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
+55 -64
View File
@@ -2491,15 +2491,14 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
const running = streaming && toolsRunning(turn.parts);
const failed = parts.some((part) => toolFailed(part.state));
const long = running && parts.some((part) => toolRunning(part) && toolLongRunning(elapsedMillis(part)));
const turnKey = turn.key;
const wrap = h("div", { class: "chat-tools" });
const open = state.chatToolPanels.has(turnKey);
const chip = h("button", {
class: `chip chat-tool-chip${failed ? " chat-tool-chip-failed" : ""}`,
type: "button",
"aria-label": toolCallsAnnouncement(count),
"aria-expanded": String(open),
"aria-expanded": "false",
"aria-haspopup": "dialog",
});
if (running) {
chip.append(h("span", { class: "spinner chat-tool-spinner", "aria-hidden": "true" }));
@@ -2514,28 +2513,25 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
}
chip.append(h("span", { class: "chat-tool-label", text: toolCallsLabel(count) }));
if (long) chip.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
const chevron = h("span", {
class: "chat-tool-chevron",
role: "img",
"aria-label": open ? "Hide tool calls" : "Show tool calls",
text: open ? "\u25b4" : "\u25be",
chip.append(
h("span", {
class: "chat-tool-chevron",
role: "img",
"aria-label": "Open tool calls",
text: "\u25b8",
}),
);
chip.addEventListener("click", (event) => {
event.stopPropagation();
openChatToolCalls(turn, parts, count);
});
chip.append(chevron);
wrap.append(chip);
return wrap;
}
const panel = h("div", { class: "chat-tool-panel", role: "dialog", "aria-label": toolCallsLabel(count) });
panel.hidden = !open;
const head = h("div", { class: "chat-tool-panel-head" });
head.append(h("span", { class: "chat-tool-panel-count", text: toolCallsLabel(count) }));
const close = h("button", {
class: "ghost chat-tool-close",
type: "button",
"aria-label": "Close tool calls",
title: "Close tool calls",
text: "\u00d7",
});
head.append(close);
panel.append(head);
/** The tool list body, shared by the modal: one expandable row per call. */
function renderChatToolPanelBody(turn, parts, count) {
const panel = h("div", { class: "chat-tool-panel" });
const list = h("div", { class: "chat-tool-list" });
for (const part of parts) {
const id = String(part?.id ?? "");
@@ -2553,50 +2549,45 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
list.append(holder);
}
panel.append(list);
wrap.append(panel);
const setOpen = (next) => {
if (next) state.chatToolPanels.add(turnKey);
else state.chatToolPanels.delete(turnKey);
panel.hidden = !next;
chip.setAttribute("aria-expanded", String(next));
chevron.setAttribute("aria-label", next ? "Hide tool calls" : "Show tool calls");
chevron.textContent = next ? "\u25b4" : "\u25be";
if (next) positionChatToolPanel(panel, chip);
};
chip.addEventListener("click", (event) => {
event.stopPropagation();
setOpen(panel.hidden);
});
close.addEventListener("click", () => setOpen(false));
if (open) {
// The panel is built before its turn is attached to the document, so its
// rect is not measurable yet; place it on the next frame, when it is.
const place = () => positionChatToolPanel(panel, chip);
if (typeof requestAnimationFrame === "function") requestAnimationFrame(place);
else setTimeout(place, 0);
}
return wrap;
return panel;
}
/**
* Places the tool panel below its chip, or above it when there is no room, keeping
* it inside the viewport margins — the browser's port of
* `ToolPanelPositionProvider`. Resolved in px from the live rects, so it is
* independent of any layout guess.
*/
function positionChatToolPanel(panel, chip) {
const gap = 4;
const margin = 8;
const chipRect = chip.getBoundingClientRect();
const rect = panel.getBoundingClientRect();
let top = chipRect.bottom + gap;
if (top + rect.height > window.innerHeight - margin) top = chipRect.top - rect.height - gap;
top = Math.max(margin, Math.min(top, window.innerHeight - rect.height - margin));
const left = Math.max(margin, Math.min(chipRect.left, window.innerWidth - rect.width - margin));
panel.style.top = `${Math.round(top)}px`;
panel.style.left = `${Math.round(left)}px`;
/** Open one turn's tool calls in a modal, not an inline popover. */
function openChatToolCalls(turn, parts, count) {
const close = () => modal.close("chat-tools");
const overlay = h("div", {
class: "chat-tools-viewer",
role: "dialog",
"aria-modal": "true",
"aria-label": toolCallsLabel(count),
});
overlay.addEventListener("click", (event) => {
if (event.target === overlay) close();
});
const panel = h("div", { class: "chat-tools-modal-panel" });
panel.append(
h(
"div",
{ class: "chat-tool-panel-head" },
h("span", { class: "chat-tool-panel-count", text: toolCallsLabel(count) }),
h("button", {
class: "ghost chat-tool-close",
type: "button",
"aria-label": "Close tool calls",
title: "Close tool calls",
text: "\u00d7",
onclick: close,
}),
),
renderChatToolPanelBody(turn, parts, count),
);
overlay.append(panel);
modal.open("chat-tools", overlay, {
history: false,
onClose: close,
trigger: document.activeElement,
fallbackSelectors: ["#chatTranscript", "#detailTitle", "#pane-main"],
});
}
/**