@firstpick/pi-package-webui 0.8.5 → 0.8.7

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 (110) hide show
  1. package/README.md +18 -584
  2. package/bin/pi-webui-launcher.mjs +22 -0
  3. package/bin/pi-webui-update-supervisor.mjs +86 -0
  4. package/bin/pi-webui.mjs +933 -554
  5. package/index.ts +16 -6
  6. package/lib/component-update-state.mjs +21 -0
  7. package/lib/git-workflow-preferences.mjs +20 -2
  8. package/lib/optional-feature-catalog.mjs +1 -0
  9. package/lib/sampling-parameter-capabilities.mjs +160 -0
  10. package/lib/session-summary-core.mjs +4 -3
  11. package/lib/session-summary-preferences.mjs +16 -1
  12. package/lib/subagent-launch-slots.mjs +14 -2
  13. package/lib/trust-boundaries.mjs +16 -0
  14. package/lib/update/executor.mjs +99 -0
  15. package/lib/update/journal.mjs +175 -0
  16. package/lib/update/owners.mjs +70 -0
  17. package/lib/update/plan.mjs +134 -0
  18. package/lib/update/resolver.mjs +168 -0
  19. package/lib/update/supervisor.mjs +238 -0
  20. package/lib/update/verify.mjs +52 -0
  21. package/lib/update-commands.mjs +25 -13
  22. package/lib/webui-workspaces.mjs +17 -1
  23. package/lib/workspace-session-summaries.mjs +400 -0
  24. package/package.json +4 -4
  25. package/public/app.js +2487 -349
  26. package/public/index.html +200 -51
  27. package/public/middle-button-drag-scroll.mjs +154 -0
  28. package/public/sampling-parameter-controls.mjs +361 -0
  29. package/public/service-worker.js +5 -1
  30. package/public/stream-output-controller.mjs +327 -0
  31. package/public/styles.css +666 -71
  32. package/public/theme-contract.mjs +244 -0
  33. package/session-summary.ts +164 -4
  34. package/tests/aur-review-widget-static.test.mjs +2 -1
  35. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  36. package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
  37. package/tests/browser/interaction-continuity.spec.mjs +2 -2
  38. package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
  39. package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
  40. package/tests/browser/sampling-tooltip.spec.mjs +228 -0
  41. package/tests/browser/session-summary.spec.mjs +131 -3
  42. package/tests/browser/stream-output-isolation.spec.mjs +510 -0
  43. package/tests/browser/update-reconnect.spec.mjs +92 -0
  44. package/tests/codex-fast-mode-static.test.mjs +2 -2
  45. package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
  46. package/tests/common-options-submenus-markup-static.test.mjs +152 -0
  47. package/tests/component-update-api-static.test.mjs +22 -61
  48. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  49. package/tests/control-deck-component-updates-static.test.mjs +13 -237
  50. package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
  51. package/tests/fast-mode-client-static.test.mjs +3 -2
  52. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  53. package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
  54. package/tests/fixtures/fake-pi.mjs +269 -2
  55. package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
  56. package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
  57. package/tests/git-footer-context-menu-static.test.mjs +58 -0
  58. package/tests/git-workflow-preferences.test.mjs +7 -1
  59. package/tests/guided-git-aur-review.test.mjs +4 -3
  60. package/tests/http-endpoints-harness.test.mjs +274 -23
  61. package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
  62. package/tests/middle-button-drag-scroll.test.mjs +170 -0
  63. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  64. package/tests/mobile-foundation-static.test.mjs +5 -6
  65. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  66. package/tests/mobile-static.test.mjs +85 -50
  67. package/tests/native-parity.test.mjs +1 -1
  68. package/tests/open-issue-wizard-static.test.mjs +2 -3
  69. package/tests/optional-feature-migration-frontend.test.mjs +9 -5
  70. package/tests/persistent-ui-layout-static.test.mjs +13 -2
  71. package/tests/questionnaire-dialog.test.mjs +3 -3
  72. package/tests/remote-auth-settings-harness.test.mjs +43 -0
  73. package/tests/rpc-supervisor-host.test.mjs +11 -2
  74. package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
  75. package/tests/safety-guard-auto-review-static.test.mjs +34 -0
  76. package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
  77. package/tests/sampling-parameter-capabilities.test.mjs +167 -0
  78. package/tests/sampling-parameter-controls.test.mjs +241 -0
  79. package/tests/session-sampling-helper.test.mjs +228 -0
  80. package/tests/session-sampling-http.test.mjs +168 -0
  81. package/tests/session-sampling-ui-static.test.mjs +370 -0
  82. package/tests/session-summary-core.test.mjs +205 -10
  83. package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
  84. package/tests/side-panel-section-reorder-static.test.mjs +3 -3
  85. package/tests/staged-content-hash-contract.test.mjs +52 -11
  86. package/tests/stream-lifecycle-core.test.mjs +134 -0
  87. package/tests/stream-output-controller.test.mjs +252 -0
  88. package/tests/stream-output-isolation-static.test.mjs +89 -0
  89. package/tests/streaming-ui-coupling.test.mjs +50 -0
  90. package/tests/subagent-gate-visibility.test.mjs +1 -1
  91. package/tests/subagent-launch-slots-static.test.mjs +1 -1
  92. package/tests/subagent-launch-slots.test.mjs +18 -1
  93. package/tests/theme-contract.test.mjs +104 -0
  94. package/tests/theme-customizer-static.test.mjs +82 -0
  95. package/tests/theme-scheme-mode.test.mjs +15 -0
  96. package/tests/ui-layout-settings.test.mjs +18 -1
  97. package/tests/update-api-harness.test.mjs +111 -0
  98. package/tests/update-commands.test.mjs +15 -45
  99. package/tests/update-executor-process-tree-harness.test.mjs +22 -0
  100. package/tests/update-journal-harness.test.mjs +59 -0
  101. package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
  102. package/tests/update-owners.test.mjs +27 -0
  103. package/tests/update-plan.test.mjs +58 -0
  104. package/tests/update-resolver.test.mjs +56 -0
  105. package/tests/update-supervisor-harness.test.mjs +57 -0
  106. package/tests/update-tab-restore-harness.test.mjs +24 -0
  107. package/tests/update-verify.test.mjs +31 -0
  108. package/tests/workspace-files-live-updates-static.test.mjs +13 -4
  109. package/tests/workspace-session-summaries.test.mjs +288 -0
  110. package/webui-rpc-helper.mjs +119 -0
@@ -106,6 +106,10 @@ function generatedSummaryResponse() {
106
106
  }
107
107
 
108
108
  async function installSummaryRoutes(page, requests, { configured = false, summary = null, generate = generatedSummaryResponse } = {}) {
109
+ const requestTabId = (route) => new URL(route.request().url()).searchParams.get("tab");
110
+ requests.getTabs = [];
111
+ requests.putTabs = [];
112
+ requests.generateTabs = [];
109
113
  await page.route("**/api/commands?*", async (route) => {
110
114
  await route.fulfill({
111
115
  status: 200,
@@ -118,16 +122,21 @@ async function installSummaryRoutes(page, requests, { configured = false, summar
118
122
  });
119
123
  await page.route("**/api/session-summary/preferences?*", async (route) => {
120
124
  const method = route.request().method();
125
+ const tabId = requestTabId(route);
121
126
  if (method === "GET") {
122
127
  requests.get += 1;
123
- await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data: preferencesData({ configured, summary }) }) });
128
+ requests.getTabs.push(tabId);
129
+ const tabSummary = typeof summary === "function" ? summary(tabId) : summary;
130
+ await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data: preferencesData({ configured, summary: tabSummary }) }) });
124
131
  return;
125
132
  }
133
+ requests.putTabs.push(tabId);
126
134
  requests.put.push(JSON.parse(route.request().postData() || "{}"));
127
135
  await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data: preferencesData({ configured: true }) }) });
128
136
  });
129
137
  await page.route("**/api/session-summary/generate?*", async (route) => {
130
138
  const request = JSON.parse(route.request().postData() || "{}");
139
+ requests.generateTabs.push(requestTabId(route));
131
140
  requests.generate.push(request);
132
141
  const response = await generate(request, requests.generate.length);
133
142
  await route.fulfill({
@@ -143,7 +152,7 @@ test("first click opens confirmed setup, cancel has no side effect, and save ope
143
152
  await installSummaryRoutes(page, requests);
144
153
  await page.goto(baseURL);
145
154
 
146
- const summaryButton = page.locator("#summaryHeaderButton");
155
+ const summaryButton = page.locator(".terminal-tab.active[data-tab-id] > .terminal-tab-actions > .terminal-tab-summary-button");
147
156
  await expect(summaryButton).toBeVisible();
148
157
  await summaryButton.evaluate((button) => button.click());
149
158
  await expect(page.locator("#nativeCommandDialog")).toBeVisible();
@@ -231,7 +240,7 @@ test("typed summary commands stay native, preserve failures, reset sessions, res
231
240
  await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data: {} }) });
232
241
  });
233
242
  await page.goto(baseURL);
234
- await expect(page.locator("#summaryHeaderButton")).toBeVisible();
243
+ await expect(page.locator(".terminal-tab.active[data-tab-id] > .terminal-tab-actions > .terminal-tab-summary-button")).toBeVisible();
235
244
 
236
245
  const prompt = page.locator("#promptInput");
237
246
  await prompt.fill("/summary");
@@ -269,3 +278,122 @@ test("typed summary commands stay native, preserve failures, reset sessions, res
269
278
  await expect(page.locator("#tabBar [role=\"tab\"]")).toHaveCount(2);
270
279
  await expect(page.locator("#sessionSummaryOverlay")).toBeHidden();
271
280
  });
281
+
282
+ test("inactive and grouped tab actions keep setup, generation, and busy state scoped without activating the tab", async ({ page }) => {
283
+ const requests = { get: 0, put: [], generate: [] };
284
+ let releaseGeneration;
285
+ const generationReleased = new Promise((resolve) => { releaseGeneration = resolve; });
286
+ await installSummaryRoutes(page, requests, {
287
+ generate: async () => {
288
+ await generationReleased;
289
+ return generatedSummaryResponse();
290
+ },
291
+ });
292
+ await page.goto(baseURL);
293
+ await expect(page.locator(".terminal-tab[data-tab-id]").first()).toBeVisible();
294
+ const initialTabCount = await page.locator(".terminal-tab[data-tab-id]").count();
295
+ expect(initialTabCount).toBeGreaterThan(0);
296
+ await expect(page.locator(".terminal-tab-summary-button")).toHaveCount(initialTabCount);
297
+
298
+ const firstTabId = await page.locator(".terminal-tab[data-tab-id]").first().getAttribute("data-tab-id");
299
+ await page.locator("#newTabButton").evaluate((button) => button.click());
300
+ await page.locator("#newTabCurrentDirectoryButton").evaluate((button) => button.click());
301
+ const expectedTabCount = initialTabCount + 1;
302
+ await expect(page.locator(".terminal-tab[data-tab-id]")).toHaveCount(expectedTabCount);
303
+ await expect(page.locator(".terminal-tab-summary-button")).toHaveCount(expectedTabCount);
304
+
305
+ await page.reload();
306
+ await expect(page.locator(".terminal-tab[data-tab-id]")).toHaveCount(expectedTabCount);
307
+ await expect(page.locator(".terminal-tab-summary-button")).toHaveCount(expectedTabCount);
308
+
309
+ const activeTab = page.locator(".terminal-tab.active[data-tab-id]");
310
+ const activeTabId = await activeTab.getAttribute("data-tab-id");
311
+ expect(activeTabId).not.toBe(firstTabId);
312
+ const inactiveSummary = page.locator(`[data-tab-id="${firstTabId}"] > .terminal-tab-actions > .terminal-tab-summary-button`);
313
+ const activeSummary = page.locator(`[data-tab-id="${activeTabId}"] > .terminal-tab-actions > .terminal-tab-summary-button`);
314
+ await inactiveSummary.click();
315
+ await expect(page.locator("#nativeCommandDialog")).toBeVisible();
316
+ await expect(page.locator("#nativeCommandTitle")).toHaveText("/summary-setup");
317
+ await expect(page.locator(`[data-tab-id="${activeTabId}"]`)).toHaveClass(/active/);
318
+
319
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Save and generate" }).click();
320
+ await page.locator("#confirmationConfirmButton").click();
321
+ await expect.poll(() => requests.generate.length).toBe(1);
322
+ expect(requests.putTabs).toEqual([firstTabId]);
323
+ expect(requests.generateTabs).toEqual([firstTabId]);
324
+ await expect(inactiveSummary).toBeDisabled();
325
+ await expect(inactiveSummary).toHaveAttribute("aria-busy", "true");
326
+ await expect(activeSummary).toBeEnabled();
327
+ await expect(activeSummary).toHaveAttribute("aria-busy", "false");
328
+ await expect(page.locator(`[data-tab-id="${activeTabId}"]`)).toHaveClass(/active/);
329
+
330
+ releaseGeneration();
331
+ await expect(page.locator("#sessionSummaryOverlay")).toBeVisible();
332
+ await expect(page.locator("#sessionSummaryOverlayTitle")).toHaveText("Validated fixture title");
333
+ await expect(inactiveSummary).toBeEnabled();
334
+ await page.keyboard.press("Escape");
335
+
336
+ await page.locator(`.terminal-tab[data-tab-id="${activeTabId}"]`).dragTo(page.locator(`.terminal-tab[data-tab-id="${firstTabId}"]`));
337
+ const group = page.locator(".terminal-tab-custom-group");
338
+ await expect(group).toHaveCount(1);
339
+ await group.hover();
340
+ await expect(group.locator(".terminal-tab-group-item")).toHaveCount(2);
341
+ await expect(group.locator(".terminal-tab-group-item > .terminal-tab-actions > .terminal-tab-summary-button")).toHaveCount(2);
342
+ await group.locator(`[data-tab-id="${firstTabId}"] > .terminal-tab-actions > .terminal-tab-summary-button`).click();
343
+ await expect(page.locator("#sessionSummaryOverlayTitle")).toHaveText("Validated fixture title");
344
+ await expect(group.locator(`[data-tab-id="${activeTabId}"]`)).toHaveClass(/active/);
345
+ });
346
+
347
+ test("focus returns to a regenerated per-tab summary action after tab controls rerender", async ({ page }) => {
348
+ const requests = { get: 0, put: [], generate: [] };
349
+ await installSummaryRoutes(page, requests, { configured: true });
350
+ await page.goto(baseURL);
351
+
352
+ await expect(page.locator("#promptInput")).toBeFocused();
353
+ const summaryButton = page.locator(".terminal-tab.active[data-tab-id] > .terminal-tab-actions > .terminal-tab-summary-button, .terminal-tab-group.active .terminal-tab-group-item.active > .terminal-tab-actions > .terminal-tab-summary-button");
354
+ await expect(summaryButton).toHaveCount(1);
355
+ await summaryButton.evaluate((button) => button.click());
356
+ await expect(page.locator("#sessionSummaryOverlayTitle")).toHaveText("Validated fixture title");
357
+ await page.keyboard.press("Escape");
358
+ await expect(summaryButton).toBeFocused();
359
+ });
360
+
361
+ test("each terminal tab stacks Split and Summary across one horizontally divided action slot", async ({ page }) => {
362
+ const requests = { get: 0, put: [], generate: [] };
363
+ await installSummaryRoutes(page, requests, { configured: true });
364
+ await page.goto(baseURL);
365
+
366
+ await expect(page.locator("#splitTabButton")).toHaveCount(0);
367
+ const initialTabCount = await page.locator("[data-tab-id] > .terminal-tab-actions").count();
368
+ const activeGroup = page.locator(".terminal-tab-group.active");
369
+ if (await activeGroup.count()) await activeGroup.hover();
370
+ const activeActions = page.locator(".terminal-tab.active[data-tab-id] > .terminal-tab-actions, .terminal-tab-group.active .terminal-tab-group-item.active > .terminal-tab-actions");
371
+ await expect(activeActions).toHaveCount(1);
372
+ await expect(activeActions.locator(":scope > .terminal-tab-split-button")).toHaveCount(1);
373
+ await expect(activeActions.locator(":scope > .terminal-tab-summary-button")).toHaveCount(1);
374
+ const actionGeometry = await activeActions.evaluate((slot) => ({
375
+ slotWidth: slot.getBoundingClientRect().width,
376
+ splitWidth: slot.querySelector(".terminal-tab-split-button")?.getBoundingClientRect().width || 0,
377
+ summaryWidth: slot.querySelector(".terminal-tab-summary-button")?.getBoundingClientRect().width || 0,
378
+ slotHeight: slot.getBoundingClientRect().height,
379
+ tabHeight: slot.parentElement?.querySelector(":scope > .terminal-tab-button")?.getBoundingClientRect().height || 0,
380
+ splitHeight: slot.querySelector(".terminal-tab-split-button")?.getBoundingClientRect().height || 0,
381
+ summaryHeight: slot.querySelector(".terminal-tab-summary-button")?.getBoundingClientRect().height || 0,
382
+ }));
383
+ expect(Math.abs(actionGeometry.splitWidth - actionGeometry.slotWidth)).toBeLessThanOrEqual(1);
384
+ expect(Math.abs(actionGeometry.summaryWidth - actionGeometry.slotWidth)).toBeLessThanOrEqual(1);
385
+ expect(Math.abs(actionGeometry.slotHeight - actionGeometry.tabHeight)).toBeLessThan(1);
386
+ expect(Math.abs(actionGeometry.splitHeight - actionGeometry.summaryHeight)).toBeLessThan(1);
387
+ expect(Math.abs((actionGeometry.splitHeight + actionGeometry.summaryHeight) - actionGeometry.slotHeight)).toBeLessThan(2);
388
+
389
+ await activeActions.locator(":scope > .terminal-tab-split-button").click();
390
+ await expect(page.locator("[data-tab-id] > .terminal-tab-actions")).toHaveCount(initialTabCount + 1);
391
+ await expect(page.locator("#terminalSplitShell")).toBeVisible();
392
+ const splitTabId = await page.locator("#terminalSplitFrame").getAttribute("data-tab-id");
393
+ expect(splitTabId).toBeTruthy();
394
+ const splitControl = page.locator(`[data-tab-id="${splitTabId}"] > .terminal-tab-actions > .terminal-tab-split-button`);
395
+ await expect(splitControl).toHaveAttribute("aria-pressed", "true");
396
+ await splitControl.evaluate((button) => button.click());
397
+ await expect(page.locator("#terminalSplitShell")).toBeHidden();
398
+ await expect(splitControl).toHaveAttribute("aria-pressed", "false");
399
+ });