@firstpick/pi-package-webui 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/bin/pi-webui.mjs +507 -66
- package/index.ts +4 -0
- package/lib/git-live-watcher.mjs +135 -0
- package/lib/git-message-artifacts.mjs +103 -0
- package/lib/process-tree.mjs +3 -1
- package/lib/subagent-gate.mjs +618 -0
- package/package.json +8 -6
- package/public/app.js +1261 -117
- package/public/index.html +25 -3
- package/public/styles.css +479 -4
- package/tests/app-runner-windows-conpty-harness.test.mjs +140 -0
- package/tests/danger-button-contrast-static.test.mjs +32 -0
- package/tests/fixtures/fake-pi.mjs +22 -4
- package/tests/footer-middle-truncation.test.mjs +118 -0
- package/tests/git-live-watcher.test.mjs +93 -0
- package/tests/git-message-artifacts.test.mjs +59 -0
- package/tests/git-panel-live-updates-static.test.mjs +54 -0
- package/tests/git-panel-render-stability-static.test.mjs +43 -0
- package/tests/guided-git-message-reliability-static.test.mjs +38 -0
- package/tests/http-endpoints-harness.test.mjs +103 -5
- package/tests/image-payload-hardening-harness.test.mjs +115 -0
- package/tests/mobile-static.test.mjs +74 -10
- package/tests/pi-footer-calibration-static.test.mjs +55 -0
- package/tests/runtime-error-visibility.test.mjs +63 -0
- package/tests/side-panel-context-menu-static.test.mjs +74 -0
- package/tests/subagent-gate.test.mjs +300 -0
- package/tests/subagents-helper.test.mjs +34 -3
- package/webui-rpc-helper.mjs +165 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import { spawn, spawnSync } from "node:child_process";
|
|
3
3
|
import { createServer } from "node:http";
|
|
4
|
-
import { chmod, mkdir, mkdtemp, readFile, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
4
|
+
import { chmod, mkdir, mkdtemp, readFile, rename, rm, stat, symlink, writeFile } from "node:fs/promises";
|
|
5
5
|
import { networkInterfaces, tmpdir } from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { setTimeout as delay } from "node:timers/promises";
|
|
@@ -305,6 +305,39 @@ try {
|
|
|
305
305
|
const tabId = tabList[0].id;
|
|
306
306
|
assert.ok(tabId, "tab should have an id");
|
|
307
307
|
|
|
308
|
+
const malformedInlineImage = await request("127.0.0.1", "/api/prompt", {
|
|
309
|
+
method: "POST",
|
|
310
|
+
body: { tab: tabId, message: "malformed inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "137,80,78,71,13,10,26,10" }] },
|
|
311
|
+
});
|
|
312
|
+
assert.equal(malformedInlineImage.status, 400, "comma-separated image bytes should be rejected before RPC dispatch");
|
|
313
|
+
assert.match(String(malformedInlineImage.body?.error || ""), /image 1 data must be canonical base64/i);
|
|
314
|
+
|
|
315
|
+
const unpaddedInlineImage = await request("127.0.0.1", "/api/prompt", {
|
|
316
|
+
method: "POST",
|
|
317
|
+
body: { tab: tabId, message: "unpadded inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "iVBORw0KGgo" }] },
|
|
318
|
+
});
|
|
319
|
+
assert.equal(unpaddedInlineImage.status, 400, "non-canonical unpadded image base64 should be rejected before RPC dispatch");
|
|
320
|
+
assert.match(String(unpaddedInlineImage.body?.error || ""), /image 1 data must be canonical base64/i);
|
|
321
|
+
|
|
322
|
+
const malformedAttachment = await request("127.0.0.1", "/api/attachments", {
|
|
323
|
+
method: "POST",
|
|
324
|
+
body: { tab: tabId, files: [{ id: "bad-image", name: "bad.png", mimeType: "image/png", data: "137,80,78,71" }] },
|
|
325
|
+
});
|
|
326
|
+
assert.equal(malformedAttachment.status, 400, "malformed attachment data should be rejected before a file is written");
|
|
327
|
+
assert.match(String(malformedAttachment.body?.error || ""), /attachment data must be canonical base64/i);
|
|
328
|
+
|
|
329
|
+
const canonicalPng = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).toString("base64");
|
|
330
|
+
const validInlineImage = await request("127.0.0.1", "/api/prompt", {
|
|
331
|
+
method: "POST",
|
|
332
|
+
body: { tab: tabId, message: "canonical inline image fixture", images: [{ type: "image", mimeType: "image/png", data: canonicalPng }] },
|
|
333
|
+
});
|
|
334
|
+
assert.equal(validInlineImage.status, 200, `canonical inline image should reach Pi unchanged: ${validInlineImage.body?.error || ""}`);
|
|
335
|
+
const imageCommands = (await readFile(fakePiCommandLog, "utf8")).trim().split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
|
|
336
|
+
assert.equal(imageCommands.some((entry) => entry.direction === "command" && entry.message === "malformed inline image fixture"), false, "malformed inline images must not reach Pi");
|
|
337
|
+
assert.equal(imageCommands.some((entry) => entry.direction === "command" && entry.message === "unpadded inline image fixture"), false, "non-canonical inline images must not reach Pi");
|
|
338
|
+
const validImageCommand = imageCommands.find((entry) => entry.direction === "command" && entry.message === "canonical inline image fixture");
|
|
339
|
+
assert.deepEqual(validImageCommand?.images, [{ type: "image", data: canonicalPng, mimeType: "image/png" }], "canonical image bytes and MIME type should be forwarded unchanged");
|
|
340
|
+
|
|
308
341
|
const optionalFeatures = await request("127.0.0.1", "/api/optional-features");
|
|
309
342
|
assert.equal(optionalFeatures.status, 200, "optional feature status should load");
|
|
310
343
|
const aurReviewFeature = optionalFeatures.body?.data?.features?.find((feature) => feature.featureId === "aurReview");
|
|
@@ -425,11 +458,17 @@ try {
|
|
|
425
458
|
assert.equal(subagentsResponse.body?.data?.totalAgents, 2, "subagent overview should count all running agents");
|
|
426
459
|
assert.equal(subagentsResponse.body?.data?.tabs?.[0]?.tabId, tabId, "subagent overview should group agents under their terminal tab");
|
|
427
460
|
assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.runs?.[0]?.agents?.map((agent) => agent.name), ["reviewer", "scout"], "subagent overview should preserve agent order within the session run");
|
|
461
|
+
assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.runs?.[0]?.agents?.map((agent) => [agent.model, agent.thinking]), [["anthropic/claude-opus-4-8:high", "high"], ["openai-codex/gpt-5.6-sol", "high"]], "subagent overview should preserve bounded model and reasoning metadata");
|
|
462
|
+
assert.equal(subagentsResponse.body?.data?.totalGates, 1, "subagent overview should expose retry gates independently from running children");
|
|
463
|
+
assert.equal(subagentsResponse.body?.data?.tabs?.[0]?.gates?.[0]?.qualifyingSuccesses, 1, "retry gate quorum should be normalized");
|
|
464
|
+
assert.deepEqual(subagentsResponse.body?.data?.tabs?.[0]?.gates?.[0]?.attempts?.map((attempt) => [attempt.status, attempt.failureKind]), [["succeeded", undefined], ["failed", "transient-provider"]], "retry gate attempts should preserve bounded status and failure classification");
|
|
428
465
|
const subagentOutputResponse = await request("127.0.0.1", `/api/subagents/output?tab=${encodeURIComponent(tabId)}&run=${encodeURIComponent("fixture-run")}&agent=${encodeURIComponent("fixture-run:0")}`);
|
|
429
466
|
assert.equal(subagentOutputResponse.status, 200, "running subagent output endpoint should respond");
|
|
430
467
|
assert.equal(subagentOutputResponse.body?.data?.agent?.name, "reviewer", "subagent output should target the selected child agent");
|
|
431
468
|
assert.deepEqual(subagentOutputResponse.body?.data?.agent?.recentOutput, ["Inspecting current implementation", "Waiting for the next tool result"], "subagent output should preserve bounded live output lines");
|
|
432
469
|
assert.equal(subagentOutputResponse.body?.data?.agent?.currentToolArgs, "README.md", "subagent output should include current tool state");
|
|
470
|
+
assert.equal(subagentOutputResponse.body?.data?.agent?.model, "anthropic/claude-opus-4-8:high", "subagent output should preserve the effective model");
|
|
471
|
+
assert.equal(subagentOutputResponse.body?.data?.agent?.thinking, "high", "subagent output should preserve the effective reasoning effort");
|
|
433
472
|
assert.deepEqual(subagentOutputResponse.body?.data?.agent?.transcript, [
|
|
434
473
|
{
|
|
435
474
|
role: "assistant",
|
|
@@ -459,6 +498,7 @@ try {
|
|
|
459
498
|
await delay(50);
|
|
460
499
|
}
|
|
461
500
|
assert.equal(subagentsResponse.body?.data?.totalAgents, 0, "completed subagents should disappear from the running overview");
|
|
501
|
+
assert.equal(subagentsResponse.body?.data?.totalGates, 0, "cleared retry gates should disappear from the overview");
|
|
462
502
|
|
|
463
503
|
const state = await request("127.0.0.1", `/api/state?tab=${encodeURIComponent(tabId)}`);
|
|
464
504
|
assert.equal(state.status, 200);
|
|
@@ -836,11 +876,64 @@ try {
|
|
|
836
876
|
await writeFile(path.join(stagingRepo, "file.txt"), "modified\n");
|
|
837
877
|
await writeFile(path.join(stagingRepo, "loose.txt"), "loose\n");
|
|
838
878
|
|
|
879
|
+
const gitRoot = await request("127.0.0.1", `/api/git-root?tab=${encodeURIComponent(stagingTab)}`);
|
|
880
|
+
assert.equal(gitRoot.body?.ok, true, "git-root endpoint should discover the tab repository");
|
|
881
|
+
assert.equal(gitRoot.body?.data?.root, stagingRepo, "git-root should return the canonical fixture root");
|
|
882
|
+
|
|
883
|
+
const liveFile = path.join(stagingRepo, "live-update.txt");
|
|
884
|
+
const renamedLiveFile = path.join(stagingRepo, "live-update-renamed.txt");
|
|
885
|
+
const isLiveGitEvent = (event) => event.type === "webui_git_changed" && event.root === stagingRepo;
|
|
886
|
+
const createdLiveEvent = await waitForSseEvent(stagingTab, isLiveGitEvent, () => writeFile(liveFile, "created\n"));
|
|
887
|
+
assert.match(createdLiveEvent.event.changedAt || "", /^\d{4}-\d{2}-\d{2}T/, "file creation should broadcast a timestamped Git invalidation");
|
|
888
|
+
await waitForSseEvent(stagingTab, isLiveGitEvent, () => writeFile(liveFile, "modified\n"));
|
|
889
|
+
await waitForSseEvent(stagingTab, isLiveGitEvent, () => rename(liveFile, renamedLiveFile));
|
|
890
|
+
await waitForSseEvent(stagingTab, isLiveGitEvent, () => rm(renamedLiveFile));
|
|
891
|
+
|
|
892
|
+
const gitPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
|
|
893
|
+
assert.equal(gitPanel.body?.ok, true, "git-panel endpoint should return compact local status and history");
|
|
894
|
+
assert.equal(gitPanel.body?.data?.root, stagingRepo);
|
|
895
|
+
assert.equal(gitPanel.body?.data?.history?.length, 1, "git-panel should include the bounded recent commit history");
|
|
896
|
+
assert.equal(gitPanel.body?.data?.history?.[0]?.subject, "base");
|
|
897
|
+
const modifiedPanelEntry = gitPanel.body?.data?.changes?.find((entry) => entry.path === "file.txt");
|
|
898
|
+
assert.equal(modifiedPanelEntry?.unstaged, true, "git-panel should classify modified tracked files");
|
|
899
|
+
assert.equal(modifiedPanelEntry?.additions, 1, "git-panel should report unstaged additions from numstat");
|
|
900
|
+
assert.equal(modifiedPanelEntry?.deletions, 1, "git-panel should report unstaged deletions from numstat");
|
|
901
|
+
assert.equal(gitPanel.body?.data?.changes?.find((entry) => entry.path === "loose.txt")?.untracked, true, "git-panel should classify untracked files");
|
|
902
|
+
assert.equal(Object.prototype.hasOwnProperty.call(gitPanel.body?.data?.changes?.[0] || {}, "content"), false, "compact git-panel entries must not include file contents");
|
|
903
|
+
|
|
904
|
+
const fixtureHead = runGitFixture(["rev-parse", "HEAD"], stagingRepo, "staging fixture should expose its full HEAD hash");
|
|
905
|
+
const gitPanelCommit = await request("127.0.0.1", `/api/git-commit?tab=${encodeURIComponent(stagingTab)}&hash=${encodeURIComponent(fixtureHead)}`);
|
|
906
|
+
assert.equal(gitPanelCommit.body?.ok, true, "git-commit endpoint should return a bounded read-only commit diff");
|
|
907
|
+
assert.equal(gitPanelCommit.body?.data?.commit?.hash, fixtureHead);
|
|
908
|
+
assert.match(gitPanelCommit.body?.data?.sections?.[0]?.diff || "", /diff --git a\/file\.txt b\/file\.txt/, "git-commit should include the selected commit patch");
|
|
909
|
+
const invalidCommit = await request("127.0.0.1", `/api/git-commit?tab=${encodeURIComponent(stagingTab)}&hash=HEAD`);
|
|
910
|
+
assert.equal(invalidCommit.status, 400, "git-commit should reject symbolic or abbreviated revisions");
|
|
911
|
+
|
|
912
|
+
const stageAll = await request("127.0.0.1", "/api/git-changes/stage-all", { method: "POST", body: { tab: stagingTab } });
|
|
913
|
+
assert.equal(stageAll.body?.ok, true, "stage-all endpoint should stage the selected repository");
|
|
914
|
+
const stagedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
|
|
915
|
+
assert.equal(stagedPanel.body?.data?.summary?.staged, 2, "stage-all should stage tracked and untracked changes");
|
|
916
|
+
const unstageAll = await request("127.0.0.1", "/api/git-changes/unstage-all", { method: "POST", body: { tab: stagingTab } });
|
|
917
|
+
assert.equal(unstageAll.body?.ok, true, "unstage-all endpoint should clear the selected repository index");
|
|
918
|
+
const unstagedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
|
|
919
|
+
assert.equal(unstagedPanel.body?.data?.summary?.staged, 0, "unstage-all should leave no staged changes");
|
|
920
|
+
assert.equal(unstagedPanel.body?.data?.changes?.find((entry) => entry.path === "loose.txt")?.untracked, true, "unstage-all should restore newly added files to untracked state");
|
|
921
|
+
|
|
839
922
|
const stageFile = await request("127.0.0.1", "/api/git-changes/stage-file", { method: "POST", body: { tab: stagingTab, path: "file.txt" } });
|
|
840
923
|
assert.equal(stageFile.status, 200);
|
|
841
924
|
assert.equal(stageFile.body?.ok, true, "stage-file endpoint should stage a modified file");
|
|
842
925
|
assert.equal(stageFile.body?.data?.changes?.summary?.staged, 1, "stage-file should report one staged file afterwards");
|
|
843
926
|
|
|
927
|
+
await writeFile(path.join(stagingRepo, "file.txt"), "modified again\n");
|
|
928
|
+
const mixedPanel = await request("127.0.0.1", `/api/git-panel?tab=${encodeURIComponent(stagingTab)}`);
|
|
929
|
+
const mixedEntry = mixedPanel.body?.data?.changes?.find((entry) => entry.path === "file.txt");
|
|
930
|
+
assert.equal(mixedEntry?.staged, true, "mixed index/worktree files should remain staged");
|
|
931
|
+
assert.equal(mixedEntry?.unstaged, true, "mixed index/worktree files should also remain unstaged");
|
|
932
|
+
assert.equal(mixedEntry?.stagedAdditions, 1, "Git panel should preserve staged additions separately");
|
|
933
|
+
assert.equal(mixedEntry?.stagedDeletions, 1, "Git panel should preserve staged deletions separately");
|
|
934
|
+
assert.equal(mixedEntry?.unstagedAdditions, 1, "Git panel should preserve unstaged additions separately");
|
|
935
|
+
assert.equal(mixedEntry?.unstagedDeletions, 1, "Git panel should preserve unstaged deletions separately");
|
|
936
|
+
|
|
844
937
|
const unstageFile = await request("127.0.0.1", "/api/git-changes/unstage-file", { method: "POST", body: { tab: stagingTab, path: "file.txt" } });
|
|
845
938
|
assert.equal(unstageFile.status, 200);
|
|
846
939
|
assert.equal(unstageFile.body?.ok, true, "unstage-file endpoint should unstage the file");
|
|
@@ -1234,7 +1327,7 @@ try {
|
|
|
1234
1327
|
await writeFile(path.join(cwd, "interactive-runner.mjs"), [
|
|
1235
1328
|
"import readline from 'node:readline';",
|
|
1236
1329
|
"const rl = readline.createInterface({ input: process.stdin, output: process.stdout });",
|
|
1237
|
-
"console.log(
|
|
1330
|
+
"console.log(`interactive ready; stdin tty=${Boolean(process.stdin.isTTY)}`);",
|
|
1238
1331
|
"rl.question('name? ', (answer) => {",
|
|
1239
1332
|
" console.log(`hello ${answer}`);",
|
|
1240
1333
|
" rl.close();",
|
|
@@ -1255,6 +1348,9 @@ try {
|
|
|
1255
1348
|
timeoutMs: 10_000,
|
|
1256
1349
|
});
|
|
1257
1350
|
assert.equal(interactiveRunStart.status, 200, `interactive runner start should return ok: ${interactiveRunStart.body?.error || ""}`);
|
|
1351
|
+
if (process.platform === "win32") {
|
|
1352
|
+
assert.equal(interactiveRunStart.body?.data?.activeRun?.executionMode, "conpty", "Windows interactive runners should use the node-pty ConPTY backend");
|
|
1353
|
+
}
|
|
1258
1354
|
let interactiveRunState = interactiveRunStart;
|
|
1259
1355
|
for (let attempt = 0; attempt < 50; attempt++) {
|
|
1260
1356
|
interactiveRunState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
@@ -1283,13 +1379,14 @@ try {
|
|
|
1283
1379
|
assert.equal(interactiveRunState.body?.data?.activeRun?.status, "done", "interactive custom runner should finish after stdin");
|
|
1284
1380
|
const interactiveOutput = (interactiveRunState.body?.data?.activeRun?.lines || []).join("\n");
|
|
1285
1381
|
assert.match(interactiveOutput, /hello webui/, "interactive custom runner should receive stdin from the app-runner input endpoint");
|
|
1382
|
+
if (process.platform === "win32") assert.match(interactiveOutput, /stdin tty=true/, "Windows ConPTY runners should expose a real TTY to the child process");
|
|
1286
1383
|
assert.match(interactiveOutput, /# stdin sent \(5 chars\) and closed/, "app runner output should show that stdin was sent without echoing the input text itself");
|
|
1287
1384
|
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
1288
1385
|
|
|
1289
1386
|
const scriptVersion = spawnSync("script", ["--version"], { encoding: "utf8" });
|
|
1290
1387
|
const utilLinuxScriptAvailable = process.platform !== "win32" && scriptVersion.status === 0 && /util-linux/i.test(`${scriptVersion.stdout}\n${scriptVersion.stderr}`);
|
|
1291
1388
|
const bashAvailable = spawnSync("bash", ["--version"], { encoding: "utf8" }).status === 0;
|
|
1292
|
-
if (utilLinuxScriptAvailable && bashAvailable) {
|
|
1389
|
+
if ((utilLinuxScriptAvailable || process.platform === "win32") && bashAvailable) {
|
|
1293
1390
|
await mkdir(path.join(cwd, "qa"), { recursive: true });
|
|
1294
1391
|
await writeFile(path.join(cwd, "qa", "read-p-runner.sh"), [
|
|
1295
1392
|
"#!/usr/bin/env bash",
|
|
@@ -1312,7 +1409,8 @@ try {
|
|
|
1312
1409
|
timeoutMs: 10_000,
|
|
1313
1410
|
});
|
|
1314
1411
|
assert.equal(readPromptStart.status, 200, `bash read -p runner start should return ok: ${readPromptStart.body?.error || ""}`);
|
|
1315
|
-
|
|
1412
|
+
const expectedPtyMode = process.platform === "win32" ? "conpty" : "pty";
|
|
1413
|
+
assert.equal(readPromptStart.body?.data?.activeRun?.executionMode, expectedPtyMode, "bash read -p runner should use the platform PTY-backed execution path");
|
|
1316
1414
|
let readPromptState = readPromptStart;
|
|
1317
1415
|
for (let attempt = 0; attempt < 50; attempt++) {
|
|
1318
1416
|
readPromptState = await request("127.0.0.1", `/api/app-runners?tab=${encodeURIComponent(tabId)}`, { timeoutMs: 5_000 });
|
|
@@ -1341,7 +1439,7 @@ try {
|
|
|
1341
1439
|
assert.equal(readPromptState.body?.data?.activeRun?.status, "done", "bash read -p runner should finish after stdin");
|
|
1342
1440
|
const readPromptOutput = (readPromptState.body?.data?.activeRun?.lines || []).join("\n");
|
|
1343
1441
|
assert.match(readPromptOutput, /selected:alpha/, "bash read -p runner should receive stdin from the app-runner input endpoint");
|
|
1344
|
-
assert.doesNotMatch(readPromptOutput, /^alpha$/m, "
|
|
1442
|
+
if (process.platform !== "win32") assert.doesNotMatch(readPromptOutput, /^alpha$/m, "script-backed PTY runner should not echo raw stdin into captured output");
|
|
1345
1443
|
await request("127.0.0.1", "/api/app-runner/clear", { method: "POST", body: { tab: tabId } });
|
|
1346
1444
|
}
|
|
1347
1445
|
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
3
|
+
import { chmod, mkdtemp, readFile, rm } from "node:fs/promises";
|
|
4
|
+
import { tmpdir } from "node:os";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
7
|
+
import { dirname, join } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
|
+
const serverScript = join(root, "bin", "pi-webui.mjs");
|
|
12
|
+
const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
|
|
13
|
+
const port = 32000 + Math.floor(Math.random() * 20000);
|
|
14
|
+
const cwd = await mkdtemp(path.join(tmpdir(), "pi-webui-image-payload-"));
|
|
15
|
+
const commandLog = path.join(cwd, "fake-pi-commands.jsonl");
|
|
16
|
+
let child;
|
|
17
|
+
|
|
18
|
+
async function request(pathname, { method = "GET", body, timeoutMs = 5_000 } = {}) {
|
|
19
|
+
const response = await fetch(`http://127.0.0.1:${port}${pathname}`, {
|
|
20
|
+
method,
|
|
21
|
+
headers: body === undefined ? undefined : { "content-type": "application/json" },
|
|
22
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
23
|
+
signal: AbortSignal.timeout(timeoutMs),
|
|
24
|
+
});
|
|
25
|
+
return { status: response.status, body: await response.json().catch(() => undefined) };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function stopChild() {
|
|
29
|
+
if (!child || child.exitCode !== null || child.signalCode !== null) return;
|
|
30
|
+
const exited = new Promise((resolve) => child.once("exit", resolve));
|
|
31
|
+
child.kill("SIGKILL");
|
|
32
|
+
await exited;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
async function cleanup() {
|
|
36
|
+
await stopChild();
|
|
37
|
+
for (let attempt = 0; attempt < 8; attempt++) {
|
|
38
|
+
try {
|
|
39
|
+
await rm(cwd, { recursive: true, force: true });
|
|
40
|
+
return;
|
|
41
|
+
} catch (error) {
|
|
42
|
+
if (!["EBUSY", "EPERM", "ENOTEMPTY"].includes(error?.code) || attempt === 7) throw error;
|
|
43
|
+
await delay(100 * (attempt + 1));
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
try {
|
|
49
|
+
await chmod(fakePi, 0o755);
|
|
50
|
+
let output = "";
|
|
51
|
+
child = spawn(process.execPath, [serverScript, "--cwd", cwd, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
|
|
52
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
53
|
+
env: {
|
|
54
|
+
...process.env,
|
|
55
|
+
PI_CODING_AGENT_DIR: path.join(cwd, "agent"),
|
|
56
|
+
FAKE_PI_LOG_FILE: commandLog,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
60
|
+
child.stderr.on("data", (chunk) => { output += String(chunk); });
|
|
61
|
+
|
|
62
|
+
let health;
|
|
63
|
+
for (let attempt = 0; attempt < 100; attempt++) {
|
|
64
|
+
if (child.exitCode !== null) break;
|
|
65
|
+
try {
|
|
66
|
+
health = await request("/api/health", { timeoutMs: 1_000 });
|
|
67
|
+
if (health.status === 200) break;
|
|
68
|
+
} catch {
|
|
69
|
+
// Server is still starting.
|
|
70
|
+
}
|
|
71
|
+
await delay(50);
|
|
72
|
+
}
|
|
73
|
+
assert.equal(health?.status, 200, `server should become healthy:\n${output}`);
|
|
74
|
+
const tabs = await request("/api/tabs");
|
|
75
|
+
const tabId = tabs.body?.data?.tabs?.[0]?.id;
|
|
76
|
+
assert.ok(tabId, "server should create a tab");
|
|
77
|
+
|
|
78
|
+
const malformedInline = await request("/api/prompt", {
|
|
79
|
+
method: "POST",
|
|
80
|
+
body: { tab: tabId, message: "malformed inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "137,80,78,71,13,10,26,10" }] },
|
|
81
|
+
});
|
|
82
|
+
assert.equal(malformedInline.status, 400);
|
|
83
|
+
assert.match(String(malformedInline.body?.error || ""), /image 1 data must be canonical base64/i);
|
|
84
|
+
|
|
85
|
+
const unpaddedInline = await request("/api/prompt", {
|
|
86
|
+
method: "POST",
|
|
87
|
+
body: { tab: tabId, message: "unpadded inline image fixture", images: [{ type: "image", mimeType: "image/png", data: "iVBORw0KGgo" }] },
|
|
88
|
+
});
|
|
89
|
+
assert.equal(unpaddedInline.status, 400);
|
|
90
|
+
assert.match(String(unpaddedInline.body?.error || ""), /image 1 data must be canonical base64/i);
|
|
91
|
+
|
|
92
|
+
const malformedAttachment = await request("/api/attachments", {
|
|
93
|
+
method: "POST",
|
|
94
|
+
body: { tab: tabId, files: [{ id: "bad-image", name: "bad.png", mimeType: "image/png", data: "137,80,78,71" }] },
|
|
95
|
+
});
|
|
96
|
+
assert.equal(malformedAttachment.status, 400);
|
|
97
|
+
assert.match(String(malformedAttachment.body?.error || ""), /attachment data must be canonical base64/i);
|
|
98
|
+
|
|
99
|
+
const canonicalPng = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]).toString("base64");
|
|
100
|
+
const validInline = await request("/api/prompt", {
|
|
101
|
+
method: "POST",
|
|
102
|
+
body: { tab: tabId, message: "canonical inline image fixture", images: [{ type: "image", mimeType: "image/png", data: canonicalPng }] },
|
|
103
|
+
});
|
|
104
|
+
assert.equal(validInline.status, 200, validInline.body?.error || "canonical image should be accepted");
|
|
105
|
+
|
|
106
|
+
const commands = (await readFile(commandLog, "utf8")).trim().split(/\r?\n/).filter(Boolean).map((line) => JSON.parse(line));
|
|
107
|
+
assert.equal(commands.some((entry) => entry.direction === "command" && entry.message === "malformed inline image fixture"), false);
|
|
108
|
+
assert.equal(commands.some((entry) => entry.direction === "command" && entry.message === "unpadded inline image fixture"), false);
|
|
109
|
+
const validCommand = commands.find((entry) => entry.direction === "command" && entry.message === "canonical inline image fixture");
|
|
110
|
+
assert.deepEqual(validCommand?.images, [{ type: "image", data: canonicalPng, mimeType: "image/png" }]);
|
|
111
|
+
} finally {
|
|
112
|
+
await cleanup();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
console.log("image payload hardening harness passed");
|
|
@@ -39,17 +39,17 @@ const companionDependencies = {
|
|
|
39
39
|
"@firstpick/pi-extension-bang-command-autocomplete": "^0.2.1",
|
|
40
40
|
"@firstpick/pi-extension-btw": "^0.1.3",
|
|
41
41
|
"@firstpick/pi-extension-fish-user-bash": "^0.2.1",
|
|
42
|
-
"@firstpick/pi-extension-git-footer-status": "^0.4.
|
|
42
|
+
"@firstpick/pi-extension-git-footer-status": "^0.4.1",
|
|
43
43
|
"@firstpick/pi-extension-release-aur": "^0.1.7",
|
|
44
|
-
"@firstpick/pi-extension-release-npm": "^0.4.
|
|
44
|
+
"@firstpick/pi-extension-release-npm": "^0.4.3",
|
|
45
45
|
"@firstpick/pi-extension-safety-guard": "^0.2.5",
|
|
46
46
|
"@firstpick/pi-extension-setup-skills": "^0.1.8",
|
|
47
47
|
"@firstpick/pi-extension-stats": "^0.2.8",
|
|
48
48
|
"@firstpick/pi-extension-todo-progress": "^0.2.8",
|
|
49
49
|
"@firstpick/pi-extension-tools": "^0.1.6",
|
|
50
|
-
"@firstpick/pi-extension-workflows": "^0.1.
|
|
51
|
-
"@firstpick/pi-package-remote-webui": "^0.1.
|
|
52
|
-
"@firstpick/pi-prompts-git-pr": "^0.1.
|
|
50
|
+
"@firstpick/pi-extension-workflows": "^0.1.4",
|
|
51
|
+
"@firstpick/pi-package-remote-webui": "^0.1.6",
|
|
52
|
+
"@firstpick/pi-prompts-git-pr": "^0.1.4",
|
|
53
53
|
"@firstpick/pi-themes-bundle": "^0.1.4",
|
|
54
54
|
};
|
|
55
55
|
|
|
@@ -107,12 +107,49 @@ assert.match(html, /id="pathPickerSearchInput"[^>]*type="search"[^>]*placeholder
|
|
|
107
107
|
assert.match(html, /id="pathPickerClearSearchButton"[^>]*hidden[^>]*>Clear<\/button>/, "cwd picker should expose a clear-search action");
|
|
108
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");
|
|
109
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");
|
|
110
|
+
assert.match(html, /data-side-panel-section="git"[\s\S]*class="side-panel-section-label">Git<[\s\S]*id="gitPanelCountBadge"[\s\S]*id="gitPanelGroups"[\s\S]*aria-label="Git repositories"[\s\S]*id="gitPanelContextMenu"[\s\S]*role="menu"/, "side panel should expose a collapsed, globally deduplicated Git repository list with a count and dedicated action menu");
|
|
111
|
+
assert.match(app, /const GIT_PANEL_CACHE_MAX_AGE_MS = 5 \* 60 \* 1000/, "Git panel should use the approved five-minute page-local freshness window");
|
|
112
|
+
assert.match(app, /function gitPanelTerminalGroups\(\)[\s\S]*tabCwdGroups\(\)[\s\S]*shouldRenderTerminalTabGroup[\s\S]*key: `tab:\$\{tab\.id\}`[\s\S]*title: tabGroupTitle\(tab\.cwd, "Working directory"\)/, "Git panel discovery should mirror visible terminal groups while cwd—not session title—defines ungrouped labels");
|
|
113
|
+
assert.match(app, /function gitPanelCandidates\(groups = gitPanelTerminalGroups\(\)\)[\s\S]*const byCwd = new Map\(\)[\s\S]*key: `cwd:\$\{cwd\}`/, "Git panel discovery should deduplicate repeated cwd candidates globally across terminal groups");
|
|
114
|
+
assert.match(app, /function gitPanelRepositoryCards\(groups = gitPanelTerminalGroups\(\)\)[\s\S]*const identity = root \? `root:\$\{root\}` : candidate\.key[\s\S]*byIdentity/, "Git panel cards should deduplicate discovered repositories globally by canonical Git root");
|
|
115
|
+
assert.match(app, /const cards = gitPanelRepositoryCards\(groups\)/, "Git panel rendering should consume the globally deduplicated repository card list");
|
|
116
|
+
const gitPanelCandidatesSource = appFunctionSource("gitPanelCandidates", "gitPanelRepositoryCards");
|
|
117
|
+
const gitPanelRepositoryCardsSource = appFunctionSource("gitPanelRepositoryCards", "gitPanelRootLabel");
|
|
118
|
+
const gitPanelDeduplication = JSON.parse(vm.runInNewContext(`${gitPanelCandidatesSource}\n${gitPanelRepositoryCardsSource}\nJSON.stringify((() => {\n const groups = [\n { key: "group-a", tabs: [{ id: "tab-1", cwd: "/repo" }, { id: "tab-2", cwd: "/repo" }] },\n { key: "group-b", tabs: [{ id: "tab-3", cwd: "/repo" }, { id: "tab-4", cwd: "/repo/subdir" }] },\n ];\n gitPanelState.discovery.set("cwd:/repo", { root: "/repo", resolved: true });\n gitPanelState.discovery.set("cwd:/repo/subdir", { root: "/repo", resolved: true });\n return { candidates: gitPanelCandidates(groups), cards: gitPanelRepositoryCards(groups) };\n})())`, {
|
|
119
|
+
gitPanelState: { discovery: new Map() },
|
|
120
|
+
gitPanelTerminalGroups: () => [],
|
|
121
|
+
tabGroupTitle: (cwd) => cwd.split("/").filter(Boolean).pop() || "Working directory",
|
|
122
|
+
}));
|
|
123
|
+
assert.equal(gitPanelDeduplication.candidates.length, 2, "repeated cwd tabs across terminal groups should create one discovery candidate per cwd");
|
|
124
|
+
assert.equal(gitPanelDeduplication.cards.length, 1, "different cwd candidates in the same canonical repository should render one card globally");
|
|
125
|
+
assert.equal(gitPanelDeduplication.cards[0].key, "root:/repo", "the global repository card key should be based only on the canonical Git root");
|
|
126
|
+
assert.match(app, /function toggleGitPanelRepository\(card\)[\s\S]*gitPanelState\.expandedCardKey === card\.key[\s\S]*gitPanelState\.expandedCardKey = card\.key/, "only one Git repository card should be expanded at a time");
|
|
127
|
+
assert.match(app, /function loadGitPanelRepository\(card, \{ force = false \} = \{\}\)[\s\S]*!force && gitPanelSnapshotFresh\(existing\)[\s\S]*api\("\/api\/git-panel"/, "repository expansion should reuse fresh cache and otherwise load local status on demand");
|
|
128
|
+
assert.match(app, /ensureGitPanelRepositoriesDiscovered\(\{ retryUnavailable: true \}\)[\s\S]*function ensureGitPanelRepositoriesDiscovered\(\{ retryUnavailable = false \} = \{\}\)[\s\S]*discoverGitPanelCandidate\(candidate, \{ force: true \}\)/, "reopening the Git section should rediscover cwd entries that were previously not repositories");
|
|
129
|
+
assert.match(app, /function renderGitPanel\(\) \{\s+if \(!elements\.gitPanelGroups \|\| !gitPanelSectionExpanded\(\)\) return;/, "tab polling should not rebuild the Git panel while its top-level section is collapsed");
|
|
130
|
+
assert.doesNotMatch(app, /make\("div", "git-side-panel-tree"[\s\S]{0,180}setAttribute\("role", "tree"\)/, "Git file disclosures should use native details semantics instead of an incomplete ARIA tree");
|
|
131
|
+
assert.match(app, /function gitPanelStatsText\(entry = \{\}, category = ""\)[\s\S]*category === "staged"[\s\S]*category === "changes"/, "mixed index/worktree files should display category-specific numstat values");
|
|
132
|
+
assert.match(app, /function renderGitPanelChanges\(card, data\)[\s\S]*"Conflicts"[\s\S]*"Staged"[\s\S]*"Changes"[\s\S]*"Untracked"/, "Git panel should render every requested change category");
|
|
133
|
+
assert.match(app, /function runGitPanelAction\(card, action, path = ""\)[\s\S]*"stage-all"[\s\S]*"unstage-all"[\s\S]*confirm:[\s\S]*git restore --[\s\S]*Delete untracked file/, "Git panel actions should cover staging plus confirmed destructive discard/delete flows");
|
|
134
|
+
assert.match(app, /function renderGitPanelHistory\(card, data\)[\s\S]*openGitCommitDialog\(card\.tabId, commit\)/, "Git History should open bounded commit diffs from the selected repository");
|
|
135
|
+
assert.match(app, /elements\.gitPanelGroups\.replaceChildren\(\.\.\.cards\.map\(renderGitPanelRepositoryCard\)\)/, "Git repositories should render directly without a redundant terminal/session disclosure");
|
|
136
|
+
assert.doesNotMatch(app, /function renderGitPanelGroup\(/, "Git panel should not render terminal/session parent dropdowns");
|
|
137
|
+
assert.match(app, /function gitPanelContextMenuItems\(context\)[\s\S]*kind === "repository"[\s\S]*"View Diff"[\s\S]*"Stage All"[\s\S]*"Unstage All"[\s\S]*"Discard changes…"[\s\S]*"Delete file…"/, "repository and path actions should be provided by the Git context menu");
|
|
138
|
+
assert.match(app, /function bindGitPanelContextMenu\(trigger, context\)[\s\S]*"contextmenu"[\s\S]*"ContextMenu"[\s\S]*event\.shiftKey && event\.key === "F10"/, "Git context actions should support right click and keyboard-equivalent invocation");
|
|
139
|
+
assert.doesNotMatch(app, /git-side-panel-file-actions|git-side-panel-toolbar-actions|git-side-panel-stage-select|gitPanelSmallButton/, "Git rows should not render the removed inline action controls");
|
|
140
|
+
assert.match(app, /function renderGitPanelFolder\(node, card, category, depth = 0\)[\s\S]*const defaultOpen = true[\s\S]*details\.open = gitPanelState\.openFolders\.has\(folderKey\) \? gitPanelState\.openFolders\.get\(folderKey\) : defaultOpen[\s\S]*details\.open === defaultOpen[\s\S]*gitPanelState\.openFolders\.set\(folderKey, details\.open\)[\s\S]*git-side-panel-folder-chevron[\s\S]*aria-hidden/, "Git folders should start expanded at every depth while retaining explicit user collapse overrides");
|
|
141
|
+
assert.match(css, /\.git-side-panel-folder-chevron[\s\S]*transform: rotate\(0deg\)[\s\S]*\.git-side-panel-folder\[open\][\s\S]*transform: rotate\(90deg\)/, "Git folder arrows should indicate collapsed and expanded states");
|
|
142
|
+
assert.match(css, /\.git-side-panel-repository[\s\S]*\.git-side-panel-file[\s\S]*grid-template-columns: 1\.3rem minmax\(5rem, 1fr\) auto[\s\S]*\.git-side-panel-context-menu[\s\S]*\.git-side-panel-commit/, "Git side panel should prioritize filename width and style repository, context-menu, and history surfaces");
|
|
143
|
+
assert.match(server, /async function readGitPanel\(cwd\)[\s\S]*GIT_PANEL_HISTORY_LIMIT[\s\S]*"status", "--porcelain=v1", "-z"[\s\S]*"--numstat", "-z"/, "server should build compact bounded local Git snapshots without full file contents");
|
|
144
|
+
assert.match(server, /async function readGitCommit\(cwd, requestedHash\)[\s\S]*\^\[a-f0-9\][\s\S]*"show", "--format="/, "commit inspection should require a full hash and use a bounded read-only Git show");
|
|
145
|
+
assert.match(server, /"\/api\/git-changes\/stage-all"[\s\S]*stageAllGitChanges[\s\S]*"\/api\/git-changes\/unstage-all"[\s\S]*unstageAllGitChanges/, "server should expose repository-wide stage and unstage mutations");
|
|
146
|
+
assert.match(readme, /side-panel \*\*Git\*\* section[\s\S]*five-minute cache window[\s\S]*confirmed discard\/delete actions[\s\S]*latest 30 commits/, "README should document Git panel grouping, refresh, actions, and history behavior");
|
|
110
147
|
assert.match(html, /id="optionalFeaturesBox"/, "side panel should expose optional feature status and controls");
|
|
111
148
|
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");
|
|
112
149
|
assert.doesNotMatch(html, /id="btwOverlayDialog"/, "/btw should not use a blocking modal overlay");
|
|
113
150
|
assert.match(html, /id="codexUsageBox"/, "side panel should expose Codex subscription usage status");
|
|
114
151
|
assert.match(html, /data-side-panel-section="codex-usage"/, "Codex usage should live in a collapsible side-panel section");
|
|
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]*
|
|
152
|
+
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]*<code>subagent_gate<\/code>[\s\S]*bounded retries or a success quorum[\s\S]*id="subagentsBox"/, "side panel should explain ordinary delegation and retry-gate workflows with a live count");
|
|
116
153
|
assert.match(html, /id="subagentOpenModeSelect"[\s\S]*<option value="overlay">Overlay<\/option>[\s\S]*<option value="tab">Tab \/ terminal<\/option>[\s\S]*id="subagentOpenModeStatus"/, "Subagents should offer a browser-persisted overlay or terminal-tab opening choice");
|
|
117
154
|
assert.match(html, /id="subagentTerminalView"[\s\S]*Subagent · view only[\s\S]*id="subagentTerminalTranscript"[\s\S]*id="subagentTerminalStatus"[^>]*aria-live="off"[\s\S]*id="subagentTerminalInput"[^>]*placeholder="View only — send messages from the parent terminal"[^>]*disabled[\s\S]*Use its parent terminal to interact with the run/, "dedicated subagent tabs should expose a view-only transcript, non-announcing routine status, and disabled input");
|
|
118
155
|
assert.doesNotMatch(html, /id="subagentOverlayDialog"/, "subagent output should not use a blocking modal dialog");
|
|
@@ -293,6 +330,8 @@ assert.match(css, /button\.composer-skill-tag:hover,[\s\S]*?button\.composer-ski
|
|
|
293
330
|
assert.match(css, /\.extension-dialog\.skill-editor-dialog \{[\s\S]*?--skill-editor-size:\s*min\(152rem[\s\S]*?width:\s*var\(--skill-editor-size\);[\s\S]*?height:\s*var\(--skill-editor-size\);[\s\S]*?aspect-ratio:\s*1 \/ 1/, "skill editor should use a square viewport-bounded modal layout");
|
|
294
331
|
assert.match(css, /\.skill-editor-dialog form \{[\s\S]*?height:\s*100%;[\s\S]*?min-height:\s*0/, "skill editor form should fill the square modal without forcing overflow");
|
|
295
332
|
assert.match(css, /\.skill-editor-text \{[\s\S]*?overflow-x:\s*hidden;[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap/, "skill editor text should wrap long lines instead of horizontal scrolling");
|
|
333
|
+
assert.match(html, /<textarea id="fileViewerEditor"[^>]*\bwrap="soft"/, "file viewer source mode should enable soft wrapping");
|
|
334
|
+
assert.match(css, /\.file-viewer-editor \{[\s\S]*?overflow-x:\s*hidden;[\s\S]*?overflow-y:\s*auto;[\s\S]*?overflow-wrap:\s*anywhere;[\s\S]*?white-space:\s*pre-wrap/, "file viewer source mode should wrap long lines to the available preview width");
|
|
296
335
|
assert.match(css, /\.composer-busy-mode-menu \{[\s\S]*?bottom:\s*calc\(100% \+ 0\.22rem\);[\s\S]*?background:\s*var\(--ctp-crust\)/, "busy prompt behavior dropdown should expand above the tag with an opaque background");
|
|
297
336
|
assert.match(css, /\.sticky-user-prompt-button \{[\s\S]*?grid-template-columns:\s*auto minmax\(0, 1fr\) auto/, "last-user-prompt jump control should render as a fixed transcript header");
|
|
298
337
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.sticky-user-prompt-button \{\n\s+grid-template-columns:\s*minmax\(0, 1fr\) auto;\n\s+min-height:\s*36px;[\s\S]*?\.sticky-user-prompt-text \{[\s\S]*?font-size:\s*var\(--text-xs\)/, "mobile last-user-prompt card should preserve compact height while respecting the text floor");
|
|
@@ -350,6 +389,7 @@ assert.match(css, /\.side-panel-section\.collapsed \.side-panel-section-content,
|
|
|
350
389
|
assert.match(css, /\.side-panel-section:not\(\.collapsed\) \.side-panel-section-chevron/, "expanded side panel sections should rotate the chevron");
|
|
351
390
|
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");
|
|
352
391
|
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");
|
|
392
|
+
assert.match(css, /\.subagent-gate-card[\s\S]*\.subagent-gate-status[\s\S]*\.subagent-gate-attempt[\s\S]*\.subagent-gate-attempt-error/, "retry gates should render quorum, attempt status, and failure details");
|
|
353
393
|
assert.match(css, /\.subagent-agent-row:hover,[\s\S]*\.subagent-agent-row:focus-visible/, "subagent rows should expose clickable hover and keyboard focus states");
|
|
354
394
|
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");
|
|
355
395
|
assert.match(css, /\.terminal-tab-subagent-indicator[\s\S]*\.terminal-tab-subagent[\s\S]*\.subagent-terminal-view[\s\S]*\.subagent-terminal-composer textarea:disabled/, "subagent terminal tabs should be visibly marked and retain an explicit disabled composer");
|
|
@@ -370,6 +410,7 @@ assert.match(css, /\.release-npm-stream-header \{[\s\S]*?text-transform:\s*upper
|
|
|
370
410
|
assert.match(css, /\.release-npm-output-summary \{[\s\S]*?cursor:\s*pointer/, "release-npm output should expose a local expand/collapse summary");
|
|
371
411
|
assert.match(css, /\.release-npm-output-details\[open\] \.release-npm-output-toggle/, "release-npm expanded output should rotate the summary chevron");
|
|
372
412
|
assert.match(css, /\.widget-area:has\(\.release-npm-live-widget \.release-npm-output-details\[open\]\)[\s\S]*?flex:\s*0 0 min\(44rem, 68dvh\)/, "live release output should reserve a stable widget slot instead of resizing the transcript while streaming");
|
|
413
|
+
assert.match(css, /\.widget-area:has\(\.workflow-widget\) \{[\s\S]*?flex:\s*0 1 auto;[\s\S]*?max-height:\s*min\(34rem, 52dvh\);[\s\S]*?overflow:\s*auto/, "workflow widgets should stay within a scrollable output-sized slot so the composer and footer remain visible");
|
|
373
414
|
assert.match(css, /\.release-npm-live-widget \.release-npm-output-details\[open\] \.release-npm-terminal,[\s\S]*?height:\s*clamp\(15rem, 42dvh, 31rem\)/, "live release terminals should keep a fixed viewport height while output streams");
|
|
374
415
|
assert.match(css, /\.release-npm-terminal \{[\s\S]*?rgba\(3, 4, 10, 0\.98\)/, "release-npm terminal should use a high-contrast stream panel");
|
|
375
416
|
assert.match(css, /\.release-aur-widget \{[\s\S]*?border-color/, "release-aur output should render as a specialized Web UI widget variant");
|
|
@@ -479,7 +520,10 @@ assert.match(css, /\.git-current-file-header \{[\s\S]*?position:\s*sticky[\s\S]*
|
|
|
479
520
|
assert.match(css, /\.git-changes-file-list \{[\s\S]*?grid-template-columns:\s*repeat\(2, minmax\(0, 1fr\)\)/, "git changes modal should show changed-file jump buttons in two columns without horizontal scrolling");
|
|
480
521
|
assert.match(css, /\.git-diff-grid \{[\s\S]*?grid-template-columns:\s*3\.8rem minmax\(22rem, 1fr\) 3\.8rem minmax\(22rem, 1fr\)/, "git changes modal should render a side-by-side diff grid");
|
|
481
522
|
assert.match(html, /id="gitChangesDialog"[\s\S]*id="gitChangesRefreshButton"[\s\S]*id="gitChangesPullButton"[\s\S]*id="gitChangesBody"/, "git changes modal should expose refresh, pull controls, and a diff body");
|
|
482
|
-
assert.match(app, /chip\.key === "changes"[\s\S]*?options\.onClick = openGitChangesDialog/, "footer CHANGES chip should
|
|
523
|
+
assert.match(app, /chip\.key === "changes"[\s\S]*?options\.onClick = \(\) => openGitChangesDialog\(tab\?\.id \|\| activeTabId\)/, "footer CHANGES chip should pass its tab ID without forwarding the browser click event");
|
|
524
|
+
assert.match(app, /chip\.key === "git-state"[\s\S]*?options\.onClick = \(\) => openGitChangesDialog\(tab\?\.id \|\| activeTabId\)/, "footer git-state chip should pass its tab ID without forwarding the browser click event");
|
|
525
|
+
assert.match(app, /function openGitChangesDialog\(requestedTabId = activeTabId\)[\s\S]*?typeof requestedTabId === "string" && requestedTabId \? requestedTabId : activeTabId/, "git changes dialog should reject event objects and other non-string tab IDs defensively");
|
|
526
|
+
assert.doesNotMatch(app, /options\.onClick = openGitChangesDialog/, "git changes handlers must not forward click events as tab IDs");
|
|
483
527
|
assert.match(app, /async function loadGitChangesDialog[\s\S]*api\("\/api\/git-changes"/, "git changes modal should load diff data from the server endpoint");
|
|
484
528
|
assert.match(app, /"Resolve with agent"[\s\S]*api\("\/api\/git-operation\/resolve-with-agent", \{ method: "POST"[\s\S]*switchToResponseTab\(response\)/, "conflict panel should open the resolution agent in the new tab returned by the server");
|
|
485
529
|
assert.match(server, /function gitConflictResolutionAgentPrompt\(operation\)[\s\S]*Conflicted files:[\s\S]*Do not continue, skip, abort, commit, reset, or push[\s\S]*diff-filter=U is empty/, "server should build a bounded conflict handoff with operation safety and verification instructions");
|
|
@@ -507,6 +551,7 @@ assert.match(css, /\.footer-model-picker[\s\S]*?position:\s*absolute[\s\S]*?left
|
|
|
507
551
|
assert.match(css, /@media \(max-width: 720px\), \(max-device-width: 720px\), \(pointer: coarse\) and \(hover: none\)[\s\S]*?\.footer-model-picker \{[\s\S]*?position:\s*fixed/, "mobile footer model picker should escape footer-details stacking as a fixed overlay on narrow, device-width-narrow, or touch-only devices");
|
|
508
552
|
assert.match(css, /bottom:\s*var\(--footer-model-picker-bottom/, "mobile footer model picker should be anchored by a JS-computed viewport offset");
|
|
509
553
|
assert.match(css, /\.footer-model-option\.active/, "footer model picker should style the selected scoped model");
|
|
554
|
+
assert.match(css, /\.model-search-result-main,\n\.model-search-result-name \{[\s\S]*?line-height:\s*1\.3;/, "side-panel model titles should reserve enough line height to avoid clipping heavy font glyphs");
|
|
510
555
|
assert.match(app, /async function createPathPickerDirectory\(\)/, "cwd picker should implement create-directory behavior in the browser");
|
|
511
556
|
assert.match(app, /function renderPathPickerDirectoryList\(\)[\s\S]*pathPickerDirectoryMatchesSearch/, "cwd picker should filter current-directory entries in the browser");
|
|
512
557
|
assert.match(app, /elements\.pathPickerSearchInput\.addEventListener\("input", renderPathPickerDirectoryList\)/, "cwd picker should update directory matches as the user types");
|
|
@@ -718,7 +763,18 @@ assert.match(
|
|
|
718
763
|
"side-panel section toggles should expand at most one section at a time",
|
|
719
764
|
);
|
|
720
765
|
assert.match(app, /function renderCodexUsage\(\)/, "frontend should render Codex usage buckets in the side panel");
|
|
721
|
-
assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents by terminal and session");
|
|
766
|
+
assert.match(app, /function renderSubagents\(\)[\s\S]*subagentTabsWithRunningAgents\(\)[\s\S]*totalGates[\s\S]*renderSubagentTabGroup\(tab\)/, "frontend should group running subagents and retained retry gates by terminal and session");
|
|
767
|
+
assert.match(app, /function renderSubagentGateAttempt\(attempt\)[\s\S]*failureKind[\s\S]*function renderSubagentGate\(gate\)[\s\S]*qualifyingSuccesses/, "frontend should render failure-classified attempts and gate quorum");
|
|
768
|
+
assert.match(helper, /async function enrichAsyncSubagentAgent\(run, agent, statusByDir\)[\s\S]*status\.json[\s\S]*agent\.model = subagentModel\(step\.model\)[\s\S]*agent\.thinking = subagentThinking\(step\.thinking\)/, "WebUI helper should enrich async children from effective lifecycle model and reasoning metadata");
|
|
769
|
+
assert.match(helper, /SUBAGENT_GATE_UPDATE_EVENT[\s\S]*function publicSubagentGates\(\)[\s\S]*failureKind[\s\S]*gates = publicSubagentGates\(\)/, "WebUI helper should publish bounded retry-gate lifecycle data");
|
|
770
|
+
assert.match(extension, /registerSubagentGate\(pi\)[\s\S]*session_shutdown[\s\S]*subagentGate\.dispose\(\)/, "the WebUI package extension should own the retry-gate tool lifecycle without another extension package");
|
|
771
|
+
assert.match(server, /function normalizeWebuiSubagentPayload\(value\)[\s\S]*model: normalizeWebuiSubagentText\(rawAgent\.model, 240\)[\s\S]*thinking: normalizeWebuiSubagentText\(rawAgent\.thinking, 40\)/, "server should bound model and reasoning metadata in the cross-tab overview");
|
|
772
|
+
assert.match(server, /WEBUI_SUBAGENT_GATE_LIMIT[\s\S]*rawGate\.attempts[\s\S]*failureKind: normalizeWebuiSubagentText\(rawAttempt\.failureKind, 80\)[\s\S]*totalGates/, "server should bound retry gates and expose their cross-tab total");
|
|
773
|
+
assert.match(server, /function normalizeWebuiSubagentOutput\(value, selection\)[\s\S]*model: normalizeWebuiSubagentText\(rawAgent\.model, 240\)[\s\S]*thinking: normalizeWebuiSubagentText\(rawAgent\.thinking, 40\)/, "server should preserve model and reasoning metadata in selected child output");
|
|
774
|
+
assert.match(app, /function subagentExecutionFacts\(agent = \{\}\)[\s\S]*model \$\{model \|\| "unknown"\}[\s\S]*reasoning \$\{thinking \|\| "unknown"\}/, "subagent metadata should use one honest model/reasoning formatter with unknown fallbacks");
|
|
775
|
+
assert.match(app, /function renderSubagentAgent\(tab, run, agent\)[\s\S]*\.\.\.subagentExecutionFacts\(agent\)/, "Subagents side-panel rows should show model and reasoning effort");
|
|
776
|
+
assert.match(app, /function subagentOverlayStateFacts\(data = subagentOverlayData\)[\s\S]*\.\.\.subagentExecutionFacts\(agent\)/, "subagent overlays should show model and reasoning effort");
|
|
777
|
+
assert.match(app, /function renderSubagentTerminalView\(\)[\s\S]*\.\.\.subagentExecutionFacts\(agent\)/, "dedicated subagent terminal views should show model and reasoning effort");
|
|
722
778
|
assert.match(app, /SUBAGENT_OPEN_MODE_STORAGE_KEY = "pi-webui-subagent-open-mode"[\s\S]*function normalizeSubagentOpenMode\(value\)[\s\S]*function restoreSubagentOpenModeSetting\(\)/, "subagent opening mode should default safely and persist in this browser");
|
|
723
779
|
assert.match(app, /function openSubagentOutput\(tab, run, agent\) \{[\s\S]*subagentOpenMode === "tab" \? openSubagentTerminal\(tab, run, agent\) : openSubagentOverlay\(tab, run, agent\)/, "clicking an agent should dispatch to the selected overlay or terminal-tab view");
|
|
724
780
|
assert.match(app, /function openSubagentOverlay\(tab, run, agent\)[\s\S]*activeSubagentTerminalId[\s\S]*deactivateSubagentTerminalView\(\{ render: false \}\)[\s\S]*activeTabId !== tab\.tabId[\s\S]*await switchTab\(tab\.tabId\)[\s\S]*renderWidgets\(\)/, "opening an overlay should first leave any virtual child tab, then switch to its owning terminal before rendering the widget");
|
|
@@ -836,7 +892,10 @@ assert.match(app, /function parseGitFooterWebuiPayloadRaw\(raw\)[\s\S]*GIT_FOOTE
|
|
|
836
892
|
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");
|
|
837
893
|
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");
|
|
838
894
|
assert.match(app, /FOOTER_PAYLOAD_ACTIONS = new Set\(\["calibrate-current", "calibrate-probe"\]\)[\s\S]*chip\.action = value\.action;/, "git footer payload chips should preserve allowlisted actions such as PI calibration");
|
|
839
|
-
assert.match(app, /async function runGitFooterPiCalibration\(
|
|
895
|
+
assert.match(app, /async function runGitFooterPiCalibration\(tabContext = activeTabContext\(\)\)[\s\S]*resolveAvailableCommandName\("calibrate", \{ rpcOnly: true \}\)[\s\S]*sendPrompt\("prompt", `\/\$\{commandName\}`[\s\S]*scheduleGitFooterPiCalibrationRefresh\(tabContext\)/, "clicking the PI footer chip should dispatch exactly /calibrate and schedule a refreshed footer value");
|
|
896
|
+
assert.match(app, /function applyGitFooterPiCalibrationOptions\(chip, options\) \{\s+if \(chip\?\.key !== "pi"\) return "";[\s\S]*void runGitFooterPiCalibration\(\)/, "every PI footer chip should remain clickable regardless of payload calibration action metadata");
|
|
897
|
+
assert.doesNotMatch(app.match(/async function runGitFooterPiCalibration[\s\S]*?\n\}/)?.[0] || "", /commandName\} current|appConfirmText/, "PI footer calibration should neither append the current-mode argument nor open a probe confirmation dialog");
|
|
898
|
+
|
|
840
899
|
assert.match(app, /title: cleanFooterPayloadText\(value\.title, "", 4000\)/, "git footer tooltip titles should preserve long cwd paths instead of truncating at chip display length");
|
|
841
900
|
assert.match(app, /const sourceTitle = cleanFooterPayloadText\(chip\?\.title, "", 4000\)/, "git footer tooltip rendering should keep full source titles for long cwd paths");
|
|
842
901
|
assert.match(app, /function renderFooter\(\)[\s\S]*parseGitFooterWebuiPayload\(\)[\s\S]*renderGitFooterPayload\(footerPayloadWithLiveModel\(gitFooterPayload\)\)/, "detailed footer rendering should prefer the git-footer-status extension payload");
|
|
@@ -962,10 +1021,14 @@ assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-ins
|
|
|
962
1021
|
assert.match(app, /function renderWorkflowInspectorAgent\(agent, run\)[\s\S]*Prompt[\s\S]*Recent activity[\s\S]*Result and usage[\s\S]*Retry agent/, "agent drilldown should expose prompt, activity, result, usage, and retry");
|
|
963
1022
|
assert.match(app, /canPause[\s\S]*`\/workflow pause \$\{run\.runId\}`[\s\S]*canAbort[\s\S]*`\/workflow abort \$\{run\.runId\}`[\s\S]*Save user[\s\S]*Save project[\s\S]*Raw workflow script/, "WebUI Workflow controls should send canonical extension commands and expose raw scripts");
|
|
964
1023
|
assert.match(app, /confirmMessage && !window\.confirm\(confirmMessage\)/, "destructive WebUI Workflow actions should require browser confirmation");
|
|
965
|
-
assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)/, "Workflow inspector
|
|
1024
|
+
assert.match(app, /const workflowInspectorByTab = new Map\(\)[\s\S]*workflowInspectorSelectionByTab = new Map\(\)[\s\S]*workflowInspectorMinimizedByTab = new Set\(\)/, "Workflow inspector run, selection, and minimized state should be per tab");
|
|
1025
|
+
assert.match(app, /function workflowInspectorSetMinimized\(minimized\)[\s\S]*workflowInspectorMinimizedByTab\.(?:add|delete)[\s\S]*renderWidgets\(\)[\s\S]*requestAnimationFrame[\s\S]*workflow-inspector-minimize-button[\s\S]*focus\(\{ preventScroll: true \}\)/, "Workflow inspector minimize state should survive rerenders and restore focus to the replacement control");
|
|
1026
|
+
assert.match(app, /function renderWorkflowInspectorWidget\(\)[\s\S]*workflow-inspector-body[\s\S]*workflow-inspector-minimize-button[\s\S]*minimized \? "Restore" : "Minimize"[\s\S]*minimizeButton\.type = "button"[\s\S]*aria-controls[\s\S]*aria-expanded[\s\S]*aria-label[\s\S]*if \(minimized\) return node/, "Workflow inspector should expose an accessible minimize and restore disclosure control");
|
|
1027
|
+
assert.match(app, /workflowInspectorMinimizedByTab\.delete\(tabId\)/, "closing a terminal tab should discard its Workflow inspector minimize state");
|
|
966
1028
|
assert.match(app, /handleInactiveTabEvent\(event\)[\s\S]*WORKFLOW_INSPECTOR_WIDGET_KEY[\s\S]*updateWorkflowInspectorForTab\(event\.tabId, inspector\)[\s\S]*renderTabs\(\)/, "inactive tabs should consume replayed Workflow inspector payloads for badges");
|
|
967
1029
|
assert.match(app, /terminal-tab-workflow-indicator[\s\S]*workflowRunningCountForTab/, "terminal tabs should display Workflow Mode or active-run badges");
|
|
968
1030
|
assert.match(css, /\.workflow-inspector-layout \{[\s\S]*grid-template-columns:[\s\S]*\.workflow-inspector-run-list[\s\S]*\.workflow-inspector-agent/, "Workflow inspector should have responsive run and agent layout styling");
|
|
1031
|
+
assert.match(css, /\.workflow-inspector-widget\.minimized \{[\s\S]*\.workflow-inspector-minimize-button/, "Workflow inspector should style its minimized state and toggle control");
|
|
969
1032
|
assert.match(css, /\.terminal-tab-workflow-indicator \{[\s\S]*color: var\(--ctp-mauve\)/, "inactive-tab Workflow badges should have a distinct accessible style");
|
|
970
1033
|
assert.match(css, /\.composer-workflow-mode-button\.active,[\s\S]*aria-pressed="true"/, "active Workflow Mode toggle should have persistent pressed styling");
|
|
971
1034
|
assert.match(css, /\.composer\.workflow-mode-active[\s\S]*body\.workflow-mode-active \.composer::before/, "active Workflow Mode should visibly accent the composer");
|
|
@@ -1233,6 +1296,7 @@ assert.match(app, /case "agent_end":[\s\S]*?clearRunIndicatorActivity\(\)/, "age
|
|
|
1233
1296
|
assert.match(app, /case "agent_end":[\s\S]*?notifyAgentDone\(event\.tabId \|\| activeTabId/, "agent completion should trigger optional done notifications");
|
|
1234
1297
|
assert.match(app, /function getPathTrigger\(\)/, "prompt composer should detect @ file\/path reference triggers");
|
|
1235
1298
|
assert.match(app, /api\(`\/api\/path-suggestions\?query=\$\{encodeURIComponent\(trigger\.query\)\}`/, "@ reference suggestions should load from the server as the user types");
|
|
1299
|
+
assert.match(app, /async function api\([\s\S]*?if \(signal\?\.aborted \|\| error\?\.name === "AbortError"\) throw error;[\s\S]*?setBackendOffline\(true, offlineError\)/, "cancelled @ autocomplete requests should not mark the server offline");
|
|
1236
1300
|
assert.match(app, /formatPathReference\(suggestion\.path, trigger\.quoted\)/, "accepting a path suggestion should insert an @ reference into the prompt");
|
|
1237
1301
|
assert.match(app, /let pathSuggestActiveQuery = null/, "@ autocomplete should track the active path query to avoid duplicate refresh flicker");
|
|
1238
1302
|
assert.match(app, /pathSuggestActiveQuery === trigger\.query[\s\S]*?return;/, "@ autocomplete should skip duplicate same-query fetches from input and keyup events");
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { test } from "node:test";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
|
|
7
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
8
|
+
const [app, gitFooterExtension] = await Promise.all([
|
|
9
|
+
readFile(join(root, "public", "app.js"), "utf8"),
|
|
10
|
+
readFile(join(root, "..", "pi-extension-git-footer-status", "index.ts"), "utf8"),
|
|
11
|
+
]);
|
|
12
|
+
const readFunction = (name) => app.match(new RegExp(`(?:async )?function ${name}\\([^]*?\\n\\}`))?.[0] || "";
|
|
13
|
+
|
|
14
|
+
test("PI footer metric always exposes the calibration click action", () => {
|
|
15
|
+
const applyOptions = readFunction("applyGitFooterPiCalibrationOptions");
|
|
16
|
+
assert.match(applyOptions, /if \(chip\?\.key !== "pi"\) return "";/);
|
|
17
|
+
assert.doesNotMatch(applyOptions, /chip\?\.action|FOOTER_PAYLOAD_ACTIONS/);
|
|
18
|
+
assert.match(applyOptions, /void runGitFooterPiCalibration\(\)/);
|
|
19
|
+
assert.match(applyOptions, /ariaBusy/);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
test("PI footer click dispatches exactly /calibrate in the background", () => {
|
|
23
|
+
const runCalibration = readFunction("runGitFooterPiCalibration");
|
|
24
|
+
assert.match(runCalibration, /resolveAvailableCommandName\("calibrate", \{ rpcOnly: true \}\)/);
|
|
25
|
+
assert.match(runCalibration, /await sendPrompt\("prompt", `\/\$\{commandName\}`, \{ targetTabId: tabContext\.tabId, throwOnError: true \}\)/);
|
|
26
|
+
assert.doesNotMatch(runCalibration, /commandName\} current|appConfirmText/);
|
|
27
|
+
assert.match(runCalibration, /gitFooterPiCalibrationInFlightByTab\.has\(tabContext\.tabId\)/);
|
|
28
|
+
assert.match(runCalibration, /currentState\?\.isStreaming \|\| currentState\?\.isCompacting/);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("PI calibration schedules bounded delayed footer refreshes", () => {
|
|
32
|
+
const scheduleRefresh = readFunction("scheduleGitFooterPiCalibrationRefresh");
|
|
33
|
+
const runCalibration = readFunction("runGitFooterPiCalibration");
|
|
34
|
+
assert.match(scheduleRefresh, /delays = \[5000, 14000, 30000\]/);
|
|
35
|
+
assert.match(scheduleRefresh, /requestGitFooterWebuiPayload\(tabContext, \{ force: true \}\)/);
|
|
36
|
+
assert.match(runCalibration, /scheduleGitFooterPiCalibrationRefresh\(tabContext\)/);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
test("PI calibration busy state invalidates the footer render cache key", () => {
|
|
40
|
+
const pickerStateKey = readFunction("gitFooterPickerStateKey");
|
|
41
|
+
assert.match(pickerStateKey, /gitFooterPiCalibrationInFlightByTab\.has\(tabContext\.tabId\)/);
|
|
42
|
+
assert.match(pickerStateKey, /piCalibrationInFlight \? 1 : 0/);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
test("PI refresh scheduling survives an immediate tab switch", () => {
|
|
46
|
+
const runCalibration = readFunction("runGitFooterPiCalibration");
|
|
47
|
+
assert.match(runCalibration, /scheduleGitFooterPiCalibrationRefresh\(tabContext\);\s+if \(!isCurrentTabContext\(tabContext\)\) return;/);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
test("explicit git-footer refresh invalidates stale calibration records", () => {
|
|
51
|
+
assert.match(
|
|
52
|
+
gitFooterExtension,
|
|
53
|
+
/pi\.registerCommand\("git-footer-refresh"[\s\S]*promptCalibrationCache = null;\s+await refreshPromptInjectionEstimate\(ctx\)/,
|
|
54
|
+
);
|
|
55
|
+
});
|