diff --git a/web/PARITY.md b/web/PARITY.md index dbf8b6e8..c2136c8d 100644 --- a/web/PARITY.md +++ b/web/PARITY.md @@ -8,6 +8,21 @@ test, or a code change without a capture, is `partial` at best. Status legend: `todo` · `partial` (some of it works) · `done` (working + captured). +### Tool summary error scope (2026-10-20) + +The aggregate **N tools** label stays neutral and borderless even when a call +fails. Only the separate **· N errors** count is red; individual failed calls +remain marked inside the tool popup. Keyboard focus keeps its accessible focus +ring. This is an intentional browser presentation correction, not a protocol or +Android change. + +`test/tool-summary-browser.mjs` verifies 82 calls with zero, one and two errors +at 390/1100px, neutral aggregate color, transparent border, no resting outline, +correct accessible error counts, and exactly one failed row among 82 popup rows. +Captures are in the approved OpenCode temporary `tool-summary-captures/` +directory. Fixture-only browser evidence; no live chat/session was changed. +Shell cache v10 refreshes the changed modules on reload. + ### Generic alpha starters (2026-10-20) The embedded catalogue now presents small code change/review, research/fact-check, diff --git a/web/chat.css b/web/chat.css index c09ea5d1..1f4298c3 100644 --- a/web/chat.css +++ b/web/chat.css @@ -550,7 +550,7 @@ outline: 2px solid var(--accent); outline-offset: 1px; } -.chat-tool-chip-failed { border-color: var(--bad); color: var(--bad); } +.chat-tool-error-count { color: var(--bad); } .chat-tool-icon { font-size: 12px; line-height: 1; } .chat-tool-icon-failed { color: var(--bad); } .chat-tool-long { color: var(--bad); } diff --git a/web/src/chat.js b/web/src/chat.js index f90f3463..9f4a284c 100644 --- a/web/src/chat.js +++ b/web/src/chat.js @@ -235,6 +235,11 @@ export function toolCallCount(parts) { return (parts ?? []).filter((part) => part?.type === PART_TOOL).length; } +/** Errors belong to individual calls, not the entire turn's tool total. */ +export function toolFailureCount(parts) { + return (parts ?? []).filter((part) => part?.type === PART_TOOL && toolFailed(part.state)).length; +} + /** True while any tool call in [parts] is still in flight. */ export function toolsRunning(parts) { return (parts ?? []).some((part) => toolRunning(part)); diff --git a/web/src/views/chat.js b/web/src/views/chat.js index a4a3594e..8628751e 100644 --- a/web/src/views/chat.js +++ b/web/src/views/chat.js @@ -163,7 +163,7 @@ import { toolCallsAnnouncement, toolCallsLabel, toolDetail, - toolFailed, + toolFailureCount, toolLabel, toolLongRunning, toolRunning, @@ -3517,24 +3517,26 @@ function renderChatToolChip(turn, { streaming = false, elapsedMillis = () => 0 } if (parts.length === 0) return null; const count = toolCallCount(turn.parts); const running = streaming && toolsRunning(turn.parts); - const failed = parts.some((part) => toolFailed(part.state)); + const errors = toolFailureCount(turn.parts); + const errorLabel = errors === 1 ? "1 error" : `${errors} errors`; const long = running && parts.some((part) => toolRunning(part) && toolLongRunning(elapsedMillis(part))); const chip = h("button", { - class: `chip chat-tool-chip${failed ? " chat-tool-chip-failed" : ""}`, + class: "chat-tool-chip", type: "button", - "aria-label": toolCallsAnnouncement(count), + "aria-label": `${toolCallsAnnouncement(count)}${errors ? `, ${errorLabel}` : ""}`, "aria-expanded": "false", "aria-haspopup": "dialog", }); const currentTool = running ? parts.filter((part) => toolRunning(part)).at(-1) ?? null : null; chip.append( h("span", { - class: `chat-tool-icon${failed ? " chat-tool-icon-failed" : ""}`, + class: "chat-tool-icon", "aria-hidden": "true", - text: failed ? "\u26a0" : "\u29c9", + text: "\u29c9", }), ); chip.append(h("span", { class: "chat-tool-label", text: toolCallsLabel(count) })); + if (errors) chip.append(h("span", { class: "chat-tool-error-count", text: `· ${errorLabel}` })); if (currentTool) { const detail = toolDetail(currentTool); const name = toolLabel(currentTool); diff --git a/web/sw.js b/web/sw.js index 872442bd..d3554c45 100644 --- a/web/sw.js +++ b/web/sw.js @@ -1,7 +1,7 @@ // A shell cache for an installed Pipelines app. The API (the WebSocket proxy and // artifact files) is never cached; static files prefer the network and fall back // to the last good copy so an installed app still opens when the server is away. -const CACHE = "pipelines-shell-v9"; +const CACHE = "pipelines-shell-v10"; const SHELL = ["/", "/index.html", "/manifest.webmanifest", "/favicon.svg"]; self.addEventListener("install", (event) => { diff --git a/web/test/serviceWorker.test.mjs b/web/test/serviceWorker.test.mjs index 755f7a66..f123549a 100644 --- a/web/test/serviceWorker.test.mjs +++ b/web/test/serviceWorker.test.mjs @@ -9,9 +9,9 @@ test("shell updates retain unrelated caches and the current app cache", async () let activation; vm.runInNewContext(await readFile(new URL("../sw.js", import.meta.url), "utf8"), { self: { addEventListener: (type, handler) => handlers.set(type, handler), clients: { claim: async () => {} } }, - caches: { keys: async () => ["pipelines-shell-v8", "pipelines-shell-v9", "unrelated-user-cache"], delete: async (key) => deleted.push(key) }, + caches: { keys: async () => ["pipelines-shell-v9", "pipelines-shell-v10", "unrelated-user-cache"], delete: async (key) => deleted.push(key) }, }); handlers.get("activate")({ waitUntil: (promise) => { activation = promise; } }); await activation; - assert.deepEqual(deleted, ["pipelines-shell-v8"]); + assert.deepEqual(deleted, ["pipelines-shell-v9"]); }); diff --git a/web/test/tool-summary-browser.mjs b/web/test/tool-summary-browser.mjs new file mode 100644 index 00000000..f48ea832 --- /dev/null +++ b/web/test/tool-summary-browser.mjs @@ -0,0 +1,74 @@ +// Scratch-only chat rendering: no provider, backend, or production sessions. +import assert from "node:assert/strict"; +import { createServer } from "node:http"; +import { readFile, mkdir } from "node:fs/promises"; +import { resolve, extname, dirname } from "node:path"; +import { fileURLToPath } from "node:url"; +import { launchChrome } from "./browser.mjs"; + +const root = resolve(dirname(fileURLToPath(import.meta.url)), ".."); +const out = resolve(process.argv[2] ?? "captures-tool-summary"); +await mkdir(out, { recursive: true }); +const html = ` +${["design/tokens/tokens","base","shell","lists","run-detail","chat","dialogs"].map(n=>``).join("")} +