@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,141 +0,0 @@
|
|
|
1
|
-
// Run: node _site/_test/codex-notify-fanout-test.js
|
|
2
|
-
const assert = require('assert');
|
|
3
|
-
const fs = require('fs');
|
|
4
|
-
const os = require('os');
|
|
5
|
-
const path = require('path');
|
|
6
|
-
const { spawn, spawnSync } = require('child_process');
|
|
7
|
-
|
|
8
|
-
const ROOT = path.resolve(__dirname, '..', '..');
|
|
9
|
-
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), `pk-codex-fanout-${process.pid}-`));
|
|
10
|
-
const fanout = path.join(ROOT, '_site', 'scripts', 'codex-notify-fanout.cjs');
|
|
11
|
-
const receiver = path.join(TEMP, 'receiver.cjs');
|
|
12
|
-
|
|
13
|
-
// Completion protocol: receivers stage the JSON beside the target and publish
|
|
14
|
-
// with rename, so the polling reader only ever observes a fully written file.
|
|
15
|
-
// A direct writeFileSync made the file visible while still empty and CI run
|
|
16
|
-
// 39849466967 read it mid-write (Unexpected end of JSON input).
|
|
17
|
-
fs.writeFileSync(receiver, [
|
|
18
|
-
"let data = '';",
|
|
19
|
-
"process.stdin.on('data', chunk => data += chunk);",
|
|
20
|
-
"process.stdin.on('end', () => { const fs = require('fs'); const output = process.argv[2];",
|
|
21
|
-
" const staging = output + '.tmp-' + process.pid;",
|
|
22
|
-
" fs.writeFileSync(staging, JSON.stringify({",
|
|
23
|
-
" stdin: data, args: process.argv.slice(3), sessionsRoot: process.env.CODEX_SESSIONS_ROOT || null,",
|
|
24
|
-
' }));',
|
|
25
|
-
' fs.renameSync(staging, output); });',
|
|
26
|
-
].join('\n'), 'utf8');
|
|
27
|
-
|
|
28
|
-
function encoded(command) {
|
|
29
|
-
return Buffer.from(JSON.stringify(command)).toString('base64');
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function receiverCommand(output) {
|
|
33
|
-
return [process.execPath, receiver, path.join(TEMP, output)];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function options(next, bridge) {
|
|
37
|
-
return ['--next-base64', encoded(next), '--bridge-base64', encoded(bridge)];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
async function received(fileName) {
|
|
41
|
-
const file = path.join(TEMP, fileName);
|
|
42
|
-
for (let attempt = 0; attempt < 150; attempt += 1) {
|
|
43
|
-
if (fs.existsSync(file)) return JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
44
|
-
await new Promise(resolve => setTimeout(resolve, 20));
|
|
45
|
-
}
|
|
46
|
-
throw new Error(`timed out waiting for ${fileName}`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function run(args, input = '') {
|
|
50
|
-
const result = spawnSync(process.execPath, [fanout, ...args], {
|
|
51
|
-
input,
|
|
52
|
-
encoding: 'utf8',
|
|
53
|
-
windowsHide: true,
|
|
54
|
-
timeout: 5000,
|
|
55
|
-
});
|
|
56
|
-
assert.strictEqual(result.status, 0, result.stderr || result.error?.message || 'fan-out process should succeed');
|
|
57
|
-
assert.strictEqual(result.stderr, '', 'a broken notifier must not emit an unhandled child-process error');
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
function runWithOpenStdin(args) {
|
|
61
|
-
return new Promise((resolve, reject) => {
|
|
62
|
-
const child = spawn(process.execPath, [fanout, ...args], {
|
|
63
|
-
stdio: ['pipe', 'ignore', 'pipe'],
|
|
64
|
-
windowsHide: true,
|
|
65
|
-
});
|
|
66
|
-
let stderr = '';
|
|
67
|
-
child.stderr.setEncoding('utf8');
|
|
68
|
-
child.stderr.on('data', chunk => { stderr += chunk; });
|
|
69
|
-
const timer = setTimeout(() => {
|
|
70
|
-
child.kill();
|
|
71
|
-
reject(new Error('argv notification waited for stdin to end'));
|
|
72
|
-
}, 5000);
|
|
73
|
-
child.once('error', error => { clearTimeout(timer); reject(error); });
|
|
74
|
-
child.once('exit', status => {
|
|
75
|
-
clearTimeout(timer);
|
|
76
|
-
child.stdin.destroy();
|
|
77
|
-
try {
|
|
78
|
-
assert.strictEqual(status, 0, stderr || 'argv notification must succeed with stdin still open');
|
|
79
|
-
assert.strictEqual(stderr, '');
|
|
80
|
-
resolve();
|
|
81
|
-
} catch (error) {
|
|
82
|
-
reject(error);
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
(async () => {
|
|
89
|
-
const legacy = JSON.stringify({ session_id: 'codex-session-test', type: 'turn-ended' });
|
|
90
|
-
run(options(receiverCommand('stdin-next.json'), receiverCommand('stdin-bridge.json')), legacy);
|
|
91
|
-
const [stdinNext, stdinBridge] = await Promise.all([received('stdin-next.json'), received('stdin-bridge.json')]);
|
|
92
|
-
assert.strictEqual(stdinNext.stdin, legacy, 'stdin notifier keeps the original payload bytes');
|
|
93
|
-
assert.deepStrictEqual(stdinNext.args, [], 'stdin notification is not unexpectedly converted into argv');
|
|
94
|
-
assert.strictEqual(stdinBridge.stdin, legacy, 'existing session_id payload remains unchanged');
|
|
95
|
-
assert.deepStrictEqual(stdinBridge.args, [], 'Bridge always receives stdin');
|
|
96
|
-
|
|
97
|
-
// This is the documented Codex notify shape, not an invented session event.
|
|
98
|
-
const official = '{ "type": "agent-turn-complete", "thread-id": "codex-thread-test", "turn-id": "turn-41", "last-assistant-message": "摘要不应成为伪造的会话证据" }';
|
|
99
|
-
await runWithOpenStdin([
|
|
100
|
-
...options(receiverCommand('argv-next.json'), receiverCommand('argv-bridge.json')),
|
|
101
|
-
official,
|
|
102
|
-
]);
|
|
103
|
-
const [argvNext, argvBridge] = await Promise.all([received('argv-next.json'), received('argv-bridge.json')]);
|
|
104
|
-
assert.deepStrictEqual(argvNext.args, [official], 'third-party notifier receives the original single JSON argument');
|
|
105
|
-
assert.strictEqual(argvNext.stdin, '', 'argv notifier must not also receive a duplicate stdin payload');
|
|
106
|
-
const normalized = JSON.parse(argvBridge.stdin);
|
|
107
|
-
assert.strictEqual(normalized.session_id, 'codex-thread-test', 'official thread-id wakes the matching Bridge rollout reader');
|
|
108
|
-
assert.strictEqual(normalized.turn_id, 'turn-41');
|
|
109
|
-
assert.strictEqual(normalized['last-assistant-message'], JSON.parse(official)['last-assistant-message']);
|
|
110
|
-
assert.deepStrictEqual(argvBridge.args, [], 'official payload is adapted into Bridge stdin only');
|
|
111
|
-
assert.strictEqual(argvBridge.sessionsRoot, process.env.CODEX_SESSIONS_ROOT || path.join(process.env.CODEX_HOME || path.join(os.homedir(), '.codex'), 'sessions'));
|
|
112
|
-
|
|
113
|
-
run(options(receiverCommand('official-stdin-next.json'), receiverCommand('official-stdin-bridge.json')), official);
|
|
114
|
-
const [officialStdinNext, officialStdinBridge] = await Promise.all([
|
|
115
|
-
received('official-stdin-next.json'), received('official-stdin-bridge.json'),
|
|
116
|
-
]);
|
|
117
|
-
assert.strictEqual(officialStdinNext.stdin, official, 'legacy stdin transport preserves official payload bytes for third parties');
|
|
118
|
-
assert.strictEqual(JSON.parse(officialStdinBridge.stdin).session_id, 'codex-thread-test');
|
|
119
|
-
|
|
120
|
-
const alias = JSON.stringify({ sessionId: 'already-authoritative', turnId: 'already-turn', 'thread-id': 'different-thread', 'turn-id': 'different-turn' });
|
|
121
|
-
run(options(null, receiverCommand('alias-bridge.json')), alias);
|
|
122
|
-
assert.strictEqual((await received('alias-bridge.json')).stdin, alias, 'existing authoritative legacy aliases must not be overridden');
|
|
123
|
-
|
|
124
|
-
const missingExecutable = [path.join(TEMP, 'missing-notifier.exe')];
|
|
125
|
-
run(options(missingExecutable, receiverCommand('after-next-failure.json')), legacy);
|
|
126
|
-
assert.strictEqual((await received('after-next-failure.json')).stdin, legacy, 'failed third-party spawn cannot block Bridge');
|
|
127
|
-
run([...options(receiverCommand('after-bridge-failure.json'), missingExecutable), official]);
|
|
128
|
-
assert.deepStrictEqual((await received('after-bridge-failure.json')).args, [official], 'failed Bridge spawn cannot block third-party notifier');
|
|
129
|
-
run(['--next-base64', 'not-json', '--bridge-base64', encoded(receiverCommand('after-invalid-next.json'))], legacy);
|
|
130
|
-
assert.strictEqual((await received('after-invalid-next.json')).stdin, legacy, 'invalid encoded branch cannot block the valid branch');
|
|
131
|
-
|
|
132
|
-
// A child closing stdin early must not cause an EPIPE crash or lose the other branch.
|
|
133
|
-
run(options([process.execPath, '-e', 'process.exit(0)'], receiverCommand('after-closed-stdin.json')), JSON.stringify({ session_id: 'large-payload', padding: 'x'.repeat(1024 * 1024) }));
|
|
134
|
-
assert.strictEqual(JSON.parse((await received('after-closed-stdin.json')).stdin).session_id, 'large-payload');
|
|
135
|
-
console.log('codex-notify-fanout-test PASS');
|
|
136
|
-
})().catch(error => {
|
|
137
|
-
console.error(error.stack || error.message);
|
|
138
|
-
process.exitCode = 1;
|
|
139
|
-
}).finally(() => {
|
|
140
|
-
fs.rmSync(TEMP, { recursive: true, force: true });
|
|
141
|
-
});
|
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
// Run: node _site/_test/codex-notify-upgrade-test.js
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const assert = require('assert');
|
|
5
|
-
const fs = require('fs');
|
|
6
|
-
const os = require('os');
|
|
7
|
-
const path = require('path');
|
|
8
|
-
const { IntegrationManager } = require('../lib/integration-installer');
|
|
9
|
-
const { planNotify, writeNotify } = require('../lib/codex-notify-config');
|
|
10
|
-
|
|
11
|
-
const ROOT = path.resolve(__dirname, '..', '..');
|
|
12
|
-
const TEMP = fs.mkdtempSync(path.join(os.tmpdir(), `pk-codex-notify-upgrade-${process.pid}-`));
|
|
13
|
-
const CURRENT_FANOUT = path.join(ROOT, '_site', 'scripts', 'codex-notify-fanout.cjs');
|
|
14
|
-
|
|
15
|
-
function encode(command) {
|
|
16
|
-
return Buffer.from(JSON.stringify(command)).toString('base64');
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function writeFixtureFile(file, content = '// isolated notifier fixture\n') {
|
|
20
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
21
|
-
fs.writeFileSync(file, content, 'utf8');
|
|
22
|
-
return file;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function desktopCommand(name, previous, exists) {
|
|
26
|
-
const executable = path.join(TEMP, name, 'OpenAI', 'Codex', 'runtimes', 'cua_node', '0123456789abcdef', 'bin', 'node_modules', '@oai', 'sky', 'bin', 'windows', 'codex-computer-use.exe');
|
|
27
|
-
if (exists) writeFixtureFile(executable, '');
|
|
28
|
-
return [executable, 'turn-ended', '--previous-notify', JSON.stringify(previous)];
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function oldFanout(name, previous, bridge, scoped = false) {
|
|
32
|
-
const packagePath = scoped ? ['@sanqianx', 'project-knowledge'] : ['project-knowledge'];
|
|
33
|
-
const file = path.join(TEMP, name, 'npm', 'node_modules', ...packagePath, '_site', 'scripts', 'codex-notify-fanout.cjs');
|
|
34
|
-
return ['node', file, ...(previous ? ['--next-base64', encode(previous)] : []), '--bridge-base64', encode(bridge)];
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function fixture(name, notify) {
|
|
38
|
-
const directory = path.join(TEMP, name);
|
|
39
|
-
const configFile = path.join(directory, 'home', '.codex', 'config.toml');
|
|
40
|
-
const bridgeHomeDir = path.join(directory, 'bridge-home');
|
|
41
|
-
const before = `# unrelated settings must survive\r\nmodel = "test-model"\r\nnotify = ${JSON.stringify(notify)}\r\n[features]\r\nreview = true\r\n`;
|
|
42
|
-
writeFixtureFile(configFile, before);
|
|
43
|
-
return {
|
|
44
|
-
before,
|
|
45
|
-
configFile,
|
|
46
|
-
bridgeHomeDir,
|
|
47
|
-
manager: new IntegrationManager({
|
|
48
|
-
rootDir: ROOT,
|
|
49
|
-
homeDir: path.join(directory, 'home'),
|
|
50
|
-
env: {},
|
|
51
|
-
bridgeHomeDir,
|
|
52
|
-
codexConfigFile: configFile,
|
|
53
|
-
commandResolver: name => name,
|
|
54
|
-
runner: () => ({ status: 0, stdout: '', stderr: '' }),
|
|
55
|
-
}),
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
function readNotify(configFile) {
|
|
60
|
-
const source = fs.readFileSync(configFile, 'utf8');
|
|
61
|
-
const line = source.split(/\r?\n/).find(value => /^notify\s*=/.test(value));
|
|
62
|
-
return line ? JSON.parse(line.replace(/^notify\s*=\s*/, '')) : null;
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
function descendants(command) {
|
|
66
|
-
if (!command) return [];
|
|
67
|
-
const result = [command];
|
|
68
|
-
for (let index = 0; index < command.length - 1; index += 1) {
|
|
69
|
-
const marker = command[index];
|
|
70
|
-
if (!['--previous-notify', '--next-base64', '--bridge-base64'].includes(marker)) continue;
|
|
71
|
-
const text = marker === '--previous-notify' ? command[index + 1] : Buffer.from(command[index + 1], 'base64').toString('utf8');
|
|
72
|
-
try {
|
|
73
|
-
const child = JSON.parse(text);
|
|
74
|
-
if (Array.isArray(child)) result.push(...descendants(child));
|
|
75
|
-
} catch {
|
|
76
|
-
// Fixtures also exercise uninterpreted third-party arguments.
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return result;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function assertUnrelatedSettings(item) {
|
|
83
|
-
const source = fs.readFileSync(item.configFile, 'utf8');
|
|
84
|
-
assert(source.startsWith('# unrelated settings must survive\r\nmodel = "test-model"\r\n'), 'retain comments, settings, and CRLF');
|
|
85
|
-
assert(source.endsWith('[features]\r\nreview = true\r\n'), 'retain unrelated TOML sections');
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function assertCurrentCapture(item) {
|
|
89
|
-
const commands = descendants(readNotify(item.configFile));
|
|
90
|
-
assert.strictEqual(commands.filter(command => command[1] === CURRENT_FANOUT).length, 1, 'exactly one current managed fan-out remains');
|
|
91
|
-
assert.strictEqual(commands.filter(command => command.join('\n') === ['node', path.join(item.bridgeHomeDir, 'bin', 'bridge-hook.cjs')].join('\n')).length, 1, 'capture targets the current bridge home exactly once');
|
|
92
|
-
assertUnrelatedSettings(item);
|
|
93
|
-
return commands;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async function assertInstallIdempotent(item) {
|
|
97
|
-
const installed = await item.manager.installCaptureCodex();
|
|
98
|
-
assert(installed.installed && !installed.conflict, JSON.stringify(installed));
|
|
99
|
-
assertCurrentCapture(item);
|
|
100
|
-
const first = fs.readFileSync(item.configFile, 'utf8');
|
|
101
|
-
const repeated = await item.manager.installCaptureCodex();
|
|
102
|
-
assert(repeated.installed && !repeated.conflict, 'repeat install must succeed');
|
|
103
|
-
assert.strictEqual(fs.readFileSync(item.configFile, 'utf8'), first, 'repeat install must not add wrappers or rewrite a healthy chain');
|
|
104
|
-
const status = await item.manager.statusCaptureCodex();
|
|
105
|
-
assert(status.installed && !status.conflict, 'status must recognize repaired capture through desktop wrappers');
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
async function main() {
|
|
109
|
-
// Mirrors the upgrade failure: a live Codex outer wrapper embeds a missing
|
|
110
|
-
// unscoped package wrapper, which embeds a removed Codex runtime wrapper.
|
|
111
|
-
const radarFile = writeFixtureFile(path.join(TEMP, 'tools', 'devtask-radar', 'connectors', 'codex', 'notify-hook.js'));
|
|
112
|
-
const radar = ['node', radarFile, '--config', path.join(TEMP, 'radar settings.json')];
|
|
113
|
-
const staleBridge = ['node', path.join(TEMP, 'old-data', 'events', 'bin', 'bridge-hook.cjs')];
|
|
114
|
-
const missingDesktop = desktopCommand('removed-codex-runtime', radar, false);
|
|
115
|
-
const stalePackage = oldFanout('removed-unscoped-package', missingDesktop, staleBridge);
|
|
116
|
-
const liveDesktop = desktopCommand('current-codex-runtime', stalePackage, true);
|
|
117
|
-
const upgrade = fixture('upgrade', liveDesktop);
|
|
118
|
-
await assertInstallIdempotent(upgrade);
|
|
119
|
-
const upgraded = readNotify(upgrade.configFile);
|
|
120
|
-
assert.deepStrictEqual(upgraded.slice(0, 3), liveDesktop.slice(0, 3), 'preserve the live desktop notifier as the outer command');
|
|
121
|
-
const upgradedCommands = descendants(upgraded);
|
|
122
|
-
assert(upgradedCommands.some(command => JSON.stringify(command) === JSON.stringify(radar)), 'retain the valid Radar command and every non-notify argument');
|
|
123
|
-
assert(!upgradedCommands.some(command => command.includes(missingDesktop[0])), 'unwrap only the removed, known Codex runtime wrapper');
|
|
124
|
-
assert(!upgradedCommands.some(command => command.includes(stalePackage[1])), 'remove the stale unscoped managed package path');
|
|
125
|
-
assert(!upgradedCommands.some(command => command.includes(staleBridge[1])), 'remove the stale managed bridge home');
|
|
126
|
-
|
|
127
|
-
await upgrade.manager.uninstallCaptureCodex();
|
|
128
|
-
assert.deepStrictEqual(readNotify(upgrade.configFile), desktopCommand('current-codex-runtime', radar, true), 'uninstall restores the valid third-party desktop-to-Radar chain');
|
|
129
|
-
assertUnrelatedSettings(upgrade);
|
|
130
|
-
const removedSource = fs.readFileSync(upgrade.configFile, 'utf8');
|
|
131
|
-
await upgrade.manager.uninstallCaptureCodex();
|
|
132
|
-
assert.strictEqual(fs.readFileSync(upgrade.configFile, 'utf8'), removedSource, 'uninstall is idempotent and retains third-party notification');
|
|
133
|
-
|
|
134
|
-
// Ownership is determined by the installed package path, not by Radar being
|
|
135
|
-
// present: a prior managed fan-out may preserve an arbitrary third-party tool.
|
|
136
|
-
const arbitraryFile = writeFixtureFile(path.join(TEMP, 'tools', 'notify-user.cjs'));
|
|
137
|
-
const arbitrary = ['node', arbitraryFile, '--label', 'existing third party'];
|
|
138
|
-
const scoped = fixture('scoped-package-upgrade', oldFanout('removed-scoped-package', arbitrary, staleBridge, true));
|
|
139
|
-
await assertInstallIdempotent(scoped);
|
|
140
|
-
assert(descendants(readNotify(scoped.configFile)).some(command => JSON.stringify(command) === JSON.stringify(arbitrary)), 'upgrade preserves arbitrary already-chained third-party commands');
|
|
141
|
-
await scoped.manager.uninstallCaptureCodex();
|
|
142
|
-
assert.deepStrictEqual(readNotify(scoped.configFile), arbitrary, 'uninstall unwraps only owned capture, preserving the unrelated command');
|
|
143
|
-
|
|
144
|
-
const liveNestedDesktop = desktopCommand('still-present-previous-codex-runtime', radar, true);
|
|
145
|
-
const preserveLive = fixture('preserve-live-nested-runtime', oldFanout('old-nested-package', liveNestedDesktop, staleBridge));
|
|
146
|
-
await assertInstallIdempotent(preserveLive);
|
|
147
|
-
assert(descendants(readNotify(preserveLive.configFile)).some(command => JSON.stringify(command) === JSON.stringify(liveNestedDesktop)), 'a known but still-present Codex runtime must not be collapsed');
|
|
148
|
-
await preserveLive.manager.uninstallCaptureCodex();
|
|
149
|
-
assert.deepStrictEqual(readNotify(preserveLive.configFile), liveNestedDesktop, 'uninstall retains the complete live Codex runtime wrapper');
|
|
150
|
-
|
|
151
|
-
const missingUnowned = ['python', path.join(TEMP, 'missing-but-user-owned.py'), '--keep-this'];
|
|
152
|
-
const preserveMissing = fixture('preserve-missing-user-command', oldFanout('old-package-user-command', missingUnowned, staleBridge));
|
|
153
|
-
await assertInstallIdempotent(preserveMissing);
|
|
154
|
-
assert(descendants(readNotify(preserveMissing.configFile)).some(command => JSON.stringify(command) === JSON.stringify(missingUnowned)), 'only missing known Codex wrappers may be folded; missing user-owned commands remain untouched');
|
|
155
|
-
await preserveMissing.manager.uninstallCaptureCodex();
|
|
156
|
-
assert.deepStrictEqual(readNotify(preserveMissing.configFile), missingUnowned, 'uninstall restores even a missing user-owned notifier');
|
|
157
|
-
|
|
158
|
-
const bridgeMoved = fixture('bridge-home-upgrade', ['node', CURRENT_FANOUT, '--next-base64', encode(radar), '--bridge-base64', encode(staleBridge)]);
|
|
159
|
-
await assertInstallIdempotent(bridgeMoved);
|
|
160
|
-
assert(!descendants(readNotify(bridgeMoved.configFile)).some(command => command.includes(staleBridge[1])), 'a moved bridge home is repaired even when the package path is unchanged');
|
|
161
|
-
|
|
162
|
-
const fanoutOnly = fixture('managed-only', oldFanout('removed-managed-only', null, staleBridge));
|
|
163
|
-
await assertInstallIdempotent(fanoutOnly);
|
|
164
|
-
await fanoutOnly.manager.uninstallCaptureCodex();
|
|
165
|
-
assert.strictEqual(readNotify(fanoutOnly.configFile), null, 'uninstall removes the notify entry only if no third-party notifier remains');
|
|
166
|
-
assertUnrelatedSettings(fanoutOnly);
|
|
167
|
-
|
|
168
|
-
const defaultLegacy = name => ['node', path.join(TEMP, name, 'home', '.ai-coding-event-bridge', 'bin', 'bridge-hook.cjs')];
|
|
169
|
-
const rawLegacy = fixture('legacy-default-home', defaultLegacy('legacy-default-home'));
|
|
170
|
-
await assertInstallIdempotent(rawLegacy);
|
|
171
|
-
assert(!descendants(readNotify(rawLegacy.configFile)).some(command => command[1] === defaultLegacy('legacy-default-home')[1]), 'replace the known old standalone Bridge instead of chaining it as a third party');
|
|
172
|
-
await rawLegacy.manager.uninstallCaptureCodex();
|
|
173
|
-
assert.strictEqual(readNotify(rawLegacy.configFile), null, 'uninstall must not resurrect a retired Bridge home');
|
|
174
|
-
|
|
175
|
-
const v5Command = ['node', path.join(TEMP, 'legacy-v5-data-home', 'home', '.project-knowledge-v5', 'events', 'bin', 'bridge-hook.cjs')];
|
|
176
|
-
const rawV5 = fixture('legacy-v5-data-home', v5Command);
|
|
177
|
-
await assertInstallIdempotent(rawV5);
|
|
178
|
-
assert(!descendants(readNotify(rawV5.configFile)).some(command => command[1] === v5Command[1]), 'retire the old default data-directory hook rather than chaining its missing script');
|
|
179
|
-
await rawV5.manager.uninstallCaptureCodex();
|
|
180
|
-
assert.strictEqual(readNotify(rawV5.configFile), null, 'uninstall cannot resurrect the retired v5 data-directory hook');
|
|
181
|
-
|
|
182
|
-
const nestedLegacyCommand = defaultLegacy('nested-legacy-default-home');
|
|
183
|
-
const legacyRadar = [...radar, '--previous-notify', JSON.stringify(nestedLegacyCommand)];
|
|
184
|
-
const nestedLegacy = fixture('nested-legacy-default-home', oldFanout('old-with-legacy-next', legacyRadar, staleBridge));
|
|
185
|
-
await assertInstallIdempotent(nestedLegacy);
|
|
186
|
-
assert(!descendants(readNotify(nestedLegacy.configFile)).some(command => command[1] === nestedLegacyCommand[1]), 'remove known stale Bridge capture hidden in a compatible notification branch');
|
|
187
|
-
assert(descendants(readNotify(nestedLegacy.configFile)).some(command => JSON.stringify(command) === JSON.stringify(radar)), 'preserve Radar and its non-notify arguments');
|
|
188
|
-
await nestedLegacy.manager.uninstallCaptureCodex();
|
|
189
|
-
assert.deepStrictEqual(readNotify(nestedLegacy.configFile), radar);
|
|
190
|
-
|
|
191
|
-
// Missing files alone never authorize deleting a third-party notifier.
|
|
192
|
-
// Neither a matching script basename nor the word devtask-radar is ownership.
|
|
193
|
-
for (const [name, command] of [
|
|
194
|
-
['unknown-third-party', ['python', path.join(TEMP, 'missing-user-notifier.py')]],
|
|
195
|
-
['unowned-lookalike', ['node', path.join(TEMP, 'my-custom-tools', 'codex-notify-fanout.cjs')]],
|
|
196
|
-
['unowned-radar-string', ['node', arbitraryFile, '--label', 'devtask-radar']],
|
|
197
|
-
['unowned-desktop-lookalike', [path.join(TEMP, 'custom-tool', 'codex-computer-use.exe'), 'turn-ended', '--previous-notify', JSON.stringify(radar)]],
|
|
198
|
-
]) {
|
|
199
|
-
const item = fixture(name, command);
|
|
200
|
-
const installed = await item.manager.installCaptureCodex();
|
|
201
|
-
assert(installed.conflict && !installed.installed, `${name}: unrecognized third-party notify must remain a conflict`);
|
|
202
|
-
assert.strictEqual(fs.readFileSync(item.configFile, 'utf8'), item.before, `${name}: conflict must leave the config byte-for-byte unchanged`);
|
|
203
|
-
await item.manager.uninstallCaptureCodex();
|
|
204
|
-
assert.strictEqual(fs.readFileSync(item.configFile, 'utf8'), item.before, `${name}: uninstall cannot remove unknown third-party settings`);
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
const rootSetting = fixture('root-setting', radar);
|
|
208
|
-
const tablesOnly = '# retain the original tables\n[features]\nreview = true\n[tui]\nnotifications = false\n';
|
|
209
|
-
fs.writeFileSync(rootSetting.configFile, tablesOnly);
|
|
210
|
-
await rootSetting.manager.installCaptureCodex();
|
|
211
|
-
const rootSource = fs.readFileSync(rootSetting.configFile, 'utf8');
|
|
212
|
-
assert(rootSource.startsWith('notify = '), 'new notify must be a root setting, not inside the final TOML table');
|
|
213
|
-
assert(rootSource.endsWith(tablesOnly), 'existing tables and comments stay byte-for-byte intact');
|
|
214
|
-
await rootSetting.manager.uninstallCaptureCodex();
|
|
215
|
-
assert(fs.readFileSync(rootSetting.configFile, 'utf8').endsWith(tablesOnly));
|
|
216
|
-
|
|
217
|
-
for (const [name, source] of [
|
|
218
|
-
['malformed', 'notify = ["node",\n'],
|
|
219
|
-
['duplicate', `notify = ${JSON.stringify(radar)}\nnotify = ${JSON.stringify(radar)}\n`],
|
|
220
|
-
['malformed-owned', `notify = ${JSON.stringify(['node', CURRENT_FANOUT, '--bridge-base64', 'not-a-command'])}\n`],
|
|
221
|
-
]) {
|
|
222
|
-
const item = fixture(name, radar);
|
|
223
|
-
fs.writeFileSync(item.configFile, source);
|
|
224
|
-
const plan = planNotify(item.configFile, item.manager);
|
|
225
|
-
assert(plan.conflict, `${name}: fail closed on ambiguous notify settings`);
|
|
226
|
-
const result = await item.manager.installCaptureCodex();
|
|
227
|
-
assert(result.conflict && !result.installed);
|
|
228
|
-
assert.strictEqual(fs.readFileSync(item.configFile, 'utf8'), source);
|
|
229
|
-
}
|
|
230
|
-
let deep = radar;
|
|
231
|
-
for (let index = 0; index < 18; index++) deep = desktopCommand(`deep-${index}`, deep, true);
|
|
232
|
-
const tooDeep = fixture('deep-notify', deep);
|
|
233
|
-
assert(planNotify(tooDeep.configFile, tooDeep.manager).conflict, 'bound recursion on repeated wrappers');
|
|
234
|
-
|
|
235
|
-
const compareAndSwap = fixture('concurrent-change', radar);
|
|
236
|
-
const plan = planNotify(compareAndSwap.configFile, compareAndSwap.manager);
|
|
237
|
-
const otherWrite = `${compareAndSwap.before}# written by another application\r\n`;
|
|
238
|
-
fs.writeFileSync(compareAndSwap.configFile, otherWrite);
|
|
239
|
-
assert.throws(() => writeNotify(compareAndSwap.configFile, plan), error => error.code === 'CONFIG_CHANGED');
|
|
240
|
-
assert.strictEqual(fs.readFileSync(compareAndSwap.configFile, 'utf8'), otherWrite, 'do not overwrite a config that changed after preflight');
|
|
241
|
-
|
|
242
|
-
const backup = fixture('notify-only-backup', radar);
|
|
243
|
-
const withSecret = `local_test_key = "must-not-be-backed-up"\r\n${backup.before}`;
|
|
244
|
-
fs.writeFileSync(backup.configFile, withSecret);
|
|
245
|
-
const backedUp = await backup.manager.installCaptureCodex();
|
|
246
|
-
assert(backedUp.backupFile && fs.existsSync(backedUp.backupFile), 'a changed setting gets a recoverable backup');
|
|
247
|
-
const saved = fs.readFileSync(backedUp.backupFile, 'utf8');
|
|
248
|
-
assert(!saved.includes('must-not-be-backed-up'), 'backup must not duplicate unrelated credentials');
|
|
249
|
-
assert.deepStrictEqual(JSON.parse(JSON.parse(saved).notify.replace(/^notify\s*=\s*/, '')), radar);
|
|
250
|
-
|
|
251
|
-
console.log('codex-notify-upgrade-test PASS');
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
module.exports = main().catch(error => {
|
|
255
|
-
console.error(error.stack || error.message);
|
|
256
|
-
process.exitCode = 1;
|
|
257
|
-
}).finally(() => {
|
|
258
|
-
assert(path.resolve(TEMP).startsWith(`${path.resolve(os.tmpdir())}${path.sep}`), 'cleanup stays inside the allocated temp directory');
|
|
259
|
-
fs.rmSync(TEMP, { recursive: true, force: true });
|
|
260
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// Run: node _site/_test/commit-boundary-freeze-test.js
|
|
2
|
-
//
|
|
3
|
-
// T13 gates: frozen snapshots never contain events beyond the commit
|
|
4
|
-
// boundary (I-13), same-workspace-only binding, legacy confidence
|
|
5
|
-
// translation, and idempotent freeze.
|
|
6
|
-
|
|
7
|
-
const assert = require('assert');
|
|
8
|
-
const fs = require('fs');
|
|
9
|
-
const os = require('os');
|
|
10
|
-
const path = require('path');
|
|
11
|
-
const { execSync } = require('child_process');
|
|
12
|
-
const { StorageLayout } = require('../lib/storage-layout');
|
|
13
|
-
const { ProjectRegistryStore } = require('../lib/project-registry-store');
|
|
14
|
-
const { ProjectStore } = require('../lib/project-store');
|
|
15
|
-
const { ConversationStore } = require('../lib/conversation-store');
|
|
16
|
-
const { CommitConversationBinder } = require('../lib/commit-conversation-binder');
|
|
17
|
-
const bridgeModule = require('@sanqianx/ai-coding-event-bridge-console/src/bridge');
|
|
18
|
-
|
|
19
|
-
const temp = fs.mkdtempSync(path.join(os.tmpdir(), `kb-boundary-freeze-${process.pid}-`));
|
|
20
|
-
const layout = new StorageLayout({ dataDir: path.join(temp, 'data') });
|
|
21
|
-
const registry = new ProjectRegistryStore({ layout });
|
|
22
|
-
const projects = new ProjectStore({ layout });
|
|
23
|
-
const store = new ConversationStore({ layout, projectStore: projects, logger: null });
|
|
24
|
-
|
|
25
|
-
function gitRepo(name) {
|
|
26
|
-
const dir = path.join(temp, name);
|
|
27
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
28
|
-
execSync('git init -q', { cwd: dir, stdio: 'ignore' });
|
|
29
|
-
return dir;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
function bridgeRecord(sequence, eventType, role, content, repoIdentity, turnId, confidence) {
|
|
33
|
-
return {
|
|
34
|
-
schema: 'ai-coding-event/v1',
|
|
35
|
-
eventId: `evt-${sequence}`,
|
|
36
|
-
sequence,
|
|
37
|
-
source: 'claude-code',
|
|
38
|
-
eventType,
|
|
39
|
-
role,
|
|
40
|
-
content,
|
|
41
|
-
sessionId: 's-boundary',
|
|
42
|
-
turnId,
|
|
43
|
-
repoIdentity,
|
|
44
|
-
identityConfidence: confidence || 'exact',
|
|
45
|
-
captureStatus: 'complete',
|
|
46
|
-
capturedAt: new Date().toISOString(),
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
(async () => {
|
|
51
|
-
await registry.initialize();
|
|
52
|
-
const ccsPath = gitRepo('ccs');
|
|
53
|
-
const ccbPath = gitRepo('ccb');
|
|
54
|
-
const ccs = (await bridgeModule.resolveRepoContext(ccsPath)).repoIdentity;
|
|
55
|
-
const ccb = (await bridgeModule.resolveRepoContext(ccbPath)).repoIdentity;
|
|
56
|
-
const projectId = 'project-freeze';
|
|
57
|
-
await projects.create(projectId, {
|
|
58
|
-
storageName: projectId,
|
|
59
|
-
displayName: projectId,
|
|
60
|
-
repoPath: ccsPath,
|
|
61
|
-
knowledgePath: path.join(temp, 'knowledge', projectId),
|
|
62
|
-
repoIdentity: ccs,
|
|
63
|
-
}, { conversationBaselineCursor: 99 });
|
|
64
|
-
await registry.add(projectId, { displayName: projectId });
|
|
65
|
-
|
|
66
|
-
const binder = new CommitConversationBinder({ layout, projectStore: projects, conversationStore: store, logger: null });
|
|
67
|
-
|
|
68
|
-
const boundary = (commitSha, cursor, openTurnIds) => store.writeBoundary(projectId, {
|
|
69
|
-
repoIdentity: ccs,
|
|
70
|
-
commitSha,
|
|
71
|
-
parentShas: [],
|
|
72
|
-
branch: 'main',
|
|
73
|
-
committedAt: new Date().toISOString(),
|
|
74
|
-
bridgeCursorAtCommit: cursor,
|
|
75
|
-
openTurnIdsAtCommit: openTurnIds || [],
|
|
76
|
-
operationId: `op-${cursor}`,
|
|
77
|
-
journalSequence: cursor,
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// BOUNDARY-001: user(100), boundary(101), assistant(102) created later.
|
|
81
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(100, 'user_prompt', 'user', 'prompt before boundary', ccs, 'turn-1'));
|
|
82
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(102, 'assistant_response', 'assistant', 'reply after boundary', ccs, 'turn-1'));
|
|
83
|
-
boundary('a'.repeat(40), 101, []);
|
|
84
|
-
const snapshotA = await binder.bind({ projectId, commitSha: 'a'.repeat(40) });
|
|
85
|
-
assert.strictEqual(snapshotA.status, 'available');
|
|
86
|
-
assert.strictEqual(snapshotA.turns.length, 1);
|
|
87
|
-
assert.strictEqual(snapshotA.turns[0].turnId, 'turn-1');
|
|
88
|
-
assert.ok(snapshotA.turns[0].userEvents.some(event => event.sequence === 100), 'user event inside window is bound');
|
|
89
|
-
assert.strictEqual(snapshotA.turns[0].assistantEvents.length, 0, 'assistant beyond boundaryEndCursor must never enter the frozen snapshot');
|
|
90
|
-
|
|
91
|
-
// BOUNDARY-002: user(200), assistant(201) before boundary(202).
|
|
92
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(200, 'user_prompt', 'user', 'second prompt', ccs, 'turn-2'));
|
|
93
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(201, 'assistant_response', 'assistant', 'reply before boundary', ccs, 'turn-2'));
|
|
94
|
-
boundary('b'.repeat(40), 202, []);
|
|
95
|
-
const snapshotB = await binder.bind({ projectId, commitSha: 'b'.repeat(40) });
|
|
96
|
-
assert.ok(snapshotB.turns.some(turn => turn.turnId === 'turn-2'
|
|
97
|
-
&& turn.assistantEvents.some(event => event.sequence === 201)), 'assistant before boundary may enter');
|
|
98
|
-
assert.ok(!snapshotB.turns.some(turn => turn.turnId === 'turn-1'), 'already-bound turn is not re-selected in the next window');
|
|
99
|
-
|
|
100
|
-
// Cross-repo: CCB event right before a CCS commit is never substituted.
|
|
101
|
-
// The consumer would never project a CCB event into the CCS store at all
|
|
102
|
-
// (appendBridgeEvent rejects it); raw appendEvent simulates legacy stored
|
|
103
|
-
// data so the binder's workspace filter is exercised directly.
|
|
104
|
-
{
|
|
105
|
-
const rejected = await store.appendBridgeEvent(projectId, bridgeRecord(299, 'user_prompt', 'user', 'blocked at the door', ccb, 'turn-ccb-blocked')).catch(error => error);
|
|
106
|
-
assert.ok(rejected instanceof Error && rejected.code === 'DATA_CORRUPT', 'appendBridgeEvent rejects foreign-workspace events');
|
|
107
|
-
}
|
|
108
|
-
await store.appendEvent(projectId, {
|
|
109
|
-
eventId: 'evt-300',
|
|
110
|
-
sequence: 300,
|
|
111
|
-
source: 'claude-code',
|
|
112
|
-
eventType: 'user_prompt',
|
|
113
|
-
role: 'user',
|
|
114
|
-
content: 'Modify CCB parser',
|
|
115
|
-
sessionId: 's-boundary',
|
|
116
|
-
turnId: 'turn-ccb',
|
|
117
|
-
repoIdentity: ccb,
|
|
118
|
-
identityConfidence: 'exact',
|
|
119
|
-
captureStatus: 'complete',
|
|
120
|
-
capturedAt: new Date().toISOString(),
|
|
121
|
-
});
|
|
122
|
-
boundary('c'.repeat(40), 301, []);
|
|
123
|
-
const snapshotC = await binder.bind({ projectId, commitSha: 'c'.repeat(40) });
|
|
124
|
-
assert.strictEqual(snapshotC.status, 'no-new-user-prompt', 'no CCS conversation yields a deterministic empty status');
|
|
125
|
-
assert.ok(!JSON.stringify(snapshotC).includes('Modify CCB parser'), 'CCB conversation must not leak into a CCS snapshot');
|
|
126
|
-
|
|
127
|
-
// Legacy confidence translation: stored 'high' behaves as exact.
|
|
128
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(400, 'user_prompt', 'user', 'legacy confidence prompt', ccs, 'turn-3', 'high'));
|
|
129
|
-
boundary('d'.repeat(40), 401, []);
|
|
130
|
-
const snapshotD = await binder.bind({ projectId, commitSha: 'd'.repeat(40) });
|
|
131
|
-
assert.ok(snapshotD.turns.some(turn => turn.turnId === 'turn-3'), 'legacy high/trusted translates to exact for old stored data');
|
|
132
|
-
|
|
133
|
-
// Partial confidence never binds as direct evidence.
|
|
134
|
-
await store.appendBridgeEvent(projectId, bridgeRecord(500, 'user_prompt', 'user', 'partial identity prompt', ccs, 'turn-4', 'partial'));
|
|
135
|
-
boundary('e'.repeat(40), 501, []);
|
|
136
|
-
const snapshotE = await binder.bind({ projectId, commitSha: 'e'.repeat(40) });
|
|
137
|
-
assert.ok(!snapshotE.turns.some(turn => turn.turnId === 'turn-4'), 'partial identity is ambiguous, never direct evidence');
|
|
138
|
-
|
|
139
|
-
// Immutable freeze: rebinding returns the identical hash.
|
|
140
|
-
const rebound = await binder.bind({ projectId, commitSha: 'a'.repeat(40) });
|
|
141
|
-
assert.strictEqual(rebound.snapshotHash, snapshotA.snapshotHash, 'frozen snapshots are never rewritten');
|
|
142
|
-
|
|
143
|
-
console.log('commit-boundary-freeze-test PASS');
|
|
144
|
-
})().catch(error => {
|
|
145
|
-
console.error(error.stack || error.message);
|
|
146
|
-
process.exitCode = 1;
|
|
147
|
-
});
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
const assert = require('assert');
|
|
2
|
-
const fs = require('fs');
|
|
3
|
-
const os = require('os');
|
|
4
|
-
const path = require('path');
|
|
5
|
-
const { StorageLayout } = require('../lib/storage-layout');
|
|
6
|
-
const { ProjectStore } = require('../lib/project-store');
|
|
7
|
-
const { ConversationStore } = require('../lib/conversation-store');
|
|
8
|
-
const { CommitConversationBinder } = require('../lib/commit-conversation-binder');
|
|
9
|
-
|
|
10
|
-
(async () => {
|
|
11
|
-
const root = fs.mkdtempSync(path.join(os.tmpdir(), 'pk-conversation-binding-'));
|
|
12
|
-
const layout = new StorageLayout({ dataDir: path.join(root, 'data') });
|
|
13
|
-
const projectStore = new ProjectStore({ layout });
|
|
14
|
-
const projectId = 'project-binding';
|
|
15
|
-
const repoIdentity = { commonDir: path.join(root, 'repo', '.git') };
|
|
16
|
-
await projectStore.create(projectId, {
|
|
17
|
-
displayName: 'Binding',
|
|
18
|
-
storageName: 'binding',
|
|
19
|
-
repoPath: path.join(root, 'repo'),
|
|
20
|
-
knowledgePath: path.join(root, 'knowledge'),
|
|
21
|
-
repoIdentity,
|
|
22
|
-
}, { conversationBaselineCursor: 0, conversation: { lastConsumedCursor: 0, captureStatus: 'captured' } });
|
|
23
|
-
const store = new ConversationStore({ layout, projectStore });
|
|
24
|
-
const binder = new CommitConversationBinder({ layout, projectStore, conversationStore: store });
|
|
25
|
-
const c1 = '1'.repeat(40);
|
|
26
|
-
const c2 = '2'.repeat(40);
|
|
27
|
-
const c3 = '3'.repeat(40);
|
|
28
|
-
const cMerge = '4'.repeat(40);
|
|
29
|
-
const cAmbiguous = '5'.repeat(40);
|
|
30
|
-
|
|
31
|
-
const append = input => store.appendEvent(projectId, {
|
|
32
|
-
source: 'codex',
|
|
33
|
-
sessionId: 'session-1',
|
|
34
|
-
projectPath: path.join(root, 'repo'),
|
|
35
|
-
repoIdentity,
|
|
36
|
-
branch: 'main',
|
|
37
|
-
headAtCapture: '0'.repeat(40),
|
|
38
|
-
capturedAt: `2026-08-18T02:${String(input.sequence || 0).padStart(2, '0')}:00.000Z`,
|
|
39
|
-
rawEventType: input.eventType,
|
|
40
|
-
identityConfidence: 'high',
|
|
41
|
-
captureStatus: 'captured',
|
|
42
|
-
...input,
|
|
43
|
-
});
|
|
44
|
-
await append({ eventId: 'r1', sequence: 1, eventType: 'user_prompt', role: 'user', content: 'Requirement before C1.', turnId: 'turn-1' });
|
|
45
|
-
const boundaryC1 = { commitSha: c1, repoIdentity, parentShas: [], branch: 'main', committedAt: '2026-08-18T02:02:00.000Z', bridgeCursorAtCommit: 2, journalSequence: 2, openTurnIdsAtCommit: ['turn-1'], operationId: 'op-c1' };
|
|
46
|
-
store.writeBoundary(projectId, boundaryC1);
|
|
47
|
-
assert.strictEqual(store.writeBoundary(projectId, boundaryC1).commitSha, c1, 'identical bridge/hook boundary is idempotent');
|
|
48
|
-
assert.throws(() => store.writeBoundary(projectId, { ...boundaryC1, branch: 'other' }), error => error.code === 'DATA_CORRUPT');
|
|
49
|
-
await append({ eventId: 'a1', sequence: 3, eventType: 'assistant_response', role: 'assistant', content: 'Late assistant before claim.', turnId: 'turn-1' });
|
|
50
|
-
await append({ eventId: 'r2', sequence: 4, eventType: 'user_prompt', role: 'user', content: 'Requirement after C1.', turnId: 'turn-2', headAtCapture: c1 });
|
|
51
|
-
|
|
52
|
-
const frozenC1 = await binder.bind({ projectId, commitSha: c1 });
|
|
53
|
-
assert.strictEqual(frozenC1.status, 'available');
|
|
54
|
-
assert.deepStrictEqual(frozenC1.turns.map(turn => turn.turnId), ['turn-1'], 'future R2 must never bind back to C1');
|
|
55
|
-
assert.deepStrictEqual(frozenC1.turns[0].assistantEvents.map(event => event.eventId), [], 'assistant beyond boundaryEndCursor must never enter the frozen snapshot (I-13)');
|
|
56
|
-
assert.strictEqual(frozenC1.excludedFuturePromptCount, 1);
|
|
57
|
-
const frozenHash = frozenC1.snapshotHash;
|
|
58
|
-
await append({ eventId: 'a1-after-claim', sequence: 6, eventType: 'assistant_response', role: 'assistant', content: 'Assistant arrived after Claim.', turnId: 'turn-1' });
|
|
59
|
-
const retriedC1 = await binder.bind({ projectId, commitSha: c1 });
|
|
60
|
-
assert.strictEqual(retriedC1.snapshotHash, frozenHash, 'retry must reuse the exact Claim-time conversation freeze');
|
|
61
|
-
assert.deepStrictEqual(retriedC1.turns[0].assistantEvents.map(event => event.eventId), [], 'delayed binder execution must not pull post-commit replies into the old snapshot');
|
|
62
|
-
|
|
63
|
-
store.writeBoundary(projectId, { commitSha: c2, repoIdentity, parentShas: [c1], branch: 'main', committedAt: '2026-08-18T02:05:00.000Z', bridgeCursorAtCommit: 5, journalSequence: 5, openTurnIdsAtCommit: ['turn-1'], operationId: 'op-c2' });
|
|
64
|
-
const frozenC2 = await binder.bind({ projectId, commitSha: c2 });
|
|
65
|
-
assert.deepStrictEqual(frozenC2.turns.map(turn => [turn.turnId, turn.bindingKind]), [['turn-1', 'shared-spanning'], ['turn-2', 'direct']]);
|
|
66
|
-
assert.deepStrictEqual(frozenC2.turns[0].assistantEvents.map(event => event.eventId), ['a1'], 'the assistant reply inside the C2 window belongs to the spanning turn');
|
|
67
|
-
assert.strictEqual(frozenC2.turns[0].turnId, frozenC1.turns[0].turnId, 'spanning turns must retain one stable identity across commits');
|
|
68
|
-
|
|
69
|
-
store.writeBoundary(projectId, { commitSha: c3, repoIdentity, parentShas: [c2], branch: 'main', committedAt: '2026-08-18T02:07:00.000Z', bridgeCursorAtCommit: 7, journalSequence: 7, openTurnIdsAtCommit: ['turn-1'], operationId: 'op-c3' });
|
|
70
|
-
const frozenC3 = await binder.bind({ projectId, commitSha: c3 });
|
|
71
|
-
assert.strictEqual(frozenC3.status, 'no-new-user-prompt');
|
|
72
|
-
assert.deepStrictEqual(frozenC3.turns, [], 'a stale Bridge open-turn id must not copy a closed requirement into a later commit');
|
|
73
|
-
|
|
74
|
-
await append({ eventId: 'r-merge', sequence: 8, eventType: 'user_prompt', role: 'user', content: 'Merge-window requirement.', turnId: 'turn-merge' });
|
|
75
|
-
store.writeBoundary(projectId, { commitSha: cMerge, repoIdentity, parentShas: [c1, c2], branch: 'main', committedAt: '2026-08-18T02:10:00.000Z', bridgeCursorAtCommit: 10, journalSequence: 10, openTurnIdsAtCommit: [], operationId: 'op-merge' });
|
|
76
|
-
const mergeSnapshot = await binder.bind({ projectId, commitSha: cMerge });
|
|
77
|
-
assert.strictEqual(mergeSnapshot.boundaryStartCursor, 7, 'merge window must use previous durable repo boundary, not an arbitrary Git parent');
|
|
78
|
-
assert.deepStrictEqual(mergeSnapshot.turns.map(turn => turn.turnId), ['turn-merge']);
|
|
79
|
-
|
|
80
|
-
await append({ eventId: 'r-ambiguous', sequence: 11, eventType: 'user_prompt', role: 'user', content: 'Identity unavailable.', turnId: null, repoIdentity: null, identityConfidence: 'unknown' });
|
|
81
|
-
store.writeBoundary(projectId, { commitSha: cAmbiguous, repoIdentity, parentShas: [cMerge], branch: 'main', committedAt: '2026-08-18T02:12:00.000Z', bridgeCursorAtCommit: 12, journalSequence: 12, openTurnIdsAtCommit: [], operationId: 'op-ambiguous' });
|
|
82
|
-
const ambiguous = await binder.bind({ projectId, commitSha: cAmbiguous });
|
|
83
|
-
assert.strictEqual(ambiguous.status, 'ambiguous');
|
|
84
|
-
assert.deepStrictEqual(ambiguous.turns, []);
|
|
85
|
-
|
|
86
|
-
const missingBoundary = await binder.bind({ projectId, commitSha: '6'.repeat(40) });
|
|
87
|
-
assert.strictEqual(missingBoundary.status, 'unavailable', 'missing boundary/capture gap must never fall back to timestamp or ancestry guessing');
|
|
88
|
-
|
|
89
|
-
const explicitSha = '7'.repeat(40);
|
|
90
|
-
await append({ eventId: 'explicit-r', sequence: null, eventType: 'user_prompt', role: 'user', content: 'Explicit requirement.', turnId: 'turn-explicit', explicitCommitSha: explicitSha, identityConfidence: 'explicit' });
|
|
91
|
-
const explicit = await binder.bind({ projectId, commitSha: explicitSha });
|
|
92
|
-
assert.strictEqual(explicit.status, 'available');
|
|
93
|
-
assert.strictEqual(explicit.turns[0].bindingKind, 'explicit');
|
|
94
|
-
|
|
95
|
-
console.log('commit-conversation-binding-test PASS');
|
|
96
|
-
})().catch(error => {
|
|
97
|
-
console.error(error.stack || error.message);
|
|
98
|
-
process.exitCode = 1;
|
|
99
|
-
});
|