agentic-qe 3.15.10 → 3.15.12

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 (536) hide show
  1. package/.claude/hooks/aqe-hook.cjs +38 -2
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +263 -0
  4. package/README.md +8 -0
  5. package/assets/skills/skills-manifest.json +1 -1
  6. package/dist/adapters/a2a/agent-cards/generator.js +6 -3
  7. package/dist/adapters/a2a/tasks/task-router.js +3 -1
  8. package/dist/adapters/trajectory-adapter.js +1 -1
  9. package/dist/agents/claim-verifier/verifiers/output-verifier.d.ts +3 -1
  10. package/dist/agents/claim-verifier/verifiers/output-verifier.js +31 -2
  11. package/dist/agents/overlay-loader.js +26 -21
  12. package/dist/cli/bundle.js +6 -6
  13. package/dist/cli/chunks/adapter-HL7MOCQN.js +2 -0
  14. package/dist/cli/chunks/{agent-booster-wasm-H7ANGXW4.js → agent-booster-wasm-5VZCKTIJ.js} +2 -2
  15. package/dist/cli/chunks/{agent-handler-SVXSHEET.js → agent-handler-K3C6CQCD.js} +2 -2
  16. package/dist/cli/chunks/{agent-memory-branch-WKQH36XL.js → agent-memory-branch-NVFQ25WS.js} +2 -2
  17. package/dist/cli/chunks/aqe-learning-engine-OZ2DXB4G.js +2 -0
  18. package/dist/cli/chunks/{arena-EKOOFVST.js → arena-QGWIJADQ.js} +2 -2
  19. package/dist/cli/chunks/{arena-OPS36NFZ.js → arena-TSZVDSXS.js} +4 -4
  20. package/dist/cli/chunks/{audit-AO5NDZRI.js → audit-KIEE2SHJ.js} +3 -3
  21. package/dist/cli/chunks/base-WIM7G3HC.js +2 -0
  22. package/dist/cli/chunks/{better-sqlite3-TFLVEMMY.js → better-sqlite3-BNB32NW3.js} +2 -2
  23. package/dist/cli/chunks/{brain-handler-ADBBJPYW.js → brain-handler-MPC5SPYI.js} +3 -3
  24. package/dist/cli/chunks/{branch-enumerator-HGHUYYL5.js → branch-enumerator-LZ7UXKAY.js} +2 -2
  25. package/dist/cli/chunks/{browser-5LU6P4SZ.js → browser-VDHAW4RK.js} +2 -2
  26. package/dist/cli/chunks/browser-workflow-QRKCFVR3.js +2 -0
  27. package/dist/cli/chunks/{chunk-5LPYV3TK.js → chunk-23PQF7NN.js} +1 -1
  28. package/dist/cli/chunks/{chunk-2ZMF4NCF.js → chunk-26672ISV.js} +2 -2
  29. package/dist/cli/chunks/{chunk-U53ZB4IX.js → chunk-2ASQRBK2.js} +2 -2
  30. package/dist/cli/chunks/{chunk-7PJIR4ST.js → chunk-2E2QO44T.js} +2 -2
  31. package/dist/cli/chunks/{chunk-2T7RRL6G.js → chunk-2IVE5AR3.js} +1 -1
  32. package/dist/cli/chunks/{chunk-B6LTH6YV.js → chunk-2JYUA27M.js} +1 -1
  33. package/dist/cli/chunks/{chunk-PFG6VQ5Z.js → chunk-2PPSS4JD.js} +2 -2
  34. package/dist/cli/chunks/{chunk-NZYLNXT6.js → chunk-32UTHIY5.js} +5 -5
  35. package/dist/cli/chunks/{chunk-5E6GHSTY.js → chunk-33I2ZP6E.js} +2 -2
  36. package/dist/cli/chunks/{chunk-XLZYRTNO.js → chunk-35MIUSXQ.js} +2 -2
  37. package/dist/cli/chunks/{chunk-7LFZ4CHM.js → chunk-35NW676P.js} +2 -2
  38. package/dist/cli/chunks/{chunk-4G63WT4F.js → chunk-3EWQN37E.js} +2 -2
  39. package/dist/cli/chunks/{chunk-GZLZCZ42.js → chunk-3IU4LDZR.js} +2 -2
  40. package/dist/cli/chunks/{chunk-CESIR27V.js → chunk-47RMGDG4.js} +2 -2
  41. package/dist/cli/chunks/chunk-4A76VPU4.js +3 -0
  42. package/dist/cli/chunks/{chunk-DT7SIJOA.js → chunk-4CB3QPZM.js} +2 -2
  43. package/dist/cli/chunks/{chunk-ERQKYIP7.js → chunk-4HWUECVD.js} +5 -5
  44. package/dist/cli/chunks/{chunk-MA7JIQ6U.js → chunk-4KUOYDY2.js} +5 -5
  45. package/dist/cli/chunks/{chunk-VWNFAW2M.js → chunk-4LWMAAWK.js} +2 -2
  46. package/dist/cli/chunks/{chunk-IKISCIGH.js → chunk-4PU5GTZW.js} +2 -2
  47. package/dist/cli/chunks/{chunk-ZXPY654C.js → chunk-4SA7M34P.js} +1 -1
  48. package/dist/cli/chunks/{chunk-NGKNYIQZ.js → chunk-4Y6OEBJZ.js} +1 -1
  49. package/dist/cli/chunks/{chunk-KOBVYY6H.js → chunk-5A66EGEW.js} +2 -2
  50. package/dist/cli/chunks/{chunk-Z2O2YJAF.js → chunk-5ADXFUMO.js} +2 -2
  51. package/dist/cli/chunks/{chunk-YKMU4LBV.js → chunk-5S4UIDFK.js} +1 -1
  52. package/dist/cli/chunks/{chunk-Z7IYW5U7.js → chunk-5TAEW5OV.js} +1 -1
  53. package/dist/cli/chunks/chunk-5Z23ZMXZ.js +742 -0
  54. package/dist/cli/chunks/{chunk-6TB6YOCZ.js → chunk-65TH6RPD.js} +1 -1
  55. package/dist/cli/chunks/{chunk-3Y7SPD72.js → chunk-66PXR3NI.js} +2 -2
  56. package/dist/cli/chunks/{chunk-3P34JFQH.js → chunk-6E6HB4N4.js} +14 -14
  57. package/dist/cli/chunks/{chunk-6PX4OXQO.js → chunk-6QRI3JVE.js} +2 -2
  58. package/dist/cli/chunks/{chunk-WBM6N6IM.js → chunk-7DNR4KKR.js} +1 -1
  59. package/dist/cli/chunks/{chunk-6XCMKIZN.js → chunk-7JFDLL2F.js} +1 -1
  60. package/dist/cli/chunks/chunk-7OEFBWAG.js +5 -0
  61. package/dist/cli/chunks/{chunk-Y76IAYQD.js → chunk-7QEUHNKO.js} +1 -1
  62. package/dist/cli/chunks/{chunk-WQ4PYWSW.js → chunk-7TA5MUPW.js} +1 -1
  63. package/dist/cli/chunks/{chunk-2XGVTYVX.js → chunk-A2JCRXTK.js} +2 -2
  64. package/dist/cli/chunks/{chunk-ESUO3GTJ.js → chunk-A5Y7DAVQ.js} +2 -2
  65. package/dist/cli/chunks/{chunk-ATHWDAXB.js → chunk-ADUAJIAU.js} +2 -2
  66. package/dist/cli/chunks/{chunk-IU2IV4NE.js → chunk-AJEXPFAB.js} +1 -1
  67. package/dist/cli/chunks/{chunk-YK7JN5N7.js → chunk-BC4T6SCV.js} +4 -4
  68. package/dist/cli/chunks/{chunk-KSIWGGJI.js → chunk-BMG2JLSQ.js} +2 -2
  69. package/dist/cli/chunks/chunk-BOSMELJX.js +180 -0
  70. package/dist/cli/chunks/{chunk-7OZVZIBE.js → chunk-BYRCB5JT.js} +2 -2
  71. package/dist/cli/chunks/{chunk-FAUCT5KR.js → chunk-C3YOVASQ.js} +6 -5
  72. package/dist/cli/chunks/{chunk-DMFTELBS.js → chunk-C74M4WUI.js} +2 -2
  73. package/dist/cli/chunks/{chunk-2SXBBUM6.js → chunk-CA5UNWQF.js} +2 -2
  74. package/dist/cli/chunks/{chunk-UCJMVXO4.js → chunk-CDA5Z74H.js} +2 -2
  75. package/dist/cli/chunks/{chunk-NVYIZCSR.js → chunk-CPIBIR3X.js} +2 -2
  76. package/dist/cli/chunks/{chunk-YK3BVZY6.js → chunk-CU36D7TN.js} +2 -2
  77. package/dist/cli/chunks/{chunk-H32EPIR2.js → chunk-DAUEK66C.js} +1 -1
  78. package/dist/cli/chunks/{chunk-6KIL6CMD.js → chunk-DRCBRUGN.js} +2 -2
  79. package/dist/cli/chunks/{chunk-EWFECZ2U.js → chunk-DZGPUGUG.js} +2 -2
  80. package/dist/cli/chunks/{chunk-YDAQK5UF.js → chunk-EF6OERRR.js} +1 -1
  81. package/dist/cli/chunks/{chunk-KG336OV3.js → chunk-EN7GRVEQ.js} +2 -2
  82. package/dist/cli/chunks/{chunk-DBMNJSBV.js → chunk-ENGL7FIJ.js} +1 -1
  83. package/dist/cli/chunks/{chunk-FKL3R5JQ.js → chunk-FAGKBOX2.js} +2 -2
  84. package/dist/cli/chunks/{chunk-NAXGWDVM.js → chunk-FNUFTWEO.js} +3 -3
  85. package/dist/cli/chunks/{chunk-RWWOHCMG.js → chunk-FZJCBSN4.js} +2 -2
  86. package/dist/cli/chunks/{chunk-ABFFWZPC.js → chunk-G24SWTAX.js} +151 -149
  87. package/dist/cli/chunks/{chunk-ODJNUMV3.js → chunk-G3AABG4Q.js} +2 -2
  88. package/dist/cli/chunks/{chunk-FBXTQNRH.js → chunk-GJKZ7UQO.js} +2 -2
  89. package/dist/cli/chunks/{chunk-DEF34AFL.js → chunk-GKFV6CUD.js} +2 -2
  90. package/dist/cli/chunks/{chunk-SY2IB442.js → chunk-HLGFHHWV.js} +2 -2
  91. package/dist/cli/chunks/{chunk-CZGOSJQ4.js → chunk-HM3LSFTY.js} +2 -2
  92. package/dist/cli/chunks/chunk-HSA5IGGW.js +2 -0
  93. package/dist/cli/chunks/{chunk-GJHWY3ZX.js → chunk-HZBXJFGN.js} +2 -2
  94. package/dist/cli/chunks/chunk-IA55PFLG.js +7 -0
  95. package/dist/cli/chunks/{chunk-MNN5J4GU.js → chunk-ICKUINKD.js} +2 -2
  96. package/dist/cli/chunks/{chunk-XEB3NLJR.js → chunk-IETBWYHW.js} +2 -2
  97. package/dist/cli/chunks/{chunk-A55QKKT2.js → chunk-IL7GQNNE.js} +2 -2
  98. package/dist/cli/chunks/{chunk-LRZY4KS2.js → chunk-INZARYUD.js} +2 -2
  99. package/dist/cli/chunks/{chunk-OBAREPDC.js → chunk-IPA7K556.js} +2 -2
  100. package/dist/cli/chunks/{chunk-CFBEBXLO.js → chunk-IVTQF55W.js} +3 -3
  101. package/dist/cli/chunks/{chunk-FFTPAWM6.js → chunk-J7Y7ZBIT.js} +8 -8
  102. package/dist/cli/chunks/{chunk-I33O4BRQ.js → chunk-JGIJPDGD.js} +2 -2
  103. package/dist/cli/chunks/chunk-JNXK47OL.js +2 -0
  104. package/dist/cli/chunks/{chunk-PCEW6Q2C.js → chunk-JOWUS2X5.js} +1 -1
  105. package/dist/cli/chunks/{chunk-KI73QCR5.js → chunk-JR6CUKAI.js} +2 -2
  106. package/dist/cli/chunks/chunk-JRYWLOBD.js +21 -0
  107. package/dist/cli/chunks/{chunk-SO45NA4D.js → chunk-JW5PDJ5O.js} +11 -11
  108. package/dist/cli/chunks/{chunk-APSRPR4W.js → chunk-K3A3NWT3.js} +2 -2
  109. package/dist/cli/chunks/{chunk-FESZBPUB.js → chunk-KA5SHLMW.js} +2 -2
  110. package/dist/cli/chunks/{chunk-OPFGRS5S.js → chunk-KGA7VAI4.js} +2 -2
  111. package/dist/cli/chunks/chunk-KJDI5CHX.js +2 -0
  112. package/dist/cli/chunks/{chunk-V2RSNVMW.js → chunk-L3PV7VXK.js} +1 -1
  113. package/dist/cli/chunks/{chunk-C522H7XR.js → chunk-L7NGKANW.js} +32 -32
  114. package/dist/cli/chunks/{chunk-DNRWGATA.js → chunk-LFBA735S.js} +7 -7
  115. package/dist/cli/chunks/{chunk-V2M2XCR5.js → chunk-MAJXZYGK.js} +1 -1
  116. package/dist/cli/chunks/{chunk-FZOWULMH.js → chunk-MCPEC6OO.js} +1 -1
  117. package/dist/cli/chunks/{chunk-LMS3Y7JD.js → chunk-MCPXNUDK.js} +2 -2
  118. package/dist/cli/chunks/{chunk-GWZZ7DAO.js → chunk-MMEALJ4D.js} +2 -2
  119. package/dist/cli/chunks/{chunk-G3CZCUPM.js → chunk-MYF5CNGV.js} +2 -2
  120. package/dist/cli/chunks/{chunk-NNFZUTDH.js → chunk-MYUMJ2ZI.js} +1 -1
  121. package/dist/cli/chunks/{chunk-WDQ7IEZY.js → chunk-N7O3PF6Y.js} +2 -2
  122. package/dist/cli/chunks/{chunk-YAKGBHO4.js → chunk-NA3F6FEO.js} +2 -2
  123. package/dist/cli/chunks/chunk-NNBQZR73.js +6 -0
  124. package/dist/cli/chunks/{chunk-6C3II5OM.js → chunk-NV74SICL.js} +2 -2
  125. package/dist/cli/chunks/chunk-NVRYELCY.js +13 -0
  126. package/dist/cli/chunks/{chunk-UHTTW3IT.js → chunk-NX4BCSOZ.js} +2 -2
  127. package/dist/cli/chunks/{chunk-EN2QSKFF.js → chunk-O3IM4WRZ.js} +2 -2
  128. package/dist/cli/chunks/{chunk-S75EYIJG.js → chunk-O4QJMANM.js} +1 -1
  129. package/dist/cli/chunks/{chunk-NPPHWFA2.js → chunk-OHVYINGM.js} +18 -18
  130. package/dist/cli/chunks/{chunk-DE4YJQJF.js → chunk-P5E26N2X.js} +2 -2
  131. package/dist/cli/chunks/chunk-P7UFJ6DO.js +14 -0
  132. package/dist/cli/chunks/{chunk-XFVTGAAJ.js → chunk-PGSJBXTD.js} +2 -2
  133. package/dist/cli/chunks/{chunk-CZ2IF6MC.js → chunk-PT2NXS43.js} +1 -1
  134. package/dist/cli/chunks/{chunk-RK73HB2F.js → chunk-PTBOLBM4.js} +2 -2
  135. package/dist/cli/chunks/{chunk-EAU5KDFO.js → chunk-PX5OPXY6.js} +1 -1
  136. package/dist/cli/chunks/chunk-QCPVUNN3.js +2 -0
  137. package/dist/cli/chunks/{chunk-VKRTTFB6.js → chunk-QSGEBCDB.js} +2 -2
  138. package/dist/cli/chunks/{chunk-SKQUUE4F.js → chunk-QUJJYTJH.js} +2 -2
  139. package/dist/cli/chunks/chunk-QWG3SILX.js +59 -0
  140. package/dist/cli/chunks/{chunk-D6DA2KFD.js → chunk-RCOLPF3B.js} +2 -2
  141. package/dist/cli/chunks/{chunk-SU5H66SD.js → chunk-RYHG3I7J.js} +2 -2
  142. package/dist/cli/chunks/chunk-SBHM5X2S.js +4 -0
  143. package/dist/cli/chunks/{chunk-62OAY5KJ.js → chunk-SDRJJUPO.js} +1 -1
  144. package/dist/cli/chunks/{chunk-FB6TI3BH.js → chunk-SG2TX72G.js} +2 -2
  145. package/dist/cli/chunks/{chunk-H2PYU7MN.js → chunk-SITL5YZV.js} +4 -4
  146. package/dist/cli/chunks/{chunk-AI4VYSFS.js → chunk-SPC4RBLF.js} +2 -2
  147. package/dist/cli/chunks/{chunk-BQUAE3CP.js → chunk-SQVZ3TRU.js} +2 -2
  148. package/dist/cli/chunks/{chunk-TBLI254A.js → chunk-SUX5XB2Z.js} +2 -2
  149. package/dist/cli/chunks/{chunk-VFSYMOAL.js → chunk-T4EN5VVK.js} +2 -2
  150. package/dist/cli/chunks/{chunk-KNQ2ERFX.js → chunk-TGMXUZZC.js} +2 -2
  151. package/dist/cli/chunks/{chunk-7TB6FK4B.js → chunk-TLRHAMX5.js} +1 -1
  152. package/dist/cli/chunks/{chunk-V6JBOIMX.js → chunk-TOWOJGEI.js} +1 -1
  153. package/dist/cli/chunks/{chunk-JHIY4VCC.js → chunk-TSOQ2QLT.js} +3 -3
  154. package/dist/cli/chunks/{chunk-YYTGXD3R.js → chunk-TVA5GRIU.js} +2 -2
  155. package/dist/cli/chunks/{chunk-6MVVSSID.js → chunk-TXEUVUMO.js} +1 -1
  156. package/dist/cli/chunks/{chunk-7ZCDZHDB.js → chunk-U6IXYQO4.js} +2 -2
  157. package/dist/cli/chunks/{chunk-NW5JUCCG.js → chunk-U7ZHDGXG.js} +1 -1
  158. package/dist/cli/chunks/{chunk-UARKIZAS.js → chunk-UCSK2RMI.js} +2 -2
  159. package/dist/cli/chunks/{chunk-RPHY2DU6.js → chunk-UIKQPO4Y.js} +2 -2
  160. package/dist/cli/chunks/chunk-UJNGGFGX.js +2 -0
  161. package/dist/cli/chunks/{chunk-EDLFX4ZB.js → chunk-ULCW6IVQ.js} +2 -2
  162. package/dist/cli/chunks/{chunk-M2QV7PT7.js → chunk-UREDS662.js} +2 -2
  163. package/dist/cli/chunks/{chunk-MG27QY4D.js → chunk-URSTP3WI.js} +2 -2
  164. package/dist/cli/chunks/{chunk-2ZI5FKSF.js → chunk-UUZZXHUF.js} +2 -2
  165. package/dist/cli/chunks/{chunk-IPJ7Q3AJ.js → chunk-UZED4YZ5.js} +1 -1
  166. package/dist/cli/chunks/{chunk-VFKF2XO7.js → chunk-VF7FTD64.js} +1 -1
  167. package/dist/cli/chunks/{chunk-YCGP5VFP.js → chunk-VUR5THML.js} +2 -2
  168. package/dist/cli/chunks/{chunk-WDVRE6GN.js → chunk-VXVTFKRA.js} +2 -2
  169. package/dist/cli/chunks/chunk-VZBC6DP7.js +2 -0
  170. package/dist/cli/chunks/{chunk-GHBNRMSJ.js → chunk-W4II6SIH.js} +2 -2
  171. package/dist/cli/chunks/{chunk-TNMBRDCA.js → chunk-W5HQIYQU.js} +3 -3
  172. package/dist/cli/chunks/{chunk-H74Q7TJN.js → chunk-W7H55PY4.js} +1 -1
  173. package/dist/cli/chunks/{chunk-OY2AHLSF.js → chunk-WDEXOLK2.js} +1 -1
  174. package/dist/cli/chunks/{chunk-VJQYDYAJ.js → chunk-WGTEZT7G.js} +2 -2
  175. package/dist/cli/chunks/{chunk-GRCIBCJ2.js → chunk-WLRU6ESI.js} +2 -2
  176. package/dist/cli/chunks/{chunk-ACWFKES2.js → chunk-WTAUF6O4.js} +2 -2
  177. package/dist/cli/chunks/chunk-XCNSGSKV.js +3 -0
  178. package/dist/cli/chunks/{chunk-6S3WJGUV.js → chunk-XZOYKB22.js} +2 -2
  179. package/dist/cli/chunks/chunk-YIDAXOUX.js +8 -0
  180. package/dist/cli/chunks/{chunk-LQEURY7C.js → chunk-YLKIXEPP.js} +1 -1
  181. package/dist/cli/chunks/chunk-YNVEDFPQ.js +2 -0
  182. package/dist/cli/chunks/{chunk-PGYMKGOE.js → chunk-YUA6ZKKY.js} +2 -2
  183. package/dist/cli/chunks/{chunk-GJMLK5UT.js → chunk-YVJEUX3I.js} +2 -2
  184. package/dist/cli/chunks/{chunk-AH3ZD3NJ.js → chunk-YWWMNTBF.js} +2 -2
  185. package/dist/cli/chunks/{chunk-37OWRCUN.js → chunk-ZGROHCOW.js} +2 -2
  186. package/dist/cli/chunks/{chunk-OEKP73MC.js → chunk-ZPVGX4DI.js} +2 -2
  187. package/dist/cli/chunks/{chunk-6GP6W46M.js → chunk-ZROAMFX2.js} +2 -2
  188. package/dist/cli/chunks/{chunk-OY3NJNP2.js → chunk-ZYOYR3UR.js} +1 -1
  189. package/dist/cli/chunks/ci-BZNWW3I3.js +81 -0
  190. package/dist/cli/chunks/{ci-config-7ODMNAUM.js → ci-config-LOHNXOKV.js} +2 -2
  191. package/dist/cli/chunks/{ci-output-FXZ7ZZW3.js → ci-output-LCOQBSJL.js} +2 -2
  192. package/dist/cli/chunks/{circuit-breaker-4VOUEPOX.js → circuit-breaker-7LRXTLFE.js} +2 -2
  193. package/dist/cli/chunks/{claude-flow-setup-7D4SGLM4.js → claude-flow-setup-HBU4VWC3.js} +2 -2
  194. package/dist/cli/chunks/client-4PNYDFYS.js +2 -0
  195. package/dist/cli/chunks/{cline-installer-WRRT7BGQ.js → cline-installer-CO6MLH6X.js} +2 -2
  196. package/dist/cli/chunks/{code-ZDJRIL3S.js → code-SIXBS6JM.js} +3 -3
  197. package/dist/cli/chunks/{code-index-extractor-4S4SHM56.js → code-index-extractor-GWJKZ2IQ.js} +2 -2
  198. package/dist/cli/chunks/{codex-installer-YTRHNDWR.js → codex-installer-6NINVWXJ.js} +2 -2
  199. package/dist/cli/chunks/{completions-6N64JUXJ.js → completions-7VIX3GML.js} +2 -2
  200. package/dist/cli/chunks/{complexity-analyzer-I4A26VCJ.js → complexity-analyzer-FBQR6ZP2.js} +2 -2
  201. package/dist/cli/chunks/{continuedev-installer-IIDR66LB.js → continuedev-installer-VA7RIXW5.js} +2 -2
  202. package/dist/cli/chunks/{copilot-installer-SVVFY3S2.js → copilot-installer-4QEBC4MU.js} +2 -2
  203. package/dist/cli/chunks/core-handlers-ODO6LUWQ.js +2 -0
  204. package/dist/cli/chunks/{cost-tracker-VGFS6IBX.js → cost-tracker-GRYKHPWL.js} +2 -2
  205. package/dist/cli/chunks/coverage-USPMNKOU.js +50 -0
  206. package/dist/cli/chunks/cross-domain-router-DT4MHJKK.js +2 -0
  207. package/dist/cli/chunks/{cursor-installer-UPETT57E.js → cursor-installer-ZXIPSZVH.js} +2 -2
  208. package/dist/cli/chunks/{daemon-CQFNZLXU.js → daemon-D7F3RGI5.js} +3 -3
  209. package/dist/cli/chunks/{daemon-7BDJHEIJ.js → daemon-N2VRHPSJ.js} +4 -4
  210. package/dist/cli/chunks/{dag-attention-scheduler-PJVABHON.js → dag-attention-scheduler-NL6BA7BY.js} +2 -2
  211. package/dist/cli/chunks/{detect-56SKAGWX.js → detect-XC2HCIIT.js} +2 -2
  212. package/dist/cli/chunks/{dist-node-UYTYUMLN.js → dist-node-A3Y26MEI.js} +2 -2
  213. package/dist/cli/chunks/{domain-handler-YOYLBYJE.js → domain-handler-WV6SFXRB.js} +2 -2
  214. package/dist/cli/chunks/{domain-plugins-7TARX2XF.js → domain-plugins-KJIF6Z2B.js} +2 -2
  215. package/dist/cli/chunks/{domain-transfer-AKVSBD6E.js → domain-transfer-L3F6AES2.js} +2 -2
  216. package/dist/cli/chunks/dream-QOB3JCOM.js +2 -0
  217. package/dist/cli/chunks/{embed-and-insert-pattern-IS6HSR66.js → embed-and-insert-pattern-PA3Y4KGO.js} +2 -2
  218. package/dist/cli/chunks/{eval-GNB574IM.js → eval-YGEZNUVE.js} +2 -2
  219. package/dist/cli/chunks/{experience-capture-middleware-RCAOCKM7.js → experience-capture-middleware-D4T7NW6B.js} +3 -3
  220. package/dist/cli/chunks/{fast-paths-KTZ5SF54.js → fast-paths-6JYK7RYQ.js} +2 -2
  221. package/dist/cli/chunks/{feature-flags-KFHSR5YF.js → feature-flags-DKXMDVPE.js} +2 -2
  222. package/dist/cli/chunks/{feature-flags-ITX5LQ57.js → feature-flags-RBH2GDSR.js} +2 -2
  223. package/dist/cli/chunks/file-discovery-BN76S2PR.js +2 -0
  224. package/dist/cli/chunks/fleet-43YMXACN.js +46 -0
  225. package/dist/cli/chunks/{gnn-wrapper-RLFW3GSX.js → gnn-wrapper-MV54UC4C.js} +2 -2
  226. package/dist/cli/chunks/{heartbeat-handler-EM2URCYZ.js → heartbeat-handler-7DKMVQQH.js} +4 -4
  227. package/dist/cli/chunks/heartbeat-scheduler-3NNP4WCP.js +2 -0
  228. package/dist/cli/chunks/hnsw-adapter-MZR7Y4WF.js +2 -0
  229. package/dist/cli/chunks/hnsw-index-HE4AX22U.js +2 -0
  230. package/dist/cli/chunks/{hnsw-legacy-bridge-JMHEOIBH.js → hnsw-legacy-bridge-6IWREDQC.js} +2 -2
  231. package/dist/cli/chunks/{hnswlib-node-CBP73QHY.js → hnswlib-node-5BIESSCK.js} +2 -2
  232. package/dist/cli/chunks/{hooks-IP7XE34Z.js → hooks-3EETRM62.js} +30 -30
  233. package/dist/cli/chunks/hybrid-backend-IHUHB3Y2.js +2 -0
  234. package/dist/cli/chunks/{hypergraph-engine-ONAYHU25.js → hypergraph-engine-RSWCB2D3.js} +2 -2
  235. package/dist/cli/chunks/{hypergraph-handler-VINJRAID.js → hypergraph-handler-552LXKL3.js} +3 -3
  236. package/dist/cli/chunks/impact-analyzer-FI6GI6PD.js +2 -0
  237. package/dist/cli/chunks/{init-guard-RYVV5R3Z.js → init-guard-OTDBJ5HD.js} +2 -2
  238. package/dist/cli/chunks/{init-handler-MPRGWMOE.js → init-handler-3FK3TKEA.js} +26 -25
  239. package/dist/cli/chunks/init-wizard-WLQKH5Y5.js +2 -0
  240. package/dist/cli/chunks/kernel-2WZOQEZS.js +2 -0
  241. package/dist/cli/chunks/{kilocode-installer-OPD7JBRL.js → kilocode-installer-KZ2O4LF3.js} +2 -2
  242. package/dist/cli/chunks/{kiro-installer-M4OPUNK2.js → kiro-installer-MLCCXRF7.js} +2 -2
  243. package/dist/cli/chunks/knowledge-graph-G3LVKK6P.js +2 -0
  244. package/dist/cli/chunks/{learning-4UWTQLMF.js → learning-QUCMBD77.js} +3 -3
  245. package/dist/cli/chunks/{llm-router-SQ56FF6Z.js → llm-router-PDEV3UP2.js} +4 -4
  246. package/dist/cli/chunks/llm-router-service-MM75HKWJ.js +2 -0
  247. package/dist/cli/chunks/{load-HPHKDGGL.js → load-XFVVLO7E.js} +2 -2
  248. package/dist/cli/chunks/load-test-BEWEE44J.js +2 -0
  249. package/dist/cli/chunks/{mcp-TELMAC7Z.js → mcp-74G3CL2S.js} +2 -2
  250. package/dist/cli/chunks/{memory-PFQ3KPVJ.js → memory-XIFM6JNX.js} +5 -5
  251. package/dist/cli/chunks/memory-backend-NYKBBKZR.js +2 -0
  252. package/dist/cli/chunks/memory-handlers-ZCKURV6S.js +2 -0
  253. package/dist/cli/chunks/{multi-model-executor-3VDRX6TZ.js → multi-model-executor-7L4W3O2Q.js} +2 -2
  254. package/dist/cli/chunks/{opencode-installer-PJ576R63.js → opencode-installer-BPG422LF.js} +2 -2
  255. package/dist/cli/chunks/{orchestrator-72QP4UU7.js → orchestrator-OEAFLAEV.js} +61 -23
  256. package/dist/cli/chunks/pattern-null-store-QGPUIV6M.js +2 -0
  257. package/dist/cli/chunks/{pattern-usage-recorder-754YQW7C.js → pattern-usage-recorder-LOPNCULT.js} +2 -2
  258. package/dist/cli/chunks/{pipeline-AVXY4MVB.js → pipeline-VWTYUZB7.js} +2 -2
  259. package/dist/cli/chunks/{platform-3E3DXLYB.js → platform-WFJJ3X2E.js} +2 -2
  260. package/dist/cli/chunks/{plugin-7FUQAKRE.js → plugin-744TPUSG.js} +2 -2
  261. package/dist/cli/chunks/{prime-radiant-advanced-wasm-NIB4F5NV.js → prime-radiant-advanced-wasm-BD5BLNDR.js} +2 -2
  262. package/dist/cli/chunks/project-root-C7ELXZRK.js +2 -0
  263. package/dist/cli/chunks/protocol-executor-SUVE33BM.js +2 -0
  264. package/dist/cli/chunks/{protocol-handler-BQRYMUTG.js → protocol-handler-JIBILI74.js} +2 -2
  265. package/dist/cli/chunks/{prove-H52QGC6B.js → prove-MNOL5FYW.js} +2 -2
  266. package/dist/cli/chunks/qe-reasoning-bank-YWZMMGJB.js +2 -0
  267. package/dist/cli/chunks/{quality-QO4XPAUM.js → quality-JEGBDGGX.js} +2 -2
  268. package/dist/cli/chunks/{quality-gate-FBKE5E6F.js → quality-gate-SYJ6ROMI.js} +3 -3
  269. package/dist/cli/chunks/queen-coordinator-ZFAKXRN7.js +2 -0
  270. package/dist/cli/chunks/real-embeddings-ZWXS5ZFV.js +2 -0
  271. package/dist/cli/chunks/{ref-validation-LF76ZOBD.js → ref-validation-RRHUFW2N.js} +2 -2
  272. package/dist/cli/chunks/{roocode-installer-3BYEBTQ7.js → roocode-installer-XFO6JSVN.js} +2 -2
  273. package/dist/cli/chunks/router-4FTAVYLJ.js +2 -0
  274. package/dist/cli/chunks/routing-feedback-IO2KOWMJ.js +2 -0
  275. package/dist/cli/chunks/{routing-handler-DST7BVCU.js → routing-handler-L2K3JASE.js} +2 -2
  276. package/dist/cli/chunks/{ruvector-commands-XE32PGKC.js → ruvector-commands-A6CINHGM.js} +2 -2
  277. package/dist/cli/chunks/rvf-dual-writer-KCIRNE7C.js +2 -0
  278. package/dist/cli/chunks/rvf-migration-adapter-MFC5WTJU.js +2 -0
  279. package/dist/cli/chunks/{rvf-migration-coordinator-VP32XC75.js → rvf-migration-coordinator-T4RY7L53.js} +2 -2
  280. package/dist/cli/chunks/rvf-native-adapter-I3KWHE7X.js +2 -0
  281. package/dist/cli/chunks/{rvf-store-integrity-SH2AMVI7.js → rvf-store-integrity-IR33TGQS.js} +2 -2
  282. package/dist/cli/chunks/safe-db-QXDZ6QY3.js +2 -0
  283. package/dist/cli/chunks/schedule-CZKD6RIY.js +2 -0
  284. package/dist/cli/chunks/scheduler-BLA3Q4CH.js +2 -0
  285. package/dist/cli/chunks/{security-VSPNKCDS.js → security-Z5GDE2IH.js} +3 -3
  286. package/dist/cli/chunks/{shared-rvf-adapter-HX6AHL3P.js → shared-rvf-adapter-SIZMEHPM.js} +2 -2
  287. package/dist/cli/chunks/{shared-rvf-dual-writer-MX4FC2JE.js → shared-rvf-dual-writer-HLM65RDS.js} +2 -2
  288. package/dist/cli/chunks/sqlite-persistence-XIUYDJC4.js +2 -0
  289. package/dist/cli/chunks/{standalone-memory-O4QUTK6L.js → standalone-memory-SKSZG7P5.js} +2 -2
  290. package/dist/cli/chunks/{status-handler-Z2BP6EOG.js → status-handler-766YOOMJ.js} +2 -2
  291. package/dist/cli/chunks/{structural-health-R36WNLQG.js → structural-health-M45FNOLT.js} +2 -2
  292. package/dist/cli/chunks/{sync-QF5Y3EMZ.js → sync-6CJ24B5T.js} +2 -2
  293. package/dist/cli/chunks/{sync-2ELWUFQU.js → sync-B2U366I3.js} +2 -2
  294. package/dist/cli/chunks/{task-handler-43PYE75J.js → task-handler-P6IFLCKP.js} +17 -15
  295. package/dist/cli/chunks/task-handlers-DPWMUKFC.js +9 -0
  296. package/dist/cli/chunks/{test-UWA377D4.js → test-TODH7KRF.js} +11 -11
  297. package/dist/cli/chunks/test-runner-process-46IPK3GH.js +2 -0
  298. package/dist/cli/chunks/{test-scheduling-YQZPJRRN.js → test-scheduling-VMVMVRHT.js} +3 -3
  299. package/dist/cli/chunks/{token-bootstrap-F7C6UKTC.js → token-bootstrap-XQW7BMCK.js} +2 -2
  300. package/dist/cli/chunks/{token-usage-DO6WLMXP.js → token-usage-JCZEIRKO.js} +2 -2
  301. package/dist/cli/chunks/{transformers-H5RGFKVO.js → transformers-U2ML3OHE.js} +2 -2
  302. package/dist/cli/chunks/tree-sitter-wasm-parser-MOI2WWNJ.js +2 -0
  303. package/dist/cli/chunks/{types-PJS2FGPF.js → types-GGEPCHP6.js} +2 -2
  304. package/dist/cli/chunks/unified-memory-FL26RTV3.js +2 -0
  305. package/dist/cli/chunks/unified-memory-hnsw-E2BPTH3U.js +2 -0
  306. package/dist/cli/chunks/unified-persistence-5ZOUPKHF.js +2 -0
  307. package/dist/cli/chunks/{upgrade-4IC4F6AB.js → upgrade-T5GRM7HS.js} +2 -2
  308. package/dist/cli/chunks/{validate-DHUWW7PF.js → validate-XMUJPLP3.js} +2 -2
  309. package/dist/cli/chunks/{validate-swarm-OERQNOX5.js → validate-swarm-KJLF7JEH.js} +2 -2
  310. package/dist/cli/chunks/visual-security-IJVPO5FA.js +2 -0
  311. package/dist/cli/chunks/{web-tree-sitter-TV7DMKES.js → web-tree-sitter-LOHVZ7G5.js} +2 -2
  312. package/dist/cli/chunks/{windsurf-installer-QZPWSH37.js → windsurf-installer-33FBTXJU.js} +2 -2
  313. package/dist/cli/chunks/witness-chain-5FAFCQKP.js +2 -0
  314. package/dist/cli/chunks/witness-chain-V2M32W5D.js +2 -0
  315. package/dist/cli/chunks/{witness-chain-repair-RUXIOE7F.js → witness-chain-repair-VWBO4NXE.js} +2 -2
  316. package/dist/cli/chunks/{witness-chain-verifier-YXENHB42.js → witness-chain-verifier-BHJ3ZAEK.js} +2 -2
  317. package/dist/cli/chunks/{witness-key-manager-HL26AGFO.js → witness-key-manager-WNVPH2Z3.js} +2 -2
  318. package/dist/cli/chunks/{workflow-EOVVCN2E.js → workflow-6QR5MQTO.js} +4 -4
  319. package/dist/cli/chunks/workflow-orchestrator-3JLF3IX7.js +2 -0
  320. package/dist/cli/chunks/{wrappers-AGODHBOO.js → wrappers-EHOL62TS.js} +2 -2
  321. package/dist/cli/commands/ci.js +7 -0
  322. package/dist/cli/commands/coverage.js +7 -1
  323. package/dist/cli/commands/fleet.js +5 -2
  324. package/dist/cli/commands/hooks-handlers/stats-hooks.d.ts +4 -3
  325. package/dist/cli/commands/hooks-handlers/stats-hooks.js +22 -4
  326. package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.js +11 -6
  327. package/dist/cli/commands/test.js +5 -2
  328. package/dist/cli/handlers/init-handler.d.ts +12 -0
  329. package/dist/cli/handlers/init-handler.js +27 -12
  330. package/dist/cli/handlers/task-handler.js +6 -0
  331. package/dist/cli/utils/ci-output.d.ts +2 -0
  332. package/dist/cli/utils/ci-output.js +2 -0
  333. package/dist/cli/utils/coverage-verdict.d.ts +11 -2
  334. package/dist/cli/utils/coverage-verdict.js +26 -6
  335. package/dist/cli/utils/fleet-operation.d.ts +5 -0
  336. package/dist/cli/utils/fleet-operation.js +7 -1
  337. package/dist/cli/utils/fleet-result.d.ts +5 -3
  338. package/dist/cli/utils/fleet-result.js +9 -3
  339. package/dist/cli/utils/progress.d.ts +16 -2
  340. package/dist/cli/utils/progress.js +31 -14
  341. package/dist/coordination/consensus/consensus-engine.js +3 -1
  342. package/dist/coordination/handlers/code-intelligence-handlers.js +3 -2
  343. package/dist/coordination/handlers/coverage-collection.d.ts +2 -0
  344. package/dist/coordination/handlers/coverage-collection.js +5 -2
  345. package/dist/coordination/handlers/coverage-evidence.d.ts +75 -0
  346. package/dist/coordination/handlers/coverage-evidence.js +159 -0
  347. package/dist/coordination/handlers/coverage-handlers.js +16 -3
  348. package/dist/coordination/handlers/coverage-runner.d.ts +3 -8
  349. package/dist/coordination/handlers/coverage-runner.js +6 -22
  350. package/dist/coordination/handlers/coverage-scope.d.ts +40 -0
  351. package/dist/coordination/handlers/coverage-scope.js +321 -0
  352. package/dist/coordination/handlers/coverage-stderr.d.ts +23 -0
  353. package/dist/coordination/handlers/coverage-stderr.js +39 -0
  354. package/dist/coordination/handlers/coverage-target.d.ts +9 -0
  355. package/dist/coordination/handlers/coverage-target.js +21 -8
  356. package/dist/coordination/handlers/handler-utils.d.ts +5 -0
  357. package/dist/coordination/handlers/handler-utils.js +11 -5
  358. package/dist/coordination/handlers/requirements-handlers.js +3 -2
  359. package/dist/coordination/handlers/security-handlers.js +34 -20
  360. package/dist/coordination/queen-coordinator.js +8 -3
  361. package/dist/coordination/task-executability.d.ts +12 -0
  362. package/dist/coordination/task-executability.js +27 -0
  363. package/dist/coordination/workflow-orchestrator.d.ts +6 -0
  364. package/dist/coordination/workflow-orchestrator.js +22 -8
  365. package/dist/domains/code-intelligence/services/metric-collector/listing-process-owner.js +4 -1
  366. package/dist/domains/code-intelligence/services/product-factors-bridge.js +7 -4
  367. package/dist/domains/code-intelligence/services/semantic-analyzer.d.ts +8 -0
  368. package/dist/domains/code-intelligence/services/semantic-analyzer.js +10 -7
  369. package/dist/domains/coverage-analysis/services/coverage-parser.js +19 -10
  370. package/dist/domains/learning-optimization/interfaces.d.ts +2 -0
  371. package/dist/domains/learning-optimization/services/learning-coordinator.js +2 -1
  372. package/dist/domains/learning-optimization/services/metrics-optimizer.js +14 -4
  373. package/dist/domains/learning-optimization/services/production-intel.js +3 -1
  374. package/dist/domains/security-compliance/generic-finding-dedup.d.ts +40 -0
  375. package/dist/domains/security-compliance/generic-finding-dedup.js +63 -0
  376. package/dist/domains/security-compliance/services/scanners/dependency-resolver.js +14 -6
  377. package/dist/domains/security-compliance/services/scanners/sast-scanner.js +4 -2
  378. package/dist/domains/security-compliance/services/security-auditor-sast.js +2 -2
  379. package/dist/domains/security-compliance/services/security-auditor-secrets.js +2 -2
  380. package/dist/domains/security-compliance/services/security-auditor.js +3 -2
  381. package/dist/domains/test-execution/coordinator.d.ts +2 -1
  382. package/dist/domains/test-execution/coordinator.js +5 -14
  383. package/dist/domains/test-execution/interfaces.d.ts +11 -1
  384. package/dist/domains/test-execution/services/retry-outcome.d.ts +18 -0
  385. package/dist/domains/test-execution/services/retry-outcome.js +53 -0
  386. package/dist/domains/test-generation/coordinator.js +2 -2
  387. package/dist/domains/test-generation/services/pattern-matcher.js +4 -4
  388. package/dist/domains/test-generation/services/test-generator.js +2 -2
  389. package/dist/governance/evolution-pipeline-integration.js +3 -1
  390. package/dist/hooks/cross-phase-hooks.js +3 -1
  391. package/dist/init/init-wizard-steps.js +5 -1
  392. package/dist/init/phases/04-database.js +7 -0
  393. package/dist/init/phases/10-workers.js +42 -4
  394. package/dist/init/phases/12-verification.js +14 -4
  395. package/dist/init/settings-merge.js +7 -4
  396. package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.d.ts +29 -0
  397. package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +70 -6
  398. package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +10 -3
  399. package/dist/integrations/agentic-flow/reasoning-bank/index.js +13 -0
  400. package/dist/integrations/ruvector/filter-adapter.js +2 -1
  401. package/dist/learning/dream/insight-generator.js +5 -4
  402. package/dist/learning/embedder-endpoint-client.d.ts +8 -0
  403. package/dist/learning/embedder-endpoint-client.js +20 -0
  404. package/dist/learning/embedder-recovery.d.ts +63 -0
  405. package/dist/learning/embedder-recovery.js +94 -0
  406. package/dist/learning/memory-auditor.js +3 -1
  407. package/dist/learning/qe-patterns.js +2 -1
  408. package/dist/learning/qe-reasoning-bank-types.d.ts +5 -0
  409. package/dist/learning/qe-reasoning-bank.d.ts +21 -0
  410. package/dist/learning/qe-reasoning-bank.js +54 -8
  411. package/dist/learning/real-embeddings.d.ts +23 -0
  412. package/dist/learning/real-embeddings.js +69 -2
  413. package/dist/learning/real-qe-reasoning-bank.d.ts +39 -0
  414. package/dist/learning/real-qe-reasoning-bank.js +108 -38
  415. package/dist/logging/redaction.js +142 -12
  416. package/dist/mcp/bundle.js +520 -503
  417. package/dist/mcp/daemon-mode.d.ts +126 -0
  418. package/dist/mcp/daemon-mode.js +257 -0
  419. package/dist/mcp/entry.d.ts +4 -0
  420. package/dist/mcp/entry.js +50 -2
  421. package/dist/mcp/handlers/domain-handler-configs.d.ts +2 -0
  422. package/dist/mcp/handlers/domain-handler-configs.js +13 -2
  423. package/dist/mcp/handlers/orchestrate-routes.d.ts +6 -1
  424. package/dist/mcp/handlers/orchestrate-routes.js +53 -0
  425. package/dist/mcp/handlers/task-handlers.d.ts +23 -1
  426. package/dist/mcp/handlers/task-handlers.js +90 -19
  427. package/dist/mcp/handlers/validation-pipeline-handler.js +9 -9
  428. package/dist/mcp/protocol-server.js +11 -8
  429. package/dist/mcp/qe-tool-bridge.js +3 -0
  430. package/dist/mcp/services/reasoning-bank-service.d.ts +9 -2
  431. package/dist/mcp/services/reasoning-bank-service.js +13 -0
  432. package/dist/mcp/tool-annotations.js +4 -1
  433. package/dist/mcp/tools/coherence/check.js +1 -0
  434. package/dist/mcp/tools/coherence/consensus.js +4 -2
  435. package/dist/mcp/tools/learning-optimization/optimize.js +1 -2
  436. package/dist/mcp/tools/mincut/index.js +3 -0
  437. package/dist/mcp/tools/quality-assessment/gate.js +7 -0
  438. package/dist/mcp/tools/qx-analysis/analyze.js +1 -0
  439. package/dist/mcp/tools/requirements-validation/quality-criteria.js +10 -3
  440. package/dist/mcp/tools/security-compliance/scan.js +4 -2
  441. package/dist/mcp/tools/test-execution/e2e-execute.js +2 -2
  442. package/dist/mcp/tools/test-execution/execute.js +3 -2
  443. package/dist/mcp/types.d.ts +14 -0
  444. package/dist/memory/crdt/crdt-store.js +5 -0
  445. package/dist/memory/crdt/lww-register.js +12 -2
  446. package/dist/optimization/early-exit-token-optimizer.js +3 -1
  447. package/dist/planning/goap-planner.js +5 -0
  448. package/dist/planning/plan-executor.js +5 -0
  449. package/dist/routing/advisor/redaction.js +22 -2
  450. package/dist/shared/io/confined-read.d.ts +74 -0
  451. package/dist/shared/io/confined-read.js +256 -0
  452. package/dist/shared/io/file-reader.d.ts +6 -6
  453. package/dist/shared/io/file-reader.js +16 -42
  454. package/dist/shared/llm/providers/claude-code.js +4 -1
  455. package/dist/shared/llm/providers/response-deadline.js +16 -2
  456. package/dist/shared/native-module-errors.d.ts +51 -0
  457. package/dist/shared/native-module-errors.js +129 -0
  458. package/dist/shared/safe-db.js +14 -4
  459. package/dist/shared/security/osv-client.js +4 -1
  460. package/dist/shared/types/index.js +3 -1
  461. package/dist/shared/types/test-frameworks.js +2 -2
  462. package/dist/strange-loop/infra-healing/infra-aware-agent-provider.js +8 -1
  463. package/dist/sync/readers/json-reader.js +2 -1
  464. package/dist/validation/anchor-set.d.ts +6 -0
  465. package/dist/validation/anchor-set.js +9 -1
  466. package/dist/validation/quality-gate-runner.d.ts +7 -1
  467. package/dist/validation/quality-gate-runner.js +3 -3
  468. package/package.json +3 -3
  469. package/dist/cli/chunks/adapter-TR5SLAZC.js +0 -2
  470. package/dist/cli/chunks/aqe-learning-engine-DXWKCHY2.js +0 -2
  471. package/dist/cli/chunks/base-GTB6POYE.js +0 -2
  472. package/dist/cli/chunks/browser-workflow-MSBOLYUY.js +0 -2
  473. package/dist/cli/chunks/chunk-4SJYIX54.js +0 -3
  474. package/dist/cli/chunks/chunk-6P7424AO.js +0 -21
  475. package/dist/cli/chunks/chunk-6X5DHU6Q.js +0 -14
  476. package/dist/cli/chunks/chunk-CMBLM26R.js +0 -2
  477. package/dist/cli/chunks/chunk-DKAC3E3B.js +0 -3
  478. package/dist/cli/chunks/chunk-DURHK377.js +0 -742
  479. package/dist/cli/chunks/chunk-FPUDRSFJ.js +0 -180
  480. package/dist/cli/chunks/chunk-G5I6KGMW.js +0 -59
  481. package/dist/cli/chunks/chunk-HOZUDE4C.js +0 -2
  482. package/dist/cli/chunks/chunk-N6PIIK6G.js +0 -3
  483. package/dist/cli/chunks/chunk-NSHU347M.js +0 -2
  484. package/dist/cli/chunks/chunk-PPSAMXYN.js +0 -13
  485. package/dist/cli/chunks/chunk-TYFZXDGZ.js +0 -4
  486. package/dist/cli/chunks/chunk-U4OICXV2.js +0 -6
  487. package/dist/cli/chunks/chunk-WSF24I3D.js +0 -2
  488. package/dist/cli/chunks/chunk-XBVUVFJK.js +0 -4
  489. package/dist/cli/chunks/chunk-XUZDBQ5X.js +0 -6
  490. package/dist/cli/chunks/chunk-YBSBABOS.js +0 -2
  491. package/dist/cli/chunks/chunk-ZG5666GJ.js +0 -2
  492. package/dist/cli/chunks/ci-MSKMVH5X.js +0 -81
  493. package/dist/cli/chunks/client-POSVREVS.js +0 -2
  494. package/dist/cli/chunks/core-handlers-V243GY7X.js +0 -2
  495. package/dist/cli/chunks/coverage-B7MCGNTE.js +0 -49
  496. package/dist/cli/chunks/cross-domain-router-N3AIEM3B.js +0 -2
  497. package/dist/cli/chunks/dream-UA7MKOPQ.js +0 -2
  498. package/dist/cli/chunks/file-discovery-YCMNKZAK.js +0 -2
  499. package/dist/cli/chunks/fleet-2Y3ZE6CE.js +0 -46
  500. package/dist/cli/chunks/heartbeat-scheduler-QH5V6G2P.js +0 -2
  501. package/dist/cli/chunks/hnsw-adapter-OJNFAGJS.js +0 -2
  502. package/dist/cli/chunks/hnsw-index-DFUNARVD.js +0 -2
  503. package/dist/cli/chunks/hybrid-backend-SSGQQEQ2.js +0 -2
  504. package/dist/cli/chunks/impact-analyzer-CRGCA7ZD.js +0 -2
  505. package/dist/cli/chunks/init-wizard-NIMZ4J55.js +0 -2
  506. package/dist/cli/chunks/kernel-JQK7PRAI.js +0 -2
  507. package/dist/cli/chunks/knowledge-graph-YPVVIKEU.js +0 -2
  508. package/dist/cli/chunks/llm-router-service-5OGAUOXF.js +0 -2
  509. package/dist/cli/chunks/load-test-UKNV5MWW.js +0 -2
  510. package/dist/cli/chunks/memory-backend-ZW4BTRNK.js +0 -2
  511. package/dist/cli/chunks/memory-handlers-FCXN437E.js +0 -2
  512. package/dist/cli/chunks/pattern-null-store-4DUV6MQC.js +0 -2
  513. package/dist/cli/chunks/project-root-JCAUNL6O.js +0 -2
  514. package/dist/cli/chunks/protocol-executor-RNZNZP3A.js +0 -2
  515. package/dist/cli/chunks/qe-reasoning-bank-WK6TQOG2.js +0 -2
  516. package/dist/cli/chunks/queen-coordinator-4452SXZQ.js +0 -2
  517. package/dist/cli/chunks/real-embeddings-RWGOVOXO.js +0 -2
  518. package/dist/cli/chunks/router-3DIS5X4R.js +0 -2
  519. package/dist/cli/chunks/routing-feedback-OPXRCXM7.js +0 -2
  520. package/dist/cli/chunks/rvf-dual-writer-JL6T727I.js +0 -2
  521. package/dist/cli/chunks/rvf-migration-adapter-V7IBDUCS.js +0 -2
  522. package/dist/cli/chunks/rvf-native-adapter-O3UQTEBK.js +0 -2
  523. package/dist/cli/chunks/safe-db-EVB4ZC7T.js +0 -2
  524. package/dist/cli/chunks/schedule-ORDDXXY4.js +0 -2
  525. package/dist/cli/chunks/scheduler-XFLJSFIU.js +0 -2
  526. package/dist/cli/chunks/sqlite-persistence-Y7B42CJ3.js +0 -2
  527. package/dist/cli/chunks/task-handlers-KPWAEMKH.js +0 -9
  528. package/dist/cli/chunks/test-runner-process-3XZUYST2.js +0 -2
  529. package/dist/cli/chunks/tree-sitter-wasm-parser-YTBCBHUO.js +0 -2
  530. package/dist/cli/chunks/unified-memory-EHD4VNFW.js +0 -2
  531. package/dist/cli/chunks/unified-memory-hnsw-ZODGM4UK.js +0 -2
  532. package/dist/cli/chunks/unified-persistence-MHSI7ABK.js +0 -2
  533. package/dist/cli/chunks/visual-security-54MLFKWY.js +0 -2
  534. package/dist/cli/chunks/witness-chain-LC6Q2W27.js +0 -2
  535. package/dist/cli/chunks/witness-chain-QUIBAF3W.js +0 -2
  536. package/dist/cli/chunks/workflow-orchestrator-UKHEJVSK.js +0 -2
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.10");process.exit(0)}
2
- import{c as g,d as p}from"./chunk-NSHU347M.js";import{c as h,e as B}from"./chunk-GHBNRMSJ.js";import{c as R,d as D}from"./chunk-EWFECZ2U.js";D();import*as c from"node:fs/promises";import*as i from"node:path";B();var W=2*1024*1024;function m(r,t){let n=i.relative(r,t);return n===""||n!==".."&&!n.startsWith(`..${i.sep}`)&&!i.isAbsolute(n)}function M(r,t){return i.isAbsolute(t)?t:`${r}${i.sep}${t}`}async function _(r,t){let n=[],e=r;for(;;){n.unshift(i.basename(e));let o=i.dirname(e);if(o===e)return null;e=o;let s=await c.realpath(e).catch(()=>null);if(s)return!m(t,s)||n.some(a=>a==="..")?null:i.join(s,...n.filter(a=>a!=="."&&a!==""))}}async function $(r,t={}){let n=t.projectRoot??R(),e=t.basePath??process.cwd(),o=[],s=[],a=[],d=i.resolve(n),u=await c.realpath(n).catch(()=>d),k=await c.realpath(e).catch(()=>null),b=(l,f)=>{o.push(l),s.push(!i.isAbsolute(l)&&k?i.relative(k,f)||".":f)};for(let l of r){let f=i.resolve(e,l);if(!m(d,f)&&!m(u,f)){a.push({path:l,reason:"outside-project-root"});continue}let x=M(e,l),y;try{y=await c.realpath(x)}catch(O){let E=O.code,I=E==="ENOENT"||E==="ENOTDIR",T=await c.lstat(x).then(()=>!0,()=>!1),A=I&&!T&&t.allowMissing?await _(x,u):null;A?b(l,A):a.push({path:l,reason:I?"not-found":"unreadable"});continue}if(!m(u,y)){a.push({path:l,reason:"outside-project-root"});continue}let P=await c.stat(y).catch(()=>null);P?P.isFile()||t.allowDirectory&&P.isDirectory()?t.maxBytes!==void 0&&P.size>t.maxBytes?a.push({path:l,reason:"too-large"}):b(l,y):a.push({path:l,reason:"not-a-file"}):a.push({path:l,reason:"unreadable"})}return{accepted:o,resolved:s,skipped:a}}function w(r){return r===null?"null":Array.isArray(r)?"array":typeof r}async function Y(r,t,n,e={}){let o=`Invalid ${r} payload`;if(!Array.isArray(n))return p(new h(`${o}: '${t}' must be an array of file paths, got ${w(n)}`));for(let d=0;d<n.length;d++){let u=n[d];if(typeof u!="string"||u.trim()==="")return p(new h(`${o}: '${t}[${d}]' must be a non-empty string, got ${w(u)}`));if(u.includes("\0"))return p(new h(`${o}: '${t}[${d}]' contains a null byte`))}let{resolved:s,skipped:a}=await $(n,e);return a.length>0?p(j(o,t,a,e)):g(s)}function j(r,t,n,e){let o=e.maxBytes!==void 0?`, at most ${Math.round(e.maxBytes/1048576)} MB each`:"",s=e.allowDirectory?"regular files or directories":"regular files";return new h(`${r}: ${t} cannot be read: ${n.map(a=>`${a.path} (${a.reason})`).join(", ")}. Pass ${s} inside the project${o}.`)}async function v(r,t,n,e={}){let o=`Invalid ${r} payload`;if(typeof n!="string"||n.trim()==="")return p(new h(`${o}: '${t}' must be a non-empty path string, got ${w(n)}`));if(n.includes("\0"))return p(new h(`${o}: '${t}' contains a null byte`));let{resolved:s,skipped:a}=await $([n],e);return a.length>0?p(j(o,t,a,e)):g(s[0])}function S(r){return r===null?"null":Array.isArray(r)?"array":typeof r}var N=1e4;function C(r,t="paths",n="Invalid index payload",e=N){if(!Array.isArray(r))return p(new Error(`${n}: '${t}' must be an array of file paths, got ${S(r)}`));if(r.length>e)return p(new Error(`${n}: '${t}' has ${r.length} entries; at most ${e} paths are accepted per request - index a directory target or split the list`));for(let o=0;o<r.length;o++){let s=r[o];if(typeof s!="string"||s.trim()==="")return p(new Error(`${n}: '${t}[${o}]' must be a non-empty string, got ${S(s)}`));if(s.includes("\0"))return p(new Error(`${n}: '${t}[${o}]' contains a null byte`))}return g(r)}function K(r,t){if(r!=="index"&&r!=="index-code")return;if(t===null||typeof t!="object"||!Object.hasOwn(t,"paths"))return new Error(`Invalid index payload: '${r}' needs 'paths', the list of files to index. It does not expand a directory 'target'; use code_index (or \`aqe code index\`) with a target, or list the files in paths.`);let n=C(t.paths);if(!n.success)return n.error;if(n.value.length===0)return new Error("Invalid index payload: 'paths' is empty; list at least one file to index")}async function Q(r,t,n=process.cwd()){let{accepted:e,skipped:o}=await $(r,{projectRoot:t,basePath:n});return{accepted:e,skipped:o}}function U(r,t,n=[]){let e=[...t.map(a=>`${a.path} (${a.reason})`),...n.map(a=>`${a.file} (${a.error})`)],o=e.slice(0,5).join(", "),s=e.length>5?`, and ${e.length-5} more`:"";return new Error(`Nothing was indexed: 0 of ${r} requested path(s) indexed`+(o?` - ${o}${s}`:""))}export{W as a,$ as b,Y as c,v as d,C as e,K as f,Q as g,U as h};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
+ import{c as g,d as p}from"./chunk-VZBC6DP7.js";import{c as R,d as D}from"./chunk-DZGPUGUG.js";import{c as h,e as B}from"./chunk-W4II6SIH.js";D();import*as c from"node:fs/promises";import*as i from"node:path";B();var W=2*1024*1024;function m(r,t){let n=i.relative(r,t);return n===""||n!==".."&&!n.startsWith(`..${i.sep}`)&&!i.isAbsolute(n)}function M(r,t){return i.isAbsolute(t)?t:`${r}${i.sep}${t}`}async function _(r,t){let n=[],e=r;for(;;){n.unshift(i.basename(e));let o=i.dirname(e);if(o===e)return null;e=o;let s=await c.realpath(e).catch(()=>null);if(s)return!m(t,s)||n.some(a=>a==="..")?null:i.join(s,...n.filter(a=>a!=="."&&a!==""))}}async function $(r,t={}){let n=t.projectRoot??R(),e=t.basePath??process.cwd(),o=[],s=[],a=[],d=i.resolve(n),u=await c.realpath(n).catch(()=>d),k=await c.realpath(e).catch(()=>null),b=(l,f)=>{o.push(l),s.push(!i.isAbsolute(l)&&k?i.relative(k,f)||".":f)};for(let l of r){let f=i.resolve(e,l);if(!m(d,f)&&!m(u,f)){a.push({path:l,reason:"outside-project-root"});continue}let x=M(e,l),y;try{y=await c.realpath(x)}catch(O){let E=O.code,I=E==="ENOENT"||E==="ENOTDIR",T=await c.lstat(x).then(()=>!0,()=>!1),A=I&&!T&&t.allowMissing?await _(x,u):null;A?b(l,A):a.push({path:l,reason:I?"not-found":"unreadable"});continue}if(!m(u,y)){a.push({path:l,reason:"outside-project-root"});continue}let P=await c.stat(y).catch(()=>null);P?P.isFile()||t.allowDirectory&&P.isDirectory()?t.maxBytes!==void 0&&P.size>t.maxBytes?a.push({path:l,reason:"too-large"}):b(l,y):a.push({path:l,reason:"not-a-file"}):a.push({path:l,reason:"unreadable"})}return{accepted:o,resolved:s,skipped:a}}function w(r){return r===null?"null":Array.isArray(r)?"array":typeof r}async function Y(r,t,n,e={}){let o=`Invalid ${r} payload`;if(!Array.isArray(n))return p(new h(`${o}: '${t}' must be an array of file paths, got ${w(n)}`));for(let d=0;d<n.length;d++){let u=n[d];if(typeof u!="string"||u.trim()==="")return p(new h(`${o}: '${t}[${d}]' must be a non-empty string, got ${w(u)}`));if(u.includes("\0"))return p(new h(`${o}: '${t}[${d}]' contains a null byte`))}let{resolved:s,skipped:a}=await $(n,e);return a.length>0?p(j(o,t,a,e)):g(s)}function j(r,t,n,e){let o=e.maxBytes!==void 0?`, at most ${Math.round(e.maxBytes/1048576)} MB each`:"",s=e.allowDirectory?"regular files or directories":"regular files";return new h(`${r}: ${t} cannot be read: ${n.map(a=>`${a.path} (${a.reason})`).join(", ")}. Pass ${s} inside the project${o}.`)}async function v(r,t,n,e={}){let o=`Invalid ${r} payload`;if(typeof n!="string"||n.trim()==="")return p(new h(`${o}: '${t}' must be a non-empty path string, got ${w(n)}`));if(n.includes("\0"))return p(new h(`${o}: '${t}' contains a null byte`));let{resolved:s,skipped:a}=await $([n],e);return a.length>0?p(j(o,t,a,e)):g(s[0])}function S(r){return r===null?"null":Array.isArray(r)?"array":typeof r}var N=1e4;function C(r,t="paths",n="Invalid index payload",e=N){if(!Array.isArray(r))return p(new Error(`${n}: '${t}' must be an array of file paths, got ${S(r)}`));if(r.length>e)return p(new Error(`${n}: '${t}' has ${r.length} entries; at most ${e} paths are accepted per request - index a directory target or split the list`));for(let o=0;o<r.length;o++){let s=r[o];if(typeof s!="string"||s.trim()==="")return p(new Error(`${n}: '${t}[${o}]' must be a non-empty string, got ${S(s)}`));if(s.includes("\0"))return p(new Error(`${n}: '${t}[${o}]' contains a null byte`))}return g(r)}function K(r,t){if(r!=="index"&&r!=="index-code")return;if(t===null||typeof t!="object"||!Object.hasOwn(t,"paths"))return new Error(`Invalid index payload: '${r}' needs 'paths', the list of files to index. It does not expand a directory 'target'; use code_index (or \`aqe code index\`) with a target, or list the files in paths.`);let n=C(t.paths);if(!n.success)return n.error;if(n.value.length===0)return new Error("Invalid index payload: 'paths' is empty; list at least one file to index")}async function Q(r,t,n=process.cwd()){let{accepted:e,skipped:o}=await $(r,{projectRoot:t,basePath:n});return{accepted:e,skipped:o}}function U(r,t,n=[]){let e=[...t.map(a=>`${a.path} (${a.reason})`),...n.map(a=>`${a.file} (${a.error})`)],o=e.slice(0,5).join(", "),s=e.length>5?`, and ${e.length-5} more`:"";return new Error(`Nothing was indexed: 0 of ${r} requested path(s) indexed`+(o?` - ${o}${s}`:""))}export{W as a,$ as b,Y as c,v as d,C as e,K as f,Q as g,U as h};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.10");process.exit(0)}
2
- import{c as m}from"./chunk-FZOWULMH.js";import{existsSync as g,readFileSync as _,readdirSync as w,statSync as T}from"fs";import{join as c,extname as E}from"path";var v=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),F=[".test.",".spec.","_test.","_spec."],b=new Set(["node_modules","dist","build","coverage",".git","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".next",".nuxt",".output"]);function W(s,n={}){let{maxDepth:r=6,includeTests:x=!1,testsOnly:y=!1,extraExtensions:S=[]}=n;if(!g(s))return[];let a=T(s);if(a.isFile())return[s];if(!a.isDirectory())return[];let h=new Set(S.map(e=>e.startsWith(".")?e:`.${e}`)),i=[];function u(e,o){if(o>r)return;let l;try{l=w(e,{withFileTypes:!0})}catch{return}for(let t of l)if(t.isDirectory()){if(b.has(t.name)||m(e,t.name,o===0))continue;u(c(e,t.name),o+1)}else if(t.isFile()){let f=E(t.name).toLowerCase();if(!(v.has(f)||h.has(f))||t.name.endsWith(".d.ts"))continue;let p=F.some(d=>t.name.includes(d))||t.name.startsWith("test_");y?p&&i.push(c(e,t.name)):(x||!p)&&i.push(c(e,t.name))}}return u(s,0),i}function I(s,n){return n!=="node"&&n!=="node-test"?s:s.filter(r=>{try{return!/@playwright\/test|require\(\s*['"]playwright['"]\s*\)/.test(_(r,"utf8"))}catch{return!0}})}export{v as a,W as b,I as c};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
+ import{c as m}from"./chunk-MCPEC6OO.js";import{existsSync as g,readFileSync as _,readdirSync as w,statSync as T}from"fs";import{join as c,extname as E}from"path";var v=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),F=[".test.",".spec.","_test.","_spec."],b=new Set(["node_modules","dist","build","coverage",".git","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".next",".nuxt",".output"]);function W(s,n={}){let{maxDepth:r=6,includeTests:x=!1,testsOnly:y=!1,extraExtensions:S=[]}=n;if(!g(s))return[];let a=T(s);if(a.isFile())return[s];if(!a.isDirectory())return[];let h=new Set(S.map(e=>e.startsWith(".")?e:`.${e}`)),i=[];function u(e,o){if(o>r)return;let l;try{l=w(e,{withFileTypes:!0})}catch{return}for(let t of l)if(t.isDirectory()){if(b.has(t.name)||m(e,t.name,o===0))continue;u(c(e,t.name),o+1)}else if(t.isFile()){let f=E(t.name).toLowerCase();if(!(v.has(f)||h.has(f))||t.name.endsWith(".d.ts"))continue;let p=F.some(d=>t.name.includes(d))||t.name.startsWith("test_");y?p&&i.push(c(e,t.name)):(x||!p)&&i.push(c(e,t.name))}}return u(s,0),i}function I(s,n){return n!=="node"&&n!=="node-test"?s:s.filter(r=>{try{return!/@playwright\/test|require\(\s*['"]playwright['"]\s*\)/.test(_(r,"utf8"))}catch{return!0}})}export{v as a,W as b,I as c};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.10");process.exit(0)}
2
- import{e as l,l as c}from"./chunk-YBSBABOS.js";import{a as i}from"./chunk-EAU5KDFO.js";import{a as n,e as h}from"./chunk-GHBNRMSJ.js";h();var d=class extends c{config={name:"qe/tests/schedule",description:"Schedule and execute tests using phase-based pipeline with git-aware selection and flaky tracking. Runs tests in phases (unit, integration, e2e), selects affected tests from git changes, and tracks flaky tests.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{cwd:{type:"string",description:"Working directory for test execution (defaults to project root)"},gitRef:{type:"string",description:'Git ref to compare for affected test selection (e.g., "main", "HEAD~3")'},useGitAware:{type:"boolean",description:"Enable git-aware test selection to only run affected tests",default:!0},trackFlaky:{type:"boolean",description:"Enable flaky test tracking and quarantine",default:!0}}}}async execute(s,o){if(s.gitRef!==void 0){let a=i(s.gitRef,"gitRef");if(a)return{success:!1,error:a}}try{let{runTestPipeline:a}=await import("./test-scheduling-YQZPJRRN.js"),u=await l(o),t=await a({cwd:s.cwd||process.cwd(),memory:u,baseRef:s.gitRef,flakyHistoryPath:s.trackFlaky!==!1?".agentic-qe/flaky-history.json":void 0,runAllTests:s.useGitAware===!1}),f=t.phaseResults.reduce((e,r)=>e+r.totalTests,0),p=t.phaseResults.reduce((e,r)=>e+r.passed,0),g=t.phaseResults.reduce((e,r)=>e+r.failed,0);return{success:!0,data:{pipelineId:o.requestId,phases:t.phaseResults.map(e=>({phaseId:e.phaseId,phaseName:e.phaseName,totalTests:e.totalTests,passed:e.passed,failed:e.failed,passRate:e.passRate,durationMs:e.durationMs})),gitAware:{enabled:!t.ranAllTests,selectedTests:t.selectedTests.length,gitRef:s.gitRef},flakyTracking:{enabled:s.trackFlaky!==!1},totalDuration:t.totalDurationMs,ranAllTests:t.ranAllTests,summary:`Executed ${t.phaseResults.length} phases, ${f} tests (${p} passed, ${g} failed) in ${t.totalDurationMs}ms`}}}catch(a){return{success:!1,error:n(a)}}}};export{d as a};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
+ import{e as l,l as c}from"./chunk-KJDI5CHX.js";import{a as i}from"./chunk-PX5OPXY6.js";import{a as n,e as h}from"./chunk-W4II6SIH.js";h();var d=class extends c{config={name:"qe/tests/schedule",description:"Schedule and execute tests using phase-based pipeline with git-aware selection and flaky tracking. Runs tests in phases (unit, integration, e2e), selects affected tests from git changes, and tracks flaky tests.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{cwd:{type:"string",description:"Working directory for test execution (defaults to project root)"},gitRef:{type:"string",description:'Git ref to compare for affected test selection (e.g., "main", "HEAD~3")'},useGitAware:{type:"boolean",description:"Enable git-aware test selection to only run affected tests",default:!0},trackFlaky:{type:"boolean",description:"Enable flaky test tracking and quarantine",default:!0}}}}async execute(s,o){if(s.gitRef!==void 0){let a=i(s.gitRef,"gitRef");if(a)return{success:!1,error:a}}try{let{runTestPipeline:a}=await import("./test-scheduling-VMVMVRHT.js"),u=await l(o),t=await a({cwd:s.cwd||process.cwd(),memory:u,baseRef:s.gitRef,flakyHistoryPath:s.trackFlaky!==!1?".agentic-qe/flaky-history.json":void 0,runAllTests:s.useGitAware===!1}),f=t.phaseResults.reduce((e,r)=>e+r.totalTests,0),p=t.phaseResults.reduce((e,r)=>e+r.passed,0),g=t.phaseResults.reduce((e,r)=>e+r.failed,0);return{success:!0,data:{pipelineId:o.requestId,phases:t.phaseResults.map(e=>({phaseId:e.phaseId,phaseName:e.phaseName,totalTests:e.totalTests,passed:e.passed,failed:e.failed,passRate:e.passRate,durationMs:e.durationMs})),gitAware:{enabled:!t.ranAllTests,selectedTests:t.selectedTests.length,gitRef:s.gitRef},flakyTracking:{enabled:s.trackFlaky!==!1},totalDuration:t.totalDurationMs,ranAllTests:t.ranAllTests,summary:`Executed ${t.phaseResults.length} phases, ${f} tests (${p} passed, ${g} failed) in ${t.totalDurationMs}ms`}}}catch(a){return{success:!1,error:n(a)}}}};export{d as a};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
+ import{a as T}from"./chunk-SG2TX72G.js";import{a as M}from"./chunk-GKFV6CUD.js";import{v as q}from"./chunk-L7NGKANW.js";import{i as b}from"./chunk-7TA5MUPW.js";import{c as _}from"./chunk-DZGPUGUG.js";import{a as h,e as x}from"./chunk-W4II6SIH.js";var R=Object.freeze({readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}),P=["accessibility_test","advisor_consult","agent_complete","agent_list","agent_metrics","agent_spawn","agent_status","aqe_health","chaos_test","code_index","contract_validate","coverage_analyze_sublinear","cross_phase_cleanup","cross_phase_query","cross_phase_stats","cross_phase_store","defect_predict","fleet_health","fleet_init","fleet_status","format_signals","infra_healing_feed_output","infra_healing_recover","infra_healing_status","memory_delete","memory_query","memory_retrieve","memory_share","memory_store","memory_usage","migration_check","migration_promote","migration_status","model_route","phase_end","phase_start","pipeline_list","pipeline_load","pipeline_approve","pipeline_reject","pipeline_run","pipeline_status","pipeline_validate","quality_assess","requirements_validate","routing_economics","routing_metrics","security_scan_comprehensive","session_cache_stats","task_cancel","task_list","task_orchestrate","task_status","task_submit","team_broadcast","team_health","team_list","team_message","team_rebalance","team_scale","test_execute_parallel","test_generate_enhanced","validation_pipeline"],C=["qe/analysis/token_usage","qe/code/c4","qe/coherence/audit","qe/coherence/check","qe/coherence/collapse","qe/coherence/consensus","qe/coverage/gaps","qe/embeddings/compare","qe/embeddings/generate","qe/embeddings/search","qe/embeddings/stats","qe/embeddings/store","qe/learning/dream","qe/learning/optimize","qe/mincut/health","qe/mincut/analyze","qe/mincut/strengthen","qe/planning/goap_execute","qe/planning/goap_plan","qe/planning/goap_status","qe/quality/gate","qe/qx/analyze","qe/requirements/quality-criteria","qe/security/url-validate","qe/tests/load","qe/tests/schedule","qe/visual/compare","qe/workflows/browser-load"],L=Object.freeze([...P,...C].sort());function w(){return{annotations:R,reason:"No narrow side-effect-free guarantee is recorded for this built-in; retain conservative policy defaults."}}var S=Object.freeze(Object.fromEntries(L.map(r=>[r,w()])));function k(r,e){let t=Object.hasOwn(S,r)?S[r]:void 0;return Object.freeze({...t?.annotations??R,...t?e:void 0})}q();x();import*as p from"path";import*as d from"fs";function O(){return process.env.AQE_MEMORY_BACKEND==="memory"}var s=null,c=null,g=null;function Q(r){g=r}async function A(){return s||c||(c=(async()=>{if(O()){let o=new M;return await o.initialize(),s=o,o}let r=_(),e=p.join(r,".agentic-qe");d.existsSync(e)||d.mkdirSync(e,{recursive:!0});let t=new T({sqlite:{path:p.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await t.initialize(),s=t,t})(),c)}function F(){if(g)try{g()}catch{}s&&(s.dispose().catch(()=>{}),s=null),c=null}async function V(r){return r?.memory?r.memory:A()}var u=null,m=null;function D(){let r=(process.env.AQE_LLM_ROUTER_DISABLED??"").trim().toLowerCase();return r?r!=="false"&&r!=="0"&&r!=="no"&&r!=="off":!1}function U(r){u=r,m=null}async function j(){return D()?null:u||m||(m=(async()=>{let{createLLMRouterService:r}=await import("./llm-router-service-MM75HKWJ.js"),e=await r();return e?(u=e.router,u):null})(),m)}function Y(){u=null,m=null}async function W(r){return r?.llmRouter?r.llmRouter:await j()??void 0}async function G(r){if(r?.kernel)return r.kernel;try{let{getFleetState:e}=await import("./core-handlers-ODO6LUWQ.js");return e().kernel??void 0}catch{return}}var I={info:(r,e)=>console.log(`[MCP-TOOL] ${r}`,e||""),warn:(r,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${r}`,e||""),error:(r,e)=>console.error(`[MCP-TOOL] \u274C ${r}`,e||"")},v=class{logger=I;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,t){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:t,requestId:e.requestId,demoMode:e.demoMode})}markAsEstimatedData(){this.currentDataSource="estimated"}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let t=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let o=e,{properties:i,required:n}=this.config.schema;if(n)for(let a of n)a in o||t.push(`Missing required field: ${a}`);for(let[a,l]of Object.entries(o)){let f=i[a];if(!f)continue;let y=this.validateType(a,l,f);y&&t.push(y)}return{valid:t.length===0,errors:t}}validateType(e,t,o){if(t==null)return null;let i=Array.isArray(t)?"array":typeof t;if(o.type==="array"&&!Array.isArray(t))return`${e} must be an array`;if(o.type!=="array"&&i!==o.type)return`${e} must be of type ${o.type}, got ${i}`;if(o.enum&&!o.enum.includes(t))return`${e} must be one of: ${o.enum.join(", ")}`;if(o.type==="number"){let n=t;if(o.minimum!==void 0&&n<o.minimum)return`${e} must be >= ${o.minimum}`;if(o.maximum!==void 0&&n>o.maximum)return`${e} must be <= ${o.maximum}`}if(o.type==="string"){let n=t;if(o.minLength!==void 0&&n.length<o.minLength)return`${e} must be at least ${o.minLength} characters`;if(o.maxLength!==void 0&&n.length>o.maxLength)return`${e} must be at most ${o.maxLength} characters`}return null}async invoke(e,t={}){let o=Date.now(),i=b();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(o,i)};let a={requestId:i,startTime:o,streaming:t.streaming,onStream:t.onStream,abortSignal:t.abortSignal,demoMode:t.demoMode,memory:t.memory,llmRouter:t.llmRouter,kernel:t.kernel};try{let l=await this.execute(e,a);return{...l,metadata:{...l.metadata,...this.createMetadata(o,i)}}}catch(l){return{success:!1,error:h(l),metadata:this.createMetadata(o,i)}}}createMetadata(e,t){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:t,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,t){e.streaming&&e.onStream&&e.onStream(t)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get annotations(){return k(this.name,this.config.annotations)}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{O as a,Q as b,A as c,F as d,V as e,U as f,j as g,Y as h,W as i,G as j,I as k,v as l};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.10");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
2
  var l=[{name:"aqe-plan-quality",default:!0},{name:"aqe-plan-work",default:!0},{name:"aqe-research",default:!0},{name:"aqe-review-quality",default:!0},{name:"aqe-test-change",default:!0},{name:"aqe-ruflo",default:!1,files:["SKILL.md"]}];function t(a={}){return l.filter(e=>e.default||e.name==="aqe-ruflo"&&a.includeRuflo===!0)}export{t as a};
@@ -1,5 +1,5 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.10");process.exit(0)}
2
- import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chunk-ACWFKES2.js";import{a as K,b as $,c as V,d as Se,e as gt}from"./chunk-AI4VYSFS.js";import{a as Y,c as lt}from"./chunk-VJQYDYAJ.js";import{a as me,d as x,e as fe,f as Ne}from"./chunk-OBAREPDC.js";import{a as U,b as pe,e as dt}from"./chunk-PGYMKGOE.js";import{a as he,c as Re,d as _t}from"./chunk-AH3ZD3NJ.js";import{a as ct}from"./chunk-HOZUDE4C.js";import{c as le}from"./chunk-ATHWDAXB.js";import{a as A,e as ue}from"./chunk-GHBNRMSJ.js";import{a as z,c as X,d as Tt}from"./chunk-EWFECZ2U.js";import{a as ge,b as Et}from"./chunk-XBVUVFJK.js";import{b as R,d as at}from"./chunk-OY2AHLSF.js";import{createHash as Ce}from"node:crypto";function mt(n){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(n)),e}function ft(n){return typeof n=="string"?Buffer.from(n,"utf8"):n instanceof Uint8Array?Buffer.from(n):Buffer.from(Q(n),"utf8")}function Q(n){return n===null||typeof n!="object"?JSON.stringify(n)??"null":Array.isArray(n)?`[${n.map(Q).join(",")}]`:`{${Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${Q(n[t])}`).join(",")}}`}function Oe(...n){let e=Ce("sha256");for(let t of n)e.update(t);return e.digest()}function Ie(n,e,t){return Oe(pt,n,e,mt(t))}var pt,Le,v,Ae=R(()=>{"use strict";pt=Buffer.from("ruvector:chain:"),Le=Ce("sha256").update("ruvector-proof-gate-v1").digest();v=class n{seq=0;prev=Le;chain=[];payloadHashes=[];admit(e){let t=Oe(ft(e)),r=Ie(this.prev,t,this.seq);this.prev=r,this.chain.push(r),this.payloadHashes.push(t);let i={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:r.toString("hex")};return this.seq+=1,i}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=Le;for(let t=0;t<this.chain.length;t++){if(!Ie(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new n;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let r of e.chain)t.chain.push(Buffer.from(r,"hex"));for(let r of e.payloadHashes)t.payloadHashes.push(Buffer.from(r,"hex"));return t}}});function b(n){if(!J.has(n))throw new Error(`Invalid table name: "${n}" is not in the allowlist`);return n}function Ut(n){let e=n.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${n}" has too many parts (max: schema.table)`);for(let t of e)if(!ve.test(t))throw new Error(`Invalid SQL identifier: "${n}" \u2014 part "${t}" does not match pattern ${ve}`);return n}var J,ve,Z=R(()=>{"use strict";J=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage","qe_agent_co_execution"]);ve=/^[a-z_][a-z0-9_]{0,62}$/});function De(n){n.exec(be),n.exec(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.12");process.exit(0)}
2
+ import{d as W,f as lt}from"./chunk-66PXR3NI.js";import{b as I,d as _e}from"./chunk-WTAUF6O4.js";import{a as K,b as $,c as V,d as he,e as pt}from"./chunk-SPC4RBLF.js";import{a as Y,c as gt}from"./chunk-WGTEZT7G.js";import{a as fe,d as x,e as Ne,f as Se}from"./chunk-IPA7K556.js";import{a as U,b as me,e as ut}from"./chunk-YUA6ZKKY.js";import{a as Re,c as Le,d as _t}from"./chunk-YWWMNTBF.js";import{a as Tt}from"./chunk-UJNGGFGX.js";import{c as ge}from"./chunk-ADUAJIAU.js";import{a as z,c as X,d as Et}from"./chunk-DZGPUGUG.js";import{d as pe,e as dt}from"./chunk-IA55PFLG.js";import{a as A,e as le}from"./chunk-W4II6SIH.js";import{b as R,d as ct}from"./chunk-WDEXOLK2.js";import{createHash as Oe}from"node:crypto";function ft(n){let e=Buffer.alloc(8);return e.writeBigUInt64LE(BigInt(n)),e}function Nt(n){return typeof n=="string"?Buffer.from(n,"utf8"):n instanceof Uint8Array?Buffer.from(n):Buffer.from(Q(n),"utf8")}function Q(n){return n===null||typeof n!="object"?JSON.stringify(n)??"null":Array.isArray(n)?`[${n.map(Q).join(",")}]`:`{${Object.keys(n).sort().map(t=>`${JSON.stringify(t)}:${Q(n[t])}`).join(",")}}`}function Ae(...n){let e=Oe("sha256");for(let t of n)e.update(t);return e.digest()}function Ce(n,e,t){return Ae(mt,n,e,ft(t))}var mt,Ie,v,ve=R(()=>{"use strict";mt=Buffer.from("ruvector:chain:"),Ie=Oe("sha256").update("ruvector-proof-gate-v1").digest();v=class n{seq=0;prev=Ie;chain=[];payloadHashes=[];admit(e){let t=Ae(Nt(e)),s=Ce(this.prev,t,this.seq);this.prev=s,this.chain.push(s),this.payloadHashes.push(t);let r={sequence:this.seq,payloadHash:t.toString("hex"),chainCommitment:s.toString("hex")};return this.seq+=1,r}verifyReceipt(e){return e.sequence>=0&&e.sequence<this.chain.length&&this.chain[e.sequence].toString("hex")===e.chainCommitment}chainRoot(){return this.prev.toString("hex")}get length(){return this.seq}get isEmpty(){return this.seq===0}verifyIntegrity(){if(this.chain.length!==this.payloadHashes.length)return!1;let e=Ie;for(let t=0;t<this.chain.length;t++){if(!Ce(e,this.payloadHashes[t],t).equals(this.chain[t]))return!1;e=this.chain[t]}return e.equals(this.prev)}toJSON(){return{seq:this.seq,head:this.prev.toString("hex"),chain:this.chain.map(e=>e.toString("hex")),payloadHashes:this.payloadHashes.map(e=>e.toString("hex"))}}static fromJSON(e){let t=new n;t.seq=e.seq,t.prev=Buffer.from(e.head,"hex");for(let s of e.chain)t.chain.push(Buffer.from(s,"hex"));for(let s of e.payloadHashes)t.payloadHashes.push(Buffer.from(s,"hex"));return t}}});function b(n){if(!J.has(n))throw new Error(`Invalid table name: "${n}" is not in the allowlist`);return n}function Ft(n){let e=n.split(".");if(e.length>2)throw new Error(`Invalid SQL identifier: "${n}" has too many parts (max: schema.table)`);for(let t of e)if(!be.test(t))throw new Error(`Invalid SQL identifier: "${n}" \u2014 part "${t}" does not match pattern ${be}`);return n}var J,be,Z=R(()=>{"use strict";J=new Set(["schema_version","kv_store","vectors","rl_q_values","goap_goals","goap_actions","goap_plans","goap_plan_signatures","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","sona_patterns","sona_fisher_matrices","test_outcomes","routing_outcomes","coverage_sessions","patterns","hypergraph_nodes","hypergraph_edges","hypergraph_vertices","hypergraph_hyperedges","hypergraph_edge_vertices","hypergraph_vertex_properties","hypergraph_edge_properties","captured_experiences","experience_applications","witness_chain","witness_chain_receipts","witness_chain_archive","trajectories","trajectory_steps","pattern_evolution_events","pattern_relationships","pattern_versions","learning_daily_snapshots","metrics_outcomes","experience_consolidation_log","qe_pattern_reuse","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage","qe_agent_co_execution"]);be=/^[a-z_][a-z0-9_]{0,62}$/});function ye(n){n.exec(De),n.exec(`
3
3
  INSERT OR IGNORE INTO learning_evidence_manifests (
4
4
  id, trajectory_id, trajectory_hash, manifest_hash, task_family,
5
5
  outcome, oracle_refs_json, source_kind, process_signals_json
@@ -23,7 +23,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
23
23
  pattern_id, manifest_id, use_kind
24
24
  )
25
25
  SELECT id, 'legacy-pattern:' || id, 'legacy-context' FROM qe_patterns;
26
- `)}var be,ee=R(()=>{"use strict";be=`
26
+ `)}var De,ee=R(()=>{"use strict";De=`
27
27
  CREATE TABLE IF NOT EXISTS learning_evidence_manifests (
28
28
  id TEXT PRIMARY KEY,
29
29
  trajectory_id TEXT,
@@ -131,8 +131,8 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
131
131
  BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
132
132
  CREATE TRIGGER IF NOT EXISTS learning_admissions_no_delete BEFORE DELETE ON learning_evidence_admissions
133
133
  BEGIN SELECT RAISE(ABORT, 'learning evidence admissions are append-only'); END;
134
- `});var ye,Nt,te,Xe=R(()=>{"use strict";ye="dream_insights_archive",Nt=`
135
- CREATE TABLE IF NOT EXISTS ${ye} (
134
+ `});var Xe,St,te,Ue=R(()=>{"use strict";Xe="dream_insights_archive",St=`
135
+ CREATE TABLE IF NOT EXISTS ${Xe} (
136
136
  archive_id INTEGER PRIMARY KEY AUTOINCREMENT,
137
137
  id TEXT NOT NULL,
138
138
  cycle_id TEXT,
@@ -149,16 +149,16 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
149
149
  archived_at TEXT NOT NULL DEFAULT (datetime('now'))
150
150
  )
151
151
  `,te=`
152
- ${Nt};
152
+ ${St};
153
153
  -- The sweep's read-back looks copies up by insight id.
154
- CREATE INDEX IF NOT EXISTS idx_dream_insights_archive_id ON ${ye}(id);
155
- `});var C,Ue,Fe,xe,we,ne,Me,re,D,se,Ge,Pe,ke,qe,Be,je,He,ie=R(()=>{"use strict";ut();lt();ee();Xe();C=14,Ue=`
154
+ CREATE INDEX IF NOT EXISTS idx_dream_insights_archive_id ON ${Xe}(id);
155
+ `});var C,Fe,xe,we,Me,ne,Ge,re,D,se,Pe,ke,qe,Be,je,He,ze,ie=R(()=>{"use strict";lt();gt();ee();Ue();C=14,Fe=`
156
156
  CREATE TABLE IF NOT EXISTS schema_version (
157
157
  id INTEGER PRIMARY KEY CHECK (id = 1),
158
158
  version INTEGER NOT NULL,
159
159
  migrated_at TEXT DEFAULT (datetime('now'))
160
160
  );
161
- `,Fe=`
161
+ `,xe=`
162
162
  -- Key-Value Store (v2 compatible - same schema as HybridBackend)
163
163
  CREATE TABLE IF NOT EXISTS kv_store (
164
164
  key TEXT NOT NULL,
@@ -170,7 +170,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
170
170
  );
171
171
  CREATE INDEX IF NOT EXISTS idx_kv_namespace ON kv_store(namespace);
172
172
  CREATE INDEX IF NOT EXISTS idx_kv_expires ON kv_store(expires_at) WHERE expires_at IS NOT NULL;
173
- `,xe=`
173
+ `,we=`
174
174
  -- Vector Embeddings (new in v3 - replaces in-memory AgentDB)
175
175
  CREATE TABLE IF NOT EXISTS vectors (
176
176
  id TEXT PRIMARY KEY,
@@ -183,7 +183,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
183
183
  );
184
184
  CREATE INDEX IF NOT EXISTS idx_vectors_namespace ON vectors(namespace);
185
185
  CREATE INDEX IF NOT EXISTS idx_vectors_dimensions ON vectors(dimensions);
186
- `,we=`
186
+ `,Me=`
187
187
  -- Q-Values for RL algorithms (ADR-046)
188
188
  CREATE TABLE IF NOT EXISTS rl_q_values (
189
189
  id TEXT PRIMARY KEY,
@@ -315,7 +315,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
315
315
  -- would fail on "no such column" since CREATE TABLE IF NOT EXISTS above
316
316
  -- silently no-ops against them. unified-memory.ts's v11 migration creates
317
317
  -- this index only after confirming/backfilling the column.
318
- `,Me=`
318
+ `,Ge=`
319
319
  -- Concept Graph Nodes (Dream Engine)
320
320
  CREATE TABLE IF NOT EXISTS concept_nodes (
321
321
  id TEXT PRIMARY KEY,
@@ -407,7 +407,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
407
407
  INSERT INTO qe_patterns_fts(rowid, name, description, pattern_type, qe_domain)
408
408
  VALUES (new.rowid, new.name, new.description, new.pattern_type, new.qe_domain);
409
409
  END;
410
- `}),se=re+Object.values(D).join(""),Ge=n=>`
410
+ `}),se=re+Object.values(D).join(""),Pe=n=>`
411
411
  -- QE Patterns table (unified from sqlite-persistence.ts)
412
412
  CREATE TABLE IF NOT EXISTS qe_patterns (
413
413
  id TEXT PRIMARY KEY,
@@ -537,7 +537,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
537
537
  CREATE INDEX IF NOT EXISTS idx_execution_results_status ON execution_results(status);
538
538
  CREATE INDEX IF NOT EXISTS idx_executed_steps_execution ON executed_steps(execution_id);
539
539
  CREATE INDEX IF NOT EXISTS idx_executed_steps_action ON executed_steps(action_id);
540
- `,Pe=Ge(se),ke=Ge(""),qe=`
540
+ `,ke=Pe(se),qe=Pe(""),Be=`
541
541
  -- MinCut Graph Snapshots (ADR-047)
542
542
  CREATE TABLE IF NOT EXISTS mincut_snapshots (
543
543
  id TEXT PRIMARY KEY,
@@ -643,7 +643,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
643
643
  CREATE INDEX IF NOT EXISTS idx_mincut_healing_type ON mincut_healing_actions(action_type);
644
644
  CREATE INDEX IF NOT EXISTS idx_mincut_healing_success ON mincut_healing_actions(success);
645
645
  CREATE INDEX IF NOT EXISTS idx_mincut_observations_iter ON mincut_observations(iteration);
646
- `,Be=`
646
+ `,je=`
647
647
  -- SONA Patterns table (ADR-046: Pattern Persistence for Neural Backbone)
648
648
  CREATE TABLE IF NOT EXISTS sona_patterns (
649
649
  id TEXT PRIMARY KEY,
@@ -669,7 +669,7 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
669
669
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_domain ON sona_patterns(domain);
670
670
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_confidence ON sona_patterns(confidence DESC);
671
671
  CREATE INDEX IF NOT EXISTS idx_sona_patterns_updated ON sona_patterns(updated_at DESC);
672
- `,je=`
672
+ `,He=`
673
673
  -- Test outcomes (ADR-023: Quality Feedback Loop)
674
674
  CREATE TABLE IF NOT EXISTS test_outcomes (
675
675
  id TEXT PRIMARY KEY,
@@ -752,41 +752,41 @@ import{d as W,f as ut}from"./chunk-3Y7SPD72.js";import{b as I,d as _e}from"./chu
752
752
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_technique ON coverage_sessions(technique);
753
753
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_agent ON coverage_sessions(agent_id);
754
754
  CREATE INDEX IF NOT EXISTS idx_coverage_sessions_created ON coverage_sessions(created_at);
755
- `,He=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage"]});function oe(n,e,t){return n.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?").get(e,t)!==void 0}function Ye(n){return n.replace(/\s+/g," ").trim().replace(/^CREATE TRIGGER IF NOT EXISTS /i,"CREATE TRIGGER ").replace(/ ?;$/,"").toLowerCase()}function w(n,e){return n.prepare(e).get()?.n??0}function ze(n){let e=oe(n,"table","qe_patterns_fts"),t=e&&oe(n,"table","qe_patterns_fts_docsize"),r=[],i=[],s=n.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");for(let u of St){let d=s.get(u);d===void 0?r.push(u):Ye(d.sql??"")!==ht[u]&&i.push(u)}let c=w(n,"SELECT count(*) AS n FROM qe_patterns"),T=t?w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize"):-1,g=t&&T===c?w(n,`SELECT count(*) AS n FROM qe_patterns p
756
- WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:r,mismatchedTriggers:i,patterns:c,indexed:T,unindexed:g}}function We(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function Rt(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function Ke(n,e={}){let t=e.log??(s=>console.warn(s)),r=e.logPrefix??"[PatternFTS]",i={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!oe(n,"table","qe_patterns"))return i.status="no-patterns",i;if(Rt(n))return i.status="readonly",i;let s=ze(n);if(i.patternsBefore=s.patterns,i.indexedBefore=s.indexed,!We(s))return i;let c=n.transaction(()=>{let T=ze(n);if(!We(T))return null;T.hasTable||n.exec(re);for(let g of T.missingTriggers)n.exec(D[g]);for(let g of T.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${g}`),n.exec(D[g]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:T,indexedAfter:w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(c){let{s:T}=c;i.createdTable=!T.hasTable,i.recreatedTriggers=[...T.missingTriggers],i.replacedTriggers=[...T.mismatchedTriggers],i.patternsBefore=T.patterns,i.indexedBefore=T.indexed,i.indexedAfter=c.indexedAfter,i.rebuilt=!0}if(i.rebuilt){i.status="healed";let T=[];i.createdTable&&T.push("created qe_patterns_fts"),i.recreatedTriggers.length>0&&T.push(`recreated triggers [${i.recreatedTriggers.join(", ")}]`),i.replacedTriggers.length>0&&T.push(`replaced triggers [${i.replacedTriggers.join(", ")}]`);let g=i.indexedBefore<0?"n/a":String(i.indexedBefore);T.push(`rebuilt index (indexed ${g} -> ${i.indexedAfter}, qe_patterns ${i.patternsBefore})`),t(`${r} Healed qe_patterns FTS5 index: ${T.join("; ")}`)}return i}catch(s){i.status="failed",i.error=A(s);try{t(`${r} qe_patterns FTS5 self-heal skipped: ${i.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return i}}var St,ht,$e=R(()=>{"use strict";ue();ie();St=Object.keys(D);ht=Object.freeze(Object.fromEntries(Object.entries(D).map(([n,e])=>[n,Ye(e)])))});function M(n,e,t){let r={value:e,timestamp:t??(e!==void 0?Date.now():0),nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function i(s,c,T,g){return s!==T?s-T:c===g?0:c>g?1:-1}return{get(){return r.value},set(s,c){let T=c??Date.now();c===void 0&&r.version>0&&r.nodeId===n&&T<=r.timestamp&&(T=r.timestamp+1),(r.version===0||i(T,n,r.timestamp,r.nodeId)>0)&&(r={value:s,timestamp:T,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(s){let c=s.getState();this.applyState(c)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(s){s.version!==0&&(r.version===0||i(s.timestamp,s.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:s.value,timestamp:s.timestamp,nodeId:s.nodeId,version:Math.max(r.version,s.version)+1,lastUpdated:Date.now()})},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var ae=R(()=>{"use strict"});function O(n){let e={counts:K(),version:0,lastUpdated:Date.now()};return V(e.counts,n,0),{get(){return Object.values(e.counts).reduce((t,r)=>t+r,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(Se(e.counts,n,t),e.version++,e.lastUpdated=Date.now())},merge(t){let r=t.getState();this.applyState(r)},getState(){return{counts:Object.assign(K(),e.counts),version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let r=!1;for(let[i,s]of Object.entries(t.counts)){let c=$(e.counts,i)??0;s>c&&(V(e.counts,i,s),r=!0)}r&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return $(e.counts,n)??0}}}function P(n,e){let t=O(n);return t.applyState(e),t}var k=R(()=>{"use strict";gt()});function q(n){let e=O(n),t=O(n),r=0,i=Date.now();return{get(){return e.get()-t.get()},increment(s=1){if(s<0)throw new Error("Use decrement() for negative values");s!==0&&(e.increment(s),r++,i=Date.now())},decrement(s=1){if(s<0)throw new Error("Use increment() for negative values");s!==0&&(t.increment(s),r++,i=Date.now())},merge(s){let c=s.getState();this.applyState(c)},getState(){return{positive:e.getState(),negative:t.getState(),version:r,lastUpdated:i}},applyState(s){let c=this.get();e.applyState(s.positive),t.applyState(s.negative);let T=this.get();c!==T&&(r=Math.max(r,s.version)+1,i=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var ce=R(()=>{"use strict";k()});function Lt(n,e){return`${n}:${Date.now()}:${e}`}function Te(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function It(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,r=0,i=Date.now(),s=0;function c(u){let d=`${n}:`;if(!u.startsWith(d))return;let m=u.slice(d.length),_=/^(-?\d+):(\d+)$/.exec(m);if(!_)return;let l=Number(_[1]),p=Number(_[2]);Number.isSafeInteger(l)&&Number.isSafeInteger(p)&&p<Number.MAX_SAFE_INTEGER&&(s=Math.max(s,p+1))}function T(u){let d=e.get(u);if(!d||d.size===0)return!1;let m=t.get(u);if(!m||m.size===0)return!0;for(let _ of d)if(!m.has(_))return!0;return!1}function g(u){let d=e.get(u);if(!d)return new Set;let m=t.get(u)||new Set,_=new Set;for(let l of d)m.has(l)||_.add(l);return _}return{has(u){let d=Te(u);return T(d)},values(){let u=[];for(let[d]of e)T(d)&&u.push(It(d));return u},size(){let u=0;for(let[d]of e)T(d)&&u++;return u},add(u){let d=Te(u),m=Lt(n,s++);e.has(d)||e.set(d,new Set),e.get(d).add(m),r++,i=Date.now()},remove(u){let d=Te(u),m=e.get(d);if(!m||m.size===0)return;t.has(d)||t.set(d,new Set);let _=t.get(d);for(let l of m)_.add(l);r++,i=Date.now()},merge(u){let d=u.getState();this.applyState(d)},getState(){let u={};for(let[m,_]of e)u[m]=Array.from(_);let d={};for(let[m,_]of t)_.size>0&&(d[m]=Array.from(_));return{elements:u,tombstones:d,version:r,lastUpdated:i}},applyState(u){let d=!1;for(let[m,_]of Object.entries(u.elements)){e.has(m)||e.set(m,new Set);let l=e.get(m);for(let p of _)c(p),l.has(p)||(l.add(p),d=!0)}for(let[m,_]of Object.entries(u.tombstones)){t.has(m)||t.set(m,new Set);let l=t.get(m);for(let p of _)c(p),l.has(p)||(l.add(p),d=!0)}d&&(r=Math.max(r,u.version)+1,i=Date.now())},getNodeId(){return n},clear(){for(let[u,d]of e){t.has(u)||t.set(u,new Set);let m=t.get(u);for(let _ of d)m.add(_)}r++,i=Date.now()}}}function H(n,e){let t=j(n);return t.applyState(e),t}var Ee=R(()=>{"use strict";_e()});function de(n){let e={...Ct,...n},{nodeId:t,enableDeltaTracking:r,maxDeltaHistory:i}=e,s=new Map,c=new Map,T=new Map,g=new Map,u=0,d=[],m=new Set,_={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function l(a,o,E){let f={key:a,type:o,operation:E,timestamp:Date.now(),nodeId:t};for(let it of m)try{it(f)}catch(ot){console.error("[CRDTStore] Error in change listener:",ot)}}function p(a,o){u++,r&&_[a].add(o)}function L(){if(!r||!(_.registers.size>0||_.gCounters.size>0||_.pnCounters.size>0||_.sets.size>0))return;let o={fromVersion:d.length>0?d[d.length-1].toVersion:0,toVersion:u,timestamp:Date.now(),nodeId:t};if(_.registers.size>0){o.registers={};for(let E of _.registers){let f=s.get(E);f&&(o.registers[E]=f.getState())}_.registers.clear()}if(_.gCounters.size>0){o.gCounters={};for(let E of _.gCounters){let f=c.get(E);f&&(o.gCounters[E]=f.getState())}_.gCounters.clear()}if(_.pnCounters.size>0){o.pnCounters={};for(let E of _.pnCounters){let f=T.get(E);f&&(o.pnCounters[E]=f.getState())}_.pnCounters.clear()}if(_.sets.size>0){o.sets={};for(let E of _.sets){let f=g.get(E);f&&(o.sets[E]=f.getState())}_.sets.clear()}for(d.push(o);d.length>i;)d.shift()}let h={getRegister(a){return s.has(a)||s.set(a,M(t)),s.get(a)},setRegister(a,o){h.getRegister(a).set(o),p("registers",a),l(a,"lww-register","set")},hasRegister(a){return s.has(a)},deleteRegister(a){let o=s.delete(a);return o&&p("registers",a),o},getGCounter(a){return c.has(a)||c.set(a,O(t)),c.get(a)},incrementGCounter(a,o){h.getGCounter(a).increment(o),p("gCounters",a),l(a,"g-counter","increment")},hasGCounter(a){return c.has(a)},deleteGCounter(a){let o=c.delete(a);return o&&p("gCounters",a),o},getCounter(a){return T.has(a)||T.set(a,q(t)),T.get(a)},incrementCounter(a,o){h.getCounter(a).increment(o),p("pnCounters",a),l(a,"pn-counter","increment")},decrementCounter(a,o){h.getCounter(a).decrement(o),p("pnCounters",a),l(a,"pn-counter","decrement")},hasCounter(a){return T.has(a)},deleteCounter(a){let o=T.delete(a);return o&&p("pnCounters",a),o},getSet(a){return g.has(a)||g.set(a,j(t)),g.get(a)},addToSet(a,o){h.getSet(a).add(o),p("sets",a),l(a,"or-set","add")},removeFromSet(a,o){h.getSet(a).remove(o),p("sets",a),l(a,"or-set","remove")},hasSet(a){return g.has(a)},deleteSet(a){let o=g.delete(a);return o&&p("sets",a),o},merge(a){let o=a.getState();h.applyState(o)},getState(){L();let a={version:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[o,E]of s)a.registers[o]=E.getState();for(let[o,E]of c)a.gCounters[o]=E.getState();for(let[o,E]of T)a.pnCounters[o]=E.getState();for(let[o,E]of g)a.sets[o]=E.getState();return a},applyState(a){for(let[o,E]of Object.entries(a.registers))s.has(o)?s.get(o).applyState(E):s.set(o,G(t,E)),p("registers",o),l(o,"lww-register","merge");for(let[o,E]of Object.entries(a.gCounters))c.has(o)?c.get(o).applyState(E):c.set(o,P(t,E)),p("gCounters",o),l(o,"g-counter","merge");for(let[o,E]of Object.entries(a.pnCounters))T.has(o)?T.get(o).applyState(E):T.set(o,B(t,E)),p("pnCounters",o),l(o,"pn-counter","merge");for(let[o,E]of Object.entries(a.sets))g.has(o)?g.get(o).applyState(E):g.set(o,H(t,E)),p("sets",o),l(o,"or-set","merge");u=Math.max(u,a.version)+1},getDelta(a){if(L(),d.length===0)return a>=u,null;if(a<d[0].fromVersion){let f=h.getState();return{fromVersion:a,toVersion:u,timestamp:Date.now(),nodeId:t,registers:f.registers,gCounters:f.gCounters,pnCounters:f.pnCounters,sets:f.sets}}let o=d.filter(f=>f.toVersion>a);if(o.length===0)return null;let E={fromVersion:a,toVersion:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let f of o)f.registers&&Object.assign(E.registers,f.registers),f.gCounters&&Object.assign(E.gCounters,f.gCounters),f.pnCounters&&Object.assign(E.pnCounters,f.pnCounters),f.sets&&Object.assign(E.sets,f.sets);return Object.keys(E.registers).length===0&&delete E.registers,Object.keys(E.gCounters).length===0&&delete E.gCounters,Object.keys(E.pnCounters).length===0&&delete E.pnCounters,Object.keys(E.sets).length===0&&delete E.sets,E},applyDelta(a){if(a.registers)for(let[o,E]of Object.entries(a.registers))s.has(o)?s.get(o).applyState(E):s.set(o,G(t,E)),p("registers",o),l(o,"lww-register","merge");if(a.gCounters)for(let[o,E]of Object.entries(a.gCounters))c.has(o)?c.get(o).applyState(E):c.set(o,P(t,E)),p("gCounters",o),l(o,"g-counter","merge");if(a.pnCounters)for(let[o,E]of Object.entries(a.pnCounters))T.has(o)?T.get(o).applyState(E):T.set(o,B(t,E)),p("pnCounters",o),l(o,"pn-counter","merge");if(a.sets)for(let[o,E]of Object.entries(a.sets))g.has(o)?g.get(o).applyState(E):g.set(o,H(t,E)),p("sets",o),l(o,"or-set","merge");u=Math.max(u,a.toVersion)+1},getVersion(){return u},getNodeId(){return t},on(a,o){if(a==="change")return m.add(o),()=>{m.delete(o)};throw new Error(`Unknown event type: ${a}`)},removeAllListeners(){m.clear()},keys(a){let o=[];return(!a||a==="lww-register")&&o.push(...Array.from(s.keys())),(!a||a==="g-counter")&&o.push(...Array.from(c.keys())),(!a||a==="pn-counter")&&o.push(...Array.from(T.keys())),(!a||a==="or-set")&&o.push(...Array.from(g.keys())),o},clear(){s.clear(),c.clear(),T.clear(),g.clear(),d.length=0,_.registers.clear(),_.gCounters.clear(),_.pnCounters.clear(),_.sets.clear(),u=0},getStats(){return{total:s.size+c.size+T.size+g.size,registers:s.size,gCounters:c.size,pnCounters:T.size,sets:g.size,version:u,nodeId:t,deltaHistorySize:d.length}}};return h}var Ct,Ve=R(()=>{"use strict";ae();k();ce();Ee();Ct={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var Qe=R(()=>{"use strict"});var Je=R(()=>{"use strict";ae();k();ce();Ee();Ve();Qe()});var bt={};at(bt,{ALLOWED_TABLE_NAMES:()=>J,BinaryHeap:()=>me,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>nt,UnifiedHnswIndex:()=>x,UnifiedMemoryManager:()=>y,clearProjectRootCache:()=>z,createHnswIndex:()=>fe,findProjectRoot:()=>X,getDefaultDbPath:()=>tt,getResolvedDefaultConfig:()=>rt,getUnifiedMemory:()=>st,initializeUnifiedMemory:()=>Ot,resetUnifiedMemory:()=>At,validateTableName:()=>b});import*as N from"fs";import*as et from"os";import*as S from"path";function tt(){let n=X();return S.join(n,".agentic-qe","memory.db")}function rt(){return{...nt,dbPath:tt()}}function st(n){return y.getInstance(n)}async function Ot(n){let e=st(n);return await e.initialize(),e}function At(){y.resetInstance()}function vt(){if(Ze)return;Ze=!0;let n=()=>{try{let t=y.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),he(n);let e=t=>{Re(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var F,nt,y,Ze,Dt=R(()=>{Et();_e();ue();dt();ct();Ae();Z();Z();Ne();Ne();ie();$e();ee();Je();Tt();_t();F=le.create("unified-memory");nt={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:U.MMAP_SIZE_BYTES,cacheSize:U.CACHE_SIZE_KB,busyTimeout:U.BUSY_TIMEOUT_MS,vectorDimensions:U.DEFAULT_VECTOR_DIMENSIONS};y=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new x("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=rt();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let r=X();this.config.dbPath=S.join(r,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,z()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",r="",i=!1,s=0;if(!t){let c=process.env.AQE_PROJECT_ROOT;if(c){let T=S.resolve(this.config.dbPath),g=S.resolve(c);!T.startsWith(g)&&!T.startsWith(et.tmpdir())&&T.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${c}". Redirecting to test-safe path.`),this.config.dbPath=S.join(c,".agentic-qe","memory.db"))}if(r=S.dirname(this.config.dbPath),N.existsSync(r)||N.mkdirSync(r,{recursive:!0}),i=N.existsSync(this.config.dbPath),i)s=N.statSync(this.config.dbPath).size;else if(N.existsSync(r)){let T=this.findRecentBackups(r);if(T.length>0){let g=T[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
755
+ `,ze=["kv_store","vectors","rl_q_values","goap_actions","goap_goals","goap_plans","goap_plan_signatures","goap_execution_steps","concept_nodes","concept_edges","dream_cycles","dream_insights","qe_patterns","qe_pattern_embeddings","qe_pattern_usage","qe_trajectories","embeddings","execution_results","executed_steps","mincut_snapshots","mincut_history","mincut_weak_vertices","mincut_alerts","mincut_healing_actions","mincut_observations","hypergraph_nodes","hypergraph_edges","sona_patterns","witness_chain","learning_evidence_manifests","learning_evidence_segments","learning_segment_edges","learning_evidence_admissions","pattern_manifest_lineage","pattern_segment_lineage"]});function oe(n,e,t){return n.prepare("SELECT 1 FROM sqlite_master WHERE type = ? AND name = ?").get(e,t)!==void 0}function Ke(n){return n.replace(/\s+/g," ").trim().replace(/^CREATE TRIGGER IF NOT EXISTS /i,"CREATE TRIGGER ").replace(/ ?;$/,"").toLowerCase()}function w(n,e){return n.prepare(e).get()?.n??0}function We(n){let e=oe(n,"table","qe_patterns_fts"),t=e&&oe(n,"table","qe_patterns_fts_docsize"),s=[],r=[],c=n.prepare("SELECT sql FROM sqlite_master WHERE type = 'trigger' AND name = ?");for(let u of ht){let d=c.get(u);d===void 0?s.push(u):Ke(d.sql??"")!==Rt[u]&&r.push(u)}let a=w(n,"SELECT count(*) AS n FROM qe_patterns"),T=t?w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize"):-1,l=t&&T===a?w(n,`SELECT count(*) AS n FROM qe_patterns p
756
+ WHERE NOT EXISTS (SELECT 1 FROM qe_patterns_fts_docsize d WHERE d.id = p.rowid)`):0;return{hasTable:e,hasDocsize:t,missingTriggers:s,mismatchedTriggers:r,patterns:a,indexed:T,unindexed:l}}function Ye(n){return!n.hasTable||n.missingTriggers.length>0||n.mismatchedTriggers.length>0?!0:n.hasDocsize?n.indexed!==n.patterns||n.unindexed>0:!1}function Lt(n){if(n.readonly)return!0;try{return Number(n.pragma("query_only",{simple:!0}))===1}catch{return!1}}function $e(n,e={}){let t=e.log??(c=>console.warn(c)),s=e.logPrefix??"[PatternFTS]",r={status:"healthy",createdTable:!1,recreatedTriggers:[],replacedTriggers:[],rebuilt:!1,patternsBefore:-1,indexedBefore:-1,indexedAfter:-1};try{if(!oe(n,"table","qe_patterns"))return r.status="no-patterns",r;if(Lt(n))return r.status="readonly",r;let c=We(n);if(r.patternsBefore=c.patterns,r.indexedBefore=c.indexed,!Ye(c))return r;let a=n.transaction(()=>{let T=We(n);if(!Ye(T))return null;T.hasTable||n.exec(re);for(let l of T.missingTriggers)n.exec(D[l]);for(let l of T.mismatchedTriggers)n.exec(`DROP TRIGGER IF EXISTS ${l}`),n.exec(D[l]);return n.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')"),{s:T,indexedAfter:w(n,"SELECT count(*) AS n FROM qe_patterns_fts_docsize")}}).immediate();if(a){let{s:T}=a;r.createdTable=!T.hasTable,r.recreatedTriggers=[...T.missingTriggers],r.replacedTriggers=[...T.mismatchedTriggers],r.patternsBefore=T.patterns,r.indexedBefore=T.indexed,r.indexedAfter=a.indexedAfter,r.rebuilt=!0}if(r.rebuilt){r.status="healed";let T=[];r.createdTable&&T.push("created qe_patterns_fts"),r.recreatedTriggers.length>0&&T.push(`recreated triggers [${r.recreatedTriggers.join(", ")}]`),r.replacedTriggers.length>0&&T.push(`replaced triggers [${r.replacedTriggers.join(", ")}]`);let l=r.indexedBefore<0?"n/a":String(r.indexedBefore);T.push(`rebuilt index (indexed ${l} -> ${r.indexedAfter}, qe_patterns ${r.patternsBefore})`),t(`${s} Healed qe_patterns FTS5 index: ${T.join("; ")}`)}return r}catch(c){r.status="failed",r.error=A(c);try{t(`${s} qe_patterns FTS5 self-heal skipped: ${r.error} (keyword search may be degraded; vector search unaffected)`)}catch{}return r}}var ht,Rt,Ve=R(()=>{"use strict";le();ie();ht=Object.keys(D);Rt=Object.freeze(Object.fromEntries(Object.entries(D).map(([n,e])=>[n,Ke(e)])))});function ae(n){if(!Number.isFinite(n))throw new RangeError("LWW register timestamp must be a finite number")}function M(n,e,t){let s=t??(e!==void 0?Date.now():0);ae(s);let r={value:e,timestamp:s,nodeId:e!==void 0?n:"",version:e!==void 0?1:0,lastUpdated:Date.now()};function c(a,T,l,u){return a!==l?a-l:T===u?0:T>u?1:-1}return{get(){return r.value},set(a,T){let l=T??Date.now();ae(l),T===void 0&&r.version>0&&r.nodeId===n&&l<=r.timestamp&&(l=r.timestamp+1),(r.version===0||c(l,n,r.timestamp,r.nodeId)>0)&&(r={value:a,timestamp:l,nodeId:n,version:r.version+1,lastUpdated:Date.now()})},merge(a){let T=a.getState();this.applyState(T)},getState(){return{value:r.value,timestamp:r.timestamp,nodeId:r.nodeId,version:r.version,lastUpdated:r.lastUpdated}},applyState(a){a.version!==0&&(ae(a.timestamp),(r.version===0||c(a.timestamp,a.nodeId,r.timestamp,r.nodeId)>0)&&(r={value:a.value,timestamp:a.timestamp,nodeId:a.nodeId,version:Math.max(r.version,a.version)+1,lastUpdated:Date.now()}))},getNodeId(){return n},getTimestamp(){return r.timestamp}}}function G(n,e){let t=M(n);return t.applyState(e),t}var ce=R(()=>{"use strict"});function O(n){let e={counts:K(),version:0,lastUpdated:Date.now()};return V(e.counts,n,0),{get(){return Object.values(e.counts).reduce((t,s)=>t+s,0)},increment(t=1){if(t<0)throw new Error("G-Counter can only increment by positive values");t!==0&&(he(e.counts,n,t),e.version++,e.lastUpdated=Date.now())},merge(t){let s=t.getState();this.applyState(s)},getState(){return{counts:Object.assign(K(),e.counts),version:e.version,lastUpdated:e.lastUpdated}},applyState(t){let s=!1;for(let[r,c]of Object.entries(t.counts)){let a=$(e.counts,r)??0;c>a&&(V(e.counts,r,c),s=!0)}s&&(e.version=Math.max(e.version,t.version)+1,e.lastUpdated=Date.now())},getNodeId(){return n},getLocalCount(){return $(e.counts,n)??0}}}function P(n,e){let t=O(n);return t.applyState(e),t}var k=R(()=>{"use strict";pt()});function q(n){let e=O(n),t=O(n),s=0,r=Date.now();return{get(){return e.get()-t.get()},increment(c=1){if(c<0)throw new Error("Use decrement() for negative values");c!==0&&(e.increment(c),s++,r=Date.now())},decrement(c=1){if(c<0)throw new Error("Use increment() for negative values");c!==0&&(t.increment(c),s++,r=Date.now())},merge(c){let a=c.getState();this.applyState(a)},getState(){return{positive:e.getState(),negative:t.getState(),version:s,lastUpdated:r}},applyState(c){let a=this.get();e.applyState(c.positive),t.applyState(c.negative);let T=this.get();a!==T&&(s=Math.max(s,c.version)+1,r=Date.now())},getNodeId(){return n}}}function B(n,e){let t=q(n);return t.applyState(e),t}var Te=R(()=>{"use strict";k()});function It(n,e){return`${n}:${Date.now()}:${e}`}function Ee(n){return typeof n=="string"?`s:${n}`:typeof n=="number"?`n:${n}`:typeof n=="boolean"?`b:${n}`:`j:${JSON.stringify(n)}`}function Ct(n){let e=n.substring(0,2),t=n.substring(2);switch(e){case"s:":return t;case"n:":return Number(t);case"b:":return t==="true";case"j:":return I(t);default:throw new Error(`Unknown serialization type: ${e}`)}}function j(n){let e=new Map,t=new Map,s=0,r=Date.now(),c=0;function a(u){let d=`${n}:`;if(!u.startsWith(d))return;let m=u.slice(d.length),p=/^(-?\d+):(\d+)$/.exec(m);if(!p)return;let g=Number(p[1]),_=Number(p[2]);Number.isSafeInteger(g)&&Number.isSafeInteger(_)&&_<Number.MAX_SAFE_INTEGER&&(c=Math.max(c,_+1))}function T(u){let d=e.get(u);if(!d||d.size===0)return!1;let m=t.get(u);if(!m||m.size===0)return!0;for(let p of d)if(!m.has(p))return!0;return!1}function l(u){let d=e.get(u);if(!d)return new Set;let m=t.get(u)||new Set,p=new Set;for(let g of d)m.has(g)||p.add(g);return p}return{has(u){let d=Ee(u);return T(d)},values(){let u=[];for(let[d]of e)T(d)&&u.push(Ct(d));return u},size(){let u=0;for(let[d]of e)T(d)&&u++;return u},add(u){let d=Ee(u),m=It(n,c++);e.has(d)||e.set(d,new Set),e.get(d).add(m),s++,r=Date.now()},remove(u){let d=Ee(u),m=e.get(d);if(!m||m.size===0)return;t.has(d)||t.set(d,new Set);let p=t.get(d);for(let g of m)p.add(g);s++,r=Date.now()},merge(u){let d=u.getState();this.applyState(d)},getState(){let u={};for(let[m,p]of e)u[m]=Array.from(p);let d={};for(let[m,p]of t)p.size>0&&(d[m]=Array.from(p));return{elements:u,tombstones:d,version:s,lastUpdated:r}},applyState(u){let d=!1;for(let[m,p]of Object.entries(u.elements)){e.has(m)||e.set(m,new Set);let g=e.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),d=!0)}for(let[m,p]of Object.entries(u.tombstones)){t.has(m)||t.set(m,new Set);let g=t.get(m);for(let _ of p)a(_),g.has(_)||(g.add(_),d=!0)}d&&(s=Math.max(s,u.version)+1,r=Date.now())},getNodeId(){return n},clear(){for(let[u,d]of e){t.has(u)||t.set(u,new Set);let m=t.get(u);for(let p of d)m.add(p)}s++,r=Date.now()}}}function H(n,e){let t=j(n);return t.applyState(e),t}var de=R(()=>{"use strict";_e()});function ue(n){let e={...Ot,...n},{nodeId:t,enableDeltaTracking:s,maxDeltaHistory:r}=e,c=new Map,a=new Map,T=new Map,l=new Map,u=0,d=[],m=new Set,p={registers:new Set,gCounters:new Set,pnCounters:new Set,sets:new Set};function g(o,i,E){let f={key:o,type:i,operation:E,timestamp:Date.now(),nodeId:t};for(let ot of m)try{ot(f)}catch(at){console.error("[CRDTStore] Error in change listener:",at)}}function _(o,i){u++,s&&p[o].add(i)}function L(){if(!s||!(p.registers.size>0||p.gCounters.size>0||p.pnCounters.size>0||p.sets.size>0))return;let i={fromVersion:d.length>0?d[d.length-1].toVersion:0,toVersion:u,timestamp:Date.now(),nodeId:t};if(p.registers.size>0){i.registers={};for(let E of p.registers){let f=c.get(E);f&&(i.registers[E]=f.getState())}p.registers.clear()}if(p.gCounters.size>0){i.gCounters={};for(let E of p.gCounters){let f=a.get(E);f&&(i.gCounters[E]=f.getState())}p.gCounters.clear()}if(p.pnCounters.size>0){i.pnCounters={};for(let E of p.pnCounters){let f=T.get(E);f&&(i.pnCounters[E]=f.getState())}p.pnCounters.clear()}if(p.sets.size>0){i.sets={};for(let E of p.sets){let f=l.get(E);f&&(i.sets[E]=f.getState())}p.sets.clear()}for(d.push(i);d.length>r;)d.shift()}let h={getRegister(o){return c.has(o)||c.set(o,M(t)),c.get(o)},setRegister(o,i){h.getRegister(o).set(i),_("registers",o),g(o,"lww-register","set")},hasRegister(o){return c.has(o)},deleteRegister(o){let i=c.delete(o);return i&&_("registers",o),i},getGCounter(o){return a.has(o)||a.set(o,O(t)),a.get(o)},incrementGCounter(o,i){h.getGCounter(o).increment(i),_("gCounters",o),g(o,"g-counter","increment")},hasGCounter(o){return a.has(o)},deleteGCounter(o){let i=a.delete(o);return i&&_("gCounters",o),i},getCounter(o){return T.has(o)||T.set(o,q(t)),T.get(o)},incrementCounter(o,i){h.getCounter(o).increment(i),_("pnCounters",o),g(o,"pn-counter","increment")},decrementCounter(o,i){h.getCounter(o).decrement(i),_("pnCounters",o),g(o,"pn-counter","decrement")},hasCounter(o){return T.has(o)},deleteCounter(o){let i=T.delete(o);return i&&_("pnCounters",o),i},getSet(o){return l.has(o)||l.set(o,j(t)),l.get(o)},addToSet(o,i){h.getSet(o).add(i),_("sets",o),g(o,"or-set","add")},removeFromSet(o,i){h.getSet(o).remove(i),_("sets",o),g(o,"or-set","remove")},hasSet(o){return l.has(o)},deleteSet(o){let i=l.delete(o);return i&&_("sets",o),i},merge(o){let i=o.getState();h.applyState(i)},getState(){L();let o={version:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let[i,E]of c)o.registers[i]=E.getState();for(let[i,E]of a)o.gCounters[i]=E.getState();for(let[i,E]of T)o.pnCounters[i]=E.getState();for(let[i,E]of l)o.sets[i]=E.getState();return o},applyState(o){for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");u=Math.max(u,o.version)+1},getDelta(o){if(L(),d.length===0)return o>=u,null;if(o<d[0].fromVersion){let f=h.getState();return{fromVersion:o,toVersion:u,timestamp:Date.now(),nodeId:t,registers:f.registers,gCounters:f.gCounters,pnCounters:f.pnCounters,sets:f.sets}}let i=d.filter(f=>f.toVersion>o);if(i.length===0)return null;let E={fromVersion:o,toVersion:u,timestamp:Date.now(),nodeId:t,registers:{},gCounters:{},pnCounters:{},sets:{}};for(let f of i)f.registers&&Object.assign(E.registers,f.registers),f.gCounters&&Object.assign(E.gCounters,f.gCounters),f.pnCounters&&Object.assign(E.pnCounters,f.pnCounters),f.sets&&Object.assign(E.sets,f.sets);return Object.keys(E.registers).length===0&&delete E.registers,Object.keys(E.gCounters).length===0&&delete E.gCounters,Object.keys(E.pnCounters).length===0&&delete E.pnCounters,Object.keys(E.sets).length===0&&delete E.sets,E},applyDelta(o){if(o.registers)for(let[i,E]of Object.entries(o.registers))typeof E?.timestamp!="number"||!Number.isFinite(E.timestamp)||(c.has(i)?c.get(i).applyState(E):c.set(i,G(t,E)),_("registers",i),g(i,"lww-register","merge"));if(o.gCounters)for(let[i,E]of Object.entries(o.gCounters))a.has(i)?a.get(i).applyState(E):a.set(i,P(t,E)),_("gCounters",i),g(i,"g-counter","merge");if(o.pnCounters)for(let[i,E]of Object.entries(o.pnCounters))T.has(i)?T.get(i).applyState(E):T.set(i,B(t,E)),_("pnCounters",i),g(i,"pn-counter","merge");if(o.sets)for(let[i,E]of Object.entries(o.sets))l.has(i)?l.get(i).applyState(E):l.set(i,H(t,E)),_("sets",i),g(i,"or-set","merge");u=Math.max(u,o.toVersion)+1},getVersion(){return u},getNodeId(){return t},on(o,i){if(o==="change")return m.add(i),()=>{m.delete(i)};throw new Error(`Unknown event type: ${o}`)},removeAllListeners(){m.clear()},keys(o){let i=[];return(!o||o==="lww-register")&&i.push(...Array.from(c.keys())),(!o||o==="g-counter")&&i.push(...Array.from(a.keys())),(!o||o==="pn-counter")&&i.push(...Array.from(T.keys())),(!o||o==="or-set")&&i.push(...Array.from(l.keys())),i},clear(){c.clear(),a.clear(),T.clear(),l.clear(),d.length=0,p.registers.clear(),p.gCounters.clear(),p.pnCounters.clear(),p.sets.clear(),u=0},getStats(){return{total:c.size+a.size+T.size+l.size,registers:c.size,gCounters:a.size,pnCounters:T.size,sets:l.size,version:u,nodeId:t,deltaHistorySize:d.length}}};return h}var Ot,Qe=R(()=>{"use strict";ce();k();Te();de();Ot={nodeId:"default-node",enableDeltaTracking:!0,maxDeltaHistory:100}});var Je=R(()=>{"use strict"});var Ze=R(()=>{"use strict";ce();k();Te();de();Qe();Je()});var Dt={};ct(Dt,{ALLOWED_TABLE_NAMES:()=>J,BinaryHeap:()=>fe,DEFAULT_UNIFIED_MEMORY_CONFIG:()=>rt,UnifiedHnswIndex:()=>x,UnifiedMemoryManager:()=>y,clearProjectRootCache:()=>z,createHnswIndex:()=>Ne,findProjectRoot:()=>X,getDefaultDbPath:()=>nt,getResolvedDefaultConfig:()=>st,getUnifiedMemory:()=>it,initializeUnifiedMemory:()=>At,resetUnifiedMemory:()=>vt,validateTableName:()=>b});import*as N from"fs";import*as tt from"os";import*as S from"path";function nt(){let n=X();return S.join(n,".agentic-qe","memory.db")}function st(){return{...rt,dbPath:nt()}}function it(n){return y.getInstance(n)}async function At(n){let e=it(n);return await e.initialize(),e}function vt(){y.resetInstance()}function bt(){if(et)return;et=!0;let n=()=>{try{let t=y.instance;t&&t.close()}catch(t){console.debug("[UnifiedMemory] Cleanup error:",t instanceof Error?t.message:t)}};process.on("beforeExit",n),Re(n);let e=t=>{Le(t)||(n(),process.exit(0))};process.on("SIGINT",e),process.on("SIGTERM",e)}var F,rt,y,et,yt=R(()=>{dt();_e();le();ut();Tt();ve();Z();Z();Se();Se();ie();Ve();ee();Ze();Et();_t();F=ge.create("unified-memory");rt={dbPath:".agentic-qe/memory.db",walMode:!0,mmapSize:U.MMAP_SIZE_BYTES,cacheSize:U.CACHE_SIZE_KB,busyTimeout:U.BUSY_TIMEOUT_MS,vectorDimensions:U.DEFAULT_VECTOR_DIMENSIONS};y=class n{static instance=null;static instancePromise=null;db=null;config;initialized=!1;vectorsLoaded=!1;initPromise=null;preparedStatements=new Map;vectorIndex=new x("qe-memory");crdtStore=null;proofGate=null;proofGateEnvChecked=!1;static PROOF_NS="__proofgate__";static PROOF_KEY="chain";constructor(e){let t=st();if(this.config={...t,...e},process.env.AQE_MEMORY_BACKEND==="memory"){this.config.dbPath=":memory:";return}if(this.config.dbPath!==":memory:"&&!S.isAbsolute(this.config.dbPath)){let s=X();this.config.dbPath=S.join(s,this.config.dbPath)}}static getInstance(e){return n.instance||(n.instance=new n(e)),n.instance}static async getInstanceAsync(e){return n.instance?.initialized?n.instance:(n.instancePromise||(n.instancePromise=(async()=>{let t=n.getInstance(e);return await t.initialize(),t})()),n.instancePromise)}static resetInstance(){n.instance&&(n.instance.close(),n.instance=null),n.instancePromise=null,z()}async initialize(e){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize(e?.signal)),this.initPromise}async _doInitialize(e){if(!this.initialized){e?.throwIfAborted();try{let t=this.config.dbPath===":memory:",s="",r=!1,c=0;if(!t){let a=process.env.AQE_PROJECT_ROOT;if(a){let T=S.resolve(this.config.dbPath),l=S.resolve(a);!T.startsWith(l)&&!T.startsWith(tt.tmpdir())&&T.includes(".agentic-qe")&&(console.error(`[UnifiedMemory] WARNING: DB path "${this.config.dbPath}" points to a production .agentic-qe/ while AQE_PROJECT_ROOT="${a}". Redirecting to test-safe path.`),this.config.dbPath=S.join(a,".agentic-qe","memory.db"))}if(s=S.dirname(this.config.dbPath),N.existsSync(s)||N.mkdirSync(s,{recursive:!0}),r=N.existsSync(this.config.dbPath),r)c=N.statSync(this.config.dbPath).size;else if(N.existsSync(s)){let T=this.findRecentBackups(s);if(T.length>0){let l=T[0];console.error(`[UnifiedMemory] CRITICAL: Database file missing but directory exists!
757
757
  Expected: ${this.config.dbPath}
758
- Found ${T.length} backup(s), newest: ${g.path} (${(g.size/1024/1024).toFixed(1)}MB)
759
- Restoring from backup to prevent data loss...`),N.copyFileSync(g.path,this.config.dbPath);for(let u of["-wal","-shm"]){let d=this.config.dbPath+u;N.existsSync(d)&&N.unlinkSync(d)}s=g.size}}}if(e?.throwIfAborted(),this.db=ge(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,autoRestore:!0}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),Ke(this.db,{logPrefix:"[UnifiedMemory]"}),e?.throwIfAborted(),i&&s>1e6)try{let c=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(c&&c.cnt===0){let T=N.statSync(this.config.dbPath).size;T<s*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
760
- DB was ${(s/1024/1024).toFixed(1)}MB, now ${(T/1024/1024).toFixed(1)}MB with 0 patterns.
758
+ Found ${T.length} backup(s), newest: ${l.path} (${(l.size/1024/1024).toFixed(1)}MB)
759
+ Restoring from backup to prevent data loss...`),N.copyFileSync(l.path,this.config.dbPath);for(let u of["-wal","-shm"]){let d=this.config.dbPath+u;N.existsSync(d)&&N.unlinkSync(d)}c=l.size}}}if(e?.throwIfAborted(),this.db=pe(this.config.dbPath,{walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,autoRestore:!0}),this.db.pragma(`mmap_size = ${this.config.mmapSize}`),this.db.pragma(`cache_size = ${this.config.cacheSize}`),this.db.pragma("foreign_keys = ON"),e?.aborted){try{this.db.close()}catch{}this.db=null,e.throwIfAborted()}if(await this.runMigrations(),$e(this.db,{logPrefix:"[UnifiedMemory]"}),e?.throwIfAborted(),r&&c>1e6)try{let a=this.db.prepare("SELECT COUNT(*) as cnt FROM qe_patterns").get();if(a&&a.cnt===0){let T=N.statSync(this.config.dbPath).size;T<c*.1&&console.error(`[UnifiedMemory] CRITICAL: Possible data loss detected!
760
+ DB was ${(c/1024/1024).toFixed(1)}MB, now ${(T/1024/1024).toFixed(1)}MB with 0 patterns.
761
761
  This looks like the DB was replaced with an empty schema.
762
- Check backups in ${r} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${A(t)}`)}}}findRecentBackups(e){try{let r=N.readdirSync(e).filter(s=>s.startsWith("memory")&&s.endsWith(".db")&&s!=="memory.db").map(s=>{let c=S.join(e,s),T=N.statSync(c);return{path:c,size:T.size,mtime:T.mtimeMs}}).filter(s=>s.size>1e6).sort((s,c)=>c.mtime-s.mtime),i=S.join(e,"backups");if(N.existsSync(i)){let s=N.readdirSync(i);for(let c of s)if(c.endsWith(".db")){let T=S.join(i,c),g=N.statSync(T);g.size>1e6&&r.push({path:T,size:g.size,mtime:g.mtimeMs})}r.sort((c,T)=>T.mtime-c.mtime)}return r}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=X(),t=S.resolve(this.config.dbPath),i=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(s=>S.resolve(s)).filter(s=>s!==t&&N.existsSync(s));i.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
762
+ Check backups in ${s} and restore manually.`)}}catch{}this.vectorsLoaded=!1,this.initialized=!0,console.log(`[UnifiedMemory] Initialized: ${this.config.dbPath}`),this.warnIfDuplicateDatabases()}catch(t){throw this.initPromise=null,t instanceof Error&&(t.name==="AbortError"||(e?.aborted??!1))?t:new Error(`Failed to initialize UnifiedMemoryManager: ${A(t)}`)}}}findRecentBackups(e){try{let s=N.readdirSync(e).filter(c=>c.startsWith("memory")&&c.endsWith(".db")&&c!=="memory.db").map(c=>{let a=S.join(e,c),T=N.statSync(a);return{path:a,size:T.size,mtime:T.mtimeMs}}).filter(c=>c.size>1e6).sort((c,a)=>a.mtime-c.mtime),r=S.join(e,"backups");if(N.existsSync(r)){let c=N.readdirSync(r);for(let a of c)if(a.endsWith(".db")){let T=S.join(r,a),l=N.statSync(T);l.size>1e6&&s.push({path:T,size:l.size,mtime:l.mtimeMs})}s.sort((a,T)=>T.mtime-a.mtime)}return s}catch{return[]}}warnIfDuplicateDatabases(){if(this.config.dbPath!==":memory:")try{let e=X(),t=S.resolve(this.config.dbPath),r=[S.join(e,".agentic-qe","memory.db"),S.join(e,"v3",".agentic-qe","memory.db")].map(c=>S.resolve(c)).filter(c=>c!==t&&N.existsSync(c));r.length>0&&console.warn(`[UnifiedMemory] WARNING: Duplicate database(s) detected!
763
763
  Canonical: ${t}
764
- Duplicates: ${i.join(", ")}
765
- This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){F.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let r=b(e);return this.db.prepare(`PRAGMA table_info(${r})`).all().some(s=>s.name===t)}catch(r){return F.debug("Column existence check failed",{table:e,column:t,error:r instanceof Error?r.message:String(r)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:r,columnDef:i}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,r)){let c=b(t);try{this.db.exec(`ALTER TABLE ${c} ADD COLUMN ${r} ${i}`),console.log(`[UnifiedMemory] Added column ${r} to ${t} (safe migration)`)}catch(T){console.log(`[UnifiedMemory] Column ${r} on ${t}: ${T instanceof Error?T.message:String(T)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(Ue),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<C&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${C}`),this.db.transaction(()=>{let c=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return c>=C||(c<1&&this.db.exec(Fe),c<2&&this.db.exec(xe),c<3&&(this.db.exec(we),this.db.exec(ne),this.db.exec(Me)),c<4&&this.db.exec(Pe),c<5&&this.db.exec(qe),c<6&&this.db.exec(W),c<7&&this.db.exec(Be),c<8&&this.db.exec(je),c<9&&(this.db.exec(se),this.db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')")),c<10&&this.db.exec(Y),c<11&&this.migrateToV11GoapExecutionSteps(),c<12&&De(this.db),c<13&&this.migrateToV13EmbeddingSpace(),c<14&&this.db.exec(te),this.db.prepare(`
764
+ Duplicates: ${r.join(", ")}
765
+ This can cause data splits. Remove duplicates or set AQE_PROJECT_ROOT.`)}catch(e){F.debug("Duplicate database check failed",{error:e instanceof Error?e.message:String(e)})}}columnExists(e,t){if(!this.db)return!1;try{let s=b(e);return this.db.prepare(`PRAGMA table_info(${s})`).all().some(c=>c.name===t)}catch(s){return F.debug("Column existence check failed",{table:e,column:t,error:s instanceof Error?s.message:String(s)}),!1}}handleV2SchemaIncompatibilities(){if(!this.db)return;let e=[{table:"goap_plans",requiredColumn:"status",columnDef:"TEXT DEFAULT 'pending'"},{table:"goap_actions",requiredColumn:"agent_type",columnDef:"TEXT DEFAULT 'unknown'"},{table:"concept_nodes",requiredColumn:"concept_type",columnDef:"TEXT DEFAULT 'general'"},{table:"concept_edges",requiredColumn:"edge_type",columnDef:"TEXT DEFAULT 'related'"},{table:"dream_insights",requiredColumn:"cycle_id",columnDef:"TEXT DEFAULT ''"},{table:"rl_q_values",requiredColumn:"algorithm",columnDef:"TEXT DEFAULT 'q-learning'"}];for(let{table:t,requiredColumn:s,columnDef:r}of e)if(this.db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name=?").get(t)&&!this.columnExists(t,s)){let a=b(t);try{this.db.exec(`ALTER TABLE ${a} ADD COLUMN ${s} ${r}`),console.log(`[UnifiedMemory] Added column ${s} to ${t} (safe migration)`)}catch(T){console.log(`[UnifiedMemory] Column ${s} on ${t}: ${T instanceof Error?T.message:String(T)}`)}}}async runMigrations(){if(!this.db)throw new Error("Database not initialized");this.db.exec(Fe),this.handleV2SchemaIncompatibilities();let t=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;t<C&&(console.log(`[UnifiedMemory] Migrating from v${t} to v${C}`),this.db.transaction(()=>{let a=this.db.prepare("SELECT version FROM schema_version WHERE id = 1").get()?.version??0;return a>=C||(a<1&&this.db.exec(xe),a<2&&this.db.exec(we),a<3&&(this.db.exec(Me),this.db.exec(ne),this.db.exec(Ge)),a<4&&this.db.exec(ke),a<5&&this.db.exec(Be),a<6&&this.db.exec(W),a<7&&this.db.exec(je),a<8&&this.db.exec(He),a<9&&(this.db.exec(se),this.db.exec("INSERT INTO qe_patterns_fts(qe_patterns_fts) VALUES('rebuild')")),a<10&&this.db.exec(Y),a<11&&this.migrateToV11GoapExecutionSteps(),a<12&&ye(this.db),a<13&&this.migrateToV13EmbeddingSpace(),a<14&&this.db.exec(te),this.db.prepare(`
766
766
  INSERT OR REPLACE INTO schema_version (id, version, migrated_at)
767
767
  VALUES (1, ?, datetime('now'))
768
- `).run(C)),c}).immediate()>=C?console.log(`[UnifiedMemory] Another process completed the migration to v${C}`):console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(ne);let t=(r,i,s)=>{e.prepare(`SELECT name FROM pragma_table_info('${r}')`).all().some(T=>T.name===i)||e.exec(`ALTER TABLE ${r} ADD COLUMN ${i} ${s}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let r=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,r)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,r="default",i){this.ensureInitialized();let s=i?Date.now()+i*1e3:null,c=JSON.stringify(t);this.db.prepare(`
768
+ `).run(C)),a}).immediate()>=C?console.log(`[UnifiedMemory] Another process completed the migration to v${C}`):console.log("[UnifiedMemory] Migration complete"))}migrateToV11GoapExecutionSteps(){let e=this.db;e.exec(ne);let t=(s,r,c)=>{e.prepare(`SELECT name FROM pragma_table_info('${s}')`).all().some(T=>T.name===r)||e.exec(`ALTER TABLE ${s} ADD COLUMN ${r} ${c}`)};t("goap_execution_steps","execution_id","TEXT"),t("goap_execution_steps","retries","INTEGER DEFAULT 0"),t("goap_execution_steps","started_at","TEXT"),t("goap_execution_steps","agent_output","TEXT"),t("goap_actions","method","TEXT"),t("goap_actions","params","TEXT"),t("goap_actions","implemented","INTEGER DEFAULT 0"),e.exec("CREATE INDEX IF NOT EXISTS idx_goap_exec_steps_execution ON goap_execution_steps(execution_id)")}async loadVectorIndex(){if(this.vectorsLoaded)return;if(!this.db)throw new Error("Database not initialized");this.vectorIndex.clear();let e=this.db.prepare("SELECT id, embedding, dimensions FROM vectors").all();for(let t of e){let s=this.bufferToFloatArray(t.embedding,t.dimensions);this.vectorIndex.add(t.id,s)}this.vectorsLoaded=!0,console.log(`[UnifiedMemory] Loaded ${e.length} vectors into vector index (ruvector flat)`)}async kvSet(e,t,s="default",r){this.ensureInitialized();let c=r?Date.now()+r*1e3:null,a=JSON.stringify(t);this.db.prepare(`
769
769
  INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
770
770
  VALUES (?, ?, ?, ?)
771
- `).run(e,r,c,s),this.auditWrite("kvSet",r,e,c)}async kvGet(e,t="default"){this.ensureInitialized();let r=this.db.prepare(`
771
+ `).run(e,s,a,c),this.auditWrite("kvSet",s,e,a)}async kvGet(e,t="default"){this.ensureInitialized();let s=this.db.prepare(`
772
772
  SELECT value, expires_at FROM kv_store
773
773
  WHERE key = ? AND namespace = ?
774
- `).get(e,t);if(r){if(r.expires_at&&Date.now()>r.expires_at){this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return}return I(r.value)}}async kvDelete(e,t="default"){this.ensureInitialized();let r=this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return r.changes>0&&this.auditWrite("kvDelete",t,e,""),r.changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
774
+ `).get(e,t);if(s){if(s.expires_at&&Date.now()>s.expires_at){this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return}return I(s.value)}}async kvDelete(e,t="default"){this.ensureInitialized();let s=this.db.prepare("DELETE FROM kv_store WHERE key = ? AND namespace = ?").run(e,t);return s.changes>0&&this.auditWrite("kvDelete",t,e,""),s.changes>0}async kvExists(e,t="default"){return this.ensureInitialized(),this.db.prepare(`
775
775
  SELECT 1 FROM kv_store
776
776
  WHERE key = ? AND namespace = ? AND (expires_at IS NULL OR expires_at > ?)
777
- `).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",r=100){this.ensureInitialized();let i=e.replace(/[!%_]/g,"!$&").replace(/\*/g,"%").replace(/\?/g,"_");return this.db.prepare(`
777
+ `).get(e,t,Date.now())!==void 0}async kvSearch(e,t="default",s=100){this.ensureInitialized();let r=e.replace(/[!%_]/g,"!$&").replace(/\*/g,"%").replace(/\?/g,"_");return this.db.prepare(`
778
778
  SELECT key FROM kv_store
779
779
  WHERE namespace = ? AND key LIKE ? ESCAPE '!'
780
780
  AND (expires_at IS NULL OR expires_at > ?)
781
781
  LIMIT ?
782
- `).all(t,i,Date.now(),r).map(c=>c.key)}async kvCleanupExpired(){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()).changes}enableProofGate(){this.ensureInitialized(),this.proofGateEnvChecked=!0,!this.proofGate&&(this.proofGate=this.loadProofChain()??new v)}isProofGateEnabled(){return this.proofGate!==null}verifyMemoryIntegrity(){if(!this.proofGate)throw new Error("Proof-gate not enabled \u2014 call enableProofGate() or set AQE_PROOF_GATE=1");return this.proofGate.verifyIntegrity()}getProofChainRoot(){return this.proofGate?this.proofGate.chainRoot():null}getProofChainLength(){return this.proofGate?this.proofGate.length:0}auditWrite(e,t,r,i){if(!this.proofGate){if(this.proofGateEnvChecked||(this.proofGateEnvChecked=!0,process.env.AQE_PROOF_GATE!=="1"))return;this.proofGate=this.loadProofChain()??new v}if(t!==n.PROOF_NS)try{this.proofGate.admit({op:e,ns:t,key:r,value:i}),this.persistProofChain()}catch(s){F.warn(`proof-gate audit skipped for ${t}/${r}: ${A(s)}`)}}persistProofChain(){!this.proofGate||!this.db||this.db.prepare(`
782
+ `).all(t,r,Date.now(),s).map(a=>a.key)}async kvCleanupExpired(){return this.ensureInitialized(),this.db.prepare("DELETE FROM kv_store WHERE expires_at IS NOT NULL AND expires_at < ?").run(Date.now()).changes}enableProofGate(){this.ensureInitialized(),this.proofGateEnvChecked=!0,!this.proofGate&&(this.proofGate=this.loadProofChain()??new v)}isProofGateEnabled(){return this.proofGate!==null}verifyMemoryIntegrity(){if(!this.proofGate)throw new Error("Proof-gate not enabled \u2014 call enableProofGate() or set AQE_PROOF_GATE=1");return this.proofGate.verifyIntegrity()}getProofChainRoot(){return this.proofGate?this.proofGate.chainRoot():null}getProofChainLength(){return this.proofGate?this.proofGate.length:0}auditWrite(e,t,s,r){if(!this.proofGate){if(this.proofGateEnvChecked||(this.proofGateEnvChecked=!0,process.env.AQE_PROOF_GATE!=="1"))return;this.proofGate=this.loadProofChain()??new v}if(t!==n.PROOF_NS)try{this.proofGate.admit({op:e,ns:t,key:s,value:r}),this.persistProofChain()}catch(c){F.warn(`proof-gate audit skipped for ${t}/${s}: ${A(c)}`)}}persistProofChain(){!this.proofGate||!this.db||this.db.prepare(`
783
783
  INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at)
784
784
  VALUES (?, ?, ?, NULL)
785
785
  `).run(n.PROOF_KEY,n.PROOF_NS,JSON.stringify(this.proofGate.toJSON()))}loadProofChain(){if(!this.db)return null;let e=this.db.prepare(`
786
786
  SELECT value FROM kv_store WHERE key = ? AND namespace = ?
787
- `).get(n.PROOF_KEY,n.PROOF_NS);if(!e)return null;try{return v.fromJSON(JSON.parse(e.value))}catch(t){return F.warn(`proof-gate chain failed to load (starting fresh): ${A(t)}`),null}}async vectorStore(e,t,r="default",i){this.ensureInitialized();let s=this.floatArrayToBuffer(t),c=i?JSON.stringify(i):null;this.db.prepare(`
787
+ `).get(n.PROOF_KEY,n.PROOF_NS);if(!e)return null;try{return v.fromJSON(JSON.parse(e.value))}catch(t){return F.warn(`proof-gate chain failed to load (starting fresh): ${A(t)}`),null}}async vectorStore(e,t,s="default",r){this.ensureInitialized();let c=this.floatArrayToBuffer(t),a=r?JSON.stringify(r):null;this.db.prepare(`
788
788
  INSERT OR REPLACE INTO vectors (id, namespace, embedding, dimensions, metadata, updated_at)
789
789
  VALUES (?, ?, ?, ?, ?, datetime('now'))
790
- `).run(e,r,s,t.length,c),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
790
+ `).run(e,s,c,t.length,a),this.vectorIndex.add(e,t)}async vectorGet(e){this.ensureInitialized();let t=this.db.prepare(`
791
791
  SELECT embedding, dimensions, metadata FROM vectors WHERE id = ?
792
- `).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,r,i){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let s=this.vectorIndex.size(),c=!!(r||i),T=Math.min(s,Math.max(c?t*2:t,1)),g=r?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(r):void 0,u=g?new Map(g.map(l=>[l.id,l])):void 0,d=this.vectorIndex.search(e,T);for(;c&&d.filter(l=>(!i||l.id.startsWith(i))&&(!u||u.has(l.id))).length<t&&T<s;)T=Math.min(s,T*2),d=this.vectorIndex.search(e,T);if(d.length===0)return[];let m=u??(()=>{let l=d.map(h=>h.id),p=l.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${p})`).all(...l);return new Map(L.map(h=>[h.id,h]))})();if(r){let l=[];for(let p of d){let L=m.get(p.id);if(L&&L.namespace===r&&(!i||p.id.startsWith(i))&&(l.push({id:p.id,score:p.score,metadata:L.metadata?I(L.metadata):void 0}),l.length>=t))break}return l}return(i?d.filter(l=>l.id.startsWith(i)).slice(0,t):d.slice(0,t)).map(l=>{let p=m.get(l.id);return{id:l.id,score:l.score,metadata:p?.metadata?I(p.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(ke);return}e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(i=>i.name==="space_id")||e.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),e.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)")}getVectorSearchProvenance(){return this.vectorIndex.getProvider().isNativeBackend()?{backend:"native-hnsw",indexType:"hnsw",approximate:!0,estimatedRecall:this.vectorIndex.recall(),qualifiedMaxK:pe.EF_SEARCH}:{backend:"progressive-hnsw",indexType:"flat",approximate:!1,estimatedRecall:1}}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=b(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=de({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,r="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,r)}async crdtGet(e,t="crdt"){if(this.crdtStore){let r=this.crdtStore.getRegister(e);if(r)return r.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let r=this.crdtStore.getCounter(e);r||(this.crdtStore.incrementCounter(e,0),r=this.crdtStore.getCounter(e));for(let i=0;i<t;i++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let r=this.preparedStatements.get(e);return r||(r=this.db.prepare(t),this.preparedStatements.set(e,r)),r}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=He.map(i=>{try{let s=this.db.prepare(`SELECT COUNT(*) as count FROM ${i}`).get();return{name:i,rowCount:s.count}}catch(s){return F.debug("Table row count query failed",{table:i,error:s instanceof Error?s.message:String(s)}),{name:i,rowCount:0}}}),t=0,r=0;try{N.existsSync(this.config.dbPath)&&(t=N.statSync(this.config.dbPath).size);let i=this.config.dbPath+"-wal";N.existsSync(i)&&(r=N.statSync(i).size)}catch(i){console.debug("[UnifiedMemory] File stat error:",i instanceof Error?i.message:i)}return{tables:e,fileSize:t,walSize:r,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let r=0;r<e.length;r++)t.writeFloatLE(e[r],r*4);return t}bufferToFloatArray(e,t){let r=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(r)}};Ze=!1;vt()});export{J as a,b,Ut as c,Z as d,be as e,ee as f,ye as g,Nt as h,Xe as i,se as j,ie as k,Ke as l,$e as m,tt as n,nt as o,rt as p,y as q,st as r,Ot as s,At as t,bt as u,Dt as v};
792
+ `).get(e);if(t)return{embedding:this.bufferToFloatArray(t.embedding,t.dimensions),metadata:t.metadata?I(t.metadata):void 0}}async vectorDelete(e){this.ensureInitialized();let t=this.db.prepare("DELETE FROM vectors WHERE id = ?").run(e);return this.vectorIndex.remove(e),t.changes>0}async vectorSearch(e,t=10,s,r){if(this.ensureInitialized(),!Number.isInteger(t)||t<=0)return[];this.vectorsLoaded||await this.loadVectorIndex();let c=this.vectorIndex.size(),a=!!(s||r),T=Math.min(c,Math.max(a?t*2:t,1)),l=s?this.db.prepare("SELECT id, namespace, metadata FROM vectors WHERE namespace = ?").all(s):void 0,u=l?new Map(l.map(g=>[g.id,g])):void 0,d=this.vectorIndex.search(e,T);for(;a&&d.filter(g=>(!r||g.id.startsWith(r))&&(!u||u.has(g.id))).length<t&&T<c;)T=Math.min(c,T*2),d=this.vectorIndex.search(e,T);if(d.length===0)return[];let m=u??(()=>{let g=d.map(h=>h.id),_=g.map(()=>"?").join(","),L=this.db.prepare(`SELECT id, namespace, metadata FROM vectors WHERE id IN (${_})`).all(...g);return new Map(L.map(h=>[h.id,h]))})();if(s){let g=[];for(let _ of d){let L=m.get(_.id);if(L&&L.namespace===s&&(!r||_.id.startsWith(r))&&(g.push({id:_.id,score:_.score,metadata:L.metadata?I(L.metadata):void 0}),g.length>=t))break}return g}return(r?d.filter(g=>g.id.startsWith(r)).slice(0,t):d.slice(0,t)).map(g=>{let _=m.get(g.id);return{id:g.id,score:g.score,metadata:_?.metadata?I(_.metadata):void 0}})}migrateToV13EmbeddingSpace(){let e=this.db;if(!e.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='qe_pattern_embeddings'").get()){e.exec(qe);return}e.prepare("PRAGMA table_info('qe_pattern_embeddings')").all().some(r=>r.name==="space_id")||e.exec("ALTER TABLE qe_pattern_embeddings ADD COLUMN space_id TEXT"),e.exec("CREATE INDEX IF NOT EXISTS idx_qe_pattern_embeddings_space ON qe_pattern_embeddings(space_id)")}getVectorSearchProvenance(){return this.vectorIndex.getProvider().isNativeBackend()?{backend:"native-hnsw",indexType:"hnsw",approximate:!0,estimatedRecall:this.vectorIndex.recall(),qualifiedMaxK:me.EF_SEARCH}:{backend:"progressive-hnsw",indexType:"flat",approximate:!1,estimatedRecall:1}}async vectorCount(e){return this.ensureInitialized(),e?this.db.prepare("SELECT COUNT(*) as count FROM vectors WHERE namespace = ?").get(e).count:this.db.prepare("SELECT COUNT(*) as count FROM vectors").get().count}queryCount(e){this.ensureInitialized();let t=b(e);return this.db.prepare(`SELECT COUNT(*) as c FROM ${t}`).get().c}initializeCRDT(e){if(this.crdtStore){console.warn("[UnifiedMemory] CRDT store already initialized");return}this.crdtStore=ue({nodeId:e}),console.log(`[UnifiedMemory] CRDT store initialized for node: ${e}`)}getCRDTStore(){return this.crdtStore}isCRDTInitialized(){return this.crdtStore!==null}async crdtSet(e,t,s="crdt"){this.ensureInitialized(),this.crdtStore&&this.crdtStore.setRegister(e,t),await this.kvSet(e,t,s)}async crdtGet(e,t="crdt"){if(this.crdtStore){let s=this.crdtStore.getRegister(e);if(s)return s.get()}return this.kvGet(e,t)}crdtIncrement(e,t=1){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");let s=this.crdtStore.getCounter(e);s||(this.crdtStore.incrementCounter(e,0),s=this.crdtStore.getCounter(e));for(let r=0;r<t;r++)this.crdtStore.incrementCounter(e)}crdtGetCounter(e){return this.crdtStore?this.crdtStore.getCounter(e)?.get()??0:0}crdtAddToSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.addToSet(e,t)}crdtRemoveFromSet(e,t){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.removeFromSet(e,t)}crdtGetSet(e){if(!this.crdtStore)return new Set;let t=this.crdtStore.getSet(e);return new Set(t.values())}crdtGetState(){return this.crdtStore?this.crdtStore.getState():null}crdtGetDelta(e){return this.crdtStore?this.crdtStore.getDelta(e??0):null}crdtMerge(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyState(e)}crdtApplyDelta(e){if(!this.crdtStore)throw new Error("CRDT store not initialized. Call initializeCRDT first.");this.crdtStore.applyDelta(e)}async crdtPersist(){if(!this.crdtStore)return;let e=this.crdtStore.getState();await this.kvSet("__crdt_state__",e,"crdt-internal")}async crdtRestore(){if(!this.crdtStore)return!1;let e=await this.kvGet("__crdt_state__","crdt-internal");return e?(this.crdtStore.applyState(e),!0):!1}getDatabase(){if(!this.db||!this.initialized)throw new Error("UnifiedMemoryManager not initialized");return this.db}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(e,t){if(!this.db)throw new Error("Database not initialized");let s=this.preparedStatements.get(e);return s||(s=this.db.prepare(t),this.preparedStatements.set(e,s)),s}transaction(e){if(!this.db)throw new Error("Database not initialized");return this.db.transaction(e)()}getStats(){if(!this.db)throw new Error("Database not initialized");let e=ze.map(r=>{try{let c=this.db.prepare(`SELECT COUNT(*) as count FROM ${r}`).get();return{name:r,rowCount:c.count}}catch(c){return F.debug("Table row count query failed",{table:r,error:c instanceof Error?c.message:String(c)}),{name:r,rowCount:0}}}),t=0,s=0;try{N.existsSync(this.config.dbPath)&&(t=N.statSync(this.config.dbPath).size);let r=this.config.dbPath+"-wal";N.existsSync(r)&&(s=N.statSync(r).size)}catch(r){console.debug("[UnifiedMemory] File stat error:",r instanceof Error?r.message:r)}return{tables:e,fileSize:t,walSize:s,vectorIndexSize:this.vectorIndex.size()}}vacuum(){if(!this.db)throw new Error("Database not initialized");this.db.exec("VACUUM")}checkpoint(){if(!this.db)throw new Error("Database not initialized");this.db.pragma("wal_checkpoint(TRUNCATE)")}close(){this.db&&(this.preparedStatements.clear(),this.vectorIndex.clear(),this.db.close(),this.db=null,this.initialized=!1,console.log("[UnifiedMemory] Database closed"))}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("UnifiedMemoryManager not initialized. Call initialize() first.")}floatArrayToBuffer(e){let t=Buffer.alloc(e.length*4);for(let s=0;s<e.length;s++)t.writeFloatLE(e[s],s*4);return t}bufferToFloatArray(e,t){let s=new Float32Array(e.buffer,e.byteOffset,t);return Array.from(s)}};et=!1;bt()});export{J as a,b,Ft as c,Z as d,De as e,ee as f,Xe as g,St as h,Ue as i,se as j,ie as k,$e as l,Ve as m,nt as n,rt as o,st as p,y as q,it as r,At as s,vt as t,Dt as u,yt as v};