@sanqianx/project-knowledge 5.3.0 → 5.3.2
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 +12 -0
- package/README.md +17 -14
- package/bin/project-knowledge-integrations.js +3 -3
- package/bin/project-knowledge-kb.js +2 -2
- package/bin/project-knowledge-mcp.js +3 -3
- package/bin/project-knowledge.js +5 -5
- package/module-runtime-manifest.json +26 -22
- package/package.json +31 -27
- 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 → resources/ui}/product.css +20 -0
- package/{ui → resources/ui}/product.js +14 -2
- package/{_site → src}/README.md +30 -30
- package/{_site/lib → src/automation}/capture-hook-config.js +1 -1
- package/{_site/lib → src/automation}/commit-conversation-binder.js +4 -4
- package/{_site/lib → src/automation}/commit-processing-ledger.js +27 -27
- package/{_site/lib → src/automation}/commit-reconciler.js +11 -11
- package/{_site/lib → src/automation}/hook-manager.js +203 -203
- package/{_site/lib → src/automation}/post-commit-automation.js +87 -87
- package/{_site/lib → src/common}/atomic-file.js +1 -0
- package/{_site/lib → src/common}/runtime-endpoint.js +153 -160
- package/{_site/lib → src/common}/structured-logger.js +574 -574
- package/{_site/lib → src/conversations}/bridge-adapter.js +2 -2
- package/{_site/lib → src/conversations}/codex-notify-config.js +6 -3
- package/{_site/lib → src/conversations}/conversation-exclusions.js +2 -2
- package/{_site/lib → src/conversations}/conversation-query-service.js +144 -144
- package/{_site/lib → src/conversations}/conversation-store.js +3 -3
- package/{_site/lib → src/conversations}/zcode-context-integration.js +1 -1
- package/{_site/lib → src/integrations}/ai-profile-resolver.js +78 -78
- package/{_site/lib → src/integrations}/ai-workspace.js +101 -101
- package/{_site/lib → src/integrations}/claude-cli-runner.js +1510 -1510
- package/{_site/lib → src/integrations}/integration-installer.js +11 -15
- package/{_site/lib → src/integrations}/llm-client.js +161 -161
- package/{_site/lib → src/knowledge}/context-pack-builder.js +3 -3
- package/{_site/lib → src/knowledge}/evidence-bundle.js +2 -2
- package/{_site/lib → src/knowledge}/index-service.js +173 -173
- package/{_site/lib → src/knowledge}/kb-framework.js +171 -191
- package/{_site/lib → src/knowledge}/knowledge-promotion.js +6 -6
- package/{_site/lib → src/knowledge}/knowledge-retrieval-service.js +401 -401
- package/{_site/lib → src/module_bridge}/engine-connection.js +2 -2
- package/{_site/lib → src/module_bridge}/engine-knowledge-client.js +3 -3
- package/{_site/lib → src/module_bridge}/module-bridge.js +9 -9
- package/{_site/lib → src/projects}/github-team-store.js +1172 -1172
- package/{_site/lib → src/projects}/project-lifecycle-service.js +5 -5
- package/{_site/lib → src/projects}/project-registry-store.js +3 -3
- package/{_site/lib → src/projects}/project-store.js +268 -268
- package/{_site/lib → src/projects}/scanner.js +3 -3
- package/{_site/lib → src/projects}/settings-store.js +3 -3
- package/{_site → src}/scripts/ab-rank-v2-v3.js +4 -4
- package/{_site → src}/scripts/hook-trigger.js +158 -158
- package/{_site → src}/scripts/install-module-candidates.js +2 -2
- package/{_site → src}/scripts/pack-module-candidates.js +2 -2
- package/{_site → src}/scripts/refresh-runtime-manifest.js +1 -1
- package/{_site → src}/scripts/run-retrieval-gold-isolated.js +6 -6
- package/{_site → src}/scripts/sync-product-content.js +2 -2
- package/{_site → src}/scripts/verify-product-runtime.js +3 -3
- package/{_site → src}/scripts/verify-retrieval-gold.js +1 -1
- package/{_site/lib → src/server}/product-data.js +2 -2
- package/{_site/lib → src/server}/server-app.js +40 -40
- package/{_site/lib → src/server}/storage-layout.js +166 -166
- package/{_site → src}/server.js +1 -1
- package/{_site/lib → src/tools}/knowledge-tool-runtime.js +366 -366
- package/{_site/lib → src/tools}/prompt-registry.js +1 -1
- package/{_site/lib → src/tools}/requirement-adapters.js +1 -1
- package/{_site/lib → src/tools}/requirement-binder.js +4 -4
- package/{_site/lib → src/tools}/requirement-recorder.js +278 -278
- package/{_site/lib → src/tools}/workflow-tool-runtime.js +3 -3
- package/_site/_test/agent-capture-mcp-ui-test.js +0 -118
- package/_site/_test/agent-capture-ui-test.js +0 -103
- package/_site/_test/ai-profile-resolver-test.js +0 -137
- package/_site/_test/ai-profile-test.js +0 -75
- package/_site/_test/ai-vendor-presets-test.js +0 -91
- package/_site/_test/appearance-settings-test.js +0 -148
- package/_site/_test/automatic-context-test.js +0 -95
- package/_site/_test/automation-queue-test.js +0 -14
- package/_site/_test/automation-ui-test.js +0 -40
- package/_site/_test/background-task-registry-test.js +0 -43
- package/_site/_test/baseline-schema-test.js +0 -91
- package/_site/_test/bin-cli-test.js +0 -231
- package/_site/_test/bridge-adapter-test.js +0 -95
- package/_site/_test/bridge-consumer-service-test.js +0 -310
- package/_site/_test/candidate-bin-content-test.js +0 -35
- package/_site/_test/candidate-product-assets-test.js +0 -13
- package/_site/_test/candidate-release-contract-test.js +0 -14
- package/_site/_test/capture-hook-dedup-test.js +0 -198
- package/_site/_test/cdp-browser-failure-test.js +0 -103
- package/_site/_test/chat-claudecodeui-match-test.js +0 -111
- package/_site/_test/claude-executable-discovery-test.js +0 -90
- package/_site/_test/claude-session-lifecycle-sweep-test.js +0 -252
- package/_site/_test/claude-workbench-test.js +0 -174
- package/_site/_test/cli-instance-management-test.js +0 -62
- package/_site/_test/cli-version-report-test.js +0 -22
- package/_site/_test/client-capture-restart-e2e-test.js +0 -189
- package/_site/_test/codex-conversation-projection-test.js +0 -60
- package/_site/_test/codex-marketplace-scoped-path-test.js +0 -186
- package/_site/_test/codex-notify-capture-e2e-test.js +0 -101
- package/_site/_test/codex-notify-fanout-test.js +0 -141
- package/_site/_test/codex-notify-upgrade-test.js +0 -260
- package/_site/_test/commit-boundary-freeze-test.js +0 -147
- package/_site/_test/commit-conversation-binding-test.js +0 -99
- package/_site/_test/commit-evidence-test.js +0 -110
- package/_site/_test/configuration-generation-test.js +0 -22
- package/_site/_test/context-pack-test.js +0 -200
- package/_site/_test/context-session-index-test.js +0 -254
- package/_site/_test/conversation-api-test.js +0 -119
- package/_site/_test/conversation-origin-test.js +0 -15
- package/_site/_test/conversation-store-test.js +0 -138
- package/_site/_test/cross-repo-isolation-e2e-test.js +0 -187
- package/_site/_test/desktop-browser-compat-test.js +0 -28
- package/_site/_test/desktop-hook-runtime-regression-test.js +0 -204
- package/_site/_test/embedding-config-test.js +0 -32
- package/_site/_test/explicit-commit-processor-test.js +0 -37
- package/_site/_test/fixtures/fake-browser-exit.js +0 -10
- package/_site/_test/fixtures/fake-browser-hang.js +0 -10
- package/_site/_test/fixtures/integration-busy-worker.cjs +0 -14
- package/_site/_test/fixtures/make-git-repos.js +0 -92
- package/_site/_test/fixtures/retrieval-gold-queries.json +0 -36
- package/_site/_test/fixtures/slow-startup-integration.cjs +0 -12
- package/_site/_test/fixtures/startup-repair-worker.cjs +0 -13
- package/_site/_test/folder-picker-output-test.js +0 -19
- package/_site/_test/fresh-hook-reimport-test.js +0 -53
- package/_site/_test/fresh-product-data-test.js +0 -56
- package/_site/_test/full-integration-e2e-test.js +0 -167
- package/_site/_test/git-path-compatibility-test.js +0 -80
- package/_site/_test/git-validation-test.js +0 -81
- package/_site/_test/glm-ui-refresh-review-test.js +0 -313
- package/_site/_test/harness-isolation-test.js +0 -138
- package/_site/_test/helpers/cdp-browser.js +0 -386
- package/_site/_test/helpers/cdp-network-capture.js +0 -66
- package/_site/_test/helpers/find-chrome.js +0 -34
- package/_site/_test/helpers/free-port.js +0 -8
- package/_site/_test/helpers/logging-ui-fixture.js +0 -131
- package/_site/_test/helpers/module-fixture.js +0 -282
- package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +0 -606
- package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +0 -464
- package/_site/_test/helpers/parallel-dock-acceptance-env.js +0 -301
- package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +0 -378
- package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +0 -314
- package/_site/_test/helpers/parallel-dock-acceptance-ui.js +0 -195
- package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +0 -113
- package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +0 -307
- package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +0 -373
- package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +0 -314
- package/_site/_test/helpers/parallel-engine-advanced-engine-child.js +0 -45
- package/_site/_test/helpers/parallel-engine-advanced-fault-writer.js +0 -171
- package/_site/_test/helpers/parallel-engine-advanced-harness.js +0 -245
- package/_site/_test/helpers/parallel-engine-advanced-standin-analyzer.js +0 -80
- package/_site/_test/helpers/parallel-engine-advanced-ui-host.js +0 -177
- package/_site/_test/helpers/parallel-engine-final-harness.js +0 -314
- package/_site/_test/helpers/parallel-engine-final-standin-analyzer.js +0 -159
- package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +0 -340
- package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +0 -82
- package/_site/_test/helpers/parallel-knowledge-fixture.js +0 -255
- package/_site/_test/helpers/parallel-logging-acceptance-fixture.js +0 -111
- package/_site/_test/helpers/parallel-logging-acceptance-proxy.js +0 -106
- package/_site/_test/helpers/parallel-logging-fix-r2-proxy.js +0 -205
- package/_site/_test/helpers/parallel-logging-integration-5025-env.js +0 -432
- package/_site/_test/helpers/parallel-memory-analyzer.js +0 -81
- package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +0 -605
- package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +0 -176
- package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +0 -577
- package/_site/_test/helpers/parallel-memory-event-bridge.js +0 -128
- package/_site/_test/helpers/parallel-memory-injection-shell.js +0 -723
- package/_site/_test/helpers/parallel-memory-injection-wb-host.js +0 -81
- package/_site/_test/helpers/parallel-memory-shell.js +0 -489
- package/_site/_test/helpers/parallel-nav-isolation-env.js +0 -389
- package/_site/_test/helpers/parallel-nav-module-ui.js +0 -186
- package/_site/_test/helpers/parallel-nav-proxy.js +0 -148
- package/_site/_test/helpers/parallel-nav-shell.js +0 -361
- package/_site/_test/helpers/parallel-qa-engine-endpoint-guard.js +0 -206
- package/_site/_test/helpers/parallel-qa-engine-endpoint-isolate.js +0 -259
- package/_site/_test/helpers/parallel-retrieval-followup-corpus.js +0 -293
- package/_site/_test/helpers/parallel-retrieval-followup-next-session.js +0 -70
- package/_site/_test/helpers/parallel-retrieval-followup-r2-shell.js +0 -737
- package/_site/_test/helpers/parallel-retrieval-followup-r2-wb-host.js +0 -82
- package/_site/_test/helpers/parallel-retrieval-followup-shell.js +0 -279
- package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +0 -295
- package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +0 -573
- package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +0 -69
- package/_site/_test/helpers/parallel-workbench-fixture.js +0 -371
- package/_site/_test/helpers/parallel-workbench-host.js +0 -80
- package/_site/_test/helpers/parallel-workbench-integration-5025-fixture.js +0 -408
- package/_site/_test/helpers/parallel-workbench-integration-5025-harness.js +0 -593
- package/_site/_test/helpers/parallel-workbench-integration-5025-host.js +0 -70
- package/_site/_test/helpers/parallel-workbench-integration-5025-launcher.js +0 -240
- package/_site/_test/helpers/parallel-workbench-integration-5025-runtime-harness.js +0 -630
- package/_site/_test/helpers/parallel-workbench-runtime-harness.js +0 -587
- package/_site/_test/helpers/parallel-workbench-source-map.js +0 -196
- package/_site/_test/helpers/qa-r44-env.js +0 -418
- package/_site/_test/helpers/qa-r44-report.js +0 -656
- package/_site/_test/helpers/qa-r44-ui.js +0 -347
- package/_site/_test/helpers/qa-r45-harness.js +0 -94
- package/_site/_test/helpers/qa-r48-env.js +0 -64
- package/_site/_test/helpers/qa-r49-wb-host.js +0 -58
- package/_site/_test/helpers/qa-r51-env.cjs +0 -77
- package/_site/_test/helpers/qa-r91-harness.cjs +0 -534
- package/_site/_test/helpers/spawn-server.js +0 -106
- package/_site/_test/helpers/version-visibility-fixture.js +0 -251
- package/_site/_test/home-overview-test.js +0 -64
- package/_site/_test/hook-relocation-rebind-test.js +0 -120
- package/_site/_test/hook-runtime-endpoint-test.js +0 -88
- package/_site/_test/hook-status-repair-api-test.js +0 -152
- package/_site/_test/hook-trigger-test.js +0 -85
- package/_site/_test/hook-worktree-test.js +0 -42
- package/_site/_test/import-preflight-api-test.js +0 -234
- package/_site/_test/index-builder-test.js +0 -41
- package/_site/_test/index-error-display-contract-test.js +0 -32
- package/_site/_test/index-writer-concurrency-test.js +0 -135
- package/_site/_test/integration-adapters-test.js +0 -262
- package/_site/_test/integration-auto-repair-test.js +0 -115
- package/_site/_test/integration-capture-setup-test.js +0 -118
- package/_site/_test/integration-intent-test.js +0 -85
- package/_site/_test/integration-runtime-binding-a2-test.js +0 -566
- package/_site/_test/integration-runtime-binding-a3-test.js +0 -227
- package/_site/_test/integration-runtime-binding-test.js +0 -473
- package/_site/_test/integration-status-scan-test.js +0 -160
- package/_site/_test/integration-surface-coverage-test.js +0 -165
- package/_site/_test/kb-framework-test.js +0 -57
- package/_site/_test/kbpath-follow-test.js +0 -63
- package/_site/_test/knowledge-db-test.js +0 -144
- package/_site/_test/knowledge-engine-client-test.js +0 -120
- package/_site/_test/knowledge-language-control-test.js +0 -170
- package/_site/_test/knowledge-maintenance-test.js +0 -40
- package/_site/_test/knowledge-panel-lifecycle-test.js +0 -154
- package/_site/_test/knowledge-panel-ui-contract-test.js +0 -110
- package/_site/_test/knowledge-promotion-recovery-test.js +0 -260
- package/_site/_test/knowledge-query-test.js +0 -54
- package/_site/_test/knowledge-retrieval-service-test.js +0 -77
- package/_site/_test/knowledge-scopes-test.js +0 -37
- package/_site/_test/knowledge-storage-location-test.js +0 -28
- package/_site/_test/knowledge-storage-startup-test.js +0 -52
- package/_site/_test/knowledge-store-logs-supervision-test.js +0 -89
- package/_site/_test/launcher-readiness-test.js +0 -80
- package/_site/_test/legacy-claude-session-alias-test.js +0 -106
- package/_site/_test/legacy-relocation-recovery-test.js +0 -258
- package/_site/_test/legacy-routes-removed-test.js +0 -47
- package/_site/_test/legacy-workbench-exclusion-test.js +0 -92
- package/_site/_test/live-gateway-test.js +0 -48
- package/_site/_test/local-marketplace-test.js +0 -16
- package/_site/_test/log-redaction-test.js +0 -58
- package/_site/_test/logging-api-test.js +0 -89
- package/_site/_test/logging-sse-no-gap-test.js +0 -88
- package/_site/_test/logging-ui-test.js +0 -107
- package/_site/_test/markdown-delta-overlay-test.js +0 -85
- package/_site/_test/markdown-maintenance-api-test.js +0 -75
- package/_site/_test/markdown-maintenance-test.js +0 -11
- package/_site/_test/mcp-server-test.js +0 -149
- package/_site/_test/memory-groups-ui-test.js +0 -173
- package/_site/_test/model-context-windows-test.js +0 -89
- package/_site/_test/module-agent-start-proxy-test.js +0 -65
- package/_site/_test/module-artifact-integrity-test.js +0 -27
- package/_site/_test/module-boundary-test.js +0 -30
- package/_site/_test/module-bridge-eventbridge-test.js +0 -202
- package/_site/_test/module-dynamic-port-test.js +0 -118
- package/_site/_test/module-index-proxy-test.js +0 -33
- package/_site/_test/module-model-configuration-test.js +0 -44
- package/_site/_test/module-process-lifecycle-test.js +0 -35
- package/_site/_test/module-stream-proxy-test.js +0 -34
- package/_site/_test/module-supervisor-backoff-reset-test.js +0 -64
- package/_site/_test/module-terminal-restart-test.js +0 -63
- package/_site/_test/module-wiring-unbind-race-test.js +0 -59
- package/_site/_test/native-context-integrations-test.js +0 -86
- package/_site/_test/non-release-ci-test.js +0 -34
- package/_site/_test/offline-boundary-isolation-test.js +0 -32
- package/_site/_test/orphaned-claim-recovery-test.js +0 -80
- package/_site/_test/package-boundary-test.js +0 -48
- package/_site/_test/package-startup-test.js +0 -56
- package/_site/_test/packaged-ui-smoke-test.js +0 -126
- package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +0 -524
- package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +0 -577
- package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +0 -381
- package/_site/_test/parallel-ci-r9-posix-socket-budget-test.js +0 -156
- package/_site/_test/parallel-engine-advanced-eng005-test.js +0 -136
- package/_site/_test/parallel-engine-advanced-eng006-test.js +0 -171
- package/_site/_test/parallel-engine-advanced-eng007-reconcile-test.js +0 -231
- package/_site/_test/parallel-engine-advanced-eng009-test.js +0 -208
- package/_site/_test/parallel-engine-advanced-eng010-test.js +0 -213
- package/_site/_test/parallel-engine-advanced-eng011-ui-probe.js +0 -459
- package/_site/_test/parallel-engine-final-eng002-test.js +0 -255
- package/_site/_test/parallel-engine-final-eng007-test.js +0 -269
- package/_site/_test/parallel-engine-final-eng011-test.js +0 -197
- package/_site/_test/parallel-engine-final-eng012-test.js +0 -354
- package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +0 -304
- package/_site/_test/parallel-knowledge-client-error-code-test.js +0 -194
- package/_site/_test/parallel-knowledge-engine-test.js +0 -353
- package/_site/_test/parallel-knowledge-retrieval-test.js +0 -292
- package/_site/_test/parallel-knowledge-vector-test.js +0 -168
- package/_site/_test/parallel-linux-ci-r7-log007-day-test.js +0 -110
- package/_site/_test/parallel-logging-acceptance-log003-probe.js +0 -78
- package/_site/_test/parallel-logging-acceptance-log003-test.js +0 -224
- package/_site/_test/parallel-logging-acceptance-log004-probe.js +0 -85
- package/_site/_test/parallel-logging-acceptance-log004-test.js +0 -231
- package/_site/_test/parallel-logging-acceptance-log005-test.js +0 -208
- package/_site/_test/parallel-logging-acceptance-log006-test.js +0 -214
- package/_site/_test/parallel-logging-acceptance-log007-test.js +0 -223
- package/_site/_test/parallel-logging-acceptance-log008-test.js +0 -192
- package/_site/_test/parallel-logging-fix-r2-crash-probe.js +0 -271
- package/_site/_test/parallel-logging-fix-r2-gap-test.js +0 -294
- package/_site/_test/parallel-logging-fix-r2-normalhook-test.js +0 -330
- package/_site/_test/parallel-logging-integration-5025-portability-test.js +0 -554
- package/_site/_test/parallel-memory-candidate-test.js +0 -353
- package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +0 -238
- package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +0 -371
- package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +0 -439
- package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +0 -333
- package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +0 -519
- package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +0 -569
- package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +0 -374
- package/_site/_test/parallel-memory-home-review-test.js +0 -148
- package/_site/_test/parallel-memory-injection-origin-probe.js +0 -412
- package/_site/_test/parallel-memory-injection-probe.js +0 -411
- package/_site/_test/parallel-memory-manual-test.js +0 -292
- package/_site/_test/parallel-memory-scope-test.js +0 -98
- package/_site/_test/parallel-memory-source-test.js +0 -254
- package/_site/_test/parallel-memory-sync-test.js +0 -265
- package/_site/_test/parallel-memory-view-r8-reload-gate-test.js +0 -123
- package/_site/_test/parallel-nav-failure-test.js +0 -139
- package/_site/_test/parallel-nav-home-issues-test.js +0 -159
- package/_site/_test/parallel-nav-isolation-test.js +0 -308
- package/_site/_test/parallel-nav-isolation-vector-path-test.js +0 -90
- package/_site/_test/parallel-nav-offline-test.js +0 -300
- package/_site/_test/parallel-nav-operability-test.js +0 -268
- package/_site/_test/parallel-nav-switch-test.js +0 -293
- package/_site/_test/parallel-nav-theme-test.js +0 -176
- package/_site/_test/parallel-nav-viewport-test.js +0 -321
- package/_site/_test/parallel-qa-engine-endpoint-guard-test.js +0 -275
- package/_site/_test/parallel-retrieval-followup-citation-test.js +0 -219
- package/_site/_test/parallel-retrieval-followup-corpus-test.js +0 -289
- package/_site/_test/parallel-workbench-drafts-r4-probe.js +0 -477
- package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +0 -89
- package/_site/_test/parallel-workbench-drafts-r5-probe.js +0 -593
- package/_site/_test/parallel-workbench-independent-host.js +0 -262
- package/_site/_test/parallel-workbench-integration-5025-abort-probe.js +0 -340
- package/_site/_test/parallel-workbench-integration-5025-drafts-probe.js +0 -588
- package/_site/_test/parallel-workbench-integration-5025-env-check.js +0 -317
- package/_site/_test/parallel-workbench-integration-5025-model-probe.js +0 -342
- package/_site/_test/parallel-workbench-integration-5025-ordering-probe.js +0 -326
- package/_site/_test/parallel-workbench-model-probe.js +0 -336
- package/_site/_test/parallel-workbench-offline-test.js +0 -169
- package/_site/_test/parallel-workbench-provenance-trace.js +0 -134
- package/_site/_test/parallel-workbench-runtime-minimax-probe.js +0 -321
- package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +0 -307
- package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +0 -313
- package/_site/_test/parallel-workbench-runtime-wb008-abort.js +0 -321
- package/_site/_test/parallel-workbench-source-match.js +0 -206
- package/_site/_test/parallel-workbench-standalone-turn.js +0 -349
- package/_site/_test/path-consistency-test.js +0 -151
- package/_site/_test/pending-sweep-test.js +0 -9
- package/_site/_test/post-commit-automation-test.js +0 -87
- package/_site/_test/pr-consumer-contract-test.js +0 -55
- package/_site/_test/product-brand-contract-test.js +0 -25
- package/_site/_test/product-diagnostics-ui-test.js +0 -105
- package/_site/_test/product-empty-state-test.js +0 -214
- package/_site/_test/product-import-ui-test.js +0 -245
- package/_site/_test/product-navigation-test.js +0 -213
- package/_site/_test/product-progress-status-test.js +0 -100
- package/_site/_test/project-delete-recovery-test.js +0 -64
- package/_site/_test/project-domain-create-test.js +0 -91
- package/_site/_test/project-domain-scope-retrieval-test.js +0 -214
- package/_site/_test/project-git-init-confirm-test.js +0 -115
- package/_site/_test/project-goal-editor-test.js +0 -145
- package/_site/_test/project-import-duplicate-alias-test.js +0 -134
- package/_site/_test/project-import-unicode-restart-test.js +0 -140
- package/_site/_test/project-lifecycle-transaction-test.js +0 -106
- package/_site/_test/project-module-partial-recovery-test.js +0 -237
- package/_site/_test/project-remove-running-guard-test.js +0 -79
- package/_site/_test/project-store-test.js +0 -90
- package/_site/_test/project-team-ui-test.js +0 -132
- package/_site/_test/project-unbind-late-read-ui-test.js +0 -281
- package/_site/_test/project-unbind-writer-guard-test.js +0 -231
- package/_site/_test/prompt-settings-test.js +0 -115
- package/_site/_test/protected-architecture-gate-test.js +0 -123
- package/_site/_test/qa-r44-permission-question.js +0 -756
- package/_site/_test/qa-r45-offline-backfill-test.js +0 -279
- package/_site/_test/qa-r48-sys003-blank-secret-test.js +0 -258
- package/_site/_test/qa-r49-sys003-real-blank-probe.js +0 -374
- package/_site/_test/recovery-label-contract-test.js +0 -55
- package/_site/_test/refactor-characterization-test.js +0 -36
- package/_site/_test/registry-events-test.js +0 -38
- package/_site/_test/release-version-sync-test.js +0 -115
- package/_site/_test/requirement-binding-test.js +0 -113
- package/_site/_test/requirement-recorder-test.js +0 -173
- package/_site/_test/run-all-tests.js +0 -196
- package/_site/_test/runtime-endpoint-test.js +0 -64
- package/_site/_test/scanner-test.js +0 -83
- package/_site/_test/server-security-test.js +0 -96
- package/_site/_test/sessions-stream-test.js +0 -93
- package/_site/_test/shared-contracts-test.js +0 -58
- package/_site/_test/shared-scope-root-binding-test.js +0 -75
- package/_site/_test/simple-import-test.js +0 -98
- package/_site/_test/startup-analysis-disabled-test.js +0 -16
- package/_site/_test/startup-integration-isolation-test.js +0 -59
- package/_site/_test/startup-integration-repair-test.js +0 -43
- package/_site/_test/storage-foundation-test.js +0 -78
- package/_site/_test/structured-logger-test.js +0 -101
- package/_site/_test/t07b-cln-005-coverage-test.js +0 -212
- package/_site/_test/t07c-cln-001-002-007-coverage-test.js +0 -135
- package/_site/_test/t07d-git-rel-coverage-test.js +0 -226
- package/_site/_test/t07e-qta-coverage-test.js +0 -195
- package/_site/_test/t07f-mem-008-coverage-test.js +0 -100
- package/_site/_test/team-knowledge-store-sparse-checkout-test.js +0 -196
- package/_site/_test/team-knowledge-store-test.js +0 -132
- package/_site/_test/test-server-cleanup-test.js +0 -35
- package/_site/_test/test-server-module-isolation-test.js +0 -37
- package/_site/_test/tracking-start-test.js +0 -144
- package/_site/_test/vector-storage-root-test.js +0 -75
- package/_site/_test/version-visibility-browser-probe.js +0 -249
- package/_site/_test/version-visibility-test.js +0 -92
- package/_site/_test/workbench-context-receipts-test.js +0 -22
- package/_site/_test/workbench-permission-test.js +0 -118
- package/_site/_test/workflow-module-wiring-test.js +0 -252
- package/_site/_test/workflow-tools-test.js +0 -243
- package/_site/_test/workspace-ui-contract-test.js +0 -77
- package/_site/_test/zcode-capture-integration-test.js +0 -112
- package/templates/change.md +0 -30
- package/templates/project-readme.md +0 -52
- /package/docs/{assets → images}/architecture.svg +0 -0
- /package/docs/{assets → images}/dashboard.png +0 -0
- /package/docs/{assets → images}/draft-review.png +0 -0
- /package/docs/{assets → images}/logo.svg +0 -0
- /package/docs/{assets → images}/runs-drafts.png +0 -0
- /package/docs/{assets → images}/settings.png +0 -0
- /package/{ui → resources/ui}/favicon.svg +0 -0
- /package/{ui → resources/ui}/index.html +0 -0
- /package/{ui → resources/ui}/knowledge-panel.html +0 -0
- /package/{ui → resources/ui}/live-client.js +0 -0
- /package/{ui → resources/ui}/version-info.css +0 -0
- /package/{ui → resources/ui}/version-info.js +0 -0
- /package/{_site/lib → src/automation}/automation-config.js +0 -0
- /package/{_site/lib → src/automation}/commit-prompt.js +0 -0
- /package/{_site/lib → src/common}/cli-instances.js +0 -0
- /package/{_site/lib → src/common}/contracts.js +0 -0
- /package/{_site/lib → src/common}/data-dir.js +0 -0
- /package/{_site/lib → src/common}/folder-picker-output.js +0 -0
- /package/{_site/lib → src/common}/git-path.js +0 -0
- /package/{_site/lib → src/common}/git-runner.js +0 -0
- /package/{_site/lib → src/common}/runtime-control.js +0 -0
- /package/{_site/lib → src/conversations}/bridge-consumer-service.js +0 -0
- /package/{_site/lib → src/conversations}/codex-context-status.js +0 -0
- /package/{_site/lib → src/integrations}/ai-vendor-presets.js +0 -0
- /package/{_site/lib → src/integrations}/claude-plugin-status.js +0 -0
- /package/{_site/lib → src/integrations}/integration-auto-repair.js +0 -0
- /package/{_site/lib → src/integrations}/integration-intent.js +0 -0
- /package/{_site/lib → src/integrations}/integration-repair-worker.js +0 -0
- /package/{_site/lib → src/integrations}/integration-status-scan.js +0 -0
- /package/{_site/lib → src/integrations}/integration-status-worker.js +0 -0
- /package/{_site/lib → src/integrations}/model-context-windows.js +0 -0
- /package/{_site/lib → src/integrations}/startup-integration-repair.js +0 -0
- /package/{_site/lib → src/knowledge}/embedding-service.js +0 -0
- /package/{_site/lib → src/knowledge}/index-builder.js +0 -0
- /package/{_site/lib → src/knowledge}/kb-validator.js +0 -0
- /package/{_site/lib → src/knowledge}/knowledge-db.js +0 -0
- /package/{_site/lib → src/knowledge}/knowledge-schema.js +0 -0
- /package/{_site/lib → src/knowledge}/markdown-knowledge-indexer.js +0 -0
- /package/{_site → src}/scripts/codex-notify-fanout.cjs +0 -0
- /package/{_site → src}/scripts/folder-picker.ps1 +0 -0
- /package/{_site → src}/scripts/sync-release-version.js +0 -0
- /package/{_site → src}/scripts/verify-module-runtime.js +0 -0
- /package/{_site/lib → src/server}/live-gateway.js +0 -0
- /package/{_site/lib → src/server}/module-port-resolver.js +0 -0
- /package/{_site/lib → src/server}/public-version-info.js +0 -0
- /package/{_site → src}/start.bat +0 -0
- /package/{_site → src}/stop.bat +0 -0
- /package/{_site/lib → src/tools}/registry-events.js +0 -0
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// Lane-owned child process that hosts the REAL claude-ai-workbench module
|
|
3
|
-
// (0.13.6, the copy the installed product ships) for the P-MEMORY-INJECTION-02
|
|
4
|
-
// lane. It speaks the module's real HTTP contract and is started by the lane
|
|
5
|
-
// probes.
|
|
6
|
-
//
|
|
7
|
-
// The shape of this child is a READ-ONLY SNAPSHOT of
|
|
8
|
-
// _site/_test/helpers/parallel-memory-injection-wb-host.js (P-MEMORY-INJECTION-02
|
|
9
|
-
// lane) which is itself a snapshot of _site/_test/helpers/parallel-workbench-host.js
|
|
10
|
-
// (Workbench provenance lane). No source file is modified or imported: this
|
|
11
|
-
// lane never depends on another lane's unfrozen file. The SHA-256 of every
|
|
12
|
-
// source is recorded in the lane report.
|
|
13
|
-
//
|
|
14
|
-
// Environment (all set by the parent):
|
|
15
|
-
// PK_WB_MODULE_ROOT the claude-ai-workbench package root to host
|
|
16
|
-
// PK_WB_HOST_PORT port to listen on (127.0.0.1)
|
|
17
|
-
// PK_WB_HOST_DATA_DIR isolated workbench data directory
|
|
18
|
-
// PK_WB_HOST_WORKSPACES JSON map of workspaceRef -> absolute directory
|
|
19
|
-
// PK_WB_ENGINE_URL the knowledge engine URL (a recording proxy)
|
|
20
|
-
// PK_WB_PROFILE_SOURCE none | real-readonly
|
|
21
|
-
// PK_WB_BRIDGE_URL optional event-bridge console URL (enables capture)
|
|
22
|
-
// PK_WB_BRIDGE_TOKEN optional event-bridge runtime token (memory only)
|
|
23
|
-
const path = require('node:path');
|
|
24
|
-
const fs = require('node:fs');
|
|
25
|
-
|
|
26
|
-
const moduleRoot = String(process.env.PK_WB_MODULE_ROOT || '').trim();
|
|
27
|
-
const port = Number(process.env.PK_WB_HOST_PORT || 0);
|
|
28
|
-
const dataDir = String(process.env.PK_WB_HOST_DATA_DIR || '').trim();
|
|
29
|
-
const workspaces = JSON.parse(String(process.env.PK_WB_HOST_WORKSPACES || '{}'));
|
|
30
|
-
const engineUrl = String(process.env.PK_WB_ENGINE_URL || '').trim();
|
|
31
|
-
const profileSource = String(process.env.PK_WB_PROFILE_SOURCE || 'none');
|
|
32
|
-
const bridgeUrl = String(process.env.PK_WB_BRIDGE_URL || '').trim();
|
|
33
|
-
const bridgeToken = String(process.env.PK_WB_BRIDGE_TOKEN || '').trim();
|
|
34
|
-
|
|
35
|
-
if (!moduleRoot || !port || !dataDir || !Object.keys(workspaces).length) {
|
|
36
|
-
console.error('parallel-retrieval-followup-r2-wb-host: PK_WB_MODULE_ROOT, PK_WB_HOST_PORT, PK_WB_HOST_DATA_DIR and PK_WB_HOST_WORKSPACES are required');
|
|
37
|
-
process.exit(2);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
// Same contract as the module's own bin: the runtime resolves its data
|
|
41
|
-
// directory from these.
|
|
42
|
-
process.env.CLAUDE_AI_WORKBENCH_DATA_DIR = dataDir;
|
|
43
|
-
process.env.KB_DATA_DIR = dataDir;
|
|
44
|
-
if (engineUrl) process.env.KB_KNOWLEDGE_ENGINE_URL = engineUrl;
|
|
45
|
-
|
|
46
|
-
const { createWorkbenchServer } = require(path.join(moduleRoot, 'packages', 'server'));
|
|
47
|
-
|
|
48
|
-
function buildOptions() {
|
|
49
|
-
const options = { dataDir, workspaces };
|
|
50
|
-
if (profileSource === 'real-readonly') {
|
|
51
|
-
const shell = require('./parallel-retrieval-followup-r2-shell');
|
|
52
|
-
options.profiles = shell.createReadOnlyProfileStore(moduleRoot, { dataDir });
|
|
53
|
-
}
|
|
54
|
-
if (bridgeUrl && bridgeToken) {
|
|
55
|
-
// The real Workbench capture: the module records the ORIGINAL user input
|
|
56
|
-
// (not the augmented prompt) and flushes it to the Bridge.
|
|
57
|
-
const { ConversationCapture } = require(path.join(moduleRoot, 'packages', 'server', 'lib', 'conversation-capture.js'));
|
|
58
|
-
options.conversationCapture = new ConversationCapture({
|
|
59
|
-
file: path.join(dataDir, 'capture-outbox.v1.json'),
|
|
60
|
-
bridgeUrl,
|
|
61
|
-
token: bridgeToken,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return options;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const app = createWorkbenchServer(buildOptions());
|
|
68
|
-
app.server.listen(port, '127.0.0.1', () => {
|
|
69
|
-
process.stdout.write(`WORKBENCH_HOST_READY http://127.0.0.1:${port} engine=${engineUrl || 'none'} capture=${bridgeUrl ? 'on' : 'off'}\n`);
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
let stopping = false;
|
|
73
|
-
async function shutdown() {
|
|
74
|
-
if (stopping) return;
|
|
75
|
-
stopping = true;
|
|
76
|
-
setTimeout(() => process.exit(1), 10000).unref();
|
|
77
|
-
try { await app.service.destroy(); } catch { process.exitCode = 1; }
|
|
78
|
-
app.server.closeAllConnections?.();
|
|
79
|
-
app.server.close(() => process.exit(process.exitCode || 0));
|
|
80
|
-
}
|
|
81
|
-
process.on('SIGINT', shutdown);
|
|
82
|
-
process.on('SIGTERM', shutdown);
|
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// Lane-owned helpers for the P-RETRIEVAL-FOLLOWUP-01 batch (RET-007/RET-008).
|
|
3
|
-
//
|
|
4
|
-
// Portability contract: no developer path is hard-coded. The operator's
|
|
5
|
-
// Workbench profile store defaults to the real user home captured BEFORE
|
|
6
|
-
// fixture.isolateProcess() replaces HOME/USERPROFILE, and can be overridden
|
|
7
|
-
// with PK_RETRIEVAL_WORKBENCH_HOME. Secrets (the glm subscription key) are
|
|
8
|
-
// read in memory only: they are never printed, logged or persisted, and no
|
|
9
|
-
// quota/usage endpoint is ever contacted by anything in this lane.
|
|
10
|
-
//
|
|
11
|
-
// Isolation contract: same as the sibling parallel-knowledge-fixture helper —
|
|
12
|
-
// ambient module URLs cleared, live 5757/5790/8787/8790 endpoints refused,
|
|
13
|
-
// every artefact under the external temp root. The shared fixture helper is
|
|
14
|
-
// required read-only; this file only adds lane-specific composition.
|
|
15
|
-
const fs = require('node:fs');
|
|
16
|
-
const os = require('node:os');
|
|
17
|
-
const path = require('node:path');
|
|
18
|
-
const http = require('node:http');
|
|
19
|
-
const { spawn, execFileSync } = require('node:child_process');
|
|
20
|
-
|
|
21
|
-
const fixture = require('./parallel-knowledge-fixture');
|
|
22
|
-
|
|
23
|
-
// Captured before isolateProcess() rewrites the environment.
|
|
24
|
-
const REAL_HOME = process.env.PK_RETRIEVAL_WORKBENCH_HOME
|
|
25
|
-
|| process.env.USERPROFILE
|
|
26
|
-
|| process.env.HOME
|
|
27
|
-
|| os.homedir();
|
|
28
|
-
|
|
29
|
-
const REPO_ROOT = fixture.REPO_ROOT;
|
|
30
|
-
const LANE_DIR = path.join(REPO_ROOT, 'qa-autopilot', 'artifacts', 'parallel-20261023', 'retrieval-followup');
|
|
31
|
-
const BRIDGE_BIN = path.join(REPO_ROOT, 'node_modules', '@sanqianx', 'ai-coding-event-bridge-console', 'src', 'bin.js');
|
|
32
|
-
const HUB_DIST = path.join(REPO_ROOT, 'node_modules', '@sanqianx', 'vector-hub', 'dist', 'cjs');
|
|
33
|
-
const MODEL_RELATIVE = path.join('Xenova', 'bge-small-zh-v1.5');
|
|
34
|
-
|
|
35
|
-
function workbenchProfileHome() { return path.join(REAL_HOME, '.agent-terminal'); }
|
|
36
|
-
|
|
37
|
-
// Resolve one of the operator's real subscription profiles, in memory only.
|
|
38
|
-
// Shape mirrors the Workbench ProfileStore runtime projection actually used
|
|
39
|
-
// for engine runtime-config: { apiKey, baseUrl, mainModel }.
|
|
40
|
-
//
|
|
41
|
-
// The model list is the operator's instruction order, not a filter: the
|
|
42
|
-
// provider is the authority on which id it accepts, so a model that the local
|
|
43
|
-
// catalog does not list is still attempted and the answer is recorded.
|
|
44
|
-
function loadRuntimeProfile(options = {}) {
|
|
45
|
-
const profileId = options.profileId || 'minimax';
|
|
46
|
-
const models = (options.models && options.models.length ? options.models : [options.model].filter(Boolean));
|
|
47
|
-
const home = workbenchProfileHome();
|
|
48
|
-
const profileFile = path.join(home, 'profiles.v2.json');
|
|
49
|
-
const credentialFile = path.join(home, 'credentials.v1.json');
|
|
50
|
-
const detail = { home, profileFile, credentialFile, profileId, models };
|
|
51
|
-
if (!models.length) return { ok: false, reason: 'no model requested', ...detail };
|
|
52
|
-
try {
|
|
53
|
-
const store = JSON.parse(fs.readFileSync(profileFile, 'utf8'));
|
|
54
|
-
const profiles = Array.isArray(store.profiles) ? store.profiles : [];
|
|
55
|
-
const profile = profiles.find(item => item.id === profileId);
|
|
56
|
-
if (!profile) return { ok: false, reason: `${profileId} profile not found`, ...detail };
|
|
57
|
-
if (profile.enabled === false) return { ok: false, reason: `${profileId} profile is disabled`, ...detail };
|
|
58
|
-
const credentials = JSON.parse(fs.readFileSync(credentialFile, 'utf8'));
|
|
59
|
-
const secret = credentials.credentials && credentials.credentials[profile.credentialRef];
|
|
60
|
-
if (typeof secret !== 'string' || !secret) return { ok: false, reason: `${profileId} credential is not configured`, ...detail };
|
|
61
|
-
if (!profile.baseUrl) return { ok: false, reason: `${profileId} profile has no baseUrl`, ...detail };
|
|
62
|
-
const listedModels = (profile.models && profile.models.list || []).map(entry => entry.id);
|
|
63
|
-
const mainModel = models[0];
|
|
64
|
-
// The secret never leaves memory; callers must not serialise this object.
|
|
65
|
-
return {
|
|
66
|
-
ok: true,
|
|
67
|
-
...detail,
|
|
68
|
-
listedModels,
|
|
69
|
-
profile: { apiKey: secret, baseUrl: profile.baseUrl, mainModel },
|
|
70
|
-
identity: {
|
|
71
|
-
profileId: profile.id,
|
|
72
|
-
baseUrl: profile.baseUrl,
|
|
73
|
-
protocol: profile.protocol || null,
|
|
74
|
-
mainModel,
|
|
75
|
-
modelListedInProfile: listedModels.includes(mainModel),
|
|
76
|
-
credentialConfigured: true,
|
|
77
|
-
},
|
|
78
|
-
};
|
|
79
|
-
} catch (error) {
|
|
80
|
-
return { ok: false, reason: `workbench profile store unreadable: ${error.message}`, ...detail };
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// The lane's offline model cache. A missing cache is a real BLOCKED, never a
|
|
85
|
-
// download and never the shipped mock provider.
|
|
86
|
-
function verifyModelCache(cacheDir) {
|
|
87
|
-
const modelDir = path.join(cacheDir, MODEL_RELATIVE);
|
|
88
|
-
const required = ['onnx' + path.sep + 'model.onnx', 'tokenizer.json'];
|
|
89
|
-
const missing = required.filter(relative => !fs.existsSync(path.join(modelDir, ...relative.split(/[\\/]/))));
|
|
90
|
-
return { cacheDir, modelDir, ok: missing.length === 0, missing };
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
// The product's own embedding service wrapped in the interface the real
|
|
94
|
-
// vector hub expects (same contract as the accepted parallel-knowledge-vector
|
|
95
|
-
// probe: batch = passage, single string = query).
|
|
96
|
-
function createProductEmbedder(service) {
|
|
97
|
-
const state = { calls: 0, dimensions: [], nonZeroVectors: 0 };
|
|
98
|
-
return {
|
|
99
|
-
kind: 'product-local-embedding-service',
|
|
100
|
-
model: service.modelId,
|
|
101
|
-
modelId: service.modelId,
|
|
102
|
-
maxTokens: 500,
|
|
103
|
-
state,
|
|
104
|
-
async createEmbeddings(inputs) {
|
|
105
|
-
const isBatch = Array.isArray(inputs);
|
|
106
|
-
const texts = isBatch ? inputs : [inputs];
|
|
107
|
-
const output = [];
|
|
108
|
-
for (const text of texts) {
|
|
109
|
-
const vector = isBatch ? await service.embedPassage(text) : await service.embedQuery(text);
|
|
110
|
-
state.calls += 1;
|
|
111
|
-
state.dimensions.push(vector.length);
|
|
112
|
-
if (vector.some(value => value !== 0)) state.nonZeroVectors += 1;
|
|
113
|
-
output.push(vector);
|
|
114
|
-
}
|
|
115
|
-
return { status: 'success', output };
|
|
116
|
-
},
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// A real vectra index on disk: the stored vectors must be real, of the
|
|
121
|
-
// expected dimension and not all zero.
|
|
122
|
-
function inspectStoredVectors(projectDir, expectedDimensions) {
|
|
123
|
-
const indexFile = path.join(projectDir, 'index.json');
|
|
124
|
-
if (!fs.existsSync(indexFile)) {
|
|
125
|
-
return { inspected: false, reason: 'no index.json in the project folder', files: fs.existsSync(projectDir) ? fs.readdirSync(projectDir) : [] };
|
|
126
|
-
}
|
|
127
|
-
const raw = fs.readFileSync(indexFile, 'utf8');
|
|
128
|
-
let parsed = null;
|
|
129
|
-
try { parsed = JSON.parse(raw); } catch { parsed = null; }
|
|
130
|
-
if (!parsed || !Array.isArray(parsed.items)) return { inspected: false, reason: 'index.json is not a readable JSON index', bytes: raw.length };
|
|
131
|
-
const vectors = parsed.items.map(item => item && item.vector).filter(Array.isArray);
|
|
132
|
-
const dimensions = [...new Set(vectors.map(vector => vector.length))];
|
|
133
|
-
return {
|
|
134
|
-
inspected: true,
|
|
135
|
-
bytes: raw.length,
|
|
136
|
-
itemCount: parsed.items.length,
|
|
137
|
-
vectorCount: vectors.length,
|
|
138
|
-
dimensions,
|
|
139
|
-
expectedDimensions,
|
|
140
|
-
dimensionsMatch: dimensions.length === 1 && dimensions[0] === expectedDimensions,
|
|
141
|
-
allVectorsNonZero: vectors.length > 0 && vectors.every(vector => vector.some(value => value !== 0)),
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
async function httpJson(url, options = {}) {
|
|
146
|
-
const response = await fetch(url, { signal: AbortSignal.timeout(options.timeoutMs || 8000), ...options });
|
|
147
|
-
const body = await response.json().catch(() => null);
|
|
148
|
-
return { status: response.status, ok: response.ok, body };
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// The real event-bridge console as its own child process on an isolated port
|
|
152
|
-
// and home — the production topology (hooks, console service and consumers
|
|
153
|
-
// are separate processes over HTTP).
|
|
154
|
-
async function spawnBridgeConsole({ home, port }) {
|
|
155
|
-
fs.mkdirSync(home, { recursive: true });
|
|
156
|
-
const child = spawn(process.execPath, [BRIDGE_BIN, 'serve', '--port', String(port), '--host', '127.0.0.1', '--home', home], {
|
|
157
|
-
env: fixture.sanitizedEnv({ BRIDGE_CONSOLE_PICK_FOLDER: '0', AI_CODING_EVENT_BRIDGE_HOME: home }),
|
|
158
|
-
windowsHide: true,
|
|
159
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
160
|
-
});
|
|
161
|
-
const output = { stdout: '', stderr: '' };
|
|
162
|
-
child.stdout.on('data', chunk => { output.stdout += chunk; });
|
|
163
|
-
child.stderr.on('data', chunk => { output.stderr += chunk; });
|
|
164
|
-
const url = `http://127.0.0.1:${port}`;
|
|
165
|
-
const deadline = Date.now() + 20000;
|
|
166
|
-
let lastError = null;
|
|
167
|
-
while (Date.now() < deadline) {
|
|
168
|
-
try {
|
|
169
|
-
const health = await httpJson(`${url}/api/health`, { timeoutMs: 2000 });
|
|
170
|
-
if (health.ok) return { child, url, home, output, stop: kill(child) };
|
|
171
|
-
lastError = new Error(`health HTTP ${health.status}`);
|
|
172
|
-
} catch (error) { lastError = error; }
|
|
173
|
-
if (child.exitCode !== null) throw new Error(`bridge console exited early (${child.exitCode}): ${output.stderr.slice(0, 400)}`);
|
|
174
|
-
await new Promise(resolve => setTimeout(resolve, 200));
|
|
175
|
-
}
|
|
176
|
-
kill(child)();
|
|
177
|
-
throw new Error(`bridge console did not become healthy: ${lastError && lastError.message}`);
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function kill(child) {
|
|
181
|
-
return () => new Promise(resolve => {
|
|
182
|
-
if (child.exitCode !== null) return resolve();
|
|
183
|
-
child.once('close', () => resolve());
|
|
184
|
-
child.kill();
|
|
185
|
-
setTimeout(() => { if (child.exitCode === null) child.kill('SIGKILL'); resolve(); }, 3000).unref();
|
|
186
|
-
});
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
// The real pinned vector-hub package served over its real HTTP layer. The
|
|
190
|
-
// product's LocalEmbeddingService is attached through the package's supported
|
|
191
|
-
// hub.setEmbeddings API (the accepted probe pattern); the shell-managed
|
|
192
|
-
// runtime-config credential path is not applicable to the offline local model
|
|
193
|
-
// and is documented as the lane's injection boundary.
|
|
194
|
-
async function startVectorHttpServer({ root, port, embedder, hubDist = HUB_DIST }) {
|
|
195
|
-
const { HubManager } = require(path.join(hubDist, 'server', 'manager.js'));
|
|
196
|
-
const { createServer } = require(path.join(hubDist, 'server', 'server.js'));
|
|
197
|
-
fs.mkdirSync(root, { recursive: true });
|
|
198
|
-
process.env.VECTOR_HUB_DISABLE_PICKER = '1';
|
|
199
|
-
const manager = await HubManager.load({ rootPath: root, configPath: path.join(root, 'vector-config.json'), managed: true });
|
|
200
|
-
manager.hub.setEmbeddings(embedder);
|
|
201
|
-
const server = http.createServer(createServer(manager));
|
|
202
|
-
await new Promise(resolve => server.listen(port, '127.0.0.1', resolve));
|
|
203
|
-
return {
|
|
204
|
-
manager,
|
|
205
|
-
server,
|
|
206
|
-
url: `http://127.0.0.1:${server.address().port}`,
|
|
207
|
-
root,
|
|
208
|
-
async stop() {
|
|
209
|
-
server.closeAllConnections();
|
|
210
|
-
await new Promise(resolve => server.close(resolve));
|
|
211
|
-
await manager.dispose?.();
|
|
212
|
-
},
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
|
|
216
|
-
// An isolated sink for the hook trigger's best-effort site notification. The
|
|
217
|
-
// trigger falls back to KB_SITE_PORT (default 5757 — the developer's LIVE
|
|
218
|
-
// site) when no runtime endpoint file exists, so every Git child in this lane
|
|
219
|
-
// gets KB_SITE_PORT pointed here. Nothing may ever reach the real 5757.
|
|
220
|
-
async function startNotificationSink() {
|
|
221
|
-
const hits = [];
|
|
222
|
-
const server = http.createServer((req, res) => {
|
|
223
|
-
let body = '';
|
|
224
|
-
req.on('data', chunk => { body += chunk; });
|
|
225
|
-
req.on('end', () => {
|
|
226
|
-
let parsed = null;
|
|
227
|
-
try { parsed = JSON.parse(body); } catch { parsed = null; }
|
|
228
|
-
hits.push({ method: req.method, url: req.url, body: parsed });
|
|
229
|
-
res.writeHead(404, { 'Content-Type': 'application/json' });
|
|
230
|
-
res.end(JSON.stringify({ error: 'notification sink' }));
|
|
231
|
-
});
|
|
232
|
-
});
|
|
233
|
-
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
|
|
234
|
-
return { server, hits, port: server.address().port, stop: () => new Promise(resolve => { server.closeAllConnections(); server.close(resolve); }) };
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Git with an explicit environment (the hook inherits it: KB_SITE_PORT sinks
|
|
238
|
-
// the notification, isolated vars keep the trigger away from live surfaces).
|
|
239
|
-
function gitIn(repoPath, args, env = {}) {
|
|
240
|
-
return execFileSync('git', args, { cwd: repoPath, windowsHide: true, encoding: 'utf8', env: fixture.sanitizedEnv(env) }).trim();
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
async function waitFor(predicate, timeoutMs, label, intervalMs = 500) {
|
|
244
|
-
const deadline = Date.now() + timeoutMs;
|
|
245
|
-
let last = null;
|
|
246
|
-
while (Date.now() < deadline) {
|
|
247
|
-
last = await predicate();
|
|
248
|
-
if (last) return last;
|
|
249
|
-
await new Promise(resolve => setTimeout(resolve, intervalMs));
|
|
250
|
-
}
|
|
251
|
-
throw new Error(`Timed out after ${timeoutMs}ms waiting for ${label}`);
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function writeEvidence(name, value) {
|
|
255
|
-
const file = path.join(LANE_DIR, 'evidence', name);
|
|
256
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
257
|
-
fs.writeFileSync(file, JSON.stringify(value, null, 2), 'utf8');
|
|
258
|
-
return { file, sha256: fixture.sha256File(file) };
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
module.exports = {
|
|
262
|
-
REAL_HOME,
|
|
263
|
-
REPO_ROOT,
|
|
264
|
-
LANE_DIR,
|
|
265
|
-
HUB_DIST,
|
|
266
|
-
workbenchProfileHome,
|
|
267
|
-
loadRuntimeProfile,
|
|
268
|
-
verifyModelCache,
|
|
269
|
-
createProductEmbedder,
|
|
270
|
-
inspectStoredVectors,
|
|
271
|
-
httpJson,
|
|
272
|
-
spawnBridgeConsole,
|
|
273
|
-
startVectorHttpServer,
|
|
274
|
-
startNotificationSink,
|
|
275
|
-
gitIn,
|
|
276
|
-
waitFor,
|
|
277
|
-
writeEvidence,
|
|
278
|
-
...fixture,
|
|
279
|
-
};
|
|
@@ -1,295 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
// P-WB-DRAFTS-R5 fixture — copied from the accepted helpers/parallel-workbench-fixture.js
|
|
3
|
-
// (frozen for WB003/4/8) with exactly the isolation corrections the R5 dispatch
|
|
4
|
-
// requires; the original stays untouched.
|
|
5
|
-
//
|
|
6
|
-
// R5 isolation contract (everything this lane's own children may see):
|
|
7
|
-
// * every directory is created below the shared temp root, never inside
|
|
8
|
-
// the repository;
|
|
9
|
-
// * the Workbench data directory, the knowledge data directory, the Bridge
|
|
10
|
-
// home, HOME/USERPROFILE, CLAUDE_CONFIG_DIR, CODEX_HOME, APPDATA,
|
|
11
|
-
// LOCALAPPDATA and TEMP are ALL isolated below the layout root — the
|
|
12
|
-
// R4 boundary gap (APPDATA/LOCALAPPDATA/CODEX_HOME inherited from the
|
|
13
|
-
// real machine) is closed;
|
|
14
|
-
// * the live product ports are refused;
|
|
15
|
-
// * the ambient module addresses and every ambient Anthropic credential
|
|
16
|
-
// variable are dropped.
|
|
17
|
-
//
|
|
18
|
-
// Profile contract (R5): the real profile source is GONE. There is no
|
|
19
|
-
// read-only facade, no PK_WB_REAL_PROFILE_DIR and no digest of the real
|
|
20
|
-
// credential files — the host seeds a purely fictional profile with a fake
|
|
21
|
-
// key through the product's own ProfileStore on the isolated data dir.
|
|
22
|
-
// realWorkbenchProfileDir() survives only as a pure path-string helper so
|
|
23
|
-
// guards can prove no isolated env value points at the real location; it
|
|
24
|
-
// performs no filesystem access of its own.
|
|
25
|
-
const fs = require('node:fs');
|
|
26
|
-
const os = require('node:os');
|
|
27
|
-
const path = require('node:path');
|
|
28
|
-
const net = require('node:net');
|
|
29
|
-
|
|
30
|
-
const REPO_ROOT = path.resolve(__dirname, '..', '..', '..');
|
|
31
|
-
|
|
32
|
-
// The developer's live surfaces. A test may never bind or talk to them.
|
|
33
|
-
const FORBIDDEN_PORTS = new Set([5757, 5760, 5789, 5790, 8787, 8790]);
|
|
34
|
-
|
|
35
|
-
// Ambient module addresses that would point a test at a live instance.
|
|
36
|
-
const AMBIENT_MODULE_URLS = [
|
|
37
|
-
'KB_KNOWLEDGE_ENGINE_URL',
|
|
38
|
-
'KB_VECTORHUB_URL',
|
|
39
|
-
'KB_TERMINAL_URL',
|
|
40
|
-
'KB_EVENTBRIDGE_URL',
|
|
41
|
-
'KB_EVENT_BRIDGE_URL',
|
|
42
|
-
'KB_WORKBENCH_RUNTIME_TOKEN',
|
|
43
|
-
'KB_MODULES_AUTOSTART',
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
// Ambient Anthropic credentials: a test must only ever use the credential it
|
|
47
|
-
// injects itself, never one that happens to sit in the shell.
|
|
48
|
-
const AMBIENT_MODEL_ENV = [
|
|
49
|
-
'ANTHROPIC_API_KEY',
|
|
50
|
-
'ANTHROPIC_AUTH_TOKEN',
|
|
51
|
-
'ANTHROPIC_BASE_URL',
|
|
52
|
-
'ANTHROPIC_MODEL',
|
|
53
|
-
'ANTHROPIC_DEFAULT_THINKING_MODEL',
|
|
54
|
-
'ANTHROPIC_DEFAULT_HAIKU_MODEL',
|
|
55
|
-
'ANTHROPIC_DEFAULT_SONNET_MODEL',
|
|
56
|
-
'ANTHROPIC_DEFAULT_OPUS_MODEL',
|
|
57
|
-
'API_TIMEOUT_MS',
|
|
58
|
-
'CLAUDE_CODE_OAUTH_TOKEN',
|
|
59
|
-
'CLAUDE_CODE_USE_BEDROCK',
|
|
60
|
-
'CLAUDE_CODE_USE_VERTEX',
|
|
61
|
-
'CLAUDE_CODE_USE_FOUNDRY',
|
|
62
|
-
];
|
|
63
|
-
|
|
64
|
-
// Captured before any isolation changes HOME.
|
|
65
|
-
const REAL_HOME = os.homedir();
|
|
66
|
-
const REAL_USERPROFILE = process.env.USERPROFILE || REAL_HOME;
|
|
67
|
-
|
|
68
|
-
// The absolute-path members of the isolation whitelist. KB_MODULES_AUTOSTART
|
|
69
|
-
// is a flag ('0'), HOMEDRIVE/HOMEPATH are drive-relative companions; none of
|
|
70
|
-
// them is a directory of its own.
|
|
71
|
-
const ISOLATION_PATH_KEYS = [
|
|
72
|
-
'HOME',
|
|
73
|
-
'USERPROFILE',
|
|
74
|
-
'CODEX_HOME',
|
|
75
|
-
'CLAUDE_CONFIG_DIR',
|
|
76
|
-
'APPDATA',
|
|
77
|
-
'LOCALAPPDATA',
|
|
78
|
-
'TEMP',
|
|
79
|
-
'TMP',
|
|
80
|
-
'TMPDIR',
|
|
81
|
-
'KB_DATA_DIR',
|
|
82
|
-
'KB_KNOWLEDGE_DATA_DIR',
|
|
83
|
-
'AI_CODING_EVENT_BRIDGE_HOME',
|
|
84
|
-
'AGENT_TERMINAL_DATA_DIR',
|
|
85
|
-
'CLAUDE_AI_WORKBENCH_DATA_DIR',
|
|
86
|
-
];
|
|
87
|
-
|
|
88
|
-
function isInside(candidate, parent) {
|
|
89
|
-
const relative = path.relative(parent, candidate);
|
|
90
|
-
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
function resolveTempRoot() {
|
|
94
|
-
const sharedRoot = path.join(path.dirname(REPO_ROOT), '.project-knowledge-test-temp');
|
|
95
|
-
const candidates = [
|
|
96
|
-
process.env.PK_TEST_TEMP_ROOT,
|
|
97
|
-
fs.existsSync(sharedRoot) ? sharedRoot : null,
|
|
98
|
-
process.env.TEMP,
|
|
99
|
-
process.env.TMP,
|
|
100
|
-
process.env.TMPDIR,
|
|
101
|
-
];
|
|
102
|
-
const chosen = candidates.find(value => value && String(value).trim());
|
|
103
|
-
const root = path.resolve(chosen ? String(chosen).trim() : os.tmpdir());
|
|
104
|
-
if (isInside(root, REPO_ROOT)) throw new Error(`refusing to use a temp root inside the repository: ${root}`);
|
|
105
|
-
return root;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
function ensureTempRoot() {
|
|
109
|
-
const root = resolveTempRoot();
|
|
110
|
-
fs.mkdirSync(root, { recursive: true });
|
|
111
|
-
return root;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function makeTempDir(prefix = 'parallel-workbench') {
|
|
115
|
-
const root = ensureTempRoot();
|
|
116
|
-
const dir = fs.mkdtempSync(path.join(root, `${prefix}-`));
|
|
117
|
-
if (isInside(dir, REPO_ROOT)) throw new Error(`refusing to create a fixture inside the repository: ${dir}`);
|
|
118
|
-
return dir;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function removeTree(dir) {
|
|
122
|
-
if (!dir) return;
|
|
123
|
-
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
async function freePort() {
|
|
127
|
-
return new Promise((resolve, reject) => {
|
|
128
|
-
const server = net.createServer();
|
|
129
|
-
server.unref();
|
|
130
|
-
server.on('error', reject);
|
|
131
|
-
server.listen(0, '127.0.0.1', () => {
|
|
132
|
-
const { port } = server.address();
|
|
133
|
-
server.close(() => {
|
|
134
|
-
if (FORBIDDEN_PORTS.has(Number(port))) { reject(new Error(`refusing to use the live port ${port}`)); return; }
|
|
135
|
-
resolve(Number(port));
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function assertAllowedEndpoint(url, what = 'endpoint') {
|
|
142
|
-
const parsed = new URL(String(url));
|
|
143
|
-
const port = parsed.port ? Number(parsed.port) : (parsed.protocol === 'https:' ? 443 : 80);
|
|
144
|
-
if (FORBIDDEN_PORTS.has(port)) throw new Error(`refusing to contact the live ${what} ${url}`);
|
|
145
|
-
return url;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
async function waitForHttp(url, timeoutMs = 30000) {
|
|
149
|
-
assertAllowedEndpoint(url, 'service');
|
|
150
|
-
const until = Date.now() + timeoutMs;
|
|
151
|
-
let lastError = null;
|
|
152
|
-
while (Date.now() < until) {
|
|
153
|
-
try {
|
|
154
|
-
const response = await fetch(url, { signal: AbortSignal.timeout(2000) });
|
|
155
|
-
if (response.ok) return true;
|
|
156
|
-
lastError = new Error(`HTTP ${response.status}`);
|
|
157
|
-
} catch (error) { lastError = error; }
|
|
158
|
-
await new Promise(resolve => setTimeout(resolve, 100));
|
|
159
|
-
}
|
|
160
|
-
throw new Error(`Timed out waiting for ${url}: ${lastError && lastError.message}`);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function sanitizedEnv(extra = {}) {
|
|
164
|
-
const env = { ...process.env, ...extra };
|
|
165
|
-
for (const key of AMBIENT_MODULE_URLS) delete env[key];
|
|
166
|
-
for (const key of AMBIENT_MODEL_ENV) delete env[key];
|
|
167
|
-
return env;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
function spawnNode(args, env = {}) {
|
|
171
|
-
const { spawn } = require('node:child_process');
|
|
172
|
-
const child = spawn(process.execPath, args, {
|
|
173
|
-
env: sanitizedEnv(env),
|
|
174
|
-
windowsHide: true,
|
|
175
|
-
stdio: ['ignore', 'pipe', 'pipe'],
|
|
176
|
-
});
|
|
177
|
-
const output = { stdout: '', stderr: '' };
|
|
178
|
-
child.stdout.on('data', chunk => { output.stdout += chunk; });
|
|
179
|
-
child.stderr.on('data', chunk => { output.stderr += chunk; });
|
|
180
|
-
const exited = new Promise(resolve => child.once('close', code => resolve({ code, ...output })));
|
|
181
|
-
return { child, exited, output };
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// --- the isolation directories of one host ---------------------------------
|
|
185
|
-
function createIsolationLayout(prefix = 'parallel-workbench') {
|
|
186
|
-
const root = makeTempDir(prefix);
|
|
187
|
-
const layout = {
|
|
188
|
-
root,
|
|
189
|
-
dataDir: path.join(root, 'workbench-data'),
|
|
190
|
-
knowledgeDataDir: path.join(root, 'knowledge-data'),
|
|
191
|
-
bridgeHome: path.join(root, 'bridge-home'),
|
|
192
|
-
home: path.join(root, 'home'),
|
|
193
|
-
claudeConfigDir: path.join(root, 'claude-config'),
|
|
194
|
-
codexHome: path.join(root, 'codex-home'),
|
|
195
|
-
appData: path.join(root, 'appdata'),
|
|
196
|
-
localAppData: path.join(root, 'localappdata'),
|
|
197
|
-
workspace: path.join(root, 'workspace'),
|
|
198
|
-
temp: path.join(root, 'temp'),
|
|
199
|
-
};
|
|
200
|
-
for (const dir of Object.values(layout)) {
|
|
201
|
-
if (typeof dir === 'string') fs.mkdirSync(dir, { recursive: true });
|
|
202
|
-
}
|
|
203
|
-
fs.writeFileSync(path.join(layout.workspace, 'README.md'), '# Workbench fixture workspace\n', 'utf8');
|
|
204
|
-
// Chrome >= 136 refuses --remote-debugging-port unless it can resolve its
|
|
205
|
-
// DEFAULT user data dir and confirm the passed --user-data-dir differs.
|
|
206
|
-
// The default is derived from %USERPROFILE% (bisect evidence: overriding
|
|
207
|
-
// USERPROFILE alone trips the gate; APPDATA/LOCALAPPDATA/TEMP/HOME do not).
|
|
208
|
-
// An empty default-shaped scaffold under the isolated home lets the
|
|
209
|
-
// resolution succeed, so the real, separate browser-profile directory
|
|
210
|
-
// below this layout is accepted as non-default. The scaffold stays inside
|
|
211
|
-
// the isolated root — nothing of the real machine is touched.
|
|
212
|
-
fs.mkdirSync(path.join(layout.home, 'AppData', 'Local', 'Google', 'Chrome', 'User Data'), { recursive: true });
|
|
213
|
-
fs.mkdirSync(path.join(layout.home, 'AppData', 'Roaming'), { recursive: true });
|
|
214
|
-
return layout;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// The complete R5 isolation whitelist: every value an own child (probe, host,
|
|
218
|
-
// browser) may resolve through its environment points into this layout.
|
|
219
|
-
function isolationEnvMap(layout) {
|
|
220
|
-
const parsed = path.parse(layout.home);
|
|
221
|
-
return {
|
|
222
|
-
HOME: layout.home,
|
|
223
|
-
USERPROFILE: layout.home,
|
|
224
|
-
HOMEDRIVE: parsed.root,
|
|
225
|
-
HOMEPATH: parsed.root === path.sep ? layout.home.slice(1) : layout.home.slice(parsed.root.length),
|
|
226
|
-
CODEX_HOME: layout.codexHome,
|
|
227
|
-
CLAUDE_CONFIG_DIR: layout.claudeConfigDir,
|
|
228
|
-
APPDATA: layout.appData,
|
|
229
|
-
LOCALAPPDATA: layout.localAppData,
|
|
230
|
-
TEMP: layout.temp,
|
|
231
|
-
TMP: layout.temp,
|
|
232
|
-
TMPDIR: layout.temp,
|
|
233
|
-
KB_DATA_DIR: layout.knowledgeDataDir,
|
|
234
|
-
KB_KNOWLEDGE_DATA_DIR: layout.knowledgeDataDir,
|
|
235
|
-
AI_CODING_EVENT_BRIDGE_HOME: layout.bridgeHome,
|
|
236
|
-
AGENT_TERMINAL_DATA_DIR: layout.dataDir,
|
|
237
|
-
CLAUDE_AI_WORKBENCH_DATA_DIR: layout.dataDir,
|
|
238
|
-
KB_MODULES_AUTOSTART: '0',
|
|
239
|
-
};
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
// The environment a host child may inherit. Unlike the accepted fixture this
|
|
243
|
-
// passes NO real profile directory: there is no real profile source in R5.
|
|
244
|
-
function hostEnv(layout, extra = {}) {
|
|
245
|
-
return sanitizedEnv({ ...isolationEnvMap(layout), ...extra });
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
// --- the real profile location (path string ONLY) --------------------------
|
|
249
|
-
// Where the product keeps its real profiles, resolved from the real home
|
|
250
|
-
// captured at module load. R5 uses this string exclusively to prove that no
|
|
251
|
-
// isolated env value points there; this helper never touches the filesystem.
|
|
252
|
-
function realWorkbenchProfileDir() {
|
|
253
|
-
return path.join(REAL_HOME, '.project-knowledge', 'workbench');
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
// The module that is hosted: the copy the installed product ships, unless
|
|
257
|
-
// the caller pins another one explicitly. Callers must resolve this BEFORE
|
|
258
|
-
// applying isolationEnvMap to their own process.env — the discovery reads
|
|
259
|
-
// the real APPDATA.
|
|
260
|
-
function resolveHostModuleRoot(options = {}) {
|
|
261
|
-
const override = String(options.moduleRoot || process.env.PK_WB_MODULE_ROOT || '').trim();
|
|
262
|
-
if (override) return path.resolve(override);
|
|
263
|
-
const appData = String(process.env.APPDATA || '').trim();
|
|
264
|
-
if (appData) {
|
|
265
|
-
const candidate = path.join(appData, 'npm', 'node_modules', '@sanqianx', 'project-knowledge', 'node_modules', 'claude-ai-workbench');
|
|
266
|
-
if (fs.existsSync(path.join(candidate, 'packages', 'server', 'package.json'))) return candidate;
|
|
267
|
-
}
|
|
268
|
-
const repoPin = path.join(REPO_ROOT, 'node_modules', 'claude-ai-workbench');
|
|
269
|
-
if (fs.existsSync(path.join(repoPin, 'packages', 'server', 'package.json'))) return repoPin;
|
|
270
|
-
return null;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
module.exports = {
|
|
274
|
-
REPO_ROOT,
|
|
275
|
-
FORBIDDEN_PORTS,
|
|
276
|
-
AMBIENT_MODULE_URLS,
|
|
277
|
-
AMBIENT_MODEL_ENV,
|
|
278
|
-
REAL_HOME,
|
|
279
|
-
REAL_USERPROFILE,
|
|
280
|
-
ISOLATION_PATH_KEYS,
|
|
281
|
-
resolveTempRoot,
|
|
282
|
-
ensureTempRoot,
|
|
283
|
-
makeTempDir,
|
|
284
|
-
removeTree,
|
|
285
|
-
freePort,
|
|
286
|
-
assertAllowedEndpoint,
|
|
287
|
-
waitForHttp,
|
|
288
|
-
sanitizedEnv,
|
|
289
|
-
spawnNode,
|
|
290
|
-
createIsolationLayout,
|
|
291
|
-
isolationEnvMap,
|
|
292
|
-
hostEnv,
|
|
293
|
-
realWorkbenchProfileDir,
|
|
294
|
-
resolveHostModuleRoot,
|
|
295
|
-
};
|