@firstpick/pi-package-webui 0.9.7 → 0.9.8
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 -3
- package/bin/pi-webui.mjs +114 -25
- package/index.ts +2 -1
- package/lib/optional-feature-catalog.mjs +1 -1
- package/package.json +1 -1
- package/public/app.js +629 -98
- package/public/guided-git-command-state.mjs +175 -1
- package/public/index.html +12 -9
- package/public/service-worker.js +1 -1
- package/public/styles.css +133 -31
- package/public/transcript-renderer.mjs +62 -0
- package/tests/boot-failure-diagnostics.test.mjs +3 -3
- package/tests/browser/footer-model-advanced-layout.spec.mjs +512 -0
- package/tests/browser/guided-git-extension-command.spec.mjs +180 -0
- package/tests/browser/guided-git-fallback.spec.mjs +68 -3
- package/tests/browser/interaction-continuity.spec.mjs +33 -0
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/compaction-static.test.mjs +1 -1
- package/tests/composer-action-grid-reorder-static.test.mjs +3 -3
- package/tests/control-visibility-static.test.mjs +3 -3
- package/tests/controls-layout-static.test.mjs +3 -3
- package/tests/events-tree-context-menu-static.test.mjs +3 -3
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +2 -2
- package/tests/file-viewer-image-static.test.mjs +3 -3
- package/tests/fixtures/fake-pi.mjs +34 -3
- package/tests/git-footer-context-menu-static.test.mjs +103 -1
- package/tests/guided-git-activation-http.test.mjs +194 -0
- package/tests/guided-git-activation-static.test.mjs +80 -0
- package/tests/guided-git-activation.test.mjs +244 -0
- package/tests/guided-git-fallback-runtime.test.mjs +1 -0
- package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
- package/tests/guided-git-message-reliability-static.test.mjs +2 -1
- package/tests/guided-git-optional-feature.test.mjs +31 -0
- package/tests/http-endpoints-harness.test.mjs +3 -0
- package/tests/interaction-state-stability-static.test.mjs +1 -1
- package/tests/intercom-conversation-viewer-static.test.mjs +3 -3
- package/tests/main-output-loading-static.test.mjs +11 -9
- package/tests/middle-button-drag-scroll-static.test.mjs +3 -3
- package/tests/mobile-continuity-tablet-static.test.mjs +3 -3
- package/tests/mobile-foundation-static.test.mjs +3 -3
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/mobile-static.test.mjs +85 -4
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/persistent-ui-layout-static.test.mjs +3 -3
- package/tests/prompt-input-vertical-scroll-static.test.mjs +6 -6
- package/tests/prompt-routing-input-clear-static.test.mjs +1 -1
- package/tests/questionnaire-dialog.test.mjs +3 -3
- package/tests/session-sampling-ui-static.test.mjs +3 -3
- package/tests/side-panel-section-height-removal-static.test.mjs +3 -3
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +3 -3
- package/tests/tab-close-continuity-static.test.mjs +2 -0
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/thinking-block-grouping.test.mjs +79 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { spawn, spawnSync } from "node:child_process";
|
|
3
|
+
import { createServer } from "node:net";
|
|
4
|
+
import { mkdtemp, rm, writeFile } from "node:fs/promises";
|
|
5
|
+
import { tmpdir } from "node:os";
|
|
6
|
+
import { dirname, join } from "node:path";
|
|
7
|
+
import { setTimeout as delay } from "node:timers/promises";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
import { expect, test } from "@playwright/test";
|
|
10
|
+
|
|
11
|
+
test.describe.configure({ mode: "serial" });
|
|
12
|
+
|
|
13
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
14
|
+
const serverScript = join(root, "bin", "pi-webui.mjs");
|
|
15
|
+
const fakePi = join(root, "tests", "fixtures", "fake-pi.mjs");
|
|
16
|
+
|
|
17
|
+
async function freePort() {
|
|
18
|
+
const server = createServer();
|
|
19
|
+
await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
20
|
+
const { port } = server.address();
|
|
21
|
+
await new Promise((resolve) => server.close(resolve));
|
|
22
|
+
return port;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let child;
|
|
26
|
+
let baseURL;
|
|
27
|
+
let tempRoot;
|
|
28
|
+
let output = "";
|
|
29
|
+
|
|
30
|
+
async function waitForServer() {
|
|
31
|
+
for (let attempt = 0; attempt < 100; attempt += 1) {
|
|
32
|
+
if (child.exitCode !== null) break;
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(`${baseURL}/api/health`, { signal: AbortSignal.timeout(500) });
|
|
35
|
+
if (response.ok) return;
|
|
36
|
+
} catch {}
|
|
37
|
+
await delay(100);
|
|
38
|
+
}
|
|
39
|
+
throw new Error(`Pi Web UI did not start:\n${output}`);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
test.beforeAll(async () => {
|
|
43
|
+
const port = await freePort();
|
|
44
|
+
tempRoot = await mkdtemp(join(tmpdir(), "pi-webui-guided-git-extension-"));
|
|
45
|
+
assert.equal(spawnSync("git", ["init", "--quiet"], { cwd: tempRoot }).status, 0);
|
|
46
|
+
await writeFile(join(tempRoot, "fixture.txt"), "guided git extension fixture\n", "utf8");
|
|
47
|
+
const settingsFile = join(tempRoot, "settings.json");
|
|
48
|
+
await writeFile(settingsFile, `${JSON.stringify({
|
|
49
|
+
version: 8,
|
|
50
|
+
gitWorkflow: {
|
|
51
|
+
reviewProcessEnabled: false,
|
|
52
|
+
stagingPolicy: "all",
|
|
53
|
+
generation: {
|
|
54
|
+
provider: "fake",
|
|
55
|
+
modelId: "fake-model",
|
|
56
|
+
thinkingLevel: "off",
|
|
57
|
+
unavailablePolicy: "ask",
|
|
58
|
+
fallback: { provider: "", modelId: "", thinkingLevel: "off" },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
}, null, 2)}\n`, "utf8");
|
|
62
|
+
baseURL = `http://127.0.0.1:${port}`;
|
|
63
|
+
child = spawn(process.execPath, [serverScript, "--cwd", tempRoot, "--host", "127.0.0.1", "--port", String(port), "--pi", fakePi], {
|
|
64
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
65
|
+
env: {
|
|
66
|
+
...process.env,
|
|
67
|
+
PI_WEBUI_RPC_SUPERVISOR: "0",
|
|
68
|
+
PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
|
|
69
|
+
PI_WEBUI_SETTINGS_FILE: settingsFile,
|
|
70
|
+
FAKE_PI_GUIDED_GIT_ACTIVATION: "1",
|
|
71
|
+
FAKE_PI_GUIDED_GIT_ACTIVATION_DELAY_MS: "150",
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
75
|
+
child.stderr.on("data", (chunk) => { output += String(chunk); });
|
|
76
|
+
await waitForServer();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
test.afterAll(async () => {
|
|
80
|
+
if (child?.exitCode === null) child.kill("SIGTERM");
|
|
81
|
+
if (child?.exitCode === null) await new Promise((resolve) => child.once("exit", resolve));
|
|
82
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
test("typing /git-guided-workflow opens the originating tab workflow exactly once", async ({ page }) => {
|
|
86
|
+
let preferenceLoads = 0;
|
|
87
|
+
page.on("request", (request) => {
|
|
88
|
+
if (new URL(request.url()).pathname === "/api/git-workflow/preferences") preferenceLoads += 1;
|
|
89
|
+
});
|
|
90
|
+
await page.goto(baseURL);
|
|
91
|
+
const button = page.locator("#gitWorkflowButton");
|
|
92
|
+
await expect(button).toBeVisible();
|
|
93
|
+
await expect(button).toBeEnabled();
|
|
94
|
+
|
|
95
|
+
const prompt = page.locator("#promptInput");
|
|
96
|
+
await prompt.fill("/git-guided-workflow");
|
|
97
|
+
await prompt.press("Enter");
|
|
98
|
+
|
|
99
|
+
await expect(page.locator("#gitWorkflowPanel")).toBeVisible();
|
|
100
|
+
await expect(page.locator("#gitWorkflowKicker")).toHaveText("Git workflow");
|
|
101
|
+
await expect(prompt).toHaveValue("");
|
|
102
|
+
await delay(200);
|
|
103
|
+
assert.equal(preferenceLoads, 1, "one typed extension command must start one browser workflow");
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
test("one browser command starts Guided Git only in its originating client", async ({ browser }) => {
|
|
107
|
+
const context = await browser.newContext();
|
|
108
|
+
const origin = await context.newPage();
|
|
109
|
+
const observer = await context.newPage();
|
|
110
|
+
let originPreferenceLoads = 0;
|
|
111
|
+
let observerPreferenceLoads = 0;
|
|
112
|
+
origin.on("request", (request) => {
|
|
113
|
+
if (new URL(request.url()).pathname === "/api/git-workflow/preferences") originPreferenceLoads += 1;
|
|
114
|
+
});
|
|
115
|
+
observer.on("request", (request) => {
|
|
116
|
+
if (new URL(request.url()).pathname === "/api/git-workflow/preferences") observerPreferenceLoads += 1;
|
|
117
|
+
});
|
|
118
|
+
await origin.goto(baseURL);
|
|
119
|
+
await observer.goto(baseURL);
|
|
120
|
+
await expect(origin.locator("#gitWorkflowButton")).toBeEnabled();
|
|
121
|
+
await expect(observer.locator("#gitWorkflowButton")).toBeEnabled();
|
|
122
|
+
|
|
123
|
+
await origin.locator("#promptInput").fill("/git-guided-workflow");
|
|
124
|
+
await origin.locator("#promptInput").press("Enter");
|
|
125
|
+
|
|
126
|
+
await expect(origin.locator("#gitWorkflowPanel")).toBeVisible();
|
|
127
|
+
await delay(250);
|
|
128
|
+
await expect(observer.locator("#gitWorkflowPanel")).toBeHidden();
|
|
129
|
+
assert.equal(originPreferenceLoads, 1, "the initiating browser owns the activation");
|
|
130
|
+
assert.equal(observerPreferenceLoads, 0, "another browser attached to the same Pi tab must ignore the broadcast");
|
|
131
|
+
await context.close();
|
|
132
|
+
});
|
|
133
|
+
|
|
134
|
+
test("two initiating clients cannot cross-claim one pending Guided Git activation", async ({ browser }) => {
|
|
135
|
+
const context = await browser.newContext();
|
|
136
|
+
const first = await context.newPage();
|
|
137
|
+
const second = await context.newPage();
|
|
138
|
+
let preferenceLoads = 0;
|
|
139
|
+
for (const page of [first, second]) {
|
|
140
|
+
page.on("request", (request) => {
|
|
141
|
+
if (new URL(request.url()).pathname === "/api/git-workflow/preferences") preferenceLoads += 1;
|
|
142
|
+
});
|
|
143
|
+
await page.goto(baseURL);
|
|
144
|
+
await expect(page.locator("#gitWorkflowButton")).toBeEnabled();
|
|
145
|
+
await page.locator("#promptInput").fill("/git-guided-workflow");
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
await Promise.all([
|
|
149
|
+
first.locator("#promptInput").press("Enter"),
|
|
150
|
+
second.locator("#promptInput").press("Enter"),
|
|
151
|
+
]);
|
|
152
|
+
await expect.poll(async () => Number(await first.locator("#gitWorkflowPanel").isVisible()) + Number(await second.locator("#gitWorkflowPanel").isVisible())).toBe(1);
|
|
153
|
+
await delay(250);
|
|
154
|
+
assert.equal(preferenceLoads, 1, "server arbitration and envelope correlation must produce one aggregate start");
|
|
155
|
+
await context.close();
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
test("Guided Git button dispatch preserves the existing composer draft and attachment", async ({ page }) => {
|
|
159
|
+
const promptMessages = [];
|
|
160
|
+
page.on("request", (request) => {
|
|
161
|
+
if (new URL(request.url()).pathname !== "/api/prompt" || request.method() !== "POST") return;
|
|
162
|
+
const data = request.postDataJSON();
|
|
163
|
+
promptMessages.push(data?.message);
|
|
164
|
+
});
|
|
165
|
+
await page.goto(baseURL);
|
|
166
|
+
const prompt = page.locator("#promptInput");
|
|
167
|
+
await prompt.fill("keep this draft");
|
|
168
|
+
await page.locator("#attachmentInput").setInputFiles({
|
|
169
|
+
name: "keep.txt",
|
|
170
|
+
mimeType: "text/plain",
|
|
171
|
+
buffer: Buffer.from("keep this attachment\n"),
|
|
172
|
+
});
|
|
173
|
+
await expect(page.locator(".attachment-pill-name")).toHaveText("keep.txt");
|
|
174
|
+
|
|
175
|
+
await page.locator("#gitWorkflowButton").click();
|
|
176
|
+
await expect(page.locator("#gitWorkflowPanel")).toBeVisible();
|
|
177
|
+
await expect(prompt).toHaveValue("keep this draft");
|
|
178
|
+
await expect(page.locator(".attachment-pill-name")).toHaveText("keep.txt");
|
|
179
|
+
assert.equal(promptMessages.filter((message) => /^\/git-guided-workflow(?::\d+)?$/u.test(String(message || ""))).length, 1);
|
|
180
|
+
});
|
|
@@ -8,6 +8,8 @@ import { setTimeout as delay } from "node:timers/promises";
|
|
|
8
8
|
import { fileURLToPath } from "node:url";
|
|
9
9
|
import { expect, test } from "@playwright/test";
|
|
10
10
|
|
|
11
|
+
test.describe.configure({ mode: "serial" });
|
|
12
|
+
|
|
11
13
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
12
14
|
const serverScript = join(root, "bin", "pi-webui.mjs");
|
|
13
15
|
|
|
@@ -44,13 +46,39 @@ test.beforeAll(async () => {
|
|
|
44
46
|
const fakePi = join(tempRoot, "fake-pi.mjs");
|
|
45
47
|
const logFile = join(tempRoot, "rpc.jsonl");
|
|
46
48
|
await writeFile(fakePi, `#!/usr/bin/env node
|
|
47
|
-
import { appendFileSync } from "node:fs";
|
|
49
|
+
import { appendFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
50
|
+
import { join } from "node:path";
|
|
48
51
|
import { createInterface } from "node:readline";
|
|
49
52
|
const logFile = process.env.GUIDED_GIT_BROWSER_LOG;
|
|
53
|
+
const fallbackSuccessFlag = process.env.GUIDED_GIT_BROWSER_FALLBACK_SUCCESS;
|
|
54
|
+
const artifactRoot = process.env.GUIDED_GIT_BROWSER_ARTIFACT_ROOT;
|
|
50
55
|
let model = { provider: "fake", id: "original" };
|
|
51
56
|
let thinkingLevel = "high";
|
|
52
57
|
function send(value) { process.stdout.write(JSON.stringify(value) + "\\n"); }
|
|
53
58
|
function log(value) { appendFileSync(logFile, JSON.stringify(value) + "\\n"); }
|
|
59
|
+
function fallbackSuccessEnabled() { return existsSync(fallbackSuccessFlag); }
|
|
60
|
+
function event(value) { send(value); }
|
|
61
|
+
function assistantFailure() { return { role: "assistant", stopReason: "error", content: [{ type: "text", text: "fixture failure" }] }; }
|
|
62
|
+
function writeCommitArtifacts() {
|
|
63
|
+
const directory = join(artifactRoot, "dev", "COMMIT");
|
|
64
|
+
mkdirSync(directory, { recursive: true });
|
|
65
|
+
writeFileSync(join(directory, "staged-commit-short.txt"), "fallback short\\n");
|
|
66
|
+
writeFileSync(join(directory, "staged-commit-long.txt"), "fallback long\\n");
|
|
67
|
+
}
|
|
68
|
+
function settle({ failed = false, wait = 20 } = {}) {
|
|
69
|
+
setTimeout(() => {
|
|
70
|
+
event({ type: "agent_start" });
|
|
71
|
+
if (failed) {
|
|
72
|
+
const message = assistantFailure();
|
|
73
|
+
event({ type: "message_end", message });
|
|
74
|
+
event({ type: "agent_end", willRetry: false, messages: [message] });
|
|
75
|
+
} else {
|
|
76
|
+
event({ type: "message_end", message: { role: "assistant", content: [{ type: "text", text: "fixture success" }] } });
|
|
77
|
+
event({ type: "agent_end" });
|
|
78
|
+
}
|
|
79
|
+
event({ type: "agent_settled" });
|
|
80
|
+
}, wait);
|
|
81
|
+
}
|
|
54
82
|
const models = [
|
|
55
83
|
{ provider: "fake", id: "original", name: "Original", reasoning: true },
|
|
56
84
|
{ provider: "fake", id: "primary", name: "Primary", reasoning: true },
|
|
@@ -69,10 +97,12 @@ createInterface({ input: process.stdin }).on("line", (line) => {
|
|
|
69
97
|
{ name: "pr", source: "extension", description: "Generate PR text" },
|
|
70
98
|
] } });
|
|
71
99
|
else if (command.type === "get_messages") send({ ...response, data: { messages: [] } });
|
|
72
|
-
else if (command.type === "set_model" && command.modelId === "primary") send({ ...response, success: false, error: "SECRET primary failure at /private/provider.mjs:12" });
|
|
100
|
+
else if (command.type === "set_model" && command.modelId === "primary" && !fallbackSuccessEnabled()) send({ ...response, success: false, error: "SECRET primary failure at /private/provider.mjs:12" });
|
|
73
101
|
else if (command.type === "set_model") { model = { provider: command.provider, id: command.modelId }; send({ ...response, data: model }); }
|
|
74
102
|
else if (command.type === "set_thinking_level") { thinkingLevel = command.level; send({ ...response, data: { level: thinkingLevel } }); }
|
|
75
|
-
else if (command.type === "prompt" && model.id === "
|
|
103
|
+
else if (command.type === "prompt" && model.id === "primary" && fallbackSuccessEnabled()) { send({ ...response, data: {} }); settle({ failed: true }); }
|
|
104
|
+
else if (command.type === "prompt" && model.id === "fallback" && !fallbackSuccessEnabled()) send({ ...response, success: false, error: "SECRET fallback failure at /private/provider.mjs:44" });
|
|
105
|
+
else if (command.type === "prompt" && model.id === "fallback") { send({ ...response, data: {} }); setTimeout(writeCommitArtifacts, 450); settle({ wait: 600 }); }
|
|
76
106
|
else send({ ...response, data: {} });
|
|
77
107
|
});
|
|
78
108
|
`, "utf8");
|
|
@@ -103,6 +133,8 @@ createInterface({ input: process.stdin }).on("line", (line) => {
|
|
|
103
133
|
PI_CODING_AGENT_DIR: join(tempRoot, "agent"),
|
|
104
134
|
PI_WEBUI_SETTINGS_FILE: settingsFile,
|
|
105
135
|
GUIDED_GIT_BROWSER_LOG: logFile,
|
|
136
|
+
GUIDED_GIT_BROWSER_FALLBACK_SUCCESS: join(tempRoot, "fallback-success"),
|
|
137
|
+
GUIDED_GIT_BROWSER_ARTIFACT_ROOT: tempRoot,
|
|
106
138
|
},
|
|
107
139
|
});
|
|
108
140
|
child.stdout.on("data", (chunk) => { output += String(chunk); });
|
|
@@ -151,3 +183,36 @@ test("pre-response fallback lifecycle survives correlation and remains browser-o
|
|
|
151
183
|
const entries = (await log).trim().split("\n").filter(Boolean).map((line) => JSON.parse(line));
|
|
152
184
|
assert.equal(entries.filter((entry) => entry.type === "prompt" && entry.activeModel === "fallback").length, 1, "the browser must not dispatch another fallback prompt");
|
|
153
185
|
});
|
|
186
|
+
|
|
187
|
+
test("a slow successful fallback opens the generated message preview automatically", async ({ page }) => {
|
|
188
|
+
await writeFile(join(tempRoot, "fallback-success"), "enabled\n", "utf8");
|
|
189
|
+
await page.route("**/app.js?v=*", async (route) => {
|
|
190
|
+
const response = await route.fetch();
|
|
191
|
+
const source = await response.text();
|
|
192
|
+
assert.match(source, /GIT_WORKFLOW_MESSAGE_POLL_TIMEOUT_MS = 30_000/);
|
|
193
|
+
await route.fulfill({ response, body: source.replace("GIT_WORKFLOW_MESSAGE_POLL_TIMEOUT_MS = 30_000", "GIT_WORKFLOW_MESSAGE_POLL_TIMEOUT_MS = 100") });
|
|
194
|
+
});
|
|
195
|
+
await page.route("**/api/commands?*", async (route) => {
|
|
196
|
+
await route.fulfill({
|
|
197
|
+
status: 200,
|
|
198
|
+
contentType: "application/json",
|
|
199
|
+
body: JSON.stringify({ ok: true, data: { commands: [
|
|
200
|
+
{ name: "git-staged-msg", source: "extension", description: "Generate commit messages" },
|
|
201
|
+
{ name: "git-branch-name", source: "extension", description: "Generate branch names" },
|
|
202
|
+
{ name: "pr", source: "extension", description: "Generate PR text" },
|
|
203
|
+
] } }),
|
|
204
|
+
});
|
|
205
|
+
});
|
|
206
|
+
await page.goto(baseURL);
|
|
207
|
+
await page.locator("#gitWorkflowButton").click();
|
|
208
|
+
|
|
209
|
+
const panel = page.locator("#gitWorkflowPanel");
|
|
210
|
+
await panel.getByRole("button", { name: "Run git add ." }).click();
|
|
211
|
+
await panel.getByRole("button", { name: "Generate commit message" }).click();
|
|
212
|
+
|
|
213
|
+
const outputText = page.locator("#gitWorkflowOutput");
|
|
214
|
+
await expect(outputText).toContainText("fallback short");
|
|
215
|
+
await expect(outputText).toContainText("fallback long");
|
|
216
|
+
await expect(panel.getByRole("button", { name: "Commit short (default)", exact: true })).toBeVisible();
|
|
217
|
+
await expect(outputText).not.toContainText("Preview current message files");
|
|
218
|
+
});
|
|
@@ -234,10 +234,14 @@ test("main output shows non-blocking inline feedback while transcript data loads
|
|
|
234
234
|
await expect(chat).toHaveAttribute("aria-busy", "true");
|
|
235
235
|
await expect(page.locator("#promptInput")).toBeEnabled();
|
|
236
236
|
assert.equal(await page.evaluate(() => document.querySelectorAll("dialog:modal").length), 0, "loading feedback should not open a popup");
|
|
237
|
+
const loadingChatBounds = await chat.boundingBox();
|
|
238
|
+
assert.ok(loadingChatBounds, "the transcript should have measurable bounds while loading");
|
|
237
239
|
|
|
238
240
|
releaseMessages();
|
|
239
241
|
await expect(loading).toBeHidden();
|
|
240
242
|
await expect(chat).toHaveAttribute("aria-busy", "false");
|
|
243
|
+
const settledChatBounds = await chat.boundingBox();
|
|
244
|
+
assert.deepEqual(settledChatBounds, loadingChatBounds, "showing or hiding loading feedback must not move or resize the transcript");
|
|
241
245
|
} finally {
|
|
242
246
|
releaseMessages?.();
|
|
243
247
|
await page.unroute(messagesPattern);
|
|
@@ -301,6 +305,35 @@ test("only hidden pages disconnect live events and resume from one authoritative
|
|
|
301
305
|
assert.ok(Date.now() - resumedAt < 4_000, "the bounded snapshot resume should complete without replaying the hidden stream duration");
|
|
302
306
|
});
|
|
303
307
|
|
|
308
|
+
test("the main input shows six lines before vertical scrolling", async ({ page }) => {
|
|
309
|
+
await page.setViewportSize({ width: 1280, height: 800 });
|
|
310
|
+
await page.goto(baseURL);
|
|
311
|
+
|
|
312
|
+
const promptInput = page.locator("#promptInput");
|
|
313
|
+
await promptInput.fill(Array.from({ length: 6 }, (_, index) => `line ${index + 1}`).join("\n"));
|
|
314
|
+
const sixLines = await promptInput.evaluate((node) => {
|
|
315
|
+
const style = getComputedStyle(node);
|
|
316
|
+
return {
|
|
317
|
+
clientHeight: node.clientHeight,
|
|
318
|
+
scrollHeight: node.scrollHeight,
|
|
319
|
+
renderedHeight: node.getBoundingClientRect().height,
|
|
320
|
+
lineHeight: style.lineHeight,
|
|
321
|
+
maxHeight: style.maxHeight,
|
|
322
|
+
paddingBlock: `${style.paddingTop} + ${style.paddingBottom}`,
|
|
323
|
+
};
|
|
324
|
+
});
|
|
325
|
+
assert.ok(sixLines.scrollHeight <= sixLines.clientHeight + 1, `six lines overflowed: ${JSON.stringify(sixLines)}`);
|
|
326
|
+
|
|
327
|
+
await promptInput.fill(Array.from({ length: 7 }, (_, index) => `line ${index + 1}`).join("\n"));
|
|
328
|
+
const sevenLines = await promptInput.evaluate((node) => ({
|
|
329
|
+
clientHeight: node.clientHeight,
|
|
330
|
+
scrollHeight: node.scrollHeight,
|
|
331
|
+
renderedHeight: node.getBoundingClientRect().height,
|
|
332
|
+
}));
|
|
333
|
+
assert.ok(sevenLines.scrollHeight > sevenLines.clientHeight + 1, "the seventh line should overflow the six-line input height");
|
|
334
|
+
assert.ok(Math.abs(sevenLines.renderedHeight - sixLines.renderedHeight) <= 1, "the prompt should stop growing after six lines");
|
|
335
|
+
});
|
|
336
|
+
|
|
304
337
|
test("autosizing the main input does not move settled agent output", async ({ page }) => {
|
|
305
338
|
await page.setViewportSize({ width: 1280, height: 800 });
|
|
306
339
|
await page.goto(baseURL);
|
|
@@ -55,7 +55,7 @@ assert.match(app, /statusKey === CODEX_FAST_MODE_STATUS_KEY[\s\S]*?applyCodexFas
|
|
|
55
55
|
assert.match(technical, /## Normal and compact output[\s\S]*?select \*\*Compact\*\*[\s\S]*?`compact-v1`/, "technical reference should document Compact mode with the stable identifier");
|
|
56
56
|
assert.match(development, /### Codex subscription Fast mode[\s\S]*?service_tier: "priority"[\s\S]*?1\.5× faster[\s\S]*?2× Standard credits[\s\S]*?2\.5×/, "development guide should document Fast-mode integration and cost semantics");
|
|
57
57
|
// Intent preserved: browser-asset changes must advance the coherent cache tuple.
|
|
58
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
59
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
58
|
+
assert.match(serviceWorker, /pi-webui-pwa-v139/, "PWA cache identity should be bumped for changed browser assets");
|
|
59
|
+
assert.match(html, /data-app-src="\/app\.js\?v=172"/, "browser module URL should be cache-busted for Fast-mode wiring");
|
|
60
60
|
|
|
61
61
|
console.log("codex-fast-mode-static.test.mjs passed");
|
|
@@ -25,7 +25,7 @@ assert.match(server, /operation\.type === "delete"[\s\S]*queue\.splice\(slots\[o
|
|
|
25
25
|
assert.match(server, /url\.pathname === "\/api\/queue\/mutate" && req\.method === "POST"[\s\S]*request\.source === "webui-compaction"[\s\S]*mutateCompactionFollowUpQueue[\s\S]*status = data\?\.mutated === true \? 200 : conflict \? 409 : 400/, "queue mutation HTTP handling should keep compaction mutations source-specific and map conflicts to 409");
|
|
26
26
|
|
|
27
27
|
assert.match(app, /function isRunActive\(\) \{\n\s+return !!currentState\?\.isStreaming \|\| !!currentState\?\.isCompacting/, "frontend should treat compaction as an active run for composer controls");
|
|
28
|
-
assert.match(app, /const targetWasCompacting = !!
|
|
28
|
+
assert.match(app, /const targetState = targetTabId === activeTabId \? currentState : tabStateCache\.get\(targetTabId\);[\s\S]*const targetWasCompacting = !!targetState\?\.isCompacting;[\s\S]*const targetWasBusy = targetWasStreaming \|\| targetWasCompacting[\s\S]*if \(targetWasBusy\) body\.streamingBehavior = streamingBehavior \|\| busyBehavior/, "prompt send should use the captured target tab's busy behavior while streaming or compacting");
|
|
29
29
|
assert.match(app, /case "webui_compaction_queue_update":[\s\S]*renderQueue\(event\)[\s\S]*queued compaction prompt sent; Pi is resuming/, "frontend should surface compaction queue and resume events");
|
|
30
30
|
|
|
31
31
|
console.log("compaction-static.test.mjs passed");
|
|
@@ -57,8 +57,8 @@ assert.match(app, /function initializeComposerActionOrdering\(\)[\s\S]*MutationO
|
|
|
57
57
|
assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreComposerActionOrder\(\)[\s\S]*event\.key === COMPOSER_ACTION_LAYOUT_STORAGE_KEY\) restoreComposerActionSlotLayout\(\)/, "other tabs should apply persisted composer order and sparse-layout changes");
|
|
58
58
|
assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
|
|
59
59
|
|
|
60
|
-
assert.match(html, /styles\.css\?v=
|
|
61
|
-
assert.match(html, /app\.js\?v=
|
|
62
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
60
|
+
assert.match(html, /styles\.css\?v=142/, "changed composer styles should advance the stylesheet revision");
|
|
61
|
+
assert.match(html, /app\.js\?v=172/, "changed composer behavior should advance the app revision");
|
|
62
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v139"/, "changed browser assets should advance the PWA cache identity");
|
|
63
63
|
|
|
64
64
|
console.log("composer-action-grid-reorder-static.test.mjs passed");
|
|
@@ -348,10 +348,10 @@ assert.match(
|
|
|
348
348
|
|
|
349
349
|
assert.match(
|
|
350
350
|
serviceWorker,
|
|
351
|
-
/const CACHE_NAME = "pi-webui-pwa-
|
|
351
|
+
/const CACHE_NAME = "pi-webui-pwa-v139";/,
|
|
352
352
|
"browser asset changes should advance the PWA cache identity",
|
|
353
353
|
);
|
|
354
|
-
assert.match(html, /styles\.css\?v=
|
|
355
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
354
|
+
assert.match(html, /styles\.css\?v=142/, "visibility styles should advance the stylesheet query revision");
|
|
355
|
+
assert.match(html, /data-app-src="\/app\.js\?v=172"/, "visibility behavior should advance the app query revision");
|
|
356
356
|
|
|
357
357
|
console.log("control-visibility-static.test.mjs passed");
|
|
@@ -15,8 +15,8 @@ assert.equal((html.match(/class="control-row-label"[^>]*data-tooltip=/g) || []).
|
|
|
15
15
|
assert.match(app, /function initializeControlSettingTooltips\(\)[\s\S]*#sidePanelSectionControls \.control-row-label\[data-tooltip\][\s\S]*bindStyledTooltipEvents\(label\)[\s\S]*showFooterTooltip\(label\)/, "Controls help should use the viewport-safe floating tooltip for hover and keyboard access");
|
|
16
16
|
assert.match(html, /class="control-row remote-auth-control-row" hidden[\s\S]*id="remoteAuthToggle"/, "optional PIN protection should retain its guarded visibility");
|
|
17
17
|
assert.match(app, /remoteAuthToggle\?\.closest\("\.remote-auth-control-row"\)[\s\S]*remoteAuthRow\.hidden = false/, "loading remote status should reveal the optional PIN protection setting");
|
|
18
|
-
assert.match(html, /styles\.css\?v=
|
|
19
|
-
assert.match(html, /app\.js\?v=
|
|
20
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
18
|
+
assert.match(html, /styles\.css\?v=142/, "Controls stylesheet changes should advance the cache query");
|
|
19
|
+
assert.match(html, /app\.js\?v=172/, "Controls tooltip wiring should advance the app cache query");
|
|
20
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v139"/, "Controls browser assets should advance the PWA cache identity");
|
|
21
21
|
|
|
22
22
|
console.log("controls-layout-static.test.mjs passed");
|
|
@@ -124,8 +124,8 @@ assert.match(styles, /\.event-log\[data-display-mode="compact"\] \.event\[data-e
|
|
|
124
124
|
assert.match(styles, /\.event-tree-context-menu \{[\s\S]*max-width: calc\(100vw - 1rem\)/, "the dedicated menu should remain viewport bounded");
|
|
125
125
|
|
|
126
126
|
// Cache tuple for this browser-asset change.
|
|
127
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
128
|
-
assert.match(html, /styles\.css\?v=
|
|
129
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
127
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v139";/, "the PWA cache identity should advance");
|
|
128
|
+
assert.match(html, /styles\.css\?v=142/, "compact-mode styles should advance the stylesheet revision");
|
|
129
|
+
assert.match(html, /data-app-src="\/app\.js\?v=172"/, "the app query revision should advance");
|
|
130
130
|
|
|
131
131
|
console.log("events-tree-context-menu-static.test.mjs passed");
|
|
@@ -159,7 +159,7 @@ assert.match(worker, /pi-webui-pwa-v\d+[\s\S]*?"\/fast-output-live\.mjs"/, "PWA
|
|
|
159
159
|
assert.match(html, /<label for="fastOutputModeSelect">Compact mode \(Experimental\)<\/label>/, "the sidebar should mark compact mode as experimental");
|
|
160
160
|
assert.match(html, /Lightweight browser rendering; Markdown final output; live thinking expanded; stored thinking grouped and collapsed/, "the sidebar should distinguish compact rendering from model inference");
|
|
161
161
|
// Intent preserved: the guarded PWA entry point must advance whenever app wiring changes.
|
|
162
|
-
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=
|
|
162
|
+
assert.match(html, /id="webuiBootLoader"[^>]*data-app-src="\/app\.js\?v=172"/, "the guarded PWA entry point should cache-bust browser wiring");
|
|
163
163
|
assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
|
|
164
164
|
|
|
165
165
|
const events = createFastModeOutputEvents();
|
|
@@ -166,7 +166,7 @@ assert.match(functionSource("closeTerminalTabs"), /clearFeatureDecisionStateForT
|
|
|
166
166
|
assert.match(app, /case "webui_connected":[\s\S]*clearFeatureDecisionStateForTab\(connectedTabId, \{ render: true \}\)[\s\S]*scheduleForegroundReconcile\("event stream reconnect", 0\)/, "reconnect should clear local state before authoritative replay");
|
|
167
167
|
assert.match(app, /statusKey === FEATURE_DECISION_OUTPUT_STATUS_KEY[\s\S]*handleFeatureDecisionOutputStatus[\s\S]*return;[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*return;[\s\S]*statusEntries\.set/, "both feature statuses should be intercepted before generic footer storage while preserving category handling");
|
|
168
168
|
|
|
169
|
-
assert.match(html, /\/styles\.css\?v=
|
|
170
|
-
assert.match(html, /\/app\.js\?v=
|
|
169
|
+
assert.match(html, /\/styles\.css\?v=142/, "integrated stylesheet changes should advance the cache query");
|
|
170
|
+
assert.match(html, /\/app\.js\?v=172/, "integrated app changes should advance the cache query");
|
|
171
171
|
|
|
172
172
|
console.log("feature decision-output popup static checks passed");
|
|
@@ -62,8 +62,8 @@ assert.match(css, /\.file-viewer-image img \{[\s\S]*max-width: 100%;[\s\S]*max-h
|
|
|
62
62
|
assert.match(readme, /PNG, JPEG, GIF, WebP, and AVIF/i, "the Files panel guide should list supported image formats");
|
|
63
63
|
assert.match(technical, /supported raster images[\s\S]*2 MiB/i, "the advanced reference should document image support and its size limit");
|
|
64
64
|
assert.match(development, /kind: "image"[\s\S]*base64/i, "the contributor guide should document the image response contract");
|
|
65
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
66
|
-
assert.match(html, /styles\.css\?v=
|
|
67
|
-
assert.match(html, /app\.js\?v=
|
|
65
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v139"/, "changed viewer assets should advance the PWA cache identity");
|
|
66
|
+
assert.match(html, /styles\.css\?v=142/, "changed image styles should advance the stylesheet revision");
|
|
67
|
+
assert.match(html, /app\.js\?v=172/, "changed image rendering should advance the app revision");
|
|
68
68
|
|
|
69
69
|
console.log("file viewer image static tests passed");
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
// records with an isolated transcript fixture; dynamic/scripted messages still append.
|
|
22
22
|
// - FAKE_PI_INTERCOM_LIVE=1: accept the isolated "fixture modal transport live"
|
|
23
23
|
// prompt and emit a generic Intercom tool stream with visible unrelated output.
|
|
24
|
+
// - FAKE_PI_GUIDED_GIT_ACTIVATION=1: advertise the Guided Git extension and
|
|
25
|
+
// prompt companion, then emit its exact transient set/clear activation status.
|
|
24
26
|
import { createHash, randomUUID } from "node:crypto";
|
|
25
27
|
import { createInterface } from "node:readline";
|
|
26
28
|
import { appendFileSync } from "node:fs";
|
|
@@ -94,6 +96,9 @@ const largePayloadsEnabled = process.env.FAKE_PI_LARGE_PAYLOADS === "1";
|
|
|
94
96
|
const sseFloodEnabled = process.env.FAKE_PI_SSE_FLOOD === "1";
|
|
95
97
|
const statsPromptContextEnabled = process.env.FAKE_PI_STATS_PROMPT_CONTEXT === "1";
|
|
96
98
|
const intercomLiveEnabled = process.env.FAKE_PI_INTERCOM_LIVE === "1";
|
|
99
|
+
const guidedGitActivationEnabled = process.env.FAKE_PI_GUIDED_GIT_ACTIVATION === "1";
|
|
100
|
+
const guidedGitStateMode = String(process.env.FAKE_PI_GUIDED_GIT_STATE || "").trim();
|
|
101
|
+
const guidedGitActivationDelayMs = Math.max(0, Number.parseInt(process.env.FAKE_PI_GUIDED_GIT_ACTIVATION_DELAY_MS || "0", 10) || 0);
|
|
97
102
|
const fakeTranscriptMessages = (() => {
|
|
98
103
|
const source = process.env.FAKE_PI_TRANSCRIPT_JSON;
|
|
99
104
|
if (!source) return null;
|
|
@@ -372,6 +377,25 @@ function runIntercomLiveScript() {
|
|
|
372
377
|
]);
|
|
373
378
|
}
|
|
374
379
|
|
|
380
|
+
function handleGuidedGitActivationPrompt(command, base) {
|
|
381
|
+
if (!guidedGitActivationEnabled || !/^\/git-guided-workflow(?::\d+)?$/u.test(String(command.message || "").trim())) return false;
|
|
382
|
+
respond({ ...base, data: { output: "Guided Git WebUI activation requested" } });
|
|
383
|
+
const statusKey = "git-guided-workflow:webui-start";
|
|
384
|
+
const statusText = JSON.stringify({
|
|
385
|
+
type: "firstpick.pi-extension-git-guided-workflow.start",
|
|
386
|
+
version: 1,
|
|
387
|
+
action: "start",
|
|
388
|
+
requestId: randomUUID(),
|
|
389
|
+
});
|
|
390
|
+
const emitActivation = () => {
|
|
391
|
+
emitEvent({ type: "extension_ui_request", id: randomUUID(), method: "setStatus", statusKey, statusText });
|
|
392
|
+
emitEvent({ type: "extension_ui_request", id: randomUUID(), method: "setStatus", statusKey });
|
|
393
|
+
};
|
|
394
|
+
if (guidedGitActivationDelayMs > 0) setTimeout(emitActivation, guidedGitActivationDelayMs);
|
|
395
|
+
else emitActivation();
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
|
|
375
399
|
function handleIntercomLivePrompt(command, base) {
|
|
376
400
|
if (!intercomLiveEnabled || String(command.message || "").trim() !== "fixture modal transport live") return false;
|
|
377
401
|
appendDynamicMessage({ role: "user", content: String(command.message), timestamp: Date.now() });
|
|
@@ -1535,8 +1559,8 @@ rl.on("line", (line) => {
|
|
|
1535
1559
|
data: {
|
|
1536
1560
|
model: { provider: "fake", id: "fake-model" },
|
|
1537
1561
|
thinkingLevel,
|
|
1538
|
-
isStreaming: scriptedStreaming,
|
|
1539
|
-
isCompacting:
|
|
1562
|
+
isStreaming: scriptedStreaming || guidedGitStateMode === "streaming",
|
|
1563
|
+
isCompacting: guidedGitStateMode === "compacting",
|
|
1540
1564
|
steeringMode: "one-at-a-time",
|
|
1541
1565
|
followUpMode: "one-at-a-time",
|
|
1542
1566
|
sessionFile,
|
|
@@ -1544,7 +1568,7 @@ rl.on("line", (line) => {
|
|
|
1544
1568
|
sessionName: "fake",
|
|
1545
1569
|
autoCompactionEnabled: false,
|
|
1546
1570
|
messageCount: 0,
|
|
1547
|
-
pendingMessageCount: 0,
|
|
1571
|
+
pendingMessageCount: guidedGitStateMode === "pending" ? 1 : 0,
|
|
1548
1572
|
},
|
|
1549
1573
|
});
|
|
1550
1574
|
return;
|
|
@@ -1574,6 +1598,12 @@ rl.on("line", (line) => {
|
|
|
1574
1598
|
{ name: "conversation", source: "extension", description: "Natural Conversation Mode alias" },
|
|
1575
1599
|
{ name: "fast-mode", source: "extension", description: "Toggle Codex subscription Fast mode" },
|
|
1576
1600
|
{ name: "workflow", source: "extension", description: "Run and inspect JavaScript workflows" },
|
|
1601
|
+
...(guidedGitActivationEnabled ? [
|
|
1602
|
+
{ name: "git-guided-workflow", source: "extension", description: "Start Guided Git" },
|
|
1603
|
+
{ name: "git-staged-msg", source: "prompt", description: "Generate commit messages" },
|
|
1604
|
+
{ name: "git-branch-name", source: "prompt", description: "Generate branch names" },
|
|
1605
|
+
{ name: "pr", source: "prompt", description: "Generate PR text" },
|
|
1606
|
+
] : []),
|
|
1577
1607
|
...(statsPromptContextEnabled ? [{ name: "stats-webui", source: "extension", description: "Publish fixture stats dashboard" }] : []),
|
|
1578
1608
|
],
|
|
1579
1609
|
},
|
|
@@ -1597,6 +1627,7 @@ rl.on("line", (line) => {
|
|
|
1597
1627
|
return;
|
|
1598
1628
|
}
|
|
1599
1629
|
case "prompt":
|
|
1630
|
+
if (handleGuidedGitActivationPrompt(command, base)) return;
|
|
1600
1631
|
if (handleIntercomLivePrompt(command, base)) return;
|
|
1601
1632
|
if (handleFeatureDecisionFixturePrompt(command, base)) return;
|
|
1602
1633
|
if (handleStatsPromptContextFixturePrompt(command, base)) return;
|