@sanqianx/project-knowledge 5.3.1 → 5.4.0

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.
Files changed (471) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +16 -0
  3. package/README.md +17 -14
  4. package/bin/project-knowledge-integrations.js +3 -3
  5. package/bin/project-knowledge-kb.js +2 -2
  6. package/bin/project-knowledge-mcp.js +3 -3
  7. package/bin/project-knowledge.js +5 -5
  8. package/module-runtime-manifest.json +24 -23
  9. package/package.json +31 -27
  10. package/plugins/project-knowledge/.claude-plugin/plugin.json +1 -1
  11. package/plugins/project-knowledge/.codex-plugin/plugin.json +1 -1
  12. package/plugins/project-knowledge/.mcp.json +1 -1
  13. package/{_site → src}/README.md +30 -30
  14. package/{_site/lib → src/automation}/capture-hook-config.js +1 -1
  15. package/{_site/lib → src/automation}/commit-conversation-binder.js +4 -4
  16. package/{_site/lib → src/automation}/commit-processing-ledger.js +27 -27
  17. package/{_site/lib → src/automation}/commit-reconciler.js +11 -11
  18. package/{_site/lib → src/automation}/hook-manager.js +203 -203
  19. package/{_site/lib → src/automation}/post-commit-automation.js +87 -87
  20. package/{_site/lib → src/common}/atomic-file.js +1 -0
  21. package/{_site/lib → src/common}/runtime-endpoint.js +153 -160
  22. package/{_site/lib → src/common}/structured-logger.js +574 -574
  23. package/{_site/lib → src/conversations}/bridge-adapter.js +2 -2
  24. package/{_site/lib → src/conversations}/codex-notify-config.js +6 -3
  25. package/{_site/lib → src/conversations}/conversation-exclusions.js +2 -2
  26. package/{_site/lib → src/conversations}/conversation-query-service.js +144 -144
  27. package/{_site/lib → src/conversations}/conversation-store.js +3 -3
  28. package/{_site/lib → src/conversations}/zcode-context-integration.js +1 -1
  29. package/{_site/lib → src/integrations}/ai-profile-resolver.js +78 -78
  30. package/{_site/lib → src/integrations}/ai-workspace.js +101 -101
  31. package/{_site/lib → src/integrations}/claude-cli-runner.js +1510 -1510
  32. package/{_site/lib → src/integrations}/integration-installer.js +11 -15
  33. package/{_site/lib → src/integrations}/llm-client.js +161 -161
  34. package/{_site/lib → src/knowledge}/context-pack-builder.js +3 -3
  35. package/{_site/lib → src/knowledge}/evidence-bundle.js +2 -2
  36. package/{_site/lib → src/knowledge}/index-service.js +173 -173
  37. package/{_site/lib → src/knowledge}/kb-framework.js +171 -191
  38. package/{_site/lib → src/knowledge}/knowledge-promotion.js +6 -6
  39. package/{_site/lib → src/knowledge}/knowledge-retrieval-service.js +401 -401
  40. package/{_site/lib → src/module_bridge}/engine-connection.js +2 -2
  41. package/{_site/lib → src/module_bridge}/engine-knowledge-client.js +3 -3
  42. package/{_site/lib → src/module_bridge}/module-bridge.js +99 -10
  43. package/{_site/lib → src/projects}/github-team-store.js +1172 -1172
  44. package/{_site/lib → src/projects}/project-lifecycle-service.js +5 -5
  45. package/{_site/lib → src/projects}/project-registry-store.js +3 -3
  46. package/{_site/lib → src/projects}/project-store.js +268 -268
  47. package/{_site/lib → src/projects}/scanner.js +3 -3
  48. package/{_site/lib → src/projects}/settings-store.js +3 -3
  49. package/{_site → src}/scripts/ab-rank-v2-v3.js +4 -4
  50. package/{_site → src}/scripts/hook-trigger.js +158 -158
  51. package/{_site → src}/scripts/install-module-candidates.js +2 -2
  52. package/{_site → src}/scripts/pack-module-candidates.js +5 -3
  53. package/{_site → src}/scripts/refresh-runtime-manifest.js +1 -1
  54. package/{_site → src}/scripts/run-retrieval-gold-isolated.js +6 -6
  55. package/{_site → src}/scripts/sync-product-content.js +2 -2
  56. package/{_site → src}/scripts/verify-product-runtime.js +3 -3
  57. package/{_site → src}/scripts/verify-retrieval-gold.js +1 -1
  58. package/{_site/lib → src/server}/product-data.js +2 -2
  59. package/{_site/lib → src/server}/server-app.js +74 -52
  60. package/{_site/lib → src/server}/storage-layout.js +166 -166
  61. package/{_site → src}/server.js +1 -1
  62. package/{_site/lib → src/tools}/knowledge-tool-runtime.js +366 -366
  63. package/{_site/lib → src/tools}/prompt-registry.js +1 -1
  64. package/{_site/lib → src/tools}/requirement-adapters.js +1 -1
  65. package/{_site/lib → src/tools}/requirement-binder.js +4 -4
  66. package/{_site/lib → src/tools}/requirement-recorder.js +278 -278
  67. package/{_site/lib → src/tools}/workflow-tool-runtime.js +3 -3
  68. package/_site/_test/agent-capture-mcp-ui-test.js +0 -118
  69. package/_site/_test/agent-capture-ui-test.js +0 -103
  70. package/_site/_test/ai-profile-resolver-test.js +0 -137
  71. package/_site/_test/ai-profile-test.js +0 -75
  72. package/_site/_test/ai-team-ui-integration-test.js +0 -219
  73. package/_site/_test/ai-vendor-presets-test.js +0 -91
  74. package/_site/_test/appearance-settings-test.js +0 -148
  75. package/_site/_test/automatic-context-test.js +0 -95
  76. package/_site/_test/automation-queue-test.js +0 -14
  77. package/_site/_test/automation-ui-test.js +0 -40
  78. package/_site/_test/background-task-registry-test.js +0 -43
  79. package/_site/_test/baseline-schema-test.js +0 -91
  80. package/_site/_test/bin-cli-test.js +0 -231
  81. package/_site/_test/bridge-adapter-test.js +0 -95
  82. package/_site/_test/bridge-consumer-service-test.js +0 -310
  83. package/_site/_test/candidate-bin-content-test.js +0 -35
  84. package/_site/_test/candidate-product-assets-test.js +0 -13
  85. package/_site/_test/candidate-release-contract-test.js +0 -14
  86. package/_site/_test/capture-hook-dedup-test.js +0 -198
  87. package/_site/_test/cdp-browser-failure-test.js +0 -103
  88. package/_site/_test/chat-claudecodeui-match-test.js +0 -111
  89. package/_site/_test/claude-executable-discovery-test.js +0 -90
  90. package/_site/_test/claude-session-lifecycle-sweep-test.js +0 -252
  91. package/_site/_test/claude-workbench-test.js +0 -174
  92. package/_site/_test/cli-instance-management-test.js +0 -62
  93. package/_site/_test/cli-version-report-test.js +0 -22
  94. package/_site/_test/client-capture-restart-e2e-test.js +0 -189
  95. package/_site/_test/codex-conversation-projection-test.js +0 -60
  96. package/_site/_test/codex-marketplace-scoped-path-test.js +0 -186
  97. package/_site/_test/codex-notify-capture-e2e-test.js +0 -101
  98. package/_site/_test/codex-notify-fanout-test.js +0 -141
  99. package/_site/_test/codex-notify-upgrade-test.js +0 -260
  100. package/_site/_test/commit-boundary-freeze-test.js +0 -147
  101. package/_site/_test/commit-conversation-binding-test.js +0 -99
  102. package/_site/_test/commit-evidence-test.js +0 -110
  103. package/_site/_test/configuration-generation-test.js +0 -22
  104. package/_site/_test/context-pack-test.js +0 -200
  105. package/_site/_test/context-session-index-test.js +0 -254
  106. package/_site/_test/conversation-api-test.js +0 -119
  107. package/_site/_test/conversation-origin-test.js +0 -15
  108. package/_site/_test/conversation-store-test.js +0 -138
  109. package/_site/_test/cross-repo-isolation-e2e-test.js +0 -187
  110. package/_site/_test/desktop-browser-compat-test.js +0 -28
  111. package/_site/_test/desktop-hook-runtime-regression-test.js +0 -204
  112. package/_site/_test/embedding-config-test.js +0 -32
  113. package/_site/_test/explicit-commit-processor-test.js +0 -37
  114. package/_site/_test/fixtures/fake-browser-exit.js +0 -10
  115. package/_site/_test/fixtures/fake-browser-hang.js +0 -10
  116. package/_site/_test/fixtures/integration-busy-worker.cjs +0 -14
  117. package/_site/_test/fixtures/make-git-repos.js +0 -92
  118. package/_site/_test/fixtures/retrieval-gold-queries.json +0 -36
  119. package/_site/_test/fixtures/slow-startup-integration.cjs +0 -12
  120. package/_site/_test/fixtures/startup-repair-worker.cjs +0 -13
  121. package/_site/_test/folder-picker-output-test.js +0 -19
  122. package/_site/_test/fresh-hook-reimport-test.js +0 -53
  123. package/_site/_test/fresh-product-data-test.js +0 -56
  124. package/_site/_test/full-integration-e2e-test.js +0 -167
  125. package/_site/_test/git-path-compatibility-test.js +0 -80
  126. package/_site/_test/git-validation-test.js +0 -81
  127. package/_site/_test/glm-ui-refresh-review-test.js +0 -313
  128. package/_site/_test/harness-isolation-test.js +0 -138
  129. package/_site/_test/helpers/ai-team-ui-fixture.js +0 -235
  130. package/_site/_test/helpers/cdp-browser.js +0 -386
  131. package/_site/_test/helpers/cdp-network-capture.js +0 -66
  132. package/_site/_test/helpers/find-chrome.js +0 -34
  133. package/_site/_test/helpers/free-port.js +0 -8
  134. package/_site/_test/helpers/logging-ui-fixture.js +0 -131
  135. package/_site/_test/helpers/module-fixture.js +0 -282
  136. package/_site/_test/helpers/parallel-capture-safety-r5-cap-shell.js +0 -606
  137. package/_site/_test/helpers/parallel-capture-safety-r5-memory-shell.js +0 -464
  138. package/_site/_test/helpers/parallel-dock-acceptance-env.js +0 -301
  139. package/_site/_test/helpers/parallel-dock-acceptance-r2-env.js +0 -378
  140. package/_site/_test/helpers/parallel-dock-acceptance-r2-ui.js +0 -314
  141. package/_site/_test/helpers/parallel-dock-acceptance-ui.js +0 -195
  142. package/_site/_test/helpers/parallel-dock-isolation-r3-credential-preload.js +0 -113
  143. package/_site/_test/helpers/parallel-dock-isolation-r3-env.js +0 -307
  144. package/_site/_test/helpers/parallel-dock-isolation-r3-fixture.js +0 -373
  145. package/_site/_test/helpers/parallel-dock-isolation-r3-ui.js +0 -314
  146. package/_site/_test/helpers/parallel-engine-advanced-engine-child.js +0 -45
  147. package/_site/_test/helpers/parallel-engine-advanced-fault-writer.js +0 -171
  148. package/_site/_test/helpers/parallel-engine-advanced-harness.js +0 -245
  149. package/_site/_test/helpers/parallel-engine-advanced-standin-analyzer.js +0 -80
  150. package/_site/_test/helpers/parallel-engine-advanced-ui-host.js +0 -177
  151. package/_site/_test/helpers/parallel-engine-final-harness.js +0 -314
  152. package/_site/_test/helpers/parallel-engine-final-standin-analyzer.js +0 -159
  153. package/_site/_test/helpers/parallel-engine-reconcile-r4-harness.js +0 -340
  154. package/_site/_test/helpers/parallel-engine-reconcile-r4-standin-analyzer.js +0 -82
  155. package/_site/_test/helpers/parallel-knowledge-fixture.js +0 -255
  156. package/_site/_test/helpers/parallel-logging-acceptance-fixture.js +0 -111
  157. package/_site/_test/helpers/parallel-logging-acceptance-proxy.js +0 -106
  158. package/_site/_test/helpers/parallel-logging-fix-r2-proxy.js +0 -205
  159. package/_site/_test/helpers/parallel-logging-integration-5025-env.js +0 -432
  160. package/_site/_test/helpers/parallel-memory-analyzer.js +0 -81
  161. package/_site/_test/helpers/parallel-memory-capture-r3-cap-shell.js +0 -605
  162. package/_site/_test/helpers/parallel-memory-capture-r3-shell.js +0 -176
  163. package/_site/_test/helpers/parallel-memory-capture-r4-cap-shell.js +0 -577
  164. package/_site/_test/helpers/parallel-memory-event-bridge.js +0 -128
  165. package/_site/_test/helpers/parallel-memory-injection-shell.js +0 -723
  166. package/_site/_test/helpers/parallel-memory-injection-wb-host.js +0 -81
  167. package/_site/_test/helpers/parallel-memory-shell.js +0 -489
  168. package/_site/_test/helpers/parallel-nav-isolation-env.js +0 -389
  169. package/_site/_test/helpers/parallel-nav-module-ui.js +0 -186
  170. package/_site/_test/helpers/parallel-nav-proxy.js +0 -148
  171. package/_site/_test/helpers/parallel-nav-shell.js +0 -361
  172. package/_site/_test/helpers/parallel-qa-engine-endpoint-guard.js +0 -206
  173. package/_site/_test/helpers/parallel-qa-engine-endpoint-isolate.js +0 -259
  174. package/_site/_test/helpers/parallel-retrieval-followup-corpus.js +0 -293
  175. package/_site/_test/helpers/parallel-retrieval-followup-next-session.js +0 -70
  176. package/_site/_test/helpers/parallel-retrieval-followup-r2-shell.js +0 -737
  177. package/_site/_test/helpers/parallel-retrieval-followup-r2-wb-host.js +0 -82
  178. package/_site/_test/helpers/parallel-retrieval-followup-shell.js +0 -279
  179. package/_site/_test/helpers/parallel-workbench-drafts-r5-fixture.js +0 -295
  180. package/_site/_test/helpers/parallel-workbench-drafts-r5-harness.js +0 -573
  181. package/_site/_test/helpers/parallel-workbench-drafts-r5-host.js +0 -69
  182. package/_site/_test/helpers/parallel-workbench-fixture.js +0 -371
  183. package/_site/_test/helpers/parallel-workbench-host.js +0 -80
  184. package/_site/_test/helpers/parallel-workbench-integration-5025-fixture.js +0 -408
  185. package/_site/_test/helpers/parallel-workbench-integration-5025-harness.js +0 -593
  186. package/_site/_test/helpers/parallel-workbench-integration-5025-host.js +0 -70
  187. package/_site/_test/helpers/parallel-workbench-integration-5025-launcher.js +0 -240
  188. package/_site/_test/helpers/parallel-workbench-integration-5025-runtime-harness.js +0 -630
  189. package/_site/_test/helpers/parallel-workbench-runtime-harness.js +0 -587
  190. package/_site/_test/helpers/parallel-workbench-source-map.js +0 -196
  191. package/_site/_test/helpers/qa-r44-env.js +0 -418
  192. package/_site/_test/helpers/qa-r44-report.js +0 -656
  193. package/_site/_test/helpers/qa-r44-ui.js +0 -347
  194. package/_site/_test/helpers/qa-r45-harness.js +0 -94
  195. package/_site/_test/helpers/qa-r48-env.js +0 -64
  196. package/_site/_test/helpers/qa-r49-wb-host.js +0 -58
  197. package/_site/_test/helpers/qa-r51-env.cjs +0 -77
  198. package/_site/_test/helpers/qa-r91-harness.cjs +0 -534
  199. package/_site/_test/helpers/single-repo-maintenance-fixture.js +0 -94
  200. package/_site/_test/helpers/single-repo-maintenance-tool.js +0 -56
  201. package/_site/_test/helpers/spawn-server.js +0 -106
  202. package/_site/_test/helpers/version-visibility-fixture.js +0 -251
  203. package/_site/_test/home-overview-test.js +0 -64
  204. package/_site/_test/hook-relocation-rebind-test.js +0 -120
  205. package/_site/_test/hook-runtime-endpoint-test.js +0 -88
  206. package/_site/_test/hook-status-repair-api-test.js +0 -152
  207. package/_site/_test/hook-trigger-test.js +0 -85
  208. package/_site/_test/hook-worktree-test.js +0 -42
  209. package/_site/_test/import-preflight-api-test.js +0 -234
  210. package/_site/_test/index-builder-test.js +0 -41
  211. package/_site/_test/index-error-display-contract-test.js +0 -32
  212. package/_site/_test/index-writer-concurrency-test.js +0 -135
  213. package/_site/_test/integration-adapters-test.js +0 -262
  214. package/_site/_test/integration-auto-repair-test.js +0 -115
  215. package/_site/_test/integration-capture-setup-test.js +0 -118
  216. package/_site/_test/integration-intent-test.js +0 -85
  217. package/_site/_test/integration-runtime-binding-a2-test.js +0 -566
  218. package/_site/_test/integration-runtime-binding-a3-test.js +0 -227
  219. package/_site/_test/integration-runtime-binding-test.js +0 -473
  220. package/_site/_test/integration-status-scan-test.js +0 -160
  221. package/_site/_test/integration-surface-coverage-test.js +0 -165
  222. package/_site/_test/kb-framework-test.js +0 -57
  223. package/_site/_test/kbpath-follow-test.js +0 -63
  224. package/_site/_test/knowledge-db-test.js +0 -144
  225. package/_site/_test/knowledge-engine-client-test.js +0 -120
  226. package/_site/_test/knowledge-language-control-test.js +0 -170
  227. package/_site/_test/knowledge-maintenance-test.js +0 -40
  228. package/_site/_test/knowledge-panel-lifecycle-test.js +0 -154
  229. package/_site/_test/knowledge-panel-ui-contract-test.js +0 -110
  230. package/_site/_test/knowledge-promotion-recovery-test.js +0 -260
  231. package/_site/_test/knowledge-query-test.js +0 -54
  232. package/_site/_test/knowledge-retrieval-service-test.js +0 -77
  233. package/_site/_test/knowledge-scopes-test.js +0 -37
  234. package/_site/_test/knowledge-storage-location-test.js +0 -28
  235. package/_site/_test/knowledge-storage-startup-test.js +0 -52
  236. package/_site/_test/knowledge-store-logs-supervision-test.js +0 -89
  237. package/_site/_test/launcher-readiness-test.js +0 -80
  238. package/_site/_test/legacy-claude-session-alias-test.js +0 -106
  239. package/_site/_test/legacy-relocation-recovery-test.js +0 -258
  240. package/_site/_test/legacy-routes-removed-test.js +0 -47
  241. package/_site/_test/legacy-workbench-exclusion-test.js +0 -92
  242. package/_site/_test/live-gateway-test.js +0 -48
  243. package/_site/_test/local-marketplace-test.js +0 -16
  244. package/_site/_test/log-redaction-test.js +0 -58
  245. package/_site/_test/logging-api-test.js +0 -89
  246. package/_site/_test/logging-sse-no-gap-test.js +0 -88
  247. package/_site/_test/logging-ui-test.js +0 -107
  248. package/_site/_test/markdown-delta-overlay-test.js +0 -85
  249. package/_site/_test/markdown-maintenance-api-test.js +0 -75
  250. package/_site/_test/markdown-maintenance-test.js +0 -11
  251. package/_site/_test/mcp-server-test.js +0 -149
  252. package/_site/_test/memory-groups-ui-test.js +0 -173
  253. package/_site/_test/model-context-windows-test.js +0 -89
  254. package/_site/_test/module-agent-start-proxy-test.js +0 -65
  255. package/_site/_test/module-artifact-integrity-test.js +0 -27
  256. package/_site/_test/module-boundary-test.js +0 -30
  257. package/_site/_test/module-bridge-eventbridge-test.js +0 -202
  258. package/_site/_test/module-dynamic-port-test.js +0 -118
  259. package/_site/_test/module-index-proxy-test.js +0 -33
  260. package/_site/_test/module-model-configuration-test.js +0 -44
  261. package/_site/_test/module-process-lifecycle-test.js +0 -35
  262. package/_site/_test/module-stream-proxy-test.js +0 -34
  263. package/_site/_test/module-supervisor-backoff-reset-test.js +0 -64
  264. package/_site/_test/module-terminal-restart-test.js +0 -63
  265. package/_site/_test/module-wiring-unbind-race-test.js +0 -59
  266. package/_site/_test/native-context-integrations-test.js +0 -86
  267. package/_site/_test/non-release-ci-test.js +0 -34
  268. package/_site/_test/offline-boundary-isolation-test.js +0 -32
  269. package/_site/_test/orphaned-claim-recovery-test.js +0 -80
  270. package/_site/_test/package-boundary-test.js +0 -48
  271. package/_site/_test/package-startup-test.js +0 -56
  272. package/_site/_test/packaged-ui-smoke-test.js +0 -126
  273. package/_site/_test/parallel-capture-safety-r5-cap006-probe.js +0 -524
  274. package/_site/_test/parallel-capture-safety-r5-cap008e-probe.js +0 -577
  275. package/_site/_test/parallel-capture-safety-r5-mem005-health-test.js +0 -381
  276. package/_site/_test/parallel-ci-r9-posix-socket-budget-test.js +0 -156
  277. package/_site/_test/parallel-engine-advanced-eng005-test.js +0 -136
  278. package/_site/_test/parallel-engine-advanced-eng006-test.js +0 -171
  279. package/_site/_test/parallel-engine-advanced-eng007-reconcile-test.js +0 -231
  280. package/_site/_test/parallel-engine-advanced-eng009-test.js +0 -208
  281. package/_site/_test/parallel-engine-advanced-eng010-test.js +0 -213
  282. package/_site/_test/parallel-engine-advanced-eng011-ui-probe.js +0 -459
  283. package/_site/_test/parallel-engine-final-eng002-test.js +0 -255
  284. package/_site/_test/parallel-engine-final-eng007-test.js +0 -269
  285. package/_site/_test/parallel-engine-final-eng011-test.js +0 -197
  286. package/_site/_test/parallel-engine-final-eng012-test.js +0 -354
  287. package/_site/_test/parallel-engine-reconcile-r4-eng007-probe.js +0 -304
  288. package/_site/_test/parallel-knowledge-client-error-code-test.js +0 -194
  289. package/_site/_test/parallel-knowledge-engine-test.js +0 -353
  290. package/_site/_test/parallel-knowledge-retrieval-test.js +0 -292
  291. package/_site/_test/parallel-knowledge-vector-test.js +0 -168
  292. package/_site/_test/parallel-linux-ci-r7-log007-day-test.js +0 -110
  293. package/_site/_test/parallel-logging-acceptance-log003-probe.js +0 -78
  294. package/_site/_test/parallel-logging-acceptance-log003-test.js +0 -224
  295. package/_site/_test/parallel-logging-acceptance-log004-probe.js +0 -85
  296. package/_site/_test/parallel-logging-acceptance-log004-test.js +0 -231
  297. package/_site/_test/parallel-logging-acceptance-log005-test.js +0 -208
  298. package/_site/_test/parallel-logging-acceptance-log006-test.js +0 -214
  299. package/_site/_test/parallel-logging-acceptance-log007-test.js +0 -223
  300. package/_site/_test/parallel-logging-acceptance-log008-test.js +0 -192
  301. package/_site/_test/parallel-logging-fix-r2-crash-probe.js +0 -271
  302. package/_site/_test/parallel-logging-fix-r2-gap-test.js +0 -294
  303. package/_site/_test/parallel-logging-fix-r2-normalhook-test.js +0 -330
  304. package/_site/_test/parallel-logging-integration-5025-portability-test.js +0 -554
  305. package/_site/_test/parallel-memory-candidate-test.js +0 -353
  306. package/_site/_test/parallel-memory-capture-r3-cap001-probe.js +0 -238
  307. package/_site/_test/parallel-memory-capture-r3-cap006-probe.js +0 -371
  308. package/_site/_test/parallel-memory-capture-r3-cap008-probe.js +0 -439
  309. package/_site/_test/parallel-memory-capture-r3-mem005-persistence-test.js +0 -333
  310. package/_site/_test/parallel-memory-capture-r4-cap006-probe.js +0 -519
  311. package/_site/_test/parallel-memory-capture-r4-cap008e-probe.js +0 -569
  312. package/_site/_test/parallel-memory-capture-r4-mem005-health-test.js +0 -374
  313. package/_site/_test/parallel-memory-home-review-test.js +0 -148
  314. package/_site/_test/parallel-memory-injection-origin-probe.js +0 -412
  315. package/_site/_test/parallel-memory-injection-probe.js +0 -411
  316. package/_site/_test/parallel-memory-manual-test.js +0 -292
  317. package/_site/_test/parallel-memory-scope-test.js +0 -98
  318. package/_site/_test/parallel-memory-source-test.js +0 -254
  319. package/_site/_test/parallel-memory-sync-test.js +0 -274
  320. package/_site/_test/parallel-memory-view-r8-reload-gate-test.js +0 -123
  321. package/_site/_test/parallel-nav-failure-test.js +0 -139
  322. package/_site/_test/parallel-nav-home-issues-test.js +0 -159
  323. package/_site/_test/parallel-nav-isolation-test.js +0 -308
  324. package/_site/_test/parallel-nav-isolation-vector-path-test.js +0 -90
  325. package/_site/_test/parallel-nav-offline-test.js +0 -300
  326. package/_site/_test/parallel-nav-operability-test.js +0 -268
  327. package/_site/_test/parallel-nav-switch-test.js +0 -293
  328. package/_site/_test/parallel-nav-theme-test.js +0 -176
  329. package/_site/_test/parallel-nav-viewport-test.js +0 -321
  330. package/_site/_test/parallel-qa-engine-endpoint-guard-test.js +0 -275
  331. package/_site/_test/parallel-retrieval-followup-citation-test.js +0 -219
  332. package/_site/_test/parallel-retrieval-followup-corpus-test.js +0 -289
  333. package/_site/_test/parallel-workbench-drafts-r4-probe.js +0 -477
  334. package/_site/_test/parallel-workbench-drafts-r5-chrome-env-bisect.js +0 -89
  335. package/_site/_test/parallel-workbench-drafts-r5-probe.js +0 -593
  336. package/_site/_test/parallel-workbench-independent-host.js +0 -262
  337. package/_site/_test/parallel-workbench-integration-5025-abort-probe.js +0 -340
  338. package/_site/_test/parallel-workbench-integration-5025-drafts-probe.js +0 -588
  339. package/_site/_test/parallel-workbench-integration-5025-env-check.js +0 -317
  340. package/_site/_test/parallel-workbench-integration-5025-model-probe.js +0 -342
  341. package/_site/_test/parallel-workbench-integration-5025-ordering-probe.js +0 -326
  342. package/_site/_test/parallel-workbench-model-probe.js +0 -336
  343. package/_site/_test/parallel-workbench-offline-test.js +0 -169
  344. package/_site/_test/parallel-workbench-provenance-trace.js +0 -134
  345. package/_site/_test/parallel-workbench-runtime-minimax-probe.js +0 -321
  346. package/_site/_test/parallel-workbench-runtime-wb004-ordering.js +0 -307
  347. package/_site/_test/parallel-workbench-runtime-wb005-drafts.js +0 -313
  348. package/_site/_test/parallel-workbench-runtime-wb008-abort.js +0 -321
  349. package/_site/_test/parallel-workbench-source-match.js +0 -206
  350. package/_site/_test/parallel-workbench-standalone-turn.js +0 -349
  351. package/_site/_test/path-consistency-test.js +0 -151
  352. package/_site/_test/pending-sweep-test.js +0 -9
  353. package/_site/_test/post-commit-automation-test.js +0 -87
  354. package/_site/_test/pr-consumer-contract-test.js +0 -55
  355. package/_site/_test/product-brand-contract-test.js +0 -25
  356. package/_site/_test/product-diagnostics-ui-test.js +0 -105
  357. package/_site/_test/product-empty-state-test.js +0 -214
  358. package/_site/_test/product-import-ui-test.js +0 -245
  359. package/_site/_test/product-navigation-test.js +0 -213
  360. package/_site/_test/product-progress-status-test.js +0 -100
  361. package/_site/_test/project-delete-recovery-test.js +0 -64
  362. package/_site/_test/project-domain-create-test.js +0 -91
  363. package/_site/_test/project-domain-scope-retrieval-test.js +0 -214
  364. package/_site/_test/project-git-init-confirm-test.js +0 -115
  365. package/_site/_test/project-goal-editor-test.js +0 -145
  366. package/_site/_test/project-import-duplicate-alias-test.js +0 -134
  367. package/_site/_test/project-import-unicode-restart-test.js +0 -140
  368. package/_site/_test/project-lifecycle-transaction-test.js +0 -106
  369. package/_site/_test/project-module-partial-recovery-test.js +0 -237
  370. package/_site/_test/project-remove-running-guard-test.js +0 -79
  371. package/_site/_test/project-store-test.js +0 -90
  372. package/_site/_test/project-team-ui-test.js +0 -128
  373. package/_site/_test/project-unbind-late-read-ui-test.js +0 -281
  374. package/_site/_test/project-unbind-writer-guard-test.js +0 -231
  375. package/_site/_test/prompt-settings-test.js +0 -115
  376. package/_site/_test/protected-architecture-gate-test.js +0 -123
  377. package/_site/_test/qa-r44-permission-question.js +0 -756
  378. package/_site/_test/qa-r45-offline-backfill-test.js +0 -279
  379. package/_site/_test/qa-r48-sys003-blank-secret-test.js +0 -258
  380. package/_site/_test/qa-r49-sys003-real-blank-probe.js +0 -374
  381. package/_site/_test/recovery-label-contract-test.js +0 -55
  382. package/_site/_test/refactor-characterization-test.js +0 -36
  383. package/_site/_test/registry-events-test.js +0 -38
  384. package/_site/_test/release-version-sync-test.js +0 -115
  385. package/_site/_test/requirement-binding-test.js +0 -113
  386. package/_site/_test/requirement-recorder-test.js +0 -173
  387. package/_site/_test/run-all-tests.js +0 -196
  388. package/_site/_test/runtime-endpoint-test.js +0 -64
  389. package/_site/_test/scanner-test.js +0 -83
  390. package/_site/_test/server-security-test.js +0 -96
  391. package/_site/_test/sessions-stream-test.js +0 -93
  392. package/_site/_test/shared-contracts-test.js +0 -58
  393. package/_site/_test/shared-scope-root-binding-test.js +0 -75
  394. package/_site/_test/simple-import-test.js +0 -98
  395. package/_site/_test/single-repo-maintenance-e2e-test.js +0 -200
  396. package/_site/_test/startup-analysis-disabled-test.js +0 -16
  397. package/_site/_test/startup-integration-isolation-test.js +0 -59
  398. package/_site/_test/startup-integration-repair-test.js +0 -43
  399. package/_site/_test/storage-foundation-test.js +0 -78
  400. package/_site/_test/structured-logger-test.js +0 -101
  401. package/_site/_test/t07b-cln-005-coverage-test.js +0 -212
  402. package/_site/_test/t07c-cln-001-002-007-coverage-test.js +0 -135
  403. package/_site/_test/t07d-git-rel-coverage-test.js +0 -226
  404. package/_site/_test/t07e-qta-coverage-test.js +0 -195
  405. package/_site/_test/t07f-mem-008-coverage-test.js +0 -100
  406. package/_site/_test/team-knowledge-store-sparse-checkout-test.js +0 -196
  407. package/_site/_test/team-knowledge-store-test.js +0 -132
  408. package/_site/_test/test-server-cleanup-test.js +0 -35
  409. package/_site/_test/test-server-module-isolation-test.js +0 -37
  410. package/_site/_test/tracking-start-test.js +0 -144
  411. package/_site/_test/vector-storage-root-test.js +0 -75
  412. package/_site/_test/version-visibility-browser-probe.js +0 -249
  413. package/_site/_test/version-visibility-test.js +0 -92
  414. package/_site/_test/workbench-context-receipts-test.js +0 -27
  415. package/_site/_test/workbench-permission-test.js +0 -118
  416. package/_site/_test/workflow-module-wiring-test.js +0 -252
  417. package/_site/_test/workflow-tools-test.js +0 -243
  418. package/_site/_test/workspace-ui-contract-test.js +0 -77
  419. package/_site/_test/zcode-capture-integration-test.js +0 -112
  420. package/templates/change.md +0 -30
  421. package/templates/project-readme.md +0 -52
  422. /package/docs/{assets → images}/architecture.svg +0 -0
  423. /package/docs/{assets → images}/dashboard.png +0 -0
  424. /package/docs/{assets → images}/draft-review.png +0 -0
  425. /package/docs/{assets → images}/logo.svg +0 -0
  426. /package/docs/{assets → images}/runs-drafts.png +0 -0
  427. /package/docs/{assets → images}/settings.png +0 -0
  428. /package/{ui → resources/ui}/favicon.svg +0 -0
  429. /package/{ui → resources/ui}/index.html +0 -0
  430. /package/{ui → resources/ui}/knowledge-panel.html +0 -0
  431. /package/{ui → resources/ui}/live-client.js +0 -0
  432. /package/{ui → resources/ui}/product.css +0 -0
  433. /package/{ui → resources/ui}/product.js +0 -0
  434. /package/{ui → resources/ui}/version-info.css +0 -0
  435. /package/{ui → resources/ui}/version-info.js +0 -0
  436. /package/{_site/lib → src/automation}/automation-config.js +0 -0
  437. /package/{_site/lib → src/automation}/commit-prompt.js +0 -0
  438. /package/{_site/lib → src/common}/cli-instances.js +0 -0
  439. /package/{_site/lib → src/common}/contracts.js +0 -0
  440. /package/{_site/lib → src/common}/data-dir.js +0 -0
  441. /package/{_site/lib → src/common}/folder-picker-output.js +0 -0
  442. /package/{_site/lib → src/common}/git-path.js +0 -0
  443. /package/{_site/lib → src/common}/git-runner.js +0 -0
  444. /package/{_site/lib → src/common}/runtime-control.js +0 -0
  445. /package/{_site/lib → src/conversations}/bridge-consumer-service.js +0 -0
  446. /package/{_site/lib → src/conversations}/codex-context-status.js +0 -0
  447. /package/{_site/lib → src/integrations}/ai-vendor-presets.js +0 -0
  448. /package/{_site/lib → src/integrations}/claude-plugin-status.js +0 -0
  449. /package/{_site/lib → src/integrations}/integration-auto-repair.js +0 -0
  450. /package/{_site/lib → src/integrations}/integration-intent.js +0 -0
  451. /package/{_site/lib → src/integrations}/integration-repair-worker.js +0 -0
  452. /package/{_site/lib → src/integrations}/integration-status-scan.js +0 -0
  453. /package/{_site/lib → src/integrations}/integration-status-worker.js +0 -0
  454. /package/{_site/lib → src/integrations}/model-context-windows.js +0 -0
  455. /package/{_site/lib → src/integrations}/startup-integration-repair.js +0 -0
  456. /package/{_site/lib → src/knowledge}/embedding-service.js +0 -0
  457. /package/{_site/lib → src/knowledge}/index-builder.js +0 -0
  458. /package/{_site/lib → src/knowledge}/kb-validator.js +0 -0
  459. /package/{_site/lib → src/knowledge}/knowledge-db.js +0 -0
  460. /package/{_site/lib → src/knowledge}/knowledge-schema.js +0 -0
  461. /package/{_site/lib → src/knowledge}/markdown-knowledge-indexer.js +0 -0
  462. /package/{_site → src}/scripts/codex-notify-fanout.cjs +0 -0
  463. /package/{_site → src}/scripts/folder-picker.ps1 +0 -0
  464. /package/{_site → src}/scripts/sync-release-version.js +0 -0
  465. /package/{_site → src}/scripts/verify-module-runtime.js +0 -0
  466. /package/{_site/lib → src/server}/live-gateway.js +0 -0
  467. /package/{_site/lib → src/server}/module-port-resolver.js +0 -0
  468. /package/{_site/lib → src/server}/public-version-info.js +0 -0
  469. /package/{_site → src}/start.bat +0 -0
  470. /package/{_site → src}/stop.bat +0 -0
  471. /package/{_site/lib → src/tools}/registry-events.js +0 -0
@@ -1,439 +0,0 @@
1
- 'use strict';
2
- // _site/_test/parallel-memory-capture-r3-cap008-probe.js
3
- //
4
- // CAP-008 同basename不同真实路径A/B并行 — the external-Agent integration case
5
- // of qa-autopilot/config/test-cases.json.
6
- //
7
- // steps: 相同basename不同真实路径A/B开发会话并行。
8
- // expected: 以canonical身份隔离,不串对话/Commit。
9
- // evidence: 实际命令与退出码 / UI、接口、磁盘对应证据 / 源HEAD/文件哈希/测试夹具ID
10
- //
11
- // WHAT IS REAL HERE
12
- //
13
- // * the product server is the real one running in its OWN consumer mode
14
- // (analysisOwner 'legacy'), so the product's own BridgeConsumerService and
15
- // ConversationStore — the code that decides which project a captured event
16
- // belongs to — are the code under test, not a driver-side reimplementation;
17
- // * two REAL Git repositories with the SAME basename (`service`) live at two
18
- // different canonical paths and are imported through the product's real
19
- // import API, which installs the real managed post-commit hook into each
20
- // repo (each hook marker carrying its own projectId);
21
- // * the development sessions are fired through the REAL Bridge shim the
22
- // product's real 接入 click installed (bin/bridge-hook.cjs): interleaved
23
- // UserPromptSubmit/Stop payloads with unique marker strings, cwd pointing
24
- // at repo A or repo B;
25
- // * the commits are real `git commit` invocations; the managed hooks really
26
- // run and really POST hook-event/v2 back to the product;
27
- // * isolation is asserted at every layer with falsifiable cross-checks:
28
- // distinct canonical workspaceIds (computed by the product's own identity
29
- // resolver), journal records carrying only their own identity, per-project
30
- // conversation read-back through the product's own API, boundary files on
31
- // disk only under the owning project, and a whole-data-dir grep proving no
32
- // marker ever lands on the other project.
33
- //
34
- // WHY THIS FILE IS NOT NAMED *-test.js
35
- //
36
- // The case needs the native Claude Code CLI (for the real 接入 click) and a
37
- // real Git + Chrome environment. The offline CI suite collects every
38
- // *_test.js and would report a false failure on a runner without them, so
39
- // the case runs through the product probe entry point instead.
40
-
41
- const fs = require('node:fs');
42
- const path = require('node:path');
43
- const crypto = require('node:crypto');
44
- const assert = require('node:assert/strict');
45
- const { execFileSync, spawnSync } = require('node:child_process');
46
-
47
- const { startCapHarness, ROOT, resolveTempRoot } = require('./helpers/parallel-memory-capture-r3-cap-shell');
48
- const { BridgeAdapter } = require(path.join(ROOT, '_site', 'lib', 'bridge-adapter'));
49
- const { parseManagedMarker } = require(path.join(ROOT, '_site', 'lib', 'hook-manager'));
50
-
51
- const EVIDENCE = process.env.PK_TEST_EVIDENCE_DIR ? path.resolve(process.env.PK_TEST_EVIDENCE_DIR) : null;
52
- const CLIENT = 'claude';
53
-
54
- function gitHead() {
55
- try {
56
- return execFileSync('git', ['-C', ROOT, 'rev-parse', 'HEAD'], { encoding: 'utf8', windowsHide: true }).trim();
57
- } catch { return null; }
58
- }
59
-
60
- function git(repo, args) {
61
- return execFileSync('git', ['-C', repo, ...args], { encoding: 'utf8', windowsHide: true }).trim();
62
- }
63
-
64
- function walkFiles(dir) {
65
- const out = [];
66
- const walk = current => {
67
- let entries = [];
68
- try { entries = fs.readdirSync(current, { withFileTypes: true }); } catch { return; }
69
- for (const entry of entries) {
70
- const full = path.join(current, entry.name);
71
- if (entry.isDirectory()) walk(full);
72
- else if (entry.isFile()) out.push(full);
73
- }
74
- };
75
- walk(dir);
76
- return out;
77
- }
78
-
79
- /** Every (file, needle) hit of the needles below a directory. */
80
- function grepTree(dir, needles) {
81
- const hits = [];
82
- for (const file of walkFiles(dir)) {
83
- let text;
84
- try { text = fs.readFileSync(file, 'utf8'); } catch { continue; }
85
- for (const needle of needles) if (text.includes(needle)) hits.push({ file: path.relative(dir, file).split(path.sep).join('/'), needle });
86
- }
87
- return hits;
88
- }
89
-
90
- async function main() {
91
- // The consumer mode is the point of this case: the product's own drain and
92
- // projection code runs, so a driver-side "correct routing" could not mask it.
93
- const harness = await startCapHarness({ tag: 'cap008', evidenceDir: EVIDENCE || undefined, analysisOwner: 'legacy' });
94
- const evidence = [];
95
- const reposRoot = fs.mkdtempSync(path.join(resolveTempRoot(), 'pk-cap008-repos-'));
96
- const dataDir = harness.server.dataDir;
97
- try {
98
- const hex = () => crypto.randomBytes(6).toString('hex');
99
- const markerA = { prompt: `CAP008-A-PROMPT-${hex()}`, answer: `CAP008-A-ANSWER-${hex()}`, commit: `CAP008-A-COMMIT-${hex()}`, session: `cap008-alpha-${hex()}` };
100
- const markerB = { prompt: `CAP008-B-PROMPT-${hex()}`, answer: `CAP008-B-ANSWER-${hex()}`, commit: `CAP008-B-COMMIT-${hex()}`, session: `cap008-beta-${hex()}` };
101
- const commands = [];
102
-
103
- // ------------------------------------------------------------------
104
- // 1. The real 接入 click: the Bridge shim that will receive both
105
- // sessions is the one the product itself installed.
106
- // ------------------------------------------------------------------
107
- await harness.openSystemDrawer();
108
- await harness.nativeClick(`[data-agent-switch="install"][data-agent-client="${CLIENT}"]`);
109
- await harness.waitFor(
110
- () => harness.run("document.getElementById('agentCaptureFeedback').textContent.trim().length > 0 && !document.getElementById('agentCaptureFeedback').textContent.includes('正在接入')"),
111
- 'the 接入 action answers in the UI',
112
- 180000,
113
- );
114
- const installCall = await harness.lastInstallCall();
115
- assert.ok(installCall, 'the UI really sent an install request');
116
- assert.equal(installCall.status, 200, `the install request answers 200: ${JSON.stringify(installCall)}`);
117
- assert.equal(installCall.response.complete, true, `the install must complete: ${JSON.stringify(installCall.response)}`);
118
- await harness.waitFor(
119
- () => harness.run(`(() => { const row = [...document.querySelectorAll('#agentCaptureList .agent-capture-row')].find(item => item.querySelector('[data-agent-switch]') && item.querySelector('[data-agent-switch]').dataset.agentClient === ${JSON.stringify(CLIENT)}); return Boolean(row) && row.querySelector('.status').textContent === '已接入'; })()`),
120
- 'the row shows the client as connected',
121
- 90000,
122
- );
123
- const hooks = harness.ownedHookEntries();
124
- const shimPaths = [...new Set(hooks.map(entry => entry.shimPath))];
125
- assert.equal(shimPaths.length, 1, `both capture events must point at one shim: ${JSON.stringify(hooks)}`);
126
- assert.equal(fs.existsSync(shimPaths[0]), true, 'the shim must exist on disk');
127
- const shimPath = shimPaths[0];
128
- const bridgeHome = harness.server.bridgeHome;
129
-
130
- // ------------------------------------------------------------------
131
- // 2. Two real repositories with the SAME basename at different paths.
132
- // ------------------------------------------------------------------
133
- const repoA = path.join(reposRoot, 'alpha', 'service');
134
- const repoB = path.join(reposRoot, 'beta', 'service');
135
- for (const [repo, seed] of [[repoA, 'a'], [repoB, 'b']]) {
136
- fs.mkdirSync(repo, { recursive: true });
137
- commands.push({ cwd: repo, args: ['init', '-b', 'main'], ...runGitRaw(repo, ['init', '-b', 'main']) });
138
- commands.push({ cwd: repo, args: ['config', 'user.name', 'CAP008 Probe'], ...runGitRaw(repo, ['config', 'user.name', 'CAP008 Probe']) });
139
- commands.push({ cwd: repo, args: ['config', 'user.email', 'cap008@probe.invalid'], ...runGitRaw(repo, ['config', 'user.email', 'cap008@probe.invalid']) });
140
- fs.writeFileSync(path.join(repo, 'README.md'), `CAP008 same-basename fixture ${seed}\n`, 'utf8');
141
- commands.push({ cwd: repo, args: ['add', 'README.md'], ...runGitRaw(repo, ['add', 'README.md']) });
142
- commands.push({ cwd: repo, args: ['commit', '-m', `seed ${seed}`], ...runGitRaw(repo, ['commit', '-m', `seed ${seed}`]) });
143
- }
144
- assert.equal(path.basename(repoA), path.basename(repoB), 'the two repos must share one basename');
145
- assert.notEqual(path.resolve(repoA).toLowerCase(), path.resolve(repoB).toLowerCase(), 'the two repos must live at different canonical paths');
146
-
147
- // ------------------------------------------------------------------
148
- // 3. Import both through the product's real import API. Each import
149
- // resolves the canonical repo identity and installs the managed
150
- // post-commit hook bound to its own projectId. Both keep the SAME
151
- // default display name (the shared basename) — only the canonical
152
- // identity may tell them apart.
153
- // ------------------------------------------------------------------
154
- const knowledgeRoot = path.join(harness.fixture, 'knowledge');
155
- fs.mkdirSync(knowledgeRoot, { recursive: true });
156
- const settingsResult = await harness.productApi('PATCH', '/api/settings', { knowledge: { rootPath: knowledgeRoot } });
157
- assert.equal(settingsResult.status, 200, `the isolated instance must accept its knowledge root: ${JSON.stringify(settingsResult.body)}`);
158
- const imported = [];
159
- for (const [repo, side] of [[repoA, 'a'], [repoB, 'b']]) {
160
- const knowledgePath = path.join(knowledgeRoot, `service-${side}`);
161
- fs.mkdirSync(knowledgePath, { recursive: true });
162
- const result = await harness.productApi('POST', '/api/projects/import', { localPath: repo, knowledgePath });
163
- assert.equal(result.status, 201, `importing ${repo} must answer 201: ${JSON.stringify(result.body)}`);
164
- const project = result.body && result.body.project;
165
- assert.ok(project && project.projectId, `the import must return the project: ${JSON.stringify(result.body)}`);
166
- imported.push({ repo, projectId: project.projectId, workspaceId: project.config && project.config.repoIdentity ? project.config.repoIdentity.workspaceId : null });
167
- }
168
- const [projectA, projectB] = imported;
169
- assert.notEqual(projectA.projectId, projectB.projectId, 'the two repos must be two projects');
170
- assert.ok(projectA.workspaceId && projectB.workspaceId, `both projects must carry a canonical workspace identity: ${JSON.stringify(imported)}`);
171
- assert.notEqual(projectA.workspaceId, projectB.workspaceId, 'same basename at different paths must yield different canonical identities');
172
-
173
- // The product's own identity resolver is the oracle for the same claim.
174
- const adapter = new BridgeAdapter({});
175
- const oracleA = await adapter.resolveRepoIdentity(repoA);
176
- const oracleB = await adapter.resolveRepoIdentity(repoB);
177
- assert.equal(oracleA.status, 'ok', `the product's own resolver must answer for A: ${JSON.stringify(oracleA)}`);
178
- assert.equal(oracleB.status, 'ok', `the product's own resolver must answer for B: ${JSON.stringify(oracleB)}`);
179
- assert.equal(oracleA.repoIdentity.workspaceId, projectA.workspaceId, 'project A identity must equal the canonical one');
180
- assert.equal(oracleB.repoIdentity.workspaceId, projectB.workspaceId, 'project B identity must equal the canonical one');
181
- assert.notEqual(oracleA.repoIdentity.workspaceId, oracleB.repoIdentity.workspaceId, 'the canonical identities of A and B must differ');
182
-
183
- // The managed hook of each repo is bound to its own project only.
184
- const hookMarkers = {};
185
- for (const project of imported) {
186
- const hookFile = path.join(project.repo, '.git', 'hooks', 'post-commit');
187
- assert.equal(fs.existsSync(hookFile), true, `the managed post-commit hook must exist in ${project.repo}`);
188
- const marker = parseManagedMarker(fs.readFileSync(hookFile, 'utf8'));
189
- assert.ok(marker, `the hook must be managed: ${hookFile}`);
190
- assert.equal(marker.projectId, project.projectId, `the hook of ${project.repo} must be bound to its own project: ${JSON.stringify(marker)}`);
191
- hookMarkers[project.projectId] = marker;
192
- }
193
- assert.notEqual(hookMarkers[projectA.projectId].projectId, hookMarkers[projectB.projectId].projectId, 'the two hooks must carry different projectIds');
194
-
195
- // ------------------------------------------------------------------
196
- // 4. One drain BETWEEN import and the sessions: the product establishes
197
- // each project's baseline before the events exist, exactly as the
198
- // Bridge notify wake-up does in real operation. Without this the
199
- // baseline would swallow the first session events (I-14: pre-import
200
- // history is never backfilled).
201
- // ------------------------------------------------------------------
202
- await harness.productApi('POST', '/api/bridge/notify', {});
203
- let drainStatus = null;
204
- await harness.waitFor(async () => {
205
- const status = await harness.productApi('GET', '/api/bridge/status');
206
- const drained = status.body && status.body.status ? status.body.status.lastDrainAt : null;
207
- if (drained) drainStatus = status.body.status;
208
- return Boolean(drained);
209
- }, 'the product drains the bridge journal after import', 30000);
210
- for (const project of imported) {
211
- const stateFile = path.join(dataDir, 'projects', project.projectId, 'state.json');
212
- await harness.waitFor(() => {
213
- try {
214
- const parsed = JSON.parse(fs.readFileSync(stateFile, 'utf8'));
215
- const state = parsed && typeof parsed === 'object' && parsed.state && typeof parsed.state === 'object' ? parsed.state : parsed;
216
- return Number.isInteger(state.conversationBaselineCursor);
217
- } catch { return false; }
218
- }, `project ${project.projectId} must establish its conversation baseline before the sessions start`, 30000);
219
- }
220
-
221
- // ------------------------------------------------------------------
222
- // 5. Two interleaved development sessions through the real shim.
223
- // The shim always exits 0 (fail-open), so landing is proven by the
224
- // read-back in step 6, not by the exit code.
225
- // ------------------------------------------------------------------
226
- const fire = (payload) => {
227
- const env = { ...process.env, AI_CODING_EVENT_BRIDGE_HOME: bridgeHome };
228
- delete env.AI_CODING_EVENT_BRIDGE_CAPTURE; // an ambient kill-switch must not silence the real capture
229
- const result = spawnSync(process.execPath, [shimPath], {
230
- input: JSON.stringify(payload), env, encoding: 'utf8', timeout: 90000, windowsHide: true,
231
- });
232
- return { payload: payload.hook_event_name, cwd: payload.cwd, exitCode: result.status, error: result.error ? result.error.message : null };
233
- };
234
- const sessionCommands = [
235
- fire({ hook_event_name: 'UserPromptSubmit', session_id: markerA.session, prompt: markerA.prompt, cwd: repoA }),
236
- fire({ hook_event_name: 'UserPromptSubmit', session_id: markerB.session, prompt: markerB.prompt, cwd: repoB }),
237
- fire({ hook_event_name: 'Stop', session_id: markerA.session, last_assistant_message: markerA.answer, cwd: repoA }),
238
- fire({ hook_event_name: 'Stop', session_id: markerB.session, last_assistant_message: markerB.answer, cwd: repoB }),
239
- ];
240
- for (const call of sessionCommands) {
241
- assert.equal(call.exitCode, 0, `the shim must exit 0 (fail-open contract): ${JSON.stringify(call)}`);
242
- commands.push({ cwd: call.cwd, args: ['shim', call.payload], exitCode: call.exitCode });
243
- }
244
-
245
- // ------------------------------------------------------------------
246
- // 6. The product's own conversation read-back: each project sees only
247
- // its own session, and never the other side's markers.
248
- // ------------------------------------------------------------------
249
- const localDate = (() => {
250
- const now = new Date();
251
- const offset = now.getTimezoneOffset() * 60000;
252
- return new Date(now.getTime() - offset).toISOString().slice(0, 10);
253
- })();
254
- const dates = [...new Set([new Date().toISOString().slice(0, 10), localDate])];
255
- const turnsOf = async (projectId) => {
256
- for (const date of dates) {
257
- const result = await harness.productApi('GET', `/api/conversations/turns?projectId=${encodeURIComponent(projectId)}&date=${date}`);
258
- if (result.status === 200 && JSON.stringify(result.body).length > 2) return { date, body: result.body };
259
- }
260
- return { date: null, body: null };
261
- };
262
- await harness.waitFor(async () => {
263
- const read = await turnsOf(projectA.projectId);
264
- const text = JSON.stringify(read.body);
265
- return text.includes(markerA.prompt) && text.includes(markerA.answer);
266
- }, 'project A reads back its own session through the product API', 90000);
267
- await harness.waitFor(async () => {
268
- const read = await turnsOf(projectB.projectId);
269
- const text = JSON.stringify(read.body);
270
- return text.includes(markerB.prompt) && text.includes(markerB.answer);
271
- }, 'project B reads back its own session through the product API', 90000);
272
-
273
- const readA = await turnsOf(projectA.projectId);
274
- const readB = await turnsOf(projectB.projectId);
275
- const textA = JSON.stringify(readA.body);
276
- const textB = JSON.stringify(readB.body);
277
- assert.equal(textA.includes(markerA.prompt) && textA.includes(markerA.answer) && textA.includes(markerA.session), true, `project A must carry its own session: ${textA.slice(0, 800)}`);
278
- assert.equal(textA.includes(markerB.prompt) || textA.includes(markerB.answer) || textA.includes(markerB.session), false, `project A must not carry B's session: ${textA.slice(0, 800)}`);
279
- assert.equal(textB.includes(markerB.prompt) && textB.includes(markerB.answer) && textB.includes(markerB.session), true, `project B must carry its own session: ${textB.slice(0, 800)}`);
280
- assert.equal(textB.includes(markerA.prompt) || textB.includes(markerA.answer) || textB.includes(markerA.session), false, `project B must not carry A's session: ${textB.slice(0, 800)}`);
281
-
282
- // ------------------------------------------------------------------
283
- // 7. Real commits in both repos. The managed hooks append the commit
284
- // boundary themselves and notify the product, which projects the
285
- // boundary under the owning project only.
286
- // ------------------------------------------------------------------
287
- const commits = [];
288
- for (const [project, marker, seed] of [[projectA, markerA, 'a'], [projectB, markerB, 'b']]) {
289
- const file = path.join(project.repo, `work-${seed}.md`);
290
- fs.writeFileSync(file, `${marker.commit}\n`, 'utf8');
291
- commands.push({ cwd: project.repo, args: ['add', `work-${seed}.md`], ...runGitRaw(project.repo, ['add', `work-${seed}.md`]) });
292
- commands.push({ cwd: project.repo, args: ['commit', '-m', marker.commit], ...runGitRaw(project.repo, ['commit', '-m', marker.commit]) });
293
- const sha = git(project.repo, ['rev-parse', 'HEAD']);
294
- assert.match(sha, /^[0-9a-f]{40}$/, 'the commit must produce a real sha');
295
- commits.push({ projectId: project.projectId, repo: project.repo, marker: marker.commit, sha });
296
- }
297
- const [commitA, commitB] = commits;
298
- const boundaryPath = (projectId, sha) => path.join(dataDir, 'projects', projectId, 'commit-boundaries', `${sha}.json`);
299
- await harness.waitFor(() => fs.existsSync(boundaryPath(commitA.projectId, commitA.sha)), 'project A persists its own commit boundary', 90000);
300
- await harness.waitFor(() => fs.existsSync(boundaryPath(commitB.projectId, commitB.sha)), 'project B persists its own commit boundary', 90000);
301
- assert.equal(fs.existsSync(boundaryPath(commitB.projectId, commitA.sha)), false, "B must not own A's commit boundary");
302
- assert.equal(fs.existsSync(boundaryPath(commitA.projectId, commitB.sha)), false, "A must not own B's commit boundary");
303
- const boundaryA = JSON.parse(fs.readFileSync(boundaryPath(commitA.projectId, commitA.sha), 'utf8'));
304
- const boundaryB = JSON.parse(fs.readFileSync(boundaryPath(commitB.projectId, commitB.sha), 'utf8'));
305
- assert.equal(boundaryA.projectId, commitA.projectId, `A's boundary must name A: ${JSON.stringify(boundaryA)}`);
306
- assert.equal(boundaryA.repoIdentity.workspaceId, projectA.workspaceId, `A's boundary must carry A's canonical identity: ${JSON.stringify(boundaryA)}`);
307
- assert.equal(boundaryB.projectId, commitB.projectId, `B's boundary must name B: ${JSON.stringify(boundaryB)}`);
308
- assert.equal(boundaryB.repoIdentity.workspaceId, projectB.workspaceId, `B's boundary must carry B's canonical identity: ${JSON.stringify(boundaryB)}`);
309
-
310
- // ------------------------------------------------------------------
311
- // 8. Record-level isolation in the durable per-project store: every
312
- // persisted event that carries a marker belongs to exactly that
313
- // side — same canonical identity, same session — and the other
314
- // side's markers are absent from the whole file.
315
- //
316
- // The Bridge journal itself is a LIVE SPOOL by design: the consumer
317
- // trims every drained record (the sealed stores are the archive of
318
- // record), so the journal is only checked structurally — its
319
- // sequence watermark must prove the traffic really passed through
320
- // the Bridge.
321
- // ------------------------------------------------------------------
322
- const storeEvents = (projectId) => {
323
- const file = path.join(dataDir, 'projects', projectId, 'conversation-events.jsonl');
324
- if (!fs.existsSync(file)) return [];
325
- return fs.readFileSync(file, 'utf8').split(/\r?\n/).filter(line => line.trim()).map(line => JSON.parse(line));
326
- };
327
- const eventsA = storeEvents(projectA.projectId);
328
- const eventsB = storeEvents(projectB.projectId);
329
- const recordCheck = (events, marker, workspaceId, projectId, side) => {
330
- const own = events.filter(event => String(event.content || '').includes(marker.prompt) || String(event.content || '').includes(marker.answer));
331
- assert.ok(own.length >= 2, `${side} must persist its own prompt and answer events: ${JSON.stringify(own.map(event => ({ eventType: event.eventType, content: String(event.content).slice(0, 60) })))}`);
332
- assert.equal(own.every(event => event.projectId === projectId), true, `every ${side} record must be named after its project: ${JSON.stringify(own.map(event => event.projectId))}`);
333
- assert.equal(own.every(event => event.repoIdentity && event.repoIdentity.workspaceId === workspaceId), true, `every ${side} record must carry ${side}'s canonical identity: ${JSON.stringify(own.map(event => event.repoIdentity))}`);
334
- assert.equal(own.every(event => event.sessionId === marker.session), true, `every ${side} record must belong to ${side}'s session: ${JSON.stringify(own.map(event => event.sessionId))}`);
335
- };
336
- recordCheck(eventsA, markerA, projectA.workspaceId, projectA.projectId, 'A');
337
- recordCheck(eventsB, markerB, projectB.workspaceId, projectB.projectId, 'B');
338
-
339
- // The Bridge spool really carried the traffic (4 session events + 2
340
- // boundaries), and the consumer really drained and compacted it.
341
- const spoolStates = [];
342
- for (const file of walkFiles(bridgeHome)) {
343
- if (path.basename(file) !== 'state.json') continue;
344
- let parsed;
345
- try { parsed = JSON.parse(fs.readFileSync(file, 'utf8')); } catch { continue; }
346
- if (Number.isInteger(parsed.lastSequence)) spoolStates.push({ file: path.relative(bridgeHome, file).split(path.sep).join('/'), firstSequence: parsed.firstSequence, lastSequence: parsed.lastSequence });
347
- }
348
- assert.ok(spoolStates.length > 0, `the Bridge journal state must exist under the isolated bridge home: ${bridgeHome}`);
349
- assert.ok(spoolStates.some(state => state.lastSequence >= 6), `the Bridge journal must have carried all six records (4 session events + 2 boundaries): ${JSON.stringify(spoolStates)}`);
350
-
351
- // ------------------------------------------------------------------
352
- // 9. Whole-store cross-contamination grep: no marker or sha of one
353
- // side may appear anywhere under the other project's directory,
354
- // and each marker must exist under its own project.
355
- // ------------------------------------------------------------------
356
- const hitsA = grepTree(dataDir, [markerA.prompt, markerA.answer, markerA.session, commitA.sha]);
357
- const hitsB = grepTree(dataDir, [markerB.prompt, markerB.answer, markerB.session, commitB.sha]);
358
- assert.ok(hitsA.length > 0, "A's evidence must exist in the product data dir");
359
- assert.ok(hitsB.length > 0, "B's evidence must exist in the product data dir");
360
- assert.equal(hitsA.some(hit => hit.file.split('/').includes(projectA.projectId)), true, `A's evidence must be under A's project directory: ${JSON.stringify(hitsA)}`);
361
- assert.equal(hitsB.some(hit => hit.file.split('/').includes(projectB.projectId)), true, `B's evidence must be under B's project directory: ${JSON.stringify(hitsB)}`);
362
- assert.equal(hitsA.some(hit => hit.file.split('/').includes(projectB.projectId)), false, `no A evidence may live under B's project directory: ${JSON.stringify(hitsA)}`);
363
- assert.equal(hitsB.some(hit => hit.file.split('/').includes(projectA.projectId)), false, `no B evidence may live under A's project directory: ${JSON.stringify(hitsB)}`);
364
-
365
- // ------------------------------------------------------------------
366
- // 10. Nothing leaked into the developer's real home (see CAP-001 for
367
- // the honest scope of this comparison).
368
- // ------------------------------------------------------------------
369
- const configComparison = harness.compareConfigSurface(harness.realHomeBefore, harness.digestRealClientConfigs());
370
- assert.equal(configComparison.byteIdentical, true, `the real client configuration must be untouched: ${JSON.stringify({ changedFiles: configComparison.changedFiles, changedDirs: configComparison.changedDirs })}`);
371
- const treeComparison = harness.compareRealTrees(harness.realTreesBefore, harness.digestRealClientTrees());
372
- assert.deepEqual(treeComparison.leaks, [], `nothing outside the runtime set may change in the real home: ${JSON.stringify(treeComparison.leaks)}`);
373
- assert.deepEqual(treeComparison.configChanges, [], `no configuration file may change in the real home: ${JSON.stringify(treeComparison.configChanges)}`);
374
-
375
- if (harness.evidence) await harness.browser.screenshot(path.join(harness.evidence, 'cap008-after.png'));
376
-
377
- evidence.push({
378
- case: 'CAP-008',
379
- fixture: {
380
- tag: 'cap008', fixtureDir: harness.fixture, reposRoot, isolatedHome: harness.homeDir,
381
- bridgeHome, dataDir, port: Number(harness.base.split(':').pop()), analysisOwner: 'legacy',
382
- },
383
- source: { repoRoot: ROOT, gitHead: gitHead() },
384
- repos: [
385
- { side: 'A', path: repoA, basename: path.basename(repoA), projectId: projectA.projectId, workspaceId: projectA.workspaceId, hookMarker: hookMarkers[projectA.projectId] },
386
- { side: 'B', path: repoB, basename: path.basename(repoB), projectId: projectB.projectId, workspaceId: projectB.workspaceId, hookMarker: hookMarkers[projectB.projectId] },
387
- ],
388
- markers: { A: markerA, B: markerB },
389
- wiring: { installRequest: installCall.request, httpStatus: installCall.status, operationId: installCall.response.operationId, shimPath, ownedHookEntries: hooks },
390
- identityOracle: { A: oracleA.repoIdentity, B: oracleB.repoIdentity },
391
- baselineDrain: drainStatus,
392
- sessionCommands,
393
- commands: commands.map(entry => ({ cwd: entry.cwd, args: entry.args, exitCode: entry.exitCode })),
394
- journal: {
395
- spoolStates,
396
- note: 'the Bridge journal is a live spool: the consumer trims every drained record after the per-project stores are written, so the durable isolation evidence is the per-project store records below',
397
- },
398
- storeRecords: {
399
- A: eventsA.map(event => ({ eventType: event.eventType, role: event.role, sessionId: event.sessionId, workspaceId: event.repoIdentity && event.repoIdentity.workspaceId, contentHead: String(event.content || '').slice(0, 40) })),
400
- B: eventsB.map(event => ({ eventType: event.eventType, role: event.role, sessionId: event.sessionId, workspaceId: event.repoIdentity && event.repoIdentity.workspaceId, contentHead: String(event.content || '').slice(0, 40) })),
401
- },
402
- conversationReadBack: {
403
- A: { date: readA.date, carriesOwnSession: true, carriesOtherSession: false },
404
- B: { date: readB.date, carriesOwnSession: true, carriesOtherSession: false },
405
- },
406
- commits: {
407
- A: { sha: commitA.sha, message: markerA.commit, boundaryFile: path.relative(dataDir, boundaryPath(commitA.projectId, commitA.sha)), boundary: boundaryA },
408
- B: { sha: commitB.sha, message: markerB.commit, boundaryFile: path.relative(dataDir, boundaryPath(commitB.projectId, commitB.sha)), boundary: boundaryB },
409
- crossBoundaryAUnderB: fs.existsSync(boundaryPath(commitB.projectId, commitA.sha)),
410
- crossBoundaryBUnderA: fs.existsSync(boundaryPath(commitA.projectId, commitB.sha)),
411
- },
412
- storeGrep: { A: hitsA, B: hitsB },
413
- realHomeIsolation: {
414
- configuration: { byteIdentical: configComparison.byteIdentical, changedFiles: configComparison.changedFiles, changedDirs: configComparison.changedDirs },
415
- tree: { leaks: treeComparison.leaks, configChanges: treeComparison.configChanges, runtimeChangeCount: treeComparison.runtimeChanges },
416
- scopeLabel: "honest: the developer's own live client sessions keep writing runtime files while the case runs; the isolation claim is about the client configuration surface and every changed file outside the known runtime set",
417
- },
418
- scopeLabel: 'honest: both sessions went through the real installed shim and both commits through the real managed hooks; read-back used the product own conversation API plus the on-disk stores of the legacy-mode product instance',
419
- });
420
-
421
- if (harness.evidence) {
422
- fs.mkdirSync(harness.evidence, { recursive: true });
423
- fs.writeFileSync(path.join(harness.evidence, 'cap008-cross-workspace-isolation.json'), `${JSON.stringify(evidence, null, 2)}\n`, 'utf8');
424
- }
425
-
426
- console.log('parallel-memory-capture-r3-cap008-probe PASS (same-basename repos at different canonical paths stayed isolated: canonical identities differ, sessions and commits never crossed sides)');
427
- } finally {
428
- await harness.cleanup();
429
- fs.rmSync(reposRoot, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
430
- }
431
- }
432
-
433
- function runGitRaw(repo, args) {
434
- const result = spawnSync('git', ['-C', repo, ...args], { encoding: 'utf8', windowsHide: true });
435
- if (result.status !== 0) throw new Error(`git ${args.join(' ')} in ${repo} failed (${result.status}): ${String(result.stderr || result.stdout || '').slice(0, 500)}`);
436
- return { exitCode: result.status };
437
- }
438
-
439
- main().catch(error => { console.error(error.stack || error.message); process.exitCode = 1; });