@firstpick/pi-package-webui 0.9.8 → 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 (59) hide show
  1. package/DEVELOPMENT.md +911 -0
  2. package/README.md +8 -8
  3. package/TECHNICAL.md +415 -0
  4. package/bin/pi-webui.mjs +237 -64
  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/lib/windows-drive-roots.mjs +114 -0
  10. package/package.json +3 -1
  11. package/public/app.js +274 -90
  12. package/public/index.html +7 -3
  13. package/public/service-worker.js +1 -1
  14. package/public/styles.css +76 -16
  15. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  16. package/tests/browser/intercom-conversation-viewer.spec.mjs +76 -53
  17. package/tests/browser/user-noticeable-fixes.spec.mjs +51 -0
  18. package/tests/browser/windows-drive-parent.spec.mjs +198 -0
  19. package/tests/codex-fast-mode-static.test.mjs +2 -2
  20. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  21. package/tests/control-visibility-static.test.mjs +3 -3
  22. package/tests/controls-layout-static.test.mjs +3 -3
  23. package/tests/durable-rpc-supervisor-harness.test.mjs +9 -0
  24. package/tests/events-tree-context-menu-static.test.mjs +3 -3
  25. package/tests/fast-mode-client-static.test.mjs +1 -1
  26. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  27. package/tests/file-viewer-image-static.test.mjs +3 -3
  28. package/tests/fixtures/fake-pi.mjs +3 -3
  29. package/tests/guided-git-activation-static.test.mjs +24 -12
  30. package/tests/guided-git-fallback-runtime.test.mjs +209 -270
  31. package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
  32. package/tests/guided-git-message-reliability-static.test.mjs +2 -1
  33. package/tests/guided-git-optional-feature.test.mjs +8 -5
  34. package/tests/http-endpoints-harness.test.mjs +22 -4
  35. package/tests/intercom-conversation-viewer-static.test.mjs +7 -6
  36. package/tests/intercom-tag-layout-static.test.mjs +35 -16
  37. package/tests/intercom-tag-overflow-layout.test.mjs +87 -0
  38. package/tests/main-output-loading-static.test.mjs +3 -3
  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 +11 -6
  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 +3 -3
  47. package/tests/questionnaire-dialog.test.mjs +3 -3
  48. package/tests/remote-auth-settings-harness.test.mjs +18 -3
  49. package/tests/resource-tui-extension.test.mjs +2 -1
  50. package/tests/session-sampling-ui-static.test.mjs +3 -3
  51. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  52. package/tests/subagent-observability-static.test.mjs +2 -2
  53. package/tests/syntax-highlighting-static.test.mjs +3 -3
  54. package/tests/theme-customizer-static.test.mjs +1 -1
  55. package/tests/tui-model-profile-selector.test.mjs +102 -0
  56. package/tests/tui-resource-selector.test.mjs +74 -0
  57. package/tests/webui-settings-locking.test.mjs +32 -1
  58. package/tests/windows-drive-cwd-picker-static.test.mjs +81 -0
  59. package/tests/windows-drive-roots.test.mjs +130 -0
package/public/styles.css CHANGED
@@ -4954,8 +4954,11 @@ button.subagent-gate-attempt:focus-visible {
4954
4954
  padding-top: 0.38rem;
4955
4955
  min-width: 0;
4956
4956
  max-width: 100%;
4957
- max-height: none;
4958
- overflow: visible;
4957
+ max-height: min(32rem, calc(var(--visual-viewport-height, 100dvh) - 6rem));
4958
+ overflow-x: hidden;
4959
+ overflow-y: auto;
4960
+ overscroll-behavior: contain;
4961
+ scrollbar-gutter: stable;
4959
4962
  }
4960
4963
  .terminal-tab-group:hover .terminal-tab-group-menu,
4961
4964
  .terminal-tab-group:focus-within .terminal-tab-group-menu,
@@ -9681,30 +9684,30 @@ summary { cursor: pointer; color: var(--warning); }
9681
9684
  display: none !important;
9682
9685
  }
9683
9686
  .composer-intercom-tags {
9687
+ position: relative;
9684
9688
  pointer-events: auto;
9685
- display: grid;
9686
- grid-auto-flow: column;
9687
- grid-auto-columns: minmax(0, 1fr);
9688
- flex: 0 1 17rem;
9689
+ display: inline-flex;
9690
+ flex: 0 1 50%;
9691
+ flex-direction: row-reverse;
9689
9692
  align-items: center;
9690
9693
  gap: 0.28rem;
9691
9694
  min-width: 0;
9692
- max-width: min(17rem, 100%);
9695
+ max-width: 50%;
9693
9696
  padding-block: 0.12rem;
9697
+ overflow: hidden;
9694
9698
  }
9695
- .composer-intercom-tags[hidden] { display: none !important; }
9696
- .composer-intercom-tags.dense {
9697
- grid-auto-flow: row;
9698
- grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
9699
- align-items: stretch;
9699
+ .composer-intercom-tags.overflow-open {
9700
+ overflow: visible;
9700
9701
  }
9702
+ .composer-intercom-tags[hidden] { display: none !important; }
9701
9703
  .composer-intercom-tag {
9702
9704
  display: inline-flex;
9705
+ flex: 0 0 auto;
9703
9706
  align-items: center;
9704
9707
  gap: 0.34rem;
9705
- width: 100%;
9708
+ width: auto;
9706
9709
  min-width: 0;
9707
- max-width: 100%;
9710
+ max-width: min(13rem, 100%);
9708
9711
  min-height: 0;
9709
9712
  margin: 0;
9710
9713
  padding: 0.14rem 0.5rem;
@@ -9751,9 +9754,53 @@ summary { cursor: pointer; color: var(--warning); }
9751
9754
  line-height: 1.1;
9752
9755
  text-align: center;
9753
9756
  }
9757
+ .composer-intercom-tag.overflow {
9758
+ color: var(--ctp-subtext0);
9759
+ font-variant-numeric: tabular-nums;
9760
+ border-color: rgba(166, 173, 200, 0.30);
9761
+ background: linear-gradient(120deg, rgba(166, 173, 200, 0.22), rgba(166, 173, 200, 0.08)), var(--ctp-crust);
9762
+ }
9763
+ .composer-intercom-tag.overflow[aria-expanded="true"] {
9764
+ color: var(--ctp-green);
9765
+ border-color: rgba(166, 227, 161, 0.78);
9766
+ box-shadow: 0 0.42rem 1rem rgba(var(--ctp-crust-rgb), 0.48), 0 0 1.1rem rgba(166, 227, 161, 0.3);
9767
+ }
9768
+ .composer-intercom-overflow-menu {
9769
+ position: absolute;
9770
+ right: 0;
9771
+ bottom: calc(100% + 0.42rem);
9772
+ z-index: 150;
9773
+ display: grid;
9774
+ grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
9775
+ gap: 0.34rem;
9776
+ box-sizing: border-box;
9777
+ width: min(32rem, calc(100vw - 1.5rem));
9778
+ max-height: min(42vh, 18rem);
9779
+ padding: 0.46rem;
9780
+ overflow-y: auto;
9781
+ overscroll-behavior: contain;
9782
+ pointer-events: auto;
9783
+ border: 1px solid rgba(166, 227, 161, 0.36);
9784
+ border-radius: 0.9rem;
9785
+ background: var(--ctp-crust);
9786
+ box-shadow: 0 0.9rem 2.2rem rgba(var(--ctp-crust-rgb), 0.72), 0 0 1rem rgba(166, 227, 161, 0.18), inset 0 1px 0 rgba(255,255,255,0.05);
9787
+ }
9788
+ .composer-intercom-overflow-menu[hidden] {
9789
+ display: none !important;
9790
+ }
9791
+ .composer-intercom-overflow-menu .composer-intercom-tag {
9792
+ width: 100%;
9793
+ max-width: none;
9794
+ min-height: 2rem;
9795
+ }
9754
9796
  @media (max-width: 720px), (max-device-width: 720px), (pointer: coarse) and (hover: none) {
9755
- .composer-intercom-tags { flex: 1 1 100%; min-width: 0; max-width: 100%; }
9797
+ .composer-intercom-tags { flex: 0 0 100%; width: 100%; min-width: 0; max-width: 100%; }
9756
9798
  .composer-intercom-tag { min-height: 44px; }
9799
+ .composer-intercom-overflow-menu {
9800
+ width: min(32rem, calc(100vw - 1rem));
9801
+ max-height: min(50vh, 20rem);
9802
+ }
9803
+ .composer-intercom-overflow-menu .composer-intercom-tag { min-height: 44px; }
9757
9804
  }
9758
9805
  .composer-feature-category-tag {
9759
9806
  flex: 0 1 auto;
@@ -14672,12 +14719,19 @@ body.subagent-terminal-active .composer-remote-mic-consent {
14672
14719
  color: var(--ctp-teal);
14673
14720
  border-color: rgba(148, 226, 213, 0.30);
14674
14721
  }
14722
+ .path-picker-path-row,
14675
14723
  .path-picker-create-row {
14676
14724
  display: grid;
14677
14725
  grid-template-columns: minmax(0, 1fr) auto;
14678
14726
  gap: 0.45rem;
14727
+ }
14728
+ .path-picker-path-row {
14729
+ margin: 0.72rem 0 0;
14730
+ }
14731
+ .path-picker-create-row {
14679
14732
  margin: 0 0 0.72rem;
14680
14733
  }
14734
+ .path-picker-path-input,
14681
14735
  .path-picker-create-input {
14682
14736
  min-width: 0;
14683
14737
  width: 100%;
@@ -14686,11 +14740,14 @@ body.subagent-terminal-active .composer-remote-mic-consent {
14686
14740
  border-color: rgba(137, 180, 250, 0.20);
14687
14741
  background: rgba(var(--ctp-surface-rgb), 0.38);
14688
14742
  }
14743
+ .path-picker-path-button,
14689
14744
  .path-picker-create-button {
14690
14745
  align-self: stretch;
14691
14746
  color: var(--ctp-blue);
14692
14747
  border-color: rgba(137, 180, 250, 0.32);
14693
14748
  }
14749
+ .path-picker-path-button:hover,
14750
+ .path-picker-path-button:focus-visible,
14694
14751
  .path-picker-create-button:hover,
14695
14752
  .path-picker-create-button:focus-visible {
14696
14753
  color: #11111b;
@@ -14701,7 +14758,7 @@ body.subagent-terminal-active .composer-remote-mic-consent {
14701
14758
  display: grid;
14702
14759
  grid-template-columns: minmax(0, 1fr) auto;
14703
14760
  gap: 0.45rem;
14704
- margin: 0 0 0.38rem;
14761
+ margin: 0.72rem 0 0.38rem;
14705
14762
  }
14706
14763
  .path-picker-search-input {
14707
14764
  min-width: 0;
@@ -16307,9 +16364,11 @@ button.git-workflow-step { min-height: 1.9rem; }
16307
16364
  .app-runner-stdin-send,
16308
16365
  .app-runner-stdin-eof { width: 100%; }
16309
16366
  .path-picker-current-row,
16367
+ .path-picker-path-row,
16310
16368
  .path-picker-create-row,
16311
16369
  .path-picker-search-row { grid-template-columns: 1fr; }
16312
16370
  .path-picker-add-fast-pick,
16371
+ .path-picker-path-button,
16313
16372
  .path-picker-create-button,
16314
16373
  .path-picker-clear-search-button { width: 100%; }
16315
16374
  .path-picker-fast-pick { grid-template-columns: minmax(0, 1fr) 44px; }
@@ -19282,6 +19341,7 @@ body:has(#undoToast:not([hidden])) .notice-toast-stack { bottom: calc(max(1rem,
19282
19341
  }
19283
19342
  body.mobile-composer-disclosure .composer-actions-panel > .composer-context-tags {
19284
19343
  display: flex;
19344
+ flex-wrap: wrap;
19285
19345
  min-height: 44px;
19286
19346
  padding: 0.3rem;
19287
19347
  overflow: visible;
@@ -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=142", sheet: stylesheetLoaded ? {} : null });
68
+ const styleLink = new FakeElement({ href: "http://127.0.0.1:31415/styles.css?v=145", 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=172" } }),
87
+ currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=177" } }),
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=172"), "the inline loader should own app module startup");
235
+ assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=177"), "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");
@@ -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
+ });
@@ -0,0 +1,198 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createServer } from "node:net";
3
+ import { mkdtemp, rm } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
5
+ import { dirname, join } from "node:path";
6
+ import { setTimeout as delay } from "node:timers/promises";
7
+ import { fileURLToPath } from "node:url";
8
+ import assert from "node:assert/strict";
9
+ import AxeBuilder from "@axe-core/playwright";
10
+ import { expect, test } from "@playwright/test";
11
+
12
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
13
+ const serverScript = join(root, "bin", "pi-webui.mjs");
14
+ const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
15
+ const WINDOWS_DRIVES_PICKER_PATH = "::pi-webui-windows-drives::";
16
+
17
+ async function freePort() {
18
+ const server = createServer();
19
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
20
+ const { port } = server.address();
21
+ await new Promise((resolve) => server.close(resolve));
22
+ return port;
23
+ }
24
+
25
+ let child;
26
+ let baseURL;
27
+ let tempRoot;
28
+ let output = "";
29
+
30
+ test.beforeAll(async () => {
31
+ const port = await freePort();
32
+ tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-windows-drive-parent-"));
33
+ baseURL = `http://127.0.0.1:${port}`;
34
+ child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
35
+ stdio: ["ignore", "pipe", "pipe"],
36
+ env: {
37
+ ...process.env,
38
+ PI_WEBUI_RPC_SUPERVISOR: "0",
39
+ PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
40
+ PI_WEBUI_SETTINGS_FILE: join(tempRoot, "settings.json"),
41
+ },
42
+ });
43
+ child.stdout.on("data", (chunk) => { output += String(chunk); });
44
+ child.stderr.on("data", (chunk) => { output += String(chunk); });
45
+ for (let attempt = 0; attempt < 80; attempt += 1) {
46
+ if (child.exitCode !== null) break;
47
+ try {
48
+ const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
49
+ if (response.ok) return;
50
+ } catch {
51
+ // Wait for the local server and fake Pi fixture.
52
+ }
53
+ await delay(100);
54
+ }
55
+ throw new Error(`Pi Web UI did not start:\n${output}`);
56
+ });
57
+
58
+ test.afterAll(async () => {
59
+ child?.kill("SIGTERM");
60
+ if (child?.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
61
+ await rm(tempRoot, { recursive: true, force: true });
62
+ });
63
+
64
+ function directoryPayload(cwd, { parent = WINDOWS_DRIVES_PICKER_PATH, directories = [] } = {}) {
65
+ return {
66
+ cwd,
67
+ displayCwd: cwd,
68
+ parent,
69
+ roots: [],
70
+ directories,
71
+ truncated: false,
72
+ };
73
+ }
74
+
75
+ function virtualDrivesPayload() {
76
+ return {
77
+ cwd: "",
78
+ displayCwd: "This PC",
79
+ parent: null,
80
+ roots: [],
81
+ directories: ["C:\\", "D:\\", "E:\\"].map((cwd) => ({ name: cwd, cwd, displayCwd: cwd, hidden: false })),
82
+ truncated: false,
83
+ selectable: false,
84
+ };
85
+ }
86
+
87
+ test("Windows drive Parent flow remains navigation-only, accessible, and cwd-safe", async ({ page }) => {
88
+ const directoryRequests = [];
89
+ const tabCreateBodies = [];
90
+
91
+ await page.route("**/api/path-fast-picks*", async (route) => {
92
+ await route.fulfill({
93
+ status: 200,
94
+ contentType: "application/json",
95
+ body: JSON.stringify({ ok: true, data: { picks: [{ cwd: "D:\\", displayCwd: "D:\\" }] } }),
96
+ });
97
+ });
98
+ await page.route(/\/api\/tabs(?:\?.*)?$/, async (route) => {
99
+ if (route.request().method() !== "POST") return route.fallback();
100
+ tabCreateBodies.push(route.request().postDataJSON());
101
+ await route.fulfill({ status: 400, contentType: "application/json", body: JSON.stringify({ ok: false, error: "test stopped after cwd submission" }) });
102
+ });
103
+ await page.route("**/api/directories*", async (route) => {
104
+ if (route.request().method() !== "GET") return route.fallback();
105
+ const requestedPath = new URL(route.request().url()).searchParams.get("path") || "";
106
+ directoryRequests.push(requestedPath);
107
+ if (requestedPath === WINDOWS_DRIVES_PICKER_PATH) {
108
+ await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data: virtualDrivesPayload() }) });
109
+ return;
110
+ }
111
+ if (requestedPath === "E:\\") {
112
+ await route.fulfill({ status: 400, contentType: "application/json", body: JSON.stringify({ ok: false, error: "Drive E is unavailable" }) });
113
+ return;
114
+ }
115
+ const data = requestedPath === "D:/project"
116
+ ? directoryPayload("D:\\project", { parent: "D:\\" })
117
+ : directoryPayload(requestedPath === "D:\\" ? "D:\\" : "C:\\");
118
+ await route.fulfill({ status: 200, contentType: "application/json", body: JSON.stringify({ ok: true, data }) });
119
+ });
120
+
121
+ await page.setViewportSize({ width: 1280, height: 850 });
122
+ await page.goto(baseURL);
123
+ await expect(page.locator("#promptInput")).toBeVisible();
124
+
125
+ await page.keyboard.press("Control+k");
126
+ await page.locator("#commandPaletteInput").fill("Choose directory for new tab");
127
+ await page.keyboard.press("Enter");
128
+
129
+ const dialog = page.locator("#pathPickerDialog");
130
+ const current = page.locator("#pathPickerCurrent");
131
+ const search = page.locator("#pathPickerSearchInput");
132
+ const directPath = page.locator("#pathPickerPathInput");
133
+ const choose = page.locator("#pathPickerChooseButton");
134
+ await expect(dialog).toBeVisible();
135
+ await expect(current).toHaveText("C:\\");
136
+
137
+ await page.locator("#pathPickerFastPicks .path-picker-fast-pick-button", { hasText: "D:" }).click();
138
+ await expect(current).toHaveText("D:\\");
139
+ await expect(search).toBeFocused();
140
+
141
+ await page.getByRole("button", { name: "↑ Parent" }).click();
142
+ await expect(current).toHaveText("This PC");
143
+ await expect(search).toBeFocused();
144
+ await expect(choose).toBeDisabled();
145
+ await expect(page.locator("#pathPickerCreateNameInput")).toBeDisabled();
146
+ await expect(page.locator("#pathPickerCreateButton")).toBeDisabled();
147
+ await expect(page.locator("#pathPickerAddFastPickButton")).toBeDisabled();
148
+ await expect(search).toBeEnabled();
149
+ await expect(directPath).toBeEnabled();
150
+
151
+ const accessibility = await new AxeBuilder({ page }).include("#pathPickerDialog").disableRules(["aria-required-children"]).analyze();
152
+ const serious = accessibility.violations.filter((violation) => ["serious", "critical"].includes(violation.impact));
153
+ assert.deepEqual(serious, [], `This PC picker should have no serious/critical Axe violations: ${serious.map(({ id }) => id).join(", ")}`);
154
+
155
+ await search.fill("D");
156
+ await expect(page.locator("#pathPickerList .path-picker-directory")).toHaveCount(1);
157
+ await expect(page.locator("#pathPickerList .path-picker-directory")).toHaveText("D:\\");
158
+ await page.locator("#pathPickerClearSearchButton").click();
159
+
160
+ await page.locator("#pathPickerList .path-picker-directory", { hasText: "D:\\" }).click();
161
+ await expect(current).toHaveText("D:\\");
162
+ await expect(search).toBeFocused();
163
+ await page.getByRole("button", { name: "↑ Parent" }).click();
164
+ await expect(current).toHaveText("This PC");
165
+ await expect(search).toBeFocused();
166
+
167
+ await directPath.fill("D:/project");
168
+ await page.locator("#pathPickerList .path-picker-directory", { hasText: "E:\\" }).click();
169
+ const alert = page.locator("#pathPickerError");
170
+ await expect(alert).toHaveAttribute("role", "alert");
171
+ await expect(alert).toContainText("Drive E is unavailable");
172
+ await expect(current).toHaveText("This PC");
173
+ await expect(directPath).toHaveValue("D:/project");
174
+
175
+ await page.locator("#pathPickerPathButton").click();
176
+ await expect(current).toHaveText("D:\\project");
177
+ await expect(search).not.toBeFocused();
178
+ assert.ok(directoryRequests.includes("D:/project"), "direct path entry should preserve slash-form drive-qualified input");
179
+
180
+ await page.getByRole("button", { name: "↑ Parent" }).click();
181
+ await expect(current).toHaveText("D:\\");
182
+ await expect(search).toBeFocused();
183
+ await page.getByRole("button", { name: "↑ Parent" }).click();
184
+ await expect(current).toHaveText("This PC");
185
+ await expect(search).toBeFocused();
186
+
187
+ await page.evaluate(() => document.querySelector("#pathPickerChooseButton").click());
188
+ await expect(dialog).toBeVisible();
189
+ assert.deepEqual(tabCreateBodies, [], "the virtual empty cwd must not create a tab");
190
+
191
+ await page.locator("#pathPickerList .path-picker-directory", { hasText: "C:\\" }).click();
192
+ await expect(current).toHaveText("C:\\");
193
+ await expect(search).toBeFocused();
194
+ await choose.click();
195
+ await expect.poll(() => tabCreateBodies.length).toBe(1);
196
+ assert.deepEqual(tabCreateBodies, [{ cwd: "C:\\" }]);
197
+ assert.ok(tabCreateBodies.every(({ cwd }) => cwd && cwd !== WINDOWS_DRIVES_PICKER_PATH), "only a real drive root may reach tab creation");
198
+ });
@@ -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-v139/, "PWA cache identity should be bumped for changed browser assets");
59
- assert.match(html, /data-app-src="\/app\.js\?v=172"/, "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");