@firstpick/pi-package-webui 0.9.7 → 0.9.8

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 (55) hide show
  1. package/README.md +7 -3
  2. package/bin/pi-webui.mjs +114 -25
  3. package/index.ts +2 -1
  4. package/lib/optional-feature-catalog.mjs +1 -1
  5. package/package.json +1 -1
  6. package/public/app.js +629 -98
  7. package/public/guided-git-command-state.mjs +175 -1
  8. package/public/index.html +12 -9
  9. package/public/service-worker.js +1 -1
  10. package/public/styles.css +133 -31
  11. package/public/transcript-renderer.mjs +62 -0
  12. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  13. package/tests/browser/footer-model-advanced-layout.spec.mjs +512 -0
  14. package/tests/browser/guided-git-extension-command.spec.mjs +180 -0
  15. package/tests/browser/guided-git-fallback.spec.mjs +68 -3
  16. package/tests/browser/interaction-continuity.spec.mjs +33 -0
  17. package/tests/codex-fast-mode-static.test.mjs +2 -2
  18. package/tests/compaction-static.test.mjs +1 -1
  19. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  20. package/tests/control-visibility-static.test.mjs +3 -3
  21. package/tests/controls-layout-static.test.mjs +3 -3
  22. package/tests/events-tree-context-menu-static.test.mjs +3 -3
  23. package/tests/fast-mode-client-static.test.mjs +1 -1
  24. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  25. package/tests/file-viewer-image-static.test.mjs +3 -3
  26. package/tests/fixtures/fake-pi.mjs +34 -3
  27. package/tests/git-footer-context-menu-static.test.mjs +103 -1
  28. package/tests/guided-git-activation-http.test.mjs +194 -0
  29. package/tests/guided-git-activation-static.test.mjs +80 -0
  30. package/tests/guided-git-activation.test.mjs +244 -0
  31. package/tests/guided-git-fallback-runtime.test.mjs +1 -0
  32. package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
  33. package/tests/guided-git-message-reliability-static.test.mjs +2 -1
  34. package/tests/guided-git-optional-feature.test.mjs +31 -0
  35. package/tests/http-endpoints-harness.test.mjs +3 -0
  36. package/tests/interaction-state-stability-static.test.mjs +1 -1
  37. package/tests/intercom-conversation-viewer-static.test.mjs +3 -3
  38. package/tests/main-output-loading-static.test.mjs +11 -9
  39. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  40. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  41. package/tests/mobile-foundation-static.test.mjs +3 -3
  42. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  43. package/tests/mobile-static.test.mjs +85 -4
  44. package/tests/open-issue-wizard-static.test.mjs +1 -1
  45. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  46. package/tests/prompt-input-vertical-scroll-static.test.mjs +6 -6
  47. package/tests/prompt-routing-input-clear-static.test.mjs +1 -1
  48. package/tests/questionnaire-dialog.test.mjs +3 -3
  49. package/tests/session-sampling-ui-static.test.mjs +3 -3
  50. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  51. package/tests/subagent-observability-static.test.mjs +2 -2
  52. package/tests/syntax-highlighting-static.test.mjs +3 -3
  53. package/tests/tab-close-continuity-static.test.mjs +2 -0
  54. package/tests/theme-customizer-static.test.mjs +1 -1
  55. package/tests/thinking-block-grouping.test.mjs +79 -0
@@ -17,7 +17,9 @@ export function resolveCommandForTabCatalog(catalog, name, { rpcOnly = false } =
17
17
  const commands = (rpcOnly ? raw : available).filter((command) => !rpcOnly || command.source !== "native");
18
18
  const exact = commands.find((command) => command.name === requested || command.invokeName === requested || command.duplicateNames?.includes(requested));
19
19
  if (exact) return exact;
20
- const canUseBaseAlias = available.some((command) => commandBaseName(command.name) === requested && command.invokeName && command.duplicateCount > 1);
20
+ const nativeOwnsBaseName = rpcOnly && raw.some((command) => command.source === "native" && command.name === requested);
21
+ const canUseBaseAlias = nativeOwnsBaseName
22
+ || available.some((command) => commandBaseName(command.name) === requested && command.invokeName && command.duplicateCount > 1);
21
23
  return canUseBaseAlias ? commands.find((command) => commandNameMatches(command?.name, requested)) || null : null;
22
24
  }
23
25
 
@@ -32,3 +34,175 @@ export function resolveRpcSlashCommandForTabCatalog(catalog, message) {
32
34
  export function guidedGitReviewAvailableForTabCatalog(catalog) {
33
35
  return !!resolveCommandForTabCatalog(catalog, "aur-review", { rpcOnly: true });
34
36
  }
37
+
38
+ export function guidedGitLaunchModeForTabCatalog(catalog, { disabled = false } = {}) {
39
+ if (disabled) return "disabled";
40
+ if (resolveCommandForTabCatalog(catalog, "git-guided-workflow", { rpcOnly: true })) return "extension";
41
+ if (resolveCommandForTabCatalog(catalog, "git-staged-msg", { rpcOnly: true })) return "fallback";
42
+ return "unavailable";
43
+ }
44
+
45
+ export function guidedGitWorkflowCommandForTabCatalog(catalog, message) {
46
+ const match = String(message || "").trim().match(/^\/([^\s]+)$/u);
47
+ if (!match) return false;
48
+ const command = resolveCommandForTabCatalog(catalog, match[1], { rpcOnly: true });
49
+ return commandBaseName(command?.name) === "git-guided-workflow";
50
+ }
51
+
52
+ export function guidedGitLaunchBlockedReason(state, queuedMessageCount = 0) {
53
+ if (!state || typeof state !== "object") return "state-unavailable";
54
+ if (state.isCompacting === true) return "compacting";
55
+ if (state.isStreaming === true) return "streaming";
56
+ if (Number(state.pendingMessageCount || 0) > 0 || Number(queuedMessageCount || 0) > 0) return "pending";
57
+ return "";
58
+ }
59
+
60
+ export function createGuidedGitLaunchPermitController({ maxTrackedTabs = 64, permitTtlMs = 15_000 } = {}) {
61
+ const permitsByTab = new Map();
62
+
63
+ function prune(now) {
64
+ for (const [tabId, permit] of permitsByTab) {
65
+ if (now - permit.grantedAt > permitTtlMs) permitsByTab.delete(tabId);
66
+ }
67
+ }
68
+
69
+ function grant(tabId, launchId, now = Date.now()) {
70
+ if (typeof tabId !== "string" || !tabId || typeof launchId !== "string" || !GUIDED_GIT_START_REQUEST_ID.test(launchId)) return false;
71
+ prune(now);
72
+ if (permitsByTab.has(tabId)) return false;
73
+ permitsByTab.set(tabId, { launchId, grantedAt: now });
74
+ while (permitsByTab.size > maxTrackedTabs) permitsByTab.delete(permitsByTab.keys().next().value);
75
+ return permitsByTab.has(tabId);
76
+ }
77
+
78
+ function consume(tabId, launchId, now = Date.now()) {
79
+ prune(now);
80
+ const permit = permitsByTab.get(tabId);
81
+ if (!permit || permit.launchId !== launchId) return false;
82
+ permitsByTab.delete(tabId);
83
+ return true;
84
+ }
85
+
86
+ function clearTab(tabId) {
87
+ permitsByTab.delete(tabId);
88
+ }
89
+
90
+ return {
91
+ grant,
92
+ consume,
93
+ clearTab,
94
+ inspect() {
95
+ return {
96
+ trackedTabs: permitsByTab.size,
97
+ hasPermit: (tabId) => permitsByTab.has(tabId),
98
+ launchIdForTab: (tabId) => permitsByTab.get(tabId)?.launchId || "",
99
+ };
100
+ },
101
+ };
102
+ }
103
+
104
+ export const GUIDED_GIT_START_STATUS_KEY = "git-guided-workflow:webui-start";
105
+ export const GUIDED_GIT_START_PAYLOAD_TYPE = "firstpick.pi-extension-git-guided-workflow.start";
106
+ export const GUIDED_GIT_START_PAYLOAD_VERSION = 1;
107
+ export const GUIDED_GIT_START_PAYLOAD_MAX_BYTES = 1024;
108
+ const GUIDED_GIT_START_REQUEST_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/u;
109
+ const GUIDED_GIT_START_PAYLOAD_KEYS = ["action", "requestId", "type", "version"];
110
+
111
+ export function parseGuidedGitStartPayload(raw) {
112
+ if (typeof raw !== "string" || !raw || new TextEncoder().encode(raw).length > GUIDED_GIT_START_PAYLOAD_MAX_BYTES) return null;
113
+ let value;
114
+ try {
115
+ value = JSON.parse(raw);
116
+ } catch {
117
+ return null;
118
+ }
119
+ if (!value || typeof value !== "object" || Array.isArray(value)) return null;
120
+ const keys = Object.keys(value).sort();
121
+ if (keys.length !== GUIDED_GIT_START_PAYLOAD_KEYS.length || keys.some((key, index) => key !== GUIDED_GIT_START_PAYLOAD_KEYS[index])) return null;
122
+ if (value.type !== GUIDED_GIT_START_PAYLOAD_TYPE || value.version !== GUIDED_GIT_START_PAYLOAD_VERSION || value.action !== "start") return null;
123
+ if (typeof value.requestId !== "string" || !GUIDED_GIT_START_REQUEST_ID.test(value.requestId)) return null;
124
+ return { type: value.type, version: value.version, action: value.action, requestId: value.requestId };
125
+ }
126
+
127
+ export function createGuidedGitActivationController({ maxSeenPerTab = 64, maxTrackedTabs = 64, seenTtlMs = 5 * 60 * 1000, claimStart = () => true } = {}) {
128
+ const seenByTab = new Map();
129
+ const startsByTab = new Map();
130
+ const startOwnersByTab = new Map();
131
+
132
+ function prune(now) {
133
+ for (const [tabId, seen] of seenByTab) {
134
+ for (const [requestId, receivedAt] of seen) {
135
+ if (now - receivedAt > seenTtlMs) seen.delete(requestId);
136
+ }
137
+ if (!seen.size) seenByTab.delete(tabId);
138
+ }
139
+ while (seenByTab.size > maxTrackedTabs) seenByTab.delete(seenByTab.keys().next().value);
140
+ }
141
+
142
+ function accept(tabId, requestId, now) {
143
+ prune(now);
144
+ let seen = seenByTab.get(tabId);
145
+ if (!seen) {
146
+ seen = new Map();
147
+ seenByTab.set(tabId, seen);
148
+ while (seenByTab.size > maxTrackedTabs) seenByTab.delete(seenByTab.keys().next().value);
149
+ if (!seenByTab.has(tabId)) return false;
150
+ }
151
+ if (seen.has(requestId)) return false;
152
+ seen.set(requestId, now);
153
+ while (seen.size > maxSeenPerTab) seen.delete(seen.keys().next().value);
154
+ return true;
155
+ }
156
+
157
+ function run(tabId, start) {
158
+ const existing = startsByTab.get(tabId);
159
+ if (existing) return existing;
160
+ const owner = Symbol(tabId);
161
+ startOwnersByTab.set(tabId, owner);
162
+ let promise;
163
+ promise = Promise.resolve()
164
+ .then(() => start(tabId, () => startOwnersByTab.get(tabId) === owner))
165
+ .finally(() => {
166
+ if (startsByTab.get(tabId) === promise) startsByTab.delete(tabId);
167
+ if (startOwnersByTab.get(tabId) === owner) startOwnersByTab.delete(tabId);
168
+ });
169
+ startsByTab.set(tabId, promise);
170
+ return promise;
171
+ }
172
+
173
+ function consume(request, start, now = Date.now()) {
174
+ const tabId = typeof request?.tabId === "string" ? request.tabId : "";
175
+ if (!tabId || request?.replayed === true || !request?.statusText) return { status: "ignored", payload: null, promise: null };
176
+ const payload = parseGuidedGitStartPayload(request.statusText);
177
+ if (!payload) return { status: "invalid", payload: null, promise: null };
178
+ let claimed = false;
179
+ try {
180
+ claimed = claimStart(tabId, payload, request, now) === true;
181
+ } catch {
182
+ claimed = false;
183
+ }
184
+ if (!claimed) return { status: "unclaimed", payload, promise: null };
185
+ if (!accept(tabId, payload.requestId, now)) return { status: "duplicate", payload, promise: null };
186
+ const folded = startsByTab.has(tabId);
187
+ return { status: folded ? "folded" : "started", payload, promise: run(tabId, start) };
188
+ }
189
+
190
+ function clearTab(tabId) {
191
+ seenByTab.delete(tabId);
192
+ startsByTab.delete(tabId);
193
+ startOwnersByTab.delete(tabId);
194
+ }
195
+
196
+ return {
197
+ consume,
198
+ run,
199
+ clearTab,
200
+ inspect() {
201
+ return {
202
+ trackedTabs: seenByTab.size,
203
+ seenForTab: (tabId) => seenByTab.get(tabId)?.size || 0,
204
+ inFlightTabs: startsByTab.size,
205
+ };
206
+ },
207
+ };
208
+ }
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=137" />
15
+ <link rel="stylesheet" href="/styles.css?v=142" />
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.
@@ -296,19 +296,21 @@
296
296
  <button id="chatSearchNextButton" class="chat-search-button" type="button" aria-label="Next match" title="Next match (Enter)">↓</button>
297
297
  <button id="chatSearchCloseButton" class="chat-search-button" type="button" aria-label="Close search" title="Close (Escape)">✕</button>
298
298
  </div>
299
- <div id="mainOutputLoading" class="main-output-loading" role="status" aria-live="polite" aria-atomic="true" aria-controls="chat" hidden>
300
- <span class="main-output-loading-spinner" aria-hidden="true"></span>
301
- <span>Loading agent output…</span>
302
- </div>
303
- <div id="chat" class="chat" aria-live="polite" aria-busy="false">
304
- <button id="stickyUserPromptButton" class="sticky-user-prompt-button" type="button" aria-controls="chat" hidden></button>
299
+ <div class="main-output-surface">
300
+ <div id="mainOutputLoading" class="main-output-loading" role="status" aria-live="polite" aria-atomic="true" aria-controls="chat" hidden>
301
+ <span class="main-output-loading-spinner" aria-hidden="true"></span>
302
+ <span>Loading agent output…</span>
303
+ </div>
304
+ <div id="chat" class="chat" aria-live="polite" aria-busy="false">
305
+ <button id="stickyUserPromptButton" class="sticky-user-prompt-button" type="button" aria-controls="chat" hidden></button>
306
+ </div>
307
+ <button id="jumpToLatestButton" class="jump-to-latest-button" type="button" hidden>Latest ↓</button>
305
308
  </div>
306
309
  <div id="runIndicatorHost" class="run-indicator-host"></div>
307
310
  <div id="feedbackTray" class="feedback-tray" aria-live="polite" hidden>
308
311
  <span id="feedbackTraySummary">No action feedback queued.</span>
309
312
  <button id="sendFeedbackButton" type="button">Send &amp; create LEARNING</button>
310
313
  </div>
311
- <button id="jumpToLatestButton" class="jump-to-latest-button" type="button" hidden>Latest ↓</button>
312
314
  <div id="statusBar" class="statusbar" aria-live="polite"></div>
313
315
  <section id="contextMeterBar" class="context-meter-bar" aria-live="polite"></section>
314
316
  <section id="gitWorkflowPanel" class="git-workflow-panel" aria-live="polite" hidden>
@@ -1246,6 +1248,7 @@
1246
1248
  <div id="visibilityContextMenu" class="file-context-menu control-visibility-context-menu" role="menu" aria-label="Choose visible controls" hidden></div>
1247
1249
  <div id="gitFooterContextMenu" class="file-context-menu git-footer-context-menu" role="menu" aria-label="Git footer box actions" hidden>
1248
1250
  <button type="button" role="menuitem" data-git-footer-menu-action="disable">Disable this box</button>
1251
+ <button type="button" role="menuitemcheckbox" aria-checked="false" data-git-footer-menu-action="toggle-advanced" hidden>Toggle advanced</button>
1249
1252
  <button type="button" role="menuitem" data-git-footer-menu-action="visibility">Open Git-footer Visibility</button>
1250
1253
  </div>
1251
1254
  <div id="eventTreeContextMenu" class="file-context-menu event-tree-context-menu" role="menu" aria-labelledby="eventTreeContextMenuLabel" hidden>
@@ -1882,7 +1885,7 @@
1882
1885
  </form>
1883
1886
  </dialog>
1884
1887
 
1885
- <script id="webuiBootLoader" data-app-src="/app.js?v=166">
1888
+ <script id="webuiBootLoader" data-app-src="/app.js?v=172">
1886
1889
  (() => {
1887
1890
  "use strict";
1888
1891
 
@@ -1,4 +1,4 @@
1
- const CACHE_NAME = "pi-webui-pwa-v132";
1
+ const CACHE_NAME = "pi-webui-pwa-v139";
2
2
  const APP_SHELL = [
3
3
  "/",
4
4
  "/index.html",
package/public/styles.css CHANGED
@@ -270,8 +270,9 @@ textarea {
270
270
  }
271
271
  textarea::placeholder { color: rgba(var(--ctp-subtext-rgb), 0.62); }
272
272
  #promptInput {
273
+ --prompt-input-block-chrome: calc(1.8rem + 2px);
273
274
  min-height: calc(1.5em + 1.8rem);
274
- max-height: min(25vh, 10rem);
275
+ max-height: calc(6lh + var(--prompt-input-block-chrome));
275
276
  resize: none;
276
277
  overflow-y: auto;
277
278
  overscroll-behavior-y: contain;
@@ -5459,7 +5460,7 @@ button.subagent-gate-attempt:focus-visible {
5459
5460
  body.terminal-tabs-left .chat-panel {
5460
5461
  display: grid;
5461
5462
  grid-template-columns: minmax(0, 1fr) minmax(13rem, var(--terminal-tabs-sidebar-width));
5462
- grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto auto auto auto auto;
5463
+ grid-template-rows: auto auto auto minmax(0, 1fr) auto auto auto auto auto auto;
5463
5464
  align-items: stretch;
5464
5465
  overflow: visible;
5465
5466
  }
@@ -5564,11 +5565,9 @@ button.subagent-gate-attempt:focus-visible {
5564
5565
  body.terminal-tabs-left .widget-area,
5565
5566
  body.terminal-tabs-left .subagent-terminal-view,
5566
5567
  body.terminal-tabs-left .chat-search-bar,
5567
- body.terminal-tabs-left .main-output-loading,
5568
- body.terminal-tabs-left .chat,
5568
+ body.terminal-tabs-left .main-output-surface,
5569
5569
  body.terminal-tabs-left .run-indicator-host,
5570
5570
  body.terminal-tabs-left .feedback-tray,
5571
- body.terminal-tabs-left .jump-to-latest-button,
5572
5571
  body.terminal-tabs-left .statusbar,
5573
5572
  body.terminal-tabs-left .context-meter-bar,
5574
5573
  body.terminal-tabs-left .git-workflow-panel,
@@ -5582,17 +5581,15 @@ button.subagent-gate-attempt:focus-visible {
5582
5581
  body.terminal-tabs-left .widget-area { grid-row: 2; }
5583
5582
  body.terminal-tabs-left .subagent-terminal-view { grid-row: 1 / -1; }
5584
5583
  body.terminal-tabs-left .chat-search-bar { grid-row: 3; }
5585
- body.terminal-tabs-left .main-output-loading,
5586
- body.terminal-tabs-left .chat { grid-row: 4; }
5587
- body.terminal-tabs-left .main-output-loading { align-self: start; justify-self: center; margin-top: 0.75rem; }
5584
+ body.terminal-tabs-left .main-output-surface { grid-row: 4; }
5585
+ body.terminal-tabs-left .main-output-loading { top: 0.75rem; }
5588
5586
  body.terminal-tabs-left .run-indicator-host { grid-row: 5; }
5589
5587
  body.terminal-tabs-left .feedback-tray { grid-row: 6; }
5590
- body.terminal-tabs-left .jump-to-latest-button { grid-row: 7; }
5591
- body.terminal-tabs-left .statusbar { grid-row: 8; }
5592
- body.terminal-tabs-left .context-meter-bar { grid-row: 9; }
5593
- body.terminal-tabs-left .git-workflow-panel { grid-row: 10; }
5588
+ body.terminal-tabs-left .statusbar { grid-row: 7; }
5589
+ body.terminal-tabs-left .context-meter-bar { grid-row: 8; }
5590
+ body.terminal-tabs-left .git-workflow-panel { grid-row: 9; }
5594
5591
  body.terminal-tabs-left .composer,
5595
- body.terminal-tabs-left .composer-remote-mic-consent { grid-row: 11; }
5592
+ body.terminal-tabs-left .composer-remote-mic-consent { grid-row: 10; }
5596
5593
  body.terminal-tabs-left .side-panel-button-chevron { transform: scaleX(-1); }
5597
5594
 
5598
5595
  body.terminal-tabs-left.terminal-tabs-sidebar-start .chat-panel {
@@ -5619,11 +5616,9 @@ button.subagent-gate-attempt:focus-visible {
5619
5616
  body.terminal-tabs-left.terminal-tabs-sidebar-start .widget-area,
5620
5617
  body.terminal-tabs-left.terminal-tabs-sidebar-start .subagent-terminal-view,
5621
5618
  body.terminal-tabs-left.terminal-tabs-sidebar-start .chat-search-bar,
5622
- body.terminal-tabs-left.terminal-tabs-sidebar-start .main-output-loading,
5623
- body.terminal-tabs-left.terminal-tabs-sidebar-start .chat,
5619
+ body.terminal-tabs-left.terminal-tabs-sidebar-start .main-output-surface,
5624
5620
  body.terminal-tabs-left.terminal-tabs-sidebar-start .run-indicator-host,
5625
5621
  body.terminal-tabs-left.terminal-tabs-sidebar-start .feedback-tray,
5626
- body.terminal-tabs-left.terminal-tabs-sidebar-start .jump-to-latest-button,
5627
5622
  body.terminal-tabs-left.terminal-tabs-sidebar-start .statusbar,
5628
5623
  body.terminal-tabs-left.terminal-tabs-sidebar-start .context-meter-bar,
5629
5624
  body.terminal-tabs-left.terminal-tabs-sidebar-start .git-workflow-panel,
@@ -6103,6 +6098,17 @@ button.footer-meta {
6103
6098
  .footer-worktree.footer-meta-action {
6104
6099
  border-color: rgba(166, 227, 161, 0.24);
6105
6100
  }
6101
+ body.footer-model-picker-open .workspace-column {
6102
+ position: relative;
6103
+ z-index: 112;
6104
+ }
6105
+ body.footer-model-picker-open .workspace-column > .chat-panel,
6106
+ body.footer-model-picker-open .statusbar {
6107
+ overflow: visible;
6108
+ }
6109
+ body.footer-model-picker-open .statusbar {
6110
+ z-index: 113;
6111
+ }
6106
6112
  .footer-model-picker {
6107
6113
  position: absolute;
6108
6114
  left: var(--footer-model-picker-left, auto);
@@ -6122,6 +6128,59 @@ button.footer-meta {
6122
6128
  linear-gradient(145deg, rgba(var(--ctp-crust-rgb), 0.98), rgba(var(--ctp-base-rgb), 0.96));
6123
6129
  box-shadow: 0 1.2rem 2.8rem rgba(var(--ctp-crust-rgb), 0.68), 0 0 1.4rem rgba(148, 226, 213, 0.14), inset 0 1px 0 rgba(255,255,255,0.055);
6124
6130
  }
6131
+ .footer-model-picker-advanced {
6132
+ width: max-content;
6133
+ min-width: min(14.5rem, calc(100vw - 1rem));
6134
+ max-width: calc(100vw - 1rem);
6135
+ overflow: hidden;
6136
+ }
6137
+ .footer-model-picker-advanced .footer-model-picker-source {
6138
+ width: 100%;
6139
+ max-width: none;
6140
+ }
6141
+ .footer-model-provider-columns {
6142
+ display: grid;
6143
+ grid-auto-flow: column;
6144
+ grid-auto-columns: 13rem;
6145
+ align-items: start;
6146
+ gap: 0.58rem;
6147
+ width: fit-content;
6148
+ min-width: 0;
6149
+ max-width: calc(100vw - 2.5rem);
6150
+ max-height: min(38dvh, 22rem);
6151
+ overflow: auto;
6152
+ padding: 0.08rem 0.08rem 0.3rem;
6153
+ overscroll-behavior: contain;
6154
+ scrollbar-gutter: stable;
6155
+ }
6156
+ .footer-model-provider-column {
6157
+ display: grid;
6158
+ gap: 0.34rem;
6159
+ min-width: 0;
6160
+ padding: 0.48rem;
6161
+ border: 1px solid rgba(180, 190, 254, 0.18);
6162
+ border-radius: 0.78rem;
6163
+ background: rgba(var(--ctp-crust-rgb), 0.46);
6164
+ transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
6165
+ }
6166
+ .footer-model-provider-column:focus-within {
6167
+ border-color: rgba(148, 226, 213, 0.56);
6168
+ background: rgba(148, 226, 213, 0.06);
6169
+ box-shadow: 0 0 0 2px rgba(148, 226, 213, 0.10), 0 0 1rem rgba(148, 226, 213, 0.14);
6170
+ }
6171
+ .footer-model-provider-title {
6172
+ min-width: 0;
6173
+ padding: 0.08rem 0.16rem 0.28rem;
6174
+ overflow: hidden;
6175
+ color: var(--ctp-pink);
6176
+ border-bottom: 1px solid rgba(245, 194, 231, 0.22);
6177
+ font-size: var(--text-xs);
6178
+ font-weight: 950;
6179
+ letter-spacing: 0.09em;
6180
+ text-overflow: ellipsis;
6181
+ text-transform: uppercase;
6182
+ white-space: nowrap;
6183
+ }
6125
6184
  .footer-model-picker-title {
6126
6185
  color: var(--ctp-teal);
6127
6186
  font-size: var(--text-xs);
@@ -6187,12 +6246,24 @@ button.footer-meta {
6187
6246
  border-color: rgba(166, 227, 161, 0.46);
6188
6247
  box-shadow: inset 3px 0 0 var(--ctp-green), 0 0 1rem rgba(166, 227, 161, 0.14);
6189
6248
  }
6190
- .footer-model-option[data-footer-model-key] {
6249
+ .footer-model-picker:not(.footer-model-picker-advanced) .footer-model-option[data-footer-model-key] {
6191
6250
  position: relative;
6192
6251
  cursor: grab;
6193
6252
  touch-action: none;
6194
6253
  user-select: none;
6195
6254
  }
6255
+ .footer-model-picker-advanced .footer-model-option[data-footer-model-key] {
6256
+ min-width: 0;
6257
+ cursor: grab;
6258
+ touch-action: none;
6259
+ user-select: none;
6260
+ }
6261
+ .footer-model-picker-advanced .footer-model-option:focus-visible {
6262
+ border-color: var(--ctp-teal);
6263
+ outline: 2px solid rgba(148, 226, 213, 0.74);
6264
+ outline-offset: 1px;
6265
+ box-shadow: inset 3px 0 0 var(--ctp-teal), 0 0 0 3px rgba(148, 226, 213, 0.13), 0 0 1rem rgba(148, 226, 213, 0.22);
6266
+ }
6196
6267
  .footer-model-option.dragging {
6197
6268
  cursor: grabbing;
6198
6269
  border-color: rgba(148, 226, 213, 0.72);
@@ -8216,6 +8287,13 @@ button.git-workflow-step:hover:not(:disabled) {
8216
8287
  color: rgba(var(--ctp-subtext-rgb), 0.64);
8217
8288
  font-size: var(--text-xs);
8218
8289
  }
8290
+ .main-output-surface {
8291
+ position: relative;
8292
+ display: flex;
8293
+ flex: 1 1 auto;
8294
+ min-width: 0;
8295
+ min-height: 0;
8296
+ }
8219
8297
  .chat {
8220
8298
  position: relative;
8221
8299
  display: flex;
@@ -8229,15 +8307,16 @@ button.git-workflow-step:hover:not(:disabled) {
8229
8307
  }
8230
8308
  .main-output-loading[hidden] { display: none !important; }
8231
8309
  .main-output-loading {
8232
- position: relative;
8310
+ position: absolute;
8233
8311
  z-index: 13;
8312
+ top: 0.55rem;
8313
+ left: 50%;
8234
8314
  display: inline-flex;
8235
- flex: 0 0 auto;
8236
- align-self: center;
8237
8315
  align-items: center;
8238
8316
  gap: 0.48rem;
8239
8317
  max-width: calc(100% - 1.2rem);
8240
- margin: 0.55rem auto 0;
8318
+ margin: 0;
8319
+ transform: translateX(-50%);
8241
8320
  padding: 0.42rem 0.7rem;
8242
8321
  pointer-events: none;
8243
8322
  user-select: none;
@@ -8323,15 +8402,24 @@ button.git-workflow-step:hover:not(:disabled) {
8323
8402
  }
8324
8403
  .jump-to-latest-button[hidden] { display: none; }
8325
8404
  .jump-to-latest-button {
8326
- align-self: center;
8327
- z-index: 3;
8328
- margin: 0.45rem 0;
8405
+ position: absolute;
8406
+ z-index: 14;
8407
+ bottom: 0.75rem;
8408
+ left: 50%;
8409
+ margin: 0;
8410
+ transform: translateX(-50%);
8329
8411
  color: #11111b;
8330
8412
  font-weight: 900;
8331
8413
  background: linear-gradient(120deg, var(--ctp-teal), var(--ctp-blue), var(--ctp-mauve));
8332
8414
  border-color: transparent;
8333
8415
  box-shadow: 0 0 1.2rem var(--glow-teal), 0 0.7rem 1.6rem rgba(0, 0, 0, 0.28);
8334
8416
  }
8417
+ .jump-to-latest-button:hover {
8418
+ transform: translateX(-50%) translateY(-1px);
8419
+ }
8420
+ .jump-to-latest-button:active {
8421
+ transform: translateX(-50%) translateY(0);
8422
+ }
8335
8423
  .feedback-tray[hidden] { display: none; }
8336
8424
  .feedback-tray {
8337
8425
  display: flex;
@@ -12939,8 +13027,7 @@ body:not(.mobile-keyboard-open) .composer-input-row:has(.composer-workflow-mode-
12939
13027
  }
12940
13028
  body.subagent-terminal-active .workspace-dashboard,
12941
13029
  body.subagent-terminal-active .widget-area,
12942
- body.subagent-terminal-active .main-output-loading,
12943
- body.subagent-terminal-active .chat,
13030
+ body.subagent-terminal-active .main-output-surface,
12944
13031
  body.subagent-terminal-active .feedback-tray,
12945
13032
  body.subagent-terminal-active .jump-to-latest-button,
12946
13033
  body.subagent-terminal-active .statusbar,
@@ -15406,7 +15493,7 @@ button.git-workflow-step { min-height: 1.9rem; }
15406
15493
  }
15407
15494
  .jump-to-latest-button {
15408
15495
  min-height: 44px;
15409
- margin: 0.35rem auto;
15496
+ margin: 0;
15410
15497
  padding: 0.55rem 0.92rem;
15411
15498
  font-size: 0.86rem;
15412
15499
  }
@@ -15515,9 +15602,24 @@ button.git-workflow-step { min-height: 1.9rem; }
15515
15602
  right: max(0.55rem, env(safe-area-inset-right));
15516
15603
  bottom: var(--footer-model-picker-bottom, calc(7.2rem + env(safe-area-inset-bottom)));
15517
15604
  width: auto;
15605
+ max-width: none;
15518
15606
  max-height: min(52dvh, 24rem);
15519
15607
  z-index: 60;
15520
15608
  }
15609
+ .footer-model-picker-advanced {
15610
+ overflow: hidden;
15611
+ }
15612
+ .footer-model-provider-columns {
15613
+ grid-auto-flow: row;
15614
+ grid-template-columns: minmax(0, 1fr);
15615
+ grid-auto-columns: auto;
15616
+ max-height: min(38dvh, 17rem);
15617
+ overflow-x: hidden;
15618
+ overflow-y: auto;
15619
+ }
15620
+ .footer-model-provider-column {
15621
+ width: 100%;
15622
+ }
15521
15623
  .footer-line-main {
15522
15624
  display: none;
15523
15625
  grid-template-columns: repeat(2, minmax(0, 1fr));
@@ -15642,8 +15744,9 @@ button.git-workflow-step { min-height: 1.9rem; }
15642
15744
  border-radius: 0.72rem;
15643
15745
  }
15644
15746
  #promptInput {
15747
+ --prompt-input-block-chrome: calc(1.04rem + 2px);
15645
15748
  min-height: calc(1.35em + 1.05rem);
15646
- max-height: min(24dvh, 10rem);
15749
+ max-height: calc(6lh + var(--prompt-input-block-chrome));
15647
15750
  padding: 0.52rem 0.62rem;
15648
15751
  resize: none;
15649
15752
  font-size: 0.95rem;
@@ -15680,7 +15783,7 @@ button.git-workflow-step { min-height: 1.9rem; }
15680
15783
  }
15681
15784
  body.mobile-keyboard-open #promptInput {
15682
15785
  min-height: calc(1.35em + 1.05rem);
15683
- max-height: min(22dvh, 8rem);
15786
+ max-height: min(22dvh, calc(6lh + var(--prompt-input-block-chrome)));
15684
15787
  }
15685
15788
  body.mobile-keyboard-open .composer-row {
15686
15789
  grid-template-columns: 1fr;
@@ -18160,7 +18263,6 @@ html[data-density="compact"] .composer { padding-block: 0.5rem; }
18160
18263
  html[data-mobile-shell="v2"][data-mobile-presentation="essential"] .thinking-block:not([open]) > :not(summary) { display: none; }
18161
18264
  html[data-mobile-shell="v2"] .message .message-collapse > summary,
18162
18265
  html[data-mobile-shell="v2"] .thinking-block > summary { min-height: 44px; }
18163
- html[data-mobile-shell="v2"] .jump-to-latest-button { bottom: calc(7.3rem + env(safe-area-inset-bottom)); }
18164
18266
  html[data-mobile-shell="v2"] body.mobile-keyboard-open .mobile-shell-nav { display: none; }
18165
18267
  html[data-mobile-shell="v2"] body.mobile-keyboard-open .widget-area,
18166
18268
  html[data-mobile-shell="v2"] body.mobile-keyboard-open .statusbar { display: grid !important; }
@@ -19379,6 +19481,7 @@ body:has(#undoToast:not([hidden])) .notice-toast-stack { bottom: calc(max(1rem,
19379
19481
  .composer-input-row { gap: 0.28rem; }
19380
19482
  .composer-attach-button { padding: 0.36rem; border-radius: 0.64rem; }
19381
19483
  #promptInput {
19484
+ --prompt-input-block-chrome: calc(0.88rem + 2px);
19382
19485
  min-height: calc(1.3em + 0.88rem);
19383
19486
  padding: 0.44rem 0.52rem;
19384
19487
  font-size: 0.88rem;
@@ -19494,7 +19597,6 @@ body:has(#undoToast:not([hidden])) .notice-toast-stack { bottom: calc(max(1rem,
19494
19597
  html[data-mobile-shell="v2"] .mobile-continuity-notice { top: calc(4.8rem + env(safe-area-inset-top)); right: 0.58rem; left: 0.58rem; padding: 0.44rem 0.56rem; }
19495
19598
  html[data-mobile-shell="v2"] .mobile-failed-send-recovery { gap: 0.3rem; padding: 0.38rem; }
19496
19599
  html[data-mobile-shell="v2"] .mobile-indicator { min-height: 1.2rem; padding: 0.06rem 0.3rem; font-size: 0.7rem; }
19497
- html[data-mobile-shell="v2"] .jump-to-latest-button { bottom: calc(6.75rem + env(safe-area-inset-bottom)); }
19498
19600
  html[data-mobile-shell="v2"] body.mobile-keyboard-open .composer { padding-bottom: calc(0.5rem + env(safe-area-inset-bottom)); }
19499
19601
  }
19500
19602
 
@@ -2,6 +2,68 @@ const DEFAULT_SURFACE_SELECTOR = "[data-transcript-surface], .markdown-body, .co
2
2
  const DESTRUCTIVE_KINDS = new Set(["reconcile", "destructive", "authoritative"]);
3
3
  const MUTATION_LOG_LIMIT = 80;
4
4
 
5
+ function groupableThinkingText(message) {
6
+ if (message?.role !== "thinking") return null;
7
+ if (typeof message.thinking === "string") return message.thinking;
8
+ return typeof message.content === "string" ? message.content : null;
9
+ }
10
+
11
+ export function groupConsecutiveThinkingMessages(messages) {
12
+ const grouped = [];
13
+ let pending = [];
14
+
15
+ const flush = () => {
16
+ if (pending.length === 1) grouped.push(pending[0]);
17
+ else if (pending.length > 1) {
18
+ const first = pending[0];
19
+ const thinking = pending.map(groupableThinkingText).join("\n\n");
20
+ grouped.push({
21
+ ...first,
22
+ content: thinking,
23
+ thinking,
24
+ thinkingSegmentCount: pending.length,
25
+ });
26
+ }
27
+ pending = [];
28
+ };
29
+
30
+ for (const message of messages || []) {
31
+ if (groupableThinkingText(message) !== null) pending.push(message);
32
+ else {
33
+ flush();
34
+ grouped.push(message);
35
+ }
36
+ }
37
+ flush();
38
+ return grouped;
39
+ }
40
+
41
+ export function groupConsecutiveThinkingItems(items, thinkingMessageForItem = (item) => item?.message) {
42
+ const grouped = [];
43
+ let pending = [];
44
+
45
+ const flush = () => {
46
+ if (pending.length === 1) grouped.push(pending[0].item);
47
+ else if (pending.length > 1) {
48
+ const first = pending[0].item;
49
+ const message = groupConsecutiveThinkingMessages(pending.map((entry) => entry.message))[0];
50
+ grouped.push({ ...first, message, thinkingGroupSourceCount: pending.length });
51
+ }
52
+ pending = [];
53
+ };
54
+
55
+ for (const item of items || []) {
56
+ const message = thinkingMessageForItem(item);
57
+ if (groupableThinkingText(message) !== null) pending.push({ item, message });
58
+ else {
59
+ flush();
60
+ grouped.push(item);
61
+ }
62
+ }
63
+ flush();
64
+ return grouped;
65
+ }
66
+
5
67
  function normalizedKey(value, fallback = "") {
6
68
  const key = String(value || "").trim();
7
69
  return key || fallback;
@@ -65,7 +65,7 @@ function makeEnvironment({
65
65
  reload: new FakeElement(),
66
66
  copyStatus: new FakeElement(),
67
67
  };
68
- const styleLink = new FakeElement({ href: "http://127.0.0.1:31415/styles.css?v=137", sheet: stylesheetLoaded ? {} : null });
68
+ const styleLink = new FakeElement({ href: "http://127.0.0.1:31415/styles.css?v=142", sheet: stylesheetLoaded ? {} : null });
69
69
  const listeners = new Map();
70
70
  const timers = new Map();
71
71
  let timerId = 0;
@@ -84,7 +84,7 @@ function makeEnvironment({
84
84
  removeEventListener(name) { listeners.delete(name); },
85
85
  };
86
86
  const document = {
87
- currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=166" } }),
87
+ currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=172" } }),
88
88
  readyState: "complete",
89
89
  querySelector(selector) {
90
90
  return {
@@ -232,7 +232,7 @@ for (const moduleName of startupModuleNames) {
232
232
  assert.ok(serviceWorker.includes(`"/${moduleName}"`), `the PWA app shell should include every app.js startup module: ${moduleName}`);
233
233
  }
234
234
  assert.match(serviceWorker, /pi-webui-pwa-v\d+/, "the app-shell cache should retain a versioned identity");
235
- assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=166"), "the inline loader should own app module startup");
235
+ assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=172"), "the inline loader should own app module startup");
236
236
  assert.doesNotMatch(html, /<script type="module" src="\/app\.js/, "the app module should not bypass the guarded loader");
237
237
 
238
238
  console.log("boot-failure-diagnostics.test.mjs passed");