@firstpick/pi-package-webui 0.8.5 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. package/README.md +18 -584
  2. package/bin/pi-webui-launcher.mjs +22 -0
  3. package/bin/pi-webui-update-supervisor.mjs +86 -0
  4. package/bin/pi-webui.mjs +933 -554
  5. package/index.ts +16 -6
  6. package/lib/component-update-state.mjs +21 -0
  7. package/lib/git-workflow-preferences.mjs +20 -2
  8. package/lib/optional-feature-catalog.mjs +1 -0
  9. package/lib/sampling-parameter-capabilities.mjs +160 -0
  10. package/lib/session-summary-core.mjs +4 -3
  11. package/lib/session-summary-preferences.mjs +16 -1
  12. package/lib/subagent-launch-slots.mjs +14 -2
  13. package/lib/trust-boundaries.mjs +16 -0
  14. package/lib/update/executor.mjs +99 -0
  15. package/lib/update/journal.mjs +175 -0
  16. package/lib/update/owners.mjs +70 -0
  17. package/lib/update/plan.mjs +134 -0
  18. package/lib/update/resolver.mjs +168 -0
  19. package/lib/update/supervisor.mjs +238 -0
  20. package/lib/update/verify.mjs +52 -0
  21. package/lib/update-commands.mjs +25 -13
  22. package/lib/webui-workspaces.mjs +17 -1
  23. package/lib/workspace-session-summaries.mjs +400 -0
  24. package/package.json +4 -4
  25. package/public/app.js +2487 -349
  26. package/public/index.html +200 -51
  27. package/public/middle-button-drag-scroll.mjs +154 -0
  28. package/public/sampling-parameter-controls.mjs +361 -0
  29. package/public/service-worker.js +5 -1
  30. package/public/stream-output-controller.mjs +327 -0
  31. package/public/styles.css +666 -71
  32. package/public/theme-contract.mjs +244 -0
  33. package/session-summary.ts +164 -4
  34. package/tests/aur-review-widget-static.test.mjs +2 -1
  35. package/tests/boot-failure-diagnostics.test.mjs +3 -3
  36. package/tests/browser/control-deck-component-updates.spec.mjs +20 -22
  37. package/tests/browser/interaction-continuity.spec.mjs +2 -2
  38. package/tests/browser/middle-button-drag-scroll.spec.mjs +145 -0
  39. package/tests/browser/persistent-ui-layout.spec.mjs +68 -23
  40. package/tests/browser/sampling-tooltip.spec.mjs +228 -0
  41. package/tests/browser/session-summary.spec.mjs +131 -3
  42. package/tests/browser/stream-output-isolation.spec.mjs +510 -0
  43. package/tests/browser/update-reconnect.spec.mjs +92 -0
  44. package/tests/codex-fast-mode-static.test.mjs +2 -2
  45. package/tests/common-options-submenus-interaction-static.test.mjs +172 -0
  46. package/tests/common-options-submenus-markup-static.test.mjs +152 -0
  47. package/tests/component-update-api-static.test.mjs +22 -61
  48. package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
  49. package/tests/control-deck-component-updates-static.test.mjs +13 -237
  50. package/tests/durable-rpc-supervisor-harness.test.mjs +3 -1
  51. package/tests/fast-mode-client-static.test.mjs +3 -2
  52. package/tests/feature-decision-output-popup-static.test.mjs +2 -2
  53. package/tests/feature-system-prompt-optional-feature-static.test.mjs +49 -0
  54. package/tests/fixtures/fake-pi.mjs +269 -2
  55. package/tests/fixtures/update/tree-timeout-descendant.mjs +6 -0
  56. package/tests/fixtures/update/tree-timeout-parent.mjs +11 -0
  57. package/tests/git-footer-context-menu-static.test.mjs +58 -0
  58. package/tests/git-workflow-preferences.test.mjs +7 -1
  59. package/tests/guided-git-aur-review.test.mjs +4 -3
  60. package/tests/http-endpoints-harness.test.mjs +274 -23
  61. package/tests/middle-button-drag-scroll-static.test.mjs +24 -0
  62. package/tests/middle-button-drag-scroll.test.mjs +170 -0
  63. package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
  64. package/tests/mobile-foundation-static.test.mjs +5 -6
  65. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  66. package/tests/mobile-static.test.mjs +85 -50
  67. package/tests/native-parity.test.mjs +1 -1
  68. package/tests/open-issue-wizard-static.test.mjs +2 -3
  69. package/tests/optional-feature-migration-frontend.test.mjs +9 -5
  70. package/tests/persistent-ui-layout-static.test.mjs +13 -2
  71. package/tests/questionnaire-dialog.test.mjs +3 -3
  72. package/tests/remote-auth-settings-harness.test.mjs +43 -0
  73. package/tests/rpc-supervisor-host.test.mjs +11 -2
  74. package/tests/safety-guard-auto-review-harness.test.mjs +117 -0
  75. package/tests/safety-guard-auto-review-static.test.mjs +34 -0
  76. package/tests/sampling-native-controls-user-flow.test.mjs +752 -0
  77. package/tests/sampling-parameter-capabilities.test.mjs +167 -0
  78. package/tests/sampling-parameter-controls.test.mjs +241 -0
  79. package/tests/session-sampling-helper.test.mjs +228 -0
  80. package/tests/session-sampling-http.test.mjs +168 -0
  81. package/tests/session-sampling-ui-static.test.mjs +370 -0
  82. package/tests/session-summary-core.test.mjs +205 -10
  83. package/tests/side-panel-section-height-removal-static.test.mjs +34 -0
  84. package/tests/side-panel-section-reorder-static.test.mjs +3 -3
  85. package/tests/staged-content-hash-contract.test.mjs +52 -11
  86. package/tests/stream-lifecycle-core.test.mjs +134 -0
  87. package/tests/stream-output-controller.test.mjs +252 -0
  88. package/tests/stream-output-isolation-static.test.mjs +89 -0
  89. package/tests/streaming-ui-coupling.test.mjs +50 -0
  90. package/tests/subagent-gate-visibility.test.mjs +1 -1
  91. package/tests/subagent-launch-slots-static.test.mjs +1 -1
  92. package/tests/subagent-launch-slots.test.mjs +18 -1
  93. package/tests/theme-contract.test.mjs +104 -0
  94. package/tests/theme-customizer-static.test.mjs +82 -0
  95. package/tests/theme-scheme-mode.test.mjs +15 -0
  96. package/tests/ui-layout-settings.test.mjs +18 -1
  97. package/tests/update-api-harness.test.mjs +111 -0
  98. package/tests/update-commands.test.mjs +15 -45
  99. package/tests/update-executor-process-tree-harness.test.mjs +22 -0
  100. package/tests/update-journal-harness.test.mjs +59 -0
  101. package/tests/update-lock-multiprocess-harness.test.mjs +46 -0
  102. package/tests/update-owners.test.mjs +27 -0
  103. package/tests/update-plan.test.mjs +58 -0
  104. package/tests/update-resolver.test.mjs +56 -0
  105. package/tests/update-supervisor-harness.test.mjs +57 -0
  106. package/tests/update-tab-restore-harness.test.mjs +24 -0
  107. package/tests/update-verify.test.mjs +31 -0
  108. package/tests/workspace-files-live-updates-static.test.mjs +13 -4
  109. package/tests/workspace-session-summaries.test.mjs +288 -0
  110. package/webui-rpc-helper.mjs +119 -0
@@ -1,6 +1,5 @@
1
1
  import assert from "node:assert/strict";
2
2
  import { readFile } from "node:fs/promises";
3
- import vm from "node:vm";
4
3
  import { dirname, join } from "node:path";
5
4
  import { fileURLToPath } from "node:url";
6
5
 
@@ -12,240 +11,17 @@ const [html, css, app, server, readme] = await Promise.all([
12
11
  readFile(join(root, "bin", "pi-webui.mjs"), "utf8"),
13
12
  readFile(join(root, "README.md"), "utf8"),
14
13
  ]);
15
-
16
- function functionSource(name, nextName) {
17
- const start = app.indexOf(`function ${name}(`);
18
- const end = app.indexOf(`\nfunction ${nextName}(`, start);
19
- assert.ok(start >= 0 && end > start, `${name} should remain a standalone frontend helper`);
20
- return app.slice(start, end);
21
- }
22
-
23
- const piDialog = html.match(/<dialog id="piReleaseNotesDialog"[\s\S]*?<\/dialog>/)?.[0] || "";
24
- assert.match(piDialog, /aria-labelledby="piReleaseNotesTitle"/, "the Pi version tag should keep its accessible release-notes dialog");
25
- assert.match(piDialog, /id="piComponentUpdateStatus"[^>]*role="status"[^>]*aria-live="polite"/, "the Pi dialog should announce component update state");
26
- assert.match(piDialog, /id="piComponentUpdateButton"[^>]*>Update Pi<\/button>/, "the Pi dialog should expose a targeted update action");
27
-
28
- const webuiDialog = html.match(/<dialog id="webuiPackageDialog"[\s\S]*?<\/dialog>/)?.[0] || "";
29
- assert.match(html, /id="webuiVersionButton"[^>]*aria-haspopup="dialog"[^>]*aria-controls="webuiPackageDialog"/, "the Web UI version tag should control its dedicated package dialog");
30
- assert.match(webuiDialog, /aria-labelledby="webuiPackageTitle"/, "the Web UI package dialog should have an accessible title");
31
- assert.match(webuiDialog, /<dt>Installed<\/dt>[\s\S]*id="webuiPackageCurrentVersion"[\s\S]*<dt>Latest on npm<\/dt>[\s\S]*id="webuiPackageLatestVersion"/, "the Web UI dialog should show installed and latest versions");
32
- assert.match(webuiDialog, /id="webuiPackageNpmButton"[^>]*>View on npm<\/button>/, "the Web UI dialog should retain the npm package action");
33
- assert.match(webuiDialog, /id="webuiComponentUpdateStatus"[^>]*role="status"[^>]*aria-live="polite"/, "the Web UI dialog should announce component update state");
34
- assert.match(webuiDialog, /id="webuiComponentUpdateButton"[^>]*>Update Web UI<\/button>/, "the Web UI dialog should expose a targeted update action");
35
- assert.match(app, /webuiPackageNpmButton\?\.addEventListener\("click", \(\) => \{[\s\S]*confirmOpenWebuiNpmPage\(\)/, "the package dialog npm action should reuse the guarded external-link flow");
36
-
37
- for (const state of ["available", "running", "succeeded", "failed"]) {
38
- assert.match(css, new RegExp(`\\.pi-version-button\\[data-update-state="${state}"\\]::after[\\s\\S]*\\.webui-version-button\\[data-update-state="${state}"\\]::after`), `both component tags should render the ${state} indicator`);
39
- }
40
- assert.match(css, /prefers-reduced-motion: reduce[\s\S]*data-update-state="running"/, "the running indicator should respect reduced-motion preferences");
41
-
42
- const renderPiVersionButtonSource = functionSource("renderPiVersionButton", "renderWebuiVersionButton");
43
- const renderWebuiVersionButtonSource = functionSource("renderWebuiVersionButton", "renderWebuiDevBadge");
44
- assert.match(renderPiVersionButtonSource, /componentUpdateTagState\("pi"\)[\s\S]*setAttribute\("aria-label", stateText/, "the Pi tag should use Pi-only state in its accessible name");
45
- assert.match(renderWebuiVersionButtonSource, /componentUpdateTagState\("webui"\)[\s\S]*setAttribute\("aria-label", stateText/, "the Web UI tag should use Web-UI-only state in its accessible name");
46
-
47
- const componentBlockStart = app.indexOf('const COMPONENT_UPDATE_TARGETS = ["pi", "webui"];');
48
- const componentBlockEnd = app.indexOf("\nfunction initializeUpdateNotifications()", componentBlockStart);
49
- assert.ok(componentBlockStart >= 0 && componentBlockEnd > componentBlockStart, "component update helpers should remain a focused frontend block");
50
- const componentBlock = app.slice(componentBlockStart, componentBlockEnd);
51
-
52
- const calls = [];
53
- const events = [];
54
- const scheduled = [];
55
- const cleared = [];
56
- const makeButton = () => ({
57
- hidden: false,
58
- textContent: "",
59
- title: "",
60
- disabled: false,
61
- dataset: {},
62
- attributes: {},
63
- setAttribute(name, value) { this.attributes[name] = value; },
64
- });
65
- const makeStatus = () => ({ textContent: "", hidden: false, dataset: {} });
66
- const elements = {
67
- piVersionButton: makeButton(),
68
- webuiVersionButton: makeButton(),
69
- piComponentUpdateStatus: makeStatus(),
70
- piComponentUpdateButton: makeButton(),
71
- webuiComponentUpdateStatus: makeStatus(),
72
- webuiComponentUpdateButton: makeButton(),
73
- webuiPackageCurrentVersion: makeStatus(),
74
- webuiPackageLatestVersion: makeStatus(),
75
- webuiPackageDialog: { open: false, showModal() { this.open = true; } },
76
- };
77
- let nextTimer = 1;
78
- let refreshShouldFail = false;
79
- const context = {
80
- elements,
81
- console,
82
- setTimeout(callback, delay) {
83
- const id = nextTimer++;
84
- scheduled.push({ id, callback, delay });
85
- return id;
86
- },
87
- clearTimeout(id) { cleared.push(id); },
88
- formatWebuiVersion(value) {
89
- const text = String(value || "").trim();
90
- return text ? (text.startsWith("v") ? text : `v${text}`) : "";
91
- },
92
- packageUpdateText(label, status = {}) {
93
- return `${label} ${status.currentVersion || ""} → ${status.latestVersion || ""}`.trim();
94
- },
95
- appConfirmText: async (_message, options) => {
96
- calls.push({ kind: "confirm", options });
97
- return true;
98
- },
99
- api: async (path, options) => {
100
- calls.push({ kind: "api", path, options });
101
- return { data: { target: options.body.target, state: "running", canStart: false, message: "Update is running." } };
102
- },
103
- addEvent(message, level) { events.push({ message, level }); },
104
- refreshUpdateStatus: async () => {
105
- if (refreshShouldFail) throw new Error("temporary status failure");
106
- return null;
107
- },
108
- };
109
- vm.runInNewContext(`
110
- let latestUpdateStatus = null;
111
- let piVersion = "0.83.0";
112
- let webuiVersion = "0.8.1";
113
- let componentUpdatePollTimer = null;
114
- let componentUpdateStartInProgress = false;
115
- let updateRequestInProgress = false;
116
- const COMPONENT_UPDATE_POLL_MS = 1000;
117
- ${renderPiVersionButtonSource}
118
- ${renderWebuiVersionButtonSource}
119
- ${componentBlock}
120
- globalThis.componentHarness = {
121
- setStatus(value) { latestUpdateStatus = value; },
122
- getStatus() { return latestUpdateStatus; },
123
- tagState: componentUpdateTagState,
124
- statusText: componentUpdateStatusText,
125
- buttonState: componentUpdateButtonState,
126
- renderIndicators: renderComponentUpdateIndicators,
127
- renderDialogs: renderComponentUpdateDialogs,
128
- syncPolling: syncComponentUpdatePolling,
129
- pollTimer() { return componentUpdatePollTimer; },
130
- start: startComponentUpdate,
131
- };
132
- `, context);
133
- const harness = context.componentHarness;
134
-
135
- harness.setStatus({
136
- updateInProgress: false,
137
- pi: { currentVersion: "0.83.0", latestVersion: "0.84.0", updateAvailable: true },
138
- webui: { currentVersion: "0.8.1", latestVersion: "0.8.1", updateAvailable: false, checked: true },
139
- componentUpdates: {
140
- pi: { target: "pi", state: "idle", canStart: true },
141
- webui: { target: "webui", state: "idle", canStart: true },
142
- },
143
- });
144
- harness.renderIndicators();
145
- assert.equal(elements.piVersionButton.dataset.updateState, "available", "Pi availability should mark only the Pi tag");
146
- assert.equal(elements.piVersionButton.attributes["aria-label"], "View Pi v0.83.0 release notes, update available", "Pi availability should be present in the accessible name");
147
- assert.equal(elements.webuiVersionButton.dataset.updateState, undefined, "Pi availability should not mark the Web UI tag");
148
- assert.doesNotMatch(elements.webuiVersionButton.attributes["aria-label"], /update available/, "Pi availability should not leak into the Web UI accessible name");
149
-
150
- harness.setStatus({
151
- updateInProgress: false,
152
- pi: { updateAvailable: true },
153
- webui: { updateAvailable: true },
154
- componentUpdates: {
155
- pi: { state: "succeeded", canStart: true, message: "Pi update completed." },
156
- webui: { state: "failed", canStart: true, message: "Web UI update failed.", error: "bounded failure" },
157
- },
158
- });
159
- assert.equal(harness.tagState("pi"), "succeeded", "terminal Pi success should outrank stale availability");
160
- assert.equal(harness.tagState("webui"), "failed", "terminal Web UI failure should outrank stale availability");
161
- assert.match(harness.statusText("pi").text, /New or reloaded Pi sessions use the update; already-running tabs keep their current runtime/, "Pi success should explain activation without interrupting active tabs");
162
- assert.match(harness.statusText("webui").text, /bounded failure[\s\S]*retry the update/, "Web UI failure should remain visible and permit retry");
163
- assert.equal(harness.buttonState("webui").label, "Retry Web UI update", "a failed Web UI update should expose retry");
164
- assert.equal(harness.buttonState("webui").disabled, false, "retry should be enabled when no update is running");
165
-
166
- harness.setStatus({
167
- updateInProgress: false,
168
- webui: { currentVersion: "0.8.1", latestVersion: "0.8.2", updateAvailable: true },
169
- componentUpdates: {
170
- pi: { state: "idle", canStart: true },
171
- webui: { state: "idle", canStart: false, unavailableReason: "Automatic Web UI update is unavailable from a source or development checkout." },
172
- },
173
- });
174
- assert.equal(harness.buttonState("webui").disabled, true, "source/development Web UI self-update should be disabled");
175
- assert.match(harness.statusText("webui").text, /source or development checkout/, "source/development refusal should be explained in the live status");
176
-
177
- harness.setStatus({
178
- updateInProgress: true,
179
- pi: { updateAvailable: true },
180
- webui: { updateAvailable: true },
181
- componentUpdates: {
182
- pi: { state: "running", canStart: false, message: "Updating Pi…" },
183
- webui: { state: "idle", canStart: false },
184
- },
185
- });
186
- assert.equal(harness.buttonState("pi").disabled, true, "the running target should reject duplicate starts");
187
- assert.equal(harness.buttonState("webui").disabled, true, "a running Pi update should disable the conflicting Web UI start");
188
- harness.syncPolling();
189
- assert.equal(scheduled.length, 1, "a running update should create one short polling timer");
190
- assert.equal(scheduled[0].delay, 1000, "running status should poll at the bounded one-second interval");
191
- harness.syncPolling();
192
- assert.equal(scheduled.length, 1, "re-rendering while running should not create duplicate poll timers");
193
- refreshShouldFail = true;
194
- scheduled[0].callback();
195
- await new Promise((resolve) => setImmediate(resolve));
196
- assert.equal(scheduled.length, 2, "a transient status failure should re-arm polling while the last known job remains running");
197
- assert.match(events.at(-1)?.message || "", /status check failed/i, "a transient polling failure should remain visible in the event log");
198
- refreshShouldFail = false;
199
- const rearmedTimer = harness.pollTimer();
200
- harness.setStatus({
201
- updateInProgress: false,
202
- componentUpdates: {
203
- pi: { state: "succeeded", canStart: true },
204
- webui: { state: "idle", canStart: true },
205
- },
206
- });
207
- harness.syncPolling();
208
- assert.deepEqual(cleared, [rearmedTimer], "terminal state should clear the re-armed running poll");
209
- assert.equal(harness.pollTimer(), null, "terminal state should release the polling timer reference");
210
-
211
- calls.length = 0;
212
- harness.setStatus({
213
- updateInProgress: false,
214
- pi: { currentVersion: "0.83.0", latestVersion: "0.84.0", updateAvailable: true },
215
- webui: { updateAvailable: false },
216
- componentUpdates: {
217
- pi: { state: "idle", canStart: true },
218
- webui: { state: "idle", canStart: true },
219
- },
220
- });
221
- await harness.start("pi");
222
- const piStartCall = calls.find((call) => call.kind === "api");
223
- assert.equal(piStartCall?.path, "/api/component-update", "the Pi dialog should use the component-update endpoint");
224
- assert.equal(piStartCall?.options.method, "POST", "component update starts should use POST");
225
- assert.equal(piStartCall?.options.scoped, false, "component update starts should not inherit a Pi tab scope");
226
- assert.equal(JSON.stringify(piStartCall?.options.body), '{"target":"pi"}', "the Pi dialog should send only the exact Pi target");
227
- assert.equal(harness.getStatus().componentUpdates.pi.state, "running", "the accepted 202-shaped state should render immediately as running");
228
- assert.equal(harness.buttonState("pi").disabled, true, "the accepted job should immediately disable duplicate starts");
229
- assert.match(componentBlock, /statusElement\.hidden = false;[\s\S]*statusElement\.textContent = text;/, "component live regions should remain rendered before their status text changes");
230
- assert.match(app, /openPiReleaseNotes\(\)[\s\S]*refreshUpdateStatus\(\{ notify: false \}\)/, "opening Pi details should refresh component status even when cached state exists");
231
-
232
- assert.match(
233
- server,
234
- /url\.pathname === "\/api\/component-update" && req\.method === "POST"[\s\S]*requireLocalhostRoute\(req, url\.pathname\)[\s\S]*validateComponentUpdateRequest\(body\)[\s\S]*sendJson\(res, 202/,
235
- "the server should keep exact validation, localhost restriction, and 202 acceptance for component starts",
236
- );
237
- assert.match(
238
- app,
239
- /async function runPiUpdateAndRestart\([\s\S]*api\(all \? "\/api\/update\?all=1" : "\/api\/update", \{ method: "POST", scoped: false \}\)[\s\S]*waitForServerRestart\(\)/,
240
- "the legacy browser update-and-restart flow should remain compatible",
241
- );
242
- assert.match(
243
- server,
244
- /url\.pathname === "\/api\/update" && req\.method === "POST"[\s\S]*runPiUpdateAndPrepareRestart\(\{ all: queryAll \|\| bodyAll \}\)[\s\S]*sendJson\(res, 200[\s\S]*shutdown\("api update", \{ preserveSessions: true \}\)/,
245
- "the legacy server route should retain update-all selection, completion response, restart, and managed-session preservation",
246
- );
247
- assert.match(readme, /Control Deck component updates[\s\S]*component-specific `available`, `running`, `succeeded`, or `failed` status/, "README should explain the component-specific tag indicators");
248
- assert.match(readme, /Update Pi[\s\S]*does not restart the Web UI or interrupt managed Pi tabs[\s\S]*Update Web UI[\s\S]*restart the Web UI after success/, "README should explain Pi and Web UI activation behavior");
249
- assert.match(readme, /only from localhost[\s\S]*disabled for source\/development checkouts[\s\S]*verify the installed version before retrying[\s\S]*broader legacy behavior/, "README should document security, source refusal, recovery, and legacy compatibility");
250
-
14
+ assert.match(html, /id="piComponentUpdateStatus"[^>]*aria-live="polite"/);
15
+ assert.match(html, /id="webuiComponentUpdateStatus"[^>]*aria-live="polite"/);
16
+ for (const state of ["available", "running", "succeeded", "failed"]) assert.match(css, new RegExp(`data-update-state="${state}"`));
17
+ assert.match(app, /api\("\/api\/update\/plan", \{ method: "POST", body: \{ targets: \[target\] \}/);
18
+ assert.match(app, /Exact plan digest: \$\{plan\.digest\}/);
19
+ assert.match(app, /api\("\/api\/update\/apply", \{ method: "POST", body: \{ transactionId: plan\.transactionId, planDigest: plan\.digest \}/);
20
+ assert.match(app, /function piUpdateConfirmationText\(\{ all = false, plan = null \} = \{\}\)[\s\S]*Exact immutable plan digest/);
21
+ assert.match(app, /will not re-resolve latest or scan package roots/);
22
+ assert.match(app, /function separatePathPiPlanNotice\(plan\)[\s\S]*PATH Pi[\s\S]*separate installation[\s\S]*will remain untouched/);
23
+ assert.match(app, /async function waitForServerRestart\(previousBootIdentity = serverBootIdentity\)[\s\S]*Date\.now\(\) \+ 90_000[\s\S]*health\.bootIdentity === previousBootIdentity/);
24
+ assert.match(server, /bootIdentity,[\s\S]*startupPhase:/);
25
+ assert.match(server, /url\.pathname === "\/api\/update\/rollback"[\s\S]*assertUpdatePlanDigest/);
26
+ assert.match(readme, /exact-target plan|plan digest/i);
251
27
  console.log("control deck component update static tests passed");
@@ -253,7 +253,9 @@ try {
253
253
  return false;
254
254
  }, { timeoutMs: 12_000 });
255
255
  const exitEntries = (await readLog(logFile)).filter((entry) => entry.direction === "exit" && entry.pid === observedPiPid);
256
- assert.ok(exitEntries.some((entry) => entry.signal === "SIGTERM"), "explicit shutdown must produce the fake-Pi termination marker");
256
+ if (process.platform !== "win32") {
257
+ assert.ok(exitEntries.some((entry) => entry.signal === "SIGTERM"), "explicit shutdown must produce the fake-Pi termination marker");
258
+ }
257
259
  console.log(`durable-rpc-supervisor-harness.test.mjs passed (Pi PID ${observedPiPid}; tab ${observedTabId})`);
258
260
  } finally {
259
261
  const liveServer = manualServer?.exitCode === null ? manualServer : initialServer?.exitCode === null ? initialServer : null;
@@ -91,7 +91,8 @@ 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, /case "tool_execution_update":\s+if \(!compactOutputActive\(\)\) handleToolExecutionUpdate\(event\);/, "compact mode should not build intermediate rich tool updates");
94
+ assert.match(app, /applyToolExecutionUpdate: \(event\) => \{\s+if \(!compactOutputActive\(\)\) applyTranscriptToolExecutionUpdate\(event\);/, "compact mode should not build intermediate rich tool updates");
95
+ assert.doesNotMatch(app, /case "tool_execution_update":/, "raw tool updates should have only the controller-owned dispatch path");
95
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");
96
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");
97
98
  assert.match(app, /case "message_end": \{\s+if \(compactOutputActive\(\)\) finishCompactLiveOutput\(tabContext\);/, "message ends should synchronously flush compact output before reconciliation");
@@ -155,7 +156,7 @@ assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA
155
156
  assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
156
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");
157
158
  // Intent preserved: the guarded PWA entry point must advance whenever app wiring changes.
158
- assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=113"/, "the guarded PWA entry point should cache-bust browser wiring");
159
+ assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=120"/, "the guarded PWA entry point should cache-bust browser wiring");
159
160
  assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
160
161
 
161
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=98/, "integrated stylesheet changes should advance the cache query");
170
- assert.match(html, /\/app\.js\?v=113/, "integrated app changes should advance the cache query");
169
+ assert.match(html, /\/styles\.css\?v=104/, "integrated stylesheet changes should advance the cache query");
170
+ assert.match(html, /\/app\.js\?v=120/, "integrated app changes should advance the cache query");
171
171
 
172
172
  console.log("feature decision-output popup static checks passed");
@@ -0,0 +1,49 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+
4
+ const [catalog, app, readme, manifest] = await Promise.all([
5
+ readFile(new URL("../lib/optional-feature-catalog.mjs", import.meta.url), "utf8"),
6
+ readFile(new URL("../public/app.js", import.meta.url), "utf8"),
7
+ readFile(new URL("../README.md", import.meta.url), "utf8"),
8
+ readFile(new URL("../../pi-extension-feature-system-prompt/package.json", import.meta.url), "utf8").then(JSON.parse),
9
+ ]);
10
+
11
+ assert.equal(manifest.name, "@firstpick/pi-extension-feature-system-prompt");
12
+ assert.equal(manifest.version, "0.1.3");
13
+ assert.match(
14
+ catalog,
15
+ /\["featureSystemPrompt", "@firstpick\/pi-extension-feature-system-prompt", "\^0\.1\.3"\]/,
16
+ "the shared server catalog should allow Pi to install and audit the feature-routing package",
17
+ );
18
+ assert.match(
19
+ app,
20
+ /featureSystemPrompt: false,[\s\S]*?id: "featureSystemPrompt",[\s\S]*?packageName: "@firstpick\/pi-extension-feature-system-prompt"/,
21
+ "browser availability state and optional-feature metadata should use the same feature id and package",
22
+ );
23
+ assert.match(
24
+ app,
25
+ /featureIds: \["gitWorkflow", "workflows", "featureSystemPrompt", "releaseNpm", "releaseAur", "aurReview"\]/,
26
+ "the package should appear in the Workflows & releases section",
27
+ );
28
+ assert.match(
29
+ app,
30
+ /function renderFeatureCategoryTag\([\s\S]*?isOptionalFeatureEnabled\("featureSystemPrompt"\)/,
31
+ "the package-specific composer integration should honor the browser Optional Features toggle",
32
+ );
33
+ assert.match(
34
+ app,
35
+ /function handleFeatureDecisionOutputStatus\([\s\S]*?optionalFeatureAvailability\.featureSystemPrompt = true;[\s\S]*?function handleFeatureCategoryStatus\([\s\S]*?optionalFeatureAvailability\.featureSystemPrompt = true;/,
36
+ "either extension-owned status should mark the package integration as detected",
37
+ );
38
+ assert.match(
39
+ app,
40
+ /featureId === "featureSystemPrompt"[\s\S]*?clearFeatureDecisionStateForTab/,
41
+ "disabling the optional integration should clear replayed classifier state",
42
+ );
43
+ assert.match(
44
+ readme,
45
+ /`@firstpick\/pi-extension-feature-system-prompt` — feature-request classification and routing/,
46
+ "the optional companion list should document the new package",
47
+ );
48
+
49
+ console.log("feature-system-prompt optional-feature static tests passed");