@sanqianx/project-knowledge 5.0.30 → 5.0.32
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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +26 -0
- package/README.md +5 -2
- package/_site/_test/appearance-settings-test.js +148 -0
- package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +606 -0
- package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +464 -0
- package/_site/_test/helpers/parallel-dock-acceptance-env.js +301 -0
- package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +378 -0
- package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +314 -0
- package/_site/_test/helpers/parallel-dock-acceptance-ui.js +195 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +113 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +307 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +373 -0
- package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +314 -0
- package/_site/_test/helpers/parallel-engine-advanced-engine-child.js +1 -1
- package/_site/_test/helpers/parallel-engine-advanced-fault-writer.js +3 -3
- package/_site/_test/helpers/parallel-engine-advanced-harness.js +1 -1
- package/_site/_test/helpers/parallel-engine-advanced-standin-analyzer.js +1 -1
- package/_site/_test/helpers/parallel-engine-final-harness.js +2 -2
- package/_site/_test/helpers/parallel-engine-final-standin-analyzer.js +1 -1
- package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +340 -0
- package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +82 -0
- package/_site/_test/helpers/parallel-memory-analyzer.js +1 -1
- package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +605 -0
- package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +176 -0
- package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +577 -0
- package/_site/_test/helpers/parallel-memory-injection-shell.js +723 -0
- package/_site/_test/helpers/parallel-memory-injection-wb-host.js +81 -0
- package/_site/_test/helpers/parallel-nav-shell.js +1 -1
- package/_site/_test/helpers/parallel-qa-engine-endpoint-guard.js +1 -1
- package/_site/_test/helpers/parallel-retrieval-followup-r2-shell.js +1 -1
- package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +295 -0
- package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +573 -0
- package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +69 -0
- package/_site/_test/helpers/parallel-workbench-runtime-harness.js +587 -0
- package/_site/_test/helpers/qa-r45-harness.js +94 -0
- package/_site/_test/helpers/qa-r48-env.js +64 -0
- package/_site/_test/helpers/qa-r51-env.cjs +77 -0
- package/_site/_test/helpers/qa-r91-harness.cjs +4 -1
- package/_site/_test/package-boundary-test.js +5 -0
- package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +524 -0
- package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +577 -0
- package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +320 -0
- package/_site/_test/parallel-engine-advanced-eng011-ui-probe.js +1 -1
- package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +304 -0
- package/_site/_test/parallel-knowledge-engine-test.js +3 -3
- package/_site/_test/parallel-knowledge-retrieval-test.js +2 -2
- package/_site/_test/parallel-logging-acceptance-log003-probe.js +78 -0
- package/_site/_test/parallel-logging-acceptance-log004-probe.js +85 -0
- package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +238 -0
- package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +371 -0
- package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +439 -0
- package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +271 -0
- package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +519 -0
- package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +569 -0
- package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +314 -0
- package/_site/_test/parallel-memory-injection-origin-probe.js +412 -0
- package/_site/_test/parallel-memory-injection-probe.js +411 -0
- package/_site/_test/parallel-nav-isolation-test.js +1 -1
- package/_site/_test/parallel-qa-engine-endpoint-guard-test.js +1 -1
- package/_site/_test/parallel-retrieval-followup-citation-test.js +2 -2
- package/_site/_test/parallel-retrieval-followup-corpus-test.js +1 -1
- package/_site/_test/parallel-workbench-drafts-r4-probe.js +477 -0
- package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +89 -0
- package/_site/_test/parallel-workbench-drafts-r5-probe.js +593 -0
- package/_site/_test/parallel-workbench-runtime-minimax-probe.js +321 -0
- package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +307 -0
- package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +313 -0
- package/_site/_test/parallel-workbench-runtime-wb008-abort.js +321 -0
- package/_site/_test/qa-r45-offline-backfill-test.js +279 -0
- package/_site/_test/qa-r48-sys003-blank-secret-test.js +258 -0
- package/_site/_test/t07c-cln-001-002-007-coverage-test.js +135 -0
- package/_site/_test/t07d-git-rel-coverage-test.js +226 -0
- package/_site/_test/t07e-qta-coverage-test.js +195 -0
- package/_site/_test/t07f-mem-008-coverage-test.js +101 -0
- package/_site/lib/module-bridge.js +2 -11
- package/_site/lib/server-app.js +11 -2
- package/_site/lib/settings-store.js +43 -1
- package/_site/scripts/install-module-candidates.js +1 -1
- package/_site/scripts/pack-module-candidates.js +2 -1
- package/_site/scripts/verify-module-runtime.js +17 -32
- package/_site/scripts/verify-product-runtime.js +7 -3
- package/docs/README.zh-CN.md +3 -1
- package/module-runtime-manifest.json +56 -6
- package/package.json +2 -4
- package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
- package/plugins/project-knowledge/.mcp.json +1 -1
- package/ui/index.html +18 -1
- package/ui/product.css +6 -2
- package/ui/product.js +86 -1
- package/_modules/knowledge-engine/README.md +0 -133
- package/_modules/knowledge-engine/package.json +0 -38
- package/_modules/knowledge-engine/src/analysis-contract.js +0 -35
- package/_modules/knowledge-engine/src/analysis-failures.js +0 -39
- package/_modules/knowledge-engine/src/analysis-output.js +0 -52
- package/_modules/knowledge-engine/src/analysis-worker.js +0 -58
- package/_modules/knowledge-engine/src/bin.js +0 -52
- package/_modules/knowledge-engine/src/bridge-client.js +0 -24
- package/_modules/knowledge-engine/src/context.js +0 -140
- package/_modules/knowledge-engine/src/coordinator.js +0 -376
- package/_modules/knowledge-engine/src/diagnostics.js +0 -37
- package/_modules/knowledge-engine/src/headless-analyzer.js +0 -66
- package/_modules/knowledge-engine/src/index-request.js +0 -49
- package/_modules/knowledge-engine/src/knowledge-targets.js +0 -46
- package/_modules/knowledge-engine/src/memories.js +0 -281
- package/_modules/knowledge-engine/src/memory-eligibility.js +0 -74
- package/_modules/knowledge-engine/src/retrieval-policy.json +0 -14
- package/_modules/knowledge-engine/src/retrieval-ranking.js +0 -153
- package/_modules/knowledge-engine/src/retrieval.js +0 -367
- package/_modules/knowledge-engine/src/runtime/README.md +0 -7
- package/_modules/knowledge-engine/src/runtime/atomic-file.js +0 -204
- package/_modules/knowledge-engine/src/runtime/automation-config.js +0 -140
- package/_modules/knowledge-engine/src/runtime/commit-conversation-binder.js +0 -250
- package/_modules/knowledge-engine/src/runtime/commit-processing-ledger.js +0 -26
- package/_modules/knowledge-engine/src/runtime/commit-prompt.js +0 -205
- package/_modules/knowledge-engine/src/runtime/commit-reconciler.js +0 -432
- package/_modules/knowledge-engine/src/runtime/content-hash.js +0 -4
- package/_modules/knowledge-engine/src/runtime/contracts.js +0 -282
- package/_modules/knowledge-engine/src/runtime/conversation-exclusions.js +0 -204
- package/_modules/knowledge-engine/src/runtime/conversation-store.js +0 -389
- package/_modules/knowledge-engine/src/runtime/evidence-bundle.js +0 -228
- package/_modules/knowledge-engine/src/runtime/git-runner.js +0 -62
- package/_modules/knowledge-engine/src/runtime/knowledge-promotion.js +0 -559
- package/_modules/knowledge-engine/src/runtime/knowledge-retrieval-service.js +0 -408
- package/_modules/knowledge-engine/src/runtime/layout.js +0 -46
- package/_modules/knowledge-engine/src/runtime/markdown-knowledge-indexer.js +0 -276
- package/_modules/knowledge-engine/src/runtime/scanner.js +0 -298
- package/_modules/knowledge-engine/src/server.js +0 -166
- package/_modules/knowledge-engine/src/store.js +0 -267
- package/_modules/knowledge-engine/ui/app.css +0 -172
- package/_modules/knowledge-engine/ui/app.js +0 -318
- package/_modules/knowledge-engine/ui/index.html +0 -95
- package/_site/scripts/vendor-modules.js +0 -49
- package/vendor-manifest.json +0 -55
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// _site/_test/helpers/parallel-memory-capture-r3-cap-shell.js
|
|
3
|
+
//
|
|
4
|
+
// Lane harness for the external-Agent integration cases of
|
|
5
|
+
// P-MEMORY-CAPTURE-R3 (CAP-001 / CAP-006 / CAP-008).
|
|
6
|
+
//
|
|
7
|
+
// The harness runs the REAL product server and the REAL browser UI. The
|
|
8
|
+
// product's own integration manager then runs the REAL native client
|
|
9
|
+
// (Claude Code) against an ISOLATED home directory, so the "接入" action is
|
|
10
|
+
// a real installation and not a stub.
|
|
11
|
+
//
|
|
12
|
+
// Isolation:
|
|
13
|
+
//
|
|
14
|
+
// * HOME / USERPROFILE / CLAUDE_CONFIG_DIR -> a throwaway home, so the
|
|
15
|
+
// client's own configuration (settings.json hooks, codex notify wrapper,
|
|
16
|
+
// plugin marketplace) is written there and never in the developer's
|
|
17
|
+
// real home. The real home is digested before and after the run and the
|
|
18
|
+
// comparison is part of the evidence.
|
|
19
|
+
// * KB_DATA_DIR / KB_KNOWLEDGE_DATA_DIR / Bridge home -> the isolated
|
|
20
|
+
// directories the shared spawn-server helper creates.
|
|
21
|
+
// * every ambient ANTHROPIC_*/CLAUDE_*/CODEX_*/KB_*/AI_CODING_* variable
|
|
22
|
+
// of the calling shell is removed from the child environment, so the
|
|
23
|
+
// child cannot inherit a live endpoint or a live credential.
|
|
24
|
+
// * own port, own Chrome profile, own external temp root with an owner
|
|
25
|
+
// prefix.
|
|
26
|
+
|
|
27
|
+
const crypto = require('node:crypto');
|
|
28
|
+
const fs = require('node:fs');
|
|
29
|
+
const os = require('node:os');
|
|
30
|
+
const path = require('node:path');
|
|
31
|
+
|
|
32
|
+
const { spawnServer } = require('../helpers/spawn-server');
|
|
33
|
+
const { findChrome } = require('../helpers/find-chrome');
|
|
34
|
+
const { launchCdpBrowser, waitFor } = require('../helpers/cdp-browser');
|
|
35
|
+
const { attachNetworkCapture } = require('../helpers/cdp-network-capture');
|
|
36
|
+
const freePort = require('../helpers/free-port');
|
|
37
|
+
|
|
38
|
+
const ROOT = path.resolve(__dirname, '..', '..', '..');
|
|
39
|
+
const LIVE_PORTS = new Set([5757, 5760, 5789, 5790, 8787, 8790]);
|
|
40
|
+
|
|
41
|
+
// Every ambient variable that could point a child at a live surface.
|
|
42
|
+
const AMBIENT_PREFIXES = ['ANTHROPIC_', 'CLAUDE_', 'CODEX_', 'KB_', 'AI_CODING_', 'OPENCODE_'];
|
|
43
|
+
const AMBIENT_EXACT = ['AI_AGENT', 'CLAUDECODE'];
|
|
44
|
+
|
|
45
|
+
function isInside(candidate, parent) {
|
|
46
|
+
const relative = path.relative(parent, candidate);
|
|
47
|
+
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function resolveTempRoot() {
|
|
51
|
+
const sharedRoot = path.join(path.dirname(ROOT), '.project-knowledge-test-temp');
|
|
52
|
+
const chosen = [process.env.PK_TEST_TEMP_ROOT, fs.existsSync(sharedRoot) ? sharedRoot : null, process.env.TEMP, process.env.TMP, process.env.TMPDIR, os.tmpdir()]
|
|
53
|
+
.find(value => value && String(value).trim());
|
|
54
|
+
const root = path.resolve(String(chosen));
|
|
55
|
+
if (isInside(root, ROOT)) throw new Error(`refusing to use a temp root inside the repository: ${root}`);
|
|
56
|
+
return root;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function sha256File(file) {
|
|
60
|
+
try { return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex'); } catch { return null; }
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** A recursive digest of a directory tree; digests never leave this process. */
|
|
64
|
+
function digestTree(dir) {
|
|
65
|
+
const files = [];
|
|
66
|
+
const walk = current => {
|
|
67
|
+
let entries = [];
|
|
68
|
+
try { entries = fs.readdirSync(current, { withFileTypes: true }); } catch { return; }
|
|
69
|
+
for (const entry of entries) {
|
|
70
|
+
const full = path.join(current, entry.name);
|
|
71
|
+
if (entry.isDirectory()) walk(full);
|
|
72
|
+
else if (entry.isFile()) files.push(full);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
walk(dir);
|
|
76
|
+
return {
|
|
77
|
+
dir,
|
|
78
|
+
count: files.length,
|
|
79
|
+
digest: crypto.createHash('sha256').update(files.map(file => `${path.relative(dir, file)}:${sha256File(file)}`).sort().join('\n')).digest('hex'),
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* The client's CONFIGURATION surface: the files and directories an
|
|
85
|
+
* integration writes into. A native install that escaped the isolated home
|
|
86
|
+
* would show up here first.
|
|
87
|
+
*/
|
|
88
|
+
const CLIENT_CONFIG_FILES = [
|
|
89
|
+
'.claude/settings.json',
|
|
90
|
+
'.claude/settings.local.json',
|
|
91
|
+
'.claude/plugins/installed_plugins.json',
|
|
92
|
+
'.claude/plugins/known_marketplaces.json',
|
|
93
|
+
'.claude/plugins/config.json',
|
|
94
|
+
'.codex/config.toml',
|
|
95
|
+
'.zcode/cli/config.json',
|
|
96
|
+
'.config/opencode/opencode.json',
|
|
97
|
+
'.config/opencode/opencode.jsonc',
|
|
98
|
+
];
|
|
99
|
+
const CLIENT_CONFIG_DIRS = [
|
|
100
|
+
'.claude/plugins/cache',
|
|
101
|
+
'.claude/plugins/marketplaces',
|
|
102
|
+
'.config/opencode/plugin',
|
|
103
|
+
'.config/opencode/skills',
|
|
104
|
+
'.config/opencode/instructions',
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Runtime state of the developer's OWN live clients: transcripts, logs,
|
|
109
|
+
* caches and lock files. The developer runs Claude Code and Codex while the
|
|
110
|
+
* case runs, so these files change on their own — they are not evidence of
|
|
111
|
+
* anything the product did. Everything outside this list and outside the
|
|
112
|
+
* configuration surface is treated as a leak.
|
|
113
|
+
*/
|
|
114
|
+
const RUNTIME_PATH = /(?:^|\/)(?:projects|sessions|todos|tasks|teams|ide|debug|statsig|telemetry|shell-snapshots|file-history|paste-cache|session-env|backups|tmp|logs|state|sqlite|cache|ambient-suggestions|archived_sessions|automations|browser|computer-use|cap_sid|code-review-plugin|codex-remote-attachments)(?:\/|$)|(?:^|\/)(?:history\.jsonl|stats-cache\.json|install-counts-cache\.json|blocklist\.json|models_cache\.json|\.last-cleanup|.*\.sqlite(?:-shm|-wal)?|.*\.lock)$/;
|
|
115
|
+
|
|
116
|
+
/** Every file below a directory, as relative path -> sha256. */
|
|
117
|
+
function digestTreeFiles(dir) {
|
|
118
|
+
const map = new Map();
|
|
119
|
+
const walk = current => {
|
|
120
|
+
let entries = [];
|
|
121
|
+
try { entries = fs.readdirSync(current, { withFileTypes: true }); } catch { return; }
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
const full = path.join(current, entry.name);
|
|
124
|
+
if (entry.isDirectory()) walk(full);
|
|
125
|
+
else if (entry.isFile()) map.set(path.relative(dir, full).split(path.sep).join('/'), sha256File(full));
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
walk(dir);
|
|
129
|
+
return map;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/** The real client configuration of the developer, digested. */
|
|
133
|
+
function digestRealClientConfigs(homeDir = os.homedir()) {
|
|
134
|
+
const files = CLIENT_CONFIG_FILES.map(relative => ({ relative, sha256: sha256File(path.join(homeDir, relative)) }));
|
|
135
|
+
const dirs = CLIENT_CONFIG_DIRS.map(relative => ({ relative, ...digestTree(path.join(homeDir, relative)) }));
|
|
136
|
+
return { files, dirs };
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** The whole real client tree, as relative path -> sha256 per client home. */
|
|
140
|
+
function digestRealClientTrees(homeDir = os.homedir()) {
|
|
141
|
+
return [
|
|
142
|
+
{ dir: '.claude', files: digestTreeFiles(path.join(homeDir, '.claude')) },
|
|
143
|
+
{ dir: '.codex', files: digestTreeFiles(path.join(homeDir, '.codex')) },
|
|
144
|
+
{ dir: '.config/opencode', files: digestTreeFiles(path.join(homeDir, '.config', 'opencode')) },
|
|
145
|
+
];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function compareDigests(before, after) {
|
|
149
|
+
const changed = [];
|
|
150
|
+
for (const [index, entry] of before.entries()) {
|
|
151
|
+
const now = after[index];
|
|
152
|
+
if (!now || now.digest !== entry.digest) changed.push(entry.dir);
|
|
153
|
+
}
|
|
154
|
+
return { byteIdentical: changed.length === 0, changed, before, after };
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
/** The configuration surface comparison: the real isolation claim. */
|
|
158
|
+
function compareConfigSurface(before, after) {
|
|
159
|
+
const changedFiles = [];
|
|
160
|
+
for (const entry of before.files) {
|
|
161
|
+
const now = after.files.find(item => item.relative === entry.relative);
|
|
162
|
+
if (!now || now.sha256 !== entry.sha256) changedFiles.push(entry.relative);
|
|
163
|
+
}
|
|
164
|
+
const changedDirs = [];
|
|
165
|
+
for (const entry of before.dirs) {
|
|
166
|
+
const now = after.dirs.find(item => item.relative === entry.relative);
|
|
167
|
+
if (!now || now.digest !== entry.digest) changedDirs.push(entry.relative);
|
|
168
|
+
}
|
|
169
|
+
return { byteIdentical: changedFiles.length === 0 && changedDirs.length === 0, changedFiles, changedDirs, before, after };
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Every file that changed in the real home during the run, classified.
|
|
174
|
+
* A file outside the runtime set and outside the configuration surface is a
|
|
175
|
+
* leak and must fail the case.
|
|
176
|
+
*/
|
|
177
|
+
function compareRealTrees(before, after) {
|
|
178
|
+
const changed = [];
|
|
179
|
+
for (const entry of before) {
|
|
180
|
+
const now = after.find(item => item.dir === entry.dir);
|
|
181
|
+
if (!now) { changed.push({ dir: entry.dir, file: null, state: 'directory-removed' }); continue; }
|
|
182
|
+
for (const [file, sha] of now.files) {
|
|
183
|
+
if (entry.files.get(file) === sha) continue;
|
|
184
|
+
changed.push({ dir: entry.dir, file, state: entry.files.has(file) ? 'modified' : 'created' });
|
|
185
|
+
}
|
|
186
|
+
for (const file of entry.files.keys()) {
|
|
187
|
+
if (!now.files.has(file)) changed.push({ dir: entry.dir, file, state: 'deleted' });
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
const isConfig = item => CLIENT_CONFIG_FILES.includes(`${item.dir}/${item.file}`)
|
|
191
|
+
|| CLIENT_CONFIG_DIRS.some(dir => `${item.dir}/${item.file}`.startsWith(`${dir}/`));
|
|
192
|
+
const leaks = changed.filter(item => !isConfig(item) && !RUNTIME_PATH.test(`${item.dir}/${item.file}`));
|
|
193
|
+
const configChanges = changed.filter(item => isConfig(item));
|
|
194
|
+
return { changed, leaks, configChanges, runtimeChanges: changed.length - leaks.length - configChanges.length };
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
/** Remove the ambient variables of the calling shell around one call. */
|
|
198
|
+
function withSanitizedEnv(fn) {
|
|
199
|
+
const saved = new Map();
|
|
200
|
+
for (const name of Object.keys(process.env)) {
|
|
201
|
+
if (AMBIENT_PREFIXES.some(prefix => name.startsWith(prefix)) || AMBIENT_EXACT.includes(name)) {
|
|
202
|
+
saved.set(name, process.env[name]);
|
|
203
|
+
delete process.env[name];
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
try {
|
|
207
|
+
return fn();
|
|
208
|
+
} finally {
|
|
209
|
+
for (const [name, value] of saved) process.env[name] = value;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function startCapHarness({ tag, evidenceDir, viewport = { width: 1600, height: 950 }, analysisOwner = 'engine' } = {}) {
|
|
214
|
+
const tempRoot = resolveTempRoot();
|
|
215
|
+
fs.mkdirSync(tempRoot, { recursive: true });
|
|
216
|
+
const previousTemp = { TEMP: process.env.TEMP, TMP: process.env.TMP, TMPDIR: process.env.TMPDIR };
|
|
217
|
+
process.env.TEMP = tempRoot;
|
|
218
|
+
process.env.TMP = tempRoot;
|
|
219
|
+
process.env.TMPDIR = tempRoot;
|
|
220
|
+
|
|
221
|
+
const fixture = fs.mkdtempSync(path.join(tempRoot, `pk-cap-r3-${tag}-`));
|
|
222
|
+
const homeDir = path.join(fixture, 'home');
|
|
223
|
+
fs.mkdirSync(homeDir, { recursive: true });
|
|
224
|
+
const evidence = evidenceDir || path.join(fixture, 'evidence');
|
|
225
|
+
fs.mkdirSync(evidence, { recursive: true });
|
|
226
|
+
|
|
227
|
+
const realHomeBefore = digestRealClientConfigs();
|
|
228
|
+
const realTreesBefore = digestRealClientTrees();
|
|
229
|
+
|
|
230
|
+
const port = await freePort();
|
|
231
|
+
if (LIVE_PORTS.has(port)) throw new Error(`refusing to use the live port ${port}`);
|
|
232
|
+
const base = `http://127.0.0.1:${port}`;
|
|
233
|
+
|
|
234
|
+
const server = withSanitizedEnv(() => spawnServer({
|
|
235
|
+
root: ROOT,
|
|
236
|
+
port,
|
|
237
|
+
dataDir: path.join(fixture, 'data'),
|
|
238
|
+
tag: `cap-r3-${tag}`,
|
|
239
|
+
analysisOwner,
|
|
240
|
+
extraEnv: {
|
|
241
|
+
HOME: homeDir,
|
|
242
|
+
USERPROFILE: homeDir,
|
|
243
|
+
CLAUDE_CONFIG_DIR: path.join(homeDir, '.claude'),
|
|
244
|
+
KB_MODULES_REGISTER: '0',
|
|
245
|
+
KB_MODULES_AUTOSTART: '0',
|
|
246
|
+
},
|
|
247
|
+
}));
|
|
248
|
+
process.env.TEMP = previousTemp.TEMP;
|
|
249
|
+
process.env.TMP = previousTemp.TMP;
|
|
250
|
+
process.env.TMPDIR = previousTemp.TMPDIR;
|
|
251
|
+
|
|
252
|
+
let browser = null;
|
|
253
|
+
let network = null;
|
|
254
|
+
try {
|
|
255
|
+
await waitFor(async () => {
|
|
256
|
+
try {
|
|
257
|
+
const response = await fetch(`${base}/api/health`, { signal: AbortSignal.timeout(5000) });
|
|
258
|
+
return response.status === 200;
|
|
259
|
+
} catch { return false; }
|
|
260
|
+
}, 'the isolated product instance', 30000);
|
|
261
|
+
|
|
262
|
+
browser = await launchCdpBrowser({
|
|
263
|
+
chrome: findChrome(),
|
|
264
|
+
profileDir: path.join(fixture, 'browser'),
|
|
265
|
+
url: `${base}/`,
|
|
266
|
+
width: viewport.width,
|
|
267
|
+
height: viewport.height,
|
|
268
|
+
});
|
|
269
|
+
await browser.setViewport(viewport.width, viewport.height);
|
|
270
|
+
await browser.send('Network.enable');
|
|
271
|
+
network = attachNetworkCapture(browser);
|
|
272
|
+
} catch (error) {
|
|
273
|
+
await server.cleanup();
|
|
274
|
+
fs.rmSync(fixture, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
275
|
+
throw error;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
const run = expression => browser.evaluate(expression);
|
|
279
|
+
const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
|
|
280
|
+
|
|
281
|
+
const productApi = async (method, route, body) => {
|
|
282
|
+
const response = await fetch(base + route, {
|
|
283
|
+
method,
|
|
284
|
+
headers: body === undefined ? undefined : { 'Content-Type': 'application/json' },
|
|
285
|
+
body: body === undefined ? undefined : JSON.stringify(body),
|
|
286
|
+
signal: AbortSignal.timeout(30000),
|
|
287
|
+
});
|
|
288
|
+
return { status: response.status, body: await response.json().catch(() => null) };
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/** A native pointer click: the hit test must resolve to the target. */
|
|
292
|
+
const nativeClick = async selector => {
|
|
293
|
+
const probe = await run(`(() => {
|
|
294
|
+
const el = document.querySelector(${JSON.stringify(selector)});
|
|
295
|
+
if (!el) return { missing: true };
|
|
296
|
+
el.scrollIntoView({ block: 'center' });
|
|
297
|
+
const rect = el.getBoundingClientRect();
|
|
298
|
+
if (rect.width <= 0 || rect.height <= 0) return { invisible: true };
|
|
299
|
+
const x = rect.left + rect.width / 2;
|
|
300
|
+
const y = rect.top + rect.height / 2;
|
|
301
|
+
const hit = document.elementFromPoint(x, y);
|
|
302
|
+
const describe = node => {
|
|
303
|
+
if (!node) return 'nothing';
|
|
304
|
+
let text = node.tagName.toLowerCase();
|
|
305
|
+
if (node.id) text += '#' + node.id;
|
|
306
|
+
if (node.className && typeof node.className === 'string' && node.className.trim()) text += '.' + node.className.trim().split(/\\s+/).join('.');
|
|
307
|
+
return text;
|
|
308
|
+
};
|
|
309
|
+
return { x, y, hitIsTarget: Boolean(hit && (hit === el || el.contains(hit))), hit: describe(hit), label: (el.textContent || '').trim().slice(0, 40) };
|
|
310
|
+
})()`);
|
|
311
|
+
if (!probe || probe.missing) throw new Error(`the control ${selector} must exist in the page`);
|
|
312
|
+
if (probe.invisible) throw new Error(`the control ${selector} must be visible`);
|
|
313
|
+
if (!probe.hitIsTarget) throw new Error(`the control ${selector} must be the hit target; ${probe.hit} is on top`);
|
|
314
|
+
const common = { x: probe.x, y: probe.y, button: 'left', clickCount: 1 };
|
|
315
|
+
await browser.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: probe.x, y: probe.y, button: 'none', clickCount: 0 });
|
|
316
|
+
await browser.send('Input.dispatchMouseEvent', { type: 'mousePressed', ...common });
|
|
317
|
+
await browser.send('Input.dispatchMouseEvent', { type: 'mouseReleased', ...common });
|
|
318
|
+
return probe;
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const typeInto = async (selector, text) => {
|
|
322
|
+
await nativeClick(selector);
|
|
323
|
+
await run(`(() => { const el = document.querySelector(${JSON.stringify(selector)}); el.value = ''; el.focus(); })()`);
|
|
324
|
+
for (const character of String(text)) {
|
|
325
|
+
const upper = character.toUpperCase();
|
|
326
|
+
const isLetter = character >= 'a' && character <= 'z';
|
|
327
|
+
const isUpper = character >= 'A' && character <= 'Z';
|
|
328
|
+
const isDigit = character >= '0' && character <= '9';
|
|
329
|
+
const code = isLetter ? `Key${upper}` : isUpper ? `Key${character}` : isDigit ? `Digit${character}` : '';
|
|
330
|
+
const keyCode = isUpper ? upper.charCodeAt(0) : isLetter ? character.charCodeAt(0) : isDigit ? character.charCodeAt(0) : 0;
|
|
331
|
+
const base = { key: character, code, windowsVirtualKeyCode: keyCode, nativeVirtualKeyCode: keyCode };
|
|
332
|
+
await browser.send('Input.dispatchKeyEvent', { type: 'keyDown', ...base, text: character, unmodifiedText: character });
|
|
333
|
+
await browser.send('Input.dispatchKeyEvent', { type: 'keyUp', ...base });
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
|
|
337
|
+
/** Open the real system drawer: the 外部 Agent 接入 section lives there. */
|
|
338
|
+
const openSystemDrawer = async () => {
|
|
339
|
+
await nativeClick('#openSystem');
|
|
340
|
+
await waitFor(() => run("document.getElementById('systemDrawer').hidden === false"), 'the system drawer is open', 15000);
|
|
341
|
+
await waitFor(
|
|
342
|
+
() => run("document.querySelectorAll('#agentCaptureList .agent-capture-row').length > 0"),
|
|
343
|
+
'the external agent rows are rendered',
|
|
344
|
+
60000,
|
|
345
|
+
);
|
|
346
|
+
// The drawer answers '检测中' until the product's own scan settles; a
|
|
347
|
+
// case that reads that placeholder would prove nothing.
|
|
348
|
+
await waitFor(
|
|
349
|
+
() => run("[...document.querySelectorAll('#agentCaptureList .agent-capture-row')].every(row => { const badge = row.querySelector('.status'); return badge && badge.textContent !== '检测中'; })"),
|
|
350
|
+
'the external agent rows show a settled state',
|
|
351
|
+
90000,
|
|
352
|
+
);
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
/** Close and reopen the drawer with real clicks: reopening is the product's own refresh point. */
|
|
356
|
+
const reopenSystemDrawer = async () => {
|
|
357
|
+
if (!(await run("document.getElementById('systemDrawer').hidden === false"))) throw new Error('the system drawer must be open before it can be reopened');
|
|
358
|
+
await nativeClick('#closeSystem');
|
|
359
|
+
await waitFor(() => run("document.getElementById('systemDrawer').hidden === true"), 'the system drawer is closed', 15000);
|
|
360
|
+
await openSystemDrawer();
|
|
361
|
+
};
|
|
362
|
+
|
|
363
|
+
/** The rows exactly as the UI rendered them. */
|
|
364
|
+
const agentRows = () => run(`[...document.querySelectorAll('#agentCaptureList .agent-capture-row')].map(row => ({
|
|
365
|
+
label: row.querySelector('b') ? row.querySelector('b').textContent : null,
|
|
366
|
+
badge: row.querySelector('.status') ? row.querySelector('.status').textContent : null,
|
|
367
|
+
client: row.querySelector('[data-agent-switch]') ? row.querySelector('[data-agent-switch]').dataset.agentClient : null,
|
|
368
|
+
details: [...row.querySelectorAll('small')].map(el => el.textContent),
|
|
369
|
+
switch: row.querySelector('[data-agent-switch]') ? {
|
|
370
|
+
action: row.querySelector('[data-agent-switch]').dataset.agentSwitch,
|
|
371
|
+
client: row.querySelector('[data-agent-switch]').dataset.agentClient,
|
|
372
|
+
text: row.querySelector('[data-agent-switch]').textContent,
|
|
373
|
+
disabled: row.querySelector('[data-agent-switch]').disabled,
|
|
374
|
+
} : null,
|
|
375
|
+
retry: row.querySelector('[data-agent-retry]') ? row.querySelector('[data-agent-retry]').dataset.agentClient : null,
|
|
376
|
+
}))`);
|
|
377
|
+
|
|
378
|
+
const feedback = () => run("document.getElementById('agentCaptureFeedback').textContent");
|
|
379
|
+
|
|
380
|
+
/** The product's own status: one entry per client, one state per capability. */
|
|
381
|
+
const integrationStatus = async (refresh = true) => {
|
|
382
|
+
const result = await productApi('GET', `/api/integrations/status${refresh ? '?refresh=1' : ''}`);
|
|
383
|
+
if (result.status !== 200) throw new Error(`the integration status must be readable: ${JSON.stringify(result.body)}`);
|
|
384
|
+
return result.body;
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
/** The client configuration files the installer writes into the isolated home. */
|
|
388
|
+
const isolatedConfigs = () => {
|
|
389
|
+
const claudeSettings = path.join(homeDir, '.claude', 'settings.json');
|
|
390
|
+
const codexConfig = path.join(homeDir, '.codex', 'config.toml');
|
|
391
|
+
const openCodeConfig = path.join(homeDir, '.config', 'opencode', 'opencode.json');
|
|
392
|
+
const readJson = file => {
|
|
393
|
+
try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return null; }
|
|
394
|
+
};
|
|
395
|
+
const settings = readJson(claudeSettings);
|
|
396
|
+
const hookEvents = settings && settings.hooks ? settings.hooks : null;
|
|
397
|
+
const ownedHooks = {};
|
|
398
|
+
for (const [event, groups] of Object.entries(hookEvents || {})) {
|
|
399
|
+
const list = Array.isArray(groups) ? groups : [];
|
|
400
|
+
const entries = [];
|
|
401
|
+
for (const group of list) for (const hook of group?.hooks || []) {
|
|
402
|
+
const command = hook?.type === 'command' ? hook.command : `${hook?.command} ${(hook?.args || []).join(' ')}`;
|
|
403
|
+
if (/bridge-hook\.cjs/i.test(String(command))) entries.push({ command, args: hook?.args || null, type: hook?.type || null });
|
|
404
|
+
}
|
|
405
|
+
ownedHooks[event] = entries;
|
|
406
|
+
}
|
|
407
|
+
return {
|
|
408
|
+
homeDir,
|
|
409
|
+
claudeSettingsFile: claudeSettings,
|
|
410
|
+
claudeSettingsExists: fs.existsSync(claudeSettings),
|
|
411
|
+
claudeSettings: settings,
|
|
412
|
+
ownedHooks,
|
|
413
|
+
ownedHookCounts: Object.fromEntries(Object.entries(ownedHooks).map(([event, entries]) => [event, entries.length])),
|
|
414
|
+
installedPlugins: readJson(path.join(homeDir, '.claude', 'plugins', 'installed_plugins.json')),
|
|
415
|
+
knownMarketplaces: readJson(path.join(homeDir, '.claude', 'plugins', 'known_marketplaces.json')),
|
|
416
|
+
codexConfigFile: codexConfig,
|
|
417
|
+
codexConfigExists: fs.existsSync(codexConfig),
|
|
418
|
+
codexConfigText: fs.existsSync(codexConfig) ? fs.readFileSync(codexConfig, 'utf8') : null,
|
|
419
|
+
openCodeConfigFile: openCodeConfig,
|
|
420
|
+
openCodeConfigExists: fs.existsSync(openCodeConfig),
|
|
421
|
+
};
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/**
|
|
425
|
+
* The status once the product's own scan has settled.
|
|
426
|
+
*
|
|
427
|
+
* The product answers the first status request with 'checking' placeholders
|
|
428
|
+
* and refreshes itself; a case that reads a 'checking' answer would prove
|
|
429
|
+
* nothing. This waits for the product's own settled answer.
|
|
430
|
+
*/
|
|
431
|
+
const settledStatus = async (timeoutMs = 90000) => {
|
|
432
|
+
const deadline = Date.now() + timeoutMs;
|
|
433
|
+
let last = null;
|
|
434
|
+
while (Date.now() < deadline) {
|
|
435
|
+
const result = await productApi('GET', '/api/integrations/status');
|
|
436
|
+
last = result.body;
|
|
437
|
+
const clients = (last && last.clients) || [];
|
|
438
|
+
const pending = clients.some(client => ['checking', 'refreshing'].includes(client.summary)
|
|
439
|
+
|| client.knowledgeIntegration?.state === 'checking'
|
|
440
|
+
|| client.automaticContext?.state === 'checking'
|
|
441
|
+
|| client.developmentCapture?.state === 'checking');
|
|
442
|
+
if (!pending && last && last.scan && last.scan.state === 'ready') return last;
|
|
443
|
+
await new Promise(resolve => setTimeout(resolve, 400));
|
|
444
|
+
}
|
|
445
|
+
throw new Error(`the integration status never settled: ${JSON.stringify(last)}`);
|
|
446
|
+
};
|
|
447
|
+
|
|
448
|
+
/** One client entry of the settled status. */
|
|
449
|
+
const statusClient = (status, client) => (status.clients || []).find(entry => entry.client === client) || null;
|
|
450
|
+
|
|
451
|
+
/** The row of one client exactly as the UI rendered it. */
|
|
452
|
+
const agentRow = async client => {
|
|
453
|
+
const rows = await agentRows();
|
|
454
|
+
return rows.find(row => row.client === client) || null;
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
/** Every install request the real UI sent so far. */
|
|
458
|
+
const installCallCount = () => network.find(entry => entry.method === 'POST' && entry.url.includes('/api/integrations/install')).length;
|
|
459
|
+
|
|
460
|
+
/** The last install request the real UI sent, with its real response body. */
|
|
461
|
+
const lastInstallCall = async () => {
|
|
462
|
+
const entries = network.find(entry => entry.method === 'POST' && entry.url.includes('/api/integrations/install'));
|
|
463
|
+
const entry = entries.length ? entries[entries.length - 1] : null;
|
|
464
|
+
if (!entry) return null;
|
|
465
|
+
return { method: entry.method, url: entry.url.replace(base, ''), request: entry.body, status: entry.status, response: await network.body(entry) };
|
|
466
|
+
};
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* The real 系统诊断记录 dialog, searched with the real input and the real
|
|
470
|
+
* 查询 button. The operationId must be findable in the product's own
|
|
471
|
+
* diagnostics, not only in the HTTP response that produced it.
|
|
472
|
+
*/
|
|
473
|
+
const logsSearch = async operationId => {
|
|
474
|
+
// The dialog is modal and stays open after a previous search; the real
|
|
475
|
+
// user path back to the button is the dialog's own close control, and
|
|
476
|
+
// then the system drawer again.
|
|
477
|
+
if (await run("document.getElementById('logsDialog').open === true")) {
|
|
478
|
+
await nativeClick('#logsDialog [data-close="logsDialog"]');
|
|
479
|
+
await waitFor(() => run("document.getElementById('logsDialog').open === false"), 'the diagnostics dialog is closed', 10000);
|
|
480
|
+
}
|
|
481
|
+
if (await run("document.getElementById('systemDrawer').hidden === true")) await openSystemDrawer();
|
|
482
|
+
await nativeClick('#openLogs');
|
|
483
|
+
await waitFor(() => run("document.getElementById('logsDialog').open === true"), 'the diagnostics dialog is open', 10000);
|
|
484
|
+
await typeInto('#logsSearch', operationId);
|
|
485
|
+
await nativeClick('#loadLogs');
|
|
486
|
+
// The content keeps the previous search's records until the new answer
|
|
487
|
+
// lands; the operation id appearing in a returned record is the product's
|
|
488
|
+
// own answer for this search.
|
|
489
|
+
await waitFor(
|
|
490
|
+
() => run(`[...document.getElementById('logsContent').querySelectorAll('.log-entry')].some(row => row.textContent.includes(${JSON.stringify(operationId)}))`),
|
|
491
|
+
'the diagnostics search returns records for the operation id',
|
|
492
|
+
20000,
|
|
493
|
+
);
|
|
494
|
+
return run(`({
|
|
495
|
+
status: document.getElementById('logsStatus').textContent,
|
|
496
|
+
search: document.getElementById('logsSearch').value,
|
|
497
|
+
entries: [...document.getElementById('logsContent').querySelectorAll('.log-entry')].map(row => ({
|
|
498
|
+
level: row.dataset.level,
|
|
499
|
+
summary: row.querySelector('summary') ? row.querySelector('summary').textContent : '',
|
|
500
|
+
detail: row.querySelector('.log-detail') ? row.querySelector('.log-detail').textContent : '',
|
|
501
|
+
})),
|
|
502
|
+
})`);
|
|
503
|
+
};
|
|
504
|
+
|
|
505
|
+
/**
|
|
506
|
+
* The installed knowledge plugin of the isolated home, compared with the
|
|
507
|
+
* product's own plugin source file by file.
|
|
508
|
+
*/
|
|
509
|
+
const pluginEvidence = () => {
|
|
510
|
+
const indexFile = path.join(homeDir, '.claude', 'plugins', 'installed_plugins.json');
|
|
511
|
+
const index = (() => {
|
|
512
|
+
try { return JSON.parse(fs.readFileSync(indexFile, 'utf8')); } catch { return null; }
|
|
513
|
+
})();
|
|
514
|
+
const entries = index && index.plugins ? index.plugins['project-knowledge@project-knowledge'] || [] : [];
|
|
515
|
+
const installPath = entries.length ? entries[0].installPath : null;
|
|
516
|
+
const files = ['hooks/claude.json', 'scripts/context-hook.cjs', '.mcp.json', '.claude-plugin/plugin.json'];
|
|
517
|
+
const normalize = file => {
|
|
518
|
+
try { return new TextDecoder('utf-8', { fatal: true }).decode(fs.readFileSync(file)).replace(/\r\n/g, '\n'); } catch { return null; }
|
|
519
|
+
};
|
|
520
|
+
const comparison = files.map(file => {
|
|
521
|
+
const installed = installPath ? path.join(installPath, file) : null;
|
|
522
|
+
const source = path.join(ROOT, 'plugins', 'project-knowledge', file);
|
|
523
|
+
const installedText = installed && fs.existsSync(installed) ? normalize(installed) : null;
|
|
524
|
+
const sourceText = fs.existsSync(source) ? normalize(source) : null;
|
|
525
|
+
return {
|
|
526
|
+
file,
|
|
527
|
+
installedPath: installed,
|
|
528
|
+
installedExists: Boolean(installedText !== null),
|
|
529
|
+
sourcePath: source,
|
|
530
|
+
byteIdentical: installedText !== null && sourceText !== null && installedText === sourceText,
|
|
531
|
+
installedSha256: installed && fs.existsSync(installed) ? sha256File(installed) : null,
|
|
532
|
+
sourceSha256: fs.existsSync(source) ? sha256File(source) : null,
|
|
533
|
+
};
|
|
534
|
+
});
|
|
535
|
+
const marketplaceFile = path.join(homeDir, '.claude', 'plugins', 'known_marketplaces.json');
|
|
536
|
+
const marketplace = (() => {
|
|
537
|
+
try { return JSON.parse(fs.readFileSync(marketplaceFile, 'utf8')); } catch { return null; }
|
|
538
|
+
})();
|
|
539
|
+
return {
|
|
540
|
+
indexFile,
|
|
541
|
+
installedPlugins: index,
|
|
542
|
+
installedVersion: entries.length ? entries[0].version : null,
|
|
543
|
+
installPath,
|
|
544
|
+
installPathExists: Boolean(installPath && fs.existsSync(installPath)),
|
|
545
|
+
files: comparison,
|
|
546
|
+
allFilesIdentical: comparison.every(entry => entry.byteIdentical),
|
|
547
|
+
marketplaceSource: marketplace && marketplace['project-knowledge'] ? marketplace['project-knowledge'].source : null,
|
|
548
|
+
};
|
|
549
|
+
};
|
|
550
|
+
|
|
551
|
+
/** The Bridge hook entries the product owns in the isolated home. */
|
|
552
|
+
const ownedHookEntries = () => {
|
|
553
|
+
const configs = isolatedConfigs();
|
|
554
|
+
const entries = [];
|
|
555
|
+
for (const [event, list] of Object.entries(configs.ownedHooks)) {
|
|
556
|
+
for (const hook of list) {
|
|
557
|
+
const match = String(hook.command || '').match(/bridge-hook\.cjs/i);
|
|
558
|
+
const target = match ? String(hook.command).match(/"([^"]*bridge-hook\.cjs)"/i) : null;
|
|
559
|
+
const shim = target ? target[1] : null;
|
|
560
|
+
entries.push({
|
|
561
|
+
event,
|
|
562
|
+
command: hook.command,
|
|
563
|
+
shimPath: shim,
|
|
564
|
+
shimExists: Boolean(shim && fs.existsSync(shim)),
|
|
565
|
+
});
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return entries;
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
const cleanup = async () => {
|
|
572
|
+
await browser?.close();
|
|
573
|
+
await server.cleanup();
|
|
574
|
+
fs.rmSync(fixture, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
return {
|
|
578
|
+
fixture, evidence, homeDir, tempRoot, base, server, productApi, browser, network,
|
|
579
|
+
run, wait, waitFor, nativeClick, typeInto,
|
|
580
|
+
openSystemDrawer, reopenSystemDrawer, agentRows, agentRow, feedback, integrationStatus, isolatedConfigs,
|
|
581
|
+
settledStatus, statusClient, lastInstallCall, installCallCount, logsSearch, pluginEvidence, ownedHookEntries,
|
|
582
|
+
realHomeBefore, realTreesBefore, digestRealClientConfigs, digestRealClientTrees,
|
|
583
|
+
compareDigests, compareConfigSurface, compareRealTrees, cleanup,
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
module.exports = {
|
|
588
|
+
ROOT,
|
|
589
|
+
LIVE_PORTS,
|
|
590
|
+
AMBIENT_PREFIXES,
|
|
591
|
+
AMBIENT_EXACT,
|
|
592
|
+
CLIENT_CONFIG_FILES,
|
|
593
|
+
CLIENT_CONFIG_DIRS,
|
|
594
|
+
RUNTIME_PATH,
|
|
595
|
+
resolveTempRoot,
|
|
596
|
+
digestTree,
|
|
597
|
+
digestTreeFiles,
|
|
598
|
+
digestRealClientConfigs,
|
|
599
|
+
digestRealClientTrees,
|
|
600
|
+
compareDigests,
|
|
601
|
+
compareConfigSurface,
|
|
602
|
+
compareRealTrees,
|
|
603
|
+
withSanitizedEnv,
|
|
604
|
+
startCapHarness,
|
|
605
|
+
};
|