@firstpick/pi-package-webui 0.9.9 → 0.10.0

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 (56) hide show
  1. package/DEVELOPMENT.md +42 -13
  2. package/README.md +7 -7
  3. package/TECHNICAL.md +8 -8
  4. package/bin/pi-webui.mjs +197 -63
  5. package/index.ts +23 -33
  6. package/lib/git-workflow-preferences.mjs +51 -12
  7. package/lib/tui-model-profile-selector.mjs +183 -0
  8. package/lib/tui-resource-selector.mjs +173 -0
  9. package/package.json +1 -1
  10. package/public/app.js +220 -73
  11. package/public/index.html +2 -2
  12. package/public/service-worker.js +1 -1
  13. package/public/styles.css +63 -15
  14. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  15. package/tests/browser/intercom-conversation-viewer.spec.mjs +76 -53
  16. package/tests/browser/user-noticeable-fixes.spec.mjs +51 -0
  17. package/tests/codex-fast-mode-static.test.mjs +2 -2
  18. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  19. package/tests/control-visibility-static.test.mjs +3 -3
  20. package/tests/controls-layout-static.test.mjs +3 -3
  21. package/tests/durable-rpc-supervisor-harness.test.mjs +9 -0
  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 +3 -3
  27. package/tests/guided-git-activation-static.test.mjs +24 -12
  28. package/tests/guided-git-fallback-runtime.test.mjs +209 -270
  29. package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
  30. package/tests/guided-git-message-reliability-static.test.mjs +2 -1
  31. package/tests/guided-git-optional-feature.test.mjs +8 -5
  32. package/tests/http-endpoints-harness.test.mjs +22 -4
  33. package/tests/intercom-conversation-viewer-static.test.mjs +7 -6
  34. package/tests/intercom-tag-layout-static.test.mjs +35 -16
  35. package/tests/intercom-tag-overflow-layout.test.mjs +87 -0
  36. package/tests/main-output-loading-static.test.mjs +3 -3
  37. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  38. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  39. package/tests/mobile-foundation-static.test.mjs +3 -3
  40. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  41. package/tests/mobile-static.test.mjs +11 -6
  42. package/tests/open-issue-wizard-static.test.mjs +1 -1
  43. package/tests/persistent-ui-layout-static.test.mjs +3 -3
  44. package/tests/prompt-input-vertical-scroll-static.test.mjs +3 -3
  45. package/tests/questionnaire-dialog.test.mjs +3 -3
  46. package/tests/remote-auth-settings-harness.test.mjs +18 -3
  47. package/tests/resource-tui-extension.test.mjs +2 -1
  48. package/tests/session-sampling-ui-static.test.mjs +3 -3
  49. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  50. package/tests/subagent-observability-static.test.mjs +2 -2
  51. package/tests/syntax-highlighting-static.test.mjs +3 -3
  52. package/tests/theme-customizer-static.test.mjs +1 -1
  53. package/tests/tui-model-profile-selector.test.mjs +102 -0
  54. package/tests/tui-resource-selector.test.mjs +74 -0
  55. package/tests/webui-settings-locking.test.mjs +32 -1
  56. package/tests/windows-drive-cwd-picker-static.test.mjs +3 -3
@@ -144,55 +144,71 @@ test.afterAll(async () => {
144
144
  await rm(tempRoot, { recursive: true, force: true }).catch(() => {});
145
145
  });
146
146
 
147
- test("the 32-conversation dense grid stays contained and opens the correct truncated conversation", async ({ page }) => {
147
+ test("the 32-conversation strip reaches half the input and keeps overflow chats recognizable", async ({ page }) => {
148
148
  await page.setViewportSize({ width: 900, height: 760 });
149
149
  await page.goto(baseURL);
150
150
  const container = page.locator("#intercomConversationTags");
151
- const tags = container.locator(":scope > .composer-intercom-tag");
152
- const longTag = tags.filter({ hasText: longPeerName });
153
- const longLabel = longTag.locator(".composer-intercom-tag-label");
151
+ const tags = container.locator(":scope > .composer-intercom-tag[data-intercom-conversation-id]");
152
+ const overflow = container.locator(":scope > .composer-intercom-tag.overflow");
153
+ const menu = container.locator(":scope > .composer-intercom-overflow-menu");
154
154
 
155
155
  await expect(tags).toHaveCount(expectedConversationCount);
156
- await expect(container).toHaveClass(/\bdense\b/);
157
- for (let index = 0; index < expectedConversationCount; index += 1) await expect(tags.nth(index)).toBeVisible();
156
+ await expect(overflow).toBeVisible();
157
+ const hiddenCount = Number((await overflow.textContent())?.slice(1));
158
+ assert.ok(hiddenCount > 0 && hiddenCount < expectedConversationCount, `the desktop strip should keep some complete tags visible and hide the rest (${hiddenCount})`);
158
159
 
159
160
  const layout = await container.evaluate((element) => {
160
161
  const containerRect = element.getBoundingClientRect();
161
- const tagRects = [...element.querySelectorAll(":scope > .composer-intercom-tag")].map((tag) => tag.getBoundingClientRect());
162
+ const inputRect = document.querySelector("#promptInput").getBoundingClientRect();
163
+ const visibleRects = [...element.querySelectorAll(":scope > .composer-intercom-tag:not([hidden])")].map((tag) => tag.getBoundingClientRect());
164
+ const visibleConversationRects = [...element.querySelectorAll(":scope > .composer-intercom-tag[data-intercom-conversation-id]:not([hidden])")].map((tag) => tag.getBoundingClientRect());
165
+ const overflowRect = element.querySelector(":scope > .composer-intercom-tag.overflow").getBoundingClientRect();
166
+ const firstConversationRect = visibleConversationRects[0];
162
167
  return {
163
- clientWidth: element.clientWidth,
164
- scrollWidth: element.scrollWidth,
168
+ containerWidth: containerRect.width,
169
+ inputWidth: inputRect.width,
165
170
  rootFontSize: Number.parseFloat(getComputedStyle(document.documentElement).fontSize),
166
- widths: tagRects.map((rect) => rect.width),
167
- rowTops: [...new Set(tagRects.map((rect) => Math.round(rect.top)))],
168
- allContained: tagRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
171
+ widths: visibleConversationRects.map((rect) => rect.width),
172
+ rowCenters: visibleRects.map((rect) => rect.top + rect.height / 2),
173
+ firstConversationRightGap: containerRect.right - firstConversationRect.right,
174
+ firstConversationLeft: firstConversationRect.left,
175
+ overflowLeft: overflowRect.left,
176
+ allContained: visibleRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
169
177
  };
170
178
  });
171
- assert.ok(layout.allContained, "every desktop conversation tag should remain within the tag container");
172
- assert.ok(layout.clientWidth <= (17 * layout.rootFontSize) + 0.5, `the desktop conversation tag group should stay within 17rem (${layout.clientWidth}px)`);
173
- assert.ok(layout.scrollWidth <= layout.clientWidth, `the desktop tag grid should not overflow horizontally (${layout.scrollWidth} > ${layout.clientWidth})`);
174
- assert.ok(Math.min(...layout.widths) >= 44, `every dense desktop target should be at least 44px wide (minimum ${Math.min(...layout.widths)})`);
175
- assert.ok(layout.rowTops.length > 1, "the 32-conversation desktop fixture should wrap into multiple rows");
179
+ assert.ok(layout.containerWidth <= layout.inputWidth / 2 + 1, `the desktop tag strip should stop at the input midpoint (${layout.containerWidth} > ${layout.inputWidth / 2})`);
180
+ assert.ok(layout.containerWidth >= layout.inputWidth * 0.45, `the desktop tag strip should use the available half-width instead of the old compact cap (${layout.containerWidth} < ${layout.inputWidth * 0.45})`);
181
+ assert.ok(layout.allContained, "every visible desktop conversation tag should stay within the measured strip");
182
+ assert.ok(Math.max(...layout.rowCenters) - Math.min(...layout.rowCenters) <= 1, "visible conversations and +X should remain vertically aligned on one row");
183
+ assert.ok(layout.firstConversationRightGap <= 1, `the newest conversation should start at the right edge (${layout.firstConversationRightGap}px gap)`);
184
+ assert.ok(layout.firstConversationLeft > layout.overflowLeft, "older conversations and +X should extend left toward the input midpoint");
185
+ assert.ok(Math.min(...layout.widths) >= 44, `visible desktop conversation targets should remain recognizable (minimum ${Math.min(...layout.widths)}px)`);
186
+ assert.ok(Math.max(...layout.widths) <= 13 * layout.rootFontSize + 1, `direct conversation tags should stay within 13rem (maximum ${Math.max(...layout.widths)}px)`);
176
187
 
177
- await expect(longTag).toHaveCount(1);
178
- const fullVisualLabel = await longLabel.textContent();
179
- assert.ok(fullVisualLabel?.includes(longPeerName), "the long label fixture should retain its full DOM text");
180
- await expect(longTag).toHaveAttribute("aria-label", `Open agent conversation ${fullVisualLabel}`);
181
- await expect(longTag).toHaveAttribute("title", `${fullVisualLabel} · 1 message`);
182
- const truncation = await longLabel.evaluate((element) => ({ clientWidth: element.clientWidth, scrollWidth: element.scrollWidth }));
183
- assert.ok(truncation.scrollWidth > truncation.clientWidth, `the long label should be visually truncated (${truncation.scrollWidth} <= ${truncation.clientWidth})`);
188
+ await overflow.click();
189
+ await expect(menu).toBeVisible();
190
+ await expect(overflow).toHaveAttribute("aria-expanded", "true");
191
+ const hiddenItems = menu.locator(":scope > .composer-intercom-overflow-menu-item:not([hidden])");
192
+ await expect(hiddenItems).toHaveCount(hiddenCount);
193
+ const longMenuItem = hiddenItems.filter({ hasText: longPeerName });
194
+ await expect(longMenuItem).toHaveCount(1);
195
+ await expect(longMenuItem).toBeVisible();
196
+ const fullVisualLabel = await longMenuItem.locator(".composer-intercom-tag-label").textContent();
197
+ assert.ok(fullVisualLabel?.includes(longPeerName), "the overflow menu should retain the full long conversation label in the DOM");
198
+ await expect(longMenuItem).toHaveAttribute("aria-label", `Open agent conversation ${fullVisualLabel}`);
199
+ await expect(longMenuItem).toHaveAttribute("title", `${fullVisualLabel} · 1 message`);
184
200
 
185
- await longTag.click();
201
+ await longMenuItem.click();
186
202
  await expect(page.locator("#intercomConversationDialog")).toBeVisible();
187
203
  await expect(page.locator("#intercomConversationParticipants")).toContainText(`${longPeerName} (${longPeerId})`);
188
204
  await expect(page.locator("#intercomConversationTranscript")).toContainText("Long-label conversation selected correctly");
189
205
  await page.locator("#intercomConversationCloseButton").click();
190
- await expect(longTag).toBeFocused();
206
+ await expect(overflow).toBeFocused();
191
207
  });
192
208
 
193
209
  test("conversation tag opens a safe chat dialog, refreshes, and restores focus", async ({ page }) => {
194
210
  await page.goto(baseURL);
195
- const tags = page.locator("#intercomConversationTags .composer-intercom-tag");
211
+ const tags = page.locator("#intercomConversationTags > .composer-intercom-tag[data-intercom-conversation-id]");
196
212
  const tag = tags.filter({
197
213
  has: page.locator(".composer-intercom-tag-label").filter({ hasText: /↔ Browser Peer \(peer-browser\)$/ }),
198
214
  });
@@ -261,7 +277,7 @@ test("conversation tag opens a safe chat dialog, refreshes, and restores focus",
261
277
  await expect(stableTagLabel).toHaveAttribute("data-stable-visual-marker", "retained");
262
278
  });
263
279
 
264
- test("conversation tags remain reachable through the narrow composer disclosure", async ({ page }) => {
280
+ test("conversation overflow remains reachable through the narrow composer disclosure", async ({ page }) => {
265
281
  await page.setViewportSize({ width: 390, height: 760 });
266
282
  await page.goto(baseURL);
267
283
  const more = page.locator("#composerActionsButton");
@@ -269,39 +285,46 @@ test("conversation tags remain reachable through the narrow composer disclosure"
269
285
  await more.focus();
270
286
  await more.press("Enter");
271
287
  const tags = page.locator("#intercomConversationTags");
272
- const tagButtons = tags.locator(":scope > .composer-intercom-tag");
273
- const tag = tagButtons.filter({
274
- has: page.locator(".composer-intercom-tag-label").filter({ hasText: /↔ Browser Peer \(peer-browser\)$/ }),
275
- });
288
+ const tagButtons = tags.locator(":scope > .composer-intercom-tag[data-intercom-conversation-id]");
289
+ const overflow = tags.locator(":scope > .composer-intercom-tag.overflow");
276
290
  await expect(tags).toBeVisible();
277
291
  await expect(tagButtons).toHaveCount(expectedConversationCount);
278
- for (let index = 0; index < expectedConversationCount; index += 1) {
279
- await expect(tagButtons.nth(index)).toBeVisible();
280
- await expect(tagButtons.nth(index)).toHaveCSS("min-height", "44px");
281
- }
292
+ await expect(overflow).toBeVisible();
293
+ await expect(overflow).toHaveCSS("min-height", "44px");
294
+
282
295
  const layout = await tags.evaluate((element) => {
283
296
  const containerRect = element.getBoundingClientRect();
284
- const tagRects = [...element.querySelectorAll(":scope > .composer-intercom-tag")].map((button) => button.getBoundingClientRect());
297
+ const contextStyle = getComputedStyle(element.parentElement);
298
+ const contextContentWidth = element.parentElement.clientWidth
299
+ - Number.parseFloat(contextStyle.paddingLeft)
300
+ - Number.parseFloat(contextStyle.paddingRight);
301
+ const visibleRects = [...element.querySelectorAll(":scope > .composer-intercom-tag:not([hidden])")].map((button) => button.getBoundingClientRect());
285
302
  return {
286
- clientWidth: element.clientWidth,
287
- scrollWidth: element.scrollWidth,
288
- widths: tagRects.map((rect) => rect.width),
289
- heights: tagRects.map((rect) => rect.height),
290
- rowTops: [...new Set(tagRects.map((rect) => Math.round(rect.top)))],
291
- allContained: tagRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
303
+ containerWidth: containerRect.width,
304
+ contextContentWidth,
305
+ widths: visibleRects.map((rect) => rect.width),
306
+ heights: visibleRects.map((rect) => rect.height),
307
+ rowCenters: visibleRects.map((rect) => rect.top + rect.height / 2),
308
+ allContained: visibleRects.every((rect) => rect.left >= containerRect.left - 0.5 && rect.right <= containerRect.right + 0.5),
292
309
  };
293
310
  });
294
- assert.ok(layout.allContained, "every narrow conversation tag should remain within the tag container");
295
- assert.ok(layout.scrollWidth <= layout.clientWidth, `the narrow tag grid should not overflow horizontally (${layout.scrollWidth} > ${layout.clientWidth})`);
296
- assert.ok(Math.min(...layout.widths) >= 44, `every narrow touch target should be at least 44px wide (minimum ${Math.min(...layout.widths)})`);
297
- assert.ok(Math.min(...layout.heights) >= 44, `every narrow touch target should be at least 44px high (minimum ${Math.min(...layout.heights)})`);
298
- assert.ok(layout.rowTops.length > 1, "the 32-conversation narrow fixture should wrap into multiple rows");
299
- const clippedLabels = await tagButtons.locator(".composer-intercom-tag-label").evaluateAll((labels) => labels.filter((label) => label.scrollWidth > label.clientWidth).length);
300
- assert.ok(clippedLabels > 0, "dense narrow labels should be allowed to truncate visually");
301
- await tag.focus();
302
- await tag.press("Enter");
311
+ assert.ok(layout.containerWidth >= layout.contextContentWidth - 1, `the narrow conversation strip should use the full disclosed row (${layout.containerWidth} < ${layout.contextContentWidth})`);
312
+ assert.ok(layout.allContained, "every visible narrow conversation tag should stay within the tag container");
313
+ assert.ok(Math.min(...layout.widths) >= 44, `every visible narrow touch target should be at least 44px wide (minimum ${Math.min(...layout.widths)})`);
314
+ assert.ok(Math.min(...layout.heights) >= 44, `every visible narrow touch target should be at least 44px high (minimum ${Math.min(...layout.heights)})`);
315
+ assert.ok(Math.max(...layout.rowCenters) - Math.min(...layout.rowCenters) <= 1, "narrow conversation tags should stay vertically aligned on one row before disclosure");
316
+
317
+ const hiddenCount = Number((await overflow.textContent())?.slice(1));
318
+ await overflow.click();
319
+ const hiddenItems = tags.locator(":scope > .composer-intercom-overflow-menu > .composer-intercom-overflow-menu-item:not([hidden])");
320
+ await expect(hiddenItems).toHaveCount(hiddenCount);
321
+ for (let index = 0; index < hiddenCount; index += 1) await expect(hiddenItems.nth(index)).toHaveCSS("min-height", "44px");
322
+ const longMenuItem = hiddenItems.filter({ hasText: longPeerName });
323
+ await expect(longMenuItem).toBeVisible();
324
+ await longMenuItem.focus();
325
+ await longMenuItem.press("Enter");
303
326
  await expect(page.locator("#intercomConversationDialog")).toBeVisible();
304
- await expect(page.locator("#intercomConversationParticipants")).toContainText("Browser Peer (peer-browser)");
327
+ await expect(page.locator("#intercomConversationParticipants")).toContainText(`${longPeerName} (${longPeerId})`);
305
328
  await expect(page.locator("#intercomConversationCloseButton")).toBeVisible();
306
329
  });
307
330
 
@@ -202,3 +202,54 @@ test("Escape closes the composer options menu while its trigger keeps focus", as
202
202
  await page.keyboard.press("Escape");
203
203
  await expect(panel).toBeHidden();
204
204
  });
205
+
206
+ test("a group with more than eight tabs keeps every titled row reachable", async ({ page }) => {
207
+ await page.setViewportSize({ width: 1280, height: 520 });
208
+ await page.goto(baseURL);
209
+ await expect(page.locator("#promptInput")).toBeVisible();
210
+
211
+ const groupedTabs = [];
212
+ for (let index = 1; index <= 9; index += 1) {
213
+ const title = `Overflow title ${index}`;
214
+ const response = await page.request.post(`${baseURL}/api/tabs`, { data: { title } });
215
+ assert.equal(response.ok(), true, `creating ${title} should succeed`);
216
+ const payload = await response.json();
217
+ groupedTabs.push({ id: payload.data.tab.id, title });
218
+ }
219
+
220
+ await page.evaluate((tabs) => {
221
+ localStorage.setItem("pi-webui-terminal-custom-groups-v1", JSON.stringify({
222
+ version: 1,
223
+ groups: [{ id: "overflow-group", title: "Overflow group", tabIds: tabs.map((tab) => tab.id) }],
224
+ }));
225
+ }, groupedTabs);
226
+ await page.reload();
227
+
228
+ const group = page.locator(".terminal-tab-custom-group");
229
+ await expect(group).toHaveCount(1);
230
+ await group.hover();
231
+ const menu = group.locator(".terminal-tab-group-menu");
232
+ await expect(menu).toBeVisible();
233
+ await expect(menu.locator(".terminal-tab-group-item")).toHaveCount(groupedTabs.length);
234
+ assert.deepEqual(
235
+ await menu.locator(".terminal-tab-group-item .terminal-tab-title").allTextContents(),
236
+ groupedTabs.map((tab) => tab.title),
237
+ "the group menu should preserve every server-provided tab title",
238
+ );
239
+
240
+ const bounds = await menu.evaluate((node) => {
241
+ const rect = node.getBoundingClientRect();
242
+ return { bottom: rect.bottom, viewportHeight: window.innerHeight, clientHeight: node.clientHeight, scrollHeight: node.scrollHeight };
243
+ });
244
+ assert.ok(bounds.bottom <= bounds.viewportHeight - 16, `the group menu should stay inside the viewport: ${JSON.stringify(bounds)}`);
245
+ assert.ok(bounds.scrollHeight > bounds.clientHeight, `nine group rows should use the bounded menu scroller: ${JSON.stringify(bounds)}`);
246
+
247
+ await menu.evaluate((node) => { node.scrollTop = node.scrollHeight; });
248
+ const lastRow = menu.locator(".terminal-tab-group-item").last();
249
+ const lastBounds = await lastRow.evaluate((node) => {
250
+ const row = node.getBoundingClientRect();
251
+ const scroller = node.parentElement.getBoundingClientRect();
252
+ return { rowTop: row.top, rowBottom: row.bottom, scrollerTop: scroller.top, scrollerBottom: scroller.bottom };
253
+ });
254
+ assert.ok(lastBounds.rowTop >= lastBounds.scrollerTop && lastBounds.rowBottom <= lastBounds.scrollerBottom, `the final titled row should be reachable by scrolling: ${JSON.stringify(lastBounds)}`);
255
+ });
@@ -55,7 +55,7 @@ assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFas
55
55
  assert.match(technical, /## Normal and compact output[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "technical reference should document Compact mode with the stable identifier");
56
56
  assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "development guide should document Fast-mode integration and cost semantics");
57
57
  // Intent preserved: browser-asset changes must advance the coherent cache tuple.
58
- assert.match(serviceWorker, /pi-webui-pwa-v142/, "PWA cache identity should be bumped for changed browser assets");
59
- assert.match(html, /data-app-src="\/app\.js\?v=175"/, "browser module URL should be cache-busted for Fast-mode wiring");
58
+ assert.match(serviceWorker, /pi-webui-pwa-v145/, "PWA cache identity should be bumped for changed browser assets");
59
+ assert.match(html, /data-app-src="\/app\.js\?v=177"/, "browser module URL should be cache-busted for Fast-mode wiring");
60
60
 
61
61
  console.log("codex-fast-mode-static.test.mjs passed");
@@ -57,8 +57,8 @@ assert.match(app, /function initializeComposerActionOrdering\(\)[\s\S]*MutationO
57
57
  assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreComposerActionOrder\(\)[\s\S]*event\.key === COMPOSER_ACTION_LAYOUT_STORAGE_KEY\) restoreComposerActionSlotLayout\(\)/, "other tabs should apply persisted composer order and sparse-layout changes");
58
58
  assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
59
59
 
60
- assert.match(html, /styles\.css\?v=143/, "changed composer styles should advance the stylesheet revision");
61
- assert.match(html, /app\.js\?v=175/, "changed composer behavior should advance the app revision");
62
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "changed browser assets should advance the PWA cache identity");
60
+ assert.match(html, /styles\.css\?v=145/, "changed composer styles should advance the stylesheet revision");
61
+ assert.match(html, /app\.js\?v=177/, "changed composer behavior should advance the app revision");
62
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v145"/, "changed browser assets should advance the PWA cache identity");
63
63
 
64
64
  console.log("composer-action-grid-reorder-static.test.mjs passed");
@@ -348,10 +348,10 @@ assert.match(
348
348
 
349
349
  assert.match(
350
350
  serviceWorker,
351
- /const CACHE_NAME = "pi-webui-pwa-v142";/,
351
+ /const CACHE_NAME = "pi-webui-pwa-v145";/,
352
352
  "browser asset changes should advance the PWA cache identity",
353
353
  );
354
- assert.match(html, /styles\.css\?v=143/, "visibility styles should advance the stylesheet query revision");
355
- assert.match(html, /data-app-src="\/app\.js\?v=175"/, "visibility behavior should advance the app query revision");
354
+ assert.match(html, /styles\.css\?v=145/, "visibility styles should advance the stylesheet query revision");
355
+ assert.match(html, /data-app-src="\/app\.js\?v=177"/, "visibility behavior should advance the app query revision");
356
356
 
357
357
  console.log("control-visibility-static.test.mjs passed");
@@ -15,8 +15,8 @@ assert.equal((html.match(/class="control-row-label"[^>]*data-tooltip=/g) || []).
15
15
  assert.match(app, /function initializeControlSettingTooltips\(\)[\s\S]*#sidePanelSectionControls \.control-row-label\[data-tooltip\][\s\S]*bindStyledTooltipEvents\(label\)[\s\S]*showFooterTooltip\(label\)/, "Controls help should use the viewport-safe floating tooltip for hover and keyboard access");
16
16
  assert.match(html, /class="control-row remote-auth-control-row" hidden[\s\S]*id="remoteAuthToggle"/, "optional PIN protection should retain its guarded visibility");
17
17
  assert.match(app, /remoteAuthToggle\?\.closest\("\.remote-auth-control-row"\)[\s\S]*remoteAuthRow\.hidden = false/, "loading remote status should reveal the optional PIN protection setting");
18
- assert.match(html, /styles\.css\?v=143/, "Controls stylesheet changes should advance the cache query");
19
- assert.match(html, /app\.js\?v=175/, "Controls tooltip wiring should advance the app cache query");
20
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "Controls browser assets should advance the PWA cache identity");
18
+ assert.match(html, /styles\.css\?v=145/, "Controls stylesheet changes should advance the cache query");
19
+ assert.match(html, /app\.js\?v=177/, "Controls tooltip wiring should advance the app cache query");
20
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v145"/, "Controls browser assets should advance the PWA cache identity");
21
21
 
22
22
  console.log("controls-layout-static.test.mjs passed");
@@ -170,6 +170,13 @@ try {
170
170
  ));
171
171
  assert.equal(replacementStartup.cwd, changedCwd, "replacement child process should actually run in the requested cwd");
172
172
 
173
+ const featureRoutingStatus = await request("/api/prompt", { method: "POST", body: { tab: observedTabId, message: "fixture feature decision clear" } });
174
+ assert.equal(featureRoutingStatus.status, 200, "feature-routing capability status must be accepted before the server restarts");
175
+ await waitFor("feature-routing supervisor metadata", async () => {
176
+ const supervisorState = await readSupervisorState(paths);
177
+ return supervisorState?.tabs?.find((tab) => tab.id === observedTabId)?.metadata?.featureSystemPromptDetected === true;
178
+ });
179
+
173
180
  const controlledPrompt = await request("/api/prompt", { method: "POST", body: { tab: observedTabId, message: streamPrompt } });
174
181
  assert.equal(controlledPrompt.status, 200, "controlled-restart prompt must be accepted once");
175
182
  const preRestartTab = (await tabs())[0];
@@ -219,6 +226,8 @@ try {
219
226
  const reconnectEvents = await initialSseEvents(observedTabId);
220
227
  const connectedEvent = reconnectEvents.find((event) => event.type === "webui_connected");
221
228
  const replayGapEvent = reconnectEvents.find((event) => event.type === "webui_supervisor_replay_gap");
229
+ const featureRoutingReplay = reconnectEvents.find((event) => event.type === "extension_ui_request" && event.method === "setStatus" && event.statusKey === "feature-decision-output");
230
+ assert.equal(featureRoutingReplay?.replayed, true, "replacement server must replay persisted feature-routing capability evidence before another prompt");
222
231
  assert.equal(connectedEvent?.supervisorReplayGap, true, "actual replacement server must report a truthful cursor-less replay gap");
223
232
  assert.equal(Object.hasOwn(connectedEvent || {}, "supervisorGap"), false, "replacement server must use the browser's canonical replay-gap field");
224
233
  assert.equal(replayGapEvent?.supervisorReplayGap, true, "replacement SSE must explicitly warn that authoritative replay recovery ran");
@@ -124,8 +124,8 @@ assert.match(styles, /\.event-log\[data-display-mode="compact"\] \.event\[data-e
124
124
  assert.match(styles, /\.event-tree-context-menu \{[\s\S]*max-width: calc\(100vw - 1rem\)/, "the dedicated menu should remain viewport bounded");
125
125
 
126
126
  // Cache tuple for this browser-asset change.
127
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142";/, "the PWA cache identity should advance");
128
- assert.match(html, /styles\.css\?v=143/, "compact-mode styles should advance the stylesheet revision");
129
- assert.match(html, /data-app-src="\/app\.js\?v=175"/, "the app query revision should advance");
127
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v145";/, "the PWA cache identity should advance");
128
+ assert.match(html, /styles\.css\?v=145/, "compact-mode styles should advance the stylesheet revision");
129
+ assert.match(html, /data-app-src="\/app\.js\?v=177"/, "the app query revision should advance");
130
130
 
131
131
  console.log("events-tree-context-menu-static.test.mjs passed");
@@ -159,7 +159,7 @@ assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA
159
159
  assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
160
160
  assert.match(html, /Lightweight browser rendering; Markdown final output; live thinking expanded; stored thinking grouped and collapsed/, "the sidebar should distinguish compact rendering from model inference");
161
161
  // Intent preserved: the guarded PWA entry point must advance whenever app wiring changes.
162
- assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=175"/, "the guarded PWA entry point should cache-bust browser wiring");
162
+ assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=177"/, "the guarded PWA entry point should cache-bust browser wiring");
163
163
  assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
164
164
 
165
165
  const events = createFastModeOutputEvents();
@@ -166,7 +166,7 @@ assert.match(functionSource("closeTerminalTabs"), /clearFeatureDecisionStateForT
166
166
  assert.match(app, /case "webui_connected":[\s\S]*clearFeatureDecisionStateForTab\(connectedTabId, \{ render: true \}\)[\s\S]*scheduleForegroundReconcile\("event stream reconnect", 0\)/, "reconnect should clear local state before authoritative replay");
167
167
  assert.match(app, /statusKey === FEATURE_DECISION_OUTPUT_STATUS_KEY[\s\S]*handleFeatureDecisionOutputStatus[\s\S]*return;[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*return;[\s\S]*statusEntries\.set/, "both feature statuses should be intercepted before generic footer storage while preserving category handling");
168
168
 
169
- assert.match(html, /\/styles\.css\?v=143/, "integrated stylesheet changes should advance the cache query");
170
- assert.match(html, /\/app\.js\?v=175/, "integrated app changes should advance the cache query");
169
+ assert.match(html, /\/styles\.css\?v=145/, "integrated stylesheet changes should advance the cache query");
170
+ assert.match(html, /\/app\.js\?v=177/, "integrated app changes should advance the cache query");
171
171
 
172
172
  console.log("feature decision-output popup static checks passed");
@@ -62,8 +62,8 @@ assert.match(css, /\.file-viewer-image img \{[\s\S]*max-width: 100%;[\s\S]*max-h
62
62
  assert.match(readme, /PNG, JPEG, GIF, WebP, and AVIF/i, "the Files panel guide should list supported image formats");
63
63
  assert.match(technical, /supported raster images[\s\S]*2 MiB/i, "the advanced reference should document image support and its size limit");
64
64
  assert.match(development, /kind: "image"[\s\S]*base64/i, "the contributor guide should document the image response contract");
65
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v142"/, "changed viewer assets should advance the PWA cache identity");
66
- assert.match(html, /styles\.css\?v=143/, "changed image styles should advance the stylesheet revision");
67
- assert.match(html, /app\.js\?v=175/, "changed image rendering should advance the app revision");
65
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v145"/, "changed viewer assets should advance the PWA cache identity");
66
+ assert.match(html, /styles\.css\?v=145/, "changed image styles should advance the stylesheet revision");
67
+ assert.match(html, /app\.js\?v=177/, "changed image rendering should advance the app revision");
68
68
 
69
69
  console.log("file viewer image static tests passed");
@@ -1600,9 +1600,9 @@ rl.on("line", (line) => {
1600
1600
  { name: "workflow", source: "extension", description: "Run and inspect JavaScript workflows" },
1601
1601
  ...(guidedGitActivationEnabled ? [
1602
1602
  { name: "git-guided-workflow", source: "extension", description: "Start Guided Git" },
1603
- { name: "git-staged-msg", source: "prompt", description: "Generate commit messages" },
1604
- { name: "git-branch-name", source: "prompt", description: "Generate branch names" },
1605
- { name: "pr", source: "prompt", description: "Generate PR text" },
1603
+ { name: "git-staged-msg", source: "extension", description: "Generate commit messages" },
1604
+ { name: "git-branch-name", source: "extension", description: "Generate branch names" },
1605
+ { name: "pr", source: "extension", description: "Generate PR text" },
1606
1606
  ] : []),
1607
1607
  ...(statsPromptContextEnabled ? [{ name: "stats-webui", source: "extension", description: "Publish fixture stats dashboard" }] : []),
1608
1608
  ],
@@ -22,8 +22,10 @@ test("Guided Git activation is intercepted before generic status rendering and b
22
22
  assert.match(app, /function handleInactiveTabEvent\(event\) \{\n if \(handleGuidedGitActivationRequest\(event\)\) return;/u);
23
23
  assert.match(app, /guidedGitActivationController\.consume\(request, async \(tabId, activationIsCurrent\)/u);
24
24
  assert.match(app, /startGitWorkflow\(tabId, \{ activationIsCurrent \}\)/u, "tab reset or close must invalidate an asynchronous activation start");
25
+ assert.match(app, /api\("\/api\/git-workflow\/preferences\?includeModels=false", \{ tabId \}\)/u, "configured startup must not wait for the setup-only model catalog RPC");
26
+ assert.match(server, /includeModels = url\.searchParams\.get\("includeModels"\) !== "false"[\s\S]*gitWorkflowPreferencesData\(tab, \{ includeModels \}\)/u, "the preferences route must expose the explicit lightweight startup read");
25
27
  assert.match(app, /openNativeGitWorkflowSetupDialog\(\{\s+tabId,\s+activationIsCurrent,\s+onSaved: \(\) => startGitWorkflow\(tabId, \{ skipSetup: true, activationIsCurrent \}\),\s+\}\)/u, "setup and its local continuation must preserve the envelope tab and the same activation owner");
26
- assert.match(app, /async function openNativeGitWorkflowSetupDialog\(\{ onSaved, tabId = activeTabId, activationIsCurrent = \(\) => true \} = \{\}\)[\s\S]*nativeCommandTabId = tabId[\s\S]*nativeCommandApi\("\/api\/git-workflow\/preferences", \{ tabId \}\)[\s\S]*const targetState = tabId === activeTabId \? currentState : tabStateCache\.get\(tabId\)/u, "setup loads models and preferences only for the originating tab");
28
+ assert.match(app, /async function openNativeGitWorkflowSetupDialog\(\{ onSaved, tabId = activeTabId, activationIsCurrent = \(\) => true \} = \{\}\)[\s\S]*nativeCommandTabId = tabId[\s\S]*nativeCommandApi\("\/api\/git-workflow\/preferences", \{ tabId \}\)[\s\S]*const targetState = tabId === activeTabId \? currentState : tabStateCache\.get\(tabId\)/u, "setup still loads the full model catalog for the originating tab");
27
29
  assert.match(app, /const setupOwner = Symbol\(tabId\);[\s\S]*const setupOwnsDialog = \(\) => guidedGitSetupDialogOwner === setupOwner;[\s\S]*const handleSetupClose = \(\) => \{\s+if \(!saveInFlight\) settleSetup\("cancelled"\);[\s\S]*if \(!activationIsCurrent\(\)\) \{\s+closeOwnedSetupDialog\(\);\s+settleSetup\("stale"\);/u, "Cancel must settle ownership, stale reset\/cwd\/session owners must fail closed, and an old response must not close a replacement setup dialog");
28
30
  assert.match(app, /nativeCommandApi\("\/api\/git-workflow\/preferences", \{\s+method: "POST",\s+tabId,[\s\S]*if \(typeof onSaved === "function" && activationIsCurrent\(\)\)/u, "Save and its continuation must stay tab-bound and owner-guarded");
29
31
  assert.match(app, /function resetGitWorkflowForTab[\s\S]*guidedGitLaunchPermits\.clearTab\(tabId\);[\s\S]*guidedGitActivationController\.clearTab\(tabId\);/u, "reset, cwd change, and new-session seams must invalidate permits and activation ownership together");
@@ -48,9 +50,10 @@ test("all visible Guided Git entry points prefer the extension launcher without
48
50
  assert.match(app, /guidedGitLaunchBlockedReason\(guidedGitLaunchStateForTab\(tabId\), queueMessageCount\(queuedSnapshotForTab\(tabId\)\)\)/u, "busy admission must include streaming, compaction, canonical pending count, and the real tab-local queue snapshot");
49
51
  });
50
52
 
51
- test("temporary fallback and prompt capabilities are explicit and tab-local", () => {
52
- assert.match(app, /async function startLegacyGuidedGitWorkflowFallback\(tabId\) \{\s+if \(!guidedGitLaunchAdmitted\(tabId\)\) return;[\s\S]*api\("\/api\/git-workflow\/launch-admission", \{ method: "POST", body: \{\}, tabId \}\)/u, "the direct compatibility fallback must receive authoritative server admission immediately before local start");
53
- assert.match(app, /if \(launchMode === "fallback"\) \{\n await startLegacyGuidedGitWorkflowFallback\(tabId\);/u);
53
+ test("native generation capabilities are extension-only and tab-local", () => {
54
+ assert.doesNotMatch(app, /startLegacyGuidedGitWorkflowFallback|temporary prompt-only Guided Git compatibility launcher/u);
55
+ assert.match(app, /function hasLoadedGuidedGitNativeCommand\(commandName, tabId\)[\s\S]*rpcOnly: true[\s\S]*source === "extension"/u);
56
+ assert.match(app, /guidedGitNativeCommandsAvailable[\s\S]*\["git-staged-msg", "git-branch-name", "pr"\]\.every/u);
54
57
  assert.match(state, /function guidedGitLaunchModeForTabCatalog[\s\S]*return "extension"[\s\S]*return "fallback"[\s\S]*return "unavailable"/u);
55
58
  assert.match(state, /createGuidedGitLaunchPermitController\(\{ maxTrackedTabs = 64, permitTtlMs = 15_000 \}/u);
56
59
  assert.match(app, /claimStart: \(tabId, _payload, request, now\) => guidedGitLaunchPermits\.consume\(tabId, request\?\.guidedGitLaunchId, now\)/u, "only the browser client holding the exact envelope-correlated permit may claim activation");
@@ -60,19 +63,28 @@ test("temporary fallback and prompt capabilities are explicit and tab-local", ()
60
63
  assert.match(server, /return \{ \.\.\.event, guidedGitLaunchId: pending\.launchId \};/u, "browser launch correlation belongs only to the trusted transport envelope");
61
64
  assert.match(server, /GUIDED_GIT_LAUNCH_TTL_MS = 15_000/u);
62
65
  assert.match(server, /guidedGitPendingLaunch: null/u, "pending launch state is bounded to one record per tab and dies with the tab");
63
- assert.match(app, /temporary prompt-only Guided Git compatibility launcher/u);
64
- assert.match(app, /hasLoadedRpcCommand\("git-staged-msg", \{ tabId \}\)/u);
65
- assert.match(app, /hasLoadedRpcCommand\("git-branch-name", \{ tabId \}\)/u);
66
- assert.match(app, /hasLoadedRpcCommand\("pr", \{ tabId \}\)/u);
67
- assert.match(app, /packageName: "@firstpick\/pi-extension-git-guided-workflow"[\s\S]*Browser generation also requires @firstpick\/pi-prompts-git-pr/u);
66
+ assert.match(app, /hasLoadedGuidedGitNativeCommand\("git-staged-msg", tabId\)/u);
67
+ assert.match(app, /hasLoadedGuidedGitNativeCommand\("git-branch-name", tabId\)/u);
68
+ assert.match(app, /hasLoadedGuidedGitNativeCommand\("pr", tabId\)/u);
69
+ assert.match(app, /Same-named prompt templates are not used/u);
70
+ assert.doesNotMatch(`${app}\n${readme}\n${technical}\n${development}`, /pi-prompts-git-pr/u);
71
+ });
72
+
73
+ test("server dispatch requires extension provenance and completes on a fresh native artifact", () => {
74
+ assert.match(server, /async function resolveGuidedGitNativeCommand[\s\S]*candidate\?\.source === "extension"[\s\S]*Same-named prompt templates are not used/u);
75
+ assert.match(server, /record\.nativeCommandName = nativeCommandName;\s+record\.message = gitWorkflowGenerationPrompt\(kind, preferences, nativeCommandName\)/u);
76
+ assert.match(server, /function guidedGitNativeCommandErrorFromEvent[\s\S]*event\?\.type !== "extension_error"[\s\S]*event\.extensionPath !== `command:\$\{commandName\}`/u);
77
+ assert.match(server, /if \(record\.nativeCommandError\) throw record\.nativeCommandError;[\s\S]*await assertGuidedGitNativeArtifactUpdated\(tab, record\);[\s\S]*finishGitWorkflowGeneration\(tab, record, \{ successful: true \}\)/u);
78
+ assert.match(server, /const target = path\.resolve\(base, `\$\{encodeURIComponent\(branch\)\}\.md`\)/u);
79
+ assert.match(development, /correlated `extension_error` event as the native command's terminal failure/u);
68
80
  });
69
81
 
70
82
  test("fixture, cache revisions, and layered docs expose the migration contract", () => {
71
83
  assert.match(fakePi, /FAKE_PI_GUIDED_GIT_ACTIVATION/u);
72
84
  assert.match(fakePi, /git-guided-workflow:webui-start/u);
73
- assert.match(html, /styles\.css\?v=143/u);
74
- assert.match(html, /app\.js\?v=175/u);
75
- assert.match(serviceWorker, /pi-webui-pwa-v142/u);
85
+ assert.match(html, /styles\.css\?v=145/u);
86
+ assert.match(html, /app\.js\?v=177/u);
87
+ assert.match(serviceWorker, /pi-webui-pwa-v145/u);
76
88
  assert.match(serviceWorker, /"\/guided-git-command-state\.mjs"/u);
77
89
  assert.match(readme, /pi-extension-git-guided-workflow/u);
78
90
  assert.match(technical, /\/git-guided-workflow/u);