@firstpick/pi-package-webui 0.9.4 → 0.9.6

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 (70) hide show
  1. package/README.md +7 -2
  2. package/bin/pi-webui.mjs +90 -5
  3. package/lib/optional-feature-catalog.mjs +1 -1
  4. package/lib/session-actions.mjs +20 -2
  5. package/lib/ui-layout-settings.mjs +37 -6
  6. package/package.json +1 -1
  7. package/public/app.js +2311 -257
  8. package/public/index.html +82 -55
  9. package/public/service-worker.js +4 -1
  10. package/public/stream-derived-output.mjs +799 -0
  11. package/public/stream-markdown-tail.mjs +204 -0
  12. package/public/stream-output-controller.mjs +222 -51
  13. package/public/stream-render-scheduler.mjs +85 -0
  14. package/public/styles.css +276 -20
  15. package/public/transcript-renderer.mjs +73 -24
  16. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  17. package/tests/browser/composer-action-grid-reorder.spec.mjs +114 -31
  18. package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
  19. package/tests/browser/control-visibility.spec.mjs +396 -0
  20. package/tests/browser/mobile-foundation.spec.mjs +28 -0
  21. package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
  22. package/tests/browser/stream-output-isolation.spec.mjs +308 -3
  23. package/tests/browser/user-noticeable-fixes.spec.mjs +204 -0
  24. package/tests/codex-fast-mode-static.test.mjs +2 -2
  25. package/tests/composer-action-grid-reorder-static.test.mjs +8 -7
  26. package/tests/control-deck-side-panels-static.test.mjs +3 -1
  27. package/tests/control-visibility-static.test.mjs +294 -0
  28. package/tests/controls-layout-static.test.mjs +3 -3
  29. package/tests/cwd-footer-reliability-static.test.mjs +1 -1
  30. package/tests/fast-mode-client-static.test.mjs +1 -1
  31. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  32. package/tests/file-viewer-image-static.test.mjs +3 -3
  33. package/tests/fixtures/fake-pi.mjs +57 -10
  34. package/tests/fixtures/streaming-workloads.mjs +167 -0
  35. package/tests/footer-provider-usage-visual-static.test.mjs +15 -0
  36. package/tests/foreground-transcript-catch-up-static.test.mjs +7 -1
  37. package/tests/git-workflow-preferences.test.mjs +2 -2
  38. package/tests/http-endpoints-harness.test.mjs +4 -4
  39. package/tests/interaction-state-stability-static.test.mjs +3 -1
  40. package/tests/intercom-conversation-viewer-static.test.mjs +4 -4
  41. package/tests/intercom-conversations-http.test.mjs +16 -0
  42. package/tests/main-output-loading-static.test.mjs +3 -3
  43. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  44. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  45. package/tests/mobile-foundation-static.test.mjs +3 -3
  46. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  47. package/tests/mobile-static.test.mjs +77 -66
  48. package/tests/open-issue-wizard-static.test.mjs +2 -2
  49. package/tests/persistent-ui-layout-static.test.mjs +7 -7
  50. package/tests/prompt-input-vertical-scroll-static.test.mjs +26 -0
  51. package/tests/questionnaire-dialog.test.mjs +3 -3
  52. package/tests/runtime-error-visibility.test.mjs +3 -3
  53. package/tests/session-auth-harness.test.mjs +26 -1
  54. package/tests/session-sampling-ui-static.test.mjs +3 -3
  55. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  56. package/tests/stream-derived-output.test.mjs +121 -0
  57. package/tests/stream-markdown-tail.test.mjs +218 -0
  58. package/tests/stream-output-controller.test.mjs +119 -4
  59. package/tests/stream-output-isolation-static.test.mjs +34 -6
  60. package/tests/stream-output-workloads.test.mjs +276 -0
  61. package/tests/stream-render-scheduler.test.mjs +115 -0
  62. package/tests/streaming-ui-coupling.test.mjs +1 -1
  63. package/tests/subagent-observability-static.test.mjs +2 -2
  64. package/tests/syntax-highlighting-static.test.mjs +3 -3
  65. package/tests/theme-customizer-static.test.mjs +1 -1
  66. package/tests/thinking-format-parser.test.mjs +15 -0
  67. package/tests/todo-filter-static.test.mjs +148 -0
  68. package/tests/transcript-markdown-tail.test.mjs +137 -0
  69. package/tests/ui-layout-settings.test.mjs +54 -7
  70. package/tests/webui-settings-locking.test.mjs +3 -3
@@ -301,19 +301,35 @@ export function createTranscriptRenderer({ chat, contextKey = () => "", surfaceS
301
301
  messageKey,
302
302
  kind = "assistant-final",
303
303
  text = "",
304
+ complete = false,
304
305
  stableBoundary,
305
306
  renderInto,
307
+ renderLiveTail,
308
+ appendLiveTail,
306
309
  } = {}) {
307
310
  if (!surface || typeof stableBoundary !== "function" || typeof renderInto !== "function") return { applied: false, invalid: true };
308
311
  const value = String(text || "");
309
312
  let state = markdownStates.get(surface);
310
- const diverged = !!state && !value.startsWith(state.stableText);
311
- const replacesMutableTail = !!state?.tailNodes?.length;
312
- return commitTranscriptMutation({
313
+ const diverged = !!state && !value.startsWith(state.value);
314
+ const boundaryResult = stableBoundary(value, diverged ? null : state?.boundaryState, { complete, appendOnly: !!state && !diverged });
315
+ const boundaryInfo = boundaryResult && typeof boundaryResult === "object"
316
+ ? boundaryResult
317
+ : { boundary: Number(boundaryResult) || 0, state: null, liveMode: "markdown", tailKind: "text", scannedChars: value.length };
318
+ const stableFloor = diverged ? 0 : state?.stableText?.length || 0;
319
+ const nextBoundary = Math.max(stableFloor, Math.min(value.length, Number(boundaryInfo.boundary) || 0));
320
+ const nextTail = value.slice(nextBoundary);
321
+ const canReuseLiveTail = !!state?.tailNodes?.length
322
+ && typeof appendLiveTail === "function"
323
+ && ["open-fence", "plain"].includes(boundaryInfo.liveMode)
324
+ && state.tailMode === boundaryInfo.liveMode
325
+ && state.tailBoundary === nextBoundary
326
+ && nextTail.startsWith(state.tailText);
327
+ const replacesMutableTail = !!state?.tailNodes?.length && !canReuseLiveTail;
328
+ const mutation = commitTranscriptMutation({
313
329
  key: key || `markdown:${surfaceKey(surface)}`,
314
330
  context,
315
- // Removing/reparsing the open tail is destructive even for append-only
316
- // transport data. It must wait for an intersecting native drag gesture.
331
+ // Replacing/reparsing an open tail is destructive and must wait for an
332
+ // intersecting native drag. Suffix appends reuse the mounted live nodes.
317
333
  kind: diverged || replacesMutableTail ? "reconcile" : "append",
318
334
  surfaces: [surface],
319
335
  invalidateSelection: diverged,
@@ -322,30 +338,63 @@ export function createTranscriptRenderer({ chat, contextKey = () => "", surfaceS
322
338
  state = markdownStates.get(surface);
323
339
  if (!state || diverged) {
324
340
  for (const node of [...surface.childNodes]) node.remove();
325
- state = { stableText: "", tailNodes: [], committedBlocks: 0 };
341
+ state = { stableText: "", value: "", tailNodes: [], tailText: "", tailMode: "", tailBoundary: 0, boundaryState: null, committedBlocks: 0 };
326
342
  markdownStates.set(surface, state);
327
343
  }
328
- for (const node of state.tailNodes) node.remove();
329
- state.tailNodes = [];
330
- const boundary = Math.max(state.stableText.length, Math.min(value.length, Number(stableBoundary(value)) || 0));
331
- if (boundary > state.stableText.length) {
332
- const fragment = document.createDocumentFragment();
333
- renderInto(fragment, value.slice(state.stableText.length, boundary));
334
- const nodes = [...fragment.childNodes];
335
- state.committedBlocks = ownBlocks(nodes, { messageKey, kind, start: state.committedBlocks });
336
- surface.append(fragment);
337
- state.stableText = value.slice(0, boundary);
338
- }
339
- const tail = value.slice(state.stableText.length);
340
- if (tail.trim()) {
341
- const fragment = document.createDocumentFragment();
342
- renderInto(fragment, tail);
343
- state.tailNodes = [...fragment.childNodes];
344
- ownBlocks(state.tailNodes, { messageKey, kind, tail: true });
345
- surface.append(fragment);
344
+
345
+ const boundary = Math.max(state.stableText.length, nextBoundary);
346
+ const tail = value.slice(boundary);
347
+ const reuse = !!state.tailNodes.length
348
+ && typeof appendLiveTail === "function"
349
+ && ["open-fence", "plain"].includes(boundaryInfo.liveMode)
350
+ && state.tailMode === boundaryInfo.liveMode
351
+ && state.tailBoundary === boundary
352
+ && tail.startsWith(state.tailText);
353
+
354
+ if (reuse) {
355
+ appendLiveTail(state.tailNodes, state.tailText, tail, boundaryInfo);
356
+ } else {
357
+ const committedSlice = value.slice(state.stableText.length, boundary);
358
+ const promotesMountedTail = !!state.tailNodes.length
359
+ && ["markdown", "authoritative"].includes(state.tailMode)
360
+ && committedSlice.startsWith(state.tailText)
361
+ && !committedSlice.slice(state.tailText.length).trim();
362
+ if (promotesMountedTail) {
363
+ state.committedBlocks = ownBlocks(state.tailNodes, { messageKey, kind, start: state.committedBlocks });
364
+ state.tailNodes = [];
365
+ state.stableText = value.slice(0, boundary);
366
+ } else {
367
+ for (const node of state.tailNodes) node.remove();
368
+ state.tailNodes = [];
369
+ if (boundary > state.stableText.length) {
370
+ const fragment = document.createDocumentFragment();
371
+ renderInto(fragment, committedSlice);
372
+ const nodes = [...fragment.childNodes];
373
+ state.committedBlocks = ownBlocks(nodes, { messageKey, kind, start: state.committedBlocks });
374
+ surface.append(fragment);
375
+ state.stableText = value.slice(0, boundary);
376
+ }
377
+ }
378
+ if (tail.trim()) {
379
+ const fragment = document.createDocumentFragment();
380
+ if (["open-fence", "plain"].includes(boundaryInfo.liveMode) && typeof renderLiveTail === "function") {
381
+ renderLiveTail(fragment, tail, boundaryInfo);
382
+ } else {
383
+ renderInto(fragment, tail);
384
+ }
385
+ state.tailNodes = [...fragment.childNodes];
386
+ ownBlocks(state.tailNodes, { messageKey, kind, tail: true });
387
+ surface.append(fragment);
388
+ }
346
389
  }
390
+ state.value = value;
391
+ state.tailText = tail;
392
+ state.tailMode = boundaryInfo.liveMode || "markdown";
393
+ state.tailBoundary = boundary;
394
+ state.boundaryState = boundaryInfo.state || null;
347
395
  },
348
396
  });
397
+ return { ...mutation, boundary: nextBoundary, tailKind: boundaryInfo.tailKind || "text", liveMode: boundaryInfo.liveMode || "markdown", scannedChars: Number(boundaryInfo.scannedChars) || 0, fallback: !!boundaryInfo.fallback, reusedTail: canReuseLiveTail };
349
398
  }
350
399
 
351
400
  function updateTextSurface({ key, context = contextKey(), surface, messageKey, kind = "compact-output", text = "" } = {}) {
@@ -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=126", sheet: stylesheetLoaded ? {} : null });
68
+ const styleLink = new FakeElement({ href: "http://127.0.0.1:31415/styles.css?v=132", 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=148" } }),
87
+ currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=157" } }),
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=148"), "the inline loader should own app module startup");
235
+ assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=157"), "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");
@@ -68,7 +68,8 @@ test.beforeEach(async () => {
68
68
  method: "PUT",
69
69
  headers: { "content-type": "application/json" },
70
70
  body: JSON.stringify({
71
- layout: { version: 1, composerActions: null },
71
+ sidePanelWidth: 384,
72
+ layout: { version: 3, composerActions: null },
72
73
  expectedLayoutRevision: current.data.layoutRevision,
73
74
  }),
74
75
  });
@@ -83,6 +84,14 @@ async function storedLayout(page) {
83
84
  return page.evaluate((key) => JSON.parse(localStorage.getItem(key) || "null"), layoutStorageKey);
84
85
  }
85
86
 
87
+ async function resizeControlDeckBy(handle, key, count) {
88
+ for (let index = 0; index < count; index += 1) {
89
+ const previous = await handle.getAttribute("aria-valuenow");
90
+ await handle.press(key);
91
+ await expect.poll(async () => handle.getAttribute("aria-valuenow")).not.toBe(previous);
92
+ }
93
+ }
94
+
86
95
  test("composer actions persist pointer and keyboard grid reordering", async ({ page }) => {
87
96
  await page.setViewportSize({ width: 1440, height: 900 });
88
97
  await page.goto(baseURL);
@@ -247,18 +256,81 @@ test("empty composer grid cells retain their space and accept later drops", asyn
247
256
  await expect.poll(async () => page.evaluate((key) => JSON.parse(localStorage.getItem(key) || "null")?.positions?.new, layoutStorageKey)).toBe(middleEmptyCellIndex);
248
257
  });
249
258
 
250
- test("sparse composer buttons keep responsive positions when the Control Deck width changes", async ({ page }) => {
259
+ test("narrow composer projection preserves the saved order of adjacent actions", async ({ page }) => {
251
260
  await page.setViewportSize({ width: 1440, height: 900 });
252
261
  await page.goto(baseURL);
253
262
 
254
263
  const row = page.locator(".composer-row");
255
264
  const options = page.locator('[data-composer-action-id="options"]');
265
+ const send = page.locator('[data-composer-action-id="send"]');
256
266
  const gridGuide = page.locator("#composerActionGridGuide");
257
267
  const resizeHandle = page.locator("#sidePanelResizeHandle");
268
+
269
+ const moveToCellFromEnd = async (action, offsetFromEnd) => {
270
+ const actionBox = await action.boundingBox();
271
+ expect(actionBox).toBeTruthy();
272
+ await page.mouse.move(actionBox.x + actionBox.width / 2, actionBox.y + actionBox.height / 2);
273
+ await page.mouse.down();
274
+ await page.mouse.move(actionBox.x + actionBox.width / 2 + 12, actionBox.y + actionBox.height / 2, { steps: 2 });
275
+ await expect(gridGuide).toBeVisible();
276
+ const cellCount = await gridGuide.locator(".composer-action-grid-cell").count();
277
+ const target = gridGuide.locator(".composer-action-grid-cell").nth(cellCount - offsetFromEnd);
278
+ const targetBox = await target.boundingBox();
279
+ expect(targetBox).toBeTruthy();
280
+ await page.mouse.move(targetBox.x + targetBox.width / 2, targetBox.y + targetBox.height / 2, { steps: 8 });
281
+ await page.mouse.up();
282
+ await expect(gridGuide).toBeHidden();
283
+ };
284
+
285
+ await moveToCellFromEnd(options, 3);
286
+ await moveToCellFromEnd(send, 2);
287
+ const savedWideLayout = await storedLayout(page);
288
+ expect(savedWideLayout?.positions?.options).toBeLessThan(savedWideLayout?.positions?.send);
258
289
  const wideRowBox = await row.boundingBox();
259
- const optionsBox = await options.boundingBox();
260
290
  expect(wideRowBox).toBeTruthy();
291
+
292
+ await resizeHandle.focus();
293
+ await resizeControlDeckBy(resizeHandle, "Shift+ArrowLeft", 3);
294
+ await expect.poll(async () => (await row.boundingBox()).width).toBeLessThan(wideRowBox.width - 150);
295
+ await expect.poll(async () => {
296
+ const [optionsBox, sendBox] = await Promise.all([options.boundingBox(), send.boundingBox()]);
297
+ if (!optionsBox || !sendBox) return false;
298
+ return optionsBox.y < sendBox.y || (Math.abs(optionsBox.y - sendBox.y) < 1 && optionsBox.x < sendBox.x);
299
+ }).toBe(true);
300
+ expect(await storedLayout(page)).toEqual(savedWideLayout);
301
+
302
+ await page.reload();
303
+ await expect.poll(async () => {
304
+ const [optionsBox, sendBox] = await Promise.all([options.boundingBox(), send.boundingBox()]);
305
+ if (!optionsBox || !sendBox) return false;
306
+ return optionsBox.y < sendBox.y || (Math.abs(optionsBox.y - sendBox.y) < 1 && optionsBox.x < sendBox.x);
307
+ }).toBe(true);
308
+ expect(await storedLayout(page)).toEqual(savedWideLayout);
309
+ });
310
+
311
+ test("sparse composer buttons keep fixed widths and stable columns when the Control Deck width changes", async ({ page }) => {
312
+ await page.setViewportSize({ width: 1440, height: 900 });
313
+ await page.goto(baseURL);
314
+
315
+ const row = page.locator(".composer-row");
316
+ const options = page.locator('[data-composer-action-id="options"]');
317
+ const send = page.locator('[data-composer-action-id="send"]');
318
+ const gridGuide = page.locator("#composerActionGridGuide");
319
+ const resizeHandle = page.locator("#sidePanelResizeHandle");
320
+ const initialRowBox = await row.boundingBox();
321
+ expect(initialRowBox).toBeTruthy();
322
+
323
+ await resizeHandle.focus();
324
+ await resizeControlDeckBy(resizeHandle, "Shift+ArrowLeft", 3);
325
+ await expect.poll(async () => (await row.boundingBox()).width).toBeLessThan(initialRowBox.width - 50);
326
+
327
+ const narrowRowBox = await row.boundingBox();
328
+ const optionsBox = await options.boundingBox();
329
+ expect(narrowRowBox).toBeTruthy();
261
330
  expect(optionsBox).toBeTruthy();
331
+ const rootFontSize = await page.evaluate(() => Number.parseFloat(getComputedStyle(document.documentElement).fontSize));
332
+ const fixedCellWidth = 3.2 * rootFontSize;
333
+ expect(Math.abs(optionsBox.width - fixedCellWidth)).toBeLessThan(1);
262
334
 
263
335
  await page.mouse.move(optionsBox.x + optionsBox.width / 2, optionsBox.y + optionsBox.height / 2);
264
336
  await page.mouse.down();
@@ -269,35 +341,46 @@ test("sparse composer buttons keep responsive positions when the Control Deck wi
269
341
  await page.mouse.move(lastCellBox.x + lastCellBox.width / 2, lastCellBox.y + lastCellBox.height / 2, { steps: 8 });
270
342
  await page.mouse.up();
271
343
 
272
- const wideColumn = await options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"));
273
- const savedWideLayout = await storedLayout(page);
274
- expect(Number(wideColumn)).toBeGreaterThan(1);
275
- expect(savedWideLayout?.columns).toBeGreaterThan(1);
344
+ const placedOptionsBox = await options.boundingBox();
345
+ const placedSendBox = await send.boundingBox();
346
+ const narrowColumn = await options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"));
347
+ const savedNarrowLayout = await storedLayout(page);
348
+ expect(placedOptionsBox).toBeTruthy();
349
+ expect(placedSendBox).toBeTruthy();
350
+ expect(Number(narrowColumn)).toBeGreaterThan(1);
351
+ expect(savedNarrowLayout?.columns).toBeGreaterThan(1);
276
352
 
277
- await resizeHandle.focus();
278
- await resizeHandle.press("Shift+ArrowLeft");
279
- await resizeHandle.press("Shift+ArrowLeft");
280
- await resizeHandle.press("Shift+ArrowLeft");
281
-
282
- await expect.poll(async () => (await row.boundingBox()).width).toBeLessThan(wideRowBox.width - 50);
283
- await expect.poll(async () => options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"))).not.toBe("");
284
- await expect.poll(async () => page.evaluate(() => {
285
- const composerRow = document.querySelector(".composer-row");
286
- const action = document.querySelector('[data-composer-action-id="options"]');
287
- const rowRect = composerRow.getBoundingClientRect();
288
- const actionRect = action.getBoundingClientRect();
289
- return Math.abs(rowRect.right - actionRect.right);
290
- })).toBeLessThan(2);
291
- expect(await storedLayout(page)).toEqual(savedWideLayout);
353
+ await resizeControlDeckBy(resizeHandle, "Shift+ArrowRight", 3);
354
+
355
+ await expect.poll(async () => (await row.boundingBox()).width).toBeGreaterThan(narrowRowBox.width + 50);
356
+ await expect.poll(async () => {
357
+ const wideOptionsBox = await options.boundingBox();
358
+ return Math.abs(wideOptionsBox.width - placedOptionsBox.width);
359
+ }).toBeLessThan(1);
360
+ await expect.poll(async () => {
361
+ const wideSendBox = await send.boundingBox();
362
+ return Math.abs(wideSendBox.width - placedSendBox.width);
363
+ }).toBeLessThan(1);
364
+ await expect.poll(async () => {
365
+ const wideOptionsBox = await options.boundingBox();
366
+ return Math.abs(wideOptionsBox.x - placedOptionsBox.x);
367
+ }).toBeLessThan(1);
368
+ await expect.poll(async () => {
369
+ const wideSendBox = await send.boundingBox();
370
+ return Math.abs(wideSendBox.x - placedSendBox.x);
371
+ }).toBeLessThan(1);
372
+ await expect.poll(async () => options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"))).toBe(narrowColumn);
373
+ expect(await storedLayout(page)).toEqual(savedNarrowLayout);
292
374
 
293
375
  await page.reload();
294
- await expect.poll(async () => options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"))).not.toBe("");
295
- await expect.poll(async () => page.evaluate(() => {
296
- const composerRow = document.querySelector(".composer-row");
297
- const action = document.querySelector('[data-composer-action-id="options"]');
298
- const rowRect = composerRow.getBoundingClientRect();
299
- const actionRect = action.getBoundingClientRect();
300
- return Math.abs(rowRect.right - actionRect.right);
301
- })).toBeLessThan(2);
302
- expect(await storedLayout(page)).toEqual(savedWideLayout);
376
+ await expect.poll(async () => options.evaluate((node) => node.style.getPropertyValue("--composer-action-grid-column"))).toBe(narrowColumn);
377
+ await expect.poll(async () => {
378
+ const restoredOptionsBox = await options.boundingBox();
379
+ return Math.abs(restoredOptionsBox.x - placedOptionsBox.x);
380
+ }).toBeLessThan(1);
381
+ await expect.poll(async () => {
382
+ const restoredSendBox = await send.boundingBox();
383
+ return Math.abs(restoredSendBox.x - placedSendBox.x);
384
+ }).toBeLessThan(1);
385
+ expect(await storedLayout(page)).toEqual(savedNarrowLayout);
303
386
  });
@@ -134,6 +134,48 @@ test("Mobile v2 repeatedly returns canonical project content to its Control Deck
134
134
  await context.close();
135
135
  });
136
136
 
137
+ test("embedded split terminal fills every desktop pane width with inherited sidebar classes", async ({ page }) => {
138
+ test.setTimeout(45_000);
139
+ await page.setViewportSize({ width: 1200, height: 900 });
140
+ await page.goto(baseURL);
141
+ const tabId = await page.locator("[data-tab-id]").first().getAttribute("data-tab-id");
142
+ assert.ok(tabId, "the fixture should expose a terminal tab for the embedded split");
143
+
144
+ for (const width of [721, 900, 1200]) {
145
+ await page.setViewportSize({ width, height: 900 });
146
+ await page.goto(`${baseURL}/?embed=split&tab=${encodeURIComponent(tabId)}`);
147
+ await page.locator("body").evaluate((body) => {
148
+ body.classList.add("terminal-tabs-left", "terminal-tabs-sidebar-start");
149
+ body.style.setProperty("--terminal-tabs-sidebar-width", "560px");
150
+ });
151
+ await expect(page.locator("body")).toHaveClass(/embedded-split/);
152
+ await expect(page.locator("body")).toHaveClass(/terminal-tabs-left/);
153
+ await expect(page.locator("#terminalTabsShell")).toBeHidden();
154
+ const geometry = await page.evaluate(() => {
155
+ const panel = document.querySelector(".chat-panel");
156
+ const chat = document.querySelector(".chat");
157
+ const composer = document.querySelector(".composer");
158
+ const panelRect = panel?.getBoundingClientRect();
159
+ const chatRect = chat?.getBoundingClientRect();
160
+ const composerRect = composer?.getBoundingClientRect();
161
+ const style = panel ? getComputedStyle(panel) : null;
162
+ return {
163
+ viewportWidth: window.innerWidth,
164
+ panelWidth: panelRect?.width || 0,
165
+ chatWidth: chatRect?.width || 0,
166
+ composerWidth: composerRect?.width || 0,
167
+ display: style?.display || "",
168
+ flexDirection: style?.flexDirection || "",
169
+ };
170
+ });
171
+ assert.equal(geometry.display, "flex", `embedded chat panel should remain flex at ${width}px`);
172
+ assert.equal(geometry.flexDirection, "column", `embedded chat panel should remain vertical at ${width}px`);
173
+ assert.ok(Math.abs(geometry.panelWidth - geometry.viewportWidth) <= 1, `embedded panel should fill ${width}px: ${JSON.stringify(geometry)}`);
174
+ assert.ok(Math.abs(geometry.chatWidth - geometry.panelWidth) <= 2, `embedded transcript should fill ${width}px inside the panel border: ${JSON.stringify(geometry)}`);
175
+ assert.ok(Math.abs(geometry.composerWidth - geometry.panelWidth) <= 2, `embedded composer should fill ${width}px inside the panel border: ${JSON.stringify(geometry)}`);
176
+ }
177
+ });
178
+
137
179
  test("Right, Left, Both, Sidebar rail, independent state, overlay, singleton ARIA, and reload", async ({ page }) => {
138
180
  test.setTimeout(60_000);
139
181
  await page.setViewportSize({ width: 2200, height: 1000 });