Files
loki/scripts/test/agent-switch.ts
CatoandClaude Opus 5.5 62bf5f6935 feat: fixes where things fail, plain Sessions, calm alerts, even layouts (#1334)
* feat(home): every failure carries its fix; one list, no repeats

* feat(alerts): one calm row for the bell and /system — one thing to read, one thing to do

The bell put "WARNING"/"INFO" in capitals beside every title, the whole
description, a bordered "View" and a bare tick; /system put each alert in a
beige or red box holding its full text (owner, 2026-10-19: "a bunch of
text ... some are red, some are green. Very bad design").

- components/alerts/AlertList: shared by both. A dot only for urgent or
  warning; the title; the description's first paragraph in at most two
  lines, the technical record behind "Details"; when; "Dismiss" as a word;
  ONE button named for where it goes, and the whole row opens it. No button
  to the page you are already on.
- config/alert-types: an optional `action` per type ("Review", "Fix in
  Projects", "Reconnect"), else a label from the destination
  ("Get the update", "Open Home").
- The system alerts' producers now open with what is wrong and what to do,
  in plain words, with the old engineer's text kept as the record:
  runner version (and the cloud builder, which updates itself, no longer
  says "Get the update"), missing repositories, telemetry, a stalled queue,
  model ids.
- /system: a divided list in the card; the count reads "3 open · 1 urgent".
- scripts/test/alert-list-browser.ts mounts both at 390px.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* feat(sessions): open sessions in words, every other project one tap from its own

The Sessions drawer listed all 42 projects, each with one of four coloured
dots, one of six codes (ready / offline / open / closed / working / —), the
age of a database row and a git-branch icon; a tap went to Home. Owner,
2026-10-19: "what exactly do you mean by sessions? What will happen when I
click on AOZ Housing? ... super useless".

- Open now: only sessions the runner has seen open in the last ten minutes,
  each in words that say what a tap gives you (Working on <task> / Waiting
  for you / Finished — your turn / Open, nothing running). A tap attaches.
- Start in another project: plain rows with when an agent last worked there
  (its own handoff time, not the row's heartbeat), a search, Show all. A tap
  opens the project on the Sessions page, which now offers its Resume row
  instead of "Start it from Loki".
- No colour legend (one pulse for working), no branch icon, no codes.
- lib/session-list is the pure SSOT for the words; tests: session-list,
  sessions-drawer-browser.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(ui): chat starts under its header, nothing floats over the terminal, one shape for project settings

- Chat view: the thread no longer bottom-anchors (mt-auto) a short
  conversation onto the box, which left ~200px of nothing above the first
  message. Dispatch details is a centred 44px row; reply steps are one
  grouped list.
- Terminal: "Last screen · updating" was a pill over the output's first
  lines. It is a 2px edge bar now, and the header says "connecting…" until
  a live frame lands (the remembered screen no longer reports live).
- Project settings: every row is a SettingRow (what it is, its value, its
  actions), and every action one bordered 44px shape whichever control drew
  it. The phone section picker is one full-width control.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NZqZujmXpupVDC1Hi5Jbsx

* fix(projects): publish actions take the settings row's size

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-19 20:31:40 +02:00

48 lines
1.6 KiB
TypeScript

/**
* "Use … instead" on a failure: an agent the project's builder has, never the
* one that just failed (control/agent-switch.ts).
*
* Run: npx tsx scripts/test/agent-switch.ts
*/
import assert from "node:assert/strict";
import { agentToSwitchTo } from "../../src/components/control/agent-switch";
const catalog = [
{ id: "claude", label: "Claude" },
{ id: "codex", label: "Codex" },
{ id: "grok", label: "Grok" },
];
const grokMissing =
"Grok is not installed on the cloud builder, so nothing was started. Switch this project to an agent installed there, or install Grok on the cloud builder, then try again.";
assert.deepEqual(
agentToSwitchTo(
{ builderAgents: ["claude", "codex"], builderChannel: "cloud" },
grokMissing,
catalog,
),
{ id: "claude", label: "Claude" },
"the most capable agent the builder has",
);
assert.deepEqual(
agentToSwitchTo({ builderAgents: null, builderChannel: "cloud" }, grokMissing, catalog),
{ id: "claude", label: "Claude" },
"a cloud builder that has not reported still runs Claude",
);
assert.equal(
agentToSwitchTo({ builderAgents: null, builderChannel: "local" }, grokMissing, catalog),
null,
"a computer we know nothing about gets no guess",
);
assert.deepEqual(
agentToSwitchTo(
{ builderAgents: ["claude", "codex"], builderChannel: "cloud" },
"Claude is not installed on this computer, so nothing was started.",
catalog,
),
{ id: "codex", label: "Codex" },
"never the agent that just failed",
);
assert.equal(agentToSwitchTo(undefined, grokMissing, catalog), null);
console.log("✓ agent-switch: offers an agent the builder has, never the one that failed");