@firstpick/pi-package-webui 0.9.1 → 0.9.3

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 (107) hide show
  1. package/README.md +31 -9
  2. package/bin/pi-webui-launcher.mjs +23 -12
  3. package/bin/pi-webui.mjs +729 -93
  4. package/index.ts +266 -1
  5. package/lib/agent-run-adapters.mjs +500 -0
  6. package/lib/agent-run-protocol.mjs +262 -0
  7. package/lib/agent-run-registry.mjs +339 -0
  8. package/lib/git-workflow-preferences.mjs +18 -28
  9. package/lib/intercom-conversations.mjs +491 -0
  10. package/lib/intercom-transcript-filter.mjs +99 -0
  11. package/lib/resource-selection.mjs +140 -0
  12. package/lib/trust-boundaries.mjs +2 -0
  13. package/lib/ui-layout-settings.mjs +172 -28
  14. package/lib/update/package-layout.mjs +50 -0
  15. package/lib/update/plan.mjs +11 -0
  16. package/package.json +2 -2
  17. package/public/app.js +2276 -419
  18. package/public/index.html +142 -72
  19. package/public/service-worker.js +2 -1
  20. package/public/stream-output-controller.mjs +15 -0
  21. package/public/styles.css +764 -92
  22. package/public/syntax-highlight.mjs +622 -0
  23. package/tests/agent-run-adapters.test.mjs +217 -0
  24. package/tests/agent-run-launcher.test.mjs +41 -0
  25. package/tests/agent-run-protocol.test.mjs +82 -0
  26. package/tests/agent-run-registry.test.mjs +102 -0
  27. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  28. package/tests/browser/control-deck-side-panels.spec.mjs +354 -0
  29. package/tests/browser/controls-layout.spec.mjs +122 -0
  30. package/tests/browser/file-tree-git-ignored.spec.mjs +113 -0
  31. package/tests/browser/interaction-continuity.spec.mjs +161 -0
  32. package/tests/browser/intercom-conversation-viewer.spec.mjs +355 -0
  33. package/tests/browser/mobile-foundation.spec.mjs +26 -0
  34. package/tests/browser/model-search-focus.spec.mjs +96 -0
  35. package/tests/browser/optimistic-prompt.spec.mjs +22 -0
  36. package/tests/browser/persistent-ui-layout.spec.mjs +285 -66
  37. package/tests/browser/resource-profiles.spec.mjs +200 -0
  38. package/tests/browser/subagent-observability.spec.mjs +116 -0
  39. package/tests/codex-fast-mode-static.test.mjs +7 -6
  40. package/tests/common-options-submenus-interaction-static.test.mjs +2 -0
  41. package/tests/common-options-submenus-markup-static.test.mjs +1 -0
  42. package/tests/component-update-api-static.test.mjs +2 -1
  43. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  44. package/tests/composer-skill-tag-layout.test.mjs +32 -2
  45. package/tests/control-deck-component-updates-static.test.mjs +6 -0
  46. package/tests/control-deck-side-panels-static.test.mjs +68 -0
  47. package/tests/controls-layout-static.test.mjs +22 -0
  48. package/tests/fast-mode-client-static.test.mjs +2 -2
  49. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  50. package/tests/feature-system-prompt-optional-feature-static.test.mjs +5 -5
  51. package/tests/file-tree-git-ignored-static.test.mjs +152 -0
  52. package/tests/file-tree-search-layout-static.test.mjs +2 -1
  53. package/tests/file-viewer-image-static.test.mjs +69 -0
  54. package/tests/fixtures/fake-pi.mjs +147 -12
  55. package/tests/foreground-transcript-catch-up-static.test.mjs +1 -1
  56. package/tests/git-panel-file-preview-static.test.mjs +5 -5
  57. package/tests/git-panel-live-updates-static.test.mjs +3 -3
  58. package/tests/git-workflow-preferences.test.mjs +55 -6
  59. package/tests/http-endpoints-harness.test.mjs +295 -14
  60. package/tests/intercom-conversation-viewer-static.test.mjs +105 -0
  61. package/tests/intercom-conversations-http.test.mjs +252 -0
  62. package/tests/intercom-conversations.test.mjs +374 -0
  63. package/tests/intercom-main-transcript-suppression-static.test.mjs +52 -0
  64. package/tests/intercom-tag-layout-static.test.mjs +46 -0
  65. package/tests/intercom-transcript-filter.test.mjs +98 -0
  66. package/tests/main-output-loading-static.test.mjs +59 -0
  67. package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
  68. package/tests/mobile-compact-layout.test.mjs +2 -3
  69. package/tests/mobile-continuity-tablet-static.test.mjs +6 -6
  70. package/tests/mobile-foundation-static.test.mjs +3 -3
  71. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  72. package/tests/mobile-static.test.mjs +76 -42
  73. package/tests/native-parity.test.mjs +8 -7
  74. package/tests/open-issue-wizard-static.test.mjs +2 -2
  75. package/tests/optional-feature-migration-frontend.test.mjs +5 -5
  76. package/tests/optional-feature-resource-setup-static.test.mjs +29 -0
  77. package/tests/persistent-ui-layout-static.test.mjs +13 -13
  78. package/tests/questionnaire-dialog.test.mjs +3 -3
  79. package/tests/remote-auth-settings-harness.test.mjs +1 -1
  80. package/tests/resource-defaults-helper.test.mjs +60 -6
  81. package/tests/resource-selection.test.mjs +114 -0
  82. package/tests/resource-tui-extension.test.mjs +23 -0
  83. package/tests/session-sampling-ui-static.test.mjs +3 -3
  84. package/tests/side-panel-context-menu-static.test.mjs +1 -1
  85. package/tests/side-panel-resize-static.test.mjs +26 -16
  86. package/tests/side-panel-section-height-removal-static.test.mjs +4 -4
  87. package/tests/side-panel-section-reorder-static.test.mjs +16 -70
  88. package/tests/stream-output-controller.test.mjs +8 -0
  89. package/tests/stream-output-isolation-static.test.mjs +2 -2
  90. package/tests/streaming-ui-coupling.test.mjs +5 -0
  91. package/tests/subagent-gate-visibility.test.mjs +2 -1
  92. package/tests/subagent-launch-slots.test.mjs +1 -1
  93. package/tests/subagent-observability-static.test.mjs +32 -0
  94. package/tests/subagent-reliability-integration.test.mjs +183 -0
  95. package/tests/subagent-workflow-section-static.test.mjs +67 -0
  96. package/tests/subagents-helper.test.mjs +548 -5
  97. package/tests/syntax-highlight.test.mjs +235 -0
  98. package/tests/syntax-highlighting-static.test.mjs +84 -0
  99. package/tests/terminal-tabs-resize-static.test.mjs +35 -0
  100. package/tests/theme-customizer-static.test.mjs +5 -5
  101. package/tests/thinking-format-parser.test.mjs +64 -0
  102. package/tests/ui-layout-settings.test.mjs +104 -32
  103. package/tests/update-api-harness.test.mjs +24 -10
  104. package/tests/update-package-layout.test.mjs +38 -0
  105. package/tests/update-plan.test.mjs +11 -1
  106. package/tests/webui-settings-locking.test.mjs +33 -3
  107. package/webui-rpc-helper.mjs +700 -89
@@ -0,0 +1,200 @@
1
+ import assert from "node:assert/strict";
2
+ import { spawn } from "node:child_process";
3
+ import { createServer } from "node:net";
4
+ import { mkdtemp, readFile, rm } from "node:fs/promises";
5
+ import { tmpdir } from "node:os";
6
+ import { dirname, join } from "node:path";
7
+ import { setTimeout as delay } from "node:timers/promises";
8
+ import { fileURLToPath } from "node:url";
9
+ import { expect, test } from "@playwright/test";
10
+
11
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
12
+ const serverScript = join(root, "bin", "pi-webui.mjs");
13
+ const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
14
+
15
+ async function freePort() {
16
+ const server = createServer();
17
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
18
+ const { port } = server.address();
19
+ await new Promise((resolve) => server.close(resolve));
20
+ return port;
21
+ }
22
+
23
+ let child;
24
+ let baseURL;
25
+ let tempRoot;
26
+ let settingsFile;
27
+ let output = "";
28
+
29
+ async function installResourceCommands(page) {
30
+ await page.route("**/api/commands?*", async (route) => {
31
+ await route.fulfill({
32
+ status: 200,
33
+ contentType: "application/json",
34
+ body: JSON.stringify({
35
+ ok: true,
36
+ data: {
37
+ commands: [
38
+ { name: "tools", source: "extension", description: "Configure tools" },
39
+ { name: "skills", source: "extension", description: "Configure skills" },
40
+ ],
41
+ },
42
+ }),
43
+ });
44
+ });
45
+ }
46
+
47
+ async function openResourceSetupMenu(page) {
48
+ await page.locator("#nativeCommandMenuButton").click();
49
+ await expect(page.locator("#nativeCommandMenu")).toBeVisible();
50
+ }
51
+
52
+ test.beforeAll(async () => {
53
+ const port = await freePort();
54
+ tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-resource-profiles-browser-"));
55
+ settingsFile = join(tempRoot, "settings.json");
56
+ baseURL = `http://127.0.0.1:${port}`;
57
+ child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
58
+ stdio: ["ignore", "pipe", "pipe"],
59
+ env: {
60
+ ...process.env,
61
+ PI_WEBUI_RPC_SUPERVISOR: "0",
62
+ PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
63
+ PI_WEBUI_SETTINGS_FILE: settingsFile,
64
+ },
65
+ });
66
+ child.stdout.on("data", (chunk) => { output += String(chunk); });
67
+ child.stderr.on("data", (chunk) => { output += String(chunk); });
68
+ for (let attempt = 0; attempt < 80; attempt += 1) {
69
+ if (child.exitCode !== null) break;
70
+ try {
71
+ const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
72
+ if (response.ok) return;
73
+ } catch {
74
+ // Wait for the isolated real server and fake Pi fixture.
75
+ }
76
+ await delay(100);
77
+ }
78
+ throw new Error(`Pi Web UI did not start:\n${output}`);
79
+ });
80
+
81
+ test.afterAll(async () => {
82
+ if (child?.exitCode === null) child.kill("SIGTERM");
83
+ if (child && child.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
84
+ await rm(tempRoot, { recursive: true, force: true });
85
+ });
86
+
87
+ test("the dedicated resource menu opens exact-model tools and persists then clears the profile", async ({ page }) => {
88
+ await installResourceCommands(page);
89
+ await page.setViewportSize({ width: 1280, height: 800 });
90
+ await page.goto(baseURL);
91
+
92
+ await expect(page.locator("#optionsToolsSetupButton, #optionsSkillsSetupButton")).toHaveCount(0);
93
+ await openResourceSetupMenu(page);
94
+ await page.locator("#nativeToolsButton").click();
95
+
96
+ await expect(page.locator("#nativeCommandDialog")).toBeVisible();
97
+ await expect(page.locator("#nativeCommandTitle")).toHaveText("Tools Setup");
98
+ const scope = page.locator(".native-resource-scope select");
99
+ await expect(scope).toHaveValue("session");
100
+ await expect(scope.locator("option")).toHaveText(["Session only", "Global default", "Model default"]);
101
+ await scope.selectOption("model");
102
+
103
+ const model = page.locator(".native-resource-model select");
104
+ await expect(model).toBeVisible();
105
+ await expect(model.locator("option").first()).toContainText("fake/fake-model");
106
+ await expect(page.locator(".native-resource-model")).toContainText("active session model is not changed");
107
+
108
+ const bashItem = page.locator(".native-selector-item").filter({ hasText: "bash" });
109
+ await expect(bashItem).toContainText("enabled");
110
+ await bashItem.click();
111
+ await expect(page.locator(".native-selector-item").filter({ hasText: "bash" })).toContainText("disabled");
112
+
113
+ await expect.poll(async () => {
114
+ try {
115
+ const settings = JSON.parse(await readFile(settingsFile, "utf8"));
116
+ return settings.resourceDefaults?.modelProfiles?.[0]?.tools?.enabledTools || null;
117
+ } catch {
118
+ return null;
119
+ }
120
+ }).toEqual(["read"]);
121
+
122
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Use inherited defaults" }).click();
123
+ await expect.poll(async () => {
124
+ const settings = JSON.parse(await readFile(settingsFile, "utf8"));
125
+ return settings.resourceDefaults?.modelProfiles || [];
126
+ }).toEqual([]);
127
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
128
+ });
129
+
130
+ test("Optional features exposes Skills Setup and Tools Setup on the loaded TUI command rows", async ({ page }) => {
131
+ await installResourceCommands(page);
132
+ await page.setViewportSize({ width: 1280, height: 800 });
133
+ await page.goto(baseURL);
134
+ await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
135
+
136
+ await page.locator("#sidePanelSectionToggleOptionalFeatures").click();
137
+
138
+ const questionnaireRow = page.locator(".optional-feature-row").filter({ hasText: "Native questionnaires" });
139
+ await expect(questionnaireRow.getByRole("button", { name: "Set up Native questionnaires" })).toHaveCount(0);
140
+ await expect(questionnaireRow).not.toContainText("Use Setup");
141
+
142
+ const skillsRow = page.locator(".optional-feature-row").filter({ hasText: "TUI Skills command" });
143
+ const skillsSetup = skillsRow.getByRole("button", { name: "Set up TUI Skills command" });
144
+ await expect(skillsSetup).toBeVisible();
145
+ await expect(skillsSetup).toHaveText("Setup");
146
+ await skillsSetup.click();
147
+ await expect(page.locator("#nativeCommandTitle")).toHaveText("Skills Setup");
148
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
149
+
150
+ const toolsRow = page.locator(".optional-feature-row").filter({ hasText: "TUI Tools command" });
151
+ const toolsSetup = toolsRow.getByRole("button", { name: "Set up TUI Tools command" });
152
+ await expect(toolsSetup).toBeVisible();
153
+ await expect(toolsSetup).toHaveText("Setup");
154
+ await toolsSetup.click();
155
+ await expect(page.locator("#nativeCommandTitle")).toHaveText("Tools Setup");
156
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Cancel" }).click();
157
+ });
158
+
159
+ test("mobile keyboard navigation opens Skills Setup from the dedicated resource menu", async ({ browser }) => {
160
+ const context = await browser.newContext({ viewport: { width: 390, height: 844 }, isMobile: true, hasTouch: true });
161
+ const page = await context.newPage();
162
+ await installResourceCommands(page);
163
+ await page.goto(`${baseURL}/?mobileShell=legacy`);
164
+ await page.addStyleTag({ content: "#optionalFeatureMigrationSurface, #updateNotification { display: none !important; }" });
165
+
166
+ await page.locator("#composerActionsButton").focus();
167
+ await page.keyboard.press("Enter");
168
+ await expect(page.locator("#composerActionsPanel")).toBeVisible();
169
+ await expect(page.locator("#optionsToolsSetupButton, #optionsSkillsSetupButton")).toHaveCount(0);
170
+ await page.locator("#nativeCommandMenuButton").focus();
171
+ await page.keyboard.press("Enter");
172
+ await expect(page.locator("#nativeCommandMenu")).toBeVisible();
173
+ await page.locator("#nativeSkillsButton").focus();
174
+ await page.keyboard.press("Enter");
175
+ await expect(page.locator("#nativeCommandDialog")).toBeVisible();
176
+ await expect(page.locator("#nativeCommandTitle")).toHaveText("Skills Setup");
177
+ const skillScope = page.locator(".native-resource-scope select");
178
+ await expect(skillScope).toHaveValue("session");
179
+ const box = await page.locator("#nativeCommandDialog").boundingBox();
180
+ assert.ok(box && box.width <= 390 && box.height <= 844, `Skills Setup must fit the mobile viewport, got ${JSON.stringify(box)}`);
181
+
182
+ await skillScope.selectOption("model");
183
+ await expect(page.locator(".native-resource-model select")).toBeVisible();
184
+ const codeSecurity = page.locator(".native-selector-item").filter({ hasText: "code-security" });
185
+ await expect(codeSecurity).toHaveAttribute("aria-pressed", "true");
186
+ await codeSecurity.click();
187
+ await expect(page.locator(".native-selector-item").filter({ hasText: "code-security" })).toHaveAttribute("aria-pressed", "false");
188
+ await expect.poll(async () => {
189
+ const settings = JSON.parse(await readFile(settingsFile, "utf8"));
190
+ return settings.resourceDefaults?.modelProfiles?.[0]?.skills?.enabledSkills || null;
191
+ }).toEqual(["repo-explorer"]);
192
+
193
+ await page.locator("#nativeCommandActions").getByRole("button", { name: "Use inherited defaults" }).click();
194
+ await expect.poll(async () => {
195
+ const settings = JSON.parse(await readFile(settingsFile, "utf8"));
196
+ return settings.resourceDefaults?.modelProfiles || [];
197
+ }).toEqual([]);
198
+
199
+ await context.close();
200
+ });
@@ -0,0 +1,116 @@
1
+ import { spawn } from "node:child_process";
2
+ import { createServer } from "node:net";
3
+ import { mkdtemp, rm } from "node:fs/promises";
4
+ import { tmpdir } from "node:os";
5
+ import { dirname, join } from "node:path";
6
+ import { setTimeout as delay } from "node:timers/promises";
7
+ import { fileURLToPath } from "node:url";
8
+ import { expect, test } from "@playwright/test";
9
+
10
+ const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
11
+ const serverScript = join(root, "bin", "pi-webui.mjs");
12
+ const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
13
+ let child;
14
+ let baseURL;
15
+ let tempRoot;
16
+
17
+ async function freePort() {
18
+ const server = createServer();
19
+ await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
20
+ const { port } = server.address();
21
+ await new Promise((resolve) => server.close(resolve));
22
+ return port;
23
+ }
24
+
25
+ async function api(page, pathname, { method = "GET", data } = {}) {
26
+ const response = await page.request.fetch(`${baseURL}${pathname}`, { method, data });
27
+ expect(response.ok()).toBe(true);
28
+ return response.json();
29
+ }
30
+
31
+ async function startServer() {
32
+ const port = await freePort();
33
+ baseURL = `http://127.0.0.1:${port}`;
34
+ child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
35
+ stdio: ["ignore", "pipe", "pipe"],
36
+ env: { ...process.env, PI_WEBUI_RPC_SUPERVISOR: "0", PI_CODING_AGENT_DIR: join(tempRoot, "agent"), PI_WEBUI_SETTINGS_FILE: join(tempRoot, "settings.json") },
37
+ });
38
+ let output = "";
39
+ child.stdout.on("data", (chunk) => { output += String(chunk); });
40
+ child.stderr.on("data", (chunk) => { output += String(chunk); });
41
+ for (let attempt = 0; attempt < 100; attempt += 1) {
42
+ try { if ((await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) })).ok) return; } catch {}
43
+ await delay(100);
44
+ }
45
+ throw new Error(`server did not start: ${output}`);
46
+ }
47
+
48
+ async function stopServer() {
49
+ if (!child || child.exitCode !== null) return;
50
+ const exited = new Promise((resolve) => child.once("exit", resolve));
51
+ child.kill("SIGTERM");
52
+ await Promise.race([exited, delay(5_000).then(() => child.kill("SIGKILL"))]);
53
+ }
54
+
55
+ test.beforeAll(async () => {
56
+ tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-subagent-browser-"));
57
+ await startServer();
58
+ });
59
+
60
+ test.afterAll(async () => {
61
+ await stopServer();
62
+ await rm(tempRoot, { recursive: true, force: true });
63
+ });
64
+
65
+ test("renders canonical v2 agents and opens output through the unified selection", async ({ page }) => {
66
+ await page.goto(baseURL);
67
+ await expect(page.locator("#tabBar [data-tab-id]").first()).toBeVisible();
68
+ const tabs = await api(page, "/api/tabs");
69
+ const tabId = tabs.data.tabs[0].id;
70
+ await api(page, `/api/prompt?tab=${encodeURIComponent(tabId)}`, { method: "POST", data: { message: "fixture subagents running", requestId: `subagents-${Date.now()}` } });
71
+
72
+ const sectionToggle = page.locator('[data-side-panel-section-toggle="subagents"]');
73
+ if (await sectionToggle.getAttribute("aria-expanded") !== "true") await sectionToggle.click();
74
+ await expect(page.locator(".subagent-agent-row")).toHaveCount(2);
75
+ await expect(page.locator("#subagentCountBadge")).toHaveText("2");
76
+ await expect(page.locator("#subagentsStatus")).toContainText("2 total");
77
+ await expect(page.locator("#subagentsStatus")).toContainText("2 running");
78
+ await expect(page.locator(".subagent-source-badge").first()).toHaveText("pi-subagents");
79
+ await expect(page.locator(".subagent-state-dot.running")).toHaveCount(2);
80
+ await expect(page.locator(".subagent-gate-card")).toHaveCount(1);
81
+
82
+ await page.locator(".subagent-agent-row").first().click();
83
+ await expect(page.locator(".subagent-overlay-widget")).toBeVisible();
84
+ await expect(page.locator(".subagent-overlay-widget")).toContainText("reviewer");
85
+ await expect(page.locator(".subagent-overlay-refresh-action")).toBeVisible();
86
+ await expect(page.locator(".subagent-overlay-cancel-action")).toBeVisible();
87
+ });
88
+
89
+ test("renders the workflow controller as a collapsible header with nested agents", async ({ page }) => {
90
+ await page.goto(baseURL);
91
+ await expect(page.locator("#tabBar [data-tab-id]").first()).toBeVisible();
92
+ const tabs = await api(page, "/api/tabs");
93
+ const tabId = tabs.data.tabs[0].id;
94
+ await api(page, `/api/prompt?tab=${encodeURIComponent(tabId)}`, { method: "POST", data: { message: "fixture subagents workflow", requestId: `workflow-${Date.now()}` } });
95
+
96
+ const sectionToggle = page.locator('[data-side-panel-section-toggle="subagents"]');
97
+ if (await sectionToggle.getAttribute("aria-expanded") !== "true") await sectionToggle.click();
98
+ const workflow = page.locator(".subagent-workflow");
99
+ await expect(workflow).toHaveCount(1);
100
+ await expect(workflow).toHaveAttribute("open", "");
101
+ await expect(workflow.locator(".subagent-workflow-header")).toContainText("Workflow");
102
+ await expect(workflow.locator(".subagent-workflow-header")).toContainText("running");
103
+ await expect(workflow.locator(".subagent-workflow-header")).toContainText("1 agent");
104
+ await expect(workflow.locator(".subagent-agent-row")).toHaveCount(1);
105
+ await expect(workflow.locator(".subagent-agent-name")).toHaveText("worker");
106
+ await expect(page.locator(".subagent-agent-list > .subagent-run")).toHaveCount(1);
107
+ await expect(page.locator("#subagentCountBadge")).toHaveText("1");
108
+ await expect(page.locator("#subagentsStatus")).toContainText("1 total");
109
+ await expect(page.locator("#subagentsStatus")).toContainText("1 running");
110
+
111
+ await workflow.locator(".subagent-workflow-header").click();
112
+ await expect(workflow).not.toHaveAttribute("open", "");
113
+ await expect(workflow.locator(".subagent-agent-row")).toBeHidden();
114
+ await page.waitForTimeout(650);
115
+ await expect(workflow).not.toHaveAttribute("open", "");
116
+ });
@@ -4,13 +4,14 @@ import { dirname, join } from "node:path";
4
4
  import { fileURLToPath } from "node:url";
5
5
 
6
6
  const root = join(dirname(fileURLToPath(import.meta.url)), "..");
7
- const [server, app, html, styles, serviceWorker, readme, packageRaw, lockRaw, optionalFeatureCatalog] = await Promise.all([
7
+ const [server, app, html, styles, serviceWorker, technical, development, packageRaw, lockRaw, optionalFeatureCatalog] = await Promise.all([
8
8
  readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
9
9
  readFile(join(root, "public", "app.js"), "utf8"),
10
10
  readFile(join(root, "public", "index.html"), "utf8"),
11
11
  readFile(join(root, "public", "styles.css"), "utf8"),
12
12
  readFile(join(root, "public", "service-worker.js"), "utf8"),
13
- readFile(join(root, "README.md"), "utf8"),
13
+ readFile(join(root, "TECHNICAL.md"), "utf8"),
14
+ readFile(join(root, "DEVELOPMENT.md"), "utf8"),
14
15
  readFile(join(root, "package.json"), "utf8"),
15
16
  readFile(join(root, "package-lock.json"), "utf8"),
16
17
  readFile(join(root, "lib", "optional-feature-catalog.mjs"), "utf8"),
@@ -51,10 +52,10 @@ assert.match(app, /async function disableCodexFastModeIntegration\(\)[\s\S]*?tab
51
52
  assert.match(app, /refreshNaturalConversationMode\(tabContext\),[\s\S]*?refreshCodexFastMode\(tabContext\),/, "tab refreshes should reload branch-scoped Fast-mode state");
52
53
  assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFastModeStatus\(request\.statusText\)/, "extension status events should refresh the active-tab selector");
53
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
- 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");
55
+ assert.match(technical, /## Normal and compact output[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "technical reference should document Compact mode with the stable identifier");
56
+ assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "development guide should document Fast-mode integration and cost semantics");
56
57
  // Intent preserved: browser-asset changes must advance the coherent cache tuple.
57
- assert.match(serviceWorker, /pi-webui-pwa-v84/, "PWA cache identity should be bumped for changed browser assets");
58
- assert.match(html, /data-app-src="\/app\.js\?v=121"/, "browser module URL should be cache-busted for Fast-mode wiring");
58
+ assert.match(serviceWorker, /pi-webui-pwa-v108/, "PWA cache identity should be bumped for changed browser assets");
59
+ assert.match(html, /data-app-src="\/app\.js\?v=146"/, "browser module URL should be cache-busted for Fast-mode wiring");
59
60
 
60
61
  console.log("codex-fast-mode-static.test.mjs passed");
@@ -153,6 +153,8 @@ for (const [id, handler] of [
153
153
  ["optionsWorkflowSetupButton", 'runNativeCommandMenu\\("/workflow-setup"\\)'],
154
154
  ["optionsSafetyGuardSetupButton", 'runNativeCommandMenu\\("/safety-guard-setup"\\)'],
155
155
  ["optionsGitWorkflowSetupButton", 'runNativeCommandMenu\\("/git-workflow-setup"\\)'],
156
+ ["optionsToolsSetupButton", 'runNativeCommandMenu\\("/tools"\\)'],
157
+ ["optionsSkillsSetupButton", 'runNativeCommandMenu\\("/skills"\\)'],
156
158
  ["optionsExportButton", 'runNativeCommandMenu\\("/export"\\)'],
157
159
  ["optionsForkButton", 'runNativeCommandMenu\\("/fork"\\)'],
158
160
  ["optionsTreeButton", 'runNativeCommandMenu\\("/tree"\\)'],
@@ -82,6 +82,7 @@ const menuEnd = html.indexOf('<div id="appRunnerMenu"', menuStart);
82
82
  assert.ok(menuStart >= 0 && menuEnd > menuStart, "the Common Pi options block should remain bounded by its stable IDs");
83
83
  const menuMarkup = html.slice(menuStart, menuEnd);
84
84
  assert.match(menuMarkup, /^<div id="optionsMenu"[^>]*role="menu"[^>]*aria-label="Common Pi options">/, "the root should remain a labelled menu");
85
+ assert.doesNotMatch(menuMarkup, /id="options(?:Tools|Skills)SetupButton"/, "Tools Setup and Skills Setup should not appear in Common Pi options");
85
86
 
86
87
  const allActionIds = Object.keys(actionContract);
87
88
  for (const [id, contract] of Object.entries(actionContract)) {
@@ -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, /assertUpdatePlanDigest\(journal\.plan, planDigest\)[\s\S]*acquireInstallLock\(agentDir\)/);
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=107/, "changed composer styles should advance the stylesheet revision");
60
- assert.match(html, /app\.js\?v=121/, "changed composer behavior should advance the app revision");
61
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v84"/, "changed browser assets should advance the PWA cache identity");
59
+ assert.match(html, /styles\.css\?v=123/, "changed composer styles should advance the stylesheet revision");
60
+ assert.match(html, /app\.js\?v=146/, "changed composer behavior should advance the app revision");
61
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v108"/, "changed browser assets should advance the PWA cache identity");
62
62
 
63
63
  console.log("composer-action-grid-reorder-static.test.mjs passed");
@@ -6,6 +6,7 @@ import { fileURLToPath } from "node:url";
6
6
 
7
7
  const root = join(dirname(fileURLToPath(import.meta.url)), "..");
8
8
  const app = await readFile(join(root, "public", "app.js"), "utf8");
9
+ const css = await readFile(join(root, "public", "styles.css"), "utf8");
9
10
 
10
11
  function functionSource(name, nextName) {
11
12
  const start = app.indexOf(`function ${name}(`);
@@ -19,7 +20,11 @@ function chip(width) {
19
20
  hidden: false,
20
21
  textContent: "",
21
22
  title: "",
23
+ attributes: new Map(),
22
24
  measurements: 0,
25
+ setAttribute(name, value) {
26
+ this.attributes.set(name, value);
27
+ },
23
28
  getBoundingClientRect() {
24
29
  this.measurements += 1;
25
30
  return { width };
@@ -28,15 +33,23 @@ function chip(width) {
28
33
  }
29
34
 
30
35
  const tags = [chip(50), chip(60), chip(70)];
36
+ const menuItems = [chip(50), chip(60), chip(70)];
31
37
  const overflow = chip(22);
38
+ const overflowStateCalls = [];
32
39
  const container = {
33
40
  hidden: false,
34
41
  clientWidth: 150,
35
- querySelectorAll: (selector) => selector === "button.composer-skill-tag" ? tags : [],
36
- querySelector: (selector) => selector === ".composer-skill-tag.overflow" ? overflow : null,
42
+ querySelectorAll: (selector) => {
43
+ if (selector === ":scope > button.composer-skill-tag:not(.overflow)") return tags;
44
+ if (selector === ".composer-skill-overflow-menu-item") return menuItems;
45
+ return [];
46
+ },
47
+ querySelector: (selector) => selector === "button.composer-skill-tag.overflow" ? overflow : null,
37
48
  };
38
49
  const context = {
39
50
  elements: { sessionSkillTags: container },
51
+ sessionSkillOverflowOpen: false,
52
+ setSessionSkillOverflowOpen: (open) => overflowStateCalls.push(open),
40
53
  getComputedStyle: () => ({ columnGap: "5px", gap: "5px" }),
41
54
  };
42
55
  vm.runInNewContext(
@@ -46,18 +59,23 @@ vm.runInNewContext(
46
59
 
47
60
  context.fitSessionSkillTags();
48
61
  assert.deepEqual(tags.map((tag) => tag.hidden), [false, false, true], "the strip should show the maximum chip count that fits the measured width");
62
+ assert.deepEqual(menuItems.map((tag) => tag.hidden), [true, true, false], "the popup should contain only tags hidden from the strip");
49
63
  assert.equal(overflow.hidden, false, "the overflow chip should remain visible while tags are hidden");
50
64
  assert.equal(overflow.textContent, "+1", "the overflow chip should report the current hidden count");
65
+ assert.equal(overflow.attributes.get("aria-label"), "Show 1 more tracked skill", "the disclosure should announce its current hidden count");
51
66
  assert.equal(overflow.measurements, 1, "fitting should measure one overflow width per digit count rather than forcing layout for every candidate");
52
67
 
53
68
  container.clientWidth = 200;
54
69
  context.fitSessionSkillTags();
55
70
  assert.deepEqual(tags.map((tag) => tag.hidden), [false, false, false], "widening the input should reveal every tag without rerendering the session state");
71
+ assert.deepEqual(menuItems.map((tag) => tag.hidden), [true, true, true], "the popup should not duplicate tags visible in the strip");
56
72
  assert.equal(overflow.hidden, true, "the overflow chip should disappear when every tag fits");
73
+ assert.deepEqual(overflowStateCalls, [false], "revealing every tag should close an open overflow surface");
57
74
 
58
75
  container.clientWidth = 80;
59
76
  context.fitSessionSkillTags();
60
77
  assert.deepEqual(tags.map((tag) => tag.hidden), [false, true, true], "narrowing the input should compact the tag strip again");
78
+ assert.deepEqual(menuItems.map((tag) => tag.hidden), [true, false, false], "responsive compaction should update the selectable popup contents");
61
79
  assert.equal(overflow.textContent, "+2", "responsive compaction should keep the overflow count current");
62
80
 
63
81
  container.clientWidth = 0;
@@ -67,4 +85,16 @@ context.fitSessionSkillTags();
67
85
  assert.deepEqual(tags.map((tag) => tag.hidden), zeroWidthState, "a temporarily unmeasurable strip should preserve its last stable visibility state");
68
86
  assert.equal(overflow.textContent, zeroWidthOverflowText, "a zero-width pass should not expose a stale overflow count");
69
87
 
88
+ const disclosureSource = functionSource("setSessionSkillOverflowOpen", "fitSessionSkillTags");
89
+ const installSource = functionSource("installSessionSkillTagResizeHandling", "renderSessionSkillTags");
90
+ const renderStart = app.indexOf("function renderSessionSkillTags(");
91
+ const renderEnd = app.indexOf("\nconst INTERCOM_CONVERSATION_ID_PATTERN", renderStart);
92
+ const renderSource = app.slice(renderStart, renderEnd);
93
+ assert.match(disclosureSource, /classList\.toggle\("overflow-open", expanded\)[\s\S]*aria-expanded[\s\S]*menu\.hidden = !expanded/, "the disclosure should keep visual, accessible, and hidden state synchronized");
94
+ assert.match(installSource, /event\.key !== "Escape"[\s\S]*restoreFocus: true[\s\S]*document\.addEventListener\("pointerdown"/, "Escape and outside pointer interaction should dismiss the popup");
95
+ assert.match(renderSource, /make\("button", "composer-skill-tag overflow"[\s\S]*aria-haspopup[\s\S]*sessionSkillOverflowMenu[\s\S]*role", "dialog"/, "the overflow count should render as an accessible popup button");
96
+ assert.match(renderSource, /composer-skill-overflow-menu-item[\s\S]*setSessionSkillOverflowOpen\(false\);[\s\S]*openSkillEditor\(entry\)/, "every hidden tag should remain clickable through the existing editor action");
97
+ assert.match(css, /\.composer-skill-overflow-menu \{[\s\S]*position: absolute;[\s\S]*bottom: calc\(100% \+ 0\.42rem\);[\s\S]*max-height:[\s\S]*overflow-y: auto;/, "the bounded popup should expand upward above the compact strip");
98
+ assert.match(css, /\.composer-skill-overflow-menu \.composer-skill-tag \{[\s\S]*width: 100%;[\s\S]*max-width: none;/, "hidden tags should use the popup width instead of the compact-strip truncation limit");
99
+
70
100
  console.log("composer skill tag layout tests passed");
@@ -18,6 +18,12 @@ 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/);
23
+ assert.match(html, /id="serverRestartPanel"[\s\S]*server-restart-spinner[\s\S]*id="serverRestartKicker"[\s\S]*id="serverRestartTitle"/);
24
+ assert.match(app, /function setServerRestartOverlay\(active[\s\S]*phase = "restarting"[\s\S]*phase === "updating"[\s\S]*Applying exact update/);
25
+ assert.match(app, /async function startComponentUpdate\(target\)[\s\S]*setServerRestartOverlay\(true, `Starting exact \$\{label\} update…`, \{ phase: "updating" \}\)[\s\S]*setServerRestartOverlay\(false\)/);
26
+ assert.match(app, /async function runPiUpdateAndRestart[\s\S]*setServerRestartOverlay\(true, progressMessage, \{ phase: "updating" \}\)/);
21
27
  assert.match(app, /will not re-resolve latest or scan package roots/);
22
28
  assert.match(app, /function separatePathPiPlanNotice\(plan\)[\s\S]*PATH Pi[\s\S]*separate installation[\s\S]*will remain untouched/);
23
29
  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=123/, "Controls stylesheet changes should advance the cache query");
19
+ assert.match(html, /app\.js\?v=146/, "Controls tooltip wiring should advance the app cache query");
20
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v108"/, "Controls browser assets should advance the PWA cache identity");
21
+
22
+ console.log("controls-layout-static.test.mjs passed");
@@ -91,7 +91,7 @@ assert.match(resetCompactLiveOutput, /clearCompactThinkingDisclosureState\("live
91
91
  assert.match(compactFlush, /compactThinkingNode\?\._rawThinkingText !== compactLiveState\.thinking[\s\S]*?renderThinkingMarkdown\(compactThinkingNode, compactLiveState\.thinking\)/, "compact live thinking should preserve Markdown formatting");
92
92
  assert.doesNotMatch(compactFlush, /compactThinkingNode\.textContent|renderStreamingMarkdown|renderToolExecution|normalizeToolExecution/, "compact thinking must not fall back to plain text or invoke rich tool renderers");
93
93
  assert.doesNotMatch(compactToolShell, /normalizeToolExecution|toolExecutionRenderSignature|renderToolExecution|handleToolExecutionUpdate|JSON\.stringify/, "compact tool shells must defer rich bodies and raw serialization");
94
- assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\)\) applyTranscriptToolExecutionUpdate\(event\);/, "compact mode should not build intermediate rich tool updates");
94
+ assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\) && !isIntercomTransportToolName\(event\?\.toolName\)\) applyTranscriptToolExecutionUpdate\(event\);/, "compact mode and hidden Intercom transport should not build intermediate rich tool updates");
95
95
  assert.doesNotMatch(app, /case "tool_execution_update":/, "raw tool updates should have only the controller-owned dispatch path");
96
96
  assert.match(app, /case "tool_execution_end":[\s\S]*?compactLiveScheduler\.flushNow\(\)[\s\S]*?renderCompactToolShell\(event, \{ complete: true \}\)[\s\S]*?finishCompactLiveOutput\(tabContext\)/, "compact tool completion should remain lightweight and request final reconciliation");
97
97
  assert.match(resetStream, /resetCompactLiveOutput\(\{ remove: !preserveCompact \}\)/, "reset and tab changes should cancel compact pending work while exact compact settlement may retain its adopted owner");
@@ -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=121"/, "the guarded PWA entry point should cache-bust browser wiring");
159
+ assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=146"/, "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=107/, "integrated stylesheet changes should advance the cache query");
170
- assert.match(html, /\/app\.js\?v=121/, "integrated app changes should advance the cache query");
169
+ assert.match(html, /\/styles\.css\?v=123/, "integrated stylesheet changes should advance the cache query");
170
+ assert.match(html, /\/app\.js\?v=146/, "integrated app changes should advance the cache query");
171
171
 
172
172
  console.log("feature decision-output popup static checks passed");