@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,301 +0,0 @@
1
- // _site/_test/helpers/parallel-dock-acceptance-env.js
2
- //
3
- // Lane-exclusive helper for batch P-DOCK-ACCEPTANCE-01 (DOCK-001/002/003).
4
- // Boots the REAL product page against REAL module processes with full
5
- // isolation:
6
- // - product shell: _site/lib/server-app.js via helpers/spawn-server.js
7
- // (isolated KB_DATA_DIR / KB_KNOWLEDGE_DATA_DIR / bridge home)
8
- // - terminal module: the pinned claude-ai-workbench package from this
9
- // repo's node_modules, spawned here on an exclusive port with its own
10
- // AGENT_TERMINAL_DATA_DIR + isolated HOME. KB_TERMINAL_URL is injected
11
- // explicitly, so the product shell treats it as an external service and
12
- // NEVER spawns/reuses the live 5.x desktop modules (port 5760 etc.).
13
- // - fixture workspace kept a valid Git repo; the fixture project is then
14
- // created through the REAL onboarding API chain (settings knowledge-root
15
- // patch -> preflight-import -> import), which registers it with the
16
- // terminal module and persists state.modules wiring via module-bridge.
17
- //
18
- // Shared helpers (spawn-server, free-port) are referenced read-only.
19
-
20
- 'use strict';
21
-
22
- const fs = require('fs');
23
- const os = require('os');
24
- const path = require('path');
25
- const http = require('http');
26
- const crypto = require('crypto');
27
- const { spawn, spawnSync } = require('child_process');
28
-
29
- const { spawnServer } = require('./spawn-server');
30
- const freePort = require('./free-port');
31
-
32
- const PKB_ROOT = path.resolve(__dirname, '..', '..', '..');
33
- const TERMINAL_ENTRY = path.join(
34
- PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'packages', 'server', 'bin', 'agent-terminal-server.js'
35
- );
36
-
37
- function sha256File(file) {
38
- try { return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex'); } catch { return null; }
39
- }
40
-
41
- function httpJson(url, { method = 'GET', body, timeoutMs = 8000 } = {}) {
42
- return new Promise((resolve, reject) => {
43
- const payload = body === undefined ? null : JSON.stringify(body);
44
- const request = http.request(url, { method, headers: payload ? { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } : {} }, response => {
45
- let text = '';
46
- response.setEncoding('utf8');
47
- response.on('data', chunk => { text += chunk; });
48
- response.on('end', () => {
49
- let data = null;
50
- try { data = text ? JSON.parse(text) : null; } catch { data = null; }
51
- resolve({ status: response.statusCode, data });
52
- });
53
- });
54
- request.setTimeout(timeoutMs, () => { request.destroy(new Error('timeout')); });
55
- request.on('error', reject);
56
- if (payload) request.write(payload);
57
- request.end();
58
- });
59
- }
60
-
61
- async function waitForHttpOk(url, label, timeoutMs = 60000, accept = () => true) {
62
- const deadline = Date.now() + timeoutMs;
63
- let lastError = 'not attempted';
64
- while (Date.now() < deadline) {
65
- try {
66
- const response = await httpJson(url, { timeoutMs: 3000 });
67
- if (response.status === 200 && accept(response.data)) return response.data;
68
- lastError = `status ${response.status}`;
69
- } catch (error) { lastError = error.message; }
70
- await new Promise(resolve => setTimeout(resolve, 400));
71
- }
72
- throw new Error(`Timed out waiting for ${label} (${lastError}): ${url}`);
73
- }
74
-
75
- function writeJson(file, value) {
76
- fs.mkdirSync(path.dirname(file), { recursive: true });
77
- fs.writeFileSync(file, JSON.stringify(value, null, 2), 'utf8');
78
- }
79
-
80
- async function createDockAcceptanceEnv({ tag = 'dock-acceptance' } = {}) {
81
- if (!fs.existsSync(TERMINAL_ENTRY)) {
82
- throw new Error(`pinned claude-ai-workbench terminal entry missing: ${TERMINAL_ENTRY}`);
83
- }
84
- const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), `pk-${tag}-${process.pid}-`));
85
- const marker = { pid: process.pid, startedAt: new Date().toISOString() };
86
- writeJson(path.join(fixtureRoot, 'owner-marker.json'), marker);
87
-
88
- const workspace = path.join(fixtureRoot, 'workspace');
89
- const knowledgeDir = path.join(fixtureRoot, 'knowledge');
90
- const homeDir = path.join(fixtureRoot, 'home');
91
- const workbenchDir = path.join(fixtureRoot, 'agent-terminal-data');
92
- const dataDir = path.join(fixtureRoot, 'kb-data');
93
- for (const dir of [workspace, knowledgeDir, homeDir, workbenchDir, dataDir]) fs.mkdirSync(dir, { recursive: true });
94
-
95
- // The workspace stays a valid rebuilt Git repo (module/project resolution
96
- // relies on real repository shape, a lesson carried from the retrieval lane).
97
- const git = (args) => spawnSync('git', ['-C', workspace, ...args], { encoding: 'utf8', windowsHide: true });
98
- let gitOk = git(['init', '-q']).status === 0;
99
- gitOk = git(['config', 'user.email', 'dock-acceptance@example.invalid']).status === 0 && gitOk;
100
- gitOk = git(['config', 'user.name', 'dock-acceptance']).status === 0 && gitOk;
101
- fs.writeFileSync(path.join(workspace, 'README.md'), '# dock acceptance fixture workspace\n', 'utf8');
102
- gitOk = git(['add', 'README.md']).status === 0 && gitOk;
103
- gitOk = git(['commit', '-q', '-m', 'fixture baseline']).status === 0 && gitOk;
104
- if (!gitOk) throw new Error('fixture workspace could not be initialized as a Git repository');
105
-
106
- // The data dir starts EMPTY: initializeProductData refuses a dir holding
107
- // legacy-shaped entries (projects.json / projects/) without its own
108
- // product-data.json marker, so the fixture project is created AFTER boot
109
- // through the real onboarding API chain (settings -> preflight -> import).
110
-
111
- const productPort = await freePort();
112
- const terminalPort = await freePort();
113
- const terminalUrl = `http://127.0.0.1:${terminalPort}`;
114
- const productUrl = `http://127.0.0.1:${productPort}`;
115
-
116
- // Product shell. KB_TERMINAL_URL is an explicit external URL: the shell
117
- // proxies to our isolated terminal module and never spawns or probes the
118
- // live desktop modules. KB_MODULES_REGISTER=1 re-enables the real
119
- // per-project module registration the import route performs (terminal
120
- // project creation + state.modules wiring) — autostart stays off.
121
- const product = spawnServer({
122
- root: PKB_ROOT, port: productPort, dataDir, tag,
123
- analysisOwner: 'engine',
124
- extraEnv: {
125
- KB_TERMINAL_URL: terminalUrl,
126
- KB_MODULES_AUTOSTART: '0',
127
- KB_MODULES_REGISTER: '1',
128
- HOME: homeDir, USERPROFILE: homeDir,
129
- },
130
- });
131
-
132
- const env = {
133
- fixtureRoot, workspace, knowledgeDir, homeDir, workbenchDir, dataDir,
134
- productUrl, terminalUrl, productPort, terminalPort,
135
- projectId: null,
136
- terminalProjectId: null,
137
- processes: { product: product.child, terminal: null },
138
- };
139
-
140
- const productLog = [];
141
- const productTail = (chunk) => productLog.push(String(chunk));
142
- product.child.stdout.on('data', productTail);
143
- product.child.stderr.on('data', productTail);
144
- const productLogText = () => productLog.join('');
145
-
146
- try {
147
- const deadline = Date.now() + 60000;
148
- while (Date.now() < deadline) {
149
- if (product.child.exitCode !== null) {
150
- throw new Error(`product server exited early with code ${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
151
- }
152
- try {
153
- const response = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 });
154
- if (response.status === 200 && response.data && typeof response.data === 'object') break;
155
- await new Promise(resolve => setTimeout(resolve, 400));
156
- } catch { await new Promise(resolve => setTimeout(resolve, 400)); }
157
- }
158
- const late = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 }).catch(() => null);
159
- if (!late || late.status !== 200) {
160
- throw new Error(`product health never came up; exitCode=${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
161
- }
162
- } catch (error) {
163
- await cleanup();
164
- throw error;
165
- }
166
-
167
- // Terminal module on its own port with its own data dir and HOME.
168
- const terminalLog = [];
169
- const terminal = spawn(process.execPath, [TERMINAL_ENTRY], {
170
- cwd: PKB_ROOT,
171
- env: {
172
- ...process.env,
173
- AGENT_TERMINAL_PORT: String(terminalPort),
174
- AGENT_TERMINAL_HOST: '127.0.0.1',
175
- AGENT_TERMINAL_DATA_DIR: workbenchDir,
176
- KB_KNOWLEDGE_DATA_DIR: dataDir,
177
- KB_KNOWLEDGE_ENGINE_URL: 'http://127.0.0.1:0',
178
- KB_WORKBENCH_DISABLE_PICKER: '1',
179
- HOME: homeDir, USERPROFILE: homeDir,
180
- },
181
- stdio: ['ignore', 'pipe', 'pipe'],
182
- windowsHide: true,
183
- });
184
- env.processes.terminal = terminal;
185
- const tail = (chunk) => terminalLog.push(String(chunk));
186
- terminal.stdout.on('data', tail);
187
- terminal.stderr.on('data', tail);
188
-
189
- try {
190
- await waitForHttpOk(`${terminalUrl}/api/claude-workbench/v1/health`, 'terminal module health', 60000,
191
- data => data && data.status === 'ok' && typeof data.apiVersion === 'string');
192
- } catch (error) {
193
- await cleanup();
194
- throw new Error(`${error.message}; terminal log tail: ${terminalLog.join('').slice(-2000)}`);
195
- }
196
-
197
- // Real onboarding chain, exactly what the product UI's import wizard calls:
198
- // 1. PATCH /api/settings — configure the knowledge root
199
- // 2. POST /api/projects/preflight-import — validation-only gate
200
- // 3. POST /api/projects/import — creates the project, installs the
201
- // real git hook, and registers it with the terminal module through
202
- // module-bridge (which also persists state.modules.terminal wiring —
203
- // the mapping ui/product.js uses for kb:knowledge).
204
- const patched = await httpJson(`${productUrl}/api/settings`, {
205
- method: 'PATCH', body: { knowledge: { rootPath: knowledgeDir } },
206
- });
207
- if (patched.status !== 200 || !(patched.data && patched.data.ok)) {
208
- await cleanup();
209
- throw new Error(`settings knowledge-root patch failed: ${patched.status} ${JSON.stringify(patched.data).slice(0, 800)}`);
210
- }
211
- const preflight = await httpJson(`${productUrl}/api/projects/preflight-import`, {
212
- method: 'POST', body: { localPath: workspace },
213
- });
214
- if (preflight.status !== 200 || !(preflight.data && preflight.data.ok) || (Array.isArray(preflight.data.problems) && preflight.data.problems.length)) {
215
- await cleanup();
216
- throw new Error(`import preflight failed: ${preflight.status} ${JSON.stringify(preflight.data).slice(0, 800)}`);
217
- }
218
- const imported = await httpJson(`${productUrl}/api/projects/import`, {
219
- method: 'POST', body: { localPath: workspace, displayName: 'Dock Acceptance Fixture' },
220
- });
221
- const terminalModule = imported.data && imported.data.modules && imported.data.modules.terminal;
222
- if (imported.status !== 201 || !(imported.data && imported.data.projectId)
223
- || !(terminalModule && terminalModule.ok === true && terminalModule.status === 'registered' && terminalModule.projectId)) {
224
- await cleanup();
225
- throw new Error(`fixture project import/terminal registration failed: ${imported.status} ${JSON.stringify(imported.data).slice(0, 1200)}; product log tail: ${productLogText().slice(-1500)}`);
226
- }
227
- env.projectId = imported.data.projectId;
228
- env.terminalProjectId = terminalModule.projectId;
229
-
230
- const termApi = (pathname, init) => httpJson(`${productUrl}/api/terminal/${pathname.replace(/^\//, '')}`, init);
231
-
232
- // Session knowledge fixture in the module's real persisted format. The
233
- // module reads this file fresh on every GET /sessions/:id/knowledge, so
234
- // later writes are picked up live without touching the module process.
235
- const knowledgeFile = path.join(workbenchDir, 'knowledge-contexts.v1.json');
236
- const seedSessionKnowledge = (sessionId, references, status = 'ready') => {
237
- const current = fs.existsSync(knowledgeFile)
238
- ? JSON.parse(fs.readFileSync(knowledgeFile, 'utf8'))
239
- : { schema: 'session-knowledge-context/v1', sessions: {} };
240
- current.sessions[sessionId] = { status, references, retrievedAt: new Date().toISOString() };
241
- writeJson(knowledgeFile, current);
242
- return current;
243
- };
244
-
245
- async function cleanup() {
246
- const terminalChild = env.processes.terminal;
247
- if (terminalChild && terminalChild.exitCode === null && terminalChild.pid) {
248
- if (process.platform === 'win32') {
249
- try { spawnSync('taskkill', ['/PID', String(terminalChild.pid), '/T', '/F'], { stdio: 'ignore', timeout: 10000, windowsHide: true }); } catch {}
250
- } else {
251
- try { terminalChild.kill('SIGTERM'); } catch {}
252
- await new Promise(resolve => {
253
- const timer = setTimeout(resolve, 5000);
254
- terminalChild.once('exit', () => { clearTimeout(timer); resolve(); });
255
- });
256
- }
257
- }
258
- try { await product.cleanup(); } catch {}
259
- try {
260
- const current = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'owner-marker.json'), 'utf8'));
261
- if (current.pid === marker.pid) fs.rmSync(fixtureRoot, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
262
- } catch { /* fixture root already gone or not owned */ }
263
- }
264
-
265
- const identity = () => ({
266
- pkbRoot: PKB_ROOT,
267
- productId: 'project-knowledge _site server (spawn-server bootstrap)',
268
- productPid: product.child.pid,
269
- productPort, terminalPort,
270
- terminalEntry: TERMINAL_ENTRY,
271
- terminalPid: terminal.pid,
272
- terminalPackageVersion: (() => {
273
- try { return require(path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'package.json')).version; } catch { return null; }
274
- })(),
275
- servedFiles: {
276
- 'agent-terminal/app.js': { path: path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'apps', 'agent-terminal', 'app.js') },
277
- 'agent-terminal/right-workspace-dock.js': { path: path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'apps', 'agent-terminal', 'right-workspace-dock.js') },
278
- 'ui/product.js': { path: path.join(PKB_ROOT, 'ui', 'product.js') },
279
- },
280
- });
281
-
282
- const fileHashes = () => {
283
- const out = {};
284
- const id = identity();
285
- for (const [name, entry] of Object.entries(id.servedFiles)) out[name] = sha256File(entry.path);
286
- return out;
287
- };
288
-
289
- return {
290
- ...env,
291
- termApi,
292
- seedSessionKnowledge,
293
- identity,
294
- fileHashes,
295
- cleanup,
296
- terminalLogText: () => terminalLog.join(''),
297
- productLogText,
298
- };
299
- }
300
-
301
- module.exports = { createDockAcceptanceEnv };
@@ -1,378 +0,0 @@
1
- // _site/_test/helpers/parallel-dock-acceptance-r2-env.js
2
- //
3
- // Lane-exclusive helper for batch P-DOCK-ACCEPTANCE-02 (DOCK-001/002/004).
4
- // Derived from the R1 helper (parallel-dock-acceptance-env.js, read-only
5
- // reference). Same isolation contract, plus two R2 additions:
6
- //
7
- // - an optional read-only copy of a REAL model profile (default:
8
- // 'minimax') into the isolated module data dir, so a real model turn can
9
- // run without touching the installed desktop workbench. The credential is
10
- // only written into the isolated temp data dir; it is never logged, never
11
- // put into a URL, never sent to the browser and never written to a report.
12
- // - direct access to the isolated module's own API (the product proxy is
13
- // still available through termApi) plus the module's static app root, so
14
- // the module's OWN shipped panel host proof page can be driven as a real
15
- // host for the two-simultaneous-panel case.
16
- //
17
- // Everything else (product shell, fixture project through the real
18
- // onboarding API chain, isolated HOME/ports/data dirs, owner-marker cleanup)
19
- // is unchanged from R1.
20
-
21
- 'use strict';
22
-
23
- const fs = require('fs');
24
- const os = require('os');
25
- const path = require('path');
26
- const http = require('http');
27
- const crypto = require('crypto');
28
- const { spawn, spawnSync } = require('child_process');
29
-
30
- const { spawnServer } = require('./spawn-server');
31
- const freePort = require('./free-port');
32
-
33
- const PKB_ROOT = path.resolve(__dirname, '..', '..', '..');
34
- const TERMINAL_ENTRY = path.join(
35
- PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'packages', 'server', 'bin', 'agent-terminal-server.js'
36
- );
37
- const MODULE_APP_ROOT = path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'apps', 'agent-terminal');
38
- const MODULE_API_PREFIX = '/api/claude-workbench/v1';
39
-
40
- // Real, already-installed workbench stores. They are opened READ-ONLY and
41
- // only to copy one profile definition + its credential into the isolated
42
- // fixture data dir. The live desktop core 5.0.24 installation is never
43
- // written to, restarted or replaced.
44
- const REAL_PROFILE_STORES = [
45
- path.join(os.homedir(), '.project-knowledge', 'workbench'),
46
- path.join(os.homedir(), '.agent-terminal'),
47
- ];
48
-
49
- function sha256File(file) {
50
- try { return crypto.createHash('sha256').update(fs.readFileSync(file)).digest('hex'); } catch { return null; }
51
- }
52
-
53
- function httpJson(url, { method = 'GET', body, timeoutMs = 8000 } = {}) {
54
- return new Promise((resolve, reject) => {
55
- const payload = body === undefined ? null : JSON.stringify(body);
56
- const request = http.request(url, { method, headers: payload ? { 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(payload) } : {} }, response => {
57
- let text = '';
58
- response.setEncoding('utf8');
59
- response.on('data', chunk => { text += chunk; });
60
- response.on('end', () => {
61
- let data = null;
62
- try { data = text ? JSON.parse(text) : null; } catch { data = null; }
63
- resolve({ status: response.statusCode, data, text });
64
- });
65
- });
66
- request.setTimeout(timeoutMs, () => { request.destroy(new Error('timeout')); });
67
- request.on('error', reject);
68
- if (payload) request.write(payload);
69
- request.end();
70
- });
71
- }
72
-
73
- async function waitForHttpOk(url, label, timeoutMs = 60000, accept = () => true) {
74
- const deadline = Date.now() + timeoutMs;
75
- let lastError = 'not attempted';
76
- while (Date.now() < deadline) {
77
- try {
78
- const response = await httpJson(url, { timeoutMs: 3000 });
79
- if (response.status === 200 && accept(response.data)) return response.data;
80
- lastError = `status ${response.status}`;
81
- } catch (error) { lastError = error.message; }
82
- await new Promise(resolve => setTimeout(resolve, 400));
83
- }
84
- throw new Error(`Timed out waiting for ${label} (${lastError}): ${url}`);
85
- }
86
-
87
- function writeJson(file, value) {
88
- fs.mkdirSync(path.dirname(file), { recursive: true });
89
- fs.writeFileSync(file, JSON.stringify(value, null, 2), 'utf8');
90
- }
91
-
92
- // Copy exactly one real profile (definition + credential) into the isolated
93
- // module data dir. The secret never leaves the fixture directory: it is not
94
- // logged, not returned to the caller and not written into any artifact.
95
- function seedModelProfile(workbenchDir, profileId) {
96
- for (const store of REAL_PROFILE_STORES) {
97
- const profilesFile = path.join(store, 'profiles.v2.json');
98
- const credentialsFile = path.join(store, 'credentials.v1.json');
99
- if (!fs.existsSync(profilesFile) || !fs.existsSync(credentialsFile)) continue;
100
- let profiles;
101
- let credentials;
102
- try {
103
- profiles = JSON.parse(fs.readFileSync(profilesFile, 'utf8'));
104
- credentials = JSON.parse(fs.readFileSync(credentialsFile, 'utf8'));
105
- } catch { continue; }
106
- const profile = (profiles.profiles || []).find(item => item && item.id === profileId);
107
- if (!profile) continue;
108
- const credentialRef = profile.credentialRef || `credential:${profile.id}`;
109
- const secret = (credentials.credentials || {})[credentialRef];
110
- if (!secret) continue;
111
- writeJson(path.join(workbenchDir, 'profiles.v2.json'), {
112
- schema: 'claude-workbench-profiles/v2',
113
- profiles: [profile],
114
- maintenanceDefaultProfileId: null,
115
- });
116
- writeJson(path.join(workbenchDir, 'credentials.v1.json'), {
117
- schema: 'claude-workbench-credentials/v1',
118
- credentials: { [credentialRef]: secret },
119
- });
120
- return {
121
- profileId: profile.id,
122
- name: profile.name || null,
123
- provider: profile.provider || null,
124
- baseUrl: profile.baseUrl || null,
125
- model: (profile.models && profile.models.default) || null,
126
- credentialRef,
127
- credentialConfigured: true,
128
- sourceStore: path.basename(store),
129
- };
130
- }
131
- throw new Error(`real profile "${profileId}" not found in any installed workbench store`);
132
- }
133
-
134
- async function createDockAcceptanceEnv({ tag = 'dock-acceptance-r2', modelProfileId = null } = {}) {
135
- if (!fs.existsSync(TERMINAL_ENTRY)) {
136
- throw new Error(`pinned claude-ai-workbench terminal entry missing: ${TERMINAL_ENTRY}`);
137
- }
138
- const fixtureRoot = fs.mkdtempSync(path.join(os.tmpdir(), `pk-${tag}-${process.pid}-`));
139
- const marker = { pid: process.pid, startedAt: new Date().toISOString() };
140
- writeJson(path.join(fixtureRoot, 'owner-marker.json'), marker);
141
-
142
- const workspace = path.join(fixtureRoot, 'workspace');
143
- const knowledgeDir = path.join(fixtureRoot, 'knowledge');
144
- const homeDir = path.join(fixtureRoot, 'home');
145
- const workbenchDir = path.join(fixtureRoot, 'agent-terminal-data');
146
- const dataDir = path.join(fixtureRoot, 'kb-data');
147
- // Windows roaming/local app data are per-user state directories. The
148
- // dispatch requires them isolated per run, otherwise a spawned process could
149
- // read or write the developer's real per-user application state.
150
- const appDataDir = path.join(fixtureRoot, 'appdata-roaming');
151
- const localAppDataDir = path.join(fixtureRoot, 'appdata-local');
152
- const tempDir = path.join(fixtureRoot, 'temp');
153
- for (const dir of [workspace, knowledgeDir, homeDir, workbenchDir, dataDir, appDataDir, localAppDataDir, tempDir]) fs.mkdirSync(dir, { recursive: true });
154
-
155
- // The model profile (if any) is written BEFORE the module boots so the
156
- // module reads it from its own store on first use.
157
- let modelProfile = null;
158
- if (modelProfileId) modelProfile = seedModelProfile(workbenchDir, modelProfileId);
159
-
160
- const git = (args) => spawnSync('git', ['-C', workspace, ...args], { encoding: 'utf8', windowsHide: true });
161
- let gitOk = git(['init', '-q']).status === 0;
162
- gitOk = git(['config', 'user.email', 'dock-acceptance@example.invalid']).status === 0 && gitOk;
163
- gitOk = git(['config', 'user.name', 'dock-acceptance']).status === 0 && gitOk;
164
- fs.writeFileSync(path.join(workspace, 'README.md'), '# dock acceptance fixture workspace\n', 'utf8');
165
- gitOk = git(['add', 'README.md']).status === 0 && gitOk;
166
- gitOk = git(['commit', '-q', '-m', 'fixture baseline']).status === 0 && gitOk;
167
- if (!gitOk) throw new Error('fixture workspace could not be initialized as a Git repository');
168
-
169
- const productPort = await freePort();
170
- const terminalPort = await freePort();
171
- const terminalUrl = `http://127.0.0.1:${terminalPort}`;
172
- const productUrl = `http://127.0.0.1:${productPort}`;
173
-
174
- const product = spawnServer({
175
- root: PKB_ROOT, port: productPort, dataDir, tag,
176
- analysisOwner: 'engine',
177
- extraEnv: {
178
- KB_TERMINAL_URL: terminalUrl,
179
- KB_MODULES_AUTOSTART: '0',
180
- KB_MODULES_REGISTER: '1',
181
- HOME: homeDir, USERPROFILE: homeDir,
182
- APPDATA: appDataDir, LOCALAPPDATA: localAppDataDir, TEMP: tempDir, TMP: tempDir,
183
- },
184
- });
185
-
186
- const env = {
187
- fixtureRoot, workspace, knowledgeDir, homeDir, workbenchDir, dataDir,
188
- appDataDir, localAppDataDir, tempDir,
189
- productUrl, terminalUrl, productPort, terminalPort,
190
- modelProfile,
191
- projectId: null,
192
- terminalProjectId: null,
193
- processes: { product: product.child, terminal: null },
194
- };
195
-
196
- const productLog = [];
197
- const productTail = (chunk) => productLog.push(String(chunk));
198
- product.child.stdout.on('data', productTail);
199
- product.child.stderr.on('data', productTail);
200
- const productLogText = () => productLog.join('');
201
-
202
- async function cleanup() {
203
- const terminalChild = env.processes.terminal;
204
- if (terminalChild && terminalChild.exitCode === null && terminalChild.pid) {
205
- if (process.platform === 'win32') {
206
- try { spawnSync('taskkill', ['/PID', String(terminalChild.pid), '/T', '/F'], { stdio: 'ignore', timeout: 10000, windowsHide: true }); } catch {}
207
- } else {
208
- try { terminalChild.kill('SIGTERM'); } catch {}
209
- await new Promise(resolve => {
210
- const timer = setTimeout(resolve, 5000);
211
- terminalChild.once('exit', () => { clearTimeout(timer); resolve(); });
212
- });
213
- }
214
- }
215
- try { await product.cleanup(); } catch {}
216
- try {
217
- const current = JSON.parse(fs.readFileSync(path.join(fixtureRoot, 'owner-marker.json'), 'utf8'));
218
- if (current.pid === marker.pid) fs.rmSync(fixtureRoot, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 });
219
- } catch { /* fixture root already gone or not owned */ }
220
- }
221
-
222
- try {
223
- const deadline = Date.now() + 60000;
224
- while (Date.now() < deadline) {
225
- if (product.child.exitCode !== null) {
226
- throw new Error(`product server exited early with code ${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
227
- }
228
- try {
229
- const response = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 });
230
- if (response.status === 200 && response.data && typeof response.data === 'object') break;
231
- await new Promise(resolve => setTimeout(resolve, 400));
232
- } catch { await new Promise(resolve => setTimeout(resolve, 400)); }
233
- }
234
- const late = await httpJson(`${productUrl}/api/health`, { timeoutMs: 3000 }).catch(() => null);
235
- if (!late || late.status !== 200) {
236
- throw new Error(`product health never came up; exitCode=${product.child.exitCode}; log tail: ${productLogText().slice(-4000)}`);
237
- }
238
- } catch (error) {
239
- await cleanup();
240
- throw error;
241
- }
242
-
243
- // Terminal module on its own port with its own data dir and HOME.
244
- const terminalLog = [];
245
- const terminal = spawn(process.execPath, [TERMINAL_ENTRY], {
246
- cwd: PKB_ROOT,
247
- env: {
248
- ...process.env,
249
- AGENT_TERMINAL_PORT: String(terminalPort),
250
- AGENT_TERMINAL_HOST: '127.0.0.1',
251
- AGENT_TERMINAL_DATA_DIR: workbenchDir,
252
- KB_KNOWLEDGE_DATA_DIR: dataDir,
253
- KB_KNOWLEDGE_ENGINE_URL: 'http://127.0.0.1:0',
254
- KB_WORKBENCH_DISABLE_PICKER: '1',
255
- HOME: homeDir, USERPROFILE: homeDir,
256
- APPDATA: appDataDir, LOCALAPPDATA: localAppDataDir, TEMP: tempDir, TMP: tempDir,
257
- // The CLI that the Agent SDK spawns must not read or write the real
258
- // developer's agent config directories.
259
- CLAUDE_CONFIG_DIR: path.join(homeDir, '.claude'),
260
- CODEX_HOME: path.join(homeDir, '.codex'),
261
- },
262
- stdio: ['ignore', 'pipe', 'pipe'],
263
- windowsHide: true,
264
- });
265
- env.processes.terminal = terminal;
266
- const tail = (chunk) => terminalLog.push(String(chunk));
267
- terminal.stdout.on('data', tail);
268
- terminal.stderr.on('data', tail);
269
-
270
- try {
271
- await waitForHttpOk(`${terminalUrl}${MODULE_API_PREFIX}/health`, 'terminal module health', 60000,
272
- data => data && data.status === 'ok' && typeof data.apiVersion === 'string');
273
- } catch (error) {
274
- await cleanup();
275
- throw new Error(`${error.message}; terminal log tail: ${terminalLog.join('').slice(-2000)}`);
276
- }
277
-
278
- // Real onboarding chain (settings -> preflight -> import). The import route
279
- // registers the fixture project with the terminal module and persists the
280
- // state.modules.terminal wiring the product UI depends on.
281
- const patched = await httpJson(`${productUrl}/api/settings`, {
282
- method: 'PATCH', body: { knowledge: { rootPath: knowledgeDir } },
283
- });
284
- if (patched.status !== 200 || !(patched.data && patched.data.ok)) {
285
- await cleanup();
286
- throw new Error(`settings knowledge-root patch failed: ${patched.status} ${JSON.stringify(patched.data).slice(0, 800)}`);
287
- }
288
- const preflight = await httpJson(`${productUrl}/api/projects/preflight-import`, {
289
- method: 'POST', body: { localPath: workspace },
290
- });
291
- if (preflight.status !== 200 || !(preflight.data && preflight.data.ok) || (Array.isArray(preflight.data.problems) && preflight.data.problems.length)) {
292
- await cleanup();
293
- throw new Error(`import preflight failed: ${preflight.status} ${JSON.stringify(preflight.data).slice(0, 800)}`);
294
- }
295
- const imported = await httpJson(`${productUrl}/api/projects/import`, {
296
- method: 'POST', body: { localPath: workspace, displayName: 'Dock Acceptance Fixture' },
297
- });
298
- const terminalModule = imported.data && imported.data.modules && imported.data.modules.terminal;
299
- if (imported.status !== 201 || !(imported.data && imported.data.projectId)
300
- || !(terminalModule && terminalModule.ok === true && terminalModule.status === 'registered' && terminalModule.projectId)) {
301
- await cleanup();
302
- throw new Error(`fixture project import/terminal registration failed: ${imported.status} ${JSON.stringify(imported.data).slice(0, 1200)}; product log tail: ${productLogText().slice(-1500)}`);
303
- }
304
- env.projectId = imported.data.projectId;
305
- env.terminalProjectId = terminalModule.projectId;
306
-
307
- // Through the PRODUCT proxy (the path the product UI actually uses).
308
- const termApi = (pathname, init) => httpJson(`${productUrl}/api/terminal/${pathname.replace(/^\//, '')}`, init);
309
- // Direct to the isolated module (same server, bypassing the product proxy).
310
- const moduleApi = (pathname, init) => httpJson(`${terminalUrl}${MODULE_API_PREFIX}/${pathname.replace(/^\//, '')}`, init);
311
-
312
- const knowledgeFile = path.join(workbenchDir, 'knowledge-contexts.v1.json');
313
- const seedSessionKnowledge = (sessionId, references, status = 'ready') => {
314
- const current = fs.existsSync(knowledgeFile)
315
- ? JSON.parse(fs.readFileSync(knowledgeFile, 'utf8'))
316
- : { schema: 'session-knowledge-context/v1', sessions: {} };
317
- current.sessions[sessionId] = { status, references, retrievedAt: new Date().toISOString() };
318
- writeJson(knowledgeFile, current);
319
- return current;
320
- };
321
-
322
- // The isolated module's own native-task store identity (used by the
323
- // public native-tasks read API). The module publishes it as
324
- // { schema: 'workbench-store/v1', storeId }.
325
- const storeScope = () => {
326
- try {
327
- const raw = JSON.parse(fs.readFileSync(path.join(workbenchDir, 'store-id.v1.json'), 'utf8'));
328
- return raw.storeId || raw.storeScope || raw.scope || raw.id || null;
329
- } catch { return null; }
330
- };
331
-
332
- const identity = () => ({
333
- pkbRoot: PKB_ROOT,
334
- productId: 'project-knowledge _site server (spawn-server bootstrap)',
335
- productPid: product.child.pid,
336
- productPort, terminalPort,
337
- terminalEntry: TERMINAL_ENTRY,
338
- terminalPid: terminal.pid,
339
- terminalPackageVersion: (() => {
340
- try { return require(path.join(PKB_ROOT, 'node_modules', 'claude-ai-workbench', 'package.json')).version; } catch { return null; }
341
- })(),
342
- modelProfile: env.modelProfile,
343
- servedFiles: {
344
- 'agent-terminal/app.js': { path: path.join(MODULE_APP_ROOT, 'app.js') },
345
- 'agent-terminal/right-workspace-dock.js': { path: path.join(MODULE_APP_ROOT, 'right-workspace-dock.js') },
346
- 'agent-terminal/right-dock-panel-registry.js': { path: path.join(MODULE_APP_ROOT, 'right-dock-panel-registry.js') },
347
- 'agent-terminal/panel-host-proof.html': { path: path.join(MODULE_APP_ROOT, 'panel-host-proof.html') },
348
- 'agent-terminal/panel-proof-content.html': { path: path.join(MODULE_APP_ROOT, 'panel-proof-content.html') },
349
- 'ui/product.js': { path: path.join(PKB_ROOT, 'ui', 'product.js') },
350
- },
351
- });
352
-
353
- const fileHashes = () => {
354
- const out = {};
355
- const id = identity();
356
- for (const [name, entry] of Object.entries(id.servedFiles)) out[name] = sha256File(entry.path);
357
- return out;
358
- };
359
-
360
- return {
361
- ...env,
362
- termApi,
363
- moduleApi,
364
- seedSessionKnowledge,
365
- storeScope,
366
- identity,
367
- fileHashes,
368
- cleanup,
369
- // The module's own shipped panel host proof page (a real host that
370
- // registers a multi-instance panel provider through the public panel
371
- // protocol and drives it with real buttons).
372
- panelProofHostUrl: () => `${terminalUrl}/agent-terminal/panel-host-proof.html`,
373
- terminalLogText: () => terminalLog.join(''),
374
- productLogText,
375
- };
376
- }
377
-
378
- module.exports = { createDockAcceptanceEnv, MODULE_API_PREFIX, MODULE_APP_ROOT };