@firstpick/pi-package-webui 0.8.0 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +34 -5
  2. package/bin/pi-webui.mjs +606 -102
  3. package/lib/component-update-state.mjs +126 -0
  4. package/lib/npm-command.mjs +81 -0
  5. package/lib/queue-mutation.mjs +6 -0
  6. package/lib/trust-boundaries.mjs +1 -0
  7. package/lib/workspace-files-live-watcher.mjs +138 -0
  8. package/package.json +8 -3
  9. package/public/app.js +4231 -376
  10. package/public/index.html +265 -52
  11. package/public/mobile-shell-state.mjs +166 -0
  12. package/public/service-worker.js +60 -13
  13. package/public/styles.css +1790 -383
  14. package/public/subagent-gate-visibility.mjs +16 -0
  15. package/public/subagent-launch-slot-state.mjs +16 -0
  16. package/public/transcript-renderer.mjs +433 -0
  17. package/tests/boot-failure-diagnostics.test.mjs +63 -5
  18. package/tests/browser/control-deck-component-updates.spec.mjs +180 -0
  19. package/tests/browser/interaction-continuity.spec.mjs +897 -0
  20. package/tests/browser/mobile-foundation.spec.mjs +363 -0
  21. package/tests/browser/optimistic-prompt.spec.mjs +130 -0
  22. package/tests/browser/side-panel-section-reorder.spec.mjs +101 -0
  23. package/tests/browser/stats-overlay.spec.mjs +265 -0
  24. package/tests/chat-scroll-intent-static.test.mjs +6 -1
  25. package/tests/codex-fast-mode-static.test.mjs +8 -5
  26. package/tests/compact-sections-static.test.mjs +20 -2
  27. package/tests/compaction-mutation-contract.test.mjs +18 -4
  28. package/tests/compaction-static.test.mjs +1 -0
  29. package/tests/completion-signal-contract.test.mjs +13 -2
  30. package/tests/component-update-api-static.test.mjs +67 -0
  31. package/tests/component-update-state.test.mjs +80 -0
  32. package/tests/control-deck-component-updates-static.test.mjs +251 -0
  33. package/tests/fast-mode-client-static.test.mjs +7 -4
  34. package/tests/fixtures/fake-pi.mjs +305 -2
  35. package/tests/footer-provider-usage-visual-static.test.mjs +71 -0
  36. package/tests/git-panel-gitignore-static.test.mjs +104 -0
  37. package/tests/http-endpoints-harness.test.mjs +228 -2
  38. package/tests/interaction-state-stability-static.test.mjs +271 -0
  39. package/tests/mobile-continuity-tablet-static.test.mjs +55 -0
  40. package/tests/mobile-foundation-static.test.mjs +71 -0
  41. package/tests/mobile-phone-experience-static.test.mjs +65 -0
  42. package/tests/mobile-shell-state.test.mjs +69 -0
  43. package/tests/mobile-static.test.mjs +246 -39
  44. package/tests/mobile-transcript-cache-characterization.test.mjs +34 -0
  45. package/tests/native-parity-harness.test.mjs +2 -0
  46. package/tests/npm-command.test.mjs +64 -1
  47. package/tests/open-issue-wizard-static.test.mjs +2 -1
  48. package/tests/queue-edit-reorder-static.test.mjs +9 -1
  49. package/tests/queue-mutation-contract.test.mjs +22 -0
  50. package/tests/service-worker-lifecycle.test.mjs +120 -0
  51. package/tests/side-panel-section-reorder-static.test.mjs +68 -0
  52. package/tests/sse-backpressure-harness.test.mjs +137 -0
  53. package/tests/stats-dashboard-static.test.mjs +266 -0
  54. package/tests/streaming-ui-coupling.test.mjs +7 -1
  55. package/tests/subagent-gate-visibility.test.mjs +18 -2
  56. package/tests/subagent-launch-slot-state.test.mjs +32 -0
  57. package/tests/subagent-launch-slots-static.test.mjs +8 -2
  58. package/tests/subagents-helper.test.mjs +90 -0
  59. package/tests/terminal-tab-workspace-static.test.mjs +1 -1
  60. package/tests/update-commands.test.mjs +4 -0
  61. package/tests/workspace-files-live-updates-static.test.mjs +76 -0
  62. package/tests/workspace-files-live-watcher.test.mjs +95 -0
  63. package/webui-rpc-helper.mjs +175 -3
package/public/index.html CHANGED
@@ -12,7 +12,7 @@
12
12
  <link rel="manifest" href="/manifest.webmanifest" />
13
13
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
14
14
  <link rel="apple-touch-icon" href="/apple-touch-icon.png" />
15
- <link rel="stylesheet" href="/styles.css?v=86" />
15
+ <link rel="stylesheet" href="/styles.css?v=93" />
16
16
  <script>
17
17
  // Public-only issue-bot runtime configuration. Keep disabled unless the gateway,
18
18
  // Turnstile site key, exact CORS origin, and private-report destination are approved.
@@ -126,6 +126,52 @@
126
126
  </div>
127
127
  </section>
128
128
 
129
+ <!-- Flagged phone/tablet shell: route content reuses the canonical nodes below. -->
130
+ <div id="mobileShellV2" class="mobile-shell-v2" hidden>
131
+ <p id="mobileLifecycleAnnouncer" class="sr-only" role="status" aria-live="polite" aria-atomic="true"></p>
132
+ <p id="mobileContinuityNotice" class="mobile-continuity-notice" role="status" hidden></p>
133
+ <header class="mobile-shell-appbar" aria-label="Phone app bar">
134
+ <button id="mobileSessionButton" class="mobile-shell-session-button" type="button" aria-label="Open Sessions"><span id="mobileSessionStatus" aria-hidden="true">○</span><span id="mobileSessionTitle">Session</span></button>
135
+ <div id="mobileShellIndicators" class="mobile-shell-indicators" role="group" aria-label="Connection and attention status"></div>
136
+ <button id="mobileSearchButton" class="mobile-shell-icon-button" type="button" aria-label="Open command palette">Search</button>
137
+ <button id="mobileMoreButton" class="mobile-shell-icon-button" type="button" aria-expanded="false" aria-controls="mobileShellSurface">More</button>
138
+ </header>
139
+ <div id="mobileShellDestination" class="mobile-shell-destination" tabindex="-1">
140
+ <section id="mobileSessionsRoute" class="mobile-route" data-mobile-route="sessions" aria-labelledby="mobileSessionsTitle" hidden>
141
+ <header class="mobile-route-header"><h1 id="mobileSessionsTitle" tabindex="-1">Sessions</h1><button id="mobileSessionsCloseAllButton" type="button">Close all</button></header>
142
+ <div class="mobile-session-actions" aria-label="New session actions">
143
+ <button id="mobileNewCurrentDirectoryButton" class="primary" type="button">New here</button><button id="mobileNewDirectoryButton" type="button">Choose folder</button><button id="mobileNewWorktreeButton" type="button">Worktree</button><button id="mobileResumeSessionButton" type="button">Resume</button>
144
+ </div>
145
+ <label class="mobile-search-field" for="mobileSessionsSearchInput">Search sessions<input id="mobileSessionsSearchInput" type="search" placeholder="Search sessions" autocomplete="off" /></label>
146
+ <p id="mobileSessionsStatus" class="mobile-route-status muted" role="status"></p>
147
+ <div id="mobileSessionsList" class="mobile-session-list"></div>
148
+ </section>
149
+ <section id="mobileActivityRoute" class="mobile-route" data-mobile-route="activity" aria-labelledby="mobileActivityTitle" hidden>
150
+ <header class="mobile-route-header"><h1 id="mobileActivityTitle" tabindex="-1">Activity</h1><button id="mobileActivityRefreshButton" type="button">Refresh</button></header>
151
+ <p id="mobileActivityStatus" class="mobile-route-status muted" role="status"></p>
152
+ <div id="mobileActivityList" class="mobile-activity-list"></div>
153
+ </section>
154
+ <section id="mobileProjectRoute" class="mobile-route" data-mobile-route="project" aria-labelledby="mobileProjectTitle" hidden>
155
+ <header class="mobile-route-header"><h1 id="mobileProjectTitle" tabindex="-1">Project</h1><span id="mobileProjectName" class="muted"></span></header>
156
+ <div id="mobileProjectTopics" class="mobile-topic-tabs" role="tablist" aria-label="Project topics">
157
+ <button type="button" role="tab" data-mobile-project-topic="files">Files</button><button type="button" role="tab" data-mobile-project-topic="git">Git</button><button type="button" role="tab" data-mobile-project-topic="queue">Queue</button><button type="button" role="tab" data-mobile-project-topic="workflows">Workflows</button>
158
+ </div>
159
+ <section id="mobileProjectContent" class="mobile-canonical-host" aria-live="off"></section>
160
+ </section>
161
+ </div>
162
+ <nav class="mobile-shell-nav" aria-label="Phone destinations">
163
+ <button type="button" data-mobile-route-button="chat"><span aria-hidden="true">●</span>Chat</button>
164
+ <button type="button" data-mobile-route-button="sessions"><span aria-hidden="true">▤</span>Sessions<span id="mobileSessionsBadge" class="mobile-nav-badge" hidden></span></button>
165
+ <button type="button" data-mobile-route-button="activity"><span aria-hidden="true">◌</span>Activity<span id="mobileActivityBadge" class="mobile-nav-badge" hidden></span></button>
166
+ <button type="button" data-mobile-route-button="project"><span aria-hidden="true">▣</span>Project<span id="mobileProjectBadge" class="mobile-nav-badge" hidden></span></button>
167
+ </nav>
168
+ <section id="mobileShellSurface" class="mobile-shell-surface" aria-label="Mobile actions" hidden>
169
+ <header class="mobile-surface-header"><button id="mobileSurfaceBackButton" type="button" hidden>Back</button><h1 id="mobileSurfaceTitle" tabindex="-1">More</h1><button id="mobileSurfaceCloseButton" type="button">Close</button></header>
170
+ <div id="mobileSurfaceRoot" class="mobile-surface-root"></div>
171
+ <section id="mobileSurfaceContent" class="mobile-canonical-host" aria-live="off"></section>
172
+ </section>
173
+ </div>
174
+
129
175
  <main class="layout">
130
176
  <section class="chat-panel">
131
177
  <header class="terminal-tabs-shell">
@@ -141,10 +187,10 @@
141
187
  </div>
142
188
  </div>
143
189
  <div class="terminal-sidebar-actions" aria-label="Tab and workspace actions">
144
- <button id="splitTabButton" class="terminal-split-button" type="button" aria-label="Split the active terminal to the right" aria-pressed="false"><svg class="terminal-split-icon terminal-split-icon-split" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M15 12h4m0 0-2-2m2 2-2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><svg class="terminal-split-icon terminal-split-icon-unsplit" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M19 12h-4m0 0 2-2m-2 2 2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><span class="terminal-sidebar-action-label terminal-sidebar-action-label-split">Split</span><span class="terminal-sidebar-action-label terminal-sidebar-action-label-unsplit">Unsplit</span></button>
145
- <button id="workspaceSaveButton" class="terminal-workspace-save-button" type="button" aria-label="Save workspace" data-tooltip="Save workspace:&#10;• Captures all open tabs, sessions, order, custom groups, and the active tab.&#10;• Available when at least one tab is open."><svg class="terminal-workspace-save-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 4h11l3 3v13H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M8 4v6h7V4M8 19v-5h8v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg><span class="terminal-sidebar-action-label">Save workspace</span></button>
146
- <button id="commandPaletteButton" class="terminal-command-palette-button" type="button" aria-label="Open command palette" data-tooltip="Command palette:&#10;• Search and run actions, slash commands, models, and tabs.&#10;• Shortcut: Ctrl/Cmd+K."><svg class="composer-icon command-palette-launcher-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 7.5h14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 12h9" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 16.5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M17 14.5 19.5 17 17 19.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><span class="terminal-sidebar-action-label">Commands</span></button>
147
- <button id="workspaceDashboardToggleButton" class="terminal-dashboard-button" type="button" aria-controls="workspaceDashboard" aria-expanded="false" aria-label="Show workspace overview" data-tooltip="Workspace overview:&#10;• Shows current tab, cwd, model, context, session, and queue.&#10;• Opens common workspace/session actions from one place."><svg class="composer-icon workspace-overview-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 11.4 12 4l8 7.4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.5 10.5V20h11v-9.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 20v-5h4v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><span class="terminal-sidebar-action-label">Overview</span></button>
190
+ <button id="splitTabButton" class="terminal-split-button" type="button" aria-label="Split the active terminal to the right" aria-pressed="false"><svg class="terminal-split-icon terminal-split-icon-split" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M15 12h4m0 0-2-2m2 2-2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg><svg class="terminal-split-icon terminal-split-icon-unsplit" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><rect x="4" y="5" width="16" height="14" rx="2" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 5v14M19 12h-4m0 0 2-2m-2 2 2 2" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
191
+ <button id="workspaceSaveButton" class="terminal-workspace-save-button" type="button" aria-label="Save workspace" data-tooltip="Save workspace:&#10;• Captures all open tabs, sessions, order, custom groups, and the active tab.&#10;• Available when at least one tab is open."><svg class="terminal-workspace-save-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 4h11l3 3v13H5z" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/><path d="M8 4v6h7V4M8 19v-5h8v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/></svg></button>
192
+ <button id="commandPaletteButton" class="terminal-command-palette-button" type="button" aria-label="Open command palette" data-tooltip="Command palette:&#10;• Search and run actions, slash commands, models, and tabs.&#10;• Shortcut: Ctrl/Cmd+K."><svg class="composer-icon command-palette-launcher-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M5 7.5h14" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 12h9" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M5 16.5h5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><path d="M17 14.5 19.5 17 17 19.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
193
+ <button id="workspaceDashboardToggleButton" class="terminal-dashboard-button" type="button" aria-controls="workspaceDashboard" aria-expanded="false" aria-label="Show workspace overview" data-tooltip="Workspace overview:&#10;• Shows current tab, cwd, model, context, session, and queue.&#10;• Opens common workspace/session actions from one place."><svg class="composer-icon workspace-overview-icon" viewBox="0 0 24 24" aria-hidden="true" focusable="false"><path d="M4 11.4 12 4l8 7.4" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M6.5 10.5V20h11v-9.5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 20v-5h4v5" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg></button>
148
194
  </div>
149
195
  <div id="remoteAccessIndicator" class="remote-access-indicator" role="status" aria-live="polite" hidden>Remote access open</div>
150
196
  <button id="closeAllTabsButton" class="terminal-close-all-button" type="button" aria-label="Close all terminal tabs">Close all Tabs</button>
@@ -166,6 +212,40 @@
166
212
  </header>
167
213
  <div id="subagentTerminalTranscript" class="subagent-terminal-transcript" role="log" aria-live="polite"></div>
168
214
  <p id="subagentTerminalStatus" class="subagent-terminal-status muted" aria-live="off"></p>
215
+ <footer id="subagentTerminalCards" class="subagent-terminal-cards" aria-label="Subagent session telemetry">
216
+ <dl class="subagent-terminal-card-list">
217
+ <div class="subagent-terminal-card" data-subagent-card="pi" title="Initial Pi prompt tokens injected into this child session.">
218
+ <span class="subagent-terminal-card-icon" aria-hidden="true">π</span>
219
+ <dt class="subagent-terminal-card-label">PI</dt>
220
+ <dd id="subagentTerminalCardPi" class="subagent-terminal-card-value">—</dd>
221
+ </div>
222
+ <div class="subagent-terminal-card" data-subagent-card="speed" title="Output tokens per second across completed child responses.">
223
+ <span class="subagent-terminal-card-icon" aria-hidden="true">⚡</span>
224
+ <dt class="subagent-terminal-card-label">Speed</dt>
225
+ <dd id="subagentTerminalCardSpeed" class="subagent-terminal-card-value">—</dd>
226
+ </div>
227
+ <div class="subagent-terminal-card" data-subagent-card="context" title="Latest child context load over its model context window.">
228
+ <span class="subagent-terminal-card-icon" aria-hidden="true">🧠</span>
229
+ <dt class="subagent-terminal-card-label">Context</dt>
230
+ <dd id="subagentTerminalCardContext" class="subagent-terminal-card-value">—</dd>
231
+ </div>
232
+ <div class="subagent-terminal-card" data-subagent-card="model" title="Effective model for this child run.">
233
+ <span class="subagent-terminal-card-icon" aria-hidden="true">🤖</span>
234
+ <dt class="subagent-terminal-card-label">Model</dt>
235
+ <dd id="subagentTerminalCardModel" class="subagent-terminal-card-value">unknown</dd>
236
+ </div>
237
+ <div class="subagent-terminal-card" data-subagent-card="effort" title="Effective reasoning effort for this child run.">
238
+ <span class="subagent-terminal-card-icon" aria-hidden="true">⚙</span>
239
+ <dt class="subagent-terminal-card-label">Effort</dt>
240
+ <dd id="subagentTerminalCardEffort" class="subagent-terminal-card-value">unknown</dd>
241
+ </div>
242
+ <div class="subagent-terminal-card" data-subagent-card="tokens" title="Input and output tokens found in the bounded recent child-session scan.">
243
+ <span class="subagent-terminal-card-icon" aria-hidden="true">🪙</span>
244
+ <dt class="subagent-terminal-card-label">Tokens</dt>
245
+ <dd id="subagentTerminalCardTokens" class="subagent-terminal-card-value">—</dd>
246
+ </div>
247
+ </dl>
248
+ </footer>
169
249
  <div class="subagent-terminal-composer" aria-label="Subagent input unavailable">
170
250
  <textarea id="subagentTerminalInput" rows="1" placeholder="View only — send messages from the parent terminal" aria-describedby="subagentTerminalInputHint" disabled></textarea>
171
251
  <button type="button" disabled>View only</button>
@@ -203,6 +283,11 @@
203
283
  <div id="gitWorkflowActions" class="git-workflow-actions"></div>
204
284
  </section>
205
285
  <form id="composer" class="composer">
286
+ <section id="mobileFailedSendRecovery" class="mobile-failed-send-recovery" role="status" hidden>
287
+ <span><strong>Not sent.</strong> Pi did not confirm this request. It will never retry automatically.</span>
288
+ <button id="mobileFailedSendRetryButton" type="button">Retry</button>
289
+ <button id="mobileFailedSendDiscardButton" type="button">Discard</button>
290
+ </section>
206
291
  <div id="commandSuggest" class="command-suggest" role="listbox" aria-label="Command and path suggestions" hidden></div>
207
292
  <div class="composer-input-row">
208
293
  <div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls" hidden>
@@ -523,7 +608,7 @@
523
608
  <strong class="side-panel-title">Control Deck</strong>
524
609
  <div class="side-panel-version-row" aria-label="Version and build information">
525
610
  <button id="piVersionButton" class="pi-version-button" type="button" aria-label="View Pi release notes" aria-haspopup="dialog" aria-controls="piReleaseNotesDialog" hidden></button>
526
- <button id="webuiVersionButton" class="webui-version-button" type="button" aria-label="Open Pi Web UI package page" aria-haspopup="dialog" aria-controls="confirmationDialog" hidden></button>
611
+ <button id="webuiVersionButton" class="webui-version-button" type="button" aria-label="Open Pi Web UI package and update details" aria-haspopup="dialog" aria-controls="webuiPackageDialog" hidden></button>
527
612
  <span id="webuiDevBadge" class="webui-dev-badge" aria-label="Pi Web UI dev server" hidden>DEV</span>
528
613
  </div>
529
614
  </div>
@@ -544,13 +629,13 @@
544
629
  </h2>
545
630
  <div id="sidePanelSectionControls" class="side-panel-section-content" hidden>
546
631
  <div class="side-panel-controls">
547
- <p class="controls-intro">Session controls affect the active Pi tab. Interface preferences are saved in this browser. Output processing is a shared server default.</p>
632
+ <p class="controls-intro">Settings apply to this tab, this browser, or the server.</p>
548
633
 
549
634
  <section class="control-group" aria-labelledby="sessionControlsTitle">
550
635
  <div class="control-group-header">
551
636
  <div class="control-group-heading">
552
637
  <h3 id="sessionControlsTitle">Active session</h3>
553
- <p>Choose how Pi responds in the current tab.</p>
638
+ <p>Model, effort, and transcript.</p>
554
639
  </div>
555
640
  <span class="control-scope-badge">This tab</span>
556
641
  </div>
@@ -603,7 +688,7 @@
603
688
  <div class="control-group-header">
604
689
  <div class="control-group-heading">
605
690
  <h3 id="interfaceControlsTitle">Interface</h3>
606
- <p>Personalise layout, appearance, and alerts.</p>
691
+ <p>Layout, theme, and alerts.</p>
607
692
  </div>
608
693
  <span class="control-scope-badge">This browser</span>
609
694
  </div>
@@ -658,7 +743,7 @@
658
743
  <div class="control-group-header">
659
744
  <div class="control-group-heading">
660
745
  <h3 id="outputProcessingControlsTitle">Output processing</h3>
661
- <p>Choose the default live-output path for auto-negotiated Web UI connections.</p>
746
+ <p>Default rendering for new Web UI connections.</p>
662
747
  </div>
663
748
  <span class="control-scope-badge">Server</span>
664
749
  </div>
@@ -682,7 +767,7 @@
682
767
  <div class="control-group-header">
683
768
  <div class="control-group-heading">
684
769
  <h3 id="remoteAccessControlsTitle">Remote access</h3>
685
- <p>Control trusted-LAN access and PIN protection.</p>
770
+ <p>LAN access and PIN protection.</p>
686
771
  </div>
687
772
  <span class="control-scope-badge warning">Network</span>
688
773
  </div>
@@ -704,7 +789,7 @@
704
789
  <div class="control-group-header">
705
790
  <div class="control-group-heading">
706
791
  <h3 id="serverControlsTitle">Server</h3>
707
- <p>Maintenance actions may interrupt every open tab.</p>
792
+ <p>Maintenance actions affect every open tab.</p>
708
793
  </div>
709
794
  <span class="control-scope-badge danger">System</span>
710
795
  </div>
@@ -795,13 +880,14 @@
795
880
  </button>
796
881
  </h2>
797
882
  <div id="sidePanelSectionCodexUsage" class="side-panel-section-content" hidden>
883
+ <div class="codex-usage-actions">
884
+ <button id="refreshCodexUsageButton" type="button">Refresh usage</button>
885
+ </div>
886
+ <div id="codexUsageBox" class="codex-usage-box muted">Checking Codex usage…</div>
798
887
  <div class="control-field codex-fast-mode-control" aria-labelledby="codexFastModeLabel">
799
- <div class="control-field-header">
800
- <label id="codexFastModeLabel" for="codexFastModeSelect">Fast mode</label>
801
- <span class="control-field-context">Subscription-backed Codex requests · This tab</span>
802
- </div>
803
- <div class="control-action-row">
804
- <select id="codexFastModeSelect" title="Codex subscription request tier" aria-describedby="codexFastModeStatus" disabled>
888
+ <div class="codex-fast-mode-row">
889
+ <label id="codexFastModeLabel" for="codexFastModeSelect" title="Fast mode for subscription-backed Codex requests on this tab">Fast mode</label>
890
+ <select id="codexFastModeSelect" title="Codex subscription request tier for this tab" aria-describedby="codexFastModeStatus" disabled>
805
891
  <option value="normal">Normal</option>
806
892
  <option value="fast">Fast</option>
807
893
  </select>
@@ -809,10 +895,6 @@
809
895
  </div>
810
896
  <div id="codexFastModeStatus" class="toggle-control-hint" role="status" aria-live="polite">Checking Codex Fast mode…</div>
811
897
  </div>
812
- <div class="codex-usage-actions">
813
- <button id="refreshCodexUsageButton" type="button">Refresh usage</button>
814
- </div>
815
- <div id="codexUsageBox" class="codex-usage-box muted">Checking Codex usage…</div>
816
898
  </div>
817
899
  </section>
818
900
  <section class="side-panel-section collapsed" data-side-panel-section="claude-usage">
@@ -862,8 +944,8 @@
862
944
  </summary>
863
945
  <div class="subagent-launch-slots-body">
864
946
  <div class="subagent-launch-slots-intro">
865
- <p>Choose model and thinking presets for future same-role launches. Running children are not changed.</p>
866
- <button id="subagentLaunchSlotsRefresh" type="button">Refresh models</button>
947
+ <p>Presets for future launches; running children stay unchanged.</p>
948
+ <button id="subagentLaunchSlotsRefresh" type="button" aria-label="Refresh available agent models">Refresh</button>
867
949
  </div>
868
950
  <div class="subagent-launch-slot-scope">
869
951
  <label for="subagentLaunchSlotScope">Apply to</label>
@@ -877,8 +959,8 @@
877
959
  <p id="subagentLaunchSlotsStatus" class="subagent-launch-slots-status muted" role="status" aria-live="polite">Loading agent models…</p>
878
960
  <div id="subagentLaunchSlotRoles" class="subagent-launch-slot-roles" aria-busy="true"></div>
879
961
  <div class="subagent-launch-slots-actions">
880
- <button id="subagentLaunchSlotsSave" class="primary" type="button" disabled>Save agent models</button>
881
- <span id="subagentLaunchSlotsDirty" class="muted">No unsaved changes</span>
962
+ <button id="subagentLaunchSlotsSave" class="primary" type="button" aria-describedby="subagentLaunchSlotsDirty" disabled>Save agent models</button>
963
+ <span id="subagentLaunchSlotsDirty" class="muted" role="status" aria-live="polite">Agent model configuration is not available for this tab.</span>
882
964
  </div>
883
965
  <div id="subagentLaunchSlotsReloadActions" class="subagent-launch-slots-reload-actions" hidden>
884
966
  <span>Saved changes apply to future launches after this tab reloads.</span>
@@ -896,7 +978,10 @@
896
978
  </select>
897
979
  <span id="subagentOpenModeStatus" class="muted">Overlay · saved in this browser</span>
898
980
  </div>
899
- <p id="subagentsStatus" class="subagents-status muted" role="status" aria-live="polite">Checking running subagents…</p>
981
+ <div class="subagents-status-row">
982
+ <p id="subagentsStatus" class="subagents-status muted" role="status" aria-live="polite">Checking running subagents…</p>
983
+ <button id="subagentsClearFinishedButton" class="subagents-clear-finished-button" type="button" aria-describedby="subagentsStatus" disabled>Clear finished</button>
984
+ </div>
900
985
  <div id="subagentsBox" class="subagents-box muted">Checking running subagents…</div>
901
986
  </div>
902
987
  </section>
@@ -1020,6 +1105,10 @@
1020
1105
  <button id="piReleaseNotesCloseButton" type="button" aria-label="Close Pi release notes">Close</button>
1021
1106
  </div>
1022
1107
  <p id="piReleaseNotesStatus" class="pi-release-notes-status muted" role="status" aria-live="polite"></p>
1108
+ <section class="component-update-panel" aria-label="Pi background update">
1109
+ <p id="piComponentUpdateStatus" class="component-update-status muted" role="status" aria-live="polite"></p>
1110
+ <button id="piComponentUpdateButton" class="component-update-button primary" type="button">Update Pi</button>
1111
+ </section>
1023
1112
  <div id="piReleaseNotesBody" class="pi-release-notes-body markdown-body"></div>
1024
1113
  <menu>
1025
1114
  <a id="piReleaseNotesGithubLink" class="pi-release-notes-link" target="_blank" rel="noopener noreferrer" hidden>View on GitHub</a>
@@ -1028,6 +1117,34 @@
1028
1117
  </form>
1029
1118
  </dialog>
1030
1119
 
1120
+ <dialog id="webuiPackageDialog" class="extension-dialog webui-package-dialog" aria-labelledby="webuiPackageTitle">
1121
+ <form method="dialog">
1122
+ <div class="webui-package-header">
1123
+ <div>
1124
+ <span class="webui-package-kicker">Web UI package</span>
1125
+ <h2 id="webuiPackageTitle">Pi Web UI package</h2>
1126
+ </div>
1127
+ <button id="webuiPackageCloseButton" type="button" aria-label="Close Web UI package details">Close</button>
1128
+ </div>
1129
+ <dl class="webui-package-versions">
1130
+ <div class="webui-package-version-row">
1131
+ <dt>Installed</dt>
1132
+ <dd id="webuiPackageCurrentVersion">Unknown</dd>
1133
+ </div>
1134
+ <div class="webui-package-version-row">
1135
+ <dt>Latest on npm</dt>
1136
+ <dd id="webuiPackageLatestVersion">Not checked</dd>
1137
+ </div>
1138
+ </dl>
1139
+ <p id="webuiComponentUpdateStatus" class="component-update-status muted" role="status" aria-live="polite"></p>
1140
+ <menu>
1141
+ <button id="webuiPackageNpmButton" class="webui-package-npm-link" type="button">View on npm</button>
1142
+ <button id="webuiComponentUpdateButton" class="component-update-button primary" type="button">Update Web UI</button>
1143
+ <button value="close">Close</button>
1144
+ </menu>
1145
+ </form>
1146
+ </dialog>
1147
+
1031
1148
  <dialog id="confirmationDialog" class="extension-dialog confirmation-dialog">
1032
1149
  <form method="dialog">
1033
1150
  <h2 id="confirmationTitle">Confirm action</h2>
@@ -1180,7 +1297,7 @@
1180
1297
  </div>
1181
1298
  <p id="statsOverlayStatus" class="stats-overlay-status muted" role="status" aria-live="polite" hidden></p>
1182
1299
  <div id="statsOverlayTabs" class="stats-overlay-tabs" role="tablist" aria-label="Stats dashboard views"></div>
1183
- <div id="statsOverlayBody" class="stats-overlay-body"></div>
1300
+ <div id="statsOverlayBody" class="stats-overlay-body" role="tabpanel" tabindex="0"></div>
1184
1301
  </form>
1185
1302
  </dialog>
1186
1303
 
@@ -1383,7 +1500,7 @@
1383
1500
  </form>
1384
1501
  </dialog>
1385
1502
 
1386
- <script id="webuiBootLoader" data-app-src="/app.js?v=94">
1503
+ <script id="webuiBootLoader" data-app-src="/app.js?v=104">
1387
1504
  (() => {
1388
1505
  "use strict";
1389
1506
 
@@ -1396,6 +1513,8 @@
1396
1513
  const copyStatus = document.querySelector("#webuiBootFailureCopyStatus");
1397
1514
  const appSource = loader?.dataset?.appSrc || "/app.js";
1398
1515
  const bootStartedAt = new Date();
1516
+ const DIAGNOSTIC_REQUEST_TIMEOUT_MS = 3_000;
1517
+ const JAVASCRIPT_CONTENT_TYPES = ["text/javascript", "application/javascript"];
1399
1518
  let bootSettled = false;
1400
1519
  let bootFailed = false;
1401
1520
  let watchdog = null;
@@ -1422,29 +1541,64 @@
1422
1541
  return boundedSafeText(error);
1423
1542
  }
1424
1543
 
1425
- async function responseSummary(url, label, { parseHealth = false, readSource = false } = {}) {
1544
+ async function responseSummary(url, label, { parseHealth = false, readSource = false, expectedTypes = [] } = {}) {
1426
1545
  const safeUrl = sanitizedUrl(url);
1546
+ const controller = typeof AbortController === "function" ? new AbortController() : null;
1547
+ let timedOut = false;
1548
+ let timeoutId = null;
1427
1549
  try {
1428
- const response = await fetch(url, { cache: "no-store", credentials: "same-origin" });
1429
- const type = String(response.headers?.get?.("content-type") || "unknown").split(";", 1)[0];
1430
- let suffix = "";
1431
- let source = "";
1432
- if (parseHealth && response.ok) {
1433
- const data = await response.clone().json().catch(() => null);
1434
- const fields = [data?.ok === true ? "ok=true" : "", data?.webuiVersion ? `webuiVersion=${boundedSafeText(data.webuiVersion, 80)}` : ""].filter(Boolean);
1435
- if (fields.length) suffix = ` (${fields.join(", ")})`;
1436
- }
1437
- if (readSource && response.ok) source = await response.text();
1438
- else response.body?.cancel?.().catch?.(() => {});
1439
- return { ok: response.ok, status: response.status, type, safeUrl, label, line: `- ${label}: HTTP ${response.status} ${type}${suffix} — ${safeUrl}`, source };
1550
+ const request = (async () => {
1551
+ const response = await fetch(url, { cache: "no-store", credentials: "same-origin", ...(controller ? { signal: controller.signal } : {}) });
1552
+ const type = String(response.headers?.get?.("content-type") || "unknown").split(";", 1)[0].trim().toLowerCase();
1553
+ const contentTypeMismatch = response.ok && expectedTypes.length > 0 && !expectedTypes.includes(type);
1554
+ let suffix = contentTypeMismatch ? ` (expected ${expectedTypes.join(" or ")})` : "";
1555
+ let source = "";
1556
+ let invalidJson = false;
1557
+ if (parseHealth && response.ok) {
1558
+ const data = await response.clone().json().catch(() => null);
1559
+ invalidJson = !data || typeof data !== "object";
1560
+ const fields = [data?.ok === true ? "ok=true" : "", data?.webuiVersion ? `webuiVersion=${boundedSafeText(data.webuiVersion, 80)}` : ""].filter(Boolean);
1561
+ if (fields.length) suffix += ` (${fields.join(", ")})`;
1562
+ if (invalidJson) suffix += " (invalid JSON)";
1563
+ }
1564
+ if (readSource && response.ok) source = await response.text();
1565
+ else response.body?.cancel?.().catch?.(() => {});
1566
+ return {
1567
+ ok: response.ok && !contentTypeMismatch && !invalidJson,
1568
+ status: response.status,
1569
+ type,
1570
+ safeUrl,
1571
+ label,
1572
+ contentTypeMismatch,
1573
+ invalidJson,
1574
+ timedOut: false,
1575
+ line: `- ${label}: HTTP ${response.status} ${type}${suffix} — ${safeUrl}`,
1576
+ source,
1577
+ };
1578
+ })();
1579
+ const timeout = new Promise((_, reject) => {
1580
+ timeoutId = setTimeout(() => {
1581
+ timedOut = true;
1582
+ controller?.abort();
1583
+ const timeoutError = new Error(`Diagnostic request timed out after ${DIAGNOSTIC_REQUEST_TIMEOUT_MS / 1_000} seconds`);
1584
+ timeoutError.name = "DiagnosticTimeoutError";
1585
+ reject(timeoutError);
1586
+ }, DIAGNOSTIC_REQUEST_TIMEOUT_MS);
1587
+ });
1588
+ return await Promise.race([request, timeout]);
1440
1589
  } catch (error) {
1441
- return { ok: false, status: null, type: "unknown", safeUrl, label, line: `- ${label}: request failed (${boundedSafeText(errorText(error), 240)}) — ${safeUrl}`, source: "" };
1590
+ const detail = timedOut
1591
+ ? `diagnostic timed out after ${DIAGNOSTIC_REQUEST_TIMEOUT_MS / 1_000} seconds`
1592
+ : `request failed (${boundedSafeText(errorText(error), 240)})`;
1593
+ return { ok: false, status: null, type: "unknown", safeUrl, label, timedOut, contentTypeMismatch: false, invalidJson: false, line: `- ${label}: ${detail} — ${safeUrl}`, source: "" };
1594
+ } finally {
1595
+ clearTimeout(timeoutId);
1442
1596
  }
1443
1597
  }
1444
1598
 
1445
1599
  async function startupAssetReport() {
1446
1600
  const appUrl = new URL(appSource, window.location.href);
1447
- const app = await responseSummary(appUrl.href, "entry module", { readSource: true });
1601
+ const app = await responseSummary(appUrl.href, "entry module", { readSource: true, expectedTypes: JAVASCRIPT_CONTENT_TYPES });
1448
1602
  if (!app.source) return { probes: [app], lines: [app.line], failures: app.ok ? [] : [app] };
1449
1603
 
1450
1604
  const imported = [];
@@ -1457,15 +1611,30 @@
1457
1611
  if (imported.length >= 24) break;
1458
1612
  }
1459
1613
 
1460
- const importedProbes = await Promise.all(imported.map((item) => responseSummary(item.url, "imported module")));
1614
+ const importedProbes = await Promise.all(imported.map((item) => responseSummary(item.url, "imported module", { expectedTypes: JAVASCRIPT_CONTENT_TYPES })));
1461
1615
  const probes = [app, ...importedProbes];
1462
1616
  return { probes, lines: probes.map((probe) => probe.line), failures: probes.filter((probe) => !probe.ok) };
1463
1617
  }
1464
1618
 
1465
- function startupAssessment(health, assets, error) {
1619
+ async function webManifestReport() {
1620
+ const probe = await responseSummary(new URL("/manifest.webmanifest", window.location.href).href, "optional web manifest", {
1621
+ readSource: true,
1622
+ expectedTypes: ["application/manifest+json", "application/json"],
1623
+ });
1624
+ if (!probe.ok || !probe.source) return { ...probe, validJson: false };
1625
+ try {
1626
+ JSON.parse(probe.source);
1627
+ return { ...probe, validJson: true };
1628
+ } catch (error) {
1629
+ return { ...probe, validJson: false, line: `${probe.line} (invalid JSON: ${boundedSafeText(errorText(error), 160)})` };
1630
+ }
1631
+ }
1632
+
1633
+ function startupAssessment(health, assets, reason, error) {
1466
1634
  const missingImports = assets.failures.filter((probe) => probe.label === "imported module" && probe.status === 404);
1467
1635
  const firstFailure = assets.failures[0] || (!health.ok ? health : null);
1468
1636
  const originalError = boundedSafeText(errorText(error));
1637
+ const failureText = `${boundedSafeText(reason)}\n${originalError}`;
1469
1638
  if (missingImports.length) {
1470
1639
  const paths = missingImports.map((probe) => new URL(probe.safeUrl).pathname);
1471
1640
  return {
@@ -1477,8 +1646,25 @@
1477
1646
  };
1478
1647
  }
1479
1648
  if (firstFailure) {
1649
+ const path = new URL(firstFailure.safeUrl).pathname;
1650
+ if (firstFailure.timedOut) {
1651
+ return {
1652
+ summary: `A diagnostic check timed out while probing ${path}.`,
1653
+ likelyCause: firstFailure.label === "backend health"
1654
+ ? "The browser shell loaded, but the backend or browser network service did not answer the bounded health check."
1655
+ : "The startup asset request remained pending; check the backend, service worker, or browser network state.",
1656
+ failingUrls: [firstFailure.safeUrl],
1657
+ };
1658
+ }
1659
+ if (firstFailure.contentTypeMismatch) {
1660
+ return {
1661
+ summary: `Wrong content type for startup asset ${path}: ${firstFailure.type}.`,
1662
+ likelyCause: "The URL responded, but it did not serve JavaScript with an executable MIME type; a fallback HTML/error response or stale server route is likely.",
1663
+ failingUrls: [firstFailure.safeUrl],
1664
+ };
1665
+ }
1480
1666
  return {
1481
- summary: `Startup request failed: ${new URL(firstFailure.safeUrl).pathname}${firstFailure.status ? ` (HTTP ${firstFailure.status})` : ""}.`,
1667
+ summary: `Startup request failed: ${path}${firstFailure.status ? ` (HTTP ${firstFailure.status})` : ""}.`,
1482
1668
  likelyCause: firstFailure.label === "backend health"
1483
1669
  ? "The browser shell loaded, but the WebUI backend is unavailable or unreachable."
1484
1670
  : "A startup asset is unavailable, blocked, or served with an unsuccessful response.",
@@ -1488,6 +1674,20 @@
1488
1674
  if (/critical stylesheet/i.test(originalError)) {
1489
1675
  return { summary: "The critical stylesheet failed to load.", likelyCause: "The stylesheet request failed even though the startup-module probes succeeded.", failingUrls: [] };
1490
1676
  }
1677
+ if (/\bSyntaxError\b|unexpected token|unexpected identifier|already been declared|invalid or unexpected token|missing[ )\]}]/i.test(failureText)) {
1678
+ return {
1679
+ summary: `JavaScript failed during startup: ${boundedSafeText(originalError, 180)}.`,
1680
+ likelyCause: "The entry module is reachable, but the browser could not parse or evaluate it. During development this commonly means a source file was briefly incomplete while being edited; otherwise check for stale mixed-version assets.",
1681
+ failingUrls: [],
1682
+ };
1683
+ }
1684
+ if (/watchdog timed out|startup did not finish/i.test(failureText)) {
1685
+ return {
1686
+ summary: "WebUI startup stalled even though the current HTTP checks succeeded.",
1687
+ likelyCause: "The entry-module import, stylesheet, or top-level module evaluation remained pending. During development, a file changing while the browser loads it can cause a transient mixed-version startup.",
1688
+ failingUrls: [],
1689
+ };
1690
+ }
1491
1691
  return {
1492
1692
  summary: "All probed startup URLs currently respond successfully, but module evaluation still failed.",
1493
1693
  likelyCause: "The failure may be a stale browser/PWA cache, a transient request failure, or a JavaScript evaluation error rather than a current HTTP 404.",
@@ -1497,9 +1697,16 @@
1497
1697
 
1498
1698
  async function troubleshootingReport(reason, error) {
1499
1699
  const pageUrl = sanitizedUrl(window.location.href);
1500
- const health = await responseSummary(new URL("/api/health", window.location.href).href, "backend health", { parseHealth: true });
1501
- const assets = await startupAssetReport();
1502
- const assessment = startupAssessment(health, assets, error);
1700
+ const [health, assets, manifest] = await Promise.all([
1701
+ responseSummary(new URL("/api/health", window.location.href).href, "backend health", { parseHealth: true, expectedTypes: ["application/json"] }),
1702
+ startupAssetReport(),
1703
+ webManifestReport(),
1704
+ ]);
1705
+ const assessment = startupAssessment(health, assets, reason, error);
1706
+ const manifestHasIssue = !manifest.ok || !manifest.validJson;
1707
+ const manifestImpact = manifestHasIssue
1708
+ ? "The web manifest has a separate problem that can produce DevTools console errors, but it does not execute or block app.js startup."
1709
+ : "The optional web manifest is valid and is not the startup blocker.";
1503
1710
  const failedProbes = [...(!health.ok ? [health] : []), ...assets.failures];
1504
1711
  const failingChecks = failedProbes.length
1505
1712
  ? failedProbes.map((probe) => probe.line)
@@ -1532,14 +1739,20 @@
1532
1739
  health.line,
1533
1740
  ...assets.lines,
1534
1741
  "",
1742
+ "Related browser checks",
1743
+ "----------------------",
1744
+ manifest.line,
1745
+ `- manifest impact: ${manifestImpact}`,
1746
+ "",
1535
1747
  "Suggested troubleshooting",
1536
1748
  "-------------------------",
1537
1749
  "1. In Pi, run: /webui-status detailed",
1538
1750
  `2. Check the backend: curl -i ${new URL("/api/health", pageUrl).href}`,
1539
1751
  failingAssetCommand,
1540
1752
  "4. For an imported-module 404, synchronize the WebUI static allowlist and PWA app shell with app.js imports.",
1541
- "5. After correcting files, run /webui-start again to restart the server and restore tabs.",
1542
- "6. Share this complete report with your troubleshooting assistant.",
1753
+ "5. For a JavaScript syntax/evaluation error during development, finish or revert the incomplete edit and run the package syntax check before reloading.",
1754
+ "6. After correcting files, run /webui-start again to restart the server and restore tabs.",
1755
+ "7. Share this complete report with your troubleshooting assistant.",
1543
1756
  ].join("\n");
1544
1757
  return { text, summary: assessment.summary };
1545
1758
  }