@firstpick/pi-package-webui 0.8.8 → 0.9.0

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 (44) hide show
  1. package/README.md +12 -0
  2. package/bin/pi-webui-rpc-supervisor.mjs +4 -1
  3. package/bin/pi-webui.mjs +15 -3
  4. package/lib/rpc-supervisor-protocol.mjs +6 -1
  5. package/package.json +1 -1
  6. package/public/app.js +659 -150
  7. package/public/index.html +28 -13
  8. package/public/service-worker.js +1 -1
  9. package/public/styles.css +789 -23
  10. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  11. package/tests/browser/interaction-continuity.spec.mjs +120 -0
  12. package/tests/browser/mobile-foundation.spec.mjs +363 -5
  13. package/tests/browser/optimistic-prompt.spec.mjs +24 -10
  14. package/tests/browser/persistent-ui-layout.spec.mjs +2 -0
  15. package/tests/browser/search-match-highlighting.spec.mjs +104 -0
  16. package/tests/browser/side-panel-section-reorder.spec.mjs +16 -1
  17. package/tests/codex-fast-mode-static.test.mjs +2 -2
  18. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  19. package/tests/fast-mode-client-static.test.mjs +1 -1
  20. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  21. package/tests/file-tree-search-layout-static.test.mjs +261 -0
  22. package/tests/file-viewer-search-static.test.mjs +7 -2
  23. package/tests/fixtures/fake-pi.mjs +4 -1
  24. package/tests/foreground-transcript-catch-up-static.test.mjs +91 -0
  25. package/tests/http-endpoints-harness.test.mjs +35 -2
  26. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  27. package/tests/mobile-compact-layout.test.mjs +60 -0
  28. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  29. package/tests/mobile-foundation-static.test.mjs +12 -12
  30. package/tests/mobile-phone-experience-static.test.mjs +2 -2
  31. package/tests/mobile-static.test.mjs +39 -20
  32. package/tests/open-issue-wizard-static.test.mjs +1 -1
  33. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  34. package/tests/questionnaire-dialog.test.mjs +3 -3
  35. package/tests/rpc-supervisor-host.test.mjs +18 -1
  36. package/tests/rpc-supervisor-protocol.test.mjs +5 -0
  37. package/tests/search-match-highlighting-static.test.mjs +27 -0
  38. package/tests/session-sampling-ui-static.test.mjs +3 -3
  39. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  40. package/tests/side-panel-section-reorder-static.test.mjs +23 -10
  41. package/tests/stream-output-isolation-static.test.mjs +1 -1
  42. package/tests/streaming-ui-coupling.test.mjs +8 -0
  43. package/tests/terminal-tab-workspace-static.test.mjs +15 -1
  44. package/tests/theme-customizer-static.test.mjs +1 -1
@@ -8,6 +8,7 @@ import { setTimeout as delay } from "node:timers/promises";
8
8
  import { dirname, join } from "node:path";
9
9
  import { fileURLToPath, pathToFileURL } from "node:url";
10
10
  import { terminateProcessTree } from "../lib/process-tree.mjs";
11
+ import { deriveSupervisorRecoveryToken } from "../lib/rpc-supervisor-protocol.mjs";
11
12
  import { readSupervisorState, supervisorPaths, supervisorPidIsAlive } from "../lib/rpc-supervisor-state.mjs";
12
13
  import { REQUIRED_THEME_TOKENS, serializeTheme } from "../public/theme-contract.mjs";
13
14
 
@@ -2678,6 +2679,35 @@ try {
2678
2679
  assert.equal(stashDrop.body?.ok, true, "confirmed stash drop should succeed");
2679
2680
  assert.equal(stashDrop.body?.data?.stashes?.length, 0, "dropping the only stash should empty the list");
2680
2681
 
2682
+ // Both footer Sync and Guided Git use this push endpoint. Even when a
2683
+ // feature branch mistakenly tracks origin/main, push its current HEAD to
2684
+ // the same-named remote branch without changing remote main.
2685
+ const mismatchedPushBranch = "feature/current-branch-push";
2686
+ const remoteMainBeforeCurrentBranchPush = runGitFixture(["rev-parse", "refs/heads/main"], remoteBare, "current-branch push fixture should record remote main");
2687
+ runGitFixture(["switch", "-c", mismatchedPushBranch], localRepo, "current-branch push fixture should create its feature branch");
2688
+ runGitFixture(["config", `branch.${mismatchedPushBranch}.remote`, "origin"], localRepo, "current-branch push fixture should configure the upstream remote");
2689
+ runGitFixture(["config", `branch.${mismatchedPushBranch}.merge`, "refs/heads/main"], localRepo, "current-branch push fixture should reproduce the mismatched upstream branch");
2690
+ await writeFile(path.join(localRepo, "current-branch-push.txt"), "feature branch only\n");
2691
+ runGitFixture(["add", "current-branch-push.txt"], localRepo, "current-branch push fixture should stage its marker");
2692
+ runGitFixture(["commit", "-m", "current branch push fixture"], localRepo, "current-branch push fixture should commit its marker");
2693
+ const currentBranchHead = runGitFixture(["rev-parse", "HEAD"], localRepo, "current-branch push fixture should record feature HEAD");
2694
+
2695
+ const pushCurrentBranch = await request("127.0.0.1", "/api/git-workflow/push", { method: "POST", body: { tab: remoteTabId }, timeoutMs: 30_000 });
2696
+ assert.equal(pushCurrentBranch.body?.ok, true, `push should target the checked-out branch despite a mismatched upstream: ${pushCurrentBranch.body?.error || ""}`);
2697
+ assert.equal(pushCurrentBranch.body?.data?.branch, mismatchedPushBranch);
2698
+ assert.equal(pushCurrentBranch.body?.data?.remote, "origin");
2699
+ assert.equal(runGitFixture(["rev-parse", `refs/heads/${mismatchedPushBranch}`], remoteBare, "current-branch push fixture should create the same-named remote branch"), currentBranchHead);
2700
+ assert.equal(runGitFixture(["rev-parse", "refs/heads/main"], remoteBare, "current-branch push fixture should leave remote main unchanged"), remoteMainBeforeCurrentBranchPush);
2701
+ assert.equal(
2702
+ runGitFixture(["rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{upstream}"], localRepo, "current-branch push fixture should read the repaired upstream"),
2703
+ `origin/${mismatchedPushBranch}`,
2704
+ "push should replace origin/main tracking with the same-named remote feature branch",
2705
+ );
2706
+ const currentBranchStatus = runGitFixture(["status", "--porcelain=v2", "--branch"], localRepo, "current-branch push fixture should read synchronized status");
2707
+ assert.match(currentBranchStatus, new RegExp(`^# branch\\.upstream origin/${mismatchedPushBranch}$`, "m"));
2708
+ assert.match(currentBranchStatus, /^# branch\.ab \+0 -0$/m, "the repaired upstream should leave no phantom outgoing Sync count");
2709
+ runGitFixture(["switch", "main"], localRepo, "current-branch push fixture should restore main");
2710
+
2681
2711
  // Fetch, divergence classification, integrate, push classification
2682
2712
  await writeFile(path.join(remoteWork, "incoming.txt"), "base\nremote one\nremote two\nremote three\n");
2683
2713
  runGitFixture(["commit", "-am", "remote three"], remoteWork, "remote worktree should commit third incoming change");
@@ -3848,12 +3878,15 @@ try {
3848
3878
  body: recoveryBody,
3849
3879
  });
3850
3880
  assert.equal(wrongCredentialRecovery.status, 401, "recovery endpoint must reject an incorrect bearer credential");
3881
+ const liveRecoverySupervisorState = await readSupervisorState(await supervisorPaths({ agentDir: workflowPolicyAgentDir, port }));
3882
+ assert.ok(liveRecoverySupervisorState?.token, "recovery endpoint test needs the active supervisor credential");
3883
+ const retainedChildRecoveryToken = deriveSupervisorRecoveryToken(liveRecoverySupervisorState.token);
3851
3884
  const invalidModeRecovery = await request("127.0.0.1", "/api/recovery/plan", {
3852
3885
  method: "POST",
3853
- headers: { authorization: `Bearer ${recoveryEndpointToken}` },
3886
+ headers: { authorization: `Bearer ${retainedChildRecoveryToken}` },
3854
3887
  body: { ...recoveryBody, mode: "apply" },
3855
3888
  });
3856
- assert.equal(invalidModeRecovery.status, 400, "recovery endpoint must accept plan-only mode exclusively");
3889
+ assert.equal(invalidModeRecovery.status, 400, "recovery endpoint must accept the stable managed-child credential and plan-only mode exclusively");
3857
3890
  if (lan) {
3858
3891
  const remoteRecovery = await request(lan, "/api/recovery/plan", {
3859
3892
  method: "POST",
@@ -16,9 +16,9 @@ assert.match(app, /import \{ installMiddleButtonDragScroll \} from "\.\/middle-b
16
16
  assert.match(app, /installMiddleButtonDragScroll\(\{[\s\S]*onDirection: \(\{ target, offsetY \}\)[\s\S]*noteChatUserScrollIntent\(\{ type: "middle-drag", deltaY: offsetY \}\)/, "chat auto-scroll direction should feed the existing follow/pause intent state");
17
17
  assert.match(app, /event\?\.type === "middle-drag"\) return event\.deltaY > 0;/, "moving below the press point should be recognized as intent to read later chat output");
18
18
  assert.match(css, /body\.middle-button-auto-scrolling,[\s\S]*cursor: all-scroll !important;[\s\S]*user-select: none !important;/, "active automatic scrolling should expose a directional-scroll affordance and suppress accidental selection");
19
- assert.match(html, /styles\.css\?v=104/, "changed drag-scroll styles should advance the stylesheet revision");
20
- assert.match(html, /app\.js\?v=120/, "changed drag-scroll wiring should advance the app revision");
21
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81";[\s\S]*"\/middle-button-drag-scroll\.mjs"/, "offline PWA installs should refresh and cache the new controller module");
19
+ assert.match(html, /styles\.css\?v=107/, "changed drag-scroll styles should advance the stylesheet revision");
20
+ assert.match(html, /app\.js\?v=121/, "changed drag-scroll wiring should advance the app revision");
21
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84";[\s\S]*"\/middle-button-drag-scroll\.mjs"/, "offline PWA installs should refresh and cache the new controller module");
22
22
  assert.match(JSON.parse(packageJson).scripts.check, /node --check public\/middle-button-drag-scroll\.mjs/, "the package check should parse the startup-critical controller module");
23
23
 
24
24
  console.log("middle-button-drag-scroll-static.test.mjs passed");
@@ -0,0 +1,60 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+ import { dirname, join } from "node:path";
4
+ import { fileURLToPath } from "node:url";
5
+
6
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..");
7
+ const [html, css, app, readme, technical] = await Promise.all([
8
+ readFile(join(root, "public", "index.html"), "utf8"),
9
+ readFile(join(root, "public", "styles.css"), "utf8"),
10
+ readFile(join(root, "public", "app.js"), "utf8"),
11
+ readFile(join(root, "README.md"), "utf8"),
12
+ readFile(join(root, "TECHNICAL.md"), "utf8"),
13
+ ]);
14
+
15
+ assert.match(html, /id="terminalTabsToggleButton"[^>]*aria-controls="terminalTabsDrawerContent"[^>]*aria-expanded="false"/, "terminal summary should control the collapsed drawer");
16
+ assert.match(html, /id="terminalTabsDrawerContent"[^>]*aria-label="Terminal navigation"[\s\S]*id="tabBar"[\s\S]*class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="closeAllTabsButton"/, "drawer should reuse canonical tabs and workspace actions");
17
+ assert.match(html, /id="terminalTabsBackdrop"[^>]*aria-label="Close terminal navigation"[^>]*hidden/, "drawer should expose an accessible backdrop close target");
18
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs-shell \{[\s\S]*?position:\s*fixed;[\s\S]*?top:\s*0;[\s\S]*?right:\s*0;[\s\S]*?left:\s*0;[\s\S]*?width:\s*100vw;[\s\S]*?height:\s*var\(--visual-viewport-height, 100dvh\);[\s\S]*?border-radius:\s*0;/, "expanded terminal navigation should fill the visual viewport");
19
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs \{[\s\S]*?position:\s*static;[\s\S]*?flex-direction:\s*column;[\s\S]*?overflow-y:\s*auto/, "drawer tabs should follow the vertical left-sidebar model");
20
+ assert.match(app, /function setMobileTabsExpanded\(expanded, \{ restoreFocus = false \} = \{\}\)[\s\S]*?setComposerActionsOpen\(false\)[\s\S]*?terminalTabsBackdrop\.hidden = !mobileTabsExpanded[\s\S]*?focusReturn\.focus/, "drawer state should coordinate competing surfaces and restore focus");
21
+ assert.match(app, /node\.addEventListener\("pointerenter", \(event\) => \{\n\s+if \(event\.pointerType === "touch"\) return;\n\s+scheduleFooterTooltip\(node\);/, "touch pointers should not schedule floating hover tooltips");
22
+ assert.match(app, /node\.addEventListener\("focus", \(\) => \{\n\s+if \(!node\.matches\(":focus-visible"\)\) return;\n\s+showFooterTooltip\(node\);/, "touch focus should not open a floating tooltip while keyboard focus remains supported");
23
+ assert.match(css, /@media \(hover: none\) and \(pointer: coarse\) \{[\s\S]*?\[data-tooltip\]:not\(:focus-visible\):not\(\.tooltip-open\)::before,[\s\S]*?::after \{[\s\S]*?display:\s*none !important;[\s\S]*?opacity:\s*0 !important;/, "coarse touch layouts should suppress hover-only pseudo tooltips");
24
+ assert.match(app, /function setMobileFooterExpanded\(expanded, \{ restoreFocus = false \} = \{\}\)[\s\S]*?button\.textContent = mobileFooterExpanded \? "−" : "Details"[\s\S]*?"Minimize Git footer details"[\s\S]*?activateDrawerModal\(elements\.statusBar, button[\s\S]*?setMobileFooterExpanded\(false, \{ restoreFocus: true \}\)/, "expanded mobile footer details should use a modal top minimize control with focus restoration");
25
+ assert.match(app, /const footerToggle = make\("button", "footer-details-toggle", mobileFooterExpanded \? "−" : "Details"\)[\s\S]*?aria-label[\s\S]*?setMobileFooterExpanded\(!mobileFooterExpanded, \{ restoreFocus: true \}\)/, "rendered footer details should expose only the minimize symbol while expanded");
26
+ assert.match(css, /html:not\(\[data-mobile-shell="v2"\]\):not\(\[data-tablet-shell="v2"\]\) body\.footer-details-expanded \.statusbar-git-footer \{[\s\S]*?position:\s*fixed;[\s\S]*?inset:\s*0;[\s\S]*?width:\s*100vw;[\s\S]*?height:\s*var\(--visual-viewport-height, 100dvh\);[\s\S]*?border-radius:\s*0;/, "legacy-mobile Git footer details should fill the complete visual viewport without owning v2 surfaces");
27
+ assert.match(css, /body\.footer-details-expanded \.statusbar-git-footer \{[\s\S]*?align-content:\s*start;[\s\S]*?grid-auto-rows:\s*max-content;[\s\S]*?body\.footer-details-expanded \.footer-line-main,[\s\S]*?body\.footer-details-expanded \.footer-line-meta \{[\s\S]*?grid-template-columns:\s*repeat\(2, minmax\(0, 1fr\)\);[\s\S]*?\.footer-line-main::before \{ content:\s*"Session"; \}[\s\S]*?\.footer-line-meta::before \{ content:\s*"Workspace, Git & runtime"; \}/, "expanded mobile Git details should pack compact two-column sections at the top of the overlay");
28
+ assert.match(css, /body\.footer-details-expanded \.footer-line-main > \.footer-metric:nth-child\(odd\):last-child \{ grid-column:\s*1 \/ -1; \}[\s\S]*?body\.footer-details-expanded \.footer-workspace,[\s\S]*?body\.footer-details-expanded \.footer-context,[\s\S]*?body\.footer-details-expanded \.footer-model,[\s\S]*?grid-column:\s*1 \/ -1;/, "odd metrics and long footer metadata should span the mobile details grid without leaving holes");
29
+ assert.match(css, /html:not\(\[data-mobile-shell="v2"\]\):not\(\[data-tablet-shell="v2"\]\) \.statusbar-git-footer \.git-footer-refresh-button \{ display:\s*none; \}[\s\S]*?body\.footer-details-expanded \.statusbar-git-footer \.git-footer-refresh-button \{[\s\S]*?display:\s*inline-grid;[\s\S]*?min-width:\s*44px;[\s\S]*?min-height:\s*44px;/, "legacy-mobile Git footer refresh should be available only in the expanded details overlay");
30
+ assert.match(css, /body\.footer-details-expanded \.side-panel-toggle-button,[\s\S]*?body\.footer-details-expanded \.side-panel-expand-button,[\s\S]*?body\.composer-actions-open \.side-panel-toggle-button,[\s\S]*?body\.composer-actions-open \.side-panel-expand-button,[\s\S]*?body\.mobile-tabs-expanded \.side-panel-toggle-button,[\s\S]*?body\.mobile-tabs-expanded \.side-panel-expand-button \{\n\s+display:\s*none !important;/, "full-screen mobile Git, More, and terminal overlays should hide both side-panel disclosure controls");
31
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs-shell\[aria-modal="true"\] \{\n\s+z-index:\s*122;/, "the modal terminal drawer should retain its layer above the blurred backdrop while child menus are open");
32
+ assert.match(css, /\.terminal-tab-meta \{ display:\s*none; \}\n\s+\.terminal-tab-group > \.terminal-tab-group-button > \.terminal-tab-meta \{ display:\s*block; \}/, "mobile group buttons should retain the desktop cwd metadata while standalone tab metadata stays compact");
33
+ assert.match(css, /\.terminal-tabs:has\(> \.terminal-tab-group\.menu-open:not\(\.terminal-tab-subagent-group\)\) > \.terminal-new-tab-menu \{\n\s+display:\s*none;/, "mobile tabs should hide the overall new-tab menu only while a regular group exposes its scoped add action");
34
+ assert.match(css, /\.footer-details-toggle \{\n\s+display:\s*block;\n\s+min-width:\s*44px;\n\s+min-height:\s*44px;/, "collapsed Details should retain a 44px mobile touch target");
35
+ assert.match(app, /function runFooterControlAction\(action, event\) \{\n\s+if \(mobileFooterExpanded\) setMobileFooterExpanded\(false, \{ restoreFocus: false \}\);\n\s+return action\(event\);/, "footer actions should deactivate the full-screen footer before opening dialogs or other surfaces");
36
+
37
+ assert.match(html, /id="composerActionsButton"[^>]*aria-controls="composerActionsPanel"[^>]*aria-expanded="false"[^>]*>More<\/button>/, "composer should expose one labelled secondary-action trigger");
38
+ assert.match(html, /id="composerActionsPanel"[^>]*aria-label="More composer actions"[\s\S]*Session &amp; workspace[\s\S]*Tools &amp; commands[\s\S]*Context &amp; modes/, "secondary actions should be grouped in task order");
39
+ assert.match(app, /function syncMobileComposerDisclosureLayout\(\)[\s\S]*?isMobileView\(\) && !isMobileShellV2Active\(\)[\s\S]*?composerActionsPanel\.append\(node\)/, "legacy mobile should reuse canonical secondary controls in the panel");
40
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-input-row \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\) 44px/, "collapsed composer should keep the prompt and attachment control in the input row");
41
+ assert.match(html, /id="chat" class="chat" aria-live="polite"[\s\S]*?<\/div>\s*<div id="runIndicatorHost" class="run-indicator-host"><\/div>/, "mobile should mount the run indicator in a dedicated host immediately after the transcript");
42
+ assert.match(css, /\.chat \{\n\s+padding:\s*0\.62rem 0\.58rem;[\s\S]*?\.run-indicator-host \{\n\s+padding:\s*0 0\.58rem 0\.62rem;[\s\S]*?\.run-indicator-host > \.run-indicator-message \.run-indicator-row \{[\s\S]*?grid-template-columns:\s*auto auto minmax\(0, 1fr\);[\s\S]*?\.run-indicator-host > \.run-indicator-message \.run-indicator-meta \{[\s\S]*?text-overflow:\s*ellipsis;[\s\S]*?white-space:\s*nowrap;/, "mobile should preserve the one-line run indicator layout at the transcript edge from its separate host");
43
+ assert.match(css, /\.todo-widget:not\(\[open\]\) \.todo-widget-summary \{ display:\s*block; \}[\s\S]*?\.todo-widget:not\(\[open\]\) \.todo-widget-goal,[\s\S]*?\.todo-widget:not\(\[open\]\) \.todo-widget-progress \{ display:\s*none; \}[\s\S]*?\.todo-widget:not\(\[open\]\) \.todo-widget-title \{[\s\S]*?text-overflow:\s*ellipsis;[\s\S]*?white-space:\s*nowrap;/, "collapsed mobile todo progress should stay on one overflow-safe summary line until expanded");
44
+ assert.match(css, /\/\* Balanced phone density:[\s\S]*?--mobile-control-size:\s*40px;[\s\S]*?--mobile-page-gutter:\s*0\.5rem;[\s\S]*?--mobile-body-text:\s*0\.86rem;/, "balanced phone density should use one coherent compact scale");
45
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-input-row \{ grid-template-columns:\s*minmax\(0, 1fr\) var\(--mobile-control-size\);[\s\S]*?body\.mobile-composer-disclosure \.composer-actions-panel \{[\s\S]*?padding:\s*calc\(3\.5rem \+ env\(safe-area-inset-top\)\)/, "legacy composer and full-screen More surfaces should use the compact scale");
46
+ assert.match(css, /html\[data-mobile-shell="v2"\] \.mobile-shell-appbar \{[\s\S]*?min-height:\s*calc\(68px \+ env\(safe-area-inset-top\)\);[\s\S]*?\.mobile-shell-nav \{[\s\S]*?min-height:\s*calc\(54px \+ env\(safe-area-inset-bottom\)\);/, "Mobile Experience v2 chrome should use the compact app bar and navigation heights");
47
+ assert.match(css, /html\[data-mobile-shell="v2"\] \.mobile-shell-session-button \{ grid-column:\s*1; grid-row:\s*1;[\s\S]*?#mobileSearchButton \{ grid-column:\s*2; grid-row:\s*1; \}[\s\S]*?#mobileMoreButton \{ grid-column:\s*3; grid-row:\s*1; \}[\s\S]*?\.mobile-shell-indicators \{ grid-row:\s*2;/, "v2 app-bar controls should share the first row instead of creating a sparse third row");
48
+ assert.match(css, /body\.mobile-composer-disclosure\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-row > #abortButton \{ order:\s*1; \}[\s\S]*?#steerButton \{ order:\s*2; \}[\s\S]*?#followUpButton \{ order:\s*3; \}[\s\S]*?\.composer-actions-button \{ order:\s*4; \}[\s\S]*?#sendButton \{ order:\s*5; \}/, "active primary controls should remain on one predictable row");
49
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-actions-panel \{[\s\S]*?position:\s*fixed;[\s\S]*?inset:\s*0;[\s\S]*?width:\s*100vw;[\s\S]*?height:\s*var\(--visual-viewport-height, 100dvh\);[\s\S]*?max-height:\s*none;[\s\S]*?border-radius:\s*0;/, "secondary actions should use the complete visual viewport");
50
+ assert.match(app, /composerActionsButton\.textContent = shouldOpen \? "−" : "More";[\s\S]*?aria-label", shouldOpen \? "Minimize more composer actions" : "Show more composer actions"/, "the open More overlay should expose an accessible minimize symbol instead of a Less label");
51
+ assert.match(css, /body\.mobile-composer-disclosure\.composer-actions-open \.composer-actions-panel \{ display:\s*grid; \}[\s\S]*?body\.mobile-composer-disclosure\.composer-actions-open \.composer-actions-button \{[\s\S]*?position:\s*fixed;[\s\S]*?top:\s*max\(0\.65rem, env\(safe-area-inset-top\)\);[\s\S]*?right:\s*max\(0\.7rem, env\(safe-area-inset-right\)\);[\s\S]*?width:\s*44px;[\s\S]*?height:\s*44px;/, "secondary actions should appear only after disclosure and keep a 44px minimize control reachable at the top-right");
52
+ assert.match(html, /id="sidePanelEditButton"[^>]*aria-pressed="false"[^>]*aria-label="Edit Control Deck section order"/, "mobile Control Deck should expose a default-off Edit mode");
53
+ assert.match(app, /function isSidePanelSectionReorderingEnabled\(\) \{\n\s+return !isMobileView\(\) \|\| sidePanelSectionEditMode;[\s\S]*?function moveSidePanelSectionByOffset\(sectionId, offset\) \{\n\s+if \(!isSidePanelSectionReorderingEnabled\(\)\) return false;[\s\S]*?function beginSidePanelSectionPointerDrag\(event, sectionId\) \{\n\s+if \(!isSidePanelSectionReorderingEnabled\(\) \|\|/, "desktop Control Deck reordering should stay active while mobile fails closed until Edit is active");
54
+ assert.match(css, /\.side-panel-edit-button \{\n\s+display:\s*none;[\s\S]*?\.side-panel-section-toggle\[data-side-panel-section-toggle\] \{\n\s+cursor:\s*pointer;\n\s+touch-action:\s*manipulation;[\s\S]*?\.side-panel\.section-edit-mode \.side-panel-section-toggle\[data-side-panel-section-toggle\] \{[\s\S]*?cursor:\s*grab;[\s\S]*?touch-action:\s*none;[\s\S]*?@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*?\.side-panel-edit-button \{ display:\s*inline-flex;/, "desktop should hide Edit while mobile restores it and switches section headers to drag capture in Edit mode");
55
+ assert.match(css, /body\.mobile-composer-disclosure\.mobile-keyboard-open \.composer-row \{[\s\S]*?repeat\(4,[\s\S]*?body\.mobile-composer-disclosure\.mobile-keyboard-open \.composer-actions-button,[\s\S]*?display:\s*none !important/, "keyboard-open mode should retain primary controls and suppress secondary chrome");
56
+
57
+ assert.match(readme, /On a phone, tap the current terminal name to open full-screen terminal navigation[\s\S]*Grouped terminals use their title as a dropdown[\s\S]*tap \*\*More\*\* to open[\s\S]*in a full-screen overlay[\s\S]*Git footer \*\*Details\*\* opens full-screen with refresh inside and a top `−` button[\s\S]*Hover-only tooltips stay hidden on touch controls[\s\S]*\*\*Control Deck\*\*[\s\S]*tap \*\*Edit\*\*[\s\S]*tap \*\*Done\*\*/, "README should explain the full-screen mobile paths and explicit Control Deck editing");
58
+ assert.match(technical, /## Mobile layout[\s\S]*open full-screen terminal navigation[\s\S]*regular or subagent terminal-group title is a dropdown button[\s\S]*Git footer \*\*Details\*\* opens as a full-screen legacy-mobile overlay[\s\S]*Tap \*\*More\*\* to open[\s\S]*accessible top-right `−` control[\s\S]*Control Deck section reordering is always enabled on desktop[\s\S]*`Alt\+ArrowUp` \/ `Alt\+ArrowDown`[\s\S]*Mobile keeps the transient \*\*Edit\*\* \/ \*\*Done\*\* mode[\s\S]*Touch pointers do not schedule hover-only tooltips[\s\S]*Tablet layout, desktop tab placement/, "technical reference should document always-on desktop reordering and transient mobile Edit mode");
59
+
60
+ console.log("mobile compact layout contracts passed");
@@ -47,9 +47,9 @@ assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-nav[\s\S]*?widt
47
47
  assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-surface[\s\S]*?width: min\(30rem, 72vw\)/, "tablet inspector must be a bounded right-side sheet");
48
48
  assert.match(css, /html\[data-tablet-shell="v2"\] \.file-viewer-pane[\s\S]*?position: fixed[\s\S]*?inset: 0/, "tablet files must default to full-screen replacement");
49
49
  assert.match(css, /and \(pointer: coarse\)[\s\S]*?min-height: 44px/, "coarse tablet pointers must retain the 44px target floor");
50
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "continuity/tablet assets need a coherent cache identity");
51
- assert.match(html, /styles\.css\?v=104/, "tablet CSS must have a coherent HTML revision");
52
- assert.match(html, /app\.js\?v=120/, "continuity app logic must have a coherent HTML revision");
50
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "continuity/tablet assets need a coherent cache identity");
51
+ assert.match(html, /styles\.css\?v=107/, "tablet CSS must have a coherent HTML revision");
52
+ assert.match(html, /app\.js\?v=121/, "continuity app logic must have a coherent HTML revision");
53
53
  assert.match(readme, /tabletShell=v2/, "tablet preview and rollback must be documented");
54
54
 
55
55
  console.log("mobile-continuity-tablet-static.test.mjs passed");
@@ -16,9 +16,9 @@ const pkg = JSON.parse(packageRaw);
16
16
 
17
17
  const assertionIntent = [
18
18
  {
19
- assertion: "legacy mobile composer controls used a 40px minimum",
20
- status: "superseded",
21
- reason: "Phase 0 establishes the approved 44px phone/coarse-pointer hit-area floor, including Compact density.",
19
+ assertion: "phone controls use the user-selected 40px minimum",
20
+ status: "preserved",
21
+ reason: "Balanced phone density restores a 40px floor while retaining safe areas and unchanged tablet and desktop sizing.",
22
22
  },
23
23
  {
24
24
  assertion: "legacy mobile tab popover remains available when the v2 flag is off",
@@ -37,9 +37,9 @@ assert.match(pkg.scripts.check, /node --check public\/transcript-renderer\.mjs/,
37
37
  assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server must serve typed startup modules from the public asset boundary");
38
38
  assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
39
39
  assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
40
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "the cache identity must change with the startup graph");
41
- assert.match(html, /styles\.css\?v=104/, "the stylesheet revision must change with mobile/tablet CSS fixes");
42
- assert.match(html, /app\.js\?v=120/, "the app revision must change with continuity/tablet wiring");
40
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "the cache identity must change with the startup graph");
41
+ assert.match(html, /styles\.css\?v=107/, "the stylesheet revision must change with mobile/tablet CSS fixes");
42
+ assert.match(html, /app\.js\?v=121/, "the app revision must change with continuity/tablet wiring");
43
43
  assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;[\s\S]*?event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)[\s\S]*?return networkResponse;/, "runtime cache writes must extend the event lifetime without blocking bounded network responses");
44
44
  assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
45
45
  assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
@@ -47,8 +47,8 @@ assert.match(app, /function installMobileShellNavigationBridge\([\s\S]*?pi-webui
47
47
  assert.match(app, /function updateVisualViewportVars\([\s\S]*?keyboardOpen && !isMobileShellV2Active\(\)/, "v2 must retain viewport measurement but suppress legacy keyboard mutation");
48
48
  assert.match(app, /function syncMobileChatToBottomForInput\(\) \{\n if \(!isMobileView\(\) \|\| isMobileShellV2Active\(\)\) return;/, "v2 must suppress legacy forced chat scrolling");
49
49
  assert.match(app, /function bindMobileViewChanges\([\s\S]*?applyMobileShellViewport\(\);[\s\S]*?if \(isMobileShellV2Active\(\)\) return;/, "v2 must bypass legacy breakpoint mutations");
50
- assert.match(app, /function setMobileTabsExpanded\(expanded\) \{\n if \(isMobileShellV2Active\(\)\) return;/, "v2 must own surface visibility rather than the legacy tabs expander");
51
- assert.match(app, /function setMobileFooterExpanded\(expanded\) \{\n if \(isMobileShellV2Active\(\)\) return;/, "v2 must suppress legacy footer expansion");
50
+ assert.match(app, /function setMobileTabsExpanded\(expanded, \{ restoreFocus = false \} = \{\}\) \{\n if \(isMobileShellV2Active\(\)\) return;/, "v2 must own surface visibility rather than the legacy tabs expander");
51
+ assert.match(app, /function setMobileFooterExpanded\(expanded, \{ restoreFocus = false \} = \{\}\) \{\n if \(isMobileShellV2Active\(\)\) return;/, "v2 must suppress legacy footer expansion");
52
52
  assert.match(app, /function createBrowserPromptRequestId\(/, "browser prompt submission must mint an opaque request identity");
53
53
  assert.match(app, /if \(kind === "prompt"\) bodyBase\.requestId = createBrowserPromptRequestId\(\)/, "the browser identity must travel with primary prompt submission and remain stable in the captured manual-retry body");
54
54
  assert.match(server, /BROWSER_PROMPT_REQUEST_LIMIT = 256/, "server request deduplication must remain bounded");
@@ -61,10 +61,10 @@ assert.match(server, /SSE_BACKPRESSURE_MAX_PENDING_BYTES = 4 \* 1024 \* 1024/, "
61
61
  assert.match(server, /res\.once\("drain", \(\) => flushSseClient\(client\)\)/, "healthy SSE clients must resume after transient write backpressure");
62
62
  assert.match(server, /client\.tab\?\.sseClients\?\.delete\(client\)/, "eviction must remove only the slow client");
63
63
  assert.match(server, /client\.res\?\.end\(\)/, "slow-client eviction must finish chunked SSE responses gracefully");
64
- assert.match(css, /\.terminal-tabs-toggle-button \{[\s\S]*?min-height: 44px/, "phone tab targets must meet the 44px floor");
65
- assert.match(css, /\.composer-attach-button \{[\s\S]*?width: 44px;[\s\S]*?min-height: 44px/, "phone attachment target must meet the 44px floor");
66
- assert.match(css, /\.composer-row button \{\n width: 100%;\n min-height: 44px/, "phone composer controls must meet the 44px floor");
67
- assert.match(css, /html\[data-density="compact"\] button,[\s\S]*?@media \(max-width: 720px\)[\s\S]*?min-height: 44px/, "Compact density cannot shrink phone/coarse targets below 44px");
64
+ assert.match(css, /--mobile-control-size:\s*40px;/, "phone density should expose the selected 40px control floor");
65
+ assert.match(css, /\.terminal-tabs-toggle-button,[\s\S]*?\.terminal-close-all-button \{ min-height:\s*var\(--mobile-control-size\)/, "phone tab targets should use the shared compact control size");
66
+ assert.match(css, /\.side-panel-toggle-button,[\s\S]*?\.composer-attach-button,[\s\S]*?width:\s*var\(--mobile-control-size\);[\s\S]*?height:\s*var\(--mobile-control-size\);/, "phone icon controls should use the shared compact square size");
67
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-input-row \{ grid-template-columns:\s*minmax\(0, 1fr\) var\(--mobile-control-size\);/, "legacy phone composer layout should reserve only the compact attachment width");
68
68
  assert.match(css, /html\[data-mobile-shell="v2"\] \{ --mobile-shell-v2-active: 1; \}/, "new v2 CSS must be root-scoped");
69
69
 
70
70
  console.log("mobile-foundation-static.test.mjs passed");
@@ -54,12 +54,12 @@ assert.match(app, /tabAppRunnerRunningRun\(tab\)/, "Activity must consume canoni
54
54
  assert.match(app, /installMobilePhoneExperience\(\);/, "the phone shell must be installed at boot");
55
55
 
56
56
  assert.match(css, /html\[data-mobile-shell="v2"\] \.mobile-shell-v2/, "mobile CSS must be root scoped");
57
- assert.match(css, /min-height: 44px/, "phone targets must preserve the 44px floor");
57
+ assert.match(css, /--mobile-control-size:\s*40px;[\s\S]*?html\[data-mobile-shell="v2"\][\s\S]*?min-height:\s*var\(--mobile-control-size\)/, "phone v2 targets must use the selected 40px floor");
58
58
  assert.match(css, /env\(safe-area-inset-bottom\)/, "bottom controls must honor safe areas");
59
59
  assert.match(css, /data-mobile-presentation="essential"/, "Essential presentation must use progressive disclosures");
60
60
  assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
61
61
  assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
62
62
  assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
63
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "browser asset changes need a coherent cache tuple");
63
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "browser asset changes need a coherent cache tuple");
64
64
 
65
65
  console.log("mobile-phone-experience-static.test.mjs passed");
@@ -155,7 +155,7 @@ assert.match(html, /id="pathPickerClearSearchButton"[^>]*hidden[^>]*>Clear<\/but
155
155
  assert.match(app, /function fileTreeGitStatusForEntry\(entry = \{\}\) \{\s+return fileTreeState\.gitStatusByPath\.get\(normalizeFileTreePath\(entry\.path \|\| ""\)\) \|\| null;\s+\}/, "file tree rendering should use the refreshed Git-status snapshot instead of stale status embedded in cached entries");
156
156
  assert.match(app, /function fileTreeExpander\(expanded = false\)[\s\S]*make\("span", "file-tree-expander", expanded \? "▾" : "▸"\)[\s\S]*aria-hidden/, "file tree arrows should be visual children rather than separate buttons");
157
157
  assert.match(app, /function appendFileTreeEntry\(parent, entry, depth = 0\)[\s\S]*button\.append\([\s\S]*isDirectory \? fileTreeExpander\(expanded\)[\s\S]*file-tree-name[\s\S]*button\.addEventListener\("click"[\s\S]*toggleFileTreeDirectory\(path\)[\s\S]*item\.append\(button, fileTreeOverflowButton\(entry\)\)/, "each directory arrow and label should share one expansion button");
158
- assert.match(app, /function appendFileSearchEntry\(parent, entry\)[\s\S]*button\.append\([\s\S]*isDirectory \? fileTreeExpander\(false\)[\s\S]*button\.addEventListener\("click"[\s\S]*revealFileTreeEntry\(entry\)[\s\S]*item\.append\(button, fileTreeOverflowButton\(entry\)\)/, "directory search results should also combine their arrow and label action");
158
+ assert.match(app, /function appendFileSearchEntry\(parent, entry\)[\s\S]*button\.append\([\s\S]*isDirectory \? fileTreeExpander\(expanded\)[\s\S]*button\.addEventListener\("click"[\s\S]*toggleFileTreeDirectory\(path\)[\s\S]*item\.append\(button, fileTreeOverflowButton\(entry\)\)/, "directory search results should combine their arrow and label action while toggling in place");
159
159
  assert.match(css, /\.file-tree-node \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto[\s\S]*\.file-tree-item \{[\s\S]*grid-template-columns: auto auto minmax\(0, 1fr\) auto auto/, "file tree layout should reserve one row button plus the overflow action while keeping the arrow inside the row button");
160
160
  assert.match(app, /confirmLabel: activeAgentTabs\.length \? "Close and stop work" : count === 1 \? "Close tab" : "Close tabs"/, "single-tab confirmation should use singular close wording");
161
161
  assert.match(html, /data-side-panel-section="git"[\s\S]*class="side-panel-section-label">Git<[\s\S]*id="gitPanelCountBadge"[\s\S]*id="gitPanelGroups"[\s\S]*aria-label="Git repositories"[\s\S]*id="gitPanelContextMenu"[\s\S]*role="menu"/, "side panel should expose a collapsed, globally deduplicated Git repository list with a count and dedicated action menu");
@@ -457,8 +457,8 @@ assert.match(css, /button, select, input \{ min-height: 44px; \}/, "base control
457
457
  assert.match(css, /\.composer-row button \{\n\s+width:\s*100%;\n\s+min-height:\s*44px/, "mobile composer buttons should retain compact layout with 44px footer hit areas");
458
458
  assert.match(css, /\.composer-abort-button,\n\.composer-row button\.primary \{[\s\S]*?min-width:/, "Abort and Send should share stable bottom-row sizing");
459
459
  assert.match(css, /\.composer-abort-button\.long-pressing::after[\s\S]*?animation:\s*abort-long-press-fill var\(--abort-long-press-duration, 3000ms\) linear forwards/, "Abort should expose a visible 3-second long-press progress affordance");
460
- assert.match(css, /body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-abort-button:not\(\[hidden\]\) \{\n\s+order:\s*1;\n\s+grid-column:\s*span 2;/, "active mobile runs should move Abort to the top row");
461
- assert.match(css, /body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-actions-button \{ order:\s*4; \}[\s\S]*?body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-btw-button:not\(\[hidden\]\) \{\n\s+order:\s*5;\n\s+grid-column:\s*span 2;[\s\S]*?body\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-row button\.primary \{\n\s+order:\s*6;\n\s+grid-column:\s*span 2;/, "active mobile runs should keep Actions, /btw, and Send on the bottom row");
460
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-row \{[\s\S]*?grid-template-columns:\s*repeat\(5, minmax\(0, 1fr\)\)/, "mobile composer should reserve one compact row for primary run controls");
461
+ assert.match(css, /body\.mobile-composer-disclosure\.pi-run-active:not\(\.mobile-keyboard-open\) \.composer-row > #abortButton \{ order:\s*1; \}[\s\S]*?#steerButton \{ order:\s*2; \}[\s\S]*?#followUpButton \{ order:\s*3; \}[\s\S]*?\.composer-actions-button \{ order:\s*4; \}[\s\S]*?#sendButton \{ order:\s*5; \}/, "active mobile runs should keep Abort, Steer, Follow-up, More, and Send on one ordered row");
462
462
  assert.match(css, /#promptInput \{[\s\S]*?min-height:\s*calc\(1\.5em \+ 1\.8rem\)/, "prompt input should default to a compact single-line height");
463
463
  assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input should be JS-resized instead of showing a scrollbar by default");
464
464
  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");
@@ -625,10 +625,11 @@ assert.match(css, /\.composer-actions-panel > \.composer-options-menu \.composer
625
625
  assert.match(css, /\.composer-actions-panel > \.composer-publish-menu \.composer-auto-height-menu-panel \{[\s\S]*?height:\s*auto;[\s\S]*?max-height:\s*none;[\s\S]*?overflow:\s*visible;[\s\S]*?overflow-y:\s*visible;/, "mobile content-height menus should grow with their active commands without an internal scrollbar");
626
626
  assert.match(css, /\.composer-native-command-menu-item \{[\s\S]*?color:\s*var\(--ctp-mauve\)/, "skills/tools command menu items should be styled separately from publish actions");
627
627
  assert.match(css, /\.composer-actions-panel > \.composer-publish-menu[\s\S]*?grid-column: span 1/, "Publish and command menu buttons should fit beside Git workflow in mobile actions");
628
- assert.match(css, /\.composer-actions-panel[\s\S]*?bottom:\s*calc\(100% \+ 0\.42rem\)/, "mobile composer actions should open as an above-composer sheet");
628
+ assert.match(css, /body\.mobile-composer-disclosure \.composer-actions-panel \{[\s\S]*?position:\s*fixed;[\s\S]*?inset:\s*0;[\s\S]*?width:\s*100vw;[\s\S]*?height:\s*var\(--visual-viewport-height, 100dvh\);[\s\S]*?max-height:\s*none;/, "mobile composer actions should open as a full-screen visual-viewport overlay");
629
629
  assert.match(css, /body\.composer-actions-open \.composer-actions-panel \{ display: grid; \}/, "composer actions panel should only open when toggled");
630
630
  assert.match(css, /\.terminal-tabs-toggle-button \{ display: none; \}/, "terminal tab toggle should be hidden outside mobile CSS");
631
- assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.terminal-command-palette-button,\n\s+\.terminal-dashboard-button \{[\s\S]*?display:\s*inline-grid;/, "mobile header should keep the command palette button visible beside the dashboard button");
631
+ assert.match(html, /id="terminalTabsDrawerContent"[^>]*aria-label="Terminal navigation"[\s\S]*class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="closeAllTabsButton"/, "mobile terminal disclosure should group canonical tabs and workspace actions in one labelled drawer");
632
+ assert.match(html, /id="terminalTabsBackdrop"[^>]*aria-label="Close terminal navigation"[^>]*hidden/, "mobile terminal drawer should expose an accessible backdrop close target");
632
633
  assert.match(css, /\.command-palette-close-button \{[\s\S]*?min-width:\s*44px;[\s\S]*?min-height:\s*44px/, "command palette close button should meet touch-target sizing by default");
633
634
  assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-dialog \{[\s\S]*?width:\s*min\(100vw - 0\.5rem, 42rem\)[\s\S]*?\.command-palette-list \{[\s\S]*?align-content:\s*start;[\s\S]*?grid-auto-rows:\s*max-content;[\s\S]*?scrollbar-gutter:\s*auto;[\s\S]*?\.command-palette-item \{[\s\S]*?grid-template-columns:\s*minmax\(3\.4rem, 0\.26fr\) minmax\(0, 1fr\);[\s\S]*?min-height:\s*2\.72rem;/, "mobile command palette results should keep text-height rows and use compact two-column cards");
634
635
  assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-item-kind \{[\s\S]*?font-size:\s*var\(--text-xs\);[\s\S]*?\.command-palette-item-label \{ font-size:\s*0\.82rem; \}[\s\S]*?\.command-palette-item-description \{ font-size:\s*var\(--text-xs\); \}/, "mobile command palette result text should respect the typography floor");
@@ -652,8 +653,9 @@ assert.match(css, /\.terminal-new-tab-menu \.composer-publish-menu-item \{[\s\S]
652
653
  assert.match(css, /\.terminal-close-all-button \{[\s\S]*?color:\s*var\(--ctp-red\)/, "close-all tabs action should render as a top-right destructive tab action");
653
654
  assert.match(css, /\.terminal-tabs\.terminal-tabs-dense \{[\s\S]*?flex-wrap:\s*wrap/, "large terminal tab sets should wrap into a readable dense tab strip");
654
655
  assert.match(css, /\.terminal-tab-group-close \{[\s\S]*?border-left-color/, "terminal tab groups should style their close button distinctly");
655
- assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs \{ display: flex; \}/, "mobile tabs should expand only when toggled");
656
- assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*?\.terminal-tabs \{\n\s+position:\s*absolute;[\s\S]*?top:\s*calc\(100% \+ 0\.35rem\);[\s\S]*?overscroll-behavior:\s*contain;[\s\S]*?-webkit-overflow-scrolling:\s*touch;/, "expanded mobile tabs should overlay below the header with contained touch scrolling");
656
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs-shell \{[\s\S]*?position:\s*fixed;[\s\S]*?top:\s*0;[\s\S]*?right:\s*0;[\s\S]*?left:\s*0;[\s\S]*?width:\s*100vw;[\s\S]*?height:\s*var\(--visual-viewport-height, 100dvh\);[\s\S]*?border-radius:\s*0;/, "expanded mobile terminal navigation should fill the visual viewport");
657
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs-backdrop:not\(\[hidden\]\) \{[\s\S]*?position:\s*fixed;[\s\S]*?z-index:\s*121;[\s\S]*?backdrop-filter:\s*blur\(4px\)/, "expanded mobile terminal navigation should dim the inactive surface behind it");
658
+ assert.match(css, /body\.mobile-tabs-expanded \.terminal-tabs \{[\s\S]*?position:\s*static;[\s\S]*?flex-direction:\s*column;[\s\S]*?overflow-y:\s*auto;/, "expanded full-screen mobile terminal tabs should use the canonical vertical interaction model");
657
659
  assert.match(css, /\.terminal-tab-activity-indicator/, "terminal tabs should expose per-tab agent activity indicators");
658
660
  assert.match(css, /\.terminal-tab-app-runner-indicator \{[\s\S]*?terminal-tab-app-runner-pulse/, "terminal tabs should expose animated app-runner indicators");
659
661
  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");
@@ -670,11 +672,14 @@ assert.match(css, /\.terminal-tab\.activity-blocked[\s\S]*?rgba\(250, 179, 135/,
670
672
  assert.match(css, /\.terminal-tab\.activity-blocked > \.terminal-tab-button \.terminal-tab-activity-indicator[\s\S]*?background:\s*var\(--ctp-peach\)/, "blocked tab indicator dots should be orange");
671
673
  assert.doesNotMatch(css, /\.terminal-tab\.activity-(?:working|blocked|done)\s+\.terminal-tab-activity-indicator/, "group status styling should not cascade into child tabs in the group menu");
672
674
  assert.match(css, /\.terminal-tab\.activity-done/, "completed unseen work should have a distinct tab style");
673
- assert.match(css, /\.terminal-tabs[\s\S]*?position:\s*absolute/, "expanded mobile tabs should overlay instead of consuming transcript space");
675
+ assert.match(app, /function setMobileTabsExpanded\(expanded, \{ restoreFocus = false \} = \{\}\)[\s\S]*?setComposerActionsOpen\(false\)[\s\S]*?terminalTabsBackdrop\.hidden = !mobileTabsExpanded[\s\S]*?focusReturn\.focus/, "mobile terminal drawer should coordinate competing surfaces, backdrop state, and focus return");
674
676
  assert.match(css, /body\.mobile-keyboard-open \.terminal-tabs-shell,[\s\S]*?body\.mobile-keyboard-open \.widget-area,[\s\S]*?body\.mobile-keyboard-open \.statusbar/, "mobile keyboard mode should hide header, widgets, and footer");
675
677
  assert.match(css, /body\.mobile-keyboard-open \.composer-actions-button,[\s\S]*?body\.mobile-keyboard-open \.composer-actions-panel/, "mobile keyboard mode should hide the secondary actions sheet while keeping active-run controls available");
676
678
  assert.match(css, /\.server-offline-panel/, "PWA/offline shell should style a backend-offline recovery panel");
677
- assert.match(css, /body:not\(\.pi-run-active\):not\(\.mobile-keyboard-open\) \.composer-row button\.primary \{ grid-column: span 2; \}[\s\S]*?body:not\(\.pi-run-active\):not\(\.mobile-keyboard-open\) \.composer-btw-button\[hidden\] \+ button\.primary \{ grid-column: span 4; \}/, "idle mobile composer should keep Actions, /btw, and Send on one compact row with a hidden-button fallback");
679
+ assert.match(html, /id="composerActionsPanel"[^>]*aria-label="More composer actions"[\s\S]*Session &amp; workspace[\s\S]*Tools &amp; commands[\s\S]*Context &amp; modes/, "secondary mobile composer controls should be grouped in task order");
680
+ assert.match(app, /function syncMobileComposerDisclosureLayout\(\)[\s\S]*?isMobileView\(\) && !isMobileShellV2Active\(\)[\s\S]*?composerActionsPanel\.append\(node\)/, "legacy mobile should reuse canonical secondary composer controls inside the expandable panel");
681
+ assert.match(css, /body\.mobile-composer-disclosure:not\(\.pi-run-active\):not\(\.mobile-keyboard-open\) \.composer-row > \.composer-actions-button \{[\s\S]*?grid-column:\s*span 2;[\s\S]*?#sendButton \{[\s\S]*?grid-column:\s*span 3;/, "idle mobile composer should show only More and Send beneath the prompt and attachment row");
682
+ assert.match(css, /body\.mobile-composer-disclosure\.mobile-keyboard-open \.composer-row \{[\s\S]*?repeat\(4,[\s\S]*?body\.mobile-composer-disclosure\.mobile-keyboard-open \.composer-actions-button,[\s\S]*?display:\s*none !important/, "keyboard-open mobile composer should retain primary run controls while hiding secondary disclosure chrome");
678
683
  assert.match(css, /\[hidden\] \{ display: none !important; \}/, "hidden controls should not occupy layout space or be overridden by component display styles");
679
684
  assert.match(css, /\.statusbar-tui-footer \{[\s\S]*?gap:\s*0/, "default TUI-like footer should reduce statusbar chrome around the compact line");
680
685
  assert.match(css, /\.statusbar-git-footer \{[\s\S]*?--footer-chip-min-width:\s*7\.6rem;[\s\S]*?gap:\s*0\.58rem/, "enabled git-footer extension should keep styled spacing and one shared minimal chip width token");
@@ -1015,6 +1020,10 @@ assert.match(app, /let networkStatusLoaded = false;/, "Remote WebUI QR auto-popu
1015
1020
  assert.match(app, /const hadNetworkStatus = networkStatusLoaded;[\s\S]*if \(!hadNetworkStatus\) \{\n\s+remoteQrAutoPopupShown = true;\n\s+return;\n\s+\}[\s\S]*if \(!wasOpen && !remoteQrAutoPopupShown && isLocalWebuiBrowserOrigin\(\)\)/, "Remote WebUI QR should auto-open only after network access transitions open, not on initial refresh");
1016
1021
  assert.match(app, /remoteAuthToggle: \$\("#remoteAuthToggle"\)/, "Remote WebUI controls should bind the remote PIN auth toggle");
1017
1022
  assert.match(html, /id="networkControlField"[^>]*hidden/, "Remote WebUI browser controls should be hidden until the optional package is loaded and enabled");
1023
+ assert.match(html, /id="showRemoteQrButton"[^>]*hidden>Open QR-Code<\/button>/, "Remote WebUI side-panel controls should include the Open QR-Code button");
1024
+ assert.doesNotMatch(css, /#networkControlField\s+#showRemoteQrButton\s*\{[^}]*display:\s*none/, "Remote WebUI styles should not override the Open QR-Code button's runtime visibility");
1025
+ assert.match(app, /showRemoteQrButton\.hidden = !open;[\s\S]*?showRemoteQrButton\.disabled = rebinding \|\| !open;[\s\S]*?showRemoteQrButton\.textContent = "Open QR-Code";/, "Open QR-Code should keep the existing remote-open and rebinding availability rules");
1026
+ assert.match(app, /showRemoteQrButton\?\.addEventListener\("click", \(\) => showRemoteWebuiQrPopupFromNetwork\(\)/, "Open QR-Code should open the existing Remote WebUI QR popup");
1018
1027
  assert.match(app, /remoteWebuiCommand\(enable \? "authOn" : "authOff"/, "remote PIN auth toggle should dispatch through the Remote WebUI package command");
1019
1028
  assert.match(server, /webuiSettingsFile,[\s\S]*from "\.\.\/lib\/git-workflow-preferences\.mjs"/, "server should use the shared Pi Web UI settings persistence module");
1020
1029
  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");
@@ -1490,7 +1499,7 @@ assert.match(app, /function footerBranchOptionLabel\(branch = \{\}\)[\s\S]*clean
1490
1499
  assert.match(app, /function footerBranchOptionDetail\(branch, state, \{ selected, worktreePath \} = \{\}\)[\s\S]*if \(branch\.remote\) return `remote-only · creates local branch \$\{branch\.name\} tracking \$\{branch\.remoteRef\}`;/, "remote branch rows should visibly describe the local tracking branch they create");
1491
1500
  assert.match(app, /function renderFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*remote-only[\s\S]*Remote-only branch \$\{branch\.remoteRef\}: create local branch \$\{branch\.name\} tracking it[\s\S]*Advanced: git switch --track -c \$\{branch\.name\} \$\{branch\.remoteRef\} in this checkout/, "remote branch rows should expose remote-only state and exact-ref tracking actions in visible and accessible text");
1492
1501
  assert.match(app, /function openFooterBranchOption\(branch, state = footerBranchPickerState\)[\s\S]*if \(branch\.remote\) return createFooterGitBranchWorktree\(branch\.name, \{ skipConfirm: true, chooseBase: false, remoteRef: branch\.remoteRef/, "remote primary actions should forward the advertised exact remote ref to tracking-worktree creation");
1493
- assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\), \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)[\s\S]*: await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: true \}, tabId \}\)/, "remote worktree creation should submit the exact remote ref while local creation retains its base-ref request shape");
1502
+ assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\), \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, remoteRef: trackedRemoteRef, sessionMode: "fork-current", openTab: false \}, tabId \}\)[\s\S]*: await api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: false \}, tabId \}\)/, "remote and local worktree creation should preserve their exact refs while deferring tab opening until after creation");
1494
1503
  assert.match(app, /async function applyFooterGitBranch\(branch, \{[\s\S]*const response = trackedRemoteRef[\s\S]*\? await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create, remoteRef: trackedRemoteRef \}, tabId \}\)[\s\S]*: await api\("\/api\/git-branch", \{ method: "POST", body: \{ branch: branchName, create \}, tabId \}\)/, "remote in-place switching should submit the exact remote ref while local switching retains its request shape");
1495
1504
  assert.match(app, /function footerBranchOptionDetail\(branch, state,[\s\S]*state\.switchingKey \? state\.switchingKey === branch\.key[\s\S]*switchingKey: branch\.key/, "branch busy state should use the exact local-or-remote row identity instead of a collision-prone display label");
1496
1505
  assert.match(app, /GIT_BRANCH_TYPE_SUGGESTIONS = \["feat", "fix", "change", "perf", "test", "chore", "refactor", "docs", "style", "build", "ci", "revert"\]/, "new branch creation should reuse the conventional type suggestions from /git-staged-msg");
@@ -1499,7 +1508,7 @@ assert.match(app, /let footerBranchCreateDraft = \{ type: "", name: "" \}/, "new
1499
1508
  assert.match(app, /function footerBranchCreateType\(value = footerBranchCreateDraft\.type\) \{\n\s+return slugifyGitBranchPart\(value\);\n\}/, "branch type suggestions should not restrict or default custom user-entered prefixes");
1500
1509
  assert.match(app, /const slash = make\("span", "footer-branch-create-slash", "\/"\)/, "branch creation should visibly separate the prefix and user input with a slash");
1501
1510
  assert.match(app, /function gitWorktreeCreateCommandDisplay\(branch, state = footerBranchPickerState, baseRef = "origin\/main"\)[\s\S]*git worktree add -b[\s\S]*preview\.textContent = gitWorktreeCreateCommandDisplay\(branchName \|\| footerBranchCreatePreviewName\(\), state\)/, "branch worktree creation should preview the default origin/main start point");
1502
- assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\), state = footerBranchPickerState\)[\s\S]*A branch worktree is a separate checkout for parallel changes\.[\s\S]*origin\/main \(default\)[\s\S]*does not switch this tab's branch, commit, push, or delete anything[\s\S]*ignored dependencies such as node_modules or \.venv are not copied/, "create worktree button should explain the base choice and worktree behavior");
1511
+ assert.match(app, /function footerBranchCreateTooltip\(branchName = footerBranchCreateName\(\), state = footerBranchPickerState\)[\s\S]*A branch worktree is a separate checkout for parallel changes\.[\s\S]*origin\/main \(default\)[\s\S]*creates the worktree, then asks whether to open and switch to it in a separate Pi tab[\s\S]*does not switch this tab's branch, commit, push, or delete anything[\s\S]*ignored dependencies such as node_modules or \.venv are not copied/, "create worktree button should explain the base choice and post-creation switch choice");
1503
1512
  assert.match(html, /id="gitWorktreeBaseDialog"[\s\S]*id="gitWorktreeBaseOriginMain"[^>]*value="origin\/main" checked[\s\S]*id="gitWorktreeBaseCurrentHead"[^>]*value="HEAD"[\s\S]*id="gitWorktreeBaseCreateButton"/, "worktree creation should present an origin/main-default base picker with a current-HEAD alternative");
1504
1513
  assert.match(app, /function chooseGitWorktreeBase\(branch\)[\s\S]*gitWorktreeBaseOriginMain\.checked = true[\s\S]*gitWorktreeBaseCurrentHead\.checked = false/, "the worktree base picker should reset to origin/main for every creation");
1505
1514
  assert.match(css, /\.git-worktree-base-option:has\(input:checked\)[\s\S]*border-color:/, "the selected worktree base should be visibly highlighted");
@@ -1519,8 +1528,10 @@ assert.match(app, /const summary = make\("div", "workspace-dashboard-summary-row
1519
1528
  assert.match(css, /\.workspace-dashboard \{[\s\S]*?gap:\s*0\.52rem;[\s\S]*?padding:\s*0\.62rem 0\.78rem 0\.56rem;/, "workspace dashboard shell should use compact desktop spacing");
1520
1529
  assert.match(css, /\.workspace-dashboard-metric \{[\s\S]*?min-height:\s*3\.75rem;[\s\S]*?padding:\s*0\.48rem 0\.52rem;/, "workspace dashboard metrics should remain readable without tall cards");
1521
1530
  assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.workspace-dashboard-metrics \{ grid-template-columns: repeat\(2, minmax\(0, 1fr\)\); \}[\s\S]*?@media \(max-width: 480px\) \{\s*\.workspace-dashboard-metrics \{ grid-template-columns: 1fr; \}/, "workspace dashboard metrics should stay compact on tablets and stack on narrow phones");
1522
- assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\)[\s\S]*chooseGitWorktreeBase\(branchName\)[\s\S]*api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: true \}/, "new footer branch worktrees should ask for and submit the selected base ref");
1523
- assert.match(app, /async function openFooterGitWorktree\(path,[\s\S]*api\("\/api\/git-worktrees\/open", \{ method: "POST", body: \{ path: worktreePath, sessionMode: "fork-current", openTab: true \}/, "existing worktree actions should call the worktree open endpoint");
1531
+ assert.match(app, /async function createFooterGitBranchWorktree\(branch = footerBranchCreateName\(\)[\s\S]*chooseGitWorktreeBase\(branchName\)[\s\S]*api\("\/api\/git-worktrees", \{ method: "POST", body: \{ branchName, baseRef, sessionMode: "fork-current", openTab: false \}/, "new footer branch worktrees should ask for and submit the selected base ref without opening a tab early");
1532
+ assert.match(app, /async function confirmSwitchToCreatedFooterGitWorktree\(payload = \{\}, branchName = ""\)[\s\S]*payload\.created !== true[\s\S]*title: "Switch to new worktree\?"[\s\S]*switch to it now\?[\s\S]*confirmLabel: "Switch to worktree"[\s\S]*danger: false/, "newly created worktrees should prompt with a non-danger action before switching tabs");
1533
+ assert.match(app, /if \(payload\.created\) \{[\s\S]*openWorktreeResponseTab\(response, \{ branchName, action: "create" \}\)[\s\S]*confirmSwitchToCreatedFooterGitWorktree\(payload, branchName\)[\s\S]*openFooterGitWorktree\(worktreePath, \{ branchName, tabContext, skipConfirm: true, announce: false \}\)[\s\S]*\} else \{[\s\S]*openFooterGitWorktree\(worktreePath, \{ branchName, tabContext, skipConfirm: true \}\)/, "creation should switch only after acceptance while existing-worktree results retain automatic opening");
1534
+ assert.match(app, /async function openFooterGitWorktree\(path,[\s\S]*api\("\/api\/git-worktrees\/open", \{ method: "POST", body: \{ path: worktreePath, sessionMode: "fork-current", openTab: true \}/, "accepted and existing worktree actions should call the worktree open endpoint");
1524
1535
  assert.match(app, /elements\.newTabWorktreeButton\?\.addEventListener\("click", \(\) => openBranchWorktreePicker\(\)\)/, "new-tab menu branch worktree item should open the picker");
1525
1536
  assert.match(app, /\{ kind: "Git", label: "Branch worktree"[\s\S]*openBranchWorktreePicker\(\)/, "command palette should include branch worktree actions");
1526
1537
  assert.match(app, /dashboardAction\("Branch worktree", \(\) => openBranchWorktreePicker\(\), "worktree"\)/, "workspace dashboard should expose a branch worktree action");
@@ -1896,17 +1907,20 @@ assert.match(app, /\/api\/action-feedback not found; falling back to a normal pr
1896
1907
  assert.match(app, /actionFeedbackSteerMessage\(item\)/, "live action feedback should be sent as steering while the agent is running");
1897
1908
  assert.match(app, /function addTransientMessage\(\{ role = "notice"/, "frontend should render transient command output into the transcript");
1898
1909
  assert.match(app, /addTransientMessage\(\{ role: "extension", title: "extension output"/, "extension notify output should appear in the transcript, not only the event log");
1899
- assert.match(app, /function renderRunIndicator\(/, "frontend should render a transcript-level active agent indicator");
1910
+ assert.match(app, /function renderRunIndicator\(/, "frontend should render an active agent indicator");
1900
1911
  assert.match(app, /return "Agent is running: ";/, "active agent indicator should use the requested headline wording");
1901
1912
  assert.doesNotMatch(app, /"agent running"/, "active agent indicator should not render a separate title/header label");
1902
1913
  assert.doesNotMatch(app, /runIndicatorTimestamp/, "active agent indicator should not render a separate live timestamp header");
1903
- assert.match(app, /runIndicatorBubble = make\("article", "message runIndicator run-indicator-message streaming"\)/, "active agent indicator should use a dedicated streaming transcript card");
1914
+ assert.match(app, /runIndicatorBubble = make\("article", "message runIndicator run-indicator-message streaming"\)/, "active agent indicator should retain its dedicated streaming-card appearance");
1915
+ assert.match(html, /id="chat" class="chat" aria-live="polite"[\s\S]*?<\/div>\s*<div id="runIndicatorHost" class="run-indicator-host"><\/div>/, "active agent indicator should have a dedicated host immediately after the transcript");
1916
+ assert.match(css, /\.run-indicator-host\s*\{[\s\S]*?padding: 0 1rem 1rem;/, "the dedicated run-indicator host should preserve the transcript card inset");
1904
1917
  assert.match(app, /function standaloneLiveTranscriptBubbles\(\)[\s\S]*?streamThinkingBubble[\s\S]*?streamToolCallBubble[\s\S]*?streamBubble[\s\S]*?compactThinkingBubble[\s\S]*?compactTextBubble/, "transcript reconciliation should identify standalone live-tail bubbles that must stay mounted");
1905
- assert.match(app, /function resetChatOutput\(\)[\s\S]*?liveBubbles = standaloneLiveTranscriptBubbles\(\)[\s\S]*?preservedNodes[\s\S]*?child === runIndicatorBubble \|\| liveBubbles\.has\(child\)[\s\S]*?transcriptRenderer\.replaceChildren\(elements\.chat, \.\.\.preservedNodes\)/, "transcript resets should reconcile through the coordinator while preserving live output and the run indicator");
1906
- assert.match(app, /function appendChatMessageBubble\(bubble, \{ liveTail = false \} = \{\}\)[\s\S]*?child === runIndicatorBubble \|\| \(!liveTail && liveBubbles\.has\(child\)\)[\s\S]*?insertBefore\(bubble, tailAnchor\)/, "reconciled history should insert before the stable live transcript tail while new live output stays chronological");
1918
+ assert.match(app, /function resetChatOutput\(\)[\s\S]*?liveBubbles = standaloneLiveTranscriptBubbles\(\)[\s\S]*?preservedNodes[\s\S]*?child === elements\.stickyUserPromptButton \|\| liveBubbles\.has\(child\)[\s\S]*?transcriptRenderer\.replaceChildren\(elements\.chat, \.\.\.preservedNodes\)/, "transcript resets should reconcile through the coordinator while preserving only transcript-owned live output");
1919
+ assert.match(app, /function appendChatMessageBubble\(bubble, \{ liveTail = false \} = \{\}\)[\s\S]*?!liveTail && liveBubbles\.has\(child\)[\s\S]*?insertBefore\(bubble, tailAnchor\)/, "reconciled history should preserve the stable live transcript tail while new live output stays chronological");
1907
1920
  assert.match(app, /appendChatMessageBubble\(created\.bubble, \{ liveTail: streaming \|\| message\?\.live === true \}\)/, "streaming thinking, assistant text, and live tools should append after earlier live output");
1908
1921
  assert.match(app, /setChatScrollTopInstant\(Math\.min\(previousScrollTop, elements\.chat\.scrollHeight\)\)/, "paused-reader scroll restoration should bypass smooth scrolling to avoid a down-then-back animation");
1909
- assert.match(app, /function ensureRunIndicatorBubble\(\)[\s\S]*?!runIndicatorBubble \|\| !runIndicatorText \|\| !runIndicatorMeta[\s\S]*?elements\.chat\.lastElementChild !== runIndicatorBubble/, "active agent indicator should reuse the existing bubble across transcript re-renders instead of recreating it");
1922
+ assert.match(app, /function ensureRunIndicatorBubble\(\)[\s\S]*?!runIndicatorBubble \|\| !runIndicatorText \|\| !runIndicatorMeta[\s\S]*?runIndicatorBubble\.parentElement !== elements\.runIndicatorHost[\s\S]*?elements\.runIndicatorHost\.replaceChildren\(runIndicatorBubble\)/, "active agent indicator should reuse its existing bubble in the dedicated status host");
1923
+ assert.doesNotMatch(app, /elements\.chat\.(?:append|insertBefore)\(runIndicatorBubble/, "the active agent indicator must never be mounted in the transcript");
1910
1924
  assert.match(app, /const headline = runIndicatorHeadline\(\);\n\s+if \(runIndicatorText\.textContent !== headline\) runIndicatorText\.textContent = headline;/, "active agent indicator should avoid redundant headline DOM writes that can flicker");
1911
1925
  assert.match(app, /const meta = runIndicatorShowsElapsed\(\) \? `\$\{detail\} · run time[\s\S]*?if \(runIndicatorMeta\.textContent !== meta\) runIndicatorMeta\.textContent = meta;/, "active agent indicator should avoid redundant metadata DOM writes except elapsed changes");
1912
1926
  assert.match(app, /runIndicatorShowsElapsed\(\) \? `\$\{detail\} · run time/, "active agent indicator should label elapsed run time instead of showing a bare counter");
@@ -2502,9 +2516,14 @@ assert.match(app, /case "message_end": \{(?:(?!case ")[\s\S])*?scheduleSemanticR
2502
2516
  assert.match(html, /id="chatSearchBar"[\s\S]*?id="chatSearchInput"[\s\S]*?id="chatSearchPrevButton"[\s\S]*?id="chatSearchNextButton"[\s\S]*?id="chatSearchCloseButton"/, "transcript search bar markup should exist with navigation controls");
2503
2517
  assert.match(app, /function openChatSearch\(\)[\s\S]*?elements\.chatSearchInput\?\.focus\(\)/, "opening transcript search should focus the input");
2504
2518
  assert.match(app, /\(event\.ctrlKey \|\| event\.metaKey\) && !event\.altKey && !event\.shiftKey && event\.key\.toLowerCase\(\) === "f"/, "Ctrl\/Cmd+F should open the transcript search");
2519
+ assert.match(app, /function chatSearchRoot\(\)[\s\S]*subagentTerminalTranscript[\s\S]*elements\.chat/, "transcript search should target the active main or subagent output stream");
2520
+ assert.match(app, /function collectChatSearchMatches\(query\)[\s\S]*while \(matches\.length < CHAT_SEARCH_MATCH_LIMIT\)[\s\S]*matches\.push\(\{ bubble, start, end:/, "transcript search should collect every matching occurrence instead of only matching bubbles");
2521
+ assert.match(app, /function renderChatSearchHighlights\(\)[\s\S]*chat-search-match[\s\S]*new HighlightConstructor\(\.\.\.ranges\)[\s\S]*chat-search-current/, "transcript search should highlight all exact ranges and distinguish the current one");
2505
2522
  assert.match(app, /function focusChatSearchMatch\(\)[\s\S]*?details\.open = true;[\s\S]*?scrollIntoView/, "navigating to a search match should expand collapsed tool output and scroll to the bubble");
2506
- assert.match(app, /autoFollowChat = false;\n lastChatProgrammaticScrollAt = performance\.now\(\);/, "search navigation must not fight chat auto-follow");
2507
- assert.match(css, /\.message\.search-current \{/, "current search match should have a highlight style");
2523
+ assert.match(app, /autoFollowChat = false;\n lastChatProgrammaticScrollAt = performance\.now\(\);/, "main-transcript search navigation must not fight chat auto-follow");
2524
+ assert.match(app, /new MutationObserver\([\s\S]*runChatSearch\(\{ navigate: false \}\)[\s\S]*characterData: true/, "open searches should re-highlight refreshed live output without stealing navigation focus");
2525
+ assert.match(css, /::highlight\(chat-search-match\)[\s\S]*::highlight\(chat-search-current\)/, "all transcript matches and the current match should have distinct highlight styles");
2526
+ assert.doesNotMatch(css, /body\.subagent-terminal-active \.chat-search-bar/, "the search bar must remain visible while viewing a subagent output stream");
2508
2527
  assert.match(css, /\.chat \{[^}]*overflow:\s*auto;[^}]*overflow-anchor:\s*none;/, "the transcript should disable browser scroll anchoring because paused-reader position is controlled explicitly during live growth");
2509
2528
  assert.match(css, /\.chat-search-bar,\n\.file-viewer-search-bar \{/, "transcript search bar should be styled");
2510
2529
 
@@ -68,7 +68,7 @@ assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server
68
68
  assert.match(serviceWorker, /"\/issue-wizard-state\.mjs"/, "the PWA shell must keep caching the pure wizard module");
69
69
  assert.match(serviceWorker, /"\/issue-bot-client\.mjs"/, "the PWA shell must cache the browser client module");
70
70
  // Intent preserved: changing the public startup graph advances the PWA cache identity.
71
- assert.match(serviceWorker, /pi-webui-pwa-v81/, "the PWA cache name must change with browser wiring updates");
71
+ assert.match(serviceWorker, /pi-webui-pwa-v84/, "the PWA cache name must change with browser wiring updates");
72
72
  assert.match(packageJson, /node --check public\/issue-wizard-state\.mjs/, "the package check must keep syntax-checking the pure wizard module");
73
73
  assert.match(packageJson, /node --check public\/issue-bot-client\.mjs/, "the package check must syntax-check the browser client module");
74
74
 
@@ -271,8 +271,8 @@ assert.match(
271
271
 
272
272
  // --- Coherent browser asset revisions --------------------------------------
273
273
 
274
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "changed browser assets should advance the PWA cache identity");
275
- assert.match(html, /styles\.css\?v=104/, "the page should request the updated layout stylesheet revision");
276
- assert.match(html, /data-app-src="\/app\.js\?v=120"/, "the boot loader should request the updated app module revision");
274
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "changed browser assets should advance the PWA cache identity");
275
+ assert.match(html, /styles\.css\?v=107/, "the page should request the updated layout stylesheet revision");
276
+ assert.match(html, /data-app-src="\/app\.js\?v=121"/, "the boot loader should request the updated app module revision");
277
277
 
278
278
  console.log("persistent-ui-layout-static.test.mjs passed");
@@ -504,8 +504,8 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
504
504
  assert.match(css, /\.questionnaire-options button\s*\{\s*min-height:\s*3\.35rem/, "mobile questionnaire targets must exceed the 44px floor");
505
505
  assert.match(css, /@media \(prefers-reduced-motion: reduce\)\s*\{[\s\S]*?\*, \*::before, \*::after[\s\S]*?transition-duration:\s*1ms !important/, "global reduced-motion rules must cover questionnaire transitions");
506
506
 
507
- assert.match(html, /styles\.css\?v=104/, "questionnaire CSS needs the current stylesheet revision");
508
- assert.match(html, /app\.js\?v=120/, "questionnaire behavior needs the current app revision");
509
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v81"/, "questionnaire public assets need a coherent PWA cache revision");
507
+ assert.match(html, /styles\.css\?v=107/, "questionnaire CSS needs the current stylesheet revision");
508
+ assert.match(html, /app\.js\?v=121/, "questionnaire behavior needs the current app revision");
509
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "questionnaire public assets need a coherent PWA cache revision");
510
510
 
511
511
  console.log("questionnaire-dialog.test.mjs passed");
@@ -1,4 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
+ import { createHash } from "node:crypto";
2
3
  import { createConnection, createServer } from "node:net";
3
4
  import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
4
5
  import { tmpdir } from "node:os";
@@ -9,6 +10,7 @@ import {
9
10
  RPC_SUPERVISOR_CHILD_ARG_LIMIT,
10
11
  RPC_SUPERVISOR_EVENT_RING_MAX_BYTES,
11
12
  RPC_SUPERVISOR_REQUEST_DEDUPE_LIMIT,
13
+ deriveSupervisorRecoveryToken,
12
14
  } from "../lib/rpc-supervisor-protocol.mjs";
13
15
  import {
14
16
  RpcSupervisorClient,
@@ -123,7 +125,13 @@ try {
123
125
  client = await discoverStartAttachRpcSupervisor({
124
126
  agentDir,
125
127
  port,
126
- environment: { ...process.env, FAKE_PI_LOG_FILE: logFile, RAW_PI_LOG: rawLogFile },
128
+ environment: {
129
+ ...process.env,
130
+ FAKE_PI_LOG_FILE: logFile,
131
+ RAW_PI_LOG: rawLogFile,
132
+ PI_WEBUI_RECOVERY_URL: `http://127.0.0.1:${port}/api/recovery/plan`,
133
+ PI_WEBUI_RECOVERY_TOKEN: "server-ephemeral-recovery-token",
134
+ },
127
135
  startupTimeoutMs: 10_000,
128
136
  });
129
137
  const created = await client.createTab({
@@ -160,6 +168,15 @@ try {
160
168
  await delay(60);
161
169
  const logged = (await readFile(logFile, "utf8")).split("\n").filter(Boolean).map(JSON.parse);
162
170
  assert.equal(logged.filter((entry) => entry.direction === "command" && entry.message === "dedupe me").length, 1, "duplicate request IDs must not write to Pi twice");
171
+ const startupState = await readSupervisorState(await supervisorPaths({ agentDir, port }));
172
+ const expectedRecoveryDigest = createHash("sha256").update(deriveSupervisorRecoveryToken(startupState.token)).digest("hex");
173
+ const startupEntry = logged.find((entry) => entry.direction === "startup" && entry.cwd === work);
174
+ assert.equal(startupEntry?.recoveryTokenDigest, expectedRecoveryDigest, "managed Pi children must receive the stable derived recovery credential");
175
+ assert.notEqual(
176
+ startupEntry?.recoveryTokenDigest,
177
+ createHash("sha256").update("server-ephemeral-recovery-token").digest("hex"),
178
+ "managed Pi children must not retain the server process's restart-scoped credential",
179
+ );
163
180
 
164
181
  const rawCommand = {
165
182
  type: "raw_round_trip",
@@ -6,6 +6,7 @@ import {
6
6
  RPC_SUPERVISOR_PROTOCOL,
7
7
  RpcSupervisorProtocolError,
8
8
  constantTimeTokenEqual,
9
+ deriveSupervisorRecoveryToken,
9
10
  encodeFrame,
10
11
  frameReader,
11
12
  protocolCompatible,
@@ -20,6 +21,10 @@ const attach = validateClientFrame({
20
21
  assert.equal(attach.token, "private-token", "attach validation must retain the private token for authentication");
21
22
  assert.equal(constantTimeTokenEqual("same", "same"), true);
22
23
  assert.equal(constantTimeTokenEqual("same", "different"), false);
24
+ const recoveryToken = deriveSupervisorRecoveryToken("private-token");
25
+ assert.equal(recoveryToken, deriveSupervisorRecoveryToken("private-token"), "recovery credentials must remain stable across server reattachment");
26
+ assert.notEqual(recoveryToken, "private-token", "the lower-privilege recovery credential must not expose the supervisor credential");
27
+ assert.notEqual(recoveryToken, deriveSupervisorRecoveryToken("other-private-token"));
23
28
  assert.equal(protocolCompatible({ major: RPC_SUPERVISOR_PROTOCOL.major, minor: 0 }), true, "older minor versions remain attach-compatible for actionable recovery");
24
29
  assert.equal(protocolCurrent({ major: RPC_SUPERVISOR_PROTOCOL.major, minor: 0 }), false, "older detached supervisors must be detectable after a server-only restart");
25
30
  assert.equal(protocolCurrent(RPC_SUPERVISOR_PROTOCOL), true);