@firstpick/pi-package-webui 0.9.5 → 0.9.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.
- package/README.md +11 -5
- package/bin/pi-webui.mjs +457 -77
- package/lib/git-workflow-preferences.mjs +21 -1
- package/lib/optional-feature-catalog.mjs +1 -1
- package/lib/session-actions.mjs +20 -2
- package/lib/session-tree-event-targets.mjs +70 -0
- package/lib/subagent-launch-policy.mjs +375 -0
- package/lib/subagent-launch-slots.mjs +2 -1
- package/package.json +1 -1
- package/public/app.js +2539 -292
- package/public/index.html +87 -31
- package/public/service-worker.js +4 -1
- package/public/stream-derived-output.mjs +799 -0
- package/public/stream-markdown-tail.mjs +204 -0
- package/public/stream-output-controller.mjs +193 -51
- package/public/stream-render-scheduler.mjs +85 -0
- package/public/styles.css +501 -19
- package/public/transcript-renderer.mjs +73 -24
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/composer-action-grid-reorder.spec.mjs +114 -31
- package/tests/browser/control-visibility.spec.mjs +141 -2
- package/tests/browser/events-tree-context-menu.spec.mjs +240 -0
- package/tests/browser/guided-git-fallback.spec.mjs +153 -0
- package/tests/browser/mobile-foundation.spec.mjs +28 -0
- package/tests/browser/stream-output-isolation.spec.mjs +308 -3
- package/tests/browser/user-noticeable-fixes.spec.mjs +204 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/compact-sections-static.test.mjs +4 -0
- package/tests/composer-action-grid-reorder-static.test.mjs +8 -7
- package/tests/control-visibility-static.test.mjs +66 -3
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/cwd-footer-reliability-static.test.mjs +1 -1
- package/tests/events-tree-context-menu-static.test.mjs +131 -0
- package/tests/fast-mode-client-static.test.mjs +5 -2
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/fixtures/fake-pi.mjs +57 -10
- package/tests/fixtures/streaming-workloads.mjs +36 -0
- package/tests/footer-provider-usage-visual-static.test.mjs +15 -0
- package/tests/foreground-transcript-catch-up-static.test.mjs +7 -1
- package/tests/git-workflow-preferences.test.mjs +30 -1
- package/tests/guided-git-fallback-runtime.test.mjs +418 -0
- package/tests/guided-git-fallback-ui-static.test.mjs +60 -0
- package/tests/guided-git-message-reliability-static.test.mjs +8 -7
- package/tests/interaction-state-stability-static.test.mjs +3 -1
- package/tests/intercom-conversation-viewer-static.test.mjs +3 -3
- package/tests/intercom-conversations-http.test.mjs +16 -0
- package/tests/main-output-loading-static.test.mjs +3 -3
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +80 -67
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/persistent-ui-layout-static.test.mjs +4 -4
- package/tests/prompt-input-vertical-scroll-static.test.mjs +26 -0
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +23 -0
- package/tests/resource-defaults-helper.test.mjs +12 -0
- package/tests/runtime-error-visibility.test.mjs +3 -3
- package/tests/session-auth-harness.test.mjs +26 -1
- package/tests/session-sampling-helper.test.mjs +1 -0
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/session-tree-event-targets.test.mjs +106 -0
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/stream-derived-output.test.mjs +121 -0
- package/tests/stream-markdown-tail.test.mjs +218 -0
- package/tests/stream-output-controller.test.mjs +119 -4
- package/tests/stream-output-isolation-static.test.mjs +27 -6
- package/tests/stream-output-workloads.test.mjs +40 -3
- package/tests/stream-render-scheduler.test.mjs +115 -0
- package/tests/streaming-ui-coupling.test.mjs +1 -1
- package/tests/subagent-launch-policy.test.mjs +532 -0
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/subagents-helper.test.mjs +211 -1
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/tab-close-continuity-static.test.mjs +23 -0
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/thinking-format-parser.test.mjs +15 -0
- package/tests/todo-filter-static.test.mjs +148 -0
- package/tests/transcript-markdown-tail.test.mjs +137 -0
- package/webui-rpc-helper.mjs +220 -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.
|
|
311
|
-
const
|
|
312
|
-
|
|
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
|
-
//
|
|
316
|
-
//
|
|
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
|
-
|
|
329
|
-
state.
|
|
330
|
-
const
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
state.
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
const
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
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=
|
|
68
|
+
const styleLink = new FakeElement({ href: "http://127.0.0.1:31415/styles.css?v=137", 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=
|
|
87
|
+
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=166" } }),
|
|
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=
|
|
235
|
+
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=166"), "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
|
-
|
|
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("
|
|
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
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
|
|
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
|
|
278
|
-
|
|
279
|
-
await
|
|
280
|
-
await
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
await expect.poll(async () =>
|
|
285
|
-
const
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
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"))).
|
|
295
|
-
await expect.poll(async () =>
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
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
|
});
|
|
@@ -119,6 +119,17 @@ async function suppressUnrelatedOverlays(page) {
|
|
|
119
119
|
await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
+
async function openSetupFromDirect(page, selector) {
|
|
123
|
+
const menu = page.locator(MENU_SELECTOR);
|
|
124
|
+
await page.locator(selector).click({ button: "right" });
|
|
125
|
+
await expect(menu).toBeVisible();
|
|
126
|
+
await menu.getByRole("menuitem", { name: "Open setup" }).click();
|
|
127
|
+
await expect(menu).toBeHidden();
|
|
128
|
+
const dialog = page.locator("#controlVisibilitySetupDialog");
|
|
129
|
+
await expect(dialog).toBeVisible();
|
|
130
|
+
return dialog;
|
|
131
|
+
}
|
|
132
|
+
|
|
122
133
|
test.describe.configure({ mode: "serial" });
|
|
123
134
|
|
|
124
135
|
test.beforeAll(async () => {
|
|
@@ -136,6 +147,131 @@ test.afterAll(async () => {
|
|
|
136
147
|
await rm(tempRoot, { recursive: true, force: true });
|
|
137
148
|
});
|
|
138
149
|
|
|
150
|
+
test("setup dialog covers the catalog, immediate durability, quick actions, focus, gating, and narrow viewports", async ({ page }) => {
|
|
151
|
+
await page.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
152
|
+
await suppressUnrelatedOverlays(page);
|
|
153
|
+
const menu = page.locator(MENU_SELECTOR);
|
|
154
|
+
const optionsButton = page.locator("#optionsMenuButton");
|
|
155
|
+
const optionsAction = page.locator('[data-composer-action-id="options"]');
|
|
156
|
+
|
|
157
|
+
// The grouped area menu opens setup and its non-focusable host uses the
|
|
158
|
+
// prompt fallback when setup closes.
|
|
159
|
+
await openAreaMenu(page);
|
|
160
|
+
await menu.getByRole("menuitem", { name: "Open setup" }).click();
|
|
161
|
+
let dialog = page.locator("#controlVisibilitySetupDialog");
|
|
162
|
+
await expect(dialog).toBeVisible();
|
|
163
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
164
|
+
await expect(dialog).toBeHidden();
|
|
165
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
166
|
+
|
|
167
|
+
// Wrapped controls preserve the actual inner button for pointer and keyboard
|
|
168
|
+
// invocation instead of retaining their non-focusable catalog wrapper.
|
|
169
|
+
dialog = await openSetupFromDirect(page, "#optionsMenuButton");
|
|
170
|
+
await page.keyboard.press("Escape");
|
|
171
|
+
await expect(dialog).toBeHidden();
|
|
172
|
+
await expect(optionsButton).toBeFocused();
|
|
173
|
+
|
|
174
|
+
await optionsButton.focus();
|
|
175
|
+
await page.keyboard.press("Shift+F10");
|
|
176
|
+
await expect(menu).toBeVisible();
|
|
177
|
+
await menu.getByRole("menuitem", { name: "Open setup" }).focus();
|
|
178
|
+
await page.keyboard.press("Enter");
|
|
179
|
+
await expect(dialog).toBeVisible();
|
|
180
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
181
|
+
await expect(optionsButton).toBeFocused();
|
|
182
|
+
|
|
183
|
+
// If setup hides the wrapped catalog root, its inner button is no longer a
|
|
184
|
+
// surviving return target and focus falls back safely to the prompt.
|
|
185
|
+
dialog = await openSetupFromDirect(page, "#optionsMenuButton");
|
|
186
|
+
await dialog.getByLabel("Show Common options").uncheck();
|
|
187
|
+
await expect(optionsAction).toHaveClass(/webui-user-hidden/);
|
|
188
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
189
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
190
|
+
await openAreaMenu(page);
|
|
191
|
+
await menu.getByRole("menuitem", { name: "Reset defaults" }).click();
|
|
192
|
+
await expect(optionsAction).not.toHaveClass(/webui-user-hidden/);
|
|
193
|
+
await expect.poll(hiddenIdsOnDisk).toBe(null);
|
|
194
|
+
|
|
195
|
+
// A direct visibility menu opens the generated setup and transfers focus.
|
|
196
|
+
dialog = await openSetupFromDirect(page, "#newSessionButton");
|
|
197
|
+
await expect(dialog.getByRole("checkbox")).toHaveCount(24);
|
|
198
|
+
await expect(dialog.getByRole("group")).toHaveCount(5);
|
|
199
|
+
assert.deepEqual(
|
|
200
|
+
await dialog.getByRole("group").evaluateAll((groups) => groups.map((group) => group.querySelector("legend")?.textContent?.trim())),
|
|
201
|
+
["Workspace toolbar", "Control Deck", "Composer actions", "Input-frame controls", "Input-frame tags"],
|
|
202
|
+
"setup groups should follow the approved catalog order",
|
|
203
|
+
);
|
|
204
|
+
await expect(dialog.locator('[data-visibility-setup-id="composer.send"]')).toHaveCount(0);
|
|
205
|
+
await expect(dialog.getByText("Send", { exact: true })).toHaveCount(0);
|
|
206
|
+
await expect(dialog.getByLabel("Show Save workspace")).toBeFocused();
|
|
207
|
+
|
|
208
|
+
// Simulate runtime capability gating deterministically: preference application
|
|
209
|
+
// may toggle only its class and must leave the capability-owned hidden state intact.
|
|
210
|
+
const gitButton = page.locator('[data-composer-action-id="git"]');
|
|
211
|
+
await expect(dialog.getByLabel("Show Guided Git workflow")).toBeChecked();
|
|
212
|
+
await gitButton.evaluate((element) => { element.hidden = true; });
|
|
213
|
+
await expect(gitButton).toBeHidden();
|
|
214
|
+
|
|
215
|
+
// Escape follows the native dialog close path and restores a surviving opener.
|
|
216
|
+
await page.keyboard.press("Escape");
|
|
217
|
+
await expect(dialog).toBeHidden();
|
|
218
|
+
await expect(page.locator("#newSessionButton")).toBeFocused();
|
|
219
|
+
|
|
220
|
+
// Hiding the invoking control persists immediately and makes Close use the prompt fallback.
|
|
221
|
+
dialog = await openSetupFromDirect(page, "#attachButton");
|
|
222
|
+
const attachToggle = dialog.getByLabel("Show Attach files");
|
|
223
|
+
await attachToggle.uncheck();
|
|
224
|
+
await expect(page.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
225
|
+
assert.deepEqual(await hiddenIdsInLocal(page), ["input.attach-files"], "setup changes should update the local cache immediately");
|
|
226
|
+
await expect.poll(hiddenIdsOnDisk).toEqual(["input.attach-files"]);
|
|
227
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
228
|
+
await expect(dialog).toBeHidden();
|
|
229
|
+
await expect(page.locator("#promptInput")).toBeFocused();
|
|
230
|
+
|
|
231
|
+
// Reload from durable settings, not the browser cache, and synchronize the setup checkbox.
|
|
232
|
+
await page.evaluate((key) => localStorage.removeItem(key), HIDDEN_IDS_KEY);
|
|
233
|
+
await page.reload({ waitUntil: "domcontentloaded" });
|
|
234
|
+
await suppressUnrelatedOverlays(page);
|
|
235
|
+
await expect(page.locator("#attachButton")).toHaveClass(/webui-user-hidden/);
|
|
236
|
+
dialog = await openSetupFromDirect(page, "#newSessionButton");
|
|
237
|
+
await expect(dialog.getByLabel("Show Attach files")).not.toBeChecked();
|
|
238
|
+
|
|
239
|
+
// Reapply the simulated capability state after reload, which replaced the DOM.
|
|
240
|
+
await gitButton.evaluate((element) => { element.hidden = true; });
|
|
241
|
+
await expect(gitButton).toBeHidden();
|
|
242
|
+
|
|
243
|
+
// Setup quick actions preserve the [] versus null contract and refresh all toggles.
|
|
244
|
+
await dialog.getByRole("button", { name: "Show all" }).click();
|
|
245
|
+
await expect.poll(() => dialog.getByRole("checkbox").evaluateAll((checkboxes) => checkboxes.every((checkbox) => checkbox.checked))).toBe(true);
|
|
246
|
+
assert.deepEqual(await hiddenIdsInLocal(page), [], "Show all should persist an explicit empty list");
|
|
247
|
+
await expect.poll(hiddenIdsOnDisk).toEqual([]);
|
|
248
|
+
assert.ok(await gitButton.evaluate((element) => element.hidden), "Show all must not clear capability-owned hidden state");
|
|
249
|
+
|
|
250
|
+
await dialog.getByRole("button", { name: "Reset defaults" }).click();
|
|
251
|
+
await expect.poll(() => dialog.getByRole("checkbox").evaluateAll((checkboxes) => checkboxes.every((checkbox) => checkbox.checked))).toBe(true);
|
|
252
|
+
assert.equal(await hiddenIdsInLocal(page), null, "Reset defaults should clear the preference to null");
|
|
253
|
+
await expect.poll(hiddenIdsOnDisk).toBe(null);
|
|
254
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
255
|
+
await expect(page.locator("#newSessionButton")).toBeFocused();
|
|
256
|
+
|
|
257
|
+
// A short viewport keeps the dialog bounded, its persistent actions usable,
|
|
258
|
+
// and the full generated catalog reachable through an independently scrolling body.
|
|
259
|
+
dialog = await openSetupFromDirect(page, "#newSessionButton");
|
|
260
|
+
await page.setViewportSize({ width: 360, height: 640 });
|
|
261
|
+
await expect(dialog.getByRole("button", { name: "Show all" })).toBeVisible();
|
|
262
|
+
await expect(dialog.getByRole("button", { name: "Reset defaults" })).toBeVisible();
|
|
263
|
+
await expect(dialog.getByRole("button", { name: "Close" })).toBeVisible();
|
|
264
|
+
const dialogBounds = await dialog.boundingBox();
|
|
265
|
+
assert.ok(dialogBounds.x >= 0 && dialogBounds.y >= 0, "the setup should not overflow the top or left viewport edges");
|
|
266
|
+
assert.ok(dialogBounds.x + dialogBounds.width <= 360 && dialogBounds.y + dialogBounds.height <= 640, "the setup should remain bounded by the narrow viewport");
|
|
267
|
+
assert.ok(await dialog.locator("#controlVisibilitySetupBody").evaluate((body) => body.scrollHeight > body.clientHeight), "the setup catalog should scroll within its bounded body");
|
|
268
|
+
await dialog.locator("#controlVisibilitySetupBody").evaluate((body) => { body.scrollTop = body.scrollHeight; });
|
|
269
|
+
await expect(dialog.getByLabel("Show Workflow-mode tag")).toBeVisible();
|
|
270
|
+
await dialog.getByRole("button", { name: "Close" }).click();
|
|
271
|
+
await expect(dialog).toBeHidden();
|
|
272
|
+
await expect(menu).toBeHidden();
|
|
273
|
+
});
|
|
274
|
+
|
|
139
275
|
test("grouped area menu, direct hide, recovery, persistence, gating, Send exclusion, keyboard", async ({ page }) => {
|
|
140
276
|
await page.goto(baseURL, { waitUntil: "domcontentloaded" });
|
|
141
277
|
await suppressUnrelatedOverlays(page);
|
|
@@ -152,10 +288,12 @@ test("grouped area menu, direct hide, recovery, persistence, gating, Send exclus
|
|
|
152
288
|
await page.reload({ waitUntil: "domcontentloaded" });
|
|
153
289
|
await suppressUnrelatedOverlays(page);
|
|
154
290
|
const optionsAction = page.locator('[data-composer-action-id="options"]');
|
|
291
|
+
const compactAction = page.locator('[data-composer-action-id="compact"]');
|
|
155
292
|
const newAction = page.locator('[data-composer-action-id="new"]');
|
|
156
293
|
await expect.poll(() => optionsAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeGreaterThan(1);
|
|
157
294
|
await expect.poll(() => newAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeGreaterThan(0);
|
|
158
295
|
const initialOptionsColumn = Number(await optionsAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column")));
|
|
296
|
+
const initialCompactColumn = Number(await compactAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column")));
|
|
159
297
|
const initialNewColumn = Number(await newAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column")));
|
|
160
298
|
|
|
161
299
|
// Send and editable controls are not region-menu proxies.
|
|
@@ -193,13 +331,14 @@ test("grouped area menu, direct hide, recovery, persistence, gating, Send exclus
|
|
|
193
331
|
await menu.locator('[data-visibility-menu-action="hide"]').click();
|
|
194
332
|
await expect(page.locator("#newSessionButton")).toHaveClass(/webui-user-hidden/);
|
|
195
333
|
await expect(page.locator("#promptInput")).toBeFocused();
|
|
196
|
-
await expect.poll(() =>
|
|
334
|
+
await expect.poll(() => compactAction.evaluate((element) => Number(element.style.getPropertyValue("--composer-action-grid-column")))).toBeLessThan(initialCompactColumn);
|
|
197
335
|
assert.ok(Number(await optionsAction.evaluate((element) => element.style.getPropertyValue("--composer-action-grid-column"))) > 0, "repacked actions should keep a positive dense slot");
|
|
198
336
|
assert.deepEqual(await hiddenIdsInLocal(page), ["composer.new"], "direct hide should persist locally first");
|
|
199
337
|
await expect.poll(async () => (await hiddenIdsOnDisk())?.slice?.().sort?.()).toEqual(["composer.new"]);
|
|
200
338
|
|
|
201
|
-
//
|
|
339
|
+
// Simulate runtime capability gating deterministically before preferences show all.
|
|
202
340
|
const gitButton = page.locator('[data-composer-action-id="git"]');
|
|
341
|
+
await gitButton.evaluate((element) => { element.hidden = true; });
|
|
203
342
|
await openAreaMenu(page);
|
|
204
343
|
assert.ok(await gitButton.evaluate((element) => element.hidden), "capability-hidden controls keep the hidden attribute");
|
|
205
344
|
await menu.getByRole("menuitem", { name: "Show all" }).click();
|