@firstpick/pi-package-webui 0.10.9 → 0.11.1

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 (52) hide show
  1. package/DEVELOPMENT.md +42 -2
  2. package/README.md +9 -3
  3. package/TECHNICAL.md +23 -1
  4. package/bin/pi-webui.mjs +72 -25
  5. package/lib/codex-cli-usage.mjs +232 -0
  6. package/lib/codex-usage-auth.mjs +39 -3
  7. package/lib/codex-usage-source.mjs +36 -0
  8. package/package.json +14 -8
  9. package/public/app.js +56 -24
  10. package/public/codex-speed-mode.mjs +36 -0
  11. package/public/index.html +6 -5
  12. package/public/service-worker.js +2 -1
  13. package/public/theme-contract.mjs +1 -1
  14. package/tests/boot-failure-diagnostics.test.mjs +2 -2
  15. package/tests/codex-cli-usage.test.mjs +189 -0
  16. package/tests/codex-fast-mode-static.test.mjs +12 -11
  17. package/tests/codex-speed-mode-browser-state.test.mjs +149 -0
  18. package/tests/codex-speed-mode.test.mjs +36 -0
  19. package/tests/codex-usage-auth.test.mjs +168 -9
  20. package/tests/codex-usage-http.test.mjs +124 -0
  21. package/tests/codex-usage-source.test.mjs +145 -0
  22. package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
  23. package/tests/control-visibility-static.test.mjs +2 -2
  24. package/tests/controls-layout-static.test.mjs +2 -2
  25. package/tests/events-tree-context-menu-static.test.mjs +2 -2
  26. package/tests/fast-mode-client-static.test.mjs +1 -1
  27. package/tests/feature-decision-output-popup-static.test.mjs +1 -1
  28. package/tests/file-viewer-image-static.test.mjs +2 -2
  29. package/tests/fixtures/fake-codex-app-server.mjs +61 -0
  30. package/tests/fixtures/fake-pi.mjs +18 -8
  31. package/tests/guided-git-activation-static.test.mjs +2 -2
  32. package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
  33. package/tests/host-peer-dependencies.test.mjs +24 -0
  34. package/tests/http-endpoints-harness.test.mjs +60 -0
  35. package/tests/intercom-conversation-viewer-static.test.mjs +2 -2
  36. package/tests/main-output-loading-static.test.mjs +2 -2
  37. package/tests/middle-button-drag-scroll-static.test.mjs +2 -2
  38. package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
  39. package/tests/mobile-foundation-static.test.mjs +2 -2
  40. package/tests/mobile-phone-experience-static.test.mjs +1 -1
  41. package/tests/open-issue-wizard-static.test.mjs +1 -1
  42. package/tests/optional-feature-prompt-impact-static.test.mjs +2 -2
  43. package/tests/persistent-ui-layout-static.test.mjs +2 -2
  44. package/tests/prompt-input-vertical-scroll-static.test.mjs +2 -2
  45. package/tests/questionnaire-dialog.test.mjs +2 -2
  46. package/tests/session-sampling-ui-static.test.mjs +2 -2
  47. package/tests/side-panel-section-height-removal-static.test.mjs +2 -2
  48. package/tests/subagent-observability-static.test.mjs +2 -2
  49. package/tests/syntax-highlighting-static.test.mjs +2 -2
  50. package/tests/theme-contract.test.mjs +10 -3
  51. package/tests/theme-customizer-static.test.mjs +1 -1
  52. package/tests/windows-drive-cwd-picker-static.test.mjs +2 -2
@@ -0,0 +1,124 @@
1
+ import assert from "node:assert/strict";
2
+ import { spawn } from "node:child_process";
3
+ import { createServer } from "node:http";
4
+ import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
5
+ import { tmpdir } from "node:os";
6
+ import path from "node:path";
7
+ import { setTimeout as delay } from "node:timers/promises";
8
+ import { fileURLToPath } from "node:url";
9
+ import { terminateProcessTree } from "../lib/process-tree.mjs";
10
+
11
+ const packageRoot = fileURLToPath(new URL("../", import.meta.url));
12
+ const root = await mkdtemp(path.join(tmpdir(), "pi-webui-codex-usage-http-"));
13
+ const children = [];
14
+ const legacyRequests = [];
15
+ const legacy = createServer((req, res) => {
16
+ legacyRequests.push(req.headers.authorization);
17
+ res.writeHead(200, { "content-type": "application/json" });
18
+ res.end(JSON.stringify({ plan_type: "plus", rate_limit: { primary_window: { used_percent: 8, limit_window_seconds: 18000 } }, accountId: "fixture-private-account", accessToken: "fixture-private-token" }));
19
+ });
20
+ await new Promise((resolve) => legacy.listen(0, "127.0.0.1", resolve));
21
+
22
+ async function freePort() {
23
+ const server = createServer();
24
+ await new Promise((resolve, reject) => server.once("error", reject).listen(0, "127.0.0.1", resolve));
25
+ const port = server.address().port;
26
+ await new Promise((resolve) => server.close(resolve));
27
+ return port;
28
+ }
29
+
30
+ async function request(port, pathname, method = "GET") {
31
+ const response = await fetch(`http://127.0.0.1:${port}${pathname}`, { method, signal: AbortSignal.timeout(10_000) });
32
+ return { status: response.status, body: await response.json() };
33
+ }
34
+
35
+ async function start(name, codex, credentials = {}) {
36
+ const agentDir = path.join(root, name, "agent");
37
+ await mkdir(agentDir, { recursive: true });
38
+ await writeFile(path.join(agentDir, "auth.json"), JSON.stringify(credentials));
39
+ const log = path.join(root, name, "codex.jsonl");
40
+ const port = await freePort();
41
+ // Omit --cwd so this harness needs no Pi child or model turn.
42
+ const child = spawn(process.execPath, [path.join(packageRoot, "bin", "pi-webui.mjs"), "--host", "127.0.0.1", "--port", String(port), "--pi", path.join(packageRoot, "tests", "fixtures", "fake-pi.mjs")], {
43
+ detached: process.platform !== "win32",
44
+ stdio: ["ignore", "pipe", "pipe"],
45
+ env: {
46
+ ...process.env,
47
+ NODE_ENV: "test",
48
+ PI_CODING_AGENT_DIR: agentDir,
49
+ PI_WEBUI_SETTINGS_FILE: path.join(root, name, "settings.json"),
50
+ PI_WEBUI_RPC_SUPERVISOR: "0",
51
+ PI_WEBUI_UPDATE_TEST_HOME: path.join(root, "coordination"),
52
+ PI_WEBUI_CODEX_BIN: codex,
53
+ PI_WEBUI_CODEX_USAGE_URL: `http://127.0.0.1:${legacy.address().port}/usage`,
54
+ FAKE_CODEX_MODE: "success",
55
+ FAKE_CODEX_LOG: log,
56
+ },
57
+ });
58
+ children.push(child);
59
+ let output = "";
60
+ for (const stream of [child.stdout, child.stderr]) stream.on("data", (chunk) => { output = (output + chunk.toString()).slice(-65536); });
61
+ let ready = false;
62
+ for (let attempt = 0; attempt < 100 && child.exitCode === null; attempt++) {
63
+ try { if ((await request(port, "/api/health")).status === 200) { ready = true; break; } } catch {}
64
+ await delay(100);
65
+ }
66
+ assert.ok(ready, `isolated WebUI should start\n${output}`);
67
+ return { child, port, log };
68
+ }
69
+
70
+ async function stop(server) {
71
+ if (server.child.exitCode !== null) return;
72
+ try { await request(server.port, "/api/shutdown", "POST"); } catch {}
73
+ for (let attempt = 0; attempt < 100 && server.child.exitCode === null; attempt++) await delay(50);
74
+ terminateProcessTree(server.child, "SIGKILL");
75
+ }
76
+
77
+ async function launches(log) {
78
+ return (await readFile(log, "utf8")).split("\n").filter(Boolean).map(JSON.parse).filter((entry) => entry.kind === "start");
79
+ }
80
+
81
+ try {
82
+ const cli = await start("cli", path.join(packageRoot, "tests", "fixtures", "fake-codex-app-server.mjs"));
83
+ const [first, simultaneous] = await Promise.all([request(cli.port, "/api/codex-usage"), request(cli.port, "/api/codex-usage")]);
84
+ assert.equal(first.status, 200);
85
+ assert.equal(simultaneous.status, 200);
86
+ assert.equal(first.body.data.source, "codex-cli");
87
+ assert.equal(first.body.data.selected.primary.usedPercent, 25);
88
+ assert.equal(first.body.data.selected.secondary.usedPercent, 42);
89
+ assert.doesNotMatch(JSON.stringify(first.body), /private-|fixture-.*secret|email|accessToken|accountId/);
90
+ assert.equal((await launches(cli.log)).length, 1, "concurrent HTTP requests must share one CLI process");
91
+ await request(cli.port, "/api/codex-usage");
92
+ assert.equal((await launches(cli.log)).length, 1, "normal reads use the successful cache");
93
+ assert.equal((await request(cli.port, "/api/codex-usage?refresh=1")).status, 200);
94
+ assert.equal((await launches(cli.log)).length, 2, "explicit refresh bypasses the completed cache");
95
+ assert.equal(legacyRequests.length, 0, "CLI success must not touch the legacy endpoint");
96
+ await stop(cli);
97
+
98
+ const credential = { type: "oauth", access: "fixture-legacy-access", refresh: "fixture-legacy-refresh", expires: Date.now() + 60 * 60 * 1000, accountId: "fixture-legacy-account" };
99
+ const fallback = await start("fallback", path.join(root, "missing-codex.exe"), { "openai-codex": credential });
100
+ const legacyResult = await request(fallback.port, "/api/codex-usage");
101
+ assert.equal(legacyResult.status, 200);
102
+ assert.equal(legacyResult.body.data.source, "chatgpt.com");
103
+ assert.equal(legacyResult.body.data.selected.primary.usedPercent, 8);
104
+ assert.match(legacyResult.body.data.sourceNotice, /legacy Codex login/);
105
+ assert.deepEqual(legacyRequests, ["Bearer fixture-legacy-access"]);
106
+ assert.doesNotMatch(JSON.stringify(legacyResult.body), /fixture-legacy|fixture-private/);
107
+ await stop(fallback);
108
+
109
+ const unavailable = await start("unavailable", path.join(root, "missing-codex.exe"));
110
+ const error = await request(unavailable.port, "/api/codex-usage");
111
+ assert.equal(error.status, 503);
112
+ assert.match(error.body.error, /Codex CLI was not found/);
113
+ assert.match(error.body.error, /legacy Codex usage fallback/);
114
+ assert.doesNotMatch(error.body.error, /stack|fixture-|auth\.json|AppData/);
115
+ await stop(unavailable);
116
+ console.log("codex-usage-http.test.mjs passed");
117
+ } finally {
118
+ for (const child of children) terminateProcessTree(child, "SIGKILL");
119
+ await new Promise((resolve) => legacy.close(resolve));
120
+ for (let attempt = 0; attempt < 20; attempt++) {
121
+ try { await rm(root, { recursive: true, force: true }); break; }
122
+ catch (error) { if (attempt === 19 || !["EBUSY", "EPERM", "ENOTEMPTY"].includes(error.code)) throw error; await delay(100); }
123
+ }
124
+ }
@@ -0,0 +1,145 @@
1
+ import assert from "node:assert/strict";
2
+ import test from "node:test";
3
+ import { readFile } from "node:fs/promises";
4
+ import vm from "node:vm";
5
+ import { CodexCliUsageError } from "../lib/codex-cli-usage.mjs";
6
+ import { createCodexUsageReader } from "../lib/codex-usage-source.mjs";
7
+
8
+ const unavailable = () => { throw new CodexCliUsageError("CODEX_CLI_NOT_FOUND", "Codex CLI was not found."); };
9
+
10
+ test("CLI usage has precedence and does not touch Pi authentication", async () => {
11
+ const snapshot = { source: "codex-cli", selected: { primary: { usedPercent: 25 } } };
12
+ const reader = createCodexUsageReader({ readCli: async () => snapshot, readLegacy: () => assert.fail("CLI success must not resolve Pi auth") });
13
+ assert.equal(await reader({ forceRefresh: true }), snapshot);
14
+ });
15
+
16
+ test("a compatible legacy login supplies an explicitly labelled fallback", async () => {
17
+ let received;
18
+ const reader = createCodexUsageReader({ readCli: unavailable, readLegacy: async (options) => { received = options; return { source: "chatgpt.com", selected: {} }; } });
19
+ const result = await reader({ forceRefresh: true });
20
+ assert.deepEqual(received, { forceRefresh: true });
21
+ assert.equal(result.source, "chatgpt.com");
22
+ assert.match(result.sourceNotice, /Pi's legacy Codex login/);
23
+ });
24
+
25
+ test("concurrent polls coalesce and refresh bypasses only the completed cache", async () => {
26
+ let calls = 0;
27
+ let complete;
28
+ const pending = new Promise((resolve) => { complete = resolve; });
29
+ const reader = createCodexUsageReader({ readCli: async () => { calls++; return pending; }, readLegacy: () => assert.fail("must not fall back") });
30
+ const first = reader();
31
+ const second = reader({ forceRefresh: true });
32
+ assert.equal(calls, 1);
33
+ complete({ source: "codex-cli" });
34
+ assert.deepEqual(await first, await second);
35
+ await reader();
36
+ assert.equal(calls, 1);
37
+ await reader({ forceRefresh: true });
38
+ assert.equal(calls, 2);
39
+ });
40
+
41
+ test("successful caches expire, while failures never enter the cache", async () => {
42
+ let now = 100;
43
+ let calls = 0;
44
+ const reader = createCodexUsageReader({ readCli: async () => ({ source: "codex-cli", count: ++calls }), readLegacy: unavailable, cacheMs: 30, now: () => now });
45
+ assert.equal((await reader()).count, 1);
46
+ now = 129;
47
+ assert.equal((await reader()).count, 1);
48
+ now = 130;
49
+ assert.equal((await reader()).count, 2);
50
+ let failures = 0;
51
+ const failing = createCodexUsageReader({ readCli: async () => { failures++; unavailable(); }, readLegacy: async () => { throw new Error("private-token"); } });
52
+ for (let index = 0; index < 2; index++) await assert.rejects(failing(), (error) => error.code === "CODEX_CLI_NOT_FOUND" && !error.message.includes("private-token"));
53
+ assert.equal(failures, 2);
54
+ });
55
+
56
+ test("unexpected CLI errors and legacy exceptions never expose raw diagnostics", async () => {
57
+ const reader = createCodexUsageReader({ readCli: async () => { throw new Error("Bearer private-cli-token"); }, readLegacy: async () => { throw new Error("private-refresh-token"); } });
58
+ await assert.rejects(reader(), (error) => {
59
+ assert.equal(error.statusCode, 503);
60
+ assert.match(error.message, /legacy Codex usage fallback/);
61
+ assert.doesNotMatch(error.message, /private-|Bearer/);
62
+ return true;
63
+ });
64
+ });
65
+
66
+ const serverSource = await readFile(new URL("../bin/pi-webui.mjs", import.meta.url), "utf8");
67
+ function serverUsageReader(readCli, fetchLegacy, resolveAuth) {
68
+ const start = serverSource.indexOf("function firstDefined(");
69
+ const end = serverSource.indexOf("const CLAUDE_USAGE_MONTHS", start);
70
+ assert.ok(start >= 0 && end > start);
71
+ return vm.runInNewContext(`${serverSource.slice(start, end)}\ngetOpenAICodexUsageStatus;`, {
72
+ Buffer, AbortController, setTimeout, clearTimeout,
73
+ createCodexUsageReader,
74
+ readCodexCliUsage: readCli,
75
+ fetch: fetchLegacy,
76
+ OPENAI_CODEX_PROVIDER_ID: "openai-codex",
77
+ OPENAI_CODEX_USAGE_ENDPOINT: "https://fixture.invalid/usage",
78
+ CODEX_USAGE_TIMEOUT_MS: 1000,
79
+ CODEX_USAGE_DIRECT_TOKEN_MESSAGE: "Direct ChatGPT login cannot supply legacy usage.",
80
+ codexUsageLoginGuidance: () => "Run /login.",
81
+ authContext: async () => ({ modelRuntime: {} }),
82
+ resolveCodexUsageAuth: resolveAuth,
83
+ makeHttpError: (statusCode, message) => Object.assign(new Error(message), { statusCode }),
84
+ });
85
+ }
86
+
87
+ test("the server normalizes CLI weekly-only usage and records its source", async () => {
88
+ const reader = serverUsageReader(async () => ({ planType: "plus", rateLimits: { limitId: "codex", primary: null, secondary: { usedPercent: 42, windowDurationMins: 10080, resetsAt: 2_000_500_000 } } }), () => assert.fail("must not call legacy backend"), () => assert.fail("must not resolve Pi auth"));
89
+ const data = await reader();
90
+ assert.equal(data.source, "codex-cli");
91
+ assert.equal(data.auth.source, "codex-cli");
92
+ assert.equal(data.planType, "plus");
93
+ assert.equal(data.selected.primary, null);
94
+ assert.equal(data.selected.secondary.usedPercent, 42);
95
+ assert.equal(data.snapshots.length, 1);
96
+ assert.equal(data.selected.secondary.resetsAt, new Date(2_000_500_000 * 1000).toISOString());
97
+ });
98
+
99
+ test("the server retains legacy usage as a fallback with no CLI credentials involved", async () => {
100
+ let legacyCalls = 0;
101
+ const reader = serverUsageReader(unavailable, async (_url, options) => {
102
+ legacyCalls++;
103
+ assert.equal(options.headers.authorization, "Bearer fixture-legacy-token");
104
+ return { ok: true, text: async () => JSON.stringify({ plan_type: "plus", rate_limit: { primary_window: { used_percent: 12, limit_window_seconds: 18000 } } }) };
105
+ }, async () => ({ providerId: "openai-codex", accessToken: "fixture-legacy-token", credential: { type: "oauth", accountId: "fixture-account" } }));
106
+ const data = await reader();
107
+ assert.equal(legacyCalls, 1);
108
+ assert.equal(data.source, "chatgpt.com");
109
+ assert.equal(data.selected.primary.usedPercent, 12);
110
+ assert.match(data.sourceNotice, /legacy Codex login/);
111
+ assert.doesNotMatch(JSON.stringify(data), /fixture-legacy-token|fixture-account/);
112
+ });
113
+
114
+ test("the server gives a sanitized combined error when CLI and direct-flow Pi fallback fail", async () => {
115
+ const reader = serverUsageReader(unavailable, () => assert.fail("direct-flow token must not reach backend"), async () => ({ unsupportedReason: "chatgpt-direct-token" }));
116
+ await assert.rejects(reader(), (error) => error.code === "CODEX_CLI_NOT_FOUND" && /legacy Codex usage fallback/.test(error.message));
117
+ });
118
+
119
+ test("the browser labels the usage account and redraws when source changes", async () => {
120
+ const source = await readFile(new URL("../public/app.js", import.meta.url), "utf8");
121
+ const signatureStart = source.indexOf("function codexUsageStructureSignature(");
122
+ const signatureEnd = source.indexOf("function updateCodexUsageValues(", signatureStart);
123
+ const renderStart = source.indexOf("function renderCodexUsage(");
124
+ const renderEnd = source.indexOf("async function refreshCodexUsage(", renderStart);
125
+ const nodes = [];
126
+ let rebuilds = 0;
127
+ const box = { replaceChildren: () => { nodes.length = 0; rebuilds++; }, classList: { toggle() {} }, append: (...items) => nodes.push(...items) };
128
+ const context = vm.createContext({
129
+ latestCodexUsage: { source: "codex-cli", planType: "plus" },
130
+ codexUsageLoading: false, codexUsageError: null, codexUsageRenderSignature: "",
131
+ elements: { codexUsageBox: box },
132
+ formatCodexPlanType: (value) => value,
133
+ codexUsageBuckets: () => [],
134
+ updateCodexUsageValues: () => true,
135
+ make: (_tag, _className, text) => ({ text, append() {} }),
136
+ });
137
+ vm.runInContext(`${source.slice(signatureStart, signatureEnd)}\n${source.slice(renderStart, renderEnd)}\nrenderCodexUsage();`, context);
138
+ assert.ok(nodes.some((node) => /Codex CLI account/.test(node.text)));
139
+ assert.ok(nodes.some((node) => /separate from Pi/.test(node.text)));
140
+ context.latestCodexUsage = { source: "chatgpt.com", planType: "plus", sourceNotice: "Showing fallback usage." };
141
+ vm.runInContext("renderCodexUsage()", context);
142
+ assert.equal(rebuilds, 2, "source changes must invalidate the structural cache");
143
+ assert.ok(nodes.some((node) => /Pi's legacy Codex login/.test(node.text)));
144
+ assert.ok(nodes.some((node) => node.text === "Showing fallback usage."));
145
+ });
@@ -58,7 +58,7 @@ assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreCom
58
58
  assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
59
59
 
60
60
  assert.match(html, /styles\.css\?v=154/, "changed composer styles should advance the stylesheet revision");
61
- assert.match(html, /app\.js\?v=184/, "changed composer behavior should advance the app revision");
62
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155"/, "changed browser assets should advance the PWA cache identity");
61
+ assert.match(html, /app\.js\?v=185/, "changed composer behavior should advance the app revision");
62
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156"/, "changed browser assets should advance the PWA cache identity");
63
63
 
64
64
  console.log("composer-action-grid-reorder-static.test.mjs passed");
@@ -348,10 +348,10 @@ assert.match(
348
348
 
349
349
  assert.match(
350
350
  serviceWorker,
351
- /const CACHE_NAME = "pi-webui-pwa-v155";/,
351
+ /const CACHE_NAME = "pi-webui-pwa-v156";/,
352
352
  "browser asset changes should advance the PWA cache identity",
353
353
  );
354
354
  assert.match(html, /styles\.css\?v=154/, "visibility styles should advance the stylesheet query revision");
355
- assert.match(html, /data-app-src="\/app\.js\?v=184"/, "visibility behavior should advance the app query revision");
355
+ assert.match(html, /data-app-src="\/app\.js\?v=185"/, "visibility behavior should advance the app query revision");
356
356
 
357
357
  console.log("control-visibility-static.test.mjs passed");
@@ -16,7 +16,7 @@ assert.match(app, /function initializeControlSettingTooltips\(\)[\s\S]*#sidePane
16
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
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
18
  assert.match(html, /styles\.css\?v=154/, "Controls stylesheet changes should advance the cache query");
19
- assert.match(html, /app\.js\?v=184/, "Controls tooltip wiring should advance the app cache query");
20
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155"/, "Controls browser assets should advance the PWA cache identity");
19
+ assert.match(html, /app\.js\?v=185/, "Controls tooltip wiring should advance the app cache query");
20
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156"/, "Controls browser assets should advance the PWA cache identity");
21
21
 
22
22
  console.log("controls-layout-static.test.mjs passed");
@@ -124,8 +124,8 @@ assert.match(styles, /\.event-log\[data-display-mode="compact"\] \.event\[data-e
124
124
  assert.match(styles, /\.event-tree-context-menu \{[\s\S]*max-width: calc\(100vw - 1rem\)/, "the dedicated menu should remain viewport bounded");
125
125
 
126
126
  // Cache tuple for this browser-asset change.
127
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155";/, "the PWA cache identity should advance");
127
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156";/, "the PWA cache identity should advance");
128
128
  assert.match(html, /styles\.css\?v=154/, "compact-mode styles should advance the stylesheet revision");
129
- assert.match(html, /data-app-src="\/app\.js\?v=184"/, "the app query revision should advance");
129
+ assert.match(html, /data-app-src="\/app\.js\?v=185"/, "the app query revision should advance");
130
130
 
131
131
  console.log("events-tree-context-menu-static.test.mjs passed");
@@ -159,7 +159,7 @@ assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA
159
159
  assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
160
160
  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");
161
161
  // Intent preserved: the guarded PWA entry point must advance whenever app wiring changes.
162
- assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=184"/, "the guarded PWA entry point should cache-bust browser wiring");
162
+ assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=185"/, "the guarded PWA entry point should cache-bust browser wiring");
163
163
  assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
164
164
 
165
165
  const events = createFastModeOutputEvents();
@@ -167,6 +167,6 @@ assert.match(app, /case "webui_connected":[\s\S]*clearFeatureDecisionStateForTab
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
169
  assert.match(html, /\/styles\.css\?v=154/, "integrated stylesheet changes should advance the cache query");
170
- assert.match(html, /\/app\.js\?v=184/, "integrated app changes should advance the cache query");
170
+ assert.match(html, /\/app\.js\?v=185/, "integrated app changes should advance the cache query");
171
171
 
172
172
  console.log("feature decision-output popup static checks passed");
@@ -62,8 +62,8 @@ assert.match(css, /\.file-viewer-image img \{[\s\S]*max-width: 100%;[\s\S]*max-h
62
62
  assert.match(readme, /PNG, JPEG, GIF, WebP, and AVIF/i, "the Files panel guide should list supported image formats");
63
63
  assert.match(technical, /supported raster images[\s\S]*2 MiB/i, "the advanced reference should document image support and its size limit");
64
64
  assert.match(development, /kind: "image"[\s\S]*base64/i, "the contributor guide should document the image response contract");
65
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155"/, "changed viewer assets should advance the PWA cache identity");
65
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156"/, "changed viewer assets should advance the PWA cache identity");
66
66
  assert.match(html, /styles\.css\?v=154/, "changed image styles should advance the stylesheet revision");
67
- assert.match(html, /app\.js\?v=184/, "changed image rendering should advance the app revision");
67
+ assert.match(html, /app\.js\?v=185/, "changed image rendering should advance the app revision");
68
68
 
69
69
  console.log("file viewer image static tests passed");
@@ -0,0 +1,61 @@
1
+ import { appendFileSync } from "node:fs";
2
+ import { createInterface } from "node:readline";
3
+ import { spawn } from "node:child_process";
4
+
5
+ const mode = process.env.FAKE_CODEX_MODE || "success";
6
+ const log = (entry) => {
7
+ if (process.env.FAKE_CODEX_LOG) appendFileSync(process.env.FAKE_CODEX_LOG, `${JSON.stringify(entry)}\n`);
8
+ };
9
+ log({ kind: "start", pid: process.pid, args: process.argv.slice(2) });
10
+ if (["hang", "stubborn", "tree"].includes(mode)) setInterval(() => {}, 1000);
11
+ if (mode === "tree") {
12
+ const child = spawn(process.execPath, ["-e", "setInterval(() => {}, 1000)"], { stdio: "ignore" });
13
+ log({ kind: "descendant", pid: child.pid });
14
+ }
15
+ const send = (frame) => {
16
+ const bytes = Buffer.from(`${JSON.stringify(frame)}\n`);
17
+ if (mode === "fragmented") {
18
+ for (let start = 0; start < bytes.length; start += 7) process.stdout.write(bytes.subarray(start, start + 7));
19
+ } else process.stdout.write(bytes);
20
+ };
21
+ const primary = { usedPercent: 25, windowDurationMins: 300, resetsAt: 2_000_000_000 };
22
+ const secondary = { usedPercent: 42, windowDurationMins: 10080, resetsAt: 2_000_500_000 };
23
+ createInterface({ input: process.stdin }).on("line", (line) => {
24
+ const frame = JSON.parse(line);
25
+ log({ kind: "frame", ...frame });
26
+ if (!frame.method || frame.method === "initialized") return;
27
+ if (frame.method === "initialize") {
28
+ if (mode === "hang") return;
29
+ if (mode === "early-exit") { process.exit(7); return; }
30
+ if (mode === "malformed") { process.stdout.write("not JSON\n"); return; }
31
+ if (mode === "oversized") { process.stdout.write("x".repeat(1024 * 1024 + 1)); return; }
32
+ if (mode === "stderr-flood") { process.stderr.write("x".repeat(4 * 1024 * 1024 + 1)); return; }
33
+ send({ id: frame.id, result: { userAgent: "fixture" } });
34
+ if (mode === "server-request") send({ id: "server-auth-request", method: "account/chatgptAuthTokens/refresh", params: { reason: "expired" } });
35
+ send({ method: "account/updated", params: { email: "private-fixture@example.invalid", secret: "fixture-notification-secret" } });
36
+ return;
37
+ }
38
+ if (frame.method === "account/read") {
39
+ const account = mode === "logged-out" ? null : mode === "api-key" ? { type: "apiKey" } : { type: "chatgpt", planType: "plus", email: "private-fixture@example.invalid", accountId: "private-account", accessToken: "fixture-access-secret" };
40
+ send({ id: frame.id, result: { account, requiresOpenaiAuth: true } });
41
+ return;
42
+ }
43
+ if (frame.method === "account/rateLimits/read") {
44
+ if (mode === "rpc-error") {
45
+ process.stderr.write("Bearer fixture-stderr-secret\n");
46
+ send({ id: frame.id, error: { code: -32603, message: "upstream 401 Bearer fixture-error-secret", data: { refreshToken: "fixture-refresh-secret" } } });
47
+ return;
48
+ }
49
+ const limits = mode === "empty" ? {} : { limitId: "codex", limitName: "Codex 漢字", primary: mode === "weekly-only" ? null : primary, secondary, credits: { hasCredits: true, unlimited: false, balance: "12.50", accessToken: "fixture-credit-secret" }, planType: "plus" };
50
+ send({ id: frame.id, result: {
51
+ rateLimits: limits,
52
+ rateLimitsByLimitId: mode === "multi-bucket" ? { codex: limits, extra: { limitId: "extra", primary: { ...primary, usedPercent: 70 } } } : null,
53
+ accountId: "private-account",
54
+ accessToken: "fixture-usage-secret",
55
+ profile: { email: "private-fixture@example.invalid" },
56
+ } });
57
+ return;
58
+ }
59
+ send({ id: frame.id, error: { code: -32601, message: "Unexpected operation" } });
60
+ });
61
+ process.stdin.on("end", () => { if (!["hang", "stubborn", "tree"].includes(mode)) process.exit(0); });
@@ -43,7 +43,8 @@ let activeBash = 0;
43
43
  let peakBash = 0;
44
44
  let thinkingLevel = "off";
45
45
  let conversationEnabled = false;
46
- let codexFastModeEnabled = false;
46
+ let codexSpeedMode = "normal";
47
+ let codexFixtureModel = null;
47
48
  let rejectNextCodexFastModeMutation = false;
48
49
  const fakeTools = [
49
50
  { name: "read", description: "Read files", sourceInfo: { source: "builtin", scope: "temporary", origin: "top-level" } },
@@ -667,12 +668,20 @@ function emitCodexFastModeStatus() {
667
668
  id: randomUUID(),
668
669
  method: "setStatus",
669
670
  statusKey: "codex-fast-mode",
670
- statusText: codexFastModeEnabled ? "on" : "off",
671
+ statusText: codexSpeedMode === "ultrafast" ? "ultrafast" : codexSpeedMode === "fast" ? "on" : "off",
671
672
  });
672
673
  }
673
674
 
674
675
  function handleCodexFastModePrompt(command, base) {
675
676
  const message = String(command.message || "").trim();
677
+ if (message === "fixture codex astra" || message === "fixture codex reset") {
678
+ codexFixtureModel = message.endsWith("astra")
679
+ ? { provider: "openai-codex", api: "openai-codex-responses", id: "gpt-6-astra" } : null;
680
+ emitEvent({ type: "agent_start" });
681
+ emitEvent({ type: "agent_settled" });
682
+ respond({ ...base, data: { output: "Codex model fixture updated" } });
683
+ return true;
684
+ }
676
685
  if (message === "fixture reject next codex fast mode mutation") {
677
686
  rejectNextCodexFastModeMutation = true;
678
687
  // Prompt routing marks the tab active before RPC dispatch; settle this control-only fixture
@@ -682,7 +691,7 @@ function handleCodexFastModePrompt(command, base) {
682
691
  respond({ ...base, data: { output: "next Codex Fast mode mutation will be rejected" } });
683
692
  return true;
684
693
  }
685
- const match = message.match(/^\/fast-mode(?:\s+(on|off|status))?$/i);
694
+ const match = message.match(/^\/fast-mode(?:\s+(on|off|normal|fast|ultrafast|status))?$/i);
686
695
  if (!match) return false;
687
696
  const subcommand = String(match[1] || "").toLowerCase();
688
697
  if (subcommand !== "status" && rejectNextCodexFastModeMutation) {
@@ -690,11 +699,12 @@ function handleCodexFastModePrompt(command, base) {
690
699
  respond({ ...base, data: { output: "Fast mode mutation rejected while busy" } });
691
700
  return true;
692
701
  }
693
- if (!subcommand) codexFastModeEnabled = !codexFastModeEnabled;
694
- else if (subcommand === "on") codexFastModeEnabled = true;
695
- else if (subcommand === "off") codexFastModeEnabled = false;
702
+ if (!subcommand) codexSpeedMode = codexSpeedMode === "normal" ? "fast" : "normal";
703
+ else if (subcommand === "on" || subcommand === "fast") codexSpeedMode = "fast";
704
+ else if (subcommand === "off" || subcommand === "normal") codexSpeedMode = "normal";
705
+ else if (subcommand === "ultrafast") codexSpeedMode = "ultrafast";
696
706
  emitCodexFastModeStatus();
697
- respond({ ...base, data: { output: `Fast mode ${codexFastModeEnabled ? "on" : "off"}.` } });
707
+ respond({ ...base, data: { output: `Codex speed ${codexSpeedMode}.` } });
698
708
  return true;
699
709
  }
700
710
 
@@ -1565,7 +1575,7 @@ rl.on("line", (line) => {
1565
1575
  respond({
1566
1576
  ...base,
1567
1577
  data: {
1568
- model: { provider: "fake", id: "fake-model" },
1578
+ model: codexFixtureModel || { provider: "fake", id: "fake-model" },
1569
1579
  thinkingLevel,
1570
1580
  isStreaming: scriptedStreaming || guidedGitStateMode === "streaming",
1571
1581
  isCompacting: guidedGitStateMode === "compacting",
@@ -90,8 +90,8 @@ test("fixture, cache revisions, and layered docs expose the migration contract",
90
90
  assert.match(fakePi, /FAKE_PI_GUIDED_GIT_ACTIVATION/u);
91
91
  assert.match(fakePi, /git-guided-workflow:webui-start/u);
92
92
  assert.match(html, /styles\.css\?v=154/u);
93
- assert.match(html, /app\.js\?v=184/u);
94
- assert.match(serviceWorker, /pi-webui-pwa-v155/u);
93
+ assert.match(html, /app\.js\?v=185/u);
94
+ assert.match(serviceWorker, /pi-webui-pwa-v156/u);
95
95
  assert.match(serviceWorker, /"\/guided-git-command-state\.mjs"/u);
96
96
  assert.match(readme, /pi-extension-git-guided-workflow/u);
97
97
  assert.match(technical, /\/git-guided-workflow/u);
@@ -54,7 +54,7 @@ assert.match(readme, /fallback model and its own reasoning effort[\s\S]*tries th
54
54
  assert.match(technical, /## Guided Git generation profiles[\s\S]*strict one-retry policy[\s\S]*active model and reasoning effort remain unchanged[\s\S]*dead Pi process cannot run the fallback/i, "technical reference should document configuration and operational limits");
55
55
  assert.match(development, /### Fallback browser\/runtime contract[\s\S]*fallbackUsed: true[\s\S]*webui_git_workflow_generation_fallback_started[\s\S]*never sends a retry/, "development guide should preserve the response/event and browser ownership contract");
56
56
 
57
- assert.match(html, /data-app-src="\/app\.js\?v=184"/, "the changed browser app should use the next query revision");
58
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155";/, "the PWA cache identity should advance with browser behavior");
57
+ assert.match(html, /data-app-src="\/app\.js\?v=185"/, "the changed browser app should use the next query revision");
58
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156";/, "the PWA cache identity should advance with browser behavior");
59
59
 
60
60
  console.log("guided-git-fallback-ui-static.test.mjs passed");
@@ -0,0 +1,24 @@
1
+ import assert from "node:assert/strict";
2
+ import { readFile } from "node:fs/promises";
3
+
4
+ const manifest = JSON.parse(await readFile(new URL("../package.json", import.meta.url), "utf8"));
5
+ const lock = JSON.parse(await readFile(new URL("../package-lock.json", import.meta.url), "utf8"));
6
+ const hostPackages = [
7
+ "@earendil-works/pi-ai",
8
+ "@earendil-works/pi-coding-agent",
9
+ "@earendil-works/pi-tui",
10
+ "typebox",
11
+ ];
12
+
13
+ for (const name of hostPackages) {
14
+ assert.equal(manifest.dependencies?.[name], undefined, `${name} must come from the Pi host`);
15
+ assert.equal(manifest.optionalDependencies?.[name], undefined, `${name} must not install as an optional dependency`);
16
+ assert.equal(manifest.peerDependencies?.[name], "*", `${name} must accept the host's version`);
17
+ assert.ok(manifest.devDependencies?.[name], `${name} must remain available to local tests`);
18
+ }
19
+ assert.equal(manifest.dependencies?.["@earendil-works/pi-agent-core"], undefined);
20
+ for (const field of ["dependencies", "devDependencies", "peerDependencies", "optionalDependencies"]) {
21
+ assert.deepEqual(lock.packages[""][field], manifest[field], `npm lock root must match ${field}`);
22
+ }
23
+
24
+ console.log("host-peer-dependencies.test.mjs passed");
@@ -159,6 +159,9 @@ await writeFile(artifactManifest, JSON.stringify({ artifact: { schema: "pi.artif
159
159
  await mkdir(managedThemeDir, { recursive: true });
160
160
  await writeFile(path.join(managedThemePackageRoot, "package.json"), JSON.stringify({ name: "@firstpick/pi-themes-bundle", version: "0.0.0-test", pi: { themes: ["./themes"] } }));
161
161
  await writeFile(path.join(managedThemeDir, "managed-fixture.json"), serializeTheme(themeFixture("managed-fixture")));
162
+ await writeFile(path.join(managedThemePackageRoot, "webui-backgrounds.json"), JSON.stringify({
163
+ "managed-fixture": { backgroundImage: "url(\"/matrix-background.webp\")", backgroundSize: "cover", pageBg: "#ffffff", arbitrary: "ignored" },
164
+ }));
162
165
  await writeFile(path.join(workflowPolicyAgentDir, "trust.json"), `${JSON.stringify({ [cwd]: true }, null, 2)}\n`);
163
166
  await chmod(fakePi, 0o755);
164
167
  await mkdir(fakeOpenBinDir, { recursive: true });
@@ -513,6 +516,11 @@ try {
513
516
  assert.deepEqual(managedThemesResponse.body?.data?.themes?.map(({ name }) => name), ["managed-fixture"], "themes installed only under PI_CODING_AGENT_DIR/npm/node_modules should be exposed to the browser");
514
517
  assert.equal(managedThemesResponse.body?.data?.themes?.[0]?.colors?.accent, "#123456");
515
518
  assert.equal(managedThemesResponse.body?.data?.themes?.[0]?.scope, "bundled");
519
+ const managedExport = managedThemesResponse.body.data.themes[0].export;
520
+ assert.equal(managedExport.backgroundImage, "url(\"/matrix-background.webp\")", "separate WebUI metadata must preserve bundled backgrounds");
521
+ assert.equal(managedExport.backgroundSize, "cover");
522
+ assert.notEqual(managedExport.pageBg, "#ffffff", "background metadata must not replace native Pi export colors");
523
+ assert.equal(Object.hasOwn(managedExport, "arbitrary"), false, "only supported background fields may enter the catalog");
516
524
 
517
525
  const themeTabs = await request("127.0.0.1", "/api/tabs");
518
526
  const themeTabId = themeTabs.body?.data?.tabs?.[0]?.id;
@@ -3856,6 +3864,15 @@ try {
3856
3864
  assert.equal(codexFastModeOn.status, 200, `Codex Fast mode on should succeed: ${codexFastModeOn.body?.error || ""}`);
3857
3865
  assert.equal(codexFastModeOn.body?.data?.statusKnown, true);
3858
3866
  assert.equal(codexFastModeOn.body?.data?.enabled, true, "PUT should return only extension-confirmed on state");
3867
+ assert.equal(codexFastModeOn.body?.data?.mode, "fast", "legacy enabled=true should select Fast");
3868
+ for (const body of [{ mode: "turbo" }, { mode: "ultrafast", enabled: false }, { mode: "normal", enabled: true }]) {
3869
+ const invalidMode = await request("127.0.0.1", "/api/codex-fast-mode", { method: "PUT", body: { ...body, tab: tabId } });
3870
+ assert.equal(invalidMode.status, 400, "invalid or contradictory mode intent must fail closed");
3871
+ }
3872
+ const unsupportedUltrafast = await request("127.0.0.1", "/api/codex-fast-mode", {
3873
+ method: "PUT", body: { mode: "ultrafast", tab: tabId },
3874
+ });
3875
+ assert.equal(unsupportedUltrafast.status, 400, "Ultrafast should reject non-Astra models before dispatch");
3859
3876
 
3860
3877
  const rejectNextCodexFastMode = await request("127.0.0.1", "/api/prompt", {
3861
3878
  method: "POST",
@@ -3899,6 +3916,49 @@ try {
3899
3916
  assert.equal(codexFastModeOff.status, 200, `Codex Fast mode off should succeed after the tab settles: ${codexFastModeOff.body?.error || ""}`);
3900
3917
  assert.equal(codexFastModeOff.body?.data?.enabled, false);
3901
3918
  assert.equal(codexFastModeOff.body?.data?.statusKnown, true, "off response should be extension-confirmed");
3919
+ assert.equal(codexFastModeOff.body?.data?.mode, "normal");
3920
+
3921
+ const astraFixture = await request("127.0.0.1", "/api/prompt", {
3922
+ method: "POST", body: { message: "fixture codex astra", tab: tabId },
3923
+ });
3924
+ assert.equal(astraFixture.status, 200);
3925
+ const astraSpeed = await request("127.0.0.1", `/api/codex-fast-mode?tab=${encodeURIComponent(tabId)}`);
3926
+ assert.equal(astraSpeed.body?.data?.ultrafastModelEligible, true);
3927
+ const ultrafast = await request("127.0.0.1", "/api/codex-fast-mode", {
3928
+ method: "PUT", body: { mode: "ultrafast", tab: tabId },
3929
+ });
3930
+ assert.equal(ultrafast.status, 200, `Ultrafast should confirm: ${ultrafast.body?.error || ""}`);
3931
+ assert.equal(ultrafast.body?.data?.mode, "ultrafast");
3932
+ assert.equal(ultrafast.body?.data?.enabled, true);
3933
+ assert.equal(ultrafast.body?.data?.requested, "ultrafast");
3934
+
3935
+ await request("127.0.0.1", "/api/prompt", {
3936
+ method: "POST", body: { message: "fixture reject next codex fast mode mutation", tab: tabId },
3937
+ });
3938
+ const rejectedFastFromUltra = await request("127.0.0.1", "/api/codex-fast-mode", {
3939
+ method: "PUT", body: { mode: "fast", tab: tabId },
3940
+ });
3941
+ assert.equal(rejectedFastFromUltra.status, 409, "enabled=true alone must not confirm Fast when Ultrafast is still selected");
3942
+ const stillUltra = await request("127.0.0.1", `/api/codex-fast-mode?tab=${encodeURIComponent(tabId)}`);
3943
+ assert.equal(stillUltra.body?.data?.mode, "ultrafast");
3944
+
3945
+ const legacyOnFromUltra = await request("127.0.0.1", "/api/codex-fast-mode", {
3946
+ method: "PUT", body: { enabled: true, tab: tabId },
3947
+ });
3948
+ assert.equal(legacyOnFromUltra.status, 200);
3949
+ assert.equal(legacyOnFromUltra.body?.data?.mode, "fast", "legacy on must explicitly leave Ultrafast");
3950
+ await request("127.0.0.1", "/api/codex-fast-mode", { method: "PUT", body: { mode: "ultrafast", tab: tabId } });
3951
+ const legacyOffFromUltra = await request("127.0.0.1", "/api/codex-fast-mode", {
3952
+ method: "PUT", body: { enabled: false, tab: tabId },
3953
+ });
3954
+ assert.equal(legacyOffFromUltra.status, 200);
3955
+ assert.equal(legacyOffFromUltra.body?.data?.mode, "normal", "legacy off must disarm Ultrafast too");
3956
+ const explicitNormal = await request("127.0.0.1", "/api/codex-fast-mode", {
3957
+ method: "PUT", body: { mode: "normal", tab: tabId },
3958
+ });
3959
+ assert.equal(explicitNormal.status, 200);
3960
+ assert.equal(explicitNormal.body?.data?.mode, "normal");
3961
+ await request("127.0.0.1", "/api/prompt", { method: "POST", body: { message: "fixture codex reset", tab: tabId } });
3902
3962
 
3903
3963
  // Natural Conversation shell: /talk availability drives per-tab status and safety guards.
3904
3964
  const conversationFeature = await request("127.0.0.1", `/api/features/natural-conversation?tab=${encodeURIComponent(tabId)}`);
@@ -97,8 +97,8 @@ assert.match(css, /\.extension-dialog\.intercom-conversation-dialog \{[\s\S]*wid
97
97
  assert.match(css, /@media \(max-width: 720px\)[\s\S]*\.composer-intercom-tag \{ min-height: 44px;[\s\S]*\.extension-dialog\.intercom-conversation-dialog[\s\S]*width: calc\(100vw - 0\.7rem\)/, "tags and the dialog should remain reachable on narrow and coarse-pointer layouts");
98
98
 
99
99
  assert.match(html, /\/styles\.css\?v=154/, "the stylesheet URL should advance for the bounded conversation tags");
100
- assert.match(html, /data-app-src="\/app\.js\?v=184"/, "the guarded app URL should advance for current browser wiring");
101
- assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v155"/, "the PWA cache identity should advance with browser assets");
100
+ assert.match(html, /data-app-src="\/app\.js\?v=185"/, "the guarded app URL should advance for current browser wiring");
101
+ assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v156"/, "the PWA cache identity should advance with browser assets");
102
102
 
103
103
  assert.match(readme, /one compact tag per conversation appears beneath the composer/i, "the README should explain the user-visible entry point");
104
104
  assert.match(technical, /## Agent conversation viewer[\s\S]*Attachments, tool calls and results, thinking, stdout\/stderr, filesystem paths, raw session records/i, "the advanced guide should document privacy exclusions");