agentic-qe 3.9.0 → 3.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (416) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +43 -0
  3. package/dist/audit/witness-chain.d.ts +1 -1
  4. package/dist/cli/bundle.js +8 -8
  5. package/dist/cli/chunks/adapter-53WBPKXU.js +2 -0
  6. package/dist/cli/chunks/{agent-booster-wasm-PQYB7VRU.js → agent-booster-wasm-AKAOHSCX.js} +2 -2
  7. package/dist/cli/chunks/{agent-handler-QDAB5NQS.js → agent-handler-MTGPOUVP.js} +2 -2
  8. package/dist/cli/chunks/agent-memory-branch-UFPKWUFK.js +2 -0
  9. package/dist/cli/chunks/aqe-learning-engine-MV7NGY24.js +2 -0
  10. package/dist/cli/chunks/{audit-S7JUYYVP.js → audit-VBEZHNHO.js} +2 -2
  11. package/dist/cli/chunks/base-DZVGMQN2.js +2 -0
  12. package/dist/cli/chunks/better-sqlite3-IRPHIXRU.js +2 -0
  13. package/dist/cli/chunks/brain-handler-7EO3FFRZ.js +68 -0
  14. package/dist/cli/chunks/{branch-enumerator-XK4V5W7L.js → branch-enumerator-MZRGP35N.js} +2 -2
  15. package/dist/cli/chunks/{browser-PALA5PL3.js → browser-VSIWQE7J.js} +2 -2
  16. package/dist/cli/chunks/browser-workflow-3J5YNMEI.js +2 -0
  17. package/dist/cli/chunks/chunk-25LFUL2K.js +79 -0
  18. package/dist/cli/chunks/{chunk-LHJQD2VU.js → chunk-2EC5Z2J4.js} +68 -68
  19. package/dist/cli/chunks/{chunk-4YOMLWEK.js → chunk-2VVV73PW.js} +1 -1
  20. package/dist/cli/chunks/{chunk-BPWXXEH2.js → chunk-2WBCYSUN.js} +128 -128
  21. package/dist/cli/chunks/{chunk-X3KI6JOY.js → chunk-2Z2TFEOL.js} +2 -2
  22. package/dist/cli/chunks/chunk-34U7JDCN.js +2 -0
  23. package/dist/cli/chunks/{chunk-24FKIJNC.js → chunk-3GZKAORV.js} +2 -2
  24. package/dist/cli/chunks/{chunk-72WOAVK6.js → chunk-4D2ZG2QO.js} +1 -1
  25. package/dist/cli/chunks/{chunk-B36CDR4U.js → chunk-4DAOZQ3V.js} +2 -2
  26. package/dist/cli/chunks/{chunk-CL6POIX4.js → chunk-4FMHBBG5.js} +1 -1
  27. package/dist/cli/chunks/{chunk-BXAXGEFC.js → chunk-4FT3PND7.js} +5 -5
  28. package/dist/cli/chunks/{chunk-IGJPMN4I.js → chunk-4LA7IW3V.js} +1 -1
  29. package/dist/cli/chunks/{chunk-JRYGQO2W.js → chunk-4PKXIBX2.js} +1 -1
  30. package/dist/cli/chunks/{chunk-YPFOCNOE.js → chunk-4UH25U4O.js} +1 -1
  31. package/dist/cli/chunks/{chunk-U5RN7YQW.js → chunk-4Z27TRQF.js} +2 -2
  32. package/dist/cli/chunks/{chunk-YW2THB5Q.js → chunk-563PJBDM.js} +2 -2
  33. package/dist/cli/chunks/{chunk-BDIEMZ22.js → chunk-56IWS2KY.js} +2 -2
  34. package/dist/cli/chunks/chunk-5AUKULWO.js +2 -0
  35. package/dist/cli/chunks/{chunk-VSVXUTJN.js → chunk-5L6AU3QK.js} +2 -2
  36. package/dist/cli/chunks/{chunk-RTGGL7D7.js → chunk-5RL66XSH.js} +2 -2
  37. package/dist/cli/chunks/{chunk-YANUP2RO.js → chunk-65M7C6SH.js} +1 -1
  38. package/dist/cli/chunks/{chunk-ESVQ6MEB.js → chunk-6SOJVEU7.js} +2 -2
  39. package/dist/cli/chunks/{chunk-UFUVUO3J.js → chunk-727BDQ3K.js} +2 -2
  40. package/dist/cli/chunks/{chunk-TLHP5EII.js → chunk-7NOIIC7G.js} +1 -1
  41. package/dist/cli/chunks/{chunk-N4TL73TH.js → chunk-7SLN2JGP.js} +8 -8
  42. package/dist/cli/chunks/{chunk-NZ2VCPN4.js → chunk-AA33R5U4.js} +2 -2
  43. package/dist/cli/chunks/{chunk-Y7BHKZFJ.js → chunk-AKSJQ6B3.js} +2 -2
  44. package/dist/cli/chunks/{chunk-3ZOONQG6.js → chunk-BIVIPF4O.js} +1 -1
  45. package/dist/cli/chunks/{chunk-VOS4NQSF.js → chunk-BKCTNRC5.js} +2 -2
  46. package/dist/cli/chunks/{chunk-B6LLWYQ6.js → chunk-BOH22AKC.js} +2 -2
  47. package/dist/cli/chunks/{chunk-OI5NGQO2.js → chunk-BY47GV4T.js} +2 -2
  48. package/dist/cli/chunks/chunk-CCYMJKWX.js +2 -0
  49. package/dist/cli/chunks/chunk-CL3K5EJK.js +2 -0
  50. package/dist/cli/chunks/{chunk-GPQ57KA4.js → chunk-CQBSGYRA.js} +2 -2
  51. package/dist/cli/chunks/{chunk-MZOFWJTM.js → chunk-CQP7ZFME.js} +2 -2
  52. package/dist/cli/chunks/chunk-DBE34QES.js +2 -0
  53. package/dist/cli/chunks/chunk-DHE66JRR.js +12 -0
  54. package/dist/cli/chunks/{chunk-2BZFNEN2.js → chunk-DNLMZTE2.js} +1 -1
  55. package/dist/cli/chunks/{chunk-XLRQYLWW.js → chunk-DSE57A5N.js} +1 -1
  56. package/dist/cli/chunks/{chunk-SUSEVMZT.js → chunk-E25S5E2D.js} +1 -1
  57. package/dist/cli/chunks/{chunk-FEKY7T6Q.js → chunk-FAXVVLPL.js} +2 -2
  58. package/dist/cli/chunks/chunk-FRJLP7IB.js +2 -0
  59. package/dist/cli/chunks/{chunk-CS2KS7LP.js → chunk-FUIHWBVF.js} +1 -1
  60. package/dist/cli/chunks/{chunk-LNQIY6BP.js → chunk-GCMVJS5X.js} +2 -2
  61. package/dist/cli/chunks/{chunk-XT2V2322.js → chunk-GITD7SRQ.js} +2 -2
  62. package/dist/cli/chunks/{chunk-JJO7Y4H3.js → chunk-GK72GUHA.js} +3 -3
  63. package/dist/cli/chunks/{chunk-6EOS7KX2.js → chunk-GPLERTZU.js} +2 -2
  64. package/dist/cli/chunks/{chunk-2E5NQNSU.js → chunk-HW4ISY5B.js} +11 -11
  65. package/dist/cli/chunks/{chunk-HRO6OZQD.js → chunk-ICDXWIFZ.js} +1 -1
  66. package/dist/cli/chunks/{chunk-3NZLZHJI.js → chunk-J4BS6IWE.js} +1 -1
  67. package/dist/cli/chunks/{chunk-4VUPRTVX.js → chunk-JOVINE23.js} +2 -2
  68. package/dist/cli/chunks/chunk-JV7LX6OT.js +95 -0
  69. package/dist/cli/chunks/{chunk-6SVX4DJC.js → chunk-KBA7FBK3.js} +3 -3
  70. package/dist/cli/chunks/chunk-KDDZYXP4.js +2 -0
  71. package/dist/cli/chunks/{chunk-GAOJV3OX.js → chunk-KNVAAVHH.js} +2 -2
  72. package/dist/cli/chunks/{chunk-CWFB6BSA.js → chunk-KQTJ2YLI.js} +4 -4
  73. package/dist/cli/chunks/{chunk-FGA7VIFR.js → chunk-KTYUCZEM.js} +3 -3
  74. package/dist/cli/chunks/{chunk-RU5WAHB7.js → chunk-KZTO5EVM.js} +2 -2
  75. package/dist/cli/chunks/{chunk-IFNIIK34.js → chunk-KZUJBZ7B.js} +3 -3
  76. package/dist/cli/chunks/{chunk-GKNNSCLC.js → chunk-L5WZUPZF.js} +2 -2
  77. package/dist/cli/chunks/{chunk-MDUHYUHF.js → chunk-L5YEPSDU.js} +2 -2
  78. package/dist/cli/chunks/chunk-LCAA6H4J.js +2 -0
  79. package/dist/cli/chunks/{chunk-XRE2HCWG.js → chunk-LMMEUVE5.js} +1 -1
  80. package/dist/cli/chunks/{chunk-7VDBAVTY.js → chunk-MN742FIH.js} +2 -2
  81. package/dist/cli/chunks/chunk-MY4LMIG7.js +180 -0
  82. package/dist/cli/chunks/{chunk-WGMPEW2T.js → chunk-N3F3CX4V.js} +2 -2
  83. package/dist/cli/chunks/{chunk-YVA65UZL.js → chunk-NJY7ZA77.js} +1 -1
  84. package/dist/cli/chunks/{chunk-3IHG3WOY.js → chunk-NM6TIEJ3.js} +3 -3
  85. package/dist/cli/chunks/{chunk-KP5NUODU.js → chunk-NRCKGXJJ.js} +1 -1
  86. package/dist/cli/chunks/{chunk-3ADGXLTM.js → chunk-PFNFC43Q.js} +1 -1
  87. package/dist/cli/chunks/{chunk-4VBTXZRM.js → chunk-PJFLO37I.js} +2 -2
  88. package/dist/cli/chunks/{chunk-XIBDETCS.js → chunk-PNL5G6TE.js} +2 -2
  89. package/dist/cli/chunks/{chunk-AFLLQ5PP.js → chunk-Q4A72ZTV.js} +2 -2
  90. package/dist/cli/chunks/{chunk-EHDQJQ6Y.js → chunk-QEQTC4WQ.js} +5 -5
  91. package/dist/cli/chunks/{chunk-IAV2JMIX.js → chunk-QIH3E775.js} +2 -2
  92. package/dist/cli/chunks/{chunk-GRUUQAR6.js → chunk-QNBQBSAI.js} +2 -2
  93. package/dist/cli/chunks/{chunk-WIEC7VKK.js → chunk-QODE4LM6.js} +2 -2
  94. package/dist/cli/chunks/{chunk-HY6PMO5W.js → chunk-QPRVX4H2.js} +2 -2
  95. package/dist/cli/chunks/chunk-RC5CPXON.js +2 -0
  96. package/dist/cli/chunks/{chunk-TWUWL5EJ.js → chunk-RITN3XR4.js} +2 -2
  97. package/dist/cli/chunks/{chunk-WBQSXPBI.js → chunk-RJROC5M3.js} +2 -2
  98. package/dist/cli/chunks/chunk-RQGYJK7H.js +2 -0
  99. package/dist/cli/chunks/{chunk-XO6PVK2P.js → chunk-S3RDH5CI.js} +2 -2
  100. package/dist/cli/chunks/{chunk-3IUNFTIF.js → chunk-SCF7NRVE.js} +1 -1
  101. package/dist/cli/chunks/chunk-SDTVHR63.js +2 -0
  102. package/dist/cli/chunks/chunk-SGAW2WLI.js +65 -0
  103. package/dist/cli/chunks/{chunk-N2NS2PHA.js → chunk-SNVM4YJS.js} +2 -2
  104. package/dist/cli/chunks/{chunk-JXM26HEE.js → chunk-SRRFWTNF.js} +2 -2
  105. package/dist/cli/chunks/{chunk-UQHYFOBX.js → chunk-STE42EMB.js} +2 -2
  106. package/dist/cli/chunks/{chunk-WJ3DLOXF.js → chunk-T5GV6UIO.js} +2 -2
  107. package/dist/cli/chunks/{chunk-4YS3IJ45.js → chunk-TKF447CW.js} +1 -1
  108. package/dist/cli/chunks/{chunk-ZAPS3UGQ.js → chunk-TTOE336G.js} +3 -3
  109. package/dist/cli/chunks/{chunk-YAGODYIG.js → chunk-UKDOMLBI.js} +3 -3
  110. package/dist/cli/chunks/{chunk-JBANAPWG.js → chunk-V6XBAZNH.js} +1 -1
  111. package/dist/cli/chunks/{chunk-BULKFVYX.js → chunk-VHVWAXCF.js} +1 -1
  112. package/dist/cli/chunks/{chunk-5SKGFSKD.js → chunk-VL7YOOC2.js} +2 -2
  113. package/dist/cli/chunks/{chunk-AKE543X2.js → chunk-VUAO4VFC.js} +2 -2
  114. package/dist/cli/chunks/{chunk-7R6YMLVS.js → chunk-WG4GHAML.js} +2 -2
  115. package/dist/cli/chunks/{chunk-BTREG4IW.js → chunk-WXWY2GAF.js} +2 -2
  116. package/dist/cli/chunks/chunk-X35GP7TR.js +1 -0
  117. package/dist/cli/chunks/chunk-X6LCMOGC.js +2 -0
  118. package/dist/cli/chunks/{chunk-BGXNSCXX.js → chunk-XFMKJ3UD.js} +1 -1
  119. package/dist/cli/chunks/{chunk-BLBRY5UD.js → chunk-XH53ARZD.js} +2 -2
  120. package/dist/cli/chunks/chunk-XIBVVZGB.js +2 -0
  121. package/dist/cli/chunks/chunk-XYJL6DKI.js +2 -0
  122. package/dist/cli/chunks/{chunk-5T2ZQWKF.js → chunk-Y6O7CDLI.js} +2 -2
  123. package/dist/cli/chunks/{chunk-4I2IOUS4.js → chunk-YXCU4CJX.js} +1 -1
  124. package/dist/cli/chunks/{chunk-YR6ZZGH7.js → chunk-Z2IKNC5M.js} +1 -1
  125. package/dist/cli/chunks/{chunk-OLHKGP35.js → chunk-Z54EO6E6.js} +2 -2
  126. package/dist/cli/chunks/{chunk-ZDATDCYN.js → chunk-Z5HXGVXZ.js} +1 -1
  127. package/dist/cli/chunks/{ci-J374KDLI.js → ci-2BCOBWFG.js} +2 -2
  128. package/dist/cli/chunks/ci-output-FB4OJHAC.js +2 -0
  129. package/dist/cli/chunks/{claude-flow-setup-245JLJCN.js → claude-flow-setup-NEEFZTMB.js} +2 -2
  130. package/dist/cli/chunks/client-EF555KYW.js +2 -0
  131. package/dist/cli/chunks/{cline-installer-LBA2M5N3.js → cline-installer-ODO2PS4K.js} +2 -2
  132. package/dist/cli/chunks/{code-U4N4WONM.js → code-NSOF62VE.js} +2 -2
  133. package/dist/cli/chunks/{code-index-extractor-A57Z6BO4.js → code-index-extractor-YQL5XN52.js} +2 -2
  134. package/dist/cli/chunks/{codex-installer-UXMK2N4T.js → codex-installer-SPEY6VYT.js} +2 -2
  135. package/dist/cli/chunks/{completions-W66BSCOE.js → completions-OWKBUMBE.js} +2 -2
  136. package/dist/cli/chunks/complexity-analyzer-PGTXKP73.js +2 -0
  137. package/dist/cli/chunks/{continuedev-installer-LRFZ2SJM.js → continuedev-installer-KGOXAC7L.js} +2 -2
  138. package/dist/cli/chunks/{copilot-installer-CQ3JYBIB.js → copilot-installer-BF3UA3TG.js} +2 -2
  139. package/dist/cli/chunks/cost-tracker-2HDJ66E2.js +2 -0
  140. package/dist/cli/chunks/{coverage-4PUEQXAY.js → coverage-KPA2PHIN.js} +3 -3
  141. package/dist/cli/chunks/cross-domain-router-GXFNK5TS.js +2 -0
  142. package/dist/cli/chunks/{cursor-installer-JZEDEDHA.js → cursor-installer-7CDZFHTV.js} +2 -2
  143. package/dist/cli/chunks/{daemon-B7TWGHXQ.js → daemon-4BPGCKDJ.js} +3 -3
  144. package/dist/cli/chunks/dag-attention-scheduler-2MAVGSBB.js +2 -0
  145. package/dist/cli/chunks/detect-WRPWTGP5.js +2 -0
  146. package/dist/cli/chunks/{domain-handler-FT5FLZWL.js → domain-handler-JZVSJ7AG.js} +2 -2
  147. package/dist/cli/chunks/domain-transfer-XGIZOR2X.js +2 -0
  148. package/dist/cli/chunks/dream-3IKF5XH4.js +2 -0
  149. package/dist/cli/chunks/esm-node-DHAE52OW.js +2 -0
  150. package/dist/cli/chunks/{eval-GHMPFGWV.js → eval-T7YPAS4G.js} +2 -2
  151. package/dist/cli/chunks/{fast-paths-B3R647KN.js → fast-paths-QECJTKCQ.js} +2 -2
  152. package/dist/cli/chunks/{feature-flags-DWS7ARSX.js → feature-flags-LIFURSFZ.js} +2 -2
  153. package/dist/cli/chunks/feature-flags-R4QZYTIW.js +2 -0
  154. package/dist/cli/chunks/file-discovery-4W3K3W4C.js +2 -0
  155. package/dist/cli/chunks/{fleet-EKOKMOMW.js → fleet-NLLQWCI5.js} +3 -3
  156. package/dist/cli/chunks/gnn-wrapper-XEII72LN.js +2 -0
  157. package/dist/cli/chunks/{heartbeat-handler-MBBS4IBU.js → heartbeat-handler-DJ65RE5D.js} +4 -4
  158. package/dist/cli/chunks/{heartbeat-scheduler-XDGMOT7X.js → heartbeat-scheduler-H664265Q.js} +2 -2
  159. package/dist/cli/chunks/hnsw-adapter-DML5KXQR.js +2 -0
  160. package/dist/cli/chunks/hnsw-index-BUPPGVR6.js +2 -0
  161. package/dist/cli/chunks/hnsw-legacy-bridge-SQIDTWAA.js +2 -0
  162. package/dist/cli/chunks/hnswlib-node-WICYCU5U.js +2 -0
  163. package/dist/cli/chunks/{hooks-L5VLZGEK.js → hooks-GZUHUD63.js} +6 -6
  164. package/dist/cli/chunks/hypergraph-engine-MLCDZ6BL.js +2 -0
  165. package/dist/cli/chunks/{hypergraph-handler-3HDGB5SZ.js → hypergraph-handler-NNDDI4R3.js} +3 -3
  166. package/dist/cli/chunks/impact-analyzer-DPTMJRYS.js +2 -0
  167. package/dist/cli/chunks/{init-handler-JDET6WUN.js → init-handler-IJ6BHE6A.js} +6 -6
  168. package/dist/cli/chunks/init-wizard-35PUDJPW.js +2 -0
  169. package/dist/cli/chunks/kernel-2HZ44ZJ4.js +2 -0
  170. package/dist/cli/chunks/{kilocode-installer-GZZG5AFW.js → kilocode-installer-EPZFFPFE.js} +2 -2
  171. package/dist/cli/chunks/{kiro-installer-IWNY5TKH.js → kiro-installer-5VACG3HU.js} +2 -2
  172. package/dist/cli/chunks/knowledge-graph-JL62G72U.js +2 -0
  173. package/dist/cli/chunks/{learning-722ZNSZ6.js → learning-6FITK6XY.js} +3 -3
  174. package/dist/cli/chunks/{llm-router-DNAV746L.js → llm-router-4DDC6AKJ.js} +2 -2
  175. package/dist/cli/chunks/{load-Y3GCUFM4.js → load-KGDNVUBX.js} +2 -2
  176. package/dist/cli/chunks/load-test-LN245SSD.js +2 -0
  177. package/dist/cli/chunks/{mcp-LKPIBZ3W.js → mcp-4LETGVIV.js} +2 -2
  178. package/dist/cli/chunks/{memory-L57MLFOP.js → memory-II4I4QMO.js} +5 -5
  179. package/dist/cli/chunks/memory-backend-SVM7YRIE.js +2 -0
  180. package/dist/cli/chunks/memory-handlers-TQXTOJGQ.js +2 -0
  181. package/dist/cli/chunks/opencode-installer-EU6JCWBW.js +3 -0
  182. package/dist/cli/chunks/{orchestrator-QHSBB2UC.js → orchestrator-YLMGJVSP.js} +5 -5
  183. package/dist/cli/chunks/{pipeline-D3QER35Z.js → pipeline-MPZJWYKK.js} +2 -2
  184. package/dist/cli/chunks/{platform-T4E7Q3RD.js → platform-YH35ZZFZ.js} +2 -2
  185. package/dist/cli/chunks/{plugin-JHW2YPRC.js → plugin-B7JYZFNQ.js} +2 -2
  186. package/dist/cli/chunks/{prime-radiant-advanced-wasm-G7CFNNQV.js → prime-radiant-advanced-wasm-KTUK6UE2.js} +2 -2
  187. package/dist/cli/chunks/protocol-executor-IEN2XB4L.js +2 -0
  188. package/dist/cli/chunks/{protocol-handler-2BQQ4HDM.js → protocol-handler-3NXMVU34.js} +2 -2
  189. package/dist/cli/chunks/{prove-UQ6JFT73.js → prove-H5LMGSUC.js} +2 -2
  190. package/dist/cli/chunks/qe-reasoning-bank-Q3ZV3JRG.js +2 -0
  191. package/dist/cli/chunks/{quality-JRZYMC77.js → quality-RCWHY6GO.js} +2 -2
  192. package/dist/cli/chunks/queen-coordinator-E6ON3JUR.js +2 -0
  193. package/dist/cli/chunks/real-embeddings-NKH4VURF.js +2 -0
  194. package/dist/cli/chunks/{roocode-installer-F4E2LAYR.js → roocode-installer-SB7QJYM3.js} +2 -2
  195. package/dist/cli/chunks/router-WMC3LZ3C.js +2 -0
  196. package/dist/cli/chunks/routing-feedback-VKCZRCE3.js +2 -0
  197. package/dist/cli/chunks/{routing-handler-VNKFUUGB.js → routing-handler-SY7GKG2W.js} +2 -2
  198. package/dist/cli/chunks/ruvector-commands-HATTO3UQ.js +8 -0
  199. package/dist/cli/chunks/rvf-dual-writer-D57EXQUD.js +2 -0
  200. package/dist/cli/chunks/rvf-migration-adapter-OWDYN6KD.js +2 -0
  201. package/dist/cli/chunks/rvf-migration-coordinator-SIQVJB5S.js +2 -0
  202. package/dist/cli/chunks/rvf-native-adapter-C7NBH5UN.js +2 -0
  203. package/dist/cli/chunks/safe-db-5KLXCNXN.js +2 -0
  204. package/dist/cli/chunks/schedule-HAWWOXWB.js +2 -0
  205. package/dist/cli/chunks/scheduler-HTRDY5BC.js +2 -0
  206. package/dist/cli/chunks/{security-EBEG2OPU.js → security-DS3XLZWN.js} +3 -3
  207. package/dist/cli/chunks/shared-rvf-adapter-6I2Z5UGL.js +2 -0
  208. package/dist/cli/chunks/shared-rvf-dual-writer-YB7AH6XJ.js +2 -0
  209. package/dist/cli/chunks/sqlite-persistence-WNNRGTGG.js +2 -0
  210. package/dist/cli/chunks/{status-handler-VZ32M4G4.js → status-handler-TUYHE4FT.js} +2 -2
  211. package/dist/cli/chunks/{structural-health-K6LRCKV6.js → structural-health-XNGBNRRD.js} +2 -2
  212. package/dist/cli/chunks/{sync-MHSHNLIM.js → sync-K6CIRKBB.js} +2 -2
  213. package/dist/cli/chunks/{task-handler-JNOIBZ2G.js → task-handler-7PJY67DR.js} +2 -2
  214. package/dist/cli/chunks/task-handlers-WB5CDWUR.js +2 -0
  215. package/dist/cli/chunks/{test-DO22BNIL.js → test-WV5ALEBB.js} +4 -4
  216. package/dist/cli/chunks/{test-scheduling-VLRQZEFL.js → test-scheduling-N55ZGGA2.js} +3 -3
  217. package/dist/cli/chunks/token-bootstrap-SINWHAKR.js +2 -0
  218. package/dist/cli/chunks/{token-usage-LG3PXRXH.js → token-usage-R7TGEVGL.js} +2 -2
  219. package/dist/cli/chunks/transformers-6DBLXPV7.js +2 -0
  220. package/dist/cli/chunks/{tree-sitter-wasm-parser-FT2KB66N.js → tree-sitter-wasm-parser-7C7FKMQW.js} +2 -2
  221. package/dist/cli/chunks/types-VNPMOKQT.js +2 -0
  222. package/dist/cli/chunks/unified-memory-72SKVZ7Y.js +2 -0
  223. package/dist/cli/chunks/unified-memory-hnsw-TMN2L77W.js +2 -0
  224. package/dist/cli/chunks/unified-persistence-MDN3SRCR.js +2 -0
  225. package/dist/cli/chunks/{validate-VQCRSVNQ.js → validate-53MNIRAF.js} +2 -2
  226. package/dist/cli/chunks/{validate-swarm-A5DHAWTP.js → validate-swarm-ZY4RGUFO.js} +2 -2
  227. package/dist/cli/chunks/{vibium-RZBSL4EB.js → vibium-PBADBIV6.js} +2 -2
  228. package/dist/cli/chunks/visual-security-TRBCXPIB.js +2 -0
  229. package/dist/cli/chunks/{web-tree-sitter-7C4NXEOF.js → web-tree-sitter-O7VI6RLB.js} +2 -2
  230. package/dist/cli/chunks/{windsurf-installer-ES3KPQG3.js → windsurf-installer-HV3C3TAD.js} +2 -2
  231. package/dist/cli/chunks/witness-chain-4WIMYP4X.js +2 -0
  232. package/dist/cli/chunks/witness-chain-JOI2YYGK.js +2 -0
  233. package/dist/cli/chunks/{workflow-JETHX4ML.js → workflow-5RVAQ4TM.js} +4 -4
  234. package/dist/cli/chunks/workflow-orchestrator-2NQ72S3C.js +2 -0
  235. package/dist/cli/chunks/{wrappers-WP5RH745.js → wrappers-RRHCCA3E.js} +2 -2
  236. package/dist/cli/commands/ruvector-commands.js +14 -2
  237. package/dist/cli/index.js +10 -15
  238. package/dist/coordination/agent-memory-branch.d.ts +117 -0
  239. package/dist/coordination/agent-memory-branch.js +213 -0
  240. package/dist/coordination/agent-teams/mailbox.d.ts +43 -0
  241. package/dist/coordination/agent-teams/mailbox.js +130 -4
  242. package/dist/coordination/handlers/handler-utils.d.ts +1 -0
  243. package/dist/coordination/handlers/handler-utils.js +9 -2
  244. package/dist/coordination/handlers/quality-handlers.js +7 -1
  245. package/dist/domains/contract-testing/coordinator.js +11 -0
  246. package/dist/domains/quality-assessment/coherence/gate-controller.d.ts +20 -1
  247. package/dist/domains/quality-assessment/coherence/gate-controller.js +64 -0
  248. package/dist/domains/quality-assessment/coherence/index.d.ts +3 -3
  249. package/dist/domains/quality-assessment/coherence/index.js +2 -2
  250. package/dist/domains/quality-assessment/coherence/types.d.ts +39 -0
  251. package/dist/domains/quality-assessment/coherence/types.js +11 -0
  252. package/dist/domains/quality-assessment/coordinator.d.ts +14 -0
  253. package/dist/domains/quality-assessment/coordinator.js +92 -0
  254. package/dist/domains/test-execution/coordinator.d.ts +19 -0
  255. package/dist/domains/test-execution/coordinator.js +102 -5
  256. package/dist/domains/test-generation/coordinator.js +11 -0
  257. package/dist/domains/test-generation/interfaces.d.ts +2 -0
  258. package/dist/domains/test-generation/services/test-generator.d.ts +9 -0
  259. package/dist/domains/test-generation/services/test-generator.js +37 -0
  260. package/dist/init/agents-installer.d.ts +5 -3
  261. package/dist/init/agents-installer.js +17 -43
  262. package/dist/init/find-package-root.d.ts +22 -0
  263. package/dist/init/find-package-root.js +46 -0
  264. package/dist/init/n8n-installer.d.ts +4 -2
  265. package/dist/init/n8n-installer.js +23 -23
  266. package/dist/init/opencode-installer.d.ts +0 -5
  267. package/dist/init/opencode-installer.js +12 -39
  268. package/dist/init/skills-installer.d.ts +5 -2
  269. package/dist/init/skills-installer.js +15 -37
  270. package/dist/integrations/embeddings/index/HNSWIndex.d.ts +9 -2
  271. package/dist/integrations/embeddings/index/HNSWIndex.js +110 -35
  272. package/dist/integrations/ruvector/cognitive-routing.d.ts +67 -0
  273. package/dist/integrations/ruvector/cognitive-routing.js +208 -0
  274. package/dist/integrations/ruvector/feature-flags.d.ts +84 -0
  275. package/dist/integrations/ruvector/feature-flags.js +59 -0
  276. package/dist/integrations/ruvector/hdc-fingerprint.d.ts +76 -0
  277. package/dist/integrations/ruvector/hdc-fingerprint.js +217 -0
  278. package/dist/integrations/ruvector/hyperbolic-hnsw.d.ts +59 -0
  279. package/dist/integrations/ruvector/hyperbolic-hnsw.js +194 -0
  280. package/dist/integrations/ruvector/index.d.ts +5 -2
  281. package/dist/integrations/ruvector/index.js +13 -2
  282. package/dist/integrations/ruvector/shared-rvf-adapter.d.ts +24 -0
  283. package/dist/integrations/ruvector/shared-rvf-adapter.js +55 -0
  284. package/dist/integrations/ruvector/shared-rvf-dual-writer.d.ts +6 -0
  285. package/dist/integrations/ruvector/shared-rvf-dual-writer.js +38 -0
  286. package/dist/integrations/ruvector/sona-persistence.d.ts +8 -0
  287. package/dist/integrations/ruvector/sona-persistence.js +10 -0
  288. package/dist/integrations/ruvector/vector-delta-tracker.d.ts +96 -0
  289. package/dist/integrations/ruvector/vector-delta-tracker.js +226 -0
  290. package/dist/kernel/agent-coordinator.d.ts +75 -1
  291. package/dist/kernel/agent-coordinator.js +250 -1
  292. package/dist/kernel/hnsw-legacy-bridge.d.ts +38 -0
  293. package/dist/kernel/hnsw-legacy-bridge.js +88 -0
  294. package/dist/kernel/hnsw-shadow-validator.d.ts +91 -0
  295. package/dist/kernel/hnsw-shadow-validator.js +139 -0
  296. package/dist/kernel/index.d.ts +1 -1
  297. package/dist/kernel/index.js +1 -1
  298. package/dist/kernel/interfaces.d.ts +39 -0
  299. package/dist/kernel/kernel.d.ts +23 -0
  300. package/dist/kernel/kernel.js +106 -1
  301. package/dist/kernel/unified-memory.d.ts +1 -1
  302. package/dist/kernel/unified-memory.js +7 -3
  303. package/dist/learning/aqe-learning-engine.d.ts +65 -0
  304. package/dist/learning/aqe-learning-engine.js +134 -0
  305. package/dist/learning/dream/dream-engine.d.ts +6 -1
  306. package/dist/learning/dream/dream-engine.js +37 -2
  307. package/dist/learning/dream/dream-scheduler.d.ts +25 -0
  308. package/dist/learning/dream/dream-scheduler.js +120 -0
  309. package/dist/learning/dream/rvcow-branch-manager.d.ts +6 -3
  310. package/dist/learning/dream/rvcow-branch-manager.js +60 -5
  311. package/dist/learning/experience-capture.d.ts +3 -3
  312. package/dist/learning/hyperbolic-pattern-index.d.ts +82 -0
  313. package/dist/learning/hyperbolic-pattern-index.js +142 -0
  314. package/dist/learning/index.d.ts +3 -3
  315. package/dist/learning/index.js +1 -1
  316. package/dist/learning/metrics-tracker.d.ts +44 -0
  317. package/dist/learning/metrics-tracker.js +37 -0
  318. package/dist/learning/pattern-promotion.d.ts +3 -3
  319. package/dist/learning/pattern-store.d.ts +45 -2
  320. package/dist/learning/pattern-store.js +239 -4
  321. package/dist/learning/qe-patterns.d.ts +1 -1
  322. package/dist/learning/qe-reasoning-bank.js +1 -1
  323. package/dist/learning/rvf-pattern-migration.d.ts +50 -0
  324. package/dist/learning/rvf-pattern-migration.js +106 -0
  325. package/dist/learning/rvf-pattern-store.d.ts +69 -0
  326. package/dist/learning/rvf-pattern-store.js +449 -0
  327. package/dist/mcp/bundle.js +1894 -1804
  328. package/dist/mcp/handlers/index.d.ts +1 -0
  329. package/dist/mcp/handlers/index.js +2 -0
  330. package/dist/mcp/handlers/migration-handlers.d.ts +52 -0
  331. package/dist/mcp/handlers/migration-handlers.js +85 -0
  332. package/dist/mcp/protocol-server.d.ts +1 -0
  333. package/dist/mcp/protocol-server.js +63 -2
  334. package/dist/mcp/types.d.ts +1 -1
  335. package/dist/optimization/early-exit-token-optimizer.d.ts +7 -7
  336. package/dist/optimization/early-exit-token-optimizer.js +3 -3
  337. package/dist/persistence/rvf-consistency-validator.d.ts +85 -0
  338. package/dist/persistence/rvf-consistency-validator.js +182 -0
  339. package/dist/persistence/rvf-migration-adapter.d.ts +125 -0
  340. package/dist/persistence/rvf-migration-adapter.js +303 -0
  341. package/dist/persistence/rvf-migration-coordinator.d.ts +115 -0
  342. package/dist/persistence/rvf-migration-coordinator.js +224 -0
  343. package/dist/persistence/rvf-stage-gate.d.ts +70 -0
  344. package/dist/persistence/rvf-stage-gate.js +163 -0
  345. package/package.json +10 -10
  346. package/dist/cli/chunks/adapter-WBR5NXS3.js +0 -2
  347. package/dist/cli/chunks/aqe-learning-engine-TK4JQCGT.js +0 -2
  348. package/dist/cli/chunks/base-2WXOSMBQ.js +0 -2
  349. package/dist/cli/chunks/better-sqlite3-7KY2RDXO.js +0 -2
  350. package/dist/cli/chunks/brain-handler-PPEGDCN4.js +0 -68
  351. package/dist/cli/chunks/browser-workflow-42F7GK5T.js +0 -2
  352. package/dist/cli/chunks/chunk-263XS447.js +0 -2
  353. package/dist/cli/chunks/chunk-2I7J3O6V.js +0 -2
  354. package/dist/cli/chunks/chunk-3JPRUND5.js +0 -2
  355. package/dist/cli/chunks/chunk-3THRQEZ2.js +0 -95
  356. package/dist/cli/chunks/chunk-4B6NCELM.js +0 -2
  357. package/dist/cli/chunks/chunk-62ADTHV7.js +0 -2
  358. package/dist/cli/chunks/chunk-BR26T7ZS.js +0 -180
  359. package/dist/cli/chunks/chunk-DRT3WKQW.js +0 -2
  360. package/dist/cli/chunks/chunk-FIA6X7UL.js +0 -2
  361. package/dist/cli/chunks/chunk-J3KWWR6Z.js +0 -1
  362. package/dist/cli/chunks/chunk-JZSDOIXA.js +0 -2
  363. package/dist/cli/chunks/chunk-MV6CMOJQ.js +0 -65
  364. package/dist/cli/chunks/chunk-N5UXCLFI.js +0 -2
  365. package/dist/cli/chunks/chunk-OF4D7MYI.js +0 -2
  366. package/dist/cli/chunks/chunk-QOVHWZEP.js +0 -1
  367. package/dist/cli/chunks/chunk-RFSN6IDA.js +0 -79
  368. package/dist/cli/chunks/chunk-X5IJGWYG.js +0 -2
  369. package/dist/cli/chunks/ci-output-7JN7F6CI.js +0 -2
  370. package/dist/cli/chunks/client-MCSNSH2C.js +0 -2
  371. package/dist/cli/chunks/complexity-analyzer-AB4OZARV.js +0 -2
  372. package/dist/cli/chunks/cost-tracker-4F723RB6.js +0 -2
  373. package/dist/cli/chunks/cross-domain-router-OWR5IJ5G.js +0 -2
  374. package/dist/cli/chunks/dag-attention-scheduler-JWO6XI6A.js +0 -2
  375. package/dist/cli/chunks/detect-L6ZZHUSX.js +0 -2
  376. package/dist/cli/chunks/domain-transfer-5Y4FGJAJ.js +0 -2
  377. package/dist/cli/chunks/dream-4TDBIYED.js +0 -2
  378. package/dist/cli/chunks/esm-node-2PKHKOTS.js +0 -2
  379. package/dist/cli/chunks/feature-flags-IVQ3AL4Q.js +0 -2
  380. package/dist/cli/chunks/file-discovery-QFPA6GMV.js +0 -2
  381. package/dist/cli/chunks/gnn-wrapper-OYC55N5E.js +0 -2
  382. package/dist/cli/chunks/hnsw-index-YO7CT23I.js +0 -2
  383. package/dist/cli/chunks/hnswlib-node-56YWVXFE.js +0 -2
  384. package/dist/cli/chunks/hypergraph-engine-A4Y2ZRAG.js +0 -2
  385. package/dist/cli/chunks/impact-analyzer-UEIGXSZ4.js +0 -2
  386. package/dist/cli/chunks/init-wizard-JWZUGIPJ.js +0 -2
  387. package/dist/cli/chunks/kernel-YNDTVKIW.js +0 -2
  388. package/dist/cli/chunks/knowledge-graph-NGJKFTSN.js +0 -2
  389. package/dist/cli/chunks/load-test-GZUBXFF3.js +0 -2
  390. package/dist/cli/chunks/memory-backend-3NQIZUXE.js +0 -2
  391. package/dist/cli/chunks/memory-handlers-MDZQ7HVW.js +0 -2
  392. package/dist/cli/chunks/opencode-installer-4HUB36H5.js +0 -3
  393. package/dist/cli/chunks/protocol-executor-SPUVRDWT.js +0 -2
  394. package/dist/cli/chunks/qe-reasoning-bank-3HBK2FVD.js +0 -2
  395. package/dist/cli/chunks/queen-coordinator-RW3NKO5A.js +0 -2
  396. package/dist/cli/chunks/real-embeddings-GK63VF35.js +0 -2
  397. package/dist/cli/chunks/router-RJGHWDQ3.js +0 -2
  398. package/dist/cli/chunks/routing-feedback-ZXBXFKX6.js +0 -2
  399. package/dist/cli/chunks/ruvector-commands-2TLNHC3A.js +0 -8
  400. package/dist/cli/chunks/rvf-dual-writer-MQW2SJLT.js +0 -2
  401. package/dist/cli/chunks/rvf-native-adapter-LKFKTMUN.js +0 -2
  402. package/dist/cli/chunks/safe-db-G22E5ROA.js +0 -2
  403. package/dist/cli/chunks/schedule-Y7VVCPYV.js +0 -2
  404. package/dist/cli/chunks/scheduler-AUQIFQB7.js +0 -2
  405. package/dist/cli/chunks/shared-rvf-dual-writer-BVSCQAFS.js +0 -2
  406. package/dist/cli/chunks/sqlite-persistence-JAVHUGGL.js +0 -2
  407. package/dist/cli/chunks/task-handlers-P5DSUKND.js +0 -2
  408. package/dist/cli/chunks/token-bootstrap-4VJKGVMK.js +0 -2
  409. package/dist/cli/chunks/transformers-GY7SIKEU.js +0 -2
  410. package/dist/cli/chunks/types-QJGNBKP2.js +0 -2
  411. package/dist/cli/chunks/unified-memory-XYGENQUT.js +0 -2
  412. package/dist/cli/chunks/unified-memory-hnsw-MVEGQBF3.js +0 -2
  413. package/dist/cli/chunks/unified-persistence-PFRCWEUG.js +0 -2
  414. package/dist/cli/chunks/visual-security-V47BLGJM.js +0 -2
  415. package/dist/cli/chunks/witness-chain-BR63P4A7.js +0 -2
  416. package/dist/cli/chunks/workflow-orchestrator-7PZMX3JZ.js +0 -2
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{c as s,e as t}from"./chunk-4I2IOUS4.js";var y={};t(y,{DEFAULT_FEATURE_FLAGS:()=>r,getRuVectorFeatureFlags:()=>u,initFeatureFlagsFromEnv:()=>W,isCNNVisualRegressionEnabled:()=>A,isCoherenceActionGateEnabled:()=>g,isCoherenceGateEnabled:()=>d,isColdTierGNNEnabled:()=>M,isCrossDomainTransferEnabled:()=>N,isCusumDriftDetectionEnabled:()=>V,isDAGAttentionEnabled:()=>b,isDeltaEventSourcingEnabled:()=>G,isDeterministicDitherEnabled:()=>S,isEpropOnlineLearningEnabled:()=>P,isEwcPlusPlusEnabled:()=>D,isFlashAttentionEnabled:()=>a,isGNNIndexEnabled:()=>R,isGrangerCausalityEnabled:()=>Q,isGraphMAEEnabled:()=>L,isHDCFingerprintingEnabled:()=>I,isHnswHealthMonitorEnabled:()=>U,isHopfieldMemoryEnabled:()=>F,isMetaLearningEnabled:()=>H,isMetadataFilteringEnabled:()=>T,isNativeHNSWEnabled:()=>_,isNeuralRoutingEnabled:()=>C,isReasoningQECEnabled:()=>v,isRegretTrackingEnabled:()=>O,isReservoirReplayEnabled:()=>m,isSONAEnabled:()=>E,isSONAThreeLoopEnabled:()=>p,isSpectralSparsificationEnabled:()=>x,isSublinearSolverEnabled:()=>h,isTemporalCompressionEnabled:()=>c,isWitnessChainEnabled:()=>f,resetRuVectorFeatureFlags:()=>i,setRuVectorFeatureFlags:()=>o,shouldLogMigrationMetrics:()=>l});function u(){return{...e}}function o(n){e={...e,...n}}function i(){e={...r}}function E(){return e.useQESONA}function a(){return e.useQEFlashAttention}function R(){return e.useQEGNNIndex}function l(){return e.logMigrationMetrics}function _(){return e.useNativeHNSW}function c(){return e.useTemporalCompression}function T(){return e.useMetadataFiltering}function S(){return e.useDeterministicDither}function C(){return e.useNeuralRouting}function p(){return e.useSONAThreeLoop}function N(){return e.useCrossDomainTransfer}function U(){return e.useHnswHealthMonitor}function O(){return e.useRegretTracking}function d(){return e.useCoherenceGate}function f(){return e.useWitnessChain}function A(){return e.useCNNVisualRegression}function b(){return e.useDAGAttention}function g(){return e.useCoherenceActionGate}function v(){return e.useReasoningQEC}function I(){return e.useHDCFingerprinting}function V(){return e.useCusumDriftDetection}function G(){return e.useDeltaEventSourcing}function D(){return e.useEwcPlusPlusRegularization}function L(){return e.useGraphMAEEmbeddings}function F(){return e.useHopfieldMemory}function M(){return e.useColdTierGNN}function H(){return e.useMetaLearningEnhancements}function h(){return e.useSublinearSolver}function x(){return e.useSpectralSparsification}function m(){return e.useReservoirReplay}function P(){return e.useEpropOnlineLearning}function Q(){return e.useGrangerCausality}function W(){let n={};process.env.RUVECTOR_USE_SONA!==void 0&&(n.useQESONA=process.env.RUVECTOR_USE_SONA==="true"),process.env.RUVECTOR_USE_FLASH_ATTENTION!==void 0&&(n.useQEFlashAttention=process.env.RUVECTOR_USE_FLASH_ATTENTION==="true"),process.env.RUVECTOR_USE_GNN_INDEX!==void 0&&(n.useQEGNNIndex=process.env.RUVECTOR_USE_GNN_INDEX==="true"),process.env.RUVECTOR_LOG_MIGRATION_METRICS!==void 0&&(n.logMigrationMetrics=process.env.RUVECTOR_LOG_MIGRATION_METRICS==="true"),process.env.RUVECTOR_USE_NATIVE_HNSW!==void 0&&(n.useNativeHNSW=process.env.RUVECTOR_USE_NATIVE_HNSW==="true"),process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION!==void 0&&(n.useTemporalCompression=process.env.RUVECTOR_USE_TEMPORAL_COMPRESSION==="true"),process.env.RUVECTOR_USE_METADATA_FILTERING!==void 0&&(n.useMetadataFiltering=process.env.RUVECTOR_USE_METADATA_FILTERING==="true"),process.env.RUVECTOR_USE_DETERMINISTIC_DITHER!==void 0&&(n.useDeterministicDither=process.env.RUVECTOR_USE_DETERMINISTIC_DITHER==="true"),process.env.RUVECTOR_USE_NEURAL_ROUTING!==void 0&&(n.useNeuralRouting=process.env.RUVECTOR_USE_NEURAL_ROUTING==="true"),process.env.RUVECTOR_USE_SONA_THREE_LOOP!==void 0&&(n.useSONAThreeLoop=process.env.RUVECTOR_USE_SONA_THREE_LOOP==="true"),process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER!==void 0&&(n.useCrossDomainTransfer=process.env.RUVECTOR_USE_CROSS_DOMAIN_TRANSFER==="true"),process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR!==void 0&&(n.useHnswHealthMonitor=process.env.RUVECTOR_USE_HNSW_HEALTH_MONITOR==="true"),process.env.RUVECTOR_USE_REGRET_TRACKING!==void 0&&(n.useRegretTracking=process.env.RUVECTOR_USE_REGRET_TRACKING==="true"),process.env.RUVECTOR_USE_COHERENCE_GATE!==void 0&&(n.useCoherenceGate=process.env.RUVECTOR_USE_COHERENCE_GATE==="true"),process.env.RUVECTOR_USE_WITNESS_CHAIN!==void 0&&(n.useWitnessChain=process.env.RUVECTOR_USE_WITNESS_CHAIN==="true"),process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION!==void 0&&(n.useCNNVisualRegression=process.env.RUVECTOR_USE_CNN_VISUAL_REGRESSION==="true"),process.env.RUVECTOR_USE_DAG_ATTENTION!==void 0&&(n.useDAGAttention=process.env.RUVECTOR_USE_DAG_ATTENTION==="true"),process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE!==void 0&&(n.useCoherenceActionGate=process.env.RUVECTOR_USE_COHERENCE_ACTION_GATE==="true"),process.env.RUVECTOR_USE_REASONING_QEC!==void 0&&(n.useReasoningQEC=process.env.RUVECTOR_USE_REASONING_QEC==="true"),process.env.RUVECTOR_USE_HDC_FINGERPRINTING!==void 0&&(n.useHDCFingerprinting=process.env.RUVECTOR_USE_HDC_FINGERPRINTING==="true"),process.env.RUVECTOR_USE_CUSUM_DRIFT_DETECTION!==void 0&&(n.useCusumDriftDetection=process.env.RUVECTOR_USE_CUSUM_DRIFT_DETECTION==="true"),process.env.RUVECTOR_USE_DELTA_EVENT_SOURCING!==void 0&&(n.useDeltaEventSourcing=process.env.RUVECTOR_USE_DELTA_EVENT_SOURCING==="true"),process.env.RUVECTOR_USE_EWC_PLUS_PLUS!==void 0&&(n.useEwcPlusPlusRegularization=process.env.RUVECTOR_USE_EWC_PLUS_PLUS==="true"),process.env.RUVECTOR_USE_META_LEARNING!==void 0&&(n.useMetaLearningEnhancements=process.env.RUVECTOR_USE_META_LEARNING==="true"),process.env.RUVECTOR_USE_SUBLINEAR_SOLVER!==void 0&&(n.useSublinearSolver=process.env.RUVECTOR_USE_SUBLINEAR_SOLVER==="true"),process.env.RUVECTOR_USE_SPECTRAL_SPARSIFICATION!==void 0&&(n.useSpectralSparsification=process.env.RUVECTOR_USE_SPECTRAL_SPARSIFICATION==="true"),process.env.RUVECTOR_USE_RESERVOIR_REPLAY!==void 0&&(n.useReservoirReplay=process.env.RUVECTOR_USE_RESERVOIR_REPLAY==="true"),process.env.RUVECTOR_USE_EPROP_ONLINE_LEARNING!==void 0&&(n.useEpropOnlineLearning=process.env.RUVECTOR_USE_EPROP_ONLINE_LEARNING==="true"),process.env.RUVECTOR_USE_GRANGER_CAUSALITY!==void 0&&(n.useGrangerCausality=process.env.RUVECTOR_USE_GRANGER_CAUSALITY==="true"),o(n)}var r,e,w=s(()=>{r={useQESONA:!0,useQEFlashAttention:!0,useQEGNNIndex:!0,logMigrationMetrics:!0,useNativeHNSW:!0,useTemporalCompression:!0,useMetadataFiltering:!0,useDeterministicDither:!0,useNeuralRouting:!0,useSONAThreeLoop:!0,useCrossDomainTransfer:!0,useHnswHealthMonitor:!0,useRegretTracking:!0,useCoherenceGate:!0,useWitnessChain:!0,useCNNVisualRegression:!0,useDAGAttention:!0,useCoherenceActionGate:!0,useReasoningQEC:!0,useHDCFingerprinting:!0,useCusumDriftDetection:!0,useDeltaEventSourcing:!0,useEwcPlusPlusRegularization:!0,useGraphMAEEmbeddings:!0,useHopfieldMemory:!0,useColdTierGNN:!0,useMetaLearningEnhancements:!0,useSublinearSolver:!0,useSpectralSparsification:!0,useReservoirReplay:!0,useEpropOnlineLearning:!0,useGrangerCausality:!0},e={...r}});export{r as a,u as b,o as c,i as d,E as e,a as f,R as g,l as h,_ as i,c as j,T as k,S as l,C as m,p as n,N as o,U as p,O as q,d as r,f as s,A as t,b as u,g as v,v as w,I as x,V as y,G as z,D as A,L as B,F as C,M as D,H as E,h as F,x as G,m as H,P as I,Q as J,W as K,y as L,w as M};
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{a as e,b as g,e as r}from"./chunk-4VUPRTVX.js";import{c as o}from"./chunk-4I2IOUS4.js";var L=o(()=>{"use strict";e();g();r()});export{L as a};
@@ -1,95 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{c as x}from"./chunk-GRUUQAR6.js";import{f as y}from"./chunk-SUSEVMZT.js";import{a as H}from"./chunk-3JPRUND5.js";import{c as N}from"./chunk-4VUPRTVX.js";import{b as E,d as k}from"./chunk-WGMPEW2T.js";import{a as D,c as $}from"./chunk-JZSDOIXA.js";import{a as R,b as U,d as Q}from"./chunk-DRT3WKQW.js";var B={dbPath:".agentic-qe/dream.db",similarityThreshold:.5,maxEdgesPerNode:20,walMode:!0,debug:!1};k();$();var A=class{config;db=null;persistence=null;prepared=new Map;initialized=!1;constructor(e){this.config={...B,...e}}async initialize(){if(!this.initialized)try{if(this.persistence=x(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase(),this.prepareStatements(),this.initialized=!0,this.config.debug){let e=await this.getStats();console.log(`[ConceptGraph] Initialized: ${this.persistence.getDbPath()}`,e)}}catch(e){throw new Error(`Failed to initialize ConceptGraph: ${D(e)}`)}}prepareStatements(){if(!this.db)throw new Error("Database not initialized");this.prepared.set("insertNode",this.db.prepare(`
3
- INSERT INTO concept_nodes
4
- (id, concept_type, content, embedding, activation_level, last_activated, pattern_id, metadata)
5
- VALUES (?, ?, ?, ?, ?, ?, ?, ?)
6
- `)),this.prepared.set("getNode",this.db.prepare(`
7
- SELECT * FROM concept_nodes WHERE id = ?
8
- `)),this.prepared.set("updateActivation",this.db.prepare(`
9
- UPDATE concept_nodes
10
- SET activation_level = ?, last_activated = datetime('now')
11
- WHERE id = ?
12
- `)),this.prepared.set("getActiveNodes",this.db.prepare(`
13
- SELECT * FROM concept_nodes
14
- WHERE activation_level >= ?
15
- ORDER BY activation_level DESC
16
- `)),this.prepared.set("getNodesByType",this.db.prepare(`
17
- SELECT * FROM concept_nodes WHERE concept_type = ?
18
- `)),this.prepared.set("getAllNodes",this.db.prepare(`
19
- SELECT * FROM concept_nodes
20
- `)),this.prepared.set("insertEdge",this.db.prepare(`
21
- INSERT INTO concept_edges
22
- (id, source, target, edge_type, weight, evidence)
23
- VALUES (?, ?, ?, ?, ?, ?)
24
- `)),this.prepared.set("getEdge",this.db.prepare(`
25
- SELECT * FROM concept_edges WHERE source = ? AND target = ?
26
- `)),this.prepared.set("updateEdge",this.db.prepare(`
27
- UPDATE concept_edges
28
- SET weight = ?, evidence = evidence + 1, updated_at = datetime('now')
29
- WHERE source = ? AND target = ?
30
- `)),this.prepared.set("getOutgoingEdges",this.db.prepare(`
31
- SELECT * FROM concept_edges WHERE source = ?
32
- `)),this.prepared.set("getIncomingEdges",this.db.prepare(`
33
- SELECT * FROM concept_edges WHERE target = ?
34
- `)),this.prepared.set("countNodes",this.db.prepare(`
35
- SELECT COUNT(*) as count FROM concept_nodes
36
- `)),this.prepared.set("countEdges",this.db.prepare(`
37
- SELECT COUNT(*) as count FROM concept_edges
38
- `)),this.prepared.set("countByType",this.db.prepare(`
39
- SELECT concept_type, COUNT(*) as count FROM concept_nodes GROUP BY concept_type
40
- `))}async addNode(e){this.ensureInitialized();let t=y(),n=new Date().toISOString(),i=this.prepared.get("insertNode");if(!i)throw new Error("Prepared statement not found: insertNode");let a=e.embedding?Buffer.from(new Float32Array(e.embedding).buffer):null;return i.run(t,e.conceptType,e.content,a,0,n,e.patternId||null,e.metadata?JSON.stringify(e.metadata):null),this.config.debug&&console.log(`[ConceptGraph] Added node: ${t} (${e.conceptType})`),t}async getNode(e){this.ensureInitialized();let t=this.prepared.get("getNode");if(!t)throw new Error("Prepared statement not found: getNode");let n=t.get(e);return n?this.rowToNode(n):null}async updateActivation(e,t){this.ensureInitialized();let n=this.prepared.get("updateActivation");if(!n)throw new Error("Prepared statement not found: updateActivation");let i=Math.max(0,Math.min(1,t));n.run(i,e)}async getActiveNodes(e=.1){this.ensureInitialized();let t=this.prepared.get("getActiveNodes");if(!t)throw new Error("Prepared statement not found: getActiveNodes");return t.all(e).map(i=>this.rowToNode(i))}async getNodesByType(e){this.ensureInitialized();let t=this.prepared.get("getNodesByType");if(!t)throw new Error("Prepared statement not found: getNodesByType");return t.all(e).map(i=>this.rowToNode(i))}async addEdge(e,t,n,i=1){this.ensureInitialized();let a=await this.getEdgeBetween(e,t);if(a)return await this.strengthenEdge(e,t,.1),a.id;let r=y(),o=this.prepared.get("insertEdge");if(!o)throw new Error("Prepared statement not found: insertEdge");return o.run(r,e,t,n,Math.max(0,Math.min(1,i)),1),this.config.debug&&console.log(`[ConceptGraph] Added edge: ${e} -> ${t} (${n})`),r}async strengthenEdge(e,t,n=.1){this.ensureInitialized();let i=await this.getEdgeBetween(e,t);if(!i)return;let a=Math.min(1,i.weight+n),r=this.prepared.get("updateEdge");if(!r)throw new Error("Prepared statement not found: updateEdge");r.run(a,e,t)}async getNeighbors(e){this.ensureInitialized();let t=[],n=this.prepared.get("getOutgoingEdges");if(!n)throw new Error("Prepared statement not found: getOutgoingEdges");let i=n.all(e);for(let o of i){let s=await this.getNode(o.target);s&&t.push({node:s,edge:this.rowToEdge(o)})}let a=this.prepared.get("getIncomingEdges");if(!a)throw new Error("Prepared statement not found: getIncomingEdges");let r=a.all(e);for(let o of r){let s=await this.getNode(o.source);s&&t.push({node:s,edge:this.rowToEdge(o)})}return t}async findPath(e,t,n=5){this.ensureInitialized();let i=new Set,a=[{nodeId:e,path:[e]}];for(;a.length>0;){let r=a.shift();if(r.nodeId===t){let s=[];for(let c of r.path){let l=await this.getNode(c);l&&s.push(l)}return s}if(r.path.length>n||i.has(r.nodeId))continue;i.add(r.nodeId);let o=await this.getNeighbors(r.nodeId);for(let{node:s}of o)i.has(s.id)||a.push({nodeId:s.id,path:[...r.path,s.id]})}return[]}async getCluster(e,t=2){this.ensureInitialized();let n=new Set,i=[],a=async(r,o)=>{if(n.has(r)||o>t)return;n.add(r);let s=await this.getNode(r);if(s&&(i.push(s),o<t)){let c=await this.getNeighbors(r);for(let{node:l}of c)await a(l.id,o+1)}};return await a(e,0),i}async loadFromPatterns(e){this.ensureInitialized();let t=0,n=[],i=new Map;for(let a of e)try{if(await this.findNodeByPatternId(a.id))continue;let o=await this.addNode({conceptType:"pattern",content:`${a.name}: ${a.description}`,patternId:a.id,metadata:{domain:a.domain,patternType:a.patternType,confidence:a.confidence,successRate:a.successRate}});t++,n.push(o);let s=a.domain||"unknown";i.has(s)||i.set(s,[]),i.get(s).push(o);let c=await this.findDomainNode(a.domain);if(!c){let l=await this.addNode({conceptType:"domain",content:a.domain,metadata:{patternCount:1}});c=await this.getNode(l)}c&&await this.addEdge(o,c.id,"co_occurrence",.8)}catch(r){this.config.debug&&console.error(`[ConceptGraph] Failed to load pattern: ${a.id}`,r)}if(t>0){let a=await this.discoverSameDomainEdges(i),r=await this.pruneEdges();this.config.debug&&console.log(`[ConceptGraph] Discovered ${a} same-domain edges, pruned ${r}`)}return console.log(`[ConceptGraph] Loaded ${t} new patterns (${e.length-t} already existed)`),t}async discoverSameDomainEdges(e){if(this.ensureInitialized(),!this.db)return 0;let t=15,n=5e3,i=0;if(e&&e.size>0)for(let[a,r]of e){let o=this.countDomainSimilarityEdges(a);if(o>=n){console.log(`[ConceptGraph] Domain '${a}' already at edge cap (${o}/${n}), skipping`);continue}let s=new Set(r),c=n-o,p=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type = 'pattern'").all().filter(u=>{if(s.has(u.id))return!1;let m=u.metadata?E(u.metadata):{};return String(m.domain||"unknown")===a}),h=this.db.transaction(()=>{let u=0;for(let m of r){let v=0;for(let f of p){if(v>=t||u>=c)break;if(!this.prepared.get("getEdge")?.get(m,f.id)){let w=y();this.prepared.get("insertEdge").run(w,m,f.id,"similarity",.6,1),u++,v++}}if(u>=c)break}for(let m=0;m<r.length&&u<c;m++){let v=0;for(let f=m+1;f<r.length&&u<c&&!(v>=t);f++)if(!this.prepared.get("getEdge")?.get(r[m],r[f])){let w=y();this.prepared.get("insertEdge").run(w,r[m],r[f],"similarity",.6,1),u++,v++}}return u});i+=h()}else{let a=this.db.prepare("SELECT id, metadata FROM concept_nodes WHERE concept_type = 'pattern'").all(),r=new Map;for(let s of a){let c=s.metadata?E(s.metadata):{},l=String(c.domain||"unknown");r.has(l)||r.set(l,[]),r.get(l).push(s)}let o=this.db.transaction(()=>{let s=0;for(let[c,l]of r){let p=this.countDomainSimilarityEdges(c);if(p>=n)continue;let h=0,u=n-p;for(let m=0;m<l.length&&h<u;m++){let v=0;for(let f=m+1;f<l.length&&h<u&&!(v>=t);f++)if(!this.prepared.get("getEdge")?.get(l[m].id,l[f].id)){let w=y();this.prepared.get("insertEdge").run(w,l[m].id,l[f].id,"similarity",.6,1),s++,h++,v++}}}return s});i+=o()}return i}countDomainSimilarityEdges(e){return this.db?this.db.prepare(`
41
- SELECT COUNT(*) as count FROM concept_edges e
42
- JOIN concept_nodes n ON e.source = n.id
43
- WHERE e.edge_type = 'similarity'
44
- AND n.concept_type = 'pattern'
45
- AND json_extract(n.metadata, '$.domain') = ?
46
- `).get(e).count:0}async pruneEdges(e=15,t=.3){if(this.ensureInitialized(),!this.db)return 0;let n=0;return n=this.db.transaction(()=>{let a=0,r=this.db.prepare(`
47
- DELETE FROM concept_edges
48
- WHERE edge_type = 'similarity' AND weight < ?
49
- `).run(t);a+=r.changes;let o=this.db.prepare(`
50
- SELECT source, COUNT(*) as cnt FROM concept_edges
51
- WHERE edge_type = 'similarity'
52
- GROUP BY source
53
- HAVING cnt > ?
54
- `).all(e);for(let{source:s}of o){let c=this.db.prepare(`
55
- DELETE FROM concept_edges
56
- WHERE id IN (
57
- SELECT id FROM concept_edges
58
- WHERE source = ? AND edge_type = 'similarity'
59
- ORDER BY weight DESC
60
- LIMIT -1 OFFSET ?
61
- )
62
- `).run(s,e);a+=c.changes}return a})(),n>0&&console.log(`[ConceptGraph] Pruned ${n} edges (maxPerNode=${e}, minWeight=${t})`),n}async getStats(){this.ensureInitialized();let e=this.prepared.get("countNodes"),t=this.prepared.get("countEdges"),n=this.prepared.get("countByType");if(!e||!t||!n)throw new Error("Prepared statements not found");let i=e.get().count,a=t.get().count,r={pattern:0,technique:0,domain:0,outcome:0,error:0},o=n.all();for(let c of o)r[c.concept_type]=c.count;let s=0;return i>0&&(s=this.db.prepare("SELECT AVG(activation_level) as avg FROM concept_nodes").get().avg||0),{nodeCount:i,edgeCount:a,byType:r,avgEdgesPerNode:i>0?a/i:0,avgActivation:s}}async close(){this.prepared.clear(),this.db=null,this.persistence=null,this.initialized=!1}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ConceptGraph not initialized. Call initialize() first.")}async getEdgeBetween(e,t){let n=this.prepared.get("getEdge");if(!n)throw new Error("Prepared statement not found: getEdge");let i=n.get(e,t);return i?this.rowToEdge(i):null}async findDomainNode(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE concept_type = 'domain' AND content = ?").get(e);return n?this.rowToNode(n):null}async findNodeByPatternId(e){if(!this.db)return null;let n=this.db.prepare("SELECT * FROM concept_nodes WHERE pattern_id = ? LIMIT 1").get(e);return n?this.rowToNode(n):null}rowToNode(e){let t;if(e.embedding){let n=e.embedding,i=new Float32Array(n.buffer,n.byteOffset,n.byteLength/4);t=Array.from(i)}return{id:e.id,conceptType:e.concept_type,content:e.content,embedding:t,activationLevel:e.activation_level||0,lastActivated:e.last_activated?new Date(e.last_activated):void 0,patternId:e.pattern_id||void 0,metadata:e.metadata?E(e.metadata):void 0,createdAt:e.created_at?new Date(e.created_at):void 0}}rowToEdge(e){return{id:e.id,source:e.source,target:e.target,weight:e.weight,edgeType:e.edge_type,evidence:e.evidence,createdAt:e.created_at?new Date(e.created_at):void 0,updatedAt:e.updated_at?new Date(e.updated_at):void 0}}};function X(d){return new A(d)}Q();function Y(d,e){if(e<0||e>=d.length)return d[0]??0;let t=0,n=d.length-1;for(;t<n;){let i=t+n>>1;if(d[i]<d[t]){let s=d[t];d[t]=d[i],d[i]=s}if(d[n]<d[t]){let s=d[t];d[t]=d[n],d[n]=s}if(d[i]<d[n]){let s=d[i];d[i]=d[n],d[n]=s}let a=d[n],r=t;for(let s=t;s<n;s++)if(d[s]<=a){let c=d[r];d[r]=d[s],d[s]=c,r++}let o=d[r];if(d[r]=d[n],d[n]=o,r===e)return d[r];r<e?t=r+1:n=r-1}return d[t]}var P=1e4,O=5e4,F=.8,V={decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},I=class{graph;config;activationHistory=new Map;coActivationCounts=new Map;constructor(e,t={}){this.graph=e,this.config={...V,...t}}async spread(e,t=1,n){let i=e.filter(p=>this.graph.getConcept(p)!==void 0);if(i.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};for(let p of i)this.graph.setActivation(p,t),this.recordActivation(p,t);let a=0,r=t,o=0,s=0;for(;a<this.config.maxIterations&&!(n!==void 0&&Date.now()>=n);){let p=await this.spreadIteration(),h=this.graph.getActiveNodes(this.config.threshold);for(let u of h)u.activationLevel>r&&(r=u.activationLevel);if(h.length===o&&p===0){if(s++,s>=3)break}else s=0;o=h.length,a++}let c=this.graph.getActiveNodes(this.config.threshold).map(p=>({nodeId:p.id,activation:p.activationLevel})).sort((p,h)=>h.activation-p.activation),l=await this.findNovelAssociations(this.config.threshold);return this.trimHistory(),{iterations:a,nodesActivated:c.length,peakActivation:r,activatedNodes:c,novelAssociations:l.map(p=>({source:p.source.id,target:p.target.id,strength:p.coActivation}))}}async dream(e){let t=Date.now(),n=[],i=0,a=0,r=new Set,o=this.graph.getAllConcepts(0);if(o.length===0)return{iterations:0,nodesActivated:0,peakActivation:0,activatedNodes:[],novelAssociations:[]};let s=t+e;for(;Date.now()<s;){let p=U(0,o.length),h=o[p];if(h){let u=this.config.noiseLevel+R()*this.config.noiseLevel*2,m=h.activationLevel,v=Math.min(1,m+u+.3);this.graph.setActivation(h.id,v);let f=await this.spread([h.id],v,s);i+=f.iterations,f.peakActivation>a&&(a=f.peakActivation);for(let b of f.activatedNodes)r.add(b.nodeId);for(let b of f.novelAssociations)n.push(b)}if(Date.now()>=s)break;await this.sleep(50+R()*50)}let c=this.deduplicateAssociations(n),l=Array.from(r).map(p=>{let h=this.graph.getConcept(p);return{nodeId:p,activation:h?.activationLevel??0}}).filter(p=>p.activation>0).sort((p,h)=>h.activation-p.activation);return this.trimHistory(),{iterations:i,nodesActivated:l.length,peakActivation:a,activatedNodes:l,novelAssociations:c.slice(0,20)}}async findNovelAssociations(e){let t=e??this.config.threshold,n=this.graph.getActiveNodes(t);if(n.length<2)return[];let i=200;n.length>i&&(n=n.sort((r,o)=>o.activationLevel-r.activationLevel).slice(0,i));let a=[];for(let r=0;r<n.length;r++)for(let o=r+1;o<n.length;o++){let s=n[r],c=n[o],l=Math.sqrt(s.activationLevel*c.activationLevel),p=this.graph.getEdge(s.id,c.id),h=this.graph.getEdge(c.id,s.id),u=p!==void 0||h!==void 0,m=p?.weight??h?.weight??0,v=!u||m<.3;l>.3&&(a.push({source:s,target:c,coActivation:l,isNovel:v}),this.trackCoActivation(s.id,c.id))}return a.sort((r,o)=>r.isNovel!==o.isNovel?r.isNovel?-1:1:o.coActivation-r.coActivation).slice(0,10)}async reset(){let e=this.graph.getAllConcepts(0);for(let t of e)this.graph.setActivation(t.id,0);this.activationHistory.clear(),this.coActivationCounts.clear()}getConfig(){return{...this.config}}trimActivationHistory(){if(this.activationHistory.size<=P)return;let e=Math.floor(P*F),t=this.activationHistory.size-e,n=Array.from(this.activationHistory.keys()).slice(0,t);for(let i of n)this.activationHistory.delete(i)}trimCoActivationCounts(){if(this.coActivationCounts.size<=O)return;let e=Math.floor(O*F),t=this.coActivationCounts.size-e,n=Array.from(this.coActivationCounts.values()),i=Y(n,t-1),a=[];for(let[r,o]of this.coActivationCounts){if(a.length>=t)break;o<=i&&a.push(r)}for(let r of a)this.coActivationCounts.delete(r)}trimHistory(){this.trimActivationHistory(),this.trimCoActivationCounts()}getHistorySizes(){return{activationHistorySize:this.activationHistory.size,coActivationCountsSize:this.coActivationCounts.size}}async spreadIteration(){let e=this.graph.getActiveNodes(this.config.threshold),t=0,n=[];for(let i of e){let a=this.graph.getEdges(i.id);for(let r of a){let o=this.graph.getConcept(r.target);if(!o)continue;let s=i.activationLevel*r.weight*this.config.spreadFactor;if(s>.01){let c=o.activationLevel,l=Math.min(1,c+s);n.push({nodeId:r.target,newActivation:l})}}}for(let i of n){let a=this.graph.getConcept(i.nodeId);a&&i.newActivation>a.activationLevel&&(this.graph.setActivation(i.nodeId,i.newActivation),this.recordActivation(i.nodeId,i.newActivation),t++)}return this.applyDecay(),this.injectNoise(),t}applyDecay(){let e=1-this.config.decayRate;this.graph.decayActivations(e)}injectNoise(){if(this.config.noiseLevel<=0)return;let e=this.graph.getAllConcepts(0);for(let t of e)if(t.activationLevel>0){let n=(R()-.5)*2*this.config.noiseLevel,i=Math.max(0,Math.min(1,t.activationLevel+n));this.graph.setActivation(t.id,i)}}recordActivation(e,t){let n=this.activationHistory.get(e)||[];n.push(t),n.length>50&&n.shift(),this.activationHistory.set(e,n)}trackCoActivation(e,t){let n=[e,t].sort().join(":"),i=this.coActivationCounts.get(n)||0;this.coActivationCounts.set(n,i+1)}deduplicateAssociations(e){let t=new Map;for(let n of e){let i=[n.source,n.target].sort().join(":"),a=t.get(i);(!a||n.strength>a.strength)&&t.set(i,n)}return Array.from(t.values()).sort((n,i)=>i.strength-n.strength)}sleep(e){return new Promise(t=>setTimeout(t,e))}};import{randomUUID as J}from"crypto";var q={minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},S=class{graph;config;constructor(e,t={}){this.graph=e,this.config={...q,...t}}async generateFromActivation(e,t){let n=[],i=t.activatedNodes.map(c=>this.graph.getConcept(c.nodeId)).filter(c=>c!==void 0);if(i.length<2)return[];let a=await this.detectPatternMerges(i);for(let c of a)c.cycleId=e,n.push(c);let r=await this.detectNovelAssociations(t.novelAssociations);for(let c of r)c.cycleId=e,n.push(c);let o=await this.detectOptimizations(i);for(let c of o)c.cycleId=e,n.push(c);let s=await this.detectGaps(i);for(let c of s)c.cycleId=e,n.push(c);return n.filter(c=>c.noveltyScore>=this.config.minNoveltyScore).sort((c,l)=>l.noveltyScore-c.noveltyScore).slice(0,this.config.maxInsightsPerCycle)}async detectPatternMerges(e){let t=[],n=e.filter(i=>i.conceptType==="pattern"||i.conceptType==="technique");if(n.length<2)return t;for(let i=0;i<n.length;i++)for(let a=i+1;a<n.length;a++){let r=n[i],o=n[a],s=this.graph.getEdge(r.id,o.id),c=this.graph.getEdge(o.id,r.id),l=Math.max(s?.weight??0,c?.weight??0),p=this.calculateContentSimilarity(r.content,o.content),h=Math.sqrt(r.activationLevel*o.activationLevel),u=l*.4+p*.3+h*.3;if(u>.5){let m=this.calculateNovelty({type:"pattern_merge",sourceConcepts:[r.id,o.id]}),v=this.calculateConfidence({type:"pattern_merge",sourceConcepts:[r.id,o.id],edgeWeight:l,contentSimilarity:p,coActivation:h});t.push({id:this.generateId(),cycleId:"",type:"pattern_merge",sourceConcepts:[r.id,o.id],description:this.generatePatternMergeDescription(r,o,u),noveltyScore:m,confidenceScore:v,actionable:v>=this.config.minConfidence,applied:!1,suggestedAction:v>=this.config.minConfidence?`Merge "${this.truncate(r.content,30)}" with "${this.truncate(o.content,30)}" into a unified pattern.`:void 0,createdAt:new Date})}}return t}async detectNovelAssociations(e){let t=[];for(let n of e){let i=this.graph.getConcept(n.source),a=this.graph.getConcept(n.target);if(!i||!a)continue;let r=this.graph.getEdge(n.source,n.target);if(r&&r.weight>.5)continue;let o=i.conceptType!==a.conceptType,s=this.calculateNovelty({type:"novel_association",sourceConcepts:[n.source,n.target],isCrossDomain:o,strength:n.strength}),c=this.calculateConfidence({type:"novel_association",sourceConcepts:[n.source,n.target],coActivation:n.strength,isCrossDomain:o});t.push({id:this.generateId(),cycleId:"",type:"novel_association",sourceConcepts:[n.source,n.target],description:this.generateNovelAssociationDescription(i,a,n.strength,o),noveltyScore:s,confidenceScore:c,actionable:c>=this.config.minConfidence,applied:!1,suggestedAction:c>=this.config.minConfidence?`Investigate connection between "${this.truncate(i.content,25)}" and "${this.truncate(a.content,25)}".`:void 0,createdAt:new Date})}return t}async detectOptimizations(e){let t=[];for(let n of e){if(n.conceptType!=="pattern"&&n.conceptType!=="technique")continue;let i=n.metadata??{},a=i.successRate,r=i.executionCount,o=i.confidence,s=a!==void 0&&a<.7,c=r!==void 0&&r>10,l=o!==void 0&&o<.6;if(s||c&&l){let p=this.calculateNovelty({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:s,hasHighUsage:c}),h=this.calculateConfidence({type:"optimization",sourceConcepts:[n.id],hasLowSuccess:s,hasHighUsage:c,metadata:i});t.push({id:this.generateId(),cycleId:"",type:"optimization",sourceConcepts:[n.id],description:this.generateOptimizationDescription(n,a,r),noveltyScore:p,confidenceScore:h,actionable:h>=this.config.minConfidence,applied:!1,suggestedAction:h>=this.config.minConfidence?`Review and optimize "${this.truncate(n.content,40)}" to improve success rate.`:void 0,createdAt:new Date})}}return t}async detectGaps(e){let t=[],n={pattern:[],technique:[],domain:[],outcome:[],error:[]};for(let i of e){let a=i.conceptType??"pattern";n[a]||(n[a]=[]),n[a].push(i)}for(let i of n.error??[])if(!this.graph.getEdges(i.id).some(o=>{let s=this.graph.getConcept(o.target);return s&&(s.conceptType==="pattern"||s.conceptType==="technique")})){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"}),s=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_resolution"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`No resolution pattern found for error: "${this.truncate(i.content,50)}". Consider creating a fix pattern.`,noveltyScore:o,confidenceScore:s,actionable:!0,applied:!1,suggestedAction:`Create a resolution pattern for: "${this.truncate(i.content,40)}".`,createdAt:new Date})}for(let i of n.outcome??[])if(!this.graph.getEdges(i.id).some(o=>{let s=this.graph.getConcept(o.target);return s&&s.conceptType==="technique"})&&(n.technique?.length??0)===0){let o=this.calculateNovelty({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"}),s=this.calculateConfidence({type:"gap_detection",sourceConcepts:[i.id],gapType:"missing_technique"});t.push({id:this.generateId(),cycleId:"",type:"gap_detection",sourceConcepts:[i.id],description:`Outcome "${this.truncate(i.content,40)}" has no associated technique. Document how this outcome is achieved.`,noveltyScore:o,confidenceScore:s,actionable:!0,applied:!1,suggestedAction:`Document the technique for achieving: "${this.truncate(i.content,35)}".`,createdAt:new Date})}return t}calculateNovelty(e){let t=.5;if(e.isCrossDomain&&(t+=.2),e.strength!==void 0&&e.strength>.5&&(t+=.15),e.type==="gap_detection"&&(t+=.2),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.sourceConcepts.length>=2){let n=this.graph.getEdge(e.sourceConcepts[0],e.sourceConcepts[1]);n?n.weight<.3&&(t+=.05):t+=.1}return Math.min(1,Math.max(0,t))}calculateConfidence(e){let t=.4;if(e.coActivation!==void 0&&(t+=e.coActivation*.3),e.edgeWeight!==void 0&&(t+=e.edgeWeight*.2),e.contentSimilarity!==void 0&&e.type==="pattern_merge"&&(t+=e.contentSimilarity*.2),e.isCrossDomain&&(t-=.1),e.hasHighUsage&&e.hasLowSuccess&&(t+=.15),e.metadata){let n=Math.min(Object.keys(e.metadata).length*.05,.15);t+=n}return e.gapType&&(t+=.1),Math.min(1,Math.max(0,t))}async insightToPattern(e){if(!e.actionable)return null;let t=e.sourceConcepts.map(n=>this.graph.getConcept(n)).filter(n=>n!==void 0);if(t.length===0)return null;switch(e.type){case"pattern_merge":{let[n,i]=t;return{name:`Merged: ${this.truncate(n?.content??"",20)} + ${this.truncate(i?.content??"",20)}`,description:e.description,template:{type:"merged_pattern",sourcePatterns:e.sourceConcepts,mergedContent:t.map(a=>a.content).join(" | "),metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"novel_association":{let[n,i]=t;return{name:`Association: ${n?.conceptType} - ${i?.conceptType}`,description:e.description,template:{type:"association_pattern",source:{id:n?.id,type:n?.conceptType,content:n?.content},target:{id:i?.id,type:i?.conceptType,content:i?.content},metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"optimization":{let[n]=t;return{name:`Optimized: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"optimization_pattern",originalPattern:n?.id,suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}case"gap_detection":{let[n]=t;return{name:`Gap Fill: ${this.truncate(n?.content??"",30)}`,description:e.description,template:{type:"gap_fill_pattern",relatedConcept:n?.id,gapType:n?.conceptType==="error"?"missing_resolution":"missing_technique",suggestedAction:e.suggestedAction,metadata:{noveltyScore:e.noveltyScore,confidenceScore:e.confidenceScore,createdFrom:"dream_insight"}}}}default:return null}}generateId(){let e=Date.now(),t=J().slice(0,8);return`insight-${e}-${t}`}calculateContentSimilarity(e,t){let n=e.toLowerCase().split(/\s+/),i=t.toLowerCase().split(/\s+/),a=new Set(n),r=new Set(i),o=n.filter(c=>r.has(c)),s=a.size+r.size-o.length;return s===0?0:o.length/s}truncate(e,t){return e.length<=t?e:e.substring(0,t-3)+"..."}generatePatternMergeDescription(e,t,n){return`Pattern merge opportunity (${Math.round(n*100)}% match): "${this.truncate(e.content,40)}" and "${this.truncate(t.content,40)}" share similar structure and could be combined.`}generateNovelAssociationDescription(e,t,n,i){let a=Math.round(n*100);return`Novel association discovered${i?" (cross-domain)":""}: [${e.conceptType}] "${this.truncate(e.content,30)}" is connected to [${t.conceptType}] "${this.truncate(t.content,30)}" with ${a}% co-activation strength.`}generateOptimizationDescription(e,t,n){let i=[`Optimization opportunity for "${this.truncate(e.content,40)}":`];return t!==void 0&&i.push(`Success rate is ${Math.round(t*100)}%.`),n!==void 0&&i.push(`Used ${n} times.`),i.push("Consider reviewing and improving this pattern."),i.join(" ")}getConfig(){return{...this.config}}};k();$();H();var T={maxPatternCountDrop:.05,maxAvgConfidenceDrop:.02,maxHighConfidenceLoss:.05},C=class{constructor(e,t=T){this.db=e;this.thresholds=t}activeBranches=new Map;listeners=[];rvfAdapter;useRvfFork=!1;_witnessChain=null;set witnessChain(e){this._witnessChain=e}setRvfAdapter(e,t=!0){this.rvfAdapter=e,this.useRvfFork=t}createBranch(e){if(this.activeBranches.has(e))throw new Error(`Branch '${e}' already exists`);let t=this.sanitizeSavepointName(e),n=this.captureBaseline();this.db.exec(`SAVEPOINT "${t}"`);let i={name:e,createdAt:new Date,status:"active",baselineSnapshot:n};if(this.rvfAdapter&&this.useRvfFork)try{this.rvfAdapter.fork(`/tmp/dream-branch-${e}.rvf`)}catch{}return this.activeBranches.set(e,i),this.emit("dream:branch_created",i),i}validateBranch(e,t){this.ensureBranchActive(e.name);let n=t??e.baselineSnapshot,i=this.captureBaseline(),a=i.patternCount-n.patternCount,r=i.avgConfidence-n.avgConfidence,o=n.highConfidenceCount-i.highConfidenceCount,s=[],c=!0;if(n.patternCount>0){let p=-a/n.patternCount;p>this.thresholds.maxPatternCountDrop&&(c=!1,s.push(`Pattern count dropped by ${(p*100).toFixed(1)}% (threshold: ${(this.thresholds.maxPatternCountDrop*100).toFixed(1)}%)`))}if(r<-this.thresholds.maxAvgConfidenceDrop&&(c=!1,s.push(`Avg confidence dropped by ${(-r).toFixed(4)} (threshold: ${this.thresholds.maxAvgConfidenceDrop})`)),n.highConfidenceCount>0&&o>0){let p=o/n.highConfidenceCount;p>this.thresholds.maxHighConfidenceLoss&&(c=!1,s.push(`${o} high-confidence patterns lost (${(p*100).toFixed(1)}%, threshold: ${(this.thresholds.maxHighConfidenceLoss*100).toFixed(1)}%)`))}let l=c?"All quality checks passed":`Validation failed: ${s.join("; ")}`;return{passed:c,reason:l,patternCountDelta:a,avgConfidenceDelta:r,highConfidenceLost:Math.max(0,o),postDreamMetrics:i}}mergeBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="merged",this.activeBranches.delete(e.name),this.emit("dream:branch_merged",e);try{this._witnessChain?.append("BRANCH_MERGE",{branchName:e.name},"rvcow-branch-manager")}catch{}}discardBranch(e){this.ensureBranchActive(e.name);let t=this.sanitizeSavepointName(e.name);this.db.exec(`ROLLBACK TO SAVEPOINT "${t}"`),this.db.exec(`RELEASE SAVEPOINT "${t}"`),e.status="discarded",this.activeBranches.delete(e.name),this.emit("dream:branch_discarded",e)}listBranches(){return Array.from(this.activeBranches.values())}onEvent(e){this.listeners.push(e)}offEvent(e){let t=this.listeners.indexOf(e);t>=0&&this.listeners.splice(t,1)}captureBaseline(){let e=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get(),t=this.db.prepare("SELECT AVG(confidence) as avg_conf FROM qe_patterns").get(),n=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns WHERE confidence >= 0.8").get();return{patternCount:e?.cnt??0,avgConfidence:t?.avg_conf??0,highConfidenceCount:n?.cnt??0,capturedAt:new Date}}ensureBranchActive(e){let t=this.activeBranches.get(e);if(!t)throw new Error(`Branch '${e}' not found or not active`);if(t.status!=="active")throw new Error(`Branch '${e}' is ${t.status}, not active`)}sanitizeSavepointName(e){return e.replace(/[^a-zA-Z0-9_-]/g,"_")}emit(e,t,n){for(let i of this.listeners)try{i(e,t,n)}catch{}}};var M=N.create("dream-engine"),W={maxDurationMs:3e4,minConceptsRequired:10,activationConfig:{decayRate:.1,spreadFactor:.5,threshold:.1,maxIterations:20,noiseLevel:.05},insightConfig:{minNoveltyScore:.3,minConfidence:.5,maxInsightsPerCycle:10},enableBranching:!0,branchValidationThresholds:{...T}},z=class{constructor(e){this.graph=e}nodeCache=new Map;edgeCache=new Map;activationLevels=new Map;async loadIntoMemory(e){this.nodeCache.clear(),this.edgeCache.clear(),this.activationLevels.clear();let t=await this.graph.getActiveNodes(0);e&&t.length>e&&(t=t.sort((n,i)=>i.activationLevel-n.activationLevel).slice(0,e));for(let n of t)this.nodeCache.set(n.id,n),this.activationLevels.set(n.id,n.activationLevel);for(let n of t){let a=(await this.graph.getNeighbors(n.id)).map(r=>r.edge);this.edgeCache.set(n.id,a)}}async persistActivations(){let e=Array.from(this.activationLevels.entries());for(let[t,n]of e)await this.graph.updateActivation(t,n)}getConcept(e){let t=this.nodeCache.get(e);if(t)return{...t,activationLevel:this.activationLevels.get(e)??t.activationLevel}}getAllConcepts(e){let t=e??0;return Array.from(this.nodeCache.values()).map(n=>({...n,activationLevel:this.activationLevels.get(n.id)??n.activationLevel})).filter(n=>n.activationLevel>=t)}getActiveNodes(e){return this.getAllConcepts(e)}getEdges(e){return this.edgeCache.get(e)??[]}getEdge(e,t){return(this.edgeCache.get(e)??[]).find(i=>i.target===t)}setActivation(e,t){this.activationLevels.set(e,Math.max(0,Math.min(1,t)))}decayActivations(e){let t=Array.from(this.activationLevels.entries());for(let[n,i]of t)this.activationLevels.set(n,i*e)}getStats(){let e=Array.from(this.nodeCache.values()),t={pattern:0,technique:0,domain:0,outcome:0,error:0},n=0;for(let r of e)t[r.conceptType]=(t[r.conceptType]??0)+1,n+=this.activationLevels.get(r.id)??r.activationLevel;let i=0,a=Array.from(this.edgeCache.values());for(let r of a)i+=r.length;return{nodeCount:e.length,edgeCount:i,byType:t,avgEdgesPerNode:e.length>0?i/e.length:0,avgActivation:e.length>0?n/e.length:0}}},_=class{config;persistence=null;graph=null;db=null;branchManager=null;currentCycle=null;initialized=!1;cancelled=!1;branchEventListeners=[];_witnessChain=null;set witnessChain(e){this._witnessChain=e}constructor(e){this.config={...W,...e}}async initialize(){if(!this.initialized)try{this.persistence=x(),this.persistence.isInitialized()||await this.persistence.initialize(),this.db=this.persistence.getDatabase(),this.migrateSchema(),this.graph=new A,await this.graph.initialize(),this.config.enableBranching&&(this.branchManager=new C(this.db,this.config.branchValidationThresholds)),this.initialized=!0,console.log(`[DreamEngine] Initialized: ${this.persistence.getDbPath()}`)}catch(e){throw new Error(`Failed to initialize DreamEngine: ${D(e)}`)}}migrateSchema(){if(this.db)try{let e=this.db.prepare("PRAGMA table_info(dream_cycles)").all(),t=e.some(s=>s.name==="duration_ms"),n=e.some(s=>s.name==="duration");!t&&n&&this.db.exec("ALTER TABLE dream_cycles RENAME COLUMN duration TO duration_ms");let i=this.db.prepare("PRAGMA table_info(dream_insights)").all(),a=new Set(i.map(s=>s.name)),r=a.has("insight_type"),o=a.has("source_concepts");if(!r)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN insight_type TEXT NOT NULL DEFAULT 'general'"),M.info("Added insight_type column to dream_insights (safe migration)")}catch{}if(!o)try{this.db.exec("ALTER TABLE dream_insights ADD COLUMN source_concepts TEXT NOT NULL DEFAULT '[]'"),M.info("Added source_concepts column to dream_insights (safe migration)")}catch{}this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_cycle ON dream_insights(cycle_id)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_type ON dream_insights(insight_type)"),this.db.exec("CREATE INDEX IF NOT EXISTS idx_insight_novelty ON dream_insights(novelty_score DESC)")}catch(e){M.debug("Dream schema migration skipped",{error:e instanceof Error?e.message:String(e)})}}async dream(e){this.ensureInitialized(),this.cancelled=!1;let t=e??this.config.maxDurationMs,n=Date.now();this.currentCycle={id:y(),startTime:new Date,conceptsProcessed:0,associationsFound:0,insightsGenerated:0,status:"running"},await this.saveCycle(this.currentCycle);let i=null;if(this.branchManager){let a=`dream-${this.currentCycle.id}-${Date.now()}`;i=this.branchManager.createBranch(a),this.emitBranchEvent("dream:branch_created",i)}try{let a=await this.graph.getActiveNodes(0);if(a.length<this.config.minConceptsRequired)throw new Error(`Insufficient concepts: ${a.length} < ${this.config.minConceptsRequired}`);let r=new z(this.graph);await r.loadIntoMemory(30);let s=await new I(r,this.config.activationConfig).dream(t);if(this.cancelled)throw this.currentCycle.status="interrupted",this.currentCycle.endTime=new Date,this.currentCycle.durationMs=Date.now()-n,await this.updateCycle(this.currentCycle),new Error("Dream cycle cancelled");this.currentCycle.conceptsProcessed=s.nodesActivated,this.currentCycle.associationsFound=s.novelAssociations.length,await r.persistActivations();let l=await new S(r,this.config.insightConfig).generateFromActivation(this.currentCycle.id,s);this.currentCycle.insightsGenerated=l.length;for(let h of l)await this.saveInsight(h);if(this.currentCycle.endTime=new Date,this.currentCycle.durationMs=Date.now()-n,this.currentCycle.status="completed",await this.updateCycle(this.currentCycle),i&&this.branchManager){let h=this.branchManager.validateBranch(i);if(h.passed){this.branchManager.mergeBranch(i),this.emitBranchEvent("dream:branch_merged",i,h);try{this._witnessChain?.append("DREAM_MERGE",{cycleId:this.currentCycle.id,branchName:i.name},"dream-engine")}catch{}}else{this.branchManager.discardBranch(i),this.emitBranchEvent("dream:branch_discarded",i,h);try{this._witnessChain?.append("DREAM_DISCARD",{cycleId:this.currentCycle.id,branchName:i.name,reason:h.reason},"dream-engine")}catch{}M.warn("Dream branch discarded: quality validation failed",{cycleId:this.currentCycle.id,reason:h.reason})}i=null}let p={cycle:{...this.currentCycle},insights:l,activationStats:{totalIterations:s.iterations,peakActivation:s.peakActivation,nodesActivated:s.nodesActivated},patternsCreated:0};return this.currentCycle=null,p}catch(a){if(i&&this.branchManager)try{this.branchManager.discardBranch(i),this.emitBranchEvent("dream:branch_discarded",i)}catch{}throw this.currentCycle&&(this.currentCycle.status==="running"&&(this.currentCycle.status="failed"),this.currentCycle.error=D(a),this.currentCycle.endTime=new Date,this.currentCycle.durationMs=Date.now()-n,await this.updateCycle(this.currentCycle)),this.currentCycle=null,a}}async loadPatternsAsConcepts(e){return this.ensureInitialized(),this.graph.loadFromPatterns(e)}async ensureConceptsLoaded(){if(this.ensureInitialized(),(await this.graph.getActiveNodes(0)).length>=this.config.minConceptsRequired)return 0;let t=this.db.prepare(`SELECT id, name, description, qe_domain as domain, pattern_type as patternType,
63
- confidence, success_rate as successRate
64
- FROM qe_patterns
65
- WHERE confidence >= 0.3
66
- ORDER BY quality_score DESC
67
- LIMIT 200`).all();return t.length===0?0:this.graph.loadFromPatterns(t)}async applyInsight(e){this.ensureInitialized();try{let t=await this.getInsightRowById(e);if(!t)return{success:!1,error:`Insight not found: ${e}`};if(t.actionable!==1)return{success:!1,error:"Insight is not actionable"};if(t.applied===1)return{success:!0,patternId:t.pattern_id??void 0,error:"Insight already applied"};let n=`dream-pattern-${y()}`;return this.db.prepare(`
68
- UPDATE dream_insights
69
- SET applied = 1, pattern_id = ?
70
- WHERE id = ?
71
- `).run(n,e),{success:!0,patternId:n}}catch(t){return{success:!1,error:D(t)}}}async getPendingInsights(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
72
- SELECT * FROM dream_insights
73
- WHERE applied = 0 AND actionable = 1
74
- ORDER BY novelty_score DESC, confidence_score DESC
75
- LIMIT ?
76
- `).all(t).map(a=>this.rowToInsight(a))}async getDreamHistory(e){this.ensureInitialized();let t=e??20;return this.db.prepare(`
77
- SELECT * FROM dream_cycles
78
- ORDER BY start_time DESC
79
- LIMIT ?
80
- `).all(t).map(a=>this.rowToCycle(a))}async cancelDream(){this.cancelled=!0}isDreaming(){return this.currentCycle!==null&&this.currentCycle.status==="running"}getCurrentCycle(){return this.currentCycle?{...this.currentCycle}:null}async saveCycle(e){if(!this.db)return;this.db.prepare(`
81
- INSERT INTO dream_cycles
82
- (id, start_time, end_time, duration_ms, concepts_processed, associations_found,
83
- insights_generated, status, error, created_at)
84
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
85
- `).run(e.id,e.startTime.toISOString(),e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.startTime.toISOString())}async updateCycle(e){if(!this.db)return;this.db.prepare(`
86
- UPDATE dream_cycles
87
- SET end_time = ?, duration_ms = ?, concepts_processed = ?, associations_found = ?,
88
- insights_generated = ?, status = ?, error = ?
89
- WHERE id = ?
90
- `).run(e.endTime?.toISOString()??null,e.durationMs??null,e.conceptsProcessed,e.associationsFound,e.insightsGenerated,e.status,e.error??null,e.id)}async saveInsight(e){if(!this.db)return;this.db.prepare(`
91
- INSERT INTO dream_insights
92
- (id, cycle_id, insight_type, source_concepts, description, novelty_score,
93
- confidence_score, actionable, applied, suggested_action, pattern_id)
94
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
95
- `).run(e.id,e.cycleId,e.type,JSON.stringify(e.sourceConcepts),e.description,e.noveltyScore,e.confidenceScore,e.actionable?1:0,0,e.suggestedAction??null,null)}async getInsightRowById(e){return this.db?this.db.prepare("SELECT * FROM dream_insights WHERE id = ?").get(e)??null:null}getBranchManager(){return this.branchManager}onBranchEvent(e){this.branchEventListeners.push(e)}emitBranchEvent(e,t,n){for(let i of this.branchEventListeners)try{i(e,t,n)}catch{}}async close(){this.graph&&(await this.graph.close(),this.graph=null),this.db=null,this.persistence=null,this.branchManager=null,this.initialized=!1,this.currentCycle=null}ensureInitialized(){if(!this.initialized||!this.graph||!this.db)throw new Error("DreamEngine not initialized. Call initialize() first.")}rowToCycle(e){return{id:e.id,startTime:new Date(e.start_time),endTime:e.end_time?new Date(e.end_time):void 0,durationMs:e.duration_ms??void 0,conceptsProcessed:e.concepts_processed,associationsFound:e.associations_found,insightsGenerated:e.insights_generated,status:e.status,error:e.error??void 0}}rowToInsight(e){return{id:e.id,cycleId:e.cycle_id,type:e.insight_type,sourceConcepts:E(e.source_concepts),description:e.description,noveltyScore:e.novelty_score,confidenceScore:e.confidence_score,actionable:e.actionable===1,applied:e.applied===1,patternId:e.pattern_id??void 0,suggestedAction:e.suggested_action??void 0,createdAt:new Date(e.created_at)}}};function K(d){return new _(d)}var Z=_;H();var g=N.create("DreamScheduler"),j={autoScheduleIntervalMs:36e5,minTimeBetweenDreamsMs:3e5,experienceThreshold:20,enableExperienceTrigger:!0,enableQualityGateFailureTrigger:!0,enableDomainMilestoneTrigger:!1,defaultDreamDurationMs:1e4,quickDreamDurationMs:5e3,fullDreamDurationMs:3e4,autoApplyHighConfidenceInsights:!1,insightConfidenceThreshold:.8},L=class{config;dreamEngine;eventBus;memoryBackend;initialized=!1;running=!1;dreaming=!1;experienceBuffer=[];lastDreamTime=null;scheduledDreamTimer=null;totalDreamsCompleted=0;subscriptions=[];lastDreamResult=null;constructor(e,t){if(!e.dreamEngine)throw new Error("DreamScheduler requires dreamEngine dependency");if(!e.eventBus)throw new Error("DreamScheduler requires eventBus dependency");this.dreamEngine=e.dreamEngine,this.eventBus=e.eventBus,this.memoryBackend=e.memoryBackend,this.config={...j,...t}}async initialize(){if(!this.initialized){if(this.config.enableQualityGateFailureTrigger){let e=this.eventBus.subscribe("quality-assessment:gate:completed",this.handleQualityGateEvent.bind(this));this.subscriptions.push(e)}if(this.config.enableDomainMilestoneTrigger){let e=this.eventBus.subscribe("coordination:milestone:reached",this.handleDomainMilestoneEvent.bind(this));this.subscriptions.push(e)}await this.restoreState(),this.initialized=!0,g.info("Initialized")}}start(){this.ensureInitialized(),!this.running&&(this.running=!0,this.scheduleNextDream(),g.info("Started"))}stop(){this.running&&(this.running=!1,this.clearScheduledDream(),g.info("Stopped"))}async dispose(){this.stop();for(let e of this.subscriptions)e.unsubscribe();this.subscriptions=[],await this.saveState(),this.initialized=!1,g.info("Disposed")}async triggerDream(e){if(this.ensureInitialized(),!this.canDream()){let t=this.getTimeUntilCanDream();throw new Error(`Cannot start dream: minimum interval not met. Wait ${Math.ceil(t/1e3)}s.`)}return this.executeDream(e??this.config.defaultDreamDurationMs)}async triggerQuickDream(){return this.triggerDream(this.config.quickDreamDurationMs)}async triggerFullDream(){return this.triggerDream(this.config.fullDreamDurationMs)}recordExperience(e){this.experienceBuffer.push(e),this.config.enableExperienceTrigger&&this.experienceBuffer.length>=this.config.experienceThreshold&&this.canDream()&&!this.dreaming&&(g.info("Experience threshold reached, triggering dream",{threshold:this.config.experienceThreshold}),this.executeDream(this.config.defaultDreamDurationMs).catch(t=>{g.error("Experience-triggered dream failed",t instanceof Error?t:void 0)}))}getExperienceBuffer(){return[...this.experienceBuffer]}clearExperienceBuffer(){this.experienceBuffer=[]}getStatus(){let e=this.scheduledDreamTimer?this.getTimeUntilScheduledDream():null;return{initialized:this.initialized,running:this.running,dreaming:this.dreaming,experienceCount:this.experienceBuffer.length,experienceThreshold:this.config.experienceThreshold,timeUntilNextDream:e,totalDreamsCompleted:this.totalDreamsCompleted,lastDreamTime:this.lastDreamTime,autoSchedulingEnabled:this.running}}getLastDreamResult(){return this.lastDreamResult}async executeDream(e){if(this.dreaming)throw new Error("A dream is already in progress");this.dreaming=!0,g.info("Starting dream cycle",{durationMs:e});try{let t=await this.dreamEngine.ensureConceptsLoaded();t>0&&g.info("Auto-loaded concepts for dream",{loaded:t});let n=await this.dreamEngine.dream(e);return this.lastDreamTime=new Date,this.lastDreamResult=n,this.totalDreamsCompleted++,this.clearExperienceBuffer(),this.config.autoApplyHighConfidenceInsights&&await this.autoApplyInsights(n),await this.publishDreamCompletedEvent(n),this.running&&this.scheduleNextDream(),g.info("Dream completed",{insightsGenerated:n.insights.length}),n}finally{this.dreaming=!1}}async autoApplyInsights(e){let t=e.insights.filter(n=>n.actionable&&n.confidenceScore>=this.config.insightConfidenceThreshold);for(let n of t)try{let i=await this.dreamEngine.applyInsight(n.id);i.success&&g.info("Auto-applied insight",{insightId:n.id,patternId:i.patternId})}catch(i){g.error("Failed to auto-apply insight",i instanceof Error?i:void 0,{insightId:n.id})}}scheduleNextDream(){if(this.clearScheduledDream(),!this.running)return;let e=this.calculateNextDreamDelay();this.scheduledDreamTimer=setTimeout(async()=>{if(!(!this.running||this.dreaming))try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){g.error("Scheduled dream failed",t instanceof Error?t:void 0),this.running&&this.scheduleNextDream()}},e),g.info("Next dream scheduled",{delaySeconds:Math.ceil(e/1e3)})}clearScheduledDream(){this.scheduledDreamTimer&&(clearTimeout(this.scheduledDreamTimer),this.scheduledDreamTimer=null)}calculateNextDreamDelay(){if(!this.lastDreamTime)return this.config.autoScheduleIntervalMs;let e=Date.now()-this.lastDreamTime.getTime(),t=this.config.autoScheduleIntervalMs-e;return Math.max(t,this.config.minTimeBetweenDreamsMs)}getTimeUntilScheduledDream(){return this.calculateNextDreamDelay()}canDream(){return this.lastDreamTime?Date.now()-this.lastDreamTime.getTime()>=this.config.minTimeBetweenDreamsMs:!0}getTimeUntilCanDream(){if(!this.lastDreamTime)return 0;let e=Date.now()-this.lastDreamTime.getTime();return Math.max(0,this.config.minTimeBetweenDreamsMs-e)}async handleQualityGateEvent(e){if(!e.payload.passed){if(!this.canDream()||this.dreaming){g.info("Quality gate failed but cannot start dream yet");return}g.info("Quality gate failed, triggering analysis dream");try{await this.executeDream(this.config.quickDreamDurationMs)}catch(t){g.error("Quality gate triggered dream failed",t instanceof Error?t:void 0)}}}async handleDomainMilestoneEvent(e){if(!this.canDream()||this.dreaming){g.info("Milestone reached but cannot start dream yet");return}g.info("Domain milestone reached, triggering consolidation dream");try{await this.executeDream(this.config.defaultDreamDurationMs)}catch(t){g.error("Milestone triggered dream failed",t instanceof Error?t:void 0)}}async publishDreamCompletedEvent(e){try{await this.eventBus.publish({id:y(),type:"learning-optimization:dream:completed",timestamp:new Date,source:"learning-optimization",payload:{cycleId:e.cycle.id,insightsGenerated:e.insights.length,patternsCreated:e.patternsCreated,duration:e.cycle.durationMs}})}catch(t){g.error("Failed to publish dream completed event",t instanceof Error?t:void 0)}}async saveState(){if(this.memoryBackend)try{await this.memoryBackend.set("dream-scheduler:state",{lastDreamTime:this.lastDreamTime?.toISOString()??null,totalDreamsCompleted:this.totalDreamsCompleted,experienceBuffer:this.experienceBuffer},{namespace:"learning-optimization",persist:!0})}catch(e){g.error("Failed to save state",e instanceof Error?e:void 0)}}async restoreState(){if(this.memoryBackend)try{let e=await this.memoryBackend.get("dream-scheduler:state");e&&(this.lastDreamTime=e.lastDreamTime?new Date(e.lastDreamTime):null,this.totalDreamsCompleted=e.totalDreamsCompleted??0,this.experienceBuffer=e.experienceBuffer??[],g.info("Restored state",{totalDreamsCompleted:this.totalDreamsCompleted,experienceCount:this.experienceBuffer.length}))}catch(e){g.error("Failed to restore state",e instanceof Error?e:void 0)}}ensureInitialized(){if(!this.initialized)throw new Error("DreamScheduler not initialized. Call initialize() first.")}};function ee(d,e){return new L(d,e)}var te=[{name:"aggressive-exploration",description:"High noise, fast decay -- explores widely but forgets quickly",activationConfig:{decayRate:.2,spreadFactor:.7,noiseLevel:.15,maxIterations:30}},{name:"conservative-consolidation",description:"Low noise, slow decay -- strengthens existing associations",activationConfig:{decayRate:.05,spreadFactor:.3,noiseLevel:.02,maxIterations:15}},{name:"balanced-discovery",description:"Moderate parameters -- balanced between exploration and consolidation",activationConfig:{decayRate:.1,spreadFactor:.5,noiseLevel:.05,maxIterations:20}}],G=class{constructor(e,t){this.db=e;this.branchManager=new C(e,t??T)}branchManager;async dream(e,t){if(e.length<1)throw new Error("At least one strategy is required");if(e.length>5)throw new Error("Maximum 5 strategies allowed to limit resource usage");let n=Date.now(),i=this.branchManager.captureBaseline(),a=[];for(let s of e){let c=await this.executeStrategy(s,i,t);a.push(c)}let r=a.filter(s=>s.validation.passed),o=null;if(r.length>0){o=r.reduce((c,l)=>{let p=this.scoreValidation(c.validation);return this.scoreValidation(l.validation)>p?l:c});let s=this.branchManager.createBranch(`dream-final-${o.strategy.name}-${Date.now()}`);try{await t(o.strategy.activationConfig),this.branchManager.mergeBranch(s),o.selected=!0}catch{this.branchManager.discardBranch(s),o.selected=!1,o=null}}return{strategies:a,winner:o,totalDurationMs:Date.now()-n}}getBranchManager(){return this.branchManager}async executeStrategy(e,t,n){let i=`dream-spec-${e.name}-${Date.now()}`,a=this.branchManager.createBranch(i),r=Date.now();try{await n(e.activationConfig);let o=this.branchManager.validateBranch(a,t);return this.branchManager.discardBranch(a),{strategy:e,branch:a,validation:o,selected:!1,durationMs:Date.now()-r}}catch{return this.branchManager.discardBranch(a),{strategy:e,branch:a,validation:{passed:!1,reason:"Dream execution threw an error",patternCountDelta:0,avgConfidenceDelta:0,highConfidenceLost:0,postDreamMetrics:t},selected:!1,durationMs:Date.now()-r}}}scoreValidation(e){return e.avgConfidenceDelta*100+e.patternCountDelta*.1-e.highConfidenceLost*5}};export{B as a,A as b,X as c,P as d,O as e,F as f,V as g,I as h,q as i,S as j,T as k,C as l,W as m,_ as n,K as o,Z as p,j as q,L as r,ee as s,te as t,G as u};
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{d as m}from"./chunk-DRT3WKQW.js";import{d as T}from"./chunk-B36CDR4U.js";T();function p(t,r,o){let e=0,n=t.length;for(;e<n;){let i=e+n>>>1;o(t[i],r)<=0?e=i+1:n=i}return e}function a(t,r,o){let e=p(t,r,o);return t.splice(e,0,r),e}function s(){return(t,r)=>t.createdAt.getTime()-r.createdAt.getTime()}m();export{a,s as b};
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{a as oe,b as ae}from"./chunk-UFUVUO3J.js";import{M as ie,i as $,p as W}from"./chunk-2I7J3O6V.js";import{c as g,e as ne,g as G}from"./chunk-4I2IOUS4.js";var R,E=g(()=>{"use strict";R={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}});function se(){if(V)return k!==null;try{let o=(ae(),G(oe));if(k=o.differentiableSearch,P=o.init,P)try{P()}catch{}return V=!0,!0}catch{return V=!0,!1}}function j(o){let e=0;for(let t=0;t<o.length;t++)e+=o[t]*o[t];return Math.sqrt(e)}function q(o,e,t,r){let n=t*r;if(n===0)return 0;let a=0,i=Math.min(o.length,e.length);for(let s=0;s<i;s++)a+=o[s]*e[s];return a/n}function B(o,e){let t=0,r=Math.min(o.length,e.length);for(let n=0;n<r;n++){let a=o[n]-e[n];t+=a*a}return Math.sqrt(t)}function ce(o,e){if(o.length===e)return o;let t=new Float32Array(e);if(o.length>e){let r=o.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*r),i=Math.floor((n+1)*r),s=0;for(let c=a;c<i;c++)s+=o[c];t[n]=s/(i-a)}}else for(let r=0;r<o.length;r++)t[r]=o[r];return t}var k,P,V,w,U=g(()=>{"use strict";E();k=null,P=null,V=!1;w=class{config;entries=[];idToIndex=new Map;hasRuvector=!1;loaded=!1;constructor(e){this.config={...R,...e}}ensureLoaded(){this.loaded||(this.hasRuvector=se(),this.loaded=!0)}normalizeVector(e){return e.length===this.config.dimensions?e:ce(e,this.config.dimensions)}add(e,t,r){this.ensureLoaded();let n=this.normalizeVector(t),a=j(n);if(this.idToIndex.has(e)){let s=this.idToIndex.get(e);this.entries[s]={id:e,vector:n,norm:a,metadata:r};return}let i=this.entries.length;this.entries.push({id:e,vector:n,norm:a,metadata:r}),this.idToIndex.set(e,i)}search(e,t){if(this.ensureLoaded(),this.entries.length===0)return[];let r=this.normalizeVector(e),n=j(r),a=Math.min(t,this.entries.length),i=this.entries.length>0?this.entries[0].vector.length:0,s=r.length===i;if(this.hasRuvector&&s&&k)try{let c=this.entries.map(l=>l.vector);return k(r,c,a,1).indices.map(l=>{let h=this.entries[l],u=this.config.metric==="cosine"?q(r,h.vector,n,h.norm):-B(r,h.vector);return{id:h.id,score:u,metadata:h.metadata}})}catch{}return this.bruteForcSearch(r,n,a)}bruteForcSearch(e,t,r){let n=[];for(let a of this.entries){let i;this.config.metric==="cosine"?i=q(e,a.vector,t,a.norm):i=-B(e,a.vector),n.push({id:a.id,score:i,metadata:a.metadata})}return n.sort((a,i)=>i.score-a.score),n.slice(0,r)}remove(e){let t=this.idToIndex.get(e);if(t===void 0)return!1;let r=this.entries.length-1;if(t!==r){let n=this.entries[r];this.entries[t]=n,this.idToIndex.set(n.id,t)}return this.entries.pop(),this.idToIndex.delete(e),!0}size(){return this.entries.length}dimensions(){return this.config.dimensions}recall(){return this.hasRuvector,1}isRuvectorAvailable(){return this.ensureLoaded(),this.hasRuvector}getConfig(){return{...this.config}}clear(){this.entries=[],this.idToIndex.clear()}}});import{createRequire as le}from"module";function ue(){if(O){if(A)return A;throw new p(K??"Unknown load error")}O=!0;try{let o=he("@ruvector/router");if(!o.VectorDb||!o.DistanceMetric)throw new Error("@ruvector/router module missing VectorDb or DistanceMetric exports");return A=o,A}catch(o){let e=o instanceof Error?o.message:String(o);throw K=e,new p(e)}}function _(o){let e=0;for(let t=0;t<o.length;t++)e+=o[t]*o[t];return Math.sqrt(e)}function J(o,e,t,r){let n=t*r;if(n===0)return 0;let a=0,i=Math.min(o.length,e.length);for(let s=0;s<i;s++)a+=o[s]*e[s];return a/n}function de(o,e){if(o.length===e)return o;let t=new Float32Array(e);if(o.length>e){let r=o.length/e;for(let n=0;n<e;n++){let a=Math.floor(n*r),i=Math.floor((n+1)*r),s=0;for(let c=a;c<i;c++)s+=o[c];t[n]=s/(i-a)}}else for(let r=0;r<o.length;r++)t[r]=o[r];return t}var he,p,A,O,K,H,Q=g(()=>{"use strict";E();he=le(import.meta.url),p=class extends Error{constructor(e){super(`Native HNSW backend unavailable: ${e}`),this.name="NativeHnswUnavailableError"}},A=null,O=!1,K=null;H=class{config;nativeDb=null;metadataStore=new Map;vectorStore=new Map;normStore=new Map;operationLock=Promise.resolve();highFallbackWarningEmitted=!1;_metrics={totalSearches:0,totalAdds:0,totalRemoves:0,avgSearchLatencyMs:0,maxSearchLatencyMs:0,lastSearchLatencyMs:0,fallbackSearchCount:0,bruteForceSearchCount:0,nativeSearchCount:0,fallbackRate:0,allSearchesBruteForce:!1};constructor(e){this.config={...R,...e};let t=ue(),r=this.config.metric==="cosine"?t.DistanceMetric.Cosine:t.DistanceMetric.Euclidean;try{this.nativeDb=new t.VectorDb({dimensions:this.config.dimensions,distanceMetric:r,hnswM:this.config.M,hnswEfConstruction:this.config.efConstruction,hnswEfSearch:this.config.efSearch})}catch(n){let a=n instanceof Error?n.message:String(n);throw new p(`VectorDb creation failed: ${a}`)}}add(e,t,r){let n=this.normalizeVector(t),a=_(n);if(this.vectorStore.has(e))try{this.nativeDb.delete(String(e))}catch{}this.nativeDb.insert(String(e),n),this.vectorStore.set(e,n),this.normStore.set(e,a),r&&this.metadataStore.set(e,r),this._metrics.totalAdds++}search(e,t){let r=performance.now();if(this.vectorStore.size===0)return[];let n=this.normalizeVector(e),a=_(n),i=Math.min(t,this.vectorStore.size),s;try{s=this.nativeDb.search(n,i).map(l=>{let h=Number(l.id),u=this.vectorStore.get(h),S=this.normStore.get(h)??0,b;return this.config.metric==="cosine"&&u?b=J(n,u,a,S):b=-l.score,{id:h,score:b,metadata:this.metadataStore.get(h)}}),s.sort((l,h)=>h.score-l.score),this._metrics.nativeSearchCount++}catch{this._metrics.fallbackSearchCount++,this._metrics.bruteForceSearchCount++,console.warn(`[NativeHNSW] FALLBACK: Using brute-force linear scan (@ruvector/router search failed). Index size: ${this.vectorStore.size}`),s=this.bruteForceSearch(n,a,i)}let c=performance.now()-r;return this.updateSearchMetrics(c),this._metrics.fallbackRate=this._metrics.fallbackSearchCount/this._metrics.totalSearches,this._metrics.allSearchesBruteForce=this._metrics.nativeSearchCount===0&&this._metrics.totalSearches>0,!this.highFallbackWarningEmitted&&this._metrics.fallbackRate>.5&&this._metrics.totalSearches>=10&&(this.highFallbackWarningEmitted=!0,console.error(`[NativeHNSW] WARNING: ${(this._metrics.fallbackRate*100).toFixed(0)}% of searches are using brute-force fallback. Native HNSW may not be functioning correctly. Consider rebuilding the index or checking @ruvector/router installation.`)),c>50&&console.warn(`[NativeHNSW] search took ${c.toFixed(1)}ms (k=${t}, results=${s.length})`),s}remove(e){if(!this.vectorStore.has(e))return!1;try{this.nativeDb.delete(String(e))}catch{}return this.vectorStore.delete(e),this.normStore.delete(e),this.metadataStore.delete(e),this._metrics.totalRemoves++,!0}size(){return this.vectorStore.size}dimensions(){return this.config.dimensions}recall(){let e=this.config.efSearch/this.config.M;return e>=10?.99:e>=5?.97:e>=3?.95:.9}getMetrics(){return{...this._metrics}}get lastSearchLatencyMs(){return this._metrics.lastSearchLatencyMs}getConfig(){return{...this.config}}clear(){for(let e of this.vectorStore.keys())try{this.nativeDb.delete(String(e))}catch{}this.vectorStore.clear(),this.normStore.clear(),this.metadataStore.clear()}isNativeAvailable(){return this.nativeDb!==null}normalizeVector(e){return e.length===this.config.dimensions?e:de(e,this.config.dimensions)}updateSearchMetrics(e){this._metrics.totalSearches++,this._metrics.lastSearchLatencyMs=e,e>this._metrics.maxSearchLatencyMs&&(this._metrics.maxSearchLatencyMs=e);let t=this._metrics.totalSearches;this._metrics.avgSearchLatencyMs=this._metrics.avgSearchLatencyMs*((t-1)/t)+e/t}bruteForceSearch(e,t,r){let n=[];for(let[a,i]of this.vectorStore){let s=this.normStore.get(a)??_(i),c=this.config.metric==="cosine"?J(e,i,t,s):-(function(){let d=0,l=Math.min(e.length,i.length);for(let h=0;h<l;h++){let u=e[h]-i[h];d+=u*u}return Math.sqrt(d)})();n.push({id:a,score:c,metadata:this.metadataStore.get(a)})}return n.sort((a,i)=>i.score-a.score),n.slice(0,r)}}});function X(o,e){let t=Array.from({length:e},()=>new Float64Array(e));for(let r=0;r<e;r++){let n=o[r].length;t[r][r]=n;for(let a of o[r])t[r][a]=-1}return t}function F(o,e){let t=e.length,r=new Float64Array(t);for(let n=0;n<t;n++){let a=o[n].length;r[n]=a*e[n];for(let i of o[n])r[n]-=e[i]}return r}function x(o){let e=0;for(let t=0;t<o.length;t++)e+=o[t]*o[t];return Math.sqrt(e)}function I(o){let e=x(o);if(e>0)for(let t=0;t<o.length;t++)o[t]/=e}function v(o,e){let t=0;for(let r=0;r<o.length;r++)t+=o[r]*e[r];for(let r=0;r<o.length;r++)o[r]-=t*e[r]}function y(o,e,t=100,r=1e-6){if(e<=1)return 0;if(e===2)return o[0].includes(1)?2:0;let n=new Float64Array(e).fill(1/Math.sqrt(e)),a=new Float64Array(e);for(let l=0;l<e;l++)a[l]=Math.random()-.5;v(a,n),I(a);let i=0;for(let l=0;l<30;l++){let h=F(o,a);if(v(h,n),i=x(h),i>0)for(let u=0;u<e;u++)a[u]=h[u]/i}if(i<r)return 0;let s=new Float64Array(e);for(let l=0;l<e;l++)s[l]=Math.random()-.5;v(s,n),I(s);let c=0;for(let l=0;l<t;l++){let h=F(o,s),u=new Float64Array(e);for(let m=0;m<e;m++)u[m]=i*s[m]-h[m];v(u,n);let S=x(u);if(S<r)break;let b=S;for(let m=0;m<e;m++)s[m]=u[m]/S;if(Math.abs(b-c)<r)break;c=b}let d=i-c;return Math.max(0,d)}function C(o,e,t=100,r=1e-6){return y(o,e,t,r)}function N(o,e,t=50,r){if(e<=1)return 0;let n=r??y(o,e);if(n<1e-10)return 1/0;let i=2*Math.max(...o.map(d=>d.length),1),c=2*(Math.log(i/n)/(i-n));return Math.max(0,c)}function M(o,e,t){let r=1-Math.exp(-o/.05),n=1-Math.exp(-e/.5),a=t===1/0?0:1/(1+t/5),i=.4*r+.3*n+.3*a;return Math.max(0,Math.min(1,i))}var D=g(()=>{"use strict"});var ee={};ne(ee,{ALERT_THRESHOLDS:()=>me,DEFAULT_HNSW_HEALTH_CONFIG:()=>Y,HnswHealthMonitor:()=>T,_resetNativeLoader:()=>pe,approximateFiedlerValue:()=>y,approximateSpectralGap:()=>C,buildAdjacencyFromIndex:()=>Z,buildLaplacian:()=>X,computeCoherenceScore:()=>M,createHnswHealthMonitor:()=>be,deflateVector:()=>v,estimateEffectiveResistance:()=>N,laplacianMultiply:()=>F,normalizeInPlace:()=>I,vectorNorm:()=>x});function fe(){return z?L:(z=!0,L=null,null)}function pe(){L=null,z=!1}function Z(o,e=16,t){let r=o.size();if(r===0)return{adjacency:[],nodeCount:0,adjacencySource:"approximate"};let n=Array.from({length:r},()=>[]),a=Math.min(e,r-1);if(a===0)return{adjacency:n,nodeCount:r,adjacencySource:"approximate"};if(t&&t.size>0){let i=Array.from(t.keys()).slice(0,r),s=new Map;for(let c=0;c<i.length;c++)s.set(i[c],c);for(let c=0;c<i.length;c++){let d=t.get(i[c]);if(!d)continue;let l=o.search(d,a+1);for(let h of l){if(h.id===i[c])continue;let u=s.get(h.id);u!==void 0&&(n[c].includes(u)||n[c].push(u),n[u].includes(c)||n[u].push(c))}}return{adjacency:n,nodeCount:r,adjacencySource:"actual-search"}}console.warn("[HnswHealthMonitor] No stored vectors provided \u2014 using approximate circular adjacency. Pass stored vectors for accurate health metrics.");for(let i=0;i<r;i++)for(let s=0;s<a;s++){let c=(i+s+1)%r;n[i].includes(c)||n[i].push(c),n[c].includes(i)||n[c].push(i)}return{adjacency:n,nodeCount:r,adjacencySource:"approximate"}}function be(o){return new T(o)}var Y,me,L,z,T,te=g(()=>{"use strict";D();D();Y={fiedlerThreshold:.01,spectralGapThreshold:.1,resistanceThreshold:10,coherenceThreshold:.3,maxPowerIterations:100,convergenceTolerance:1e-6,resistanceSampleSize:50,maxHistoryEntries:200,minIndexSize:3},me={FragileIndex:.01,PoorExpansion:.1,HighResistance:10,LowCoherence:.3},L=null,z=!1;T=class{config;alerts=[];history=[];lastReport=null;useNative=!1;nativeChecked=!1;constructor(e){this.config={...Y,...e}}checkHealth(e){let t=performance.now(),r=e.size();if(r<this.config.minIndexSize)return this.createSmallIndexReport(r,performance.now()-t);this.nativeChecked||(this.nativeChecked=!0,this.useNative=fe()!==null);let{adjacency:n,nodeCount:a,adjacencySource:i}=Z(e),s=this.useNative?this.computeNativeMetrics(n):this.computeApproximateMetrics(n,a),c=this.generateAlerts(s);this.alerts.length=0,this.alerts.push(...c);let d=performance.now()-t,l={healthy:c.length===0,metrics:s,alerts:c,indexSize:r,usedNativeBackend:this.useNative,adjacencySource:i,checkDurationMs:d,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:s.coherenceScore,fiedlerValue:s.fiedlerValue,indexSize:r,healthy:l.healthy,timestamp:l.checkedAt}),this.lastReport=l,l}getAlerts(){return[...this.alerts]}getMetricsHistory(e){let t=[...this.history];return e!==void 0&&e<t.length?t.slice(-e):t}isHealthy(){return this.lastReport===null?!0:this.lastReport.healthy}getLastReport(){return this.lastReport}clearHistory(){this.history.length=0,this.alerts.length=0,this.lastReport=null}computeNativeMetrics(e){let t=L,r=t.computeFiedlerValue(e),n=t.computeSpectralGap(e),a=t.computeEffectiveResistance(e),i=M(r,n,a);return{fiedlerValue:r,spectralGap:n,effectiveResistance:a,coherenceScore:i}}computeApproximateMetrics(e,t){let r=y(e,t,this.config.maxPowerIterations,this.config.convergenceTolerance),n=C(e,t,this.config.maxPowerIterations,this.config.convergenceTolerance),a=N(e,t,this.config.resistanceSampleSize,r),i=M(r,n,a);return{fiedlerValue:r,spectralGap:n,effectiveResistance:a,coherenceScore:i}}generateAlerts(e){let t=[],r=new Date;return e.fiedlerValue<this.config.fiedlerThreshold&&t.push({type:"FragileIndex",message:`Fiedler value ${e.fiedlerValue.toFixed(6)} is below threshold ${this.config.fiedlerThreshold}. The index graph has weak algebraic connectivity.`,value:e.fiedlerValue,threshold:this.config.fiedlerThreshold,timestamp:r}),e.spectralGap<this.config.spectralGapThreshold&&t.push({type:"PoorExpansion",message:`Spectral gap ${e.spectralGap.toFixed(6)} is below threshold ${this.config.spectralGapThreshold}. The index graph has poor expansion properties.`,value:e.spectralGap,threshold:this.config.spectralGapThreshold,timestamp:r}),e.effectiveResistance>this.config.resistanceThreshold&&t.push({type:"HighResistance",message:`Average effective resistance ${e.effectiveResistance.toFixed(4)} exceeds threshold ${this.config.resistanceThreshold}. Nodes are poorly connected.`,value:e.effectiveResistance,threshold:this.config.resistanceThreshold,timestamp:r}),e.coherenceScore<this.config.coherenceThreshold&&t.push({type:"LowCoherence",message:`Coherence score ${e.coherenceScore.toFixed(4)} is below threshold ${this.config.coherenceThreshold}. Overall index health is degraded.`,value:e.coherenceScore,threshold:this.config.coherenceThreshold,timestamp:r}),t}createSmallIndexReport(e,t){let r={fiedlerValue:e>0?1:0,spectralGap:e>0?1:0,effectiveResistance:e>0?.5:0,coherenceScore:e>0?1:0},n={healthy:!0,metrics:r,alerts:[],indexSize:e,usedNativeBackend:!1,adjacencySource:"approximate",checkDurationMs:t,checkedAt:new Date};return this.addHistoryPoint({coherenceScore:r.coherenceScore,fiedlerValue:r.fiedlerValue,indexSize:e,healthy:!0,timestamp:n.checkedAt}),this.lastReport=n,n}addHistoryPoint(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}}});var ge,f,re,ve=g(()=>{"use strict";U();Q();ie();ge={patterns:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},"qe-memory":{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"},learning:{dimensions:384,M:16,efConstruction:200,efSearch:50,metric:"cosine"},coverage:{dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"}},f=new Map,re=class o{backend;_isNativeBackend;indexName;stringToNumericId=new Map;numericToStringId=new Map;nextAutoId=0;healthMonitor=null;healthMonitorLoaded=!1;operationsSinceLastCheck=0;healthCheckFrequency=100;lastHealthReport=null;constructor(e,t){this.indexName=e;let n={...ge[e]??{},...t},{backend:a,isNative:i}=o.createBackend(n);this.backend=a,this._isNativeBackend=i}add(e,t,r){this.backend.add(e,t,r),this.maybeRunHealthCheck()}search(e,t){let r=performance.now(),n=this.backend.search(e,t),a=performance.now()-r;return a>50&&console.warn(`[HNSW] search took ${a.toFixed(1)}ms (k=${t}, results=${n.length})`),this._lastSearchLatencyMs=a,n}_lastSearchLatencyMs=0;get lastSearchLatencyMs(){return this._lastSearchLatencyMs}remove(e){return this.backend.remove(e)}size(){return this.backend.size()}dimensions(){return this.backend.dimensions()}recall(){return this.backend.recall()}addByStringId(e,t){let r=this.stringToNumericId.get(e);r!==void 0?this.backend.remove(r):(r=this.nextAutoId++,this.stringToNumericId.set(e,r),this.numericToStringId.set(r,e)),this.backend.add(r,new Float32Array(t))}searchByArray(e,t){return this.backend.search(new Float32Array(e),t).map(n=>({id:this.numericToStringId.get(n.id)??String(n.id),score:n.score}))}removeByStringId(e){let t=this.stringToNumericId.get(e);if(t===void 0)return!1;let r=this.backend.remove(t);return r&&(this.stringToNumericId.delete(e),this.numericToStringId.delete(t)),r}clear(){this.backend.clear?.(),this.stringToNumericId.clear(),this.numericToStringId.clear(),this.nextAutoId=0}isRuvectorAvailable(){return this.backend instanceof w?this.backend.isRuvectorAvailable():this.backend instanceof H?this.backend.isNativeAvailable():!1}isNativeBackend(){return this._isNativeBackend}getName(){return this.indexName}setHealthCheckFrequency(e){this.healthCheckFrequency=Math.max(1,e)}getHealthCheckFrequency(){return this.healthCheckFrequency}getLastHealthReport(){return this.lastHealthReport}getHealthMonitor(){return this.healthMonitor}maybeRunHealthCheck(){if(W()&&(this.operationsSinceLastCheck++,!(this.operationsSinceLastCheck<this.healthCheckFrequency)&&(this.operationsSinceLastCheck=0,this.ensureHealthMonitor(),this.healthMonitor)))try{this.lastHealthReport=this.healthMonitor.checkHealth(this.backend),this.lastHealthReport.healthy||console.warn(`[HNSW-Health] Index "${this.indexName}" health check failed: ${this.lastHealthReport.alerts.length} alert(s). Coherence: ${this.lastHealthReport.metrics.coherenceScore.toFixed(3)}`)}catch(e){console.warn(`[HNSW-Health] Health check error for "${this.indexName}":`,e)}}ensureHealthMonitor(){if(!this.healthMonitorLoaded){this.healthMonitorLoaded=!0;try{let e=(te(),G(ee));this.healthMonitor=e.createHnswHealthMonitor()}catch(e){process.env.DEBUG&&console.debug("[HNSW-Health] Monitor module unavailable:",e instanceof Error?e.message:e),this.healthMonitor=null}}}static createBackend(e){if($())try{return{backend:new H(e),isNative:!0}}catch(t){t instanceof p?console.info(`[HNSW] Native backend unavailable, falling back to JS: ${t.message}`):console.warn("[HNSW] Unexpected error creating native backend, falling back to JS:",t)}return{backend:new w(e),isNative:!1}}static create(e,t){let r=f.get(e);if(r instanceof o)return r;let n=new o(e,t);return f.set(e,n),n}static get(e){let t=f.get(e);return t instanceof o?t:void 0}static close(e){let t=f.get(e);t instanceof o&&t.clear(),f.delete(e)}static closeAll(){for(let[e]of f)o.close(e);f.clear()}static listIndexes(){return Array.from(f.keys())}}});export{re as a,ve as b};
@@ -1,180 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{a as te,b as ne}from"./chunk-3ADGXLTM.js";import{b as ee}from"./chunk-KP5NUODU.js";import{b as E,d as ye}from"./chunk-WGMPEW2T.js";import{a as b,c as T}from"./chunk-JZSDOIXA.js";var ve={M:16,efConstruction:200,efSearch:100},_={enabled:!0,pretrainedPatterns:!0,hnswConfig:ve,promotionThreshold:3,qualityThreshold:.7,embeddingModel:"auto"},P={mode:"hybrid",confidenceThreshold:.7,feedbackEnabled:!0,cacheEnabled:!0,cacheTTLMs:300*1e3},F={enabled:["pattern-consolidator","coverage-gap-scanner","flaky-test-detector","routing-accuracy-monitor"],intervals:{"pattern-consolidator":1800*1e3,"coverage-gap-scanner":3600*1e3,"flaky-test-detector":7200*1e3,"routing-accuracy-monitor":900*1e3},maxConcurrent:4,daemonAutoStart:!0},N={claudeCode:!0,preCommit:!1,ciIntegration:!1},$={install:!0,installV2:!0,installV3:!0,overwrite:!1},O={enabled:!0,parameters:["hnsw.efSearch","routing.confidenceThreshold","pattern.promotionThreshold","testGen.complexityLimit"],tuningIntervalMs:10080*60*1e3,evaluationPeriodMs:5e3};var L=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization","enterprise-integration"];function M(){return"3.9.0"}function We(i,e){return{version:M(),project:{name:i,root:e,type:"single"},learning:_,routing:P,workers:F,hooks:N,skills:$,autoTuning:O,domains:{enabled:L,disabled:[]},agents:{maxConcurrent:15,defaultTimeout:6e4}}}ye();import{readFileSync as C,existsSync as m,statSync as be,readdirSync as ke}from"fs";import{join as p,basename as ie,extname as re,relative as V}from"path";var xe=[{name:"jest",detect:i=>{let e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs"];for(let n of e)if(m(p(i,n)))return{name:"jest",version:S(i,"jest"),configFile:n,confidence:1};let t=x(i);return t?.jest?{name:"jest",version:S(i,"jest"),configFile:"package.json",confidence:.9}:t?.devDependencies?.jest||t?.dependencies?.jest?{name:"jest",version:t.devDependencies?.jest||t.dependencies?.jest,confidence:.7}:null}},{name:"vitest",detect:i=>{let e=["vitest.config.ts","vitest.config.js","vitest.config.mts","vite.config.ts"];for(let n of e)if(m(p(i,n)))return{name:"vitest",version:S(i,"vitest"),configFile:n,confidence:1};let t=x(i);return t?.devDependencies?.vitest||t?.dependencies?.vitest?{name:"vitest",version:t.devDependencies?.vitest,confidence:.8}:null}},{name:"mocha",detect:i=>{let e=[".mocharc.js",".mocharc.json",".mocharc.yaml",".mocharc.yml"];for(let n of e)if(m(p(i,n)))return{name:"mocha",version:S(i,"mocha"),configFile:n,confidence:1};let t=x(i);return t?.devDependencies?.mocha?{name:"mocha",version:t.devDependencies?.mocha,confidence:.8}:null}},{name:"pytest",detect:i=>{let e=["pytest.ini","pyproject.toml","setup.cfg"];for(let n of e){let r=p(i,n);if(m(r))try{let s=C(r,"utf-8");if(s.includes("[pytest]")||s.includes("[tool.pytest]"))return{name:"pytest",configFile:n,confidence:1}}catch(s){console.debug("[ProjectAnalyzer] Config read failed:",s instanceof Error?s.message:s)}}let t=p(i,"requirements.txt");if(m(t))try{if(C(t,"utf-8").includes("pytest"))return{name:"pytest",configFile:"requirements.txt",confidence:.8}}catch(n){console.debug("[ProjectAnalyzer] requirements.txt read failed:",n instanceof Error?n.message:n)}return null}},{name:"playwright",detect:i=>{let e=["playwright.config.ts","playwright.config.js"];for(let n of e)if(m(p(i,n)))return{name:"playwright",version:S(i,"@playwright/test"),configFile:n,confidence:1};let t=x(i);return t?.devDependencies?.["@playwright/test"]?{name:"playwright",version:t.devDependencies["@playwright/test"],confidence:.8}:null}},{name:"cypress",detect:i=>{let e=["cypress.config.ts","cypress.config.js","cypress.json"];for(let t of e)if(m(p(i,t)))return{name:"cypress",version:S(i,"cypress"),configFile:t,confidence:1};return m(p(i,"cypress"))?{name:"cypress",configFile:"cypress/",confidence:.9}:null}}],Se=[{name:"typescript",extensions:[".ts",".tsx",".mts",".cts"]},{name:"javascript",extensions:[".js",".jsx",".mjs",".cjs"]},{name:"python",extensions:[".py",".pyw"]},{name:"java",extensions:[".java"]},{name:"go",extensions:[".go"]},{name:"rust",extensions:[".rs"]},{name:"csharp",extensions:[".cs"]},{name:"ruby",extensions:[".rb"]},{name:"php",extensions:[".php"]},{name:"kotlin",extensions:[".kt",".kts"]},{name:"swift",extensions:[".swift"]}];function x(i){let e=p(i,"package.json");if(!m(e))return null;try{return E(C(e,"utf-8"))}catch{return null}}function S(i,e){let t=x(i);if(t)return t.devDependencies?.[e]||t.dependencies?.[e]}function W(i,e,t={}){let{maxDepth:n=10,exclude:r=["node_modules",".git","dist","build","coverage",".next","__pycache__"]}=t;function s(o,a){if(a>n)return;let l;try{l=ke(o)}catch{return}for(let g of l){if(r.includes(g))continue;let c=p(o,g),k;try{k=be(c)}catch{continue}k.isDirectory()?s(c,a+1):k.isFile()&&e(c)}}s(i,0)}var Q=class{projectRoot;constructor(e){this.projectRoot=e}async analyze(){let e=Date.now(),[t,n,r,s,o]=await Promise.all([this.detectFrameworks(),this.detectLanguages(),this.detectExistingTests(),this.analyzeComplexity(),this.measureCoverage()]);return{projectName:x(this.projectRoot)?.name||ie(this.projectRoot),projectRoot:this.projectRoot,projectType:this.detectProjectType(),frameworks:t,languages:n,existingTests:r,codeComplexity:s,coverage:o,packageManager:this.detectPackageManager(),hasTypeScript:m(p(this.projectRoot,"tsconfig.json")),hasCIConfig:this.detectCIConfig(),ciProvider:this.detectCIProvider(),analysisTimestamp:new Date,analysisDurationMs:Date.now()-e}}async detectFrameworks(){let e=[];for(let t of xe){let n=t.detect(this.projectRoot);n&&e.push(n)}return e.sort((t,n)=>n.confidence-t.confidence)}async detectLanguages(){let e=new Map,t=0;W(this.projectRoot,r=>{let s=re(r).toLowerCase();if(s){for(let o of Se)if(o.extensions.includes(s)){let a=e.get(o.name)||{count:0,extensions:new Set};a.count++,a.extensions.add(s),e.set(o.name,a),t++;break}}});let n=[];for(let[r,s]of e)n.push({name:r,percentage:t>0?Math.round(s.count/t*100):0,fileCount:s.count,extensions:Array.from(s.extensions)});return n.sort((r,s)=>s.fileCount-r.fileCount)}async detectExistingTests(){let e={totalCount:0,byFramework:{},byType:{unit:0,integration:0,e2e:0,unknown:0},directories:[]},t=new Set,n=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/_test\.[jt]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/,/.*Test\.java$/];return W(this.projectRoot,r=>{let s=ie(r);if(n.some(a=>a.test(s))){e.totalCount++;let a=V(this.projectRoot,r).toLowerCase();a.includes("e2e")||a.includes("cypress")||a.includes("playwright")?e.byType.e2e++:a.includes("integration")||a.includes("int-test")?e.byType.integration++:a.includes("unit")||a.includes("__tests__")||a.includes("test/")?e.byType.unit++:e.byType.unknown++;let l=V(this.projectRoot,p(r,".."));t.add(l)}}),e.directories=Array.from(t).slice(0,10),e}async analyzeComplexity(){let e=[],t=[],n=0,r=0;W(this.projectRoot,a=>{let l=re(a);if([".ts",".tsx",".js",".jsx",".py",".java",".go"].includes(l))try{let g=C(a,"utf-8"),c=this.calculateFileComplexity(g,l);t.push(...c.functionComplexities),c.maxComplexity>n&&(n=c.maxComplexity),r++,c.maxComplexity>10&&e.push(V(this.projectRoot,a))}catch(g){console.debug("[ProjectAnalyzer] Complexity analysis read failed:",g instanceof Error?g.message:g)}});let s=t.reduce((a,l)=>a+l,0),o=t.length>0?s/t.length:0;return{averageCyclomatic:Math.round(o*10)/10,maxCyclomatic:n,totalFiles:r,complexFiles:e.slice(0,20),recommendation:o<5?"simple":o<15?"medium":"complex"}}calculateFileComplexity(e,t){let n=this.stripCommentsAndStrings(e,t),r=this.calculateComplexity(n);return{functionComplexities:[r],maxComplexity:r}}removeDelimitedBlocks(e,t,n){let r="",s=0;for(;s<e.length;){let o=e.indexOf(t,s);if(o===-1){r+=e.slice(s);break}r+=e.slice(s,o);let a=e.indexOf(n,o+t.length);if(a===-1)break;s=a+n.length}return r}stripCommentsAndStrings(e,t){let n=e;return[".ts",".tsx",".js",".jsx",".java",".go"].includes(t)?(n=n.split(`
3
- `).map(r=>{let s=r.indexOf("//");return s>=0?r.slice(0,s):r}).join(`
4
- `),n=this.removeDelimitedBlocks(n,"/*","*/"),n=this.removeDelimitedBlocks(n,"`","`"),n=this.removeDelimitedBlocks(n,'"','"'),n=this.removeDelimitedBlocks(n,"'","'")):t===".py"&&(n=n.split(`
5
- `).map(r=>{let s=r.indexOf("#");return s>=0?r.slice(0,s):r}).join(`
6
- `),n=this.removeDelimitedBlocks(n,'"""','"""'),n=this.removeDelimitedBlocks(n,"'''","'''"),n=this.removeDelimitedBlocks(n,'"','"'),n=this.removeDelimitedBlocks(n,"'","'")),n}calculateComplexity(e){let t=1,n=[{pattern:/(?<![a-zA-Z])if\s*\(/g,name:"if"},{pattern:/\bfor\s*\(/g,name:"for"},{pattern:/\bwhile\s*\(/g,name:"while"},{pattern:/\bcase\s+[^:]+:/g,name:"case"},{pattern:/\bcatch\s*\(/g,name:"catch"},{pattern:/&&/g,name:"&&"},{pattern:/\|\|/g,name:"||"},{pattern:/\?[^?:]+:/g,name:"ternary"},{pattern:/\belif\s+/g,name:"elif"},{pattern:/\bexcept\s*(?:\w+)?:/g,name:"except"},{pattern:/\bfor\s+\w+\s+in\s+/g,name:"for-in"},{pattern:/\bselect\s*\{/g,name:"select"}];for(let{pattern:r}of n){let s=e.match(r);s&&(t+=s.length)}return t}async measureCoverage(){let e=["coverage/lcov-report/index.html","coverage/coverage-summary.json","coverage/clover.xml","coverage/lcov.info","htmlcov/index.html"];for(let t of e){let n=p(this.projectRoot,t);if(m(n)){if(t.endsWith(".json"))try{let s=E(C(n,"utf-8")).total||{};return{lines:s.lines?.pct||0,branches:s.branches?.pct||0,functions:s.functions?.pct||0,statements:s.statements?.pct||0,hasReport:!0,reportPath:t}}catch(r){console.debug("[ProjectAnalyzer] Coverage report parse failed:",r instanceof Error?r.message:r)}return{lines:0,branches:0,functions:0,statements:0,hasReport:!0,reportPath:t}}}return{lines:0,branches:0,functions:0,statements:0,hasReport:!1}}detectProjectType(){if(m(p(this.projectRoot,"lerna.json"))||m(p(this.projectRoot,"pnpm-workspace.yaml"))||m(p(this.projectRoot,"packages")))return"monorepo";let e=x(this.projectRoot);return e?.workspaces?"monorepo":e?.main||e?.module||e?.exports?"library":"single"}detectPackageManager(){return m(p(this.projectRoot,"bun.lockb"))?"bun":m(p(this.projectRoot,"pnpm-lock.yaml"))?"pnpm":m(p(this.projectRoot,"yarn.lock"))?"yarn":m(p(this.projectRoot,"package-lock.json"))?"npm":"unknown"}detectCIConfig(){return[".github/workflows",".gitlab-ci.yml","Jenkinsfile",".circleci/config.yml",".travis.yml","azure-pipelines.yml"].some(t=>m(p(this.projectRoot,t)))}detectCIProvider(){if(m(p(this.projectRoot,".github/workflows")))return"github-actions";if(m(p(this.projectRoot,".gitlab-ci.yml")))return"gitlab-ci";if(m(p(this.projectRoot,"Jenkinsfile")))return"jenkins";if(m(p(this.projectRoot,".circleci/config.yml")))return"circleci";if(this.detectCIConfig())return"other"}};function He(i){return new Q(i)}var se=[{name:"typescript-vitest",condition:i=>i.hasTypeScript&&i.frameworks.some(e=>e.name==="vitest"),apply:i=>{i.learning.embeddingModel="transformer",i.routing.confidenceThreshold=.75}},{name:"large-codebase",condition:i=>i.codeComplexity.totalFiles>500,apply:i=>{i.learning.hnswConfig.M=32,i.learning.hnswConfig.efConstruction=400,i.learning.hnswConfig.efSearch=200,i.agents.maxConcurrent=15}},{name:"small-project",condition:i=>i.codeComplexity.totalFiles<50,apply:i=>{i.learning.hnswConfig.M=8,i.learning.hnswConfig.efConstruction=100,i.workers.enabled=["pattern-consolidator","routing-accuracy-monitor"],i.workers.maxConcurrent=2,i.agents.maxConcurrent=5}},{name:"high-complexity",condition:i=>i.codeComplexity.recommendation==="complex",apply:i=>{i.autoTuning.parameters.push("complexity.analysisDepth"),i.domains.enabled=L}},{name:"low-coverage",condition:i=>i.coverage.hasReport&&i.coverage.lines<50,apply:i=>{i.workers.enabled.push("coverage-gap-scanner"),i.workers.intervals["coverage-gap-scanner"]=1800*1e3}},{name:"monorepo",condition:i=>i.projectType==="monorepo",apply:i=>{i.agents.maxConcurrent=15,i.workers.maxConcurrent=6,i.domains.enabled=[...new Set([...i.domains.enabled,"code-intelligence"])]}},{name:"has-e2e",condition:i=>i.frameworks.some(e=>["playwright","cypress"].includes(e.name))||i.existingTests.byType.e2e>0,apply:i=>{i.domains.enabled=[...new Set([...i.domains.enabled,"visual-accessibility","chaos-resilience"])]}},{name:"has-ci",condition:i=>i.hasCIConfig,apply:i=>{i.hooks.ciIntegration=!0,i.domains.enabled=[...new Set([...i.domains.enabled,"quality-assessment"])]}},{name:"github-actions",condition:i=>i.ciProvider==="github-actions",apply:i=>{i.hooks.ciIntegration=!0,i.hooks.claudeCode=!0}},{name:"python-project",condition:i=>i.languages.some(e=>e.name==="python"&&e.percentage>30),apply:i=>{i.routing.mode="hybrid",i.domains.enabled=[...new Set([...i.domains.enabled,"security-compliance"])]}},{name:"java-project",condition:i=>i.languages.some(e=>e.name==="java"&&e.percentage>30),apply:i=>{i.agents.defaultTimeout=12e4}},{name:"no-tests",condition:i=>i.existingTests.totalCount===0,apply:i=>{i.workers.enabled=["pattern-consolidator"],i.learning.qualityThreshold=.5,i.learning.promotionThreshold=2}},{name:"many-tests",condition:i=>i.existingTests.totalCount>500,apply:i=>{i.workers.enabled=[...new Set([...i.workers.enabled,"flaky-test-detector"])],i.domains.enabled=[...new Set([...i.domains.enabled,"test-execution"])]}},{name:"security-focus",condition:i=>i.codeComplexity.totalFiles>100,apply:i=>{i.domains.enabled=[...new Set([...i.domains.enabled,"security-compliance"])]}}],z=class{rules;constructor(e={}){this.rules=e.minimal?se.filter(t=>["typescript-vitest","large-codebase","small-project"].includes(t.name)):[...se,...e.customRules||[]]}recommend(e){let t={version:M(),project:{name:e.projectName,root:e.projectRoot,type:e.projectType==="unknown"?"single":e.projectType},learning:this.recommendLearning(e),routing:this.recommendRouting(e),workers:this.recommendWorkers(e),hooks:this.recommendHooks(e),skills:this.recommendSkills(e),autoTuning:this.recommendAutoTuning(e),domains:{enabled:this.recommendDomains(e),disabled:[]},agents:{maxConcurrent:this.recommendMaxAgents(e),defaultTimeout:6e4}},n=[];for(let r of this.rules)r.condition(e)&&(r.apply(t,e),n.push(r.name));return t.domains.enabled=[...new Set(t.domains.enabled)],t.workers.enabled=[...new Set(t.workers.enabled)],t}getApplicableRules(e){return this.rules.filter(t=>t.condition(e)).map(t=>t.name)}recommendLearning(e){let t={..._};return e.codeComplexity.totalFiles>1e3?t.hnswConfig={M:32,efConstruction:400,efSearch:200}:e.codeComplexity.totalFiles<100&&(t.hnswConfig={M:8,efConstruction:100,efSearch:50}),e.languages.some(n=>["typescript","javascript"].includes(n.name))&&(t.embeddingModel="transformer"),t}recommendRouting(e){let t={...P};return e.codeComplexity.recommendation==="simple"?t.mode="rules":e.codeComplexity.recommendation==="complex"?t.mode="ml":t.mode="hybrid",t}recommendWorkers(e){let t={...F},n=new Set(["pattern-consolidator","routing-accuracy-monitor"]);return(!e.coverage.hasReport||e.coverage.lines<70)&&n.add("coverage-gap-scanner"),e.existingTests.totalCount>100&&n.add("flaky-test-detector"),t.enabled=Array.from(n),e.codeComplexity.totalFiles>500?t.maxConcurrent=6:e.codeComplexity.totalFiles<50&&(t.maxConcurrent=2),t}recommendHooks(e){let t={...N};return t.ciIntegration=e.hasCIConfig,t.preCommit=e.existingTests.totalCount>50,t}recommendSkills(e){let t={...$};return t.install=!0,t.installV2=!0,t.installV3=!0,t}recommendAutoTuning(e){let t={...O};return e.codeComplexity.totalFiles<20&&(t.enabled=!1),t}recommendDomains(e){return["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization"]}recommendMaxAgents(e){return e.projectType==="monorepo"?15:e.codeComplexity.totalFiles>500?12:e.codeComplexity.totalFiles>100?8:5}};function Ye(i){return new z(i)}var Ae=[/\baqe\b/i,/\bagentic-qe\b/i,/\bnpx\s+agentic-qe\b/i,/\bnpx\s+@anthropics\/agentic-qe\b/i,/brain-checkpoint\.cjs/i,/\.claude\/helpers\//i];function Ce(i){let e=i;return!e?.hooks||!Array.isArray(e.hooks)?!1:e.hooks.some(t=>!t.command||typeof t.command!="string"?!1:Ae.some(n=>n.test(t.command)))}function Xe(i,e){let t={};for(let[n,r]of Object.entries(e)){let s=i[n]||[],o=Array.isArray(s)?s.filter(a=>!Ce(a)):[];t[n]=[...r,...o]}for(let[n,r]of Object.entries(i))t[n]||(t[n]=r);return t}function et(i){let e=i.domains?.enabled||[];return{AQE_MEMORY_PATH:".agentic-qe/memory.db",AQE_MEMORY_ENABLED:"true",AQE_LEARNING_ENABLED:i.learning?.enabled?"true":"false",AQE_V3_MODE:"true",AQE_V3_DDD_ENABLED:"true",AQE_V3_DOMAINS:e.join(","),AQE_V3_SWARM_SIZE:String(i.agents?.maxConcurrent??15),AQE_V3_TOPOLOGY:"hierarchical",AQE_V3_SUBLINEAR_ENABLED:"true",AQE_V3_HNSW_ENABLED:i.learning?.hnswConfig?"true":"false",AQE_V3_HOOKS_ENABLED:"true",AQE_V3_AISP_ENABLED:"true",AQE_V3_REASONING_BANK:".agentic-qe/memory.db",AQE_V3_PATTERN_PROMOTION_THRESHOLD:String(i.learning?.promotionThreshold??3),AQE_V3_SUCCESS_RATE_THRESHOLD:String(i.learning?.qualityThreshold??.7)}}function tt(i,e){let t=i.domains?.enabled||[];return{aqe:{version:i.version??"3.0.0",initialized:new Date().toISOString(),hooksConfigured:!0},statusLine:{type:"command",command:`sh -c 'node "\${CLAUDE_PROJECT_DIR:-.}/.claude/helpers/statusline-v3.cjs" 2>/dev/null || echo "\u258A Agentic QE v3"'`,refreshMs:5e3,enabled:!0},_aqePermissions:["Bash(npx agentic-qe:*)","Bash(npx @anthropics/agentic-qe:*)","mcp__agentic-qe__*"],includeCoAuthoredBy:!0,v3Configuration:{domains:{total:t.length,names:t},swarm:{totalAgents:i.agents?.maxConcurrent??15,topology:"hierarchical",coordination:"queen-led"}},v3Learning:{enabled:i.learning?.enabled??!0,reasoningBank:{dbPath:".agentic-qe/memory.db",enableHNSW:!!i.learning?.hnswConfig},patternPromotion:{threshold:i.learning?.promotionThreshold??3,successRateMin:i.learning?.qualityThreshold??.7}}}}T();import{existsSync as y,mkdirSync as D,readdirSync as j,statSync as U,readFileSync as we,writeFileSync as De,copyFileSync as je,unlinkSync as Re,rmdirSync as qe}from"fs";import{join as u,dirname as Ie}from"path";import{fileURLToPath as Te}from"url";var G=["qe-test-generation","qe-test-execution","qe-coverage-analysis","qe-quality-assessment","qe-defect-intelligence","qe-requirements-validation","qe-code-intelligence","pentest-validation","qe-visual-accessibility","qe-chaos-resilience","qe-learning-optimization","qe-iterative-loop","strict-tdd","no-skip","coverage-guard","freeze-tests","security-watch","skill-stats","test-failure-investigator","coverage-drop-investigator","e2e-flow-verifier","test-metrics-dashboard"],H=["v3-core-implementation","v3-cli-modernization","v3-ddd-architecture","v3-integration-deep","v3-mcp-optimization","v3-memory-unification","v3-performance-optimization","v3-security-overhaul","v3-swarm-coordination","v3-qe-core-implementation","v3-qe-ddd-architecture","v3-qe-cli","v3-qe-memory-system","v3-qe-performance","v3-qe-security","v3-qe-mcp","v3-qe-mcp-optimization","v3-qe-memory-unification","v3-qe-integration","v3-qe-agentic-flow-integration","v3-qe-fleet-coordination","agentdb-advanced","agentdb-learning","agentdb-memory-patterns","agentdb-optimization","agentdb-vector-search","github-code-review","github-multi-repo","github-project-management","github-release-management","github-workflow-automation","flow-nexus-neural","flow-nexus-platform","flow-nexus-swarm","reasoningbank-agentdb","reasoningbank-intelligence","swarm-orchestration","swarm-advanced","sparc-methodology","hooks-automation","hive-mind-advanced","stream-chain","agentic-jujutsu","iterative-loop","performance-analysis","skill-builder","qe-agentic-flow-integration","release"],Ee=["qe-contract-testing","qe-security-compliance","aqe-v2-v3-migration"],B=class{projectRoot;options;sourceSkillsDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installV2Skills:!0,installV3Skills:!0,overwrite:!1,exclude:[],include:void 0,...e},this.sourceSkillsDir=this.findSourceSkillsDir()}findSourceSkillsDir(){let e=Ie(Te(import.meta.url)),t=[u(e,"../../.claude/skills"),u(e,"../../assets/skills"),u(this.projectRoot,"node_modules/agentic-qe/assets/skills"),u(this.projectRoot,"node_modules/agentic-qe/assets/skills")],n=process.env.HOME||process.env.USERPROFILE||"";if(process.platform==="win32"){let s=process.env.APPDATA||u(n,"AppData","Roaming");t.push(u(s,"npm/node_modules/agentic-qe/assets/skills"),u(s,"npm/node_modules/agentic-qe/.claude/skills"))}else{let s=["/usr/local","/usr",u(n,".npm-global"),u(n,".nvm/versions/node",process.version)];for(let o of s)t.push(u(o,"lib/node_modules/agentic-qe/assets/skills"),u(o,"lib/node_modules/agentic-qe/.claude/skills"),u(o,"node_modules/agentic-qe/assets/skills"),u(o,"node_modules/agentic-qe/.claude/skills"))}for(let s of t)if(y(s))return s;return t[0]}async install(){let e={installed:[],skipped:[],removed:[],errors:[],totalCount:0,skillsDir:u(this.projectRoot,".claude","skills"),validationInstalled:!1};if(!y(this.sourceSkillsDir))return e.errors.push(`Source skills directory not found: ${this.sourceSkillsDir}`),e;let t=u(this.projectRoot,".claude","skills");y(t)||D(t,{recursive:!0});let n=this.getAvailableSkills();e.totalCount=n.length;let r=this.filterSkills(n);for(let s of r)try{let o=await this.installSkill(s,t);o?e.installed.push(o):e.skipped.push(s)}catch(o){e.errors.push(`Failed to install ${s}: ${b(o)}`)}return this.options.overwrite&&(e.removed=this.removeDeprecatedSkills(t)),e.validationInstalled=this.installValidationInfrastructure(t),await this.createSkillsIndex(t,e.installed),e}installValidationInfrastructure(e){let t=u(this.sourceSkillsDir,".validation"),n=u(e,".validation");if(!y(t))return console.debug("[SkillsInstaller] Validation infrastructure not found in source"),!1;if(y(n)&&!this.options.overwrite)return console.debug("[SkillsInstaller] Validation infrastructure already exists, skipping"),!0;try{return y(n)||D(n,{recursive:!0}),this.copyDirectoryRecursive(t,n),console.debug("[SkillsInstaller] Validation infrastructure installed successfully"),!0}catch(r){return console.error("[SkillsInstaller] Failed to install validation infrastructure:",r instanceof Error?r.message:r),!1}}removeDeprecatedSkills(e){let t=[];for(let n of Ee){let r=u(e,n);if(y(r))try{this.removeDirectoryRecursive(r),t.push(n)}catch(s){console.error(`[SkillsInstaller] Failed to remove deprecated skill ${n}:`,s instanceof Error?s.message:s)}}return t.length>0&&console.debug(`[SkillsInstaller] Removed ${t.length} deprecated skills: ${t.join(", ")}`),t}removeDirectoryRecursive(e){let t=j(e,{withFileTypes:!0});for(let n of t){let r=u(e,n.name);n.isDirectory()?this.removeDirectoryRecursive(r):Re(r)}qe(e)}getAvailableSkills(){try{return j(this.sourceSkillsDir).filter(t=>{let n=u(this.sourceSkillsDir,t);return U(n).isDirectory()&&!t.startsWith(".")})}catch{return[]}}filterSkills(e){let t=e;return t=t.filter(n=>!H.includes(n)),this.options.include&&this.options.include.length>0&&(t=t.filter(n=>this.options.include.includes(n))),this.options.exclude&&this.options.exclude.length>0&&(t=t.filter(n=>!this.options.exclude.some(r=>n.includes(r)||n.match(new RegExp(r))))),this.options.installV3Skills||(t=t.filter(n=>!G.includes(n))),this.options.installV2Skills||(t=t.filter(n=>G.includes(n))),t}async installSkill(e,t){let n=u(this.sourceSkillsDir,e),r=u(t,e);if(y(r)&&!this.options.overwrite)return null;y(r)||D(r,{recursive:!0}),this.copyDirectoryRecursive(n,r);let s=this.getSkillType(e),o=this.getSkillDescription(r),a=y(u(r,"resources"));return{name:e,type:s,description:o,hasResources:a}}copyDirectoryRecursive(e,t){let n=j(e);for(let r of n){let s=u(e,r),o=u(t,r);U(s).isDirectory()?(y(o)||D(o,{recursive:!0}),this.copyDirectoryRecursive(s,o)):je(s,o)}}getSkillType(e){return G.includes(e)?"v3-domain":"v2-methodology"}getSkillDescription(e){let t=u(e,"SKILL.md");if(y(t))try{let n=we(t,"utf-8"),r=n.match(/description:\s*["']?([^"'\n]+)["']?/i);if(r)return r[1].trim();let s=n.split(`
7
- `);for(let o of s){let a=o.trim();if(a&&!a.startsWith("#")&&!a.startsWith("-")&&!a.startsWith("```"))return a.slice(0,100)+(a.length>100?"...":"")}}catch(n){console.debug("[SkillsInstaller] Failed to read skill description:",n instanceof Error?n.message:n)}}async createSkillsIndex(e,t){let n=this.scanSkillsDirectory(e),r=n.filter(c=>!H.includes(c.name)),s=r.filter(c=>c.type==="v2-methodology"),o=r.filter(c=>c.type==="v3-domain"),a=n.filter(c=>H.includes(c.name)),l=y(u(e,".validation")),g=`# AQE Skills Index
8
-
9
- This directory contains Quality Engineering skills managed by Agentic QE.
10
-
11
- ## Summary
12
-
13
- - **Total QE Skills**: ${r.length}
14
- - **V2 Methodology Skills**: ${s.length}
15
- - **V3 Domain Skills**: ${o.length}
16
- - **Platform Skills**: ${a.length} (Claude Flow managed)
17
- - **Validation Infrastructure**: ${l?"\u2705 Installed":"\u274C Not installed"}
18
-
19
- > **Note**: Platform skills (agentdb, github, flow-nexus, etc.) are managed by claude-flow.
20
- > Only QE-specific skills are installed/updated by \`aqe init\`.
21
-
22
- ## V2 Methodology Skills (${s.length})
23
-
24
- Version-agnostic quality engineering best practices from the QE community.
25
-
26
- ${s.length>0?s.map(c=>`- **${c.name}**${c.description?`: ${c.description}`:""}`).join(`
27
- `):"*None installed*"}
28
-
29
- ## V3 Domain Skills (${o.length})
30
-
31
- V3-specific implementation guides for the 12 DDD bounded contexts.
32
-
33
- ${o.length>0?o.map(c=>`- **${c.name}**${c.description?`: ${c.description}`:""}`).join(`
34
- `):"*None installed*"}
35
-
36
- ## Platform Skills (${a.length})
37
-
38
- Claude Flow platform skills (managed separately).
39
-
40
- ${a.length>0?a.map(c=>`- ${c.name}`).join(`
41
- `):"*None present*"}
42
- ${l?`
43
- ## Validation Infrastructure
44
-
45
- The \`.validation/\` directory contains the skill validation infrastructure (ADR-056):
46
-
47
- - **schemas/**: JSON Schema definitions for validating skill outputs
48
- - **templates/**: Validator script templates for creating skill validators
49
- - **examples/**: Example skill outputs that validate against schemas
50
- - **test-data/**: Test data for validator self-testing
51
-
52
- See \`.validation/README.md\` for usage instructions.
53
- `:""}
54
- ---
55
-
56
- *Generated by AQE v3 init on ${new Date().toISOString()}*
57
- `;De(u(e,"README.md"),g,"utf-8")}scanSkillsDirectory(e){let t=[];try{let n=j(e);for(let r of n){if(r.startsWith("."))continue;let s=u(e,r);if(!U(s).isDirectory())continue;let o=u(s,"SKILL.md");if(!y(o))continue;let a=this.getSkillType(r),l=this.getSkillDescription(s),g=y(u(s,"resources"));t.push({name:r,type:a,description:l,hasResources:g})}}catch(n){console.debug("[SkillsInstaller] Failed to scan skills directory:",n instanceof Error?n.message:n)}return t.sort((n,r)=>n.name.localeCompare(r.name))}};function ct(i){return new B(i)}T();import{existsSync as f,mkdirSync as w,readdirSync as K,statSync as oe,readFileSync as ae,writeFileSync as le,copyFileSync as J}from"fs";import{join as d,dirname as ce}from"path";import{fileURLToPath as ge}from"url";function _e(i){let e=new Date().toISOString().slice(0,10),t=i.match(/^---\n([\s\S]*?)\n---/);if(!t)return i;let n=t[1],r;return/^updated:/m.test(n)?r=n.replace(/^updated:.*$/m,`updated: ${e}`):/^created:/m.test(n)?r=n.replace(/^(created:.*$)/m,`$1
58
- updated: ${e}`):r=n+`
59
- updated: ${e}`,i.replace(/^---\n[\s\S]*?\n---/,`---
60
- ${r}
61
- ---`)}var Pe=["qe-test-architect","qe-bdd-generator","qe-property-tester","qe-mutation-tester","qe-test-idea-rewriter","qe-quality-criteria-recommender","qe-parallel-executor","qe-flaky-hunter","qe-retry-handler","qe-coverage-specialist","qe-gap-detector","qe-quality-gate","qe-code-complexity","qe-deployment-advisor","qe-risk-assessor","qe-defect-predictor","qe-regression-analyzer","qe-root-cause-analyzer","qe-impact-analyzer","qe-requirements-validator","qe-qx-partner","qe-product-factors-assessor","qe-code-intelligence","qe-kg-builder","qe-dependency-mapper","qe-security-scanner","qe-security-auditor","qe-pentest-validator","qe-contract-validator","qe-graphql-tester","qe-visual-tester","qe-accessibility-auditor","qe-responsive-tester","qe-chaos-engineer","qe-load-tester","qe-performance-tester","qe-learning-coordinator","qe-pattern-learner","qe-metrics-optimizer","qe-transfer-specialist","qe-soap-tester","qe-sap-rfc-tester","qe-sap-idoc-tester","qe-odata-contract-tester","qe-middleware-validator","qe-message-broker-tester","qe-sod-analyzer","qe-fleet-commander","qe-queen-coordinator","qe-tdd-specialist","qe-integration-tester","qe-integration-architect"],Fe=["qe-code-reviewer","qe-integration-reviewer","qe-performance-reviewer","qe-security-reviewer","qe-tdd-red","qe-tdd-green","qe-tdd-refactor"],Y=class{projectRoot;options;sourceAgentsDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installQEAgents:!0,installSubagents:!0,overwrite:!1,exclude:[],include:void 0,...e},this.sourceAgentsDir=this.findSourceAgentsDir()}findSourceAgentsDir(){let e=ce(ge(import.meta.url)),t=[d(e,"../../assets/agents/v3"),d(e,"../../.claude/agents/v3"),d(this.projectRoot,"node_modules/agentic-qe/assets/agents/v3"),d(this.projectRoot,"node_modules/agentic-qe/assets/agents/v3")],n=process.env.HOME||process.env.USERPROFILE||"";if(process.platform==="win32"){let s=process.env.APPDATA||d(n,"AppData","Roaming");t.push(d(s,"npm/node_modules/agentic-qe/assets/agents/v3"),d(s,"npm/node_modules/agentic-qe/.claude/agents/v3"))}else{let s=["/usr/local","/usr",d(n,".npm-global"),d(n,".nvm/versions/node",process.version)];for(let o of s)t.push(d(o,"lib/node_modules/agentic-qe/assets/agents/v3"),d(o,"lib/node_modules/agentic-qe/.claude/agents/v3"),d(o,"node_modules/agentic-qe/assets/agents/v3"),d(o,"node_modules/agentic-qe/.claude/agents/v3"))}for(let s of t)if(f(s))return s;return t[0]}preserveOverridesDir(){let e=d(this.projectRoot,".claude","agent-overrides");f(e)||w(e,{recursive:!0});let t=d(e,"_example.yaml");if(!f(t))try{let n=ce(ge(import.meta.url)),r=[d(n,"..","..","assets","templates","agent-override-example.yaml"),d(n,"..","assets","templates","agent-override-example.yaml"),d(this.projectRoot,"node_modules","agentic-qe","assets","templates","agent-override-example.yaml")];for(let s of r)if(f(s)){J(s,t);break}}catch{}}async install(){let e={installed:[],skipped:[],errors:[],totalCount:0,agentsDir:d(this.projectRoot,".claude","agents","v3"),overlaysApplied:[],overlayWarnings:[]};if(this.preserveOverridesDir(),!f(this.sourceAgentsDir))return e.errors.push(`Source agents directory not found: ${this.sourceAgentsDir}`),e;let t=d(this.projectRoot,".claude","agents","v3");f(t)||w(t,{recursive:!0});let n=d(t,"subagents");f(n)||w(n,{recursive:!0}),await this.copyHelpersDirectory(t),await this.copyTemplatesDirectory(t);let r=this.getAvailableAgents();e.totalCount=r.length;let s=this.filterAgents(r);for(let l of s)try{let g=await this.installAgent(l,t,n);g?e.installed.push(g):e.skipped.push(l)}catch(g){e.errors.push(`Failed to install ${l}: ${b(g)}`)}let o=te(this.projectRoot);if(o.warnings.length>0){e.overlayWarnings=o.warnings;for(let l of o.warnings)console.error(`[AgentsInstaller] Overlay warning: ${l}`)}if(o.errors.length>0)for(let l of o.errors)e.errors.push(`Overlay error: ${l}`);for(let l of o.overlays){let g=l.agent,k=Fe.includes(g)?d(n,`${g}.md`):d(t,`${g}.md`);if(!f(k)){e.overlayWarnings.push(`Overlay for "${g}" found but agent file does not exist. Skipping.`);continue}try{let q=ae(k,"utf-8"),{content:me,applied:I}=ne(q,l),fe=_e(me);le(k,fe,"utf-8"),e.overlaysApplied.push(g);let he=[...I.replacedFields.map(A=>`replaced:${A}`),...I.appendedFields.map(A=>`appended:${A}`),...I.configOverrides.map(A=>`config:${A}`)];console.error(`[AgentsInstaller] Applied overlay for ${g}: ${he.join(", ")}`)}catch(q){e.overlayWarnings.push(`Failed to apply overlay for "${g}": ${b(q)}`)}}e.overlaysApplied.length>0&&console.error(`[AgentsInstaller] Applied ${e.overlaysApplied.length} agent overlay(s): ${e.overlaysApplied.join(", ")}`);let a=ee(t,this.projectRoot);if(e.mcpValidationWarnings=a.warnings,a.warnings.length>0){console.error(`[AgentsInstaller] MCP dependency warnings (${a.agentsWithMissingDeps.length} agents affected):`);for(let l of a.warnings.slice(0,10))console.error(` ${l}`);a.warnings.length>10&&console.error(` ... and ${a.warnings.length-10} more warnings`)}return await this.createAgentsIndex(t,e.installed),e}getAvailableAgents(){let e=[];try{let t=K(this.sourceAgentsDir);for(let n of t){let r=d(this.sourceAgentsDir,n),s=oe(r);if(s.isFile()&&n.endsWith(".md"))e.push(n.replace(".md",""));else if(s.isDirectory()&&n==="subagents"){let o=K(r);for(let a of o)a.endsWith(".md")&&e.push(`subagents/${a.replace(".md","")}`)}}}catch{return[]}return e}filterAgents(e){let t=e.filter(n=>(n.includes("/")?n.split("/")[1]:n).startsWith("qe-"));return this.options.include&&this.options.include.length>0&&(t=t.filter(n=>{let r=n.includes("/")?n.split("/")[1]:n;return this.options.include.includes(r)})),this.options.exclude&&this.options.exclude.length>0&&(t=t.filter(n=>{let r=n.includes("/")?n.split("/")[1]:n;return!this.options.exclude.some(s=>r.includes(s)||r.match(new RegExp(s)))})),this.options.installQEAgents||(t=t.filter(n=>{let r=n.includes("/")?n.split("/")[1]:n;return!Pe.includes(r)})),this.options.installSubagents||(t=t.filter(n=>!n.startsWith("subagents/"))),t}async installAgent(e,t,n){let r=e.startsWith("subagents/"),s=r?e.split("/")[1]:e,o=d(this.sourceAgentsDir,`${e}.md`),a=r?d(n,`${s}.md`):d(t,`${s}.md`);if(f(a)&&!this.options.overwrite)return null;if(f(o))J(o,a);else throw new Error(`Source file not found: ${o}`);let l=this.getAgentType(s,r),g=this.getAgentDescription(a),c=this.getAgentDomain(s);return{name:s,type:l,description:g,domain:c}}getAgentType(e,t){return t?"v3-subagent":"v3-qe"}copyDirectoryRecursive(e,t){if(!f(e))return;f(t)||w(t,{recursive:!0});let n=K(e);for(let r of n){let s=d(e,r),o=d(t,r);oe(s).isDirectory()?this.copyDirectoryRecursive(s,o):(!f(o)||this.options.overwrite)&&J(s,o)}}async copyHelpersDirectory(e){let t=d(this.sourceAgentsDir,"helpers"),n=d(this.projectRoot,".claude","helpers","v3");f(t)&&this.copyDirectoryRecursive(t,n)}async copyTemplatesDirectory(e){let t=d(this.sourceAgentsDir,"templates"),n=d(e,"templates");f(t)&&this.copyDirectoryRecursive(t,n)}getAgentDescription(e){if(f(e))try{let t=ae(e,"utf-8"),n=t.match(/description:\s*["']?([^"'\n]+)["']?/i);if(n)return n[1].trim();let r=t.split(`
62
- `);for(let s of r){let o=s.trim();if(o&&!o.startsWith("#")&&!o.startsWith("-")&&!o.startsWith("```")&&!o.startsWith("---"))return o.slice(0,100)+(o.length>100?"...":"")}}catch(t){console.debug("[AgentsInstaller] Failed to read agent description:",t instanceof Error?t.message:t)}}getAgentDomain(e){let t={"test-architect":"test-generation","bdd-generator":"test-generation","property-tester":"test-generation","mutation-tester":"test-generation","parallel-executor":"test-execution","flaky-hunter":"test-execution","retry-handler":"test-execution","coverage-specialist":"coverage-analysis","gap-detector":"coverage-analysis","quality-gate":"quality-assessment","code-complexity":"quality-assessment","deployment-advisor":"quality-assessment","risk-assessor":"quality-assessment","defect-predictor":"defect-intelligence","regression-analyzer":"defect-intelligence","root-cause-analyzer":"defect-intelligence","impact-analyzer":"defect-intelligence","requirements-validator":"requirements-validation","qx-partner":"requirements-validation","product-factors-assessor":"requirements-validation","quality-criteria-recommender":"requirements-validation","test-idea-rewriter":"test-generation","code-intelligence":"code-intelligence","kg-builder":"code-intelligence","dependency-mapper":"code-intelligence","security-scanner":"security-compliance","security-auditor":"security-compliance","pentest-validator":"security-compliance","contract-validator":"contract-testing","graphql-tester":"contract-testing","visual-tester":"visual-accessibility","accessibility-auditor":"visual-accessibility","responsive-tester":"visual-accessibility","chaos-engineer":"chaos-resilience","load-tester":"chaos-resilience","performance-tester":"chaos-resilience","learning-coordinator":"learning-optimization","pattern-learner":"learning-optimization","metrics-optimizer":"learning-optimization","transfer-specialist":"learning-optimization","soap-tester":"enterprise-integration","sap-rfc-tester":"enterprise-integration","sap-idoc-tester":"enterprise-integration","odata-contract-tester":"enterprise-integration","middleware-validator":"enterprise-integration","message-broker-tester":"enterprise-integration","sod-analyzer":"enterprise-integration"},n=e.replace(/^(v3-)?qe-/,"");return t[n]}async createAgentsIndex(e,t){let n=t.filter(l=>l.type==="v3-qe"),r=t.filter(l=>l.type==="v3-subagent"),s=new Map;for(let l of n){let g=l.domain||"general";s.has(g)||s.set(g,[]),s.get(g).push(l)}let o=`# AQE V3 Agents Index
63
-
64
- This directory contains V3 QE agents installed by \`aqe init\`.
65
-
66
- > **Note**: This directory only contains AQE-specific agents (v3-qe-*).
67
- > Claude-flow core agents (adr-architect, memory-specialist, etc.) are part of
68
- > the claude-flow system and are available separately.
69
-
70
- ## Summary
71
-
72
- - **Total Agents**: ${t.length}
73
- - **V3 QE Domain Agents**: ${n.length}
74
- - **V3 Subagents**: ${r.length}
75
-
76
- ## Usage
77
-
78
- Spawn agents using Claude Code's Task tool:
79
-
80
- \`\`\`javascript
81
- Task("Generate tests for UserService", "...", "v3-qe-test-architect")
82
- Task("Analyze coverage gaps", "...", "v3-qe-coverage-specialist")
83
- Task("Run security scan", "...", "v3-qe-security-scanner")
84
- \`\`\`
85
-
86
- ## V3 QE Domain Agents (${n.length})
87
-
88
- Quality Engineering agents mapped to the 12 DDD bounded contexts.
89
-
90
- ${Array.from(s.entries()).map(([l,g])=>`
91
- ### ${l.split("-").map(c=>c.charAt(0).toUpperCase()+c.slice(1)).join(" ")}
92
-
93
- ${g.map(c=>`- **${c.name}**${c.description?`: ${c.description}`:""}`).join(`
94
- `)}
95
- `).join(`
96
- `)}
97
-
98
- ## V3 Subagents (${r.length})
99
-
100
- Specialized sub-task agents for TDD and code review.
101
-
102
- ${r.map(l=>`- **${l.name}**${l.description?`: ${l.description}`:""}`).join(`
103
- `)}
104
-
105
- ---
106
-
107
- *Generated by AQE v3 init on ${new Date().toISOString()}*
108
- `,a=d(this.projectRoot,".claude","docs");f(a)||w(a,{recursive:!0}),le(d(a,"v3-agents-index.md"),o,"utf-8")}};function vt(i){return new Y(i)}T();import{existsSync as v,mkdirSync as Z,readdirSync as de,readFileSync as Ne,writeFileSync as $e,copyFileSync as ue}from"fs";import{join as h,dirname as Oe}from"path";import{fileURLToPath as Le}from"url";var Me=Le(import.meta.url),R=Oe(Me),pe={core:[{name:"workflow-executor",filename:"n8n-workflow-executor.md",category:"core"},{name:"node-validator",filename:"n8n-node-validator.md",category:"core"},{name:"trigger-test",filename:"n8n-trigger-test.md",category:"core"},{name:"expression-validator",filename:"n8n-expression-validator.md",category:"core"},{name:"integration-test",filename:"n8n-integration-test.md",category:"core"},{name:"security-auditor",filename:"n8n-security-auditor.md",category:"core"}],advanced:[{name:"unit-tester",filename:"n8n-unit-tester.md",category:"advanced"},{name:"performance-tester",filename:"n8n-performance-tester.md",category:"advanced"},{name:"ci-orchestrator",filename:"n8n-ci-orchestrator.md",category:"advanced"}],quality:[{name:"version-comparator",filename:"n8n-version-comparator.md",category:"quality"},{name:"bdd-scenario-tester",filename:"n8n-bdd-scenario-tester.md",category:"quality"},{name:"monitoring-validator",filename:"n8n-monitoring-validator.md",category:"quality"}],enterprise:[{name:"compliance-validator",filename:"n8n-compliance-validator.md",category:"enterprise"},{name:"chaos-tester",filename:"n8n-chaos-tester.md",category:"enterprise"}],reliability:[{name:"base-agent",filename:"n8n-base-agent.md",category:"reliability"}]},Ve=["n8n-expression-testing","n8n-integration-testing-patterns","n8n-security-testing","n8n-trigger-testing-strategies","n8n-workflow-testing-fundamentals"],X=class{projectRoot;options;sourceAgentsDir;sourceSkillsDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installAgents:!0,installSkills:!0,overwrite:!1,...e},this.sourceAgentsDir=this.findSourceAgentsDir(),this.sourceSkillsDir=this.findSourceSkillsDir()}findSourceAgentsDir(){let e=[h(R,"../../.claude/agents/n8n"),h(process.cwd(),".claude/agents/n8n"),h(R,"../../assets/agents/n8n")];for(let t of e)if(v(t))return t;return h(process.cwd(),".claude/agents/n8n")}findSourceSkillsDir(){let e=[h(R,"../../.claude/skills"),h(process.cwd(),".claude/skills"),h(R,"../../assets/skills")];for(let t of e)if(v(t))return t;return h(process.cwd(),".claude/skills")}async install(){let e={success:!0,agentsInstalled:[],skillsInstalled:[],configGenerated:!1,errors:[],agentsDir:h(this.projectRoot,".claude/agents/n8n"),skillsDir:h(this.projectRoot,".claude/skills")};try{if(this.options.installAgents){let t=await this.installAgents(e.agentsDir);e.agentsInstalled=t.installed,e.errors.push(...t.errors)}if(this.options.installSkills){let t=await this.installSkills(e.skillsDir);e.skillsInstalled=t.installed,e.errors.push(...t.errors)}this.options.n8nApiConfig&&(e.configGenerated=!0),e.agentsInstalled.length>0&&this.createAgentsIndex(e.agentsDir,e.agentsInstalled)}catch(t){e.success=!1,e.errors.push(`Installation failed: ${b(t)}`)}return e}async installAgents(e){let t=[],n=[];if(v(e)||Z(e,{recursive:!0}),!v(this.sourceAgentsDir))return n.push(`Source agents directory not found: ${this.sourceAgentsDir}`),{installed:t,errors:n};let r=de(this.sourceAgentsDir).filter(s=>s.endsWith(".md"));for(let s of Object.keys(pe))for(let o of pe[s]){let a=h(this.sourceAgentsDir,o.filename),l=h(e,o.filename);if(r.includes(o.filename)&&!(v(l)&&!this.options.overwrite))try{ue(a,l);let c=Ne(a,"utf-8").match(/description:\s*["']?(.+?)["']?\n/);o.description=c?.[1]||`n8n ${o.name} agent`,t.push(o)}catch(g){n.push(`Failed to install ${o.name}: ${b(g)}`)}}return{installed:t,errors:n}}async installSkills(e){let t=[],n=[];if(v(e)||Z(e,{recursive:!0}),!v(this.sourceSkillsDir))return n.push(`Source skills directory not found: ${this.sourceSkillsDir}`),{installed:t,errors:n};for(let r of Ve){let s=h(this.sourceSkillsDir,r),o=h(e,r);if(v(s)&&!(v(o)&&!this.options.overwrite))try{this.copyDirectory(s,o),t.push(r)}catch(a){n.push(`Failed to install skill ${r}: ${b(a)}`)}}return{installed:t,errors:n}}copyDirectory(e,t){v(t)||Z(t,{recursive:!0});let n=de(e,{withFileTypes:!0});for(let r of n){let s=h(e,r.name),o=h(t,r.name);r.isDirectory()?this.copyDirectory(s,o):ue(s,o)}}createAgentsIndex(e,t){let n=h(e,"README.md"),r={core:t.filter(o=>o.category==="core"),advanced:t.filter(o=>o.category==="advanced"),quality:t.filter(o=>o.category==="quality"),enterprise:t.filter(o=>o.category==="enterprise"),reliability:t.filter(o=>o.category==="reliability")},s=`# N8n Testing Agents
109
-
110
- > Auto-generated by \`aqe init --with-n8n\`
111
-
112
- ## Overview
113
-
114
- These agents provide comprehensive testing capabilities for n8n workflow automation.
115
-
116
- | Category | Count |
117
- |----------|-------|
118
- | Core | ${r.core.length} |
119
- | Advanced | ${r.advanced.length} |
120
- | Quality | ${r.quality.length} |
121
- | Enterprise | ${r.enterprise.length} |
122
- | Reliability | ${r.reliability.length} |
123
- | **Total** | **${t.length}** |
124
-
125
- ## Usage with Claude Code
126
-
127
- \`\`\`javascript
128
- // Spawn an n8n agent
129
- Task("Test n8n workflow triggers", "n8n-trigger-test")
130
- Task("Run security audit on workflow", "n8n-security-auditor")
131
- \`\`\`
132
-
133
- ## Agent Categories
134
-
135
- `;for(let[o,a]of Object.entries(r))if(a.length!==0){s+=`### ${o.charAt(0).toUpperCase()+o.slice(1)}
136
-
137
- `;for(let l of a)s+=`- **${l.name}**: ${l.description||"N8n testing agent"}
138
- `;s+=`
139
- `}s+=`---
140
- Generated: ${new Date().toISOString()}
141
- `,$e(n,s)}generateConfigSection(){return{n8n:{enabled:!0,installAgents:this.options.installAgents,installSkills:this.options.installSkills,apiConfig:this.options.n8nApiConfig||null}}}generateClaudeMdSection(){return`
142
- ## N8n Workflow Testing
143
-
144
- This project includes n8n workflow testing agents. Use them with Claude Code:
145
-
146
- \`\`\`javascript
147
- // Security audit
148
- Task("Audit n8n workflow for vulnerabilities", "n8n-security-auditor")
149
-
150
- // Performance testing
151
- Task("Run load test on workflow", "n8n-performance-tester")
152
-
153
- // Trigger validation
154
- Task("Test webhook triggers", "n8n-trigger-test")
155
-
156
- // Expression validation
157
- Task("Validate n8n expressions", "n8n-expression-validator")
158
- \`\`\`
159
-
160
- ### Available N8n Agents
161
-
162
- | Agent | Purpose |
163
- |-------|---------|
164
- | n8n-workflow-executor | Execute and validate workflows |
165
- | n8n-security-auditor | Security vulnerability scanning |
166
- | n8n-performance-tester | Performance benchmarking |
167
- | n8n-trigger-test | Trigger validation |
168
- | n8n-expression-validator | Expression syntax checking |
169
- | n8n-compliance-validator | Regulatory compliance |
170
- | n8n-chaos-tester | Resilience testing |
171
-
172
- ### V3 Domain Integration
173
-
174
- N8n agents map to v3 domains:
175
- - Security agents \u2192 security-compliance domain
176
- - Performance agents \u2192 test-execution domain
177
- - Compliance agents \u2192 security-compliance domain
178
- - Chaos agents \u2192 chaos-resilience domain
179
-
180
- `}};function wt(i){return new X(i)}export{M as a,We as b,He as c,Ye as d,Ce as e,Xe as f,et as g,tt as h,ct as i,vt as j,wt as k};
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{c as t}from"./chunk-4I2IOUS4.js";import{randomInt as o}from"node:crypto";function a(){return Math.random()}function m(n,e){return o(n,e)}function c(n,e){return n+Math.random()*(e-n)}var r=t(()=>{"use strict"});export{a,m as b,c,r as d};
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{c as x,e as M,g as T}from"./chunk-4I2IOUS4.js";var v={};M(v,{DotProductAttention:()=>z,FlashAttention:()=>k,HyperbolicAttention:()=>W,LinearAttention:()=>j,MoEAttention:()=>K,MultiHeadAttention:()=>F,RuvectorLayer:()=>_,SonaEngine:()=>q,TensorCompress:()=>E,default:()=>O,differentiableSearch:()=>L,getCompressionLevel:()=>B,hierarchicalForward:()=>V,init:()=>D,pipeline:()=>J});import{createRequire as A}from"module";var I,b,O,_,E,L,V,B,D,k,z,F,W,j,K,q,J,g=x(()=>{I=A(import.meta.url),b=I("@ruvector/rvf-node"),O=b,{RuvectorLayer:_,TensorCompress:E,differentiableSearch:L,hierarchicalForward:V,getCompressionLevel:B,init:D,FlashAttention:k,DotProductAttention:z,MultiHeadAttention:F,HyperbolicAttention:W,LinearAttention:j,MoEAttention:K,SonaEngine:q,pipeline:J}=b||{}});import{readFileSync as C,writeFileSync as H,copyFileSync as $,existsSync as G}from"fs";var f=null,y=!1;function l(){if(y)return f;y=!0;try{let i=(g(),T(v));!i.RvfDatabase&&i.default&&i.default.RvfDatabase&&(i=i.default),f=i}catch{f=null}return f}function S(i){return`${i}.idmap.json`}function R(i){let e=S(i),t=new Map,n=new Map,s=1;if(G(e))try{let r=JSON.parse(C(e,"utf-8"));s=r.nextLabel;for(let[a,m]of r.entries)t.set(a,m),n.set(m,a)}catch{}return{strToNum:t,numToStr:n,nextLabel:s}}function h(i,e,t){let n={nextLabel:t,entries:Array.from(e.entries())};H(S(i),JSON.stringify(n),"utf-8")}var d=class i{db;_path;_dimension;strToNum;numToStr;nextLabel;_open;constructor(e,t,n,s,r,a){this.db=e,this._path=t,this._dimension=n,this.strToNum=s,this.numToStr=r,this.nextLabel=a,this._open=!0}ingest(e){if(this.ensureOpen(),e.length===0)return{accepted:0,rejected:0};let t=this._dimension,n=new Float32Array(e.length*t),s=[],r=[];for(let o=0;o<e.length;o++){let{id:u,vector:p,metadata:w}=e[o],c=this.strToNum.get(u);c===void 0&&(c=this.nextLabel++,this.strToNum.set(u,c),this.numToStr.set(c,u)),s.push(c),r.push(w);let N=p instanceof Float32Array?p:new Float32Array(p);n.set(N.subarray(0,t),o*t)}let a;if(r.some(o=>o!==void 0)&&typeof this.db.ingestBatchWithMetadata=="function"){let o=r.map(u=>u?JSON.stringify(u):"");a=this.db.ingestBatchWithMetadata(n,s,o)}else a=this.db.ingestBatch(n,s);return this.persistIdMap(),{accepted:a.accepted,rejected:a.rejected}}search(e,t){this.ensureOpen();let n=e instanceof Float32Array?e:new Float32Array(e);return this.db.query(n,t).map(r=>{let a=this.numToStr.get(r.id);return a===void 0?null:{id:a,distance:r.distance,score:1/(1+r.distance)}}).filter(r=>r!==null)}delete(e){this.ensureOpen();let t=[];for(let s of e){let r=this.strToNum.get(s);r!==void 0&&t.push(r)}if(t.length===0)return 0;let n=this.db.delete(t);for(let s of e){let r=this.strToNum.get(s);r!==void 0&&(this.strToNum.delete(s),this.numToStr.delete(r))}return this.persistIdMap(),n.deleted}fork(e){this.ensureOpen(),$(this._path,e);let t=new Map(this.strToNum),n=new Map(this.numToStr);h(e,t,this.nextLabel);let r=l().RvfDatabase.open(e);return new i(r,e,this._dimension,t,n,this.nextLabel)}status(){this.ensureOpen();let e=this.db.status(),n=this.db.segments().filter(s=>s.segType==="witness");return{totalVectors:e.totalVectors,totalSegments:e.totalSegments,fileSizeBytes:e.fileSize,epoch:e.currentEpoch,witnessValid:n.length>0,witnessEntries:n.length}}dimension(){return this._dimension}size(){return this.ensureOpen(),this.db.status().totalVectors}compact(){this.ensureOpen(),this.db.compact()}close(){this._open&&(this.db.close(),this._open=!1)}isOpen(){return this._open}path(){return this._path}embedKernel(e){return this.ensureOpen(),this.db.embedKernel(0,99,0,e,0,"")}extractKernel(){return this.ensureOpen(),this.db.extractKernel()}verifyWitness(){this.ensureOpen();let e=this.tryNative("verifyWitness");return e?{valid:e.valid??!0,totalEntries:e.totalEntries??0,errors:Array.isArray(e.errors)?e.errors:[]}:{valid:!0,totalEntries:0,errors:[]}}sign(e){this.ensureOpen();let t=this.tryNative("sign",e);return typeof t=="string"?t:null}fileId(){this.ensureOpen();let e=this.tryNative("fileId");return typeof e=="string"?e:null}parentId(){this.ensureOpen();let e=this.tryNative("parentId");return typeof e=="string"?e:null}lineageDepth(){this.ensureOpen();let e=this.tryNative("lineageDepth");return typeof e=="number"?e:0}indexStats(){let e=this.status();return{totalVectors:e.totalVectors,dimension:this._dimension,totalSegments:e.totalSegments,fileSizeBytes:e.fileSizeBytes,epoch:e.epoch,witnessValid:e.witnessValid,witnessEntries:e.witnessEntries,idMapSize:this.strToNum.size}}freeze(){this.ensureOpen();let e=this.tryNative("freeze");return typeof e=="number"?e:0}derive(e){this.ensureOpen();let t=l();if(typeof this.db.derive=="function")try{let n=this.db.derive(e),s=new Map(this.strToNum),r=new Map(this.numToStr);return h(e,s,this.nextLabel),new i(n,e,this._dimension,s,r,this.nextLabel)}catch{}return this.fork(e)}ensureOpen(){if(!this._open)throw new Error("RVF database is closed")}tryNative(e,...t){if(typeof this.db[e]!="function")return null;try{return this.db[e](...t)}catch{return null}}persistIdMap(){h(this._path,this.strToNum,this.nextLabel)}};function X(i,e){let t=l();if(!t)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let n=t.RvfDatabase.create(i,{dimension:e}),s=n.dimension();return new d(n,i,s,new Map,new Map,1)}function Y(i){let e=l();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.open(i),n=t.dimension(),{strToNum:s,numToStr:r,nextLabel:a}=R(i);return new d(t,i,n,s,r,a)}function Z(i){let e=l();if(!e)throw new Error("@ruvector/rvf-node is not available \u2014 install the package or check platform compatibility");let t=e.RvfDatabase.openReadonly(i),n=t.dimension(),{strToNum:s,numToStr:r,nextLabel:a}=R(i);return new d(t,i,n,s,r,a)}function P(){return l()!==null}export{X as a,Y as b,Z as c,P as d};
@@ -1 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
@@ -1,2 +0,0 @@
1
- if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.9.0");process.exit(0)}
2
- import{c as r}from"./chunk-4I2IOUS4.js";function o(n){return n instanceof Error?n.message:String(n)}function e(n){return n instanceof Error?n:new Error(String(n))}var t=r(()=>{"use strict"});export{o as a,e as b,t as c};