web: run pipelines from the browser and quiet background chat

Add the Run pipeline dialog with prompt, server directory and a per-run
notification choice; add --notify auto/on/off to run and retry; move the live
tool call onto the tool-count line and tick the reasoning duration; stop chat
frames from repainting a different screen.
This commit is contained in:
2026-10-20 12:56:47 +01:00
parent f7a3a49f94
commit 0d7e81362f
17 changed files with 428 additions and 80 deletions
+3
View File
@@ -165,6 +165,9 @@ to it, but the server never lists it and a reload drops it.
| B2 | Pipeline list mini graph | `list_pipelines` (`shape`) | done — each summary now carries the current version's parsed graph as `shape`; the browser draws a label-free miniature from the real `layoutGraph` with terminal-free stage routes. The row shows the name, the shape and only `{N stages}`; the cryptic `id {n} · v{n} · …` line is gone. Verified at 390×844 against the live server: 9 rows, 9 miniatures, and the detail still owns the full Graph tab. Additive field; older clients ignore it. |
| B3 | Equal phone dock cells | — | done — the narrow dock is a four-cell grid (one cell per destination plus Search) with a subgrid for the tablist, so every control has the same width and height. At 390×844 the measured widths are 92/92/92/92 and the row is 48px high. The phone shell uses `100svh` so a browser toolbar cannot hide the tab row while leaving only the Connected/Settings status row visible. |
| B4 | Full-height pipeline Source | — | done — the Source block no longer caps itself at `60vh`; it is as tall as its content and the detail pane owns the scroll. Verified at 390×844: a 4386px definition sits in the full pane (656px viewport) and scrolls. |
| B14 | Run a pipeline from the web | `run_pipeline` | done — the pipeline detail has a Run action that opens a dialog with the prompt, an absolute server working-directory field with recent-directory suggestions, and a per-run notification choice (pipeline default / notify / silent). The request carries `pipeline_id`, the pinned version, a fresh request key, `workspace`, `input.prompt` and `notify_mode` only when overriding. A live probe started a real run from the dialog with `notify_mode=off` and the server stored that mode; the run was canceled. |
| B15 | Per-run notification override | `notify_mode` | done — `pipelines run --notify auto\|on\|off` (and the same option on retry) records the override with the run. Off suppresses both stage policies and run-level waiting/failed alerts; auto follows the definition; on keeps run-level attention. The mode is stored in `pipeline_runs`, reloaded after a restart, and inherited by a retry unless overridden. |
| B16 | One live status line for tools | — | done — the current tool call now shares the `N tools called` line; the separate bottom per-tool line is gone and the lower indicator appears only while no tool is running. The live reasoning label's duration ticks every second without waiting for a frame. Chat frames for a background session no longer repaint a Runs/Pipelines screen: verified a synthetic stream while opening run 12's detail left the run screen interactive with no per-frame replacements. |
| B13 | Codex chat backend | `chat_backends`, `chat_create.backend` | done — OpenCode stays the default. `chat_backends` lists `codex` when the Codex App Server control socket is present; New chat shows a harness choice, the selected backend is stored on the operator-session row and echoed on every session. The Codex adapter connects to the existing App Server over its Unix WebSocket, maps `thread/start`, `turn/start`, `thread/read`, item/tool events, `item/tool/requestUserInput` to the existing question card, and carries the native user-message id so optimistic and history turns reconcile. Verified live: created a Codex chat from the browser, sent a prompt, saw the streamed answer, read it back through `chat_messages`, and saw the Codex chip and title in the list. Claude is not advertised yet: its OAuth session is expired and the SDK/CLI sidecar is still to be built. |
| B12 | One detail header, optimistic sends, thinking above the bubble | — | done — every non-chat detail (pipeline, run, template) now extracts its own `#detailTitle` into a shared `.detail-head` with the same 44px chevron Back control; on phones the button and title are vertically centred, and on wide screens the back control is hidden while the title stays in the header. Chat/create already use the same control. Sending now appends the operator's optimistic user turn immediately (using the native message id OpenCode persists), so the running placeholder cannot appear before their message. While a turn runs, Send stays present beside Stop; a follow-up is queued. The reasoning/thinking block moved outside and above the answer bubble, like the tool summary below it. |
| B11 | Enter composes; live shell bars stay in place | — | done — Enter now inserts a newline (a real CDP Enter produced `first\n` and no prompt), while Ctrl/Cmd+Enter sends; a slash draft still runs its command on Enter. The chat star reserves a 26px corner in the row head, so it no longer covers Streaming/New/Idle. Background-shell frames patch the tasks bar in place instead of full-rendering the pane, keeping the composer mounted. The shell cache was bumped to v2 so an installed PWA picks up these client changes. |
+19
View File
@@ -965,3 +965,22 @@
text-transform: uppercase;
letter-spacing: 0.04em;
}
/* The current tool call shares the count line. It is the one live element on
that row, so tool handoffs do not add or remove a second status line. */
.chat-tool-chip {
display: inline-flex;
align-items: center;
gap: 4px;
max-width: 100%;
min-width: 0;
text-align: left;
}
.chat-tool-current {
min-width: 0;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
color: var(--muted);
font-weight: var(--weight-regular);
}
+23
View File
@@ -671,3 +671,26 @@
border-radius: var(--radius-card);
background: var(--color-bg);
}
/* Run pipeline dialog: prompt, server working directory and per-run notify. */
.pipeline-actions { display: flex; gap: 8px; margin: 2px 0 12px; }
.run-start-dialog .confirm-panel {
width: min(560px, calc(100vw - 32px));
max-height: calc(100dvh - 32px);
overflow-y: auto;
}
.run-start-field { display: grid; gap: 6px; margin-top: 12px; }
.run-start-label { font-size: 12px; color: var(--color-muted); }
.run-start-prompt {
width: 100%;
min-height: 120px;
padding: 10px 12px;
resize: vertical;
background: var(--color-surface-2);
color: var(--color-text);
border: 1px solid var(--color-border);
border-radius: var(--radius-control);
font: inherit;
}
.run-start-helper { font-size: 12px; }
.run-start-error { margin-top: 8px; color: var(--color-bad); font-size: 12px; }
+3
View File
@@ -176,6 +176,9 @@ const state = {
pipelineGraph: null,
// Expanded by default; a collapse is remembered (graphPrefs.js).
pipelineGraphExpanded: readGraphExpanded(),
// The Run pipeline dialog: pipeline/version, prompt, working directory,
// notification mode and its loading/error state.
runStart: null,
// Gallery or list for run artifacts; a per-operator choice (artifactViewPrefs.js).
artifactView: readArtifactView(),
// Starred chat sessions: filled from chat_sessions (server-shared).
+1
View File
@@ -46,6 +46,7 @@ export const Protocol = Object.freeze({
// The run-level operator actions (R11–R14). Each replies with a `run` (or
// `run_started` for retry) envelope carrying the updated run detail; mirrors
// internal/protocol/runs.go and Message.kt.
RUN_PIPELINE: "run_pipeline",
CANCEL_RUN: "cancel_run",
RETRY_RUN: "retry_run",
DECIDE_RUN: "decide_run",
+23
View File
@@ -181,6 +181,29 @@ export class PipelinesRepository {
}
/** Cancels a run; mirrors PipelinesRepository.cancelRun (exactly run_id). */
/**
* Starts a fresh run of one pipeline version. `notifyMode` is auto, on or off;
* auto omits the field so the pipeline definition applies.
*/
async runPipeline({ pipelineId, version, prompt, workspace, notifyMode = "auto", title = "" } = {}) {
const request = {
type: Protocol.RUN_PIPELINE,
pipeline_id: Number(pipelineId),
version: Number(version),
request_key: newChatOperationId(),
workspace: String(workspace ?? "").trim(),
input: { prompt: String(prompt ?? "") },
};
if (String(title ?? "").trim() !== "") request.title = String(title).trim();
const mode = String(notifyMode ?? "auto").trim().toLowerCase();
if (mode === "on" || mode === "off") request.notify_mode = mode;
const response = await this.#client.call(request);
if (!response.run_detail) {
throw new ProtocolError("The server returned no run detail.");
}
return response.run_detail;
}
async cancelRun(id) {
const response = await this.#client.call({ type: Protocol.CANCEL_RUN, run_id: id });
if (!response.run_detail) {
+46 -49
View File
@@ -685,6 +685,10 @@ let chatRenderMode = null;
* scroller and leave the composer DOM untouched.
*/
function scheduleChatRender(mode = "full") {
// A background chat must never repaint the screen the operator is using.
// Folding its frames into state is enough; the chat list/detail paint when the
// operator returns to Chat.
if (state.view !== "chat") return;
if (mode === "full" || chatRenderMode == null) chatRenderMode = mode === "full" ? "full" : chatRenderMode ?? "transcript";
if (chatRenderScheduled) return;
chatRenderScheduled = true;
@@ -692,6 +696,7 @@ function scheduleChatRender(mode = "full") {
chatRenderScheduled = false;
const chosen = chatRenderMode;
chatRenderMode = null;
if (state.view !== "chat") return;
if (chosen === "transcript" && refreshChatTranscript(state.chatActiveId)) return;
renderContent();
};
@@ -768,7 +773,7 @@ function onChatEvent(frame) {
const historySyncTimers = new Map();
const historySyncedFor = new Map();
function scheduleHistorySync(sessionId, messageId) {
if (!messageId || sessionId !== state.chatActiveId) return;
if (!messageId || state.view !== "chat" || sessionId !== state.chatActiveId) return;
if (historySyncedFor.get(sessionId) === messageId) return;
historySyncedFor.set(sessionId, messageId);
if (historySyncTimers.has(sessionId)) return;
@@ -812,7 +817,7 @@ function onChatPermission(frame) {
next.permissionError = "";
}
state.chatThreads.set(sessionId, next);
if (sessionId === state.chatActiveId) scheduleChatRender();
if (state.view === "chat" && sessionId === state.chatActiveId) scheduleChatRender();
}
/**
@@ -1331,7 +1336,7 @@ function onChatFrame(message) {
const running = runningAfterFrame(thread.running, frame);
if (queued === thread.queued && running === thread.running) return;
setThread(sessionId, { queued, running });
if (sessionId === state.chatActiveId) {
if (state.view === "chat" && sessionId === state.chatActiveId) {
refreshChatComposerState(sessionId);
scheduleChatRender("transcript");
}
@@ -2539,13 +2544,15 @@ function renderChatTranscript(
else {
const streaming = running && index === lastAgent;
const elapsed = (part) => threadToolElapsedMillis(thread, part, now);
transcript.append(renderChatAgentTurn(row.turn, streaming, elapsed));
transcript.append(renderChatAgentTurn(row.turn, streaming, elapsed, thread));
}
});
// The running indicator sits under the transcript, after the last agent turn:
// a spinner, the phase headline, the turn's elapsed, then one line per running
// tool (a call over 60 s is tinted and marked `· long`).
if (running && thread) transcript.append(renderChatRunningIndicator(thread, now));
if (running && thread && threadRunningTools(thread.messages).length === 0) {
transcript.append(renderChatRunningIndicator(thread, now));
}
// The conversation's local command lines sit after the turns, full width and
// deliberately unlike a message bubble (see ChatCommandNoticeItem).
for (const notice of notices) transcript.append(renderChatCommandNotice(sessionId, notice));
@@ -2823,26 +2830,6 @@ function renderChatRunningIndicator(thread, now) {
}),
);
wrap.append(head);
// One stable detail line for the whole turn. Rendering one line per in-flight
// tool made the transcript grow and shrink for every call, which bounced the
// text (and the composer) while a turn streamed. The line updates in place to
// the longest-running call; the tool chip in the turn still lists every call.
const running = threadRunningTools(thread.messages);
const chosen =
running.find((part) => toolLongRunning(threadToolElapsedMillis(thread, part, now))) ??
running[0] ??
null;
if (chosen) {
wrap.append(renderChatRunningTool(thread, chosen, now));
} else {
wrap.append(
h(
"div",
{ class: "chat-running-tool" },
h("span", { class: "chat-running-tool-text", text: "Preparing the next step…" }),
),
);
}
return wrap;
}
@@ -2885,14 +2872,14 @@ function renderChatUserMessage(message) {
}
/** One folded agent reply, left-aligned: reasoning, tool-call chip, answer. */
function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0) {
function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0, thread = null) {
const wrap = h("div", { class: "chat-turn chat-turn-agent" });
const bubble = h("div", { class: "chat-bubble agent-bubble" });
const steps = turn.reasoningSteps;
// Thinking is evidence about the turn, not part of the answer bubble. Keep it
// outside and above the message, the way the tool summary sits outside and
// below it.
if (steps.length > 0) wrap.append(renderChatReasoning(turn, streaming));
if (steps.length > 0) wrap.append(renderChatReasoning(turn, streaming, thread));
if (turn.answer.trim() !== "") bubble.append(renderMarkdown(turn.answer));
if (bubble.childElementCount > 0) wrap.append(bubble);
// The tool summary is a quiet line beside the message, not a highlighted chip
@@ -2913,9 +2900,9 @@ function renderChatAgentTurn(turn, streaming = false, elapsedMillis = () => 0) {
* `Reasoning · N steps`), a live one `Thinking…`/`Thinking · N steps`. Live
* elapsed time is C5's; this renders the parts' own timing.
*/
function renderChatReasoning(turn, streaming = false) {
function renderChatReasoning(turn, streaming = false, thread = null) {
const expanded = state.chatReasoning.has(turn.key);
const block = h("div", { class: "chat-reasoning" });
const block = h("div", { class: `chat-reasoning${streaming ? " chat-reasoning-live" : ""}` });
const toggle = h("button", {
class: "chat-reasoning-toggle",
type: "button",
@@ -2930,11 +2917,16 @@ function renderChatReasoning(turn, streaming = false) {
}),
);
const label = reasoningLabel(turn.reasoningSteps.length, streaming);
const elapsedMillis = turnElapsedMillis(turn.parts);
// A live turn has no completed timing envelope yet, so measure from the
// thread's running clock; the one-second clock refreshes this label in place.
const elapsedMillis = streaming
? threadElapsedMillis(thread, Date.now())
: turnElapsedMillis(turn.parts);
const duration = elapsedMillis == null ? null : formatDuration(Math.trunc(elapsedMillis / 1000));
toggle.append(
h("span", {
class: "chat-reasoning-label",
"data-live-steps": streaming ? String(turn.reasoningSteps.length) : null,
text: duration == null ? label : `${label} · ${duration}`,
}),
);
@@ -2986,6 +2978,7 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
"aria-expanded": "false",
"aria-haspopup": "dialog",
});
const currentTool = running ? parts.filter((part) => toolRunning(part)).at(-1) ?? null : null;
if (running) {
chip.append(h("span", { class: "spinner chat-tool-spinner", "aria-hidden": "true" }));
} else {
@@ -2998,6 +2991,19 @@ function renderChatToolCalls(turn, { streaming = false, elapsedMillis = () => 0
);
}
chip.append(h("span", { class: "chat-tool-label", text: toolCallsLabel(count) }));
// The live call lives on the same line as the count instead of in a second
// status line below the transcript. The chip therefore updates in place while
// the count and the rest of the row remain stable.
if (currentTool) {
const detail = toolDetail(currentTool);
const name = toolLabel(currentTool);
chip.append(
h("span", {
class: "chat-tool-current",
text: detail == null ? name : `${name} ${detail}`,
}),
);
}
if (long) chip.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
chip.append(
h("span", {
@@ -3754,30 +3760,21 @@ function stopChatClock() {
/** Refresh the running indicator in place from the thread's own state at [now]. */
function updateChatIndicator(now) {
const thread = state.chatActiveId ? state.chatThreads.get(state.chatActiveId) : null;
if (!thread?.running) return;
// The live reasoning label is a second continuous clock: "Thinking · N steps ·
// 1m 2s" must keep counting even when no frame arrives.
const liveReasoning = document.querySelector("#chatTranscript .chat-reasoning-live .chat-reasoning-label");
if (liveReasoning) {
const steps = Number(liveReasoning.dataset.liveSteps) || 0;
const duration = formatDuration(Math.trunc(threadElapsedMillis(thread, now) / 1000));
liveReasoning.textContent = `${reasoningLabel(steps, true)} · ${duration}`;
}
const el = document.getElementById("chatRunning");
if (!thread?.running || !el) return;
if (!el) return;
const label = el.querySelector(".chat-running-label");
if (label) label.textContent = turnPhaseLabel(threadPhase(thread, now) ?? TURN_PHASE_WAITING);
const elapsed = el.querySelector(".chat-running-elapsed");
if (elapsed) elapsed.textContent = `\u00b7 ${formatDuration(Math.trunc(threadElapsedMillis(thread, now) / 1000))}`;
const running = threadRunningTools(thread.messages);
const chosen =
running.find((part) => toolLongRunning(threadToolElapsedMillis(thread, part, now))) ??
running[0] ??
null;
const line = el.querySelector(".chat-running-tool");
if (line) {
const text = line.querySelector(".chat-running-tool-text");
if (text && chosen) text.textContent = runningToolText(chosen);
const age = chosen ? threadToolElapsedMillis(thread, chosen, now) : 0;
const toolElapsed = line.querySelector(".chat-running-tool-elapsed");
if (toolElapsed) toolElapsed.textContent = chosen ? formatToolDuration(age) : "";
const mark = line.querySelector(".chat-tool-long");
if (chosen && toolLongRunning(age) && !mark) {
line.classList.add("chat-running-tool-long");
line.append(h("span", { class: "chat-tool-long", text: "\u00b7 long" }));
}
}
}
return {
+178 -1
View File
@@ -29,10 +29,11 @@ import { statusIcon } from "../statusIcon.js";
import { writeGraphExpanded } from "../graphPrefs.js";
export function createPipelinesView(rt) {
const { state, repo } = rt;
const { state, repo, modal } = rt;
const renderContent = (...args) => rt.renderContent(...args);
const selectPipeline = (...args) => rt.selectPipeline(...args);
const pushRoute = (...args) => rt.pushRoute(...args);
const applyRoute = (...args) => rt.applyRoute(...args);
function renderPipelineList() {
@@ -374,6 +375,171 @@ function pipelineGlyph() {
return svg;
}
/** Open the Run pipeline dialog for [pipeline]. */
async function openRunDialog(pipeline) {
const pipelineId = Number(pipeline?.id) || 0;
if (pipelineId <= 0) return;
const start = {
pipelineId,
version: Number(pipeline?.version) || Number(pipeline?.latest_version) || 0,
name: String(pipeline?.name ?? ""),
prompt: "",
workspace: String(state.workspace ?? "").startsWith("/") ? state.workspace : "",
notifyMode: "auto",
directories: [],
loading: true,
sending: false,
error: "",
};
state.runStart = start;
renderContent();
try {
const directories = await repo.chatDirectories();
start.directories = Array.isArray(directories)
? directories.filter((entry) => typeof entry === "string" && entry.startsWith("/"))
: [];
} catch (error) {
start.directories = [];
start.error = describeError(error);
}
if (!start.workspace && start.directories.length) start.workspace = start.directories[0];
start.loading = false;
if (state.runStart === start) renderContent();
}
function closeRunDialog() {
state.runStart = null;
renderContent();
}
async function startRun() {
const start = state.runStart;
if (!start || start.sending) return;
const prompt = start.prompt.trim();
if (prompt === "") {
start.error = "Enter a prompt for this run.";
renderContent();
return;
}
if (!start.workspace.startsWith("/")) {
start.error = "Choose an absolute working directory on the server.";
renderContent();
return;
}
start.sending = true;
start.error = "";
renderContent();
try {
const run = await repo.runPipeline({
pipelineId: start.pipelineId,
version: start.version,
prompt,
workspace: start.workspace,
notifyMode: start.notifyMode,
title: "",
});
state.runStart = null;
await applyRoute({ kind: "run", id: run.id });
} catch (error) {
if (state.runStart !== start) return;
start.sending = false;
start.error = describeError(error);
renderContent();
}
}
function renderRunStartDialog() {
const start = state.runStart;
const overlay = h("div", {
class: "confirm-dialog run-start-dialog",
role: "dialog",
"aria-modal": "true",
"aria-label": `Run ${start.name || "pipeline"}`,
});
overlay.addEventListener("click", (event) => {
if (event.target === overlay) closeRunDialog();
});
const panel = h("div", { class: "confirm-panel" });
panel.append(h("h2", { class: "confirm-title", text: `Run ${start.name || "pipeline"}` }));
const promptField = h("label", { class: "run-start-field", for: "runPrompt" });
promptField.append(h("span", { class: "run-start-label", text: "Prompt" }));
const prompt = h("textarea", {
id: "runPrompt",
class: "run-start-prompt",
rows: "5",
placeholder: "What should this run do?",
spellcheck: "false",
oninput: (event) => { start.prompt = event.target.value; },
});
prompt.value = start.prompt;
promptField.append(prompt);
panel.append(promptField);
const listId = "runWorkspaceChoices";
const datalist = h("datalist", { id: listId });
for (const directory of start.directories) datalist.append(h("option", { value: directory }));
const workField = h("label", { class: "run-start-field", for: "runWorkspace" });
workField.append(h("span", { class: "run-start-label", text: "Working directory (on the server)" }));
const work = h("input", {
id: "runWorkspace",
type: "text",
list: listId,
value: start.workspace,
spellcheck: "false",
autocomplete: "off",
placeholder: "/absolute/path/on/the/server",
oninput: (event) => { start.workspace = event.target.value; },
});
workField.append(work, datalist);
workField.append(h("span", { class: "run-start-helper muted", text: "Choose a recent directory or type an absolute path." }));
panel.append(workField);
const notifyField = h("label", { class: "run-start-field", for: "runNotify" });
notifyField.append(h("span", { class: "run-start-label", text: "Notifications for this run" }));
const notify = h("select", { id: "runNotify", onchange: (event) => { start.notifyMode = event.target.value; } });
for (const [value, label] of [
["auto", "Pipeline default"],
["on", "Notify me"],
["off", "Silent"],
]) {
const option = h("option", { value, text: label });
option.selected = start.notifyMode === value;
notify.append(option);
}
notifyField.append(notify);
panel.append(notifyField);
if (start.loading) panel.append(h("div", { class: "run-start-helper muted", text: "Loading directories…" }));
if (start.error) panel.append(h("div", { class: "run-start-error", role: "alert", text: start.error }));
const actions = h("div", { class: "confirm-actions" });
actions.append(
h("button", {
class: "ghost run-start-cancel",
type: "button",
text: "Cancel",
disabled: start.sending,
onclick: closeRunDialog,
}),
h("button", {
class: "primary run-start-confirm",
type: "button",
text: start.sending ? "Starting…" : "Run",
disabled: start.sending,
onclick: startRun,
}),
);
panel.append(actions);
overlay.append(panel);
modal.stage("run-start", overlay, {
onClose: closeRunDialog,
triggerSelector: ".run-pipeline",
fallbackSelectors: ["#detailTitle", "#pane-main"],
});
return overlay;
}
function renderPipelineDetail() {
const d = state.pipelineDetail;
const pane = h("div", { class: "detail" });
@@ -382,6 +548,16 @@ function renderPipelineDetail() {
return pane;
}
pane.append(h("h1", { class: "detail-title", id: "detailTitle", tabindex: "-1", text: d.name || `pipeline ${d.id}` }));
pane.append(
h("div", { class: "pipeline-actions" },
h("button", {
class: "primary run-pipeline",
type: "button",
text: "Run",
onclick: () => openRunDialog(d),
}),
),
);
if (state.pipelineTab === "graph") {
pane.append(h("p", { class: "graph-note muted", text: graphNote() }));
const stages = d.graph?.stages ?? [];
@@ -466,6 +642,7 @@ function renderPipelineDetail() {
}
pane.append(body);
}
if (state.runStart) pane.append(renderRunStartDialog());
return pane;
}
+24 -16
View File
@@ -6241,20 +6241,23 @@ try {
"the running tool",
);
await new Promise((resolve) => setTimeout(resolve, 1300));
const runningIndicator = await indicator();
const runningChip = await page.evaluate(`(() => {
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
return {
current: chip?.querySelector(".chat-tool-current")?.textContent ?? "",
spinner: !!chip?.querySelector(".chat-tool-spinner"),
indicator: !!document.querySelector("#chatRunning"),
};
})()`);
if (
!runningIndicator ||
!runningIndicator.spinner ||
runningIndicator.label !== "Running a tool…" ||
!/^· \d/.test(runningIndicator.elapsed) ||
runningIndicator.tools.length < 1
!runningChip.spinner ||
!runningChip.current.includes("shell") ||
!runningChip.current.includes("npm run build") ||
runningChip.indicator
) {
throw new Error(`C5: the running indicator is wrong: ${JSON.stringify(runningIndicator)}`);
throw new Error(`C5: the current-tool chip is wrong: ${JSON.stringify(runningChip)}`);
}
console.log(
` running indicator: spinner=${runningIndicator.spinner}, "${runningIndicator.label}", "${runningIndicator.elapsed}", ` +
`${runningIndicator.tools.length} running-tool line(s) — "${runningIndicator.tools[0].text}"`,
);
console.log(` current tool on the count line: "${runningChip.current}" (no second indicator)`);
await shot("57-chat-running.png");
// 3. A second running tool that started 61 s ago (protocol `time.ran`): the
@@ -6276,13 +6279,18 @@ try {
],
"the long-running tool",
);
const longCall = await indicator();
const longLine = longCall?.tools.find((line) => line.long !== "");
if (!longLine || !longLine.longTinted || !longLine.long.includes("long")) {
throw new Error(`C5: no tinted long-running tool line: ${JSON.stringify(longCall)}`);
const longCall = await page.evaluate(`(() => {
const chip = document.querySelector("#chatTranscript .chat-tool-chip");
return {
current: chip?.querySelector(".chat-tool-current")?.textContent ?? "",
long: chip?.querySelector(".chat-tool-long")?.textContent ?? "",
};
})()`);
if (!longCall.current.includes("npm run long") || !longCall.long.includes("long")) {
throw new Error(`C5: the long-running tool is not on the count line: ${JSON.stringify(longCall)}`);
}
const agentsWithTwoIds = await agentCount();
console.log(` long-call line: "${longLine.text}${longLine.long}" tinted=${longLine.longTinted}`);
console.log(` long-call chip: "${longCall.current}${longCall.long}"`);
if (agentsWithTwoIds - agentBefore > 1) {
throw new Error(`C5: two assistant message ids fragmented the live turn into ${agentsWithTwoIds} bubbles`);
}