@sanqianx/project-knowledge 5.3.1 → 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 +6 -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 +11 -11
- package/package.json +30 -26
- 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/{_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-team-ui-integration-test.js +0 -219
- 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/ai-team-ui-fixture.js +0 -235
- 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/single-repo-maintenance-fixture.js +0 -94
- package/_site/_test/helpers/single-repo-maintenance-tool.js +0 -56
- 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 -274
- 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 -128
- 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/single-repo-maintenance-e2e-test.js +0 -200
- 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 -27
- 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}/product.css +0 -0
- /package/{ui → resources/ui}/product.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,307 +0,0 @@
|
|
|
1
|
-
// _site/_test/helpers/parallel-dock-isolation-r3-env.js
|
|
2
|
-
//
|
|
3
|
-
// Lane-exclusive fixture for P-DOCK-ISOLATION-R3.
|
|
4
|
-
//
|
|
5
|
-
// The terminal module is NOT started here: the launcher starts it inside the
|
|
6
|
-
// isolated environment and hands over its address through the handoff file.
|
|
7
|
-
// This helper starts the PRODUCT (the pkb server) inside the same isolated
|
|
8
|
-
// environment, runs the real onboarding chain and exposes the public APIs.
|
|
9
|
-
//
|
|
10
|
-
// Read-only references: parallel-dock-acceptance-r2-env.js (the accepted R2
|
|
11
|
-
// fixture) and parallel-dock-isolation-r3-fixture.js (this lane's isolation
|
|
12
|
-
// scaffolding).
|
|
13
|
-
|
|
14
|
-
'use strict';
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
const http = require('http');
|
|
19
|
-
const crypto = require('crypto');
|
|
20
|
-
const { spawnSync } = require('child_process');
|
|
21
|
-
|
|
22
|
-
const { spawnServer } = require('./spawn-server');
|
|
23
|
-
const { sha256File, writeJson, readJsonSafe } = require('./parallel-dock-isolation-r3-fixture.js');
|
|
24
|
-
|
|
25
|
-
const PKB_ROOT = path.resolve(__dirname, '..', '..', '..');
|
|
26
|
-
const MODULE_APP_ROOT = path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'apps', 'agent-terminal');
|
|
27
|
-
const MODULE_API_PREFIX = '/api/claude-workbench/v1';
|
|
28
|
-
|
|
29
|
-
function httpJson(url, { method = 'GET', body, timeoutMs = 8000 } = {}) {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const payload = body === undefined ? null : JSON.stringify(body);
|
|
32
|
-
const request = http.request(url, { method, headers: payload ? { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } : {} }, response => {
|
|
33
|
-
let text = '';
|
|
34
|
-
response.setEncoding('utf8');
|
|
35
|
-
response.on('data', chunk => { text += chunk; });
|
|
36
|
-
response.on('end', () => {
|
|
37
|
-
let data = null;
|
|
38
|
-
try { data = text ? JSON.parse(text) : null; } catch { data = null; }
|
|
39
|
-
resolve({ status: response.statusCode, data, text });
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
request.setTimeout(timeoutMs, () => { request.destroy(new Error('timeout')); });
|
|
43
|
-
request.on('error', reject);
|
|
44
|
-
if (payload) request.write(payload);
|
|
45
|
-
request.end();
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
async function waitForHttpOk(url, label, timeoutMs = 60000, accept = () => true) {
|
|
50
|
-
const deadline = Date.now() + timeoutMs;
|
|
51
|
-
let lastError = 'not attempted';
|
|
52
|
-
while (Date.now() < deadline) {
|
|
53
|
-
try {
|
|
54
|
-
const response = await httpJson(url, { timeoutMs: 3000 });
|
|
55
|
-
if (response.status === 200 && accept(response.data)) return response.data;
|
|
56
|
-
lastError = `status ${response.status}`;
|
|
57
|
-
} catch (error) { lastError = error.message; }
|
|
58
|
-
await new Promise(resolve => setTimeout(resolve, 400));
|
|
59
|
-
}
|
|
60
|
-
throw new Error(`Timed out waiting for ${label} (${lastError}): ${url}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// Creates the product half of the isolated fixture. The module half is
|
|
64
|
-
// already running (started by the launcher with the same isolation).
|
|
65
|
-
async function createDockIsolationEnv({ tag = 'dock-isolation-r3', handoff } = {}) {
|
|
66
|
-
if (!handoff || !handoff.layout || !handoff.moduleUrl) {
|
|
67
|
-
throw new Error('createDockIsolationEnv needs the launcher handoff (layout + moduleUrl)');
|
|
68
|
-
}
|
|
69
|
-
const layout = handoff.layout;
|
|
70
|
-
const productPort = Number(handoff.productPort);
|
|
71
|
-
const productUrl = `http://127.0.0.1:${productPort}`;
|
|
72
|
-
|
|
73
|
-
// A real Git workspace: the onboarding chain imports a real project.
|
|
74
|
-
const git = (args) => spawnSync('git', ['-C', layout.workspace, ...args], { encoding: 'utf8', windowsHide: true });
|
|
75
|
-
let gitOk = git(['init', '-q']).status === 0;
|
|
76
|
-
gitOk = git(['config', 'user.email', 'dock-isolation-r3@example.invalid']).status === 0 && gitOk;
|
|
77
|
-
gitOk = git(['config', 'user.name', 'dock-isolation-r3']).status === 0 && gitOk;
|
|
78
|
-
fs.writeFileSync(path.join(layout.workspace, 'README.md'), '# dock isolation r3 fixture workspace\n', 'utf8');
|
|
79
|
-
gitOk = git(['add', 'README.md']).status === 0 && gitOk;
|
|
80
|
-
gitOk = git(['commit', '-q', '-m', 'fixture baseline']).status === 0 && gitOk;
|
|
81
|
-
if (!gitOk) throw new Error('fixture workspace could not be initialized as a Git repository');
|
|
82
|
-
|
|
83
|
-
// The product inherits the isolated environment of this (already isolated)
|
|
84
|
-
// probe process: spawn-server spreads process.env, and every value in it
|
|
85
|
-
// was allowlisted by the launcher.
|
|
86
|
-
const product = spawnServer({
|
|
87
|
-
root: PKB_ROOT, port: productPort, dataDir: layout.knowledgeDataDir, tag,
|
|
88
|
-
analysisOwner: 'engine',
|
|
89
|
-
extraEnv: {
|
|
90
|
-
KB_TERMINAL_URL: handoff.moduleUrl,
|
|
91
|
-
KB_MODULES_AUTOSTART: '0',
|
|
92
|
-
KB_MODULES_REGISTER: '1',
|
|
93
|
-
},
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
const env = {
|
|
97
|
-
layout,
|
|
98
|
-
handoff,
|
|
99
|
-
workspace: layout.workspace,
|
|
100
|
-
knowledgeDir: layout.knowledgeRoot,
|
|
101
|
-
homeDir: layout.home,
|
|
102
|
-
workbenchDir: layout.dataDir,
|
|
103
|
-
dataDir: layout.knowledgeDataDir,
|
|
104
|
-
productUrl,
|
|
105
|
-
terminalUrl: handoff.moduleUrl,
|
|
106
|
-
productPort,
|
|
107
|
-
terminalPort: handoff.modulePort,
|
|
108
|
-
moduleRoot: handoff.moduleRoot,
|
|
109
|
-
chromePath: handoff.chromePath,
|
|
110
|
-
modelProfile: handoff.profileDefinition
|
|
111
|
-
? {
|
|
112
|
-
profileId: handoff.profileDefinition.id,
|
|
113
|
-
name: handoff.profileDefinition.name,
|
|
114
|
-
provider: handoff.profileDefinition.provider,
|
|
115
|
-
baseUrl: handoff.profileDefinition.baseUrl,
|
|
116
|
-
model: handoff.profileDefinition.models && handoff.profileDefinition.models.default,
|
|
117
|
-
credentialRef: handoff.profileDefinition.credentialRef,
|
|
118
|
-
// The credential lives in the SERVER memory only. It is never copied
|
|
119
|
-
// into a credential file, a backup, a report or a URL.
|
|
120
|
-
credentialConfigured: true,
|
|
121
|
-
credentialLocation: 'server-memory (pipe handoff, overlay on ProfileStore read paths)',
|
|
122
|
-
}
|
|
123
|
-
: null,
|
|
124
|
-
projectId: null,
|
|
125
|
-
terminalProjectId: null,
|
|
126
|
-
processes: { product: product.child, terminal: null },
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const productLog = [];
|
|
130
|
-
const productTail = (chunk) => productLog.push(String(chunk));
|
|
131
|
-
product.child.stdout.on('data', productTail);
|
|
132
|
-
product.child.stderr.on('data', productTail);
|
|
133
|
-
const productLogText = () => productLog.join('');
|
|
134
|
-
|
|
135
|
-
async function cleanup() {
|
|
136
|
-
try { await product.cleanup(); } catch {}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
try {
|
|
140
|
-
const deadline = Date.now() + 60000;
|
|
141
|
-
while (Date.now() < deadline) {
|
|
142
|
-
if (product.child.exitCode !== null) {
|
|
143
|
-
throw new Error(`product server exited early with code ${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
|
|
144
|
-
}
|
|
145
|
-
try {
|
|
146
|
-
const response = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 });
|
|
147
|
-
if (response.status === 200 && response.data && typeof response.data === 'object') break;
|
|
148
|
-
await new Promise(resolve => setTimeout(resolve, 400));
|
|
149
|
-
} catch { await new Promise(resolve => setTimeout(resolve, 400)); }
|
|
150
|
-
}
|
|
151
|
-
const late = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 }).catch(() => null);
|
|
152
|
-
if (!late || late.status !== 200) {
|
|
153
|
-
throw new Error(`product health never came up; exitCode=${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
|
|
154
|
-
}
|
|
155
|
-
} catch (error) {
|
|
156
|
-
await cleanup();
|
|
157
|
-
throw error;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
// Real onboarding chain (settings -> preflight -> import). The import route
|
|
161
|
-
// registers the fixture project with the isolated terminal module.
|
|
162
|
-
const patched = await httpJson(`${productUrl}/api/settings`, {
|
|
163
|
-
method: 'PATCH', body: { knowledge: { rootPath: layout.knowledgeRoot } },
|
|
164
|
-
});
|
|
165
|
-
if (patched.status !== 200 || !(patched.data && patched.data.ok)) {
|
|
166
|
-
await cleanup();
|
|
167
|
-
throw new Error(`settings knowledge-root patch failed: ${patched.status} ${JSON.stringify(patched.data).slice(0, 800)}`);
|
|
168
|
-
}
|
|
169
|
-
const preflight = await httpJson(`${productUrl}/api/projects/preflight-import`, {
|
|
170
|
-
method: 'POST', body: { localPath: layout.workspace },
|
|
171
|
-
});
|
|
172
|
-
if (preflight.status !== 200 || !(preflight.data && preflight.data.ok) || (Array.isArray(preflight.data.problems) && preflight.data.problems.length)) {
|
|
173
|
-
await cleanup();
|
|
174
|
-
throw new Error(`import preflight failed: ${preflight.status} ${JSON.stringify(preflight.data).slice(0, 800)}`);
|
|
175
|
-
}
|
|
176
|
-
const imported = await httpJson(`${productUrl}/api/projects/import`, {
|
|
177
|
-
method: 'POST', body: { localPath: layout.workspace, displayName: 'Dock Isolation R3 Fixture' },
|
|
178
|
-
});
|
|
179
|
-
const terminalModule = imported.data && imported.data.modules && imported.data.modules.terminal;
|
|
180
|
-
if (imported.status !== 201 || !(imported.data && imported.data.projectId)
|
|
181
|
-
|| !(terminalModule && terminalModule.ok === true && terminalModule.status === 'registered' && terminalModule.projectId)) {
|
|
182
|
-
await cleanup();
|
|
183
|
-
throw new Error(`fixture project import/terminal registration failed: ${imported.status} ${JSON.stringify(imported.data).slice(0, 1200)}; product log tail: ${productLogText().slice(-1500)}`);
|
|
184
|
-
}
|
|
185
|
-
env.projectId = imported.data.projectId;
|
|
186
|
-
env.terminalProjectId = terminalModule.projectId;
|
|
187
|
-
|
|
188
|
-
// Through the PRODUCT proxy (the path the product UI actually uses).
|
|
189
|
-
const termApi = (pathname, init) => httpJson(`${productUrl}/api/terminal/${pathname.replace(/^\//, '')}`, init);
|
|
190
|
-
// Direct to the isolated module (same server, bypassing the product proxy).
|
|
191
|
-
const moduleApi = (pathname, init) => httpJson(`${handoff.moduleUrl}${MODULE_API_PREFIX}/${pathname.replace(/^\//, '')}`, init);
|
|
192
|
-
|
|
193
|
-
const knowledgeFile = path.join(layout.dataDir, 'knowledge-contexts.v1.json');
|
|
194
|
-
const seedSessionKnowledge = (sessionId, references, status = 'ready') => {
|
|
195
|
-
const current = readJsonSafe(knowledgeFile) || { schema: 'session-knowledge-context/v1', sessions: {} };
|
|
196
|
-
current.sessions[sessionId] = { status, references, retrievedAt: new Date().toISOString() };
|
|
197
|
-
writeJson(knowledgeFile, current);
|
|
198
|
-
return current;
|
|
199
|
-
};
|
|
200
|
-
|
|
201
|
-
// The isolated module's own native-task store identity.
|
|
202
|
-
const storeScope = () => {
|
|
203
|
-
const raw = readJsonSafe(path.join(layout.dataDir, 'store-id.v1.json'));
|
|
204
|
-
if (!raw) return null;
|
|
205
|
-
return raw.storeId || raw.storeScope || raw.scope || raw.id || null;
|
|
206
|
-
};
|
|
207
|
-
|
|
208
|
-
// A purely fictional profile with a fake key: it needs no provider call at
|
|
209
|
-
// all, and it exercises the module's REAL ProfileStore.
|
|
210
|
-
const seedFictionalProfile = async ({ id = 'r3-fictional', name = 'R3 Fictional', baseUrl = 'https://r3-fictional.invalid', model = 'r3-fictional-model' } = {}) => {
|
|
211
|
-
const saved = await moduleApi('profiles', {
|
|
212
|
-
method: 'POST',
|
|
213
|
-
body: {
|
|
214
|
-
id, name, provider: 'anthropic-compatible', protocol: 'anthropic-compatible',
|
|
215
|
-
baseUrl, models: { default: model }, enabled: true, permissionMode: 'default',
|
|
216
|
-
},
|
|
217
|
-
});
|
|
218
|
-
if (saved.status !== 201 && saved.status !== 200) {
|
|
219
|
-
throw new Error(`fictional profile could not be saved: ${saved.status} ${String(saved.text).slice(0, 600)}`);
|
|
220
|
-
}
|
|
221
|
-
const credential = await moduleApi(`profiles/${id}/credential`, {
|
|
222
|
-
method: 'PUT', body: { secret: 'sk-r3-fictional-invalid-key.invalid' },
|
|
223
|
-
});
|
|
224
|
-
if (credential.status !== 200 && credential.status !== 201 && credential.status !== 204) {
|
|
225
|
-
throw new Error(`fictional credential could not be stored: ${credential.status} ${String(credential.text).slice(0, 600)}`);
|
|
226
|
-
}
|
|
227
|
-
const listed = await moduleApi('profiles');
|
|
228
|
-
const rows = Array.isArray(listed.data) ? listed.data : ((listed.data && listed.data.profiles) || []);
|
|
229
|
-
const found = rows.find(item => item && item.id === id) || null;
|
|
230
|
-
return {
|
|
231
|
-
profileId: id,
|
|
232
|
-
credentialConfigured: Boolean(found && found.credentialConfigured),
|
|
233
|
-
baseUrl,
|
|
234
|
-
model,
|
|
235
|
-
fakeKeyHost: '.invalid',
|
|
236
|
-
};
|
|
237
|
-
};
|
|
238
|
-
|
|
239
|
-
// The environment the PRODUCT process actually received. spawn-server
|
|
240
|
-
// spreads the (already allowlisted) probe environment and overrides the
|
|
241
|
-
// knowledge/bridge locations with its own isolated directories.
|
|
242
|
-
const productEnv = () => ({
|
|
243
|
-
...process.env,
|
|
244
|
-
KB_SITE_PORT: String(productPort),
|
|
245
|
-
KB_SITE_HOST: '127.0.0.1',
|
|
246
|
-
KB_DATA_DIR: product.dataDir,
|
|
247
|
-
KB_KNOWLEDGE_DATA_DIR: product.knowledgeDir,
|
|
248
|
-
KB_CLAUDE_RULES_DIR: product.dataDir,
|
|
249
|
-
KB_SKIP_MIGRATION: '1',
|
|
250
|
-
KB_MODULES_REGISTER: '1',
|
|
251
|
-
KB_MODULES_AUTOSTART: '0',
|
|
252
|
-
KB_TERMINAL_URL: handoff.moduleUrl,
|
|
253
|
-
KB_VECTORHUB_URL: 'http://127.0.0.1:0',
|
|
254
|
-
KB_EVENTBRIDGE_URL: 'http://127.0.0.1:0',
|
|
255
|
-
KB_KNOWLEDGE_ENGINE_URL: 'http://127.0.0.1:0',
|
|
256
|
-
AI_CODING_EVENT_BRIDGE_HOME: product.bridgeHome,
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
const identity = () => ({
|
|
260
|
-
pkbRoot: PKB_ROOT,
|
|
261
|
-
productId: 'project-knowledge _site server (spawn-server bootstrap)',
|
|
262
|
-
productPid: product.child.pid,
|
|
263
|
-
productPort,
|
|
264
|
-
terminalPort: handoff.modulePort,
|
|
265
|
-
terminalPid: handoff.modulePid,
|
|
266
|
-
terminalEntry: handoff.terminalEntry,
|
|
267
|
-
terminalPackageVersion: (() => {
|
|
268
|
-
try { return require(path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'package.json')).version; } catch { return null; }
|
|
269
|
-
})(),
|
|
270
|
-
moduleRoot: handoff.moduleRoot,
|
|
271
|
-
modelProfile: env.modelProfile,
|
|
272
|
-
servedFiles: {
|
|
273
|
-
'agent-terminal/app.js': { path: path.join(MODULE_APP_ROOT, 'app.js') },
|
|
274
|
-
'agent-terminal/right-workspace-dock.js': { path: path.join(MODULE_APP_ROOT, 'right-workspace-dock.js') },
|
|
275
|
-
'agent-terminal/right-dock-panel-registry.js': { path: path.join(MODULE_APP_ROOT, 'right-dock-panel-registry.js') },
|
|
276
|
-
'agent-terminal/panel-host-proof.html': { path: path.join(MODULE_APP_ROOT, 'panel-host-proof.html') },
|
|
277
|
-
'agent-terminal/panel-proof-content.html': { path: path.join(MODULE_APP_ROOT, 'panel-proof-content.html') },
|
|
278
|
-
'ui/product.js': { path: path.join(PKB_ROOT, 'ui', 'product.js') },
|
|
279
|
-
},
|
|
280
|
-
});
|
|
281
|
-
|
|
282
|
-
const fileHashes = () => {
|
|
283
|
-
const out = {};
|
|
284
|
-
const id = identity();
|
|
285
|
-
for (const [name, entry] of Object.entries(id.servedFiles)) out[name] = sha256File(entry.path);
|
|
286
|
-
return out;
|
|
287
|
-
};
|
|
288
|
-
|
|
289
|
-
return {
|
|
290
|
-
...env,
|
|
291
|
-
termApi,
|
|
292
|
-
moduleApi,
|
|
293
|
-
seedSessionKnowledge,
|
|
294
|
-
seedFictionalProfile,
|
|
295
|
-
storeScope,
|
|
296
|
-
identity,
|
|
297
|
-
fileHashes,
|
|
298
|
-
productEnv,
|
|
299
|
-
productEnvKeys: () => Object.keys(productEnv()).sort(),
|
|
300
|
-
cleanup,
|
|
301
|
-
panelProofHostUrl: () => `${handoff.moduleUrl}/agent-terminal/panel-host-proof.html`,
|
|
302
|
-
terminalLogText: () => (handoff.moduleLogPath ? (() => { try { return fs.readFileSync(handoff.moduleLogPath, 'utf8'); } catch { return ''; } })() : ''),
|
|
303
|
-
productLogText,
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
module.exports = { createDockIsolationEnv, MODULE_API_PREFIX, MODULE_APP_ROOT };
|
|
@@ -1,373 +0,0 @@
|
|
|
1
|
-
// _site/_test/helpers/parallel-dock-isolation-r3-fixture.js
|
|
2
|
-
//
|
|
3
|
-
// Lane-exclusive isolation scaffolding for P-DOCK-ISOLATION-R3.
|
|
4
|
-
// Read-only references: _site/_test/helpers/parallel-workbench-drafts-r5-fixture.js
|
|
5
|
-
// (the isolation scaffolding the Leader named as verified) and
|
|
6
|
-
// _site/_test/helpers/parallel-dock-acceptance-r2-env.js. Neither is modified.
|
|
7
|
-
//
|
|
8
|
-
// Contract of this lane:
|
|
9
|
-
// * the PROBE process itself is re-executed with the isolated environment
|
|
10
|
-
// before any product / terminal / Chrome / SDK child is started, so every
|
|
11
|
-
// later child inherits the isolation instead of the developer's shell;
|
|
12
|
-
// * every child environment is an ALLOWLIST: no ambient provider key and no
|
|
13
|
-
// ambient module URL survives;
|
|
14
|
-
// * HOME / USERPROFILE / CODEX_HOME / CLAUDE_CONFIG_DIR / APPDATA /
|
|
15
|
-
// LOCALAPPDATA / TEMP / TMP / TMPDIR, the dual KB data dirs, the Bridge
|
|
16
|
-
// home, the Workbench data dir, the ports and the browser profile all
|
|
17
|
-
// point below ONE root that lives OUTSIDE the repository and carries an
|
|
18
|
-
// owner marker;
|
|
19
|
-
// * Chrome's executable is resolved BEFORE the isolation is applied,
|
|
20
|
-
// because that discovery reads the real %LOCALAPPDATA%.
|
|
21
|
-
|
|
22
|
-
'use strict';
|
|
23
|
-
|
|
24
|
-
const fs = require('fs');
|
|
25
|
-
const os = require('os');
|
|
26
|
-
const path = require('path');
|
|
27
|
-
const net = require('net');
|
|
28
|
-
const crypto = require('crypto');
|
|
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: dropped from every allowlisted environment.
|
|
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 provider credentials: a test may only use the credential it injects
|
|
47
|
-
// 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
|
-
// Any other variable whose name looks like a provider credential, a Bridge
|
|
65
|
-
// token or a product/knowledge variable is dropped as well. The isolation map
|
|
66
|
-
// re-adds the ones this lane owns.
|
|
67
|
-
const AMBIENT_CREDENTIAL_PATTERN = /^(ANTHROPIC|OPENAI|CLAUDE|CLAUDE_CODE|GEMINI|GOOGLE|GROQ|MISTRAL|XAI|COHERE|DEEPSEEK|MINIMAX|MOONSHOT|QWEN|DASHSCOPE|KB_|AI_CODING|AI_)/;
|
|
68
|
-
|
|
69
|
-
// The variables an isolated child may inherit from the launching shell. Only
|
|
70
|
-
// operating-system facts survive - never user state, never credentials.
|
|
71
|
-
const BASE_ENV_KEYS = new Set([
|
|
72
|
-
'SYSTEMROOT', 'WINDIR', 'SYSTEMDRIVE', 'NUMBER_OF_PROCESSORS',
|
|
73
|
-
'PROCESSOR_ARCHITECTURE', 'PROCESSOR_IDENTIFIER', 'PROCESSOR_REVISION',
|
|
74
|
-
'OS', 'PATHEXT', 'COMSPEC', 'PATH', 'LANG', 'LC_ALL', 'LC_CTYPE', 'TZ',
|
|
75
|
-
'TERM', 'SHELL', 'TMPDIR', 'TEMP', 'TMP', 'HOME', 'USERPROFILE',
|
|
76
|
-
'HOMEDRIVE', 'HOMEPATH',
|
|
77
|
-
]);
|
|
78
|
-
|
|
79
|
-
// The absolute-path members of the isolation whitelist.
|
|
80
|
-
const ISOLATION_PATH_KEYS = [
|
|
81
|
-
'HOME',
|
|
82
|
-
'USERPROFILE',
|
|
83
|
-
'CODEX_HOME',
|
|
84
|
-
'CLAUDE_CONFIG_DIR',
|
|
85
|
-
'APPDATA',
|
|
86
|
-
'LOCALAPPDATA',
|
|
87
|
-
'TEMP',
|
|
88
|
-
'TMP',
|
|
89
|
-
'TMPDIR',
|
|
90
|
-
'KB_DATA_DIR',
|
|
91
|
-
'KB_KNOWLEDGE_DATA_DIR',
|
|
92
|
-
'AI_CODING_EVENT_BRIDGE_HOME',
|
|
93
|
-
'AGENT_TERMINAL_DATA_DIR',
|
|
94
|
-
'CLAUDE_AI_WORKBENCH_DATA_DIR',
|
|
95
|
-
];
|
|
96
|
-
|
|
97
|
-
// Captured before any isolation changes HOME.
|
|
98
|
-
const REAL_HOME = os.homedir();
|
|
99
|
-
const REAL_USERPROFILE = process.env.USERPROFILE || REAL_HOME;
|
|
100
|
-
|
|
101
|
-
// Where the product keeps the REAL profiles. Read-only access, one profile at
|
|
102
|
-
// a time, and the secret that is read there never leaves the server process
|
|
103
|
-
// memory: it is handed over through a pipe, never written to a file.
|
|
104
|
-
const REAL_PROFILE_STORES = [
|
|
105
|
-
path.join(REAL_HOME, '.project-knowledge', 'workbench'),
|
|
106
|
-
path.join(REAL_HOME, '.agent-terminal'),
|
|
107
|
-
];
|
|
108
|
-
|
|
109
|
-
function isInside(candidate, parent) {
|
|
110
|
-
const relative = path.relative(parent, candidate);
|
|
111
|
-
return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function resolveTempRoot() {
|
|
115
|
-
const sharedRoot = path.join(path.dirname(REPO_ROOT), '.project-knowledge-test-temp');
|
|
116
|
-
const candidates = [
|
|
117
|
-
process.env.PK_TEST_TEMP_ROOT,
|
|
118
|
-
fs.existsSync(sharedRoot) ? sharedRoot : null,
|
|
119
|
-
process.env.TEMP,
|
|
120
|
-
process.env.TMP,
|
|
121
|
-
process.env.TMPDIR,
|
|
122
|
-
];
|
|
123
|
-
const chosen = candidates.find(value => value && String(value).trim());
|
|
124
|
-
const root = path.resolve(chosen ? String(chosen).trim() : os.tmpdir());
|
|
125
|
-
if (isInside(root, REPO_ROOT)) throw new Error(`refusing to use a temp root inside the repository: ${root}`);
|
|
126
|
-
return root;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function ensureTempRoot() {
|
|
130
|
-
const root = resolveTempRoot();
|
|
131
|
-
fs.mkdirSync(root, { recursive: true });
|
|
132
|
-
return root;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
function makeTempDir(prefix = 'dock-isolation-r3') {
|
|
136
|
-
const root = ensureTempRoot();
|
|
137
|
-
const dir = fs.mkdtempSync(path.join(root, `${prefix}-`));
|
|
138
|
-
if (isInside(dir, REPO_ROOT)) throw new Error(`refusing to create a fixture inside the repository: ${dir}`);
|
|
139
|
-
return dir;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function removeTree(dir) {
|
|
143
|
-
if (!dir) return;
|
|
144
|
-
fs.rmSync(dir, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// One isolated layout: every directory this lane may touch.
|
|
148
|
-
function createIsolationLayout(prefix = 'dock-isolation-r3') {
|
|
149
|
-
const root = makeTempDir(prefix);
|
|
150
|
-
const layout = {
|
|
151
|
-
root,
|
|
152
|
-
home: path.join(root, 'home'),
|
|
153
|
-
claudeConfigDir: path.join(root, 'claude-config'),
|
|
154
|
-
codexHome: path.join(root, 'codex-home'),
|
|
155
|
-
appData: path.join(root, 'appdata-roaming'),
|
|
156
|
-
localAppData: path.join(root, 'appdata-local'),
|
|
157
|
-
temp: path.join(root, 'temp'),
|
|
158
|
-
workspace: path.join(root, 'workspace'),
|
|
159
|
-
knowledgeRoot: path.join(root, 'knowledge-root'),
|
|
160
|
-
knowledgeDataDir: path.join(root, 'knowledge-data'),
|
|
161
|
-
bridgeHome: path.join(root, 'bridge-home'),
|
|
162
|
-
dataDir: path.join(root, 'agent-terminal-data'),
|
|
163
|
-
browserProfile: path.join(root, 'chrome-profile'),
|
|
164
|
-
};
|
|
165
|
-
for (const dir of Object.values(layout)) fs.mkdirSync(dir, { recursive: true });
|
|
166
|
-
// Chrome >= 136 refuses --remote-debugging-port unless it can resolve its
|
|
167
|
-
// DEFAULT user data dir and confirm the passed --user-data-dir differs. The
|
|
168
|
-
// default is derived from the user profile / local app data, so BOTH
|
|
169
|
-
// derivations get an empty scaffold inside the isolated root. Nothing of
|
|
170
|
-
// the real machine is touched.
|
|
171
|
-
fs.mkdirSync(path.join(layout.home, 'AppData', 'Local', 'Google', 'Chrome', 'User Data'), { recursive: true });
|
|
172
|
-
fs.mkdirSync(path.join(layout.home, 'AppData', 'Roaming'), { recursive: true });
|
|
173
|
-
fs.mkdirSync(path.join(layout.localAppData, 'Google', 'Chrome', 'User Data'), { recursive: true });
|
|
174
|
-
fs.mkdirSync(path.join(layout.appData, 'Google', 'Chrome', 'User Data'), { recursive: true });
|
|
175
|
-
return layout;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
function writeOwnerMarker(layout, marker) {
|
|
179
|
-
const file = path.join(layout.root, 'owner-marker.json');
|
|
180
|
-
fs.writeFileSync(file, JSON.stringify(marker, null, 2), 'utf8');
|
|
181
|
-
return file;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
function readOwnerMarker(layout) {
|
|
185
|
-
try { return JSON.parse(fs.readFileSync(path.join(layout.root, 'owner-marker.json'), 'utf8')); } catch { return null; }
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
// The isolation whitelist: every value an own child may resolve through its
|
|
189
|
-
// environment points into this layout.
|
|
190
|
-
function isolationEnvMap(layout) {
|
|
191
|
-
const parsed = path.parse(layout.home);
|
|
192
|
-
return {
|
|
193
|
-
HOME: layout.home,
|
|
194
|
-
USERPROFILE: layout.home,
|
|
195
|
-
HOMEDRIVE: parsed.root,
|
|
196
|
-
HOMEPATH: parsed.root === path.sep ? layout.home.slice(1) : layout.home.slice(parsed.root.length),
|
|
197
|
-
CODEX_HOME: layout.codexHome,
|
|
198
|
-
CLAUDE_CONFIG_DIR: layout.claudeConfigDir,
|
|
199
|
-
APPDATA: layout.appData,
|
|
200
|
-
LOCALAPPDATA: layout.localAppData,
|
|
201
|
-
TEMP: layout.temp,
|
|
202
|
-
TMP: layout.temp,
|
|
203
|
-
TMPDIR: layout.temp,
|
|
204
|
-
KB_DATA_DIR: layout.knowledgeDataDir,
|
|
205
|
-
KB_KNOWLEDGE_DATA_DIR: layout.knowledgeDataDir,
|
|
206
|
-
AI_CODING_EVENT_BRIDGE_HOME: layout.bridgeHome,
|
|
207
|
-
AGENT_TERMINAL_DATA_DIR: layout.dataDir,
|
|
208
|
-
CLAUDE_AI_WORKBENCH_DATA_DIR: layout.dataDir,
|
|
209
|
-
};
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
// The allowlisted operating-system facts of the launching shell.
|
|
213
|
-
function allowlistedBaseEnv(source = process.env) {
|
|
214
|
-
const out = {};
|
|
215
|
-
for (const [key, value] of Object.entries(source || {})) {
|
|
216
|
-
if (value === undefined || value === null) continue;
|
|
217
|
-
const upper = String(key).toUpperCase();
|
|
218
|
-
if (!BASE_ENV_KEYS.has(upper)) continue;
|
|
219
|
-
if (upper === 'TEMP' || upper === 'TMP' || upper === 'TMPDIR'
|
|
220
|
-
|| upper === 'HOME' || upper === 'USERPROFILE'
|
|
221
|
-
|| upper === 'HOMEDRIVE' || upper === 'HOMEPATH') continue;
|
|
222
|
-
out[key] = String(value);
|
|
223
|
-
}
|
|
224
|
-
return out;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// The environment of one isolated child. Nothing ambient survives unless this
|
|
228
|
-
// lane puts it there on purpose.
|
|
229
|
-
function isolatedEnv(layout, extra = {}, source = process.env) {
|
|
230
|
-
const env = { ...allowlistedBaseEnv(source), ...isolationEnvMap(layout) };
|
|
231
|
-
for (const key of AMBIENT_MODULE_URLS) delete env[key];
|
|
232
|
-
for (const key of AMBIENT_MODEL_ENV) delete env[key];
|
|
233
|
-
for (const key of Object.keys(env)) {
|
|
234
|
-
if (AMBIENT_CREDENTIAL_PATTERN.test(key) && !ISOLATION_PATH_KEYS.includes(key)) delete env[key];
|
|
235
|
-
}
|
|
236
|
-
return { ...env, ...extra };
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
async function freePort() {
|
|
240
|
-
return new Promise((resolve, reject) => {
|
|
241
|
-
const server = net.createServer();
|
|
242
|
-
server.unref();
|
|
243
|
-
server.on('error', reject);
|
|
244
|
-
server.listen(0, '127.0.0.1', () => {
|
|
245
|
-
const { port } = server.address();
|
|
246
|
-
server.close(() => {
|
|
247
|
-
if (FORBIDDEN_PORTS.has(Number(port))) { reject(new Error(`refusing to use the live port ${port}`)); return; }
|
|
248
|
-
resolve(Number(port));
|
|
249
|
-
});
|
|
250
|
-
});
|
|
251
|
-
});
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
function sha256File(file) {
|
|
255
|
-
try { return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex'); } catch { return null; }
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
function writeJson(file, value) {
|
|
259
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
260
|
-
fs.writeFileSync(file, JSON.stringify(value, null, 2), 'utf8');
|
|
261
|
-
return file;
|
|
262
|
-
}
|
|
263
|
-
|
|
264
|
-
function readJsonSafe(file) {
|
|
265
|
-
try { return JSON.parse(fs.readFileSync(file, 'utf8')); } catch { return null; }
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// Reads ONE real profile definition and its credential, read-only. The
|
|
269
|
-
// definition is secret-free by construction (normalizeProfile drops every
|
|
270
|
-
// credential field); the secret is returned to the caller only, which hands it
|
|
271
|
-
// to the server process through a pipe.
|
|
272
|
-
function readRealWorkbenchProfile(profileId) {
|
|
273
|
-
for (const store of REAL_PROFILE_STORES) {
|
|
274
|
-
const profilesFile = path.join(store, 'profiles.v2.json');
|
|
275
|
-
const credentialsFile = path.join(store, 'credentials.v1.json');
|
|
276
|
-
if (!fs.existsSync(profilesFile) || !fs.existsSync(credentialsFile)) continue;
|
|
277
|
-
const profiles = readJsonSafe(profilesFile);
|
|
278
|
-
const credentials = readJsonSafe(credentialsFile);
|
|
279
|
-
if (!profiles || !credentials) continue;
|
|
280
|
-
const profile = (profiles.profiles || []).find(item => item && item.id === profileId);
|
|
281
|
-
if (!profile) continue;
|
|
282
|
-
const credentialRef = profile.credentialRef || `credential:${profile.id}`;
|
|
283
|
-
const secret = (credentials.credentials || {})[credentialRef];
|
|
284
|
-
if (!secret) continue;
|
|
285
|
-
// Only the definition leaves this function; the secret travels separately.
|
|
286
|
-
const definition = {
|
|
287
|
-
id: profile.id,
|
|
288
|
-
name: profile.name || profile.id,
|
|
289
|
-
provider: profile.provider || null,
|
|
290
|
-
protocol: profile.protocol || 'anthropic-compatible',
|
|
291
|
-
baseUrl: profile.baseUrl || null,
|
|
292
|
-
openaiBaseUrl: profile.openaiBaseUrl || null,
|
|
293
|
-
credentialRef,
|
|
294
|
-
models: profile.models || null,
|
|
295
|
-
contextWindow: profile.contextWindow || null,
|
|
296
|
-
timeoutMs: profile.timeoutMs || null,
|
|
297
|
-
permissionMode: profile.permissionMode || null,
|
|
298
|
-
enabled: profile.enabled !== false,
|
|
299
|
-
};
|
|
300
|
-
return {
|
|
301
|
-
profileId: profile.id,
|
|
302
|
-
credentialRef,
|
|
303
|
-
secret: String(secret),
|
|
304
|
-
definition,
|
|
305
|
-
sourceStore: path.basename(store),
|
|
306
|
-
sourceStorePath: store,
|
|
307
|
-
};
|
|
308
|
-
}
|
|
309
|
-
throw new Error(`real profile "${profileId}" not found in any installed workbench store`);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
// Proves that the real credential never reached a file: every file below the
|
|
313
|
-
// given roots is searched for the secret literal.
|
|
314
|
-
function scanForSecret(roots, secret) {
|
|
315
|
-
const findings = [];
|
|
316
|
-
let scanned = 0;
|
|
317
|
-
const needle = String(secret || '');
|
|
318
|
-
if (!needle) return { scanned, findings, skipped: 'no secret given' };
|
|
319
|
-
const walk = (dir) => {
|
|
320
|
-
let entries = [];
|
|
321
|
-
try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; }
|
|
322
|
-
for (const entry of entries) {
|
|
323
|
-
const full = path.join(dir, entry.name);
|
|
324
|
-
if (entry.isDirectory()) { walk(full); continue; }
|
|
325
|
-
if (!entry.isFile()) continue;
|
|
326
|
-
let stat = null;
|
|
327
|
-
try { stat = fs.statSync(full); } catch { continue; }
|
|
328
|
-
if (stat.size > 8 * 1024 * 1024) continue;
|
|
329
|
-
let text = '';
|
|
330
|
-
try { text = fs.readFileSync(full, 'utf8'); } catch { continue; }
|
|
331
|
-
scanned += 1;
|
|
332
|
-
if (text.includes(needle)) findings.push(full);
|
|
333
|
-
}
|
|
334
|
-
};
|
|
335
|
-
for (const root of [].concat(roots || [])) walk(root);
|
|
336
|
-
return { scanned, findings };
|
|
337
|
-
}
|
|
338
|
-
|
|
339
|
-
// The names of the environment variables a process received. Values are never
|
|
340
|
-
// recorded for credential-shaped names.
|
|
341
|
-
function envKeyNames(env) {
|
|
342
|
-
return Object.keys(env || {}).sort();
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
module.exports = {
|
|
346
|
-
REPO_ROOT,
|
|
347
|
-
FORBIDDEN_PORTS,
|
|
348
|
-
AMBIENT_MODULE_URLS,
|
|
349
|
-
AMBIENT_MODEL_ENV,
|
|
350
|
-
AMBIENT_CREDENTIAL_PATTERN,
|
|
351
|
-
ISOLATION_PATH_KEYS,
|
|
352
|
-
REAL_HOME,
|
|
353
|
-
REAL_USERPROFILE,
|
|
354
|
-
REAL_PROFILE_STORES,
|
|
355
|
-
resolveTempRoot,
|
|
356
|
-
ensureTempRoot,
|
|
357
|
-
makeTempDir,
|
|
358
|
-
removeTree,
|
|
359
|
-
isInside,
|
|
360
|
-
createIsolationLayout,
|
|
361
|
-
writeOwnerMarker,
|
|
362
|
-
readOwnerMarker,
|
|
363
|
-
isolationEnvMap,
|
|
364
|
-
allowlistedBaseEnv,
|
|
365
|
-
isolatedEnv,
|
|
366
|
-
freePort,
|
|
367
|
-
sha256File,
|
|
368
|
-
writeJson,
|
|
369
|
-
readJsonSafe,
|
|
370
|
-
readRealWorkbenchProfile,
|
|
371
|
-
scanForSecret,
|
|
372
|
-
envKeyNames,
|
|
373
|
-
};
|