@firstpick/pi-package-webui 0.9.1 → 0.9.2
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 +21 -5
- package/bin/pi-webui-launcher.mjs +23 -12
- package/bin/pi-webui.mjs +479 -60
- package/lib/agent-run-adapters.mjs +500 -0
- package/lib/agent-run-protocol.mjs +262 -0
- package/lib/agent-run-registry.mjs +339 -0
- package/lib/git-workflow-preferences.mjs +11 -4
- package/lib/trust-boundaries.mjs +2 -0
- package/lib/ui-layout-settings.mjs +172 -28
- package/lib/update/package-layout.mjs +50 -0
- package/lib/update/plan.mjs +11 -0
- package/package.json +1 -1
- package/public/app.js +1261 -314
- package/public/index.html +113 -68
- package/public/service-worker.js +1 -1
- package/public/styles.css +371 -93
- package/tests/agent-run-adapters.test.mjs +217 -0
- package/tests/agent-run-launcher.test.mjs +41 -0
- package/tests/agent-run-protocol.test.mjs +82 -0
- package/tests/agent-run-registry.test.mjs +102 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/control-deck-side-panels.spec.mjs +354 -0
- package/tests/browser/controls-layout.spec.mjs +122 -0
- package/tests/browser/file-tree-git-ignored.spec.mjs +113 -0
- package/tests/browser/interaction-continuity.spec.mjs +127 -0
- package/tests/browser/mobile-foundation.spec.mjs +26 -0
- package/tests/browser/model-search-focus.spec.mjs +96 -0
- package/tests/browser/optimistic-prompt.spec.mjs +22 -0
- package/tests/browser/persistent-ui-layout.spec.mjs +224 -66
- package/tests/browser/subagent-observability.spec.mjs +87 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/component-update-api-static.test.mjs +2 -1
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-deck-component-updates-static.test.mjs +2 -0
- package/tests/control-deck-side-panels-static.test.mjs +68 -0
- package/tests/controls-layout-static.test.mjs +22 -0
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-tree-git-ignored-static.test.mjs +152 -0
- package/tests/file-tree-search-layout-static.test.mjs +2 -1
- package/tests/fixtures/fake-pi.mjs +43 -7
- package/tests/git-workflow-preferences.test.mjs +55 -6
- package/tests/http-endpoints-harness.test.mjs +173 -14
- 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 +13 -3
- package/tests/open-issue-wizard-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +13 -13
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/remote-auth-settings-harness.test.mjs +1 -1
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-context-menu-static.test.mjs +1 -1
- package/tests/side-panel-resize-static.test.mjs +26 -16
- package/tests/side-panel-section-height-removal-static.test.mjs +4 -4
- package/tests/side-panel-section-reorder-static.test.mjs +16 -70
- package/tests/subagent-gate-visibility.test.mjs +2 -1
- package/tests/subagent-launch-slots.test.mjs +1 -1
- package/tests/subagent-observability-static.test.mjs +32 -0
- package/tests/subagent-reliability-integration.test.mjs +161 -0
- package/tests/subagents-helper.test.mjs +344 -4
- package/tests/terminal-tabs-resize-static.test.mjs +35 -0
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/ui-layout-settings.test.mjs +104 -32
- package/tests/update-api-harness.test.mjs +24 -10
- package/tests/update-package-layout.test.mjs +38 -0
- package/tests/update-plan.test.mjs +11 -1
- package/tests/webui-settings-locking.test.mjs +33 -3
- package/webui-rpc-helper.mjs +417 -28
|
@@ -54,7 +54,7 @@ assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFas
|
|
|
54
54
|
assert.match(readme, /### Compact live output mode[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "README should document Compact mode with the stable wire identifier");
|
|
55
55
|
assert.match(readme, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "README should separately document subscription Fast mode and its cost semantics");
|
|
56
56
|
// Intent preserved: browser-asset changes must advance the coherent cache tuple.
|
|
57
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
58
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
57
|
+
assert.match(serviceWorker, /pi-webui-pwa-v94/, "PWA cache identity should be bumped for changed browser assets");
|
|
58
|
+
assert.match(html, /data-app-src="\/app\.js\?v=132"/, "browser module URL should be cache-busted for Fast-mode wiring");
|
|
59
59
|
|
|
60
60
|
console.log("codex-fast-mode-static.test.mjs passed");
|
|
@@ -15,7 +15,8 @@ assert.match(state, /validateUpdatePlanRequest[\s\S]*targets must contain one or
|
|
|
15
15
|
assert.match(state, /validateUpdateApplyRequest[\s\S]*Apply accepts only transactionId and planDigest/);
|
|
16
16
|
assert.match(server, /url\.pathname === "\/api\/update\/plan"[\s\S]*requireLocalhostRoute[\s\S]*validateUpdatePlanRequest[\s\S]*sendJson\(res, 201/);
|
|
17
17
|
assert.match(server, /url\.pathname === "\/api\/update\/apply"[\s\S]*requireLocalhostRoute[\s\S]*validateUpdateApplyRequest[\s\S]*applyServerOwnedUpdate/);
|
|
18
|
-
assert.match(server, /
|
|
18
|
+
assert.match(server, /assertActionableUpdatePlan\(plan\)[\s\S]*createUpdateJournal\(agentDir, plan\)/);
|
|
19
|
+
assert.match(server, /assertUpdatePlanDigest\(journal\.plan, planDigest\)[\s\S]*assertActionableUpdatePlan\(journal\.plan\)[\s\S]*acquireInstallLock\(agentDir\)/);
|
|
19
20
|
assert.match(server, /assertPlanIdentity\(target, active\)/);
|
|
20
21
|
assert.match(server, /probeCandidateRuntime\(serverEntry, \{ expectedVersion: target\.metadata\.webuiVersion, expectedPiVersion: target\.metadata\.piVersion \}\)/);
|
|
21
22
|
assert.match(server, /Legacy update mutation is disabled/);
|
|
@@ -56,8 +56,8 @@ assert.match(app, /function initializeComposerActionOrdering\(\)[\s\S]*MutationO
|
|
|
56
56
|
assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreComposerActionOrder\(\)[\s\S]*event\.key === COMPOSER_ACTION_LAYOUT_STORAGE_KEY\) restoreComposerActionSlotLayout\(\)/, "other tabs should apply persisted composer order and sparse-layout changes");
|
|
57
57
|
assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
|
|
58
58
|
|
|
59
|
-
assert.match(html, /styles\.css\?v=
|
|
60
|
-
assert.match(html, /app\.js\?v=
|
|
61
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
59
|
+
assert.match(html, /styles\.css\?v=115/, "changed composer styles should advance the stylesheet revision");
|
|
60
|
+
assert.match(html, /app\.js\?v=132/, "changed composer behavior should advance the app revision");
|
|
61
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v94"/, "changed browser assets should advance the PWA cache identity");
|
|
62
62
|
|
|
63
63
|
console.log("composer-action-grid-reorder-static.test.mjs passed");
|
|
@@ -18,6 +18,8 @@ assert.match(app, /api\("\/api\/update\/plan", \{ method: "POST", body: \{ targe
|
|
|
18
18
|
assert.match(app, /Exact plan digest: \$\{plan\.digest\}/);
|
|
19
19
|
assert.match(app, /api\("\/api\/update\/apply", \{ method: "POST", body: \{ transactionId: plan\.transactionId, planDigest: plan\.digest \}/);
|
|
20
20
|
assert.match(app, /function piUpdateConfirmationText\(\{ all = false, plan = null \} = \{\}\)[\s\S]*Exact immutable plan digest/);
|
|
21
|
+
assert.match(app, /const planTargets = Array\.isArray\(plan\?\.targets\)[\s\S]*planTargets\.length === 0[\s\S]*No update targets were accepted/);
|
|
22
|
+
assert.match(app, /applyData\?\.state !== "activating"[\s\S]*completed without a Web UI restart[\s\S]*did not complete; no Web UI restart was requested/);
|
|
21
23
|
assert.match(app, /will not re-resolve latest or scan package roots/);
|
|
22
24
|
assert.match(app, /function separatePathPiPlanNotice\(plan\)[\s\S]*PATH Pi[\s\S]*separate installation[\s\S]*will remain untouched/);
|
|
23
25
|
assert.match(app, /async function waitForServerRestart\(previousBootIdentity = serverBootIdentity\)[\s\S]*Date\.now\(\) \+ 90_000[\s\S]*health\.bootIdentity === previousBootIdentity/);
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const [html, app, css] = await Promise.all([
|
|
8
|
+
readFile(join(root, "public", "index.html"), "utf8"),
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
const ids = [...html.matchAll(/\bid="([^"]+)"/g)].map(([, id]) => id);
|
|
14
|
+
assert.equal(ids.length, new Set(ids).size, "the static DOM must not duplicate IDs");
|
|
15
|
+
assert.match(html, /id="sidePanelLeft"[^>]*aria-label="Left Control Deck"/);
|
|
16
|
+
assert.match(html, /id="sidePanel"[^>]*aria-label="Right Control Deck"/);
|
|
17
|
+
assert.match(html, /id="sidePanelBodyLeft"[^>]*data-control-deck-body="left"/);
|
|
18
|
+
assert.match(html, /id="sidePanelBodyRight"[^>]*data-control-deck-body="right"/);
|
|
19
|
+
assert.match(html, /data-control-deck-drop-target="left"/);
|
|
20
|
+
assert.match(html, /data-control-deck-drop-target="right"/);
|
|
21
|
+
assert.match(html, /id="controlDeckMovementAnnouncer"[^>]*aria-live="polite"/);
|
|
22
|
+
assert.match(html, /<div class="workspace-column">[\s\S]*<section class="chat-panel">[\s\S]*<\/div>\s*<button id="sidePanelBackdrop"/);
|
|
23
|
+
assert.match(html, /<option value="left">Sidebar<\/option>/);
|
|
24
|
+
assert.match(html, /id="controlDeckPlacementSelect"[\s\S]*<option value="right">Right<\/option>[\s\S]*<option value="left">Left<\/option>[\s\S]*<option value="both">Both<\/option>/);
|
|
25
|
+
|
|
26
|
+
assert.match(app, /const UI_LAYOUT_SCHEMA_VERSION = 2;/);
|
|
27
|
+
assert.match(app, /const UI_LAYOUT_SIDE_PANEL_FIELDS = \["placement", "sectionLayout", "collapsedSectionIds", "hiddenSectionIds", "collapsedPanels", "panelWidths"\]/);
|
|
28
|
+
assert.match(app, /const CONTROL_DECK_LAYOUT_STORAGE_KEY = "pi-webui-control-deck-layout-v2"/);
|
|
29
|
+
assert.match(app, /function controlDeckSectionRecords\(\)[\s\S]*document\.querySelectorAll\("\[data-side-panel-section\]"\)/);
|
|
30
|
+
assert.match(app, /function reconcileControlDeckHosts\(\)[\s\S]*effectiveControlDeckPresentation\(\)[\s\S]*body\.append\(record\.section\)/);
|
|
31
|
+
assert.match(app, /function isControlDeckOverlayPresentation\(\)[\s\S]*sidePanelOverlayMedia\?\.matches[\s\S]*minimum/);
|
|
32
|
+
assert.match(app, /function effectiveControlDeckPresentation\(\)[\s\S]*"overlay"[\s\S]*normalizeControlDeckPlacement\(controlDeckLayout\.placement\)/);
|
|
33
|
+
assert.match(app, /function reconcileControlDeckPlacementConstraint\(\)[\s\S]*querySelector\('option\[value="both"\]'\)[\s\S]*bothOption\.disabled = sidebarPresentation[\s\S]*placement !== "both"[\s\S]*controlDeckLayout\.placement = "right"[\s\S]*cacheControlDeckLayout\(controlDeckLayout, "placement"\)[\s\S]*markDurableUiLayoutDirty\("sidePanel", "placement"\)/, "Sidebar tabs should disable Both and durably reconcile an active Both placement to Right");
|
|
34
|
+
assert.match(app, /function reconcileControlDeckHosts\(\)[\s\S]*const placement = reconcileControlDeckPlacementConstraint\(\)[\s\S]*controlDeckPlacementSelect\.value = placement/, "placement constraints should be reconciled before the Control Deck hosts and select are rendered");
|
|
35
|
+
assert.match(app, /classList\.toggle\("terminal-tabs-sidebar-start", sidebarPresentation && placement === "right"\)/);
|
|
36
|
+
assert.match(app, /function moveSidePanelSectionToSide\(sectionId, side\)/);
|
|
37
|
+
assert.match(app, /\["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"\]/);
|
|
38
|
+
assert.match(app, /markDurableUiLayoutDirty\("sidePanel", "sectionLayout"\)/);
|
|
39
|
+
assert.match(app, /markDurableUiLayoutDirty\("sidePanel", "placement"\)/);
|
|
40
|
+
assert.match(app, /markDurableUiLayoutDirty\("sidePanel", "panelWidths"\)/);
|
|
41
|
+
assert.match(app, /const mixedWidth = patch\.sidePanel\?\.panelWidths\?\.right[\s\S]*sidePanelWidth: mixedWidth/);
|
|
42
|
+
assert.match(app, /value\.field === "sidePanel" && subfield === "sectionOrder"[\s\S]*subfield = "sectionLayout"/);
|
|
43
|
+
assert.match(app, /const UI_LAYOUT_PENDING_STORAGE_PREFIX = "pi-webui-ui-layout-pending-v4:"/);
|
|
44
|
+
assert.match(app, /const UI_LAYOUT_LEGACY_PENDING_STORAGE_PREFIX = "pi-webui-ui-layout-pending-v3:"/);
|
|
45
|
+
assert.match(app, /value\.field === "sidePanel" && subfield === "collapsed"[\s\S]*subfield = "collapsedPanels"/);
|
|
46
|
+
assert.match(app, /subfield === "collapsedSectionIds"[\s\S]*durableLayoutIdList\(value\.value\)/);
|
|
47
|
+
assert.match(app, /subfield === "hiddenSectionIds"[\s\S]*durableLayoutIdList\(value\.value\)/);
|
|
48
|
+
assert.match(app, /function cacheControlDeckLayout\(next = controlDeckLayout, subfield = null\)[\s\S]*readStoredControlDeckLayout\(\)[\s\S]*\[subfield\]: incoming\[subfield\]/);
|
|
49
|
+
assert.match(app, /activelyManipulated[\s\S]*subfield === "sectionLayout"[\s\S]*subfield === "panelWidths"/);
|
|
50
|
+
assert.match(app, /function controlDeckSideResizeAvailable\(side = "right"\)[\s\S]*presentation === "left"[\s\S]*presentation === "both"[\s\S]*presentation === "right"/);
|
|
51
|
+
assert.match(app, /function updateSidePanelResizeHandle\(width = currentSidePanelWidth\("right"\), side = "right"\)/);
|
|
52
|
+
assert.match(app, /function handleSidePanelResizeKeydown\(event\)[\s\S]*side === "left"/);
|
|
53
|
+
assert.match(css, /\.side-panel-resize-handle-right \{[\s\S]*left:\s*-1\.175rem/);
|
|
54
|
+
assert.match(css, /\.side-panel-resize-handle-left \{[\s\S]*right:\s*-1\.175rem;[\s\S]*left:\s*auto/);
|
|
55
|
+
assert.match(css, /--side-panel-left-width/);
|
|
56
|
+
assert.match(css, /--side-panel-right-width/);
|
|
57
|
+
assert.match(css, /body\.control-deck-both \.layout/);
|
|
58
|
+
assert.match(css, /side-panel-left-collapsed[\s\S]*side-panel-right-collapsed/);
|
|
59
|
+
assert.match(css, /body\.control-deck-overlay \.layout/);
|
|
60
|
+
assert.match(css, /body\.terminal-tabs-left \.chat-panel[\s\S]*grid-template-columns:\s*minmax\(0, 1fr\) minmax\(13rem, var\(--terminal-tabs-sidebar-width\)\)/);
|
|
61
|
+
assert.match(css, /body\.terminal-tabs-left \.terminal-tabs-shell[\s\S]*grid-column:\s*2/);
|
|
62
|
+
assert.match(css, /body\.terminal-tabs-left \.chat-search-bar[\s\S]*body\.terminal-tabs-left \.context-meter-bar[\s\S]*grid-column:\s*1/);
|
|
63
|
+
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.chat-panel[\s\S]*grid-template-columns:\s*minmax\(13rem, var\(--terminal-tabs-sidebar-width\)\) minmax\(0, 1fr\)/);
|
|
64
|
+
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.terminal-tabs-shell[\s\S]*grid-column:\s*1/);
|
|
65
|
+
assert.match(css, /body\.terminal-tabs-left\.terminal-tabs-sidebar-start \.chat[\s\S]*grid-column:\s*2/);
|
|
66
|
+
assert.match(css, /\.workspace-column[\s\S]*body\.terminal-split-open \.workspace-column[\s\S]*body\.file-viewer-open \.workspace-column[\s\S]*body\.terminal-split-open\.file-viewer-open \.workspace-column/);
|
|
67
|
+
|
|
68
|
+
console.log("control-deck-side-panels-static.test.mjs passed");
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFileSync } from "node:fs";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const html = readFileSync(join(root, "public/index.html"), "utf8");
|
|
8
|
+
const css = readFileSync(join(root, "public/styles.css"), "utf8");
|
|
9
|
+
const app = readFileSync(join(root, "public/app.js"), "utf8");
|
|
10
|
+
const serviceWorker = readFileSync(join(root, "public/service-worker.js"), "utf8");
|
|
11
|
+
|
|
12
|
+
assert.equal((html.match(/class="control-row(?:\s[^"]*)?"/g) || []).length, 14, "Controls should render one two-column row per setting, including optional remote-access settings");
|
|
13
|
+
assert.match(css, /\.control-row \{[\s\S]*grid-template-columns:\s*minmax\(6\.2rem, 0\.44fr\) minmax\(0, 1fr\)/, "Controls settings should use stable name and parameter columns");
|
|
14
|
+
assert.equal((html.match(/class="control-row-label"[^>]*data-tooltip=/g) || []).length, 14, "Every Controls setting name should provide user-friendly help");
|
|
15
|
+
assert.match(app, /function initializeControlSettingTooltips\(\)[\s\S]*#sidePanelSectionControls \.control-row-label\[data-tooltip\][\s\S]*bindStyledTooltipEvents\(label\)[\s\S]*showFooterTooltip\(label\)/, "Controls help should use the viewport-safe floating tooltip for hover and keyboard access");
|
|
16
|
+
assert.match(html, /class="control-row remote-auth-control-row" hidden[\s\S]*id="remoteAuthToggle"/, "optional PIN protection should retain its guarded visibility");
|
|
17
|
+
assert.match(app, /remoteAuthToggle\?\.closest\("\.remote-auth-control-row"\)[\s\S]*remoteAuthRow\.hidden = false/, "loading remote status should reveal the optional PIN protection setting");
|
|
18
|
+
assert.match(html, /styles\.css\?v=115/, "Controls stylesheet changes should advance the cache query");
|
|
19
|
+
assert.match(html, /app\.js\?v=132/, "Controls tooltip wiring should advance the app cache query");
|
|
20
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v94"/, "Controls browser assets should advance the PWA cache identity");
|
|
21
|
+
|
|
22
|
+
console.log("controls-layout-static.test.mjs passed");
|
|
@@ -156,7 +156,7 @@ assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA
|
|
|
156
156
|
assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
|
|
157
157
|
assert.match(html, /Lightweight browser rendering; Markdown final output; live thinking expanded; stored thinking grouped and collapsed/, "the sidebar should distinguish compact rendering from model inference");
|
|
158
158
|
// Intent preserved: the guarded PWA entry point must advance whenever app wiring changes.
|
|
159
|
-
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=
|
|
159
|
+
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=132"/, "the guarded PWA entry point should cache-bust browser wiring");
|
|
160
160
|
assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
|
|
161
161
|
|
|
162
162
|
const events = createFastModeOutputEvents();
|
|
@@ -166,7 +166,7 @@ assert.match(functionSource("closeTerminalTabs"), /clearFeatureDecisionStateForT
|
|
|
166
166
|
assert.match(app, /case "webui_connected":[\s\S]*clearFeatureDecisionStateForTab\(connectedTabId, \{ render: true \}\)[\s\S]*scheduleForegroundReconcile\("event stream reconnect", 0\)/, "reconnect should clear local state before authoritative replay");
|
|
167
167
|
assert.match(app, /statusKey === FEATURE_DECISION_OUTPUT_STATUS_KEY[\s\S]*handleFeatureDecisionOutputStatus[\s\S]*return;[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*return;[\s\S]*statusEntries\.set/, "both feature statuses should be intercepted before generic footer storage while preserving category handling");
|
|
168
168
|
|
|
169
|
-
assert.match(html, /\/styles\.css\?v=
|
|
170
|
-
assert.match(html, /\/app\.js\?v=
|
|
169
|
+
assert.match(html, /\/styles\.css\?v=115/, "integrated stylesheet changes should advance the cache query");
|
|
170
|
+
assert.match(html, /\/app\.js\?v=132/, "integrated app changes should advance the cache query");
|
|
171
171
|
|
|
172
172
|
console.log("feature decision-output popup static checks passed");
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import vm from "node:vm";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const [app, css] = await Promise.all([
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
readFile(join(root, "public", "styles.css"), "utf8"),
|
|
11
|
+
]);
|
|
12
|
+
|
|
13
|
+
function sourceBetween(source, startMarker, endMarker, label) {
|
|
14
|
+
const start = source.indexOf(startMarker);
|
|
15
|
+
const end = source.indexOf(endMarker, start + startMarker.length);
|
|
16
|
+
assert.ok(start >= 0 && end > start, `${label} source should be present`);
|
|
17
|
+
return source.slice(start, end);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const ignoreHelpers = sourceBetween(app, "function fileTreeEntryGitIgnored(", "\nfunction fileTreeGitStatusClasses(", "Git-ignore helpers");
|
|
21
|
+
const renderSignature = sourceBetween(app, "function fileTreeEntryRenderSignature(", "\nfunction fileTreeRenderSignature(", "file tree entry render signature");
|
|
22
|
+
const searchEntry = sourceBetween(app, "function appendFileSearchEntry(", "\nasync function revealFileTreeEntry(", "file search entry renderer");
|
|
23
|
+
const treeEntry = sourceBetween(app, "function appendFileTreeEntry(", "\nasync function loadFileTreeDirectory(", "file tree entry renderer");
|
|
24
|
+
const ignoredCss = sourceBetween(css, ".file-tree-node.git-ignored > .file-tree-item {", "\n.file-tree-git-badge {", "Git-ignored row styles");
|
|
25
|
+
|
|
26
|
+
// Renderer source contract: additive payload consumption without disabling or hiding anything.
|
|
27
|
+
for (const [label, source] of [["browse", treeEntry], ["search", searchEntry]]) {
|
|
28
|
+
assert.match(source, /const gitIgnored = fileTreeEntryGitIgnored\(entry\);/, `the ${label} renderer should read the additive Git-ignore decoration from the entry payload`);
|
|
29
|
+
assert.match(source, /\$\{gitIgnored \? " git-ignored" : ""\}/, `the ${label} renderer should add a stable git-ignored node class`);
|
|
30
|
+
assert.match(source, /button\.title = \[path \|\| "\.", fileTreeGitIgnoredTitle\(gitIgnored\), fileTreeGitStatusTitle\(gitStatus\)/, `the ${label} renderer should place ignore context in the row title without replacing Git status context`);
|
|
31
|
+
assert.doesNotMatch(source, /disabled|aria-disabled|hidden|pointer-events/, `the ${label} renderer should never disable or hide ignored rows`);
|
|
32
|
+
}
|
|
33
|
+
assert.match(ignoreHelpers, /function fileTreeGitIgnoredTitle\(gitIgnored = false\) \{\s*return gitIgnored \? "Ignored by Git" : "";/, "ignored rows should carry the plain-language “Ignored by Git” explanation");
|
|
34
|
+
assert.match(renderSignature, /fileTreeEntryGitIgnored\(entry\),/, "entry render identity should include ignored state so live refreshes repaint changed rows");
|
|
35
|
+
|
|
36
|
+
// Render identity: an ignore-only transition must produce a different signature.
|
|
37
|
+
const signatureRuntime = { normalizeFileTreePath: (value) => String(value || "").replace(/^\/+|\/+$/g, "") };
|
|
38
|
+
vm.runInNewContext(`${ignoreHelpers}\n${renderSignature}\nthis.signature = fileTreeEntryRenderSignature;`, signatureRuntime);
|
|
39
|
+
const normalEntry = { name: "build.log", path: "build.log", type: "file", extension: ".log" };
|
|
40
|
+
const ignoredEntry = { ...normalEntry, gitIgnored: true };
|
|
41
|
+
assert.notDeepEqual(signatureRuntime.signature(ignoredEntry), signatureRuntime.signature(normalEntry), "an ignore-only change should invalidate the cached render signature");
|
|
42
|
+
assert.equal(signatureRuntime.signature(ignoredEntry).includes(true), true, "the signature should carry the ignored boolean");
|
|
43
|
+
assert.equal(signatureRuntime.signature(normalEntry).includes(true), false, "ordinary entries should keep a false ignored signature component");
|
|
44
|
+
|
|
45
|
+
function fakeNode(tag, className = "", text = "") {
|
|
46
|
+
return {
|
|
47
|
+
tag,
|
|
48
|
+
className,
|
|
49
|
+
textContent: text,
|
|
50
|
+
title: "",
|
|
51
|
+
children: [],
|
|
52
|
+
attributes: new Map(),
|
|
53
|
+
listeners: {},
|
|
54
|
+
dataset: {},
|
|
55
|
+
style: { setProperty() {} },
|
|
56
|
+
append(...children) { this.children.push(...children); },
|
|
57
|
+
setAttribute(name, value) { this.attributes.set(name, String(value)); },
|
|
58
|
+
addEventListener(name, listener) { this.listeners[name] = listener; },
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const dragBindings = [];
|
|
63
|
+
const openedFiles = [];
|
|
64
|
+
const contextMenuEntries = [];
|
|
65
|
+
const fileTreeState = {
|
|
66
|
+
expanded: new Set(["ignored-dir"]),
|
|
67
|
+
loading: new Set(),
|
|
68
|
+
selectedPath: "",
|
|
69
|
+
searchQuery: "log",
|
|
70
|
+
entriesByPath: new Map([["ignored-dir", [{ name: "nested.log", path: "ignored-dir/nested.log", type: "file", extension: ".log", gitIgnored: true }]]]),
|
|
71
|
+
gitStatusByPath: new Map(),
|
|
72
|
+
};
|
|
73
|
+
const runtime = {
|
|
74
|
+
fileTreeState,
|
|
75
|
+
normalizeFileTreePath: signatureRuntime.normalizeFileTreePath,
|
|
76
|
+
fileTreeGitStatusForEntry: () => null,
|
|
77
|
+
fileTreeGitStatusClasses: () => "",
|
|
78
|
+
fileTreeGitStatusTitle: () => "",
|
|
79
|
+
fileTreeGitStatusBadge: () => null,
|
|
80
|
+
fileParentPath: (value) => String(value || "").split("/").slice(0, -1).join("/"),
|
|
81
|
+
fileDisplayName: (value) => String(value || "").split("/").pop() || ".",
|
|
82
|
+
make: fakeNode,
|
|
83
|
+
fileTreeExpander: (expanded) => fakeNode("span", "file-tree-expander", expanded ? "▾" : "▸"),
|
|
84
|
+
fileEntryIcon: () => "TXT",
|
|
85
|
+
openFileInViewer: (path) => { openedFiles.push(path); },
|
|
86
|
+
toggleFileTreeDirectory: async () => {},
|
|
87
|
+
addEvent: () => {},
|
|
88
|
+
showFileContextMenu: (event, entry) => { contextMenuEntries.push(entry); },
|
|
89
|
+
bindFileTreeDragAndDrop: (button, item, entry) => { dragBindings.push(entry.path); },
|
|
90
|
+
fileTreeOverflowButton: () => fakeNode("button", "file-tree-overflow-button", "⋯"),
|
|
91
|
+
};
|
|
92
|
+
vm.runInNewContext(`${ignoreHelpers}\n${searchEntry}\n${treeEntry}\nthis.renderSearchEntry = appendFileSearchEntry;\nthis.renderTreeEntry = appendFileTreeEntry;`, runtime);
|
|
93
|
+
|
|
94
|
+
const ignoredFile = { name: "build.log", path: "build.log", type: "file", extension: ".log", gitIgnored: true };
|
|
95
|
+
const ordinaryFile = { name: "index.js", path: "index.js", type: "file", extension: ".js" };
|
|
96
|
+
const ignoredDirectory = { name: "ignored-dir", path: "ignored-dir", type: "directory", directory: true, gitIgnored: true };
|
|
97
|
+
|
|
98
|
+
function renderRow(render, entry, ...rest) {
|
|
99
|
+
const parent = fakeNode("ul");
|
|
100
|
+
render(parent, entry, ...rest);
|
|
101
|
+
const item = parent.children[0];
|
|
102
|
+
return { item, button: item.children[0] };
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (const [label, render, extra] of [["browse", runtime.renderTreeEntry, [0]], ["search", runtime.renderSearchEntry, []]]) {
|
|
106
|
+
fileTreeState.selectedPath = "";
|
|
107
|
+
const ignoredRow = renderRow(render, ignoredFile, ...extra);
|
|
108
|
+
const ordinaryRow = renderRow(render, ordinaryFile, ...extra);
|
|
109
|
+
assert.match(ignoredRow.item.className, /(^| )git-ignored( |$)/, `${label} rows should expose a stable ignored class`);
|
|
110
|
+
assert.doesNotMatch(ordinaryRow.item.className, /git-ignored/, `${label} rows without the decoration should stay unmarked`);
|
|
111
|
+
assert.equal(ignoredRow.button.title, "build.log\nIgnored by Git", `${label} rows should explain the ignored state in the row title`);
|
|
112
|
+
assert.equal(ordinaryRow.button.title, "index.js", `${label} rows should keep the plain path title when not ignored`);
|
|
113
|
+
assert.match(ignoredRow.button.className, /file-tree-item/, `${label} ignored rows should keep the normal row button class`);
|
|
114
|
+
assert.equal(ignoredRow.button.attributes.get("role"), "treeitem", `${label} ignored rows should stay tree items`);
|
|
115
|
+
assert.equal(ignoredRow.button.attributes.get("aria-selected"), "false", `${label} ignored rows should keep selection semantics`);
|
|
116
|
+
assert.equal(ignoredRow.button.attributes.has("aria-disabled"), false, `${label} ignored rows should never be marked disabled`);
|
|
117
|
+
assert.equal(ignoredRow.button.attributes.has("hidden"), false, `${label} ignored rows should never be hidden`);
|
|
118
|
+
assert.equal(typeof ignoredRow.button.listeners.click, "function", `${label} ignored rows should keep their activation handler`);
|
|
119
|
+
assert.equal(typeof ignoredRow.button.listeners.contextmenu, "function", `${label} ignored rows should keep their context menu`);
|
|
120
|
+
assert.equal(ignoredRow.item.children.at(-1).className, "file-tree-overflow-button", `${label} ignored rows should keep the overflow action`);
|
|
121
|
+
ignoredRow.button.listeners.click();
|
|
122
|
+
ignoredRow.button.listeners.contextmenu({});
|
|
123
|
+
assert.equal(fileTreeState.selectedPath, "build.log", `${label} ignored rows should still become the selected entry`);
|
|
124
|
+
}
|
|
125
|
+
fileTreeState.selectedPath = "";
|
|
126
|
+
assert.deepEqual(openedFiles, ["build.log", "build.log"], "ignored files should still open in the viewer from both renderers");
|
|
127
|
+
assert.deepEqual(contextMenuEntries, [ignoredFile, ignoredFile], "ignored rows should still reach the file context menu from both renderers");
|
|
128
|
+
assert.deepEqual(dragBindings.filter((path) => path === "build.log").length, 2, "ignored rows should keep drag-and-drop wiring in both renderers");
|
|
129
|
+
|
|
130
|
+
const nestedSearchRow = renderRow(runtime.renderSearchEntry, ignoredDirectory);
|
|
131
|
+
assert.match(nestedSearchRow.item.className, /git-ignored/, "ignored directories should be marked in search results");
|
|
132
|
+
const nestedList = nestedSearchRow.item.children.find((child) => child.className === "file-tree-list");
|
|
133
|
+
assert.ok(nestedList, "expanded ignored directories should still render their children");
|
|
134
|
+
assert.match(nestedList.children[0].className, /git-ignored/, "nested rows inside an ignored directory should be marked from their own payload");
|
|
135
|
+
assert.equal(nestedList.children[0].children[0].title, "ignored-dir/nested.log\nIgnored by Git", "nested ignored rows should carry the same explanation");
|
|
136
|
+
|
|
137
|
+
// Styling contract: explicit muted colors, no resting whole-row opacity, stronger state feedback retained.
|
|
138
|
+
assert.match(ignoredCss, /\.file-tree-node\.git-ignored > \.file-tree-item \{[^}]*color: rgba\(var\(--ctp-overlay-rgb\)[^}]*border-color: rgba\([^}]*background: rgba\(var\(--ctp-crust-rgb\)/, "the resting ignored row should use explicit muted color, border, and background values");
|
|
139
|
+
assert.doesNotMatch(ignoredCss, /opacity:/, "the muted treatment should not rely on whole-row opacity that would hurt readability");
|
|
140
|
+
for (const [label, selector] of [
|
|
141
|
+
["hover and focus", /\.file-tree-node\.git-ignored > \.file-tree-item:hover,\s*\.file-tree-node\.git-ignored > \.file-tree-item:focus-visible \{[^}]*box-shadow: inset 2px 0 0 var\(--ctp-blue\)/],
|
|
142
|
+
["selection", /\.file-tree-node\.git-ignored\.selected > \.file-tree-item,\s*\.file-tree-node\.git-ignored > \.file-tree-item\[aria-selected="true"\] \{[^}]*box-shadow: inset 3px 0 0 var\(--ctp-teal\)/],
|
|
143
|
+
["Git status", /\.file-tree-node\.git-ignored\.git-changed > \.file-tree-item \{[^}]*box-shadow: inset 2px 0 0 var\(--file-tree-git-color\)/],
|
|
144
|
+
["drag", /\.file-tree-node\.git-ignored\.dragging > \.file-tree-item \{[^}]*cursor: grabbing/],
|
|
145
|
+
["drop target", /\.file-tree-node\.git-ignored\.drop-target > \.file-tree-item \{[^}]*box-shadow: inset 2px 0 0 var\(--ctp-green\)/],
|
|
146
|
+
["blocked drop", /\.file-tree-node\.git-ignored\.drop-blocked > \.file-tree-item \{[^}]*box-shadow: inset 2px 0 0 var\(--ctp-red\)/],
|
|
147
|
+
]) {
|
|
148
|
+
assert.match(ignoredCss, selector, `${label} feedback should still win over the resting muted treatment`);
|
|
149
|
+
}
|
|
150
|
+
assert.match(ignoredCss, /\.file-tree-node\.git-ignored > \.file-tree-item \.file-tree-kind,\s*\.file-tree-node\.git-ignored > \.file-tree-item \.file-tree-search-path \{/, "browse and search metadata should be muted together");
|
|
151
|
+
|
|
152
|
+
console.log("file-tree-git-ignored-static.test.mjs passed");
|
|
@@ -18,6 +18,7 @@ function sourceBetween(source, startMarker, endMarker, label) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
const searchEntry = sourceBetween(app, "function appendFileSearchEntry(", "\nasync function revealFileTreeEntry(", "file search entry renderer");
|
|
21
|
+
const ignoreHelpers = sourceBetween(app, "function fileTreeEntryGitIgnored(", "\nfunction fileTreeGitStatusClasses(", "Git-ignore helpers");
|
|
21
22
|
const revealSearchEntry = sourceBetween(app, "async function revealFileTreeEntry(", "\nfunction appendFileTreeEntry(", "file search reveal behavior");
|
|
22
23
|
const clearSearch = sourceBetween(app, "function focusVisibleFileTreeSelection(", "\nasync function runFileTreeSearch(", "file search clear behavior");
|
|
23
24
|
const searchLabelCss = sourceBetween(css, ".file-tree-search-label {", "\n.file-tree-kind {", "file search row styles");
|
|
@@ -106,7 +107,7 @@ const runtime = {
|
|
|
106
107
|
fileTreeOverflowButton: () => fakeNode("button", "file-tree-overflow-button", "⋯"),
|
|
107
108
|
appendFileTreeEntry: (parent, child, depth) => { renderedChildren.push({ child, depth }); parent.append(fakeNode("li", "file-tree-node", child.name)); },
|
|
108
109
|
};
|
|
109
|
-
vm.runInNewContext(`${searchEntry}\nthis.renderSearchEntry = appendFileSearchEntry;`, runtime);
|
|
110
|
+
vm.runInNewContext(`${ignoreHelpers}\n${searchEntry}\nthis.renderSearchEntry = appendFileSearchEntry;`, runtime);
|
|
110
111
|
|
|
111
112
|
const directory = { name: "packages", path: "packages", type: "directory", directory: true };
|
|
112
113
|
const collapsedParent = fakeNode("ul");
|
|
@@ -683,8 +683,11 @@ function handleWebuiHelperPrompt(command, base) {
|
|
|
683
683
|
respondHelper({ requestId, ok: true, data: mutateRuntimeQueue(request.payload) });
|
|
684
684
|
return true;
|
|
685
685
|
case "subagent-output": {
|
|
686
|
-
const
|
|
687
|
-
|
|
686
|
+
const opaqueSelection = request.payload?.outputId
|
|
687
|
+
? fixtureSubagentRuns.flatMap((run) => run.agents.map((agent) => ({ run, agent }))).find(({ run, agent }) => `h-${createHash("sha256").update(`${run.id}\0${agent.id}`).digest("hex").slice(0, 32)}` === request.payload.outputId)
|
|
688
|
+
: null;
|
|
689
|
+
const run = opaqueSelection?.run || fixtureSubagentRuns.find((candidate) => candidate.id === request.payload?.runId);
|
|
690
|
+
const agent = opaqueSelection?.agent || run?.agents?.find((candidate) => candidate.id === request.payload?.agentId);
|
|
688
691
|
if (!run || !agent) {
|
|
689
692
|
respondHelper({ requestId, ok: false, error: "Subagent output is no longer tracked" });
|
|
690
693
|
return true;
|
|
@@ -1055,23 +1058,56 @@ function handleTransportFixturePrompt(command, base) {
|
|
|
1055
1058
|
return false;
|
|
1056
1059
|
}
|
|
1057
1060
|
|
|
1058
|
-
function emitSubagentFixtureStatus() {
|
|
1061
|
+
function emitSubagentFixtureStatus({ legacyOnly = false } = {}) {
|
|
1062
|
+
const now = Date.now();
|
|
1059
1063
|
emitEvent({
|
|
1060
1064
|
type: "extension_ui_request",
|
|
1061
1065
|
id: randomUUID(),
|
|
1062
1066
|
method: "setStatus",
|
|
1063
1067
|
statusKey: "webui-subagents",
|
|
1064
|
-
statusText: `PI_WEBUI_SUBAGENTS_V1 ${JSON.stringify({ version: 1, available: true, updatedAt:
|
|
1068
|
+
statusText: `PI_WEBUI_SUBAGENTS_V1 ${JSON.stringify({ version: 1, available: true, updatedAt: now, runs: fixtureSubagentRuns, gates: fixtureSubagentGates })}`,
|
|
1069
|
+
});
|
|
1070
|
+
if (legacyOnly) return;
|
|
1071
|
+
const instances = fixtureSubagentRuns.flatMap((run) => run.agents.map((agent) => {
|
|
1072
|
+
const terminal = agent.status !== "running";
|
|
1073
|
+
const startedAt = run.startedAt;
|
|
1074
|
+
const endedAt = terminal ? run.endedAt || now : null;
|
|
1075
|
+
return {
|
|
1076
|
+
version: 1,
|
|
1077
|
+
instanceId: agent.id,
|
|
1078
|
+
runId: run.id,
|
|
1079
|
+
parentSessionId: "fake-session",
|
|
1080
|
+
launcher: run.source === "workflow" ? "workflow" : "pi-subagents",
|
|
1081
|
+
provider: run.source === "workflow" ? "workflow-run" : "pi-subagents",
|
|
1082
|
+
origin: run.source,
|
|
1083
|
+
name: agent.name,
|
|
1084
|
+
status: agent.status,
|
|
1085
|
+
startedAt,
|
|
1086
|
+
updatedAt: endedAt || now,
|
|
1087
|
+
endedAt,
|
|
1088
|
+
model: agent.model,
|
|
1089
|
+
thinking: agent.thinking,
|
|
1090
|
+
...(agent.currentTool ? { currentTool: agent.currentTool } : {}),
|
|
1091
|
+
capabilities: { open: true, refresh: true, cancel: !terminal && run.source !== "workflow", steer: false },
|
|
1092
|
+
outputRef: { kind: "helper", id: `h-${createHash("sha256").update(`${run.id}\0${agent.id}`).digest("hex").slice(0, 32)}` },
|
|
1093
|
+
};
|
|
1094
|
+
}));
|
|
1095
|
+
emitEvent({
|
|
1096
|
+
type: "extension_ui_request",
|
|
1097
|
+
id: randomUUID(),
|
|
1098
|
+
method: "setStatus",
|
|
1099
|
+
statusKey: "webui-subagents-v2",
|
|
1100
|
+
statusText: `PI_WEBUI_SUBAGENTS_V2 ${JSON.stringify({ version: 2, available: true, updatedAt: now, instances, gateReferences: [], diagnostics: [] })}`,
|
|
1065
1101
|
});
|
|
1066
1102
|
}
|
|
1067
1103
|
|
|
1068
1104
|
function handleSubagentFixturePrompt(command, base) {
|
|
1069
1105
|
const message = String(command.message || "").trim();
|
|
1070
|
-
if (!["fixture subagents running", "fixture subagents clear", "fixture subagents retained"].includes(message)) return false;
|
|
1106
|
+
if (!["fixture subagents running", "fixture subagents old-helper", "fixture subagents clear", "fixture subagents retained"].includes(message)) return false;
|
|
1071
1107
|
const now = Date.now();
|
|
1072
1108
|
fixtureSubagentRuns.splice(0, fixtureSubagentRuns.length);
|
|
1073
1109
|
fixtureSubagentGates.splice(0, fixtureSubagentGates.length);
|
|
1074
|
-
if (message === "fixture subagents running") {
|
|
1110
|
+
if (message === "fixture subagents running" || message === "fixture subagents old-helper") {
|
|
1075
1111
|
fixtureSubagentRuns.push({
|
|
1076
1112
|
id: "fixture-run",
|
|
1077
1113
|
source: "async",
|
|
@@ -1123,7 +1159,7 @@ function handleSubagentFixturePrompt(command, base) {
|
|
|
1123
1159
|
);
|
|
1124
1160
|
}
|
|
1125
1161
|
respond({ ...base, data: { output: "fake subagent status emitted" } });
|
|
1126
|
-
emitSubagentFixtureStatus();
|
|
1162
|
+
emitSubagentFixtureStatus({ legacyOnly: message === "fixture subagents old-helper" });
|
|
1127
1163
|
return true;
|
|
1128
1164
|
}
|
|
1129
1165
|
|
|
@@ -34,9 +34,33 @@ const root = await mkdtemp(path.join(tmpdir(), "pi-webui-git-preferences-"));
|
|
|
34
34
|
const settingsFile = path.join(root, "settings.json");
|
|
35
35
|
|
|
36
36
|
try {
|
|
37
|
-
|
|
37
|
+
const completeV1Layout = {
|
|
38
|
+
version: 1,
|
|
39
|
+
sidePanel: {
|
|
40
|
+
sectionOrder: ["files", "controls", "git"],
|
|
41
|
+
collapsedSectionIds: ["git"],
|
|
42
|
+
hiddenSectionIds: ["files"],
|
|
43
|
+
collapsed: true,
|
|
44
|
+
},
|
|
45
|
+
composerActions: {
|
|
46
|
+
order: ["new", "git", "send"],
|
|
47
|
+
grid: { version: 2, columns: 12, positions: { new: 0, git: 1, send: 10 } },
|
|
48
|
+
},
|
|
49
|
+
footerScopedModelOrder: ["fake/model"],
|
|
50
|
+
terminalTabs: {
|
|
51
|
+
layout: "left",
|
|
52
|
+
customGroups: { version: 1, groups: [{ id: "group-1", title: "Group 1", tabIds: ["tab-a"] }] },
|
|
53
|
+
},
|
|
54
|
+
fileViewerWidth: 560,
|
|
55
|
+
};
|
|
56
|
+
await writeFile(settingsFile, `${JSON.stringify({
|
|
57
|
+
version: 6,
|
|
58
|
+
remoteAuthEnabled: true,
|
|
59
|
+
interfacePreferences: { sidePanelWidth: 612 },
|
|
60
|
+
uiLayout: completeV1Layout,
|
|
61
|
+
}, null, 2)}\n`, "utf8");
|
|
38
62
|
const migrated = await readWebuiSettings(settingsFile);
|
|
39
|
-
assert.equal(migrated.version,
|
|
63
|
+
assert.equal(migrated.version, 7);
|
|
40
64
|
assert.equal(migrated.remoteAuthEnabled, true, "legacy Remote PIN state should survive schema migration");
|
|
41
65
|
assert.equal(migrated.outputModeDefault, "normal", "legacy settings should default browser output to normal");
|
|
42
66
|
assert.equal(isGitWorkflowSetupComplete(migrated.gitWorkflow), false);
|
|
@@ -45,10 +69,31 @@ try {
|
|
|
45
69
|
assert.equal(migrated.gitWorkflow.stagingPolicy, "review");
|
|
46
70
|
assert.equal(migrated.gitWorkflow.reviewProcessEnabled, true, "legacy settings should preserve the existing review-process behavior");
|
|
47
71
|
assert.equal(migrated.gitWorkflow.generation.thinkingLevel, "low");
|
|
48
|
-
assert.equal(migrated.uiLayout.version,
|
|
49
|
-
assert.equal(migrated.uiLayout.sidePanel.
|
|
72
|
+
assert.equal(migrated.uiLayout.version, 2);
|
|
73
|
+
assert.equal(migrated.uiLayout.sidePanel.placement, "right");
|
|
74
|
+
assert.deepEqual(migrated.uiLayout.sidePanel.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: [] });
|
|
75
|
+
assert.deepEqual(migrated.uiLayout.sidePanel.collapsedSectionIds, ["git"]);
|
|
76
|
+
assert.deepEqual(migrated.uiLayout.sidePanel.hiddenSectionIds, ["files"]);
|
|
77
|
+
assert.deepEqual(migrated.uiLayout.sidePanel.collapsedPanels, { left: false, right: true });
|
|
78
|
+
assert.deepEqual(migrated.uiLayout.sidePanel.panelWidths, { left: 384, right: 612 }, "legacy width must seed the migrated right width");
|
|
79
|
+
await writeFile(path.join(root, "width-only.json"), `${JSON.stringify({ version: 6, interfacePreferences: { sidePanelWidth: 700 } })}\n`, "utf8");
|
|
80
|
+
assert.deepEqual(
|
|
81
|
+
(await readWebuiSettings(path.join(root, "width-only.json"))).uiLayout.sidePanel.panelWidths,
|
|
82
|
+
{ left: 384, right: 700 },
|
|
83
|
+
"legacy width-only settings must seed v2 even without a v1 uiLayout envelope",
|
|
84
|
+
);
|
|
85
|
+
assert.deepEqual(migrated.uiLayout.composerActions, completeV1Layout.composerActions);
|
|
86
|
+
assert.deepEqual(migrated.uiLayout.footerScopedModelOrder, completeV1Layout.footerScopedModelOrder);
|
|
87
|
+
assert.deepEqual(migrated.uiLayout.terminalTabs, completeV1Layout.terminalTabs);
|
|
88
|
+
assert.equal(migrated.uiLayout.fileViewerWidth, 560);
|
|
50
89
|
|
|
51
|
-
await writeFile(settingsFile, `${JSON.stringify({
|
|
90
|
+
await writeFile(settingsFile, `${JSON.stringify({
|
|
91
|
+
version: 6,
|
|
92
|
+
remoteAuthEnabled: true,
|
|
93
|
+
outputModeDefault: "unsupported",
|
|
94
|
+
interfacePreferences: { sidePanelWidth: 612 },
|
|
95
|
+
uiLayout: completeV1Layout,
|
|
96
|
+
}, null, 2)}\n`, "utf8");
|
|
52
97
|
assert.equal((await readWebuiSettings(settingsFile)).outputModeDefault, "normal", "invalid persisted output modes must fail closed to normal");
|
|
53
98
|
|
|
54
99
|
const saved = await writeGitWorkflowPreferences({
|
|
@@ -82,7 +127,11 @@ try {
|
|
|
82
127
|
assert.equal(partiallyUpdated.reviewProcessEnabled, false, "partial updates should preserve the review-process choice");
|
|
83
128
|
|
|
84
129
|
const persisted = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
85
|
-
assert.equal(persisted.version,
|
|
130
|
+
assert.equal(persisted.version, 7);
|
|
131
|
+
assert.equal(persisted.uiLayout.version, 2, "the first unrelated locked write must persist the migrated v2 envelope");
|
|
132
|
+
assert.deepEqual(persisted.uiLayout.sidePanel.sectionLayout, { order: ["files", "controls", "git"], leftSectionIds: [] });
|
|
133
|
+
assert.deepEqual(persisted.uiLayout.composerActions, completeV1Layout.composerActions, "unchanged v1 composer fields must survive persistence");
|
|
134
|
+
assert.deepEqual(persisted.uiLayout.terminalTabs, completeV1Layout.terminalTabs, "unchanged v1 terminal fields must survive persistence");
|
|
86
135
|
assert.equal(persisted.remoteAuthEnabled, true);
|
|
87
136
|
assert.equal(persisted.outputModeDefault, "compact-v1", "output-mode default should persist beside existing Web UI settings");
|
|
88
137
|
assert.equal(persisted.gitWorkflow.generation.provider, "fake");
|