@firstpick/pi-package-webui 0.7.2 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +38 -25
  2. package/bin/pi-webui.mjs +469 -106
  3. package/index.ts +10 -1
  4. package/lib/git-live-watcher.mjs +135 -0
  5. package/lib/git-message-artifacts.mjs +103 -0
  6. package/lib/git-workflow-preferences.mjs +10 -3
  7. package/lib/process-tree.mjs +3 -1
  8. package/lib/webui-output-mode.mjs +97 -0
  9. package/package.json +7 -6
  10. package/public/app.js +1170 -97
  11. package/public/fast-output-live.mjs +179 -0
  12. package/public/index.html +31 -5
  13. package/public/service-worker.js +2 -1
  14. package/public/styles.css +474 -12
  15. package/tests/app-runner-windows-conpty-harness.test.mjs +140 -0
  16. package/tests/danger-button-contrast-static.test.mjs +32 -0
  17. package/tests/fast-mode-client-static.test.mjs +121 -0
  18. package/tests/fast-mode-output-work.test.mjs +69 -0
  19. package/tests/fast-mode-sse-harness.test.mjs +204 -0
  20. package/tests/fast-output-live.test.mjs +106 -0
  21. package/tests/fixtures/fake-pi.mjs +59 -0
  22. package/tests/fixtures/fast-mode-output-events.mjs +50 -0
  23. package/tests/footer-middle-truncation.test.mjs +118 -0
  24. package/tests/git-live-watcher.test.mjs +93 -0
  25. package/tests/git-message-artifacts.test.mjs +59 -0
  26. package/tests/git-panel-live-updates-static.test.mjs +54 -0
  27. package/tests/git-panel-render-stability-static.test.mjs +1 -1
  28. package/tests/git-workflow-preferences.test.mjs +8 -2
  29. package/tests/guided-git-message-reliability-static.test.mjs +38 -0
  30. package/tests/http-endpoints-harness.test.mjs +61 -5
  31. package/tests/image-payload-hardening-harness.test.mjs +115 -0
  32. package/tests/mobile-static.test.mjs +79 -20
  33. package/tests/pi-footer-calibration-static.test.mjs +55 -0
  34. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  35. package/tests/runtime-error-visibility.test.mjs +63 -0
  36. package/tests/side-panel-context-menu-static.test.mjs +74 -0
  37. package/tests/webui-output-mode.test.mjs +73 -0
@@ -0,0 +1,38 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+ import path from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const testsDir = path.dirname(fileURLToPath(import.meta.url));
7
+ const packageDir = path.resolve(testsDir, "..");
8
+ const [app, server, artifacts] = await Promise.all([
9
+ readFile(path.join(packageDir, "public", "app.js"), "utf8"),
10
+ readFile(path.join(packageDir, "bin", "pi-webui.mjs"), "utf8"),
11
+ readFile(path.join(packageDir, "lib", "git-message-artifacts.mjs"), "utf8"),
12
+ ]);
13
+
14
+ assert.match(server, /async function createGitWorkflowMessageGeneration\(tab\)[\s\S]*id: randomUUID\(\)[\s\S]*baseline: await readStableGitMessageArtifactPair\(paths\)/, "commit generation must capture a server-owned ID and exact two-file baseline");
15
+ assert.match(server, /generationId: messageGeneration\?\.id \|\| ""/, "generation dispatch must return the server correlation ID");
16
+ assert.match(server, /tab\.gitWorkflowMessageGeneration = messageGeneration/, "the generation record must be owned by the originating tab");
17
+ assert.match(server, /case "\/api\/git-workflow\/message"[\s\S]*generationId[\s\S]*tab\?\.gitWorkflowMessageGeneration/, "fresh message reads must resolve the generation from the requested tab");
18
+ assert.match(server, /readGitWorkflowMessages\(cwd, \{ generationId = "", generation = null \} = \{\}\)[\s\S]*generation\.cwd !== messageCwd[\s\S]*expired: true/, "message readiness must reject wrong-ID, wrong-kind, and wrong-cwd generations");
19
+ assert.match(server, /gitMessageArtifactPairReadiness\(generation\.baseline, pair\)[\s\S]*GIT_WORKFLOW_MESSAGE_PAIR_SETTLE_MS[\s\S]*sameGitMessageArtifactPair\(pair, settledPair\)/, "the backend must require both changed artifacts and a stable settled pair");
20
+ assert.doesNotMatch(app, /newestMtime \+ 10000 < currentWorkflow\.messageRequestedAt/, "freshness must not use the previous wall-clock/mtime tolerance");
21
+
22
+ assert.match(app, /const gitWorkflowMessageLoadsByTab = new Map\(\)/, "browser message loading must have tab-scoped single-flight ownership");
23
+ assert.match(app, /messageGenerationId: ""/, "workflow state must retain the active commit-message generation ID");
24
+ assert.match(app, /const generationId = String\(generation\.generationId \|\| ""\)\.trim\(\)[\s\S]*setGitWorkflow\(\{ messageGenerationId: generationId \}/, "the browser must bind the returned generation ID before loading files");
25
+ assert.match(app, /const loadKey = `\$\{expectedRunId\}:\$\{expectedGenerationId \|\| "preview"\}`[\s\S]*existing\?\.key === loadKey[\s\S]*return existing\.promise/, "duplicate timer/resume/agent_end wakeups must reuse one poll promise");
26
+ assert.match(app, /gitWorkflowMessageLoadIsCurrent\(tabId, expectedRunId, expectedGenerationId\)/, "poll results must be guarded by tab, run, and generation identity");
27
+ assert.match(app, /GIT_WORKFLOW_MESSAGE_POLL_TIMEOUT_MS = 30_000[\s\S]*GIT_WORKFLOW_MESSAGE_POLL_DELAYS_MS/, "fresh message polling must be adaptive and bounded");
28
+ assert.match(app, /\?generationId=\$\{encodeURIComponent\(expectedGenerationId\)\}/, "fresh reads must send the correlation ID to the backend");
29
+ assert.match(app, /message\.ready === false[\s\S]*message\.expired[\s\S]*Regenerate/, "pending and expired generation states must remain actionable");
30
+ assert.match(app, /gitWorkflow\.step === "generating"[\s\S]*gitWorkflow\.messageGenerationId[\s\S]*Starting message generation…/, "the refresh action must stay disabled until the server correlation ID is bound");
31
+ assert.match(app, /requireFresh && !expectedGenerationId[\s\S]*workflow\.step === "generating"\) return;/, "early timer and agent_end wakeups must no-op during the generation-ID dispatch window");
32
+ assert.doesNotMatch(app, /loadGitWorkflowMessage\(\{ requireFresh: true, retries:/, "legacy competing retry chains must be removed");
33
+
34
+ assert.match(artifacts, /mtimeNs: String\(stats\.mtimeNs\)[\s\S]*ctimeNs: String\(stats\.ctimeNs\)[\s\S]*sha256: createHash\("sha256"\)/, "artifact snapshots must combine high-resolution metadata with a content hash");
35
+ assert.match(artifacts, /stat\(filePath, \{ bigint: true \}\)[\s\S]*readFile\(filePath\)[\s\S]*stat\(filePath, \{ bigint: true \}\)/, "artifact reads must verify stable metadata around the file read");
36
+ assert.match(artifacts, /for \(const key of \["short", "long"\]\)[\s\S]*unchanged\.push\(key\)[\s\S]*empty\.push\(key\)/, "pair readiness must independently validate both non-empty files");
37
+
38
+ console.log("guided Git message reliability static tests passed");
@@ -1,7 +1,7 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { spawn, spawnSync } from "node:child_process";
3
3
  import { createServer } from "node:http";
4
- import { chmod, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from "node:fs/promises";
4
+ import { chmod, mkdir, mkdtemp, readFile, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
5
5
  import { networkInterfaces, tmpdir } from "node:os";
6
6
  import path from "node:path";
7
7
  import { setTimeout as delay } from "node:timers/promises";
@@ -258,6 +258,15 @@ try {
258
258
  assert.equal(gzipResponse.headers.get("content-encoding"), "gzip", "styles.css should fall back to gzip");
259
259
  await gzipResponse.arrayBuffer();
260
260
 
261
+ // app.js statically imports the fast-output helper at startup. Verify the
262
+ // real server serves it so an omitted allowlist entry cannot disable the UI.
263
+ const fastOutputModuleResponse = await fetch(`http://127.0.0.1:${port}/fast-output-live.mjs`, {
264
+ signal: AbortSignal.timeout(5_000),
265
+ });
266
+ assert.equal(fastOutputModuleResponse.status, 200, "fast-output-live.mjs must be served for the Web UI entry point");
267
+ assert.match(fastOutputModuleResponse.headers.get("content-type") || "", /text\/javascript/, "fast-output-live.mjs should use a JavaScript MIME type");
268
+ assert.equal(await fastOutputModuleResponse.text(), await readFile(join(root, "public", "fast-output-live.mjs"), "utf8"), "served fast-output-live.mjs must match the source module");
269
+
261
270
  // The browser voice loop is dynamically imported by app.js; a missing static
262
271
  // allowlist entry would 404 the module and silently disable voice mode.
263
272
  const voiceModuleResponse = await fetch(`http://127.0.0.1:${port}/voice-conversation.mjs`, {
@@ -305,6 +314,39 @@ try {
305
314
  const tabId = tabList[0].id;
306
315
  assert.ok(tabId, "tab should have an id");
307
316
 
317
+ const malformedInlineImage = await request("127.0.0.1", "/api/prompt", {
318
+ method: "POST",
319
+ body: { tab: tabId, message: "malformed inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "137,80,78,71,13,10,26,10" }] },
320
+ });
321
+ assert.equal(malformedInlineImage.status, 400, "comma-separated image bytes should be rejected before RPC dispatch");
322
+ assert.match(String(malformedInlineImage.body?.error || ""), /image 1 data must be canonical base64/i);
323
+
324
+ const unpaddedInlineImage = await request("127.0.0.1", "/api/prompt", {
325
+ method: "POST",
326
+ body: { tab: tabId, message: "unpadded inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "iVBORw0KGgo" }] },
327
+ });
328
+ assert.equal(unpaddedInlineImage.status, 400, "non-canonical unpadded image base64 should be rejected before RPC dispatch");
329
+ assert.match(String(unpaddedInlineImage.body?.error || ""), /image 1 data must be canonical base64/i);
330
+
331
+ const malformedAttachment = await request("127.0.0.1", "/api/attachments", {
332
+ method: "POST",
333
+ body: { tab: tabId, files: [{ id: "bad-image", name: "bad.png", mimeType: "image/png", data: "137,80,78,71" }] },
334
+ });
335
+ assert.equal(malformedAttachment.status, 400, "malformed attachment data should be rejected before a file is written");
336
+ assert.match(String(malformedAttachment.body?.error || ""), /attachment data must be canonical base64/i);
337
+
338
+ const canonicalPng = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).toString("base64");
339
+ const validInlineImage = await request("127.0.0.1", "/api/prompt", {
340
+ method: "POST",
341
+ body: { tab: tabId, message: "canonical inline image fixture", images: [{ type: "image", mimeType: "image/png", data: canonicalPng }] },
342
+ });
343
+ assert.equal(validInlineImage.status, 200, `canonical inline image should reach Pi unchanged: ${validInlineImage.body?.error || ""}`);
344
+ const imageCommands = (await readFile(fakePiCommandLog, "utf8")).trim().split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
345
+ assert.equal(imageCommands.some((entry) => entry.direction === "command" && entry.message === "malformed inline image fixture"), false, "malformed inline images must not reach Pi");
346
+ assert.equal(imageCommands.some((entry) => entry.direction === "command" && entry.message === "unpadded inline image fixture"), false, "non-canonical inline images must not reach Pi");
347
+ const validImageCommand = imageCommands.find((entry) => entry.direction === "command" && entry.message === "canonical inline image fixture");
348
+ assert.deepEqual(validImageCommand?.images, [{ type: "image", data: canonicalPng, mimeType: "image/png" }], "canonical image bytes and MIME type should be forwarded unchanged");
349
+
308
350
  const optionalFeatures = await request("127.0.0.1", "/api/optional-features");
309
351
  assert.equal(optionalFeatures.status, 200, "optional feature status should load");
310
352
  const aurReviewFeature = optionalFeatures.body?.data?.features?.find((feature) => feature.featureId === "aurReview");
@@ -847,6 +889,15 @@ try {
847
889
  assert.equal(gitRoot.body?.ok, true, "git-root endpoint should discover the tab repository");
848
890
  assert.equal(gitRoot.body?.data?.root, stagingRepo, "git-root should return the canonical fixture root");
849
891
 
892
+ const liveFile = path.join(stagingRepo, "live-update.txt");
893
+ const renamedLiveFile = path.join(stagingRepo, "live-update-renamed.txt");
894
+ const isLiveGitEvent = (event) => event.type === "webui_git_changed" && event.root === stagingRepo;
895
+ const createdLiveEvent = await waitForSseEvent(stagingTab, isLiveGitEvent, () => writeFile(liveFile, "created\n"));
896
+ assert.match(createdLiveEvent.event.changedAt || "", /^\d{4}-\d{2}-\d{2}T/, "file creation should broadcast a timestamped Git invalidation");
897
+ await waitForSseEvent(stagingTab, isLiveGitEvent, () => writeFile(liveFile, "modified\n"));
898
+ await waitForSseEvent(stagingTab, isLiveGitEvent, () => rename(liveFile, renamedLiveFile));
899
+ await waitForSseEvent(stagingTab, isLiveGitEvent, () => rm(renamedLiveFile));
900
+
850
901
  const gitPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
851
902
  assert.equal(gitPanel.body?.ok, true, "git-panel endpoint should return compact local status and history");
852
903
  assert.equal(gitPanel.body?.data?.root, stagingRepo);
@@ -1285,7 +1336,7 @@ try {
1285
1336
  await writeFile(path.join(cwd, "interactive-runner.mjs"), [
1286
1337
  "import readline from 'node:readline';",
1287
1338
  "const rl = readline.createInterface({ input: process.stdin, output: process.stdout });",
1288
- "console.log('interactive ready');",
1339
+ "console.log(`interactive ready; stdin tty=${Boolean(process.stdin.isTTY)}`);",
1289
1340
  "rl.question('name? ', (answer) => {",
1290
1341
  " console.log(`hello ${answer}`);",
1291
1342
  " rl.close();",
@@ -1306,6 +1357,9 @@ try {
1306
1357
  timeoutMs: 10_000,
1307
1358
  });
1308
1359
  assert.equal(interactiveRunStart.status, 200, `interactive runner start should return ok: ${interactiveRunStart.body?.error || ""}`);
1360
+ if (process.platform === "win32") {
1361
+ assert.equal(interactiveRunStart.body?.data?.activeRun?.executionMode, "conpty", "Windows interactive runners should use the node-pty ConPTY backend");
1362
+ }
1309
1363
  let interactiveRunState = interactiveRunStart;
1310
1364
  for (let attempt = 0; attempt < 50; attempt++) {
1311
1365
  interactiveRunState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
@@ -1334,13 +1388,14 @@ try {
1334
1388
  assert.equal(interactiveRunState.body?.data?.activeRun?.status, "done", "interactive custom runner should finish after stdin");
1335
1389
  const interactiveOutput = (interactiveRunState.body?.data?.activeRun?.lines || []).join("\n");
1336
1390
  assert.match(interactiveOutput, /hello webui/, "interactive custom runner should receive stdin from the app-runner input endpoint");
1391
+ if (process.platform === "win32") assert.match(interactiveOutput, /stdin tty=true/, "Windows ConPTY runners should expose a real TTY to the child process");
1337
1392
  assert.match(interactiveOutput, /# stdin sent \(5 chars\) and closed/, "app runner output should show that stdin was sent without echoing the input text itself");
1338
1393
  await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
1339
1394
 
1340
1395
  const scriptVersion = spawnSync("script", ["--version"], { encoding: "utf8" });
1341
1396
  const utilLinuxScriptAvailable = process.platform !== "win32" && scriptVersion.status === 0 && /util-linux/i.test(`${scriptVersion.stdout}\n${scriptVersion.stderr}`);
1342
1397
  const bashAvailable = spawnSync("bash", ["--version"], { encoding: "utf8" }).status === 0;
1343
- if (utilLinuxScriptAvailable && bashAvailable) {
1398
+ if ((utilLinuxScriptAvailable || process.platform === "win32") && bashAvailable) {
1344
1399
  await mkdir(path.join(cwd, "qa"), { recursive: true });
1345
1400
  await writeFile(path.join(cwd, "qa", "read-p-runner.sh"), [
1346
1401
  "#!/usr/bin/env bash",
@@ -1363,7 +1418,8 @@ try {
1363
1418
  timeoutMs: 10_000,
1364
1419
  });
1365
1420
  assert.equal(readPromptStart.status, 200, `bash read -p runner start should return ok: ${readPromptStart.body?.error || ""}`);
1366
- assert.equal(readPromptStart.body?.data?.activeRun?.executionMode, "pty", "bash read -p runner should use the PTY-backed execution path when util-linux script is available");
1421
+ const expectedPtyMode = process.platform === "win32" ? "conpty" : "pty";
1422
+ assert.equal(readPromptStart.body?.data?.activeRun?.executionMode, expectedPtyMode, "bash read -p runner should use the platform PTY-backed execution path");
1367
1423
  let readPromptState = readPromptStart;
1368
1424
  for (let attempt = 0; attempt < 50; attempt++) {
1369
1425
  readPromptState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
@@ -1392,7 +1448,7 @@ try {
1392
1448
  assert.equal(readPromptState.body?.data?.activeRun?.status, "done", "bash read -p runner should finish after stdin");
1393
1449
  const readPromptOutput = (readPromptState.body?.data?.activeRun?.lines || []).join("\n");
1394
1450
  assert.match(readPromptOutput, /selected:alpha/, "bash read -p runner should receive stdin from the app-runner input endpoint");
1395
- assert.doesNotMatch(readPromptOutput, /^alpha$/m, "PTY-backed app runner should not echo raw stdin into captured output");
1451
+ if (process.platform !== "win32") assert.doesNotMatch(readPromptOutput, /^alpha$/m, "script-backed PTY runner should not echo raw stdin into captured output");
1396
1452
  await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
1397
1453
  }
1398
1454
 
@@ -0,0 +1,115 @@
1
+ import assert from "node:assert/strict";
2
+ import { spawn } from "node:child_process";
3
+ import { chmod, mkdtemp, readFile, rm } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
5
+ import path from "node:path";
6
+ import { setTimeout as delay } from "node:timers/promises";
7
+ import { dirname, join } from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+
10
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
11
+ const serverScript = join(root, "bin", "pi-webui.mjs");
12
+ const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
13
+ const port = 32000 + Math.floor(Math.random() * 20000);
14
+ const cwd = await mkdtemp(path.join(tmpdir(), "pi-webui-image-payload-"));
15
+ const commandLog = path.join(cwd, "fake-pi-commands.jsonl");
16
+ let child;
17
+
18
+ async function request(pathname, { method = "GET", body, timeoutMs = 5_000 } = {}) {
19
+ const response = await fetch(`http://127.0.0.1:${port}${pathname}`, {
20
+ method,
21
+ headers: body === undefined ? undefined : { "content-type": "application/json" },
22
+ body: body === undefined ? undefined : JSON.stringify(body),
23
+ signal: AbortSignal.timeout(timeoutMs),
24
+ });
25
+ return { status: response.status, body: await response.json().catch(() => undefined) };
26
+ }
27
+
28
+ async function stopChild() {
29
+ if (!child || child.exitCode !== null || child.signalCode !== null) return;
30
+ const exited = new Promise((resolve) => child.once("exit", resolve));
31
+ child.kill("SIGKILL");
32
+ await exited;
33
+ }
34
+
35
+ async function cleanup() {
36
+ await stopChild();
37
+ for (let attempt = 0; attempt < 8; attempt++) {
38
+ try {
39
+ await rm(cwd, { recursive: true, force: true });
40
+ return;
41
+ } catch (error) {
42
+ if (!["EBUSY", "EPERM", "ENOTEMPTY"].includes(error?.code) || attempt === 7) throw error;
43
+ await delay(100 * (attempt + 1));
44
+ }
45
+ }
46
+ }
47
+
48
+ try {
49
+ await chmod(fakePi, 0o755);
50
+ let output = "";
51
+ child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
52
+ stdio: ["ignore", "pipe", "pipe"],
53
+ env: {
54
+ ...process.env,
55
+ PI_CODING_AGENT_DIR: path.join(cwd, "agent"),
56
+ FAKE_PI_LOG_FILE: commandLog,
57
+ },
58
+ });
59
+ child.stdout.on("data", (chunk) => { output += String(chunk); });
60
+ child.stderr.on("data", (chunk) => { output += String(chunk); });
61
+
62
+ let health;
63
+ for (let attempt = 0; attempt < 100; attempt++) {
64
+ if (child.exitCode !== null) break;
65
+ try {
66
+ health = await request("/api/health", { timeoutMs: 1_000 });
67
+ if (health.status === 200) break;
68
+ } catch {
69
+ // Server is still starting.
70
+ }
71
+ await delay(50);
72
+ }
73
+ assert.equal(health?.status, 200, `server should become healthy:\n${output}`);
74
+ const tabs = await request("/api/tabs");
75
+ const tabId = tabs.body?.data?.tabs?.[0]?.id;
76
+ assert.ok(tabId, "server should create a tab");
77
+
78
+ const malformedInline = await request("/api/prompt", {
79
+ method: "POST",
80
+ body: { tab: tabId, message: "malformed inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "137,80,78,71,13,10,26,10" }] },
81
+ });
82
+ assert.equal(malformedInline.status, 400);
83
+ assert.match(String(malformedInline.body?.error || ""), /image 1 data must be canonical base64/i);
84
+
85
+ const unpaddedInline = await request("/api/prompt", {
86
+ method: "POST",
87
+ body: { tab: tabId, message: "unpadded inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "iVBORw0KGgo" }] },
88
+ });
89
+ assert.equal(unpaddedInline.status, 400);
90
+ assert.match(String(unpaddedInline.body?.error || ""), /image 1 data must be canonical base64/i);
91
+
92
+ const malformedAttachment = await request("/api/attachments", {
93
+ method: "POST",
94
+ body: { tab: tabId, files: [{ id: "bad-image", name: "bad.png", mimeType: "image/png", data: "137,80,78,71" }] },
95
+ });
96
+ assert.equal(malformedAttachment.status, 400);
97
+ assert.match(String(malformedAttachment.body?.error || ""), /attachment data must be canonical base64/i);
98
+
99
+ const canonicalPng = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).toString("base64");
100
+ const validInline = await request("/api/prompt", {
101
+ method: "POST",
102
+ body: { tab: tabId, message: "canonical inline image fixture", images: [{ type: "image", mimeType: "image/png", data: canonicalPng }] },
103
+ });
104
+ assert.equal(validInline.status, 200, validInline.body?.error || "canonical image should be accepted");
105
+
106
+ const commands = (await readFile(commandLog, "utf8")).trim().split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
107
+ assert.equal(commands.some((entry) => entry.direction === "command" && entry.message === "malformed inline image fixture"), false);
108
+ assert.equal(commands.some((entry) => entry.direction === "command" && entry.message === "unpadded inline image fixture"), false);
109
+ const validCommand = commands.find((entry) => entry.direction === "command" && entry.message === "canonical inline image fixture");
110
+ assert.deepEqual(validCommand?.images, [{ type: "image", data: canonicalPng, mimeType: "image/png" }]);
111
+ } finally {
112
+ await cleanup();
113
+ }
114
+
115
+ console.log("image payload hardening harness passed");
@@ -39,17 +39,17 @@ const companionDependencies = {
39
39
  "@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
40
40
  "@firstpick/pi-extension-btw": "^0.1.3",
41
41
  "@firstpick/pi-extension-fish-user-bash": "^0.2.1",
42
- "@firstpick/pi-extension-git-footer-status": "^0.4.0",
42
+ "@firstpick/pi-extension-git-footer-status": "^0.4.1",
43
43
  "@firstpick/pi-extension-release-aur": "^0.1.7",
44
- "@firstpick/pi-extension-release-npm": "^0.4.1",
44
+ "@firstpick/pi-extension-release-npm": "^0.4.3",
45
45
  "@firstpick/pi-extension-safety-guard": "^0.2.5",
46
46
  "@firstpick/pi-extension-setup-skills": "^0.1.8",
47
47
  "@firstpick/pi-extension-stats": "^0.2.8",
48
48
  "@firstpick/pi-extension-todo-progress": "^0.2.8",
49
49
  "@firstpick/pi-extension-tools": "^0.1.6",
50
- "@firstpick/pi-extension-workflows": "^0.1.3",
51
- "@firstpick/pi-package-remote-webui": "^0.1.5",
52
- "@firstpick/pi-prompts-git-pr": "^0.1.3",
50
+ "@firstpick/pi-extension-workflows": "^0.1.4",
51
+ "@firstpick/pi-package-remote-webui": "^0.1.6",
52
+ "@firstpick/pi-prompts-git-pr": "^0.1.4",
53
53
  "@firstpick/pi-themes-bundle": "^0.1.4",
54
54
  };
55
55
 
@@ -137,7 +137,7 @@ assert.doesNotMatch(app, /function renderGitPanelGroup\(/, "Git panel should not
137
137
  assert.match(app, /function gitPanelContextMenuItems\(context\)[\s\S]*kind === "repository"[\s\S]*"View Diff"[\s\S]*"Stage All"[\s\S]*"Unstage All"[\s\S]*"Discard changes…"[\s\S]*"Delete file…"/, "repository and path actions should be provided by the Git context menu");
138
138
  assert.match(app, /function bindGitPanelContextMenu\(trigger, context\)[\s\S]*"contextmenu"[\s\S]*"ContextMenu"[\s\S]*event\.shiftKey && event\.key === "F10"/, "Git context actions should support right click and keyboard-equivalent invocation");
139
139
  assert.doesNotMatch(app, /git-side-panel-file-actions|git-side-panel-toolbar-actions|git-side-panel-stage-select|gitPanelSmallButton/, "Git rows should not render the removed inline action controls");
140
- assert.match(app, /function renderGitPanelFolder\(node, card, category, depth = 0\)[\s\S]*const defaultOpen = depth === 0[\s\S]*details\.open =[\s\S]*git-side-panel-folder-chevron[\s\S]*aria-hidden/, "Git folders should render an explicit decorative disclosure arrow");
140
+ assert.match(app, /function renderGitPanelFolder\(node, card, category, depth = 0\)[\s\S]*const defaultOpen = true[\s\S]*details\.open = gitPanelState\.openFolders\.has\(folderKey\) \? gitPanelState\.openFolders\.get\(folderKey\) : defaultOpen[\s\S]*details\.open === defaultOpen[\s\S]*gitPanelState\.openFolders\.set\(folderKey, details\.open\)[\s\S]*git-side-panel-folder-chevron[\s\S]*aria-hidden/, "Git folders should start expanded at every depth while retaining explicit user collapse overrides");
141
141
  assert.match(css, /\.git-side-panel-folder-chevron[\s\S]*transform: rotate\(0deg\)[\s\S]*\.git-side-panel-folder\[open\][\s\S]*transform: rotate\(90deg\)/, "Git folder arrows should indicate collapsed and expanded states");
142
142
  assert.match(css, /\.git-side-panel-repository[\s\S]*\.git-side-panel-file[\s\S]*grid-template-columns: 1\.3rem minmax\(5rem, 1fr\) auto[\s\S]*\.git-side-panel-context-menu[\s\S]*\.git-side-panel-commit/, "Git side panel should prioritize filename width and style repository, context-menu, and history surfaces");
143
143
  assert.match(server, /async function readGitPanel\(cwd\)[\s\S]*GIT_PANEL_HISTORY_LIMIT[\s\S]*"status", "--porcelain=v1", "-z"[\s\S]*"--numstat", "-z"/, "server should build compact bounded local Git snapshots without full file contents");
@@ -145,7 +145,7 @@ assert.match(server, /async function readGitCommit\(cwd, requestedHash\)[\s\S]*\
145
145
  assert.match(server, /"\/api\/git-changes\/stage-all"[\s\S]*stageAllGitChanges[\s\S]*"\/api\/git-changes\/unstage-all"[\s\S]*unstageAllGitChanges/, "server should expose repository-wide stage and unstage mutations");
146
146
  assert.match(readme, /side-panel \*\*Git\*\* section[\s\S]*five-minute cache window[\s\S]*confirmed discard\/delete actions[\s\S]*latest 30 commits/, "README should document Git panel grouping, refresh, actions, and history behavior");
147
147
  assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
148
- assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/npm-packages\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
148
+ assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/pi-coding-agent-forge\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
149
149
  assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
150
150
  assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
151
151
  assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
@@ -198,6 +198,7 @@ assert.ok(html.includes('id="commandSuggest"') && html.indexOf('id="commandSugge
198
198
  assert.match(html, /id="busyPromptBehaviorTag"[\s\S]*class="composer-busy-mode-tag"[\s\S]*aria-controls="busyPromptBehaviorMenu"/, "composer should expose a clickable busy prompt behavior tag on the input frame");
199
199
  assert.doesNotMatch(html, /Busy send:/i, "busy prompt behavior tag should show only the current mode label");
200
200
  assert.match(html, /id="sessionSkillTags" class="composer-skill-tags"[\s\S]*hidden/, "composer should expose a hidden-until-used skill tag strip beside the busy mode tag");
201
+ assert.match(html, /id="featureCategoryTag" class="composer-feature-category-tag"[^>]*aria-live="polite"[^>]*aria-atomic="true"[^>]*hidden/, "composer should expose a hidden-until-used accessible feature category tag");
201
202
  assert.match(html, /id="skillEditorDialog"[\s\S]*id="skillEditorText"[\s\S]*id="skillEditorSaveButton"/, "skill tags should have an in-Web UI SKILL.md editing dialog");
202
203
  assert.match(html, /id="busyPromptBehaviorMenu"[\s\S]*data-busy-prompt-behavior="followUp"[\s\S]*data-busy-prompt-behavior="steer"/, "busy prompt behavior dropdown should expose follow-up and steer choices");
203
204
  assert.match(app, /const LONG_INPUT_ATTACHMENT_LINE_THRESHOLD = 20/, "long composer text should use a 20-line threshold before becoming an attachment");
@@ -326,14 +327,23 @@ assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input s
326
327
  assert.match(css, /\.composer-context-tags \{[\s\S]*?top:\s*-0\.48rem;[\s\S]*?left:\s*0\.75rem;/, "busy prompt behavior and skill tags should sit at the top-left of the input frame");
327
328
  assert.match(css, /\.composer-busy-mode-tag \{[\s\S]*?var\(--ctp-crust\)/, "busy prompt behavior tag should use an opaque base background");
328
329
  assert.match(css, /\.composer-skill-tag \{[\s\S]*?var\(--ctp-crust\)/, "skill tags should use an opaque base background");
330
+ assert.match(css, /\.composer-feature-category-tag \{[\s\S]*?var\(--ctp-crust\)[\s\S]*?\.composer-feature-category-tag\.complex-feature \{[\s\S]*?var\(--ctp-mauve\)[\s\S]*?\.composer-feature-category-tag\[hidden\]/, "feature category tags should use the existing composer-tag frame with a distinct complex state and hidden default");
329
331
  assert.match(css, /button\.composer-skill-tag:hover,[\s\S]*?button\.composer-skill-tag:focus-visible/, "skill tags should be styled as clickable controls");
330
332
  assert.match(css, /\.extension-dialog\.skill-editor-dialog \{[\s\S]*?--skill-editor-size:\s*min\(152rem[\s\S]*?width:\s*var\(--skill-editor-size\);[\s\S]*?height:\s*var\(--skill-editor-size\);[\s\S]*?aspect-ratio:\s*1 \/ 1/, "skill editor should use a square viewport-bounded modal layout");
331
333
  assert.match(css, /\.skill-editor-dialog form \{[\s\S]*?height:\s*100%;[\s\S]*?min-height:\s*0/, "skill editor form should fill the square modal without forcing overflow");
332
334
  assert.match(css, /\.skill-editor-text \{[\s\S]*?overflow-x:\s*hidden;[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap/, "skill editor text should wrap long lines instead of horizontal scrolling");
335
+ assert.match(html, /<textarea id="fileViewerEditor"[^>]*\bwrap="soft"/, "file viewer source mode should enable soft wrapping");
336
+ assert.match(css, /\.file-viewer-editor \{[\s\S]*?overflow-x:\s*hidden;[\s\S]*?overflow-y:\s*auto;[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap/, "file viewer source mode should wrap long lines to the available preview width");
333
337
  assert.match(css, /\.composer-busy-mode-menu \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.22rem\);[\s\S]*?background:\s*var\(--ctp-crust\)/, "busy prompt behavior dropdown should expand above the tag with an opaque background");
334
338
  assert.match(css, /\.sticky-user-prompt-button \{[\s\S]*?grid-template-columns:\s*auto minmax\(0, 1fr\) auto/, "last-user-prompt jump control should render as a fixed transcript header");
335
339
  assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.sticky-user-prompt-button \{\n\s+grid-template-columns:\s*minmax\(0, 1fr\) auto;\n\s+min-height:\s*36px;[\s\S]*?\.sticky-user-prompt-text \{[\s\S]*?font-size:\s*var\(--text-xs\)/, "mobile last-user-prompt card should preserve compact height while respecting the text floor");
336
340
  assert.match(css, /\.message\.extension,[\s\S]*?\.message\.native/, "extension and native command output should have visible transcript styling");
341
+ assert.match(app, /const FEATURE_CATEGORY_STATUS_KEY = "feature-category";[\s\S]*const featureCategoryByTab = new Map\(\)/, "feature category status should use a dedicated per-tab transport key and state map");
342
+ assert.match(app, /function normalizeFeatureCategory\(value\) \{\s+return value === "lightweight-feature" \|\| value === "complex-feature" \? value : "";/, "feature category normalization should accept only the two approved exact labels");
343
+ assert.match(app, /function renderFeatureCategoryTag\(tabId = activeTabId\) \{[\s\S]*featureCategoryByTab\.get\(tabId\)[\s\S]*tag\.hidden = !category[\s\S]*tag\.textContent = category/, "feature category rendering should be active-tab scoped and hidden when absent");
344
+ assert.match(app, /function handleFeatureCategoryStatus\(statusText, tabId = activeTabId\) \{[\s\S]*featureCategoryByTab\.set\(tabId, category\)[\s\S]*featureCategoryByTab\.delete\(tabId\)[\s\S]*tabId === activeTabId/, "feature category status should update and clear only the addressed terminal tab");
345
+ assert.match(app, /case "setStatus": \{[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*handleFeatureCategoryStatus\(request\.statusText, request\.tabId \|\| activeTabId\);[\s\S]*return;[\s\S]*statusEntries\.set\(statusKey, request\.statusText\)/, "feature category status should be consumed before generic footer status storage");
346
+ assert.match(app, /function setActiveTabId\(tabId, \{ remember = false \} = \{\}\) \{[\s\S]*renderFeatureCategoryTag\(nextTabId\)[\s\S]*function syncTabMetadata\(nextTabs = \[\]\) \{[\s\S]*featureCategoryByTab\.delete\(tabId\)/, "tab activation and cleanup should render only the active category and remove closed-tab state");
337
347
  assert.match(app, /function remoteWebuiQrSvg\(qrLines = \[\]\)[\s\S]*?viewBox[\s\S]*?shape-rendering[\s\S]*?crispEdges/, "remote WebUI QR popup should render terminal QR output as square SVG modules");
338
348
  assert.match(app, /function showRemoteWebuiQrLoadingPopup\(message = "Opening Remote WebUI QR…"\)[\s\S]*?remote-qr-loading[\s\S]*?showModal\(\)/, "remote WebUI QR popup should show a loading state while QR generation is pending");
339
349
  assert.match(app, /function handleRemoteWebuiStatus\(statusText\)[\s\S]*?opening remote webui[\s\S]*?refreshing remote qr[\s\S]*?enabling remote pin auth[\s\S]*?showRemoteWebuiQrLoadingPopup/, "remote WebUI status updates should open the QR loading popup before widget lines arrive");
@@ -407,8 +417,14 @@ assert.match(css, /\.release-npm-widget \{[\s\S]*?border-left:\s*0\.28rem solid/
407
417
  assert.match(css, /\.release-npm-stream-header \{[\s\S]*?text-transform:\s*uppercase/, "release-npm output should label the output stream clearly");
408
418
  assert.match(css, /\.release-npm-output-summary \{[\s\S]*?cursor:\s*pointer/, "release-npm output should expose a local expand/collapse summary");
409
419
  assert.match(css, /\.release-npm-output-details\[open\] \.release-npm-output-toggle/, "release-npm expanded output should rotate the summary chevron");
420
+ assert.match(css, /\.release-npm-output-details \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\);[\s\S]*?min-width:\s*0;/, "release output should constrain its grid track so long subprocess lines scroll inside the terminal instead of widening the widget");
410
421
  assert.match(css, /\.widget-area:has\(\.release-npm-live-widget \.release-npm-output-details\[open\]\)[\s\S]*?flex:\s*0 0 min\(44rem, 68dvh\)/, "live release output should reserve a stable widget slot instead of resizing the transcript while streaming");
411
- assert.match(css, /\.release-npm-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal,[\s\S]*?height:\s*clamp\(15rem, 42dvh, 31rem\)/, "live release terminals should keep a fixed viewport height while output streams");
422
+ assert.match(css, /\.widget-area:has\(\.workflow-live-widget \.release-npm-output-details\[open\]\) \{[^}]*min-height:\s*0;[^}]*overflow-x:\s*hidden;[^}]*overflow-y:\s*auto/, "live workflow output should retain its local scroll boundary without forcing a fixed outer height");
423
+ assert.match(css, /\.widget-area:has\(\.workflow-widget:not\(\.minimized\)\) \{[^}]*--workflow-overlay-max-height:\s*min\(44rem, 68dvh\);[^}]*flex:\s*0 0 auto;[^}]*max-height:\s*var\(--workflow-overlay-max-height\);[^}]*overflow-x:\s*hidden;[^}]*overflow-y:\s*auto/, "restored workflow widgets should follow rendered content up to a viewport-safe scroll cap while minimized-only workflow content releases that sizing rule");
424
+ assert.match(css, /\.widget-area:has\(\.workflow-widget:not\(\.minimized\)\) \{ --workflow-overlay-max-height:\s*34dvh; \}/, "mobile workflow widgets should keep the existing compact viewport cap while sizing intrinsically");
425
+ assert.match(css, /\.release-npm-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal,[\s\S]*?\.release-aur-live-widget[\s\S]*?height:\s*clamp\(15rem, 42dvh, 31rem\)/, "live release terminals should keep a fixed viewport height while output streams");
426
+ assert.match(css, /\.workflow-subprocess-widget \.release-npm-output-details\[open\] \.release-npm-terminal \{[^}]*max-height:\s*clamp\(12rem, 34dvh, 26rem\);[^}]*min-height:\s*0;[^}]*overscroll-behavior-y:\s*auto;[^}]*scrollbar-gutter:\s*stable/, "workflow output should grow with real line content up to a compact local scroll cap");
427
+ assert.match(css, /\.workflow-subprocess-widget \.workflow-meta \{[\s\S]*?grid-template-columns:[\s\S]*?\.workflow-meta-label \{[\s\S]*?text-transform:\s*uppercase/, "workflow run limits and status should render as clearly labeled metadata groups");
412
428
  assert.match(css, /\.release-npm-terminal \{[\s\S]*?rgba\(3, 4, 10, 0\.98\)/, "release-npm terminal should use a high-contrast stream panel");
413
429
  assert.match(css, /\.release-aur-widget \{[\s\S]*?border-color/, "release-aur output should render as a specialized Web UI widget variant");
414
430
  assert.match(css, /\.app-runner-widget \{[\s\S]*?border-color/, "app runner output should render as a specialized Web UI widget variant");
@@ -479,11 +495,12 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
479
495
  assert.match(css, /\.terminal-tab-activity-indicator/, "terminal tabs should expose per-tab agent activity indicators");
480
496
  assert.match(css, /\.terminal-tab-app-runner-indicator \{[\s\S]*?terminal-tab-app-runner-pulse/, "terminal tabs should expose animated app-runner indicators");
481
497
  assert.match(css, /\.terminal-tab\.app-runner-running,\n\.terminal-tab-group-item\.app-runner-running/, "terminal tabs and grouped items should mark running app runners");
498
+ assert.match(css, /\.terminal-tab-group-menu \{[^}]*max-height:\s*none;[^}]*overflow:\s*visible;/, "grouped terminal tab menus should grow to show every open tab without an internal scrollbar");
482
499
  assert.match(css, /\.terminal-tab-group-item \{[\s\S]*?flex:\s*0 0 auto[\s\S]*?background:\s*var\(--ctp-crust\)/, "grouped terminal tab items should keep readable height and use opaque backgrounds");
483
- assert.match(css, /\.terminal-tab-group-add \{[\s\S]*?flex:\s*0 0 auto/, "grouped terminal tab menus should scroll instead of shrinking the add-tab action");
500
+ assert.match(css, /\.terminal-tab-group-add \{[\s\S]*?flex:\s*0 0 auto/, "grouped terminal tab menus should keep the add-tab action at its natural height");
484
501
  assert.match(css, /\.terminal-tab-group\.active \{[\s\S]*?background:[\s\S]*?var\(--ctp-crust\)/, "active terminal tab groups should keep opaque backgrounds");
485
502
  assert.match(css, /\.terminal-tab-group\.stopped \{[\s\S]*?opacity:\s*1/, "stopped terminal tab groups should not become transparent");
486
- assert.match(css, /\.terminal-tabs:has\(\.terminal-tab-group\.menu-open\)/, "open terminal tab groups should keep the tab strip usable across rerenders");
503
+ assert.match(css, /\.terminal-tabs:has\(\.terminal-tab-group\.menu-open\),[^{}]*\{[^}]*overflow:\s*visible;/, "open terminal tab groups should escape the tab strip without clipping");
487
504
  assert.match(css, /\.terminal-tab-group\.menu-open \.terminal-tab-group-menu \{[\s\S]*?display:\s*flex/, "open terminal tab group menus should remain visible without hover");
488
505
  assert.match(css, /\.terminal-tab\.activity-working > \.terminal-tab-button \.terminal-tab-activity-indicator[\s\S]*?terminal-tab-working-pulse/, "working tab indicators should be visibly animated");
489
506
  assert.match(css, /\.terminal-tab-group-item\.activity-working > \.terminal-tab-button \.terminal-tab-activity-indicator[\s\S]*?terminal-tab-working-pulse/, "working indicators should still animate on grouped tab menu items themselves");
@@ -517,7 +534,10 @@ assert.match(css, /\.git-current-file-header \{[\s\S]*?position:\s*sticky[\s\S]*
517
534
  assert.match(css, /\.git-changes-file-list \{[\s\S]*?grid-template-columns:\s*repeat\(2, minmax\(0, 1fr\)\)/, "git changes modal should show changed-file jump buttons in two columns without horizontal scrolling");
518
535
  assert.match(css, /\.git-diff-grid \{[\s\S]*?grid-template-columns:\s*3\.8rem minmax\(22rem, 1fr\) 3\.8rem minmax\(22rem, 1fr\)/, "git changes modal should render a side-by-side diff grid");
519
536
  assert.match(html, /id="gitChangesDialog"[\s\S]*id="gitChangesRefreshButton"[\s\S]*id="gitChangesPullButton"[\s\S]*id="gitChangesBody"/, "git changes modal should expose refresh, pull controls, and a diff body");
520
- assert.match(app, /chip\.key === "changes"[\s\S]*?options\.onClick = openGitChangesDialog/, "footer CHANGES chip should open the git changes modal");
537
+ assert.match(app, /chip\.key === "changes"[\s\S]*?options\.onClick = \(\) => openGitChangesDialog\(tab\?\.id \|\| activeTabId\)/, "footer CHANGES chip should pass its tab ID without forwarding the browser click event");
538
+ assert.match(app, /chip\.key === "git-state"[\s\S]*?options\.onClick = \(\) => openGitChangesDialog\(tab\?\.id \|\| activeTabId\)/, "footer git-state chip should pass its tab ID without forwarding the browser click event");
539
+ assert.match(app, /function openGitChangesDialog\(requestedTabId = activeTabId\)[\s\S]*?typeof requestedTabId === "string" && requestedTabId \? requestedTabId : activeTabId/, "git changes dialog should reject event objects and other non-string tab IDs defensively");
540
+ assert.doesNotMatch(app, /options\.onClick = openGitChangesDialog/, "git changes handlers must not forward click events as tab IDs");
521
541
  assert.match(app, /async function loadGitChangesDialog[\s\S]*api\("\/api\/git-changes"/, "git changes modal should load diff data from the server endpoint");
522
542
  assert.match(app, /"Resolve with agent"[\s\S]*api\("\/api\/git-operation\/resolve-with-agent", \{ method: "POST"[\s\S]*switchToResponseTab\(response\)/, "conflict panel should open the resolution agent in the new tab returned by the server");
523
543
  assert.match(server, /function gitConflictResolutionAgentPrompt\(operation\)[\s\S]*Conflicted files:[\s\S]*Do not continue, skip, abort, commit, reset, or push[\s\S]*diff-filter=U is empty/, "server should build a bounded conflict handoff with operation safety and verification instructions");
@@ -545,6 +565,7 @@ assert.match(css, /\.footer-model-picker[\s\S]*?position:\s*absolute[\s\S]*?left
545
565
  assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.footer-model-picker \{[\s\S]*?position:\s*fixed/, "mobile footer model picker should escape footer-details stacking as a fixed overlay on narrow, device-width-narrow, or touch-only devices");
546
566
  assert.match(css, /bottom:\s*var\(--footer-model-picker-bottom/, "mobile footer model picker should be anchored by a JS-computed viewport offset");
547
567
  assert.match(css, /\.footer-model-option\.active/, "footer model picker should style the selected scoped model");
568
+ assert.match(css, /\.model-search-result-main,\n\.model-search-result-name \{[\s\S]*?line-height:\s*1\.3;/, "side-panel model titles should reserve enough line height to avoid clipping heavy font glyphs");
548
569
  assert.match(app, /async function createPathPickerDirectory\(\)/, "cwd picker should implement create-directory behavior in the browser");
549
570
  assert.match(app, /function renderPathPickerDirectoryList\(\)[\s\S]*pathPickerDirectoryMatchesSearch/, "cwd picker should filter current-directory entries in the browser");
550
571
  assert.match(app, /elements\.pathPickerSearchInput\.addEventListener\("input", renderPathPickerDirectoryList\)/, "cwd picker should update directory matches as the user types");
@@ -623,7 +644,7 @@ assert.match(app, /remoteAuthToggle: \$\("#remoteAuthToggle"\)/, "Remote WebUI c
623
644
  assert.match(html, /id="networkControlField"[^>]*hidden/, "Remote WebUI browser controls should be hidden until the optional package is loaded and enabled");
624
645
  assert.match(app, /remoteWebuiCommand\(enable \? "authOn" : "authOff"/, "remote PIN auth toggle should dispatch through the Remote WebUI package command");
625
646
  assert.match(server, /webuiSettingsFile,[\s\S]*from "\.\.\/lib\/git-workflow-preferences\.mjs"/, "server should use the shared Pi Web UI settings persistence module");
626
- assert.match(server, /let persistedRemoteAuthEnabled = await readPersistedRemoteAuthEnabled\(\)/, "server should load the saved Remote PIN auth preference before startup");
647
+ assert.match(server, /const persistedStartupSettings = await readWebuiSettings\(undefined, \{ reportInvalidOutputMode: true \}\);[\s\S]*?let persistedRemoteAuthEnabled = persistedStartupSettings\.remoteAuthEnabled === true;/, "server should load the saved Remote PIN auth preference before startup");
627
648
  assert.match(server, /if \(remoteAuthStartupEnabled\(\)\) enableRemoteAuth\(remoteAuthStartupReason\(\)\)/, "saved Remote PIN auth preference should enable auth on startup");
628
649
  assert.match(server, /await saveRemoteAuthPreference\(true\)/, "enabling Remote PIN auth should persist the on preference");
629
650
  assert.match(server, /await saveRemoteAuthPreference\(false\)/, "disabling Remote PIN auth should persist the off preference");
@@ -885,7 +906,10 @@ assert.match(app, /function parseGitFooterWebuiPayloadRaw\(raw\)[\s\S]*GIT_FOOTE
885
906
  assert.match(app, /function normalizeFooterPayloadChangedFile\(value\)[\s\S]*FOOTER_CHANGED_FILE_KINDS\.has\(value\.kind\)[\s\S]*oldPath/, "git footer payload parsing should preserve changed-file details for changes popovers");
886
907
  assert.match(app, /const files = value\.files\.map\(normalizeFooterPayloadChangedFile\)\.filter\(Boolean\)\.slice\(0, 80\);[\s\S]*chip\.files = files;/, "git footer payload chips should retain bounded changed-file lists");
887
908
  assert.match(app, /FOOTER_PAYLOAD_ACTIONS = new Set\(\["calibrate-current", "calibrate-probe"\]\)[\s\S]*chip\.action = value\.action;/, "git footer payload chips should preserve allowlisted actions such as PI calibration");
888
- assert.match(app, /async function runGitFooterPiCalibration\(mode = "current", tabContext = activeTabContext\(\)\)[\s\S]*resolveAvailableCommandName\("calibrate", \{ rpcOnly: true \}\)[\s\S]*mode === "probe" \? `\/\$\{commandName\}` : `\/\$\{commandName\} current`[\s\S]*scheduleGitFooterPiCalibrationRefresh\(tabContext, mode === "probe" \? \[5000, 14000\] : \[600, 1600\]\)/, "clicking an uncalibrated PI footer chip should run current/probe calibration and refresh the git footer value");
909
+ assert.match(app, /async function runGitFooterPiCalibration\(tabContext = activeTabContext\(\)\)[\s\S]*resolveAvailableCommandName\("calibrate", \{ rpcOnly: true \}\)[\s\S]*sendPrompt\("prompt", `\/\$\{commandName\}`[\s\S]*scheduleGitFooterPiCalibrationRefresh\(tabContext\)/, "clicking the PI footer chip should dispatch exactly /calibrate and schedule a refreshed footer value");
910
+ assert.match(app, /function applyGitFooterPiCalibrationOptions\(chip, options\) \{\s+if \(chip\?\.key !== "pi"\) return "";[\s\S]*void runGitFooterPiCalibration\(\)/, "every PI footer chip should remain clickable regardless of payload calibration action metadata");
911
+ assert.doesNotMatch(app.match(/async function runGitFooterPiCalibration[\s\S]*?\n\}/)?.[0] || "", /commandName\} current|appConfirmText/, "PI footer calibration should neither append the current-mode argument nor open a probe confirmation dialog");
912
+
889
913
  assert.match(app, /title: cleanFooterPayloadText\(value\.title, "", 4000\)/, "git footer tooltip titles should preserve long cwd paths instead of truncating at chip display length");
890
914
  assert.match(app, /const sourceTitle = cleanFooterPayloadText\(chip\?\.title, "", 4000\)/, "git footer tooltip rendering should keep full source titles for long cwd paths");
891
915
  assert.match(app, /function renderFooter\(\)[\s\S]*parseGitFooterWebuiPayload\(\)[\s\S]*renderGitFooterPayload\(footerPayloadWithLiveModel\(gitFooterPayload\)\)/, "detailed footer rendering should prefer the git-footer-status extension payload");
@@ -1011,13 +1035,41 @@ assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-ins
1011
1035
  assert.match(app, /function renderWorkflowInspectorAgent\(agent, run\)[\s\S]*Prompt[\s\S]*Recent activity[\s\S]*Result and usage[\s\S]*Retry agent/, "agent drilldown should expose prompt, activity, result, usage, and retry");
1012
1036
  assert.match(app, /canPause[\s\S]*`\/workflow pause \$\{run\.runId\}`[\s\S]*canAbort[\s\S]*`\/workflow abort \$\{run\.runId\}`[\s\S]*Save user[\s\S]*Save project[\s\S]*Raw workflow script/, "WebUI Workflow controls should send canonical extension commands and expose raw scripts");
1013
1037
  assert.match(app, /confirmMessage && !window\.confirm\(confirmMessage\)/, "destructive WebUI Workflow actions should require browser confirmation");
1014
- assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)/, "Workflow inspector state and drilldown selection should be per tab");
1038
+ assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)[\s\S]*workflowInspectorMinimizedByTab = new Set\(\)/, "Workflow inspector run, selection, and minimized state should be per tab");
1039
+ assert.match(app, /const workflowTerminalScrollByTab = new Map\(\);\s*const workflowSubprocessMinimizedByTab = new Set\(\);/, "Workflow subprocess minimize state should be isolated per browser tab");
1040
+ assert.match(app, /function workflowInspectorSetMinimized\(minimized\)[\s\S]*workflowInspectorMinimizedByTab\.(?:add|delete)[\s\S]*renderWidgets\(\)[\s\S]*requestAnimationFrame[\s\S]*workflow-inspector-minimize-button[\s\S]*focus\(\{ preventScroll: true \}\)/, "Workflow inspector minimize state should survive rerenders and restore focus to the replacement control");
1041
+ assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-inspector-body[\s\S]*workflow-inspector-minimize-button[\s\S]*minimized \? "Restore" : "Minimize"[\s\S]*minimizeButton\.type = "button"[\s\S]*aria-controls[\s\S]*aria-expanded[\s\S]*aria-label[\s\S]*if \(minimized\) return node/, "Workflow inspector should expose an accessible minimize and restore disclosure control");
1042
+ assert.match(app, /function workflowSubprocessSetMinimized\(minimized\)[\s\S]*workflowSubprocessMinimizedByTab\.(?:add|delete)[\s\S]*renderWidgets\(\)[\s\S]*requestAnimationFrame[\s\S]*workflow-subprocess-minimize-button[\s\S]*focus\(\{ preventScroll: true \}\)/, "Workflow subprocess minimize state should survive live rerenders and restore focus to the replacement control");
1043
+ assert.match(app, /function renderWorkflowSubprocessWidget\(\)[\s\S]*workflow-subprocess-body[\s\S]*workflow-subprocess-minimize-button[\s\S]*minimized \? "Restore" : "Minimize"[\s\S]*minimizeButton\.type = "button"[\s\S]*aria-controls[\s\S]*aria-expanded[\s\S]*aria-label[\s\S]*node\.append\(header, body\);\s*if \(minimized\) return node;[\s\S]*body\.append\(outputDetails\)/, "Workflow subprocess output should expose an accessible minimize and restore disclosure control without rebuilding its terminal while minimized");
1044
+ assert.match(app, /workflowInspectorMinimizedByTab\.delete\(tabId\)[\s\S]*workflowSubprocessMinimizedByTab\.delete\(tabId\)/, "closing a terminal tab should discard its Workflow inspector and subprocess minimize state");
1015
1045
  assert.match(app, /handleInactiveTabEvent\(event\)[\s\S]*WORKFLOW_INSPECTOR_WIDGET_KEY[\s\S]*updateWorkflowInspectorForTab\(event\.tabId, inspector\)[\s\S]*renderTabs\(\)/, "inactive tabs should consume replayed Workflow inspector payloads for badges");
1016
1046
  assert.match(app, /terminal-tab-workflow-indicator[\s\S]*workflowRunningCountForTab/, "terminal tabs should display Workflow Mode or active-run badges");
1017
1047
  assert.match(css, /\.workflow-inspector-layout \{[\s\S]*grid-template-columns:[\s\S]*\.workflow-inspector-run-list[\s\S]*\.workflow-inspector-agent/, "Workflow inspector should have responsive run and agent layout styling");
1048
+ assert.match(css, /\.workflow-inspector-widget\.minimized,[\s\S]*\.workflow-subprocess-widget\.minimized \{[\s\S]*\.workflow-inspector-minimize-button,[\s\S]*\.workflow-subprocess-minimize-button/, "Workflow inspector and subprocess widgets should share visible minimized-state toggle styling");
1049
+ assert.match(css, /\.workflow-subprocess-widget\.minimized > \.release-npm-header \{[\s\S]*?padding-bottom:\s*0;[\s\S]*?border-bottom:\s*0;/, "minimized Workflow subprocess output should collapse its header divider and extra spacing");
1018
1050
  assert.match(css, /\.terminal-tab-workflow-indicator \{[\s\S]*color: var\(--ctp-mauve\)/, "inactive-tab Workflow badges should have a distinct accessible style");
1019
1051
  assert.match(css, /\.composer-workflow-mode-button\.active,[\s\S]*aria-pressed="true"/, "active Workflow Mode toggle should have persistent pressed styling");
1020
1052
  assert.match(css, /\.composer\.workflow-mode-active[\s\S]*body\.workflow-mode-active \.composer::before/, "active Workflow Mode should visibly accent the composer");
1053
+
1054
+ // Workflow raw-script inspector: narrowly specialized, structurally read-only, and viewport-safe.
1055
+ const workflowPreviewRequestSource = appFunctionSource("isWorkflowScriptPreviewRequest", "workflowScriptTokenClass");
1056
+ const workflowTokenRenderSource = appFunctionSource("appendWorkflowScriptTokens", "renderWorkflowScriptPreview");
1057
+ const workflowPreviewSource = appFunctionSource("renderWorkflowScriptPreview", "showNextDialog");
1058
+ const workflowDialogSource = appFunctionSource("showNextDialog", "handleInactiveTabEvent");
1059
+ assert.match(workflowPreviewRequestSource, /request\?\.method === "editor"[\s\S]*title\.startsWith\("Raw workflow script"\)[\s\S]*inspection only;\\s\*edits are ignored/, "workflow inspector specialization should require the editor method, raw-script title, and inspection-only wording");
1060
+ assert.match(workflowDialogSource, /else if \(isWorkflowScriptPreview\) \{\s*renderWorkflowScriptPreview\(request\);\s*\} else if \(request\.method === "editor"\) \{\s*const textarea = make\("textarea", "dialog-editor"\);[\s\S]*textarea\.value = request\.prefill \|\| ""/, "workflow previews should specialize before the unchanged generic editor textarea fallback");
1061
+ assert.doesNotMatch(workflowPreviewSource, /\btextarea\b/, "workflow previews should not create an editable textarea");
1062
+ assert.match(workflowTokenRenderSource, /document\.createTextNode\(line\.slice\(start, match\.index\)\)[\s\S]*make\("span", `workflow-script-token/, "workflow syntax tokens should be built from DOM text nodes and spans");
1063
+ assert.doesNotMatch(workflowTokenRenderSource, /innerHTML|insertAdjacentHTML/, "workflow syntax token rendering should not inject source through HTML APIs");
1064
+ assert.match(workflowPreviewSource, /search\.type = "search"[\s\S]*Previous match[\s\S]*Next match[\s\S]*Wrap lines[\s\S]*Copy source/, "workflow inspector should expose search navigation, wrap, and copy controls");
1065
+ assert.match(workflowPreviewSource, /search\.addEventListener\("keydown", \(event\) => \{\s*if \(event\.key !== "Enter"\) return;\s*event\.preventDefault\(\);\s*if \(matchingLineIndexes\.length === 0\) return;\s*setActiveMatch\(activeMatchIndex \+ \(event\.shiftKey \? -1 : 1\)\);\s*\}\);/, "workflow search should prevent Enter form submission before returning for no matches and navigate only when matches exist");
1066
+ assert.match(workflowPreviewSource, /workflow-script-search-status[\s\S]*aria-live", "polite"[\s\S]*workflow-script-copy-status[\s\S]*aria-live", "polite"/, "workflow search and copy feedback should be announced");
1067
+ assert.match(workflowPreviewSource, /addDialogButton\("Cancel workflow"[\s\S]*cancelled: true[\s\S]*addDialogButton\("Back to approval"[\s\S]*value: request\.prefill/, "workflow inspector actions should cancel explicitly or return the original prefill unchanged");
1068
+ assert.match(css, /\.extension-dialog\.workflow-script-dialog \{[\s\S]*width: min\(96rem, calc\(100vw - 2rem\)\)[\s\S]*height: min\(58rem, calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\)\)[\s\S]*overflow: hidden/, "workflow inspector should use a large visual-viewport-bounded desktop dialog");
1069
+ assert.match(css, /\.workflow-script-toolbar \{[\s\S]*grid-template-columns: minmax\(12rem, 1fr\) repeat\(4, auto\)[\s\S]*\.workflow-script-code \{[\s\S]*overflow: auto[\s\S]*font-family: ui-monospace[\s\S]*\.workflow-script-line-number \{[\s\S]*position: sticky/, "workflow inspector should style its toolbar, scrollable code surface, and persistent line-number gutter");
1070
+ assert.match(css, /\.workflow-script-code\.is-wrapped[\s\S]*white-space: pre-wrap[\s\S]*\.workflow-script-line\.is-search-match[\s\S]*\.workflow-script-line\.is-active-match[\s\S]*box-shadow:/, "workflow inspector should distinguish matches and support soft wrapping");
1071
+ assert.match(css, /\.workflow-script-code:focus-visible[\s\S]*outline:[\s\S]*\.workflow-script-token-keyword[\s\S]*var\(--ctp-mauve\)[\s\S]*\.workflow-script-token-string[\s\S]*var\(--ctp-green\)[\s\S]*\.workflow-script-token-number[\s\S]*var\(--ctp-peach\)[\s\S]*\.workflow-script-token-comment[\s\S]*var\(--ctp-subtext\)/, "workflow inspector should provide a visible focus ring and high-contrast token colors");
1072
+ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*\.extension-dialog\.workflow-script-dialog \{[\s\S]*height: calc\(var\(--visual-viewport-height, 100dvh\) - 0\.25rem - env\(safe-area-inset-top\)\)[\s\S]*\.workflow-script-toolbar \{[\s\S]*grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)[\s\S]*\.workflow-script-dialog #dialogActions \{[\s\S]*grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/, "workflow inspector mobile bottom sheet should respect the visual viewport and keep controls reachable");
1021
1073
  // Phase 3: browser voice loop (Web Speech STT/TTS) wiring.
1022
1074
  const voiceModule = await readFile(join(root, "public", "voice-conversation.mjs"), "utf8");
1023
1075
  assert.match(voiceModule, /export function createVoiceConversationController\(options = \{\}\)/, "voice loop should live in a dependency-injected module for Node tests");
@@ -1141,7 +1193,13 @@ assert.match(server, /function addCppRunners\(runners, cwd\)[\s\S]*C\/C\+\+ CMak
1141
1193
  assert.match(server, /function addDockerComposeRunner\(runners, cwd\)[\s\S]*docker compose up[\s\S]*docker-compose up/, "server should detect Docker Compose runners");
1142
1194
  assert.match(server, /APP_RUNNER_SHELL_SCRIPT_DIRS = \["", "dev", "scripts", "dev\/scripts"\][\s\S]*function addShellScriptRunners\(runners, cwd\)/, "server should detect bash\/zsh\/fish scripts in root, dev, scripts, and dev\/scripts");
1143
1195
  assert.match(app, /const releaseNpmOutputExpandedByTab = new Map\(\)/, "release-npm output collapse state should be tracked per browser tab");
1196
+ assert.match(app, /const workflowTerminalScrollByTab = new Map\(\)/, "workflow terminal follow state should be isolated per browser tab");
1144
1197
  assert.match(app, /function renderReleaseNpmOutputDetails\(key, streamHeader, terminal, controls = null\)[\s\S]*node\.open = releaseNpmOutputExpandedByTab\.get\(stateKey\) !== false[\s\S]*release-npm-output-toggle/, "release-npm output should render as a browser-side details expander");
1198
+ assert.match(app, /function workflowMetaItem\(label, value[\s\S]*workflow-meta-label[\s\S]*workflow-meta-value[\s\S]*workflow-meta-description/, "workflow metadata should pair human-readable labels and values with an optional visible description");
1199
+ assert.match(app, /function bindWorkflowTerminalScroll\([\s\S]*Auto-follow paused[\s\S]*distanceFromBottom <= 24[\s\S]*requestAnimationFrame\(restorePosition\)/, "workflow output should preserve reading position and follow only near the live tail");
1200
+ assert.match(app, /meta\.setAttribute\("role", "group"\)[\s\S]*meta\.setAttribute\("aria-label", "Workflow run summary"\)[\s\S]*"Limited history"[\s\S]*"Older output omitted from this view\."/, "workflow subprocess metadata should expose an accessible group and visible output-limit explanation");
1201
+ assert.match(app, /terminal\.dataset\.preserveScrollOnToggle = "true"[\s\S]*bindWorkflowTerminalScroll\(terminal, outputDetails, followStatus, \{ live, runId: payload\.runId \}\)/, "workflow output should opt into its own position restoration without changing shared terminal toggles");
1202
+ assert.match(app, /workflowMetaItem\("Run"[\s\S]*workflowMetaItem\("Phase"[\s\S]*workflowMetaItem\("Tasks"[\s\S]*"Limited history"/, "workflow subprocess summary should distinguish status, phase, task progress, and limited output history");
1145
1203
  assert.match(app, /releaseNpmStreamHeader\("Live output stream", outputLines\.length, \{ live: true \}\)/, "release-npm live output should expose a clear stream heading");
1146
1204
  assert.match(app, /renderReleaseNpmOutputDetails\("release-npm:output", streamHeader, terminal, controls\)/, "release-npm live stream should be wrapped in the local expander");
1147
1205
  assert.match(app, /function renderReleaseAurOutputWidget\(\)/, "release-aur live output should use a specialized Web UI renderer");
@@ -1282,6 +1340,7 @@ assert.match(app, /case "agent_end":[\s\S]*?clearRunIndicatorActivity\(\)/, "age
1282
1340
  assert.match(app, /case "agent_end":[\s\S]*?notifyAgentDone\(event\.tabId \|\| activeTabId/, "agent completion should trigger optional done notifications");
1283
1341
  assert.match(app, /function getPathTrigger\(\)/, "prompt composer should detect @ file\/path reference triggers");
1284
1342
  assert.match(app, /api\(`\/api\/path-suggestions\?query=\$\{encodeURIComponent\(trigger\.query\)\}`/, "@ reference suggestions should load from the server as the user types");
1343
+ assert.match(app, /async function api\([\s\S]*?if \(signal\?\.aborted \|\| error\?\.name === "AbortError"\) throw error;[\s\S]*?setBackendOffline\(true, offlineError\)/, "cancelled @ autocomplete requests should not mark the server offline");
1285
1344
  assert.match(app, /formatPathReference\(suggestion\.path, trigger\.quoted\)/, "accepting a path suggestion should insert an @ reference into the prompt");
1286
1345
  assert.match(app, /let pathSuggestActiveQuery = null/, "@ autocomplete should track the active path query to avoid duplicate refresh flicker");
1287
1346
  assert.match(app, /pathSuggestActiveQuery === trigger\.query[\s\S]*?return;/, "@ autocomplete should skip duplicate same-query fetches from input and keyup events");
@@ -1464,9 +1523,9 @@ assert.match(readme, /Tracked subagent output[\s\S]*dedicated \*\*Subagent\*\* t
1464
1523
  assert.match(app, /let tabSeenCompletionSerials = new Map\(\)/, "frontend should track which tab completions have been seen");
1465
1524
  assert.match(app, /let activeTabGeneration = 0/, "frontend should version active-tab UI state to reject stale async work");
1466
1525
  assert.match(app, /function isCurrentTabContext\(context\)/, "frontend should identify stale active-tab refresh contexts");
1467
- assert.match(app, /function connectEvents\(tabContext = activeTabContext\(\)\)[\s\S]*?eventSource !== source/, "frontend should ignore stale SSE messages from old active tabs");
1526
+ assert.match(app, /function connectEvents\(tabContext = activeTabContext\(\), \{ requestedMode = "auto", fallbackAttempted = false \} = \{\}\)[\s\S]*?eventSource !== source/, "frontend should ignore stale SSE messages from old active tabs");
1468
1527
  assert.match(app, /let foregroundReconcileTimer = null/, "frontend should debounce foreground resume reconciliation");
1469
- assert.match(app, /case "webui_connected":[\s\S]*?scheduleForegroundReconcile\("event stream reconnect", 0\)/, "SSE reconnect should reconcile authoritative state and messages instead of only tabs");
1528
+ assert.match(app, /case "webui_connected":[\s\S]*?featureCategoryByTab\.delete\(connectedTabId\)[\s\S]*?renderFeatureCategoryTag\(connectedTabId\)[\s\S]*?scheduleForegroundReconcile\("event stream reconnect", 0\)/, "SSE reconnect should clear cached feature-category absence before replaying authoritative statuses and reconciling state");
1470
1529
  assert.match(app, /async function reconcileForegroundState\(reason = "resume"\)[\s\S]*?refreshTabs\(\)[\s\S]*?ensureActiveEventStream\(tabContext\)[\s\S]*?refreshAll\(tabContext\)/, "foreground reconciliation should refresh tabs plus active transcript after mobile backgrounding");
1471
1530
  assert.match(app, /document\.addEventListener\("visibilitychange"[\s\S]*?scheduleForegroundReconcile\("visibility resume", 0\)/, "returning to a hidden mobile tab should force a server snapshot refresh");
1472
1531
  assert.match(app, /window\.addEventListener\("pageshow", \(\) => scheduleForegroundReconcile\("page show", 0\)\)/, "BFCache or PWA page resume should force a server snapshot refresh");
@@ -1572,10 +1631,10 @@ assert.match(server, /function rememberExtensionWidgetEvent\(tab, event\)[\s\S]*
1572
1631
  assert.match(server, /rememberExtensionStatusEvent\(tab, scopedEvent\)[\s\S]*rememberExtensionWidgetEvent\(tab, scopedEvent\)[\s\S]*trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should retain extension statuses and widgets before broadcasting");
1573
1632
  assert.match(server, /trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should populate pending extension UI storage before broadcasting");
1574
1633
  assert.match(server, /scopedEvent = \{ \.\.\.scopedEvent,[\s\S]*?pendingExtensionUiRequestCount: pendingExtensionUiRequests\(tab\)\.length \}/, "RPC events should broadcast pending blocker counts for tab indicators");
1575
- assert.match(server, /function replayExtensionStatuses\(tab, res\)[\s\S]*method: "setStatus"/, "server should replay latest extension statuses on SSE reconnect");
1576
- assert.match(server, /function replayExtensionWidgets\(tab, res\)[\s\S]*method: "setWidget"/, "server should replay latest extension widgets on SSE reconnect");
1577
- assert.match(server, /function replayPendingExtensionUiRequests\(tab, res\)/, "server should be able to replay missed extension UI requests on SSE reconnect");
1578
- assert.match(server, /replayExtensionStatuses\(tab, res\);\n\s+replayExtensionWidgets\(tab, res\);\n\s+replayPendingExtensionUiRequests\(tab, res\)/, "SSE connections should replay extension statuses and widgets before pending blockers");
1634
+ assert.match(server, /function replayExtensionStatuses\(tab, client\)[\s\S]*method: "setStatus"/, "server should replay latest extension statuses on SSE reconnect");
1635
+ assert.match(server, /function replayExtensionWidgets\(tab, client\)[\s\S]*method: "setWidget"/, "server should replay latest extension widgets on SSE reconnect");
1636
+ assert.match(server, /function replayPendingExtensionUiRequests\(tab, client\)/, "server should be able to replay missed extension UI requests on SSE reconnect");
1637
+ assert.match(server, /replayExtensionStatuses\(tab, client\);\n\s+replayExtensionWidgets\(tab, client\);\n\s+replayPendingExtensionUiRequests\(tab, client\)/, "SSE connections should replay extension statuses and widgets before pending blockers");
1579
1638
  assert.match(server, /pendingExtensionUiRequests: pendingExtensionUiRequestSummaries\(tab\)/, "detailed Web UI status should expose pending extension UI blockers");
1580
1639
  assert.match(server, /resolvePendingExtensionUiRequest\(tab, payload\.id\)/, "extension UI responses should clear the pending blocker cache");
1581
1640
  assert.match(server, /type: "webui_extension_ui_resolved"[\s\S]*?pendingExtensionUiRequestCount/, "extension UI responses should notify clients that a blocker resolved");