agentic-qe 3.14.3 → 3.14.5

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 (786) hide show
  1. package/.claude/agents/v3/qe-coverage-specialist.md +1 -1
  2. package/.claude/agents/v3/qe-fleet-commander.md +1 -1
  3. package/.claude/agents/v3/qe-pentest-validator.md +1 -1
  4. package/.claude/agents/v3/qe-queen-coordinator.md +1 -1
  5. package/.claude/agents/v3/qe-risk-assessor.md +1 -1
  6. package/.claude/agents/v3/qe-root-cause-analyzer.md +1 -1
  7. package/.claude/agents/v3/qe-security-auditor.md +1 -1
  8. package/.claude/agents/v3/qe-test-architect.md +1 -1
  9. package/.claude/commands/aqe-costs.md +10 -10
  10. package/.claude/helpers/advisor-call.cjs +3 -3
  11. package/.claude/helpers/v3/advisor-call.cjs +3 -3
  12. package/.claude/skills/.validation/examples/chaos-engineering-output.example.json +1 -1
  13. package/.claude/skills/.validation/examples/performance-testing-output.example.json +1 -1
  14. package/.claude/skills/.validation/examples/security-testing-output.example.json +1 -1
  15. package/.claude/skills/.validation/examples/testability-scoring-output.example.json +1 -1
  16. package/.claude/skills/.validation/schemas/skill-eval.schema.json +4 -1
  17. package/.claude/skills/.validation/schemas/skill-frontmatter.schema.json +1 -1
  18. package/.claude/skills/.validation/schemas/skill-output.template.json +1 -1
  19. package/.claude/skills/.validation/templates/eval.template.yaml +1 -1
  20. package/.claude/skills/.validation/templates/security-testing-eval.template.yaml +1 -1
  21. package/.claude/skills/.validation/templates/skill-frontmatter.example.yaml +1 -1
  22. package/.claude/skills/.validation/test-data/sample-output.json +1 -1
  23. package/.claude/skills/a11y-ally/SKILL.md +1 -1
  24. package/.claude/skills/a11y-ally/evals/a11y-ally.yaml +1 -1
  25. package/.claude/skills/accessibility-testing/evals/accessibility-testing.yaml +1 -1
  26. package/.claude/skills/api-testing-patterns/evals/api-testing-patterns.yaml +1 -1
  27. package/.claude/skills/chaos-engineering-resilience/evals/chaos-engineering-resilience.yaml +1 -1
  28. package/.claude/skills/cicd-pipeline-qe-orchestrator/evals/cicd-pipeline-qe-orchestrator.yaml +1 -1
  29. package/.claude/skills/compatibility-testing/evals/compatibility-testing.yaml +1 -1
  30. package/.claude/skills/compliance-testing/evals/compliance-testing.yaml +1 -1
  31. package/.claude/skills/contract-testing/evals/contract-testing.yaml +1 -1
  32. package/.claude/skills/database-testing/evals/database-testing.yaml +1 -1
  33. package/.claude/skills/enterprise-integration-testing/evals/enterprise-integration-testing.yaml +1 -1
  34. package/.claude/skills/localization-testing/evals/localization-testing.yaml +1 -1
  35. package/.claude/skills/middleware-testing-patterns/evals/middleware-testing-patterns.yaml +1 -1
  36. package/.claude/skills/mobile-testing/evals/mobile-testing.yaml +1 -1
  37. package/.claude/skills/mutation-testing/evals/mutation-testing.yaml +1 -1
  38. package/.claude/skills/mutation-testing/test-data/sample-output.json +1 -1
  39. package/.claude/skills/n8n-expression-testing/evals/n8n-expression-testing.yaml +1 -1
  40. package/.claude/skills/n8n-integration-testing-patterns/evals/n8n-integration-testing-patterns.yaml +1 -1
  41. package/.claude/skills/n8n-security-testing/evals/n8n-security-testing.yaml +1 -1
  42. package/.claude/skills/n8n-trigger-testing-strategies/evals/n8n-trigger-testing-strategies.yaml +1 -1
  43. package/.claude/skills/n8n-workflow-testing-fundamentals/evals/n8n-workflow-testing-fundamentals.yaml +1 -1
  44. package/.claude/skills/observability-testing-patterns/evals/observability-testing-patterns.yaml +1 -1
  45. package/.claude/skills/pentest-validation/evals/pentest-validation.yaml +1 -1
  46. package/.claude/skills/performance-testing/evals/performance-testing.yaml +1 -1
  47. package/.claude/skills/qcsd-cicd-swarm/evals/qcsd-cicd-swarm.yaml +1 -1
  48. package/.claude/skills/qcsd-development-swarm/evals/qcsd-development-swarm.yaml +1 -1
  49. package/.claude/skills/qcsd-ideation-swarm/evals/qcsd-ideation-swarm.yaml +1 -1
  50. package/.claude/skills/qcsd-production-swarm/evals/qcsd-production-swarm.yaml +1 -1
  51. package/.claude/skills/qcsd-refinement-swarm/evals/qcsd-refinement-swarm.yaml +1 -1
  52. package/.claude/skills/qe-browser/evals/qe-browser.yaml +1 -1
  53. package/.claude/skills/qe-chaos-resilience/evals/qe-chaos-resilience.yaml +1 -1
  54. package/.claude/skills/qe-code-intelligence/evals/qe-code-intelligence.yaml +1 -1
  55. package/.claude/skills/qe-coverage-analysis/evals/qe-coverage-analysis.yaml +1 -1
  56. package/.claude/skills/qe-defect-intelligence/evals/qe-defect-intelligence.yaml +1 -1
  57. package/.claude/skills/qe-learning-optimization/evals/qe-learning-optimization.yaml +2 -2
  58. package/.claude/skills/qe-quality-assessment/evals/qe-quality-assessment.yaml +1 -1
  59. package/.claude/skills/qe-requirements-validation/evals/qe-requirements-validation.yaml +1 -1
  60. package/.claude/skills/qe-test-execution/evals/qe-test-execution.yaml +1 -1
  61. package/.claude/skills/qe-test-generation/evals/qe-test-generation.yaml +1 -1
  62. package/.claude/skills/qe-visual-accessibility/evals/qe-visual-accessibility.yaml +1 -1
  63. package/.claude/skills/quality-metrics/evals/quality-metrics.yaml +1 -1
  64. package/.claude/skills/regression-testing/evals/regression-testing.yaml +1 -1
  65. package/.claude/skills/risk-based-testing/evals/risk-based-testing.yaml +1 -1
  66. package/.claude/skills/security-testing/evals/security-testing.yaml +1 -1
  67. package/.claude/skills/security-visual-testing/evals/security-visual-testing.yaml +1 -1
  68. package/.claude/skills/shift-left-testing/evals/shift-left-testing.yaml +1 -1
  69. package/.claude/skills/shift-right-testing/evals/shift-right-testing.yaml +1 -1
  70. package/.claude/skills/skills-manifest.json +1 -1
  71. package/.claude/skills/test-automation-strategy/evals/test-automation-strategy.yaml +1 -1
  72. package/.claude/skills/test-data-management/evals/test-data-management.yaml +1 -1
  73. package/.claude/skills/test-design-techniques/evals/test-design-techniques.yaml +1 -1
  74. package/.claude/skills/test-reporting-analytics/evals/test-reporting-analytics.yaml +1 -1
  75. package/.claude/skills/testability-scoring/evals/testability-scoring.yaml +1 -1
  76. package/.claude/skills/validation-pipeline/evals/validation-pipeline.yaml +1 -1
  77. package/.claude/skills/verification-quality/evals/verification-quality.yaml +1 -1
  78. package/.claude/skills/visual-testing-advanced/evals/visual-testing-advanced.yaml +1 -1
  79. package/.claude/skills/wms-testing-patterns/evals/wms-testing-patterns.yaml +1 -1
  80. package/.opencode/agents/collective-intelligence-coordinator.yaml +1 -1
  81. package/.opencode/agents/ddd-domain-expert.yaml +1 -1
  82. package/.opencode/agents/memory-specialist.yaml +1 -1
  83. package/.opencode/agents/performance-engineer.yaml +1 -1
  84. package/.opencode/agents/qe-accessibility-auditor.yaml +1 -1
  85. package/.opencode/agents/qe-api-contract-validator.yaml +1 -1
  86. package/.opencode/agents/qe-bdd-generator.yaml +1 -1
  87. package/.opencode/agents/qe-chaos-engineer.yaml +1 -1
  88. package/.opencode/agents/qe-code-complexity.yaml +1 -1
  89. package/.opencode/agents/qe-code-intelligence.yaml +1 -1
  90. package/.opencode/agents/qe-coverage-analyzer.yaml +1 -1
  91. package/.opencode/agents/qe-defect-predictor.yaml +1 -1
  92. package/.opencode/agents/qe-dependency-mapper.yaml +1 -1
  93. package/.opencode/agents/qe-deployment-advisor.yaml +1 -1
  94. package/.opencode/agents/qe-devils-advocate.yaml +1 -1
  95. package/.opencode/agents/qe-flaky-hunter.yaml +1 -1
  96. package/.opencode/agents/qe-fleet-commander.yaml +1 -1
  97. package/.opencode/agents/qe-gap-detector.yaml +1 -1
  98. package/.opencode/agents/qe-graphql-tester.yaml +1 -1
  99. package/.opencode/agents/qe-impact-analyzer.yaml +1 -1
  100. package/.opencode/agents/qe-integration-architect.yaml +1 -1
  101. package/.opencode/agents/qe-integration-tester.yaml +1 -1
  102. package/.opencode/agents/qe-kg-builder.yaml +1 -1
  103. package/.opencode/agents/qe-learning-coordinator.yaml +1 -1
  104. package/.opencode/agents/qe-load-tester.yaml +1 -1
  105. package/.opencode/agents/qe-message-broker-tester.yaml +1 -1
  106. package/.opencode/agents/qe-metrics-optimizer.yaml +1 -1
  107. package/.opencode/agents/qe-middleware-validator.yaml +1 -1
  108. package/.opencode/agents/qe-mutation-tester.yaml +1 -1
  109. package/.opencode/agents/qe-odata-contract-tester.yaml +1 -1
  110. package/.opencode/agents/qe-parallel-executor.yaml +1 -1
  111. package/.opencode/agents/qe-pattern-learner.yaml +1 -1
  112. package/.opencode/agents/qe-pentest-validator.yaml +1 -1
  113. package/.opencode/agents/qe-performance-tester.yaml +1 -1
  114. package/.opencode/agents/qe-product-factors-assessor.yaml +1 -1
  115. package/.opencode/agents/qe-property-tester.yaml +1 -1
  116. package/.opencode/agents/qe-quality-criteria-recommender.yaml +1 -1
  117. package/.opencode/agents/qe-quality-gate.yaml +1 -1
  118. package/.opencode/agents/qe-queen-coordinator.yaml +1 -1
  119. package/.opencode/agents/qe-qx-partner.yaml +1 -1
  120. package/.opencode/agents/qe-regression-analyzer.yaml +1 -1
  121. package/.opencode/agents/qe-requirements-validator.yaml +1 -1
  122. package/.opencode/agents/qe-responsive-tester.yaml +1 -1
  123. package/.opencode/agents/qe-retry-handler.yaml +1 -1
  124. package/.opencode/agents/qe-risk-assessor.yaml +1 -1
  125. package/.opencode/agents/qe-root-cause-analyzer.yaml +1 -1
  126. package/.opencode/agents/qe-sap-idoc-tester.yaml +1 -1
  127. package/.opencode/agents/qe-sap-rfc-tester.yaml +1 -1
  128. package/.opencode/agents/qe-security-auditor.yaml +1 -1
  129. package/.opencode/agents/qe-security-scanner.yaml +1 -1
  130. package/.opencode/agents/qe-soap-tester.yaml +1 -1
  131. package/.opencode/agents/qe-sod-analyzer.yaml +1 -1
  132. package/.opencode/agents/qe-tdd-specialist.yaml +1 -1
  133. package/.opencode/agents/qe-test-generator.yaml +1 -1
  134. package/.opencode/agents/qe-test-idea-rewriter.yaml +1 -1
  135. package/.opencode/agents/qe-transfer-specialist.yaml +1 -1
  136. package/.opencode/agents/qe-visual-tester.yaml +1 -1
  137. package/.opencode/agents/security-architect.yaml +1 -1
  138. package/.opencode/agents/security-auditor.yaml +1 -1
  139. package/CHANGELOG.md +204 -0
  140. package/README.md +7 -2
  141. package/assets/agents/v3/helpers/advisor-call.cjs +3 -3
  142. package/assets/agents/v3/qe-coverage-specialist.md +1 -1
  143. package/assets/agents/v3/qe-fleet-commander.md +1 -1
  144. package/assets/agents/v3/qe-pentest-validator.md +1 -1
  145. package/assets/agents/v3/qe-queen-coordinator.md +1 -1
  146. package/assets/agents/v3/qe-risk-assessor.md +1 -1
  147. package/assets/agents/v3/qe-root-cause-analyzer.md +1 -1
  148. package/assets/agents/v3/qe-security-auditor.md +1 -1
  149. package/assets/agents/v3/qe-test-architect.md +1 -1
  150. package/assets/skills/.validation/examples/chaos-engineering-output.example.json +1 -1
  151. package/assets/skills/.validation/examples/performance-testing-output.example.json +1 -1
  152. package/assets/skills/.validation/examples/security-testing-output.example.json +1 -1
  153. package/assets/skills/.validation/examples/testability-scoring-output.example.json +1 -1
  154. package/assets/skills/.validation/schemas/skill-eval.schema.json +4 -1
  155. package/assets/skills/.validation/schemas/skill-frontmatter.schema.json +1 -1
  156. package/assets/skills/.validation/schemas/skill-output.template.json +1 -1
  157. package/assets/skills/.validation/templates/eval.template.yaml +1 -1
  158. package/assets/skills/.validation/templates/security-testing-eval.template.yaml +1 -1
  159. package/assets/skills/.validation/templates/skill-frontmatter.example.yaml +1 -1
  160. package/assets/skills/.validation/test-data/sample-output.json +1 -1
  161. package/assets/skills/a11y-ally/SKILL.md +1 -1
  162. package/assets/skills/a11y-ally/evals/a11y-ally.yaml +1 -1
  163. package/assets/skills/accessibility-testing/evals/accessibility-testing.yaml +1 -1
  164. package/assets/skills/api-testing-patterns/evals/api-testing-patterns.yaml +1 -1
  165. package/assets/skills/chaos-engineering-resilience/evals/chaos-engineering-resilience.yaml +1 -1
  166. package/assets/skills/cicd-pipeline-qe-orchestrator/evals/cicd-pipeline-qe-orchestrator.yaml +1 -1
  167. package/assets/skills/compatibility-testing/evals/compatibility-testing.yaml +1 -1
  168. package/assets/skills/compliance-testing/evals/compliance-testing.yaml +1 -1
  169. package/assets/skills/contract-testing/evals/contract-testing.yaml +1 -1
  170. package/assets/skills/database-testing/evals/database-testing.yaml +1 -1
  171. package/assets/skills/enterprise-integration-testing/evals/enterprise-integration-testing.yaml +1 -1
  172. package/assets/skills/localization-testing/evals/localization-testing.yaml +1 -1
  173. package/assets/skills/middleware-testing-patterns/evals/middleware-testing-patterns.yaml +1 -1
  174. package/assets/skills/mobile-testing/evals/mobile-testing.yaml +1 -1
  175. package/assets/skills/mutation-testing/evals/mutation-testing.yaml +1 -1
  176. package/assets/skills/mutation-testing/test-data/sample-output.json +1 -1
  177. package/assets/skills/n8n-expression-testing/evals/n8n-expression-testing.yaml +1 -1
  178. package/assets/skills/n8n-integration-testing-patterns/evals/n8n-integration-testing-patterns.yaml +1 -1
  179. package/assets/skills/n8n-security-testing/evals/n8n-security-testing.yaml +1 -1
  180. package/assets/skills/n8n-trigger-testing-strategies/evals/n8n-trigger-testing-strategies.yaml +1 -1
  181. package/assets/skills/n8n-workflow-testing-fundamentals/evals/n8n-workflow-testing-fundamentals.yaml +1 -1
  182. package/assets/skills/observability-testing-patterns/evals/observability-testing-patterns.yaml +1 -1
  183. package/assets/skills/pentest-validation/evals/pentest-validation.yaml +1 -1
  184. package/assets/skills/performance-testing/evals/performance-testing.yaml +1 -1
  185. package/assets/skills/qcsd-cicd-swarm/evals/qcsd-cicd-swarm.yaml +1 -1
  186. package/assets/skills/qcsd-development-swarm/evals/qcsd-development-swarm.yaml +1 -1
  187. package/assets/skills/qcsd-ideation-swarm/evals/qcsd-ideation-swarm.yaml +1 -1
  188. package/assets/skills/qcsd-production-swarm/evals/qcsd-production-swarm.yaml +1 -1
  189. package/assets/skills/qcsd-refinement-swarm/evals/qcsd-refinement-swarm.yaml +1 -1
  190. package/assets/skills/qe-browser/evals/qe-browser.yaml +1 -1
  191. package/assets/skills/qe-chaos-resilience/evals/qe-chaos-resilience.yaml +1 -1
  192. package/assets/skills/qe-code-intelligence/evals/qe-code-intelligence.yaml +1 -1
  193. package/assets/skills/qe-coverage-analysis/evals/qe-coverage-analysis.yaml +1 -1
  194. package/assets/skills/qe-defect-intelligence/evals/qe-defect-intelligence.yaml +1 -1
  195. package/assets/skills/qe-learning-optimization/evals/qe-learning-optimization.yaml +2 -2
  196. package/assets/skills/qe-quality-assessment/evals/qe-quality-assessment.yaml +1 -1
  197. package/assets/skills/qe-requirements-validation/evals/qe-requirements-validation.yaml +1 -1
  198. package/assets/skills/qe-test-execution/evals/qe-test-execution.yaml +1 -1
  199. package/assets/skills/qe-test-generation/evals/qe-test-generation.yaml +1 -1
  200. package/assets/skills/qe-visual-accessibility/evals/qe-visual-accessibility.yaml +1 -1
  201. package/assets/skills/quality-metrics/evals/quality-metrics.yaml +1 -1
  202. package/assets/skills/regression-testing/evals/regression-testing.yaml +1 -1
  203. package/assets/skills/risk-based-testing/evals/risk-based-testing.yaml +1 -1
  204. package/assets/skills/security-testing/evals/security-testing.yaml +1 -1
  205. package/assets/skills/security-visual-testing/evals/security-visual-testing.yaml +1 -1
  206. package/assets/skills/shift-left-testing/evals/shift-left-testing.yaml +1 -1
  207. package/assets/skills/shift-right-testing/evals/shift-right-testing.yaml +1 -1
  208. package/assets/skills/skills-manifest.json +1 -1
  209. package/assets/skills/test-automation-strategy/evals/test-automation-strategy.yaml +1 -1
  210. package/assets/skills/test-data-management/evals/test-data-management.yaml +1 -1
  211. package/assets/skills/test-design-techniques/evals/test-design-techniques.yaml +1 -1
  212. package/assets/skills/test-reporting-analytics/evals/test-reporting-analytics.yaml +1 -1
  213. package/assets/skills/testability-scoring/evals/testability-scoring.yaml +1 -1
  214. package/assets/skills/validation-pipeline/evals/validation-pipeline.yaml +1 -1
  215. package/assets/skills/verification-quality/evals/verification-quality.yaml +1 -1
  216. package/assets/skills/visual-testing-advanced/evals/visual-testing-advanced.yaml +1 -1
  217. package/assets/skills/wms-testing-patterns/evals/wms-testing-patterns.yaml +1 -1
  218. package/dist/audit/witness-chain.d.ts +1 -1
  219. package/dist/audit/witness-chain.js +29 -22
  220. package/dist/cli/bundle.js +13 -10
  221. package/dist/cli/chunks/adapter-IYC62SXA.js +2 -0
  222. package/dist/cli/chunks/{agent-booster-wasm-TQOMLWWX.js → agent-booster-wasm-EDNKP3SP.js} +2 -2
  223. package/dist/cli/chunks/{agent-handler-Q3SEMMI2.js → agent-handler-V6CZ7Q6S.js} +2 -2
  224. package/dist/cli/chunks/{agent-memory-branch-SJXAQSZI.js → agent-memory-branch-ZMD6ULC3.js} +2 -2
  225. package/dist/cli/chunks/aqe-learning-engine-LLOU2IXD.js +2 -0
  226. package/dist/cli/chunks/{arena-7RC7TBGW.js → arena-4UPAEHFT.js} +4 -4
  227. package/dist/cli/chunks/{arena-UPB7TKUY.js → arena-QLSBESC7.js} +2 -2
  228. package/dist/cli/chunks/{audit-IXN5R4WB.js → audit-CVZQMF55.js} +3 -3
  229. package/dist/cli/chunks/base-P3Z4IKCT.js +2 -0
  230. package/dist/cli/chunks/{better-sqlite3-RP4DEGK3.js → better-sqlite3-4DSBPDRH.js} +2 -2
  231. package/dist/cli/chunks/brain-handler-GBY4EZ4P.js +94 -0
  232. package/dist/cli/chunks/{branch-enumerator-VPRWDGFJ.js → branch-enumerator-XYBVXCNO.js} +2 -2
  233. package/dist/cli/chunks/{browser-B6E7JPPJ.js → browser-32F6MREU.js} +2 -2
  234. package/dist/cli/chunks/browser-workflow-YYHQQ25X.js +2 -0
  235. package/dist/cli/chunks/{chunk-HOQQCY2K.js → chunk-2JGEZHWY.js} +2 -2
  236. package/dist/cli/chunks/{chunk-NN76NTOX.js → chunk-2KJQ2UQE.js} +1 -1
  237. package/dist/cli/chunks/{chunk-D4Z2N74A.js → chunk-2OMLTYQK.js} +1 -1
  238. package/dist/cli/chunks/chunk-37TUN44F.js +4 -0
  239. package/dist/cli/chunks/{chunk-LVLBIKJD.js → chunk-3DDXWYMO.js} +1 -1
  240. package/dist/cli/chunks/{chunk-UHQY3GK7.js → chunk-3EZ5DR2R.js} +3 -3
  241. package/dist/cli/chunks/{chunk-3P6NCFI2.js → chunk-3KDL6QDK.js} +2 -2
  242. package/dist/cli/chunks/{chunk-SG47AXJG.js → chunk-3VIXOHMS.js} +1 -1
  243. package/dist/cli/chunks/{chunk-7FYMDKQH.js → chunk-3YUB5HER.js} +165 -167
  244. package/dist/cli/chunks/chunk-4FWTLJEP.js +16 -0
  245. package/dist/cli/chunks/{chunk-PI74GOE4.js → chunk-52L77RMG.js} +2 -2
  246. package/dist/cli/chunks/{chunk-LS3EUMBP.js → chunk-5D36YHS3.js} +5 -5
  247. package/dist/cli/chunks/{chunk-EY4OQHU3.js → chunk-5WOSWNDN.js} +1 -1
  248. package/dist/cli/chunks/{chunk-F67AV5P2.js → chunk-67YV75XP.js} +2 -2
  249. package/dist/cli/chunks/{chunk-IP7NSFQQ.js → chunk-6A44AOGN.js} +2 -2
  250. package/dist/cli/chunks/{chunk-3ABRGG3C.js → chunk-6CR4VQBQ.js} +2 -2
  251. package/dist/cli/chunks/chunk-6ITZZIQX.js +2 -0
  252. package/dist/cli/chunks/{chunk-7BUERZYL.js → chunk-6LKDHEBY.js} +2 -2
  253. package/dist/cli/chunks/{chunk-FKG5OQFT.js → chunk-6TU7FEMD.js} +1 -1
  254. package/dist/cli/chunks/{chunk-KF63AYXD.js → chunk-6VAZAHQG.js} +2 -2
  255. package/dist/cli/chunks/{chunk-XXCYQXK3.js → chunk-73EI4C2E.js} +2 -2
  256. package/dist/cli/chunks/chunk-75QJ5HWE.js +14 -0
  257. package/dist/cli/chunks/{chunk-72UJXEKQ.js → chunk-7CD7PBHY.js} +2 -2
  258. package/dist/cli/chunks/chunk-7DETTOPZ.js +14 -0
  259. package/dist/cli/chunks/{chunk-7JQHPANT.js → chunk-7JZJJA7U.js} +3 -3
  260. package/dist/cli/chunks/{chunk-5Y5TC6BY.js → chunk-7VFY7TUR.js} +2 -2
  261. package/dist/cli/chunks/chunk-7X7JYWT4.js +27 -0
  262. package/dist/cli/chunks/chunk-AF4XKLXO.js +2 -0
  263. package/dist/cli/chunks/{chunk-7SLAZAVU.js → chunk-AFEDJ3RU.js} +2 -2
  264. package/dist/cli/chunks/{chunk-ZUG5MOUB.js → chunk-AMMQOV35.js} +2 -2
  265. package/dist/cli/chunks/{chunk-ZN3J6TZD.js → chunk-BHFR2EXL.js} +1 -1
  266. package/dist/cli/chunks/{chunk-HXE5NBJG.js → chunk-BJPL6THQ.js} +1 -1
  267. package/dist/cli/chunks/{chunk-37BASGWC.js → chunk-BXVAVFGU.js} +2 -2
  268. package/dist/cli/chunks/{chunk-VWNHKYK7.js → chunk-BYG36QC5.js} +2 -2
  269. package/dist/cli/chunks/chunk-C3HQL6S4.js +2 -0
  270. package/dist/cli/chunks/{chunk-OY7MLMEX.js → chunk-C3Z4VVHP.js} +5 -5
  271. package/dist/cli/chunks/{chunk-CB5JPRIZ.js → chunk-CPC7FN52.js} +2 -2
  272. package/dist/cli/chunks/{chunk-OVDKWCD7.js → chunk-CVMNJSCB.js} +2 -2
  273. package/dist/cli/chunks/{chunk-N4H2QOT5.js → chunk-CYE2TJFV.js} +2 -2
  274. package/dist/cli/chunks/{chunk-YCBDE2N7.js → chunk-CZO4BJG5.js} +2 -2
  275. package/dist/cli/chunks/{chunk-YEXPFHV6.js → chunk-D6OUCB2H.js} +2 -2
  276. package/dist/cli/chunks/{chunk-JRYZKBY2.js → chunk-DDCIYOGT.js} +2 -2
  277. package/dist/cli/chunks/{chunk-XX7HUSX2.js → chunk-DKUBQQFG.js} +2 -2
  278. package/dist/cli/chunks/{chunk-SGXSB7YO.js → chunk-DLF5BOJD.js} +1 -1
  279. package/dist/cli/chunks/{chunk-5BLFXQEB.js → chunk-DO6EI5KB.js} +1 -1
  280. package/dist/cli/chunks/{chunk-33VPWGCM.js → chunk-DPBRWP4J.js} +3 -3
  281. package/dist/cli/chunks/{chunk-H6XBM2LY.js → chunk-E3W6XQ57.js} +2 -2
  282. package/dist/cli/chunks/{chunk-KPMGTVB4.js → chunk-E4AZXCT5.js} +1 -1
  283. package/dist/cli/chunks/chunk-E4EYPYR3.js +2 -0
  284. package/dist/cli/chunks/{chunk-TFHQE6NK.js → chunk-EFV4ADMO.js} +4 -4
  285. package/dist/cli/chunks/{chunk-VIDBBB6F.js → chunk-ELBZON4V.js} +2 -2
  286. package/dist/cli/chunks/chunk-EOR2UT72.js +2 -0
  287. package/dist/cli/chunks/{chunk-H5ZRV5K5.js → chunk-F34OAHOM.js} +2 -2
  288. package/dist/cli/chunks/{chunk-UMENRGHK.js → chunk-FUNGTIF2.js} +2 -2
  289. package/dist/cli/chunks/{chunk-DBA3N742.js → chunk-G3L5L6YQ.js} +1 -1
  290. package/dist/cli/chunks/{chunk-ELU4IC3I.js → chunk-G3W6BMVJ.js} +1 -1
  291. package/dist/cli/chunks/{chunk-RTJ2M6V6.js → chunk-GTKCGPJZ.js} +3 -3
  292. package/dist/cli/chunks/chunk-HBCGYMQU.js +2 -0
  293. package/dist/cli/chunks/{chunk-YL7T3VV7.js → chunk-HSVKZ5KI.js} +4 -4
  294. package/dist/cli/chunks/{chunk-MXMFGSWR.js → chunk-HVU64GP5.js} +2 -2
  295. package/dist/cli/chunks/chunk-HVXJC3OC.js +2 -0
  296. package/dist/cli/chunks/chunk-HYEJJJY3.js +4 -0
  297. package/dist/cli/chunks/{chunk-CR3QGHVN.js → chunk-I2NENQ44.js} +2 -2
  298. package/dist/cli/chunks/{chunk-GNTVFN7D.js → chunk-I6X3EGJI.js} +1 -1
  299. package/dist/cli/chunks/{chunk-2GNRW3OD.js → chunk-IGBEJ4UJ.js} +2 -2
  300. package/dist/cli/chunks/{chunk-UYJHYMEQ.js → chunk-IIAR5S7Q.js} +2 -2
  301. package/dist/cli/chunks/{chunk-YAKS3CAB.js → chunk-IJHCIXJC.js} +2 -2
  302. package/dist/cli/chunks/{chunk-YDNSLLBS.js → chunk-IUDWEOLX.js} +2 -2
  303. package/dist/cli/chunks/chunk-IUHB5GVS.js +3 -0
  304. package/dist/cli/chunks/{chunk-4UDZLD42.js → chunk-IYTLXUBO.js} +2 -2
  305. package/dist/cli/chunks/chunk-J27F4NSB.js +2 -0
  306. package/dist/cli/chunks/{chunk-HRUU7E3D.js → chunk-J5UNP6W3.js} +2 -2
  307. package/dist/cli/chunks/{chunk-E3FBW6G2.js → chunk-JES6R5KP.js} +1 -1
  308. package/dist/cli/chunks/chunk-JROVR6YS.js +11 -0
  309. package/dist/cli/chunks/chunk-JSZ663MU.js +2 -0
  310. package/dist/cli/chunks/{chunk-FUE6LL72.js → chunk-JVQBWYHW.js} +2 -2
  311. package/dist/cli/chunks/{chunk-G6ZHTF42.js → chunk-K27SU3RE.js} +2 -2
  312. package/dist/cli/chunks/chunk-K7NJHFLZ.js +54 -0
  313. package/dist/cli/chunks/{chunk-MDZ6RRLX.js → chunk-KEY43ANX.js} +2 -2
  314. package/dist/cli/chunks/chunk-KIP6WZGV.js +13 -0
  315. package/dist/cli/chunks/{chunk-SQ3PPISY.js → chunk-KKHYJF5U.js} +1 -1
  316. package/dist/cli/chunks/{chunk-TJEIOE7F.js → chunk-KLTP5IDB.js} +1 -1
  317. package/dist/cli/chunks/{chunk-IKIITGU5.js → chunk-KO4FNAUR.js} +4 -4
  318. package/dist/cli/chunks/{chunk-DX3C5HPN.js → chunk-KYA5LARK.js} +1 -1
  319. package/dist/cli/chunks/{chunk-ZHXWGNYM.js → chunk-LSUILON7.js} +1 -1
  320. package/dist/cli/chunks/chunk-LULD4JV2.js +15 -0
  321. package/dist/cli/chunks/{chunk-MWWAMDHI.js → chunk-M23ZOZVY.js} +1 -1
  322. package/dist/cli/chunks/{chunk-RKJZWWB7.js → chunk-M5AEL7IS.js} +2 -2
  323. package/dist/cli/chunks/chunk-MI5Q55DG.js +65 -0
  324. package/dist/cli/chunks/chunk-N7H767TP.js +4 -0
  325. package/dist/cli/chunks/{chunk-5F6DWHQG.js → chunk-NQI7FWCS.js} +2 -2
  326. package/dist/cli/chunks/{chunk-LLVGTEHU.js → chunk-NRE4NAVA.js} +1 -1
  327. package/dist/cli/chunks/{chunk-XA7CG3LH.js → chunk-NU7UTXMP.js} +2 -2
  328. package/dist/cli/chunks/chunk-NVYBM3R4.js +2 -0
  329. package/dist/cli/chunks/chunk-O3JTQ7N4.js +2 -0
  330. package/dist/cli/chunks/{chunk-TISSZFHO.js → chunk-OEIQTWQP.js} +1 -1
  331. package/dist/cli/chunks/{chunk-2IGT5WNQ.js → chunk-PSPKSUF6.js} +1 -1
  332. package/dist/cli/chunks/{chunk-B7SWW5A6.js → chunk-QIRL6B3C.js} +2 -2
  333. package/dist/cli/chunks/{chunk-JBB7E26R.js → chunk-QRCIZFNK.js} +2 -2
  334. package/dist/cli/chunks/{chunk-4JBFJTHJ.js → chunk-QWUXCG2L.js} +1 -1
  335. package/dist/cli/chunks/{chunk-B5XFDFBT.js → chunk-QYOGD2VW.js} +1 -1
  336. package/dist/cli/chunks/chunk-QZMUXJHZ.js +2 -0
  337. package/dist/cli/chunks/chunk-R6IU3EWP.js +2 -0
  338. package/dist/cli/chunks/{chunk-G5C2XVZC.js → chunk-R74ZKREV.js} +1 -1
  339. package/dist/cli/chunks/chunk-RD2VGOUH.js +2 -0
  340. package/dist/cli/chunks/{chunk-OV5EZO3U.js → chunk-RD6TEZ64.js} +2 -2
  341. package/dist/cli/chunks/{chunk-4C6UJIHB.js → chunk-RGGK6VZ7.js} +1 -1
  342. package/dist/cli/chunks/{chunk-4XPPMADQ.js → chunk-RIZVC4XY.js} +6 -6
  343. package/dist/cli/chunks/{chunk-4RP5VUBI.js → chunk-RKOUXVZZ.js} +2 -2
  344. package/dist/cli/chunks/{chunk-IFFZR6GY.js → chunk-RP2ZKPYV.js} +1 -1
  345. package/dist/cli/chunks/{chunk-BN7DKW5D.js → chunk-SQF6HRXR.js} +1 -1
  346. package/dist/cli/chunks/chunk-SQKW3B6B.js +2 -0
  347. package/dist/cli/chunks/{chunk-LKN7JQTW.js → chunk-SX4JLSLV.js} +2 -2
  348. package/dist/cli/chunks/{chunk-YGB6R5DW.js → chunk-TUSSPKRM.js} +1 -1
  349. package/dist/cli/chunks/{chunk-LHGNNZ76.js → chunk-TY5WC3FT.js} +3 -3
  350. package/dist/cli/chunks/{chunk-B2ZONZPZ.js → chunk-UDHVCKGA.js} +2 -2
  351. package/dist/cli/chunks/{chunk-IU4EBTA2.js → chunk-UJWAWIRV.js} +4 -4
  352. package/dist/cli/chunks/{chunk-LTBCAFTZ.js → chunk-UKGXWW64.js} +3 -3
  353. package/dist/cli/chunks/{chunk-JV4FZUE7.js → chunk-UMGFMKDW.js} +2 -2
  354. package/dist/cli/chunks/{chunk-STRDSVH3.js → chunk-URVHZPWY.js} +2 -2
  355. package/dist/cli/chunks/{chunk-PZTVH2AS.js → chunk-UTBYJ4RF.js} +2 -2
  356. package/dist/cli/chunks/{chunk-ZK5JKHP4.js → chunk-VD5IO5EO.js} +1 -1
  357. package/dist/cli/chunks/chunk-VTOVWHEM.js +2 -0
  358. package/dist/cli/chunks/{chunk-OYMLHX2B.js → chunk-W2XCZU62.js} +1 -1
  359. package/dist/cli/chunks/{chunk-T35GZXTU.js → chunk-WJHWH5D2.js} +2 -2
  360. package/dist/cli/chunks/{chunk-NBWQBQO5.js → chunk-WJTSY5MC.js} +1 -1
  361. package/dist/cli/chunks/{chunk-NTSXHZTC.js → chunk-WK7B4B6Y.js} +4 -4
  362. package/dist/cli/chunks/{chunk-2WT7AKKK.js → chunk-WLXK2KNU.js} +2 -2
  363. package/dist/cli/chunks/chunk-WOIGKU2N.js +180 -0
  364. package/dist/cli/chunks/{chunk-WYMGK5DX.js → chunk-WX6RRIGW.js} +2 -2
  365. package/dist/cli/chunks/{chunk-C46DMCWF.js → chunk-XEZIIQYJ.js} +2 -2
  366. package/dist/cli/chunks/{chunk-TTMHIOQ3.js → chunk-XFPPERA2.js} +2 -2
  367. package/dist/cli/chunks/{chunk-OVPJQWHW.js → chunk-XLAUGSW7.js} +2 -2
  368. package/dist/cli/chunks/{chunk-V4AOVDCJ.js → chunk-XQSIRBKT.js} +8 -8
  369. package/dist/cli/chunks/{chunk-4Q35TI6Z.js → chunk-XUR2M2WB.js} +2 -2
  370. package/dist/cli/chunks/{chunk-5IAB5NRZ.js → chunk-XZSMZHM2.js} +2 -2
  371. package/dist/cli/chunks/{chunk-AB4U6ZNI.js → chunk-Y5L3ES4L.js} +2 -2
  372. package/dist/cli/chunks/chunk-YDFL445W.js +2 -0
  373. package/dist/cli/chunks/{chunk-7G6UX2QN.js → chunk-YQGPQBCX.js} +2 -2
  374. package/dist/cli/chunks/{chunk-5FOZO7KM.js → chunk-YXP6BKGS.js} +46 -46
  375. package/dist/cli/chunks/chunk-ZBABIZ2D.js +2 -0
  376. package/dist/cli/chunks/{chunk-IQEJGZV6.js → chunk-ZCWERUYB.js} +4 -4
  377. package/dist/cli/chunks/ci-RACDAJMR.js +81 -0
  378. package/dist/cli/chunks/{ci-output-LK3MBXLZ.js → ci-output-EHRSZBKG.js} +2 -2
  379. package/dist/cli/chunks/{circuit-breaker-7AIXACR7.js → circuit-breaker-GBV7M5XG.js} +2 -2
  380. package/dist/cli/chunks/{claude-flow-setup-UA7EO6VN.js → claude-flow-setup-5LVJOFKP.js} +2 -2
  381. package/dist/cli/chunks/client-HUVFA5PF.js +2 -0
  382. package/dist/cli/chunks/{cline-installer-YDDCKKEV.js → cline-installer-W4NMXJSG.js} +2 -2
  383. package/dist/cli/chunks/{code-URB7UAKW.js → code-JWXJMYXB.js} +29 -29
  384. package/dist/cli/chunks/{code-index-extractor-BL6HWH4Q.js → code-index-extractor-RVI2IFTM.js} +2 -2
  385. package/dist/cli/chunks/codex-installer-3BORJINH.js +14 -0
  386. package/dist/cli/chunks/{completions-RCKBSSSS.js → completions-A55NCTAO.js} +2 -2
  387. package/dist/cli/chunks/complexity-analyzer-JCXHGGLY.js +2 -0
  388. package/dist/cli/chunks/{continuedev-installer-VOTCEBFH.js → continuedev-installer-PUVFMGYW.js} +2 -2
  389. package/dist/cli/chunks/{copilot-installer-NVTGLZX3.js → copilot-installer-4DCMYWHB.js} +2 -2
  390. package/dist/cli/chunks/core-handlers-UEXO3VAA.js +2 -0
  391. package/dist/cli/chunks/cost-tracker-5TV2GGKY.js +2 -0
  392. package/dist/cli/chunks/{coverage-ZTPJWXWE.js → coverage-NNWM7TX3.js} +3 -3
  393. package/dist/cli/chunks/cross-domain-router-ODU5IZD6.js +2 -0
  394. package/dist/cli/chunks/{cursor-installer-CMGJQMHX.js → cursor-installer-4NCHGJGK.js} +2 -2
  395. package/dist/cli/chunks/{daemon-Y2I3YVIU.js → daemon-QIKCXKWO.js} +4 -4
  396. package/dist/cli/chunks/{daemon-V456IWR3.js → daemon-T4JO4IXP.js} +3 -3
  397. package/dist/cli/chunks/{dag-attention-scheduler-ZCBBOD3D.js → dag-attention-scheduler-RPAAIDAD.js} +2 -2
  398. package/dist/cli/chunks/{detect-2GHEA4A3.js → detect-SBEEVDSN.js} +2 -2
  399. package/dist/cli/chunks/{dist-node-44AGYJCH.js → dist-node-ZHI6NCSU.js} +2 -2
  400. package/dist/cli/chunks/{domain-handler-IDLIEP6X.js → domain-handler-LBC3GJ7Z.js} +2 -2
  401. package/dist/cli/chunks/domain-plugins-H6IZ5USZ.js +2 -0
  402. package/dist/cli/chunks/{domain-transfer-KLEXGIRF.js → domain-transfer-JZA5TMW3.js} +2 -2
  403. package/dist/cli/chunks/dream-HE3OX42F.js +2 -0
  404. package/dist/cli/chunks/embed-and-insert-pattern-AHTR7CRU.js +3 -0
  405. package/dist/cli/chunks/eval-DZU2KISM.js +17 -0
  406. package/dist/cli/chunks/{experience-capture-middleware-CJJJN7CF.js → experience-capture-middleware-5IQCWKSL.js} +4 -4
  407. package/dist/cli/chunks/{fast-paths-LGLLKX6P.js → fast-paths-2KLDUWCY.js} +2 -2
  408. package/dist/cli/chunks/{feature-flags-33D3I4DD.js → feature-flags-7AC3XDZA.js} +2 -2
  409. package/dist/cli/chunks/{feature-flags-QL4NCEGW.js → feature-flags-N6UAEZY4.js} +2 -2
  410. package/dist/cli/chunks/{file-discovery-GKCYJPFZ.js → file-discovery-5SDIW4V2.js} +2 -2
  411. package/dist/cli/chunks/fleet-ZIQCAZ2Y.js +43 -0
  412. package/dist/cli/chunks/{gnn-wrapper-ELSGT67Z.js → gnn-wrapper-DUMBZJEV.js} +2 -2
  413. package/dist/cli/chunks/{heartbeat-handler-ZUI3DOOP.js → heartbeat-handler-6HVM6ZMR.js} +4 -4
  414. package/dist/cli/chunks/heartbeat-scheduler-QUIFGGLX.js +2 -0
  415. package/dist/cli/chunks/hnsw-adapter-42KB37KP.js +2 -0
  416. package/dist/cli/chunks/hnsw-index-T2PGO77J.js +2 -0
  417. package/dist/cli/chunks/{hnsw-legacy-bridge-EZMM5JWL.js → hnsw-legacy-bridge-5DRL5FLX.js} +2 -2
  418. package/dist/cli/chunks/{hnswlib-node-G4CE3EOS.js → hnswlib-node-GW67GTCL.js} +2 -2
  419. package/dist/cli/chunks/{hooks-LCVXXA55.js → hooks-QHH6FVO4.js} +10 -10
  420. package/dist/cli/chunks/hybrid-backend-FRNWYRKH.js +2 -0
  421. package/dist/cli/chunks/{hypergraph-engine-6Z7RQ3HI.js → hypergraph-engine-7XDCCVG2.js} +2 -2
  422. package/dist/cli/chunks/{hypergraph-handler-PLI2GYPK.js → hypergraph-handler-QHF7NOU5.js} +3 -3
  423. package/dist/cli/chunks/impact-analyzer-A5QYOYBR.js +2 -0
  424. package/dist/cli/chunks/{init-handler-7VH3QJ5Y.js → init-handler-5UIVOM7K.js} +6 -6
  425. package/dist/cli/chunks/init-wizard-XBU674YH.js +2 -0
  426. package/dist/cli/chunks/kernel-DV5MTNZD.js +2 -0
  427. package/dist/cli/chunks/{kilocode-installer-U3MW62DE.js → kilocode-installer-TGGV6K5Q.js} +2 -2
  428. package/dist/cli/chunks/{kiro-installer-PPEAC44T.js → kiro-installer-4XYBHZWW.js} +12 -12
  429. package/dist/cli/chunks/knowledge-graph-4ACGVJQK.js +2 -0
  430. package/dist/cli/chunks/learning-STE5W6BS.js +122 -0
  431. package/dist/cli/chunks/llm-router-NKF7J3RI.js +37 -0
  432. package/dist/cli/chunks/llm-router-service-PSMASERT.js +2 -0
  433. package/dist/cli/chunks/{load-VO7ABNHV.js → load-B2T77UJQ.js} +2 -2
  434. package/dist/cli/chunks/load-test-MRUO2VPF.js +2 -0
  435. package/dist/cli/chunks/mcp-JGSFCEMH.js +2 -0
  436. package/dist/cli/chunks/{memory-FZTT7ADM.js → memory-WRFZKG56.js} +6 -6
  437. package/dist/cli/chunks/memory-backend-2MPGI6JW.js +2 -0
  438. package/dist/cli/chunks/memory-handlers-XT4HMITB.js +2 -0
  439. package/dist/cli/chunks/multi-model-executor-26Q5BSVG.js +14 -0
  440. package/dist/cli/chunks/{opencode-installer-GQ7J5SBG.js → opencode-installer-J36EMQU7.js} +2 -2
  441. package/dist/cli/chunks/{orchestrator-66JK2OS5.js → orchestrator-D5IFV65I.js} +20 -20
  442. package/dist/cli/chunks/pattern-null-store-TGWUL237.js +2 -0
  443. package/dist/cli/chunks/{pattern-usage-recorder-O6XHM2G5.js → pattern-usage-recorder-BVMTWI3E.js} +2 -2
  444. package/dist/cli/chunks/pipeline-OWAHDUAQ.js +19 -0
  445. package/dist/cli/chunks/platform-ANGBFWBV.js +2 -0
  446. package/dist/cli/chunks/{plugin-7OFLNGOS.js → plugin-OO7ON2YW.js} +2 -2
  447. package/dist/cli/chunks/{prime-radiant-advanced-wasm-OSRDK2FW.js → prime-radiant-advanced-wasm-HFG3BXWU.js} +2 -2
  448. package/dist/cli/chunks/project-root-LNOYVTYY.js +2 -0
  449. package/dist/cli/chunks/protocol-executor-GEVH5KD6.js +2 -0
  450. package/dist/cli/chunks/{protocol-handler-WLYTX6FS.js → protocol-handler-CE3Q6LY4.js} +2 -2
  451. package/dist/cli/chunks/{prove-QVNE4V3J.js → prove-7XPN53PY.js} +2 -2
  452. package/dist/cli/chunks/qe-reasoning-bank-DJ2JL6QB.js +2 -0
  453. package/dist/cli/chunks/{quality-DNE2RKE5.js → quality-TT23JRFX.js} +2 -2
  454. package/dist/cli/chunks/{quality-gate-2K35GCSI.js → quality-gate-PPPRP255.js} +3 -3
  455. package/dist/cli/chunks/queen-coordinator-F7E3AS26.js +2 -0
  456. package/dist/cli/chunks/real-embeddings-EYNZIFJE.js +2 -0
  457. package/dist/cli/chunks/ref-validation-QQR64ZXD.js +2 -0
  458. package/dist/cli/chunks/{roocode-installer-NCEZPF5L.js → roocode-installer-UIGS7ZJD.js} +2 -2
  459. package/dist/cli/chunks/router-OZH3QSAU.js +2 -0
  460. package/dist/cli/chunks/routing-feedback-J2E3ADZB.js +2 -0
  461. package/dist/cli/chunks/{routing-handler-4MXXZRYP.js → routing-handler-6AENUIRG.js} +4 -4
  462. package/dist/cli/chunks/{ruvector-commands-WDFMMCMK.js → ruvector-commands-5AWMEV34.js} +2 -2
  463. package/dist/cli/chunks/rvf-dual-writer-HK525Y5Y.js +2 -0
  464. package/dist/cli/chunks/rvf-migration-adapter-Q7FB3BKR.js +2 -0
  465. package/dist/cli/chunks/rvf-migration-coordinator-NWRJ7C22.js +2 -0
  466. package/dist/cli/chunks/rvf-native-adapter-5ZRCGUI6.js +2 -0
  467. package/dist/cli/chunks/rvf-store-integrity-ISKRP563.js +2 -0
  468. package/dist/cli/chunks/safe-db-3OYEPVEH.js +2 -0
  469. package/dist/cli/chunks/schedule-AG4C2EIQ.js +2 -0
  470. package/dist/cli/chunks/scheduler-SQS2CZFZ.js +2 -0
  471. package/dist/cli/chunks/{security-CJJ3WJSB.js → security-325A7FMB.js} +3 -3
  472. package/dist/cli/chunks/{shared-rvf-adapter-6RGCTLHD.js → shared-rvf-adapter-NFL6QSZ6.js} +2 -2
  473. package/dist/cli/chunks/{shared-rvf-dual-writer-KIA6Q6MT.js → shared-rvf-dual-writer-THFDYS2Z.js} +2 -2
  474. package/dist/cli/chunks/sqlite-persistence-MAKDFSHC.js +2 -0
  475. package/dist/cli/chunks/standalone-memory-UD4MJ6GZ.js +2 -0
  476. package/dist/cli/chunks/{status-handler-BADQV2KA.js → status-handler-CPFTN4XL.js} +2 -2
  477. package/dist/cli/chunks/{structural-health-VMYEYRZG.js → structural-health-2MG2IVBL.js} +2 -2
  478. package/dist/cli/chunks/{sync-PXLROLHB.js → sync-EE4VVKOW.js} +2 -2
  479. package/dist/cli/chunks/{sync-ULY7T5II.js → sync-MBTW5XBF.js} +2 -2
  480. package/dist/cli/chunks/task-handler-7H5OYJG4.js +54 -0
  481. package/dist/cli/chunks/task-handlers-NH4GJHCJ.js +9 -0
  482. package/dist/cli/chunks/{test-WCLURQUT.js → test-MPHGT4T6.js} +4 -4
  483. package/dist/cli/chunks/test-scheduling-CHQ4ZLLJ.js +15 -0
  484. package/dist/cli/chunks/token-bootstrap-SSDCYEKK.js +2 -0
  485. package/dist/cli/chunks/{token-usage-DRVG6PKO.js → token-usage-EBXUJNRB.js} +2 -2
  486. package/dist/cli/chunks/{transformers-IMDDAMYQ.js → transformers-ZEKS2OJZ.js} +2 -2
  487. package/dist/cli/chunks/{tree-sitter-wasm-parser-WBZIHVFA.js → tree-sitter-wasm-parser-J6ZMAK37.js} +2 -2
  488. package/dist/cli/chunks/types-KYAA5VLV.js +2 -0
  489. package/dist/cli/chunks/unified-memory-DDWMC435.js +2 -0
  490. package/dist/cli/chunks/unified-memory-hnsw-4JA7SGBK.js +2 -0
  491. package/dist/cli/chunks/unified-persistence-F6OSNTXY.js +2 -0
  492. package/dist/cli/chunks/{upgrade-6ALSDWDD.js → upgrade-UJBJ5AYM.js} +2 -2
  493. package/dist/cli/chunks/{validate-XF4ZG3LC.js → validate-RUV6YMWS.js} +2 -2
  494. package/dist/cli/chunks/{validate-swarm-P5TAFRDA.js → validate-swarm-IVEVMGVM.js} +2 -2
  495. package/dist/cli/chunks/{vibium-2XDXKNKZ.js → vibium-HOGMFJ2Z.js} +2 -2
  496. package/dist/cli/chunks/visual-security-25SMBIYT.js +2 -0
  497. package/dist/cli/chunks/{web-tree-sitter-4JVRQPX5.js → web-tree-sitter-AVWA6HKE.js} +2 -2
  498. package/dist/cli/chunks/{windsurf-installer-WYJXVDO5.js → windsurf-installer-DAH7HI2W.js} +2 -2
  499. package/dist/cli/chunks/{witness-chain-RPZ2SE2V.js → witness-chain-PJOQPFUX.js} +2 -2
  500. package/dist/cli/chunks/witness-chain-ZW6KKUZU.js +2 -0
  501. package/dist/cli/chunks/{witness-key-manager-LXG2VBQQ.js → witness-key-manager-JSTBMG43.js} +2 -2
  502. package/dist/cli/chunks/workflow-TWOIA6LZ.js +51 -0
  503. package/dist/cli/chunks/workflow-orchestrator-UKSIDM7Q.js +2 -0
  504. package/dist/cli/chunks/{wrappers-DIJNNFU6.js → wrappers-UR7BLXKV.js} +2 -2
  505. package/dist/cli/commands/ci.js +54 -28
  506. package/dist/cli/commands/code.js +6 -0
  507. package/dist/cli/commands/eval.js +3 -2
  508. package/dist/cli/commands/fleet.js +35 -16
  509. package/dist/cli/commands/learning-snapshot.d.ts +38 -0
  510. package/dist/cli/commands/learning-snapshot.js +171 -0
  511. package/dist/cli/commands/learning.js +16 -64
  512. package/dist/cli/commands/llm-router.js +13 -12
  513. package/dist/cli/commands/mcp.js +6 -0
  514. package/dist/cli/commands/memory.d.ts +1 -1
  515. package/dist/cli/commands/memory.js +8 -8
  516. package/dist/cli/commands/pipeline.js +9 -0
  517. package/dist/cli/commands/platform.js +15 -2
  518. package/dist/cli/commands/upgrade.d.ts +3 -3
  519. package/dist/cli/commands/upgrade.js +3 -3
  520. package/dist/cli/commands/workflow.js +9 -1
  521. package/dist/cli/handlers/init-handler.d.ts +10 -0
  522. package/dist/cli/handlers/task-handler.js +43 -12
  523. package/dist/cli/helpers/domain-plugins.d.ts +5 -0
  524. package/dist/cli/helpers/domain-plugins.js +11 -0
  525. package/dist/cli/helpers/standalone-memory.d.ts +12 -0
  526. package/dist/cli/helpers/standalone-memory.js +46 -0
  527. package/dist/cli/index.js +54 -49
  528. package/dist/cli/log-gate.d.ts +66 -0
  529. package/dist/cli/log-gate.js +170 -0
  530. package/dist/cli/utils/ci-config.d.ts +3 -0
  531. package/dist/context/sources/git-source.d.ts +2 -0
  532. package/dist/context/sources/git-source.js +9 -2
  533. package/dist/coordination/cancelled-task-settlement.d.ts +11 -0
  534. package/dist/coordination/cancelled-task-settlement.js +15 -0
  535. package/dist/coordination/consensus/providers/claude-provider.d.ts +2 -2
  536. package/dist/coordination/consensus/providers/claude-provider.js +18 -25
  537. package/dist/coordination/consensus/providers/gemini-provider.d.ts +14 -4
  538. package/dist/coordination/consensus/providers/gemini-provider.js +39 -36
  539. package/dist/coordination/consensus/providers/ollama-provider.d.ts +8 -7
  540. package/dist/coordination/consensus/providers/ollama-provider.js +16 -18
  541. package/dist/coordination/consensus/providers/openai-provider.d.ts +14 -4
  542. package/dist/coordination/consensus/providers/openai-provider.js +36 -34
  543. package/dist/coordination/consensus/providers/openrouter-provider.d.ts +5 -5
  544. package/dist/coordination/consensus/providers/openrouter-provider.js +64 -37
  545. package/dist/coordination/handlers/test-execution-handlers.js +5 -3
  546. package/dist/coordination/interfaces.d.ts +2 -2
  547. package/dist/coordination/protocol-executor.js +68 -9
  548. package/dist/coordination/queen-coordinator.js +10 -4
  549. package/dist/coordination/queen-event-handlers.js +17 -0
  550. package/dist/coordination/queen-task-management.js +25 -0
  551. package/dist/coordination/queen-types.d.ts +2 -0
  552. package/dist/coordination/task-executor.js +4 -8
  553. package/dist/coordination/workflow-composition.d.ts +19 -0
  554. package/dist/coordination/workflow-composition.js +114 -0
  555. package/dist/coordination/workflow-orchestrator.d.ts +3 -2
  556. package/dist/coordination/workflow-orchestrator.js +219 -85
  557. package/dist/coordination/workflow-types.d.ts +30 -1
  558. package/dist/coordination/yaml-pipeline-loader.js +9 -5
  559. package/dist/domains/chaos-resilience/services/chaos-engineer.js +2 -7
  560. package/dist/domains/code-intelligence/services/knowledge-graph.js +2 -7
  561. package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +9 -40
  562. package/dist/domains/constants.d.ts +1 -6
  563. package/dist/domains/constants.js +2 -6
  564. package/dist/domains/contract-testing/services/contract-validator.js +2 -7
  565. package/dist/domains/coverage-analysis/services/coverage-analyzer.js +2 -12
  566. package/dist/domains/coverage-analysis/services/gap-detector.js +2 -7
  567. package/dist/domains/defect-intelligence/services/defect-predictor.js +2 -12
  568. package/dist/domains/defect-intelligence/services/root-cause-analyzer.js +2 -7
  569. package/dist/domains/learning-optimization/services/learning-coordinator.js +2 -7
  570. package/dist/domains/quality-assessment/services/deployment-advisor.js +2 -7
  571. package/dist/domains/quality-assessment/services/quality-analyzer.js +2 -7
  572. package/dist/domains/requirements-validation/services/requirements-validator.js +2 -7
  573. package/dist/domains/security-compliance/services/scanners/sast-scanner.js +3 -7
  574. package/dist/domains/test-execution/services/flaky-detector.js +33 -3
  575. package/dist/domains/test-execution/services/retry-handler.js +22 -14
  576. package/dist/domains/test-execution/services/test-executor.js +42 -21
  577. package/dist/domains/test-generation/services/test-generator.js +2 -7
  578. package/dist/domains/visual-accessibility/services/visual-tester.js +2 -7
  579. package/dist/init/codex-installer.js +18 -6
  580. package/dist/init/init-wizard-steps.js +1 -1
  581. package/dist/init/kiro-installer.js +9 -8
  582. package/dist/init/opencode-installer.js +1 -1
  583. package/dist/init/orchestrator.js +1 -0
  584. package/dist/init/phases/07-hooks.js +4 -2
  585. package/dist/init/phases/09-assets.d.ts +10 -0
  586. package/dist/init/phases/09-assets.js +3 -0
  587. package/dist/init/phases/12-verification.js +1 -1
  588. package/dist/init/settings-merge.d.ts +10 -3
  589. package/dist/init/settings-merge.js +40 -9
  590. package/dist/init/token-bootstrap.d.ts +1 -1
  591. package/dist/init/token-bootstrap.js +12 -2
  592. package/dist/init/types.d.ts +10 -0
  593. package/dist/integrations/agentic-flow/model-router/types.js +6 -8
  594. package/dist/integrations/ruvector/brain-exporter.js +26 -15
  595. package/dist/integrations/ruvector/brain-import-audit.d.ts +20 -0
  596. package/dist/integrations/ruvector/brain-import-audit.js +22 -0
  597. package/dist/integrations/ruvector/brain-rvf-exporter.js +33 -30
  598. package/dist/integrations/ruvector/brain-shared.d.ts +5 -1
  599. package/dist/integrations/ruvector/brain-shared.js +70 -4
  600. package/dist/integrations/ruvector/rvf-dual-writer.js +42 -16
  601. package/dist/integrations/ruvector/rvf-store-integrity.d.ts +14 -9
  602. package/dist/integrations/ruvector/rvf-store-integrity.js +39 -9
  603. package/dist/integrations/ruvector/shared-rvf-adapter.js +20 -23
  604. package/dist/kernel/hybrid-backend.d.ts +6 -0
  605. package/dist/kernel/hybrid-backend.js +18 -0
  606. package/dist/kernel/kernel.js +9 -14
  607. package/dist/kernel/memory-factory.js +14 -4
  608. package/dist/kernel/project-root.d.ts +1 -1
  609. package/dist/kernel/project-root.js +33 -10
  610. package/dist/kernel/unified-memory.js +1 -1
  611. package/dist/learning/embedder-identity-store.js +4 -3
  612. package/dist/learning/local-judge-client.d.ts +6 -5
  613. package/dist/learning/local-judge-client.js +7 -6
  614. package/dist/learning/pattern-store.js +34 -12
  615. package/dist/learning/real-embeddings.d.ts +8 -0
  616. package/dist/learning/real-embeddings.js +16 -0
  617. package/dist/learning/rvf-pattern-store.js +10 -3
  618. package/dist/mcp/bundle.js +480 -480
  619. package/dist/mcp/entry.js +2 -0
  620. package/dist/mcp/handlers/index.d.ts +1 -1
  621. package/dist/mcp/handlers/index.js +1 -1
  622. package/dist/mcp/handlers/memory-handlers.d.ts +6 -1
  623. package/dist/mcp/handlers/memory-handlers.js +44 -22
  624. package/dist/mcp/handlers/pipeline-handlers.d.ts +31 -1
  625. package/dist/mcp/handlers/pipeline-handlers.js +63 -0
  626. package/dist/mcp/handlers/task-handlers.d.ts +1 -0
  627. package/dist/mcp/handlers/task-handlers.js +26 -5
  628. package/dist/mcp/protocol-server.d.ts +2 -0
  629. package/dist/mcp/protocol-server.js +105 -49
  630. package/dist/mcp/security/sampling-server.js +2 -1
  631. package/dist/mcp/services/session-store.js +5 -1
  632. package/dist/mcp/tool-annotations.js +1 -1
  633. package/dist/mcp/tools/test-execution/schedule.js +7 -0
  634. package/dist/mcp/types.d.ts +5 -1
  635. package/dist/optimization/session-cache.d.ts +5 -0
  636. package/dist/optimization/session-cache.js +23 -0
  637. package/dist/plugins/cache.d.ts +2 -0
  638. package/dist/plugins/cache.js +15 -2
  639. package/dist/plugins/lifecycle.js +15 -2
  640. package/dist/plugins/manifest.js +7 -5
  641. package/dist/plugins/resolver.d.ts +13 -22
  642. package/dist/plugins/resolver.js +169 -61
  643. package/dist/plugins/version-policy.d.ts +13 -0
  644. package/dist/plugins/version-policy.js +18 -0
  645. package/dist/routing/advisor/multi-model-executor.d.ts +4 -1
  646. package/dist/routing/advisor/multi-model-executor.js +8 -1
  647. package/dist/routing/free-tier/ladder.d.ts +2 -1
  648. package/dist/routing/free-tier/ladder.js +3 -2
  649. package/dist/routing/security/cyber-pin.d.ts +35 -11
  650. package/dist/routing/security/cyber-pin.js +76 -14
  651. package/dist/routing/value-score.js +1 -1
  652. package/dist/shared/git/index.d.ts +1 -0
  653. package/dist/shared/git/index.js +1 -0
  654. package/dist/shared/git/ref-validation.d.ts +20 -0
  655. package/dist/shared/git/ref-validation.js +43 -0
  656. package/dist/shared/llm/anthropic-params.d.ts +40 -0
  657. package/dist/shared/llm/anthropic-params.js +51 -0
  658. package/dist/shared/llm/cost-tracker.d.ts +15 -2
  659. package/dist/shared/llm/cost-tracker.js +62 -10
  660. package/dist/shared/llm/index.d.ts +2 -2
  661. package/dist/shared/llm/index.js +2 -2
  662. package/dist/shared/llm/interfaces.d.ts +1 -1
  663. package/dist/shared/llm/metrics/cost-metrics.js +5 -4
  664. package/dist/shared/llm/model-mapping.js +131 -0
  665. package/dist/shared/llm/model-registry.d.ts +37 -11
  666. package/dist/shared/llm/model-registry.js +393 -18
  667. package/dist/shared/llm/openai-params.d.ts +35 -0
  668. package/dist/shared/llm/openai-params.js +54 -0
  669. package/dist/shared/llm/provider-manager.js +4 -3
  670. package/dist/shared/llm/providers/azure-openai.d.ts +11 -0
  671. package/dist/shared/llm/providers/azure-openai.js +26 -15
  672. package/dist/shared/llm/providers/bedrock.js +11 -19
  673. package/dist/shared/llm/providers/claude.js +6 -29
  674. package/dist/shared/llm/providers/codex.js +4 -3
  675. package/dist/shared/llm/providers/gemini.d.ts +3 -2
  676. package/dist/shared/llm/providers/gemini.js +19 -10
  677. package/dist/shared/llm/providers/ollama.d.ts +2 -0
  678. package/dist/shared/llm/providers/ollama.js +30 -20
  679. package/dist/shared/llm/providers/openai.js +10 -17
  680. package/dist/shared/llm/providers/openrouter.d.ts +1 -1
  681. package/dist/shared/llm/providers/openrouter.js +57 -21
  682. package/dist/shared/llm/router/agent-router-config.js +33 -32
  683. package/dist/shared/llm/router/hybrid-router.js +21 -9
  684. package/dist/shared/llm/router/routing-rules.js +9 -8
  685. package/dist/shared/llm/router/types.js +81 -13
  686. package/dist/shared/llm/translation/message-formatter.js +4 -23
  687. package/dist/shared/types/index.d.ts +6 -0
  688. package/dist/shared/types/index.js +8 -0
  689. package/dist/shared/vitest-json-report.d.ts +7 -7
  690. package/dist/shared/vitest-json-report.js +23 -14
  691. package/dist/test-scheduling/executors/vitest-executor.d.ts +7 -2
  692. package/dist/test-scheduling/executors/vitest-executor.js +157 -47
  693. package/dist/test-scheduling/git-aware/test-selector.js +3 -0
  694. package/dist/test-scheduling/phase-scheduler.d.ts +1 -0
  695. package/dist/test-scheduling/phase-scheduler.js +23 -1
  696. package/package.json +2 -1
  697. package/dist/cli/chunks/adapter-AKQYU6UH.js +0 -2
  698. package/dist/cli/chunks/aqe-learning-engine-MICRPL3N.js +0 -2
  699. package/dist/cli/chunks/base-DZK36ITB.js +0 -2
  700. package/dist/cli/chunks/brain-handler-H5OVZ22L.js +0 -90
  701. package/dist/cli/chunks/browser-workflow-ADK54DOE.js +0 -2
  702. package/dist/cli/chunks/chunk-26GM5CWD.js +0 -13
  703. package/dist/cli/chunks/chunk-42VSQ2MX.js +0 -4
  704. package/dist/cli/chunks/chunk-44WISFTU.js +0 -2
  705. package/dist/cli/chunks/chunk-4OUPCTBS.js +0 -16
  706. package/dist/cli/chunks/chunk-4TXAP3YH.js +0 -2
  707. package/dist/cli/chunks/chunk-4W7QVUNO.js +0 -2
  708. package/dist/cli/chunks/chunk-527HQAY7.js +0 -14
  709. package/dist/cli/chunks/chunk-5DFHE4H5.js +0 -180
  710. package/dist/cli/chunks/chunk-5P3G6ZW4.js +0 -2
  711. package/dist/cli/chunks/chunk-6F2RM6X2.js +0 -2
  712. package/dist/cli/chunks/chunk-74PK3NEW.js +0 -15
  713. package/dist/cli/chunks/chunk-7Y2CEXRS.js +0 -65
  714. package/dist/cli/chunks/chunk-AWNYEAGB.js +0 -2
  715. package/dist/cli/chunks/chunk-CBOPBYPU.js +0 -2
  716. package/dist/cli/chunks/chunk-FD2JFEQC.js +0 -2
  717. package/dist/cli/chunks/chunk-G6DCESPU.js +0 -2
  718. package/dist/cli/chunks/chunk-I4NDQGKP.js +0 -2
  719. package/dist/cli/chunks/chunk-L2GKMBDP.js +0 -2
  720. package/dist/cli/chunks/chunk-QLWNXBRU.js +0 -2
  721. package/dist/cli/chunks/chunk-R2AFVFRF.js +0 -2
  722. package/dist/cli/chunks/chunk-ROX7NLS4.js +0 -14
  723. package/dist/cli/chunks/chunk-SHGKY3QB.js +0 -2
  724. package/dist/cli/chunks/chunk-SJPZSCZP.js +0 -27
  725. package/dist/cli/chunks/chunk-T62DH4GG.js +0 -11
  726. package/dist/cli/chunks/chunk-TGLAWI62.js +0 -4
  727. package/dist/cli/chunks/chunk-UMNYF5EZ.js +0 -2
  728. package/dist/cli/chunks/chunk-UTVRQEZM.js +0 -54
  729. package/dist/cli/chunks/chunk-Y2DVFVGI.js +0 -2
  730. package/dist/cli/chunks/chunk-Y5SQBI2F.js +0 -2
  731. package/dist/cli/chunks/ci-YVKDQWIX.js +0 -81
  732. package/dist/cli/chunks/client-M72GXFVQ.js +0 -2
  733. package/dist/cli/chunks/codex-installer-2AVEO4EA.js +0 -14
  734. package/dist/cli/chunks/complexity-analyzer-LEDG62YK.js +0 -2
  735. package/dist/cli/chunks/core-handlers-C32RAMVI.js +0 -2
  736. package/dist/cli/chunks/cost-tracker-GJIFB2BM.js +0 -2
  737. package/dist/cli/chunks/cross-domain-router-UGFUCPKC.js +0 -2
  738. package/dist/cli/chunks/dream-UFBBXY5W.js +0 -2
  739. package/dist/cli/chunks/embed-and-insert-pattern-DUW6K35A.js +0 -3
  740. package/dist/cli/chunks/eval-PR6YWDFM.js +0 -17
  741. package/dist/cli/chunks/fleet-QNT6X2YI.js +0 -43
  742. package/dist/cli/chunks/heartbeat-scheduler-VQWHSGTY.js +0 -2
  743. package/dist/cli/chunks/hnsw-adapter-BS3NXWGU.js +0 -2
  744. package/dist/cli/chunks/hnsw-index-JP26B4HW.js +0 -2
  745. package/dist/cli/chunks/impact-analyzer-WRE4CWPJ.js +0 -2
  746. package/dist/cli/chunks/init-wizard-OFOEYB75.js +0 -2
  747. package/dist/cli/chunks/kernel-MXNFWNUD.js +0 -2
  748. package/dist/cli/chunks/knowledge-graph-7JE2TVKJ.js +0 -2
  749. package/dist/cli/chunks/learning-7B5NITDV.js +0 -122
  750. package/dist/cli/chunks/llm-router-BNEPT5OB.js +0 -37
  751. package/dist/cli/chunks/llm-router-service-GTDVDKSU.js +0 -2
  752. package/dist/cli/chunks/load-test-JZ4CLSBF.js +0 -2
  753. package/dist/cli/chunks/mcp-THXEINCL.js +0 -2
  754. package/dist/cli/chunks/memory-backend-Q54CC5A5.js +0 -2
  755. package/dist/cli/chunks/memory-handlers-IIBJXKHZ.js +0 -2
  756. package/dist/cli/chunks/multi-model-executor-HEDVOZ6X.js +0 -14
  757. package/dist/cli/chunks/pattern-null-store-W33O7FYO.js +0 -2
  758. package/dist/cli/chunks/pipeline-UOG6UO6D.js +0 -19
  759. package/dist/cli/chunks/platform-Q7UH7FZQ.js +0 -2
  760. package/dist/cli/chunks/protocol-executor-VGN4M7XY.js +0 -2
  761. package/dist/cli/chunks/qe-reasoning-bank-7VB5LJGS.js +0 -2
  762. package/dist/cli/chunks/queen-coordinator-HIDMJMMG.js +0 -2
  763. package/dist/cli/chunks/real-embeddings-SF42ML7G.js +0 -2
  764. package/dist/cli/chunks/router-CTIJS4D7.js +0 -2
  765. package/dist/cli/chunks/routing-feedback-LFYYZS5J.js +0 -2
  766. package/dist/cli/chunks/rvf-dual-writer-MNPMIWVM.js +0 -2
  767. package/dist/cli/chunks/rvf-migration-adapter-DXOKSSNW.js +0 -2
  768. package/dist/cli/chunks/rvf-migration-coordinator-JT7ZCJY7.js +0 -2
  769. package/dist/cli/chunks/rvf-native-adapter-PZKUKA7R.js +0 -2
  770. package/dist/cli/chunks/rvf-store-integrity-Q3FGYKFT.js +0 -2
  771. package/dist/cli/chunks/safe-db-73BLFV2C.js +0 -2
  772. package/dist/cli/chunks/schedule-YVTGTTI4.js +0 -2
  773. package/dist/cli/chunks/scheduler-5DSAFIRQ.js +0 -2
  774. package/dist/cli/chunks/sqlite-persistence-LRG4IPCU.js +0 -2
  775. package/dist/cli/chunks/task-handler-L7E2I267.js +0 -49
  776. package/dist/cli/chunks/task-handlers-6DPKE4AK.js +0 -9
  777. package/dist/cli/chunks/test-scheduling-4CNJA6TW.js +0 -15
  778. package/dist/cli/chunks/token-bootstrap-GTI24JAL.js +0 -2
  779. package/dist/cli/chunks/types-TXMY5M2K.js +0 -2
  780. package/dist/cli/chunks/unified-memory-VBQ572X4.js +0 -2
  781. package/dist/cli/chunks/unified-memory-hnsw-J3L74ZRY.js +0 -2
  782. package/dist/cli/chunks/unified-persistence-EM2VYRTQ.js +0 -2
  783. package/dist/cli/chunks/visual-security-GX4S7K6O.js +0 -2
  784. package/dist/cli/chunks/witness-chain-QGKMHCNW.js +0 -2
  785. package/dist/cli/chunks/workflow-2OYNO7UU.js +0 -51
  786. package/dist/cli/chunks/workflow-orchestrator-KWHIJMFV.js +0 -2
@@ -4,16 +4,16 @@
4
4
  * A REAL test executor that actually runs tests using Vitest.
5
5
  * No simulation. No fake data. Real test execution.
6
6
  */
7
- import { spawn } from 'child_process';
7
+ import { execFile, spawn } from 'child_process';
8
8
  import { safeJsonParse } from '../../shared/safe-json.js';
9
+ import { getTestRunnerExecutionError } from '../../shared/test-runner-verdict.js';
9
10
  import { createVitestJsonReport } from '../../shared/vitest-json-report.js';
10
11
  // ============================================================================
11
12
  // Vitest Executor Implementation
12
13
  // ============================================================================
13
14
  export class VitestPhaseExecutor {
14
15
  config;
15
- currentProcess = null;
16
- isAborted = false;
16
+ currentCommand = null;
17
17
  constructor(config = {}) {
18
18
  this.config = config;
19
19
  }
@@ -21,7 +21,6 @@ export class VitestPhaseExecutor {
21
21
  // PhaseExecutor Interface
22
22
  // --------------------------------------------------------------------------
23
23
  async execute(phase, testFiles) {
24
- this.isAborted = false;
25
24
  const startTime = Date.now();
26
25
  try {
27
26
  const args = this.buildArgs(phase, testFiles);
@@ -48,11 +47,7 @@ export class VitestPhaseExecutor {
48
47
  return 'vitest-executor';
49
48
  }
50
49
  async abort() {
51
- this.isAborted = true;
52
- if (this.currentProcess) {
53
- this.currentProcess.kill('SIGTERM');
54
- this.currentProcess = null;
55
- }
50
+ await this.currentCommand?.terminate(new Error('Test execution aborted'));
56
51
  }
57
52
  // --------------------------------------------------------------------------
58
53
  // Private Methods
@@ -101,15 +96,22 @@ export class VitestPhaseExecutor {
101
96
  const report = createVitestJsonReport();
102
97
  let document;
103
98
  let exitCode;
99
+ let stderr;
104
100
  try {
105
101
  const run = await this.runCommand(this.config.vitestPath || 'npx', [...args, ...report.args], timeoutMs);
106
102
  exitCode = run.exitCode;
107
- document = report.read(run.stdout);
103
+ stderr = run.stderr;
104
+ const currentReport = report.read(run.stdout);
105
+ if (currentReport === undefined) {
106
+ throw new Error('The current Vitest JSON report is missing for this phase.');
107
+ }
108
+ document = currentReport;
108
109
  }
109
110
  finally {
110
111
  report.cleanup();
111
112
  }
112
113
  // Parse JSON report from Vitest
114
+ let result;
113
115
  try {
114
116
  const jsonStart = document.indexOf('{');
115
117
  const jsonEnd = document.lastIndexOf('}');
@@ -117,9 +119,9 @@ export class VitestPhaseExecutor {
117
119
  throw new Error('No JSON output from Vitest');
118
120
  }
119
121
  const jsonStr = document.slice(jsonStart, jsonEnd + 1);
120
- return safeJsonParse(jsonStr);
122
+ result = safeJsonParse(jsonStr);
121
123
  }
122
- catch (parseError) {
124
+ catch {
123
125
  // If JSON parsing fails, create a basic result from exit code
124
126
  return {
125
127
  numTotalTestSuites: 0,
@@ -134,46 +136,154 @@ export class VitestPhaseExecutor {
134
136
  testResults: [],
135
137
  };
136
138
  }
139
+ const executionError = getTestRunnerExecutionError('vitest', 'phase', exitCode, {
140
+ passed: result.numPassedTests,
141
+ failed: result.numFailedTests,
142
+ skipped: result.numPendingTests,
143
+ }, stderr, result);
144
+ if (executionError)
145
+ throw executionError;
146
+ return result;
137
147
  }
138
148
  runCommand(command, args, timeoutMs) {
139
- return new Promise((resolve, reject) => {
140
- let stdout = '';
141
- let stderr = '';
142
- // Security: shell: false prevents command injection through arguments
143
- // Cross-platform: Use .cmd extension on Windows for npm scripts
144
- const executable = process.platform === 'win32' && command === 'npx'
145
- ? 'npx.cmd'
146
- : command;
147
- this.currentProcess = spawn(executable, args, {
148
- cwd: this.config.cwd || process.cwd(),
149
- env: { ...process.env, ...this.config.env },
150
- shell: false,
151
- });
152
- const timeout = setTimeout(() => {
153
- this.currentProcess?.kill('SIGTERM');
154
- reject(new Error(`Test execution timed out after ${timeoutMs}ms`));
155
- }, timeoutMs);
156
- this.currentProcess.stdout?.on('data', (data) => {
157
- stdout += data.toString();
158
- });
159
- this.currentProcess.stderr?.on('data', (data) => {
160
- stderr += data.toString();
161
- });
162
- this.currentProcess.on('close', (code) => {
163
- clearTimeout(timeout);
164
- this.currentProcess = null;
165
- if (this.isAborted) {
166
- reject(new Error('Test execution aborted'));
167
- }
168
- else {
169
- resolve({ stdout, stderr, exitCode: code ?? 1 });
149
+ if (this.currentCommand) {
150
+ return Promise.reject(new Error('Test executor already has an active process'));
151
+ }
152
+ // shell: false prevents argument injection. A fresh POSIX process group
153
+ // lets cancellation reach npx, Vitest, and the workers it started.
154
+ const executable = process.platform === 'win32' && command === 'npx' ? 'npx.cmd' : command;
155
+ const child = spawn(executable, args, {
156
+ cwd: this.config.cwd || process.cwd(),
157
+ env: { ...process.env, ...this.config.env },
158
+ shell: false,
159
+ detached: process.platform !== 'win32',
160
+ });
161
+ // Detached workers do not receive the terminal's SIGINT. The CLI may
162
+ // exit synchronously from its signal handler, so kill this owned group
163
+ // synchronously while the command is active.
164
+ const stopOnExit = () => {
165
+ if (child.pid) {
166
+ try {
167
+ process.kill(-child.pid, 'SIGKILL');
170
168
  }
171
- });
172
- this.currentProcess.on('error', (error) => {
169
+ catch { /* already exited */ }
170
+ }
171
+ };
172
+ if (process.platform !== 'win32')
173
+ process.once('exit', stopOnExit);
174
+ let stdout = '';
175
+ let stderr = '';
176
+ let exitCode = 1;
177
+ let terminalError;
178
+ let terminationError;
179
+ let termination;
180
+ let rejectTermination;
181
+ const terminationFailed = new Promise((_, reject) => { rejectTermination = reject; });
182
+ child.stdout?.on('data', data => { stdout += data.toString(); });
183
+ child.stderr?.on('data', data => { stderr += data.toString(); });
184
+ const closed = new Promise((resolve, reject) => {
185
+ child.once('close', code => { exitCode = code ?? 1; resolve(); });
186
+ child.once('error', reject);
187
+ });
188
+ const active = {
189
+ terminate: (reason) => {
190
+ terminalError ??= reason;
191
+ termination ??= this.terminateProcessTree(child, closed).catch(error => {
192
+ terminationError = error;
193
+ rejectTermination(error);
194
+ throw error;
195
+ });
196
+ return termination;
197
+ },
198
+ };
199
+ this.currentCommand = active;
200
+ const timeout = setTimeout(() => {
201
+ void active.terminate(new Error(`Test execution timed out after ${timeoutMs}ms`)).catch(() => { });
202
+ }, timeoutMs);
203
+ return (async () => {
204
+ try {
205
+ // A failed kill must settle the phase even if the child never closes.
206
+ await Promise.race([closed, terminationFailed]);
207
+ if (termination)
208
+ await termination;
209
+ if (terminalError)
210
+ throw terminalError;
211
+ return { stdout, stderr, exitCode };
212
+ }
213
+ finally {
173
214
  clearTimeout(timeout);
174
- this.currentProcess = null;
175
- reject(error);
215
+ if (process.platform !== 'win32')
216
+ process.removeListener('exit', stopOnExit);
217
+ // A failed kill leaves an unknown survivor. Keep this executor closed
218
+ // to new work rather than replacing the only handle to that tree.
219
+ if (this.currentCommand === active && !terminationError)
220
+ this.currentCommand = null;
221
+ }
222
+ })();
223
+ }
224
+ async terminateProcessTree(child, closed) {
225
+ const pid = child.pid;
226
+ if (!pid) {
227
+ await closed;
228
+ return;
229
+ }
230
+ if (process.platform === 'win32') {
231
+ // taskkill /T follows the descendant tree; killing only npx.cmd leaves
232
+ // its Vitest child running. There is no POSIX-style process group here.
233
+ await new Promise((resolve, reject) => {
234
+ execFile('taskkill', ['/PID', String(pid), '/T', '/F'], { timeout: 2000 }, error => {
235
+ if (error)
236
+ reject(error);
237
+ else
238
+ resolve();
239
+ });
176
240
  });
241
+ await this.waitForClose(closed, 2000);
242
+ return;
243
+ }
244
+ this.signalGroup(pid, 'SIGTERM');
245
+ const requestedGrace = this.config.terminationGraceMs;
246
+ const graceMs = requestedGrace !== undefined && Number.isFinite(requestedGrace)
247
+ ? Math.max(0, Math.min(requestedGrace, 30_000))
248
+ : 1000;
249
+ if (!await this.waitForGroupExit(pid, graceMs)) {
250
+ this.signalGroup(pid, 'SIGKILL');
251
+ if (!await this.waitForGroupExit(pid, 2000)) {
252
+ throw new Error(`Test process group ${pid} survived SIGKILL`);
253
+ }
254
+ }
255
+ await this.waitForClose(closed, 2000);
256
+ }
257
+ signalGroup(pid, signal) {
258
+ try {
259
+ if (!process.kill(-pid, signal))
260
+ throw new Error(`Failed to send ${signal} to test process group ${pid}`);
261
+ }
262
+ catch (error) {
263
+ if (error.code !== 'ESRCH')
264
+ throw error;
265
+ }
266
+ }
267
+ async waitForGroupExit(pid, timeoutMs) {
268
+ const deadline = Date.now() + timeoutMs;
269
+ for (;;) {
270
+ try {
271
+ process.kill(-pid, 0);
272
+ }
273
+ catch (error) {
274
+ if (error.code === 'ESRCH')
275
+ return true;
276
+ throw error;
277
+ }
278
+ if (Date.now() >= deadline)
279
+ return false;
280
+ await new Promise(resolve => setTimeout(resolve, 25));
281
+ }
282
+ }
283
+ async waitForClose(closed, timeoutMs) {
284
+ await new Promise((resolve, reject) => {
285
+ const timer = setTimeout(() => reject(new Error('Test process did not close after termination')), timeoutMs);
286
+ closed.then(() => { clearTimeout(timer); resolve(); }, error => { clearTimeout(timer); reject(error); });
177
287
  });
178
288
  }
179
289
  async parseResult(phase, vitestResult, durationMs) {
@@ -12,6 +12,7 @@
12
12
  */
13
13
  import { spawn } from 'child_process';
14
14
  import { resolve, dirname, basename } from 'path';
15
+ import { assertSafeGitRef } from '../../shared/git/ref-validation.js';
15
16
  // ============================================================================
16
17
  // Default Mapping Rules
17
18
  // ============================================================================
@@ -72,6 +73,7 @@ export class GitAwareTestSelector {
72
73
  }
73
74
  this.cwd = config.cwd || process.cwd();
74
75
  this.baseRef = config.baseRef || 'HEAD~1';
76
+ assertSafeGitRef(this.baseRef, 'base ref');
75
77
  this.mappingRules = config.mappingRules || DEFAULT_MAPPING_RULES;
76
78
  this.impactAnalyzer = config.impactAnalyzer;
77
79
  }
@@ -175,6 +177,7 @@ export class GitAwareTestSelector {
175
177
  * Get the merge base between current branch and main
176
178
  */
177
179
  async getMergeBase(targetBranch = 'main') {
180
+ assertSafeGitRef(targetBranch, 'target branch');
178
181
  try {
179
182
  const output = await this.git(['merge-base', 'HEAD', targetBranch]);
180
183
  return output.trim();
@@ -46,6 +46,7 @@ export declare class PhaseScheduler {
46
46
  private startTime?;
47
47
  private endTime?;
48
48
  private abortController?;
49
+ private abortRequested;
49
50
  constructor(executor: PhaseExecutor, config?: SchedulerConfig);
50
51
  /**
51
52
  * Run all test phases sequentially
@@ -21,6 +21,7 @@ export class PhaseScheduler {
21
21
  startTime;
22
22
  endTime;
23
23
  abortController;
24
+ abortRequested = false;
24
25
  constructor(executor, config = {
25
26
  phases: DEFAULT_TEST_PHASES,
26
27
  failFast: true,
@@ -45,6 +46,7 @@ export class PhaseScheduler {
45
46
  this.results = [];
46
47
  this.startTime = new Date();
47
48
  this.abortController = new AbortController();
49
+ this.abortRequested = false;
48
50
  try {
49
51
  for (const phase of this.config.phases) {
50
52
  // Check if paused (pause() can be called externally during execution)
@@ -56,6 +58,9 @@ export class PhaseScheduler {
56
58
  break;
57
59
  }
58
60
  const result = await this.executePhaseWithRetry(phase);
61
+ if (this.abortRequested) {
62
+ throw new Error('Phase aborted');
63
+ }
59
64
  this.results.push(result);
60
65
  this.currentPhaseIndex++;
61
66
  this.config.onPhaseComplete?.(result);
@@ -64,13 +69,19 @@ export class PhaseScheduler {
64
69
  break;
65
70
  }
66
71
  }
72
+ if (this.abortRequested) {
73
+ throw new Error('Phase aborted');
74
+ }
67
75
  this.endTime = new Date();
68
76
  this.state = this.results.every((r) => r.success) ? 'completed' : 'failed';
69
77
  this.config.onAllComplete?.(this.results);
70
78
  return this.results;
71
79
  }
72
80
  catch (error) {
73
- this.state = 'failed';
81
+ // abort() owns the final state after its executor has actually stopped.
82
+ // Until then, do not report a successful or quiesced scheduler run.
83
+ if (!this.abortRequested)
84
+ this.state = 'failed';
74
85
  this.endTime = new Date();
75
86
  throw error;
76
87
  }
@@ -83,6 +94,7 @@ export class PhaseScheduler {
83
94
  if (!phase) {
84
95
  throw new Error(`Phase not found: ${phaseId}`);
85
96
  }
97
+ this.abortRequested = false;
86
98
  return this.executePhaseWithRetry(phase);
87
99
  }
88
100
  /**
@@ -105,6 +117,7 @@ export class PhaseScheduler {
105
117
  * Abort execution immediately
106
118
  */
107
119
  async abort() {
120
+ this.abortRequested = true;
108
121
  this.abortController?.abort();
109
122
  await this.executor.abort();
110
123
  this.state = 'idle';
@@ -143,13 +156,22 @@ export class PhaseScheduler {
143
156
  let lastResult;
144
157
  const maxAttempts = this.config.retryFailedPhases ? this.config.maxRetries : 1;
145
158
  for (let attempt = 1; attempt <= maxAttempts; attempt++) {
159
+ if (this.abortRequested) {
160
+ throw new Error('Phase aborted');
161
+ }
146
162
  try {
147
163
  lastResult = await this.executor.execute(phase);
164
+ if (this.abortRequested) {
165
+ throw new Error('Phase aborted');
166
+ }
148
167
  if (lastResult.success || !this.config.retryFailedPhases) {
149
168
  return lastResult;
150
169
  }
151
170
  }
152
171
  catch (error) {
172
+ if (this.abortRequested) {
173
+ throw new Error('Phase aborted');
174
+ }
153
175
  this.config.onError?.(error, phase);
154
176
  if (attempt === maxAttempts) {
155
177
  return this.createErrorResult(phase, error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.14.3",
3
+ "version": "3.14.5",
4
4
  "description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -193,6 +193,7 @@
193
193
  "pg": "^8.17.2",
194
194
  "prime-radiant-advanced-wasm": "^0.1.3",
195
195
  "secure-json-parse": "^4.1.0",
196
+ "semver": "^7.8.5",
196
197
  "typescript": "^5.9.3",
197
198
  "uuid": "^14.0.0",
198
199
  "vibium": "^0.1.2",
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a,b,c}from"./chunk-LTBCAFTZ.js";import"./chunk-CR3QGHVN.js";import"./chunk-SGXSB7YO.js";import"./chunk-YAKS3CAB.js";import"./chunk-HRUU7E3D.js";import"./chunk-Y2DVFVGI.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-IQEJGZV6.js";import"./chunk-B2ZONZPZ.js";import"./chunk-IU4EBTA2.js";import"./chunk-IFFZR6GY.js";import"./chunk-7Y2CEXRS.js";import"./chunk-7BUERZYL.js";import"./chunk-HXE5NBJG.js";import"./chunk-EY4OQHU3.js";import"./chunk-NBWQBQO5.js";import"./chunk-I4NDQGKP.js";import"./chunk-3ABRGG3C.js";import"./chunk-SJPZSCZP.js";import"./chunk-OV5EZO3U.js";import"./chunk-VWNHKYK7.js";import"./chunk-PZTVH2AS.js";import"./chunk-26GM5CWD.js";import"./chunk-TFHQE6NK.js";import"./chunk-4RP5VUBI.js";import"./chunk-5F6DWHQG.js";import"./chunk-L2GKMBDP.js";import"./chunk-72UJXEKQ.js";import"./chunk-Y5SQBI2F.js";import"./chunk-YAKS3CAB.js";import"./chunk-4JBFJTHJ.js";import"./chunk-LKN7JQTW.js";import"./chunk-6F2RM6X2.js";import"./chunk-C46DMCWF.js";import"./chunk-HRUU7E3D.js";import"./chunk-OYMLHX2B.js";import"./chunk-MXMFGSWR.js";import"./chunk-VIDBBB6F.js";import"./chunk-PI74GOE4.js";import"./chunk-5IAB5NRZ.js";import"./chunk-OVDKWCD7.js";import"./chunk-XA7CG3LH.js";import"./chunk-YEXPFHV6.js";import"./chunk-IP7NSFQQ.js";import"./chunk-T35GZXTU.js";import"./chunk-Y2DVFVGI.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-44WISFTU.js";import"./chunk-74PK3NEW.js";import"./chunk-TFHQE6NK.js";import"./chunk-4RP5VUBI.js";import"./chunk-5F6DWHQG.js";import"./chunk-L2GKMBDP.js";import"./chunk-72UJXEKQ.js";import"./chunk-Y5SQBI2F.js";import"./chunk-YAKS3CAB.js";import"./chunk-HRUU7E3D.js";import"./chunk-OYMLHX2B.js";import"./chunk-5Y5TC6BY.js";import"./chunk-MXMFGSWR.js";import"./chunk-VIDBBB6F.js";import"./chunk-PI74GOE4.js";import"./chunk-5IAB5NRZ.js";import"./chunk-OVDKWCD7.js";import"./chunk-XA7CG3LH.js";import"./chunk-YEXPFHV6.js";import"./chunk-IP7NSFQQ.js";import"./chunk-T35GZXTU.js";import"./chunk-Y2DVFVGI.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
@@ -1,90 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a as q,b as W,c as H,d as x,e as re,f as j,g as K,h as I,i as ve,j as oe,k as z,l as Re,m as V,n as ae,o as Se,p as k,q as G,r as Q,s as X}from"./chunk-4XPPMADQ.js";import{h as we}from"./chunk-SJPZSCZP.js";import{b as he}from"./chunk-OV5EZO3U.js";import"./chunk-TFHQE6NK.js";import"./chunk-4RP5VUBI.js";import"./chunk-5F6DWHQG.js";import"./chunk-L2GKMBDP.js";import"./chunk-72UJXEKQ.js";import"./chunk-Y5SQBI2F.js";import{b as B,d as ne}from"./chunk-YAKS3CAB.js";import{a as ye,b as be,c as te,d as P,f as Xe}from"./chunk-LKN7JQTW.js";import"./chunk-HRUU7E3D.js";import{a as M,b as Qe}from"./chunk-MXMFGSWR.js";import"./chunk-VIDBBB6F.js";import"./chunk-PI74GOE4.js";import"./chunk-5IAB5NRZ.js";import"./chunk-OVDKWCD7.js";import"./chunk-XA7CG3LH.js";import"./chunk-YEXPFHV6.js";import"./chunk-IP7NSFQQ.js";import"./chunk-T35GZXTU.js";import"./chunk-Y2DVFVGI.js";import A from"path";import o from"chalk";Qe();ne();import{existsSync as Y,mkdirSync as Ye,writeFileSync as Ze,readFileSync as ie}from"fs";import{join as O,resolve as se}from"path";var en={rl_q_values:"includeQValues",dream_insights:"includeDreamInsights",dream_cycles:"includeDreamInsights",witness_chain:"includeWitnessChain",vectors:"includeVectors"};function nn(e,n){let r=en[e.tableName];return!(r&&n[r]===!1)}var tn=1e4;function rn(e,n,r,t){if(!nn(n,r))return ae(O(t,n.fileName),[]),{count:0,rows:[]};let[a,i]=n.domainColumn?V(r.domains,n.domainColumn):[void 0,[]];if(r.domains&&r.domains.length>0&&!n.domainColumn){let l=r.domains.map(()=>"?").join(","),f=`manifest_id IN (SELECT id FROM learning_evidence_manifests WHERE task_family IN (${l}))`;["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(n.tableName)?(a=f,i=[...r.domains]):["pattern_manifest_lineage","pattern_segment_lineage"].includes(n.tableName)&&(a=`${f} AND pattern_id IN (SELECT id FROM qe_patterns WHERE qe_domain IN (${l}))`,i=[...r.domains,...r.domains])}if(oe(e,n.tableName,a,i)>=tn){let l=n.blobColumns,f=l&&l.length>0?y=>j(y,l):void 0;return{count:Se(O(t,n.fileName),Re(e,n.tableName,a,i),f)}}let s=z(e,n.tableName,a,i);return n.blobColumns&&n.blobColumns.length>0&&(s=s.map(l=>j(l,n.blobColumns))),ae(O(t,n.fileName),s),{count:s.length,rows:s}}function xe(e){let n=[];for(let r of x){let t=O(e,r.fileName);Y(t)?n.push(I(ie(t,"utf-8"))):n.push(I(""))}return I(n.join(":"))}function Ce(e,n,r="memory.db"){let t=se(n.outputPath);Y(t)||Ye(t,{recursive:!0});let a=0,i={},c=new Set;for(let u of x){let y=rn(e,u,n,t);if(i[u.tableName]=y.count,a+=y.count,u.tableName==="qe_patterns"){if(y.rows)for(let m of y.rows)m.qe_domain&&c.add(m.qe_domain);else if(y.count>0){let[m,R]=u.domainColumn?V(n.domains,u.domainColumn):[void 0,[]],p=`SELECT DISTINCT qe_domain FROM qe_patterns ${m?`WHERE ${m} AND qe_domain IS NOT NULL`:"WHERE qe_domain IS NOT NULL"}`;try{let g=e.prepare(p).all(...R||[]);for(let S of g)c.add(S.qe_domain)}catch{}}}}let s=n.includeVectors!==!1?oe(e,"vectors"):0,l=xe(t),f={version:"3.0",exportedAt:new Date().toISOString(),sourceDb:r,stats:{patternCount:i.qe_patterns||0,vectorCount:s,qValueCount:i.rl_q_values||0,dreamInsightCount:i.dream_insights||0,witnessChainLength:i.witness_chain||0,totalRecords:a},domains:[...c].sort(),checksum:l,tableRecordCounts:i};return Ze(O(t,"manifest.json"),JSON.stringify(f,null,2),"utf-8"),f}var on=new Set(["qe_patterns","rl_q_values","dream_insights","witness_chain"]);function an(e){return e==="1.0"?x.filter(n=>on.has(n.tableName)):e==="3.0"?x:(console.warn(`[brain-import] Unknown manifest version '${e}'. Attempting full import \u2014 some files may be missing.`),x)}function _e(e,n,r){let t=se(n),a=O(t,"manifest.json");if(!Y(a))throw new Error(`Manifest not found at ${a}`);let i=B(ie(a,"utf-8")),c=xe(t);if(c!==i.checksum)throw new Error(`Checksum mismatch: expected ${i.checksum}, got ${c}. The export may have been tampered with or corrupted.`);let s=an(i.version);if(r.dryRun){let m=0;for(let R of s){let d=k(O(t,R.fileName),B);m+=d.length}return{imported:m,skipped:0,conflicts:0}}X(e);let l=0,f=0,u=0;return e.transaction(()=>{for(let m of s){let R=O(t,m.fileName),d=k(R,B);m.blobColumns&&m.blobColumns.length>0&&(d=d.map(p=>K(p,m.blobColumns)));for(let p of d){let g;if(m.dedupColumns&&m.dedupColumns.length>0)g=Q(e,m.tableName,p,m.dedupColumns,m.preserveId);else{let S=q[m.tableName]||"id",h=H[m.tableName],$=W[m.tableName];g=G(e,m.tableName,p,S,r.mergeStrategy,h,$)}l+=g.imported,f+=g.skipped,u+=g.conflicts}}})(),{imported:l,skipped:f,conflicts:u}}function Ee(e){let n=se(e),r=O(n,"manifest.json");if(!Y(r))throw new Error(`Manifest not found at ${r}`);return B(ie(r,"utf-8"))}Xe();import{existsSync as F,readdirSync as sn,renameSync as ln,statSync as cn,unlinkSync as le,writeFileSync as dn}from"fs";import{basename as fn,dirname as mn,join as un,resolve as Z}from"path";var Ie=["",".idmap.json",".manifest.json"],pn=[...Ie,".lock"];function Be(e){for(let n of pn)try{let r=`${e}${n}`;F(r)&&le(r)}catch{}}function gn(e){let n=mn(e),r=`${fn(e)}.tmp.`,t;try{t=sn(n)}catch{return}for(let a of t){if(!a.startsWith(r))continue;let i=Number.parseInt(a.slice(r.length).split(".")[0],10);if(!(!Number.isInteger(i)||i<=0)&&!(i!==process.pid&&yn(i)))try{le(un(n,a))}catch{}}}function yn(e){try{return process.kill(e,0),!0}catch(n){return n.code==="EPERM"}}function Oe(e,n,r="memory.db"){if(!P())throw new Error("@ruvector/rvf-node is not available. Install it or use --format jsonl instead.");let t=Z(n.outputPath),a=n.dimension??384,i=`${t}.tmp.${process.pid}`;gn(t),Be(i);let c=ye(i,a),s=!1;try{let l={},f=new Set,u=0;for(let b of x){let[C,v]=b.domainColumn?V(n.domains,b.domainColumn):[void 0,[]],_=z(e,b.tableName,C,v);if(n.domains&&n.domains.length>0){let w=new Set((l.learning_evidence_manifests??[]).map(E=>E.id)),T=new Set((l.qe_patterns??[]).map(E=>E.id));["learning_evidence_segments","learning_segment_edges","learning_evidence_admissions"].includes(b.tableName)?_=_.filter(E=>w.has(E.manifest_id)):b.tableName==="pattern_manifest_lineage"?_=_.filter(E=>{let N=E;return w.has(N.manifest_id)&&T.has(N.pattern_id)}):b.tableName==="pattern_segment_lineage"&&(_=_.filter(E=>{let N=E;return w.has(N.manifest_id)&&T.has(N.pattern_id)}))}if(b.tableName==="qe_patterns")for(let w of _)w.qe_domain&&f.add(w.qe_domain);let D=re[b.tableName];D&&D.length>0&&(_=_.map(w=>j(w,D))),l[b.tableName]=_,u+=_.length}let y=0,m=[];if(ve(e,"qe_pattern_embeddings")){let b=e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(v=>v.name==="space_id"),C=e.prepare(`SELECT pattern_id, embedding, dimension, ${b?"space_id":"NULL"} AS space_id
3
- FROM qe_pattern_embeddings`).all();for(let v of C)v.embedding&&v.dimension===a&&v.space_id&&m.push({id:`pe:${v.pattern_id}`,vector:new Float32Array(v.embedding.buffer,v.embedding.byteOffset,a),metadata:{tableName:"qe_pattern_embeddings",spaceId:v.space_id}})}m.length>0&&(y=c.ingest(m).accepted);let R={version:"3.0",format:"rvf",exportedAt:new Date().toISOString(),sourceDb:r,domains:[...f].sort(),tables:l},d=JSON.stringify(R),p=I(d),g=Buffer.from(d);c.embedKernel(g);let S=n.sign?c.sign(g)??void 0:void 0,h=S?n.signerKeyId??"default":void 0,$=c.fileId(),U=$?{fileId:$,parentId:c.parentId(),lineageDepth:c.lineageDepth()}:void 0,L=c.status(),ee={version:"3.0",format:"rvf",exportedAt:R.exportedAt,sourceDb:r,stats:{patternCount:(l.qe_patterns||[]).length,embeddingCount:y,qValueCount:(l.rl_q_values||[]).length,dreamInsightCount:(l.dream_insights||[]).length,witnessChainLength:(l.witness_chain||[]).length,totalRecords:u,tableCounts:Object.fromEntries(x.map(({tableName:b})=>[b,l[b]?.length??0]))},domains:R.domains,checksum:p,rvfStatus:{totalVectors:L.totalVectors,totalSegments:L.totalSegments,fileSizeBytes:L.fileSizeBytes},...S?{signature:S,signerKeyId:h}:{},...U?{lineage:U}:{}};if(S)try{c.freeze()}catch{}if(dn(`${i}.manifest.json`,JSON.stringify(ee,null,2),"utf-8"),c.close(),s=!0,F(t)&&!n.allowOverwriteRicher){let b;try{b=J(t)}catch(C){if(bn(t)||!hn(C)){let v=C instanceof Error?C.message:String(C);throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: the existing mirror is readable but its richness could not be established (${v}). Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`)}}if(b){let C=b.stats.tableCounts,v=ee.stats.tableCounts,_=x.map(({tableName:w})=>w).filter(w=>!C||!Number.isSafeInteger(C[w]));if(_.length>0)throw new Error(`RVF_MIRROR_INSPECTION_AMBIGUOUS: existing mirror lacks trustworthy counts for ${_.join(", ")}. Preserve/import it before retrying, or repeat with --force-overwrite-richer after preserving a backup.`);let D=x.map(({tableName:w})=>({tableName:w,existing:C[w],candidate:v[w]})).filter(({existing:w,candidate:T})=>w>T);if(D.length>0){let w=D.map(({tableName:T,existing:E,candidate:N})=>`${T} ${E} -> ${N}`).join(", ");throw new Error(`RVF_MIRROR_RICHER: refusing to replace richer mirrored tables: ${w}. Restore/import the mirror first, or repeat with --force-overwrite-richer after preserving a backup.`)}}}for(let b of[...Ie].reverse()){let C=`${i}${b}`,v=`${t}${b}`;F(C)?ln(C,v):F(v)&&le(v)}return ee}catch(l){if(!s)try{c.close()}catch{}throw Be(i),l}}function bn(e){let n;try{return n=te(Z(e)),!!n.extractKernel()?.image}catch{return!1}finally{try{n?.close()}catch{}}}function hn(e){let n=e instanceof Error?e.message:String(e);return/ManifestNotFound|InvalidMagic|ChecksumMismatch|CorruptStore/i.test(n)}var wn={patterns:"qe_patterns",qValues:"rl_q_values",dreamInsights:"dream_insights",witnessChain:"witness_chain"};function Ae(e,n,r){if(!P())throw new Error("@ruvector/rvf-node is not available. Install it or use JSONL format.");let t=Z(n);if(!F(t))throw new Error(`RVF file not found: ${t}`);let a=be(t);try{let i=a.verifyWitness();if(!i.valid&&(i.totalEntries>0||i.errors.length>0)){let d=i.errors.length>0?i.errors.join("; "):"unknown integrity error";throw new Error(`RVF witness verification failed: ${d}`)}let c=a.extractKernel();if(!c||!c.image)throw new Error("No brain data found in RVF file (missing kernel segment)");let s;try{s=JSON.parse(c.image.toString("utf-8"))}catch(d){throw new Error(`Failed to parse brain kernel data as JSON: ${d instanceof Error?d.message:d}`)}if(r.dryRun){let d=0;if(s.tables)for(let p of Object.values(s.tables))d+=p?.length??0;else d=(s.patterns?.length??0)+(s.qValues?.length??0)+(s.dreamInsights?.length??0)+(s.witnessChain?.length??0);return{imported:d,skipped:0,conflicts:0,embeddingsRestored:0}}X(e);let l=0,f=0,u=0,y=0,m={};if(s.tables)Object.assign(m,s.tables);else for(let[d,p]of Object.entries(wn)){let g=s[d];Array.isArray(g)&&(m[p]=g)}if(e.transaction(()=>{for(let d of x){let p=m[d.tableName];if(!p||!Array.isArray(p))continue;let g=re[d.tableName];if(g&&g.length>0){p=p.map(S=>K(S,g));for(let S of p)for(let h of g)S[h]instanceof Buffer&&y++}for(let S of p){let h;if(d.dedupColumns&&d.dedupColumns.length>0)h=Q(e,d.tableName,S,d.dedupColumns,d.preserveId);else{let $=q[d.tableName]||"id",U=H[d.tableName],L=W[d.tableName];h=G(e,d.tableName,S,$,r.mergeStrategy,U,L)}l+=h.imported,f+=h.skipped,u+=h.conflicts}}})(),u>0)try{a.compact()}catch{}return{imported:l,skipped:f,conflicts:u,embeddingsRestored:y}}finally{a.close()}}function J(e){if(!P())throw new Error("@ruvector/rvf-node is not available.");let n=Z(e);if(!F(n))throw new Error(`RVF file not found: ${n}`);let r=te(n);try{let t=r.extractKernel();if(!t||!t.image)throw new Error("No brain data found in RVF file");let a=t.image.toString("utf-8"),i;try{i=JSON.parse(a)}catch(d){throw new Error(`Failed to parse brain kernel data as JSON: ${d instanceof Error?d.message:d}`)}let c=r.status(),s=cn(n).size,l=i.tables,f=l?l.qe_patterns?.length??0:i.patterns?.length??0,u=l?l.rl_q_values?.length??0:i.qValues?.length??0,y=l?l.dream_insights?.length??0:i.dreamInsights?.length??0,m=l?l.witness_chain?.length??0:i.witnessChain?.length??0,R=l&&typeof l=="object"&&!Array.isArray(l)?Object.fromEntries(Object.entries(l).filter(d=>Array.isArray(d[1])).map(([d,p])=>[d,p.length])):void 0;return{version:"3.0",format:"rvf",exportedAt:i.exportedAt??"unknown",sourceDb:i.sourceDb??"unknown",stats:{patternCount:f,embeddingCount:c.totalVectors,qValueCount:u,dreamInsightCount:y,witnessChainLength:m,...R?{tableCounts:R}:{}},domains:i.domains??[],checksum:I(a),rvfStatus:{totalVectors:c.totalVectors,totalSegments:c.totalSegments,fileSizeBytes:s}}}finally{r.close()}}function ce(){return P()}ne();import{existsSync as fe,readFileSync as vn,statSync as Rn}from"fs";import{join as de,resolve as Ne}from"path";function Te(e,n,r={}){let t=Ne(e),a=Ne(n),i=ke(t),c=ke(a),s=$e(t,i),l=$e(a,c),f=i==="jsonl"&&c==="jsonl",u=Cn({pathA:t,pathB:a,manifestA:s,manifestB:l,recordLevel:f,tableFilter:r.tableFilter,maxIdsPerBucket:r.maxIdsPerBucket??500}),y=new Set(s.domains),m=new Set(l.domains),R=s.domains.filter(h=>!m.has(h)),d=l.domains.filter(h=>!y.has(h)),p=s.checksum===l.checksum,g=s.version===l.version,S=p&&g&&u.every(h=>h.delta===0&&(h.added?.length??0)===0&&(h.removed?.length??0)===0&&(h.changed?.length??0)===0);return{pathA:t,pathB:a,formatA:i,formatB:c,manifestA:s,manifestB:l,checksumMatch:p,versionMatch:g,identical:S,recordLevel:f,tableDiffs:u,domainsOnlyInA:R,domainsOnlyInB:d}}function ke(e){if(!fe(e))throw new Error(`Path not found: ${e}`);if(e.endsWith(".rvf"))return"rvf";if(Rn(e).isFile())throw new Error(`Unsupported brain export: ${e} (expected a .rvf file or a JSONL directory)`);return"jsonl"}function $e(e,n){return n==="rvf"?xn(e):Sn(e)}function Sn(e){let n=de(e,"manifest.json");if(!fe(n))throw new Error(`Manifest not found at ${n}`);let r=B(vn(n,"utf-8"));return Me(r,"jsonl")}function xn(e){let n=J(e);return Me(n,"rvf")}function Me(e,n){return{format:n,version:e.version??"unknown",exportedAt:e.exportedAt??"unknown",sourceDb:e.sourceDb??"unknown",checksum:e.checksum??"",totalRecords:e.stats?.totalRecords??0,domains:e.domains??[],tableRecordCounts:e.tableRecordCounts??{}}}function Cn(e){let n=e.tableFilter?x.filter(t=>t.tableName===e.tableFilter):x;if(e.tableFilter&&n.length===0)throw new Error(`Unknown table: ${e.tableFilter}`);let r=[];for(let t of n){let a=e.manifestA.tableRecordCounts[t.tableName]??0,i=e.manifestB.tableRecordCounts[t.tableName]??0,c=i-a,s,l,f;if(e.recordLevel&&_n(t)){let u=En(de(e.pathA,t.fileName),de(e.pathB,t.fileName),t,e.maxIdsPerBucket);s=u.added,l=u.removed,f=u.changed}r.push({tableName:t.tableName,countA:a,countB:i,delta:c,...s!==void 0?{added:s}:{},...l!==void 0?{removed:l}:{},...f!==void 0?{changed:f}:{}})}return r}function _n(e){return!0}function En(e,n,r,t){let a=De(e,r),i=De(n,r),c=[],s=[],l=[];for(let[f,u]of a){let y=i.get(f);if(y===void 0)s.length<t&&s.push(f);else if(y!==u){if(r.dedupColumns&&r.dedupColumns.length>0)continue;l.length<t&&l.push(f)}}for(let f of i.keys())a.has(f)||c.length<t&&c.push(f);return c.sort(),s.sort(),l.sort(),{added:c,removed:s,changed:l}}function De(e,n){let r=new Map;if(!fe(e))return r;let t=k(e,B);for(let a of t){let i=Bn(a,n);if(i===void 0)continue;let c=In(a);r.set(i,On(c))}return r}function Bn(e,n){if(n.dedupColumns&&n.dedupColumns.length>0){let a=[];for(let i of n.dedupColumns){let c=e[i];if(c==null)return;a.push(String(c))}return a.join("")}let r=q[n.tableName]??"id",t=e[r];if(t!=null)return String(t)}function In(e){let n=Object.keys(e).sort(),r={};for(let t of n)r[t]=e[t];return JSON.stringify(r)}function On(e){return I(e)}ne();import{existsSync as me,statSync as An}from"fs";import{join as qe,resolve as Nn}from"path";var kn=20,$n="qe_patterns";function Fe(e,n={}){let r=Nn(e);Mn(r);let t=n.table??$n,a=x.find(g=>g.tableName===t);if(!a)throw new Error(`Unknown table: ${t}`);let i=qe(r,a.fileName);if(!me(i))throw new Error(`Table file not found: ${a.fileName} (expected in ${r}). Was this export generated with --format jsonl?`);let c=k(i,B),s=a.domainColumn,l=Math.max(1,n.limit??kn),f=n.query?n.query.toLowerCase():void 0,u=n.domains&&n.domains.length>0?new Set(n.domains):void 0,y=n.since,m=n.until,R=n.patternType,d=0,p=[];for(let g of c)Dn(g,{domainColumn:s,domains:u,patternType:R,since:y,until:m,queryLower:f})&&(d++,p.length<l&&p.push(Tn(g,a.tableName,s)));return{table:t,inputPath:r,totalScanned:c.length,totalMatched:d,limit:l,hits:p,truncated:d>l}}function Dn(e,n){if(n.domains){if(!n.domainColumn)return!1;let r=e[n.domainColumn];if(typeof r!="string"||!n.domains.has(r))return!1}if(n.patternType!==void 0&&e.pattern_type!==n.patternType)return!1;if(n.since!==void 0||n.until!==void 0){let r=Le(e);if(r===void 0||n.since!==void 0&&r<n.since||n.until!==void 0&&r>n.until)return!1}if(n.queryLower!==void 0){let r=typeof e.name=="string"?e.name.toLowerCase():"",t=typeof e.description=="string"?e.description.toLowerCase():"";if(!r.includes(n.queryLower)&&!t.includes(n.queryLower))return!1}return!0}function Le(e){for(let n of["updated_at","created_at","timestamp"]){let r=e[n];if(typeof r=="string"&&r.length>0)return r}}function Tn(e,n,r){let t=(typeof e.id=="string"||typeof e.id=="number"?String(e.id):void 0)??`${n}:?`,a={name:typeof e.name=="string"?e.name:void 0,description:typeof e.description=="string"?e.description:void 0,domain:r&&typeof e[r]=="string"?e[r]:void 0,patternType:typeof e.pattern_type=="string"?e.pattern_type:void 0,confidence:typeof e.confidence=="number"?e.confidence:void 0,updatedAt:Le(e)};return{id:t,display:a,row:e}}function Mn(e){if(!me(e))throw new Error(`Path not found: ${e}`);if(An(e).isFile())throw e.endsWith(".rvf")?new Error("Brain search does not support RVF exports. Re-export with --format jsonl, or use `aqe brain info` for RVF summaries."):new Error(`Unsupported brain export: ${e} (expected a JSONL directory)`);let r=qe(e,"manifest.json");if(!me(r))throw new Error(`Manifest not found at ${r}. Is this a brain export directory?`)}function Pe(e,n){if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_patterns'").get())return{created:0,skipped:0};e.exec(`
4
- CREATE TEMP TABLE IF NOT EXISTS _covered_patterns (
5
- pattern_id TEXT PRIMARY KEY
6
- )
7
- `),e.exec("DELETE FROM _covered_patterns"),e.exec(`
8
- INSERT INTO _covered_patterns (pattern_id)
9
- SELECT DISTINCT json_extract(action_data, '$.patternId')
10
- FROM witness_chain
11
- WHERE action_type = 'PATTERN_CREATE'
12
- AND json_extract(action_data, '$.patternId') IS NOT NULL
13
- `),e.exec(`
14
- INSERT OR IGNORE INTO _covered_patterns (pattern_id)
15
- SELECT DISTINCT json_extract(action_data, '$.pattern_id')
16
- FROM witness_chain
17
- WHERE action_type = 'PATTERN_CREATE'
18
- AND json_extract(action_data, '$.pattern_id') IS NOT NULL
19
- `);let t=e.prepare(`SELECT p.id, p.pattern_type, p.qe_domain, p.name, p.created_at
20
- FROM qe_patterns p
21
- LEFT JOIN _covered_patterns c ON p.id = c.pattern_id
22
- WHERE c.pattern_id IS NULL
23
- ORDER BY p.created_at ASC`).all(),i=e.prepare("SELECT COUNT(*) as count FROM qe_patterns").get().count-t.length,c=0;for(let s of t)n.append("PATTERN_CREATE",{patternId:s.id,patternType:s.pattern_type,qeDomain:s.qe_domain,name:s.name,originalCreatedAt:s.created_at,backfilled:!0},"system:backfill"),c++;return e.exec("DROP TABLE IF EXISTS _covered_patterns"),{created:c,skipped:i}}async function je(e,n){if(qn(n.format)==="rvf"){let a=M(e,{readonly:!0});try{return Oe(a,{outputPath:n.outputPath,domains:n.domains,allowOverwriteRicher:n.allowOverwriteRicher},e)}finally{a.close()}}let t=M(e,{readonly:!0});try{return Ce(t,n,e)}finally{t.close()}}async function Ve(e,n,r){if(Ke(n,r.format)==="rvf"){let i=M(e);try{return Ae(i,n,{mergeStrategy:r.mergeStrategy,dryRun:r.dryRun})}finally{i.close()}}let a=M(e);try{return _e(a,n,r)}finally{a.close()}}async function Je(e,n){return Ke(e,n)==="rvf"?J(e):Ee(e)}async function Ue(e,n,r={}){return Te(e,n,r)}async function We(e,n={}){return Fe(e,n)}async function He(e){let n=M(e);try{let r=we(n,he());return await r.initialize(),Pe(n,r)}finally{n.close()}}function qn(e){if(e==="jsonl")return"jsonl";if(e==="rvf"){if(!ce())throw new Error("RVF format requested but @ruvector/rvf-node is not available on this platform. Use --format jsonl instead.");return"rvf"}return ce()?"rvf":"jsonl"}function Ke(e,n){return n==="rvf"?"rvf":n==="jsonl"?"jsonl":e.endsWith(".rvf")?"rvf":"jsonl"}var ge=class{name="brain";description="Export, import, and inspect QE brain state";cleanupAndExit;ensureInitialized;constructor(n,r){this.cleanupAndExit=n,this.ensureInitialized=r}register(n,r){let t=n.command("brain").description(this.description);t.command("export").description("Export brain state to a portable directory").requiredOption("-o, --output <path>","Output directory path").option("--format <format>","Export format: rvf (default) or jsonl","rvf").option("--db <path>","Source database path").option("--force-overwrite-richer","Allow replacing an existing RVF with fewer patterns",!1).action(async a=>{await this.executeExport(a)}),t.command("import").description("Import brain state from an export directory").requiredOption("-i, --input <path>","Path to brain export directory").option("--strategy <strategy>","Merge strategy","skip-conflicts").option("--dry-run","Preview import without writing",!1).option("--db <path>","Target database path").action(async a=>{await this.executeImport(a)}),t.command("info").description("Show manifest info for a brain export").requiredOption("-i, --input <path>","Path to brain export directory").action(async a=>{await this.executeInfo(a)}),t.command("witness-backfill").description("Create witness chain entries for patterns that predate the witness chain").option("--db <path>","Database path").action(async a=>{await this.executeWitnessBackfill(a)}),t.command("diff").description("Compare two brain exports (JSONL directory or .rvf file)").argument("<a>","Path to first brain export").argument("<b>","Path to second brain export").option("--table <name>","Restrict comparison to a single table").option("--verbose","Show the IDs of added/removed/changed records",!1).option("--json","Emit the diff as JSON to stdout",!1).action(async(a,i,c)=>{await this.executeDiff(a,i,c)}),t.command("search").description("Search a JSONL brain export with filters").requiredOption("-i, --input <path>","Path to brain export directory (JSONL)").option("--table <name>","Table to search (default: qe_patterns)").option("--domain <name...>","Restrict to one or more domains").option("--pattern-type <type>","Restrict to a specific pattern_type (qe_patterns only)").option("--since <iso>","Include rows with timestamp \u2265 <iso>").option("--until <iso>","Include rows with timestamp \u2264 <iso>").option("-q, --query <text>","Substring match across name + description (case-insensitive)").option("-l, --limit <n>","Maximum results to return","20").option("--json","Emit results as JSON to stdout",!1).action(async a=>{await this.executeSearch(a)})}async executeExport(n){try{console.log(o.blue(`
24
- Exporting brain state (format: ${n.format})...
25
- `));let r=await ue(n.db),t=await je(r,{outputPath:A.resolve(n.output),format:n.format,allowOverwriteRicher:n.forceOverwriteRicher});if(console.log(o.green(" Export complete.")),console.log(` Format: ${o.cyan("format"in t?t.format??"jsonl":"jsonl")}`),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"embeddingCount"in t.stats?console.log(` Vectors: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`),"rvfStatus"in t){let a=t.rvfStatus;console.log(` RVF Size: ${o.cyan(ze(a.fileSizeBytes))}`),console.log(` Segments: ${o.cyan(a.totalSegments)}`)}console.log(` Checksum: ${o.gray(t.checksum)}`),console.log(` Output: ${o.cyan(A.resolve(n.output))}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
26
- Brain export failed:`),r),await this.cleanupAndExit(1)}}async executeImport(n){try{n.dryRun?console.log(o.yellow(`
27
- Dry-run mode \u2014 no data will be written.
28
- `)):console.log(o.blue(`
29
- Importing brain state...
30
- `));let r=await ue(n.db),t=await Ve(r,A.resolve(n.input),{mergeStrategy:n.strategy,dryRun:n.dryRun});console.log(o.green(" Import complete.")),console.log(` Imported: ${o.cyan(t.imported)}`),console.log(` Skipped: ${o.yellow(t.skipped)}`),console.log(` Conflicts: ${o.red(t.conflicts)}`),"embeddingsRestored"in t&&console.log(` Embeddings: ${o.cyan(t.embeddingsRestored)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
31
- Brain import failed:`),r),await this.cleanupAndExit(1)}}async executeInfo(n){try{console.log(o.blue(`
32
- Brain Export Info
33
- `));let r=A.resolve(n.input),t=await Je(r),a="format"in t?t.format??"jsonl":"jsonl";if(console.log(` Version: ${o.cyan(t.version)}`),console.log(` Format: ${o.cyan(a)}`),console.log(` Exported: ${o.cyan(t.exportedAt)}`),console.log(` Source DB: ${o.cyan(t.sourceDb)}`),console.log(o.blue(`
34
- Learning Data:`)),console.log(` Patterns: ${o.cyan(t.stats.patternCount)}`),"qValueCount"in t.stats&&console.log(` Q-Values: ${o.cyan(t.stats.qValueCount)}`),"dreamInsightCount"in t.stats){let s=t.stats.dreamInsightCount,f=("tableRecordCounts"in t?t.tableRecordCounts:void 0)?.dream_cycles,u=f!==void 0?` (${f} cycles)`:"";console.log(` Dream Insights: ${o.cyan(s)}${o.gray(u)}`)}"witnessChainLength"in t.stats&&console.log(` Witness Chain: ${o.cyan(t.stats.witnessChainLength)} entries`),"embeddingCount"in t.stats?console.log(` Embeddings: ${o.cyan(t.stats.embeddingCount)}`):"vectorCount"in t.stats&&console.log(` Vectors: ${o.cyan(t.stats.vectorCount)}`);let i="tableRecordCounts"in t?t.tableRecordCounts:void 0;if(i){let s=Object.entries(i).filter(([l,f])=>f>0&&!["qe_patterns","rl_q_values","dream_insights","dream_cycles","witness_chain","vectors","qe_pattern_embeddings"].includes(l));if(s.length>0)for(let[l,f]of s){let y=`${l.replace(/_/g," ").replace(/\b\w/g,m=>m.toUpperCase())}:`.padEnd(15);console.log(` ${y}${o.cyan(f)}`)}}let c="totalRecords"in t.stats?t.stats.totalRecords:void 0;if(c!==void 0&&(console.log(o.blue(`
35
- Summary:`)),console.log(` Total Records: ${o.cyan(c)}`)),"domains"in t&&Array.isArray(t.domains)&&t.domains.length>0&&(c||console.log(o.blue(`
36
- Summary:`)),console.log(` Domains: ${o.cyan(t.domains.join(", "))}`)),"rvfStatus"in t){let s=t.rvfStatus;console.log(o.blue(`
37
- RVF Details:`)),console.log(` File Size: ${o.cyan(ze(s.fileSizeBytes))}`),console.log(` Vectors: ${o.cyan(s.totalVectors)}`),console.log(` Segments: ${o.cyan(s.totalSegments)}`)}if("lineage"in t){let s=t.lineage;s&&(console.log(o.blue(`
38
- Lineage:`)),console.log(` File ID: ${o.cyan(s.fileId)}`),console.log(` Parent ID: ${o.cyan(s.parentId??"none (root)")}`),console.log(` Depth: ${o.cyan(s.lineageDepth)}`))}if("signature"in t){let s=t.signature,l=t.signerKeyId;console.log(o.blue(`
39
- Signature:`)),s?(console.log(` Status: ${o.green("Signed")}`),console.log(` Key ID: ${o.cyan(l??"unknown")}`),console.log(` Signature: ${o.gray(s.slice(0,32)+"...")}`)):console.log(` Status: ${o.yellow("Unsigned")}`)}console.log(`
40
- Checksum: ${o.gray(t.checksum)}`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
41
- Failed to read brain info:`),r),await this.cleanupAndExit(1)}}async executeDiff(n,r,t){try{let a=await Ue(A.resolve(n),A.resolve(r),{tableFilter:t.table});if(t.json){process.stdout.write(JSON.stringify(a,null,2)+`
42
- `),await this.cleanupAndExit(a.identical?0:1);return}Pn(a,t.verbose),await this.cleanupAndExit(a.identical?0:1)}catch(a){console.error(o.red(`
43
- Brain diff failed:`),a),await this.cleanupAndExit(2)}}async executeSearch(n){try{let r=Fn(n.limit),t=Ln(n.domain),a=await We(A.resolve(n.input),{table:n.table,domains:t,patternType:n.patternType,since:n.since,until:n.until,query:n.query,limit:r});if(n.json){process.stdout.write(JSON.stringify(a,null,2)+`
44
- `),await this.cleanupAndExit(a.totalMatched>0?0:3);return}Jn(a),await this.cleanupAndExit(a.totalMatched>0?0:3)}catch(r){console.error(o.red(`
45
- Brain search failed:`),r),await this.cleanupAndExit(2)}}async executeWitnessBackfill(n){try{console.log(o.blue(`
46
- Running witness chain backfill...
47
- `));let r=await ue(n.db),t=await He(r);console.log(o.green(" Backfill complete.")),console.log(` Created: ${o.cyan(t.created)} new witness entries`),console.log(` Skipped: ${o.cyan(t.skipped)} (already witnessed)`),console.log(""),await this.cleanupAndExit(0)}catch(r){console.error(o.red(`
48
- Witness backfill failed:`),r),await this.cleanupAndExit(1)}}getHelp(){return`
49
- Export, import, and inspect QE brain state.
50
-
51
- Formats:
52
- rvf \u2014 Single portable .rvf file (default, requires @ruvector/rvf-node)
53
- jsonl \u2014 JSONL directory format (fallback when native not available)
54
-
55
- Usage:
56
- aqe brain export -o brain.rvf [--format rvf] [--db <path>]
57
- aqe brain export -o ./brain-dir --format jsonl [--db <path>]
58
- aqe brain import -i brain.rvf [--strategy skip-conflicts] [--dry-run] [--db <path>]
59
- aqe brain info -i brain.rvf
60
-
61
- Subcommands:
62
- export Export brain state to a portable .rvf file or JSONL directory
63
- import Import a brain export into the local database
64
- info Show manifest metadata for an existing brain export
65
- diff Compare two brain exports (manifest always; record-level for JSONL)
66
- search Filtered search over a JSONL brain export
67
-
68
- Examples:
69
- aqe brain export -o .agentic-qe/brain.rvf
70
- aqe brain export -o .agentic-qe/brain.rvf --format rvf
71
- aqe brain export -o ./brain-export --format jsonl
72
- aqe brain import -i .agentic-qe/brain.rvf --strategy latest-wins
73
- aqe brain import -i .agentic-qe/brain.rvf --dry-run
74
- aqe brain info -i .agentic-qe/brain.rvf
75
- aqe brain diff ./brain-a ./brain-b --verbose
76
- aqe brain search -i ./brain-export --query oauth --domain test-generation
77
- aqe brain search -i ./brain-export --since 2026-03-01 --limit 50 --json
78
- `}};async function ue(e){if(e)return e;let{findProjectRoot:n}=await import("./unified-memory-VBQ572X4.js");return A.join(n(),".agentic-qe","memory.db")}function ze(e){return e<1024?`${e} B`:e<1024*1024?`${(e/1024).toFixed(1)} KB`:`${(e/(1024*1024)).toFixed(1)} MB`}function Fn(e){let n=Number.parseInt(e,10);return!Number.isFinite(n)||n<1?20:n}function Ln(e){if(e===void 0)return;let n=Array.isArray(e)?e:[e],r=[];for(let t of n)for(let a of t.split(",")){let i=a.trim();i&&r.push(i)}return r.length>0?r:void 0}function Pn(e,n){console.log(o.blue(`
79
- Brain Diff
80
- `)),console.log(` A: ${o.cyan(e.pathA)} (${e.formatA})`),console.log(` B: ${o.cyan(e.pathB)} (${e.formatB})`),console.log(` Versions: ${o.cyan(e.manifestA.version)} \u2192 ${o.cyan(e.manifestB.version)}`+(e.versionMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Checksums: ${o.gray(e.manifestA.checksum.slice(0,12))}\u2026 \u2192 ${o.gray(e.manifestB.checksum.slice(0,12))}\u2026`+(e.checksumMatch?o.gray(" (match)"):o.yellow(" (differ)"))),console.log(` Exported: ${o.gray(e.manifestA.exportedAt)} \u2192 ${o.gray(e.manifestB.exportedAt)}`),console.log(` Records: ${o.cyan(e.manifestA.totalRecords)} \u2192 ${o.cyan(e.manifestB.totalRecords)} `+Ge(e.manifestB.totalRecords-e.manifestA.totalRecords)),(e.domainsOnlyInA.length>0||e.domainsOnlyInB.length>0)&&(console.log(o.blue(`
81
- Domains:`)),e.domainsOnlyInA.length>0&&console.log(` Only in A: ${o.yellow(e.domainsOnlyInA.join(", "))}`),e.domainsOnlyInB.length>0&&console.log(` Only in B: ${o.yellow(e.domainsOnlyInB.join(", "))}`)),e.recordLevel||console.log(o.gray(`
82
- Note: record-level diff is only available when both sides are JSONL exports.
83
- Per-table counts shown below; re-export with --format jsonl for added/removed/changed IDs.`)),console.log(o.blue(`
84
- Tables:`));let r=e.tableDiffs.filter(jn);if(r.length===0)console.log(o.gray(" (no differences)"));else for(let t of r)console.log(` ${t.tableName.padEnd(28)} ${o.cyan(String(t.countA).padStart(7))} \u2192 ${o.cyan(String(t.countB).padStart(7))} ${Ge(t.delta)}`+Vn(t,n)),n&&(t.added&&t.added.length>0&&pe("added",t.added),t.removed&&t.removed.length>0&&pe("removed",t.removed),t.changed&&t.changed.length>0&&pe("changed",t.changed));console.log(""),e.identical?console.log(o.green(` Result: identical
85
- `)):console.log(o.yellow(` Result: differences found
86
- `))}function jn(e){return!!(e.delta!==0||e.added&&e.added.length>0||e.removed&&e.removed.length>0||e.changed&&e.changed.length>0)}function Ge(e){return e===0?o.gray("(\xB10)"):e>0?o.green(`(+${e})`):o.red(`(${e})`)}function Vn(e,n){let r=[];return e.added&&e.added.length>0&&r.push(o.green(`+${e.added.length}`)),e.removed&&e.removed.length>0&&r.push(o.red(`-${e.removed.length}`)),e.changed&&e.changed.length>0&&r.push(o.yellow(`~${e.changed.length}`)),r.length===0?"":n?" "+r.join(" "):" "+o.gray("[")+r.join(" ")+o.gray("]")}function pe(e,n){let r=n.slice(0,10).join(", "),t=n.length>10?o.gray(` \u2026(+${n.length-10} more)`):"";console.log(` ${o.gray(e+":")} ${r}${t}`)}function Jn(e){if(console.log(o.blue(`
87
- Brain Search
88
- `)),console.log(` Input: ${o.cyan(e.inputPath)}`),console.log(` Table: ${o.cyan(e.table)}`),console.log(` Scanned: ${o.cyan(e.totalScanned)} Matched: ${o.cyan(e.totalMatched)} Shown: ${o.cyan(e.hits.length)}`+(e.truncated?o.yellow(` (truncated to limit ${e.limit})`):"")),e.hits.length===0){console.log(o.yellow(`
89
- No matching rows.
90
- `));return}console.log("");for(let n of e.hits){let r=o.cyan(n.id)+(n.display.patternType?o.gray(` ${n.display.patternType}`):"")+(n.display.domain?o.gray(` [${n.display.domain}]`):"")+(n.display.confidence!==void 0?o.gray(` conf=${n.display.confidence.toFixed(2)}`):"");if(console.log(` ${r}`),n.display.name&&console.log(` ${o.bold(n.display.name)}`),n.display.description){let t=n.display.description.length>200?n.display.description.slice(0,200)+"\u2026":n.display.description;console.log(` ${o.gray(t)}`)}n.display.updatedAt&&console.log(` ${o.gray(n.display.updatedAt)}`),console.log("")}}function Ct(e,n){return new ge(e,n)}export{ge as BrainHandler,Ct as createBrainHandler};
@@ -1,2 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a}from"./chunk-H6XBM2LY.js";import"./chunk-44WISFTU.js";import"./chunk-74PK3NEW.js";import"./chunk-TFHQE6NK.js";import"./chunk-4RP5VUBI.js";import"./chunk-5F6DWHQG.js";import"./chunk-L2GKMBDP.js";import"./chunk-72UJXEKQ.js";import"./chunk-Y5SQBI2F.js";import"./chunk-YAKS3CAB.js";import"./chunk-HRUU7E3D.js";import"./chunk-OYMLHX2B.js";import"./chunk-5Y5TC6BY.js";import"./chunk-MXMFGSWR.js";import"./chunk-VIDBBB6F.js";import"./chunk-PI74GOE4.js";import"./chunk-5IAB5NRZ.js";import"./chunk-OVDKWCD7.js";import"./chunk-XA7CG3LH.js";import"./chunk-YEXPFHV6.js";import"./chunk-IP7NSFQQ.js";import"./chunk-T35GZXTU.js";import"./chunk-Y2DVFVGI.js";export{a as BrowserWorkflowTool};
@@ -1,13 +0,0 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.3");process.exit(0)}
2
- import{a as F,c as de}from"./chunk-HRUU7E3D.js";import{b as W,d as k}from"./chunk-XA7CG3LH.js";k();de();k();import*as S from"node:http";import*as R from"node:https";import{createHash as le}from"node:crypto";import{URL as G}from"node:url";var A={model:"Xenova/all-MiniLM-L6-v2",expectedDim:384,connectTimeoutMs:5e3,requestTimeoutMs:3e4,failureThreshold:3,failureWindowMs:6e4},pe="AQE embedder endpoint identity canary v1",ce="/v1/embeddings";function j(t){if(t.startsWith("unix:"))return t;try{let e=new G(t);return e.username||e.password?(e.username="",e.password="",e.toString().replace(/\/$/,"")):t}catch{return t}}function me(t){if(t.startsWith("unix:")){let r=t.slice(5);if(!r.startsWith("/"))throw new Error(`unix endpoint must be an absolute path: ${t}`);return{transport:"unix",socketPath:r,safeUrl:t}}let e=new G(t);if(e.protocol!=="http:"&&e.protocol!=="https:")throw new Error(`unsupported embedder endpoint protocol: ${e.protocol}`);return(e.username||e.password)&&(console.warn("[EmbedderEndpointClient] endpoint URL contained userinfo; stripping. Use AQE_EMBEDDER_TOKEN env var for credentials."),e.username="",e.password=""),{transport:e.protocol==="https:"?"https":"http",host:e.hostname,port:e.port?Number(e.port):e.protocol==="https:"?443:80,protocol:e.protocol,safeUrl:e.toString().replace(/\/$/,"")}}var z=class{constructor(e,n,r=()=>{}){this.threshold=e;this.windowMs=n;this.onRecover=r}threshold;windowMs;onRecover;failures=[];trippedAt=null;recordSuccess(){this.failures=[],this.trippedAt=null}recordFailure(){let e=Date.now();this.failures=this.failures.filter(n=>e-n<this.windowMs),this.failures.push(e),this.failures.length>=this.threshold&&(this.trippedAt=e)}isOpen(){return this.trippedAt===null?!1:Date.now()-this.trippedAt>=this.windowMs?(this.failures=[],this.trippedAt=null,this.onRecover(),!1):!0}getState(){return{open:this.isOpen(),failures:this.failures.length,trippedAt:this.trippedAt}}},M=class{parsed;agent;breaker;opts;cachedIdentity=null;probeInFlight=null;constructor(e){if(this.opts={endpoint:e.endpoint,token:e.token,model:e.model??A.model,expectedDim:e.expectedDim??A.expectedDim,connectTimeoutMs:e.connectTimeoutMs??A.connectTimeoutMs,requestTimeoutMs:e.requestTimeoutMs??A.requestTimeoutMs,failureThreshold:e.failureThreshold??A.failureThreshold,failureWindowMs:e.failureWindowMs??A.failureWindowMs,tlsOptions:e.tlsOptions},this.parsed=me(e.endpoint),this.parsed.transport==="https"){let n=e.tlsOptions??{};this.agent=new R.Agent({keepAlive:!0,ca:n.ca,cert:n.cert,key:n.key,rejectUnauthorized:n.rejectUnauthorized!==!1,servername:n.servername})}else this.agent=new S.Agent({keepAlive:!0});this.breaker=new z(this.opts.failureThreshold,this.opts.failureWindowMs,()=>{this.cachedIdentity=null})}getSafeEndpoint(){return this.parsed.safeUrl}async embed(e){if(e.length===0)return[];if(this.breaker.isOpen())throw new Error(`[EmbedderEndpointClient] circuit breaker open for ${this.parsed.safeUrl} \u2014 fast-failing`);this.cachedIdentity===null&&await this.ensureProbed();try{let n=await this.postEmbeddings(e),r=this.decodeAndNormalize(n,e.length);return this.breaker.recordSuccess(),r}catch(n){throw this.breaker.recordFailure(),n}}async probe(){return this.probeInFlight?this.probeInFlight:(this.probeInFlight=this.doProbe().finally(()=>{this.probeInFlight=null}),this.probeInFlight)}async ensureProbed(){return this.cachedIdentity?this.cachedIdentity:this.probe()}async doProbe(){let e;try{let a=await this.postEmbeddings([pe]);e=this.decodeAndNormalize(a,1)[0],this.breaker.recordSuccess()}catch(a){throw this.breaker.recordFailure(),a}if(!e||e.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch: expected ${this.opts.expectedDim}, got ${e?.length??0} from ${this.parsed.safeUrl}`);let n=Buffer.alloc(e.length*2);for(let a=0;a<e.length;a++){let i=Math.max(-32768,Math.min(32767,Math.round(e[a]*32767)));n.writeInt16LE(i,a*2)}let r=le("sha256").update(n).digest("hex").slice(0,16);return this.cachedIdentity={dim:e.length,fingerprint:r,endpoint:this.parsed.safeUrl},this.cachedIdentity}getCachedIdentity(){return this.cachedIdentity}getBreakerState(){return this.breaker.getState()}close(){this.agent.destroy()}decodeAndNormalize(e,n){if(!e||typeof e!="object"||!Array.isArray(e.data))throw new Error("[EmbedderEndpointClient] response missing data array");let r=e.data;if(r.length!==n)throw new Error(`[EmbedderEndpointClient] response count mismatch: expected ${n}, got ${r.length}`);let a=r.map((i,s)=>({idx:typeof i.index=="number"?i.index:s,embedding:i.embedding}));return a.sort((i,s)=>i.idx-s.idx),a.map(({embedding:i},s)=>{if(typeof i=="string")throw new Error(`[EmbedderEndpointClient] received base64 embedding at position ${s} \u2014 server ignored encoding_format=float. Configure the server to return float arrays.`);if(!Array.isArray(i))throw new Error(`[EmbedderEndpointClient] missing embedding at position ${s}`);if(i.length!==this.opts.expectedDim)throw new Error(`[EmbedderEndpointClient] dim mismatch at position ${s}: expected ${this.opts.expectedDim}, got ${i.length}`);return W(i)})}postEmbeddings(e){let n=JSON.stringify({model:this.opts.model,input:e,encoding_format:"float"});return this.request(ce,n)}request(e,n){let r={"content-type":"application/json","content-length":Buffer.byteLength(n),accept:"application/json"};this.opts.token&&(r.authorization=`Bearer ${this.opts.token}`);let a={method:"POST",path:e,headers:r,agent:this.agent},i,s;this.parsed.transport==="unix"?(i={...a,socketPath:this.parsed.socketPath},s=S.request):(i={...a,host:this.parsed.host,port:this.parsed.port,protocol:this.parsed.protocol},s=this.parsed.transport==="https"?R.request:S.request);let o=this.parsed.safeUrl,l=this.opts.connectTimeoutMs,m=this.opts.requestTimeoutMs;return new Promise((b,$)=>{let y=!1,N=d=>{y||(y=!0,b(d))},h=d=>{y||(y=!0,$(d))},w=s(i,d=>{let g=[];d.on("data",u=>g.push(Buffer.from(u))),d.on("end",()=>{let u=Buffer.concat(g).toString("utf-8");if(!d.statusCode||d.statusCode<200||d.statusCode>=300){h(new Error(`[EmbedderEndpointClient] HTTP ${d.statusCode} from ${o}: ${u.slice(0,200)}`));return}try{let E=JSON.parse(u);N(E)}catch(E){h(new Error(`[EmbedderEndpointClient] invalid JSON from ${o}: ${E.message}`))}}),d.on("error",u=>h(u))});w.on("socket",d=>{d.setTimeout(l);let g=()=>{d.setTimeout(m)};d.connecting?d.once("connect",g):g(),d.on("timeout",()=>{let u=d.connecting?"connect":"request",E=d.connecting?l:m,T=new Error(`[EmbedderEndpointClient] ${u} timeout after ${E}ms`);h(T),w.destroy(T)})}),w.on("error",d=>h(d)),w.write(n),w.end()})}};import{join as X}from"node:path";import{existsSync as ue,mkdirSync as fe}from"node:fs";import{createRequire as ge}from"node:module";var he=ge(import.meta.url);function Ee(){let t=process.env.AQE_MEMORY_PATH;return t&&t.length>0?t:X(process.cwd(),".agentic-qe","memory.db")}var J="_system",K="embedder_identity:",x=null,q=!1;function Y(){if(x)return x;if(q)return null;try{let t=he("better-sqlite3"),e=Ee(),n=X(e,"..");ue(n)||fe(n,{recursive:!0});let r=new t(e);return r.pragma("journal_mode = WAL"),r.pragma("busy_timeout = 5000"),r.exec(`
3
- CREATE TABLE IF NOT EXISTS kv_store (
4
- key TEXT NOT NULL,
5
- namespace TEXT NOT NULL,
6
- value TEXT NOT NULL,
7
- expires_at INTEGER,
8
- created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
9
- PRIMARY KEY (namespace, key)
10
- );
11
- CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
12
- `),x=r,r}catch{return q=!0,null}}function Q(t){let e=Y();if(!e)return null;try{let n=e.prepare("SELECT value FROM kv_store WHERE namespace = ? AND key = ?").get(J,K+t);if(!n)return null;let r=JSON.parse(n.value);return!r.fingerprint||typeof r.dim!="number"?null:{fingerprint:r.fingerprint,dim:r.dim,endpoint:r.endpoint}}catch{return null}}function Z(t){let e=Y();if(!e)return;let n={fingerprint:t.fingerprint,dim:t.dim,endpoint:t.endpoint,updatedAt:Date.now()};e.prepare("INSERT OR REPLACE INTO kv_store (key, namespace, value) VALUES (?, ?, ?)").run(K+t.endpoint,J,JSON.stringify(n))}function ee(){if(x)try{x.close()}catch{}x=null,q=!1}k();import{createHash as te}from"node:crypto";import{existsSync as ye,readFileSync as we,renameSync as Ie,writeFileSync as ve}from"node:fs";var ne="aqe embedding-space compatibility canary v1";var I=class extends Error{constructor(n,r){super(`${n}: ${r}`);this.code=n;this.name="EmbeddingSpaceError"}code};function Ae(t){return JSON.stringify({provider:t.provider,model:t.model,dimensions:t.dimensions,pooling:t.pooling??null,normalized:t.normalized,preprocessingVersion:t.preprocessingVersion??null,implementation:t.implementation??null,runtimeFingerprint:t.runtimeFingerprint})}function re(t){let e=Buffer.alloc(t.length*2);for(let n=0;n<t.length;n++){let r=Math.max(-32768,Math.min(32767,Math.round(t[n]*32767)));e.writeInt16LE(r,n*2)}return te("sha256").update(e).digest("hex").slice(0,16)}function U(t){if(!t.runtimeFingerprint)throw new Error("Embedding space identity requires executable runtime evidence");let e=te("sha256").update("aqe:embedding-space:v1\0").update(Ae(t)).digest("hex");return{...t,spaceId:e}}function ke(t,e){let n=[...new Set(t.flatMap(o=>o.spaceId?[o.spaceId]:[]))].sort(),r=t.filter(o=>!o.spaceId).length,a=e?t.filter(o=>o.spaceId===e).length:0,i=e?t.filter(o=>o.spaceId!==null&&o.spaceId!==e).length:t.length-r;return{status:r>0||!e?"unverified":i>0||n.length>1?"vector_space_mismatch":"healthy",activeSpaceId:e,storedSpaceIds:n,verifiedVectors:a,mismatchedVectors:i,unverifiedVectors:r}}function xe(t){return`${t}.space.json`}function ze(t,e,n){if(!e)throw new I("VECTOR_SPACE_UNVERIFIED",`cannot open ANN index ${t} without runtime provenance`);let r=xe(t);if(ye(r)){let s;try{s=JSON.parse(we(r,"utf8"))}catch{throw new I("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${r} is unreadable`)}if(s.version!==1||!s.spaceId)throw new I("VECTOR_SPACE_UNVERIFIED",`ANN index manifest ${r} has no verified space`);if(s.spaceId!==e)throw new I("VECTOR_SPACE_MISMATCH",`ANN index space ${s.spaceId} != active space ${e}`);return}if(n>0)throw new I("VECTOR_SPACE_UNVERIFIED",`populated ANN index ${t} has no embedding-space manifest; rebuild required`);let a={version:1,spaceId:e},i=`${r}.${process.pid}.tmp`;ve(i,`${JSON.stringify(a)}
13
- `,{encoding:"utf8",mode:384}),Ie(i,r)}var V=null,f=null,C=null,P=!1,_="",v=null,p=null,O=null,L={modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0,enableCache:!0,maxCacheSize:1e4,endpoint:process.env.AQE_EMBEDDER_ENDPOINT,endpointToken:process.env.AQE_EMBEDDER_TOKEN},c=new Map,ie=36e5;function B(t){return p?`endpoint:${p.fingerprint}:${t}`:`inproc:${t}`}function oe(t){let e=t.trim();return!!(e.startsWith("{")&&/["']metrics["']/.test(e)||e.startsWith("[")&&e.endsWith("]")&&e.length>50||(e.match(/[a-zA-Z]/g)||[]).length/Math.max(e.length,1)<.3&&e.length>20)}async function se(t={}){if(P)throw new Error(`Transformer initialization previously failed: ${_}`);if(C)return C;let e={...L,...t};return C=(async()=>{try{if(e.endpoint){let l=j(e.endpoint);console.log(`[RealEmbeddings] Using external embedder endpoint: ${l}`),v=new M({endpoint:e.endpoint,token:e.endpointToken,model:e.modelName,expectedDim:D()}),p=await v.probe(),O=U({provider:"openai-compatible-endpoint",model:e.modelName,dimensions:p.dim,pooling:"mean",normalized:!0,preprocessingVersion:"aqe-text-v1",implementation:p.endpoint,runtimeFingerprint:p.fingerprint}),console.log(`[RealEmbeddings] Endpoint identity: dim=${p.dim} fingerprint=${p.fingerprint}`);try{let m=Q(p.endpoint);m&&m.fingerprint!==p.fingerprint&&console.warn(`[RealEmbeddings] WARNING: endpoint identity changed since last run. Previous fingerprint=${m.fingerprint} dim=${m.dim}, current fingerprint=${p.fingerprint} dim=${p.dim}. Vectors written before this change may no longer be comparable.`),Z(p)}catch(m){console.warn(`[RealEmbeddings] Could not persist endpoint identity: ${F(m)}`)}f=Te(v);return}let n;try{n=await import("./transformers-IMDDAMYQ.js")}catch{throw new Error('In-process embeddings require the optional package "@huggingface/transformers", which is not installed. Configure an embedding endpoint (EmbeddingConfig.endpoint / AQE_EMBEDDER_ENDPOINT) so no local model is loaded. Installing @huggingface/transformers@4.2.0 is an explicit security opt-in: its compatible dependency chain currently has unresolved HIGH advisories GHSA-xcpc-8h2w-3j85 and GHSA-f88m-g3jw-g9cj.')}V=n.pipeline,console.log(`[RealEmbeddings] Loading model: ${e.modelName}`);let r=performance.now();f=await V("feature-extraction",e.modelName,{quantized:e.quantized});let a=f;if(!a)throw new Error("Transformer pipeline returned no embedding model");let i=await a(ne,{pooling:"mean",normalize:!0}),s=Array.from(i.data);O=U({provider:"huggingface-transformers",model:e.modelName,dimensions:s.length,pooling:"mean",normalized:!0,preprocessingVersion:"aqe-text-v1",implementation:`transformers:${e.quantized?"quantized":"full"}`,runtimeFingerprint:re(s)});let o=performance.now()-r;console.log(`[RealEmbeddings] Model loaded in ${o.toFixed(0)}ms`)}catch(n){throw P=!0,_=F(n),new Error(`Failed to initialize transformer model: ${_}`)}})(),C}function Te(t){return async e=>{let n=Array.isArray(e)?e:[e],r=await t.embed(n),a=r[0]?.length??D(),i=new Float32Array(n.length*a);for(let s=0;s<r.length;s++)i.set(r[s],s*a);return{data:i,dims:[n.length,a]}}}async function He(t,e={}){let n={...L,...e};if(oe(t))return new Array(D()).fill(0);if(f||await se(e),!f)throw new Error("Embedding model failed to initialize");let r=B(t);if(n.enableCache){let l=c.get(r);if(l&&Date.now()-l.timestamp<ie)return l.embedding}let a=performance.now(),i=await f(t,{pooling:"mean",normalize:!0}),s=Array.from(i.data),o=performance.now()-a;if(o>500&&console.warn(`[RealEmbeddings] Slow embedding computation: ${o.toFixed(1)}ms for "${t.slice(0,50)}..."`),n.enableCache){if(c.size>=n.maxCacheSize){let l=c.keys().next().value;l&&c.delete(l)}c.set(r,{embedding:s,timestamp:Date.now()})}return s}async function We(t,e={}){let n={...L,...e},r=[],a=[],i=new Array(t.length).fill(null),s=[];for(let o=0;o<t.length;o++)oe(t[o])?i[o]=new Array(D()).fill(0):s.push(o);if(s.length===0)return i;if(f||await se(e),!f)throw new Error("Embedding model failed to initialize");if(n.enableCache)for(let o of s){let l=c.get(B(t[o]));l&&Date.now()-l.timestamp<ie?i[o]=l.embedding:(r.push(t[o]),a.push(o))}else for(let o of s)r.push(t[o]),a.push(o);if(r.length>0){let o=performance.now(),l=32;for(let b=0;b<r.length;b+=l){let $=Math.min(b+l,r.length),y=r.slice(b,$),N=await f(y,{pooling:"mean",normalize:!0}),h=N.dims||[y.length,384],w=h[0],d=h[1];for(let g=0;g<w;g++){let u=g*d,E=Array.from(N.data.slice(u,u+d)),T=b+g,ae=a[T];if(i[ae]=E,n.enableCache){if(c.size>=n.maxCacheSize){let H=c.keys().next().value;H&&c.delete(H)}c.set(B(r[T]),{embedding:E,timestamp:Date.now()})}}}let m=performance.now()-o;console.log(`[RealEmbeddings] Batch computed ${r.length} embeddings in ${m.toFixed(0)}ms`)}return i.filter(o=>o!==null)}function Ge(){c.clear(),console.log("[RealEmbeddings] Cache cleared")}function je(){return{size:c.size,hitRate:0}}function Xe(){return!P&&f!==null}function D(){return 384}function Je(){V=null,f=null,C=null,P=!1,_="",c.clear(),v&&v.close(),v=null,p=null,O=null,ee()}function Ke(){return v!==null}function Ye(){return p}function Qe(){return O}export{ne as a,ke as b,ze as c,L as d,He as e,We as f,Ge as g,je as h,Xe as i,D as j,Je as k,Ke as l,Ye as m,Qe as n};