@firstpick/pi-package-webui 0.8.3 → 0.8.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/README.md +67 -16
  2. package/bin/pi-webui.mjs +777 -131
  3. package/lib/WEBUI_TUI_NATIVE_PARITY.json +26 -0
  4. package/lib/optional-feature-catalog.mjs +29 -0
  5. package/lib/optional-feature-migration.mjs +410 -0
  6. package/lib/session-summary-core.mjs +320 -0
  7. package/lib/session-summary-preferences.mjs +267 -0
  8. package/package.json +5 -42
  9. package/public/app.js +1325 -51
  10. package/public/index.html +43 -1
  11. package/public/service-worker.js +1 -1
  12. package/public/styles.css +345 -1
  13. package/session-summary.ts +403 -0
  14. package/tests/aur-review-widget-static.test.mjs +3 -2
  15. package/tests/boot-failure-diagnostics.test.mjs +2 -2
  16. package/tests/browser/session-summary.spec.mjs +271 -0
  17. package/tests/codex-fast-mode-static.test.mjs +10 -9
  18. package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
  19. package/tests/fast-mode-client-static.test.mjs +1 -1
  20. package/tests/feature-decision-output-popup-static.test.mjs +1 -1
  21. package/tests/http-endpoints-harness.test.mjs +429 -3
  22. package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
  23. package/tests/mobile-foundation-static.test.mjs +2 -2
  24. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  25. package/tests/mobile-static.test.mjs +91 -92
  26. package/tests/native-parity-harness.test.mjs +9 -1
  27. package/tests/native-parity.test.mjs +23 -1
  28. package/tests/open-issue-wizard-static.test.mjs +1 -1
  29. package/tests/optional-feature-migration-frontend.test.mjs +75 -0
  30. package/tests/optional-feature-migration.test.mjs +142 -0
  31. package/tests/persistent-ui-layout-static.test.mjs +2 -2
  32. package/tests/questionnaire-dialog.test.mjs +2 -2
  33. package/tests/session-summary-core.test.mjs +491 -0
  34. package/tests/session-summary-preferences.test.mjs +103 -0
  35. package/tests/side-panel-section-reorder-static.test.mjs +2 -2
@@ -6,12 +6,15 @@ import { networkInterfaces, tmpdir } from "node:os";
6
6
  import path from "node:path";
7
7
  import { setTimeout as delay } from "node:timers/promises";
8
8
  import { dirname, join } from "node:path";
9
- import { fileURLToPath } from "node:url";
9
+ import { fileURLToPath, pathToFileURL } from "node:url";
10
+ import { terminateProcessTree } from "../lib/process-tree.mjs";
11
+ import { readSupervisorState, supervisorPaths, supervisorPidIsAlive } from "../lib/rpc-supervisor-state.mjs";
10
12
 
11
13
  const root = join(dirname(fileURLToPath(import.meta.url)), "..");
12
14
  const serverScript = join(root, "bin", "pi-webui.mjs");
13
15
  const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
14
16
  const port = 30000 + Math.floor(Math.random() * 20000);
17
+ const optionalFeatureFocus = process.env.PI_WEBUI_OPTIONAL_FEATURES_FOCUS === "1";
15
18
 
16
19
  function lanAddress() {
17
20
  for (const entries of Object.values(networkInterfaces())) {
@@ -119,6 +122,7 @@ const harnessSideEffectsRoot = await mkdtemp(path.join(tmpdir(), "pi-webui-http-
119
122
  const settingsFile = path.join(harnessSideEffectsRoot, "webui-settings.json");
120
123
  const workflowPolicyAgentDir = path.join(harnessSideEffectsRoot, "agent");
121
124
  const workflowPolicyFile = path.join(workflowPolicyAgentDir, "workflow-policy.json");
125
+ const sessionSummaryConfigFile = path.join(workflowPolicyAgentDir, "session-summary.json");
122
126
  const canonicalWorkflowPolicySuggestions = {
123
127
  shellAllowlist: ["git", "node", "npm"],
124
128
  networkAllowlist: ["api.github.com", "registry.npmjs.org"],
@@ -126,6 +130,8 @@ const canonicalWorkflowPolicySuggestions = {
126
130
  };
127
131
  const openCommandLog = path.join(harnessSideEffectsRoot, "open-default.log");
128
132
  const fakePiCommandLog = path.join(harnessSideEffectsRoot, "fake-pi-commands.jsonl");
133
+ const fakePiCliLog = path.join(harnessSideEffectsRoot, "fake-pi-cli.jsonl");
134
+ const fakePiCli = path.join(harnessSideEffectsRoot, "fake-pi-cli.mjs");
129
135
  const recoveryEndpointToken = "test-recovery-token-6e1cc61d22d44c8dbf3c";
130
136
  const openCommandScript = path.join(harnessSideEffectsRoot, "fake-open-default.mjs");
131
137
  const fakeOpenBinDir = path.join(harnessSideEffectsRoot, "bin");
@@ -142,6 +148,43 @@ await writeFile(path.join(fakeOpenBinDir, "xdg-open"), `#!/usr/bin/env node\nimp
142
148
  await writeFile(path.join(fakeOpenBinDir, "gio"), `#!/usr/bin/env node\nimport { appendFile } from "node:fs/promises";\nawait appendFile(process.env.PI_WEBUI_OPEN_LOG, "gio\\t" + process.argv.slice(2).join("\\t") + "\\n", "utf8");\n`, "utf8");
143
149
  await writeFile(path.join(fakeOpenBinDir, "xdg-mime"), `#!/usr/bin/env node\nconst [,, verb, mode, value = ""] = process.argv;\nif (verb === "query" && mode === "filetype") {\n if (value.endsWith(".piunknown")) console.log("application/x-pi-unknown");\n else if (value.endsWith(".md")) console.log("text/markdown");\n else console.log("text/plain");\n process.exit(0);\n}\nif (verb === "query" && mode === "default") {\n if (value === "text/plain") console.log("fake-text-editor.desktop");\n process.exit(0);\n}\nprocess.exit(1);\n`, "utf8");
144
150
  await Promise.all(["xdg-open", "gio", "xdg-mime"].map((name) => chmod(path.join(fakeOpenBinDir, name), 0o755)));
151
+ await writeFile(fakePiCli, `#!/usr/bin/env node
152
+ import { appendFile, cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
153
+ import path from "node:path";
154
+ const args = process.argv.slice(2);
155
+ const log = async (entry) => appendFile(process.env.FAKE_PI_CLI_LOG, JSON.stringify({ at: Date.now(), ...entry }) + "\\n", "utf8");
156
+ process.on("SIGTERM", () => process.exit(143));
157
+ process.on("SIGINT", () => process.exit(130));
158
+ if (args[0] === "install") {
159
+ const source = String(args[1] || "");
160
+ await log({ event: "start", args });
161
+ if (source === "npm:@firstpick/pi-extension-stats") {
162
+ console.error("fixture Pi install failure for stats");
163
+ await log({ event: "finish", args, exitCode: 17 });
164
+ process.exitCode = 17;
165
+ } else {
166
+ const packageName = source.startsWith("npm:") ? source.slice(4) : "";
167
+ const sourceRoot = path.join(${JSON.stringify(path.dirname(root))}, packageName.split("/").at(-1));
168
+ const installRoot = path.join(process.env.PI_CODING_AGENT_DIR, "npm", "node_modules", ...packageName.split("/"));
169
+ await mkdir(path.dirname(installRoot), { recursive: true });
170
+ await rm(installRoot, { recursive: true, force: true });
171
+ await cp(sourceRoot, installRoot, { recursive: true });
172
+ const settingsPath = path.join(process.env.PI_CODING_AGENT_DIR, "settings.json");
173
+ const settings = JSON.parse(await readFile(settingsPath, "utf8").catch(() => "{}"));
174
+ const packages = Array.isArray(settings.packages) ? settings.packages : [];
175
+ if (!packages.some((entry) => (typeof entry === "string" ? entry : entry?.source) === source)) packages.push(source);
176
+ settings.packages = packages;
177
+ await mkdir(path.dirname(settingsPath), { recursive: true });
178
+ await writeFile(settingsPath, JSON.stringify(settings, null, 2) + "\\n", "utf8");
179
+ console.log("installed " + source);
180
+ await log({ event: "finish", args, exitCode: 0 });
181
+ }
182
+ } else {
183
+ await log({ event: "rpc", args });
184
+ await import(${JSON.stringify(pathToFileURL(fakePi).href)});
185
+ }
186
+ `, "utf8");
187
+ await chmod(fakePiCli, 0o755);
145
188
 
146
189
  const voiceProviderRequests = [];
147
190
  const voiceProvider = createServer(async (req, res) => {
@@ -176,7 +219,7 @@ const voiceProvider = createServer(async (req, res) => {
176
219
  await new Promise((resolve) => voiceProvider.listen(0, "127.0.0.1", resolve));
177
220
  const voiceProviderPort = voiceProvider.address().port;
178
221
 
179
- const child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "0.0.0.0", "--port", String(port), "--pi", fakePi], {
222
+ const child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "0.0.0.0", "--port", String(port), "--pi", fakePiCli], {
180
223
  stdio: ["ignore", "pipe", "pipe"],
181
224
  env: {
182
225
  ...process.env,
@@ -187,6 +230,7 @@ const child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "0.
187
230
  PATH: `${fakeOpenBinDir}${path.delimiter}${process.env.PATH || ""}`,
188
231
  PI_CODING_AGENT_DIR: workflowPolicyAgentDir,
189
232
  PI_WEBUI_SETTINGS_FILE: settingsFile,
233
+ PI_SESSION_SUMMARY_CONFIG_FILE: sessionSummaryConfigFile,
190
234
  PI_WEBUI_RPC_SUPERVISOR: "1",
191
235
  ...(process.platform === "linux" ? {} : { PI_WEBUI_OPEN_COMMAND: openCommandScript }),
192
236
  PI_WEBUI_OPEN_LOG: openCommandLog,
@@ -194,6 +238,7 @@ const child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "0.
194
238
  FAKE_PI_ARTIFACT_MANIFEST: artifactManifest,
195
239
  FAKE_PI_ARTIFACT_DOWNLOAD: artifactDownload,
196
240
  FAKE_PI_LOG_FILE: fakePiCommandLog,
241
+ FAKE_PI_CLI_LOG: fakePiCliLog,
197
242
  FAKE_PI_VOICE_SCRIPTS: "1",
198
243
  FAKE_PI_LARGE_PAYLOADS: "1",
199
244
  PI_WEBUI_RECOVERY_TOKEN: recoveryEndpointToken,
@@ -210,6 +255,174 @@ child.stderr.on("data", (chunk) => {
210
255
  serverOutput += String(chunk);
211
256
  });
212
257
 
258
+ async function verifyTopLevelOptionalFeatureProtection(tabId) {
259
+ const extensionsDir = path.join(workflowPolicyAgentDir, "extensions");
260
+ const aliasPath = path.join(extensionsDir, "aur-review-local");
261
+ await mkdir(extensionsDir, { recursive: true });
262
+ await rm(aliasPath, { recursive: true, force: true });
263
+ await symlink(path.join(path.dirname(root), "pi-extension-aur-review"), aliasPath, process.platform === "win32" ? "junction" : "dir");
264
+ try {
265
+ const recheckResponse = await request("127.0.0.1", "/api/optional-feature-migration/recheck", { method: "POST", body: {} });
266
+ assert.equal(recheckResponse.status, 200, recheckResponse.body?.error);
267
+ const statusResponse = await request("127.0.0.1", "/api/optional-features");
268
+ const status = statusResponse.body?.data?.features?.find(({ featureId }) => featureId === "aurReview");
269
+ assert.equal(statusResponse.status, 200);
270
+ assert.equal(status?.configured, false, "a top-level resource should remain distinct from package registration");
271
+ assert.equal(status?.locallyConfigured, true, "an enabled top-level resource should be recognized as locally configured");
272
+ assert.equal(status?.ready, true, "an installed top-level resource should be ready without duplicate package registration");
273
+ assert.equal(status?.resourceConflict, false);
274
+ assert.equal(Object.hasOwn(status || {}, "installedRoot"), false, "browser audit payloads must not expose install paths");
275
+ assert.equal(Object.hasOwn(status || {}, "topLevelResources"), false, "browser audit payloads must not expose resource paths");
276
+ assert.equal(status?.state, "local-resource");
277
+
278
+ const logOffset = (await readJsonLines(fakePiCliLog)).length;
279
+ const installResponse = await request("127.0.0.1", "/api/optional-feature-install", {
280
+ method: "POST",
281
+ body: { tab: tabId, featureId: "aurReview" },
282
+ });
283
+ assert.equal(installResponse.status, 409, "npm registration should be blocked before it can duplicate an enabled top-level resource");
284
+ assert.equal(installResponse.body?.optionalFeatureInstall?.kind, "local-resource-conflict");
285
+ assert.equal((await readJsonLines(fakePiCliLog)).length, logOffset, "a blocked duplicate registration must not launch Pi install");
286
+ } finally {
287
+ await rm(aliasPath, { recursive: true, force: true });
288
+ await request("127.0.0.1", "/api/optional-feature-migration/recheck", { method: "POST", body: {} });
289
+ }
290
+ }
291
+
292
+ async function runOptionalFeatureFocus() {
293
+ const tabs = await request("127.0.0.1", "/api/tabs");
294
+ const tabId = tabs.body?.data?.tabs?.[0]?.id;
295
+ assert.ok(tabId, "focused optional-feature checks require the startup tab");
296
+
297
+ const manifest = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
298
+ assert.deepEqual(manifest.optionalDependencies, { "node-pty": "^1.1.0" });
299
+ assert.equal(manifest.dependencies?.["@firstpick/pi-utils"], "^0.2.5");
300
+ assert.equal(JSON.stringify(manifest.pi).includes("node_modules/@firstpick"), false);
301
+
302
+ const initial = await request("127.0.0.1", "/api/optional-features");
303
+ assert.equal(initial.status, 200);
304
+ assert.equal(initial.body?.data?.features?.length, 19);
305
+ const aurBefore = initial.body?.data?.features?.find(({ featureId }) => featureId === "aurReview");
306
+ assert.deepEqual({ installed: aurBefore?.installed, configured: aurBefore?.configured, ready: aurBefore?.ready }, { installed: true, configured: false, ready: false });
307
+ assert.equal(aurBefore?.expectedSpec, "^0.1.1");
308
+ await verifyTopLevelOptionalFeatureProtection(tabId);
309
+
310
+ const single = await request("127.0.0.1", "/api/optional-feature-install", {
311
+ method: "POST",
312
+ body: { tab: tabId, featureId: "aurReview" },
313
+ timeoutMs: 10_000,
314
+ });
315
+ assert.equal(single.status, 200, single.body?.error);
316
+ assert.match(single.body?.data?.command || "", /install npm:@firstpick\/pi-extension-aur-review$/);
317
+ assert.deepEqual({
318
+ installed: single.body?.data?.status?.installed,
319
+ configured: single.body?.data?.status?.configured,
320
+ ready: single.body?.data?.status?.ready,
321
+ }, { installed: true, configured: true, ready: true });
322
+
323
+ const conflictExtensionsDir = path.join(workflowPolicyAgentDir, "extensions");
324
+ const conflictAliasPath = path.join(conflictExtensionsDir, "aur-review-conflict");
325
+ await mkdir(conflictExtensionsDir, { recursive: true });
326
+ await symlink(path.join(path.dirname(root), "pi-extension-aur-review"), conflictAliasPath, process.platform === "win32" ? "junction" : "dir");
327
+ try {
328
+ const conflictAudit = await request("127.0.0.1", "/api/optional-feature-migration/recheck", { method: "POST", body: {} });
329
+ const conflictFeature = conflictAudit.body?.data?.features?.find(({ featureId }) => featureId === "aurReview");
330
+ assert.equal(conflictFeature?.state, "conflict");
331
+ assert.equal(conflictFeature?.resourceConflict, true);
332
+ const conflictTab = await request("127.0.0.1", "/api/tabs", { method: "POST", body: { cwd, title: "conflict-safe optional package" } });
333
+ assert.equal(conflictTab.status, 201, conflictTab.body?.error);
334
+ const conflictRpcArgs = (await readJsonLines(fakePiCliLog)).filter(({ event }) => event === "rpc").at(-1)?.args || [];
335
+ const normalizedConflictArgs = conflictRpcArgs.map((arg) => String(arg).replace(/\\/g, "/"));
336
+ assert.equal(normalizedConflictArgs.some((arg) => arg.includes("/extensions/aur-review-conflict/")), false, "conflicting top-level alias must be excluded from RPC args");
337
+ assert.equal(normalizedConflictArgs.filter((arg) => arg.endsWith("/pi-extension-aur-review/index.ts")).length, 1, "registered package remains canonical during a conflict");
338
+ await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [conflictTab.body?.data?.tab?.id] } });
339
+ } finally {
340
+ await rm(conflictAliasPath, { recursive: true, force: true });
341
+ await request("127.0.0.1", "/api/optional-feature-migration/recheck", { method: "POST", body: {} });
342
+ }
343
+
344
+ const summaryFileAlias = path.join(workflowPolicyAgentDir, "extensions", "session-summary.ts");
345
+ await mkdir(path.dirname(summaryFileAlias), { recursive: true });
346
+ await symlink(path.join(root, "session-summary.ts"), summaryFileAlias);
347
+ try {
348
+ const resourceTab = await request("127.0.0.1", "/api/tabs", { method: "POST", body: { cwd, title: "configured optional package" } });
349
+ assert.equal(resourceTab.status, 201, resourceTab.body?.error);
350
+ const rpcArgs = (await readJsonLines(fakePiCliLog)).filter(({ event }) => event === "rpc").at(-1)?.args || [];
351
+ const normalizedArgs = rpcArgs.map((arg) => String(arg).replace(/\\/g, "/"));
352
+ const normalizedSummaryAlias = summaryFileAlias.replace(/\\/g, "/");
353
+ assert.equal(normalizedArgs.filter((arg) => arg.endsWith("/pi-extension-aur-review/index.ts")).length, 1);
354
+ assert.equal(normalizedArgs.filter((arg) => arg.endsWith("/pi-package-webui/index.ts")).length, 1);
355
+ assert.equal(normalizedArgs.filter((arg) => arg.endsWith("/pi-package-webui/session-summary.ts")).length, 1, "the started WebUI package should contribute one canonical summary extension");
356
+ assert.equal(normalizedArgs.includes(normalizedSummaryAlias), false, "a top-level file symlink into the WebUI package must not duplicate the canonical summary extension");
357
+ await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [resourceTab.body?.data?.tab?.id] } });
358
+ } finally {
359
+ await rm(summaryFileAlias, { force: true });
360
+ }
361
+
362
+ const batchPlan = await request("127.0.0.1", "/api/optional-features");
363
+ const batchRevision = batchPlan.body?.data?.revision;
364
+ assert.match(batchRevision || "", /^sha256:[a-f0-9]{64}$/);
365
+ assert.equal((await request("127.0.0.1", "/api/optional-feature-install-batch", { method: "POST", body: { tab: tabId, revision: batchRevision, featureIds: "aurReview" } })).status, 400);
366
+ assert.equal((await request("127.0.0.1", "/api/optional-feature-install-batch", { method: "POST", body: { tab: tabId, revision: batchRevision, featureIds: ["not-allowlisted"] } })).status, 400);
367
+ assert.equal((await request("127.0.0.1", "/api/optional-feature-install-batch", { method: "POST", body: { tab: tabId, revision: batchRevision, featureIds: Array(20).fill("aurReview") } })).status, 400);
368
+ assert.equal((await request("127.0.0.1", "/api/optional-feature-install-batch", { method: "POST", body: { tab: tabId, revision: "sha256:stale", featureIds: ["aurReview"] } })).status, 409);
369
+
370
+ const logOffset = (await readJsonLines(fakePiCliLog)).length;
371
+ const batch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
372
+ method: "POST",
373
+ body: { tab: tabId, revision: batchRevision, featureIds: ["bangCommandAutocomplete", "statsCommand", "bangCommandAutocomplete", "gitFooterStatus"] },
374
+ timeoutMs: 20_000,
375
+ });
376
+ assert.equal(batch.status, 200, batch.body?.error);
377
+ assert.deepEqual(batch.body?.data?.featureIds, ["bangCommandAutocomplete", "statsCommand", "gitFooterStatus"]);
378
+ assert.deepEqual(batch.body?.data?.results?.map(({ featureId, ok }) => [featureId, ok]), [
379
+ ["bangCommandAutocomplete", true], ["statsCommand", false], ["gitFooterStatus", true],
380
+ ]);
381
+ assert.deepEqual([batch.body?.data?.total, batch.body?.data?.succeeded, batch.body?.data?.failed], [3, 2, 1]);
382
+ assert.equal(batch.body?.data?.results?.[1]?.optionalFeatureInstall?.exitCode, 17);
383
+ assert.match(batch.body?.data?.results?.[1]?.optionalFeatureInstall?.outputTail || "", /fixture Pi install failure/);
384
+ const sequence = (await readJsonLines(fakePiCliLog)).slice(logOffset).filter(({ event }) => event === "start" || event === "finish");
385
+ assert.deepEqual(sequence.map(({ event, args, exitCode }) => [event, args?.[1], exitCode]), [
386
+ ["start", "npm:@firstpick/pi-extension-bang-command-autocomplete", undefined],
387
+ ["finish", "npm:@firstpick/pi-extension-bang-command-autocomplete", 0],
388
+ ["start", "npm:@firstpick/pi-extension-stats", undefined],
389
+ ["finish", "npm:@firstpick/pi-extension-stats", 17],
390
+ ["start", "npm:@firstpick/pi-extension-git-footer-status", undefined],
391
+ ["finish", "npm:@firstpick/pi-extension-git-footer-status", 0],
392
+ ]);
393
+
394
+ const progressSnapshot = (await request("127.0.0.1", "/api/optional-features")).body?.data;
395
+ assert.equal(progressSnapshot?.phase, "partial");
396
+ assert.deepEqual([progressSnapshot?.progress?.succeeded, progressSnapshot?.progress?.failed], [2, 1]);
397
+ assert.equal(progressSnapshot?.progress?.results?.length, 3);
398
+
399
+ const rpcLaunchCountBeforeSuccess = (await readJsonLines(fakePiCliLog)).filter(({ event }) => event === "rpc").length;
400
+ const successfulBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
401
+ method: "POST",
402
+ body: { tab: tabId, revision: progressSnapshot.revision, featureIds: ["releaseAur"] },
403
+ timeoutMs: 20_000,
404
+ });
405
+ assert.equal(successfulBatch.status, 200, successfulBatch.body?.error);
406
+ assert.deepEqual(successfulBatch.body?.data?.restart, { autoRestarted: true, restartDeferred: false });
407
+ let rpcLaunchCountAfterSuccess = rpcLaunchCountBeforeSuccess;
408
+ for (let attempt = 0; attempt < 20 && rpcLaunchCountAfterSuccess === rpcLaunchCountBeforeSuccess; attempt++) {
409
+ await delay(50);
410
+ rpcLaunchCountAfterSuccess = (await readJsonLines(fakePiCliLog)).filter(({ event }) => event === "rpc").length;
411
+ }
412
+ assert.equal(rpcLaunchCountAfterSuccess, rpcLaunchCountBeforeSuccess + 1, "an idle tab should restart automatically after a fully successful batch");
413
+ const completedSnapshot = (await request("127.0.0.1", "/api/optional-features")).body?.data;
414
+ assert.equal(completedSnapshot?.phase, "complete");
415
+ assert.equal(completedSnapshot?.progress?.autoRestarted, true);
416
+
417
+ const lanHost = lanAddress();
418
+ if (lanHost) assert.equal((await request(lanHost, "/api/optional-feature-install-batch", { method: "POST", body: { tab: tabId, revision: batchRevision, featureIds: ["aurReview"] } })).status, 403);
419
+
420
+ const shutdownResponse = await request("127.0.0.1", "/api/shutdown", { method: "POST", body: {} });
421
+ assert.equal(shutdownResponse.status, 200);
422
+ for (let attempt = 0; attempt < 50 && child.exitCode === null; attempt++) await delay(100);
423
+ assert.notEqual(child.exitCode, null);
424
+ }
425
+
213
426
  try {
214
427
  // Wait for the HTTP server to accept requests.
215
428
  let health;
@@ -228,6 +441,101 @@ try {
228
441
  assert.equal(health.body.piRunning, true, "fake pi RPC process should be attached and running");
229
442
  assert.match(health.body.piVersion, /^\d+\.\d+\.\d+/, "health metadata should expose the installed Pi version");
230
443
 
444
+ if (optionalFeatureFocus) {
445
+ await runOptionalFeatureFocus();
446
+ } else {
447
+ const summaryTabs = await request("127.0.0.1", "/api/tabs");
448
+ const summaryTabId = summaryTabs.body?.data?.tabs?.[0]?.id;
449
+ assert.ok(summaryTabId, "session-summary endpoint checks require the startup tab");
450
+ const summaryPath = `/api/session-summary/preferences?tab=${encodeURIComponent(summaryTabId)}`;
451
+ const initialSummaryPreferences = await request("127.0.0.1", summaryPath);
452
+ assert.equal(initialSummaryPreferences.status, 200, initialSummaryPreferences.body?.error);
453
+ assert.equal(initialSummaryPreferences.headers.get("cache-control"), "private, no-store", "summary preferences must not be cached by shared or browser caches");
454
+ assert.equal(initialSummaryPreferences.body?.data?.version, 1);
455
+ assert.equal(initialSummaryPreferences.body?.data?.preferences?.configured, false, "first read should not silently save setup defaults");
456
+ assert.deepEqual(initialSummaryPreferences.body?.data?.models?.map(({ provider, id }) => [provider, id]), [["fake", "fake-model"]]);
457
+ assert.deepEqual(initialSummaryPreferences.body?.data?.modelThinkingLevels?.["fake/fake-model"], ["off"]);
458
+ assert.match(initialSummaryPreferences.body?.data?.disclosure?.scope || "", /user text, final assistant text, and tool names only/i);
459
+ assert.equal(await pathExists(sessionSummaryConfigFile), false, "reading unconfigured summary setup must not create a preference file");
460
+
461
+ const unconfiguredSummaryGenerate = await request("127.0.0.1", `/api/session-summary/generate?tab=${encodeURIComponent(summaryTabId)}`, { method: "POST", body: { refresh: true } });
462
+ assert.equal(unconfiguredSummaryGenerate.status, 409, "direct generation must not bypass explicit setup confirmation");
463
+ assert.match(unconfiguredSummaryGenerate.body?.error || "", /setup must be confirmed/i);
464
+
465
+ const nonJsonSummarySave = await fetch(`http://127.0.0.1:${port}${summaryPath}`, {
466
+ method: "PUT",
467
+ headers: { "content-type": "text/plain" },
468
+ body: "{}",
469
+ });
470
+ assert.equal(nonJsonSummarySave.status, 415, "summary setup must reject cross-origin-simple content types");
471
+ const crossSiteSummarySave = await fetch(`http://127.0.0.1:${port}${summaryPath}`, {
472
+ method: "PUT",
473
+ headers: { "content-type": "application/json", "sec-fetch-site": "cross-site" },
474
+ body: JSON.stringify({ confirmed: true, preferences: {} }),
475
+ });
476
+ assert.equal(crossSiteSummarySave.status, 403, "summary setup must reject explicit cross-site mutations");
477
+ const unconfirmedSummarySave = await request("127.0.0.1", summaryPath, { method: "PUT", body: { confirmed: false, preferences: {} } });
478
+ assert.equal(unconfirmedSummarySave.status, 409, "summary setup must require explicit privacy and cost confirmation");
479
+ assert.equal(await pathExists(sessionSummaryConfigFile), false, "rejected summary setup must not persist defaults");
480
+
481
+ const validSummaryPreferences = {
482
+ enabled: true,
483
+ model: { provider: "fake", modelId: "fake-model", thinkingLevel: "off" },
484
+ prompts: { title: "Fixture title prompt", summary: "Fixture Markdown summary prompt" },
485
+ input: { scope: "text-and-tool-names" },
486
+ context: { injectLatest: false },
487
+ title: { enabled: true, minSettledTurns: 3 },
488
+ };
489
+ const invalidSummaryShape = await request("127.0.0.1", summaryPath, {
490
+ method: "PUT",
491
+ body: { confirmed: true, preferences: { ...validSummaryPreferences, credentials: "forbidden" } },
492
+ });
493
+ assert.equal(invalidSummaryShape.status, 400, "summary setup must reject unknown fields rather than retaining secrets or future client authority");
494
+ const invalidSummaryModel = await request("127.0.0.1", summaryPath, {
495
+ method: "PUT",
496
+ body: { confirmed: true, preferences: { ...validSummaryPreferences, model: { provider: "fake", modelId: "missing", thinkingLevel: "off" } } },
497
+ });
498
+ assert.equal(invalidSummaryModel.status, 400, "summary setup must validate against the active tab's authenticated model registry");
499
+ const savedSummaryPreferences = await request("127.0.0.1", summaryPath, {
500
+ method: "PUT",
501
+ body: { confirmed: true, preferences: validSummaryPreferences },
502
+ });
503
+ assert.equal(savedSummaryPreferences.status, 200, savedSummaryPreferences.body?.error);
504
+ assert.equal(savedSummaryPreferences.headers.get("cache-control"), "private, no-store");
505
+ assert.equal(savedSummaryPreferences.body?.data?.preferences?.configured, true);
506
+ assert.equal(savedSummaryPreferences.body?.data?.summary?.configured, true);
507
+ const summaryReplay = await waitForSseEvent(summaryTabId, (event) => event.type === "webui_session_summary" && event.kind === "replay");
508
+ assert.equal(summaryReplay.event.tabId, summaryTabId, "summary replay must remain scoped to the requested tab");
509
+ assert.equal(summaryReplay.event.summary?.configured, true);
510
+ assert.equal(Object.hasOwn(summaryReplay.event, "preferences"), false, "summary SSE replay must not expose setup prompts or model preferences");
511
+ const persistedSummaryPreferences = JSON.parse(await readFile(sessionSummaryConfigFile, "utf8"));
512
+ assert.equal(persistedSummaryPreferences.configured, true);
513
+ assert.equal(persistedSummaryPreferences.model.modelId, "fake-model");
514
+ assert.equal(Object.hasOwn(persistedSummaryPreferences, "credentials"), false, "summary preferences must not persist credentials");
515
+ assert.equal((await stat(sessionSummaryConfigFile)).mode & 0o777, 0o600, "summary preferences must be private");
516
+ persistedSummaryPreferences.credentials = "fixture-secret-must-not-cross-http";
517
+ persistedSummaryPreferences.model.providerToken = "fixture-provider-token";
518
+ await writeFile(sessionSummaryConfigFile, `${JSON.stringify(persistedSummaryPreferences, null, 2)}\n`, { mode: 0o600 });
519
+ const sanitizedSummaryPreferences = await request("127.0.0.1", summaryPath);
520
+ assert.equal(sanitizedSummaryPreferences.status, 200);
521
+ assert.equal(Object.hasOwn(sanitizedSummaryPreferences.body?.data?.preferences || {}, "credentials"), false, "unknown persisted keys must not cross the browser API boundary");
522
+ assert.equal(Object.hasOwn(sanitizedSummaryPreferences.body?.data?.preferences?.model || {}, "providerToken"), false, "unknown nested model keys must not cross the browser API boundary");
523
+ assert.equal(JSON.parse(await readFile(sessionSummaryConfigFile, "utf8")).credentials, "fixture-secret-must-not-cross-http", "sanitized reads must not destroy unknown future persisted keys");
524
+
525
+ const summaryPromptCountBefore = (await readJsonLines(fakePiCommandLog)).filter(({ direction, type, message }) => direction === "command" && type === "prompt" && String(message || "").startsWith("/summary")).length;
526
+ const unavailableSummaryGenerate = await request("127.0.0.1", `/api/session-summary/generate?tab=${encodeURIComponent(summaryTabId)}`, { method: "POST", body: { refresh: true } });
527
+ assert.equal(unavailableSummaryGenerate.status, 409, "generation should fail closed when /summary is absent from the active tab command catalog");
528
+ const summaryPromptCountAfter = (await readJsonLines(fakePiCommandLog)).filter(({ direction, type, message }) => direction === "command" && type === "prompt" && String(message || "").startsWith("/summary")).length;
529
+ assert.equal(summaryPromptCountAfter, summaryPromptCountBefore, "an unavailable summary command must not start a model-facing agent prompt");
530
+ const malformedSummaryGenerate = await request("127.0.0.1", `/api/session-summary/generate?tab=${encodeURIComponent(summaryTabId)}`, { method: "POST", body: { refresh: "yes" } });
531
+ assert.equal(malformedSummaryGenerate.status, 400, "summary refresh must be a strict boolean");
532
+ const oversizedSummarySave = await fetch(`http://127.0.0.1:${port}${summaryPath}`, {
533
+ method: "PUT",
534
+ headers: { "content-type": "application/json" },
535
+ body: JSON.stringify({ confirmed: true, padding: "x".repeat(33 * 1024) }),
536
+ });
537
+ assert.equal(oversizedSummarySave.status, 413, "summary mutations over 32 KiB must be rejected before validation");
538
+
231
539
  const initialInterfacePreferences = await request("127.0.0.1", "/api/interface-preferences");
232
540
  assert.equal(initialInterfacePreferences.status, 200);
233
541
  assert.equal(initialInterfacePreferences.body?.data?.preferences?.sidePanelWidth, null, "a user without a saved width should receive the default preference");
@@ -705,11 +1013,114 @@ try {
705
1013
  const validImageCommand = imageCommands.find((entry) => entry.direction === "command" && entry.message === "canonical inline image fixture");
706
1014
  assert.deepEqual(validImageCommand?.images, [{ type: "image", data: canonicalPng, mimeType: "image/png" }], "canonical image bytes and MIME type should be forwarded unchanged");
707
1015
 
1016
+ const webuiManifest = JSON.parse(await readFile(path.join(root, "package.json"), "utf8"));
1017
+ assert.deepEqual(webuiManifest.optionalDependencies, { "node-pty": "^1.1.0" }, "node-pty should be the only optional dependency");
1018
+ assert.equal(webuiManifest.dependencies?.["@firstpick/pi-utils"], "^0.2.5", "the required pi-utils runtime dependency must remain regular");
1019
+ assert.equal(JSON.stringify(webuiManifest.pi).includes("node_modules/@firstpick"), false, "the WebUI manifest must not claim optional companion resources");
1020
+
708
1021
  const optionalFeatures = await request("127.0.0.1", "/api/optional-features");
709
1022
  assert.equal(optionalFeatures.status, 200, "optional feature status should load");
1023
+ assert.equal(optionalFeatures.body?.data?.features?.length, 19, "the explicit server catalog should expose every allowlisted feature");
710
1024
  const aurReviewFeature = optionalFeatures.body?.data?.features?.find((feature) => feature.featureId === "aurReview");
1025
+ assert.equal(aurReviewFeature?.expectedSpec, "^0.1.1", "status should expose the catalog-owned compatibility spec");
711
1026
  assert.equal(aurReviewFeature?.installed, true, "workspace discovery should find the local pi-extension-aur-review sibling without an npm dependency");
712
- assert.equal(path.basename(aurReviewFeature?.installedRoot || ""), "pi-extension-aur-review", "aur-review discovery must validate the exact sibling manifest/name");
1027
+ assert.equal(aurReviewFeature?.configured, false, "physical discovery alone must not imply Pi registration");
1028
+ assert.equal(aurReviewFeature?.ready, false, "a physical but unregistered companion must not be ready after reload");
1029
+ assert.equal(aurReviewFeature?.state, "unknown", "physical discovery without canonical ownership must remain unknown");
1030
+ assert.equal(Object.hasOwn(aurReviewFeature || {}, "installedRoot"), false, "browser status must not expose the validated host package path");
1031
+ await verifyTopLevelOptionalFeatureProtection(tabId);
1032
+
1033
+ const invalidSingleFeature = await request("127.0.0.1", "/api/optional-feature-install", {
1034
+ method: "POST",
1035
+ body: { tab: tabId, featureId: "not-allowlisted" },
1036
+ });
1037
+ assert.equal(invalidSingleFeature.status, 400, "single installs must reject feature IDs outside the server catalog");
1038
+
1039
+ const installedAurReview = await request("127.0.0.1", "/api/optional-feature-install", {
1040
+ method: "POST",
1041
+ body: { tab: tabId, featureId: "aurReview" },
1042
+ timeoutMs: 10_000,
1043
+ });
1044
+ assert.equal(installedAurReview.status, 200, installedAurReview.body?.error);
1045
+ assert.match(installedAurReview.body?.data?.command || "", /install npm:@firstpick\/pi-extension-aur-review$/, "the selected Pi CLI should receive the exact unpinned npm source");
1046
+ assert.equal(installedAurReview.body?.data?.status?.installed, true);
1047
+ assert.equal(installedAurReview.body?.data?.status?.configured, true);
1048
+ assert.equal(installedAurReview.body?.data?.status?.ready, true, "successful Pi installation must verify physical presence and registration");
1049
+ const aurInstallCommands = (await readJsonLines(fakePiCliLog)).filter((entry) => entry.event === "start" && entry.args?.[1] === "npm:@firstpick/pi-extension-aur-review");
1050
+ assert.deepEqual(aurInstallCommands.map((entry) => entry.args), [["install", "npm:@firstpick/pi-extension-aur-review"]], "the feature path must invoke Pi install exactly once without npm CLI flags");
1051
+
1052
+ const registeredOptionalFeatures = await request("127.0.0.1", "/api/optional-features");
1053
+ const registeredAurReview = registeredOptionalFeatures.body?.data?.features?.find((feature) => feature.featureId === "aurReview");
1054
+ assert.equal(registeredAurReview?.ready, true, "Pi registration should survive a fresh status-manager read");
1055
+
1056
+ const resourceTab = await request("127.0.0.1", "/api/tabs", { method: "POST", body: { cwd, title: "configured optional package" } });
1057
+ assert.equal(resourceTab.status, 201, resourceTab.body?.error);
1058
+ const resourceTabId = resourceTab.body?.data?.tab?.id;
1059
+ const rpcLaunches = (await readJsonLines(fakePiCliLog)).filter((entry) => entry.event === "rpc");
1060
+ const configuredLaunchArgs = rpcLaunches.at(-1)?.args || [];
1061
+ const normalizedLaunchArgs = configuredLaunchArgs.map((arg) => String(arg).replace(/\\/g, "/"));
1062
+ assert.equal(normalizedLaunchArgs.filter((arg) => arg.endsWith("/pi-extension-aur-review/index.ts")).length, 1, "a separately configured optional extension should load once in a WebUI RPC tab");
1063
+ assert.equal(normalizedLaunchArgs.filter((arg) => arg.endsWith("/pi-package-webui/index.ts")).length, 1, "the WebUI package itself should remain loaded exactly once");
1064
+ assert.equal((await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [resourceTabId] } })).status, 200);
1065
+
1066
+ const currentBatchPlan = await request("127.0.0.1", "/api/optional-features");
1067
+ const currentBatchRevision = currentBatchPlan.body?.data?.revision;
1068
+ const malformedBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
1069
+ method: "POST",
1070
+ body: { tab: tabId, revision: currentBatchRevision, featureIds: "aurReview" },
1071
+ });
1072
+ assert.equal(malformedBatch.status, 400, "batch installs must require an array");
1073
+ const unknownBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
1074
+ method: "POST",
1075
+ body: { tab: tabId, revision: currentBatchRevision, featureIds: ["aurReview", "not-allowlisted"] },
1076
+ });
1077
+ assert.equal(unknownBatch.status, 400, "batch installs must reject unknown IDs before starting any command");
1078
+ const oversizedBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
1079
+ method: "POST",
1080
+ body: { tab: tabId, revision: currentBatchRevision, featureIds: Array.from({ length: 20 }, () => "aurReview") },
1081
+ });
1082
+ assert.equal(oversizedBatch.status, 400, "batch installs must cap raw input to the catalog size");
1083
+ const staleBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
1084
+ method: "POST",
1085
+ body: { tab: tabId, revision: "sha256:stale", featureIds: ["aurReview"] },
1086
+ });
1087
+ assert.equal(staleBatch.status, 409, "batch installs must reject stale audit revisions");
1088
+
1089
+ const batchLogStart = (await readJsonLines(fakePiCliLog)).length;
1090
+ const partialBatch = await request("127.0.0.1", "/api/optional-feature-install-batch", {
1091
+ method: "POST",
1092
+ body: { tab: tabId, revision: currentBatchRevision, featureIds: ["bangCommandAutocomplete", "statsCommand", "bangCommandAutocomplete", "gitFooterStatus"] },
1093
+ timeoutMs: 20_000,
1094
+ });
1095
+ assert.equal(partialBatch.status, 200, partialBatch.body?.error);
1096
+ assert.deepEqual(partialBatch.body?.data?.featureIds, ["bangCommandAutocomplete", "statsCommand", "gitFooterStatus"], "batch input should be deduplicated without reordering");
1097
+ assert.deepEqual(partialBatch.body?.data?.results?.map(({ featureId, ok }) => [featureId, ok]), [
1098
+ ["bangCommandAutocomplete", true],
1099
+ ["statsCommand", false],
1100
+ ["gitFooterStatus", true],
1101
+ ], "a failed Pi install must not stop later allowlisted installs");
1102
+ assert.deepEqual({ total: partialBatch.body?.data?.total, succeeded: partialBatch.body?.data?.succeeded, failed: partialBatch.body?.data?.failed }, { total: 3, succeeded: 2, failed: 1 });
1103
+ assert.equal(partialBatch.body?.data?.results?.[1]?.optionalFeatureInstall?.exitCode, 17, "batch failures should retain exit diagnostics");
1104
+ assert.match(partialBatch.body?.data?.results?.[1]?.optionalFeatureInstall?.command || "", /install npm:@firstpick\/pi-extension-stats$/, "batch failures should retain a copyable Pi command");
1105
+ assert.match(partialBatch.body?.data?.results?.[1]?.optionalFeatureInstall?.outputTail || "", /fixture Pi install failure/, "batch failures should retain bounded output diagnostics");
1106
+ const batchLog = (await readJsonLines(fakePiCliLog)).slice(batchLogStart).filter((entry) => entry.event === "start" || entry.event === "finish");
1107
+ assert.deepEqual(batchLog.map((entry) => [entry.event, entry.args?.[1], entry.exitCode]), [
1108
+ ["start", "npm:@firstpick/pi-extension-bang-command-autocomplete", undefined],
1109
+ ["finish", "npm:@firstpick/pi-extension-bang-command-autocomplete", 0],
1110
+ ["start", "npm:@firstpick/pi-extension-stats", undefined],
1111
+ ["finish", "npm:@firstpick/pi-extension-stats", 17],
1112
+ ["start", "npm:@firstpick/pi-extension-git-footer-status", undefined],
1113
+ ["finish", "npm:@firstpick/pi-extension-git-footer-status", 0],
1114
+ ], "batch commands should execute sequentially in request order");
1115
+
1116
+ const lanHost = lanAddress();
1117
+ if (lanHost) {
1118
+ const remoteBatch = await request(lanHost, "/api/optional-feature-install-batch", {
1119
+ method: "POST",
1120
+ body: { tab: tabId, revision: currentBatchRevision, featureIds: ["aurReview"] },
1121
+ });
1122
+ assert.equal(remoteBatch.status, 403, "batch installs must remain localhost-only");
1123
+ }
713
1124
 
714
1125
  const sessionToolsBefore = await request("127.0.0.1", `/api/tools?tab=${encodeURIComponent(tabId)}&scope=session`);
715
1126
  assert.equal(sessionToolsBefore.status, 200);
@@ -3241,12 +3652,27 @@ try {
3241
3652
  await delay(100);
3242
3653
  }
3243
3654
  assert.notEqual(child.exitCode, null, "server should exit after /api/shutdown");
3655
+ }
3244
3656
  } finally {
3245
3657
  if (child.exitCode === null) {
3246
3658
  child.kill("SIGKILL");
3247
3659
  await new Promise((resolve) => child.once("exit", resolve));
3248
3660
  }
3249
3661
  await new Promise((resolve) => voiceProvider.close(() => resolve()));
3662
+ const testSupervisorPaths = await supervisorPaths({ agentDir: workflowPolicyAgentDir, port });
3663
+ const testSupervisorState = await readSupervisorState(testSupervisorPaths);
3664
+ if (testSupervisorState && supervisorPidIsAlive(testSupervisorState.pid)) {
3665
+ terminateProcessTree({
3666
+ pid: testSupervisorState.pid,
3667
+ exitCode: null,
3668
+ signalCode: null,
3669
+ kill: (signal) => {
3670
+ process.kill(testSupervisorState.pid, signal);
3671
+ return true;
3672
+ },
3673
+ }, "SIGKILL");
3674
+ for (let attempt = 0; attempt < 50 && supervisorPidIsAlive(testSupervisorState.pid); attempt++) await delay(100);
3675
+ }
3250
3676
  await rmWithRetry(cwd);
3251
3677
  await rmWithRetry(harnessSideEffectsRoot);
3252
3678
  }
@@ -47,9 +47,9 @@ assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-nav[\s\S]*?widt
47
47
  assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-surface[\s\S]*?width: min\(30rem, 72vw\)/, "tablet inspector must be a bounded right-side sheet");
48
48
  assert.match(css, /html\[data-tablet-shell="v2"\] \.file-viewer-pane[\s\S]*?position: fixed[\s\S]*?inset: 0/, "tablet files must default to full-screen replacement");
49
49
  assert.match(css, /and \(pointer: coarse\)[\s\S]*?min-height: 44px/, "coarse tablet pointers must retain the 44px target floor");
50
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v71"/, "continuity/tablet assets need a coherent cache identity");
50
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "continuity/tablet assets need a coherent cache identity");
51
51
  assert.match(html, /styles\.css\?v=98/, "tablet CSS must have a coherent HTML revision");
52
- assert.match(html, /app\.js\?v=112/, "continuity app logic must have a coherent HTML revision");
52
+ assert.match(html, /app\.js\?v=113/, "continuity app logic must have a coherent HTML revision");
53
53
  assert.match(readme, /tabletShell=v2/, "tablet preview and rollback must be documented");
54
54
 
55
55
  console.log("mobile-continuity-tablet-static.test.mjs passed");
@@ -38,9 +38,9 @@ assert.match(server, /"mobile-shell-state\.mjs"/, "the server allowlist must ser
38
38
  assert.match(server, /"transcript-renderer\.mjs"/, "the server allowlist must serve the transcript startup module");
39
39
  assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
40
40
  assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
41
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v71"/, "the cache identity must change with the startup graph");
41
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "the cache identity must change with the startup graph");
42
42
  assert.match(html, /styles\.css\?v=98/, "the stylesheet revision must change with mobile/tablet CSS fixes");
43
- assert.match(html, /app\.js\?v=112/, "the app revision must change with continuity/tablet wiring");
43
+ assert.match(html, /app\.js\?v=113/, "the app revision must change with continuity/tablet wiring");
44
44
  assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;[\s\S]*?event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)[\s\S]*?return networkResponse;/, "runtime cache writes must extend the event lifetime without blocking bounded network responses");
45
45
  assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
46
46
  assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
@@ -60,6 +60,6 @@ assert.match(css, /data-mobile-presentation="essential"/, "Essential presentatio
60
60
  assert.match(css, /html\[data-mobile-shell="v2"\] body\.mobile-keyboard-open \.widget-area,[\s\S]*?\.composer-actions-button \{ display: block !important; \}/, "v2 keyboard mode must keep run widgets and the actions entry available");
61
61
  assert.match(css, /@media \(prefers-reduced-motion: reduce\)/, "reduced-motion behavior is required");
62
62
  assert.match(css, /@media \(forced-colors: active\)/, "forced-color affordances are required");
63
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v71"/, "browser asset changes need a coherent cache tuple");
63
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v72"/, "browser asset changes need a coherent cache tuple");
64
64
 
65
65
  console.log("mobile-phone-experience-static.test.mjs passed");