@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,81 +0,0 @@
1
- 'use strict';
2
- // Lane-owned child process that hosts the REAL claude-ai-workbench module
3
- // (0.13.6, the copy the installed product ships) for the P-MEMORY-INJECTION-02
4
- // lane. It speaks the module's real HTTP contract and is started by the lane
5
- // probes.
6
- //
7
- // The shape of this child is a READ-ONLY SNAPSHOT of
8
- // _site/_test/helpers/parallel-workbench-host.js (Workbench provenance lane);
9
- // the source file is not modified and not imported, so this lane never
10
- // depends on another lane's unfrozen file. The snapshot hash of the source is
11
- // recorded in the lane report.
12
- //
13
- // Environment (all set by the parent):
14
- // PK_WB_MODULE_ROOT the claude-ai-workbench package root to host
15
- // PK_WB_HOST_PORT port to listen on (127.0.0.1)
16
- // PK_WB_HOST_DATA_DIR isolated workbench data directory
17
- // PK_WB_HOST_WORKSPACES JSON map of workspaceRef -> absolute directory
18
- // PK_WB_ENGINE_URL the knowledge engine URL (a recording proxy)
19
- // PK_WB_PROFILE_SOURCE none | real-readonly
20
- // PK_WB_BRIDGE_URL optional event-bridge console URL (enables capture)
21
- // PK_WB_BRIDGE_TOKEN optional event-bridge runtime token (memory only)
22
- const path = require('node:path');
23
- const fs = require('node:fs');
24
-
25
- const moduleRoot = String(process.env.PK_WB_MODULE_ROOT || '').trim();
26
- const port = Number(process.env.PK_WB_HOST_PORT || 0);
27
- const dataDir = String(process.env.PK_WB_HOST_DATA_DIR || '').trim();
28
- const workspaces = JSON.parse(String(process.env.PK_WB_HOST_WORKSPACES || '{}'));
29
- const engineUrl = String(process.env.PK_WB_ENGINE_URL || '').trim();
30
- const profileSource = String(process.env.PK_WB_PROFILE_SOURCE || 'none');
31
- const bridgeUrl = String(process.env.PK_WB_BRIDGE_URL || '').trim();
32
- const bridgeToken = String(process.env.PK_WB_BRIDGE_TOKEN || '').trim();
33
-
34
- if (!moduleRoot || !port || !dataDir || !Object.keys(workspaces).length) {
35
- console.error('parallel-memory-injection-wb-host: PK_WB_MODULE_ROOT, PK_WB_HOST_PORT, PK_WB_HOST_DATA_DIR and PK_WB_HOST_WORKSPACES are required');
36
- process.exit(2);
37
- }
38
-
39
- // Same contract as the module's own bin: the runtime resolves its data
40
- // directory from these.
41
- process.env.CLAUDE_AI_WORKBENCH_DATA_DIR = dataDir;
42
- process.env.KB_DATA_DIR = dataDir;
43
- if (engineUrl) process.env.KB_KNOWLEDGE_ENGINE_URL = engineUrl;
44
-
45
- const { createWorkbenchServer } = require(path.join(moduleRoot, 'packages', 'server'));
46
-
47
- function buildOptions() {
48
- const options = { dataDir, workspaces };
49
- if (profileSource === 'real-readonly') {
50
- const shell = require('./parallel-memory-injection-shell');
51
- options.profiles = shell.createReadOnlyProfileStore(moduleRoot, { dataDir });
52
- }
53
- if (bridgeUrl && bridgeToken) {
54
- // The real Workbench capture: the module records the ORIGINAL user input
55
- // (not the augmented prompt) and flushes it to the Bridge.
56
- const { ConversationCapture } = require(path.join(moduleRoot, 'packages', 'server', 'lib', 'conversation-capture.js'));
57
- options.conversationCapture = new ConversationCapture({
58
- file: path.join(dataDir, 'capture-outbox.v1.json'),
59
- bridgeUrl,
60
- token: bridgeToken,
61
- });
62
- }
63
- return options;
64
- }
65
-
66
- const app = createWorkbenchServer(buildOptions());
67
- app.server.listen(port, '127.0.0.1', () => {
68
- process.stdout.write(`WORKBENCH_HOST_READY http://127.0.0.1:${port} engine=${engineUrl || 'none'} capture=${bridgeUrl ? 'on' : 'off'}\n`);
69
- });
70
-
71
- let stopping = false;
72
- async function shutdown() {
73
- if (stopping) return;
74
- stopping = true;
75
- setTimeout(() => process.exit(1), 10000).unref();
76
- try { await app.service.destroy(); } catch { process.exitCode = 1; }
77
- app.server.closeAllConnections?.();
78
- app.server.close(() => process.exit(process.exitCode || 0));
79
- }
80
- process.on('SIGINT', shutdown);
81
- process.on('SIGTERM', shutdown);
@@ -1,489 +0,0 @@
1
- 'use strict';
2
- // _site/_test/helpers/parallel-memory-shell.js
3
- //
4
- // Lane harness for the P-MEMORY-01 memory lane.
5
- //
6
- // Every case runs against a real, isolated product instance:
7
- // * its own port, data dir, knowledge root and Bridge journal home (the
8
- // shared spawn-server helper already isolates those);
9
- // * the REAL vendored knowledge engine, in-process, with a declared
10
- // stand-in analyzer (helpers/parallel-memory-analyzer.js) that only
11
- // replaces the model step;
12
- // * a pass-through proxy in front of the engine, so the product's own
13
- // runtime token reaches the engine the way it does in production;
14
- // * real HTTP module services for terminal / vector-hub / event-bridge;
15
- // * a real Chrome (CDP) in its own profile.
16
- //
17
- // Nothing here reaches the developer's live 5757/5790/8787/8790 endpoints,
18
- // the real HOME, the real knowledge directories or the real memories.
19
-
20
- const assert = require('node:assert/strict');
21
- const crypto = require('node:crypto');
22
- const fs = require('node:fs');
23
- const path = require('node:path');
24
- const { spawnSync } = require('node:child_process');
25
-
26
- const { spawnServer } = require('../helpers/spawn-server');
27
- const { findChrome } = require('../helpers/find-chrome');
28
- const { launchCdpBrowser, waitFor } = require('../helpers/cdp-browser');
29
- const { attachNetworkCapture } = require('../helpers/cdp-network-capture');
30
- const { createModuleFixture, createUpstreamProxy } = require('../helpers/module-fixture');
31
- const freePort = require('../helpers/free-port');
32
- const { createMemoryStandinAnalyzer } = require('./parallel-memory-analyzer');
33
- const { createEventBridgeStandin } = require('./parallel-memory-event-bridge');
34
- const { applyDriverIsolation } = require('./parallel-qa-engine-endpoint-isolate');
35
- const { guardedCreateEngineServer, createEngineVectorStandin } = require('./parallel-qa-engine-endpoint-guard');
36
-
37
- const ROOT = path.resolve(__dirname, '../../..');
38
- const LIVE_PORTS = new Set([5757, 5760, 5790, 5810, 8787, 8790]);
39
-
40
- function git(cwd, args) {
41
- const result = spawnSync('git', ['-C', cwd, ...args], { encoding: 'utf8', windowsHide: true, env: { ...process.env, GIT_TERMINAL_PROMPT: '0' } });
42
- assert.equal(result.status, 0, `git ${args.join(' ')} failed: ${result.stderr}`);
43
- return String(result.stdout || '').trim();
44
- }
45
-
46
- /** A real Git repository with real commits: the product imports it for real. */
47
- function makeRepo(root, name, files = { 'README.md': `# ${name}\n` }) {
48
- const repo = path.join(root, name);
49
- fs.mkdirSync(repo, { recursive: true });
50
- git(repo, ['init', '-q', '-b', 'main']);
51
- git(repo, ['config', 'user.email', 'parallel-memory@local.invalid']);
52
- git(repo, ['config', 'user.name', 'Parallel Memory Regression']);
53
- git(repo, ['config', 'commit.gpgsign', 'false']);
54
- for (const [file, content] of Object.entries(files)) fs.writeFileSync(path.join(repo, file), content, 'utf8');
55
- git(repo, ['add', '.']);
56
- git(repo, ['commit', '-qm', 'baseline']);
57
- return { path: repo, headCommit: git(repo, ['rev-parse', 'HEAD']) };
58
- }
59
-
60
- /**
61
- * A real follow-up commit in an existing repository.
62
- *
63
- * The engine registers a project with `trackingStartCommit` set to the commit
64
- * that was HEAD at import time, and it treats a run for that very commit as
65
- * already analysed. A maintenance run therefore has to target a commit that
66
- * was made after the import — exactly the production flow.
67
- */
68
- function commitFile(repo, file, content, message = 'follow-up') {
69
- const full = path.join(repo.path, file);
70
- fs.mkdirSync(path.dirname(full), { recursive: true });
71
- fs.writeFileSync(full, content, 'utf8');
72
- git(repo.path, ['add', '.']);
73
- git(repo.path, ['commit', '-qm', message]);
74
- repo.headCommit = git(repo.path, ['rev-parse', 'HEAD']);
75
- return repo.headCommit;
76
- }
77
-
78
- async function startHarness({ tag, evidenceDir, viewport = { width: 1600, height: 900 }, productRoot = ROOT, workflowEntry } = {}) {
79
- // Full driver isolation FIRST, before any product module load or fixture
80
- // directory: the environment is rebuilt from a system whitelist with every
81
- // product surface pointed at a per-run layout. Chrome is captured from the
82
- // REAL environment before the wipe and carried through as KB_CHROME_PATH.
83
- const applied = applyDriverIsolation({ prefix: `pk-qa-memory-${tag}`, captureChrome: true });
84
- const tempRoot = applied.layout.temp;
85
-
86
- const fixture = fs.mkdtempSync(path.join(tempRoot, `pk-parallel-memory-${tag}-`));
87
- const evidence = evidenceDir || path.join(fixture, 'evidence');
88
- fs.mkdirSync(evidence, { recursive: true });
89
- const dataDir = path.join(fixture, 'data');
90
- const knowledgeRoot = path.join(fixture, 'knowledge');
91
- fs.mkdirSync(knowledgeRoot, { recursive: true });
92
-
93
- const plan = { document: '', memoryCandidates: [] };
94
- const engineToken = crypto.randomBytes(24).toString('hex');
95
- // OWN fixtures exist BEFORE the engine. The coordinator ignores env and its
96
- // defaults are LIVE 8787/8790, so the engine must be constructed with an
97
- // explicit OWN vector endpoint (the full-contract stand-in, because run
98
- // maintenance ends in POST /api/sync which the module fixture lacks) and the
99
- // lane's own event bridge.
100
- const engineVector = createEngineVectorStandin({ label: 'memory-shell-engine-vector' });
101
- await engineVector.ready;
102
- const terminal = createModuleFixture({ kind: 'terminal', tag: `${tag}-terminal` });
103
- const vectorHub = createModuleFixture({ kind: 'vectorHub', tag: `${tag}-vectorhub` });
104
- // The shared event-bridge fixture answers with `bridge-1`, a journal id the
105
- // engine rejects, so the project never reaches the engine. This lane uses
106
- // its own stand-in that derives the real `sha256:` workspace id.
107
- const eventBridge = await createEventBridgeStandin({ tag: `${tag}-eventbridge` });
108
- await terminal.start();
109
- await vectorHub.start();
110
- await eventBridge.start();
111
-
112
- const engine = guardedCreateEngineServer({
113
- dataDir: path.join(fixture, 'engine'),
114
- runtimeToken: engineToken,
115
- debug: true,
116
- consume: false,
117
- analyzer: createMemoryStandinAnalyzer({ plan }),
118
- vectorUrl: engineVector.url,
119
- bridgeUrl: eventBridge.url,
120
- });
121
- await engine.ready;
122
- await new Promise(resolve => engine.server.listen(0, '127.0.0.1', resolve));
123
- const engineUrl = `http://127.0.0.1:${engine.server.address().port}`;
124
- assert.equal(LIVE_PORTS.has(engine.server.address().port), false, 'the lane engine must never use a live port');
125
- const engineProxy = createUpstreamProxy({ target: engineUrl, token: engineToken, tag: 'engine' });
126
- await engineProxy.start();
127
-
128
- let workflow;
129
- let workflowUrl = 'http://127.0.0.1:1';
130
- if (workflowEntry) {
131
- const { createWorkflowServer } = require(workflowEntry);
132
- workflow = createWorkflowServer({ dataDir: path.join(fixture, 'workflow-runtime') });
133
- const bound = await workflow.listen(0);
134
- workflowUrl = `http://127.0.0.1:${bound.port}`;
135
- }
136
- const port = await freePort();
137
- const base = `http://127.0.0.1:${port}`;
138
- const server = spawnServer({
139
- root: productRoot,
140
- port,
141
- dataDir,
142
- tag: `parallel-memory-${tag}`,
143
- analysisOwner: 'engine',
144
- extraEnv: {
145
- KB_MODULES_REGISTER: '1',
146
- KB_MODULES_AUTOSTART: '0',
147
- KB_TERMINAL_URL: terminal.url,
148
- KB_VECTORHUB_URL: vectorHub.url,
149
- KB_EVENTBRIDGE_URL: eventBridge.url,
150
- KB_KNOWLEDGE_ENGINE_URL: engineProxy.url,
151
- KB_WORKFLOW_URL: workflowUrl,
152
- },
153
- });
154
-
155
- const productApi = async (method, route, body) => {
156
- const response = await fetch(base + route, {
157
- method,
158
- headers: body === undefined ? undefined : { 'Content-Type': 'application/json' },
159
- body: body === undefined ? undefined : JSON.stringify(body),
160
- signal: AbortSignal.timeout(20000),
161
- });
162
- return { status: response.status, body: await response.json().catch(() => null) };
163
- };
164
-
165
- const engineApi = async (method, route, body) => {
166
- const response = await fetch(engineUrl + route, {
167
- method,
168
- headers: {
169
- 'Content-Type': 'application/json',
170
- ...(engineToken ? { Authorization: `Bearer ${engineToken}` } : {}),
171
- },
172
- body: body === undefined ? undefined : JSON.stringify(body),
173
- signal: AbortSignal.timeout(20000),
174
- });
175
- return { status: response.status, body: await response.json().catch(() => null) };
176
- };
177
-
178
- await waitFor(async () => {
179
- try { return (await productApi('GET', '/api/health')).status === 200; } catch { return false; }
180
- }, 'the isolated product instance', 30000);
181
- const settings = await productApi('PATCH', '/api/settings', { knowledge: { rootPath: knowledgeRoot } });
182
- assert.equal(settings.status, 200, `the isolated instance accepts its own knowledge root: ${JSON.stringify(settings.body)}`);
183
-
184
- let browser = null;
185
- let network = null;
186
- try {
187
- browser = await launchCdpBrowser({
188
- chrome: findChrome(),
189
- profileDir: path.join(fixture, 'browser'),
190
- url: `${base}/`,
191
- width: viewport.width,
192
- height: viewport.height,
193
- });
194
- await browser.setViewport(viewport.width, viewport.height);
195
- await browser.send('Network.enable');
196
- network = attachNetworkCapture(browser);
197
- } catch (error) {
198
- await server.cleanup();
199
- await engineProxy.close();
200
- await terminal.close();
201
- await vectorHub.close();
202
- await eventBridge.close();
203
- await engine.close().catch(() => {});
204
- await workflow?.close();
205
- fs.rmSync(fixture, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
206
- throw error;
207
- }
208
-
209
- const run = expression => browser.evaluate(expression);
210
- const wait = ms => new Promise(resolve => setTimeout(resolve, ms));
211
- const reloadLog = [];
212
-
213
- /** Ask the shell to read the project registry again. */
214
- const requestRegistryRefresh = () => run("document.dispatchEvent(new Event('visibilitychange'))");
215
-
216
- /** A real page reload, so "it survives a refresh" is proven by the browser. */
217
- const reload = async () => {
218
- // Mark the OUTGOING document first. Page.reload is acknowledged before the
219
- // navigation commits, and Runtime.evaluate keeps answering in the old
220
- // context while it stays attached — so a bare readyState gate is satisfied
221
- // by the outgoing page (CI 40062048045: the nav click right after
222
- // reload() was dispatched into the commit gap and lost, and the memory
223
- // view never activated). The marker exists only in the old context, so
224
- // the gate below can only pass on the FRESH document; the active-view
225
- // clause additionally proves the product's synchronous boot finished
226
- // (ui/product.js attaches its click delegation before the boot setView
227
- // that marks the initial view active).
228
- const startedAt = Date.now();
229
- await run('window.__pkShellReloadMark = Date.now(), true');
230
- await browser.send('Page.reload', {});
231
- await waitFor(
232
- () => run("document.readyState === 'complete' && typeof window.__pkShellReloadMark === 'undefined' && document.querySelector('.view.active') !== null"),
233
- 'the reloaded page is the fresh document and its boot finished',
234
- 20000,
235
- );
236
- reloadLog.push({ at: new Date().toISOString(), freshBootGateMs: Date.now() - startedAt });
237
- };
238
-
239
- /**
240
- * Readiness snapshot for failure diagnostics: what the page really looks
241
- * like when a navigation assertion is about to fail (small metadata).
242
- */
243
- const navigationState = async () => {
244
- try {
245
- return await run(`(() => ({
246
- readyState: document.readyState,
247
- href: location.href,
248
- activeView: (document.querySelector('.view.active') || {}).id || null,
249
- activeNav: document.querySelector('nav [data-view].active') ? document.querySelector('nav [data-view].active').dataset.view : null,
250
- reloadMark: typeof window.__pkShellReloadMark,
251
- openDialogs: [...document.querySelectorAll('dialog[open]')].map(dialog => dialog.id),
252
- toastHidden: document.getElementById('toast') ? document.getElementById('toast').hidden : null,
253
- toastText: document.getElementById('toast') ? document.getElementById('toast').textContent.trim().slice(0, 80) : null,
254
- }))()`);
255
- } catch (error) {
256
- return { unreachable: String(error && error.message || error) };
257
- }
258
- };
259
-
260
- const pressBackspace = async (count = 1) => {
261
- for (let index = 0; index < count; index += 1) await pressKey('Backspace', { code: 'Backspace', keyCode: 8 });
262
- };
263
-
264
- /** Set a select's value and fire the real change event the shell listens to. */
265
- const selectOption = async (selector, value) => {
266
- const changed = await run(`(() => {
267
- const el = document.querySelector(${JSON.stringify(selector)});
268
- if (!el) return { missing: true };
269
- el.value = ${JSON.stringify(value)};
270
- el.dispatchEvent(new Event('change', { bubbles: true }));
271
- return { value: el.value };
272
- })()`);
273
- assert.ok(changed && !changed.missing, `the select ${selector} must exist`);
274
- assert.equal(changed.value, value, `the select ${selector} must accept the value ${value}`);
275
- };
276
-
277
- /** A native pointer click: the hit test runs first and must resolve to the target. */
278
- const nativeClick = async selector => {
279
- const probe = await run(`(() => {
280
- const el = document.querySelector(${JSON.stringify(selector)});
281
- if (!el) return { missing: true };
282
- const rect = el.getBoundingClientRect();
283
- if (rect.width <= 0 || rect.height <= 0) return { invisible: true };
284
- const x = rect.left + rect.width / 2;
285
- const y = rect.top + rect.height / 2;
286
- const hit = document.elementFromPoint(x, y);
287
- return { x, y, hitIsTarget: Boolean(hit && (hit === el || el.contains(hit))), label: (el.textContent || '').trim().slice(0, 40) };
288
- })()`);
289
- assert.ok(probe && !probe.missing, `the control ${selector} must exist in the page`);
290
- assert.ok(!probe.invisible, `the control ${selector} must be visible`);
291
- assert.ok(probe.hitIsTarget, `the control ${selector} must be the hit target; something else is on top`);
292
- const common = { x: probe.x, y: probe.y, button: 'left', clickCount: 1 };
293
- await browser.send('Input.dispatchMouseEvent', { type: 'mouseMoved', x: probe.x, y: probe.y, button: 'none', clickCount: 0 });
294
- await browser.send('Input.dispatchMouseEvent', { type: 'mousePressed', ...common });
295
- await browser.send('Input.dispatchMouseEvent', { type: 'mouseReleased', ...common });
296
- return probe;
297
- };
298
-
299
- const pressKey = async (key, { code, keyCode, text } = {}) => {
300
- const base = { key, code: code || key, windowsVirtualKeyCode: keyCode, nativeVirtualKeyCode: keyCode };
301
- await browser.send('Input.dispatchKeyEvent', { type: text ? 'keyDown' : 'rawKeyDown', ...base, text });
302
- await browser.send('Input.dispatchKeyEvent', { type: 'keyUp', ...base });
303
- };
304
- const pressTab = () => pressKey('Tab', { code: 'Tab', keyCode: 9 });
305
- const pressEnter = () => pressKey('Enter', { code: 'Enter', keyCode: 13, text: '\r' });
306
-
307
- /** Type into a focused field with real key events. */
308
- const typeText = async text => {
309
- for (const character of String(text)) {
310
- const upper = character.toUpperCase();
311
- const isLower = character >= 'a' && character <= 'z';
312
- const isUpper = character >= 'A' && character <= 'Z';
313
- const isDigit = character >= '0' && character <= '9';
314
- const code = isLower ? `Key${upper}` : isUpper ? `Key${character}` : isDigit ? `Digit${character}` : '';
315
- const keyCode = isLower ? upper.charCodeAt(0) : isUpper || isDigit ? character.charCodeAt(0) : 0;
316
- const base = { key: character, code, windowsVirtualKeyCode: keyCode, nativeVirtualKeyCode: keyCode };
317
- await browser.send('Input.dispatchKeyEvent', { type: 'keyDown', ...base, text: character, unmodifiedText: character });
318
- await browser.send('Input.dispatchKeyEvent', { type: 'keyUp', ...base });
319
- }
320
- };
321
-
322
- /** Import a real project through the real product API. */
323
- const importProject = async (repo, displayName, { domainId } = {}) => {
324
- const knowledgePath = path.join(knowledgeRoot, displayName);
325
- fs.mkdirSync(knowledgePath, { recursive: true });
326
- const result = await productApi('POST', '/api/projects/import', { localPath: repo.path, knowledgePath, displayName });
327
- assert.equal(result.status, 201, `the project import must succeed: ${JSON.stringify(result.body)}`);
328
- const projectId = result.body.projectId;
329
- if (domainId) {
330
- const patched = await productApi('PATCH', `/api/projects/${encodeURIComponent(projectId)}`, { domainId });
331
- assert.equal(patched.status, 200, `the domain binding must succeed: ${JSON.stringify(patched.body)}`);
332
- }
333
- return { projectId, project: result.body.project, knowledgePath, modules: result.body.modules };
334
- };
335
-
336
- /** Add a real domain to the brain of the isolated instance. */
337
- const addDomain = async name => {
338
- const result = await productApi('POST', '/api/domains', { name });
339
- assert.equal(result.status, 201, `the brain domain must be accepted: ${JSON.stringify(result.body)}`);
340
- return result.body.domain;
341
- };
342
-
343
- /** The knowledge directory the engine uses for the brain scope. */
344
- const brainScopePath = () => {
345
- const scope = engine.store.state.sharedScopes.find(entry => entry.kind === 'brain');
346
- assert.ok(scope, 'the engine must know the brain scope');
347
- return scope.knowledgePath;
348
- };
349
-
350
- /** The knowledge directory the engine uses for one domain scope. */
351
- const domainScopePath = domainId => {
352
- const scope = engine.store.state.sharedScopes.find(entry => entry.kind === 'domain' && entry.id === domainId);
353
- assert.ok(scope, `the engine must know the domain scope ${domainId}`);
354
- return scope.knowledgePath;
355
- };
356
-
357
- /** Every memory the product's own snapshot endpoint serves. */
358
- const productMemories = async () => {
359
- const snapshot = await productApi('GET', '/api/engine/snapshot?summary=1&limit=50');
360
- assert.equal(snapshot.status, 200, `the product snapshot must be readable: ${JSON.stringify(snapshot.body)}`);
361
- return snapshot.body.memories || [];
362
- };
363
-
364
- const addGroup = async (name, projectIds) => {
365
- const created = await engineApi('POST', '/api/memory-groups', { name });
366
- assert.equal(created.status, 200, JSON.stringify(created.body));
367
- const { group } = created.body;
368
- const binding = await engineApi('POST', `/api/memory-groups/${group.id}/project-bindings`, { addProjectIds: projectIds });
369
- assert.equal(binding.status, 200, JSON.stringify(binding.body));
370
- return group;
371
- };
372
-
373
- /** The memories the engine would inject into a task for one project. */
374
- const injectedMemories = async projectId => {
375
- const context = await engineApi('POST', '/api/context', { projectId, query: '长期记忆', task: 'memory-lane' });
376
- assert.equal(context.status, 200, `the engine context must be readable: ${JSON.stringify(context.body)}`);
377
- return context.body.memories || [];
378
- };
379
-
380
- /**
381
- * A memory candidate that satisfies the engine's own provenance gate: it
382
- * quotes the real human event, the quote contains the memory text, and it
383
- * declares why the text is a durable, cross-project owner preference.
384
- */
385
- const memoryCandidate = ({ text, event }) => ({
386
- text,
387
- quote: text,
388
- sourceEventId: event.eventId,
389
- sourceHash: event.contentHash,
390
- eligibility: {
391
- durable: true,
392
- crossProject: true,
393
- reason: '人工明确表达的长期偏好',
394
- scopeReason: '跨项目可复用的约定',
395
- },
396
- });
397
-
398
- /**
399
- * Drive the real pipeline to a candidate: a real follow-up commit, a real
400
- * conversation event bound to it, the stand-in analyzer's manifest and the
401
- * engine's own promotion and capture.
402
- */
403
- const produceCandidate = async ({ repo, projectId, text, inputOrigin = 'human', file = 'src/candidate.js' }) => {
404
- const head = commitFile(repo, file, `// ${text}\n`, 'candidate commit');
405
- const event = await ingestUserEvent({
406
- projectId,
407
- commitSha: head,
408
- content: `人工要求:${text}`,
409
- inputOrigin,
410
- });
411
- plan.document = `# 冻结证据\n\n${text}\n`;
412
- plan.memoryCandidates = [memoryCandidate({ text, event })];
413
- const run = await triggerRun(projectId, head);
414
- return { run, event, commitSha: head, capture: run.memoryCapture };
415
- };
416
-
417
- /**
418
- * Append a real conversation event to the engine's own conversation store.
419
- * The engine's own binder freezes it into the commit snapshot, and the
420
- * engine's own eligibility gate reads its inputOrigin.
421
- */
422
- const ingestUserEvent = async ({ projectId, commitSha, content, inputOrigin = 'human', turnId, eventId }) => {
423
- const id = eventId || `event-${crypto.randomUUID()}`;
424
- const turn = turnId || `turn-${crypto.randomUUID()}`;
425
- const result = await engine.coordinator.conversations.appendEvent(projectId, {
426
- eventId: id,
427
- sequence: 1,
428
- source: 'claude-code',
429
- eventType: 'user_prompt',
430
- role: 'user',
431
- inputOrigin,
432
- content,
433
- sessionId: `session-${projectId}`,
434
- turnId: turn,
435
- capturedAt: new Date().toISOString(),
436
- identityConfidence: 'exact',
437
- explicitCommitSha: commitSha,
438
- });
439
- return { eventId: id, turnId: turn, contentHash: result.event.contentHash, inputOrigin: result.event.inputOrigin };
440
- };
441
-
442
- /** Run the real maintenance pipeline for a commit and wait for the run. */
443
- const triggerRun = async (projectId, commitSha, timeoutMs = 60000) => {
444
- const started = await engineApi('POST', '/api/runs', { projectId, commitSha });
445
- assert.equal(started.status, 200, `the run must be accepted: ${JSON.stringify(started.body)}`);
446
- const runId = started.body.run.runId;
447
- const deadline = Date.now() + timeoutMs;
448
- let last = null;
449
- while (Date.now() < deadline) {
450
- const current = await engineApi('GET', `/api/runs/${encodeURIComponent(runId)}`);
451
- last = current.body && current.body.run;
452
- if (last && ['succeeded', 'failed'].includes(last.state)) {
453
- if (last.state === 'failed') throw new Error(`the run failed: ${JSON.stringify(last.error)}`);
454
- return last;
455
- }
456
- if (last && last.promotedAt && last.memoryCapture) return last;
457
- await wait(150);
458
- }
459
- throw new Error(`the run did not finish in time: ${JSON.stringify(last)}`);
460
- };
461
-
462
- const cleanup = async () => {
463
- await browser?.close();
464
- await server.cleanup();
465
- await engineProxy.close();
466
- await terminal.close();
467
- await vectorHub.close();
468
- await eventBridge.close();
469
- await engine.close().catch(() => {});
470
- await engineVector.close().catch(() => {});
471
- await workflow?.close();
472
- fs.rmSync(fixture, { recursive: true, force: true, maxRetries: 3, retryDelay: 100 });
473
- };
474
-
475
- return {
476
- fixture, evidence, dataDir, knowledgeRoot, tempRoot, plan,
477
- base, server, productApi, engineApi, engine, engineUrl, engineProxy,
478
- terminal, vectorHub, eventBridge, engineVector,
479
- browser, run, wait, waitFor, network, reloadLog, navigationState,
480
- requestRegistryRefresh, reload, pressBackspace, selectOption,
481
- nativeClick, pressKey, pressTab, pressEnter, typeText,
482
- importProject, addDomain, ingestUserEvent, triggerRun,
483
- brainScopePath, domainScopePath, productMemories, injectedMemories,
484
- addGroup, memoryCandidate, produceCandidate,
485
- cleanup,
486
- };
487
- }
488
-
489
- module.exports = { startHarness, makeRepo, commitFile, ROOT };