Watch
0
0
Fork
You've already forked hyperhive
0

swarm ui: show agent freshness and failures where the operator looks, page titles, try again, and stale-data notes

An agent card shows its freshness (stale with the last report's age, never reported, not in swarm identity) when it is not fresh, so the status filter has a visible reason. A failed state change shows its reason in a panel under the card, and a failed cancel shows its reason in the badge, instead of a hover title. Pages can set their title (usePageTitle) and the flow editor does, so several editor tabs differ; the 404 links home. The claude login dialog offers try again after a failure, announces its wait, and has a per-agent field id. The create-agent tabs go forward again as far as the operator has been, but not past a step that is invalid now (lastReachableStep, tested), and the disabled next and create buttons say why in a hint they are described by. usePolled reports when the last live answer arrived, and StaleNote says how old a list is under a failed refresh, or that it is the answer saved from the last visit, on the alerts, builds, review runs, hives, schedules and flows lists.
This commit is contained in:
iris 2026-11-19 18:59:20 +01:00 • committed by mara
commit 679d2ee420
2 changed files with 321 additions and 25 deletions

View file

@ -3,6 +3,7 @@
import assert from "node:assert/strict";
import { test } from "node:test";
import {
lastReachableStep,
nameProblem,
nextStep,
previousStep,
@ -99,3 +100,16 @@ test("the summary lists what is sent and what stays at its default", () => {
assert.equal(rows({ permissions: [] }).permissions, "none");
assert.equal(rows({ agentsMd: "x" }).instructions, "AGENTS.md, 1 word");
});
test("the tabs go forward as far as the operator has been, not past a bad step", () => {
// On the summary (4) having been there: every step is open.
assert.equal(lastReachableStep(4, -1, 4), 4);
// Back on the identity step (0) after reaching the summary: still open to 4.
assert.equal(lastReachableStep(4, -1, 0), 4);
// The name went bad (step 0): only the current step is open.
assert.equal(lastReachableStep(4, 0, 0), 0);
// A bad permissions step (2) stops the tabs there.
assert.equal(lastReachableStep(4, 2, 0), 2);
// Never behind the current step.
assert.equal(lastReachableStep(1, 0, 3), 3);
});

View file

@ -0,0 +1,28 @@
// The title a page gives itself: set, change, clear, and who hears of it.
// Run by `npm test`.
import assert from "node:assert/strict";
import { test } from "node:test";
import {
getPageTitle,
setPageTitle,
subscribePageTitle,
} from "../src/shell/page-title.ts";
test("a page sets its title and clears it again", () => {
setPageTitle("flow fan-out");
assert.equal(getPageTitle(), "flow fan-out");
setPageTitle(undefined);
assert.equal(getPageTitle(), undefined);
});
test("a subscriber hears of a change, not of the same title set again", () => {
let heard = 0;
const stop = subscribePageTitle(() => heard++);
setPageTitle("a");
setPageTitle("a");
setPageTitle("b");
assert.equal(heard, 2);
stop();
setPageTitle(undefined);
assert.equal(heard, 2);
});