@firstpick/pi-package-webui 0.9.4 → 0.9.6

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 (70) hide show
  1. package/README.md +7 -2
  2. package/bin/pi-webui.mjs +90 -5
  3. package/lib/optional-feature-catalog.mjs +1 -1
  4. package/lib/session-actions.mjs +20 -2
  5. package/lib/ui-layout-settings.mjs +37 -6
  6. package/package.json +1 -1
  7. package/public/app.js +2311 -257
  8. package/public/index.html +82 -55
  9. package/public/service-worker.js +4 -1
  10. package/public/stream-derived-output.mjs +799 -0
  11. package/public/stream-markdown-tail.mjs +204 -0
  12. package/public/stream-output-controller.mjs +222 -51
  13. package/public/stream-render-scheduler.mjs +85 -0
  14. package/public/styles.css +276 -20
  15. package/public/transcript-renderer.mjs +73 -24
  16. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  17. package/tests/browser/composer-action-grid-reorder.spec.mjs +114 -31
  18. package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
  19. package/tests/browser/control-visibility.spec.mjs +396 -0
  20. package/tests/browser/mobile-foundation.spec.mjs +28 -0
  21. package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
  22. package/tests/browser/stream-output-isolation.spec.mjs +308 -3
  23. package/tests/browser/user-noticeable-fixes.spec.mjs +204 -0
  24. package/tests/codex-fast-mode-static.test.mjs +2 -2
  25. package/tests/composer-action-grid-reorder-static.test.mjs +8 -7
  26. package/tests/control-deck-side-panels-static.test.mjs +3 -1
  27. package/tests/control-visibility-static.test.mjs +294 -0
  28. package/tests/controls-layout-static.test.mjs +3 -3
  29. package/tests/cwd-footer-reliability-static.test.mjs +1 -1
  30. package/tests/fast-mode-client-static.test.mjs +1 -1
  31. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  32. package/tests/file-viewer-image-static.test.mjs +3 -3
  33. package/tests/fixtures/fake-pi.mjs +57 -10
  34. package/tests/fixtures/streaming-workloads.mjs +167 -0
  35. package/tests/footer-provider-usage-visual-static.test.mjs +15 -0
  36. package/tests/foreground-transcript-catch-up-static.test.mjs +7 -1
  37. package/tests/git-workflow-preferences.test.mjs +2 -2
  38. package/tests/http-endpoints-harness.test.mjs +4 -4
  39. package/tests/interaction-state-stability-static.test.mjs +3 -1
  40. package/tests/intercom-conversation-viewer-static.test.mjs +4 -4
  41. package/tests/intercom-conversations-http.test.mjs +16 -0
  42. package/tests/main-output-loading-static.test.mjs +3 -3
  43. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  44. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  45. package/tests/mobile-foundation-static.test.mjs +3 -3
  46. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  47. package/tests/mobile-static.test.mjs +77 -66
  48. package/tests/open-issue-wizard-static.test.mjs +2 -2
  49. package/tests/persistent-ui-layout-static.test.mjs +7 -7
  50. package/tests/prompt-input-vertical-scroll-static.test.mjs +26 -0
  51. package/tests/questionnaire-dialog.test.mjs +3 -3
  52. package/tests/runtime-error-visibility.test.mjs +3 -3
  53. package/tests/session-auth-harness.test.mjs +26 -1
  54. package/tests/session-sampling-ui-static.test.mjs +3 -3
  55. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  56. package/tests/stream-derived-output.test.mjs +121 -0
  57. package/tests/stream-markdown-tail.test.mjs +218 -0
  58. package/tests/stream-output-controller.test.mjs +119 -4
  59. package/tests/stream-output-isolation-static.test.mjs +34 -6
  60. package/tests/stream-output-workloads.test.mjs +276 -0
  61. package/tests/stream-render-scheduler.test.mjs +115 -0
  62. package/tests/streaming-ui-coupling.test.mjs +1 -1
  63. package/tests/subagent-observability-static.test.mjs +2 -2
  64. package/tests/syntax-highlighting-static.test.mjs +3 -3
  65. package/tests/theme-customizer-static.test.mjs +1 -1
  66. package/tests/thinking-format-parser.test.mjs +15 -0
  67. package/tests/todo-filter-static.test.mjs +148 -0
  68. package/tests/transcript-markdown-tail.test.mjs +137 -0
  69. package/tests/ui-layout-settings.test.mjs +54 -7
  70. package/tests/webui-settings-locking.test.mjs +3 -3
@@ -45,7 +45,7 @@ const companionDependencies = {
45
45
  "@firstpick/pi-extension-bang-command-autocomplete": "^0.2.2",
46
46
  "@firstpick/pi-extension-btw": "^0.1.4",
47
47
  "@firstpick/pi-extension-fish-user-bash": "^0.2.2",
48
- "@firstpick/pi-extension-git-footer-status": "^0.4.3",
48
+ "@firstpick/pi-extension-git-footer-status": "^0.5.0",
49
49
  "@firstpick/pi-extension-release-aur": "^0.1.8",
50
50
  "@firstpick/pi-extension-release-npm": "^0.4.4",
51
51
  "@firstpick/pi-extension-safety-guard": "^0.2.6",
@@ -74,7 +74,7 @@ assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item
74
74
  assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
75
75
  assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
76
76
  assert.match(html, /<div class="side-panel-heading">[\s\S]*<strong class="side-panel-title">Control Deck<\/strong>[\s\S]*<div class="side-panel-version-row"[\s\S]*<button id="piVersionButton"[\s\S]*aria-controls="piReleaseNotesDialog"[\s\S]*<button id="webuiVersionButton"[\s\S]*aria-controls="webuiPackageDialog"[\s\S]*id="webuiDevBadge"/, "Control Deck header should keep its title separate from an aligned version and build row");
77
- assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
77
+ assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" data-visibility-key="control-deck\.sponsor" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
78
78
  assert.match(html, /<dialog id="piReleaseNotesDialog"[\s\S]*id="piReleaseNotesTitle"[\s\S]*id="piReleaseNotesStatus"[\s\S]*id="piReleaseNotesBody"[\s\S]*id="piReleaseNotesGithubLink"/, "Pi release notes should use a dedicated accessible dialog");
79
79
  assert.doesNotMatch(html, /Safer option|confirmationAlternative/, "shared confirmation dialogs should not render a safer-option row");
80
80
  assert.doesNotMatch(app, /confirmationAlternative|\balternative:\s*options\.alternative/, "confirmation logic should not populate a removed safer-option row");
@@ -287,7 +287,7 @@ assert.match(html, /data-side-panel-section="controls"/, "side panel controls sh
287
287
  assert.match(html, /data-side-panel-section="commands"/, "side panel commands should live in a collapsible section");
288
288
  assert.match(html, /class="side-panel-section-toggle"[^>]*aria-controls="sidePanelSectionControls"/, "side panel section toggles should target their content panels");
289
289
  assert.match(html, /class="side-panel-section-label">Events<\/span>/, "side panel events should expose a section toggle label");
290
- assert.match(app, /function addEvent\(message, level = "info", \{ toolCallId = "" \} = \{\}\)[\s\S]*?make\("button", `event \$\{level\}`[\s\S]*?chatEventTimestamp[\s\S]*?jumpToChatEvent\(line\)/, "event log entries should be keyboard-accessible controls that navigate into the chat");
290
+ assert.match(app, /function addEvent\(message, level = "info", \{ toolCallId = "", notify = true \} = \{\}\)[\s\S]*?make\("button", `event \$\{level\}`[\s\S]*?chatEventTimestamp[\s\S]*?jumpToChatEvent\(line\)/, "event log entries should be keyboard-accessible controls that navigate into the chat");
291
291
  assert.match(app, /function chatEventTargetForLine\(line\)[\s\S]*?chatToolCallId[\s\S]*?data-tool-call-id[\s\S]*?\.message\[data-chat-timestamp\]/, "event navigation should prefer exact tool cards and otherwise match the closest chat timestamp");
292
292
  assert.match(app, /function jumpToChatEvent\(line\)[\s\S]*?setChatScrollTopInstant[\s\S]*?highlightChatEventTarget[\s\S]*?setSidePanelCollapsed\(true, \{ persist: false \}\)/, "event navigation should dismiss overlay sidebars, scroll the chat, and highlight its target");
293
293
  assert.match(app, /function applyChatEventMetadata\(bubble, message\)[\s\S]*?bubble\.dataset\.chatTimestamp/, "rendered chat events should expose timestamps for sidebar navigation");
@@ -324,7 +324,7 @@ assert.match(html, /id="busyPromptBehaviorMenu"[\s\S]*data-busy-prompt-behavior=
324
324
  assert.match(app, /const LONG_INPUT_ATTACHMENT_LINE_THRESHOLD = 20/, "long composer text should use a 20-line threshold before becoming an attachment");
325
325
  assert.match(app, /function attachLongTextAsFile\(text, source = "input text"\)/, "long composer text should be attachable as a generated text file");
326
326
  assert.match(app, /function handleAttachmentPaste\(event\)[\s\S]*attachLongTextAsFile\(text, "clipboard text"\)/, "long pasted text should be attached instead of inserted into the prompt textarea");
327
- assert.match(app, /promptInput\.addEventListener\("input", \(\) => \{[\s\S]*moveLongPromptInputToAttachment\(\)/, "long typed composer text should move into an attachment and clear the textarea");
327
+ assert.doesNotMatch(app, /moveLongPromptInputToAttachment/, "typed composer text must stay editable inline; only pasted text becomes an attachment");
328
328
  assert.match(html, /id="attachmentTextDialog"[\s\S]*id="attachmentTextEditor"/, "text attachments should have an in-Web UI editing dialog");
329
329
  assert.match(app, /attachment-edit-button[\s\S]*openTextAttachmentEditor\(attachment\.id\)/, "editable text attachments should expose an Edit action in the tray");
330
330
  assert.match(app, /function saveTextAttachmentEdit\(\)[\s\S]*attachment\.file = nextFile/, "text attachment dialog should save edits back to the attachment file");
@@ -332,7 +332,7 @@ assert.match(app, /attachmentTextDialog\?\.addEventListener\("keydown"[\s\S]*eve
332
332
  assert.match(css, /\.attachment-text-dialog[\s\S]*\.attachment-text-editor/, "text attachment editor should have dedicated dialog styling");
333
333
  assert.match(html, /id="composerActionsButton"/, "mobile composer should expose a compact actions trigger");
334
334
  assert.match(html, /id="composerActionsPanel"/, "secondary composer controls should live in a mobile actions panel");
335
- assert.match(html, /<div class="composer-row">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
335
+ assert.match(html, /<div class="composer-row" data-visibility-region="composer">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
336
336
  assert.match(html, /id="btwButton"[\s\S]*class="composer-icon-button composer-btw-button"[\s\S]*?<svg class="composer-icon"/, "composer should expose an icon-only /btw side-question button");
337
337
  assert.doesNotMatch(html, /id="btwButton"[\s\S]*?<span>\/btw<\/span>[\s\S]*?id="sendButton"/, "/btw composer button should not show a text label");
338
338
  assert.match(html, /id="abortButton"[^>]*Hold Esc or the Abort button for 3 seconds/, "Abort should advertise guarded Esc and long-press affordances");
@@ -363,7 +363,7 @@ assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-
363
363
  const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
364
364
  const workflowOverlayOpenButtonHtml = html.match(/<button\s+id="workflowOverlayOpenButton"[\s\S]*?<\/button>/)?.[0] || "";
365
365
  const optionsMenuHtml = html.match(/<div id="optionsMenu"[\s\S]*?<\/div>/)?.[0] || "";
366
- assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
366
+ assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row" data-visibility-region="inputframe">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls" data-visibility-key="input\.workflow"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
367
367
  assert.doesNotMatch(html, /composer-workflow-mode-dock-label|>Workflow mode<\/span>/, "Workflow Mode dock should not render visible text beside the icon");
368
368
  assert.doesNotMatch(optionsMenuHtml, /id="workflowModeButton"|Workflow Mode/, "Options menu should not duplicate or hide the directly accessible Workflow Mode control");
369
369
  assert.doesNotMatch(workflowOverlayOpenButtonHtml, /\stitle=/, "Workflow overlay restore should not combine a browser-native tooltip with its styled tooltip");
@@ -450,19 +450,21 @@ assert.match(css, /\.path-picker-clear-search-button:hover,[\s\S]*?var\(--ctp-ma
450
450
  assert.match(css, /height:\s*var\(--visual-viewport-height, 100dvh\)/, "layout should consume visual viewport height");
451
451
  assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?\.chat-panel \{[\s\S]*?height:\s*calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\);[\s\S]*?max-height:\s*calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\);[\s\S]*?\.chat \{ flex-basis:\s*0; \}/, "narrow stacked layout should bound the transcript so terminal tabs and bottom controls stay visible");
452
452
  assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?\.side-panel-backdrop \{[\s\S]*?position:\s*fixed[\s\S]*?\.side-panel \{[\s\S]*?position:\s*fixed/, "narrow stacked layout should use the mobile-style side-panel overlay drawer");
453
- assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?body:not\(\.side-panel-collapsed\) \{ overflow:\s*hidden; \}/, "narrow side-panel overlay should prevent background page scrolling while open");
454
- assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?body:not\(\.side-panel-collapsed\) \.chat-panel \{[\s\S]*?visibility:\s*hidden;[\s\S]*?pointer-events:\s*none;/, "narrow side-panel overlay should suppress the underlying terminal header so it cannot cover side-panel controls");
455
- assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?\.side-panel-backdrop \{[\s\S]*?z-index:\s*110;[\s\S]*?\.side-panel \{[\s\S]*?z-index:\s*111;[\s\S]*?body\.side-panel-collapsed \.terminal-tabs-shell \{[\s\S]*?padding-right:\s*4\.85rem;[\s\S]*?\.side-panel-expand-button \{[\s\S]*?z-index:\s*120/, "narrow side-panel overlay and expand button should stay above and reserve space from terminal header controls");
453
+ assert.match(css, /body\.control-deck-overlay:not\(\.side-panel-collapsed\) \{ overflow:\s*hidden; \}/, "narrow side-panel overlay should prevent background page scrolling while open");
454
+ assert.match(css, /body:where\(:not\(\.control-deck-left\):not\(\.control-deck-both\)\) \.layout \{ grid-template-columns:/, "the default two-column layout rule must keep low specificity so overlay/collapsed rules win on narrow and touch viewports");
455
+ assert.match(css, /body\.control-deck-overlay:not\(\.side-panel-collapsed\) \.workspace-column \{[\s\S]*?visibility:\s*hidden;[\s\S]*?pointer-events:\s*none;/, "narrow side-panel overlay should suppress the underlying workspace so it cannot cover side-panel controls");
456
+ assert.match(css, /body\.control-deck-overlay \.side-panel-backdrop \{[\s\S]*?z-index:\s*110;/, "overlay backdrop should sit above the workspace");
457
+ assert.match(css, /@media \(max-width: 1050px\)[\s\S]*?\.side-panel \{[\s\S]*?z-index:\s*111;[\s\S]*?body\.side-panel-collapsed \.terminal-tabs-shell \{[\s\S]*?padding-right:\s*4\.85rem;[\s\S]*?\.side-panel-expand-button \{[\s\S]*?z-index:\s*120/, "narrow side-panel overlay and expand button should stay above and reserve space from terminal header controls");
456
458
  assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?body\.side-panel-collapsed \.terminal-tabs-shell \{ padding-right:\s*calc\(44px \+ 0\.8rem\); \}[\s\S]*?\.side-panel-expand-button \{[\s\S]*?z-index:\s*120[\s\S]*?\.side-panel-backdrop \{[\s\S]*?z-index:\s*110;[\s\S]*?\.side-panel \{[\s\S]*?z-index:\s*111;/, "mobile side-panel controls should not hide behind terminal header buttons");
457
459
  assert.match(css, /button, select, input \{ min-height: 44px; \}/, "base controls should meet 44px touch-target height");
458
460
  // Intent superseded: Phase 0 raises all phone/coarse composer hit areas to 44px.
459
461
  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");
460
462
  assert.match(css, /\.composer-abort-button,\n\.composer-row button\.primary \{[\s\S]*?min-width:/, "Abort and Send should share stable bottom-row sizing");
461
- 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");
463
+ assert.match(css, /\.composer-abort-button\.long-pressing::after[\s\S]*?animation:\s*abort-long-press-fill var\(--abort-long-press-duration, 1200ms\) linear forwards/, "Abort should expose a visible long-press progress affordance");
462
464
  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");
463
465
  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");
464
466
  assert.match(css, /#promptInput \{[\s\S]*?min-height:\s*calc\(1\.5em \+ 1\.8rem\)/, "prompt input should default to a compact single-line height");
465
- assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input should be JS-resized instead of showing a scrollbar by default");
467
+ assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*auto/, "prompt input should auto-grow to a bounded height and then scroll vertically");
466
468
  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");
467
469
  assert.match(css, /\.composer-context-tags \{[^}]*width:\s*calc\(100% - 4\.5rem\);[^}]*min-width:\s*0;[^}]*pointer-events:\s*none;/, "context tags should claim the available prompt-frame width while leaving empty overlay space clickable through to the prompt");
468
470
  assert.match(css, /\.composer-busy-mode-tag,[\s\S]*?\.composer-workflow-mode-chip \{\s*pointer-events:\s*auto;/, "interactive context chips should remain clickable through the pointer-transparent full-width overlay");
@@ -558,7 +560,7 @@ assert.match(css, /body\.subagent-terminal-active \.workspace-dashboard,[\s\S]*b
558
560
  assert.match(css, /\.subagent-run-indicator[\s\S]*\.subagent-run-indicator \.run-indicator-meta/, "subagent output should reuse the main live run-indicator treatment with wrapping activity metadata");
559
561
  assert.match(css, /\.subagent-terminal-transcript > \.message \{[\s\S]*width: 100%;[\s\S]*max-width: none;/, "dedicated subagent transcript cards should fill the available tab width");
560
562
  assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
561
- assert.match(css, /\.subagent-running-dot \{[\s\S]*background: var\(--ctp-yellow\);[\s\S]*animation: subagent-running-pulse/, "running subagents should expose a blinking yellow activity indicator");
563
+ assert.match(css, /\.subagent-state-dot\.running \{[\s\S]*?background: var\(--ctp-yellow\);[\s\S]*?animation: subagent-running-pulse/, "running subagents should expose a blinking yellow activity indicator");
562
564
  assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity animation");
563
565
  assert.match(css, /\.optional-feature-pill\.enabled/, "optional features should visually distinguish enabled state");
564
566
  assert.match(css, /\.todo-widget \{[\s\S]*?display:\s*grid/, "todo-progress widget should render as a styled checklist card");
@@ -633,7 +635,7 @@ assert.match(css, /\.terminal-tabs-toggle-button \{ display: none; \}/, "termina
633
635
  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");
634
636
  assert.match(html, /id="terminalTabsBackdrop"[^>]*aria-label="Close terminal navigation"[^>]*hidden/, "mobile terminal drawer should expose an accessible backdrop close target");
635
637
  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");
636
- 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");
638
+ 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*3rem;/, "mobile command palette results should keep text-height rows and use compact two-column cards");
637
639
  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");
638
640
  assert.match(css, /body\.terminal-tabs-left \.chat-panel \{[\s\S]*?grid-template-columns:\s*minmax\(13rem, var\(--terminal-tabs-sidebar-width\)\) minmax\(0, 1fr\)/, "terminal tabs left layout should split the chat panel into a resizable sidebar and transcript area");
639
641
  assert.match(css, /body\.terminal-tabs-left \.terminal-tabs-shell \{[\s\S]*?grid-column:\s*1;[\s\S]*?grid-row:\s*1 \/ -1;[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should turn the top tab strip into a vertical sidebar");
@@ -712,7 +714,7 @@ assert.match(app, /"Resolve with agent"[\s\S]*api\("\/api\/git-operation\/resolv
712
714
  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");
713
715
  assert.match(server, /"\/api\/git-operation\/resolve-with-agent"[\s\S]*openGitConflictResolutionAgentTab\(tab\)/, "server should expose conflict-resolution agent tab creation through the git operation routes");
714
716
  assert.match(app, /async function pullGitChangesDialog\(\)[\s\S]*api\("\/api\/git-changes\/pull", \{ method: "POST"/, "git changes modal should post to the pull endpoint from the Pull button");
715
- assert.match(app, /async function pullGitFooterSync\(tabId = activeTabId\)[\s\S]*api\("\/api\/git-changes\/pull", \{ method: "POST", body: \{ remote: "origin" \}, tabId \}\)[\s\S]*requestGitFooterWebuiPayload\(tabContext, \{ force: true \}\)/, "incoming-only footer Sync should pull directly from origin and refresh the footer payload");
717
+ assert.match(app, /async function pullGitFooterSync\(tabId = activeTabId, \{ syncValue = "" \} = \{\}\)[\s\S]*api\("\/api\/git-changes\/pull", \{ method: "POST", body: \{ remote: "origin" \}, tabId \}\)[\s\S]*requestGitFooterWebuiPayload\(tabContext, \{ force: true \}\)/, "incoming-only footer Sync should pull directly from origin and refresh the footer payload");
716
718
  assert.doesNotMatch(app.match(/async function pullGitFooterSync[\s\S]*?\n\}/)?.[0] || "", /git-workflow\/push|appConfirmText/, "the direct footer pull path should neither push nor open a confirmation");
717
719
  assert.match(html, /id="gitPullErrorDialog"[\s\S]*aria-labelledby="gitPullErrorDialogTitle"[\s\S]*id="gitPullErrorOutput"[\s\S]*id="gitPullErrorRecovery"[^>]*hidden[\s\S]*id="gitPullErrorReviewButton"[\s\S]*id="gitPullErrorRebaseButton"[\s\S]*id="gitPullErrorMergeButton"[\s\S]*id="gitPullErrorCopyButton"[\s\S]*id="gitPullErrorCloseButton"/, "footer pull failures should use a labelled native dialog with review, rebase, merge, copy, and close actions");
718
720
  assert.match(css, /\.extension-dialog\.git-pull-error-dialog[\s\S]*\.git-pull-error-output \{[\s\S]*user-select: text;[\s\S]*white-space: pre-wrap;[\s\S]*\.git-pull-error-recovery-actions \{[\s\S]*flex-wrap: wrap;/, "Git pull error output and recovery actions should remain readable, selectable, and responsive");
@@ -980,9 +982,9 @@ assert.match(css, /\.release-dialog-danger \{ color: var\(--ctp-red\); \}/, "rel
980
982
  assert.match(app, /const MOBILE_VIEW_QUERY = "\(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)"/, "mobile detection should include phones that report desktop-like layout widths");
981
983
  assert.match(app, /const SIDE_PANEL_OVERLAY_QUERY = "\(max-width: 1050px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)"/, "side-panel overlay mode should also activate at the stacked narrow layout breakpoint");
982
984
  assert.match(app, /function isSidePanelOverlayView\(\)[\s\S]*sidePanelOverlayMedia\?\.matches/, "side-panel overlay detection should be separate from full mobile mode");
983
- assert.match(app, /const showBackdrop = !collapsed && isSidePanelOverlayView\(\)/, "side-panel backdrop should show for the overlay breakpoint, not only phone layouts");
985
+ assert.match(app, /const overlay = isControlDeckOverlayPresentation\(\);[\s\S]*?const showBackdrop = !collapsed && overlay;/, "side-panel backdrop should show for the overlay presentation, not only phone layouts");
984
986
  // Intent preserved for legacy; v2 suppresses this legacy surface writer.
985
- assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isSidePanelOverlayView\(\)\) \{\n\s+setSidePanelCollapsed\(true, \{ persist: false \}\);/, "legacy side-panel should start collapsed in narrow overlay mode");
987
+ assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isControlDeckOverlayPresentation\(\)\) \{\n\s+setSidePanelCollapsed\(true, \{ persist: false \}\);/, "legacy side-panel should start collapsed in narrow overlay mode");
986
988
  assert.match(app, /function bindSidePanelOverlayViewChanges\(\)/, "side-panel overlay breakpoint changes should be monitored separately from full mobile changes");
987
989
  assert.match(app, /if \(isSidePanelOverlayView\(\) && !document\.body\.classList\.contains\("side-panel-collapsed"\)\)/, "Escape should close the side-panel overlay at narrow widths");
988
990
  assert.match(app, /const THEME_STORAGE_KEY = "pi-webui-theme"/, "theme selection should be persisted in browser storage");
@@ -1087,7 +1089,7 @@ assert.match(app, /function setOptionsMenuOpen\(open\)[\s\S]*scheduleMobileDropd
1087
1089
  assert.match(app, /function focusPromptInput\(\{ defer = false \} = \{\}\)/, "frontend should focus the prompt composer programmatically after tab/app startup");
1088
1090
  assert.match(app, /async function switchTab\(tabId\)[\s\S]*?restoreActiveDraft\(\);\n\s+focusPromptInput\(\{ defer: true \}\);/, "switching to a newly opened tab should focus the prompt input immediately");
1089
1091
  assert.match(app, /async function initializeTabs\(\)[\s\S]*?restoreActiveDraft\(\);[\s\S]*if \(!loadedTabs\.length\)[\s\S]*focusPromptInput\(\{ defer: true \}\);/, "starting the Web UI should prompt for cwd when needed and focus active tabs");
1090
- assert.match(app, /resizePromptInput\(\);\nclearRemovedSidePanelSectionHeightState\(\);\nrestoreDurableUiLayoutPendingJournal\(\);\nrestoreSidePanelWidthPreference\(\);\nrestoreFileViewerWidthPreference\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nupdateComposerModeButtons\(\);/, "startup should clear retired section-height state, restore resizable panel preferences, request prompt focus, and restore skill tags before waiting for tab state refreshes");
1092
+ assert.match(app, /resizePromptInput\(\);\nclearRemovedSidePanelSectionHeightState\(\);\nrestoreDurableUiLayoutPendingJournal\(\);\nrestoreSidePanelWidthPreference\(\);\nrestoreFileViewerWidthPreference\(\);\nrestoreTerminalTabsSidebarWidthPreference\(\);\nfocusPromptInput\(\{ defer: true \}\);\nrestoreStoredSkillUsage\(\);\nrestoreBusyPromptBehaviorSetting\(\);\nsyncMobileComposerDisclosureLayout\(\);\nupdateComposerModeButtons\(\);/, "startup should clear retired section-height state, restore resizable panel preferences, request prompt focus, and restore skill tags before waiting for tab state refreshes");
1091
1093
  assert.match(app, /elements\.promptInput\.addEventListener\("focus", \(\) => \{\n\s+syncMobileChatToBottomForInput\(\);/, "focusing mobile input should scroll output to bottom");
1092
1094
  assert.match(app, /navigator\.serviceWorker\.register\("\/service-worker\.js"\)/, "PWA service worker should be registered by the app");
1093
1095
  assert.match(app, /function serverStartCommandText\(\)[\s\S]*return `pi-webui\$\{currentPortArg\(\)\}`/, "PWA/offline shell should build a pathless pi-webui recovery command");
@@ -1159,13 +1161,13 @@ assert.match(
1159
1161
  );
1160
1162
  assert.match(
1161
1163
  app,
1162
- /const expandedRecords = collapsedIds \? records\.filter\(\(\{ id \}\) => !collapsedIds\.has\(id\)\) : \[\];\n\s+const expandedId = expandedRecords\.length === 1 \? expandedRecords\[0\]\.id : null;/,
1163
- "side-panel section restore should preserve at most one expanded section and otherwise default collapsed",
1164
+ /function restoreSidePanelSectionState\(\) \{[\s\S]*?setSidePanelSectionCollapsed\(record, collapsedIds \? collapsedIds\.has\(record\.id\) : true, \{ persist: false \}\);/,
1165
+ "side-panel sections should restore independently from the persisted collapsed set and default to collapsed",
1164
1166
  );
1165
1167
  assert.match(
1166
1168
  app,
1167
- /if \(record\.section\.classList\.contains\("collapsed"\)\) \{\n\s+setOnlySidePanelSectionExpanded\(record\);\n\s+\} else \{\n\s+setSidePanelSectionCollapsed\(record, true\);\n\s+\}/,
1168
- "side-panel section toggles should expand at most one section at a time",
1169
+ /setSidePanelSectionCollapsed\(record, !record\.section\.classList\.contains\("collapsed"\)\);/,
1170
+ "side-panel section toggles should open and close each section independently",
1169
1171
  );
1170
1172
  assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
1171
1173
  assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*totalGates[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents and retained retry gates by terminal and session");
@@ -1192,7 +1194,7 @@ assert.deepEqual(JSON.parse(JSON.stringify(workflowCountContext.workflowAgents(s
1192
1194
  assert.deepEqual(JSON.parse(JSON.stringify(workflowCountContext.workflowCounts([syntheticWorkflowRun]))), { total: 1, running: 1, stale: 0 }, "workflow controllers should be count-neutral while their children retain lifecycle counts");
1193
1195
  assert.equal(workflowCountContext.isWorkflowController(syntheticWorkflowRun, { name: "workflow", launcher: "pi-subagents", model: "provider/real-model", thinking: "high" }), false, "a real model-powered agent named workflow must remain an agent row");
1194
1196
  assert.match(workflowRenderSource, /const status = subagentWorkflowPresentationStatus\(run, agents\);[\s\S]*make\("details", `subagent-workflow[\s\S]*details\.open = !collapsedSubagentWorkflowRunKeys\.has\(key\)[\s\S]*make\("summary", "subagent-workflow-header"\)[\s\S]*renderSubagentAgent\(tab, entry\.run, entry\.agent\)/, "workflow controllers should render as stateful native disclosure headers using the aggregate lifecycle while preserving each child run");
1195
- assert.match(compactSubagentAgentSource, /const \[model, thinking\] = subagentExecutionValues\(agent\)[\s\S]*identity\.append\([\s\S]*"subagent-agent-name", name[\s\S]*"subagent-agent-inline-meta", `· \$\{model\} · \$\{thinking\}`[\s\S]*row\.append\(dot, identity, open\)/, "side-panel agent rows should show type, provider\/model, and thinking effort on one compact line");
1197
+ assert.match(compactSubagentAgentSource, /const \[model, thinking\] = subagentExecutionValues\(agent\)[\s\S]*identity\.append\([\s\S]*"subagent-agent-name", name[\s\S]*"subagent-agent-inline-meta", `· \$\{status\} · \$\{model\} · \$\{thinking\}`[\s\S]*row\.append\(dot, identity\)/, "side-panel agent rows should show type, provider\/model, and thinking effort on one compact line");
1196
1198
  assert.doesNotMatch(compactSubagentAgentSource, /subagent-agent-meta|subagentExecutionFacts|subagentSourceLabel|subagentRunElapsed|currentTool/, "side-panel agent rows should leave all other execution metadata to the selected subagent view");
1197
1199
  assert.doesNotMatch(compactSubagentRunSource, /subagent-run-(?:header|title|meta|state)|`Run \$\{/, "side-panel run groups should not repeat IDs, metadata headers, or state badges");
1198
1200
  assert.match(compactSubagentRunSource, /Dismiss finished run[\s\S]*dismissSubagentRun\(tab, run\)/, "compact terminal subagent runs should retain their dismiss action");
@@ -1225,12 +1227,12 @@ assert.doesNotMatch(closeSubagentTerminalGroupSource, /cancel|\/api\/subagents/,
1225
1227
  assert.match(css, /\.subagent-tab-title \{[\s\S]*container-type: inline-size;[\s\S]*flex: 1 1 0;[\s\S]*min-width: 0;[\s\S]*\.subagent-tab-title strong \{[\s\S]*font-size: clamp\(0\.64rem, calc\(0\.5rem \+ 0\.65cqi\), 0\.78rem\);[\s\S]*\.subagent-tab-count \{[\s\S]*flex: 0 0 auto;[\s\S]*white-space: nowrap;/, "subagent titles should scale with their available inline width while summary badges stay fixed and text can still truncate");
1226
1228
  assert.match(css, /\.subagent-agent-list \{[\s\S]*gap: 0\.16rem;[\s\S]*\.subagent-agent-row \{[\s\S]*min-height: 1\.75rem;[\s\S]*background: transparent;[\s\S]*\.subagent-agent-identity \{[\s\S]*display: flex;[\s\S]*white-space: nowrap;[\s\S]*\.subagent-agent-inline-meta \{[\s\S]*text-overflow: ellipsis;[\s\S]*white-space: nowrap;[\s\S]*\.subagent-run \{[\s\S]*grid-template-columns: minmax\(0, 1fr\) auto;[\s\S]*border: 0;/, "the inline subagent monitor should keep type, model, and effort in compact rows without overflow");
1227
1229
  assert.match(css, /\.subagent-workflow \{[\s\S]*\.subagent-workflow-header \{[\s\S]*list-style: none;[\s\S]*\.subagent-workflow:not\(\[open\]\)[\s\S]*\.subagent-workflow-agents \{[\s\S]*border-left:/, "workflow disclosures should have a distinct collapsible header and visually nested child-agent section");
1228
- assert.match(app, /function renderSubagentOverlayWidget\(\)[\s\S]*openSubagentCancelDialog\(tab, selection\.run, agent\)[\s\S]*subagent-overlay-cancel-action/, "running overlays should route cancel through the shared dialog");
1230
+ assert.match(app, /function renderSubagentOverlayWidget\(\)[\s\S]*openSubagentCancelDialog\(selection\.tab, selection\.run, agent\)[\s\S]*subagent-overlay-cancel-action/, "running overlays should route cancel through the shared dialog");
1229
1231
  assert.match(app, /subagentTerminalCancelButton[\s\S]*openSubagentCancelDialog\(view\.tab \|\| \{ tabId: view\.parentTabId, tabTitle: view\.parentTitle \}, view\.run, view\.data\?\.agent \|\| view\.agent\)/, "running terminal headers should route cancel through the shared dialog");
1230
- assert.match(app, /function openSubagentCancelDialog\(tab, run, agent = null\)[\s\S]*agentCount[\s\S]*The entire run will be stopped[\s\S]*subagentCancelDialog\.showModal\(\)[\s\S]*async function submitSubagentCancel\(\)[\s\S]*api\("\/api\/subagents\/cancel", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*tab: selection\.tabId,[\s\S]*runId: selection\.runId/, "the shared cancel dialog should honestly describe and submit whole-run cancellation with optional reason/note data");
1232
+ assert.match(app, /function openSubagentCancelDialog\(tab, run, agent = null\)[\s\S]*agentCount[\s\S]*The entire run will be stopped[\s\S]*subagentCancelDialog\.showModal\(\)[\s\S]*async function submitSubagentCancel\(\)[\s\S]*api\("\/api\/subagents\/cancel", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*group: selection\.groupId,[\s\S]*runId: selection\.runId/, "the shared cancel dialog should honestly describe and submit whole-run cancellation with optional reason/note data");
1231
1233
  assert.doesNotMatch(app, /body: \{\n\s+tab: selection\.tabId,\n\s+runId: selection\.runId,\n\s+\.\.\.\(selection\.agentId/, "the frontend must not imply unsupported per-agent cancellation in its request contract");
1232
- assert.match(app, /async function dismissSubagentRun\(tab, run\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*body: \{ tab: tab\.tabId, runId: run\.id \}/, "finished-run dismiss controls should call the owning tab endpoint");
1233
- assert.match(app, /function finishedSubagentRunSelections\(data = latestSubagents\)[\s\S]*ungatedSubagentRuns\(tab\)[\s\S]*run\.status !== "running" && run\.source !== "workflow"[\s\S]*async function clearFinishedSubagentRuns\(\{ automatic = false \} = \{\}\)[\s\S]*for \(const selection of selections\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*body: \{ tab: selection\.tabId, runId: selection\.runId \}[\s\S]*subagentsClearFinishedButton\.disabled = subagentsLoading \|\| subagentsClearingFinished \|\| finishedRuns\.length === 0/, "clear-finished should dismiss visible terminal ordinary runs while preserving retry-gated, active, and workflow runs");
1234
+ assert.match(app, /async function dismissSubagentRun\(tab, run\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*method: "POST",[\s\S]*scoped: false,[\s\S]*body: \{ group: tab\.groupId, runId: run\.id \}/, "finished-run dismiss controls should call the owning group endpoint");
1235
+ assert.match(app, /function finishedSubagentRunSelections\(data = latestSubagents\)[\s\S]*subagentRunIsTerminal\(run\) && subagentRunCanDismiss\(run\)[\s\S]*async function clearFinishedSubagentRuns\(\{ automatic = false \} = \{\}\)[\s\S]*for \(const selection of selections\)[\s\S]*api\("\/api\/subagents\/dismiss", \{[\s\S]*body: \{ group: selection\.groupId, runId: selection\.runId \}[\s\S]*subagentsClearFinishedButton\.disabled = subagentsLoading \|\| subagentsClearingFinished \|\| finishedRuns\.length === 0/, "clear-finished should dismiss visible terminal ordinary runs while preserving retry-gated, active, and workflow runs");
1234
1236
  assert.match(app, /subagentsAutoClearButton\?\.addEventListener\("click", \(\) => \{[\s\S]*setSubagentAutoClearEnabled\(!subagentAutoClearEnabled, \{ announce: true \}\)/, "the Auto-Clear button should toggle the selected browser preference");
1235
1237
  assert.match(app, /SUBAGENT_AUTO_CLEAR_STORAGE_KEY = "pi-webui-subagent-auto-clear"[\s\S]*function readStoredSubagentAutoClearEnabled\(\)[\s\S]*localStorage\.getItem\(SUBAGENT_AUTO_CLEAR_STORAGE_KEY\) === "1"[\s\S]*function setSubagentAutoClearEnabled[\s\S]*clearFinishedSubagentRuns\(\{ automatic: true \}\)[\s\S]*restoreSubagentAutoClearSetting\(\)/, "Auto-Clear should persist per browser and immediately clear already-finished ordinary runs when selected");
1236
1238
  assert.match(app, /async function refreshSubagents\(\)[\s\S]*refreshed = true[\s\S]*refreshed && subagentAutoClearEnabled && finishedSubagentRunSelections\(\)\.length[\s\S]*await clearFinishedSubagentRuns\(\{ automatic: true \}\)/, "successful overview refreshes should await guarded auto-clear when terminal runs appear");
@@ -1253,6 +1255,12 @@ const clearFinishedContext = {
1253
1255
  const gatedRunIds = new Set((tab.gates || []).flatMap((gate) => (gate.attempts || []).map((attempt) => attempt.runId)));
1254
1256
  return (tab.runs || []).filter((run) => !gatedRunIds.has(run.id));
1255
1257
  },
1258
+ // Mirror the production overview shape: one group per tab with `groupId: tab:<id>` and ungated display runs.
1259
+ subagentOverviewGroups(data) {
1260
+ return (data?.tabs || []).map((tab) => ({ ...tab, groupId: `tab:${tab.tabId}`, displayRuns: clearFinishedContext.ungatedSubagentRuns(tab) }));
1261
+ },
1262
+ subagentRunIsTerminal(run) { return ["done", "failed", "cancelled"].includes(run?.status); },
1263
+ subagentRunCanDismiss(run) { return clearFinishedContext.subagentRunIsTerminal(run) && run?.source !== "workflow"; },
1256
1264
  subagentsClearingFinished: false,
1257
1265
  subagentsLoading: false,
1258
1266
  refreshSubagentsTimer: null,
@@ -1266,9 +1274,9 @@ const clearFinishedContext = {
1266
1274
  vm.runInNewContext(`${app.slice(clearFinishedSourceStart, clearFinishedSourceEnd)}\nthis.runClearFinishedSubagentRuns = clearFinishedSubagentRuns;`, clearFinishedContext);
1267
1275
  await clearFinishedContext.runClearFinishedSubagentRuns();
1268
1276
  assert.deepEqual(JSON.parse(JSON.stringify(clearFinishedCalls)), [
1269
- { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-a", runId: "done-a" } } },
1270
- { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-b", runId: "failed-b" } } },
1271
- { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { tab: "tab-b", runId: "cancelled-b" } } },
1277
+ { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { group: "tab:tab-a", runId: "done-a" } } },
1278
+ { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { group: "tab:tab-b", runId: "failed-b" } } },
1279
+ { path: "/api/subagents/dismiss", options: { method: "POST", scoped: false, body: { group: "tab:tab-b", runId: "cancelled-b" } } },
1272
1280
  ], "clear-finished should call the existing dismiss endpoint only for visible terminal ordinary runs");
1273
1281
  assert.equal(clearFinishedRefreshes, 1, "clear-finished should refresh the overview once after all dismissals");
1274
1282
  assert.equal(clearFinishedContext.subagentsClearingFinished, false, "clear-finished should always release its in-flight guard");
@@ -1276,7 +1284,7 @@ assert.deepEqual(clearFinishedEvents, [{ message: "cleared 3 finished subagent r
1276
1284
  clearFinishedContext.latestSubagents = { tabs: [{ tabId: "tab-c", runs: [{ id: "done-c", status: "done", source: "async" }] }] };
1277
1285
  await clearFinishedContext.runClearFinishedSubagentRuns({ automatic: true });
1278
1286
  assert.deepEqual(clearFinishedEvents.at(-1), { message: "auto-cleared 1 finished subagent run", level: "info" }, "automatic clearing should identify its action without changing terminal-run selection semantics");
1279
- assert.match(app, /function materializeRetainedSubagentTerminalViews\(\)[\s\S]*restoreKey = `\$\{tab\.tabId\}\\u0000\$\{tab\.sessionFile[\s\S]*ungatedSubagentRuns\(tab\)[\s\S]*run\?\.status === "running"[\s\S]*ensureSubagentTerminalView/, "terminal mode should materialize only ungated restored retained agent views once per parent session identity without touching overlay mode");
1287
+ assert.match(app, /function materializeRetainedSubagentTerminalViews\(\)[\s\S]*subagentOverviewGroups\(\)[\s\S]*restoreKey = `\$\{tab\.tabId\}\\u0000\$\{tab\.sessionFile[\s\S]*tab\.displayRuns[\s\S]*\["queued", "running", "stale"\]\.includes\(subagentAgentStatus\(run\)\)[\s\S]*ensureSubagentTerminalView/, "terminal mode should materialize only ungated restored retained agent views once per parent session identity without touching overlay mode");
1280
1288
  assert.match(app, /from "\.\/subagent-launch-slot-state\.mjs"[\s\S]*function renderSubagentLaunchSlots\(\)[\s\S]*function loadSubagentLaunchSlotConfig\([\s\S]*\/api\/subagents\/config/, "launch-slot configuration should have its own browser state and API loader");
1281
1289
  assert.match(app, /function subagentLaunchSlotThinkingForModel\(model\)[\s\S]*modelThinkingLevels/, "launch-slot thinking choices should come from the selected model metadata");
1282
1290
  assert.match(app, /function renderSubagentLaunchSlotCard\(role, slots\)[\s\S]*Default \/ inherit[\s\S]*"Add slot"[\s\S]*Remove/, "role cards should render independent same-role slots and inheritance controls");
@@ -1289,7 +1297,7 @@ const subagentGateTargetSource = appFunctionSource("subagentGateAttemptTarget",
1289
1297
  const subagentGateExecutionSource = appFunctionSource("subagentGateAttemptExecutionValues", "openSubagentGateAttemptOutput");
1290
1298
  const subagentGateOpenSource = appFunctionSource("openSubagentGateAttemptOutput", "renderSubagentGateAttempt");
1291
1299
  const subagentGateAttemptSource = appFunctionSource("renderSubagentGateAttempt", "renderSubagentGate");
1292
- assert.match(subagentGateTargetSource, /candidate\?\.id === attempt\.runId[\s\S]*candidate\?\.name === attempt\.agent[\s\S]*agents\.length === 1[\s\S]*return agent\?\.id \? \{ run, agent \} : null/, "retry-gate attempts should resolve their ordinary tracked child run and agent");
1300
+ assert.match(subagentGateTargetSource, /candidate\?\.id === attempt\.runId[\s\S]*candidate\?\.name === attempt\.agent[\s\S]*agents\.length === 1[\s\S]*return agent\?\.id && subagentRunCanOpen\(run, agent\) \? \{ run, agent \} : null/, "retry-gate attempts should resolve their ordinary tracked child run and agent");
1293
1301
  assert.match(subagentGateExecutionSource, /SETTINGS_THINKING_OPTIONS\.includes\(suffix\)[\s\S]*model = model\.slice\(0, suffixIndex\)[\s\S]*model = `\$\{provider\}\/\$\{model\}`/, "compact gate rows should normalize provider, model, and thinking effort");
1294
1302
  assert.match(subagentGateAttemptSource, /const target = subagentGateAttemptTarget\(tab, attempt\)[\s\S]*subagentGateAttemptExecutionValues\(attempt\)[\s\S]*attempt\?\.status[\s\S]*retrySafety[\s\S]*subagent-gate-attempt-open/, "compact gate rows should retain title, state, provider\/model, thinking effort, type, and open affordance");
1295
1303
  assert.doesNotMatch(subagentGateAttemptSource, /attempt\?\.phase|failureKind|attempt\?\.error|`run \$\{attempt/, "compact gate rows should move verbose diagnostics out of the side panel");
@@ -1298,11 +1306,12 @@ assert.match(app, /function subagentGateAttemptViewFacts\(attempt\)[\s\S]*gate a
1298
1306
  assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*gateAttempt: run\.gateAttempt \|\| null[\s\S]*function ensureSubagentTerminalView\(tab, run, agent\)[\s\S]*gateAttempt: run\.gateAttempt \|\| null/, "overlay and terminal child views should retain gate diagnostics");
1299
1307
  assert.match(app, /function renderSubagentGate\(tab, gate\)[\s\S]*renderSubagentGateAttempt\(tab, attempt\)/, "retry-gate rendering should retain the owning parent tab needed to open child output");
1300
1308
  assert.match(css, /button\.subagent-gate-attempt \{ cursor: pointer; \}[\s\S]*button\.subagent-gate-attempt:hover,[\s\S]*button\.subagent-gate-attempt:focus-visible[\s\S]*\.subagent-gate-attempt-open/, "openable retry-gate attempts should expose button hover, keyboard-focus, and arrow affordances");
1301
- const subagentGateTargetContext = {};
1309
+ const subagentGateTargetContext = { subagentRunCanOpen: () => true };
1302
1310
  vm.runInNewContext(`${subagentGateTargetSource}\nthis.resolveSubagentGateAttempt = subagentGateAttemptTarget;`, subagentGateTargetContext);
1303
1311
  const gateTargetTab = {
1304
1312
  tabId: "parent-tab",
1305
- runs: [
1313
+ groupId: "tab:parent-tab",
1314
+ displayRuns: [
1306
1315
  { id: "review-run", agents: [{ id: "review-agent", name: "reviewer" }, { id: "scout-agent", name: "scout" }] },
1307
1316
  { id: "single-run", agents: [{ id: "single-agent", name: "delegate" }] },
1308
1317
  ],
@@ -1320,7 +1329,7 @@ assert.match(extension, /registerSubagentGate\(pi\)[\s\S]*session_shutdown[\s\S]
1320
1329
  assert.match(server, /function normalizeWebuiSubagentPayload\(value\)[\s\S]*model: normalizeWebuiSubagentText\(rawAgent\.model, 240\)[\s\S]*thinking: normalizeWebuiSubagentText\(rawAgent\.thinking, 40\)/, "server should bound model and reasoning metadata in the cross-tab overview");
1321
1330
  assert.match(server, /WEBUI_SUBAGENT_GATE_LIMIT[\s\S]*rawGate\.attempts[\s\S]*failureKind: normalizeWebuiSubagentText\(rawAttempt\.failureKind, 80\)[\s\S]*totalGates/, "server should bound retry gates and expose their cross-tab total");
1322
1331
  assert.match(server, /function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*model: normalizeWebuiSubagentText\(rawAgent\.model, 240\)[\s\S]*thinking: normalizeWebuiSubagentText\(rawAgent\.thinking, 40\)/, "server should preserve model and reasoning metadata in selected child output");
1323
- assert.match(server, /function normalizeWebuiSubagentSource\(value\) \{[\s\S]*value === "foreground" \|\| value === "workflow"[\s\S]*function normalizeWebuiSubagentPayload\(value\)[\s\S]*source: normalizeWebuiSubagentSource\(rawRun\.source\)[\s\S]*function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*source: normalizeWebuiSubagentSource\(selection\.run\?\.source \|\| value\.source\)/, "server should preserve workflow source in overview and selected-output normalization");
1332
+ assert.match(server, /function normalizeWebuiSubagentSource\(value\) \{[\s\S]*\["foreground", "workflow", "recovered"\]\.includes\(value\)[\s\S]*function normalizeWebuiSubagentPayload\(value\)[\s\S]*const source = normalizeWebuiSubagentSource\(rawRun\.source\)[\s\S]*function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*source: normalizeWebuiSubagentSource\(selection\.run\?\.source \|\| value\.source\)/, "server should preserve workflow source in overview and selected-output normalization");
1324
1333
  assert.match(app, /function subagentExecutionValues\(agent = \{\}\)[\s\S]*model\.slice\(suffixIndex \+ 1\)\.toLowerCase\(\) === thinking\.toLowerCase\(\)[\s\S]*return \[model \|\| "unknown", thinking \|\| "unknown"\][\s\S]*function subagentExecutionFacts\(agent = \{\}\)[\s\S]*model \$\{model\}[\s\S]*reasoning \$\{thinking\}/, "subagent metadata should share honest model\/reasoning values, strip duplicate effort suffixes, and retain unknown fallbacks");
1325
1334
  assert.match(app, /function subagentSourceLabel\(source = ""\) \{[\s\S]*source === "foreground" \|\| source === "workflow"[\s\S]*function subagentOverlayStateFacts\(data = subagentOverlayData\)[\s\S]*subagentSourceLabel\(data\?\.source \|\| run\.source\)[\s\S]*function renderSubagentTerminalView\(\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)[\s\S]*function renderSubagentTerminalTab\(view, \{ groupItem = false \} = \{\}\)[\s\S]*subagentSourceLabel\(view\.data\?\.source \|\| view\.run\?\.source\)/, "one source-label helper should keep overlays and virtual tabs honest after inline metadata is removed");
1326
1335
  assert.match(compactSubagentAgentSource, /subagentExecutionValues\(agent\)/, "Subagents side-panel rows should reuse the normalized model and reasoning values shown in selected output views");
@@ -1337,7 +1346,7 @@ assert.match(app, /const facts = \[[\s\S]*view\.finished \? "finished" : running
1337
1346
  assert.match(app, /function renderSubagentTerminalView\(\)[\s\S]*if \(running\) appendSubagentRunIndicator\(elements\.subagentTerminalTranscript, \{ agent, run: view\.run \}\)/, "the dedicated child tab should append a live run indicator whenever the selected child is running");
1338
1347
  const subagentTerminalSignatureSource = appFunctionSource("subagentTerminalViewMeaningfulSignature", "updateSubagentTerminalRefreshState");
1339
1348
  const subagentTerminalRefreshSource = appFunctionSource("refreshSubagentTerminalView", "deactivateSubagentTerminalView");
1340
- assert.ok(subagentTerminalRefreshSource.includes("tab: view.parentTabId, run: view.runId, agent: view.agentId"), "subagent terminal refresh should stay scoped to the child and its owning parent terminal");
1349
+ assert.ok(subagentTerminalRefreshSource.includes("group: view.groupId, run: view.runId, agent: view.agentId"), "subagent terminal refresh should stay scoped to the child and its owning parent terminal");
1341
1350
  assert.ok(subagentTerminalRefreshSource.includes("view.finished = true"), "an open child tab should retain its last snapshot after the run is no longer tracked");
1342
1351
  assert.ok(subagentTerminalRefreshSource.includes("previousSignature !== subagentTerminalViewMeaningfulSignature(view)"), "automatic child polling should compare meaningful snapshots before rebuilding the transcript");
1343
1352
  let unchangedSubagentRenderCount = 0;
@@ -1423,7 +1432,7 @@ assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend sh
1423
1432
  assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
1424
1433
  assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*await webuiSubagentsData\(\)/, "server should await enriched cross-tab running-subagent titles");
1425
1434
  assert.match(server, /async function resolveSubagentDisplayTitle\(tab\)[\s\S]*tab\.titleSource !== "auto"[\s\S]*get_messages[\s\S]*message\?\.role === "user"[\s\S]*generatedTabTitleFromPrompt\(extractSessionTextContent\(firstUserMessage\?\.content\)\)/, "existing auto-named subagent groups should recover their longer title from the first user message without relaunching children");
1426
- assert.match(server, /const tabSummaries = await Promise\.all\([\s\S]*runs\.length \|\| gates\.length \? await resolveSubagentDisplayTitle\(tab\) : tab\.title/, "subagent title recovery should run once for visible run and retry-gate groups");
1435
+ assert.match(server, /const tabSummaries = await Promise\.all\([\s\S]*runs\.length \|\| gates\.length \|\| tab\.webuiAgentRuns\?\.instances\?\.length \? await resolveSubagentDisplayTitle\(tab\) : tab\.title/, "subagent title recovery should run once for visible run and retry-gate groups");
1427
1436
  const resolveSubagentDisplayTitleStart = server.indexOf("async function resolveSubagentDisplayTitle(");
1428
1437
  const resolveSubagentDisplayTitleEnd = server.indexOf("\nasync function webuiSubagentsData(", resolveSubagentDisplayTitleStart);
1429
1438
  assert.ok(resolveSubagentDisplayTitleStart >= 0 && resolveSubagentDisplayTitleEnd > resolveSubagentDisplayTitleStart, "subagent display-title recovery should remain independently testable");
@@ -1443,7 +1452,7 @@ const legacyAutoNamedTab = { title: "Workspace files webui files section sidepan
1443
1452
  assert.equal(await resolveSubagentDisplayTitleContext.runResolveSubagentDisplayTitle(legacyAutoNamedTab), recoveredSubagentTitle, "existing auto-named rows should recover the wider title from their parent conversation");
1444
1453
  assert.equal(await resolveSubagentDisplayTitleContext.runResolveSubagentDisplayTitle(legacyAutoNamedTab), recoveredSubagentTitle, "recovered titles should remain available to later panel refreshes");
1445
1454
  assert.equal(subagentTitleMessageReads, 1, "title recovery should read the existing parent conversation once and must not require spawning another subagent");
1446
- assert.match(server, /url\.pathname === "\/api\/subagents\/output" && req\.method === "GET"[\s\S]*webuiSubagentOutputData\(tab, runId, agentId\)/, "server should expose selected running subagent output only through its owning tab");
1455
+ assert.match(server, /url\.pathname === "\/api\/subagents\/output" && req\.method === "GET"[\s\S]*canonicalWebuiSubagentOutputData\(groupId, runId, agentId\)[\s\S]*webuiSubagentOutputData\(getRequestedTab\(req, url\), runId, agentId\)/, "server should expose selected running subagent output only through its owning group or tab");
1447
1456
  assert.match(server, /rememberWebuiSubagentsStatusEvent\(tab, event\)/, "server should ingest the helper's structured subagent status without forwarding internal JSON to the browser footer");
1448
1457
  assert.match(server, /PI_RPC_JSONL_LINE_MAX_BYTES = 32 \* 1024 \* 1024/, "Pi RPC JSONL parsing should use an explicit line-size limit with inline-image headroom");
1449
1458
  assert.match(server, /function ensureStderrMirrorErrorHandler\(stream\)[\s\S]*stream\.on\("error"/, "Pi stderr mirroring should contain asynchronous closed-sink failures");
@@ -1457,7 +1466,7 @@ assert.match(helper, /SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started"[\s
1457
1466
  assert.match(helper, /pi\.on\("tool_execution_start"[\s\S]*event\.toolName !== "subagent"[\s\S]*pi\.on\("tool_execution_end"/, "Web UI helper should track foreground subagent executions");
1458
1467
  assert.match(app, /if \(normalized === "prolite"\) return "Usage";/, "Codex Prolite plan labels should display as Usage in the side panel");
1459
1468
  assert.match(app, /api\(`\/api\/codex-usage\$\{suffix\}`, \{ scoped: false \}\)/, "Codex usage should load through a server endpoint without browser credentials");
1460
- assert.match(app, /restoreSidePanelSectionState\(\);\nbindSidePanelSectionToggles\(\);/, "side panel section state should restore before toggles are bound");
1469
+ assert.match(app, /restoreSidePanelSectionState\(\);\n[\s\S]{0,200}?bindSidePanelSectionToggles\(\);/, "side panel section state should restore before toggles are bound");
1461
1470
  assert.match(app, /OPTIONAL_FEATURES_STORAGE_KEY/, "optional feature disable toggles should persist in browser storage");
1462
1471
  assert.match(app, /GIT_FOOTER_WEBUI_STATUS_KEY = "git-footer-webui"/, "git footer Web UI data should be received as an extension-owned status payload");
1463
1472
  assert.match(html, /gitFooterVisibilityApplyButton[^>]*>Save globally</, "git footer visibility should state that applied choices persist globally");
@@ -1599,7 +1608,7 @@ assert.doesNotMatch(workspaceInfoSource, /runCommand\("git"|branchStatus|isRepo/
1599
1608
  assert.match(app, /function renderOptionalFeatureDependentDisplays\(\)[\s\S]*renderOptionalFeatureControls\(\);[\s\S]*renderThemeSelect\(\);[\s\S]*renderWidgets\(\);[\s\S]*renderStatus\(\);[\s\S]*renderCommands\(\);[\s\S]*renderAllMessages\(\{ preserveScroll: true, forceRebuild: true \}\);[\s\S]*if \(streamRawText\) renderStreamingAssistantText\(\);/, "optional feature toggles should immediately refresh visible controls, commands, transcript, and live stream displays");
1600
1609
  assert.match(app, /function setOptionalFeatureDisabled\(featureId, disabled\)[\s\S]*renderOptionalFeatureDependentDisplays\(\);[\s\S]*const tabContext = activeTabContext\(\);[\s\S]*refreshCommands\(tabContext\)/, "optional feature enable/disable should re-render the GUI and then refresh command capabilities");
1601
1610
  assert.match(app, /function setOptionalControlState\(button, available, unavailableTitle\)[\s\S]*setAttribute\("aria-label", nextAriaLabel\)[\s\S]*setAttribute\("data-tooltip", nextTooltip\)/, "optional feature button disabled state should update accessible labels and visible tooltips");
1602
- assert.match(app, /const hasGitWorkflow = isOptionalFeatureEnabled\("gitWorkflow"\);\n\s+elements\.gitWorkflowButton\.hidden = !hasGitWorkflow/, "guided git workflow composer button should be hidden when unavailable or disabled");
1611
+ assert.match(app, /const hasGitWorkflow = isOptionalFeatureEnabled\("gitWorkflow"\);[\s\S]{0,400}?elements\.gitWorkflowButton\.hidden = !hasGitWorkflow && isOptionalFeatureDisabled\("gitWorkflow"\)/, "guided git workflow composer button should stay discoverable (disabled) when the package is missing and hide only when explicitly disabled");
1603
1612
  assert.match(app, /elements\.publishButton\.hidden = !hasPublishWorkflow[\s\S]*elements\.nativeCommandMenuButton\.hidden = !hasNativeCommandMenu/, "optional publish and skills/tools menu buttons should be hidden when no enabled menu items are available");
1604
1613
  assert.match(app, /\["skills", "tuiSkillsCommand"\][\s\S]*\["tools", "tuiToolsCommand"\]/, "optional feature toggles should gate /skills and /tools command surfaces");
1605
1614
  assert.match(app, /function setNativeCommandMenuOpen\(open\)/, "frontend should track the skills/tools command menu open state separately from Publish");
@@ -1782,7 +1791,7 @@ assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/,
1782
1791
  assert.match(css, /\.git-workflow-actions button\[data-tooltip\]::after \{[\s\S]*content:\s*attr\(data-tooltip\)[\s\S]*white-space:\s*pre-line/, "guided git workflow action tooltips should render multiline step lists");
1783
1792
  assert.match(app, /function gitBranchNamePromptMessage\(\)[\s\S]*hasAvailableCommand\("git-branch-name"\)[\s\S]*return "\/git-branch-name"/, "guided git workflow should ask the agent to generate PR branch names when the prompt is available");
1784
1793
  assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch-name"/, "guided git workflow should load generated agent branch names before branch creation");
1785
- assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*chooseGitWorktreeBase\(branch\)[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, baseRef, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git worktrees should ask for a base ref before verifying and carrying staged content");
1794
+ assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*appPromptText\(\{ title: "New PR branch worktree"[\s\S]*chooseGitWorktreeBase\(branch\)[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, baseRef, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git worktrees should ask for a base ref before verifying and carrying staged content");
1786
1795
  assert.match(app, /function syncGitWorkflowWorktreeTabs\(result\)[\s\S]*Array\.isArray\(result\?\.tabs\)[\s\S]*applyTabMetadata\(result\.tab\)/, "guided git workflow should merge worktree tab metadata returned by the branch endpoint");
1787
1796
  assert.match(app, /const targetTabId = result\.tab\?\.id[\s\S]*setGitWorkflow\(nextState, \{ tabId: targetTabId \}\)[\s\S]*switchTab\(targetTabId\)/, "guided git workflow should transfer PR state to the opened worktree tab");
1788
1797
  assert.match(app, /addGitWorkflowAction\("Push and Create PR", \(\) => pushAndCreatePrGitWorkflow\(\), "primary", false\)/, "guided git workflow should replace push with Push and Create PR in PR mode");
@@ -1816,7 +1825,7 @@ assert.match(app, /function renderAppRunnerWidget\(\)/, "frontend should render
1816
1825
  assert.match(app, /function tabAppRunnerRunningRun\(tab\)[\s\S]*appRunnerIsRunning\(run\)/, "frontend should derive running app-runner state for terminal tab indicators");
1817
1826
  assert.match(app, /function appendTerminalTabContent\(button, \{ title, indicator, meta, count = null, appRunnerRun = null, conversationModeActive = false,[^}]*\}\)[\s\S]*terminal-tab-app-runner-indicator/, "terminal tab content should render a visible app-runner badge");
1818
1827
  assert.match(app, /function appendTerminalTabContent\(button,[\s\S]*terminal-tab-conversation-indicator/, "terminal tab content should render a visible Natural Conversation badge");
1819
- assert.match(app, /function renderTerminalTab\(tab\)[\s\S]*conversation-mode-running/, "terminal tabs should indicate active Natural Conversation mode per tab");
1828
+ assert.match(app, /function renderTerminalTab\(tab, \{ showCwdAdd = false \} = \{\}\)[\s\S]*conversation-mode-running/, "terminal tabs should indicate active Natural Conversation mode per tab");
1820
1829
  assert.match(css, /\.composer-conversation-mode-chip[\s\S]*\.composer-conversation-end-button/, "Natural Conversation composer controls should have dedicated styles");
1821
1830
  assert.match(css, /\.composer\.conversation-mode-active[\s\S]*body\.conversation-mode-active \.composer::before/, "active Natural Conversation mode should visibly glow around the composer");
1822
1831
  assert.match(css, /\.terminal-tab\.conversation-mode-running[\s\S]*\.terminal-tab-conversation-indicator/, "Natural Conversation tabs should have active-tab and badge styles");
@@ -1869,7 +1878,7 @@ assert.match(app, /function applyToolExecutionBubbleState\(bubble, message\)[\s\
1869
1878
  assert.match(app, /function toolExecutionRenderSignature\(message\)[\s\S]*?normalizeToolExecution\(message\)[\s\S]*?toolRenderSignatureReplacer\(\)/, "tool cards should derive stable render signatures from normalized tool payloads");
1870
1879
  assert.match(app, /const nextRenderSignature = toolExecutionRenderSignature\(message\)[\s\S]*?bubble\._toolRenderSignature === nextRenderSignature[\s\S]*?return true;[\s\S]*?bubble\._toolRenderSignature = nextRenderSignature/, "live tool card updates should skip identical body re-renders");
1871
1880
  assert.match(app, /message\.role === "toolExecution"[\s\S]*?renderToolExecution\(body, message\);[\s\S]*?bubble\._toolRenderSignature = toolExecutionRenderSignature\(message\);/, "new tool cards should cache their initial render signature");
1872
- assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\)\) applyTranscriptToolExecutionUpdate\(event\);/, "live tool updates should enter the bounded transcript controller sink");
1881
+ assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\) && !isIntercomTransportToolName\(event\?\.toolName\)\) applyTranscriptToolExecutionUpdate\(event\);/, "live tool updates should enter the bounded transcript controller sink");
1873
1882
  assert.match(app, /function applyTranscriptToolExecutionUpdate\(event\)[\s\S]*?event\.partialResult[\s\S]*?renderLiveToolRun\(run, \{ scroll: false \}\)/, "coalesced tool_execution_update events should update transcript-visible tool cards in the controller frame");
1874
1883
  assert.match(app, /function captureReusableToolCards\(\)[\s\S]*?\.message\.toolExecution\[data-tool-call-id\]/, "full transcript re-renders should capture existing tool cards before clearing the chat");
1875
1884
  assert.match(app, /function appendMessage\(message,[\s\S]*?reusableToolCards = null[\s\S]*?reuseToolExecutionBubble\(reusableToolCards, message/, "message rendering should reuse matching tool cards instead of replacing them during refreshes");
@@ -1896,28 +1905,29 @@ assert.match(app, /function visibleThinkingText\(text\)[\s\S]*?trimmed === UNEXP
1896
1905
  assert.match(app, /if \(isThinkingPart\) \{[\s\S]*?visibleThinkingText\(assistantThinkingText\(part\)\)[\s\S]*?if \(thinking\) displayMessages\.push/, "assistant transcript splitting should skip empty or unexposed thinking parts");
1897
1906
  assert.match(app, /message\.role === "thinking"[\s\S]*?visibleThinkingText\(message\.thinking \|\| textFromContent\(message\.content\)\)[\s\S]*?if \(thinkingOutputVisible && thinkingText\) appendThinkingMarkdown\(body, thinkingText\);/, "thinking cards should suppress empty and provider no-thinking placeholder output while rendering visible reasoning as markdown");
1898
1907
  assert.match(app, /function showStreamingThinking\(initialText = ""\)[\s\S]*?if \(initialText && !streamThinking\.textContent\) renderThinkingMarkdown\(streamThinking, initialText\);/, "live thinking should not create a visible placeholder card before content arrives");
1899
- assert.match(app, /function setStreamingThinkingText\(text\)[\s\S]*?const thinking = visibleThinkingText\(text\);[\s\S]*?if \(!thinkingOutputVisible \|\| !thinking\) return false;[\s\S]*?return true;/, "live thinking text setters should ignore empty text instead of clearing or flashing the card");
1900
- assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update, \{ placeholder = "" \} = \{\}\)[\s\S]*?return setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\);/, "incremental thinking sync should only report success after setting visible thinking text");
1908
+ assert.match(app, /function setStreamingThinkingText\(text, \{ complete = false \} = \{\}\)[\s\S]*?const thinking = visibleThinkingText\(text\);[\s\S]*?if \(!thinkingOutputVisible \|\| !thinking\) return false;[\s\S]*?return true;/, "live thinking text setters should ignore empty text instead of clearing or flashing the card");
1909
+ assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update, \{ placeholder = "", render = true \} = \{\}\)[\s\S]*?return render \? setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\) : true;/, "incremental thinking sync should only report success after setting visible thinking text");
1901
1910
  assert.doesNotMatch(app, /text \|\| placeholder \|\| streamThinkingBubble/, "partial-message thinking sync should not clear an existing thinking card when a partial carries no visible thinking text");
1902
- assert.match(app, /if \(thinkingOutputVisible && delta && \(!synced \|\| !streamThinking\?\.textContent\)\) \{/, "live thinking delta fallback should require visible delta text before creating a card");
1911
+ assert.match(app, /update\.type === "thinking_start" \|\| update\.type === "thinking_delta"\) \{\s+syncStreamingThinkingFromUpdate\(event, update, \{ render: false \}\);\s+if \(thinkingOutputVisible && streamThinkingRawText\) thinkingStreamRenderScheduler\.request\(\{ complete: false \}\);/, "live thinking deltas should require visible raw thinking text before scheduling a card render");
1903
1912
  assert.match(app, /function thinkingDeltaText\(update\) \{[\s\S]*?return visibleThinkingText\(update\.delta \|\| update\.thinking \|\| update\.content \|\| ""\);/, "live thinking deltas should suppress provider no-thinking placeholders too");
1904
1913
  assert.match(app, /const THINKING_VISIBILITY_STORAGE_KEY = "pi-webui-thinking-visible"/, "thinking visibility should persist in browser storage");
1905
1914
  assert.match(app, /function setThinkingOutputVisible\(visible[\s\S]*renderAllMessages\(\{ preserveScroll: true \}\)/, "thinking visibility changes should immediately re-render the transcript");
1906
1915
  assert.match(app, /function assistantStreamingMessage\(event\)/, "live streaming should read the authoritative partial assistant message from RPC events like the TUI");
1907
- assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update[\s\S]*?const fallback = streamingThinkingTextFallback\(event\);[\s\S]*?setStreamThinkingRawText\(fallback\);[\s\S]*?return setStreamingThinkingText\(streamThinkingRawText \|\| placeholder\);/, "live thinking end should replace deltas with the final partial-message thinking content");
1908
- assert.match(app, /function setStreamRawText\(text\)[\s\S]*?streamRawText = nextText;[\s\S]*?resetStreamDerivedTextCache\(\);/, "live assistant text should synchronize from partial messages through a cache-aware setter");
1916
+ assert.match(app, /function syncStreamingThinkingFromUpdate\(event, update[\s\S]*?update\.type === "thinking_end"\) \{[\s\S]*?const fallback = streamingThinkingTextFallback\(event\);[\s\S]*?setStreamThinkingRawText\(fallback, \{ reconcile: true \}\);[\s\S]*?return render \? setStreamingThinkingText\(streamThinkingRawText \|\| placeholder, \{ complete: true \}\) : true;/, "live thinking end should replace deltas with the final partial-message thinking content");
1917
+ assert.match(app, /function setStreamRawText\(text, \{ reason = "snapshot" \} = \{\}\)[\s\S]*?streamRawText = nextText;[\s\S]*?ensureStreamDerivedOutputState\(\)\.replace\(nextText, \{ reason \}\);/, "live assistant text should synchronize from partial messages through a cache-aware setter");
1909
1918
  assert.match(app, /const TODO_PROGRESS_LINE_REGEX = /, "frontend should recognize live todo progress lines that will be moved into the todo widget");
1910
1919
  assert.match(app, /function stripTodoProgressLines\(text, \{ streaming = false \} = \{\}\)/, "live Assistant output should strip todo-progress lines before rendering final-output text");
1911
1920
  assert.match(app, /function syncLiveTodoProgressWidgetFromText\(text, tabId = activeTabId\)/, "authoritative Assistant checklist text should remain convertible into the todo-progress widget");
1912
1921
  assert.doesNotMatch(app, /scheduleLiveTodoProgressWidgetSync\(streamRawText, event\.tabId \|\| activeTabId\)/, "raw streaming assistant text must not drive the todo-progress widget");
1913
- assert.match(app, /function renderStreamingAssistantText\(\)[\s\S]*?const thinkingFormat = syncStreamingThinkingFormat\(\);[\s\S]*?const finalText = thinkingFormat\?\.hasThinkingFormat \? streamDerivedText\(\)\.finalText : streamRenderableAssistantText\(\);/, "streamed Assistant text should render cached derived output without directly rescanning raw stream text");
1914
- assert.match(app, /function syncStreamingThinkingFormat\(\)[\s\S]*?const parsed = streamDerivedText\(\)\.thinkingFormat;[\s\S]*?setStreamingThinkingText\(thinking\)/, "tagged <think> streaming output should update the live thinking card from cached parse state instead of flashing raw tags");
1922
+ assert.match(app, /function renderStreamingAssistantText\(\{ complete = false \} = \{\}\)[\s\S]*?const thinkingFormat = syncStreamingThinkingFormat\(\{ complete \}\);[\s\S]*?const finalText = thinkingFormat\?\.hasThinkingFormat \? streamDerivedText\(\)\.finalText : streamRenderableAssistantText\(\);/, "streamed Assistant text should render cached derived output without directly rescanning raw stream text");
1923
+ assert.match(app, /function syncStreamingThinkingFormat\(\{ complete = false \} = \{\}\)[\s\S]*?const parsed = streamDerivedText\(\)\.thinkingFormat;[\s\S]*?setStreamingThinkingText\(thinking, \{ complete: complete \|\| parsed\.complete \}\)/, "tagged <think> streaming output should update the live thinking card from cached parse state instead of flashing raw tags");
1915
1924
  assert.match(app, /const finalText = thinkingFormat\?\.hasThinkingFormat \? streamDerivedText\(\)\.finalText : streamRenderableAssistantText\(\);/, "tagged <think> streaming output should render only final response text in the Assistant card");
1916
1925
  assert.match(app, /const STREAM_OUTPUT_HIDE_DELAY_MS = 300/, "stream output hiding should be debounced to prevent rapid flicker");
1917
1926
  assert.doesNotMatch(app, /STREAM_OUTPUT_TOOLCALL_GUARD_MS|scheduleStreamingAssistantTextRender/, "controller batching should be the only live assistant render scheduler");
1918
1927
  assert.match(app, /function scheduleStreamBubbleHide\([\s\S]*?STREAM_OUTPUT_MIN_VISIBLE_MS/, "stream output cards should observe a minimum visible duration before hiding");
1919
- assert.match(app, /if \(finalText\) \{[\s\S]*?renderStreamingMarkdown\(streamText, finalText\);[\s\S]*?\} else \{\n\s+scheduleStreamBubbleHide\(\);/, "empty filtered stream output should schedule hide while visible stream output renders as Markdown");
1920
- assert.match(app, /function handleMessageUpdate\(event\)[\s\S]*?renderStreamingAssistantText\(\);/, "controller-batched assistant text should render through the transcript-only sink without a second scheduler");
1928
+ assert.match(app, /if \(finalText\) \{[\s\S]*?renderStreamingMarkdown\(streamText, finalText, \{ complete \}\);[\s\S]*?\} else \{\n\s+scheduleStreamBubbleHide\(\);/, "empty filtered stream output should schedule hide while visible stream output renders as Markdown");
1929
+ assert.match(app, /function handleMessageUpdate\(event\)[\s\S]*?assistantStreamRenderScheduler\.request\(\{ complete: update\.type === "text_end" \}\);/, "controller-batched assistant text should render through the latest-wins transcript scheduler");
1930
+ assert.match(app, /const assistantStreamRenderScheduler = createLatestWinsRenderScheduler\(\{\s+render: \(options\) => \{\s+renderStreamingAssistantText\(options\);/, "the assistant stream scheduler should render through the transcript-only sink");
1921
1931
  assert.match(app, /streamToolCallSeen = true;\n\s+suppressStreamingAssistantTextBeforeToolCall\(\);/, "tool-call starts should remove pending assistant text from the live transcript");
1922
1932
  assert.match(app, /function renderStreamingToolCallCard\(\{ scroll = false \} = \{\}\)[\s\S]*?appendMessage\(message, \{ streaming: true, itemKey:[\s\S]*?transcriptRenderer\.ownSurface\(streamToolCallText[\s\S]*?transcriptRenderer\.updateTextSurface\(\{[\s\S]*?text: displayText/, "live tool-call cards should render and update their stable semantic arguments surface in place");
1923
1933
  assert.match(app, /update\.type === "toolcall_delta"[\s\S]*?updateStreamingToolCallFromEvent\(event, \{ appendDelta: true \}\)/, "tool-call deltas should update visible streamed arguments through the transcript-only sink");
@@ -1959,11 +1969,12 @@ assert.match(app, /function renderSessionSummaryControls\(\)[\s\S]*?renderSignat
1959
1969
  assert.match(app, /const previousCatalog = commandCatalogsByTab\.get\(tabContext\.tabId\);[\s\S]*?tabsSnapshotSignature\(previousCatalog\) !== tabsSnapshotSignature\(catalog\)\) scheduleTabsRender\(\);/, "foreground command refreshes should retain unchanged terminal controls");
1960
1970
  assert.doesNotMatch(app, /elements\.chat\.(?:append|insertBefore)\(runIndicatorBubble/, "the active agent indicator must never be mounted in the transcript");
1961
1971
  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");
1962
- 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");
1963
- assert.match(app, /runIndicatorShowsElapsed\(\) \? `\$\{detail\} · run time/, "active agent indicator should label elapsed run time instead of showing a bare counter");
1972
+ assert.match(app, /if \(runIndicatorMeta\.textContent !== meta\) runIndicatorMeta\.textContent = meta;[\s\S]*?const elapsed = runIndicatorShowsElapsed\(\) \? ` · run time[\s\S]*?runIndicatorElapsed\.textContent = elapsed;/, "active agent indicator should avoid redundant metadata DOM writes and keep the elapsed ticker in its own aria-hidden span");
1973
+ assert.match(app, /runIndicatorShowsElapsed\(\) \? ` · run time/, "active agent indicator should label elapsed run time instead of showing a bare counter");
1964
1974
  assert.match(app, /case "agent_settled":(?:(?!case ")[\s\S])*?clearRunIndicatorActivity\(\{ deferRemoval: !autoFollowChat \|\| !isChatNearBottom\(\) \}\);(?:(?!case ")[\s\S])*?scheduleSemanticReconcile\(\{[^}]*messages: true/, "settlement should keep the tail height stable for readers above the live edge until the coalesced semantic reconciler refreshes canonical messages");
1965
1975
  assert.match(app, /Abort requested/, "abort feedback should clarify that Web UI is checking stop status");
1966
- assert.match(app, /const ABORT_LONG_PRESS_MS = 3000/, "Abort long-press timing should be explicit");
1976
+ assert.match(app, /const ABORT_LONG_PRESS_MS = 1200/, "Abort long-press timing should be explicit and short enough to feel responsive");
1977
+ assert.match(app, /function showAbortTapHint\(\)[\s\S]*?"Hold to abort"/, "a quick tap on Abort should explain the hold instead of doing nothing");
1967
1978
  assert.match(app, /const ABORT_LONG_PRESS_TICK_MS = 100/, "Abort hold countdown should update visibly while held");
1968
1979
  assert.match(app, /const ABORT_LONG_PRESS_RELEASE_GRACE_MS = 350/, "Escape release cancellation should be debounced to ignore spurious keyup during key repeat");
1969
1980
  assert.match(app, /let escapeAbortHoldSuppressesDoubleEscape = false/, "Escape abort hold should track suppression separately from abort button UI state");
@@ -1990,7 +2001,7 @@ assert.match(app, /function clearRunIndicatorActivity[\s\S]*?clearRunIndicatorGr
1990
2001
  assert.match(app, /scheduleRunIndicatorGraceCheck\(tabContext = activeTabContext\(\)\)[\s\S]*?refreshState\(tabContext\)/, "stale local-only run indicators should re-check state after the start grace period");
1991
2002
  assert.match(app, /function scheduleAbortStateChecks\(/, "abort handling should poll state so the active indicator can clear after stop confirmation");
1992
2003
  assert.match(app, /case "tool_execution_start":[\s\S]*?suppressStreamingAssistantTextBeforeToolCall\(\)[\s\S]*?handleToolExecutionStart\(event\)[\s\S]*?setRunIndicatorActivity\(`Running tool:/, "tool execution should suppress pre-tool assistant text, then update the active agent indicator and live tool card");
1993
- assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\)\) applyTranscriptToolExecutionUpdate\(event\);/, "tool execution updates should enter the transcript-only controller sink before lifecycle dispatch");
2004
+ assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\) && !isIntercomTransportToolName\(event\?\.toolName\)\) applyTranscriptToolExecutionUpdate\(event\);/, "tool execution updates should enter the transcript-only controller sink before lifecycle dispatch");
1994
2005
  assert.match(app, /case "auto_retry_start":[\s\S]*?addTransientMessage\(\{ role: "warn", title: "auto retry"/, "auto-retry starts should be transcript-visible warnings");
1995
2006
  assert.match(app, /function trackAutoRetryStateFromEvent\(event\)[\s\S]*?event\.type === "auto_retry_start"[\s\S]*?autoRetryingTabs\.add\(tabId\)[\s\S]*?suppressPendingAgentDoneNotificationsForTab\(tabId\)[\s\S]*?markTabWorkingLocally\(tabId\)/, "auto-retry starts should suppress misleading done notifications and keep the tab working");
1996
2007
  assert.match(app, /function notifyAgentDone[\s\S]*?agentDoneNotificationKeys\.add\(key\);\n\s+if \(isAutoRetryingTab\(tabId\)\) return;/, "agent-done notifications should be ignored while a tab is auto-retrying");
@@ -2028,7 +2039,7 @@ assert.match(app, /function updateComposerModeButtons\(\)/, "composer should rel
2028
2039
  assert.match(app, /const target = runActive \? elements\.composerRow : elements\.composerActionsPanel/, "Steer and Follow-up should move into the bottom row only while an agent run is active");
2029
2040
  assert.match(app, /const before = runActive \? elements\.abortButton : null/, "active Steer and Follow-up controls should sit before Abort and Send");
2030
2041
  assert.match(app, /button\.hidden = !runActive;\n\s+button\.disabled = !runActive;/, "Steer and Follow-up should be hidden and disabled when the agent is not running");
2031
- assert.match(app, /renderBusyPromptBehaviorTag\(\);\n\s+document\.body\.classList\.toggle\("pi-run-active", runActive \|\| abortAvailable\)/, "composer mode refresh should keep the busy prompt behavior tag current");
2042
+ assert.match(app, /renderBusyPromptBehaviorTag\(\);\n\s+renderSendButtonMode\(runActive\);\n\s+document\.body\.classList\.toggle\("pi-run-active", runActive \|\| abortAvailable\)/, "composer mode refresh should keep the busy prompt behavior tag and Send label current");
2032
2043
  assert.match(app, /const abortHoldActive = isAbortLongPressActive\(\);\n\s+if \(!abortAvailable && !abortHoldActive\) resetAbortLongPressAffordance\(\);\n\s+elements\.abortButton\.hidden = !abortAvailable && !abortHoldActive;\n\s+elements\.abortButton\.disabled = \(!abortAvailable && !abortHoldActive\) \|\| abortRequestInFlight;/, "Abort should stay visible during an active hold even if run state briefly refreshes unavailable");
2033
2044
  assert.match(app, /document\.body\.classList\.toggle\("pi-run-active", runActive \|\| abortAvailable\)/, "run-active or abort-available state should be reflected in CSS for mobile composer layout");
2034
2045
  assert.match(app, /function showComposerButtonTooltip\(button\)/, "empty mode-button taps should show the usage tooltip");
@@ -2083,9 +2094,9 @@ assert.match(app, /renderNativeResourceToggles\(tools, \{[\s\S]*?getResourceTag:
2083
2094
  assert.match(app, /function nativeResourceScopeControl\(scope,[\s\S]*Session only[\s\S]*Global default/, "Tools and Skills Setup should expose a visible session/global scope control");
2084
2095
  assert.match(app, /\/api\/tools\?scope=\$\{encodeURIComponent\(scope\)\}[\s\S]*enabledTools: \[\.\.\.enabledTools\], scope/, "Tools Setup should load and save the selected scope");
2085
2096
  assert.match(app, /\/api\/skills\?scope=\$\{encodeURIComponent\(scope\)\}[\s\S]*enabledSkills: \[\.\.\.enabledSkills\], scope/, "Skills Setup should load and save the selected scope");
2086
- assert.match(server, /writeWebuiSettings\(\{ resourceDefaults: \{ tools: \{ enabledTools \} \} \}\)[\s\S]*writeWebuiSettings\(\{ resourceDefaults: \{ skills: \{ enabledSkills \} \} \}\)/, "server should persist global tool and skill defaults in the shared Web UI settings file");
2087
- assert.match(helper, /const saved = lastBranchConfig\(ctx, TOOLS_CONFIG_TYPE\)\?\.enabledTools;[\s\S]*const selected = Array\.isArray\(saved\) \? saved : inherited/, "session tool entries should take precedence over global defaults");
2088
- assert.match(helper, /const saved = lastBranchConfig\(ctx, SKILLS_CONFIG_TYPE\)\?\.disabledSkills;[\s\S]*if \(Array\.isArray\(saved\)\)/, "session skill entries should take precedence over global defaults");
2097
+ assert.match(server, /updateWebuiSettings\(\(current\) => \(\{\s+resourceDefaults: \{\s+tools: \{[\s\S]*updateWebuiSettings\(\(current\) => \(\{\s+resourceDefaults: \{\s+skills: \{/, "server should persist global tool and skill defaults in the shared Web UI settings file");
2098
+ assert.match(helper, /const directive = branchResourceDirective\(lastBranchConfig\(ctx, TOOLS_CONFIG_TYPE\), "tools"\);[\s\S]*?directive\.pinned\s+\? \{ names: directive\.names \|\| \[\], source: "session" \}\s+: resolveResourceSelection\(resourceDefaults, "tools"/, "session tool entries should take precedence over global defaults");
2099
+ assert.match(helper, /const directive = branchResourceDirective\(lastBranchConfig\(ctx, SKILLS_CONFIG_TYPE\), "skills"\);[\s\S]*?if \(directive\.pinned && directive\.legacyDisabledNames !== null\)/, "session skill entries should take precedence over global defaults");
2089
2100
  assert.match(technical, /Session only[\s\S]*Global default/, "technical reference should document resource selector scopes");
2090
2101
  assert.match(app, /const tags = Array\.isArray\(item\.tags\)[\s\S]*?item\.badge, \.\.\.tags/, "native selector filtering should include extra resource tags");
2091
2102
  assert.match(app, /publishMenuContainer\?\.addEventListener\("pointerenter", \(\) => \{[\s\S]*?setPublishMenuOpen\(true\);[\s\S]*?\}\)/, "Publish menu should expand on hover");
@@ -2120,7 +2131,7 @@ assert.match(app, /function openNativeModelSelector\(\)[\s\S]*?nativeCommandApi\
2120
2131
  assert.match(app, /function openNativeSettingsDialog\(\)[\s\S]*?\/api\/steering-mode[\s\S]*?\/api\/follow-up-mode[\s\S]*?\/api\/auto-compaction/, "native /settings selector should expose queue and compaction controls");
2121
2132
  assert.match(app, /function openNativeNameDialog\(\)[\s\S]*?sendPrompt\("prompt", `\/name \$\{name\}`\)/, "native /name selector should prompt before running the slash command");
2122
2133
  assert.match(app, /function openNativeForkSelector\(\)[\s\S]*?\/api\/fork-messages[\s\S]*?\/api\/fork/, "native /fork selector should pair fork-point loading with the fork action");
2123
- assert.match(app, /function openNativeResumeSelector\(scope = "current"\)[\s\S]*?\/api\/sessions\?scope=\$\{encodeURIComponent\(selectedScope\)\}/, "native /resume selector should list current-cwd or all sessions");
2134
+ assert.match(app, /function openNativeResumeSelector\(scope = "current", \{ query = "" \} = \{\}\)[\s\S]*?\/api\/sessions\?scope=\$\{encodeURIComponent\(selectedScope\)\}/, "native /resume selector should list current-cwd or all sessions");
2124
2135
  assert.match(app, /\/api\/session-rename/, "native /resume selector should rename session metadata");
2125
2136
  assert.match(app, /\/api\/session-delete/, "native /resume selector should delete sessions with confirmation");
2126
2137
  assert.match(app, /function openNativeTreeSelector\(\)[\s\S]*?\/api\/session-tree[\s\S]*?\/api\/tree-navigate/, "native /tree selector should list tree entries and navigate through the backend helper");
@@ -2179,7 +2190,7 @@ assert.match(app, /let openTerminalTabGroupKey = null/, "frontend should track t
2179
2190
  assert.match(app, /function updateTerminalTabGroupOpenState\(\)/, "frontend should be able to reapply open terminal tab group state after rerenders");
2180
2191
  assert.match(app, /const totalTabCount = tabs\.length \+ subagentTerminalViews\.size;[\s\S]*classList\.toggle\("terminal-tabs-dense", totalTabCount >= 10\)/, "frontend should include virtual subagent tabs when enabling dense tab layout");
2181
2192
  assert.match(app, /appendTerminalTabContent\(button, \{ title: activeTitle,[\s\S]*?count: groupTabs\.length,[^}]*\}\)/, "group buttons should show the active terminal name instead of only the cwd label");
2182
- assert.match(app, /wrapper\.addEventListener\("pointerenter", \(\) => setOpenTerminalTabGroup\(group\.key\)\)/, "terminal tab groups should mark themselves open while hovered");
2193
+ assert.match(app, /wrapper\.addEventListener\("pointerenter", \(event\) => \{\s+if \(event\.pointerType === "touch"\) return;\s+setOpenTerminalTabGroup\(group\.key\);/, "terminal tab groups should mark themselves open while hovered with a non-touch pointer");
2183
2194
  assert.match(app, /if \(openTerminalTabGroupKey\) \{\n\s+scheduleRefreshTabs\(600\);/, "tab polling should defer full tab refreshes while a group menu is open");
2184
2195
  assert.match(app, /function shouldRenderTerminalTabGroup\(group, groupCount\) \{\n\s+if \(group\.custom\) return group\.tabs\.length > 1;\n\s+return groupCount > 1 && group\.tabs\.length > 1 && Boolean\(group\.cwd\);\n\}/, "terminal tabs should always render custom groups while only collapsing multi-tab cwd groups when multiple groups are available");
2185
2196
  assert.match(app, /TERMINAL_CUSTOM_GROUPS_STORAGE_KEY/, "frontend should persist custom terminal tab groups in browser storage");
@@ -2190,7 +2201,7 @@ assert.match(app, /function closeTerminalTabGroup\(group\)[\s\S]*?closeTerminalT
2190
2201
  assert.match(app, /function closeAllTerminalTabs\(\)[\s\S]*?closeTerminalTabs\(tabs\.map\(\(tab\) => tab\.id\)/, "tab header should close all terminal tabs as a batch");
2191
2202
  assert.match(app, /WARNING: \$\{activeAgentTabs\.length\}[\s\S]*?still running or waiting for input/, "tab close confirmations should warn when agents are still running");
2192
2203
  assert.match(app, /elements\.closeAllTabsButton\.addEventListener\("click", \(\) => closeAllTerminalTabs\(\)\)/, "close-all tabs button should be wired in JS");
2193
- assert.match(app, /const groups = tabCwdGroups\(\);[\s\S]*?for \(const group of groups\) \{\n\s+if \(shouldRenderTerminalTabGroup\(group, groups\.length\)\)[\s\S]*?renderTerminalTabGroup\(group, groups\.length\)[\s\S]*?for \(const tab of group\.tabs\) elements\.tabBar\.append\(renderTerminalTab\(tab\)\);/, "terminal tabs should render groups with group count and ungrouped tabs when grouping is skipped");
2204
+ assert.match(app, /const groups = tabCwdGroups\(\);[\s\S]*?for \(const group of groups\) \{\n\s+if \(shouldRenderTerminalTabGroup\(group, groups\.length\)\)[\s\S]*?renderTerminalTabGroup\(group, groups\.length\)[\s\S]*?for \(const tab of group\.tabs\) elements\.tabBar\.append\(renderTerminalTab\(tab, \{ showCwdAdd \}\)\);/, "terminal tabs should render groups with group count and ungrouped tabs when grouping is skipped");
2194
2205
  assert.match(app, /const subagentGroups = subagentTerminalViewGroups\(\)[\s\S]*renderSubagentTerminalTabGroup\(group\)[\s\S]*renderSubagentTerminalTab\(group\.views\[0\]\)/, "open subagent views should render as first-class virtual tabs, grouped by parent workspace when siblings exist");
2195
2206
  assert.match(technical, /Tracked subagent output[\s\S]*dedicated \*\*Subagent\*\* terminal tab[\s\S]*read-only[\s\S]*does not stop or interrupt/, "technical reference should document the selectable read-only child terminal behavior");
2196
2207
  assert.match(app, /let tabSeenCompletionSerials = new Map\(\)/, "frontend should track which tab completions have been seen");
@@ -2243,7 +2254,7 @@ assert.match(app, /function isFooterPickerOpen\(\)[\s\S]*?footerModelPickerOpen
2243
2254
  assert.doesNotMatch(app.match(/function renderMinimalFooter\(\)[\s\S]*?\n\}/)?.[0] || "", /footer-details-toggle/, "minimal default footer should not render a details toggle chip");
2244
2255
  assert.match(app, /bindMobileViewChanges\(/, "side panel state should react to mobile breakpoint changes");
2245
2256
  // Intent preserved for legacy; v2 leaves mobile surface ownership to its reducer.
2246
- assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isSidePanelOverlayView\(\)\)/, "legacy mobile and narrow overlay layouts should start with the side panel collapsed");
2257
+ assert.match(app, /function restoreSidePanelState\(\) \{\n\s+if \(isMobileShellV2Active\(\)\) return;\n\s+if \(isControlDeckOverlayPresentation\(\)\)/, "legacy mobile and narrow overlay layouts should start with the side panel collapsed");
2247
2258
  assert.match(app, /case "webui_tab_reloaded":/, "frontend should handle native /reload tab restart events");
2248
2259
  assert.match(app, /addTransientMessage\(\{ role: "native", title: "\/reload"/, "native /reload should produce visible transcript output");
2249
2260
  assert.match(app, /copyText\(data\.copyText\)\.catch/, "native /copy should use the shared browser clipboard helper when available");
@@ -2529,16 +2540,16 @@ assert.ok(pkg.scripts?.check?.includes("node tests/run-all.mjs"), "check script
2529
2540
  assert.match(app, /let renderedTranscriptState = \{ epoch: "", entries: \[\] \};/, "transcript reconciliation should track rendered entries");
2530
2541
  const renderAllMessagesSource = appFunctionSource("renderAllMessages", "applyNativeSlashCommandEffects");
2531
2542
  assert.match(renderAllMessagesSource, /prefixLength[\s\S]*?prefixKeys[\s\S]*?transcriptRenderer\.commitTranscriptMutation\(\{[\s\S]*?kind: forceRebuild \? "authoritative" : "reconcile"[\s\S]*?if \(prefixLength === 0\)[\s\S]*?resetChatOutput\(\)[\s\S]*?removeChatBubblesAfterPrefix\(/, "renderAllMessages should reuse the unchanged keyed prefix inside one coordinator transaction instead of always rebuilding");
2532
- assert.match(app, /function removeChatBubblesAfterPrefix\(keptKeys\)[\s\S]*?child === elements\.stickyUserPromptButton \|\| child === runIndicatorBubble/, "prefix removal must preserve the sticky prompt button and run indicator");
2543
+ assert.match(app, /function removeChatBubblesAfterPrefix\(keptKeys\)[\s\S]*?child === elements\.stickyUserPromptButton \|\| liveBubbles\.has\(child\)/, "prefix removal must preserve the sticky prompt button and live bubbles such as the run indicator");
2533
2544
  assert.match(app, /function resetChatOutput\(\) \{\n liveToolCards\.clear\(\);\n renderedTranscriptState = \{ epoch: "", entries: \[\] \};/, "full chat resets must clear reconciliation state");
2534
2545
  assert.match(app, /function transcriptRenderEpoch\(\)[\s\S]*?thinkingOutputVisible/, "reconciliation epoch must include thinking visibility so toggles rebuild the transcript");
2535
2546
  assert.match(app, /pruneDisconnectedLiveToolCards\(\);/, "reconciliation must prune live tool card references to removed DOM nodes");
2536
2547
 
2537
2548
  // --- Performance: incremental streaming markdown (P0-3) ---
2538
- assert.match(app, /function streamingMarkdownStableBoundary\(text\)[\s\S]*?for \(let index = 0; index < lines\.length - 1; index \+= 1\)/, "streaming markdown boundary must never treat the final partial line as stable");
2549
+ assert.match(app, /function streamingMarkdownStableBoundary\(text, previousState, options\) \{\s+return advanceStreamingMarkdownTail\(previousState, text, options\);/, "streaming markdown boundary must be delegated to the mutable-tail helper (which never treats the final partial line as stable)");
2539
2550
  const renderStreamingMarkdownSource = appFunctionSource("renderStreamingMarkdown", "appendImage");
2540
2551
  assert.match(renderStreamingMarkdownSource, /captureChatTextSelection\(block\)[\s\S]*?transcriptRenderer\.reconcileMarkdownSurface\(\{[\s\S]*?stableBoundary: streamingMarkdownStableBoundary[\s\S]*?renderInto: renderMarkdownInto[\s\S]*?restoreChatTextSelection/, "streaming Markdown must reconcile stable committed blocks and its mutable tail through the coordinator");
2541
- assert.match(app, /streamRawText = "";\n streamThinkingRawText = "";\n resetStreamDerivedTextCache\(\);\n streamMarkdownState = null;/, "resetting the stream bubble must clear incremental markdown state and derived caches");
2552
+ assert.match(app, /streamRawText = "";\n streamThinkingRawText = "";\n resetStreamDerivedOutputState\("reset"\);/, "resetting the stream bubble must clear raw text and derived output state");
2542
2553
 
2543
2554
  // --- Performance: delta transcript fetch (P1-1) ---
2544
2555
  assert.match(app, /function mergeMessagesDelta\(previous, data\)[\s\S]*?messagesLookEqual\(previous\[since\], data\.messages\[0\]\)/, "delta merges must verify the one-message overlap before applying");