@sanqianx/project-knowledge 5.0.19 → 5.0.20
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/.agents/plugins/marketplace.json +3 -3
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +5 -0
- package/LICENSE +201 -201
- package/NOTICE +5 -5
- package/README.md +349 -349
- package/_modules/knowledge-engine/README.md +4 -0
- package/_modules/knowledge-engine/src/analysis-failures.js +39 -0
- package/_modules/knowledge-engine/src/analysis-worker.js +6 -2
- package/_modules/knowledge-engine/src/coordinator.js +7 -0
- package/_modules/knowledge-engine/src/headless-analyzer.js +2 -1
- package/_modules/knowledge-engine/src/server.js +1 -1
- package/_site/_test/agent-capture-mcp-ui-test.js +67 -67
- package/_site/_test/ai-profile-test.js +75 -75
- package/_site/_test/ai-vendor-presets-test.js +91 -91
- package/_site/_test/automatic-context-test.js +70 -70
- package/_site/_test/bin-cli-test.js +230 -230
- package/_site/_test/bridge-adapter-test.js +95 -95
- package/_site/_test/bridge-consumer-service-test.js +310 -310
- package/_site/_test/candidate-bin-content-test.js +35 -35
- package/_site/_test/candidate-product-assets-test.js +13 -13
- package/_site/_test/candidate-release-contract-test.js +14 -14
- package/_site/_test/capture-hook-dedup-test.js +158 -158
- package/_site/_test/claude-executable-discovery-test.js +28 -28
- package/_site/_test/claude-session-lifecycle-sweep-test.js +252 -252
- package/_site/_test/cli-instance-management-test.js +62 -62
- package/_site/_test/client-capture-restart-e2e-test.js +189 -189
- package/_site/_test/codex-conversation-projection-test.js +60 -60
- package/_site/_test/codex-marketplace-scoped-path-test.js +186 -186
- package/_site/_test/codex-notify-capture-e2e-test.js +101 -101
- package/_site/_test/codex-notify-fanout-test.js +134 -134
- package/_site/_test/codex-notify-upgrade-test.js +253 -253
- package/_site/_test/commit-boundary-freeze-test.js +147 -147
- package/_site/_test/commit-conversation-binding-test.js +4 -4
- package/_site/_test/configuration-generation-test.js +22 -22
- package/_site/_test/context-pack-test.js +200 -200
- package/_site/_test/conversation-api-test.js +10 -10
- package/_site/_test/conversation-origin-test.js +15 -15
- package/_site/_test/cross-repo-isolation-e2e-test.js +187 -187
- package/_site/_test/embedding-config-test.js +32 -32
- package/_site/_test/fixtures/fake-browser-exit.js +10 -10
- package/_site/_test/fixtures/fake-browser-hang.js +10 -10
- package/_site/_test/fixtures/integration-busy-worker.cjs +6 -6
- package/_site/_test/fixtures/make-git-repos.js +92 -92
- package/_site/_test/fixtures/retrieval-gold-queries.json +32 -32
- package/_site/_test/fresh-hook-reimport-test.js +53 -53
- package/_site/_test/fresh-product-data-test.js +56 -56
- package/_site/_test/git-path-compatibility-test.js +80 -80
- package/_site/_test/git-validation-test.js +81 -81
- package/_site/_test/hook-worktree-test.js +42 -42
- package/_site/_test/index-builder-test.js +41 -41
- package/_site/_test/index-error-display-contract-test.js +10 -10
- package/_site/_test/integration-adapters-test.js +67 -67
- package/_site/_test/integration-capture-setup-test.js +118 -118
- package/_site/_test/integration-runtime-binding-a2-test.js +566 -566
- package/_site/_test/integration-runtime-binding-a3-test.js +227 -227
- package/_site/_test/integration-runtime-binding-test.js +473 -473
- package/_site/_test/integration-status-scan-test.js +29 -29
- package/_site/_test/kb-framework-test.js +57 -57
- package/_site/_test/kbpath-follow-test.js +63 -63
- package/_site/_test/knowledge-db-test.js +144 -144
- package/_site/_test/knowledge-engine-client-test.js +109 -109
- package/_site/_test/knowledge-maintenance-test.js +40 -40
- package/_site/_test/knowledge-panel-ui-contract-test.js +112 -0
- package/_site/_test/knowledge-scopes-test.js +37 -37
- package/_site/_test/knowledge-storage-location-test.js +28 -28
- package/_site/_test/launcher-readiness-test.js +80 -80
- package/_site/_test/legacy-claude-session-alias-test.js +106 -106
- package/_site/_test/legacy-routes-removed-test.js +47 -47
- package/_site/_test/legacy-workbench-exclusion-test.js +92 -92
- package/_site/_test/live-gateway-test.js +48 -48
- package/_site/_test/local-marketplace-test.js +16 -16
- package/_site/_test/log-redaction-test.js +58 -58
- package/_site/_test/markdown-maintenance-test.js +11 -11
- package/_site/_test/model-context-windows-test.js +89 -89
- package/_site/_test/module-agent-start-proxy-test.js +65 -65
- package/_site/_test/module-artifact-integrity-test.js +27 -27
- package/_site/_test/module-boundary-test.js +30 -30
- package/_site/_test/module-bridge-eventbridge-test.js +202 -202
- package/_site/_test/module-dynamic-port-test.js +118 -118
- package/_site/_test/module-index-proxy-test.js +33 -33
- package/_site/_test/module-model-configuration-test.js +44 -44
- package/_site/_test/module-process-lifecycle-test.js +35 -35
- package/_site/_test/module-stream-proxy-test.js +34 -34
- package/_site/_test/module-terminal-restart-test.js +63 -63
- package/_site/_test/module-wiring-unbind-race-test.js +59 -59
- package/_site/_test/native-context-integrations-test.js +86 -86
- package/_site/_test/orphaned-claim-recovery-test.js +80 -80
- package/_site/_test/package-boundary-test.js +43 -42
- package/_site/_test/package-startup-test.js +56 -56
- package/_site/_test/packaged-ui-smoke-test.js +88 -88
- package/_site/_test/pr-consumer-contract-test.js +55 -55
- package/_site/_test/product-brand-contract-test.js +25 -25
- package/_site/_test/product-diagnostics-ui-test.js +93 -93
- package/_site/_test/product-import-ui-test.js +104 -104
- package/_site/_test/product-progress-status-test.js +12 -1
- package/_site/_test/project-remove-running-guard-test.js +79 -79
- package/_site/_test/project-store-test.js +90 -90
- package/_site/_test/registry-events-test.js +38 -38
- package/_site/_test/release-version-sync-test.js +115 -115
- package/_site/_test/requirement-binding-test.js +113 -113
- package/_site/_test/runtime-endpoint-test.js +64 -64
- package/_site/_test/scanner-test.js +83 -83
- package/_site/_test/server-security-test.js +96 -96
- package/_site/_test/sessions-stream-test.js +93 -93
- package/_site/_test/shared-scope-root-binding-test.js +67 -67
- package/_site/_test/simple-import-test.js +98 -98
- package/_site/_test/startup-analysis-disabled-test.js +6 -6
- package/_site/_test/team-knowledge-store-sparse-checkout-test.js +196 -196
- package/_site/_test/team-knowledge-store-test.js +132 -132
- package/_site/_test/test-server-cleanup-test.js +35 -35
- package/_site/_test/test-server-module-isolation-test.js +37 -37
- package/_site/_test/tracking-start-test.js +35 -35
- package/_site/_test/workbench-context-receipts-test.js +22 -22
- package/_site/_test/workspace-ui-contract-test.js +31 -31
- package/_site/_test/zcode-capture-integration-test.js +108 -108
- package/_site/lib/ai-vendor-presets.js +83 -83
- package/_site/lib/ai-workspace.js +3 -3
- package/_site/lib/atomic-file.js +204 -204
- package/_site/lib/bridge-adapter.js +260 -260
- package/_site/lib/capture-hook-config.js +108 -108
- package/_site/lib/claude-cli-runner.js +89 -89
- package/_site/lib/cli-instances.js +43 -43
- package/_site/lib/codex-context-status.js +17 -17
- package/_site/lib/codex-notify-config.js +193 -193
- package/_site/lib/commit-conversation-binder.js +12 -12
- package/_site/lib/commit-reconciler.js +38 -38
- package/_site/lib/context-pack-builder.js +299 -299
- package/_site/lib/conversation-exclusions.js +204 -204
- package/_site/lib/conversation-query-service.js +17 -17
- package/_site/lib/data-dir.js +13 -13
- package/_site/lib/embedding-service.js +85 -85
- package/_site/lib/engine-connection.js +93 -93
- package/_site/lib/engine-knowledge-client.js +72 -72
- package/_site/lib/folder-picker-output.js +3 -3
- package/_site/lib/git-path.js +14 -14
- package/_site/lib/github-team-store.js +3 -3
- package/_site/lib/index-builder.js +157 -157
- package/_site/lib/integration-status-scan.js +99 -99
- package/_site/lib/integration-status-worker.js +14 -14
- package/_site/lib/kb-framework.js +15 -15
- package/_site/lib/knowledge-db.js +363 -363
- package/_site/lib/knowledge-schema.js +121 -121
- package/_site/lib/live-gateway.js +78 -78
- package/_site/lib/llm-client.js +12 -12
- package/_site/lib/model-context-windows.js +82 -82
- package/_site/lib/module-bridge.js +874 -874
- package/_site/lib/module-port-resolver.js +57 -57
- package/_site/lib/post-commit-automation.js +54 -54
- package/_site/lib/product-data.js +35 -35
- package/_site/lib/project-lifecycle-service.js +14 -14
- package/_site/lib/project-registry-store.js +129 -129
- package/_site/lib/prompt-registry.js +148 -148
- package/_site/lib/registry-events.js +16 -16
- package/_site/lib/requirement-adapters.js +10 -10
- package/_site/lib/requirement-binder.js +112 -112
- package/_site/lib/runtime-control.js +89 -89
- package/_site/lib/runtime-endpoint.js +5 -5
- package/_site/lib/zcode-context-integration.js +60 -60
- package/_site/scripts/codex-notify-fanout.cjs +95 -95
- package/_site/scripts/install-module-candidates.js +69 -69
- package/_site/scripts/pack-module-candidates.js +89 -89
- package/_site/scripts/sync-product-content.js +28 -28
- package/_site/scripts/sync-release-version.js +164 -164
- package/_site/scripts/vendor-modules.js +49 -49
- package/_site/scripts/verify-module-runtime.js +50 -50
- package/_site/scripts/verify-product-runtime.js +36 -36
- package/_site/scripts/verify-retrieval-gold.js +83 -83
- package/_site/server.js +15 -15
- package/_site/start.bat +26 -26
- package/_site/stop.bat +11 -11
- package/bin/project-knowledge-integrations.js +254 -254
- package/bin/project-knowledge-kb.js +67 -67
- package/bin/project-knowledge-mcp.js +8 -8
- package/bin/project-knowledge.js +170 -170
- package/claude-prompts.json +21 -21
- package/docs/README.zh-CN.md +205 -205
- package/docs/assets/architecture.svg +181 -181
- package/docs/assets/logo.svg +49 -49
- package/docs/fresh-v5-start.md +42 -42
- package/docs/leader-glm-workbench-playbook.md +122 -122
- package/docs/project-registry-schema.md +11 -11
- package/docs/release-5.0.16-acceptance.md +176 -176
- package/docs/release-5.0.17-acceptance.md +117 -117
- package/docs/release-5.0.19-acceptance.md +39 -25
- package/docs/team-knowledge-mode-a-plan.md +73 -73
- package/module-runtime-manifest.json +53 -33
- package/package.json +3 -2
- 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/plugins/project-knowledge/opencode/project-knowledge.md +3 -3
- package/plugins/project-knowledge/skills/project-knowledge/SKILL.md +28 -28
- package/templates/change.md +30 -30
- package/templates/project-readme.md +18 -18
- package/ui/index.html +1 -1
- package/ui/knowledge-panel.html +118 -0
- package/ui/product.css +8 -0
- package/ui/product.js +146 -4
- package/vendor-manifest.json +55 -54
|
@@ -1,187 +1,187 @@
|
|
|
1
|
-
// Run: node _site/_test/cross-repo-isolation-e2e-test.js
|
|
2
|
-
//
|
|
3
|
-
// GATE CROSS-REPO-001 end to end with real Git workspaces and the real
|
|
4
|
-
// Bridge journal: CCS imported / CCB unimported, commit boundary ordering
|
|
5
|
-
// (append -> drainThrough -> writeBoundary -> bind), no CCB substitution.
|
|
6
|
-
// Also covers CROSS-REPO-002 (same remote, different clones), WORKTREE-001
|
|
7
|
-
// and NESTED-CWD-001 at the consumer level.
|
|
8
|
-
|
|
9
|
-
const assert = require('assert');
|
|
10
|
-
const fs = require('fs');
|
|
11
|
-
const os = require('os');
|
|
12
|
-
const path = require('path');
|
|
13
|
-
const { execSync } = require('child_process');
|
|
14
|
-
const { StorageLayout } = require('../lib/storage-layout');
|
|
15
|
-
const { ProjectRegistryStore } = require('../lib/project-registry-store');
|
|
16
|
-
const { ProjectStore } = require('../lib/project-store');
|
|
17
|
-
const { ConversationStore } = require('../lib/conversation-store');
|
|
18
|
-
const { BridgeAdapter } = require('../lib/bridge-adapter');
|
|
19
|
-
const { BridgeConsumerService } = require('../lib/bridge-consumer-service');
|
|
20
|
-
const { CommitConversationBinder } = require('../lib/commit-conversation-binder');
|
|
21
|
-
const claudeConnector = require('@sanqianx/ai-coding-event-bridge-console/src/bridge').claudeHookEntry;
|
|
22
|
-
const bridgeModule = require('@sanqianx/ai-coding-event-bridge-console/src/bridge');
|
|
23
|
-
|
|
24
|
-
const temp = fs.mkdtempSync(path.join(os.tmpdir(), `kb-cross-repo-e2e-${process.pid}-`));
|
|
25
|
-
const layout = new StorageLayout({ dataDir: path.join(temp, 'data') });
|
|
26
|
-
const registry = new ProjectRegistryStore({ layout });
|
|
27
|
-
const projects = new ProjectStore({ layout });
|
|
28
|
-
const bridgeHome = path.join(temp, 'bridge-home');
|
|
29
|
-
const adapter = new BridgeAdapter({ dataDir: layout.dataDir, bridgeModule, bridgeHomeDir: bridgeHome });
|
|
30
|
-
const store = new ConversationStore({ layout, projectStore: projects, logger: null });
|
|
31
|
-
const service = new BridgeConsumerService({
|
|
32
|
-
bridgeAdapter: adapter, conversationStore: store, registryStore: registry, projectStore: projects, logger: null,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
function git(dir, args) {
|
|
36
|
-
execSync(`git ${args.map(value => `"${value.replace(/"/g, '\\"')}"`).join(' ')}`, { cwd: dir, stdio: 'ignore' });
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function makeRepo(name, origin) {
|
|
40
|
-
const dir = path.join(temp, name);
|
|
41
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
42
|
-
git(dir, ['init', '-q']);
|
|
43
|
-
git(dir, ['config', 'user.email', 'e2e@example.test']);
|
|
44
|
-
git(dir, ['config', 'user.name', 'E2E Test']);
|
|
45
|
-
if (origin) git(dir, ['remote', 'add', 'origin', origin]);
|
|
46
|
-
fs.writeFileSync(path.join(dir, 'README.md'), `# ${name}\n`);
|
|
47
|
-
git(dir, ['add', '.']);
|
|
48
|
-
git(dir, ['commit', '-q', '-m', 'init']);
|
|
49
|
-
return dir;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
function commitFile(repo, name, content) {
|
|
53
|
-
fs.writeFileSync(path.join(repo, `${name}.txt`), `${content}\n`);
|
|
54
|
-
git(repo, ['add', '.']);
|
|
55
|
-
git(repo, ['commit', '-q', '-m', name]);
|
|
56
|
-
return execSync('git rev-parse HEAD', { cwd: repo, encoding: 'utf8' }).trim();
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// External Claude session in a workspace: UserPromptSubmit + Stop payloads.
|
|
60
|
-
async function externalClaudeTurn(repoDir, sessionId, prompt, reply) {
|
|
61
|
-
const user = await claudeConnector.main({
|
|
62
|
-
home: bridgeHome,
|
|
63
|
-
payload: { hookName: 'UserPromptSubmit', session_id: sessionId, cwd: repoDir, prompt },
|
|
64
|
-
});
|
|
65
|
-
const assistant = await claudeConnector.main({
|
|
66
|
-
home: bridgeHome,
|
|
67
|
-
payload: { hookName: 'Stop', session_id: sessionId, cwd: repoDir, last_assistant_message: reply },
|
|
68
|
-
});
|
|
69
|
-
return { user, assistant };
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
async function importProject(projectId, repoDir) {
|
|
73
|
-
const identity = (await bridgeModule.resolveRepoContext(repoDir)).repoIdentity;
|
|
74
|
-
const watermark = await adapter.getHighWatermark({});
|
|
75
|
-
await projects.create(projectId, {
|
|
76
|
-
storageName: projectId, displayName: projectId,
|
|
77
|
-
repoPath: repoDir, knowledgePath: path.join(temp, 'knowledge', projectId),
|
|
78
|
-
repoIdentity: identity,
|
|
79
|
-
}, { conversationBaselineCursor: watermark.status === 'captured' ? watermark.cursor : null });
|
|
80
|
-
await registry.add(projectId, { displayName: projectId });
|
|
81
|
-
return identity;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// T13 ordering for one commit: boundary append -> drainThrough -> project
|
|
85
|
-
// boundary freeze -> binder bind (the reconcile/analyzer tail is owned by the
|
|
86
|
-
// hook path and covered by full-integration-e2e-test).
|
|
87
|
-
async function boundaryAndBind(projectId, repoDir, commitSha, identity) {
|
|
88
|
-
const boundaryResult = await adapter.appendCommitBoundary({
|
|
89
|
-
projectId,
|
|
90
|
-
repoIdentity: identity,
|
|
91
|
-
commitSha,
|
|
92
|
-
parentShas: [],
|
|
93
|
-
branch: 'main',
|
|
94
|
-
committedAt: new Date().toISOString(),
|
|
95
|
-
operationId: `op-e2e-${commitSha.slice(0, 8)}`,
|
|
96
|
-
});
|
|
97
|
-
assert.strictEqual(boundaryResult.status, 'captured');
|
|
98
|
-
const boundary = boundaryResult.boundary;
|
|
99
|
-
await service.drainThrough(boundary.journalSequence, 'commit-boundary');
|
|
100
|
-
store.writeBoundary(projectId, boundary);
|
|
101
|
-
const binder = new CommitConversationBinder({ layout, projectStore: projects, conversationStore: store });
|
|
102
|
-
return binder.bind({ projectId, commitSha });
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
(async () => {
|
|
106
|
-
await registry.initialize();
|
|
107
|
-
const ccs = makeRepo('CCS', 'git@github.com:acme/ccs.git');
|
|
108
|
-
const ccb = makeRepo('CCB', 'git@github.com:acme/ccb.git');
|
|
109
|
-
|
|
110
|
-
const ccsIdentity = await importProject('project-ccs', ccs);
|
|
111
|
-
const ccbIdentity = (await bridgeModule.resolveRepoContext(ccb)).repoIdentity;
|
|
112
|
-
assert.notStrictEqual(ccsIdentity.workspaceId, ccbIdentity.workspaceId);
|
|
113
|
-
await service.start();
|
|
114
|
-
|
|
115
|
-
// Phase A — develop in unimported CCB.
|
|
116
|
-
await externalClaudeTurn(ccb, 'ccb-session-1', 'Modify CCB parser', 'CCB parser modified');
|
|
117
|
-
await service.drain('notify');
|
|
118
|
-
assert.deepStrictEqual(store.readEvents('project-ccs'), [], 'CCS ConversationStore stays empty');
|
|
119
|
-
assert.ok(!fs.existsSync(path.dirname(layout.getProjectConversationEventsPath('project-ccb'))),
|
|
120
|
-
'no Project-Knowledge CCB conversation store is created merely because Bridge observed CCB');
|
|
121
|
-
const consumerAfterCcb = await adapter.getConsumer('project-knowledge');
|
|
122
|
-
assert.ok(consumerAfterCcb.consumer.ack > 0, 'consumer ACK advanced through the deterministically skipped CCB events');
|
|
123
|
-
|
|
124
|
-
// Phase B — develop in imported CCS (from a nested directory: NESTED-CWD-001).
|
|
125
|
-
fs.mkdirSync(path.join(ccs, 'modules', 'foo'), { recursive: true });
|
|
126
|
-
const nestedTurn = await externalClaudeTurn(path.join(ccs, 'modules', 'foo'), 'ccs-session-1', 'Modify CCS autofocus', 'CCS autofocus modified');
|
|
127
|
-
await service.drain('notify');
|
|
128
|
-
const ccsEvents = store.readEvents('project-ccs');
|
|
129
|
-
assert.strictEqual(ccsEvents.length, 2, 'exactly the CCS turn is projected');
|
|
130
|
-
assert.ok(ccsEvents.every(event => event.repoIdentity.workspaceId === ccsIdentity.workspaceId),
|
|
131
|
-
'nested-cwd conversation resolves to the CCS workspace');
|
|
132
|
-
assert.strictEqual(ccsEvents[0].turnId, nestedTurn.user.turnId, 'user + assistant share one durable turnId');
|
|
133
|
-
assert.ok(!ccsEvents.some(event => event.content.includes('CCB')), 'no CCB content leaked into CCS');
|
|
134
|
-
|
|
135
|
-
// Phase C — commit CCS and freeze the snapshot.
|
|
136
|
-
const commitC = commitFile(ccs, 'ccs-change', 'autofocus fix');
|
|
137
|
-
const snapshotC = await boundaryAndBind('project-ccs', ccs, commitC, ccsIdentity);
|
|
138
|
-
assert.strictEqual(snapshotC.projectId, 'project-ccs');
|
|
139
|
-
assert.strictEqual(snapshotC.repoIdentity.workspaceId, ccsIdentity.workspaceId);
|
|
140
|
-
assert.ok(JSON.stringify(snapshotC).includes('Modify CCS autofocus'), 'snapshot contains the CCS turn');
|
|
141
|
-
assert.ok(!JSON.stringify(snapshotC).includes('Modify CCB parser'), 'snapshot never contains the CCB conversation');
|
|
142
|
-
assert.ok(snapshotC.turns.some(turn => turn.userEvents.length === 1 && turn.assistantEvents.length === 1),
|
|
143
|
-
'full turn (user + assistant) bound inside the boundary');
|
|
144
|
-
|
|
145
|
-
// Phase D — second CCS commit right after fresh CCB conversation.
|
|
146
|
-
await externalClaudeTurn(ccb, 'ccb-session-2', 'Another CCB task', 'CCB task done');
|
|
147
|
-
const commitD = commitFile(ccs, 'ccs-second', 'unrelated change');
|
|
148
|
-
const snapshotD = await boundaryAndBind('project-ccs', ccs, commitD, ccsIdentity);
|
|
149
|
-
assert.strictEqual(snapshotD.status, 'no-new-user-prompt', 'deterministic no-evidence status');
|
|
150
|
-
assert.ok(!JSON.stringify(snapshotD).includes('Another CCB task'), 'recent CCB conversation is never substituted');
|
|
151
|
-
|
|
152
|
-
// CROSS-REPO-002 — same remote, different clones.
|
|
153
|
-
const cloneA = makeRepo('clone-a', 'git@github.com:acme/ccs.git');
|
|
154
|
-
const cloneB = makeRepo('clone-b', 'git@github.com:acme/ccs.git');
|
|
155
|
-
const identityA = (await bridgeModule.resolveRepoContext(cloneA)).repoIdentity;
|
|
156
|
-
const identityB = (await bridgeModule.resolveRepoContext(cloneB)).repoIdentity;
|
|
157
|
-
assert.strictEqual(identityA.remote, ccsIdentity.remote, 'remotes are equal');
|
|
158
|
-
assert.notStrictEqual(identityA.workspaceId, identityB.workspaceId, 'workspace identity differs');
|
|
159
|
-
await importProject('project-clone-a', cloneA);
|
|
160
|
-
await externalClaudeTurn(cloneB, 'clone-b-session', 'work in clone B', 'clone B reply');
|
|
161
|
-
await service.drain('notify');
|
|
162
|
-
assert.deepStrictEqual(store.readEvents('project-clone-a'), [], 'clone B conversation never enters the clone A project');
|
|
163
|
-
assert.ok(!fs.existsSync(layout.getProjectConversationEventsPath('project-clone-b')) || store.readEvents('project-clone-b').length === 0,
|
|
164
|
-
'unimported clone B has no projected conversation');
|
|
165
|
-
|
|
166
|
-
// WORKTREE-001 — shared commonDir, distinct workspaceIds, no cross-binding.
|
|
167
|
-
const wtMain = makeRepo('wt-main', 'git@github.com:acme/wt.git');
|
|
168
|
-
fs.mkdirSync(path.join(temp, 'wt-holder'), { recursive: true });
|
|
169
|
-
const wtA = path.join(temp, 'wt-holder', 'wt-a');
|
|
170
|
-
const wtB = path.join(temp, 'wt-holder', 'wt-b');
|
|
171
|
-
git(wtMain, ['worktree', 'add', '-q', wtA, 'HEAD']);
|
|
172
|
-
git(wtMain, ['worktree', 'add', '-q', wtB, 'HEAD']);
|
|
173
|
-
const wtMainIdentity = (await bridgeModule.resolveRepoContext(wtMain)).repoIdentity;
|
|
174
|
-
const wtAIdentity = (await bridgeModule.resolveRepoContext(wtA)).repoIdentity;
|
|
175
|
-
const wtBIdentity = (await bridgeModule.resolveRepoContext(wtB)).repoIdentity;
|
|
176
|
-
assert.strictEqual(wtAIdentity.commonDir, wtMainIdentity.commonDir, 'worktrees share commonDir');
|
|
177
|
-
assert.notStrictEqual(wtAIdentity.workspaceId, wtBIdentity.workspaceId);
|
|
178
|
-
await importProject('project-wt-a', wtA);
|
|
179
|
-
await externalClaudeTurn(wtB, 'wt-b-session', 'work in worktree B', 'worktree B reply');
|
|
180
|
-
await service.drain('notify');
|
|
181
|
-
assert.deepStrictEqual(store.readEvents('project-wt-a'), [], 'worktree B conversation is not auto-bound to worktree A');
|
|
182
|
-
|
|
183
|
-
console.log('cross-repo-isolation-e2e-test PASS');
|
|
184
|
-
})().catch(error => {
|
|
185
|
-
console.error(error.stack || error.message);
|
|
186
|
-
process.exitCode = 1;
|
|
187
|
-
});
|
|
1
|
+
// Run: node _site/_test/cross-repo-isolation-e2e-test.js
|
|
2
|
+
//
|
|
3
|
+
// GATE CROSS-REPO-001 end to end with real Git workspaces and the real
|
|
4
|
+
// Bridge journal: CCS imported / CCB unimported, commit boundary ordering
|
|
5
|
+
// (append -> drainThrough -> writeBoundary -> bind), no CCB substitution.
|
|
6
|
+
// Also covers CROSS-REPO-002 (same remote, different clones), WORKTREE-001
|
|
7
|
+
// and NESTED-CWD-001 at the consumer level.
|
|
8
|
+
|
|
9
|
+
const assert = require('assert');
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const os = require('os');
|
|
12
|
+
const path = require('path');
|
|
13
|
+
const { execSync } = require('child_process');
|
|
14
|
+
const { StorageLayout } = require('../lib/storage-layout');
|
|
15
|
+
const { ProjectRegistryStore } = require('../lib/project-registry-store');
|
|
16
|
+
const { ProjectStore } = require('../lib/project-store');
|
|
17
|
+
const { ConversationStore } = require('../lib/conversation-store');
|
|
18
|
+
const { BridgeAdapter } = require('../lib/bridge-adapter');
|
|
19
|
+
const { BridgeConsumerService } = require('../lib/bridge-consumer-service');
|
|
20
|
+
const { CommitConversationBinder } = require('../lib/commit-conversation-binder');
|
|
21
|
+
const claudeConnector = require('@sanqianx/ai-coding-event-bridge-console/src/bridge').claudeHookEntry;
|
|
22
|
+
const bridgeModule = require('@sanqianx/ai-coding-event-bridge-console/src/bridge');
|
|
23
|
+
|
|
24
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), `kb-cross-repo-e2e-${process.pid}-`));
|
|
25
|
+
const layout = new StorageLayout({ dataDir: path.join(temp, 'data') });
|
|
26
|
+
const registry = new ProjectRegistryStore({ layout });
|
|
27
|
+
const projects = new ProjectStore({ layout });
|
|
28
|
+
const bridgeHome = path.join(temp, 'bridge-home');
|
|
29
|
+
const adapter = new BridgeAdapter({ dataDir: layout.dataDir, bridgeModule, bridgeHomeDir: bridgeHome });
|
|
30
|
+
const store = new ConversationStore({ layout, projectStore: projects, logger: null });
|
|
31
|
+
const service = new BridgeConsumerService({
|
|
32
|
+
bridgeAdapter: adapter, conversationStore: store, registryStore: registry, projectStore: projects, logger: null,
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function git(dir, args) {
|
|
36
|
+
execSync(`git ${args.map(value => `"${value.replace(/"/g, '\\"')}"`).join(' ')}`, { cwd: dir, stdio: 'ignore' });
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
function makeRepo(name, origin) {
|
|
40
|
+
const dir = path.join(temp, name);
|
|
41
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
42
|
+
git(dir, ['init', '-q']);
|
|
43
|
+
git(dir, ['config', 'user.email', 'e2e@example.test']);
|
|
44
|
+
git(dir, ['config', 'user.name', 'E2E Test']);
|
|
45
|
+
if (origin) git(dir, ['remote', 'add', 'origin', origin]);
|
|
46
|
+
fs.writeFileSync(path.join(dir, 'README.md'), `# ${name}\n`);
|
|
47
|
+
git(dir, ['add', '.']);
|
|
48
|
+
git(dir, ['commit', '-q', '-m', 'init']);
|
|
49
|
+
return dir;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function commitFile(repo, name, content) {
|
|
53
|
+
fs.writeFileSync(path.join(repo, `${name}.txt`), `${content}\n`);
|
|
54
|
+
git(repo, ['add', '.']);
|
|
55
|
+
git(repo, ['commit', '-q', '-m', name]);
|
|
56
|
+
return execSync('git rev-parse HEAD', { cwd: repo, encoding: 'utf8' }).trim();
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// External Claude session in a workspace: UserPromptSubmit + Stop payloads.
|
|
60
|
+
async function externalClaudeTurn(repoDir, sessionId, prompt, reply) {
|
|
61
|
+
const user = await claudeConnector.main({
|
|
62
|
+
home: bridgeHome,
|
|
63
|
+
payload: { hookName: 'UserPromptSubmit', session_id: sessionId, cwd: repoDir, prompt },
|
|
64
|
+
});
|
|
65
|
+
const assistant = await claudeConnector.main({
|
|
66
|
+
home: bridgeHome,
|
|
67
|
+
payload: { hookName: 'Stop', session_id: sessionId, cwd: repoDir, last_assistant_message: reply },
|
|
68
|
+
});
|
|
69
|
+
return { user, assistant };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async function importProject(projectId, repoDir) {
|
|
73
|
+
const identity = (await bridgeModule.resolveRepoContext(repoDir)).repoIdentity;
|
|
74
|
+
const watermark = await adapter.getHighWatermark({});
|
|
75
|
+
await projects.create(projectId, {
|
|
76
|
+
storageName: projectId, displayName: projectId,
|
|
77
|
+
repoPath: repoDir, knowledgePath: path.join(temp, 'knowledge', projectId),
|
|
78
|
+
repoIdentity: identity,
|
|
79
|
+
}, { conversationBaselineCursor: watermark.status === 'captured' ? watermark.cursor : null });
|
|
80
|
+
await registry.add(projectId, { displayName: projectId });
|
|
81
|
+
return identity;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// T13 ordering for one commit: boundary append -> drainThrough -> project
|
|
85
|
+
// boundary freeze -> binder bind (the reconcile/analyzer tail is owned by the
|
|
86
|
+
// hook path and covered by full-integration-e2e-test).
|
|
87
|
+
async function boundaryAndBind(projectId, repoDir, commitSha, identity) {
|
|
88
|
+
const boundaryResult = await adapter.appendCommitBoundary({
|
|
89
|
+
projectId,
|
|
90
|
+
repoIdentity: identity,
|
|
91
|
+
commitSha,
|
|
92
|
+
parentShas: [],
|
|
93
|
+
branch: 'main',
|
|
94
|
+
committedAt: new Date().toISOString(),
|
|
95
|
+
operationId: `op-e2e-${commitSha.slice(0, 8)}`,
|
|
96
|
+
});
|
|
97
|
+
assert.strictEqual(boundaryResult.status, 'captured');
|
|
98
|
+
const boundary = boundaryResult.boundary;
|
|
99
|
+
await service.drainThrough(boundary.journalSequence, 'commit-boundary');
|
|
100
|
+
store.writeBoundary(projectId, boundary);
|
|
101
|
+
const binder = new CommitConversationBinder({ layout, projectStore: projects, conversationStore: store });
|
|
102
|
+
return binder.bind({ projectId, commitSha });
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
(async () => {
|
|
106
|
+
await registry.initialize();
|
|
107
|
+
const ccs = makeRepo('CCS', 'git@github.com:acme/ccs.git');
|
|
108
|
+
const ccb = makeRepo('CCB', 'git@github.com:acme/ccb.git');
|
|
109
|
+
|
|
110
|
+
const ccsIdentity = await importProject('project-ccs', ccs);
|
|
111
|
+
const ccbIdentity = (await bridgeModule.resolveRepoContext(ccb)).repoIdentity;
|
|
112
|
+
assert.notStrictEqual(ccsIdentity.workspaceId, ccbIdentity.workspaceId);
|
|
113
|
+
await service.start();
|
|
114
|
+
|
|
115
|
+
// Phase A — develop in unimported CCB.
|
|
116
|
+
await externalClaudeTurn(ccb, 'ccb-session-1', 'Modify CCB parser', 'CCB parser modified');
|
|
117
|
+
await service.drain('notify');
|
|
118
|
+
assert.deepStrictEqual(store.readEvents('project-ccs'), [], 'CCS ConversationStore stays empty');
|
|
119
|
+
assert.ok(!fs.existsSync(path.dirname(layout.getProjectConversationEventsPath('project-ccb'))),
|
|
120
|
+
'no Project-Knowledge CCB conversation store is created merely because Bridge observed CCB');
|
|
121
|
+
const consumerAfterCcb = await adapter.getConsumer('project-knowledge');
|
|
122
|
+
assert.ok(consumerAfterCcb.consumer.ack > 0, 'consumer ACK advanced through the deterministically skipped CCB events');
|
|
123
|
+
|
|
124
|
+
// Phase B — develop in imported CCS (from a nested directory: NESTED-CWD-001).
|
|
125
|
+
fs.mkdirSync(path.join(ccs, 'modules', 'foo'), { recursive: true });
|
|
126
|
+
const nestedTurn = await externalClaudeTurn(path.join(ccs, 'modules', 'foo'), 'ccs-session-1', 'Modify CCS autofocus', 'CCS autofocus modified');
|
|
127
|
+
await service.drain('notify');
|
|
128
|
+
const ccsEvents = store.readEvents('project-ccs');
|
|
129
|
+
assert.strictEqual(ccsEvents.length, 2, 'exactly the CCS turn is projected');
|
|
130
|
+
assert.ok(ccsEvents.every(event => event.repoIdentity.workspaceId === ccsIdentity.workspaceId),
|
|
131
|
+
'nested-cwd conversation resolves to the CCS workspace');
|
|
132
|
+
assert.strictEqual(ccsEvents[0].turnId, nestedTurn.user.turnId, 'user + assistant share one durable turnId');
|
|
133
|
+
assert.ok(!ccsEvents.some(event => event.content.includes('CCB')), 'no CCB content leaked into CCS');
|
|
134
|
+
|
|
135
|
+
// Phase C — commit CCS and freeze the snapshot.
|
|
136
|
+
const commitC = commitFile(ccs, 'ccs-change', 'autofocus fix');
|
|
137
|
+
const snapshotC = await boundaryAndBind('project-ccs', ccs, commitC, ccsIdentity);
|
|
138
|
+
assert.strictEqual(snapshotC.projectId, 'project-ccs');
|
|
139
|
+
assert.strictEqual(snapshotC.repoIdentity.workspaceId, ccsIdentity.workspaceId);
|
|
140
|
+
assert.ok(JSON.stringify(snapshotC).includes('Modify CCS autofocus'), 'snapshot contains the CCS turn');
|
|
141
|
+
assert.ok(!JSON.stringify(snapshotC).includes('Modify CCB parser'), 'snapshot never contains the CCB conversation');
|
|
142
|
+
assert.ok(snapshotC.turns.some(turn => turn.userEvents.length === 1 && turn.assistantEvents.length === 1),
|
|
143
|
+
'full turn (user + assistant) bound inside the boundary');
|
|
144
|
+
|
|
145
|
+
// Phase D — second CCS commit right after fresh CCB conversation.
|
|
146
|
+
await externalClaudeTurn(ccb, 'ccb-session-2', 'Another CCB task', 'CCB task done');
|
|
147
|
+
const commitD = commitFile(ccs, 'ccs-second', 'unrelated change');
|
|
148
|
+
const snapshotD = await boundaryAndBind('project-ccs', ccs, commitD, ccsIdentity);
|
|
149
|
+
assert.strictEqual(snapshotD.status, 'no-new-user-prompt', 'deterministic no-evidence status');
|
|
150
|
+
assert.ok(!JSON.stringify(snapshotD).includes('Another CCB task'), 'recent CCB conversation is never substituted');
|
|
151
|
+
|
|
152
|
+
// CROSS-REPO-002 — same remote, different clones.
|
|
153
|
+
const cloneA = makeRepo('clone-a', 'git@github.com:acme/ccs.git');
|
|
154
|
+
const cloneB = makeRepo('clone-b', 'git@github.com:acme/ccs.git');
|
|
155
|
+
const identityA = (await bridgeModule.resolveRepoContext(cloneA)).repoIdentity;
|
|
156
|
+
const identityB = (await bridgeModule.resolveRepoContext(cloneB)).repoIdentity;
|
|
157
|
+
assert.strictEqual(identityA.remote, ccsIdentity.remote, 'remotes are equal');
|
|
158
|
+
assert.notStrictEqual(identityA.workspaceId, identityB.workspaceId, 'workspace identity differs');
|
|
159
|
+
await importProject('project-clone-a', cloneA);
|
|
160
|
+
await externalClaudeTurn(cloneB, 'clone-b-session', 'work in clone B', 'clone B reply');
|
|
161
|
+
await service.drain('notify');
|
|
162
|
+
assert.deepStrictEqual(store.readEvents('project-clone-a'), [], 'clone B conversation never enters the clone A project');
|
|
163
|
+
assert.ok(!fs.existsSync(layout.getProjectConversationEventsPath('project-clone-b')) || store.readEvents('project-clone-b').length === 0,
|
|
164
|
+
'unimported clone B has no projected conversation');
|
|
165
|
+
|
|
166
|
+
// WORKTREE-001 — shared commonDir, distinct workspaceIds, no cross-binding.
|
|
167
|
+
const wtMain = makeRepo('wt-main', 'git@github.com:acme/wt.git');
|
|
168
|
+
fs.mkdirSync(path.join(temp, 'wt-holder'), { recursive: true });
|
|
169
|
+
const wtA = path.join(temp, 'wt-holder', 'wt-a');
|
|
170
|
+
const wtB = path.join(temp, 'wt-holder', 'wt-b');
|
|
171
|
+
git(wtMain, ['worktree', 'add', '-q', wtA, 'HEAD']);
|
|
172
|
+
git(wtMain, ['worktree', 'add', '-q', wtB, 'HEAD']);
|
|
173
|
+
const wtMainIdentity = (await bridgeModule.resolveRepoContext(wtMain)).repoIdentity;
|
|
174
|
+
const wtAIdentity = (await bridgeModule.resolveRepoContext(wtA)).repoIdentity;
|
|
175
|
+
const wtBIdentity = (await bridgeModule.resolveRepoContext(wtB)).repoIdentity;
|
|
176
|
+
assert.strictEqual(wtAIdentity.commonDir, wtMainIdentity.commonDir, 'worktrees share commonDir');
|
|
177
|
+
assert.notStrictEqual(wtAIdentity.workspaceId, wtBIdentity.workspaceId);
|
|
178
|
+
await importProject('project-wt-a', wtA);
|
|
179
|
+
await externalClaudeTurn(wtB, 'wt-b-session', 'work in worktree B', 'worktree B reply');
|
|
180
|
+
await service.drain('notify');
|
|
181
|
+
assert.deepStrictEqual(store.readEvents('project-wt-a'), [], 'worktree B conversation is not auto-bound to worktree A');
|
|
182
|
+
|
|
183
|
+
console.log('cross-repo-isolation-e2e-test PASS');
|
|
184
|
+
})().catch(error => {
|
|
185
|
+
console.error(error.stack || error.message);
|
|
186
|
+
process.exitCode = 1;
|
|
187
|
+
});
|
|
@@ -1,32 +1,32 @@
|
|
|
1
|
-
const assert = require('assert');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { StorageLayout } = require('../lib/storage-layout');
|
|
6
|
-
const { SettingsStore } = require('../lib/settings-store');
|
|
7
|
-
|
|
8
|
-
(async () => {
|
|
9
|
-
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'embedding-config-test-'));
|
|
10
|
-
const layout = new StorageLayout({ dataDir: temp });
|
|
11
|
-
const store = new SettingsStore({ layout });
|
|
12
|
-
try {
|
|
13
|
-
const defaults = await store.initialize();
|
|
14
|
-
assert.deepStrictEqual(defaults.embedding, {});
|
|
15
|
-
const saved = await store.updatePatch({
|
|
16
|
-
embedding: {
|
|
17
|
-
modelId: 'Xenova/all-MiniLM-L6-v2',
|
|
18
|
-
remoteHost: 'https://model-mirror.example/',
|
|
19
|
-
localModelPath: 'D:\\models',
|
|
20
|
-
localFilesOnly: true,
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
assert.equal(saved.embedding.remoteHost, 'https://model-mirror.example/');
|
|
24
|
-
assert.equal(store.read().embedding.localModelPath, 'D:\\models');
|
|
25
|
-
assert.equal(store.read().embedding.localFilesOnly, true);
|
|
26
|
-
assert.strictEqual(fs.existsSync(path.join(temp, 'embedding-config.json')), false, 'embedding settings must not use a second live config file');
|
|
27
|
-
assert.strictEqual(fs.existsSync(layout.getSettingsPath()), true);
|
|
28
|
-
console.log('embedding-config-test: PASS');
|
|
29
|
-
} finally {
|
|
30
|
-
fs.rmSync(temp, { recursive: true, force: true });
|
|
31
|
-
}
|
|
32
|
-
})().catch(error => { console.error(error); process.exitCode = 1; });
|
|
1
|
+
const assert = require('assert');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const os = require('os');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const { StorageLayout } = require('../lib/storage-layout');
|
|
6
|
+
const { SettingsStore } = require('../lib/settings-store');
|
|
7
|
+
|
|
8
|
+
(async () => {
|
|
9
|
+
const temp = fs.mkdtempSync(path.join(os.tmpdir(), 'embedding-config-test-'));
|
|
10
|
+
const layout = new StorageLayout({ dataDir: temp });
|
|
11
|
+
const store = new SettingsStore({ layout });
|
|
12
|
+
try {
|
|
13
|
+
const defaults = await store.initialize();
|
|
14
|
+
assert.deepStrictEqual(defaults.embedding, {});
|
|
15
|
+
const saved = await store.updatePatch({
|
|
16
|
+
embedding: {
|
|
17
|
+
modelId: 'Xenova/all-MiniLM-L6-v2',
|
|
18
|
+
remoteHost: 'https://model-mirror.example/',
|
|
19
|
+
localModelPath: 'D:\\models',
|
|
20
|
+
localFilesOnly: true,
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
assert.equal(saved.embedding.remoteHost, 'https://model-mirror.example/');
|
|
24
|
+
assert.equal(store.read().embedding.localModelPath, 'D:\\models');
|
|
25
|
+
assert.equal(store.read().embedding.localFilesOnly, true);
|
|
26
|
+
assert.strictEqual(fs.existsSync(path.join(temp, 'embedding-config.json')), false, 'embedding settings must not use a second live config file');
|
|
27
|
+
assert.strictEqual(fs.existsSync(layout.getSettingsPath()), true);
|
|
28
|
+
console.log('embedding-config-test: PASS');
|
|
29
|
+
} finally {
|
|
30
|
+
fs.rmSync(temp, { recursive: true, force: true });
|
|
31
|
+
}
|
|
32
|
+
})().catch(error => { console.error(error); process.exitCode = 1; });
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Deterministic fake browser: writes its pid to KB_FAKE_BROWSER_PIDFILE,
|
|
2
|
-
// prints a marker to stderr, then exits immediately without exposing CDP.
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const pidFile = process.env.KB_FAKE_BROWSER_PIDFILE;
|
|
6
|
-
if (pidFile) {
|
|
7
|
-
try { fs.writeFileSync(pidFile, String(process.pid)); } catch {}
|
|
8
|
-
}
|
|
9
|
-
process.stderr.write('fake-browser-exit stderr: simulated browser crash before CDP\n');
|
|
10
|
-
process.exit(3);
|
|
1
|
+
// Deterministic fake browser: writes its pid to KB_FAKE_BROWSER_PIDFILE,
|
|
2
|
+
// prints a marker to stderr, then exits immediately without exposing CDP.
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
const pidFile = process.env.KB_FAKE_BROWSER_PIDFILE;
|
|
6
|
+
if (pidFile) {
|
|
7
|
+
try { fs.writeFileSync(pidFile, String(process.pid)); } catch {}
|
|
8
|
+
}
|
|
9
|
+
process.stderr.write('fake-browser-exit stderr: simulated browser crash before CDP\n');
|
|
10
|
+
process.exit(3);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// Deterministic fake browser: writes its pid to KB_FAKE_BROWSER_PIDFILE,
|
|
2
|
-
// stays alive forever, and never exposes a CDP endpoint.
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
|
|
5
|
-
const pidFile = process.env.KB_FAKE_BROWSER_PIDFILE;
|
|
6
|
-
if (pidFile) {
|
|
7
|
-
try { fs.writeFileSync(pidFile, String(process.pid)); } catch {}
|
|
8
|
-
}
|
|
9
|
-
process.stderr.write('fake-browser-hang stderr: alive but CDP never starts\n');
|
|
10
|
-
setInterval(() => {}, 60000);
|
|
1
|
+
// Deterministic fake browser: writes its pid to KB_FAKE_BROWSER_PIDFILE,
|
|
2
|
+
// stays alive forever, and never exposes a CDP endpoint.
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
|
|
5
|
+
const pidFile = process.env.KB_FAKE_BROWSER_PIDFILE;
|
|
6
|
+
if (pidFile) {
|
|
7
|
+
try { fs.writeFileSync(pidFile, String(process.pid)); } catch {}
|
|
8
|
+
}
|
|
9
|
+
process.stderr.write('fake-browser-hang stderr: alive but CDP never starts\n');
|
|
10
|
+
setInterval(() => {}, 60000);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
process.once('message', () => {
|
|
3
|
-
const until = Date.now() + 1200;
|
|
4
|
-
while (Date.now() < until) { /* Reproduce a blocking native status probe outside the HTTP process. */ }
|
|
5
|
-
process.send({ ok: true, summary: { bridge: { ok: true }, clients: [{ client: 'claude', available: true }] } }, () => process.disconnect());
|
|
6
|
-
});
|
|
1
|
+
'use strict';
|
|
2
|
+
process.once('message', () => {
|
|
3
|
+
const until = Date.now() + 1200;
|
|
4
|
+
while (Date.now() < until) { /* Reproduce a blocking native status probe outside the HTTP process. */ }
|
|
5
|
+
process.send({ ok: true, summary: { bridge: { ok: true }, clients: [{ client: 'claude', available: true }] } }, () => process.disconnect());
|
|
6
|
+
});
|