@firstpick/pi-package-webui 0.6.7 → 0.6.9

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.
@@ -25,19 +25,21 @@ const pkg = JSON.parse(pkgRaw);
25
25
  const manifest = JSON.parse(manifestRaw);
26
26
  const lock = JSON.parse(await readFile(join(root, "package-lock.json"), "utf8"));
27
27
  const helper = await readFile(join(root, "webui-rpc-helper.mjs"), "utf8");
28
+ const codexAuth = await readFile(join(root, "lib", "codex-usage-auth.mjs"), "utf8");
29
+ const nativeExportPayload = await readFile(join(root, "lib", "native-export-payload.mjs"), "utf8");
28
30
  const companionDependencies = {
29
31
  "@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
30
- "@firstpick/pi-extension-btw": "^0.1.2",
32
+ "@firstpick/pi-extension-btw": "^0.1.3",
31
33
  "@firstpick/pi-extension-fish-user-bash": "^0.2.1",
32
- "@firstpick/pi-extension-git-footer-status": "^0.3.8",
34
+ "@firstpick/pi-extension-git-footer-status": "^0.4.0",
33
35
  "@firstpick/pi-extension-release-aur": "^0.1.7",
34
- "@firstpick/pi-extension-release-npm": "^0.4.0",
35
- "@firstpick/pi-extension-safety-guard": "^0.2.3",
36
+ "@firstpick/pi-extension-release-npm": "^0.4.1",
37
+ "@firstpick/pi-extension-safety-guard": "^0.2.5",
36
38
  "@firstpick/pi-extension-setup-skills": "^0.1.8",
37
39
  "@firstpick/pi-extension-stats": "^0.2.8",
38
- "@firstpick/pi-extension-todo-progress": "^0.2.7",
40
+ "@firstpick/pi-extension-todo-progress": "^0.2.8",
39
41
  "@firstpick/pi-extension-tools": "^0.1.6",
40
- "@firstpick/pi-extension-workflows": "^0.1.2",
42
+ "@firstpick/pi-extension-workflows": "^0.1.3",
41
43
  "@firstpick/pi-package-remote-webui": "^0.1.5",
42
44
  "@firstpick/pi-prompts-git-pr": "^0.1.3",
43
45
  "@firstpick/pi-themes-bundle": "^0.1.4",
@@ -57,9 +59,16 @@ assert.match(html, /id="newTabChooseDirectoryButton" class="terminal-new-tab-men
57
59
  assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item composer-publish-menu-item"[\s\S]*<span>Branch Worktree…<\/span>/, "new-tab menu should offer branch worktree tabs");
58
60
  assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
59
61
  assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
60
- assert.match(html, /<strong class="side-panel-title">[\s\S]*Control Deck[\s\S]*id="webuiVersionBadge"[\s\S]*id="webuiDevBadge"/, "Control Deck title should expose Web UI version and dev badges");
62
+ 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="confirmationDialog"[\s\S]*id="webuiDevBadge"/, "Control Deck header should keep its title separate from an aligned version and build row");
63
+ 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");
64
+ assert.doesNotMatch(html, /Safer option|confirmationAlternative/, "shared confirmation dialogs should not render a safer-option row");
65
+ assert.doesNotMatch(app, /confirmationAlternative|\balternative:\s*options\.alternative/, "confirmation logic should not populate a removed safer-option row");
61
66
  assert.doesNotMatch(html, /id="sessionLine"/, "Control Deck title should not show verbose session status metadata");
62
67
  assert.match(html, /id="themeSelect"/, "side panel should expose a theme selector");
68
+ assert.match(html, /class="controls-intro"[\s\S]*aria-labelledby="sessionControlsTitle"[\s\S]*aria-labelledby="interfaceControlsTitle"[\s\S]*id="networkControlField"[\s\S]*aria-labelledby="serverControlsTitle"/, "Controls should explain scope and group session, interface, remote-access, and server settings in task order");
69
+ assert.match(html, /id="sessionControlsTitle">Active session<[\s\S]*class="control-scope-badge">This tab<[\s\S]*id="interfaceControlsTitle">Interface<[\s\S]*class="control-scope-badge">This browser</, "Controls groups should state whether settings affect the active tab or this browser");
70
+ assert.match(html, /class="control-action-row">[\s\S]*id="modelSelect"[\s\S]*id="setModelButton"[^>]*>Apply<\/button>[\s\S]*id="thinkingSelect"[\s\S]*id="setThinkingButton"[^>]*>Apply<\/button>/, "model and thinking controls should keep their apply actions beside the selection");
71
+ assert.match(css, /\.control-group-header[\s\S]*\.control-scope-badge[\s\S]*\.control-action-row/, "Controls should visually separate group headers, scope badges, and compact action rows");
63
72
  assert.match(html, /<label for="themeSelect"[^>]*id="themeControlLabel"[^>]*>Theme<\/label>/, "theme selector should be labeled in side-panel controls");
64
73
  assert.match(html, /id="themeSearchInput"[\s\S]*id="themeSelect"[\s\S]*id="themeSearchResults"/, "side-panel theme selector should expose searchable theme results");
65
74
  assert.match(html, /id="backgroundInput"[^>]*type="file"[^>]*accept="image\/png,image\/jpeg,image\/webp,image\/gif"/, "side panel should expose an image picker for custom backgrounds");
@@ -78,6 +87,7 @@ assert.match(server, /const THINKING_LEVELS = \["off", "minimal", "low", "medium
78
87
  assert.match(html, /id="terminalTabsLayoutSelect"[\s\S]*<option value="left">Left sidebar<\/option>/, "side panel controls should expose a terminal-tabs layout selector");
79
88
  assert.match(html, /id="terminalTabsLayoutStatus"/, "terminal-tabs layout selector should expose status text");
80
89
  assert.match(html, /id="nativeCommandDialog"/, "native slash selector UI should have a dedicated dialog");
90
+ assert.match(html, /id="optionsSafetyGuardSetupButton"[\s\S]*data-command="\/safety-guard-setup"[\s\S]*Safety Guard Setup/, "Common Pi options should expose native Safety Guard Setup");
81
91
  assert.match(html, /id="optionsGitWorkflowSetupButton"[\s\S]*data-command="\/git-workflow-setup"[\s\S]*Guided Git Setup/, "Common Pi options should expose native Guided Git Setup");
82
92
  assert.match(html, /id="nativeCommandSearch"[^>]*type="search"/, "native slash selector dialog should expose a filter box");
83
93
  assert.match(html, /id="remoteQrDialog"[\s\S]*id="remoteQrBody"[\s\S]*id="remoteQrCopyButton"/, "remote WebUI should expose a dedicated QR popup dialog");
@@ -86,12 +96,14 @@ assert.match(html, /id="pathPickerCreateNameInput"[^>]*placeholder="New director
86
96
  assert.match(html, /id="pathPickerCreateButton"[^>]*>Create directory<\/button>/, "cwd picker should expose a create-directory action");
87
97
  assert.match(html, /id="pathPickerSearchInput"[^>]*type="search"[^>]*placeholder="Search current directory…"/, "cwd picker should expose a current-directory search box");
88
98
  assert.match(html, /id="pathPickerClearSearchButton"[^>]*hidden[^>]*>Clear<\/button>/, "cwd picker should expose a clear-search action");
99
+ assert.match(app, /function fileTreeGitStatusForEntry\(entry = \{\}\) \{\s+return fileTreeState\.gitStatusByPath\.get\(normalizeFileTreePath\(entry\.path \|\| ""\)\) \|\| null;\s+\}/, "file tree rendering should use the refreshed Git-status snapshot instead of stale status embedded in cached entries");
100
+ assert.match(app, /confirmLabel: activeAgentTabs\.length \? "Close and stop work" : count === 1 \? "Close tab" : "Close tabs"/, "single-tab confirmation should use singular close wording");
89
101
  assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
90
102
  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");
91
103
  assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
92
104
  assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
93
105
  assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
94
- assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*id="subagentsBox"/, "side panel should expose grouped running subagents with a live count");
106
+ assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*class="subagents-help"[\s\S]*<code>subagent<\/code>[\s\S]*foreground or async mode[\s\S]*id="subagentsBox"/, "side panel should explain how to launch tracked subagents and expose grouped running agents with a live count");
95
107
  assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
96
108
  assert.match(html, /data-side-panel-section="session"[\s\S]*data-side-panel-section="subagents"[\s\S]*data-side-panel-section="queue"/, "Subagents should appear between Session and Queue in the side panel");
97
109
  assert.match(html, /data-side-panel-section="queue"[\s\S]*id="createPromptListButton"[\s\S]*>Create prompt list<\/button>/, "Queue section should expose prompt-list creation");
@@ -107,6 +119,12 @@ assert.match(html, /data-side-panel-section="controls"/, "side panel controls sh
107
119
  assert.match(html, /data-side-panel-section="commands"/, "side panel commands should live in a collapsible section");
108
120
  assert.match(html, /class="side-panel-section-toggle"[^>]*aria-controls="sidePanelSectionControls"/, "side panel section toggles should target their content panels");
109
121
  assert.match(html, /class="side-panel-section-label">Events<\/span>/, "side panel events should expose a section toggle label");
122
+ 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");
123
+ 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");
124
+ 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");
125
+ assert.match(app, /function applyChatEventMetadata\(bubble, message\)[\s\S]*?bubble\.dataset\.chatTimestamp/, "rendered chat events should expose timestamps for sidebar navigation");
126
+ assert.match(app, /addEvent\(`tool \$\{event\.toolName\} started`, "info", \{ toolCallId: event\.toolCallId \}\)/, "tool start events should navigate to their exact tool card");
127
+ assert.match(css, /\.event:hover,[\s\S]*?\.message\.chat-event-target[\s\S]*?@keyframes chat-event-target-pulse/, "clickable events and highlighted chat targets should have visible interaction states");
110
128
  const sidePanelToggleStates = Array.from(
111
129
  html.matchAll(/class="side-panel-section-toggle"[^>]*aria-expanded="([^"]+)"/g),
112
130
  (match) => match[1],
@@ -173,6 +191,11 @@ assert.ok(
173
191
  );
174
192
  assert.match(html, /id="optionsConversationModeButton"[^>]*data-command="\/talk"[^>]*hidden[\s\S]*?<span>Start Conversation<\/span>/, "Options menu should include the feature-gated Natural Conversation toggle");
175
193
  assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-chip"[\s\S]*hidden>Voice: off<\/button>/, "composer should expose a hidden-until-active conversation status chip");
194
+ const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
195
+ assert.match(workflowModeButtonHtml, /class="composer-workflow-mode-button"[\s\S]*aria-pressed="false"[\s\S]*hidden[\s\S]*<span>Workflow<\/span>/, "composer actions should expose a capability-gated Workflow Mode toggle");
196
+ assert.match(workflowModeButtonHtml, /data-tooltip="Workflow Mode:/, "Workflow Mode should retain its styled tooltip");
197
+ assert.doesNotMatch(workflowModeButtonHtml, /\stitle=/, "Workflow Mode should not also expose a browser-native tooltip");
198
+ assert.match(html, /id="workflowModeChip" class="composer-workflow-mode-chip"[\s\S]*hidden>Workflow: on<\/button>/, "composer should expose a hidden-until-active Workflow Mode chip");
176
199
  assert.match(html, /id="conversationModeEndButton" class="composer-conversation-end-button"[\s\S]*hidden>End conversation<\/button>/, "composer should expose a persistent End conversation button while active");
177
200
  assert.match(html, /id="conversationVoiceMenu" class="composer-publish-menu composer-conversation-voice-menu" hidden>[\s\S]*id="conversationVoiceButton"[\s\S]*id="conversationVoiceMenuPanel" class="composer-publish-menu-panel[\s\S]*id="conversationModeEndButton"/, "composer should expose the conversation voice menu (publish-menu pattern) next to the End conversation button");
178
201
  assert.match(app, /conversationVoiceMenuPanel: \$\("#conversationVoiceMenuPanel"\)/, "frontend should register the conversation voice menu panel");
@@ -209,7 +232,25 @@ assert.ok(
209
232
 
210
233
  assert.match(css, /--visual-viewport-height:\s*100dvh/, "CSS should define a visual viewport height fallback");
211
234
  assert.match(css, /color-scheme:\s*var\(--theme-color-scheme\)/, "CSS should allow JS-selected themes to update browser color-scheme");
212
- assert.match(css, /font-size:\s*80%/, "Web UI should render at 80% base scale for denser layout");
235
+ assert.match(css, /font-size:\s*100%/, "Web UI should preserve the browser base scale for accessible typography");
236
+ assert.match(css, /--text-xs:\s*0\.75rem/, "typography tokens should define a 12 px absolute floor");
237
+ assert.doesNotMatch(css, /font-size:\s*0\.(?:[0-6]\d*|7[0-4])rem/, "interface font declarations should not fall below the 0.75rem floor");
238
+ assert.match(html, /id="undoToast"[^>]*aria-live="polite"[^>]*aria-atomic="true"[^>]*hidden/, "reversible actions should expose a non-blocking live Undo notification");
239
+ assert.match(html, /id="undoToastButton"[^>]*>Undo<\/button>/, "Undo notification should expose an explicit Undo button");
240
+ assert.match(app, /function offerUndo\([\s\S]*?timeoutMs = 10000[\s\S]*?setTimeout\(dismissUndoToast, timeoutMs\)/, "Undo offers should expire after a clear bounded interval");
241
+ assert.match(app, /async function runOfferedUndo\(\)[\s\S]*?await pending\.undo\(\)[\s\S]*?settleUndoToast/, "Undo notification should execute asynchronous reversal callbacks and report the result");
242
+ assert.match(css, /\.undo-toast\.expiring \.undo-toast-progress \{ animation: undo-toast-expire var\(--undo-timeout\) linear forwards; \}/, "Undo notification should show its remaining lifetime visually");
243
+ assert.match(app, /message: `\$\{feature\.label\} was \$\{disabled \? "disabled" : "enabled"\}\.`,[\s\S]*?undo: \(\) => setOptionalFeatureDisabled/, "optional feature toggles should offer Undo");
244
+ assert.match(app, /message: `Deleted prompt list[\s\S]*?upsertStoredPromptList\(deleted\)/, "prompt-list deletion should offer restoration instead of only confirmation");
245
+ assert.match(app, /message: `Deleted custom app runner[\s\S]*?method: "POST", body: \{ runner: restoreRunner \}/, "custom runner deletion should offer restoration");
246
+ assert.match(app, /message: `Moved \$\{sourcePath\} to \$\{nextPath\}\.`,[\s\S]*?offerMoveUndo: false/, "file moves should offer a non-recursive move-back action");
247
+ assert.match(app, /message: "Remote access is open\."[\s\S]*?remoteWebuiCommand\("close", "\/remote close"\)/, "opening remote access should offer a quick return to local-only mode");
248
+ assert.doesNotMatch(app, /dashboardAction\("Start a conversation"/, "empty starter should not duplicate the already-focused conversation composer");
249
+ assert.match(app, /function emptyStartRecentWorkspaces\(\)[\s\S]*?typeof item\?\.cwd === "string"[\s\S]*?\^\\\[object Object\\\]\$[\s\S]*?filter\(Boolean\)\.slice\(0, 4\)/, "empty starter should normalize and reject invalid recent-workspace entries");
250
+ assert.match(app, /const recent = recentWorkspaces\.length \? make\("section", "empty-start-recent"\) : null/, "empty starter should omit the recent-workspaces section when no valid entries exist");
251
+ assert.match(app, /title: "Open workspace"[\s\S]*?title: "Resume session"[\s\S]*?title: "Branch worktree"/, "empty starter should prioritize the three useful workspace and session actions");
252
+ assert.match(css, /\.empty-start-actions \{ display: grid; grid-template-columns: repeat\(3, minmax\(0, 1fr\)\)/, "empty starter should present primary actions as a balanced desktop grid");
253
+ assert.match(css, /\.empty-start-action-copy span \{[\s\S]*?font-size: var\(--text-xs\)/, "empty starter actions should explain their outcome in readable supporting text");
213
254
  assert.match(css, /--background-glow-pink/, "CSS should expose theme-controlled page glow colors");
214
255
  assert.match(css, /--theme-background-image:\s*none/, "CSS should expose a theme-controlled page background image variable");
215
256
  assert.match(css, /var\(--theme-background-image\)/, "body background should include the selected theme background image layer");
@@ -243,7 +284,7 @@ assert.match(css, /\.skill-editor-dialog form \{[\s\S]*?height:\s*100%;[\s\S]*?m
243
284
  assert.match(css, /\.skill-editor-text \{[\s\S]*?overflow-x:\s*hidden;[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap/, "skill editor text should wrap long lines instead of horizontal scrolling");
244
285
  assert.match(css, /\.composer-busy-mode-menu \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.22rem\);[\s\S]*?background:\s*var\(--ctp-crust\)/, "busy prompt behavior dropdown should expand above the tag with an opaque background");
245
286
  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");
246
- 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*0\.72rem/, "mobile last-user-prompt card should use compact height and text");
287
+ 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");
247
288
  assert.match(css, /\.message\.extension,[\s\S]*?\.message\.native/, "extension and native command output should have visible transcript styling");
248
289
  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");
249
290
  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");
@@ -279,15 +320,25 @@ assert.match(css, /\.prompt-list-dialog \{[\s\S]*?width:\s*min\(58rem/, "prompt-
279
320
  assert.match(css, /\.prompt-list-editor-rows \{[\s\S]*?max-height:/, "prompt-list dialog should scroll long follow-up lists inside the editor");
280
321
  assert.match(css, /\.prompt-list-load-row \{[\s\S]*?grid-template-columns:\s*minmax\(0, 1fr\) auto auto/, "prompt-list load row should fit load and delete actions beside saved-list selection");
281
322
  assert.match(css, /\.side-panel-section-toggle \{[\s\S]*?justify-content:\s*space-between/, "side panel section toggles should align labels and chevrons");
323
+ assert.match(html, /id="stateDetails" class="session-details"[^>]*aria-label="Current session details"/, "session panel should expose a dedicated accessible details container");
324
+ assert.match(app, /function sessionCopyButton\([\s\S]*?await copyText\(value\)/, "session identifiers and files should be copyable");
325
+ assert.match(app, /function splitSessionFilePath\([\s\S]*?replace\(\/\^\\\/home/, "session file display should abbreviate home directories");
326
+ assert.match(css, /\.session-overview \{[\s\S]*?grid-template-columns:/, "session status and counts should have a scannable overview");
327
+ assert.match(css, /\.session-detail-value\.truncate[\s\S]*?text-overflow:\s*ellipsis/, "long session values should not overwhelm the side panel");
282
328
  assert.match(css, /\.server-restart-panel \{[\s\S]*?z-index:\s*62/, "server restart overlay should render above the offline shell");
283
329
  assert.match(css, /@keyframes server-restart-spin/, "server restart overlay should show a loading spinner");
284
- assert.match(css, /\.webui-version-badge,\n\.webui-dev-badge \{[\s\S]*?border-radius:\s*999px/, "Web UI version and dev indicators should render as compact title badges");
330
+ assert.match(css, /\.side-panel-version-row \{[\s\S]*?display:\s*flex[\s\S]*?align-items:\s*center[\s\S]*?flex-wrap:\s*wrap/, "Control Deck versions and build status should use a dedicated responsive row");
331
+ assert.match(css, /\.pi-version-button,\n\.webui-version-button,\n\.webui-dev-badge \{[\s\S]*?border-radius:\s*999px/, "Pi and Web UI version buttons plus the dev indicator should render as compact title controls");
332
+ assert.match(css, /\.webui-version-button:hover,[\s\S]*?\.webui-version-button:focus-visible/, "Web UI version button should expose visible hover and keyboard focus states");
333
+ assert.match(css, /\.pi-version-button:hover,[\s\S]*?\.pi-version-button:focus-visible/, "Pi version button should expose visible hover and keyboard focus states");
334
+ assert.match(css, /\.extension-dialog\.pi-release-notes-dialog \{[\s\S]*?\.pi-release-notes-body \{[\s\S]*?overflow:\s*auto/, "Pi release notes popup should keep long notes scrollable");
285
335
  assert.match(css, /\.webui-dev-badge \{[\s\S]*?color:\s*var\(--ctp-yellow\)/, "Web UI dev indicator should have distinct warning styling");
286
336
  assert.match(css, /\.side-panel-section\.collapsed \.side-panel-section-content,\n\.side-panel-section-content\[hidden\] \{\n\s+display:\s*none;/, "collapsed side panel section content should be hidden");
287
337
  assert.match(css, /\.side-panel-section:not\(\.collapsed\) \.side-panel-section-chevron/, "expanded side panel sections should rotate the chevron");
338
+ assert.match(css, /\.subagents-help \{[\s\S]*border-left:[\s\S]*font-size:\s*0\.7rem;[\s\S]*\.subagents-help code/, "subagent invocation guidance should render as a compact informational callout");
288
339
  assert.match(css, /\.subagents-box\.has-items[\s\S]*\.subagent-tab-group[\s\S]*\.subagent-agent-row/, "running subagents should render as grouped terminal/session cards");
289
340
  assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
290
- assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-terminal[\s\S]*\.subagent-overlay-close-action/, "subagent output should reuse the non-blocking App Runner widget visual language");
341
+ assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-transcript[\s\S]*\.subagent-overlay-message[\s\S]*\.subagent-overlay-close-action/, "subagent output should combine the non-blocking widget shell with the main transcript message styling");
291
342
  assert.match(css, /\.subagent-output-waiting-dot[\s\S]*@keyframes subagent-output-waiting-pulse/, "subagent output should animate one transient ellipsis while waiting");
292
343
  assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
293
344
  assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity indicator");
@@ -328,8 +379,10 @@ assert.match(css, /\.action-feedback-controls:hover,[\s\S]*?\.action-feedback-co
328
379
  assert.match(css, /\.action-feedback-controls:not\(:hover\):not\(:focus-within\) \.action-feedback-button/, "hidden action reactions should not expose button hit targets until the hover area is reached");
329
380
  assert.match(css, /\.action-feedback-button\.feedback-question\.active/, "question-mark reaction should have selected styling");
330
381
  assert.match(css, /\.composer-row button\[data-tooltip\]::after/, "composer button tooltips should be shared across Git, Steer, and Follow-up buttons");
382
+ assert.match(css, /\.composer-row \.composer-workflow-mode-button\[data-tooltip\]::after \{\n\s+max-width:\s*min\(18rem, calc\(100vw - 2rem\)\);/, "Workflow Mode tooltip should stay narrow enough to remain inside the outer chat frame");
331
383
  assert.match(css, /\.composer-row \.composer-git-button\[data-tooltip\]::after \{[\s\S]*?left:\s*0;[\s\S]*?right:\s*auto;/, "Git workflow tooltip should open rightward so it is not clipped off the left edge");
332
384
  assert.match(css, /\.composer-row button\[data-tooltip\]\.tooltip-open::after/, "composer button tooltips should be triggerable from JS for empty mobile taps");
385
+ assert.match(css, /\.composer-row button\[data-tooltip\]:hover,[\s\S]*?\.composer-input-row button\[data-tooltip\]\.tooltip-open \{\n\s+z-index:\s*40;/, "active composer tooltip triggers should stack above context tags and adjacent controls");
333
386
  assert.match(css, /\.footer-floating-tooltip \{[\s\S]*?position:\s*fixed;[\s\S]*?z-index:\s*1000/, "git footer extension boxes should use one viewport-positioned styled tooltip");
334
387
  assert.match(css, /\.footer-floating-tooltip \{[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap;/, "git footer tooltips should wrap long paths instead of clipping them");
335
388
  assert.doesNotMatch(css, /\.statusbar-git-footer \.footer-(?:metric|meta)\[data-tooltip\]::after/, "git footer chips should not also render a second pseudo-element tooltip");
@@ -349,10 +402,16 @@ assert.match(css, /body\.composer-actions-open \.composer-actions-panel \{ displ
349
402
  assert.match(css, /\.terminal-tabs-toggle-button \{ display: none; \}/, "terminal tab toggle should be hidden outside mobile CSS");
350
403
  assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.terminal-command-palette-button,\n\s+\.terminal-dashboard-button \{[\s\S]*?display:\s*inline-grid;/, "mobile header should keep the command palette button visible beside the dashboard button");
351
404
  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");
352
- 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]*?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 use compact two-column cards instead of tall one-column cards");
353
- assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-item-kind \{[\s\S]*?font-size:\s*0\.56rem;[\s\S]*?\.command-palette-item-label \{ font-size:\s*0\.82rem; \}[\s\S]*?\.command-palette-item-description \{ font-size:\s*0\.6rem; \}/, "mobile command palette result text should be scaled down to fit compact cards");
405
+ 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");
406
+ 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");
354
407
  assert.match(css, /body\.terminal-tabs-left \.chat-panel \{[\s\S]*?grid-template-columns:\s*clamp\(13rem, 18vw, 19rem\) minmax\(0, 1fr\)/, "terminal tabs left layout should split the chat panel into a sidebar and transcript area");
355
408
  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");
409
+ assert.match(html, /class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="splitTabButton"[\s\S]*>Split<\/span>[\s\S]*id="commandPaletteButton"[\s\S]*>Commands<\/span>[\s\S]*id="workspaceDashboardToggleButton"[\s\S]*>Overview<\/span>/, "tab, command, and workspace actions should share one labeled sidebar toolbar");
410
+ assert.match(css, /body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?display:\s*grid;[\s\S]*?grid-template-columns:\s*repeat\(3, minmax\(0, 1fr\)\);[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions > button \{[\s\S]*?min-height:\s*3\.55rem;/, "left-sidebar actions should render as an equal-width three-button toolbar with readable touch targets");
411
+ assert.match(css, /@media \(min-width: 721px\) \{[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?z-index:\s*130;[\s\S]*?overflow:\s*visible;[\s\S]*?terminal-command-palette-button\[data-tooltip\]::after,[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.62rem\);[\s\S]*?z-index:\s*220;[\s\S]*?width:\s*calc\(300% \+ 0\.84rem\);/, "left-sidebar command and overview tooltips should render above the full toolbar without clipping");
412
+ assert.match(css, /terminal-command-palette-button\[data-tooltip\]::after \{\s+left:\s*calc\(-100% - 0\.42rem\);[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{\s+left:\s*calc\(-200% - 0\.84rem\);/, "left-sidebar tooltips should align to the toolbar edges from their individual buttons");
413
+ assert.match(css, /terminal-split-button\[aria-pressed="true"\] \.terminal-sidebar-action-label-split[\s\S]*?display:\s*none;[\s\S]*?terminal-split-button\[aria-pressed="true"\] \.terminal-sidebar-action-label-unsplit[\s\S]*?display:\s*block;/, "split toolbar label should change to Unsplit with the pressed state");
414
+ assert.match(css, /body\.terminal-tabs-left \.terminal-close-all-button \{[\s\S]*?margin-top:\s*0;[\s\S]*?justify-content:\s*center;[\s\S]*?text-align:\s*center;/, "left-sidebar close-all action should remain a separate centered destructive row");
356
415
  assert.match(css, /body\.terminal-tabs-left \.terminal-tabs \{[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should stack tabs vertically");
357
416
  assert.match(css, /body\.terminal-tabs-left \.terminal-tab-group-menu \{[\s\S]*?inset:\s*0 auto auto 100%;[\s\S]*?padding-left:\s*var\(--terminal-left-dropdown-bridge\)/, "left-sidebar grouped tab menus should include a hover bridge so they do not vanish between button and dropdown");
358
417
  assert.match(css, /body\.terminal-tabs-left \.terminal-new-tab-menu \.composer-publish-menu-panel \{[\s\S]*?inset:\s*0 auto auto 100%;[\s\S]*?padding-left:\s*var\(--terminal-left-dropdown-bridge\)/, "left-sidebar new-tab dropdown should include a hover bridge so it does not vanish between button and dropdown");
@@ -406,6 +465,9 @@ assert.match(css, /\.git-diff-grid \{[\s\S]*?grid-template-columns:\s*3\.8rem mi
406
465
  assert.match(html, /id="gitChangesDialog"[\s\S]*id="gitChangesRefreshButton"[\s\S]*id="gitChangesPullButton"[\s\S]*id="gitChangesBody"/, "git changes modal should expose refresh, pull controls, and a diff body");
407
466
  assert.match(app, /chip\.key === "changes"[\s\S]*?options\.onClick = openGitChangesDialog/, "footer CHANGES chip should open the git changes modal");
408
467
  assert.match(app, /async function loadGitChangesDialog[\s\S]*api\("\/api\/git-changes"/, "git changes modal should load diff data from the server endpoint");
468
+ assert.match(app, /"Resolve with agent"[\s\S]*api\("\/api\/git-operation\/resolve-with-agent", \{ method: "POST"[\s\S]*switchToResponseTab\(response\)/, "conflict panel should open the resolution agent in the new tab returned by the server");
469
+ 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");
470
+ 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");
409
471
  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");
410
472
  assert.match(app, /function gitDiffDisplayLine\(row, side\)[\s\S]*`-\$\{text\}`[\s\S]*`\+\$\{text\}`/, "git changes modal should render changed lines with +/- prefixes");
411
473
  assert.match(app, /function gitUntrackedEntryToDiffFile\(entry\)[\s\S]*?renderRowLimit:\s*Number\.POSITIVE_INFINITY[\s\S]*?type: "added"/, "untracked files should render as complete added-file diffs without the row preview cap");
@@ -433,7 +495,7 @@ assert.match(app, /async function createPathPickerDirectory\(\)/, "cwd picker sh
433
495
  assert.match(app, /function renderPathPickerDirectoryList\(\)[\s\S]*pathPickerDirectoryMatchesSearch/, "cwd picker should filter current-directory entries in the browser");
434
496
  assert.match(app, /elements\.pathPickerSearchInput\.addEventListener\("input", renderPathPickerDirectoryList\)/, "cwd picker should update directory matches as the user types");
435
497
  assert.match(app, /function shouldOpenCwdChangeInNewTab\(tab\) \{[\s\S]*!!tab\?\.conversationStarted[\s\S]*activeTabHasConversationMessages\(tab\)[\s\S]*stateHasVisibleWork\(currentState\)[\s\S]*tabHasActiveAgent\(tab\)/, "cwd changes for started conversations should be routed to a new tab");
436
- assert.match(app, /if \(shouldOpenCwdChangeInNewTab\(tab\)\) \{[\s\S]*await createTerminalTab\(cwd, \{ triggerButton: null \}\);[\s\S]*return;[\s\S]*window\.confirm\(`Restart/, "footer cwd changes should open a new tab before destructive cwd restarts once a session is active");
498
+ assert.match(app, /if \(shouldOpenCwdChangeInNewTab\(tab\)\) \{[\s\S]*await createTerminalTab\(cwd, \{ triggerButton: null \}\);[\s\S]*return;[\s\S]*await appConfirmText\(`Restart/, "footer cwd changes should open a new tab before app-confirmed cwd restarts once a session is active");
437
499
  assert.match(server, /async function createDirectoryPickerDirectory\(parentPath, nameValue, activeCwd\)/, "server should implement cwd picker directory creation");
438
500
  assert.match(server, /function directoryPickerActiveCwd\(req, url, body = \{\}\)/, "server should let the cwd picker run before any Pi tabs exist");
439
501
  assert.match(server, /url\.pathname === "\/api\/directories" && req\.method === "POST"/, "server should expose POST /api/directories for cwd picker directory creation");
@@ -500,7 +562,7 @@ assert.match(app, /backgroundClearButton\.addEventListener\("click"/, "side-pane
500
562
  assert.match(app, /initializeCustomBackground\(\)\.catch/, "startup should restore the saved custom background when theme loading fails");
501
563
  assert.match(app, /Restart Web UI to load themes/, "frontend should explain when a stale server cannot serve the themes endpoint");
502
564
  assert.match(app, /themeSelect\.addEventListener\("change"/, "side-panel theme selector should switch themes immediately");
503
- assert.match(app, /open \? "Close for network" : "Open to network"/, "network button should toggle from open to close action");
565
+ assert.match(app, /open \? "Close remote access" : "Open for remote access"/, "network button should use explicit remote-access labels for open and close actions");
504
566
  assert.match(app, /let networkStatusLoaded = false;/, "Remote WebUI QR auto-popup state should track the first loaded network status");
505
567
  assert.match(app, /const hadNetworkStatus = networkStatusLoaded;[\s\S]*if \(!hadNetworkStatus\) \{\n\s+remoteQrAutoPopupShown = true;\n\s+return;\n\s+\}[\s\S]*if \(!wasOpen && !remoteQrAutoPopupShown && isLocalWebuiBrowserOrigin\(\)\)/, "Remote WebUI QR should auto-open only after network access transitions open, not on initial refresh");
506
568
  assert.match(app, /remoteAuthToggle: \$\("#remoteAuthToggle"\)/, "Remote WebUI controls should bind the remote PIN auth toggle");
@@ -514,10 +576,16 @@ assert.match(server, /await saveRemoteAuthPreference\(false\)/, "disabling Remot
514
576
  assert.match(server, /function pinFromHash\(\)[\s\S]*new URLSearchParams\(String\(window\.location\.hash \|\| ""\)\.replace\(\/\^#\/, ""\)\)/, "remote auth page should read QR-provided PINs from the URL fragment");
515
577
  assert.match(server, /window\.history\.replaceState\(null, "", window\.location\.pathname \+ \(window\.location\.search \|\| ""\)\)/, "remote auth page should scrub fragment PINs from the address bar before authenticating");
516
578
  assert.match(app, /remoteWebuiCommand\(open \? "close" : "open"/, "network open\/close button should dispatch through the Remote WebUI package command");
517
- assert.match(app, /webuiVersionBadge: \$\("#webuiVersionBadge"\)/, "frontend should bind the Control Deck version badge");
579
+ assert.match(app, /piVersionButton: \$\("#piVersionButton"\)/, "frontend should bind the Control Deck Pi version button");
580
+ assert.match(app, /webuiVersionButton: \$\("#webuiVersionButton"\)/, "frontend should bind the Control Deck Web UI version button");
518
581
  assert.match(app, /webuiDevBadge: \$\("#webuiDevBadge"\)/, "frontend should bind the Control Deck dev badge");
519
- assert.match(app, /function refreshWebuiVersion\(\)[\s\S]*api\("\/api\/health", \{ scoped: false \}\)[\s\S]*setWebuiVersion\(health\.webuiVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(health\)\)/, "frontend should load Web UI version and dev mode from health metadata");
520
- assert.match(app, /case "webui_connected":[\s\S]*setWebuiVersion\(event\.version\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(event\)\)/, "frontend should refresh Web UI version and dev mode from reconnect events");
582
+ assert.match(app, /function openPiReleaseNotes\(\)[\s\S]*api\("\/api\/pi-release-notes", \{ scoped: false \}\)[\s\S]*renderMarkdown\(elements\.piReleaseNotesBody/, "Pi version button should load and render release notes in the popup");
583
+ assert.match(app, /const PI_WEBUI_NPM_URL = "https:\/\/www\.npmjs\.com\/package\/@firstpick\/pi-package-webui"/, "Web UI version button should target the package's public npm page");
584
+ assert.match(app, /async function confirmOpenWebuiNpmPage\(\)[\s\S]*appConfirm\([\s\S]*confirmLabel: "Open npm"[\s\S]*openWebuiNpmPageInNewTab\(\)/, "Web UI version button should ask before opening npm in a new tab");
585
+ assert.match(app, /function refreshWebuiVersion\(\)[\s\S]*api\("\/api\/health", \{ scoped: false \}\)[\s\S]*setWebuiVersion\(health\.webuiVersion\)[\s\S]*setPiVersion\(health\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(health\)\)/, "frontend should load Pi version, Web UI version, and dev mode from health metadata");
586
+ assert.match(app, /case "webui_connected":[\s\S]*setWebuiVersion\(event\.version\)[\s\S]*setPiVersion\(event\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(event\)\)/, "frontend should refresh Pi version, Web UI version, and dev mode from reconnect events");
587
+ assert.match(server, /url\.pathname === "\/api\/pi-release-notes"[\s\S]*installedPiReleaseNotes\(\)/, "server should expose the installed Pi release notes endpoint");
588
+ assert.match(server, /PI_RELEASES_PAGE_BASE_URL = "https:\/\/github\.com\/earendil-works\/pi\/releases\/tag"/, "release-note links should target the official Pi GitHub release page");
521
589
  assert.match(server, /const webuiDevServer = isTruthyEnv\(process\.env\.PI_WEBUI_DEV\) \|\| isSourceCheckout\(packageRoot\)/, "server should derive dev mode from PI_WEBUI_DEV or a source checkout");
522
590
  assert.match(server, /webuiDev: webuiDevServer,[\s\S]*webuiMode: webuiDevServer \? "dev" : "production"/, "server status should expose Web UI dev mode");
523
591
  assert.match(server, /type: "webui_connected",[\s\S]*webuiDev: webuiDevServer,[\s\S]*webuiMode: webuiDevServer \? "dev" : "production"/, "SSE connect event should expose Web UI dev mode");
@@ -640,7 +708,9 @@ assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s
640
708
  assert.doesNotMatch(app, /subagentOverlayDialog\.showModal|elements\.subagentOverlayDialog/, "subagent output should not open or depend on a modal dialog");
641
709
  assert.match(app, /api\(`\/api\/subagents\/output\?\$\{query\}`, \{ scoped: false \}\)/, "subagent overlay should fetch selected live output from the owning tab");
642
710
  assert.match(app, /SUBAGENT_OVERLAY_REFRESH_MS = 1000/, "subagent overlay should poll selected live output at a fast cadence");
643
- assert.match(app, /function appendSubagentOutputWaitingIndicator\(parent\)[\s\S]*subagent-output-waiting-dot[\s\S]*if \(running && agent\.currentTool\) appendSubagentOutputWaitingIndicator\(terminal\)/, "subagent widget should render one replaceable waiting animation instead of transcript spam");
711
+ assert.match(app, /function createMessageBubble\(message,[\s\S]*renderContent\(body, message\.content, \{ markdown: message\.role === "assistant" \}\)[\s\S]*function appendMessage\(message, options = \{\}\)[\s\S]*createMessageBubble\(message, options\)/, "main transcript output should use the reusable message bubble renderer");
712
+ assert.match(app, /function renderSubagentOverlayWidget\(\)[\s\S]*createMessageBubble\(\{[\s\S]*role: "assistant"[\s\S]*content: shownText[\s\S]*\}, \{ streaming: running, transient: true \}\)[\s\S]*subagent-overlay-message/, "subagent output should use the same assistant Markdown message renderer as the main transcript");
713
+ assert.match(app, /function appendSubagentOutputWaitingIndicator\(parent\)[\s\S]*message runIndicator run-indicator-message streaming subagent-output-waiting[\s\S]*subagent-output-waiting-dot[\s\S]*if \(running && agent\.currentTool\) appendSubagentOutputWaitingIndicator\(output\)/, "subagent widget should render one main-transcript-style waiting indicator instead of transcript spam");
644
714
  assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend should refresh the cross-tab subagent overview");
645
715
  assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
646
716
  assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*webuiSubagentsData\(\)/, "server should expose a cross-tab running-subagent endpoint");
@@ -656,6 +726,9 @@ assert.match(app, /api\(`\/api\/codex-usage\$\{suffix\}`, \{ scoped: false \}\)/
656
726
  assert.match(app, /restoreSidePanelSectionState\(\);\nbindSidePanelSectionToggles\(\);/, "side panel section state should restore before toggles are bound");
657
727
  assert.match(app, /OPTIONAL_FEATURES_STORAGE_KEY/, "optional feature disable toggles should persist in browser storage");
658
728
  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");
729
+ assert.match(html, /gitFooterVisibilityApplyButton[^>]*>Save globally</, "git footer visibility should state that applied choices persist globally");
730
+ assert.match(app, /Changes are saved globally and reused by every Pi session\./, "git footer visibility dialog should explain its global persistence scope");
731
+ assert.match(app, /Saved.*global WebUI footer visibility change/, "git footer visibility apply feedback should confirm global persistence");
659
732
  assert.match(app, /function parseGitFooterWebuiPayloadRaw\(raw\)[\s\S]*GIT_FOOTER_WEBUI_PAYLOAD_TYPE[\s\S]*GIT_FOOTER_WEBUI_PAYLOAD_VERSION/, "Web UI footer should parse the structured payload emitted by git-footer-status");
660
733
  assert.match(app, /function normalizeFooterPayloadChangedFile\(value\)[\s\S]*FOOTER_CHANGED_FILE_KINDS\.has\(value\.kind\)[\s\S]*oldPath/, "git footer payload parsing should preserve changed-file details for changes popovers");
661
734
  assert.match(app, /const files = value\.files\.map\(normalizeFooterPayloadChangedFile\)\.filter\(Boolean\)\.slice\(0, 80\);[\s\S]*chip\.files = files;/, "git footer payload chips should retain bounded changed-file lists");
@@ -769,6 +842,27 @@ assert.match(app, /const conversationModeByTab = new Map\(\)/, "frontend should
769
842
  assert.match(app, /function defaultConversationModeState[\s\S]*allowedTools: \["read", "grep", "find", "ls"\]/, "frontend Natural Conversation defaults should mirror the read-only tool allowlist");
770
843
  assert.match(app, /function renderConversationModeControls\(\)[\s\S]*document\.body\.classList\.toggle\("conversation-mode-active", active\)[\s\S]*optionsConversationModeButton[\s\S]*conversationModeChip[\s\S]*conversationModeEndButton/, "frontend should render active Natural Conversation controls and page\/composer state");
771
844
  assert.match(app, /async function setNaturalConversationModeEnabled\(enabled\)[\s\S]*api\("\/api\/conversation-mode", \{ method: "POST"/, "frontend Natural Conversation toggle should use the WebUI shell endpoint");
845
+ assert.match(app, /const WORKFLOW_MODE_STATUS_KEY = "workflow-mode"/, "frontend should consume extension-owned Workflow Mode status");
846
+ assert.match(app, /const WORKFLOW_MODE_RPC_WIDGET_KEY = "workflow-mode:rpc"[\s\S]*WORKFLOW_MODE_RPC_PAYLOAD_PREFIX = "WORKFLOW_MODE_RPC_PAYLOAD "[\s\S]*WORKFLOW_MODE_RPC_PAYLOAD_VERSION = 1/, "frontend should recognize the versioned replayable Workflow Mode RPC payload");
847
+ assert.match(app, /function workflowModeStateFromRpcPayload\(lines\)[\s\S]*payload\?\.type !== WORKFLOW_MODE_RPC_PAYLOAD_TYPE[\s\S]*normalizeWorkflowModeState/, "frontend should strictly validate structured Workflow Mode payloads");
848
+ assert.match(app, /const workflowModeByTab = new Map\(\)/, "frontend should track Workflow Mode independently for each Pi tab");
849
+ assert.match(app, /function renderWorkflowModeControls\(\)[\s\S]*workflow-mode-active[\s\S]*workflowModeButton[\s\S]*workflowModeChip/, "frontend should render toggle, active chip, and composer state from extension status");
850
+ assert.match(app, /async function setWorkflowModeEnabled\(enabled\)[\s\S]*`\/\$\{commandName\} mode \$\{enabled \? "on" : "off"\}`/, "Workflow Mode toggle should send canonical extension commands rather than rewrite prompts locally");
851
+ assert.match(app, /if \(statusKey === WORKFLOW_MODE_STATUS_KEY\) handleWorkflowModeStatus/, "Workflow Mode should synchronize from replayable extension setStatus events");
852
+ assert.match(app, /if \(widgetKey === WORKFLOW_MODE_RPC_WIDGET_KEY\)[\s\S]*workflowModeStateFromRpcPayload\(request\.widgetLines\)[\s\S]*updateWorkflowModeForTab/, "Workflow Mode should consume structured replay state without rendering an opaque widget");
853
+ assert.match(app, /const WORKFLOW_INSPECTOR_WIDGET_KEY = "workflow:rpc"[\s\S]*WORKFLOW_INSPECTOR_PAYLOAD_PREFIX = "WORKFLOW_RPC_PAYLOAD "[\s\S]*WORKFLOW_INSPECTOR_PAYLOAD_VERSION = 1/, "frontend should recognize the versioned multi-run Workflow inspector payload");
854
+ assert.match(app, /function parseWorkflowInspectorPayload\(lines\)[\s\S]*payload\?\.type !== WORKFLOW_INSPECTOR_PAYLOAD_TYPE[\s\S]*Array\.isArray\(payload\.runs\)/, "frontend should validate Workflow inspector type, version, and run shape");
855
+ assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-inspector-run-list[\s\S]*workflow-inspector-phase-tabs[\s\S]*renderWorkflowInspectorAgent/, "WebUI should render non-blocking active and historical run, phase, and agent drilldown");
856
+ assert.match(app, /function renderWorkflowInspectorAgent\(agent, run\)[\s\S]*Prompt[\s\S]*Recent activity[\s\S]*Result and usage[\s\S]*Retry agent/, "agent drilldown should expose prompt, activity, result, usage, and retry");
857
+ 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");
858
+ assert.match(app, /confirmMessage && !window\.confirm\(confirmMessage\)/, "destructive WebUI Workflow actions should require browser confirmation");
859
+ assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)/, "Workflow inspector state and drilldown selection should be per tab");
860
+ 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");
861
+ assert.match(app, /terminal-tab-workflow-indicator[\s\S]*workflowRunningCountForTab/, "terminal tabs should display Workflow Mode or active-run badges");
862
+ 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");
863
+ assert.match(css, /\.terminal-tab-workflow-indicator \{[\s\S]*color: var\(--ctp-mauve\)/, "inactive-tab Workflow badges should have a distinct accessible style");
864
+ assert.match(css, /\.composer-workflow-mode-button\.active,[\s\S]*aria-pressed="true"/, "active Workflow Mode toggle should have persistent pressed styling");
865
+ assert.match(css, /\.composer\.workflow-mode-active[\s\S]*body\.workflow-mode-active \.composer::before/, "active Workflow Mode should visibly accent the composer");
772
866
  // Phase 3: browser voice loop (Web Speech STT/TTS) wiring.
773
867
  const voiceModule = await readFile(join(root, "public", "voice-conversation.mjs"), "utf8");
774
868
  assert.match(voiceModule, /export function createVoiceConversationController\(options = \{\}\)/, "voice loop should live in a dependency-injected module for Node tests");
@@ -804,6 +898,7 @@ assert.match(app, /OPTIONAL_COMMAND_FEATURES = new Map\(\[[\s\S]*\["bang-refresh
804
898
  assert.match(app, /function updateOptionalFeatureAvailability\(\)[\s\S]*hasAvailableCommand\("bang-status"\) \|\| hasAvailableCommand\("bang-refresh"\)[\s\S]*hasAvailableCommand\("user-bash-shell"\)[\s\S]*hasAvailableCommand\("git-staged-msg"\)[\s\S]*hasAvailableCommand\("release-npm"\)[\s\S]*hasAvailableCommand\("release-aur"\)[\s\S]*hasAvailableCommand\("safety-guard"\)[\s\S]*hasLoadedRpcCommand\("skills"\)[\s\S]*hasAvailableCommand\("todo-progress-status"\)[\s\S]*hasLoadedRpcCommand\("tools"\)[\s\S]*hasAvailableCommand\("remote"\)[\s\S]*NATURAL_CONVERSATION_COMMAND_NAMES\.some\(\(name\) => hasAvailableCommand\(name\)\)/, "optional feature detection should call RPC-visible commands directly and distinguish native resource selectors from TUI companions");
805
899
  assert.match(app, /hasRemoteWebuiCommand = isOptionalFeatureEnabled\("remoteWebui"\) && hasAvailableCommand\("remote"\)[\s\S]*optionsRemoteButton\.hidden = !hasRemoteWebuiCommand[\s\S]*syncRemoteWebuiControlVisibility\(hasRemoteWebuiCommand\)/, "Options menu should track /remote availability and delegate network card visibility");
806
900
  assert.match(app, /function syncRemoteWebuiControlVisibility[\s\S]*networkControlField\.hidden = !hasRemoteWebuiCommand/, "Remote WebUI network card should render whenever the optional feature and /remote command are enabled");
901
+ assert.match(app, /querySelector\("#remoteAccessControlsTitle"\)[\s\S]*heading\.textContent = payload\?\.title \|\| "Remote access"/, "Remote WebUI payload titles should update the group heading without replacing the nested PIN-auth label");
807
902
  assert.match(app, /if \(featureId === "remoteWebui"\) syncRemoteWebuiControlVisibility\(false\)/, "Disabling Remote WebUI should immediately hide browser network controls before broader rerendering");
808
903
  assert.match(app, /window\.addEventListener\("storage"[\s\S]*OPTIONAL_FEATURES_STORAGE_KEY[\s\S]*reconcileDisabledOptionalFeaturesFromStorage/, "Optional feature disables should live-sync across open Web UI pages");
809
904
  assert.match(app, /if \(key === "pi-remote-webui"\) return "remoteWebui"/, "optional feature handling should recognize Remote WebUI widget events without rendering them as overlays");
@@ -852,6 +947,8 @@ assert.match(app, /async function runGitPrPrompt\(tabId = gitWorkflowActionTabId
852
947
  assert.match(app, /async function runGitMessagePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "commit"/, "guided git workflow should generate commit messages with the configured model and effort");
853
948
  assert.match(app, /async function runGitBranchNamePrompt\([\s\S]*\/api\/git-workflow\/generate"[\s\S]*kind: "branch"/, "guided git workflow should generate branch names with the configured model and effort");
854
949
  assert.match(app, /async function acceptCurrentGitStaging\([\s\S]*summary\?\.staged[\s\S]*No staged files are available/, "review staging should require a non-empty current staged set");
950
+ assert.match(app, /function gitWorkflowRequest\([\s\S]*response\.hint \? `\\n\\nHint:/, "guided git failures should show actionable backend hints");
951
+ assert.match(server, /async function gitAddAllPayload\([\s\S]*platform\(\) === "win32"[\s\S]*findWindowsReservedGitPath\([\s\S]*windowsReservedGitPathFailure\(/, "guided git add should preflight Windows-reserved untracked paths before staging");
855
952
  assert.match(app, /Pre-commit verification reminder[\s\S]*Continue with this commit/, "configured verification reminders should run before committing");
856
953
  assert.match(server, /async function startGitWorkflowGeneration\([\s\S]*set_model[\s\S]*setThinkingLevelForTab[\s\S]*type: "prompt"/, "server should apply the configured generation profile before prompting Pi");
857
954
  assert.match(server, /event\?\.type === "agent_settled"[\s\S]*restoreGitWorkflowGenerationProfile\(tab\)/, "server should restore the active tab model and effort after generation settles");
@@ -864,7 +961,7 @@ assert.match(app, /function renderReleaseNpmOutputWidget\(\)/, "release-npm live
864
961
  assert.match(app, /async function refreshAppRunners\(tabContext = activeTabContext\(\)\)/, "frontend should load detected app runners for the active tab cwd");
865
962
  assert.match(app, /function renderAppRunnerWidget\(\)/, "frontend should render app runner output in the shared top widget area");
866
963
  assert.match(app, /function tabAppRunnerRunningRun\(tab\)[\s\S]*appRunnerIsRunning\(run\)/, "frontend should derive running app-runner state for terminal tab indicators");
867
- 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");
964
+ 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");
868
965
  assert.match(app, /function appendTerminalTabContent\(button,[\s\S]*terminal-tab-conversation-indicator/, "terminal tab content should render a visible Natural Conversation badge");
869
966
  assert.match(app, /function renderTerminalTab\(tab\)[\s\S]*conversation-mode-running/, "terminal tabs should indicate active Natural Conversation mode per tab");
870
967
  assert.match(css, /\.composer-conversation-mode-chip[\s\S]*\.composer-conversation-end-button/, "Natural Conversation composer controls should have dedicated styles");
@@ -1093,6 +1190,13 @@ assert.match(app, /async function runNativeCommandMenu\(command\)[\s\S]*?sendPro
1093
1190
  assert.match(app, /function setOptionsMenuOpen\(open\)/, "Options menu should have explicit open state");
1094
1191
  assert.match(app, /function nativeToolOriginTag\(resource\)[\s\S]*?sourceInfo\?\.source === "builtin"[\s\S]*?label: "Pi Native"[\s\S]*?label: "External"/, "Tools Setup should classify built-in Pi tools separately from external tools");
1095
1192
  assert.match(app, /renderNativeResourceToggles\(tools, \{[\s\S]*?getResourceTag: nativeToolOriginTag/, "Tools Setup should render Pi Native\/External tags");
1193
+ 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");
1194
+ assert.match(app, /\/api\/tools\?scope=\$\{encodeURIComponent\(scope\)\}[\s\S]*enabledTools: \[\.\.\.enabledTools\], scope/, "Tools Setup should load and save the selected scope");
1195
+ assert.match(app, /\/api\/skills\?scope=\$\{encodeURIComponent\(scope\)\}[\s\S]*enabledSkills: \[\.\.\.enabledSkills\], scope/, "Skills Setup should load and save the selected scope");
1196
+ 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");
1197
+ 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");
1198
+ 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");
1199
+ assert.match(readme, /Session only[\s\S]*Global default/, "README should document resource selector scopes");
1096
1200
  assert.match(app, /const tags = Array\.isArray\(item\.tags\)[\s\S]*?item\.badge, \.\.\.tags/, "native selector filtering should include extra resource tags");
1097
1201
  assert.match(app, /publishMenuContainer\?\.addEventListener\("pointerenter", \(\) => \{[\s\S]*?setPublishMenuOpen\(true\);[\s\S]*?\}\)/, "Publish menu should expand on hover");
1098
1202
  assert.match(app, /publishMenuContainer\?\.addEventListener\("pointerleave", \(\) => setPublishMenuOpen\(false\)\)/, "Publish menu should collapse after hover leaves");
@@ -1108,14 +1212,17 @@ for (const command of ["resume", "reload", "remote", "name", "clone", "settings"
1108
1212
  const id = command.replace(/^./, (letter) => letter.toUpperCase());
1109
1213
  assert.match(app, new RegExp(`options${id}Button\\.addEventListener\\("click", \\(\\) => runNativeCommandMenu\\("\\/${command}"\\)\\)`), `Options menu should launch /${command}`);
1110
1214
  }
1215
+ assert.match(app, /optionsSafetyGuardSetupButton\?\.addEventListener\("click", \(\) => runNativeCommandMenu\("\/safety-guard-setup"\)\)/, "Options menu should launch native Safety Guard Setup");
1111
1216
  assert.match(app, /optionsGitWorkflowSetupButton\?\.addEventListener\("click", \(\) => runNativeCommandMenu\("\/git-workflow-setup"\)\)/, "Options menu should launch native Guided Git Setup");
1112
1217
  assert.match(extension, /registerCommand\("git-workflow-setup"[\s\S]*runGitWorkflowSetup/, "Pi extension should register the reusable /git-workflow-setup command");
1218
+ assert.match(app, /async function openNativeSafetyGuardSetupDialog\([\s\S]*\/api\/safety-guard\/config/, "Web UI should implement Safety Guard Setup with the canonical persisted config API");
1219
+ assert.match(server, /url\.pathname === "\/api\/safety-guard\/config" && req\.method === "GET"[\s\S]*url\.pathname === "\/api\/safety-guard\/config" && req\.method === "POST"/, "server should expose native safety guard config read and save endpoints");
1113
1220
  assert.match(app, /async function openNativeGitWorkflowSetupDialog\([\s\S]*\/api\/git-workflow\/preferences/, "Web UI should implement Guided Git Setup with the persisted preferences API");
1114
1221
  assert.match(app, /async function sendPrompt\(kind = "prompt", explicitMessage, \{ targetTabId = activeTabId, throwOnError = false, streamingBehavior \} = \{\}\)/, "prompt sending should accept direct messages that bypass the input field and optional target tab");
1115
1222
  assert.match(app, /const rawMessage = usesPromptInput \? elements\.promptInput\.value : explicitMessage/, "direct prompt sends should not read the input textarea");
1116
1223
  assert.match(app, /if \(usesPromptInput\) \{[\s\S]*?if \(targetStillActive\) \{[\s\S]*?elements\.promptInput\.value = "";/, "direct prompt sends should preserve the input textarea draft");
1117
1224
  assert.match(app, /make\("button", "command-item"\)[\s\S]*?sendPrompt\("prompt", `\/\$\{command\.name\}`\)/, "side-panel command clicks should send the slash command directly");
1118
- assert.match(app, /const NATIVE_SELECTOR_COMMANDS = new Set\(\["model", "settings", "git-workflow-setup", "theme", "fork", "clone", "name", "resume", "tree", "login", "logout", "scoped-models", "tools", "skills"\]\)/, "frontend should route native slash commands, including Guided Git Setup, into selector UIs");
1225
+ assert.match(app, /const NATIVE_SELECTOR_COMMANDS = new Set\(\["model", "settings", "safety-guard-setup", "git-workflow-setup", "theme", "fork", "clone", "name", "resume", "tree", "login", "logout", "scoped-models", "tools", "skills"\]\)/, "frontend should route native slash commands, including safety and Guided Git setup, into selector UIs");
1119
1226
  assert.match(app, /async function handleNativeSlashSelectorCommand\(message/, "frontend should intercept exact native slash commands before prompt forwarding");
1120
1227
  assert.match(app, /kind === "prompt" && attachments\.length === 0 && await handleNativeSlashSelectorCommand/, "prompt sending should open native selector dialogs before marking a run active");
1121
1228
  assert.match(app, /function openNativeModelSelector\(\)[\s\S]*?nativeCommandApi\("\/api\/models"\)/, "native /model selector should load models through the active tab API");
@@ -1147,7 +1254,7 @@ assert.match(app, /const PROMPT_LIST_STORAGE_KEY = "pi-webui-prompt-lists"/, "fr
1147
1254
  assert.match(app, /async function runPromptList\(prompts,[\s\S]*sendPrompt\("prompt", listPrompts\[0\]/, "prompt-list runner should send the first item as the start prompt");
1148
1255
  assert.match(app, /for \(const prompt of listPrompts\.slice\(1\)\)[\s\S]*sendPrompt\("follow-up", prompt/, "prompt-list runner should send remaining items as follow-ups");
1149
1256
  assert.match(app, /async function runDisplayedPromptList\(\)[\s\S]*const saved = saveDisplayedPromptList\(\)[\s\S]*runPromptList\(saved\.prompts/, "Run List should persist the displayed prompt list before running it");
1150
- assert.match(app, /function deleteSelectedPromptList\(\)[\s\S]*window\.confirm[\s\S]*deleteStoredPromptList/, "prompt-list deletion should confirm before deleting saved browser storage");
1257
+ assert.match(app, /async function deleteSelectedPromptList\(\)[\s\S]*deleteStoredPromptList[\s\S]*offerUndo\(\{[\s\S]*upsertStoredPromptList\(deleted\)/, "prompt-list deletion should be immediately reversible through Undo");
1151
1258
  assert.match(app, /function loadSelectedPromptListIntoEditor\(\)[\s\S]*loadPromptListIntoEditor\(list, \{ updateLoaded: true \}\)[\s\S]*elements\.promptListDialog\?\.close\(\)/, "loading a saved prompt list from the popup should close the dialog");
1152
1259
  assert.match(app, /event\.altKey && key === "ArrowUp"[\s\S]*?restoreQueuedMessagesToComposerFromShortcut\(\)/, "Alt+Up should be handled by native shortcut routing");
1153
1260
  assert.match(app, /clearPromptFromShortcut\(\)/, "Ctrl+C should clear only through a guarded prompt helper");
@@ -1184,7 +1291,7 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
1184
1291
  assert.match(app, /let openTerminalTabGroupKey = null/, "frontend should track the open terminal tab group across tab bar rerenders");
1185
1292
  assert.match(app, /function updateTerminalTabGroupOpenState\(\)/, "frontend should be able to reapply open terminal tab group state after rerenders");
1186
1293
  assert.match(app, /classList\.toggle\("terminal-tabs-dense", tabs\.length >= 10\)/, "frontend should enable dense tab layout before tab names become unreadable");
1187
- 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");
1294
+ 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");
1188
1295
  assert.match(app, /wrapper\.addEventListener\("pointerenter", \(\) => setOpenTerminalTabGroup\(group\.key\)\)/, "terminal tab groups should mark themselves open while hovered");
1189
1296
  assert.match(app, /if \(openTerminalTabGroupKey\) \{\n\s+scheduleRefreshTabs\(600\);/, "tab polling should defer full tab refreshes while a group menu is open");
1190
1297
  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 cwd groups when multiple groups are available");
@@ -1227,6 +1334,7 @@ assert.match(app, /function syncActiveTabActivityFromState\(state = currentState
1227
1334
  assert.match(app, /event\.command === "get_state" && event\.tabId === activeTabId[\s\S]*?syncActiveTabActivityFromState\(currentState\)/, "get_state response events should update stale active-tab activity");
1228
1335
  assert.match(app, /function applyResponseTab\(response\)/, "frontend should merge tab metadata returned by prompt responses");
1229
1336
  assert.match(app, /case "webui_tab_renamed":/, "frontend should update tab labels from backend rename events");
1337
+ assert.match(app, /case "webui_recovery_opened":[\s\S]*?refreshTabs\(\)[\s\S]*?switchTab\(event\.recoveryTabId\)/, "recovery events should refresh tabs and activate the new recovery session");
1230
1338
  assert.match(app, /terminalTabsToggleButton\.addEventListener\("click"/, "terminal tabs trigger should be wired in JS");
1231
1339
  assert.match(app, /composerActionsButton\.addEventListener\("click"/, "composer actions trigger should be wired in JS");
1232
1340
  assert.match(app, /function setMobileFooterExpanded\(/, "mobile footer should preserve expansion state for compatibility");
@@ -1273,14 +1381,15 @@ assert.ok(icon512.length > icon192.length, "PWA 512px icon should be present and
1273
1381
  assert.ok(matrixBackground.length > 100000, "Matrix background image should be present as an optimized WebP asset");
1274
1382
  assert.ok(mochaBackground.length > 8000, "Catppuccin Mocha background image should be present as a compact PNG asset");
1275
1383
 
1276
- assert.match(server, /AuthStorage, SessionManager/, "server should import AuthStorage for safe OAuth token refresh");
1384
+ assert.match(server, /resolveCodexUsageAuth/, "server should use the lock-safe Codex OAuth compatibility adapter");
1277
1385
  assert.match(server, /DefaultPackageManager/, "server should use Pi's package resolver when controlling Web UI tab extension loading");
1278
1386
  assert.match(server, /WEBUI_CONTROLLED_PACKAGES = new Set\(\[[\s\S]*WEBUI_PACKAGE[\s\S]*filter\(\(\[featureId\]\) => featureId !== NATURAL_CONVERSATION_FEATURE_ID\)/, "server should identify Web UI-controlled packages for de-duplicated feature loading while leaving Natural Conversation independently owned");
1279
1387
  assert.match(server, /const args = \["--mode", "rpc", "--no-extensions", "--no-skills", "--no-prompt-templates", "--no-themes"\]/, "Web UI tabs should disable implicit resource loading before adding curated resource paths");
1280
1388
  assert.match(server, /normalPiResourcePathsForTab[\s\S]*WEBUI_CONTROLLED_PACKAGES\.has\(packageName\)[\s\S]*continue/, "Web UI tab resource resolution should exclude separately installed Web UI feature packages");
1281
1389
  assert.match(server, /startedWebuiResourcePaths\(resourceType\)/, "Web UI tabs should load feature resources from the started Web UI package");
1282
1390
  assert.match(server, /resolveInstalledPackageSubpath\(nodeModulesRef\.packageName, nodeModulesRef\.subpath\)/, "Web UI should prefer workspace/global/package-root installed packages for node_modules manifest entries");
1283
- assert.match(server, /const CODEX_TOKEN_REFRESH_SKEW_MS = 5 \* 60 \* 1000/, "server should refresh Codex OAuth tokens before they expire");
1391
+ assert.match(codexAuth, /CODEX_TOKEN_REFRESH_SKEW_MS = 5 \* 60 \* 1000/, "Codex OAuth credentials should refresh five minutes before expiry");
1392
+ assert.match(server, /catch \{[\s\S]*OpenAI Codex OAuth token refresh failed/, "Codex auth failures should be redacted before reaching clients");
1284
1393
  assert.match(server, /url\.pathname === "\/api\/codex-usage" && req\.method === "GET"/, "server should expose a sanitized Codex usage endpoint");
1285
1394
  assert.match(server, /OPENAI_CODEX_USAGE_ENDPOINT/, "server should query Codex usage from the backend, not the browser");
1286
1395
  assert.match(server, /const NATIVE_SLASH_COMMANDS = nativeSlashCommandEntries\(nativeParityMatrix\)/, "server should define Pi native slash commands for autocomplete from the parity matrix");
@@ -1353,9 +1462,11 @@ assert.match(server, /function formatSessionOutput\(tab, state, stats\)/, "nativ
1353
1462
  assert.match(server, /case "session": \{[\s\S]*?formatSessionOutput\(tab, state\.data \|\| \{\}, stats\.success === false \? null : stats\.data\)/, "native /session should render state and stats through Web UI");
1354
1463
  assert.match(server, /case "copy": \{[\s\S]*?get_last_assistant_text[\s\S]*?copyText: text/, "native /copy should return text for browser clipboard handling");
1355
1464
  assert.match(server, /case "export": \{[\s\S]*?handleNativeExportCommand\(tab, parsed\.args, req\)/, "native /export should run through the Web UI export helper");
1465
+ assert.match(server, /nativeExportDownloadPayload\(\{[\s\S]*localRequest: isLocalRequest\(req\)/, "native /export should condition filesystem disclosure on localhost");
1466
+ assert.match(nativeExportPayload, /\.\.\.\(localRequest \? \{ serverPath: exportedPath, result: responseData \} : \{\}\)/, "remote no-path exports should omit server paths and raw RPC path data");
1356
1467
  assert.match(server, /url\.pathname\.startsWith\("\/api\/native-download\/"\) && req\.method === "GET"/, "native /export should expose short-lived opaque download URLs");
1357
1468
  assert.match(app, /function triggerNativeDownload\(download\)/, "frontend should be able to start native command downloads");
1358
- assert.match(app, /function openNativeExportDownloadPrompt\(download\)/, "frontend should prompt before opening /export HTML in the browser");
1469
+ assert.match(app, /function openNativeExportDownloadPrompt\(download, serverPath = ""\)[\s\S]*Copy path[\s\S]*copyText\(savedPath\)/, "frontend should show and copy the saved /export HTML path");
1359
1470
  assert.match(app, /function alternateLoopbackBrowserUrl\(value\)/, "frontend should avoid reopening exports inside the installed PWA when possible");
1360
1471
  assert.match(app, /function safeHttpUrl\(value/, "frontend should validate server-provided URLs through a shared helper");
1361
1472
  assert.match(app, /const url = safeHttpUrl\(download\?\.url\)/, "native downloads must reject non-http(s) URL schemes");
@@ -0,0 +1,26 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { nativeExportDownloadPayload } from "../lib/native-export-payload.mjs";
4
+
5
+ const exportedPath = "/private/server/session-export.html";
6
+ const download = {
7
+ fileName: "session-export.html",
8
+ url: "/api/native-download/opaque-token",
9
+ openUrl: "http://localhost/api/native-download/opaque-token?open=1",
10
+ expiresAt: "2030-01-01T00:00:00.000Z",
11
+ };
12
+
13
+ test("localhost export responses include the absolute server path", () => {
14
+ const payload = nativeExportDownloadPayload({ localRequest: true, exportedPath, download, responseData: { path: exportedPath } });
15
+ assert.equal(payload.serverPath, exportedPath);
16
+ assert.equal(payload.result.path, exportedPath);
17
+ assert.match(payload.message, /Saved to: \/private\/server\/session-export\.html/);
18
+ });
19
+
20
+ test("remote no-path exports disclose only the opaque download response", () => {
21
+ const payload = nativeExportDownloadPayload({ localRequest: false, exportedPath, download, responseData: { path: exportedPath } });
22
+ assert.equal("serverPath" in payload, false);
23
+ assert.equal("result" in payload, false);
24
+ assert.doesNotMatch(payload.message, /private|serverPath|Saved to/);
25
+ assert.equal(payload.download.url, "/api/native-download/opaque-token");
26
+ });
@@ -129,7 +129,7 @@ for (const target of ["state", "tabs", "commands", "themes", "workspace"]) {
129
129
  }
130
130
 
131
131
  const slashCommands = nativeSlashCommandEntries(parity);
132
- assert.equal(slashCommands.length, 25);
132
+ assert.equal(slashCommands.length, 26);
133
133
  assert.equal(slashCommands[0].name, "settings");
134
134
  assert.equal(slashCommands.at(-1).name, "quit");
135
135
 
@@ -53,6 +53,7 @@ const slashSurfaces = parity.surfaces.filter((surface) => surface.kind === "slas
53
53
  const slashCommandNames = slashSurfaces.map((surface) => surface.command?.name).filter(Boolean);
54
54
  const requiredNativeCommands = [
55
55
  "settings",
56
+ "safety-guard-setup",
56
57
  "git-workflow-setup",
57
58
  "model",
58
59
  "theme",
@@ -139,6 +140,13 @@ assert.match(server, /url\.pathname === "\/api\/tools" && req\.method === "GET"/
139
140
  assert.match(server, /url\.pathname === "\/api\/tools" && req\.method === "POST"/, "server should expose POST /api/tools for native /tools updates");
140
141
  assert.match(server, /url\.pathname === "\/api\/skills" && req\.method === "GET"/, "server should expose GET /api/skills for native /skills");
141
142
  assert.match(server, /url\.pathname === "\/api\/skills" && req\.method === "POST"/, "server should expose POST /api/skills for native /skills updates");
143
+ assert.match(server, /function requireResourceScope\(value\)[\s\S]*scope !== "session" && scope !== "global"/, "resource APIs should accept only session and global scopes");
144
+ assert.match(server, /writeWebuiSettings\(\{ resourceDefaults: \{ tools: \{ enabledTools \} \} \}\)/, "global tool choices should persist in Web UI settings");
145
+ assert.match(server, /writeWebuiSettings\(\{ resourceDefaults: \{ skills: \{ enabledSkills \} \} \}\)/, "global skill choices should persist in Web UI settings");
146
+ assert.match(app, /function nativeResourceScopeControl\(scope,[\s\S]*Session only[\s\S]*Global default/, "Tools and Skills Setup should expose session/global scope choices");
147
+ assert.match(app, /body: \{ enabledTools: \[\.\.\.enabledTools\], scope \}/, "Tools Setup should submit its selected persistence scope");
148
+ assert.match(app, /body: \{ enabledSkills: \[\.\.\.enabledSkills\], scope \}/, "Skills Setup should submit its selected persistence scope");
149
+ assert.match(app, /Future sessions inherit it; this session is unchanged\./, "global selector feedback should explain precedence");
142
150
  assert.match(app, /const HIDDEN_COMMAND_NAMES = new Set\(\["webui-tree-navigate", "webui-helper"\]\)/, "frontend should hide Web UI internal helper commands");
143
151
  assert.match(app, /"scoped-models", "tools", "skills"/, "frontend native selector commands should include /tools and /skills");
144
152
  assert.match(app, /return match \? match\[1\]\.toLowerCase\(\) : ""/, "frontend native slash command matching should be case-insensitive");
@@ -149,13 +157,14 @@ assert.match(server, /url\.pathname\.startsWith\("\/api\/native-download\/"\) &&
149
157
  assert.match(server, /case "export": \{\n\s+return handleNativeExportCommand\(tab, parsed\.args, req\);\n\s+\}/, "native /export should route through the native command adapter");
150
158
  assert.match(server, /tab\.rpc\.send\(\{ type: "export_html", outputPath \}\)/, "no-path /export should use RPC export_html into a controlled temp path");
151
159
  assert.match(server, /registerNativeDownload\(exportedPath/, "no-path /export should return a short-lived browser download token");
160
+ assert.match(server, /nativeExportDownloadPayload\(\{[\s\S]*localRequest: isLocalRequest\(req\)/, "no-path /export should disclose the saved HTML path only to localhost requests");
152
161
  assert.match(server, /openUrl: record\.contentType === MIME_TYPES\.get\("\.html"\)/, "HTML native downloads should expose a browser-open URL");
153
162
  assert.match(server, /url\.searchParams\.get\("disposition"\) === "inline"/, "native download endpoint should support inline HTML rendering");
154
163
  assert.match(server, /copyFile\(sessionFile, targetPath\)/, "explicit .jsonl /export should copy the active session file");
155
164
  assert.match(app, /function triggerNativeDownload\(download\)/, "frontend should know how to trigger native command downloads");
156
165
  assert.match(app, /function applyNativeSlashCommandEffects\(response, message, tabContext/, "frontend should apply centralized native slash-command adapter effects");
157
- assert.match(app, /data\.download && handleNativeDownloadResponse\(data\.download, data\.command\)/, "frontend should route native downloads through command-specific handling");
158
- assert.match(app, /function openNativeExportDownloadPrompt\(download\)[\s\S]*Open in browser/, "frontend should ask Web UI users to open /export results in the browser");
166
+ assert.match(app, /data\.download && handleNativeDownloadResponse\(data\.download, data\.command, data\.serverPath\)/, "frontend should route native downloads and their saved path through command-specific handling");
167
+ assert.match(app, /function openNativeExportDownloadPrompt\(download, serverPath = ""\)[\s\S]*Saved to:\\n[\s\S]*Copy path[\s\S]*copyText\(savedPath\)[\s\S]*Open in browser/, "frontend should show and copy the saved /export HTML path before offering browser open");
159
168
  assert.match(app, /function alternateLoopbackBrowserUrl\(value\)[\s\S]*hostname === "localhost"[\s\S]*127\.0\.0\.1/, "PWA export opens should escape same-origin app scope via alternate loopback host");
160
169
  assert.match(app, /for \(const warning of response\.warnings/, "frontend should surface remote bash trust warnings");
161
170
  assert.match(server, /case "\/api\/bash": \{[\s\S]*?return \{ type: "bash", command, excludeFromContext: body\.excludeFromContext === true \}/, "server should expose RPC bash with include/exclude context semantics");