@firstpick/pi-package-webui 0.9.4 → 0.9.5

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 (42) hide show
  1. package/README.md +3 -0
  2. package/lib/ui-layout-settings.mjs +37 -6
  3. package/package.json +1 -1
  4. package/public/app.js +499 -6
  5. package/public/index.html +33 -26
  6. package/public/service-worker.js +1 -1
  7. package/public/stream-output-controller.mjs +31 -2
  8. package/public/styles.css +27 -2
  9. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  10. package/tests/browser/control-deck-side-panels.spec.mjs +42 -0
  11. package/tests/browser/control-visibility.spec.mjs +396 -0
  12. package/tests/browser/persistent-ui-layout.spec.mjs +9 -9
  13. package/tests/codex-fast-mode-static.test.mjs +2 -2
  14. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  15. package/tests/control-deck-side-panels-static.test.mjs +3 -1
  16. package/tests/control-visibility-static.test.mjs +294 -0
  17. package/tests/controls-layout-static.test.mjs +3 -3
  18. package/tests/fast-mode-client-static.test.mjs +1 -1
  19. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  20. package/tests/file-viewer-image-static.test.mjs +3 -3
  21. package/tests/fixtures/streaming-workloads.mjs +131 -0
  22. package/tests/git-workflow-preferences.test.mjs +2 -2
  23. package/tests/http-endpoints-harness.test.mjs +4 -4
  24. package/tests/intercom-conversation-viewer-static.test.mjs +4 -4
  25. package/tests/main-output-loading-static.test.mjs +3 -3
  26. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  27. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  28. package/tests/mobile-foundation-static.test.mjs +3 -3
  29. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  30. package/tests/mobile-static.test.mjs +3 -3
  31. package/tests/open-issue-wizard-static.test.mjs +2 -2
  32. package/tests/persistent-ui-layout-static.test.mjs +6 -6
  33. package/tests/questionnaire-dialog.test.mjs +3 -3
  34. package/tests/session-sampling-ui-static.test.mjs +3 -3
  35. package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
  36. package/tests/stream-output-isolation-static.test.mjs +7 -0
  37. package/tests/stream-output-workloads.test.mjs +239 -0
  38. package/tests/subagent-observability-static.test.mjs +2 -2
  39. package/tests/syntax-highlighting-static.test.mjs +3 -3
  40. package/tests/theme-customizer-static.test.mjs +1 -1
  41. package/tests/ui-layout-settings.test.mjs +54 -7
  42. package/tests/webui-settings-locking.test.mjs +3 -3
@@ -74,7 +74,7 @@ assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item
74
74
  assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
75
75
  assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
76
76
  assert.match(html, /<div class="side-panel-heading">[\s\S]*<strong class="side-panel-title">Control Deck<\/strong>[\s\S]*<div class="side-panel-version-row"[\s\S]*<button id="piVersionButton"[\s\S]*aria-controls="piReleaseNotesDialog"[\s\S]*<button id="webuiVersionButton"[\s\S]*aria-controls="webuiPackageDialog"[\s\S]*id="webuiDevBadge"/, "Control Deck header should keep its title separate from an aligned version and build row");
77
- assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
77
+ assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" data-visibility-key="control-deck\.sponsor" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
78
78
  assert.match(html, /<dialog id="piReleaseNotesDialog"[\s\S]*id="piReleaseNotesTitle"[\s\S]*id="piReleaseNotesStatus"[\s\S]*id="piReleaseNotesBody"[\s\S]*id="piReleaseNotesGithubLink"/, "Pi release notes should use a dedicated accessible dialog");
79
79
  assert.doesNotMatch(html, /Safer option|confirmationAlternative/, "shared confirmation dialogs should not render a safer-option row");
80
80
  assert.doesNotMatch(app, /confirmationAlternative|\balternative:\s*options\.alternative/, "confirmation logic should not populate a removed safer-option row");
@@ -332,7 +332,7 @@ assert.match(app, /attachmentTextDialog\?\.addEventListener\("keydown"[\s\S]*eve
332
332
  assert.match(css, /\.attachment-text-dialog[\s\S]*\.attachment-text-editor/, "text attachment editor should have dedicated dialog styling");
333
333
  assert.match(html, /id="composerActionsButton"/, "mobile composer should expose a compact actions trigger");
334
334
  assert.match(html, /id="composerActionsPanel"/, "secondary composer controls should live in a mobile actions panel");
335
- assert.match(html, /<div class="composer-row">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
335
+ assert.match(html, /<div class="composer-row" data-visibility-region="composer">[\s\S]*id="abortButton"[\s\S]*id="btwButton"[\s\S]*id="sendButton"/, "Abort and /btw should live in the bottom composer row beside Send");
336
336
  assert.match(html, /id="btwButton"[\s\S]*class="composer-icon-button composer-btw-button"[\s\S]*?<svg class="composer-icon"/, "composer should expose an icon-only /btw side-question button");
337
337
  assert.doesNotMatch(html, /id="btwButton"[\s\S]*?<span>\/btw<\/span>[\s\S]*?id="sendButton"/, "/btw composer button should not show a text label");
338
338
  assert.match(html, /id="abortButton"[^>]*Hold Esc or the Abort button for 3 seconds/, "Abort should advertise guarded Esc and long-press affordances");
@@ -363,7 +363,7 @@ assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-
363
363
  const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
364
364
  const workflowOverlayOpenButtonHtml = html.match(/<button\s+id="workflowOverlayOpenButton"[\s\S]*?<\/button>/)?.[0] || "";
365
365
  const optionsMenuHtml = html.match(/<div id="optionsMenu"[\s\S]*?<\/div>/)?.[0] || "";
366
- assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
366
+ assert.match(html, /id="commandSuggest"[\s\S]*?<div class="composer-input-row" data-visibility-region="inputframe">\s*<div id="workflowModeControls" class="composer-workflow-mode-dock" role="group" aria-label="Workflow Mode controls" data-visibility-key="input\.workflow"[\s\S]*id="workflowOverlayOpenButton"[\s\S]*aria-controls="widgetArea"[\s\S]*id="workflowModeButton"[\s\S]*?<\/div>\s*<div class="composer-context-tags">/, "Workflow Mode should remain directly accessible as an isolated icon-only overlay inside the prompt frame");
367
367
  assert.doesNotMatch(html, /composer-workflow-mode-dock-label|>Workflow mode<\/span>/, "Workflow Mode dock should not render visible text beside the icon");
368
368
  assert.doesNotMatch(optionsMenuHtml, /id="workflowModeButton"|Workflow Mode/, "Options menu should not duplicate or hide the directly accessible Workflow Mode control");
369
369
  assert.doesNotMatch(workflowOverlayOpenButtonHtml, /\stitle=/, "Workflow overlay restore should not combine a browser-native tooltip with its styled tooltip");
@@ -46,7 +46,7 @@ assert.doesNotMatch(botClient, /OPENAI_API_KEY|GITHUB_APP_|PRIVATE_KEY/, "the br
46
46
 
47
47
  assert.match(html, /__PI_WEBUI_ISSUE_BOT_CONFIG__[\s\S]*?enabled: false/, "the page must expose only disabled-by-default public runtime configuration");
48
48
  assert.match(html, /id="openIssueButton"[\s\S]*?aria-controls="issueWizardDialog"/, "the persistent Control Deck action must target the dialog");
49
- assert.match(html, /<footer class="side-panel-footer" data-control-deck-shared-footer>[\s\S]*?id="openIssueButton"/, "the singleton action must stay outside scrolling Control Deck content while rehosting with the active shell");
49
+ assert.match(html, /<footer class="side-panel-footer" data-control-deck-shared-footer data-visibility-region="control-deck">[\s\S]*?id="openIssueButton"/, "the singleton action must stay outside scrolling Control Deck content while rehosting with the active shell");
50
50
  assert.match(html, /<dialog id="issueWizardDialog"[\s\S]*?aria-labelledby="issueWizardTitle"[\s\S]*?aria-describedby="issueWizardDescription"/, "the dialog must have an accessible name and description");
51
51
  for (const step of [1, 2, 3, 4, 5]) assert.match(html, new RegExp(`data-issue-wizard-page="${step}"`), `step ${step} markup must exist`);
52
52
  assert.match(html, /id="issueWizardStatus"[^>]*role="status"[^>]*aria-live="polite"/, "wizard progress must retain its accessible live region");
@@ -68,7 +68,7 @@ assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server
68
68
  assert.match(serviceWorker, /"\/issue-wizard-state\.mjs"/, "the PWA shell must keep caching the pure wizard module");
69
69
  assert.match(serviceWorker, /"\/issue-bot-client\.mjs"/, "the PWA shell must cache the browser client module");
70
70
  // Intent preserved: changing the public startup graph advances the PWA cache identity.
71
- assert.match(serviceWorker, /pi-webui-pwa-v112/, "the PWA cache name must change with browser wiring updates");
71
+ assert.match(serviceWorker, /pi-webui-pwa-v115/, "the PWA cache name must change with browser wiring updates");
72
72
  assert.match(packageJson, /node --check public\/issue-wizard-state\.mjs/, "the package check must keep syntax-checking the pure wizard module");
73
73
  assert.match(packageJson, /node --check public\/issue-bot-client\.mjs/, "the package check must syntax-check the browser client module");
74
74
 
@@ -14,12 +14,12 @@ const [html, app, serviceWorker] = await Promise.all([
14
14
 
15
15
  assert.match(
16
16
  app,
17
- /const UI_LAYOUT_SCHEMA_VERSION = 2;[\s\S]*const UI_LAYOUT_ENDPOINT = "\/api\/interface-preferences";/,
18
- "the browser controller should target the accepted version-1 layout schema on the existing interface-preferences endpoint",
17
+ /const UI_LAYOUT_SCHEMA_VERSION = 3;[\s\S]*const UI_LAYOUT_ENDPOINT = "\/api\/interface-preferences";/,
18
+ "the browser controller should target the accepted version-3 layout schema on the existing interface-preferences endpoint",
19
19
  );
20
20
  assert.match(
21
21
  app,
22
- /const UI_LAYOUT_FIELDS = \["sidePanel", "composerActions", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"\];/,
22
+ /const UI_LAYOUT_FIELDS = \["sidePanel", "composerActions", "controlVisibility", "footerScopedModelOrder", "terminalTabs", "fileViewerWidth"\];/,
23
23
  "every approved arrangement surface should be a durable layout field",
24
24
  );
25
25
  assert.match(
@@ -271,8 +271,8 @@ assert.match(
271
271
 
272
272
  // --- Coherent browser asset revisions --------------------------------------
273
273
 
274
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "changed browser assets should advance the PWA cache identity");
275
- assert.match(html, /styles\.css\?v=126/, "the page should request the updated layout stylesheet revision");
276
- assert.match(html, /data-app-src="\/app\.js\?v=148"/, "the boot loader should request the updated app module revision");
274
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "changed browser assets should advance the PWA cache identity");
275
+ assert.match(html, /styles\.css\?v=129/, "the page should request the updated layout stylesheet revision");
276
+ assert.match(html, /data-app-src="\/app\.js\?v=150"/, "the boot loader should request the updated app module revision");
277
277
 
278
278
  console.log("persistent-ui-layout-static.test.mjs passed");
@@ -504,8 +504,8 @@ assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(p
504
504
  assert.match(css, /\.questionnaire-options button\s*\{\s*min-height:\s*3\.35rem/, "mobile questionnaire targets must exceed the 44px floor");
505
505
  assert.match(css, /@media \(prefers-reduced-motion: reduce\)\s*\{[\s\S]*?\*, \*::before, \*::after[\s\S]*?transition-duration:\s*1ms !important/, "global reduced-motion rules must cover questionnaire transitions");
506
506
 
507
- assert.match(html, /styles\.css\?v=126/, "questionnaire CSS needs the current stylesheet revision");
508
- assert.match(html, /app\.js\?v=148/, "questionnaire behavior needs the current app revision");
509
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "questionnaire public assets need a coherent PWA cache revision");
507
+ assert.match(html, /styles\.css\?v=129/, "questionnaire CSS needs the current stylesheet revision");
508
+ assert.match(html, /app\.js\?v=150/, "questionnaire behavior needs the current app revision");
509
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "questionnaire public assets need a coherent PWA cache revision");
510
510
 
511
511
  console.log("questionnaire-dialog.test.mjs passed");
@@ -57,10 +57,10 @@ assert.match(css, /\.sampling-parameter-control\.unsupported:hover:not\(\.sampli
57
57
  assert.match(css, /\.sampling-parameter-control\.unsupported:focus-visible:not\(\.sampling-tooltip-dismissed\) > \.sampling-parameter-unsupported-tooltip/, "keyboard focus should reveal dismissible unsupported reasons");
58
58
  assert.match(css, /\.sampling-parameter-unsupported-tooltip\.sampling-tooltip-below/, "bounded placement should support flipping below top-edge rows");
59
59
  assert.match(css, /pointer-events: auto;/, "a visible unsupported tooltip should remain pointer-hoverable");
60
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "native-control assets should advance the cache identity");
60
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "native-control assets should advance the cache identity");
61
61
  assert.match(serviceWorker, /"\/sampling-parameter-controls\.mjs"/, "the pure sampling module should be part of the offline app shell");
62
- assert.match(html, /styles\.css\?v=126/, "the changed stylesheet should have a new revision");
63
- assert.match(html, /app\.js\?v=148/, "the changed app module should have a new revision");
62
+ assert.match(html, /styles\.css\?v=129/, "the changed stylesheet should have a new revision");
63
+ assert.match(html, /app\.js\?v=150/, "the changed app module should have a new revision");
64
64
 
65
65
  // --- Browser state behavior -------------------------------------------------
66
66
 
@@ -27,8 +27,8 @@ assert.doesNotMatch(layout, /sectionHeightMin|sectionHeightMax|validateSectionHe
27
27
  assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLayout", "collapsedSectionIds", "hiddenSectionIds", "collapsedPanels", "panelWidths"\];/, "the browser durable layout field list should omit section heights");
28
28
  assert.match(app, /function clearRemovedSidePanelSectionHeightState\(\)[\s\S]*localStorage\.removeItem\(REMOVED_SIDE_PANEL_SECTION_HEIGHT_STORAGE_KEY\)[\s\S]*record\.field === "sidePanel" && record\.subfield === "sectionHeights"/, "startup should remove the retired cache and pending mutations");
29
29
  assert.match(app, /clearRemovedSidePanelSectionHeightState\(\);\s*restoreDurableUiLayoutPendingJournal\(\);/, "retired height state should be cleared before pending layout restoration");
30
- assert.match(html, /styles\.css\?v=126/, "removing section resize styles should advance the stylesheet revision");
31
- assert.match(html, /app\.js\?v=148/, "removing section resize behavior should advance the app revision");
32
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "removing browser assets should advance the PWA cache identity");
30
+ assert.match(html, /styles\.css\?v=129/, "removing section resize styles should advance the stylesheet revision");
31
+ assert.match(html, /app\.js\?v=150/, "removing section resize behavior should advance the app revision");
32
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "removing browser assets should advance the PWA cache identity");
33
33
 
34
34
  console.log("side-panel-section-height-removal-static.test.mjs passed");
@@ -85,5 +85,12 @@ assert.doesNotMatch(app, /function scheduleStreamingAssistantTextRender|function
85
85
  assert.match(app, /onUnknownStreamEvent: preserveUnknownTranscriptEvidence/, "unknown transcript-shaped events should retain transcript-only evidence");
86
86
  assert.match(app, /reconcileUnknownTranscriptEvidenceAtBarrier\(event\)/, "unknown evidence should request authoritative reconciliation only at a semantic barrier");
87
87
  assert.match(app, /streamIsolationDebug[\s\S]*?__piStreamIsolationDebug/, "the opt-in test diagnostic ledger should be exposed only behind the explicit debug flag");
88
+ assert.match(controller, /receivedAt: diagnosticsEnabled \? now\(\) : undefined/, "receipt timing must be disabled with diagnostics");
89
+ assert.match(controller, /maxAgeMs[\s\S]*?drainMs/, "diagnostic batches should report queue age and drain duration");
90
+ assert.match(app, /version: 2,[\s\S]*?batchPaintMaxMs[\s\S]*?transcriptNodeMax[\s\S]*?currentMessageNodeMax/, "ledger v2 should expose paint and DOM-node high-water counters");
91
+ assert.match(app, /function scheduleStreamPaintDiagnostic[\s\S]*?requestAnimationFrame[\s\S]*?type: "paint-opportunity"/, "paint opportunity timing should run only from the opt-in diagnostic path");
92
+ assert.match(app, /function streamDiagnosticBytes[\s\S]*?length \* 2/, "stream byte metrics should use conservative UTF-16 accounting");
93
+ assert.match(app, /new PerformanceObserver[\s\S]*?type: "longtask"[\s\S]*?type: "long-animation-frame"/, "supported long-task and long-frame entries should feed the ledger");
94
+ assert.match(app, /type: "markdown-commit"[\s\S]*?tailBytes[\s\S]*?tailKind/, "mutable Markdown tail diagnostics should include size and block kind");
88
95
 
89
96
  console.log("stream-output-isolation-static.test.mjs passed");
@@ -0,0 +1,239 @@
1
+ import assert from "node:assert/strict";
2
+ import {
3
+ DEFAULT_STREAM_PENDING_BYTE_LIMIT,
4
+ DEFAULT_STREAM_PENDING_ENTRY_LIMIT,
5
+ createStreamOutputController,
6
+ } from "../public/stream-output-controller.mjs";
7
+ import {
8
+ concatenatedDeltaText,
9
+ longParagraphDeltaEvents,
10
+ messageUpdateEvent,
11
+ mixedSemanticBurstEvents,
12
+ openFenceDeltaEvents,
13
+ overflowBurstEvents,
14
+ smallTextDeltaEvents,
15
+ thinkingStreamEvents,
16
+ } from "./fixtures/streaming-workloads.mjs";
17
+
18
+ class FakeFrames {
19
+ next = 1;
20
+ callbacks = new Map();
21
+
22
+ schedule = (callback) => {
23
+ const handle = this.next++;
24
+ this.callbacks.set(handle, callback);
25
+ return handle;
26
+ };
27
+
28
+ cancel = (handle) => {
29
+ this.callbacks.delete(handle);
30
+ };
31
+
32
+ runAll() {
33
+ while (this.callbacks.size) {
34
+ const [handle, callback] = this.callbacks.entries().next().value;
35
+ this.callbacks.delete(handle);
36
+ callback();
37
+ }
38
+ }
39
+ }
40
+
41
+ function harness({ diagnostics = true, nowStepMs = 1 } = {}) {
42
+ const frames = new FakeFrames();
43
+ const records = [];
44
+ const applied = { text: "", thinking: "", toolCall: "", toolExecution: [], errors: 0, order: [] };
45
+ let clock = 0;
46
+ let nowCalls = 0;
47
+ const controller = createStreamOutputController({
48
+ scheduleFrame: frames.schedule,
49
+ cancelFrame: frames.cancel,
50
+ now: () => {
51
+ nowCalls += 1;
52
+ clock += nowStepMs;
53
+ return clock;
54
+ },
55
+ applyTextUpdate: (event) => {
56
+ applied.text += event.assistantMessageEvent.delta || "";
57
+ applied.order.push(`text:${event.assistantMessageEvent.type}`);
58
+ },
59
+ applyThinkingUpdate: (event) => {
60
+ applied.thinking += event.assistantMessageEvent.delta || "";
61
+ applied.order.push(`thinking:${event.assistantMessageEvent.type}`);
62
+ },
63
+ applyToolCallUpdate: (event) => {
64
+ applied.toolCall += event.assistantMessageEvent.delta || "";
65
+ applied.order.push(`tool-call:${event.assistantMessageEvent.type}`);
66
+ },
67
+ applyToolExecutionUpdate: (event) => {
68
+ applied.toolExecution.push(event.partialResult?.content || "");
69
+ applied.order.push("tool-execution");
70
+ },
71
+ applyStreamError: () => {
72
+ applied.errors += 1;
73
+ applied.order.push("stream-error");
74
+ },
75
+ onDiagnostic: diagnostics ? (record) => records.push(record) : undefined,
76
+ });
77
+ return {
78
+ frames,
79
+ records,
80
+ applied,
81
+ controller,
82
+ nowCallCount: () => nowCalls,
83
+ dispatchAll(events) {
84
+ for (const event of events) controller.dispatch(event);
85
+ },
86
+ };
87
+ }
88
+
89
+ // 1) Small-delta burst: lossless coalescing collapses transport events into few batches.
90
+ {
91
+ const run = harness();
92
+ const events = smallTextDeltaEvents(1000);
93
+ run.dispatchAll(events);
94
+ run.frames.runAll();
95
+ assert.equal(run.applied.text, concatenatedDeltaText(events), "coalesced text must equal exact concatenation");
96
+ const batches = run.records.filter((record) => record.type === "batch");
97
+ const receipts = run.records.filter((record) => record.type === "receipt");
98
+ assert.equal(receipts.length, 1000, "every transport event must be received");
99
+ assert.ok(batches.length <= 5, `render batches (${batches.length}) must stay far below transport events`);
100
+ const totalSources = batches.reduce((total, batch) => total + batch.sourceCount, 0);
101
+ assert.equal(totalSources, 1000, "batch sourceCounts must account for every source event");
102
+ }
103
+
104
+ // 2) Long unbroken paragraph (1 MB): byte-limit overflow drains stay lossless and bounded.
105
+ {
106
+ const run = harness();
107
+ const events = longParagraphDeltaEvents(1024 * 1024, 512);
108
+ run.dispatchAll(events);
109
+ run.frames.runAll();
110
+ run.controller.flush();
111
+ assert.equal(run.applied.text.length, 1024 * 1024, "no paragraph bytes may be lost");
112
+ assert.equal(run.applied.text, concatenatedDeltaText(events), "paragraph must survive overflow drains byte-for-byte");
113
+ const overflow = run.records.filter((record) => record.type === "overflow");
114
+ assert.ok(overflow.length > 0, "1 MB through a 256 KB queue must report overflow");
115
+ for (const record of run.records.filter((entry) => entry.type === "queued")) {
116
+ assert.ok(record.pendingBytes <= DEFAULT_STREAM_PENDING_BYTE_LIMIT, "pending bytes must never exceed the configured bound");
117
+ assert.ok(record.pendingCount <= DEFAULT_STREAM_PENDING_ENTRY_LIMIT, "pending entries must never exceed the configured bound");
118
+ }
119
+ }
120
+
121
+ // 3) Open code fences: under-limit and over-limit fixtures both stream losslessly.
122
+ for (const codeBytes of [40 * 1024, 100 * 1024]) {
123
+ const run = harness();
124
+ const events = openFenceDeltaEvents(codeBytes);
125
+ run.dispatchAll(events);
126
+ run.frames.runAll();
127
+ run.controller.flush();
128
+ const expected = concatenatedDeltaText(events);
129
+ assert.equal(run.applied.text, expected, `open fence (${codeBytes} bytes) must stream losslessly`);
130
+ assert.ok(expected.startsWith("```js\n"), "fixture must open a fence");
131
+ assert.ok(!/```\s*$/.test(expected), "fixture fence must remain open");
132
+ }
133
+
134
+ // 4) Thinking stream: start/end barriers flush synchronously and text is exact.
135
+ {
136
+ const run = harness();
137
+ const events = thinkingStreamEvents(500);
138
+ run.dispatchAll(events);
139
+ assert.equal(run.controller.pendingCount(), 0, "thinking_end barrier must leave nothing queued");
140
+ assert.equal(run.applied.thinking, concatenatedDeltaText(events, "thinking_delta"), "thinking text must be exact");
141
+ const barriers = run.records.filter((record) => record.type === "barrier");
142
+ assert.ok(barriers.length >= 1, "the thinking_end barrier flush must be diagnosed");
143
+ }
144
+
145
+ // 5) Mixed semantic burst: cross-kind order is preserved exactly.
146
+ {
147
+ const run = harness();
148
+ run.dispatchAll(mixedSemanticBurstEvents());
149
+ run.frames.runAll();
150
+ run.controller.flush();
151
+ assert.deepEqual(run.applied.order, [
152
+ "thinking:thinking_start",
153
+ "thinking:thinking_delta",
154
+ "thinking:thinking_end",
155
+ "text:text_start",
156
+ "text:text_delta",
157
+ "tool-call:toolcall_start",
158
+ "tool-call:toolcall_delta",
159
+ "tool-call:toolcall_end",
160
+ "tool-execution",
161
+ "text:text_delta",
162
+ "stream-error",
163
+ "text:text_end",
164
+ ], "semantic order must match server order with only adjacent same-kind coalescing");
165
+ assert.equal(run.applied.thinking, "planning steps");
166
+ assert.equal(run.applied.text, "Running the command now. Done.");
167
+ assert.equal(run.applied.toolCall, '{"cmd":"ls"}');
168
+ assert.deepEqual(run.applied.toolExecution, ["file-a\nfile-b\n"], "superseding partial tool results must coalesce to the latest");
169
+ assert.equal(run.applied.errors, 1);
170
+ }
171
+
172
+ // 6) Overflow burst: alternating kinds defeat coalescing, hit the entry limit, stay ordered.
173
+ {
174
+ const run = harness();
175
+ const events = overflowBurstEvents({ pairs: 200 });
176
+ run.dispatchAll(events);
177
+ run.frames.runAll();
178
+ run.controller.flush();
179
+ assert.equal(run.applied.text, concatenatedDeltaText(events, "text_delta"));
180
+ assert.equal(run.applied.thinking, concatenatedDeltaText(events, "thinking_delta"));
181
+ const entryOverflows = run.records.filter((record) => record.type === "overflow" && record.reason === "entry-limit");
182
+ assert.ok(entryOverflows.length > 0, "400 non-coalescible events must hit the 128-entry limit");
183
+ for (const record of run.records.filter((entry) => entry.type === "queued")) {
184
+ assert.ok(record.pendingCount <= DEFAULT_STREAM_PENDING_ENTRY_LIMIT);
185
+ }
186
+ // Alternation must be preserved within each flushed window: text i before thinking i.
187
+ const textIndex = run.applied.order.filter((kind) => kind.startsWith("text") || kind.startsWith("thinking"));
188
+ assert.equal(textIndex[0], "text:text_delta", "first applied event must be the first dispatched kind");
189
+ }
190
+
191
+ // 7) Batch latency and drain duration are measured with the injected clock.
192
+ {
193
+ const run = harness({ nowStepMs: 5 });
194
+ run.controller.dispatch(messageUpdateEvent("text_delta", "a"));
195
+ run.controller.dispatch(messageUpdateEvent("text_delta", "b"));
196
+ run.frames.runAll();
197
+ const batch = run.records.find((record) => record.type === "batch");
198
+ assert.ok(batch, "a batch record must exist");
199
+ assert.equal(typeof batch.maxAgeMs, "number", "batch latency must be reported");
200
+ assert.equal(typeof batch.drainMs, "number", "drain duration must be reported");
201
+ assert.ok(batch.maxAgeMs > 0, "coalesced batches must report the oldest entry's age");
202
+ assert.ok(batch.drainMs > 0, "drain duration must be measured across application");
203
+ }
204
+
205
+ // 8) Coalesced entries keep the oldest receipt time so latency is not hidden by merging.
206
+ {
207
+ const run = harness({ nowStepMs: 10 });
208
+ run.controller.dispatch(messageUpdateEvent("text_delta", "first"));
209
+ run.controller.dispatch(messageUpdateEvent("text_delta", "second"));
210
+ run.controller.dispatch(messageUpdateEvent("text_delta", "third"));
211
+ run.frames.runAll();
212
+ const batch = run.records.find((record) => record.type === "batch");
213
+ // Clock: dispatch receipts at 10, 20, 30; drain start at 40 → oldest age 30.
214
+ assert.equal(batch.maxAgeMs, 30, "merged entry must retain the first source's receipt time");
215
+ }
216
+
217
+ // 9) Disabled diagnostics never touch the clock: the hot path is measurement-free.
218
+ {
219
+ const run = harness({ diagnostics: false });
220
+ run.dispatchAll(smallTextDeltaEvents(100));
221
+ run.frames.runAll();
222
+ run.controller.flush();
223
+ assert.equal(run.nowCallCount(), 0, "the disabled hot path must never call now()");
224
+ assert.equal(run.applied.text, concatenatedDeltaText(smallTextDeltaEvents(100)));
225
+ }
226
+
227
+ // 10) Oversize direct application also reports latency fields.
228
+ {
229
+ const run = harness({ nowStepMs: 2 });
230
+ const oversize = messageUpdateEvent("text_delta", "x".repeat(DEFAULT_STREAM_PENDING_BYTE_LIMIT));
231
+ run.controller.dispatch(oversize);
232
+ const direct = run.records.find((record) => record.type === "batch" && record.direct === true);
233
+ assert.ok(direct, "an oversize event must be applied directly");
234
+ assert.equal(typeof direct.maxAgeMs, "number");
235
+ assert.equal(typeof direct.drainMs, "number");
236
+ assert.equal(run.applied.text.length, DEFAULT_STREAM_PENDING_BYTE_LIMIT, "oversize events are applied, never dropped");
237
+ }
238
+
239
+ console.log("stream-output-workloads tests passed");
@@ -28,7 +28,7 @@ assert.match(app, /const SUBAGENT_ASYNC_WIDGET_KEY = "subagent-async"[\s\S]*case
28
28
  assert.match(app, /for \(const \[key, value\] of widgets\)[\s\S]*if \(key === SUBAGENT_ASYNC_WIDGET_KEY\) continue;/, "stale cached async-status widgets should remain hidden defensively");
29
29
  assert.match(css, /\.subagent-source-badge[\s\S]*text-overflow: ellipsis[\s\S]*@media \(max-width: 720px\)/, "source badges should remain compact and responsive");
30
30
  assert.match(html, /Managed and registered Pi agent runs[\s\S]*External agents/, "help should explain managed, registered, and external groups");
31
- assert.match(html, /styles\.css\?v=126[\s\S]*app\.js\?v=148/, "browser assets should use the current subagent-observability revisions");
32
- assert.match(worker, /pi-webui-pwa-v112/, "PWA cache identity should advance with subagent widget suppression");
31
+ assert.match(html, /styles\.css\?v=129[\s\S]*app\.js\?v=150/, "browser assets should use the current subagent-observability revisions");
32
+ assert.match(worker, /pi-webui-pwa-v115/, "PWA cache identity should advance with subagent widget suppression");
33
33
 
34
34
  console.log("subagent-observability-static.test.mjs passed");
@@ -60,9 +60,9 @@ assert.match(css, /\.markdown-code \.syntax-comment \{[^}]*font-style: italic;/,
60
60
 
61
61
  // --- Offline/PWA startup closure and coherent revisions ---
62
62
  assert.match(serviceWorker, /"\/syntax-highlight\.mjs",/, "the eagerly imported tokenizer must be part of the offline app shell");
63
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "adding a startup module should advance the PWA cache identity");
64
- assert.match(html, /styles\.css\?v=126/, "new token styles should advance the stylesheet revision");
65
- assert.match(html, /data-app-src="\/app\.js\?v=148"/, "new renderer wiring should advance the app module revision");
63
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "adding a startup module should advance the PWA cache identity");
64
+ assert.match(html, /styles\.css\?v=129/, "new token styles should advance the stylesheet revision");
65
+ assert.match(html, /data-app-src="\/app\.js\?v=150"/, "new renderer wiring should advance the app module revision");
66
66
  assert.match(pkg, /node --check public\/syntax-highlight\.mjs/, "the package check should syntax-check the startup-critical tokenizer");
67
67
 
68
68
  const appShell = serviceWorker.slice(serviceWorker.indexOf("const APP_SHELL"), serviceWorker.indexOf("];", serviceWorker.indexOf("const APP_SHELL")));
@@ -34,7 +34,7 @@ assert.match(html, /role="alert" hidden>[\s\S]*Replace this exact target\?/, "ov
34
34
 
35
35
  assert.match(app, /from "\.\/theme-contract\.mjs"/, "frontend should consume the shared browser-safe theme contract");
36
36
  assert.match(serviceWorker, /"\/theme-contract\.mjs"/, "the PWA app shell should cache the startup-critical theme contract");
37
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v112"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
37
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v115"/, "adding the theme contract to the startup graph should advance the PWA cache identity");
38
38
  assert.match(pkg, /node --check public\/theme-contract\.mjs/, "the package check should syntax-check the startup-critical theme contract");
39
39
  assert.match(app, /function themeDraftFromCatalog\(theme, name = theme\?\.name\)[\s\S]*colors: cloneThemeDraft\(theme\?\.colors \|\| \{\}\)/, "catalog metadata should be projected into a schema-only editable draft");
40
40
  assert.match(app, /for \(const \{ name, label \} of group\.tokens\)/, "visual controls should render from the exact shared token inventory");
@@ -1,6 +1,7 @@
1
1
  import assert from "node:assert/strict";
2
2
  import {
3
3
  UI_LAYOUT_LIMITS,
4
+ UI_LAYOUT_VERSION,
4
5
  defaultUiLayout,
5
6
  mergeUiLayout,
6
7
  normalizeUiLayout,
@@ -10,6 +11,8 @@ import {
10
11
 
11
12
  const defaults = defaultUiLayout();
12
13
  assert.deepEqual(normalizeUiLayout(undefined), defaults);
14
+ assert.equal(UI_LAYOUT_VERSION, 3);
15
+ assert.deepEqual(defaults.controlVisibility, { hiddenIds: null });
13
16
  assert.deepEqual(normalizeUiLayout({ version: 99, sidePanel: { placement: "both" } }), defaults, "unknown layout versions must fail soft to nullable defaults");
14
17
 
15
18
  const completeV1 = {
@@ -33,7 +36,7 @@ const completeV1 = {
33
36
  fileViewerWidth: 560.4,
34
37
  };
35
38
  const migrated = normalizeUiLayout(completeV1, { legacySidePanelWidth: 612.4 });
36
- assert.equal(migrated.version, 2);
39
+ assert.equal(migrated.version, 3);
37
40
  assert.equal(migrated.sidePanel.placement, "right", "v1 layouts must migrate to the existing right-side presentation");
38
41
  assert.deepEqual(migrated.sidePanel.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: [] });
39
42
  assert.deepEqual(migrated.sidePanel.collapsedSectionIds, ["git"]);
@@ -44,6 +47,7 @@ assert.deepEqual(migrated.composerActions, completeV1.composerActions, "composer
44
47
  assert.deepEqual(migrated.footerScopedModelOrder, completeV1.footerScopedModelOrder);
45
48
  assert.deepEqual(migrated.terminalTabs, { ...completeV1.terminalTabs, sidebarWidth: 285 }, "terminal placement, custom groups, and normalized sidebar width must survive migration");
46
49
  assert.equal(migrated.fileViewerWidth, 560);
50
+ assert.deepEqual(migrated.controlVisibility, { hiddenIds: null }, "v1 layouts must migrate to default control visibility");
47
51
 
48
52
  const malformedV1 = normalizeUiLayout({
49
53
  ...completeV1,
@@ -68,7 +72,7 @@ assert.equal(malformedV1.terminalTabs.layout, null);
68
72
  assert.deepEqual(malformedV1.terminalTabs.customGroups, completeV1.terminalTabs.customGroups);
69
73
  assert.equal(malformedV1.fileViewerWidth, null);
70
74
 
71
- const valid = normalizeUiLayout({
75
+ const completeV2 = {
72
76
  version: 2,
73
77
  sidePanel: {
74
78
  placement: "both",
@@ -82,6 +86,20 @@ const valid = normalizeUiLayout({
82
86
  footerScopedModelOrder: completeV1.footerScopedModelOrder,
83
87
  terminalTabs: completeV1.terminalTabs,
84
88
  fileViewerWidth: 560,
89
+ };
90
+ const migratedV2 = normalizeUiLayout(completeV2);
91
+ assert.equal(migratedV2.version, 3);
92
+ assert.deepEqual(migratedV2.controlVisibility, { hiddenIds: null }, "v2 layouts must gain default control visibility");
93
+ assert.deepEqual(migratedV2.sidePanel.sectionLayout, completeV2.sidePanel.sectionLayout, "v2 side-panel state must survive migration");
94
+ assert.deepEqual(migratedV2.composerActions, completeV2.composerActions, "v2 composer state must survive migration");
95
+ assert.deepEqual(migratedV2.footerScopedModelOrder, completeV2.footerScopedModelOrder);
96
+ assert.deepEqual(migratedV2.terminalTabs, { ...completeV2.terminalTabs, sidebarWidth: 285 });
97
+ assert.equal(migratedV2.fileViewerWidth, completeV2.fileViewerWidth);
98
+
99
+ const valid = normalizeUiLayout({
100
+ ...completeV2,
101
+ version: 3,
102
+ controlVisibility: { hiddenIds: ["tag.future-kind", "composer.new", "control-deck.sponsor"] },
85
103
  });
86
104
  assert.equal(valid.sidePanel.placement, "both");
87
105
  assert.deepEqual(valid.sidePanel.sectionLayout.leftSectionIds, ["files", "future-section"], "unknown historical section ids may be retained");
@@ -89,6 +107,11 @@ assert.deepEqual(valid.sidePanel.panelWidths, { left: 420, right: 641 });
89
107
  assert.equal(valid.fileViewerWidth, 560);
90
108
  assert.equal(valid.terminalTabs.layout, "left");
91
109
  assert.equal(valid.terminalTabs.sidebarWidth, 285);
110
+ assert.deepEqual(
111
+ valid.controlVisibility.hiddenIds,
112
+ ["composer.new", "control-deck.sponsor", "tag.future-kind"],
113
+ "visibility ids must normalize deterministically while retaining unknown well-formed future ids",
114
+ );
92
115
 
93
116
  const partiallyMalformed = normalizeUiLayout({
94
117
  ...valid,
@@ -105,15 +128,24 @@ assert.deepEqual(partiallyMalformed.sidePanel.sectionLayout, defaults.sidePanel.
105
128
  assert.deepEqual(partiallyMalformed.sidePanel.collapsedPanels, { left: null, right: true }, "malformed side values must not erase valid siblings on disk");
106
129
  assert.deepEqual(partiallyMalformed.sidePanel.panelWidths, { left: null, right: 700 });
107
130
  assert.deepEqual(partiallyMalformed.composerActions, valid.composerActions, "unrelated valid envelope fields must survive malformed side-panel fields");
131
+ assert.deepEqual(partiallyMalformed.controlVisibility, valid.controlVisibility, "unrelated visibility state must survive malformed side-panel fields");
132
+
133
+ const malformedVisibility = normalizeUiLayout({
134
+ ...valid,
135
+ controlVisibility: { hiddenIds: ["composer.new", "composer.new"] },
136
+ });
137
+ assert.deepEqual(malformedVisibility.controlVisibility, defaults.controlVisibility, "malformed persisted visibility must fail soft without affecting sibling fields");
138
+ assert.deepEqual(malformedVisibility.sidePanel, valid.sidePanel);
108
139
 
109
140
  const merged = mergeUiLayout(valid, {
110
- version: 2,
141
+ version: 3,
111
142
  sidePanel: {
112
143
  placement: "left",
113
144
  collapsedPanels: { right: true },
114
145
  panelWidths: { left: 500.2 },
115
146
  hiddenSectionIds: null,
116
147
  },
148
+ controlVisibility: { hiddenIds: [] },
117
149
  footerScopedModelOrder: [],
118
150
  fileViewerWidth: null,
119
151
  });
@@ -122,6 +154,7 @@ assert.deepEqual(merged.sidePanel.sectionLayout, valid.sidePanel.sectionLayout,
122
154
  assert.deepEqual(merged.sidePanel.collapsedPanels, { left: true, right: true }, "side-specific partial state must preserve its sibling");
123
155
  assert.deepEqual(merged.sidePanel.panelWidths, { left: 500, right: 641 });
124
156
  assert.equal(merged.sidePanel.hiddenSectionIds, null, "explicit null must clear only the named field");
157
+ assert.deepEqual(merged.controlVisibility, { hiddenIds: [] }, "an explicit empty visibility list must preserve show-all state");
125
158
  assert.deepEqual(merged.footerScopedModelOrder, [], "explicit empty arrays are valid resets");
126
159
  assert.equal(merged.fileViewerWidth, null);
127
160
 
@@ -131,10 +164,14 @@ const composerReset = mergeUiLayout(valid, { composerActions: { order: [], grid:
131
164
  assert.deepEqual(composerReset.composerActions, { order: [], grid: null });
132
165
  const terminalReset = mergeUiLayout(valid, { terminalTabs: null });
133
166
  assert.deepEqual(terminalReset.terminalTabs, defaults.terminalTabs);
167
+ const visibilityReset = mergeUiLayout(valid, { controlVisibility: { hiddenIds: null } });
168
+ assert.deepEqual(visibilityReset.controlVisibility, { hiddenIds: null }, "null hiddenIds must restore defaults/no explicit preference");
169
+ const visibilityObjectReset = mergeUiLayout(valid, { controlVisibility: null });
170
+ assert.deepEqual(visibilityObjectReset.controlVisibility, defaults.controlVisibility);
134
171
 
135
172
  assert.throws(() => validateUiLayoutPatch({}), /at least one mutable field/);
136
173
  assert.throws(() => validateUiLayoutPatch({ unknown: true }), /unsupported field/);
137
- assert.throws(() => validateUiLayoutPatch({ version: 1, fileViewerWidth: 500 }), /version must be 2/, "stale v1 writes must be rejected");
174
+ assert.throws(() => validateUiLayoutPatch({ version: 2, fileViewerWidth: 500 }), /version must be 3/, "stale v2 writes must be rejected");
138
175
  assert.throws(() => validateUiLayoutPatch({ composerActions: { order: ["send"] } }), /order and grid together/);
139
176
  assert.throws(() => validateUiLayoutPatch({ sidePanel: { sectionOrder: ["files"] } }), /unsupported field: sectionOrder/);
140
177
  assert.throws(() => validateUiLayoutPatch({ sidePanel: { collapsed: true } }), /unsupported field: collapsed/);
@@ -148,6 +185,11 @@ assert.throws(() => validateUiLayoutPatch({ sidePanel: { panelWidths: { left: UI
148
185
  assert.throws(() => validateUiLayoutPatch({ sidePanel: { panelWidths: { right: UI_LAYOUT_LIMITS.panelWidthMax + 1 } } }), /must be between/);
149
186
  assert.throws(() => validateUiLayoutPatch({ fileViewerWidth: UI_LAYOUT_LIMITS.fileViewerWidthMin - 1 }), /must be between/);
150
187
  assert.throws(() => validateUiLayoutPatch({ terminalTabs: { sidebarWidth: UI_LAYOUT_LIMITS.terminalTabsSidebarWidthMin - 1 } }), /must be between/);
188
+ assert.throws(() => validateUiLayoutPatch({ controlVisibility: {} }), /must include hiddenIds/);
189
+ assert.throws(() => validateUiLayoutPatch({ controlVisibility: { hiddenIds: "composer.new" } }), /must be an array/);
190
+ assert.throws(() => validateUiLayoutPatch({ controlVisibility: { hiddenIds: ["composer.new", "composer.new"] } }), /duplicate/);
191
+ assert.throws(() => validateUiLayoutPatch({ controlVisibility: { hiddenIds: [" composer.new"] } }), /trimmed string/);
192
+ assert.throws(() => validateUiLayoutPatch({ controlVisibility: { hiddenIds: Array.from({ length: UI_LAYOUT_LIMITS.listItems + 1 }, (_, index) => `future.item-${index}`) } }), /at most/);
151
193
  assert.throws(() => validateUiLayoutPatch({ footerScopedModelOrder: Array(UI_LAYOUT_LIMITS.listItems + 1).fill("model") }), /at most/);
152
194
  assert.throws(() => validateUiLayoutPatch({
153
195
  composerActions: { order: ["a", "b"], grid: { version: 2, columns: 2, positions: { a: 0, b: 0 } } },
@@ -165,13 +207,18 @@ assert.throws(() => validateUiLayoutPatch({
165
207
  }), /only one group/);
166
208
 
167
209
  assert.match(uiLayoutRevision(defaults), /^[a-f0-9]{64}$/);
168
- assert.equal(uiLayoutRevision(defaults), uiLayoutRevision(normalizeUiLayout({ version: 2 })), "equivalent normalized layouts need stable revisions");
210
+ assert.equal(uiLayoutRevision(defaults), uiLayoutRevision(normalizeUiLayout({ version: 3 })), "equivalent normalized layouts need stable revisions");
169
211
  assert.equal(
170
212
  uiLayoutRevision(completeV1),
171
213
  uiLayoutRevision(normalizeUiLayout(completeV1)),
172
- "a migrated v1 envelope and its canonical v2 representation need the same revision",
214
+ "a migrated v1 envelope and its canonical v3 representation need the same revision",
215
+ );
216
+ assert.equal(
217
+ uiLayoutRevision({ ...valid, controlVisibility: { hiddenIds: ["tag.future-kind", "control-deck.sponsor", "composer.new"] } }),
218
+ uiLayoutRevision(valid),
219
+ "equivalent hidden sets must have a stable revision independent of input order",
173
220
  );
174
- assert.notEqual(uiLayoutRevision(valid), uiLayoutRevision(merged), "placement, collapse, and width changes must change the revision");
221
+ assert.notEqual(uiLayoutRevision(valid), uiLayoutRevision(merged), "layout and visibility changes must change the revision");
175
222
  assert.notEqual(
176
223
  uiLayoutRevision(valid),
177
224
  uiLayoutRevision(mergeUiLayout(valid, { sidePanel: { sectionLayout: { order: ["controls", "files", "git", "future-section"], leftSectionIds: ["files"] } } })),
@@ -119,7 +119,7 @@ try {
119
119
  assert.equal(queued.interfacePreferences.sidePanelWidth, 611);
120
120
  assert.equal(queued.gitWorkflow.deliveryMode, "current");
121
121
 
122
- const futureLayout = { version: 3, futureSurface: { order: ["keep-this"] } };
122
+ const futureLayout = { version: 4, futureSurface: { order: ["keep-this"] } };
123
123
  const futureSettings = JSON.parse(await readFile(settingsFile, "utf8"));
124
124
  futureSettings.uiLayout = futureLayout;
125
125
  await writeFile(settingsFile, `${JSON.stringify(futureSettings, null, 2)}\n`, "utf8");
@@ -131,7 +131,7 @@ try {
131
131
  await writeWebuiSettings({
132
132
  interfacePreferences: { sidePanelWidth: 612 },
133
133
  uiLayout: {
134
- version: 2,
134
+ version: 3,
135
135
  sidePanel: {
136
136
  placement: "right",
137
137
  sectionLayout: { order: ["files", "controls", "git"], leftSectionIds: [] },
@@ -154,7 +154,7 @@ try {
154
154
  }), atomicWidthFile);
155
155
  const atomicWidth = JSON.parse(await readFile(atomicWidthFile, "utf8"));
156
156
  assert.equal(atomicWidth.interfacePreferences.sidePanelWidth, 700);
157
- assert.equal(atomicWidth.uiLayout.sidePanel.panelWidths.right, 700, "one locked settings update must atomically persist the v2 right width and legacy mirror");
157
+ assert.equal(atomicWidth.uiLayout.sidePanel.panelWidths.right, 700, "one locked settings update must atomically persist the v3 right width and legacy mirror");
158
158
  assert.equal(atomicWidth.uiLayout.sidePanel.panelWidths.left, 384);
159
159
 
160
160
  const liveLockTarget = path.join(root, "live-lock", "settings.json");