Files
luxe/crates/luxe-remote/app-tests/status.test.mjs
Evan Whittaker d2129a886f Luxe 0.1.3: your sessions on your phone, joinable sessions, and nested AGENTS.md
- luxe remote puts the sessions on your computer in reach of your own phone or tablet over
  Tailscale: write, steer, answer prompts, send photos, browse files, diffs and GitHub, with a
  paired device and your own Tailscale login.
- luxe join lets another program on the same machine join a running session over the RPC protocol.
- An AGENTS.md in a subfolder reaches the model the first time it works there.
- Long sessions stay fast: no stall before each model call, lighter memory, cheaper drawing.
- A session is open in one Luxe at a time, web_search shares results across its phrasings, and a
  grep glob starting with ! excludes.

The CHANGELOG has the full list.
2026-10-20 02:40:13 -05:00

40 lines
2.0 KiB
JavaScript

// The status line's facts, folded from frames, and the mode switch.
import assert from "node:assert/strict";
import { test } from "node:test";
import { createStatus, nextModeFrame } from "../app/status.js";
const frame = (kind, content) => ({ kind, content });
const model = { provider: "github-copilot", model: "claude-haiku-4.5", display_name: "Claude Haiku 4.5 (latest)" };
// The break this catches: each frame replacing the facts rather than adding to them, so a
// thinking change wipes the context reading until the next call reports it again
test("each frame updates its own facts and keeps the rest", () => {
const status = createStatus();
status.apply(frame("context_usage", { used_tokens: 9613, context_window: 200000 }));
status.apply(frame("state_changed", { model, streaming: false, mode: "plan", thinking: "high" }));
assert.deepEqual(status.facts.value, {
context: { used_tokens: 9613, context_window: 200000 },
model,
thinking: "high",
});
assert.equal(status.mode.value, "plan");
});
// The break this catches: the plan's allowance or the session's spend never reaching the host,
// so the cost slot stays empty; the spend goes as its total, which is all the line shows
test("the plan and the spend are kept for the cost slot", () => {
const status = createStatus();
const plan = { plan: "individual", primary: { used_percent: 22.3, window_minutes: 43200 } };
const total = { calls: 14, cost_usd: 0, unpriced_calls: 0, plan_usd: 0.045, plan_calls: 14 };
status.apply(frame("plan_usage", plan));
status.apply(frame("session_usage", { total, by_source: [{ source: "agent", totals: total }] }));
assert.deepEqual(status.facts.value, { plan, session: { total } });
});
// The break this catches: the mode switch sending the mode already on, so a tap does nothing
test("a tap on the mode switches to the other one", () => {
assert.deepEqual(nextModeFrame("build"), { kind: "set_mode", content: "plan" });
assert.deepEqual(nextModeFrame("plan"), { kind: "set_mode", content: "build" });
});