@firstpick/pi-package-webui 0.10.2 → 0.10.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/DEVELOPMENT.md +28 -0
- package/README.md +10 -0
- package/TECHNICAL.md +14 -0
- package/bin/pi-webui.mjs +236 -20
- package/lib/append-system-selection.mjs +311 -0
- package/lib/git-workflow-preferences.mjs +6 -0
- package/lib/trust-boundaries.mjs +37 -0
- package/package.json +1 -1
- package/public/app.js +162 -7
- package/public/index.html +5 -2
- package/public/service-worker.js +1 -1
- package/tests/append-system-http.test.mjs +622 -0
- package/tests/append-system-selection.test.mjs +259 -0
- package/tests/append-system-selector-static.test.mjs +95 -0
- package/tests/boot-failure-diagnostics.test.mjs +2 -2
- package/tests/codex-fast-mode-static.test.mjs +2 -2
- package/tests/common-options-submenus-interaction-static.test.mjs +4 -0
- package/tests/common-options-submenus-markup-static.test.mjs +2 -1
- package/tests/composer-action-grid-reorder-static.test.mjs +2 -2
- package/tests/control-visibility-static.test.mjs +2 -2
- package/tests/controls-layout-static.test.mjs +2 -2
- package/tests/events-tree-context-menu-static.test.mjs +2 -2
- package/tests/fast-mode-client-static.test.mjs +1 -1
- package/tests/feature-decision-output-popup-static.test.mjs +1 -1
- package/tests/file-viewer-image-static.test.mjs +2 -2
- package/tests/guided-git-activation-static.test.mjs +2 -2
- package/tests/guided-git-fallback-ui-static.test.mjs +2 -2
- package/tests/intercom-conversation-viewer-static.test.mjs +2 -2
- package/tests/main-output-loading-static.test.mjs +2 -2
- package/tests/middle-button-drag-scroll-static.test.mjs +2 -2
- package/tests/mobile-continuity-tablet-static.test.mjs +2 -2
- package/tests/mobile-foundation-static.test.mjs +2 -2
- package/tests/mobile-phone-experience-static.test.mjs +1 -1
- package/tests/native-parity-harness.test.mjs +7 -0
- package/tests/open-issue-wizard-static.test.mjs +1 -1
- package/tests/optional-feature-prompt-impact-static.test.mjs +2 -2
- package/tests/persistent-ui-layout-static.test.mjs +2 -2
- package/tests/prompt-input-vertical-scroll-static.test.mjs +2 -2
- package/tests/questionnaire-dialog.test.mjs +2 -2
- package/tests/session-sampling-ui-static.test.mjs +2 -2
- package/tests/side-panel-section-height-removal-static.test.mjs +2 -2
- package/tests/subagent-observability-static.test.mjs +2 -2
- package/tests/syntax-highlighting-static.test.mjs +2 -2
- package/tests/terminal-tab-prompt-tooltip-static.test.mjs +147 -0
- package/tests/terminal-tab-workspace-static.test.mjs +1 -1
- package/tests/theme-customizer-static.test.mjs +1 -1
- package/tests/windows-drive-cwd-picker-static.test.mjs +2 -2
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdir, mkdtemp, readFile, rm, symlink, writeFile } from "node:fs/promises";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import {
|
|
6
|
+
APPEND_SYSTEM_DIAGNOSTIC_KINDS,
|
|
7
|
+
APPEND_SYSTEM_DISCOVERY_LIMITS,
|
|
8
|
+
discoverAppendSystemFiles,
|
|
9
|
+
normalizeAppendSystemPromptPath,
|
|
10
|
+
normalizeAppendSystemPromptRootPath,
|
|
11
|
+
validateAppendSystemSelection,
|
|
12
|
+
validateSavedAppendSystemSelection,
|
|
13
|
+
} from "../lib/append-system-selection.mjs";
|
|
14
|
+
import {
|
|
15
|
+
normalizeWebuiSettings,
|
|
16
|
+
readWebuiSettings,
|
|
17
|
+
writeWebuiSettings,
|
|
18
|
+
} from "../lib/git-workflow-preferences.mjs";
|
|
19
|
+
|
|
20
|
+
const root = await mkdtemp(path.join(tmpdir(), "pi-webui-append-system-"));
|
|
21
|
+
const piRoot = path.join(root, ".pi");
|
|
22
|
+
const projectRoot = path.join(root, "project");
|
|
23
|
+
|
|
24
|
+
async function touch(file) {
|
|
25
|
+
await mkdir(path.dirname(file), { recursive: true });
|
|
26
|
+
await writeFile(file, `fixture:${path.basename(path.dirname(file))}\n`, "utf8");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
try {
|
|
30
|
+
await mkdir(piRoot, { recursive: true });
|
|
31
|
+
await mkdir(projectRoot, { recursive: true });
|
|
32
|
+
const piCandidate = path.join(piRoot, "APPEND_SYSTEM.md");
|
|
33
|
+
const projectCandidate = path.join(projectRoot, "APPEND_SYSTEM.md");
|
|
34
|
+
const depth10Directory = path.join(projectRoot, ...Array.from({ length: 10 }, (_, index) => `d${index + 1}`));
|
|
35
|
+
const depth10Candidate = path.join(depth10Directory, "APPEND_SYSTEM.md");
|
|
36
|
+
const depth11Candidate = path.join(depth10Directory, "d11", "APPEND_SYSTEM.md");
|
|
37
|
+
await Promise.all([
|
|
38
|
+
touch(piCandidate),
|
|
39
|
+
touch(projectCandidate),
|
|
40
|
+
touch(depth10Candidate),
|
|
41
|
+
touch(depth11Candidate),
|
|
42
|
+
touch(path.join(projectRoot, "append_system.md")),
|
|
43
|
+
touch(path.join(projectRoot, "APPEND_SYSTEM.MD")),
|
|
44
|
+
]);
|
|
45
|
+
|
|
46
|
+
const outside = path.join(root, "outside");
|
|
47
|
+
const outsideCandidate = path.join(outside, "APPEND_SYSTEM.md");
|
|
48
|
+
const differentlyNamedTarget = path.join(outside, "actual-prompt.txt");
|
|
49
|
+
await Promise.all([touch(outsideCandidate), touch(differentlyNamedTarget)]);
|
|
50
|
+
const linkedDirectory = path.join(projectRoot, "linked-directory");
|
|
51
|
+
const linkedDirectoryCandidate = path.join(linkedDirectory, "APPEND_SYSTEM.md");
|
|
52
|
+
const linkedFileCandidate = path.join(projectRoot, "linked-file", "APPEND_SYSTEM.md");
|
|
53
|
+
const brokenLink = path.join(projectRoot, "broken", "APPEND_SYSTEM.md");
|
|
54
|
+
let symlinksAvailable = true;
|
|
55
|
+
try {
|
|
56
|
+
await symlink(outside, linkedDirectory, process.platform === "win32" ? "junction" : "dir");
|
|
57
|
+
await mkdir(path.dirname(linkedFileCandidate));
|
|
58
|
+
await symlink(differentlyNamedTarget, linkedFileCandidate, "file");
|
|
59
|
+
await mkdir(path.dirname(brokenLink));
|
|
60
|
+
await symlink(path.join(root, "missing-target"), brokenLink, "file");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
symlinksAvailable = false;
|
|
63
|
+
if (!["EPERM", "EACCES", "EINVAL", "ENOTSUP", "ENOENT"].includes(error?.code)) throw error;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const discovered = await discoverAppendSystemFiles({ piRoot, cwd: projectRoot });
|
|
67
|
+
const expectedCandidates = [piCandidate, projectCandidate, depth10Candidate];
|
|
68
|
+
if (symlinksAvailable) expectedCandidates.push(linkedDirectoryCandidate, linkedFileCandidate);
|
|
69
|
+
assert.deepEqual(discovered.candidates.map((candidate) => candidate.path), expectedCandidates.sort());
|
|
70
|
+
assert.ok(discovered.candidates.every((candidate) => Object.keys(candidate).sort().join(",") === "path,rootLabel"));
|
|
71
|
+
assert.equal(discovered.candidates.some(({ path: candidatePath }) => candidatePath === depth11Candidate), false, "depth 11 must be excluded");
|
|
72
|
+
assert.equal(discovered.candidates.some(({ path: candidatePath }) => candidatePath === outsideCandidate), false, "candidate paths must retain their visible aliases");
|
|
73
|
+
assert.equal(JSON.stringify(discovered).includes("fixture:"), false, "discovery must not return file contents");
|
|
74
|
+
assert.equal(discovered.limits.maxDepth, 10);
|
|
75
|
+
assert.equal(discovered.diagnostics.length <= APPEND_SYSTEM_DISCOVERY_LIMITS.maxDiagnostics, true);
|
|
76
|
+
assert.ok(discovered.diagnostics.every(({ kind }) => APPEND_SYSTEM_DIAGNOSTIC_KINDS.includes(kind)), "diagnostic kinds must come from the bounded public catalog");
|
|
77
|
+
if (symlinksAvailable) {
|
|
78
|
+
assert.ok(discovered.diagnostics.some(({ kind, path: diagnosticPath }) => kind === "symlink-inaccessible" && diagnosticPath === brokenLink));
|
|
79
|
+
assert.equal(discovered.candidates.some(({ path: candidatePath }) => candidatePath === brokenLink), false, "broken links must be omitted");
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const overlapping = await discoverAppendSystemFiles({ piRoot: root, cwd: projectRoot });
|
|
83
|
+
assert.equal(overlapping.candidates.filter(({ path: candidatePath }) => candidatePath === projectCandidate).length, 1, "overlapping roots must deduplicate candidates");
|
|
84
|
+
assert.deepEqual(overlapping.candidates.map(({ path: candidatePath }) => candidatePath), [...new Set(overlapping.candidates.map(({ path: candidatePath }) => candidatePath))].sort(), "candidate output must be deterministic and sorted");
|
|
85
|
+
|
|
86
|
+
const valid = await validateAppendSystemSelection(path.join(projectRoot, "d1", "..", "APPEND_SYSTEM.md"), { piRoot, cwd: projectRoot });
|
|
87
|
+
assert.equal(valid?.path, projectCandidate, "selection validation must normalize a fresh visible candidate");
|
|
88
|
+
assert.equal(valid?.rootPath, projectRoot, "selection validation must retain its lexical discovery root as provenance");
|
|
89
|
+
const controlCharacterPaths = ["\n", "\r", "\t", "\u007f", "\0"].map((control) => `${projectRoot}${path.sep}unsafe${control}${path.sep}APPEND_SYSTEM.md`);
|
|
90
|
+
for (const unsafePath of controlCharacterPaths) {
|
|
91
|
+
assert.equal(normalizeAppendSystemPromptPath(unsafePath), null, "prompt path normalization must reject every tested control character");
|
|
92
|
+
assert.equal(normalizeAppendSystemPromptRootPath(path.dirname(unsafePath)), null, "root path normalization must reject every tested control character");
|
|
93
|
+
assert.equal(await validateAppendSystemSelection(unsafePath, { piRoot, cwd: projectRoot }), null, "fresh selection validation must reject control characters before filesystem lookup");
|
|
94
|
+
assert.equal(await validateSavedAppendSystemSelection(unsafePath, projectRoot), null, "saved selection validation must reject control characters before filesystem lookup");
|
|
95
|
+
}
|
|
96
|
+
if (process.platform !== "win32") {
|
|
97
|
+
const discoverableControlPaths = controlCharacterPaths.filter((candidatePath) => !candidatePath.includes("\0"));
|
|
98
|
+
await Promise.all(discoverableControlPaths.map(touch));
|
|
99
|
+
const controlDiscovery = await discoverAppendSystemFiles({ piRoot, cwd: projectRoot });
|
|
100
|
+
assert.equal(controlDiscovery.candidates.some(({ path: candidatePath }) => /[\u0000-\u001f\u007f]/.test(candidatePath)), false, "control-character candidates must be omitted from discovery");
|
|
101
|
+
}
|
|
102
|
+
assert.equal(await validateAppendSystemSelection(outsideCandidate, { piRoot, cwd: projectRoot }), null, "arbitrary regular files outside the approved roots must be rejected");
|
|
103
|
+
assert.equal(await validateAppendSystemSelection(depth11Candidate, { piRoot, cwd: projectRoot }), null, "depth 11 files must be rejected");
|
|
104
|
+
assert.deepEqual(await validateSavedAppendSystemSelection(projectCandidate, projectRoot), { path: projectCandidate, rootPath: projectRoot });
|
|
105
|
+
assert.equal(await validateSavedAppendSystemSelection(outsideCandidate, projectRoot), null, "saved paths lexically outside their root must be rejected");
|
|
106
|
+
assert.equal(await validateSavedAppendSystemSelection(depth11Candidate, projectRoot), null, "saved paths beyond depth 10 must be rejected");
|
|
107
|
+
assert.equal(await validateSavedAppendSystemSelection(path.join(projectRoot, "append_system.md"), projectRoot), null, "saved paths must retain the exact APPEND_SYSTEM.md basename");
|
|
108
|
+
assert.equal(await validateSavedAppendSystemSelection(projectCandidate, projectCandidate), null, "saved roots must resolve to directories");
|
|
109
|
+
if (symlinksAvailable) {
|
|
110
|
+
assert.deepEqual(
|
|
111
|
+
await validateSavedAppendSystemSelection(linkedFileCandidate, projectRoot),
|
|
112
|
+
{ path: linkedFileCandidate, rootPath: projectRoot },
|
|
113
|
+
"saved exact-name file aliases may resolve to differently named external regular files",
|
|
114
|
+
);
|
|
115
|
+
assert.deepEqual(
|
|
116
|
+
await validateSavedAppendSystemSelection(linkedDirectoryCandidate, projectRoot),
|
|
117
|
+
{ path: linkedDirectoryCandidate, rootPath: projectRoot },
|
|
118
|
+
"saved directory aliases may resolve outside their lexical root",
|
|
119
|
+
);
|
|
120
|
+
assert.equal((await validateAppendSystemSelection(linkedFileCandidate, { piRoot, cwd: projectRoot }))?.path, linkedFileCandidate, "fresh validation must preserve the visible file alias");
|
|
121
|
+
assert.equal(await validateSavedAppendSystemSelection(brokenLink, projectRoot), null, "broken saved aliases must be rejected");
|
|
122
|
+
const nonRegularAlias = path.join(projectRoot, "non-regular", "APPEND_SYSTEM.md");
|
|
123
|
+
await mkdir(path.dirname(nonRegularAlias));
|
|
124
|
+
await symlink(outside, nonRegularAlias, process.platform === "win32" ? "junction" : "dir");
|
|
125
|
+
assert.equal(await validateSavedAppendSystemSelection(nonRegularAlias, projectRoot), null, "saved aliases resolving to non-regular targets must be rejected");
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
const stalePath = path.join(projectRoot, "deleted", "APPEND_SYSTEM.md");
|
|
129
|
+
const stale = await discoverAppendSystemFiles({ piRoot, cwd: projectRoot, savedPath: stalePath });
|
|
130
|
+
assert.equal(stale.appendSystemPromptPath, stalePath, "a normalized stale selection remains visible");
|
|
131
|
+
assert.ok(stale.diagnostics.some(({ kind, path: diagnosticPath }) => kind === "saved-selection-invalid" && diagnosticPath === stalePath));
|
|
132
|
+
|
|
133
|
+
const cappedRoot = path.join(root, "capped");
|
|
134
|
+
await mkdir(cappedRoot, { recursive: true });
|
|
135
|
+
await Promise.all(Array.from({ length: APPEND_SYSTEM_DISCOVERY_LIMITS.maxCandidates + 1 }, (_, index) => touch(path.join(cappedRoot, `candidate-${String(index).padStart(3, "0")}`, "APPEND_SYSTEM.md"))));
|
|
136
|
+
const cappedCandidates = await discoverAppendSystemFiles({ piRoot: cappedRoot, cwd: cappedRoot });
|
|
137
|
+
assert.equal(cappedCandidates.candidates.length, APPEND_SYSTEM_DISCOVERY_LIMITS.maxCandidates);
|
|
138
|
+
assert.equal(cappedCandidates.limits.truncated.candidates, true);
|
|
139
|
+
assert.ok(cappedCandidates.diagnostics.some(({ kind }) => kind === "candidate-limit"));
|
|
140
|
+
const candidateCrowdedOutPath = path.join(cappedRoot, `candidate-${APPEND_SYSTEM_DISCOVERY_LIMITS.maxCandidates}`, "APPEND_SYSTEM.md");
|
|
141
|
+
assert.equal(cappedCandidates.candidates.some(({ path: candidatePath }) => candidatePath === candidateCrowdedOutPath), false);
|
|
142
|
+
const excludedCandidatePath = path.join(cappedRoot, "candidate-000", "APPEND_SYSTEM.md");
|
|
143
|
+
const cappedWithExclusion = await discoverAppendSystemFiles({
|
|
144
|
+
piRoot: cappedRoot,
|
|
145
|
+
cwd: cappedRoot,
|
|
146
|
+
excludedPaths: [excludedCandidatePath],
|
|
147
|
+
});
|
|
148
|
+
assert.equal(cappedWithExclusion.candidates.length, APPEND_SYSTEM_DISCOVERY_LIMITS.maxCandidates, "an excluded candidate must not consume a candidate slot");
|
|
149
|
+
assert.equal(cappedWithExclusion.candidates.some(({ path: candidatePath }) => candidatePath === excludedCandidatePath), false);
|
|
150
|
+
assert.equal(cappedWithExclusion.candidates.some(({ path: candidatePath }) => candidatePath === candidateCrowdedOutPath), true, "the next eligible candidate must fill the excluded slot");
|
|
151
|
+
assert.equal(cappedWithExclusion.limits.truncated.candidates, false, "exactly 256 eligible candidates must not report truncation");
|
|
152
|
+
assert.deepEqual(
|
|
153
|
+
await validateSavedAppendSystemSelection(candidateCrowdedOutPath, cappedRoot),
|
|
154
|
+
{ path: candidateCrowdedOutPath, rootPath: cappedRoot },
|
|
155
|
+
"saved validation must not depend on the candidate discovery cap",
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const directoryCapRoot = path.join(root, "directory-cap");
|
|
159
|
+
await mkdir(directoryCapRoot, { recursive: true });
|
|
160
|
+
await Promise.all(Array.from({ length: APPEND_SYSTEM_DISCOVERY_LIMITS.maxVisitedDirectories + 8 }, (_, index) => mkdir(path.join(directoryCapRoot, `directory-${String(index).padStart(4, "0")}`))));
|
|
161
|
+
const directoryCrowdedOutPath = path.join(directoryCapRoot, "zz-saved", "APPEND_SYSTEM.md");
|
|
162
|
+
await touch(directoryCrowdedOutPath);
|
|
163
|
+
const fairProjectRoot = path.join(root, "fair-project");
|
|
164
|
+
const fairProjectCandidate = path.join(fairProjectRoot, "APPEND_SYSTEM.md");
|
|
165
|
+
await touch(fairProjectCandidate);
|
|
166
|
+
const cappedDirectories = await discoverAppendSystemFiles({ piRoot: directoryCapRoot, cwd: fairProjectRoot });
|
|
167
|
+
assert.equal(cappedDirectories.limits.visitedDirectories, APPEND_SYSTEM_DISCOVERY_LIMITS.maxVisitedDirectories);
|
|
168
|
+
assert.equal(cappedDirectories.limits.truncated.directories, true);
|
|
169
|
+
assert.ok(cappedDirectories.diagnostics.some(({ kind }) => kind === "directory-limit"));
|
|
170
|
+
assert.ok(cappedDirectories.candidates.some(({ path: candidatePath }) => candidatePath === fairProjectCandidate), "the shared directory budget must not let the first root starve the active cwd root");
|
|
171
|
+
assert.equal(cappedDirectories.candidates.some(({ path: candidatePath }) => candidatePath === directoryCrowdedOutPath), false);
|
|
172
|
+
assert.deepEqual(
|
|
173
|
+
await validateSavedAppendSystemSelection(directoryCrowdedOutPath, directoryCapRoot),
|
|
174
|
+
{ path: directoryCrowdedOutPath, rootPath: directoryCapRoot },
|
|
175
|
+
"saved validation must not depend on the visited-directory cap",
|
|
176
|
+
);
|
|
177
|
+
|
|
178
|
+
if (symlinksAvailable) {
|
|
179
|
+
const symlinkRootTarget = path.join(root, "symlink-root-target");
|
|
180
|
+
const symlinkRootAlias = path.join(root, "symlink-root-alias");
|
|
181
|
+
const symlinkRootCandidate = path.join(symlinkRootAlias, "APPEND_SYSTEM.md");
|
|
182
|
+
await touch(path.join(symlinkRootTarget, "APPEND_SYSTEM.md"));
|
|
183
|
+
await symlink(symlinkRootTarget, symlinkRootAlias, process.platform === "win32" ? "junction" : "dir");
|
|
184
|
+
const symlinkRootDiscovery = await discoverAppendSystemFiles({ piRoot: symlinkRootAlias });
|
|
185
|
+
assert.deepEqual(symlinkRootDiscovery.roots, [{ path: symlinkRootAlias, label: "Pi home" }]);
|
|
186
|
+
assert.deepEqual(symlinkRootDiscovery.candidates.map(({ path: candidatePath }) => candidatePath), [symlinkRootCandidate]);
|
|
187
|
+
assert.deepEqual(
|
|
188
|
+
await validateSavedAppendSystemSelection(symlinkRootCandidate, symlinkRootAlias),
|
|
189
|
+
{ path: symlinkRootCandidate, rootPath: symlinkRootAlias },
|
|
190
|
+
"a saved alias under a symlinked root must remain valid",
|
|
191
|
+
);
|
|
192
|
+
|
|
193
|
+
const duplicateRoot = path.join(root, "canonical-duplicate");
|
|
194
|
+
const duplicateTarget = path.join(root, "canonical-duplicate-target");
|
|
195
|
+
await touch(path.join(duplicateTarget, "APPEND_SYSTEM.md"));
|
|
196
|
+
await mkdir(duplicateRoot);
|
|
197
|
+
await symlink(duplicateTarget, path.join(duplicateRoot, "a-link"), process.platform === "win32" ? "junction" : "dir");
|
|
198
|
+
await symlink(duplicateTarget, path.join(duplicateRoot, "b-link"), process.platform === "win32" ? "junction" : "dir");
|
|
199
|
+
await symlink(duplicateRoot, path.join(duplicateTarget, "cycle"), process.platform === "win32" ? "junction" : "dir");
|
|
200
|
+
const duplicateDiscovery = await discoverAppendSystemFiles({ piRoot: duplicateRoot });
|
|
201
|
+
assert.deepEqual(
|
|
202
|
+
duplicateDiscovery.candidates.map(({ path: candidatePath }) => candidatePath),
|
|
203
|
+
[path.join(duplicateRoot, "a-link", "APPEND_SYSTEM.md")],
|
|
204
|
+
"the first deterministic alias to a canonical directory must provide its visible candidate path",
|
|
205
|
+
);
|
|
206
|
+
assert.equal(duplicateDiscovery.limits.visitedDirectories, 2, "canonical duplicate aliases and cycles must not consume repeated scan turns");
|
|
207
|
+
assert.equal(duplicateDiscovery.limits.truncated.directories, false, "a cycle must terminate without reaching the directory cap");
|
|
208
|
+
|
|
209
|
+
const aliasDepthRoot = path.join(root, "alias-depth-root");
|
|
210
|
+
const aliasDepthTarget = path.join(root, "alias-depth-target");
|
|
211
|
+
const depth9Directory = path.join(aliasDepthTarget, ...Array.from({ length: 9 }, (_, index) => `a${index + 1}`));
|
|
212
|
+
const aliasDepth10Candidate = path.join(aliasDepthRoot, "linked", ...Array.from({ length: 9 }, (_, index) => `a${index + 1}`), "APPEND_SYSTEM.md");
|
|
213
|
+
const aliasDepth11Candidate = path.join(path.dirname(aliasDepth10Candidate), "a10", "APPEND_SYSTEM.md");
|
|
214
|
+
await Promise.all([touch(path.join(depth9Directory, "APPEND_SYSTEM.md")), touch(path.join(depth9Directory, "a10", "APPEND_SYSTEM.md"))]);
|
|
215
|
+
await mkdir(aliasDepthRoot);
|
|
216
|
+
await symlink(aliasDepthTarget, path.join(aliasDepthRoot, "linked"), process.platform === "win32" ? "junction" : "dir");
|
|
217
|
+
const aliasDepthDiscovery = await discoverAppendSystemFiles({ piRoot: aliasDepthRoot });
|
|
218
|
+
assert.ok(aliasDepthDiscovery.candidates.some(({ path: candidatePath }) => candidatePath === aliasDepth10Candidate), "a directory alias must count as one edge and include depth 10");
|
|
219
|
+
assert.equal(aliasDepthDiscovery.candidates.some(({ path: candidatePath }) => candidatePath === aliasDepth11Candidate), false, "depth 11 through a directory alias must be excluded");
|
|
220
|
+
assert.equal(await validateSavedAppendSystemSelection(aliasDepth11Candidate, aliasDepthRoot), null, "saved alias depth must be measured lexically");
|
|
221
|
+
|
|
222
|
+
const diagnosticCapRoot = path.join(root, "diagnostic-cap");
|
|
223
|
+
await mkdir(diagnosticCapRoot, { recursive: true });
|
|
224
|
+
await Promise.all(Array.from({ length: APPEND_SYSTEM_DISCOVERY_LIMITS.maxDiagnostics + 8 }, (_, index) => symlink(path.join(root, `missing-${index}`), path.join(diagnosticCapRoot, `link-${String(index).padStart(3, "0")}`), "file")));
|
|
225
|
+
const cappedDiagnostics = await discoverAppendSystemFiles({ piRoot: diagnosticCapRoot, cwd: diagnosticCapRoot });
|
|
226
|
+
assert.equal(cappedDiagnostics.diagnostics.length, APPEND_SYSTEM_DISCOVERY_LIMITS.maxDiagnostics);
|
|
227
|
+
assert.equal(cappedDiagnostics.limits.truncated.diagnostics, true);
|
|
228
|
+
assert.equal(cappedDiagnostics.diagnostics.at(-1)?.kind, "diagnostic-limit");
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
assert.equal(normalizeAppendSystemPromptPath(undefined), null);
|
|
232
|
+
assert.equal(normalizeAppendSystemPromptPath("relative/APPEND_SYSTEM.md"), null);
|
|
233
|
+
assert.equal(normalizeAppendSystemPromptPath(` ${projectCandidate} `), projectCandidate);
|
|
234
|
+
assert.equal(normalizeAppendSystemPromptRootPath("relative/project"), null);
|
|
235
|
+
assert.equal(normalizeAppendSystemPromptRootPath(` ${projectRoot} `), projectRoot);
|
|
236
|
+
assert.equal(normalizeWebuiSettings({ appendSystemPromptPath: 42, appendSystemPromptRootPath: 42 }).appendSystemPromptPath, null);
|
|
237
|
+
assert.equal(normalizeWebuiSettings({ appendSystemPromptPath: 42, appendSystemPromptRootPath: 42 }).appendSystemPromptRootPath, null);
|
|
238
|
+
assert.equal(normalizeWebuiSettings({ appendSystemPromptPath: stalePath, appendSystemPromptRootPath: projectRoot }).appendSystemPromptPath, stalePath);
|
|
239
|
+
assert.equal(normalizeWebuiSettings({ appendSystemPromptPath: stalePath, appendSystemPromptRootPath: projectRoot }).appendSystemPromptRootPath, projectRoot);
|
|
240
|
+
|
|
241
|
+
const settingsFile = path.join(root, "settings.json");
|
|
242
|
+
await writeFile(settingsFile, `${JSON.stringify({ version: 8, remoteAuthEnabled: true, futureField: { retained: true } })}\n`, "utf8");
|
|
243
|
+
await writeWebuiSettings({ appendSystemPromptPath: projectCandidate, appendSystemPromptRootPath: projectRoot }, settingsFile);
|
|
244
|
+
let persisted = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
245
|
+
assert.equal(persisted.appendSystemPromptPath, projectCandidate);
|
|
246
|
+
assert.equal(persisted.appendSystemPromptRootPath, projectRoot);
|
|
247
|
+
assert.equal(persisted.remoteAuthEnabled, true);
|
|
248
|
+
assert.deepEqual(persisted.futureField, { retained: true }, "existing settings fields must survive selection updates");
|
|
249
|
+
await writeWebuiSettings({ appendSystemPromptPath: null, appendSystemPromptRootPath: null }, settingsFile);
|
|
250
|
+
persisted = JSON.parse(await readFile(settingsFile, "utf8"));
|
|
251
|
+
assert.equal(persisted.appendSystemPromptPath, null, "clear must restore nullable default discovery state");
|
|
252
|
+
assert.equal(persisted.appendSystemPromptRootPath, null);
|
|
253
|
+
assert.deepEqual(persisted.futureField, { retained: true });
|
|
254
|
+
assert.equal((await readWebuiSettings(settingsFile)).appendSystemPromptPath, null);
|
|
255
|
+
|
|
256
|
+
console.log("append-system-selection.test.mjs passed");
|
|
257
|
+
} finally {
|
|
258
|
+
await rm(root, { recursive: true, force: true });
|
|
259
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
7
|
+
const app = await readFile(join(root, "public", "app.js"), "utf8");
|
|
8
|
+
|
|
9
|
+
function selectorBody() {
|
|
10
|
+
const start = app.indexOf("async function openNativeAppendSystemSelector()");
|
|
11
|
+
assert.ok(start > 0, "openNativeAppendSystemSelector should exist in public/app.js");
|
|
12
|
+
const end = app.indexOf("async function confirmAppendSystemRestart", start);
|
|
13
|
+
assert.ok(end > start, "confirmAppendSystemRestart should follow the selector");
|
|
14
|
+
return app.slice(start, end);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const selector = selectorBody();
|
|
18
|
+
|
|
19
|
+
assert.match(
|
|
20
|
+
selector,
|
|
21
|
+
/renderNativeSelectorItems\(items, \{[\s\S]*?emptyText: "No APPEND_SYSTEM\.md files match this filter\.",[\s\S]*?activeId:[\s\S]*?onSelect: async \(item\) => \{/,
|
|
22
|
+
"the append-system selector must reuse renderNativeSelectorItems with an active id and onSelect",
|
|
23
|
+
);
|
|
24
|
+
assert.match(
|
|
25
|
+
selector,
|
|
26
|
+
/elements\.nativeCommandSearch\.oninput = render;\s*\n\s*render\(\);/,
|
|
27
|
+
"the append-system selector should filter through the shared search input",
|
|
28
|
+
);
|
|
29
|
+
assert.match(selector, /const dialogGeneration = openNativeCommandDialog\(\{[\s\S]*?title: "\/append-system"/, "the selector should use and own the shared native command dialog");
|
|
30
|
+
assert.match(selector, /const ownsNativeCommandDialog = \(\) => dialogGeneration === nativeCommandDialogGeneration && elements\.nativeCommandDialog\.open;/, "the selector should detect when a newer dialog or close event supersedes its async work");
|
|
31
|
+
assert.match(selector, /let saveInFlight = false;/, "the selector should track one in-flight settings mutation");
|
|
32
|
+
assert.match(selector, /searchPlaceholder: "Filter APPEND_SYSTEM\.md files…"/, "the selector should expose the shared filter box");
|
|
33
|
+
assert.match(selector, /renderNativeLoading\("Scanning APPEND_SYSTEM\.md candidates…"\)/, "the selector should show a busy state while scanning");
|
|
34
|
+
assert.match(selector, /const tabId = nativeCommandTabId \|\| activeTabId;/, "the selector should target the dialog's Pi tab");
|
|
35
|
+
|
|
36
|
+
assert.match(
|
|
37
|
+
selector,
|
|
38
|
+
/nativeCommandApi\("\/api\/append-system-files"\);\s*\n\s*if \(!ownsNativeCommandDialog\(\)\) return;/,
|
|
39
|
+
"the selector should load scoped candidates and ignore a response after its dialog is superseded",
|
|
40
|
+
);
|
|
41
|
+
assert.match(
|
|
42
|
+
selector,
|
|
43
|
+
/nativeCommandApi\("\/api\/append-system-selection", \{\s*\n\s*method: "POST",\s*\n\s*body: \{ tabId, path: item\.appendSystemPath \?\? null \},\s*\n\s*\}\)/,
|
|
44
|
+
"the selector should save through POST /api/append-system-selection with { tabId, path }",
|
|
45
|
+
);
|
|
46
|
+
assert.match(selector, /if \(!ownsNativeCommandDialog\(\) \|\| saveInFlight\) return;\s*\n\s*saveInFlight = true;/, "rapid pointer or Enter activation must not start a second save");
|
|
47
|
+
assert.match(selector, /elements\.nativeCommandSearch\.disabled = true;\s*\n\s*for \(const button of nativeSelectorItemButtons\(\)\) button\.disabled = true;/, "saving should disable filtering and every enabled selector item");
|
|
48
|
+
assert.match(selector, /body: \{ tabId, path: item\.appendSystemPath \?\? null \},[\s\S]*?if \(!ownsNativeCommandDialog\(\)\) return;[\s\S]*?const result = response\.data \|\| \{\};/, "a completed save must not update or restart after another native dialog supersedes it");
|
|
49
|
+
assert.match(selector, /catch \(error\) \{\s*\n\s*if \(!ownsNativeCommandDialog\(\)\) return;/, "a stale scan failure must not overwrite a newer native dialog");
|
|
50
|
+
assert.match(selector, /saveInFlight = false;\s*\n\s*elements\.nativeCommandSearch\.disabled = false;\s*\n\s*render\(\);\s*\n\s*setNativeCommandError/, "an owned save failure should restore selector interaction before showing the error");
|
|
51
|
+
assert.match(app, /elements\.nativeCommandSearch\.disabled = false;\s*\n\s*elements\.nativeCommandSearch\.oninput = null;/, "opening a newer native dialog should always restore its search control");
|
|
52
|
+
assert.match(selector, /const savedPath = typeof data\.appendSystemPromptPath === "string"/, "the selector should read the saved override from appendSystemPromptPath");
|
|
53
|
+
assert.match(selector, /const candidates = Array\.isArray\(data\.candidates\) \? data\.candidates : \[\];/, "the selector should read the bounded candidates list");
|
|
54
|
+
assert.match(selector, /const diagnostics = Array\.isArray\(data\.diagnostics\) \? data\.diagnostics : \[\];/, "the selector should read bounded scan diagnostics");
|
|
55
|
+
assert.match(selector, /const savedIsInvalid = !!savedPath && diagnostics\.some\([\s\S]*?saved-selection-invalid[\s\S]*?diagnostic\?\.path === savedPath\);/, "provenance-invalid saved paths must not be treated as effective candidates");
|
|
56
|
+
assert.match(selector, /savedIsCandidate && candidate\.path === savedPath \? "current" : ""/, "only a provenance-valid saved candidate may be marked as current");
|
|
57
|
+
assert.match(selector, /badge: savedIsCandidate \? "" : "current"/, "Pi default discovery is current when no valid override is saved");
|
|
58
|
+
|
|
59
|
+
assert.match(selector, /label: "Use Pi default discovery"/, "the rollback choice must be present");
|
|
60
|
+
assert.equal((selector.match(/label: "Use Pi default discovery"/g) || []).length, 1, "the rollback/default row must be rendered exactly once");
|
|
61
|
+
assert.match(selector, /label: candidate\.path,/, "each candidate must show its complete visible alias path");
|
|
62
|
+
assert.match(selector, /description: `Visible path[\s\S]*?linked targets may be outside that root\.`/, "candidate wording must preserve visible aliases and warn about out-of-root link targets");
|
|
63
|
+
assert.doesNotMatch(selector, /Complete canonical path/, "followed aliases must not be mislabeled as canonical paths");
|
|
64
|
+
assert.match(selector, /badge: "invalid",\s*\n\s*badgeClass: "disabled",\s*\n\s*disabled: true/, "an invalid saved path must stay visible, use warning styling, and not be selectable");
|
|
65
|
+
assert.match(app, /badgeState === "disabled" \|\| String\(item\.badgeClass \|\| ""\)\.includes\("disabled"\)[\s\S]*?badge\.style\.color = "#ff9f43"/, "disabled badge classes must receive warning styling");
|
|
66
|
+
assert.match(selector, /saved choice is no longer a valid APPEND_SYSTEM\.md candidate/i, "an invalid saved path must explain the fallback");
|
|
67
|
+
|
|
68
|
+
assert.match(selector, /diagnostics\.slice\(0, 20\)/, "diagnostics must stay bounded in the UI");
|
|
69
|
+
assert.match(selector, /\[diagnostic\?\.kind, diagnostic\?\.path, diagnostic\?\.message\]/, "diagnostics must show kind, path, and message only");
|
|
70
|
+
assert.doesNotMatch(selector, /\/api\/file|\/api\/workspace-file|fileContents|contentText/, "the selector must never fetch prompt file contents");
|
|
71
|
+
|
|
72
|
+
assert.match(selector, /result\.changed === true && result\.restartRequired === true\) await confirmAppendSystemRestart\(tabId\);/, "restart may only be offered after a changed save with restartRequired");
|
|
73
|
+
assert.doesNotMatch(selector, /sendPrompt\("prompt", "\/reload"/, "the selector body must not reload the tab directly");
|
|
74
|
+
|
|
75
|
+
const restartBody = app.slice(app.indexOf("async function confirmAppendSystemRestart"));
|
|
76
|
+
assert.match(restartBody, /appConfirmText\([\s\S]*?confirmLabel: "Restart tab"/, "restart must be gated behind an explicit confirmation");
|
|
77
|
+
assert.match(restartBody, /if \(!confirmed\) return;/, "cancelling the confirmation must not restart the tab");
|
|
78
|
+
assert.match(restartBody, /sendPrompt\("prompt", "\/reload", \{ targetTabId: tabId, throwOnError: true \}\)/, "confirmed restart must reuse the standard active-tab reload path");
|
|
79
|
+
assert.match(restartBody, /Append-system tab restart failed:/, "reload errors must remain visible in the events log");
|
|
80
|
+
assert.match(restartBody, /Cancel keeps it for the next manual reload or new tab/, "cancellation must be described as keeping the saved choice");
|
|
81
|
+
|
|
82
|
+
assert.match(
|
|
83
|
+
app,
|
|
84
|
+
/\{ kind: "Pi", label: "\/append-system", description: "Choose the APPEND_SYSTEM\.md append prompt", keywords: "append system prompt settings global", run: \(\) => openNativeAppendSystemSelector\(\) \},/,
|
|
85
|
+
"the command palette must expose the append-system selector",
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
assert.match(selector, /one global APPEND_SYSTEM\.md append prompt for WebUI-managed Pi tabs/i, "the dialog must label the choice as a global WebUI setting");
|
|
89
|
+
assert.match(selector, /bounded scan uses the active tab folder and ~\/\.pi up to depth 10/i, "the dialog must describe the bounded scan roots and depth");
|
|
90
|
+
assert.match(selector, /follows file and folder links even outside those roots/i, "the dialog must warn that followed links can leave the visible roots");
|
|
91
|
+
assert.match(selector, /never shows file contents/i, "the dialog must promise no prompt content exposure");
|
|
92
|
+
|
|
93
|
+
assert.match(selector, /setNativeCommandError\(`Append-system scan failed: \$\{error\.message \|\| String\(error\)\}`\)/, "a rejected scan route must surface a clear dialog error");
|
|
94
|
+
|
|
95
|
+
console.log("append-system selector static tests passed");
|
|
@@ -84,7 +84,7 @@ function makeEnvironment({
|
|
|
84
84
|
removeEventListener(name) { listeners.delete(name); },
|
|
85
85
|
};
|
|
86
86
|
const document = {
|
|
87
|
-
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=
|
|
87
|
+
currentScript: new FakeElement({ dataset: { appSrc: "/app.js?v=183" } }),
|
|
88
88
|
readyState: "complete",
|
|
89
89
|
querySelector(selector) {
|
|
90
90
|
return {
|
|
@@ -232,7 +232,7 @@ for (const moduleName of startupModuleNames) {
|
|
|
232
232
|
assert.ok(serviceWorker.includes(`"/${moduleName}"`), `the PWA app shell should include every app.js startup module: ${moduleName}`);
|
|
233
233
|
}
|
|
234
234
|
assert.match(serviceWorker, /pi-webui-pwa-v\d+/, "the app-shell cache should retain a versioned identity");
|
|
235
|
-
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=
|
|
235
|
+
assert.ok(html.indexOf('id="webuiBootLoader"') < html.indexOf("/app.js?v=183"), "the inline loader should own app module startup");
|
|
236
236
|
assert.doesNotMatch(html, /<script type="module" src="\/app\.js/, "the app module should not bypass the guarded loader");
|
|
237
237
|
|
|
238
238
|
console.log("boot-failure-diagnostics.test.mjs passed");
|
|
@@ -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-v154/, "PWA cache identity should be bumped for changed browser assets");
|
|
59
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "browser module URL should be cache-busted for Fast-mode wiring");
|
|
60
60
|
|
|
61
61
|
console.log("codex-fast-mode-static.test.mjs passed");
|
|
@@ -166,6 +166,10 @@ for (const [id, handler] of [
|
|
|
166
166
|
assert.equal(occurrences(` ${id}: \\$\\("#${id}"\\),`), 1, `${id} should keep exactly one element reference`);
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
assert.match(app, /elements\.optionsAppendSystemButton\?\.addEventListener\("click", \(\) => \{\s*setOptionsMenuOpen\(false\);\s*void openNativeAppendSystemSelector\(\);\s*\}\);/, "Append-system Prompt should close Common Pi options and open the existing browser picker directly");
|
|
170
|
+
assert.equal(app.match(/elements\.optionsAppendSystemButton\?\.addEventListener\("click"/g)?.length ?? 0, 1, "Append-system Prompt should be bound exactly once");
|
|
171
|
+
assert.equal(app.match(/ optionsAppendSystemButton: \$\("#optionsAppendSystemButton"\),/g)?.length ?? 0, 1, "Append-system Prompt should have exactly one element reference");
|
|
172
|
+
|
|
169
173
|
assert.equal(occurrences('elements\\.optionsMenu\\.addEventListener\\("click"'), 1, "the submenu delegate should be bound exactly once");
|
|
170
174
|
assert.equal(occurrences('elements\\.optionsMenu\\.addEventListener\\("keydown"'), 1, "the submenu key handler should be bound exactly once");
|
|
171
175
|
assert.equal(occurrences("function initializeOptionsSubmenus\\(\\)"), 1, "the initializer should be defined exactly once");
|
|
@@ -19,6 +19,7 @@ const actionContract = {
|
|
|
19
19
|
optionsForkButton: { label: "Fork", command: "/fork" },
|
|
20
20
|
optionsTreeButton: { label: "Tree", command: "/tree" },
|
|
21
21
|
optionsExportButton: { label: "Export", command: "/export" },
|
|
22
|
+
optionsAppendSystemButton: { label: "Append-system Prompt" },
|
|
22
23
|
optionsSummarySetupButton: { label: "Session Summary Setup", command: "/summary-setup", hidden: true },
|
|
23
24
|
optionsGitWorkflowSetupButton: { label: "Guided Git Setup", command: "/git-workflow-setup" },
|
|
24
25
|
optionsWorkflowSetupButton: { label: "Workflow Permission Setup", command: "/workflow-setup", hidden: true },
|
|
@@ -42,7 +43,7 @@ const groups = [
|
|
|
42
43
|
label: "Feature Setup",
|
|
43
44
|
triggerId: "optionsFeatureSetupSubmenuButton",
|
|
44
45
|
panelId: "optionsFeatureSetupSubmenu",
|
|
45
|
-
actions: ["optionsSummarySetupButton", "optionsGitWorkflowSetupButton"],
|
|
46
|
+
actions: ["optionsAppendSystemButton", "optionsSummarySetupButton", "optionsGitWorkflowSetupButton"],
|
|
46
47
|
},
|
|
47
48
|
{
|
|
48
49
|
key: "safety-permissions",
|
|
@@ -58,7 +58,7 @@ assert.match(app, /event\.key === COMPOSER_ACTION_ORDER_STORAGE_KEY\) restoreCom
|
|
|
58
58
|
assert.match(app, /initializeComposerActionOrdering\(\);[\s\S]*restoreSidePanelSectionOrder\(\);/, "composer ordering should initialize during guarded app startup");
|
|
59
59
|
|
|
60
60
|
assert.match(html, /styles\.css\?v=152/, "changed composer styles should advance the stylesheet revision");
|
|
61
|
-
assert.match(html, /app\.js\?v=
|
|
62
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
61
|
+
assert.match(html, /app\.js\?v=183/, "changed composer behavior should advance the app revision");
|
|
62
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "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-v154";/,
|
|
352
352
|
"browser asset changes should advance the PWA cache identity",
|
|
353
353
|
);
|
|
354
354
|
assert.match(html, /styles\.css\?v=152/, "visibility styles should advance the stylesheet query revision");
|
|
355
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
355
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "visibility behavior should advance the app query revision");
|
|
356
356
|
|
|
357
357
|
console.log("control-visibility-static.test.mjs passed");
|
|
@@ -16,7 +16,7 @@ assert.match(app, /function initializeControlSettingTooltips\(\)[\s\S]*#sidePane
|
|
|
16
16
|
assert.match(html, /class="control-row remote-auth-control-row" hidden[\s\S]*id="remoteAuthToggle"/, "optional PIN protection should retain its guarded visibility");
|
|
17
17
|
assert.match(app, /remoteAuthToggle\?\.closest\("\.remote-auth-control-row"\)[\s\S]*remoteAuthRow\.hidden = false/, "loading remote status should reveal the optional PIN protection setting");
|
|
18
18
|
assert.match(html, /styles\.css\?v=152/, "Controls stylesheet changes should advance the cache query");
|
|
19
|
-
assert.match(html, /app\.js\?v=
|
|
20
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
19
|
+
assert.match(html, /app\.js\?v=183/, "Controls tooltip wiring should advance the app cache query");
|
|
20
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "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-
|
|
127
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154";/, "the PWA cache identity should advance");
|
|
128
128
|
assert.match(html, /styles\.css\?v=152/, "compact-mode styles should advance the stylesheet revision");
|
|
129
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
129
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "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=183"/, "the guarded PWA entry point should cache-bust browser wiring");
|
|
163
163
|
assert.match(JSON.parse(packageRaw).scripts.check, /node --check public\/fast-output-live\.mjs/, "package checks should parse the compact helper");
|
|
164
164
|
|
|
165
165
|
const events = createFastModeOutputEvents();
|
|
@@ -167,6 +167,6 @@ assert.match(app, /case "webui_connected":[\s\S]*clearFeatureDecisionStateForTab
|
|
|
167
167
|
assert.match(app, /statusKey === FEATURE_DECISION_OUTPUT_STATUS_KEY[\s\S]*handleFeatureDecisionOutputStatus[\s\S]*return;[\s\S]*statusKey === FEATURE_CATEGORY_STATUS_KEY[\s\S]*return;[\s\S]*statusEntries\.set/, "both feature statuses should be intercepted before generic footer storage while preserving category handling");
|
|
168
168
|
|
|
169
169
|
assert.match(html, /\/styles\.css\?v=152/, "integrated stylesheet changes should advance the cache query");
|
|
170
|
-
assert.match(html, /\/app\.js\?v=
|
|
170
|
+
assert.match(html, /\/app\.js\?v=183/, "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-
|
|
65
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "changed viewer assets should advance the PWA cache identity");
|
|
66
66
|
assert.match(html, /styles\.css\?v=152/, "changed image styles should advance the stylesheet revision");
|
|
67
|
-
assert.match(html, /app\.js\?v=
|
|
67
|
+
assert.match(html, /app\.js\?v=183/, "changed image rendering should advance the app revision");
|
|
68
68
|
|
|
69
69
|
console.log("file viewer image static tests passed");
|
|
@@ -90,8 +90,8 @@ test("fixture, cache revisions, and layered docs expose the migration contract",
|
|
|
90
90
|
assert.match(fakePi, /FAKE_PI_GUIDED_GIT_ACTIVATION/u);
|
|
91
91
|
assert.match(fakePi, /git-guided-workflow:webui-start/u);
|
|
92
92
|
assert.match(html, /styles\.css\?v=152/u);
|
|
93
|
-
assert.match(html, /app\.js\?v=
|
|
94
|
-
assert.match(serviceWorker, /pi-webui-pwa-
|
|
93
|
+
assert.match(html, /app\.js\?v=183/u);
|
|
94
|
+
assert.match(serviceWorker, /pi-webui-pwa-v154/u);
|
|
95
95
|
assert.match(serviceWorker, /"\/guided-git-command-state\.mjs"/u);
|
|
96
96
|
assert.match(readme, /pi-extension-git-guided-workflow/u);
|
|
97
97
|
assert.match(technical, /\/git-guided-workflow/u);
|
|
@@ -54,7 +54,7 @@ assert.match(readme, /fallback model and its own reasoning effort[\s\S]*tries th
|
|
|
54
54
|
assert.match(technical, /## Guided Git generation profiles[\s\S]*strict one-retry policy[\s\S]*active model and reasoning effort remain unchanged[\s\S]*dead Pi process cannot run the fallback/i, "technical reference should document configuration and operational limits");
|
|
55
55
|
assert.match(development, /### Fallback browser\/runtime contract[\s\S]*fallbackUsed: true[\s\S]*webui_git_workflow_generation_fallback_started[\s\S]*never sends a retry/, "development guide should preserve the response/event and browser ownership contract");
|
|
56
56
|
|
|
57
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
58
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
57
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "the changed browser app should use the next query revision");
|
|
58
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154";/, "the PWA cache identity should advance with browser behavior");
|
|
59
59
|
|
|
60
60
|
console.log("guided-git-fallback-ui-static.test.mjs passed");
|
|
@@ -97,8 +97,8 @@ assert.match(css, /\.extension-dialog\.intercom-conversation-dialog \{[\s\S]*wid
|
|
|
97
97
|
assert.match(css, /@media \(max-width: 720px\)[\s\S]*\.composer-intercom-tag \{ min-height: 44px;[\s\S]*\.extension-dialog\.intercom-conversation-dialog[\s\S]*width: calc\(100vw - 0\.7rem\)/, "tags and the dialog should remain reachable on narrow and coarse-pointer layouts");
|
|
98
98
|
|
|
99
99
|
assert.match(html, /\/styles\.css\?v=152/, "the stylesheet URL should advance for the bounded conversation tags");
|
|
100
|
-
assert.match(html, /data-app-src="\/app\.js\?v=
|
|
101
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
100
|
+
assert.match(html, /data-app-src="\/app\.js\?v=183"/, "the guarded app URL should advance for current browser wiring");
|
|
101
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "the PWA cache identity should advance with browser assets");
|
|
102
102
|
|
|
103
103
|
assert.match(readme, /one compact tag per conversation appears beneath the composer/i, "the README should explain the user-visible entry point");
|
|
104
104
|
assert.match(technical, /## Agent conversation viewer[\s\S]*Attachments, tool calls and results, thinking, stdout\/stderr, filesystem paths, raw session records/i, "the advanced guide should document privacy exclusions");
|
|
@@ -59,8 +59,8 @@ assert.match(css, /body\.terminal-tabs-left \.main-output-surface \{ grid-row: 4
|
|
|
59
59
|
assert.match(css, /body\.subagent-terminal-active \.main-output-surface,[\s\S]*body\.subagent-terminal-active \.main-output-loading,/, "dedicated subagent output should hide the main transcript and its loading status");
|
|
60
60
|
|
|
61
61
|
assert.match(html, /styles\.css\?v=152/, "the stylesheet cache query should advance");
|
|
62
|
-
assert.match(html, /app\.js\?v=
|
|
63
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
62
|
+
assert.match(html, /app\.js\?v=183/, "the app cache query should advance");
|
|
63
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "the PWA cache identity should advance with browser assets");
|
|
64
64
|
assert.match(readme, /Loading conversation history/, "user documentation should describe the plain-language loading feedback");
|
|
65
65
|
assert.match(development, /main output loading/i, "developer documentation should preserve the request-ownership contract");
|
|
66
66
|
|
|
@@ -17,8 +17,8 @@ assert.match(app, /installMiddleButtonDragScroll\(\{[\s\S]*onDirection: \(\{ tar
|
|
|
17
17
|
assert.match(app, /event\?\.type === "middle-drag"\) return event\.deltaY > 0;/, "moving below the press point should be recognized as intent to read later chat output");
|
|
18
18
|
assert.match(css, /body\.middle-button-auto-scrolling,[\s\S]*cursor: all-scroll !important;[\s\S]*user-select: none !important;/, "active automatic scrolling should expose a directional-scroll affordance and suppress accidental selection");
|
|
19
19
|
assert.match(html, /styles\.css\?v=152/, "changed drag-scroll styles should advance the stylesheet revision");
|
|
20
|
-
assert.match(html, /app\.js\?v=
|
|
21
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
20
|
+
assert.match(html, /app\.js\?v=183/, "changed drag-scroll wiring should advance the app revision");
|
|
21
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154";[\s\S]*"\/middle-button-drag-scroll\.mjs"/, "offline PWA installs should refresh and cache the new controller module");
|
|
22
22
|
assert.match(JSON.parse(packageJson).scripts.check, /node --check public\/middle-button-drag-scroll\.mjs/, "the package check should parse the startup-critical controller module");
|
|
23
23
|
|
|
24
24
|
console.log("middle-button-drag-scroll-static.test.mjs passed");
|
|
@@ -47,9 +47,9 @@ assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-nav[\s\S]*?widt
|
|
|
47
47
|
assert.match(css, /html\[data-tablet-shell="v2"\] \.mobile-shell-surface[\s\S]*?width: min\(30rem, 72vw\)/, "tablet inspector must be a bounded right-side sheet");
|
|
48
48
|
assert.match(css, /html\[data-tablet-shell="v2"\] \.file-viewer-pane[\s\S]*?position: fixed[\s\S]*?inset: 0/, "tablet files must default to full-screen replacement");
|
|
49
49
|
assert.match(css, /and \(pointer: coarse\)[\s\S]*?min-height: 44px/, "coarse tablet pointers must retain the 44px target floor");
|
|
50
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
50
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "continuity/tablet assets need a coherent cache identity");
|
|
51
51
|
assert.match(html, /styles\.css\?v=152/, "tablet CSS must have a coherent HTML revision");
|
|
52
|
-
assert.match(html, /app\.js\?v=
|
|
52
|
+
assert.match(html, /app\.js\?v=183/, "continuity app logic must have a coherent HTML revision");
|
|
53
53
|
assert.match(technical, /tabletShell=v2[\s\S]*tabletShell=legacy/, "technical reference should document tablet preview and rollback");
|
|
54
54
|
|
|
55
55
|
console.log("mobile-continuity-tablet-static.test.mjs passed");
|
|
@@ -37,9 +37,9 @@ assert.match(pkg.scripts.check, /node --check public\/transcript-renderer\.mjs/,
|
|
|
37
37
|
assert.match(server, /STATIC_PUBLIC_FILE_EXTENSIONS[\s\S]*"\.mjs"/, "the server must serve typed startup modules from the public asset boundary");
|
|
38
38
|
assert.match(serviceWorker, /"\/mobile-shell-state\.mjs"/, "the PWA shell must cache the new startup module");
|
|
39
39
|
assert.match(serviceWorker, /"\/transcript-renderer\.mjs"/, "the PWA shell must cache the transcript startup module");
|
|
40
|
-
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-
|
|
40
|
+
assert.match(serviceWorker, /const CACHE_NAME = "pi-webui-pwa-v154"/, "the cache identity must change with the startup graph");
|
|
41
41
|
assert.match(html, /styles\.css\?v=152/, "the stylesheet revision must change with mobile/tablet CSS fixes");
|
|
42
|
-
assert.match(html, /app\.js\?v=
|
|
42
|
+
assert.match(html, /app\.js\?v=183/, "the app revision must change with continuity/tablet wiring");
|
|
43
43
|
assert.match(serviceWorker, /const APP_SHELL_NETWORK_TIMEOUT_MS = 8_000;[\s\S]*?event\.waitUntil\([\s\S]*?cache\.put\(request, response\.clone\(\)\)[\s\S]*?return networkResponse;/, "runtime cache writes must extend the event lifetime without blocking bounded network responses");
|
|
44
44
|
assert.match(serviceWorker, /MOBILE_NAVIGATION_MESSAGE_TYPE = "pi-webui:navigate:v1"/, "the service worker must use a versioned active-client navigation message");
|
|
45
45
|
assert.match(serviceWorker, /client\.postMessage\(\{ type: MOBILE_NAVIGATION_MESSAGE_TYPE, target \}\)/, "existing clients must receive only a validated target message");
|