@firstpick/pi-package-webui 0.6.8 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -2
- package/bin/pi-webui.mjs +577 -37
- package/index.ts +7 -91
- package/lib/trust-boundaries.mjs +1 -0
- package/package.json +10 -9
- package/public/app.js +869 -118
- package/public/aur-review-payload.mjs +108 -0
- package/public/guided-git-command-state.mjs +34 -0
- package/public/guided-git-review-state.mjs +137 -0
- package/public/index.html +178 -97
- package/public/service-worker.js +1 -1
- package/public/styles.css +454 -24
- package/tests/aur-review-payload.test.mjs +57 -0
- package/tests/aur-review-widget-static.test.mjs +38 -0
- package/tests/compaction-resume-harness.test.mjs +55 -3
- package/tests/compaction-static.test.mjs +3 -3
- package/tests/fixtures/compacting-pi.mjs +10 -5
- package/tests/fixtures/fake-pi.mjs +63 -1
- package/tests/guided-git-aur-review.test.mjs +183 -0
- package/tests/http-endpoints-harness.test.mjs +184 -3
- package/tests/mobile-static.test.mjs +110 -21
- package/tests/staged-content-hash-contract.test.mjs +174 -0
- package/tests/subagents-helper.test.mjs +83 -4
- package/tests/transport-hardening-harness.test.mjs +157 -0
- package/webui-rpc-helper.mjs +108 -25
|
@@ -22,10 +22,10 @@ function lanAddress() {
|
|
|
22
22
|
return undefined;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
async function request(host, pathname, { method = "GET", body, timeoutMs = 5_000 } = {}) {
|
|
25
|
+
async function request(host, pathname, { method = "GET", body, headers = {}, timeoutMs = 5_000 } = {}) {
|
|
26
26
|
const response = await fetch(`http://${host}:${port}${pathname}`, {
|
|
27
27
|
method,
|
|
28
|
-
headers: body === undefined ?
|
|
28
|
+
headers: body === undefined ? headers : { "Content-Type": "application/json", ...headers },
|
|
29
29
|
body: body === undefined ? undefined : JSON.stringify(body),
|
|
30
30
|
signal: AbortSignal.timeout(timeoutMs),
|
|
31
31
|
});
|
|
@@ -35,7 +35,7 @@ async function request(host, pathname, { method = "GET", body, timeoutMs = 5_000
|
|
|
35
35
|
} catch {
|
|
36
36
|
payload = undefined;
|
|
37
37
|
}
|
|
38
|
-
return { status: response.status, body: payload };
|
|
38
|
+
return { status: response.status, body: payload, headers: response.headers };
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
async function waitForSseEvent(tabId, predicate, trigger) {
|
|
@@ -114,6 +114,7 @@ const harnessSideEffectsRoot = await mkdtemp(path.join(tmpdir(), "pi-webui-http-
|
|
|
114
114
|
const settingsFile = path.join(harnessSideEffectsRoot, "webui-settings.json");
|
|
115
115
|
const openCommandLog = path.join(harnessSideEffectsRoot, "open-default.log");
|
|
116
116
|
const fakePiCommandLog = path.join(harnessSideEffectsRoot, "fake-pi-commands.jsonl");
|
|
117
|
+
const recoveryEndpointToken = "test-recovery-token-6e1cc61d22d44c8dbf3c";
|
|
117
118
|
const openCommandScript = path.join(harnessSideEffectsRoot, "fake-open-default.mjs");
|
|
118
119
|
const fakeOpenBinDir = path.join(harnessSideEffectsRoot, "bin");
|
|
119
120
|
const artifactRoot = path.join(harnessSideEffectsRoot, "artifacts"), artifactDir = path.join(artifactRoot, "fixture-document-artifact"), artifactManifest = path.join(artifactDir, "manifest.json"), artifactDownload = path.join(artifactDir, "document.docx"), artifactPage = path.join(artifactDir, "page-1.png"), artifactExpiresAt = new Date(Date.now() + 60 * 60 * 1000).toISOString();
|
|
@@ -146,6 +147,17 @@ const voiceProvider = createServer(async (req, res) => {
|
|
|
146
147
|
res.end(Buffer.from("fake mp3 bytes"));
|
|
147
148
|
return;
|
|
148
149
|
}
|
|
150
|
+
if (req.url?.startsWith("/pi-releases/")) {
|
|
151
|
+
const tagName = decodeURIComponent(req.url.slice("/pi-releases/".length));
|
|
152
|
+
res.writeHead(200, { "content-type": "application/json" });
|
|
153
|
+
res.end(JSON.stringify({
|
|
154
|
+
tag_name: tagName,
|
|
155
|
+
name: `Pi ${tagName} test release`,
|
|
156
|
+
body: "## Highlights\n\n- Release notes from the test GitHub endpoint.",
|
|
157
|
+
published_at: "2026-07-16T12:00:00Z",
|
|
158
|
+
}));
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
149
161
|
res.writeHead(404, { "content-type": "application/json" });
|
|
150
162
|
res.end(JSON.stringify({ error: "not found" }));
|
|
151
163
|
});
|
|
@@ -170,8 +182,10 @@ const child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "0.
|
|
|
170
182
|
FAKE_PI_ARTIFACT_DOWNLOAD: artifactDownload,
|
|
171
183
|
FAKE_PI_LOG_FILE: fakePiCommandLog,
|
|
172
184
|
FAKE_PI_VOICE_SCRIPTS: "1",
|
|
185
|
+
PI_WEBUI_RECOVERY_TOKEN: recoveryEndpointToken,
|
|
173
186
|
PI_VOICE_STT_URL: `http://127.0.0.1:${voiceProviderPort}/stt`,
|
|
174
187
|
PI_VOICE_TTS_URL: `http://127.0.0.1:${voiceProviderPort}/tts`,
|
|
188
|
+
PI_WEBUI_PI_RELEASES_API_BASE_URL: `http://127.0.0.1:${voiceProviderPort}/pi-releases`,
|
|
175
189
|
},
|
|
176
190
|
});
|
|
177
191
|
let serverOutput = "";
|
|
@@ -198,6 +212,19 @@ try {
|
|
|
198
212
|
assert.equal(health?.status, 200, `server should become healthy, output:\n${serverOutput}`);
|
|
199
213
|
assert.equal(health.body.ok, true);
|
|
200
214
|
assert.equal(health.body.piRunning, true, "fake pi RPC process should be attached and running");
|
|
215
|
+
assert.match(health.body.piVersion, /^\d+\.\d+\.\d+/, "health metadata should expose the installed Pi version");
|
|
216
|
+
|
|
217
|
+
const releaseNotes = await request("127.0.0.1", "/api/pi-release-notes");
|
|
218
|
+
assert.equal(releaseNotes.status, 200, `Pi release notes should load through the server: ${releaseNotes.body?.error || ""}`);
|
|
219
|
+
assert.equal(releaseNotes.body?.data?.version, health.body.piVersion);
|
|
220
|
+
assert.equal(releaseNotes.body?.data?.tagName, `v${health.body.piVersion}`);
|
|
221
|
+
assert.equal(releaseNotes.body?.data?.title, `Pi v${health.body.piVersion} test release`);
|
|
222
|
+
assert.match(releaseNotes.body?.data?.body || "", /Release notes from the test GitHub endpoint/);
|
|
223
|
+
assert.equal(releaseNotes.body?.data?.url, `https://github.com/earendil-works/pi/releases/tag/v${health.body.piVersion}`);
|
|
224
|
+
assert.equal(releaseNotes.headers.get("cache-control"), "private, no-store", "browser caches should not retain notes across Pi upgrades");
|
|
225
|
+
const cachedReleaseNotes = await request("127.0.0.1", "/api/pi-release-notes");
|
|
226
|
+
assert.equal(cachedReleaseNotes.body?.data?.tagName, `v${health.body.piVersion}`);
|
|
227
|
+
assert.equal(voiceProviderRequests.filter((item) => item.url === `/pi-releases/v${health.body.piVersion}`).length, 1, "the server should fetch each installed Pi release only once");
|
|
201
228
|
|
|
202
229
|
// Static assets: brotli/gzip compression plus ETag revalidation (P0-2).
|
|
203
230
|
const brotliResponse = await fetch(`http://127.0.0.1:${port}/app.js`, {
|
|
@@ -242,6 +269,21 @@ try {
|
|
|
242
269
|
const rawVoiceModuleSize = (await stat(join(root, "public", "voice-conversation.mjs"))).size;
|
|
243
270
|
assert.equal(voiceModuleBody.byteLength, rawVoiceModuleSize, "served voice-conversation.mjs should match the raw file byte-for-byte in size");
|
|
244
271
|
|
|
272
|
+
// app.js imports this pure Guided Git review gate at startup. Fetch it over
|
|
273
|
+
// the real server so an omitted static allowlist entry cannot 404 the UI.
|
|
274
|
+
const guidedGitReviewStateResponse = await fetch(`http://127.0.0.1:${port}/guided-git-review-state.mjs`, {
|
|
275
|
+
signal: AbortSignal.timeout(5_000),
|
|
276
|
+
});
|
|
277
|
+
assert.equal(guidedGitReviewStateResponse.status, 200, "guided-git-review-state.mjs must be served for the Guided Git review gate");
|
|
278
|
+
assert.match(guidedGitReviewStateResponse.headers.get("content-type") || "", /text\/javascript/, "guided-git-review-state.mjs should use a JavaScript MIME type");
|
|
279
|
+
assert.equal(await guidedGitReviewStateResponse.text(), await readFile(join(root, "public", "guided-git-review-state.mjs"), "utf8"), "served Guided Git review state must match the source module");
|
|
280
|
+
for (const moduleName of ["aur-review-payload.mjs", "guided-git-command-state.mjs"]) {
|
|
281
|
+
const response = await fetch(`http://127.0.0.1:${port}/${moduleName}`, { signal: AbortSignal.timeout(5_000) });
|
|
282
|
+
assert.equal(response.status, 200, `${moduleName} must be served for the Guided Git review gate`);
|
|
283
|
+
assert.match(response.headers.get("content-type") || "", /text\/javascript/, `${moduleName} should use a JavaScript MIME type`);
|
|
284
|
+
assert.equal(await response.text(), await readFile(join(root, "public", moduleName), "utf8"), `served ${moduleName} must match the source module`);
|
|
285
|
+
}
|
|
286
|
+
|
|
245
287
|
const mermaidModuleResponse = await fetch(`http://127.0.0.1:${port}/vendor/mermaid/mermaid.esm.min.mjs`, {
|
|
246
288
|
signal: AbortSignal.timeout(5_000),
|
|
247
289
|
});
|
|
@@ -263,6 +305,12 @@ try {
|
|
|
263
305
|
const tabId = tabList[0].id;
|
|
264
306
|
assert.ok(tabId, "tab should have an id");
|
|
265
307
|
|
|
308
|
+
const optionalFeatures = await request("127.0.0.1", "/api/optional-features");
|
|
309
|
+
assert.equal(optionalFeatures.status, 200, "optional feature status should load");
|
|
310
|
+
const aurReviewFeature = optionalFeatures.body?.data?.features?.find((feature) => feature.featureId === "aurReview");
|
|
311
|
+
assert.equal(aurReviewFeature?.installed, true, "workspace discovery should find the local pi-extension-aur-review sibling without an npm dependency");
|
|
312
|
+
assert.equal(path.basename(aurReviewFeature?.installedRoot || ""), "pi-extension-aur-review", "aur-review discovery must validate the exact sibling manifest/name");
|
|
313
|
+
|
|
266
314
|
const sessionToolsBefore = await request("127.0.0.1", `/api/tools?tab=${encodeURIComponent(tabId)}&scope=session`);
|
|
267
315
|
assert.equal(sessionToolsBefore.status, 200);
|
|
268
316
|
assert.equal(sessionToolsBefore.body?.data?.scope, "session");
|
|
@@ -382,6 +430,25 @@ try {
|
|
|
382
430
|
assert.equal(subagentOutputResponse.body?.data?.agent?.name, "reviewer", "subagent output should target the selected child agent");
|
|
383
431
|
assert.deepEqual(subagentOutputResponse.body?.data?.agent?.recentOutput, ["Inspecting current implementation", "Waiting for the next tool result"], "subagent output should preserve bounded live output lines");
|
|
384
432
|
assert.equal(subagentOutputResponse.body?.data?.agent?.currentToolArgs, "README.md", "subagent output should include current tool state");
|
|
433
|
+
assert.deepEqual(subagentOutputResponse.body?.data?.agent?.transcript, [
|
|
434
|
+
{
|
|
435
|
+
role: "assistant",
|
|
436
|
+
timestamp: "2026-07-19T12:00:00.000Z",
|
|
437
|
+
content: [
|
|
438
|
+
{ type: "thinking", thinking: "Checking the fixture transcript." },
|
|
439
|
+
{ type: "text", text: "Inspecting current implementation" },
|
|
440
|
+
{ type: "toolCall", id: "fixture-read", name: "read", arguments: "{\"path\":\"README.md\",\"offset\":1}" },
|
|
441
|
+
{ type: "text", text: "Waiting for the next tool result" },
|
|
442
|
+
],
|
|
443
|
+
},
|
|
444
|
+
{
|
|
445
|
+
role: "toolResult",
|
|
446
|
+
timestamp: "2026-07-19T12:00:01.000Z",
|
|
447
|
+
toolCallId: "fixture-read",
|
|
448
|
+
toolName: "read",
|
|
449
|
+
content: [{ type: "text", text: "# Fixture README" }],
|
|
450
|
+
},
|
|
451
|
+
], "subagent output endpoint should preserve normalized structured transcript roles, order, IDs, and tool metadata");
|
|
385
452
|
const unknownSubagentOutput = await request("127.0.0.1", `/api/subagents/output?tab=${encodeURIComponent(tabId)}&run=missing&agent=missing`);
|
|
386
453
|
assert.equal(unknownSubagentOutput.status, 404, "subagent output endpoint should reject untracked selections");
|
|
387
454
|
const subagentFixtureClear = await request("127.0.0.1", "/api/prompt", { method: "POST", body: { tab: tabId, message: "fixture subagents clear" } });
|
|
@@ -1028,6 +1095,58 @@ try {
|
|
|
1028
1095
|
const closeGitActionTabs = await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [stagingTab, truncationTab, mergeTab, abortTab, rebaseTab, bisectTab, stashTab, undoTab] }, timeoutMs: 10_000 });
|
|
1029
1096
|
assert.equal(closeGitActionTabs.status, 200, "git action fixture tabs should close");
|
|
1030
1097
|
await rmWithRetry(gitFixturesRoot);
|
|
1098
|
+
|
|
1099
|
+
// AUR-review paths are repo-root-relative even when a tab starts in a
|
|
1100
|
+
// subdirectory. The dedicated read-only route must not reuse cwd-scoped
|
|
1101
|
+
// workspace file access.
|
|
1102
|
+
const reportRepo = await mkdtemp(path.join(tmpdir(), "pi-webui-aur-report-"));
|
|
1103
|
+
let reportTabId = "";
|
|
1104
|
+
try {
|
|
1105
|
+
const reportSubdir = path.join(reportRepo, "subdir");
|
|
1106
|
+
const reportPath = path.join(reportRepo, "reports", "audit.md");
|
|
1107
|
+
const oversizedReportPath = path.join(reportRepo, "reports", "oversized.md");
|
|
1108
|
+
await mkdir(reportSubdir, { recursive: true });
|
|
1109
|
+
await mkdir(path.dirname(reportPath), { recursive: true });
|
|
1110
|
+
runGitFixture(["init", "-b", "main"], reportRepo, "report fixture should initialize");
|
|
1111
|
+
await writeFile(reportPath, "# Audit report\n\nCanonical repo-root report.\n", "utf8");
|
|
1112
|
+
const reportTab = await request("127.0.0.1", "/api/tabs", { method: "POST", body: { cwd: reportSubdir, title: "aur-report-subdir" } });
|
|
1113
|
+
assert.equal(reportTab.status, 201, `subdirectory report tab should open: ${reportTab.body?.error || ""}`);
|
|
1114
|
+
reportTabId = reportTab.body?.data?.tab?.id || "";
|
|
1115
|
+
assert.ok(reportTabId, "subdirectory report tab should have an id");
|
|
1116
|
+
const reportRequestPath = (reportFile, repoRoot = reportRepo) => `/api/aur-review/report-content?tab=${encodeURIComponent(reportTabId)}&path=${encodeURIComponent(reportFile)}&repoRoot=${encodeURIComponent(repoRoot)}`;
|
|
1117
|
+
|
|
1118
|
+
const cwdScopedMiss = await request("127.0.0.1", `/api/files/content?tab=${encodeURIComponent(reportTabId)}&path=${encodeURIComponent("reports/audit.md")}`);
|
|
1119
|
+
assert.equal(cwdScopedMiss.status, 404, "generic workspace file access must remain scoped to the tab subdirectory");
|
|
1120
|
+
const openedReport = await request("127.0.0.1", reportRequestPath("reports/audit.md"));
|
|
1121
|
+
assert.equal(openedReport.status, 200, `repo-root report should open from a subdirectory tab: ${openedReport.body?.error || ""}`);
|
|
1122
|
+
assert.equal(openedReport.body?.data?.root, reportRepo, "report endpoint should return the canonical Git root");
|
|
1123
|
+
assert.equal(openedReport.body?.data?.path, "reports/audit.md", "report endpoint should retain the repo-relative report path");
|
|
1124
|
+
assert.equal(openedReport.body?.data?.content, "# Audit report\n\nCanonical repo-root report.\n");
|
|
1125
|
+
assert.equal(openedReport.body?.data?.language, "markdown", "repo-root reports should use the existing Markdown viewer metadata");
|
|
1126
|
+
|
|
1127
|
+
const wrongRoot = await request("127.0.0.1", reportRequestPath("reports/audit.md", reportSubdir));
|
|
1128
|
+
assert.equal(wrongRoot.status, 403, "report endpoint must require the payload repoRoot to equal the canonical Git root");
|
|
1129
|
+
const traversal = await request("127.0.0.1", reportRequestPath("../reports/audit.md"));
|
|
1130
|
+
assert.equal(traversal.status, 400, "report endpoint must reject traversal paths");
|
|
1131
|
+
const absolute = await request("127.0.0.1", reportRequestPath(reportPath));
|
|
1132
|
+
assert.equal(absolute.status, 400, "report endpoint must reject absolute report paths");
|
|
1133
|
+
const nonRegular = await request("127.0.0.1", reportRequestPath("reports"));
|
|
1134
|
+
assert.equal(nonRegular.status, 400, "report endpoint must reject non-regular paths");
|
|
1135
|
+
await writeFile(oversizedReportPath, Buffer.alloc(2 * 1024 * 1024 + 1, 0x61));
|
|
1136
|
+
const oversized = await request("127.0.0.1", reportRequestPath("reports/oversized.md"));
|
|
1137
|
+
assert.equal(oversized.status, 413, "report endpoint must reject oversized reports before returning content");
|
|
1138
|
+
try {
|
|
1139
|
+
await symlink(reportPath, path.join(reportRepo, "reports", "audit-link.md"));
|
|
1140
|
+
const symlinked = await request("127.0.0.1", reportRequestPath("reports/audit-link.md"));
|
|
1141
|
+
assert.equal(symlinked.status, 403, "report endpoint must reject symlinked reports even when their targets stay in the repository");
|
|
1142
|
+
} catch (error) {
|
|
1143
|
+
if (!["EPERM", "EACCES", "EINVAL", "ENOTSUP"].includes(error?.code)) throw error;
|
|
1144
|
+
console.log(`http-endpoints-harness: symlink unavailable (${error.code}); skipping report symlink check`);
|
|
1145
|
+
}
|
|
1146
|
+
} finally {
|
|
1147
|
+
if (reportTabId) await request("127.0.0.1", "/api/tabs/close", { method: "POST", body: { ids: [reportTabId] }, timeoutMs: 10_000 });
|
|
1148
|
+
await rmWithRetry(reportRepo);
|
|
1149
|
+
}
|
|
1031
1150
|
} else {
|
|
1032
1151
|
console.log("http-endpoints-harness: git not available; skipping git init workflow endpoint checks");
|
|
1033
1152
|
}
|
|
@@ -1695,6 +1814,68 @@ try {
|
|
|
1695
1814
|
console.log("http-endpoints-harness: no LAN address detected; skipping remote-client checks");
|
|
1696
1815
|
}
|
|
1697
1816
|
|
|
1817
|
+
const recoveryTabsBefore = await request("127.0.0.1", "/api/tabs");
|
|
1818
|
+
const sourceTabId = recoveryTabsBefore.body?.data?.tabs?.[0]?.id;
|
|
1819
|
+
assert.ok(sourceTabId, "recovery endpoint test needs an active source tab");
|
|
1820
|
+
const recoveryBody = {
|
|
1821
|
+
prompt: "Inspect the Anthropic compatibility patch and run status/plan only.",
|
|
1822
|
+
cwd,
|
|
1823
|
+
model: { provider: "fake", id: "fake-model" },
|
|
1824
|
+
mode: "plan-only",
|
|
1825
|
+
};
|
|
1826
|
+
const unauthenticatedRecovery = await request("127.0.0.1", "/api/recovery/plan", { method: "POST", body: recoveryBody });
|
|
1827
|
+
assert.equal(unauthenticatedRecovery.status, 401, "recovery endpoint must reject missing bearer credentials");
|
|
1828
|
+
const wrongCredentialRecovery = await request("127.0.0.1", "/api/recovery/plan", {
|
|
1829
|
+
method: "POST",
|
|
1830
|
+
headers: { authorization: "Bearer wrong-recovery-token" },
|
|
1831
|
+
body: recoveryBody,
|
|
1832
|
+
});
|
|
1833
|
+
assert.equal(wrongCredentialRecovery.status, 401, "recovery endpoint must reject an incorrect bearer credential");
|
|
1834
|
+
const invalidModeRecovery = await request("127.0.0.1", "/api/recovery/plan", {
|
|
1835
|
+
method: "POST",
|
|
1836
|
+
headers: { authorization: `Bearer ${recoveryEndpointToken}` },
|
|
1837
|
+
body: { ...recoveryBody, mode: "apply" },
|
|
1838
|
+
});
|
|
1839
|
+
assert.equal(invalidModeRecovery.status, 400, "recovery endpoint must accept plan-only mode exclusively");
|
|
1840
|
+
if (lan) {
|
|
1841
|
+
const remoteRecovery = await request(lan, "/api/recovery/plan", {
|
|
1842
|
+
method: "POST",
|
|
1843
|
+
headers: { authorization: `Bearer ${recoveryEndpointToken}` },
|
|
1844
|
+
body: recoveryBody,
|
|
1845
|
+
});
|
|
1846
|
+
assert.equal(remoteRecovery.status, 403, "even a credentialed LAN client must not open recovery plans");
|
|
1847
|
+
}
|
|
1848
|
+
const rejectedRecovery = await request("127.0.0.1", "/api/recovery/plan", {
|
|
1849
|
+
method: "POST",
|
|
1850
|
+
headers: { authorization: `Bearer ${recoveryEndpointToken}` },
|
|
1851
|
+
body: { ...recoveryBody, model: { provider: "fake", id: "missing-model" } },
|
|
1852
|
+
});
|
|
1853
|
+
assert.equal(rejectedRecovery.status, 409, "an unavailable recovery model should be rejected");
|
|
1854
|
+
const recoveryTabsAfterRejection = await request("127.0.0.1", "/api/tabs");
|
|
1855
|
+
assert.equal(recoveryTabsAfterRejection.body?.data?.tabs?.length, recoveryTabsBefore.body?.data?.tabs?.length, "failed recovery initialization must discard its temporary tab");
|
|
1856
|
+
const recoveryOpened = await waitForSseEvent(
|
|
1857
|
+
sourceTabId,
|
|
1858
|
+
(event) => event.type === "webui_recovery_opened",
|
|
1859
|
+
() => request("127.0.0.1", "/api/recovery/plan", {
|
|
1860
|
+
method: "POST",
|
|
1861
|
+
headers: { authorization: `Bearer ${recoveryEndpointToken}` },
|
|
1862
|
+
body: recoveryBody,
|
|
1863
|
+
}),
|
|
1864
|
+
);
|
|
1865
|
+
assert.equal(recoveryOpened.triggerResult.status, 201, `recovery endpoint should create a tab: ${recoveryOpened.triggerResult.body?.error || ""}`);
|
|
1866
|
+
assert.equal(recoveryOpened.triggerResult.body?.requestId, recoveryOpened.event.recoveryTabId);
|
|
1867
|
+
assert.equal(recoveryOpened.event.model?.provider, "fake");
|
|
1868
|
+
const recoveryTabs = await request("127.0.0.1", "/api/tabs");
|
|
1869
|
+
const recoveryTab = recoveryTabs.body?.data?.tabs?.find((tab) => tab.id === recoveryOpened.event.recoveryTabId);
|
|
1870
|
+
assert.equal(recoveryTab?.title, "Anthropic compatibility recovery");
|
|
1871
|
+
assert.equal(recoveryTab?.cwd, cwd);
|
|
1872
|
+
assert.equal(recoveryTab?.activity?.isWorking, true);
|
|
1873
|
+
const recoveryCommands = (await readFile(fakePiCommandLog, "utf8")).trim().split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
|
|
1874
|
+
assert.ok(recoveryCommands.some((entry) => entry.direction === "startup" && entry.recoveryUrl === `http://127.0.0.1:${port}/api/recovery/plan` && entry.recoveryTokenConfigured), "Pi RPC children should receive the internal recovery URL and a credential");
|
|
1875
|
+
const recoveryModelIndex = recoveryCommands.findIndex((entry) => entry.direction === "command" && entry.type === "set_model" && entry.provider === "fake" && entry.modelId === "fake-model");
|
|
1876
|
+
const recoveryPromptIndex = recoveryCommands.findIndex((entry) => entry.direction === "command" && entry.type === "prompt" && entry.message === recoveryBody.prompt);
|
|
1877
|
+
assert.ok(recoveryModelIndex >= 0 && recoveryPromptIndex > recoveryModelIndex, "recovery should select the requested model before sending the plan-only prompt");
|
|
1878
|
+
|
|
1698
1879
|
const localClose = await request("127.0.0.1", "/api/network/close", { method: "POST" });
|
|
1699
1880
|
assert.equal(localClose.status, 202, "network close from localhost should be accepted");
|
|
1700
1881
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { readFile } from "node:fs/promises";
|
|
3
|
+
import vm from "node:vm";
|
|
3
4
|
import { dirname, join } from "node:path";
|
|
4
5
|
import { fileURLToPath } from "node:url";
|
|
5
6
|
|
|
@@ -26,20 +27,27 @@ const manifest = JSON.parse(manifestRaw);
|
|
|
26
27
|
const lock = JSON.parse(await readFile(join(root, "package-lock.json"), "utf8"));
|
|
27
28
|
const helper = await readFile(join(root, "webui-rpc-helper.mjs"), "utf8");
|
|
28
29
|
const codexAuth = await readFile(join(root, "lib", "codex-usage-auth.mjs"), "utf8");
|
|
30
|
+
|
|
31
|
+
function appFunctionSource(name, nextName) {
|
|
32
|
+
const start = app.indexOf(`function ${name}(`);
|
|
33
|
+
const end = app.indexOf(`\nfunction ${nextName}(`, start);
|
|
34
|
+
assert.ok(start >= 0 && end > start, `${name} should remain a standalone frontend helper`);
|
|
35
|
+
return app.slice(start, end);
|
|
36
|
+
}
|
|
29
37
|
const nativeExportPayload = await readFile(join(root, "lib", "native-export-payload.mjs"), "utf8");
|
|
30
38
|
const companionDependencies = {
|
|
31
39
|
"@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
|
|
32
|
-
"@firstpick/pi-extension-btw": "^0.1.
|
|
40
|
+
"@firstpick/pi-extension-btw": "^0.1.3",
|
|
33
41
|
"@firstpick/pi-extension-fish-user-bash": "^0.2.1",
|
|
34
|
-
"@firstpick/pi-extension-git-footer-status": "^0.
|
|
42
|
+
"@firstpick/pi-extension-git-footer-status": "^0.4.0",
|
|
35
43
|
"@firstpick/pi-extension-release-aur": "^0.1.7",
|
|
36
|
-
"@firstpick/pi-extension-release-npm": "^0.4.
|
|
37
|
-
"@firstpick/pi-extension-safety-guard": "^0.2.
|
|
44
|
+
"@firstpick/pi-extension-release-npm": "^0.4.1",
|
|
45
|
+
"@firstpick/pi-extension-safety-guard": "^0.2.5",
|
|
38
46
|
"@firstpick/pi-extension-setup-skills": "^0.1.8",
|
|
39
47
|
"@firstpick/pi-extension-stats": "^0.2.8",
|
|
40
|
-
"@firstpick/pi-extension-todo-progress": "^0.2.
|
|
48
|
+
"@firstpick/pi-extension-todo-progress": "^0.2.8",
|
|
41
49
|
"@firstpick/pi-extension-tools": "^0.1.6",
|
|
42
|
-
"@firstpick/pi-extension-workflows": "^0.1.
|
|
50
|
+
"@firstpick/pi-extension-workflows": "^0.1.3",
|
|
43
51
|
"@firstpick/pi-package-remote-webui": "^0.1.5",
|
|
44
52
|
"@firstpick/pi-prompts-git-pr": "^0.1.3",
|
|
45
53
|
"@firstpick/pi-themes-bundle": "^0.1.4",
|
|
@@ -59,9 +67,17 @@ assert.match(html, /id="newTabChooseDirectoryButton" class="terminal-new-tab-men
|
|
|
59
67
|
assert.match(html, /id="newTabWorktreeButton" class="terminal-new-tab-menu-item composer-publish-menu-item"[\s\S]*<span>Branch Worktree…<\/span>/, "new-tab menu should offer branch worktree tabs");
|
|
60
68
|
assert.match(html, /id="closeAllTabsButton"[\s\S]*?>Close all Tabs<\/button>/, "tab header should expose a top-right close-all tabs action");
|
|
61
69
|
assert.match(html, /id="sidePanelBackdrop"/, "mobile side panel needs an overlay/backdrop close target");
|
|
62
|
-
assert.match(html, /<
|
|
70
|
+
assert.match(html, /<div class="side-panel-heading">[\s\S]*<strong class="side-panel-title">Control Deck<\/strong>[\s\S]*<div class="side-panel-version-row"[\s\S]*<button id="piVersionButton"[\s\S]*aria-controls="piReleaseNotesDialog"[\s\S]*<button id="webuiVersionButton"[\s\S]*aria-controls="confirmationDialog"[\s\S]*id="webuiDevBadge"/, "Control Deck header should keep its title separate from an aligned version and build row");
|
|
71
|
+
assert.match(html, /<div class="side-panel-brand-row">[\s\S]*<span class="side-panel-kicker">Pi Web UI<\/span>[\s\S]*<a class="sponsor-link" href="https:\/\/github\.com\/sponsors\/Firstp1ck" target="_blank" rel="noopener noreferrer" aria-label="Sponsor Firstp1ck on GitHub"[^>]*>♡<\/a>/, "Control Deck brand should expose a subtle, accessible sponsor link beside the Pi Web UI name");
|
|
72
|
+
assert.match(html, /<dialog id="piReleaseNotesDialog"[\s\S]*id="piReleaseNotesTitle"[\s\S]*id="piReleaseNotesStatus"[\s\S]*id="piReleaseNotesBody"[\s\S]*id="piReleaseNotesGithubLink"/, "Pi release notes should use a dedicated accessible dialog");
|
|
73
|
+
assert.doesNotMatch(html, /Safer option|confirmationAlternative/, "shared confirmation dialogs should not render a safer-option row");
|
|
74
|
+
assert.doesNotMatch(app, /confirmationAlternative|\balternative:\s*options\.alternative/, "confirmation logic should not populate a removed safer-option row");
|
|
63
75
|
assert.doesNotMatch(html, /id="sessionLine"/, "Control Deck title should not show verbose session status metadata");
|
|
64
76
|
assert.match(html, /id="themeSelect"/, "side panel should expose a theme selector");
|
|
77
|
+
assert.match(html, /class="controls-intro"[\s\S]*aria-labelledby="sessionControlsTitle"[\s\S]*aria-labelledby="interfaceControlsTitle"[\s\S]*id="networkControlField"[\s\S]*aria-labelledby="serverControlsTitle"/, "Controls should explain scope and group session, interface, remote-access, and server settings in task order");
|
|
78
|
+
assert.match(html, /id="sessionControlsTitle">Active session<[\s\S]*class="control-scope-badge">This tab<[\s\S]*id="interfaceControlsTitle">Interface<[\s\S]*class="control-scope-badge">This browser</, "Controls groups should state whether settings affect the active tab or this browser");
|
|
79
|
+
assert.match(html, /class="control-action-row">[\s\S]*id="modelSelect"[\s\S]*id="setModelButton"[^>]*>Apply<\/button>[\s\S]*id="thinkingSelect"[\s\S]*id="setThinkingButton"[^>]*>Apply<\/button>/, "model and thinking controls should keep their apply actions beside the selection");
|
|
80
|
+
assert.match(css, /\.control-group-header[\s\S]*\.control-scope-badge[\s\S]*\.control-action-row/, "Controls should visually separate group headers, scope badges, and compact action rows");
|
|
65
81
|
assert.match(html, /<label for="themeSelect"[^>]*id="themeControlLabel"[^>]*>Theme<\/label>/, "theme selector should be labeled in side-panel controls");
|
|
66
82
|
assert.match(html, /id="themeSearchInput"[\s\S]*id="themeSelect"[\s\S]*id="themeSearchResults"/, "side-panel theme selector should expose searchable theme results");
|
|
67
83
|
assert.match(html, /id="backgroundInput"[^>]*type="file"[^>]*accept="image\/png,image\/jpeg,image\/webp,image\/gif"/, "side panel should expose an image picker for custom backgrounds");
|
|
@@ -90,13 +106,13 @@ assert.match(html, /id="pathPickerCreateButton"[^>]*>Create directory<\/button>/
|
|
|
90
106
|
assert.match(html, /id="pathPickerSearchInput"[^>]*type="search"[^>]*placeholder="Search current directory…"/, "cwd picker should expose a current-directory search box");
|
|
91
107
|
assert.match(html, /id="pathPickerClearSearchButton"[^>]*hidden[^>]*>Clear<\/button>/, "cwd picker should expose a clear-search action");
|
|
92
108
|
assert.match(app, /function fileTreeGitStatusForEntry\(entry = \{\}\) \{\s+return fileTreeState\.gitStatusByPath\.get\(normalizeFileTreePath\(entry\.path \|\| ""\)\) \|\| null;\s+\}/, "file tree rendering should use the refreshed Git-status snapshot instead of stale status embedded in cached entries");
|
|
93
|
-
assert.match(app, /
|
|
109
|
+
assert.match(app, /confirmLabel: activeAgentTabs\.length \? "Close and stop work" : count === 1 \? "Close tab" : "Close tabs"/, "single-tab confirmation should use singular close wording");
|
|
94
110
|
assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
|
|
95
111
|
assert.match(html, /class="optional-features-description[\s\S]*href="https:\/\/github\.com\/Firstp1ck\/npm-packages\/issues\/new"[\s\S]*open a GitHub issue/, "optional features should link users to GitHub issues for additional feature requests");
|
|
96
112
|
assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
|
|
97
113
|
assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
|
|
98
114
|
assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
|
|
99
|
-
assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*id="subagentsBox"/, "side panel should expose grouped running
|
|
115
|
+
assert.match(html, /data-side-panel-section="subagents"[\s\S]*class="side-panel-section-label">Subagents<\/span>[\s\S]*id="subagentCountBadge"[\s\S]*class="subagents-help"[\s\S]*<code>subagent<\/code>[\s\S]*foreground or async mode[\s\S]*id="subagentsBox"/, "side panel should explain how to launch tracked subagents and expose grouped running agents with a live count");
|
|
100
116
|
assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
|
|
101
117
|
assert.match(html, /data-side-panel-section="session"[\s\S]*data-side-panel-section="subagents"[\s\S]*data-side-panel-section="queue"/, "Subagents should appear between Session and Queue in the side panel");
|
|
102
118
|
assert.match(html, /data-side-panel-section="queue"[\s\S]*id="createPromptListButton"[\s\S]*>Create prompt list<\/button>/, "Queue section should expose prompt-list creation");
|
|
@@ -184,7 +200,10 @@ assert.ok(
|
|
|
184
200
|
);
|
|
185
201
|
assert.match(html, /id="optionsConversationModeButton"[^>]*data-command="\/talk"[^>]*hidden[\s\S]*?<span>Start Conversation<\/span>/, "Options menu should include the feature-gated Natural Conversation toggle");
|
|
186
202
|
assert.match(html, /id="conversationModeChip" class="composer-conversation-mode-chip"[\s\S]*hidden>Voice: off<\/button>/, "composer should expose a hidden-until-active conversation status chip");
|
|
187
|
-
|
|
203
|
+
const workflowModeButtonHtml = html.match(/<button\s+id="workflowModeButton"[\s\S]*?<\/button>/)?.[0] || "";
|
|
204
|
+
assert.match(workflowModeButtonHtml, /class="composer-workflow-mode-button"[\s\S]*aria-pressed="false"[\s\S]*hidden[\s\S]*<span>Workflow<\/span>/, "composer actions should expose a capability-gated Workflow Mode toggle");
|
|
205
|
+
assert.match(workflowModeButtonHtml, /data-tooltip="Workflow Mode:/, "Workflow Mode should retain its styled tooltip");
|
|
206
|
+
assert.doesNotMatch(workflowModeButtonHtml, /\stitle=/, "Workflow Mode should not also expose a browser-native tooltip");
|
|
188
207
|
assert.match(html, /id="workflowModeChip" class="composer-workflow-mode-chip"[\s\S]*hidden>Workflow: on<\/button>/, "composer should expose a hidden-until-active Workflow Mode chip");
|
|
189
208
|
assert.match(html, /id="conversationModeEndButton" class="composer-conversation-end-button"[\s\S]*hidden>End conversation<\/button>/, "composer should expose a persistent End conversation button while active");
|
|
190
209
|
assert.match(html, /id="conversationVoiceMenu" class="composer-publish-menu composer-conversation-voice-menu" hidden>[\s\S]*id="conversationVoiceButton"[\s\S]*id="conversationVoiceMenuPanel" class="composer-publish-menu-panel[\s\S]*id="conversationModeEndButton"/, "composer should expose the conversation voice menu (publish-menu pattern) next to the End conversation button");
|
|
@@ -317,13 +336,20 @@ assert.match(css, /\.session-overview \{[\s\S]*?grid-template-columns:/, "sessio
|
|
|
317
336
|
assert.match(css, /\.session-detail-value\.truncate[\s\S]*?text-overflow:\s*ellipsis/, "long session values should not overwhelm the side panel");
|
|
318
337
|
assert.match(css, /\.server-restart-panel \{[\s\S]*?z-index:\s*62/, "server restart overlay should render above the offline shell");
|
|
319
338
|
assert.match(css, /@keyframes server-restart-spin/, "server restart overlay should show a loading spinner");
|
|
320
|
-
assert.match(css, /\.
|
|
339
|
+
assert.match(css, /\.side-panel-version-row \{[\s\S]*?display:\s*flex[\s\S]*?align-items:\s*center[\s\S]*?flex-wrap:\s*wrap/, "Control Deck versions and build status should use a dedicated responsive row");
|
|
340
|
+
assert.match(css, /\.side-panel-brand-row \{[\s\S]*?display:\s*flex[\s\S]*?align-items:\s*center[\s\S]*?\.sponsor-link \{[\s\S]*?text-decoration:\s*none/, "Sponsor heart should sit inline with the Pi Web UI brand and remain visually subtle");
|
|
341
|
+
assert.match(css, /\.sponsor-link:hover,[\s\S]*?\.sponsor-link:focus-visible/, "Sponsor heart should expose visible hover and keyboard focus states");
|
|
342
|
+
assert.match(css, /\.pi-version-button,\n\.webui-version-button,\n\.webui-dev-badge \{[\s\S]*?border-radius:\s*999px/, "Pi and Web UI version buttons plus the dev indicator should render as compact title controls");
|
|
343
|
+
assert.match(css, /\.webui-version-button:hover,[\s\S]*?\.webui-version-button:focus-visible/, "Web UI version button should expose visible hover and keyboard focus states");
|
|
344
|
+
assert.match(css, /\.pi-version-button:hover,[\s\S]*?\.pi-version-button:focus-visible/, "Pi version button should expose visible hover and keyboard focus states");
|
|
345
|
+
assert.match(css, /\.extension-dialog\.pi-release-notes-dialog \{[\s\S]*?\.pi-release-notes-body \{[\s\S]*?overflow:\s*auto/, "Pi release notes popup should keep long notes scrollable");
|
|
321
346
|
assert.match(css, /\.webui-dev-badge \{[\s\S]*?color:\s*var\(--ctp-yellow\)/, "Web UI dev indicator should have distinct warning styling");
|
|
322
347
|
assert.match(css, /\.side-panel-section\.collapsed \.side-panel-section-content,\n\.side-panel-section-content\[hidden\] \{\n\s+display:\s*none;/, "collapsed side panel section content should be hidden");
|
|
323
348
|
assert.match(css, /\.side-panel-section:not\(\.collapsed\) \.side-panel-section-chevron/, "expanded side panel sections should rotate the chevron");
|
|
349
|
+
assert.match(css, /\.subagents-help \{[\s\S]*border-left:[\s\S]*font-size:\s*0\.7rem;[\s\S]*\.subagents-help code/, "subagent invocation guidance should render as a compact informational callout");
|
|
324
350
|
assert.match(css, /\.subagents-box\.has-items[\s\S]*\.subagent-tab-group[\s\S]*\.subagent-agent-row/, "running subagents should render as grouped terminal/session cards");
|
|
325
351
|
assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
|
|
326
|
-
assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-
|
|
352
|
+
assert.match(css, /\.subagent-overlay-widget[\s\S]*\.subagent-overlay-transcript[\s\S]*\.subagent-overlay-message[\s\S]*\.subagent-overlay-close-action/, "subagent output should combine the non-blocking widget shell with the main transcript message styling");
|
|
327
353
|
assert.match(css, /\.subagent-output-waiting-dot[\s\S]*@keyframes subagent-output-waiting-pulse/, "subagent output should animate one transient ellipsis while waiting");
|
|
328
354
|
assert.doesNotMatch(css, /\.extension-dialog\.subagent-overlay-dialog/, "subagent output should not retain blocking dialog styles");
|
|
329
355
|
assert.match(css, /@keyframes subagent-running-pulse/, "running subagents should expose a live activity indicator");
|
|
@@ -364,8 +390,10 @@ assert.match(css, /\.action-feedback-controls:hover,[\s\S]*?\.action-feedback-co
|
|
|
364
390
|
assert.match(css, /\.action-feedback-controls:not\(:hover\):not\(:focus-within\) \.action-feedback-button/, "hidden action reactions should not expose button hit targets until the hover area is reached");
|
|
365
391
|
assert.match(css, /\.action-feedback-button\.feedback-question\.active/, "question-mark reaction should have selected styling");
|
|
366
392
|
assert.match(css, /\.composer-row button\[data-tooltip\]::after/, "composer button tooltips should be shared across Git, Steer, and Follow-up buttons");
|
|
393
|
+
assert.match(css, /\.composer-row \.composer-workflow-mode-button\[data-tooltip\]::after \{\n\s+max-width:\s*min\(18rem, calc\(100vw - 2rem\)\);/, "Workflow Mode tooltip should stay narrow enough to remain inside the outer chat frame");
|
|
367
394
|
assert.match(css, /\.composer-row \.composer-git-button\[data-tooltip\]::after \{[\s\S]*?left:\s*0;[\s\S]*?right:\s*auto;/, "Git workflow tooltip should open rightward so it is not clipped off the left edge");
|
|
368
395
|
assert.match(css, /\.composer-row button\[data-tooltip\]\.tooltip-open::after/, "composer button tooltips should be triggerable from JS for empty mobile taps");
|
|
396
|
+
assert.match(css, /\.composer-row button\[data-tooltip\]:hover,[\s\S]*?\.composer-input-row button\[data-tooltip\]\.tooltip-open \{\n\s+z-index:\s*40;/, "active composer tooltip triggers should stack above context tags and adjacent controls");
|
|
369
397
|
assert.match(css, /\.footer-floating-tooltip \{[\s\S]*?position:\s*fixed;[\s\S]*?z-index:\s*1000/, "git footer extension boxes should use one viewport-positioned styled tooltip");
|
|
370
398
|
assert.match(css, /\.footer-floating-tooltip \{[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap;/, "git footer tooltips should wrap long paths instead of clipping them");
|
|
371
399
|
assert.doesNotMatch(css, /\.statusbar-git-footer \.footer-(?:metric|meta)\[data-tooltip\]::after/, "git footer chips should not also render a second pseudo-element tooltip");
|
|
@@ -385,10 +413,16 @@ assert.match(css, /body\.composer-actions-open \.composer-actions-panel \{ displ
|
|
|
385
413
|
assert.match(css, /\.terminal-tabs-toggle-button \{ display: none; \}/, "terminal tab toggle should be hidden outside mobile CSS");
|
|
386
414
|
assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.terminal-command-palette-button,\n\s+\.terminal-dashboard-button \{[\s\S]*?display:\s*inline-grid;/, "mobile header should keep the command palette button visible beside the dashboard button");
|
|
387
415
|
assert.match(css, /\.command-palette-close-button \{[\s\S]*?min-width:\s*44px;[\s\S]*?min-height:\s*44px/, "command palette close button should meet touch-target sizing by default");
|
|
388
|
-
assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-dialog \{[\s\S]*?width:\s*min\(100vw - 0\.5rem, 42rem\)[\s\S]*?\.command-palette-list \{[\s\S]*?scrollbar-gutter:\s*auto;[\s\S]*?\.command-palette-item \{[\s\S]*?grid-template-columns:\s*minmax\(3\.4rem, 0\.26fr\) minmax\(0, 1fr\);[\s\S]*?min-height:\s*2\.72rem;/, "mobile command palette results should
|
|
416
|
+
assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-dialog \{[\s\S]*?width:\s*min\(100vw - 0\.5rem, 42rem\)[\s\S]*?\.command-palette-list \{[\s\S]*?align-content:\s*start;[\s\S]*?grid-auto-rows:\s*max-content;[\s\S]*?scrollbar-gutter:\s*auto;[\s\S]*?\.command-palette-item \{[\s\S]*?grid-template-columns:\s*minmax\(3\.4rem, 0\.26fr\) minmax\(0, 1fr\);[\s\S]*?min-height:\s*2\.72rem;/, "mobile command palette results should keep text-height rows and use compact two-column cards");
|
|
389
417
|
assert.match(css, /@media \(max-width: 720px\) \{[\s\S]*?\.command-palette-item-kind \{[\s\S]*?font-size:\s*var\(--text-xs\);[\s\S]*?\.command-palette-item-label \{ font-size:\s*0\.82rem; \}[\s\S]*?\.command-palette-item-description \{ font-size:\s*var\(--text-xs\); \}/, "mobile command palette result text should respect the typography floor");
|
|
390
418
|
assert.match(css, /body\.terminal-tabs-left \.chat-panel \{[\s\S]*?grid-template-columns:\s*clamp\(13rem, 18vw, 19rem\) minmax\(0, 1fr\)/, "terminal tabs left layout should split the chat panel into a sidebar and transcript area");
|
|
391
419
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tabs-shell \{[\s\S]*?grid-column:\s*1;[\s\S]*?grid-row:\s*1 \/ -1;[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should turn the top tab strip into a vertical sidebar");
|
|
420
|
+
assert.match(html, /class="terminal-sidebar-actions"[^>]*aria-label="Tab and workspace actions"[\s\S]*id="splitTabButton"[\s\S]*>Split<\/span>[\s\S]*id="commandPaletteButton"[\s\S]*>Commands<\/span>[\s\S]*id="workspaceDashboardToggleButton"[\s\S]*>Overview<\/span>/, "tab, command, and workspace actions should share one labeled sidebar toolbar");
|
|
421
|
+
assert.match(css, /body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?display:\s*grid;[\s\S]*?grid-template-columns:\s*repeat\(3, minmax\(0, 1fr\)\);[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions > button \{[\s\S]*?min-height:\s*3\.55rem;/, "left-sidebar actions should render as an equal-width three-button toolbar with readable touch targets");
|
|
422
|
+
assert.match(css, /@media \(min-width: 721px\) \{[\s\S]*?body\.terminal-tabs-left \.terminal-sidebar-actions \{[\s\S]*?z-index:\s*130;[\s\S]*?overflow:\s*visible;[\s\S]*?terminal-command-palette-button\[data-tooltip\]::after,[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.62rem\);[\s\S]*?z-index:\s*220;[\s\S]*?width:\s*calc\(300% \+ 0\.84rem\);/, "left-sidebar command and overview tooltips should render above the full toolbar without clipping");
|
|
423
|
+
assert.match(css, /terminal-command-palette-button\[data-tooltip\]::after \{\s+left:\s*calc\(-100% - 0\.42rem\);[\s\S]*?terminal-dashboard-button\[data-tooltip\]::after \{\s+left:\s*calc\(-200% - 0\.84rem\);/, "left-sidebar tooltips should align to the toolbar edges from their individual buttons");
|
|
424
|
+
assert.match(css, /terminal-split-button\[aria-pressed="true"\] \.terminal-sidebar-action-label-split[\s\S]*?display:\s*none;[\s\S]*?terminal-split-button\[aria-pressed="true"\] \.terminal-sidebar-action-label-unsplit[\s\S]*?display:\s*block;/, "split toolbar label should change to Unsplit with the pressed state");
|
|
425
|
+
assert.match(css, /body\.terminal-tabs-left \.terminal-close-all-button \{[\s\S]*?margin-top:\s*0;[\s\S]*?justify-content:\s*center;[\s\S]*?text-align:\s*center;/, "left-sidebar close-all action should remain a separate centered destructive row");
|
|
392
426
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tabs \{[\s\S]*?flex-direction:\s*column/, "terminal tabs left layout should stack tabs vertically");
|
|
393
427
|
assert.match(css, /body\.terminal-tabs-left \.terminal-tab-group-menu \{[\s\S]*?inset:\s*0 auto auto 100%;[\s\S]*?padding-left:\s*var\(--terminal-left-dropdown-bridge\)/, "left-sidebar grouped tab menus should include a hover bridge so they do not vanish between button and dropdown");
|
|
394
428
|
assert.match(css, /body\.terminal-tabs-left \.terminal-new-tab-menu \.composer-publish-menu-panel \{[\s\S]*?inset:\s*0 auto auto 100%;[\s\S]*?padding-left:\s*var\(--terminal-left-dropdown-bridge\)/, "left-sidebar new-tab dropdown should include a hover bridge so it does not vanish between button and dropdown");
|
|
@@ -553,10 +587,16 @@ assert.match(server, /await saveRemoteAuthPreference\(false\)/, "disabling Remot
|
|
|
553
587
|
assert.match(server, /function pinFromHash\(\)[\s\S]*new URLSearchParams\(String\(window\.location\.hash \|\| ""\)\.replace\(\/\^#\/, ""\)\)/, "remote auth page should read QR-provided PINs from the URL fragment");
|
|
554
588
|
assert.match(server, /window\.history\.replaceState\(null, "", window\.location\.pathname \+ \(window\.location\.search \|\| ""\)\)/, "remote auth page should scrub fragment PINs from the address bar before authenticating");
|
|
555
589
|
assert.match(app, /remoteWebuiCommand\(open \? "close" : "open"/, "network open\/close button should dispatch through the Remote WebUI package command");
|
|
556
|
-
assert.match(app, /
|
|
590
|
+
assert.match(app, /piVersionButton: \$\("#piVersionButton"\)/, "frontend should bind the Control Deck Pi version button");
|
|
591
|
+
assert.match(app, /webuiVersionButton: \$\("#webuiVersionButton"\)/, "frontend should bind the Control Deck Web UI version button");
|
|
557
592
|
assert.match(app, /webuiDevBadge: \$\("#webuiDevBadge"\)/, "frontend should bind the Control Deck dev badge");
|
|
558
|
-
assert.match(app, /function
|
|
559
|
-
assert.match(app, /
|
|
593
|
+
assert.match(app, /function openPiReleaseNotes\(\)[\s\S]*api\("\/api\/pi-release-notes", \{ scoped: false \}\)[\s\S]*renderMarkdown\(elements\.piReleaseNotesBody/, "Pi version button should load and render release notes in the popup");
|
|
594
|
+
assert.match(app, /const PI_WEBUI_NPM_URL = "https:\/\/www\.npmjs\.com\/package\/@firstpick\/pi-package-webui"/, "Web UI version button should target the package's public npm page");
|
|
595
|
+
assert.match(app, /async function confirmOpenWebuiNpmPage\(\)[\s\S]*appConfirm\([\s\S]*confirmLabel: "Open npm"[\s\S]*openWebuiNpmPageInNewTab\(\)/, "Web UI version button should ask before opening npm in a new tab");
|
|
596
|
+
assert.match(app, /function refreshWebuiVersion\(\)[\s\S]*api\("\/api\/health", \{ scoped: false \}\)[\s\S]*setWebuiVersion\(health\.webuiVersion\)[\s\S]*setPiVersion\(health\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(health\)\)/, "frontend should load Pi version, Web UI version, and dev mode from health metadata");
|
|
597
|
+
assert.match(app, /case "webui_connected":[\s\S]*setWebuiVersion\(event\.version\)[\s\S]*setPiVersion\(event\.piVersion\)[\s\S]*setWebuiDevServer\(isWebuiDevMetadata\(event\)\)/, "frontend should refresh Pi version, Web UI version, and dev mode from reconnect events");
|
|
598
|
+
assert.match(server, /url\.pathname === "\/api\/pi-release-notes"[\s\S]*installedPiReleaseNotes\(\)/, "server should expose the installed Pi release notes endpoint");
|
|
599
|
+
assert.match(server, /PI_RELEASES_PAGE_BASE_URL = "https:\/\/github\.com\/earendil-works\/pi\/releases\/tag"/, "release-note links should target the official Pi GitHub release page");
|
|
560
600
|
assert.match(server, /const webuiDevServer = isTruthyEnv\(process\.env\.PI_WEBUI_DEV\) \|\| isSourceCheckout\(packageRoot\)/, "server should derive dev mode from PI_WEBUI_DEV or a source checkout");
|
|
561
601
|
assert.match(server, /webuiDev: webuiDevServer,[\s\S]*webuiMode: webuiDevServer \? "dev" : "production"/, "server status should expose Web UI dev mode");
|
|
562
602
|
assert.match(server, /type: "webui_connected",[\s\S]*webuiDev: webuiDevServer,[\s\S]*webuiMode: webuiDevServer \? "dev" : "production"/, "SSE connect event should expose Web UI dev mode");
|
|
@@ -675,19 +715,60 @@ assert.match(
|
|
|
675
715
|
assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
|
|
676
716
|
assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents by terminal and session");
|
|
677
717
|
assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*activeTabId !== tab\.tabId[\s\S]*await switchTab\(tab\.tabId\)[\s\S]*renderWidgets\(\)/, "clicking an agent should switch to its owning tab before rendering the live widget");
|
|
678
|
-
assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s\S]*
|
|
718
|
+
assert.match(app, /function renderWidgets\(\)[\s\S]*renderAppRunnerWidget\(\)[\s\S]*renderSubagentOverlayWidgetSafely\(\)/, "subagent output should render in the shared non-blocking top widget area after App Runner");
|
|
679
719
|
assert.doesNotMatch(app, /subagentOverlayDialog\.showModal|elements\.subagentOverlayDialog/, "subagent output should not open or depend on a modal dialog");
|
|
680
720
|
assert.match(app, /api\(`\/api\/subagents\/output\?\$\{query\}`, \{ scoped: false \}\)/, "subagent overlay should fetch selected live output from the owning tab");
|
|
681
721
|
assert.match(app, /SUBAGENT_OVERLAY_REFRESH_MS = 1000/, "subagent overlay should poll selected live output at a fast cadence");
|
|
682
|
-
assert.match(app, /function
|
|
722
|
+
assert.match(app, /function createMessageBubble\(message,[\s\S]*renderContent\(body, message\.content, \{ markdown: message\.role === "assistant" \}\)[\s\S]*function appendMessage\(message, options = \{\}\)[\s\S]*createMessageBubble\(message, options\)/, "main transcript output should use the reusable message bubble renderer");
|
|
723
|
+
const subagentTranscriptMessagesSource = appFunctionSource("subagentOverlayTranscriptMessages", "subagentOverlayToolArguments");
|
|
724
|
+
assert.ok(subagentTranscriptMessagesSource.includes("message.role === \"assistant\" || message.role === \"toolResult\""), "subagent overlays should retain structured assistant and tool-result entries");
|
|
725
|
+
const subagentToolArgumentsSource = appFunctionSource("subagentOverlayToolArguments", "subagentOverlayTranscriptDisplayMessages");
|
|
726
|
+
assert.ok(subagentToolArgumentsSource.includes("JSON.parse(value)"), "structured tool arguments should be restored for specialized tool renderers");
|
|
727
|
+
const subagentDisplaySource = appFunctionSource("subagentOverlayTranscriptDisplayMessages", "subagentOverlayTranscriptOutputLines");
|
|
728
|
+
assert.ok(subagentDisplaySource.includes("const toolResults = buildToolResultMap(messages);"), "subagent rendering should pair calls with the shared result lookup");
|
|
729
|
+
assert.ok(subagentDisplaySource.includes("role: \"toolExecution\""), "paired subagent calls should use main-transcript toolExecution cards");
|
|
730
|
+
assert.ok(subagentDisplaySource.includes("const result = toolResults.get(displayMessage.toolCallId) || null;") && subagentDisplaySource.includes(" result,"), "incomplete subagent tool calls should remain pending tool cards");
|
|
731
|
+
assert.ok(subagentDisplaySource.includes("if (pairedToolCallIds.has(toolResultCallId(message))) continue;"), "paired tool results should not render as duplicate generic cards");
|
|
732
|
+
const subagentAppendSource = appFunctionSource("appendSubagentOverlayTranscript", "subagentOverlayStateFacts");
|
|
733
|
+
assert.ok(subagentAppendSource.includes("subagentOverlayTranscriptDisplayMessages(messages)"), "subagent bubbles should use the paired structured display sequence");
|
|
734
|
+
assert.ok(subagentAppendSource.includes("createMessageBubble(displayMessage, { transient: true })"), "subagent bubbles should reuse the main message renderer");
|
|
735
|
+
const thinkingVisibilitySource = appFunctionSource("setThinkingOutputVisible", "applyToolOutputExpansionToDom");
|
|
736
|
+
assert.ok(thinkingVisibilitySource.includes("if (subagentOverlaySelection?.tabId === activeTabId) renderWidgets();"), "changing thinking visibility should rerender an open subagent transcript, including finished agents");
|
|
737
|
+
const subagentCopySource = appFunctionSource("subagentOverlayTranscriptOutputLines", "subagentOverlayOutputLines");
|
|
738
|
+
assert.ok(subagentCopySource.includes("messageCopyText(message)"), "global subagent copy should derive from the same structured bubble messages");
|
|
739
|
+
const subagentOutputSource = appFunctionSource("subagentOverlayOutputLines", "subagentOverlayOutputText");
|
|
740
|
+
assert.ok(subagentOutputSource.includes("if (transcriptMessages.length) return subagentOverlayTranscriptOutputLines(data);"), "global subagent copy should prefer structured transcript content over flattened recent output");
|
|
741
|
+
const subagentEmptySource = appFunctionSource("subagentOverlayEmptyTranscriptText", "appendSubagentOutputWaitingIndicator");
|
|
742
|
+
assert.ok(subagentEmptySource.includes("No visible output was captured."), "hidden or non-renderable structured output should have explicit fallback text");
|
|
743
|
+
const subagentRenderErrorSource = appFunctionSource("renderSubagentOverlayErrorWidget", "renderSubagentOverlayWidgetSafely");
|
|
744
|
+
assert.ok(subagentRenderErrorSource.includes("Subagent output unavailable"), "a failed subagent renderer should show a minimal recoverable widget");
|
|
745
|
+
assert.ok(subagentRenderErrorSource.includes("appRunnerActionButton(\"Close\", closeSubagentOverlay"), "the recoverable subagent renderer error widget should provide a Close action");
|
|
746
|
+
assert.doesNotMatch(subagentRenderErrorSource, /addEvent\(/, "renderer failures should not create repeated event-log entries while a refresh retries");
|
|
747
|
+
const subagentSafeRenderSource = appFunctionSource("renderSubagentOverlayWidgetSafely", "renderSubagentOverlayWidget");
|
|
748
|
+
assert.match(subagentSafeRenderSource, /try \{[\s\S]*renderSubagentOverlayWidget\(\)[\s\S]*\} catch \{[\s\S]*renderSubagentOverlayErrorWidget\(\)/, "subagent renderer exceptions should be isolated from the shared widget render pass");
|
|
749
|
+
const rendererFallbackSentinel = {};
|
|
750
|
+
const rendererContainmentResult = vm.runInNewContext(`${subagentSafeRenderSource}\nrenderSubagentOverlayWidgetSafely();`, {
|
|
751
|
+
renderSubagentOverlayWidget() { throw new Error("fixture renderer failure"); },
|
|
752
|
+
renderSubagentOverlayErrorWidget() { return rendererFallbackSentinel; },
|
|
753
|
+
});
|
|
754
|
+
assert.equal(rendererContainmentResult, rendererFallbackSentinel, "subagent renderer failures should return the recoverable fallback widget");
|
|
755
|
+
const subagentWidgetSource = appFunctionSource("renderSubagentOverlayWidget", "scheduleSubagentOverlayRefresh");
|
|
756
|
+
assert.ok(subagentWidgetSource.includes("const visibleFallbackText = !hasStructuredTranscript ? fallbackText : emptyTranscriptFallback;"), "the widget should render a fallback instead of leaving structured-but-hidden output blank");
|
|
757
|
+
assert.ok(subagentWidgetSource.includes("if (visibleFallbackText) {"), "the widget should append the nonblank fallback bubble");
|
|
758
|
+
assert.ok(subagentWidgetSource.includes("if (running && (agent.currentTool || (hasStructuredTranscript && renderedTranscriptMessages === 0))) appendSubagentOutputWaitingIndicator(output);"), "subagent widgets should retain one waiting indicator while structured output is hidden or a tool is running");
|
|
683
759
|
assert.match(app, /api\("\/api\/subagents", \{ scoped: false \}\)/, "frontend should refresh the cross-tab subagent overview");
|
|
684
760
|
assert.match(app, /SUBAGENTS_ACTIVE_REFRESH_MS = 1500/, "running subagents should receive a fast live refresh cadence");
|
|
685
761
|
assert.match(server, /url\.pathname === "\/api\/subagents" && req\.method === "GET"[\s\S]*webuiSubagentsData\(\)/, "server should expose a cross-tab running-subagent endpoint");
|
|
686
762
|
assert.match(server, /url\.pathname === "\/api\/subagents\/output" && req\.method === "GET"[\s\S]*webuiSubagentOutputData\(tab, runId, agentId\)/, "server should expose selected running subagent output only through its owning tab");
|
|
687
763
|
assert.match(server, /rememberWebuiSubagentsStatusEvent\(tab, event\)/, "server should ingest the helper's structured subagent status without forwarding internal JSON to the browser footer");
|
|
764
|
+
assert.match(server, /PI_RPC_JSONL_LINE_MAX_BYTES = 32 \* 1024 \* 1024/, "Pi RPC JSONL parsing should use an explicit line-size limit with inline-image headroom");
|
|
765
|
+
assert.match(server, /function ensureStderrMirrorErrorHandler\(stream\)[\s\S]*stream\.on\("error"/, "Pi stderr mirroring should contain asynchronous closed-sink failures");
|
|
766
|
+
assert.match(server, /type: "pi_stdout_line_too_large"[\s\S]*discardingOversizedLine/, "oversized unterminated Pi RPC lines should be discarded until their newline");
|
|
688
767
|
assert.match(helper, /SUBAGENT_RPC_REQUEST_EVENT = "subagents:rpc:v1:request"/, "Web UI helper should use pi-subagents' stable status RPC");
|
|
689
768
|
assert.match(helper, /case "subagent-output":[\s\S]*subagentOutputSnapshot\(payload\)/, "Web UI helper should return bounded live state and recent output for the selected child agent");
|
|
769
|
+
assert.match(helper, /function subagentTranscriptOutput\(sessionFile\)[\s\S]*const empty = \{ recentOutput: \[\], transcript: \[\] \}[\s\S]*transcript: subagentTranscriptMessages\(boundedCandidates\)/, "subagent transcript extraction should return bounded structured entries alongside recentOutput");
|
|
690
770
|
assert.match(helper, /line\.trim\(\)\.toLowerCase\(\) === "\(no output\)"/, "subagent transcript extraction should suppress empty tool-result markers");
|
|
771
|
+
assert.match(server, /function normalizeWebuiSubagentTranscript\(value\)[\s\S]*remainingParts = WEBUI_SUBAGENT_OUTPUT_LINE_LIMIT[\s\S]*const transcript = normalizeWebuiSubagentTranscript\(rawAgent\.transcript\)/, "server output normalization should preserve the structured transcript under the existing line limit");
|
|
691
772
|
assert.match(helper, /SUBAGENT_ASYNC_STARTED_EVENT = "subagent:async-started"[\s\S]*SUBAGENT_ASYNC_COMPLETE_EVENT = "subagent:async-complete"/, "Web UI helper should track async subagent lifecycle events");
|
|
692
773
|
assert.match(helper, /pi\.on\("tool_execution_start"[\s\S]*event\.toolName !== "subagent"[\s\S]*pi\.on\("tool_execution_end"/, "Web UI helper should track foreground subagent executions");
|
|
693
774
|
assert.match(app, /if \(normalized === "prolite"\) return "Usage";/, "Codex Prolite plan labels should display as Usage in the side panel");
|
|
@@ -695,6 +776,9 @@ assert.match(app, /api\(`\/api\/codex-usage\$\{suffix\}`, \{ scoped: false \}\)/
|
|
|
695
776
|
assert.match(app, /restoreSidePanelSectionState\(\);\nbindSidePanelSectionToggles\(\);/, "side panel section state should restore before toggles are bound");
|
|
696
777
|
assert.match(app, /OPTIONAL_FEATURES_STORAGE_KEY/, "optional feature disable toggles should persist in browser storage");
|
|
697
778
|
assert.match(app, /GIT_FOOTER_WEBUI_STATUS_KEY = "git-footer-webui"/, "git footer Web UI data should be received as an extension-owned status payload");
|
|
779
|
+
assert.match(html, /gitFooterVisibilityApplyButton[^>]*>Save globally</, "git footer visibility should state that applied choices persist globally");
|
|
780
|
+
assert.match(app, /Changes are saved globally and reused by every Pi session\./, "git footer visibility dialog should explain its global persistence scope");
|
|
781
|
+
assert.match(app, /Saved.*global WebUI footer visibility change/, "git footer visibility apply feedback should confirm global persistence");
|
|
698
782
|
assert.match(app, /function parseGitFooterWebuiPayloadRaw\(raw\)[\s\S]*GIT_FOOTER_WEBUI_PAYLOAD_TYPE[\s\S]*GIT_FOOTER_WEBUI_PAYLOAD_VERSION/, "Web UI footer should parse the structured payload emitted by git-footer-status");
|
|
699
783
|
assert.match(app, /function normalizeFooterPayloadChangedFile\(value\)[\s\S]*FOOTER_CHANGED_FILE_KINDS\.has\(value\.kind\)[\s\S]*oldPath/, "git footer payload parsing should preserve changed-file details for changes popovers");
|
|
700
784
|
assert.match(app, /const files = value\.files\.map\(normalizeFooterPayloadChangedFile\)\.filter\(Boolean\)\.slice\(0, 80\);[\s\S]*chip\.files = files;/, "git footer payload chips should retain bounded changed-file lists");
|
|
@@ -864,12 +948,13 @@ assert.match(app, /OPTIONAL_COMMAND_FEATURES = new Map\(\[[\s\S]*\["bang-refresh
|
|
|
864
948
|
assert.match(app, /function updateOptionalFeatureAvailability\(\)[\s\S]*hasAvailableCommand\("bang-status"\) \|\| hasAvailableCommand\("bang-refresh"\)[\s\S]*hasAvailableCommand\("user-bash-shell"\)[\s\S]*hasAvailableCommand\("git-staged-msg"\)[\s\S]*hasAvailableCommand\("release-npm"\)[\s\S]*hasAvailableCommand\("release-aur"\)[\s\S]*hasAvailableCommand\("safety-guard"\)[\s\S]*hasLoadedRpcCommand\("skills"\)[\s\S]*hasAvailableCommand\("todo-progress-status"\)[\s\S]*hasLoadedRpcCommand\("tools"\)[\s\S]*hasAvailableCommand\("remote"\)[\s\S]*NATURAL_CONVERSATION_COMMAND_NAMES\.some\(\(name\) => hasAvailableCommand\(name\)\)/, "optional feature detection should call RPC-visible commands directly and distinguish native resource selectors from TUI companions");
|
|
865
949
|
assert.match(app, /hasRemoteWebuiCommand = isOptionalFeatureEnabled\("remoteWebui"\) && hasAvailableCommand\("remote"\)[\s\S]*optionsRemoteButton\.hidden = !hasRemoteWebuiCommand[\s\S]*syncRemoteWebuiControlVisibility\(hasRemoteWebuiCommand\)/, "Options menu should track /remote availability and delegate network card visibility");
|
|
866
950
|
assert.match(app, /function syncRemoteWebuiControlVisibility[\s\S]*networkControlField\.hidden = !hasRemoteWebuiCommand/, "Remote WebUI network card should render whenever the optional feature and /remote command are enabled");
|
|
951
|
+
assert.match(app, /querySelector\("#remoteAccessControlsTitle"\)[\s\S]*heading\.textContent = payload\?\.title \|\| "Remote access"/, "Remote WebUI payload titles should update the group heading without replacing the nested PIN-auth label");
|
|
867
952
|
assert.match(app, /if \(featureId === "remoteWebui"\) syncRemoteWebuiControlVisibility\(false\)/, "Disabling Remote WebUI should immediately hide browser network controls before broader rerendering");
|
|
868
953
|
assert.match(app, /window\.addEventListener\("storage"[\s\S]*OPTIONAL_FEATURES_STORAGE_KEY[\s\S]*reconcileDisabledOptionalFeaturesFromStorage/, "Optional feature disables should live-sync across open Web UI pages");
|
|
869
954
|
assert.match(app, /if \(key === "pi-remote-webui"\) return "remoteWebui"/, "optional feature handling should recognize Remote WebUI widget events without rendering them as overlays");
|
|
870
955
|
assert.match(app, /REMOTE_WEBUI_CONTROLS_PAYLOAD_TYPE = "firstpick\.pi-package-remote-webui\.controls"/, "Remote WebUI package should announce browser controls through a package-owned status payload");
|
|
871
956
|
assert.match(app, /function combineIdenticalDuplicateCommands\(commands\)[\s\S]*duplicateGroups[\s\S]*duplicateCount: group\.length/, "identical duplicate RPC commands should be combined into one visible command entry");
|
|
872
|
-
assert.match(app, /if \(kind === "prompt" && attachments\.length === 0\) message = resolveRpcSlashCommandMessage\(message\)/, "manual slash prompts should resolve combined duplicate command aliases before reaching Pi RPC");
|
|
957
|
+
assert.match(app, /if \(kind === "prompt" && attachments\.length === 0\) message = resolveRpcSlashCommandMessage\(message, \{ tabId: targetTabId \}\)/, "manual targeted slash prompts should resolve combined duplicate command aliases from their captured target tab before reaching Pi RPC");
|
|
873
958
|
assert.match(app, /if \(!isOptionalFeatureEnabled\("todoProgressWidget"\)\) return String\(text \|\| ""\)/, "todo progress line stripping should only run when the todo feature is detected and enabled");
|
|
874
959
|
assert.match(app, /const releasePrompt = detectedReleasePrompt && isOptionalFeatureEnabled\(detectedReleasePrompt\.featureId\) \? detectedReleasePrompt : null/, "release confirmation dialogs should use specialized rendering only when their release optional feature is enabled");
|
|
875
960
|
assert.match(app, /case "webui_tab_reloaded":[\s\S]*resetOptionalFeatureAvailability\(\)/, "optional feature state should reset when the RPC tab reloads resources");
|
|
@@ -904,7 +989,7 @@ assert.match(css, /\.git-workflow-message-input-row \{[\s\S]*flex:\s*1 1 100%/,
|
|
|
904
989
|
assert.match(css, /\.git-workflow-actions button\[data-tooltip\]::after \{[\s\S]*content:\s*attr\(data-tooltip\)[\s\S]*white-space:\s*pre-line/, "guided git workflow action tooltips should render multiline step lists");
|
|
905
990
|
assert.match(app, /function gitBranchNamePromptMessage\(\)[\s\S]*hasAvailableCommand\("git-branch-name"\)[\s\S]*return "\/git-branch-name"/, "guided git workflow should ask the agent to generate PR branch names when the prompt is available");
|
|
906
991
|
assert.match(app, /async function loadGitWorkflowBranchName\([\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch-name"/, "guided git workflow should load generated agent branch names before branch creation");
|
|
907
|
-
assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, sessionMode: "fork-current", openTab: true \
|
|
992
|
+
assert.match(app, /async function createGitPrBranchWithSuggestion\([\s\S]*prompt\("New PR branch worktree name[\s\S]*assertGuidedGitStagedContentBinding\(tabId, "PR worktree creation"\)[\s\S]*gitWorkflowRequest\("\/api\/git-workflow\/branch", \{ body: \{ branch, sessionMode: "fork-current", openTab: true, [\s\S]*expectedStagedContentHash/, "guided git workflow should confirm an agent-suggested branch and verify approved staged content before opening its worktree");
|
|
908
993
|
assert.match(app, /function syncGitWorkflowWorktreeTabs\(result\)[\s\S]*Array\.isArray\(result\?\.tabs\)[\s\S]*applyTabMetadata\(result\.tab\)/, "guided git workflow should merge worktree tab metadata returned by the branch endpoint");
|
|
909
994
|
assert.match(app, /const targetTabId = result\.tab\?\.id[\s\S]*setGitWorkflow\(nextState, \{ tabId: targetTabId \}\)[\s\S]*switchTab\(targetTabId\)/, "guided git workflow should transfer PR state to the opened worktree tab");
|
|
910
995
|
assert.match(app, /addGitWorkflowAction\("Push and Create PR", \(\) => pushAndCreatePrGitWorkflow\(\), "primary", false\)/, "guided git workflow should replace push with Push and Create PR in PR mode");
|
|
@@ -919,7 +1004,7 @@ assert.match(server, /async function startGitWorkflowGeneration\([\s\S]*set_mode
|
|
|
919
1004
|
assert.match(server, /event\?\.type === "agent_settled"[\s\S]*restoreGitWorkflowGenerationProfile\(tab\)/, "server should restore the active tab model and effort after generation settles");
|
|
920
1005
|
assert.match(server, /case "\/api\/git-workflow\/branch-name":[\s\S]*readGitWorkflowBranchName\(cwd\)/, "server should expose generated branch-name file loading for the guided PR workflow");
|
|
921
1006
|
assert.match(server, /case "\/api\/git-workflow\/branch":[\s\S]*createGitWorkflowBranchWorktree\(tab, body\)/, "server should route guided PR branch creation through worktree tabs");
|
|
922
|
-
assert.match(server, /async function createGitWorkflowBranchWorktree\(tab, body = \{\}\)[\s\S]*snapshotGitWorkflowBranchState\(root, tab\.cwd\)[\s\S]*applyGitWorkflowBranchStateToWorktree\(snapshot, worktreePath\)[\s\S]*openWorktreeResultForTab\(tab, createdResult/, "guided PR worktree creation should copy staged state before opening the worktree tab");
|
|
1007
|
+
assert.match(server, /async function createGitWorkflowBranchWorktree\(tab, body = \{\}\)[\s\S]*expectedStagedContentHashFromBody\(body\)[\s\S]*snapshotGitWorkflowBranchState\(root, tab\.cwd, expectedStagedContentHash\)[\s\S]*applyGitWorkflowBranchStateToWorktree\(snapshot, worktreePath\)[\s\S]*openWorktreeResultForTab\(tab, createdResult/, "guided PR worktree creation should verify and copy exact staged state before opening the worktree tab");
|
|
923
1008
|
assert.match(server, /case "\/api\/git-workflow\/create-pr":[\s\S]*runGitHubWorkflowCommand\(\["pr", "create"/, "server should create PRs with the GitHub CLI after confirmation");
|
|
924
1009
|
assert.doesNotMatch(app, /gitWorkflowVisibleTabId|Workflow belongs to/, "guided git workflow should not pin or show workflows outside their owning terminal tab");
|
|
925
1010
|
assert.match(app, /function renderReleaseNpmOutputWidget\(\)/, "release-npm live output should use a specialized Web UI renderer");
|
|
@@ -1299,6 +1384,7 @@ assert.match(app, /function syncActiveTabActivityFromState\(state = currentState
|
|
|
1299
1384
|
assert.match(app, /event\.command === "get_state" && event\.tabId === activeTabId[\s\S]*?syncActiveTabActivityFromState\(currentState\)/, "get_state response events should update stale active-tab activity");
|
|
1300
1385
|
assert.match(app, /function applyResponseTab\(response\)/, "frontend should merge tab metadata returned by prompt responses");
|
|
1301
1386
|
assert.match(app, /case "webui_tab_renamed":/, "frontend should update tab labels from backend rename events");
|
|
1387
|
+
assert.match(app, /case "webui_recovery_opened":[\s\S]*?refreshTabs\(\)[\s\S]*?switchTab\(event\.recoveryTabId\)/, "recovery events should refresh tabs and activate the new recovery session");
|
|
1302
1388
|
assert.match(app, /terminalTabsToggleButton\.addEventListener\("click"/, "terminal tabs trigger should be wired in JS");
|
|
1303
1389
|
assert.match(app, /composerActionsButton\.addEventListener\("click"/, "composer actions trigger should be wired in JS");
|
|
1304
1390
|
assert.match(app, /function setMobileFooterExpanded\(/, "mobile footer should preserve expansion state for compatibility");
|
|
@@ -1565,6 +1651,9 @@ for (const [name, range] of Object.entries(companionDependencies)) {
|
|
|
1565
1651
|
}
|
|
1566
1652
|
assert.equal(pkg.bundledDependencies, undefined, "webui optional companion packages should not be bundled into the tarball");
|
|
1567
1653
|
assert.equal(pkg.optionalDependencies?.["@firstpick/pi-package-natural-conversation"], undefined, "webui package should not optionally depend on the standalone Natural Conversation package");
|
|
1654
|
+
assert.equal(pkg.optionalDependencies?.["@firstpick/pi-extension-aur-review"], undefined, "webui package should not reference the unpublished aur-review extension");
|
|
1655
|
+
assert.equal(lock.packages?.["node_modules/@firstpick/pi-extension-aur-review"], undefined, "package lock should not retain an unpublished aur-review tarball");
|
|
1656
|
+
assert.ok(!pkg.pi?.extensions?.some((entry) => String(entry).includes("pi-extension-aur-review")), "webui Pi manifest should not bundle the unpublished aur-review path");
|
|
1568
1657
|
assert.ok(!pkg.pi?.extensions?.some((entry) => String(entry).includes("pi-package-natural-conversation")), "webui Pi manifest should not load Natural Conversation directly; /talk must come from the standalone package");
|
|
1569
1658
|
assert.ok(pkg.pi?.extensions?.includes("./index.ts"), "webui Pi manifest should load its own extension");
|
|
1570
1659
|
for (const extensionPath of [
|