@firstpick/pi-package-webui 0.7.3 → 0.7.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -145,7 +145,7 @@ assert.match(server, /async function readGitCommit\(cwd, requestedHash\)[\s\S]*\
145
145
  assert.match(server, /"\/api\/git-changes\/stage-all"[\s\S]*stageAllGitChanges[\s\S]*"\/api\/git-changes\/unstage-all"[\s\S]*unstageAllGitChanges/, "server should expose repository-wide stage and unstage mutations");
146
146
  assert.match(readme, /side-panel \*\*Git\*\* section[\s\S]*five-minute cache window[\s\S]*confirmed discard\/delete actions[\s\S]*latest 30 commits/, "README should document Git panel grouping, refresh, actions, and history behavior");
147
147
  assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
148
- assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/npm-packages\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
148
+ assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/pi-coding-agent-forge\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
149
149
  assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
150
150
  assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
151
151
  assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
@@ -198,6 +198,7 @@ assert.ok(html.includes('id="commandSuggest"') && html.indexOf('id="commandSugge
198
198
  assert.match(html, /id="busyPromptBehaviorTag"[\s\S]*class="composer-busy-mode-tag"[\s\S]*aria-controls="busyPromptBehaviorMenu"/, "composer should expose a clickable busy prompt behavior tag on the input frame");
199
199
  assert.doesNotMatch(html, /Busy send:/i, "busy prompt behavior tag should show only the current mode label");
200
200
  assert.match(html, /id="sessionSkillTags" class="composer-skill-tags"[\s\S]*hidden/, "composer should expose a hidden-until-used skill tag strip beside the busy mode tag");
201
+ assert.match(html, /id="featureCategoryTag" class="composer-feature-category-tag"[^>]*aria-live="polite"[^>]*aria-atomic="true"[^>]*hidden/, "composer should expose a hidden-until-used accessible feature category tag");
201
202
  assert.match(html, /id="skillEditorDialog"[\s\S]*id="skillEditorText"[\s\S]*id="skillEditorSaveButton"/, "skill tags should have an in-Web UI SKILL.md editing dialog");
202
203
  assert.match(html, /id="busyPromptBehaviorMenu"[\s\S]*data-busy-prompt-behavior="followUp"[\s\S]*data-busy-prompt-behavior="steer"/, "busy prompt behavior dropdown should expose follow-up and steer choices");
203
204
  assert.match(app, /const LONG_INPUT_ATTACHMENT_LINE_THRESHOLD = 20/, "long composer text should use a 20-line threshold before becoming an attachment");
@@ -326,6 +327,7 @@ assert.match(css, /#promptInput \{[\s\S]*?overflow-y:\s*hidden/, "prompt input s
326
327
  assert.match(css, /\.composer-context-tags \{[\s\S]*?top:\s*-0\.48rem;[\s\S]*?left:\s*0\.75rem;/, "busy prompt behavior and skill tags should sit at the top-left of the input frame");
327
328
  assert.match(css, /\.composer-busy-mode-tag \{[\s\S]*?var\(--ctp-crust\)/, "busy prompt behavior tag should use an opaque base background");
328
329
  assert.match(css, /\.composer-skill-tag \{[\s\S]*?var\(--ctp-crust\)/, "skill tags should use an opaque base background");
330
+ assert.match(css, /\.composer-feature-category-tag \{[\s\S]*?var\(--ctp-crust\)[\s\S]*?\.composer-feature-category-tag\.complex-feature \{[\s\S]*?var\(--ctp-mauve\)[\s\S]*?\.composer-feature-category-tag\[hidden\]/, "feature category tags should use the existing composer-tag frame with a distinct complex state and hidden default");
329
331
  assert.match(css, /button\.composer-skill-tag:hover,[\s\S]*?button\.composer-skill-tag:focus-visible/, "skill tags should be styled as clickable controls");
330
332
  assert.match(css, /\.extension-dialog\.skill-editor-dialog \{[\s\S]*?--skill-editor-size:\s*min\(152rem[\s\S]*?width:\s*var\(--skill-editor-size\);[\s\S]*?height:\s*var\(--skill-editor-size\);[\s\S]*?aspect-ratio:\s*1 \/ 1/, "skill editor should use a square viewport-bounded modal layout");
331
333
  assert.match(css, /\.skill-editor-dialog form \{[\s\S]*?height:\s*100%;[\s\S]*?min-height:\s*0/, "skill editor form should fill the square modal without forcing overflow");
@@ -336,6 +338,12 @@ assert.match(css, /\.composer-busy-mode-menu \{[\s\S]*?bottom:\s*calc\(100% \+ 0
336
338
  assert.match(css, /\.sticky-user-prompt-button \{[\s\S]*?grid-template-columns:\s*auto minmax\(0, 1fr\) auto/, "last-user-prompt jump control should render as a fixed transcript header");
337
339
  assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.sticky-user-prompt-button \{\n\s+grid-template-columns:\s*minmax\(0, 1fr\) auto;\n\s+min-height:\s*36px;[\s\S]*?\.sticky-user-prompt-text \{[\s\S]*?font-size:\s*var\(--text-xs\)/, "mobile last-user-prompt card should preserve compact height while respecting the text floor");
338
340
  assert.match(css, /\.message\.extension,[\s\S]*?\.message\.native/, "extension and native command output should have visible transcript styling");
341
+ assert.match(app, /const FEATURE_CATEGORY_STATUS_KEY = "feature-category";[\s\S]*const featureCategoryByTab = new Map\(\)/, "feature category status should use a dedicated per-tab transport key and state map");
342
+ assert.match(app, /function normalizeFeatureCategory\(value\) \{\s+return value === "lightweight-feature" \|\| value === "complex-feature" \? value : "";/, "feature category normalization should accept only the two approved exact labels");
343
+ assert.match(app, /function renderFeatureCategoryTag\(tabId = activeTabId\) \{[\s\S]*featureCategoryByTab\.get\(tabId\)[\s\S]*tag\.hidden = !category[\s\S]*tag\.textContent = category/, "feature category rendering should be active-tab scoped and hidden when absent");
344
+ assert.match(app, /function handleFeatureCategoryStatus\(statusText, tabId = activeTabId\) \{[\s\S]*featureCategoryByTab\.set\(tabId, category\)[\s\S]*featureCategoryByTab\.delete\(tabId\)[\s\S]*tabId === activeTabId/, "feature category status should update and clear only the addressed terminal tab");
345
+ assert.match(app, /case "setStatus": \{[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*handleFeatureCategoryStatus\(request\.statusText, request\.tabId \|\| activeTabId\);[\s\S]*return;[\s\S]*statusEntries\.set\(statusKey, request\.statusText\)/, "feature category status should be consumed before generic footer status storage");
346
+ assert.match(app, /function setActiveTabId\(tabId, \{ remember = false \} = \{\}\) \{[\s\S]*renderFeatureCategoryTag\(nextTabId\)[\s\S]*function syncTabMetadata\(nextTabs = \[\]\) \{[\s\S]*featureCategoryByTab\.delete\(tabId\)/, "tab activation and cleanup should render only the active category and remove closed-tab state");
339
347
  assert.match(app, /function remoteWebuiQrSvg\(qrLines = \[\]\)[\s\S]*?viewBox[\s\S]*?shape-rendering[\s\S]*?crispEdges/, "remote WebUI QR popup should render terminal QR output as square SVG modules");
340
348
  assert.match(app, /function showRemoteWebuiQrLoadingPopup\(message = "Opening Remote WebUI QR…"\)[\s\S]*?remote-qr-loading[\s\S]*?showModal\(\)/, "remote WebUI QR popup should show a loading state while QR generation is pending");
341
349
  assert.match(app, /function handleRemoteWebuiStatus\(statusText\)[\s\S]*?opening remote webui[\s\S]*?refreshing remote qr[\s\S]*?enabling remote pin auth[\s\S]*?showRemoteWebuiQrLoadingPopup/, "remote WebUI status updates should open the QR loading popup before widget lines arrive");
@@ -409,9 +417,14 @@ assert.match(css, /\.release-npm-widget \{[\s\S]*?border-left:\s*0\.28rem solid/
409
417
  assert.match(css, /\.release-npm-stream-header \{[\s\S]*?text-transform:\s*uppercase/, "release-npm output should label the output stream clearly");
410
418
  assert.match(css, /\.release-npm-output-summary \{[\s\S]*?cursor:\s*pointer/, "release-npm output should expose a local expand/collapse summary");
411
419
  assert.match(css, /\.release-npm-output-details\[open\] \.release-npm-output-toggle/, "release-npm expanded output should rotate the summary chevron");
420
+ assert.match(css, /\.release-npm-output-details \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\);[\s\S]*?min-width:\s*0;/, "release output should constrain its grid track so long subprocess lines scroll inside the terminal instead of widening the widget");
412
421
  assert.match(css, /\.widget-area:has\(\.release-npm-live-widget \.release-npm-output-details\[open\]\)[\s\S]*?flex:\s*0 0 min\(44rem, 68dvh\)/, "live release output should reserve a stable widget slot instead of resizing the transcript while streaming");
413
- assert.match(css, /\.widget-area:has\(\.workflow-widget\) \{[\s\S]*?flex:\s*0 1 auto;[\s\S]*?max-height:\s*min\(34rem, 52dvh\);[\s\S]*?overflow:\s*auto/, "workflow widgets should stay within a scrollable output-sized slot so the composer and footer remain visible");
414
- assert.match(css, /\.release-npm-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal,[\s\S]*?height:\s*clamp\(15rem, 42dvh, 31rem\)/, "live release terminals should keep a fixed viewport height while output streams");
422
+ assert.match(css, /\.widget-area:has\(\.workflow-live-widget \.release-npm-output-details\[open\]\) \{[^}]*min-height:\s*0;[^}]*overflow-x:\s*hidden;[^}]*overflow-y:\s*auto/, "live workflow output should retain its local scroll boundary without forcing a fixed outer height");
423
+ assert.match(css, /\.widget-area:has\(\.workflow-widget:not\(\.minimized\)\) \{[^}]*--workflow-overlay-max-height:\s*min\(44rem, 68dvh\);[^}]*flex:\s*0 0 auto;[^}]*max-height:\s*var\(--workflow-overlay-max-height\);[^}]*overflow-x:\s*hidden;[^}]*overflow-y:\s*auto/, "restored workflow widgets should follow rendered content up to a viewport-safe scroll cap while minimized-only workflow content releases that sizing rule");
424
+ assert.match(css, /\.widget-area:has\(\.workflow-widget:not\(\.minimized\)\) \{ --workflow-overlay-max-height:\s*34dvh; \}/, "mobile workflow widgets should keep the existing compact viewport cap while sizing intrinsically");
425
+ assert.match(css, /\.release-npm-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal,[\s\S]*?\.release-aur-live-widget[\s\S]*?height:\s*clamp\(15rem, 42dvh, 31rem\)/, "live release terminals should keep a fixed viewport height while output streams");
426
+ assert.match(css, /\.workflow-subprocess-widget \.release-npm-output-details\[open\] \.release-npm-terminal \{[^}]*max-height:\s*clamp\(12rem, 34dvh, 26rem\);[^}]*min-height:\s*0;[^}]*overscroll-behavior-y:\s*auto;[^}]*scrollbar-gutter:\s*stable/, "workflow output should grow with real line content up to a compact local scroll cap");
427
+ assert.match(css, /\.workflow-subprocess-widget \.workflow-meta \{[\s\S]*?grid-template-columns:[\s\S]*?\.workflow-meta-label \{[\s\S]*?text-transform:\s*uppercase/, "workflow run limits and status should render as clearly labeled metadata groups");
415
428
  assert.match(css, /\.release-npm-terminal \{[\s\S]*?rgba\(3, 4, 10, 0\.98\)/, "release-npm terminal should use a high-contrast stream panel");
416
429
  assert.match(css, /\.release-aur-widget \{[\s\S]*?border-color/, "release-aur output should render as a specialized Web UI widget variant");
417
430
  assert.match(css, /\.app-runner-widget \{[\s\S]*?border-color/, "app runner output should render as a specialized Web UI widget variant");
@@ -482,11 +495,12 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
482
495
  assert.match(css, /\.terminal-tab-activity-indicator/, "terminal tabs should expose per-tab agent activity indicators");
483
496
  assert.match(css, /\.terminal-tab-app-runner-indicator \{[\s\S]*?terminal-tab-app-runner-pulse/, "terminal tabs should expose animated app-runner indicators");
484
497
  assert.match(css, /\.terminal-tab\.app-runner-running,\n\.terminal-tab-group-item\.app-runner-running/, "terminal tabs and grouped items should mark running app runners");
498
+ assert.match(css, /\.terminal-tab-group-menu \{[^}]*max-height:\s*none;[^}]*overflow:\s*visible;/, "grouped terminal tab menus should grow to show every open tab without an internal scrollbar");
485
499
  assert.match(css, /\.terminal-tab-group-item \{[\s\S]*?flex:\s*0 0 auto[\s\S]*?background:\s*var\(--ctp-crust\)/, "grouped terminal tab items should keep readable height and use opaque backgrounds");
486
- assert.match(css, /\.terminal-tab-group-add \{[\s\S]*?flex:\s*0 0 auto/, "grouped terminal tab menus should scroll instead of shrinking the add-tab action");
500
+ assert.match(css, /\.terminal-tab-group-add \{[\s\S]*?flex:\s*0 0 auto/, "grouped terminal tab menus should keep the add-tab action at its natural height");
487
501
  assert.match(css, /\.terminal-tab-group\.active \{[\s\S]*?background:[\s\S]*?var\(--ctp-crust\)/, "active terminal tab groups should keep opaque backgrounds");
488
502
  assert.match(css, /\.terminal-tab-group\.stopped \{[\s\S]*?opacity:\s*1/, "stopped terminal tab groups should not become transparent");
489
- assert.match(css, /\.terminal-tabs:has\(\.terminal-tab-group\.menu-open\)/, "open terminal tab groups should keep the tab strip usable across rerenders");
503
+ assert.match(css, /\.terminal-tabs:has\(\.terminal-tab-group\.menu-open\),[^{}]*\{[^}]*overflow:\s*visible;/, "open terminal tab groups should escape the tab strip without clipping");
490
504
  assert.match(css, /\.terminal-tab-group\.menu-open \.terminal-tab-group-menu \{[\s\S]*?display:\s*flex/, "open terminal tab group menus should remain visible without hover");
491
505
  assert.match(css, /\.terminal-tab\.activity-working > \.terminal-tab-button \.terminal-tab-activity-indicator[\s\S]*?terminal-tab-working-pulse/, "working tab indicators should be visibly animated");
492
506
  assert.match(css, /\.terminal-tab-group-item\.activity-working > \.terminal-tab-button \.terminal-tab-activity-indicator[\s\S]*?terminal-tab-working-pulse/, "working indicators should still animate on grouped tab menu items themselves");
@@ -630,7 +644,7 @@ assert.match(app, /remoteAuthToggle: \$\("#remoteAuthToggle"\)/, "Remote WebUI c
630
644
  assert.match(html, /id="networkControlField"[^>]*hidden/, "Remote WebUI browser controls should be hidden until the optional package is loaded and enabled");
631
645
  assert.match(app, /remoteWebuiCommand\(enable \? "authOn" : "authOff"/, "remote PIN auth toggle should dispatch through the Remote WebUI package command");
632
646
  assert.match(server, /webuiSettingsFile,[\s\S]*from "\.\.\/lib\/git-workflow-preferences\.mjs"/, "server should use the shared Pi Web UI settings persistence module");
633
- assert.match(server, /let persistedRemoteAuthEnabled = await readPersistedRemoteAuthEnabled\(\)/, "server should load the saved Remote PIN auth preference before startup");
647
+ assert.match(server, /const persistedStartupSettings = await readWebuiSettings\(undefined, \{ reportInvalidOutputMode: true \}\);[\s\S]*?let persistedRemoteAuthEnabled = persistedStartupSettings\.remoteAuthEnabled === true;/, "server should load the saved Remote PIN auth preference before startup");
634
648
  assert.match(server, /if \(remoteAuthStartupEnabled\(\)\) enableRemoteAuth\(remoteAuthStartupReason\(\)\)/, "saved Remote PIN auth preference should enable auth on startup");
635
649
  assert.match(server, /await saveRemoteAuthPreference\(true\)/, "enabling Remote PIN auth should persist the on preference");
636
650
  assert.match(server, /await saveRemoteAuthPreference\(false\)/, "disabling Remote PIN auth should persist the off preference");
@@ -1022,16 +1036,40 @@ assert.match(app, /function renderWorkflowInspectorAgent\(agent, run\)[\s\S]*Pro
1022
1036
  assert.match(app, /canPause[\s\S]*`\/workflow pause \$\{run\.runId\}`[\s\S]*canAbort[\s\S]*`\/workflow abort \$\{run\.runId\}`[\s\S]*Save user[\s\S]*Save project[\s\S]*Raw workflow script/, "WebUI Workflow controls should send canonical extension commands and expose raw scripts");
1023
1037
  assert.match(app, /confirmMessage && !window\.confirm\(confirmMessage\)/, "destructive WebUI Workflow actions should require browser confirmation");
1024
1038
  assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)[\s\S]*workflowInspectorMinimizedByTab = new Set\(\)/, "Workflow inspector run, selection, and minimized state should be per tab");
1039
+ assert.match(app, /const workflowTerminalScrollByTab = new Map\(\);\s*const workflowSubprocessMinimizedByTab = new Set\(\);/, "Workflow subprocess minimize state should be isolated per browser tab");
1025
1040
  assert.match(app, /function workflowInspectorSetMinimized\(minimized\)[\s\S]*workflowInspectorMinimizedByTab\.(?:add|delete)[\s\S]*renderWidgets\(\)[\s\S]*requestAnimationFrame[\s\S]*workflow-inspector-minimize-button[\s\S]*focus\(\{ preventScroll: true \}\)/, "Workflow inspector minimize state should survive rerenders and restore focus to the replacement control");
1026
1041
  assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-inspector-body[\s\S]*workflow-inspector-minimize-button[\s\S]*minimized \? "Restore" : "Minimize"[\s\S]*minimizeButton\.type = "button"[\s\S]*aria-controls[\s\S]*aria-expanded[\s\S]*aria-label[\s\S]*if \(minimized\) return node/, "Workflow inspector should expose an accessible minimize and restore disclosure control");
1027
- assert.match(app, /workflowInspectorMinimizedByTab\.delete\(tabId\)/, "closing a terminal tab should discard its Workflow inspector minimize state");
1042
+ assert.match(app, /function workflowSubprocessSetMinimized\(minimized\)[\s\S]*workflowSubprocessMinimizedByTab\.(?:add|delete)[\s\S]*renderWidgets\(\)[\s\S]*requestAnimationFrame[\s\S]*workflow-subprocess-minimize-button[\s\S]*focus\(\{ preventScroll: true \}\)/, "Workflow subprocess minimize state should survive live rerenders and restore focus to the replacement control");
1043
+ assert.match(app, /function renderWorkflowSubprocessWidget\(\)[\s\S]*workflow-subprocess-body[\s\S]*workflow-subprocess-minimize-button[\s\S]*minimized \? "Restore" : "Minimize"[\s\S]*minimizeButton\.type = "button"[\s\S]*aria-controls[\s\S]*aria-expanded[\s\S]*aria-label[\s\S]*node\.append\(header, body\);\s*if \(minimized\) return node;[\s\S]*body\.append\(outputDetails\)/, "Workflow subprocess output should expose an accessible minimize and restore disclosure control without rebuilding its terminal while minimized");
1044
+ assert.match(app, /workflowInspectorMinimizedByTab\.delete\(tabId\)[\s\S]*workflowSubprocessMinimizedByTab\.delete\(tabId\)/, "closing a terminal tab should discard its Workflow inspector and subprocess minimize state");
1028
1045
  assert.match(app, /handleInactiveTabEvent\(event\)[\s\S]*WORKFLOW_INSPECTOR_WIDGET_KEY[\s\S]*updateWorkflowInspectorForTab\(event\.tabId, inspector\)[\s\S]*renderTabs\(\)/, "inactive tabs should consume replayed Workflow inspector payloads for badges");
1029
1046
  assert.match(app, /terminal-tab-workflow-indicator[\s\S]*workflowRunningCountForTab/, "terminal tabs should display Workflow Mode or active-run badges");
1030
1047
  assert.match(css, /\.workflow-inspector-layout \{[\s\S]*grid-template-columns:[\s\S]*\.workflow-inspector-run-list[\s\S]*\.workflow-inspector-agent/, "Workflow inspector should have responsive run and agent layout styling");
1031
- assert.match(css, /\.workflow-inspector-widget\.minimized \{[\s\S]*\.workflow-inspector-minimize-button/, "Workflow inspector should style its minimized state and toggle control");
1048
+ assert.match(css, /\.workflow-inspector-widget\.minimized,[\s\S]*\.workflow-subprocess-widget\.minimized \{[\s\S]*\.workflow-inspector-minimize-button,[\s\S]*\.workflow-subprocess-minimize-button/, "Workflow inspector and subprocess widgets should share visible minimized-state toggle styling");
1049
+ assert.match(css, /\.workflow-subprocess-widget\.minimized > \.release-npm-header \{[\s\S]*?padding-bottom:\s*0;[\s\S]*?border-bottom:\s*0;/, "minimized Workflow subprocess output should collapse its header divider and extra spacing");
1032
1050
  assert.match(css, /\.terminal-tab-workflow-indicator \{[\s\S]*color: var\(--ctp-mauve\)/, "inactive-tab Workflow badges should have a distinct accessible style");
1033
1051
  assert.match(css, /\.composer-workflow-mode-button\.active,[\s\S]*aria-pressed="true"/, "active Workflow Mode toggle should have persistent pressed styling");
1034
1052
  assert.match(css, /\.composer\.workflow-mode-active[\s\S]*body\.workflow-mode-active \.composer::before/, "active Workflow Mode should visibly accent the composer");
1053
+
1054
+ // Workflow raw-script inspector: narrowly specialized, structurally read-only, and viewport-safe.
1055
+ const workflowPreviewRequestSource = appFunctionSource("isWorkflowScriptPreviewRequest", "workflowScriptTokenClass");
1056
+ const workflowTokenRenderSource = appFunctionSource("appendWorkflowScriptTokens", "renderWorkflowScriptPreview");
1057
+ const workflowPreviewSource = appFunctionSource("renderWorkflowScriptPreview", "showNextDialog");
1058
+ const workflowDialogSource = appFunctionSource("showNextDialog", "handleInactiveTabEvent");
1059
+ assert.match(workflowPreviewRequestSource, /request\?\.method === "editor"[\s\S]*title\.startsWith\("Raw workflow script"\)[\s\S]*inspection only;\\s\*edits are ignored/, "workflow inspector specialization should require the editor method, raw-script title, and inspection-only wording");
1060
+ assert.match(workflowDialogSource, /else if \(isWorkflowScriptPreview\) \{\s*renderWorkflowScriptPreview\(request\);\s*\} else if \(request\.method === "editor"\) \{\s*const textarea = make\("textarea", "dialog-editor"\);[\s\S]*textarea\.value = request\.prefill \|\| ""/, "workflow previews should specialize before the unchanged generic editor textarea fallback");
1061
+ assert.doesNotMatch(workflowPreviewSource, /\btextarea\b/, "workflow previews should not create an editable textarea");
1062
+ assert.match(workflowTokenRenderSource, /document\.createTextNode\(line\.slice\(start, match\.index\)\)[\s\S]*make\("span", `workflow-script-token/, "workflow syntax tokens should be built from DOM text nodes and spans");
1063
+ assert.doesNotMatch(workflowTokenRenderSource, /innerHTML|insertAdjacentHTML/, "workflow syntax token rendering should not inject source through HTML APIs");
1064
+ assert.match(workflowPreviewSource, /search\.type = "search"[\s\S]*Previous match[\s\S]*Next match[\s\S]*Wrap lines[\s\S]*Copy source/, "workflow inspector should expose search navigation, wrap, and copy controls");
1065
+ assert.match(workflowPreviewSource, /search\.addEventListener\("keydown", \(event\) => \{\s*if \(event\.key !== "Enter"\) return;\s*event\.preventDefault\(\);\s*if \(matchingLineIndexes\.length === 0\) return;\s*setActiveMatch\(activeMatchIndex \+ \(event\.shiftKey \? -1 : 1\)\);\s*\}\);/, "workflow search should prevent Enter form submission before returning for no matches and navigate only when matches exist");
1066
+ assert.match(workflowPreviewSource, /workflow-script-search-status[\s\S]*aria-live", "polite"[\s\S]*workflow-script-copy-status[\s\S]*aria-live", "polite"/, "workflow search and copy feedback should be announced");
1067
+ assert.match(workflowPreviewSource, /addDialogButton\("Cancel workflow"[\s\S]*cancelled: true[\s\S]*addDialogButton\("Back to approval"[\s\S]*value: request\.prefill/, "workflow inspector actions should cancel explicitly or return the original prefill unchanged");
1068
+ assert.match(css, /\.extension-dialog\.workflow-script-dialog \{[\s\S]*width: min\(96rem, calc\(100vw - 2rem\)\)[\s\S]*height: min\(58rem, calc\(var\(--visual-viewport-height, 100dvh\) - 2rem\)\)[\s\S]*overflow: hidden/, "workflow inspector should use a large visual-viewport-bounded desktop dialog");
1069
+ assert.match(css, /\.workflow-script-toolbar \{[\s\S]*grid-template-columns: minmax\(12rem, 1fr\) repeat\(4, auto\)[\s\S]*\.workflow-script-code \{[\s\S]*overflow: auto[\s\S]*font-family: ui-monospace[\s\S]*\.workflow-script-line-number \{[\s\S]*position: sticky/, "workflow inspector should style its toolbar, scrollable code surface, and persistent line-number gutter");
1070
+ assert.match(css, /\.workflow-script-code\.is-wrapped[\s\S]*white-space: pre-wrap[\s\S]*\.workflow-script-line\.is-search-match[\s\S]*\.workflow-script-line\.is-active-match[\s\S]*box-shadow:/, "workflow inspector should distinguish matches and support soft wrapping");
1071
+ assert.match(css, /\.workflow-script-code:focus-visible[\s\S]*outline:[\s\S]*\.workflow-script-token-keyword[\s\S]*var\(--ctp-mauve\)[\s\S]*\.workflow-script-token-string[\s\S]*var\(--ctp-green\)[\s\S]*\.workflow-script-token-number[\s\S]*var\(--ctp-peach\)[\s\S]*\.workflow-script-token-comment[\s\S]*var\(--ctp-subtext\)/, "workflow inspector should provide a visible focus ring and high-contrast token colors");
1072
+ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\) \{[\s\S]*\.extension-dialog\.workflow-script-dialog \{[\s\S]*height: calc\(var\(--visual-viewport-height, 100dvh\) - 0\.25rem - env\(safe-area-inset-top\)\)[\s\S]*\.workflow-script-toolbar \{[\s\S]*grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)[\s\S]*\.workflow-script-dialog #dialogActions \{[\s\S]*grid-template-columns: repeat\(2, minmax\(0, 1fr\)\)/, "workflow inspector mobile bottom sheet should respect the visual viewport and keep controls reachable");
1035
1073
  // Phase 3: browser voice loop (Web Speech STT/TTS) wiring.
1036
1074
  const voiceModule = await readFile(join(root, "public", "voice-conversation.mjs"), "utf8");
1037
1075
  assert.match(voiceModule, /export function createVoiceConversationController\(options = \{\}\)/, "voice loop should live in a dependency-injected module for Node tests");
@@ -1155,7 +1193,13 @@ assert.match(server, /function addCppRunners\(runners, cwd\)[\s\S]*C\/C\+\+ CMak
1155
1193
  assert.match(server, /function addDockerComposeRunner\(runners, cwd\)[\s\S]*docker compose up[\s\S]*docker-compose up/, "server should detect Docker Compose runners");
1156
1194
  assert.match(server, /APP_RUNNER_SHELL_SCRIPT_DIRS = \["", "dev", "scripts", "dev\/scripts"\][\s\S]*function addShellScriptRunners\(runners, cwd\)/, "server should detect bash\/zsh\/fish scripts in root, dev, scripts, and dev\/scripts");
1157
1195
  assert.match(app, /const releaseNpmOutputExpandedByTab = new Map\(\)/, "release-npm output collapse state should be tracked per browser tab");
1196
+ assert.match(app, /const workflowTerminalScrollByTab = new Map\(\)/, "workflow terminal follow state should be isolated per browser tab");
1158
1197
  assert.match(app, /function renderReleaseNpmOutputDetails\(key, streamHeader, terminal, controls = null\)[\s\S]*node\.open = releaseNpmOutputExpandedByTab\.get\(stateKey\) !== false[\s\S]*release-npm-output-toggle/, "release-npm output should render as a browser-side details expander");
1198
+ assert.match(app, /function workflowMetaItem\(label, value[\s\S]*workflow-meta-label[\s\S]*workflow-meta-value[\s\S]*workflow-meta-description/, "workflow metadata should pair human-readable labels and values with an optional visible description");
1199
+ assert.match(app, /function bindWorkflowTerminalScroll\([\s\S]*Auto-follow paused[\s\S]*distanceFromBottom <= 24[\s\S]*requestAnimationFrame\(restorePosition\)/, "workflow output should preserve reading position and follow only near the live tail");
1200
+ assert.match(app, /meta\.setAttribute\("role", "group"\)[\s\S]*meta\.setAttribute\("aria-label", "Workflow run summary"\)[\s\S]*"Limited history"[\s\S]*"Older output omitted from this view\."/, "workflow subprocess metadata should expose an accessible group and visible output-limit explanation");
1201
+ assert.match(app, /terminal\.dataset\.preserveScrollOnToggle = "true"[\s\S]*bindWorkflowTerminalScroll\(terminal, outputDetails, followStatus, \{ live, runId: payload\.runId \}\)/, "workflow output should opt into its own position restoration without changing shared terminal toggles");
1202
+ assert.match(app, /workflowMetaItem\("Run"[\s\S]*workflowMetaItem\("Phase"[\s\S]*workflowMetaItem\("Tasks"[\s\S]*"Limited history"/, "workflow subprocess summary should distinguish status, phase, task progress, and limited output history");
1159
1203
  assert.match(app, /releaseNpmStreamHeader\("Live output stream", outputLines\.length, \{ live: true \}\)/, "release-npm live output should expose a clear stream heading");
1160
1204
  assert.match(app, /renderReleaseNpmOutputDetails\("release-npm:output", streamHeader, terminal, controls\)/, "release-npm live stream should be wrapped in the local expander");
1161
1205
  assert.match(app, /function renderReleaseAurOutputWidget\(\)/, "release-aur live output should use a specialized Web UI renderer");
@@ -1479,9 +1523,9 @@ assert.match(readme, /Tracked subagent output[\s\S]*dedicated \*\*Subagent\*\* t
1479
1523
  assert.match(app, /let tabSeenCompletionSerials = new Map\(\)/, "frontend should track which tab completions have been seen");
1480
1524
  assert.match(app, /let activeTabGeneration = 0/, "frontend should version active-tab UI state to reject stale async work");
1481
1525
  assert.match(app, /function isCurrentTabContext\(context\)/, "frontend should identify stale active-tab refresh contexts");
1482
- assert.match(app, /function connectEvents\(tabContext = activeTabContext\(\)\)[\s\S]*?eventSource !== source/, "frontend should ignore stale SSE messages from old active tabs");
1526
+ assert.match(app, /function connectEvents\(tabContext = activeTabContext\(\), \{ requestedMode = "auto", fallbackAttempted = false \} = \{\}\)[\s\S]*?eventSource !== source/, "frontend should ignore stale SSE messages from old active tabs");
1483
1527
  assert.match(app, /let foregroundReconcileTimer = null/, "frontend should debounce foreground resume reconciliation");
1484
- assert.match(app, /case "webui_connected":[\s\S]*?scheduleForegroundReconcile\("event stream reconnect", 0\)/, "SSE reconnect should reconcile authoritative state and messages instead of only tabs");
1528
+ assert.match(app, /case "webui_connected":[\s\S]*?featureCategoryByTab\.delete\(connectedTabId\)[\s\S]*?renderFeatureCategoryTag\(connectedTabId\)[\s\S]*?scheduleForegroundReconcile\("event stream reconnect", 0\)/, "SSE reconnect should clear cached feature-category absence before replaying authoritative statuses and reconciling state");
1485
1529
  assert.match(app, /async function reconcileForegroundState\(reason = "resume"\)[\s\S]*?refreshTabs\(\)[\s\S]*?ensureActiveEventStream\(tabContext\)[\s\S]*?refreshAll\(tabContext\)/, "foreground reconciliation should refresh tabs plus active transcript after mobile backgrounding");
1486
1530
  assert.match(app, /document\.addEventListener\("visibilitychange"[\s\S]*?scheduleForegroundReconcile\("visibility resume", 0\)/, "returning to a hidden mobile tab should force a server snapshot refresh");
1487
1531
  assert.match(app, /window\.addEventListener\("pageshow", \(\) => scheduleForegroundReconcile\("page show", 0\)\)/, "BFCache or PWA page resume should force a server snapshot refresh");
@@ -1587,10 +1631,10 @@ assert.match(server, /function rememberExtensionWidgetEvent\(tab, event\)[\s\S]*
1587
1631
  assert.match(server, /rememberExtensionStatusEvent\(tab, scopedEvent\)[\s\S]*rememberExtensionWidgetEvent\(tab, scopedEvent\)[\s\S]*trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should retain extension statuses and widgets before broadcasting");
1588
1632
  assert.match(server, /trackPendingExtensionUiRequest\(tab, scopedEvent\)/, "RPC events should populate pending extension UI storage before broadcasting");
1589
1633
  assert.match(server, /scopedEvent = \{ \.\.\.scopedEvent,[\s\S]*?pendingExtensionUiRequestCount: pendingExtensionUiRequests\(tab\)\.length \}/, "RPC events should broadcast pending blocker counts for tab indicators");
1590
- assert.match(server, /function replayExtensionStatuses\(tab, res\)[\s\S]*method: "setStatus"/, "server should replay latest extension statuses on SSE reconnect");
1591
- assert.match(server, /function replayExtensionWidgets\(tab, res\)[\s\S]*method: "setWidget"/, "server should replay latest extension widgets on SSE reconnect");
1592
- assert.match(server, /function replayPendingExtensionUiRequests\(tab, res\)/, "server should be able to replay missed extension UI requests on SSE reconnect");
1593
- assert.match(server, /replayExtensionStatuses\(tab, res\);\n\s+replayExtensionWidgets\(tab, res\);\n\s+replayPendingExtensionUiRequests\(tab, res\)/, "SSE connections should replay extension statuses and widgets before pending blockers");
1634
+ assert.match(server, /function replayExtensionStatuses\(tab, client\)[\s\S]*method: "setStatus"/, "server should replay latest extension statuses on SSE reconnect");
1635
+ assert.match(server, /function replayExtensionWidgets\(tab, client\)[\s\S]*method: "setWidget"/, "server should replay latest extension widgets on SSE reconnect");
1636
+ assert.match(server, /function replayPendingExtensionUiRequests\(tab, client\)/, "server should be able to replay missed extension UI requests on SSE reconnect");
1637
+ assert.match(server, /replayExtensionStatuses\(tab, client\);\n\s+replayExtensionWidgets\(tab, client\);\n\s+replayPendingExtensionUiRequests\(tab, client\)/, "SSE connections should replay extension statuses and widgets before pending blockers");
1594
1638
  assert.match(server, /pendingExtensionUiRequests: pendingExtensionUiRequestSummaries\(tab\)/, "detailed Web UI status should expose pending extension UI blockers");
1595
1639
  assert.match(server, /resolvePendingExtensionUiRequest\(tab, payload\.id\)/, "extension UI responses should clear the pending blocker cache");
1596
1640
  assert.match(server, /type: "webui_extension_ui_resolved"[\s\S]*?pendingExtensionUiRequestCount/, "extension UI responses should notify clients that a blocker resolved");
@@ -136,7 +136,7 @@ try {
136
136
  const disableAuth = await request("/api/remote-auth/settings", { method: "POST", body: { enabled: false } });
137
137
  assert.equal(disableAuth.status, 200);
138
138
  const savedAfterDisable = JSON.parse(await readFile(settingsFile, "utf8"));
139
- assert.equal(savedAfterDisable.version, 3, "Web UI settings should migrate to the resource-default schema version");
139
+ assert.equal(savedAfterDisable.version, 4, "Web UI settings should migrate to the output-mode schema version");
140
140
  assert.equal(savedAfterDisable.remoteAuthEnabled, false, "disabling Remote PIN auth should persist the off preference");
141
141
  assert.equal(savedAfterDisable.gitWorkflow?.generation?.modelId, "fake-model", "Remote PIN updates should preserve guided Git preferences");
142
142
 
@@ -0,0 +1,73 @@
1
+ import assert from "node:assert/strict";
2
+ import {
3
+ browserOutputEvent,
4
+ encodeBrowserSseEvent,
5
+ isOutputModeSemanticBarrier,
6
+ negotiateOutputMode,
7
+ normalizeOutputMode,
8
+ OUTPUT_MODE_COMPACT_V1,
9
+ OUTPUT_MODE_NORMAL,
10
+ resolveOutputModeDefault,
11
+ } from "../lib/webui-output-mode.mjs";
12
+
13
+ assert.equal(normalizeOutputMode("compact-v1"), OUTPUT_MODE_COMPACT_V1);
14
+ assert.equal(normalizeOutputMode("unknown", OUTPUT_MODE_COMPACT_V1), OUTPUT_MODE_COMPACT_V1);
15
+ assert.equal(normalizeOutputMode(undefined), OUTPUT_MODE_NORMAL);
16
+ assert.deepEqual(resolveOutputModeDefault({ cliMode: "compact-v1", envMode: "normal", persistedMode: "normal" }), { mode: "compact-v1", source: "cli" });
17
+ assert.deepEqual(resolveOutputModeDefault({ envMode: "compact-v1", persistedMode: "normal" }), { mode: "compact-v1", source: "env" });
18
+ assert.deepEqual(resolveOutputModeDefault({ persistedMode: "compact-v1" }), { mode: "compact-v1", source: "persisted" });
19
+ assert.deepEqual(resolveOutputModeDefault({ persistedMode: "invalid" }), { mode: "normal", source: "normal" });
20
+
21
+ assert.deepEqual(negotiateOutputMode({ requestedMode: "auto", protocolVersion: "1", serverDefault: "compact-v1" }), {
22
+ requestedMode: "auto",
23
+ protocolVersion: 1,
24
+ activeMode: "compact-v1",
25
+ });
26
+ assert.deepEqual(negotiateOutputMode({ requestedMode: "compact-v1", protocolVersion: 1, serverDefault: "normal" }), {
27
+ requestedMode: "compact-v1",
28
+ protocolVersion: 1,
29
+ activeMode: "compact-v1",
30
+ });
31
+ assert.deepEqual(negotiateOutputMode({ requestedMode: "compact-v1", protocolVersion: undefined, serverDefault: "compact-v1" }), {
32
+ requestedMode: "normal",
33
+ protocolVersion: 0,
34
+ activeMode: "normal",
35
+ });
36
+ assert.deepEqual(negotiateOutputMode({ requestedMode: "auto", protocolVersion: "2", serverDefault: "compact-v1" }), {
37
+ requestedMode: "normal",
38
+ protocolVersion: 0,
39
+ activeMode: "normal",
40
+ });
41
+
42
+ const canonical = {
43
+ type: "message_update",
44
+ tabId: "tab-1",
45
+ tabActivity: { status: "working" },
46
+ message: { role: "assistant", content: [{ type: "text", text: "accumulated text" }] },
47
+ assistantMessageEvent: {
48
+ type: "text_delta",
49
+ delta: "",
50
+ contentIndex: 2,
51
+ partial: { role: "assistant", content: [{ type: "text", text: "accumulated text" }] },
52
+ },
53
+ };
54
+ const original = structuredClone(canonical);
55
+ const compact = browserOutputEvent(canonical, { outputMode: "compact-v1" });
56
+ assert.notStrictEqual(compact, canonical, "compact output must be browser-only");
57
+ assert.equal(compact.message, undefined, "duplicate accumulated top-level message should be removed");
58
+ assert.equal(compact.assistantMessageEvent.partial, undefined, "duplicate accumulated partial should be removed");
59
+ assert.equal(compact.assistantMessageEvent.delta, "", "empty deltas are semantically meaningful");
60
+ assert.equal(compact.assistantMessageEvent.contentIndex, 2);
61
+ assert.deepEqual(canonical, original, "the parsed/scoped source event must never be mutated");
62
+ assert.equal(JSON.parse(encodeBrowserSseEvent(canonical, { outputMode: "compact-v1" })).assistantMessageEvent.delta, "");
63
+
64
+ const malformed = { type: "message_update", assistantMessageEvent: { type: "text_delta", delta: 4, partial: { text: "must remain" } }, message: { role: "assistant" } };
65
+ assert.strictEqual(browserOutputEvent(malformed, { outputMode: "compact-v1" }), malformed, "malformed delta shapes fail open");
66
+ const unknown = { type: "message_update", assistantMessageEvent: { type: "unknown_delta", delta: "x", partial: { text: "must remain" } }, message: { role: "assistant" } };
67
+ assert.strictEqual(browserOutputEvent(unknown, { outputMode: "compact-v1" }), unknown, "unknown update shapes fail open");
68
+ assert.equal(browserOutputEvent({ type: "tool_execution_update", partialResult: {} }, { outputMode: "compact-v1" }), undefined, "compact v1 omits only intermediate tool updates");
69
+ assert.deepEqual(browserOutputEvent({ type: "tool_execution_end", result: { content: [] } }, { outputMode: "compact-v1" }), { type: "tool_execution_end", result: { content: [] } });
70
+ assert.equal(isOutputModeSemanticBarrier({ type: "message_end" }), true);
71
+ assert.equal(isOutputModeSemanticBarrier({ type: "agent_start" }), false);
72
+
73
+ console.log("webui-output-mode.test.mjs passed");