web: one status glyph, a compact settings button and collapsible panes

- Run and pipeline rows use one coloured status glyph with the word in its
  tooltip; the run version sits at the right of the title line; the usage
  metrics row is gone.
- Settings is an icon beside the connection status (rail and dock), not a
  destination tab; the destinations keep a roving tab even while Settings is
  open.
- The rail and every list pane collapse to a narrow strip from an icon at their
  top-right (remembered per device). A collapsed runs list shows the status
  glyph, pipelines their flow glyph, chats their status word.
- Tool calls open in a modal (rendered/expanded rows in place) instead of an
  inline popover; the chip stays a quiet line beside the message.
- Refresh tooltips show the last data arrival (manual or socket) per
  destination.
This commit is contained in:
2026-10-20 01:36:38 +01:00
parent 9a450e0ebb
commit 3314f8405b
11 changed files with 488 additions and 118 deletions
+33
View File
@@ -0,0 +1,33 @@
// The rail/list collapse choices are a local layout preference.
import { test } from "node:test";
import assert from "node:assert/strict";
import { LAYOUT_KEY, readLayoutPrefs, writeLayoutPrefs } from "../src/layoutPrefs.js";
function fakeStorage(initial = {}) {
const values = new Map(Object.entries(initial));
return {
getItem: (key) => (values.has(key) ? values.get(key) : null),
setItem: (key, value) => values.set(key, String(value)),
values,
};
}
test("both panes are expanded when nothing was stored", () => {
assert.deepEqual(readLayoutPrefs(fakeStorage()), { railCollapsed: false, listCollapsed: false });
});
test("the two choices survive a write and read independently", () => {
const storage = fakeStorage();
writeLayoutPrefs({ railCollapsed: true, listCollapsed: false }, storage);
assert.deepEqual(readLayoutPrefs(storage), { railCollapsed: true, listCollapsed: false });
assert.ok(storage.values.get(LAYOUT_KEY).includes("railCollapsed"));
});
test("malformed storage and failures fall back to expanded", () => {
assert.deepEqual(readLayoutPrefs(fakeStorage({ [LAYOUT_KEY]: "{oops" })), {
railCollapsed: false,
listCollapsed: false,
});
const broken = { getItem() { throw new Error("denied"); }, setItem() { throw new Error("denied"); } };
assert.doesNotThrow(() => writeLayoutPrefs({ railCollapsed: true }, broken));
});
+34 -38
View File
@@ -186,7 +186,7 @@ async function ensureConnected(timeout = 25000) {
async function clickDestination(label) {
const key = label.toLowerCase();
const done = await page.evaluate(`(() => {
const all = [...document.querySelectorAll('[data-destination="${key}"]')];
const all = [...document.querySelectorAll('[data-destination="${key}"], [data-settings-destination="${key}"]')];
const el = all.find((node) => node.offsetParent !== null) ?? all[0];
if (!el) return false;
el.click();
@@ -288,6 +288,7 @@ async function shellState() {
dock: dock && visible(dock) ? { top: Math.round(dock.getBoundingClientRect().top) } : null,
detailTitle: document.querySelector("#detailTitle")?.textContent.trim() ?? "",
activeDestination: document.querySelector('[data-destination][aria-selected="true"]')?.getAttribute("data-destination") ?? "",
settingsActive: !!document.querySelector('[data-settings-destination="settings"][aria-current="page"]'),
focus: document.activeElement?.id ?? document.activeElement?.className ?? "",
};
})()`);
@@ -300,11 +301,11 @@ function assertShell(label, state, { wide }) {
}
if (wide) {
if (!state.railVisible || state.dockVisible) throw new Error(`${label}: expected the rail and no dock`);
if (state.railTabCount !== 4) throw new Error(`${label}: rail has ${state.railTabCount} tabs`);
if (state.railTabCount !== 3) throw new Error(`${label}: rail has ${state.railTabCount} tabs`);
if (!state.searchInRail) throw new Error(`${label}: no Search control in the rail`);
} else {
if (state.railVisible || !state.dockVisible) throw new Error(`${label}: expected the dock and no rail`);
if (state.dockTabCount !== 4) throw new Error(`${label}: dock has ${state.dockTabCount} tabs`);
if (state.dockTabCount !== 3) throw new Error(`${label}: dock has ${state.dockTabCount} tabs`);
if (!state.searchInDock) throw new Error(`${label}: no Search control in the dock`);
}
const { scrollHeight, innerHeight, scrollWidth, innerWidth } = state.page;
@@ -318,7 +319,11 @@ function assertShell(label, state, { wide }) {
for (const list of state.tablists) {
const selected = list.tabs.filter((tab) => tab.selected === "true");
const zero = list.tabs.filter((tab) => tab.tabindex === "0");
if (selected.length !== 1) throw new Error(`${label}: ${list.label} has ${selected.length} selected tabs`);
// Settings is not a destination tab; while it is open the rail has none.
const settingsRail = list.label === "Destinations" && state.settingsActive;
if (selected.length !== 1 && !(settingsRail && selected.length === 0)) {
throw new Error(`${label}: ${list.label} has ${selected.length} selected tabs`);
}
if (zero.length !== 1) throw new Error(`${label}: ${list.label} has ${zero.length} tabindex=0 tabs`);
for (const tab of list.tabs) {
if (!tab.controls || !tab.controlExists) {
@@ -327,8 +332,10 @@ function assertShell(label, state, { wide }) {
}
}
const destinations = state.tablists.find((list) => list.tabs.some((tab) => tab.current === "page"));
if (!destinations) throw new Error(`${label}: no destination carries aria-current=page`);
if (!destinations.tabs.some((tab) => tab.label && tab.selected === "true")) {
if (!destinations && !state.settingsActive) {
throw new Error(`${label}: no destination carries aria-current=page`);
}
if (destinations && !destinations.tabs.some((tab) => tab.label && tab.selected === "true")) {
throw new Error(`${label}: no destination tab is selected`);
}
}
@@ -415,8 +422,8 @@ async function runShellChecks() {
if (typeAndNumbers.titleOverflow !== "hidden" || typeAndNumbers.titleEllipsis !== "ellipsis") {
throw new Error(`run names are not ellipsized: ${JSON.stringify(typeAndNumbers)}`);
}
if (!typeAndNumbers.metricNumeric.includes("tabular-nums") || !typeAndNumbers.metaNumeric.includes("tabular-nums")) {
throw new Error(`counts/durations are not tabular: ${JSON.stringify(typeAndNumbers)}`);
if (!typeAndNumbers.metaNumeric.includes("tabular-nums")) {
throw new Error(`durations are not tabular: ${JSON.stringify(typeAndNumbers)}`);
}
await shot("80-shell-wide-runs-1440x900.png");
console.log(` wide runs: list ${state.listScrollers} / detail ${state.detailScrollers}`);
@@ -561,8 +568,9 @@ async function runShellChecks() {
focus: document.activeElement?.id ?? "",
title: document.querySelector("#detailTitle")?.textContent ?? "",
current: document.querySelector('[data-destination][aria-selected="true"]')?.getAttribute("data-destination") ?? "",
settingsCurrent: !!document.querySelector('[data-settings-destination="settings"][aria-current="page"]'),
})`);
if (statusShortcut.focus !== "detailTitle" || statusShortcut.title !== "Settings" || statusShortcut.current !== "settings") {
if (statusShortcut.focus !== "detailTitle" || statusShortcut.title !== "Settings" || !statusShortcut.settingsCurrent) {
throw new Error(`status shortcut did not land on Settings: ${JSON.stringify(statusShortcut)}`);
}
await page.evaluate(`document.querySelector("#shellStatus").focus()`);
@@ -2404,7 +2412,7 @@ try {
if (!noDetails.emptyAfterUnmount) throw new Error("unmount left the graph DOM behind");
console.log(" a node with no stage reads: No details recorded for this node.");
step("switching to Runs: day-grouped list + usage roll-up");
step("switching to Runs: the day-grouped list");
await ensureConnected();
await clickDestination("Runs");
await eventually(
@@ -2414,13 +2422,6 @@ try {
),
{ timeout: 25000, what: "the runs list" },
);
await page.waitForSelector(".metrics .metric", { timeout: 25000 });
const usageLabels = await page.evaluate(
`[...document.querySelectorAll(".metrics .metric-label")].map((n) => n.textContent)`,
);
for (const label of ["Total", "Succeeded", "Failed", "Canceled", "Interrupted", "Active"]) {
if (!usageLabels.includes(label)) throw new Error(`usage metric missing: ${label}`);
}
let fullDateHeader = "";
const dayHeaders = await page.evaluate(
`[...document.querySelectorAll(".list.runs .day-header")].map((n) => n.textContent)`,
@@ -2441,7 +2442,6 @@ try {
}
}
shots.push(await page.screenshot(`${out}/09-runs-day-groups.png`));
console.log(` usage: ${usageLabels.join(", ")}`);
console.log(` day headers: ${dayHeaders.slice(0, 3).join(" | ")}`);
// ---------------------------------------------------------------------
@@ -2762,7 +2762,7 @@ try {
}
await page.click("#runFilterBtn"); // close the menu so the list is unobstructed
const filteredChips = await page.evaluate(
`[...document.querySelectorAll(".list.runs .run-row .run-row-head .chip")].map((n) => n.textContent)`,
`[...document.querySelectorAll(".list.runs .run-row .run-row-head .status-icon")].map((n) => n.getAttribute("data-status"))`,
);
if (!filteredChips.length) throw new Error("the status filter produced no rows");
if (!filteredChips.every((chip) => chip === "failed")) {
@@ -3388,7 +3388,7 @@ try {
{ timeout: 30000, what: `a pushed run_event frame for run ${r10RunId}` },
);
const listStatus = await page.evaluate(
`document.querySelector('.list.runs .run-row-meta[data-run-id="${r10RunId}"]')?.closest(".run-row")?.querySelector(".chip")?.textContent ?? ""`,
`document.querySelector('.list.runs .run-row-meta[data-run-id="${r10RunId}"]')?.closest(".run-row")?.querySelector(".status-icon")?.getAttribute("data-status") ?? ""`,
);
const listBadge = await page.evaluate(
`document.querySelector(".list.runs .live-badge .live-word")?.textContent ?? ""`,
@@ -5026,7 +5026,8 @@ try {
};
})()`);
if (!chipInfo) throw new Error("C6: no tool-call chip rendered in the live transcript");
const toolCount = chipInfo.rows;
const parsedCount = Number(/(\d+)/.exec(chipInfo.text)?.[1] ?? NaN);
const toolCount = Number.isFinite(parsedCount) ? parsedCount : chipInfo.rows;
const toolLabel = toolCount === 1 ? "1 tool called" : `${toolCount} tools called`;
const toolAria =
toolCount === 1 ? "1 tool call, expand for details" : `${toolCount} tool calls, expand for details`;
@@ -5036,7 +5037,7 @@ try {
if (chipInfo.aria !== toolAria) {
throw new Error(`C6: chip aria-label ${chipInfo.aria} (expected ${toolAria})`);
}
if (chipInfo.chevron !== "Show tool calls") {
if (chipInfo.chevron !== "Open tool calls") {
throw new Error(`C6: collapsed chip chevron: ${chipInfo.chevron}`);
}
console.log(` tool chip "${toolLabel}" (aria "${chipInfo.aria}", ${toolCount} live row(s))`);
@@ -5051,23 +5052,19 @@ try {
const openedPanel = await page.evaluate(`(() => {
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
chip.click();
const panel = chip.closest(".chat-tools").querySelector(".chat-tool-panel");
const panel = document.querySelector(".chat-tools-viewer .chat-tool-panel");
return {
hidden: panel?.hidden ?? true,
head: panel?.querySelector(".chat-tool-panel-count")?.textContent ?? "",
close: panel?.querySelector(".chat-tool-close")?.getAttribute("aria-label") ?? "",
chevron: chip.querySelector(".chat-tool-chevron")?.getAttribute("aria-label") ?? "",
open: !!document.querySelector(".chat-tools-viewer"),
head: document.querySelector(".chat-tools-viewer .chat-tool-panel-count")?.textContent ?? "",
close: document.querySelector(".chat-tools-viewer .chat-tool-close")?.getAttribute("aria-label") ?? "",
rows: panel?.querySelectorAll(".chat-tool-row").length ?? 0,
};
})()`);
if (openedPanel.hidden) throw new Error("C6: the tool panel did not open");
if (!openedPanel.open) throw new Error("C6: the tool modal did not open");
if (openedPanel.head !== toolLabel) throw new Error(`C6: panel header ${openedPanel.head}`);
if (openedPanel.close !== "Close tool calls") {
throw new Error(`C6: panel close control ${openedPanel.close}`);
}
if (openedPanel.chevron !== "Hide tool calls") {
throw new Error(`C6: open chip chevron ${openedPanel.chevron}`);
}
if (openedPanel.rows !== toolCount) {
throw new Error(`C6: the panel lists ${openedPanel.rows} rows, the chip counts ${toolCount}`);
}
@@ -5085,7 +5082,7 @@ try {
// OUTPUT (the live first call is a settled `read` carrying both).
const firstToolRow = await page.evaluate(`(() => {
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
const panel = chip.closest(".chat-tools").querySelector(".chat-tool-panel");
const panel = document.querySelector(".chat-tools-viewer .chat-tool-panel");
const list = panel.querySelector(".chat-tool-list");
list.scrollTop = 0;
const first = () => panel.querySelector(".chat-tool-row-head");
@@ -5126,16 +5123,15 @@ try {
// Closing it must put the transcript back exactly where it was.
const closedPanel = await page.evaluate(`(() => {
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
const panel = chip.closest(".chat-tools").querySelector(".chat-tool-panel");
panel.querySelector(".chat-tool-close").click();
document.querySelector(".chat-tools-viewer .chat-tool-close")?.click();
return {
hidden: panel.hidden,
chevron: chip.querySelector(".chat-tool-chevron").getAttribute("aria-label"),
closed: !document.querySelector(".chat-tools-viewer"),
chevron: chip?.querySelector(".chat-tool-chevron")?.getAttribute("aria-label"),
top: Math.round(document.querySelector("#chatTranscript").scrollTop),
};
})()`);
if (!closedPanel.hidden || closedPanel.chevron !== "Show tool calls") {
throw new Error(`C6: closing the tool panel: ${JSON.stringify(closedPanel)}`);
if (!closedPanel.closed || closedPanel.chevron !== "Open tool calls") {
throw new Error(`C6: closing the tool modal: ${JSON.stringify(closedPanel)}`);
}
if (Math.abs(closedPanel.top - scrollBeforePanel) > 2) {
throw new Error(`C6: opening/closing the tool panel moved the transcript (${scrollBeforePanel} -> ${closedPanel.top})`);