@sanqianx/project-knowledge 5.3.1 → 5.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (471) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +6 -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 +11 -11
  9. package/package.json +30 -26
  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 +9 -9
  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 +2 -2
  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 +40 -40
  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,304 +0,0 @@
1
- 'use strict';
2
-
3
- // P-ENGINE-RECONCILE-R4 - ENG-007 gap probe (the open item R3 left behind).
4
- //
5
- // R3 proved honestly that the startup reconciliation contract is JOURNAL
6
- // RECOVERY: a commit whose hook failed and therefore never reached the
7
- // journal is not "found back" by the engine, because the engine has no
8
- // Git-history traversal at all (CommitScanner.scan/scanProject/applyScanResult
9
- // are exported but never called from src/).
10
- //
11
- // R3 also proved the OTHER case: a commit whose boundary event WAS captured
12
- // but was delivered after the analysed head had already moved past it was
13
- // silently DISCARDED - the event was consumed (cursor advanced), the boundary
14
- // was projected, and no run, no ledger entry and no analysis were created.
15
- // Durable evidence disappeared with no diagnostic and no way to recover it.
16
- // That is the case this probe drives to a decision.
17
- //
18
- // Everything here is real:
19
- // * a REAL fixture git repository with REAL commits
20
- // * a REAL post-commit hook that runs the REAL pinned
21
- // ai-coding-event-bridge commit-boundary CLI as a separate OS process
22
- // * the "broken hook" mode points the hook at a non-existent CLI, so the
23
- // hook FAILS for real and the commit never reaches the journal - no
24
- // API-created task is used to stand in for a hook failure
25
- // * the REAL bridge console (isolated --home journal), the REAL vector-hub
26
- // (deterministic test embeddings - the paid embedding API is NOT
27
- // exercised), the REAL knowledge-engine under test
28
- //
29
- // The analysed analyzer is a deterministic stand-in: it writes real staged
30
- // Markdown bytes and a real staging manifest through the engine's real
31
- // promotion path. NO real model output is exercised.
32
- //
33
- // TARGET IDENTITY
34
- // default run : the VENDORED bytes (_modules/knowledge-engine) - the pinned
35
- // bytes in which the late-delivery drop is live -> RED
36
- // candidate : PK_TEST_ENGINE_ROOT=<module source checkout> -> GREEN
37
- //
38
- // This file is deliberately NOT named *-test.js: the canonical runner collects
39
- // only *-test.js, and the fix lives in the module SOURCE repo (not vendored),
40
- // so a default-red canonical entry would misrepresent the pinned package. The
41
- // same file runs RED against the pinned bytes and GREEN against the candidate
42
- // bytes.
43
-
44
- const assert = require('node:assert/strict');
45
- const fs = require('node:fs');
46
- const path = require('node:path');
47
- const {
48
- makeLaneDir, buildFixtureRepo, installPostCommitHook, startBridge, startVector,
49
- startEngine, captureBoundary, boundaryEvents, waitUntil, git, gitRun, readJsonl,
50
- saveEvidence, hashFile, resolveEngineRoot, RUNTIME_IDENTITY, REPO_ROOT,
51
- VENDORED_ENGINE_ROOT, VENDORED_ENGINE_VERSION,
52
- } = require('./helpers/parallel-engine-reconcile-r4-harness.js');
53
- const { createStandinAnalyzer } = require('./helpers/parallel-engine-reconcile-r4-standin-analyzer.js');
54
-
55
- const ARTIFACTS = process.env.PK_TEST_EVIDENCE_ROOT
56
- ? path.join(process.env.PK_TEST_EVIDENCE_ROOT, 'eng007r4')
57
- : path.resolve(__dirname, '../../qa-autopilot/artifacts/parallel-20261023/engine-reconcile-r4/reruns/eng007r4');
58
- const PROJECT_ID = 'project-eng007r4';
59
-
60
- function targetLabel(engineIdentity) {
61
- return engineIdentity.candidate ? 'candidate' : 'pinned';
62
- }
63
-
64
- function readDiagnostics(dataDir) {
65
- const records = [];
66
- const root = path.join(dataDir, 'logs');
67
- const walk = dir => {
68
- if (!fs.existsSync(dir)) return;
69
- for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
70
- const absolute = path.join(dir, entry.name);
71
- if (entry.isDirectory()) walk(absolute);
72
- else if (entry.name.endsWith('.jsonl')) records.push(...readJsonl(absolute));
73
- }
74
- };
75
- walk(root);
76
- return records;
77
- }
78
-
79
- async function main() {
80
- const engineIdentity = resolveEngineRoot();
81
- const lane = makeLaneDir('eng007r4');
82
- const commands = [];
83
- const evidence = {
84
- caseId: 'ENG-007 (R4): a captured commit boundary delivered after the analysed head moved past it',
85
- laneDir: lane,
86
- target: {
87
- engineRoot: engineIdentity.root,
88
- engineVersion: engineIdentity.version,
89
- engineOrigin: engineIdentity.origin,
90
- candidateBytes: engineIdentity.candidate,
91
- vendoredEngineRoot: VENDORED_ENGINE_ROOT,
92
- vendoredEngineVersion: VENDORED_ENGINE_VERSION,
93
- bridge: RUNTIME_IDENTITY.bridge,
94
- vector: RUNTIME_IDENTITY.vector,
95
- coordinatorSha256: {
96
- underTest: hashFile(path.join(engineIdentity.root, 'src', 'coordinator.js')),
97
- vendored: hashFile(path.join(VENDORED_ENGINE_ROOT, 'src', 'coordinator.js')),
98
- },
99
- },
100
- contract: {
101
- source: 'README.md 触发面 (the journal is the reconciliation source) + README.md:119 (hook-captured events are retained in the journal and only become tasks after the service consumes them) + src/coordinator.js consumeJournal + src/runtime/commit-reconciler.js:173 (a failed SHA is never retried, scanned or inferred from history)',
102
- scope: 'startup reconciliation = JOURNAL RECOVERY. A commit that never reached the journal is OUTSIDE the contract (uncovered boundary, stated - not papered over). A commit whose event WAS captured but was delivered after the analysed head moved past it is INSIDE the contract and must not be dropped.',
103
- },
104
- phases: {},
105
- commands,
106
- };
107
-
108
- const fixture = buildFixtureRepo(lane, 'eng007r4', []);
109
- const knowledgePath = path.join(lane, 'knowledge-eng007r4');
110
- const storePath = path.join(knowledgePath, 'dev-conversations');
111
- fs.mkdirSync(storePath, { recursive: true });
112
- const home = path.join(lane, 'bridge-home');
113
- const dataDir = path.join(lane, 'engine-data');
114
- const vectorRoot = path.join(lane, 'vector-root');
115
- const eventsFile = path.join(lane, 'analyzer-events.jsonl');
116
-
117
- const bridge = startBridge(home);
118
- let engine = null;
119
- let vector = null;
120
- const analyzer = createStandinAnalyzer({ eventsFile, engineRoot: engineIdentity.root });
121
- const invocationsFor = sha => readJsonl(eventsFile).filter(entry => entry.kind === 'start' && entry.commitSha === sha).length;
122
-
123
- try {
124
- const bridgeUrl = await bridge.listen();
125
- vector = await startVector(vectorRoot);
126
- const registered = await bridge.projectRegistry.addProject({ home, path: fixture.repoPath, store: storePath });
127
- const { repoIdentity } = await bridge.resolveRepoContext(fixture.repoPath);
128
-
129
- // Register the project (consumer off), then stop the engine: the offline
130
- // window begins. Nothing can consume a journal event while the engine is
131
- // down.
132
- engine = await startEngine({ dataDir, bridgeUrl, vectorUrl: vector.url, analyzer, consume: false, engineRoot: engineIdentity.root });
133
- await engine.listen();
134
- engine.runtime.store.addProject({
135
- projectId: PROJECT_ID, repoPath: fixture.repoPath, knowledgePath,
136
- trackingStartCommit: fixture.baseline, repoIdentity, journalId: registered.id, conversationBaselineCursor: 0,
137
- });
138
- await engine.close();
139
- engine = null;
140
- commands.push('engine lifecycle 0: project registered (consumer off), engine stopped - offline window begins');
141
-
142
- // ----- commit A: BROKEN hook (the real hook failure) -----
143
- installPostCommitHook(fixture.repoPath, { home, mode: 'broken' });
144
- fs.writeFileSync(path.join(fixture.repoPath, 'offline-a.txt'), `offline feature A\n${'a'.repeat(64)}\n`);
145
- git(fixture.repoPath, ['add', '.']);
146
- const commitA = gitRun(fixture.repoPath, ['commit', '-qm', 'offline feature A']);
147
- assert.equal(commitA.code, 0, `Git must not be blocked by the failing hook (exit ${commitA.code})`);
148
- const shaA = git(fixture.repoPath, ['rev-parse', 'HEAD']);
149
- assert.match(commitA.stderr, /commit-boundary\.missing\.js/, 'the hook really failed');
150
-
151
- // ----- commit C: BROKEN hook too, and it is NEVER captured later -----
152
- installPostCommitHook(fixture.repoPath, { home, mode: 'broken' });
153
- fs.writeFileSync(path.join(fixture.repoPath, 'offline-c.txt'), `offline feature C\n${'c'.repeat(64)}\n`);
154
- git(fixture.repoPath, ['add', '.']);
155
- const commitC = gitRun(fixture.repoPath, ['commit', '-qm', 'offline feature C']);
156
- assert.equal(commitC.code, 0);
157
- const shaC = git(fixture.repoPath, ['rev-parse', 'HEAD']);
158
-
159
- // ----- commit B: WORKING hook (the real capture path) -----
160
- installPostCommitHook(fixture.repoPath, { home, mode: 'ok' });
161
- fs.writeFileSync(path.join(fixture.repoPath, 'offline-b.txt'), `offline feature B\n${'b'.repeat(64)}\n`);
162
- git(fixture.repoPath, ['add', '.']);
163
- const commitB = gitRun(fixture.repoPath, ['commit', '-qm', 'offline feature B']);
164
- assert.equal(commitB.code, 0);
165
- const shaB = git(fixture.repoPath, ['rev-parse', 'HEAD']);
166
-
167
- const boundariesOffline = boundaryEvents(home, storePath);
168
- assert.equal(boundariesOffline.filter(e => e.commitSha === shaB).length, 1, 'B wrote exactly one boundary event while the engine was down');
169
- assert.equal(boundariesOffline.filter(e => e.commitSha === shaA).length, 0, 'A wrote no boundary event (hook failure)');
170
- assert.equal(boundariesOffline.filter(e => e.commitSha === shaC).length, 0, 'C wrote no boundary event (hook failure)');
171
-
172
- // A and C really are ancestors of B in the real Git history (the
173
- // "the analysed head moved past them" precondition).
174
- const aIsAncestorOfB = gitRun(fixture.repoPath, ['merge-base', '--is-ancestor', shaA, shaB]);
175
- const cIsAncestorOfB = gitRun(fixture.repoPath, ['merge-base', '--is-ancestor', shaC, shaB]);
176
- assert.equal(aIsAncestorOfB.code, 0, 'A must be an ancestor of B');
177
- assert.equal(cIsAncestorOfB.code, 0, 'C must be an ancestor of B');
178
-
179
- evidence.phases.offlineWindow = {
180
- baseline: fixture.baseline,
181
- commitA: { sha: shaA, subject: 'offline feature A', hook: 'broken (missing CLI)', gitExit: commitA.code, hookStderr: (commitA.stderr.split('\n').find(line => line.includes('commit-boundary.missing.js')) || commitA.stderr.split('\n')[0]), boundaryEvents: 0 },
182
- commitC: { sha: shaC, subject: 'offline feature C', hook: 'broken (missing CLI)', gitExit: commitC.code, boundaryEvents: 0 },
183
- commitB: { sha: shaB, subject: 'offline feature B', hook: 'working (real bridge CLI)', gitExit: commitB.code, boundaryEvents: 1 },
184
- aIsAncestorOfB: aIsAncestorOfB.code === 0,
185
- cIsAncestorOfB: cIsAncestorOfB.code === 0,
186
- };
187
- commands.push(`offline window: A (broken hook, 0 events), C (broken hook, 0 events), B (working hook, 1 event); A and C are ancestors of B`);
188
-
189
- // ----- restart: startup drain compensates B (journal recovery works) -----
190
- engine = await startEngine({ dataDir, bridgeUrl, vectorUrl: vector.url, analyzer, consume: true, engineRoot: engineIdentity.root });
191
- await engine.listen();
192
- const runB = await waitUntil(async () => {
193
- const run = engine.runtime.store.listRuns(PROJECT_ID).find(r => r.commitSha === shaB);
194
- return run && run.state === 'succeeded' ? run : null;
195
- }, 60000, 'startup drain compensates B');
196
- await new Promise(resolve => setTimeout(resolve, 1500));
197
-
198
- const ledgerPath = sha => path.join(dataDir, 'runtime', 'processed-commits', PROJECT_ID, `${sha}.json`);
199
- const runsAfterStart = engine.runtime.store.listRuns(PROJECT_ID);
200
- const lastAnalyzedAfterStart = engine.runtime.store.getProject(PROJECT_ID)?.runtime?.lastAnalyzedCommit || null;
201
- evidence.phases.startupJournalRecovery = {
202
- runForB: { runId: runB.runId, trigger: runB.trigger, state: runB.state },
203
- analyzerInvocations: { forA: invocationsFor(shaA), forB: invocationsFor(shaB), forC: invocationsFor(shaC) },
204
- runsForA: runsAfterStart.filter(r => r.commitSha === shaA).length,
205
- runsForC: runsAfterStart.filter(r => r.commitSha === shaC).length,
206
- totalRuns: runsAfterStart.length,
207
- ledgerAExists: fs.existsSync(ledgerPath(shaA)),
208
- ledgerCExists: fs.existsSync(ledgerPath(shaC)),
209
- lastAnalyzedCommit: lastAnalyzedAfterStart,
210
- verdict: 'the startup drain compensates B (the captured event). A and C never reached the journal, so no recovery path exists for them - that is the documented journal-recovery boundary, not a defect.',
211
- };
212
- assert.equal(runB.trigger, 'git-hook');
213
- assert.equal(invocationsFor(shaB), 1, 'B compensated exactly once');
214
- assert.equal(runsAfterStart.filter(r => r.commitSha === shaA).length, 0, 'A has no run: nothing for the engine to consume');
215
- assert.equal(runsAfterStart.filter(r => r.commitSha === shaC).length, 0, 'C has no run: nothing for the engine to consume');
216
- assert.equal(fs.existsSync(ledgerPath(shaA)), false, 'A is not in the processing ledger');
217
- assert.equal(lastAnalyzedAfterStart, shaB, 'B\'s success moved lastAnalyzedCommit to shaB');
218
- commands.push(`restart -> drain compensated B (${shaB.slice(0, 8)}); A (${shaA.slice(0, 8)}) and C (${shaC.slice(0, 8)}) have no run/ledger/analysis - never captured`);
219
-
220
- // ----- the defect: A's boundary is captured NOW, after the head moved past it -----
221
- const cursorBefore = engine.runtime.store.state.journalCursors[registered.id] || 0;
222
- const captureA = captureBoundary({ home, repoPath: fixture.repoPath, sha: shaA });
223
- assert.equal(captureA.code, 0, `capturing A's boundary through the real CLI failed: ${captureA.stderr}`);
224
- assert.equal(captureA.payload?.ok, true, `the real boundary CLI did not report ok: ${captureA.stdout}`);
225
- await waitUntil(async () => (engine.runtime.store.state.journalCursors[registered.id] || 0) > cursorBefore, 30000, 'A\'s late boundary event is consumed');
226
- await engine.runtime.coordinator.drain();
227
- await new Promise(resolve => setTimeout(resolve, 1500));
228
-
229
- const runsAfterLateCapture = engine.runtime.store.listRuns(PROJECT_ID);
230
- const runA = runsAfterLateCapture.find(r => r.commitSha === shaA) || null;
231
- const lastAnalyzedAfterLateCapture = engine.runtime.store.getProject(PROJECT_ID)?.runtime?.lastAnalyzedCommit || null;
232
- const diagnostics = readDiagnostics(dataDir);
233
- const compensationDiagnostic = diagnostics.find(d => d.event === 'reconcile.missed_commit_compensated') || null;
234
- const knowledgeFileA = path.join(knowledgePath, 'changes', `${shaA.slice(0, 12)}.md`);
235
- const knowledgeFileB = path.join(knowledgePath, 'changes', `${shaB.slice(0, 12)}.md`);
236
-
237
- evidence.phases.lateDelivery = {
238
- capture: { code: captureA.code, ok: captureA.payload?.ok, commitSha: shaA, cli: 'pinned ai-coding-event-bridge commit-boundary CLI (the same code path the post-commit hook runs)' },
239
- journalCursorBefore: cursorBefore,
240
- journalCursorAfter: engine.runtime.store.state.journalCursors[registered.id] || 0,
241
- runsForA: runsAfterLateCapture.filter(r => r.commitSha === shaA).length,
242
- runForA: runA ? { runId: runA.runId, trigger: runA.trigger, state: runA.state, error: runA.error || null } : null,
243
- analyzerInvocations: { forA: invocationsFor(shaA), forB: invocationsFor(shaB), forC: invocationsFor(shaC) },
244
- ledgerAExists: fs.existsSync(ledgerPath(shaA)),
245
- knowledgeFileForA: fs.existsSync(knowledgeFileA),
246
- knowledgeFileForB: fs.existsSync(knowledgeFileB),
247
- lastAnalyzedCommit: lastAnalyzedAfterLateCapture,
248
- runOrder: runsAfterLateCapture.map(r => ({ commitSha: r.commitSha, state: r.state })),
249
- analysisOrder: readJsonl(eventsFile).filter(entry => entry.kind === 'start').map(entry => entry.commitSha),
250
- compensationDiagnostic: compensationDiagnostic
251
- ? { event: compensationDiagnostic.event, level: compensationDiagnostic.level, commitSha: compensationDiagnostic.commitSha, message: compensationDiagnostic.message }
252
- : null,
253
- runsForC: runsAfterLateCapture.filter(r => r.commitSha === shaC).length,
254
- };
255
- commands.push(`A's boundary captured through the real CLI after B was analysed -> cursor ${cursorBefore}->${evidence.phases.lateDelivery.journalCursorAfter}; runs for A: ${evidence.phases.lateDelivery.runsForA}`);
256
-
257
- // ----- the boundaries that must survive -----
258
- assert.equal(invocationsFor(shaB), 1, 'the already completed SHA is not analysed a second time');
259
- assert.equal(runsAfterLateCapture.filter(r => r.commitSha === shaB).length, 1, 'the already completed SHA has exactly one run');
260
- assert.equal(invocationsFor(shaC), 0, 'C (never captured) is still not analysed - the journal-recovery boundary is unchanged');
261
- assert.equal(runsAfterLateCapture.filter(r => r.commitSha === shaC).length, 0, 'C (never captured) still has no run');
262
-
263
- saveEvidence(ARTIFACTS, `eng007r4-evidence-${targetLabel(engineIdentity)}.json`, evidence);
264
-
265
- // ----- the decision: a captured commit must not be dropped -----
266
- assert.equal(
267
- evidence.phases.lateDelivery.runsForA, 1,
268
- `A's boundary WAS captured (real CLI, ok) and consumed (cursor advanced), but the engine produced no run for it: the captured evidence was dropped. runs=${JSON.stringify(evidence.phases.lateDelivery.runOrder)}`,
269
- );
270
- assert.equal(runA.state, 'succeeded', `A's compensated run must succeed: ${JSON.stringify(runA.error)}`);
271
- assert.equal(invocationsFor(shaA), 1, 'A is analysed exactly once (no duplicate paid call)');
272
- assert.equal(fs.existsSync(ledgerPath(shaA)), true, 'A is recorded in the processing ledger');
273
- assert.equal(fs.existsSync(knowledgeFileA), true, 'A reaches the knowledge tree');
274
- assert.ok(compensationDiagnostic, 'the compensation is recorded as a diagnostic');
275
- assert.equal(compensationDiagnostic.commitSha, shaA);
276
-
277
- evidence.verdict = {
278
- 'never captured (hook failure)': `UNCOVERED BY CONTRACT - A and C never reached the journal (0 boundary events on disk); the engine has no Git-history traversal (CommitScanner.scan/scanProject/applyScanResult are exported but never called from src/). Startup reconciliation is journal recovery only (README 触发面, README:119, src/coordinator.js consumeJournal, src/runtime/commit-reconciler.js:173).`,
279
- 'captured but delivered after the analysed head moved past it': `COMPENSATED - A's real boundary event is captured and consumed and A is analysed exactly once, promoted to the knowledge tree and recorded in the processing ledger; a 'reconcile.missed_commit_compensated' diagnostic records the compensation.`,
280
- 'completed SHA not re-run': 'PASS (B analysed exactly once, one run)',
281
- 'never-captured SHA not analysed': 'PASS (C is still not analysed - the contract boundary is unchanged)',
282
- 'analyser invocations': 'no duplicate paid call: exactly one invocation per analysed SHA',
283
- analyzerStandin: 'deterministic stand-in - NO real model output covered; vector-hub real with deterministic test embeddings - the paid embedding API is NOT covered',
284
- consequence: `lastAnalyzedCommit moved ${shaB.slice(0, 8)} -> ${String(lastAnalyzedAfterLateCapture).slice(0, 8)} (the compensated commit is older than the analysed head, so the single pointer regresses) and the chronological analysis order becomes ${evidence.phases.lateDelivery.analysisOrder.map(sha => sha.slice(0, 8)).join(' -> ')} (B first, then the compensated A), which deviates from README:95 ("同项目按提交顺序执行"). The run list itself is returned ordered by SHA, so the order above is read from the analyzer's append-only invocation log. Recorded as a consequence of the minimal fix, not as a test assertion.`,
285
- };
286
- saveEvidence(ARTIFACTS, `eng007r4-evidence-${targetLabel(engineIdentity)}.json`, evidence);
287
-
288
- await engine.close();
289
- await vector.close();
290
- await bridge.close();
291
- console.log(`ENG-007 R4 probe PASS (engine: ${engineIdentity.origin} ${engineIdentity.version})`);
292
- process.exit(0);
293
- } catch (error) {
294
- evidence.verdict = { failed: String((error && error.stack) || error) };
295
- try { await engine?.close(); } catch {}
296
- try { await vector?.close(); } catch {}
297
- try { await bridge.close(); } catch {}
298
- saveEvidence(ARTIFACTS, `eng007r4-evidence-${targetLabel(engineIdentity)}.json`, evidence);
299
- console.error(`ENG-007 R4 probe FAIL: ${error.message}`);
300
- process.exit(1);
301
- }
302
- }
303
-
304
- main();
@@ -1,194 +0,0 @@
1
- 'use strict';
2
- // Parallel knowledge lane — regression for the engine error-code contract.
3
- //
4
- // 迁移说明(五页简化 UI,见 patches/ui-test-mapping-spec.md):
5
- // * 本文件不驱动 UI,唯一的迁移点是引擎 schema:lib/engine-knowledge-client
6
- // 的身份门现要求 /api/health 返回 dataSchemaVersion === 4,stub 引擎的
7
- // health 响应从 3 改为 4,否则四个失败场景全部被误判为
8
- // ENGINE_IDENTITY_MISMATCH(409)而不是各自的错误码。
9
- // * 业务断言(字符串/对象信封保留错误码、非法码回退
10
- // ENGINE_REQUEST_FAILED、ok:false+200 → 502、HTTP 状态保留、成功读取
11
- // 不变)逐字保持,未改任何断言。
12
- //
13
- //
14
- // The vendored knowledge-engine reports a failed read as { ok:false,
15
- // error:'<CODE>' } with the code as a plain string. The product client used to
16
- // read the code only from payload.error.code, so every genuine business
17
- // failure was flattened into the generic ENGINE_REQUEST_FAILED and the real
18
- // reason was lost for the shell and for the MCP tools.
19
- //
20
- // This file pins the contract on a real loopback HTTP server:
21
- // * the string envelope keeps its code;
22
- // * the object envelope keeps its code;
23
- // * an invalid code still falls back to ENGINE_REQUEST_FAILED;
24
- // * the HTTP status is preserved on the raised DomainError;
25
- // * a successful read is unchanged.
26
- //
27
- // It validates the CURRENT PRODUCT only. It never reads the Git history, the
28
- // current HEAD, a remote repository or any pre-existing object, so it stays
29
- // green after the fix is committed and in a shallow checkout or an exported
30
- // tree without a .git directory.
31
- //
32
- // The historical red reproduction (the pre-fix client failing this matrix)
33
- // was removed from this entry point on purpose: it depended on `git show
34
- // HEAD:...`, which turns a fixed defect red the moment the fix lands. It is
35
- // preserved as ignored evidence instead, together with a fixed snapshot of
36
- // the pre-fix source, so the defect stays documented without the canonical
37
- // regression depending on Git history:
38
- // qa-autopilot/artifacts/parallel-20261023/test-knowledge/legacy/
39
- //
40
- // Nothing here touches the live 5757/5790/8787/8790 endpoints or the real
41
- // HOME: the entry point isolates itself before loading any product module.
42
- const assert = require('node:assert/strict');
43
- const fs = require('node:fs');
44
- const path = require('node:path');
45
- const http = require('node:http');
46
- const fixture = require('./helpers/parallel-knowledge-fixture');
47
- fixture.isolateProcess();
48
- const { StorageLayout } = require('../lib/storage-layout');
49
- const { EngineKnowledgeClient } = require('../lib/engine-knowledge-client');
50
-
51
- // --only=patched is accepted as an explicit alias of the default run. No
52
- // other mode exists here: the historical --only=head mode was moved to the
53
- // ignored legacy evidence and must not be reintroduced, because a canonical
54
- // test that depends on Git history is red by construction after the fix is
55
- // committed.
56
- const LEGACY_HEAD_MODE = '--only=head';
57
-
58
- function createEngineStub({ repoPath, knowledgePath, projectId, envelope }) {
59
- const server = http.createServer((req, res) => {
60
- const send = (status, body) => {
61
- res.writeHead(status, { 'Content-Type': 'application/json' });
62
- res.end(JSON.stringify(body));
63
- };
64
- if (req.url === '/api/health') return send(200, { name: 'knowledge-engine', dataSchemaVersion: 4 });
65
- if (req.url === '/api/projects') {
66
- return send(200, { ok: true, projects: [{ projectId, enabled: true, repoPath, knowledgePath }] });
67
- }
68
- if (req.method === 'POST') {
69
- let body = '';
70
- req.on('data', chunk => { body += chunk; });
71
- req.on('end', () => {
72
- if (envelope.kind === 'success') return send(200, { ok: true, results: [], answer: 'ok', citations: [] });
73
- return send(envelope.status, envelope.body);
74
- });
75
- return;
76
- }
77
- return send(404, { ok: false, error: 'NOT_FOUND' });
78
- });
79
- return server;
80
- }
81
-
82
- async function listen(server) {
83
- await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
84
- const { port } = server.address();
85
- fixture.assertAllowedPort(port, 'test engine port');
86
- return `http://127.0.0.1:${port}`;
87
- }
88
-
89
- const SCENARIOS = [
90
- {
91
- id: 'string-envelope-code-kept',
92
- envelope: { kind: 'failure', status: 403, body: { ok: false, error: 'PATH_OUTSIDE_ROOT' } },
93
- expectedCode: 'PATH_OUTSIDE_ROOT',
94
- expectedStatus: 403,
95
- },
96
- {
97
- id: 'object-envelope-code-kept',
98
- envelope: { kind: 'failure', status: 404, body: { ok: false, error: { code: 'PROJECT_NOT_FOUND' } } },
99
- expectedCode: 'PROJECT_NOT_FOUND',
100
- expectedStatus: 404,
101
- },
102
- {
103
- id: 'invalid-code-falls-back',
104
- envelope: { kind: 'failure', status: 500, body: { ok: false, error: 'not a valid code!' } },
105
- expectedCode: 'ENGINE_REQUEST_FAILED',
106
- expectedStatus: 500,
107
- },
108
- {
109
- id: 'ok-false-on-200-becomes-502',
110
- envelope: { kind: 'failure', status: 200, body: { ok: false, error: 'INVALID_ARGUMENT' } },
111
- expectedCode: 'INVALID_ARGUMENT',
112
- expectedStatus: 502,
113
- },
114
- ];
115
-
116
- (async () => {
117
- const args = process.argv.slice(2);
118
- if (args.includes(LEGACY_HEAD_MODE)) {
119
- console.error(`${LEGACY_HEAD_MODE} was removed from this canonical entry point.`);
120
- console.error('The pre-fix red reproduction now lives in the ignored evidence:');
121
- console.error(' qa-autopilot/artifacts/parallel-20261023/test-knowledge/legacy/reproduce-pre-fix-client.js');
122
- console.error('It uses a fixed source snapshot, so the canonical regression never depends on Git history.');
123
- process.exitCode = 2;
124
- return;
125
- }
126
-
127
- const root = fixture.makeTempDir('parallel-knowledge-client');
128
- const layout = new StorageLayout({ dataDir: path.join(root, 'data') });
129
- const repoPath = path.join(root, 'repo');
130
- const knowledgePath = path.join(root, 'knowledge');
131
- fs.mkdirSync(repoPath, { recursive: true });
132
- fs.mkdirSync(knowledgePath, { recursive: true });
133
- const project = { projectId: 'project-client', repoPath, knowledgePath };
134
- const results = [];
135
-
136
- function record(caseId, status, detail) {
137
- results.push({ caseId, status, detail });
138
- console.log(`CASE ${caseId} ${status} ${JSON.stringify(detail)}`);
139
- }
140
-
141
- try {
142
- for (const scenario of SCENARIOS) {
143
- const server = createEngineStub({ ...project, envelope: scenario.envelope });
144
- const engineUrl = await listen(server);
145
- try {
146
- const client = new EngineKnowledgeClient({ layout, engineUrl });
147
- let raised = null;
148
- try {
149
- await client.request('search', { query: 'x' }, project);
150
- } catch (error) { raised = error; }
151
- assert.ok(raised, 'the client must reject a failed read');
152
- assert.equal(raised.code, scenario.expectedCode, `unexpected code for ${scenario.id}`);
153
- assert.equal(raised.status, scenario.expectedStatus, `unexpected status for ${scenario.id}`);
154
- record(`CLIENT-${scenario.id}`, 'PASS', { code: raised.code, status: raised.status, engineUrl });
155
- } finally {
156
- server.closeAllConnections();
157
- await new Promise(resolve => server.close(resolve));
158
- }
159
- }
160
-
161
- // A successful read must still succeed.
162
- {
163
- const server = createEngineStub({ ...project, envelope: { kind: 'success' } });
164
- const engineUrl = await listen(server);
165
- try {
166
- const client = new EngineKnowledgeClient({ layout, engineUrl });
167
- const payload = await client.request('search', { query: 'x' }, project);
168
- assert.equal(payload.ok, true);
169
- assert.ok(Array.isArray(payload.results));
170
- record('CLIENT-success-envelope-untouched', 'PASS', { ok: payload.ok, resultCount: payload.results.length });
171
- } finally {
172
- server.closeAllConnections();
173
- await new Promise(resolve => server.close(resolve));
174
- }
175
- }
176
-
177
- const summary = {
178
- lane: 'test-knowledge',
179
- file: 'parallel-knowledge-client-error-code-test.js',
180
- cases: results,
181
- productionTouched: false,
182
- gitHistoryUsed: false,
183
- note: 'the canonical regression validates the current product only; the pre-fix red reproduction was moved to the ignored legacy evidence and runs against a fixed source snapshot',
184
- legacyRedEvidence: 'qa-autopilot/artifacts/parallel-20261023/test-knowledge/legacy/',
185
- };
186
- const target = process.env.PARALLEL_KNOWLEDGE_EVIDENCE;
187
- if (target) fs.mkdirSync(path.dirname(target), { recursive: true });
188
- if (target) fs.writeFileSync(target, JSON.stringify(summary, null, 2), 'utf8');
189
- console.log('parallel-knowledge-client-error-code-test PASS');
190
- } finally {
191
- fixture.removeTree(root);
192
- fixture.cleanupIsolatedProcess();
193
- }
194
- })().catch(error => { console.error(error); process.exitCode = 1; });