agentic-qe 3.10.3 → 3.10.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/.claude/skills/qcsd-development-swarm/SKILL.md +27 -6
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +104 -0
  4. package/assets/skills/skills-manifest.json +1 -1
  5. package/dist/arena/arena.d.ts +68 -0
  6. package/dist/arena/arena.js +169 -0
  7. package/dist/arena/mutator.d.ts +23 -0
  8. package/dist/arena/mutator.js +112 -0
  9. package/dist/arena/rng.d.ts +15 -0
  10. package/dist/arena/rng.js +34 -0
  11. package/dist/arena/runner.d.ts +44 -0
  12. package/dist/arena/runner.js +79 -0
  13. package/dist/cli/bundle.js +7 -7
  14. package/dist/cli/chunks/adapter-XZVL3DHO.js +2 -0
  15. package/dist/cli/chunks/{agent-booster-wasm-NGC6LSQP.js → agent-booster-wasm-3BC5LIEB.js} +2 -2
  16. package/dist/cli/chunks/{agent-handler-P2IJE4GK.js → agent-handler-QLXWVZZF.js} +2 -2
  17. package/dist/cli/chunks/{agent-memory-branch-JXRJ5GKQ.js → agent-memory-branch-3U5PDYW7.js} +2 -2
  18. package/dist/cli/chunks/aqe-learning-engine-YIL25K6W.js +2 -0
  19. package/dist/cli/chunks/arena-BMJQK4RD.js +18 -0
  20. package/dist/cli/chunks/arena-XENAGV4I.js +4 -0
  21. package/dist/cli/chunks/audit-WPIRUJNZ.js +3 -0
  22. package/dist/cli/chunks/base-YCYV23Q3.js +2 -0
  23. package/dist/cli/chunks/{hnswlib-node-64EGGWIC.js → better-sqlite3-6AGIBSVE.js} +2 -2
  24. package/dist/cli/chunks/{brain-handler-SACNDFSW.js → brain-handler-PHSWG5PR.js} +3 -3
  25. package/dist/cli/chunks/{branch-enumerator-LFOTVUDA.js → branch-enumerator-LNSYT34I.js} +2 -2
  26. package/dist/cli/chunks/{browser-FK7PRF3W.js → browser-M5BVQMBI.js} +2 -2
  27. package/dist/cli/chunks/browser-workflow-ALCOCRA2.js +2 -0
  28. package/dist/cli/chunks/{chunk-ZXQNE4QV.js → chunk-24A7KD3D.js} +1 -1
  29. package/dist/cli/chunks/{chunk-6Q2PPOOF.js → chunk-253TDTPH.js} +1 -1
  30. package/dist/cli/chunks/{chunk-MC7K44M4.js → chunk-2RLRPKCG.js} +2 -2
  31. package/dist/cli/chunks/{chunk-VRXY4T22.js → chunk-2UQWVF4P.js} +2 -2
  32. package/dist/cli/chunks/{chunk-UDV4YB42.js → chunk-2Z7HIT5I.js} +1 -1
  33. package/dist/cli/chunks/{chunk-CTDO2UB2.js → chunk-3BGGNHHZ.js} +1 -1
  34. package/dist/cli/chunks/{chunk-HWM2XJ3P.js → chunk-3JWV4GE6.js} +2 -2
  35. package/dist/cli/chunks/{chunk-BT3QLWII.js → chunk-3KGUP2SD.js} +2 -2
  36. package/dist/cli/chunks/{chunk-T63EK6GH.js → chunk-3WOQY6UL.js} +2 -2
  37. package/dist/cli/chunks/{chunk-QM65UGPV.js → chunk-4FTO3TPH.js} +2 -2
  38. package/dist/cli/chunks/{chunk-WWD5IWTV.js → chunk-4K7T6AKM.js} +1 -1
  39. package/dist/cli/chunks/{chunk-XTP2GHI7.js → chunk-4Z7XH4JE.js} +2 -2
  40. package/dist/cli/chunks/{chunk-FND6V2RV.js → chunk-54IPDQIZ.js} +8 -8
  41. package/dist/cli/chunks/{chunk-KTRB3L53.js → chunk-56RA6YPN.js} +2 -2
  42. package/dist/cli/chunks/{chunk-7YYTTWGY.js → chunk-5D7GLMT3.js} +1 -1
  43. package/dist/cli/chunks/{chunk-M5CDW2ZH.js → chunk-66LOFIBP.js} +2 -2
  44. package/dist/cli/chunks/{chunk-3X2ZQ55B.js → chunk-6SAU7GXO.js} +3 -3
  45. package/dist/cli/chunks/{chunk-DF3MJ2YL.js → chunk-75MP7JMV.js} +1 -1
  46. package/dist/cli/chunks/{chunk-RTDHWOAG.js → chunk-7DU35D4M.js} +1 -1
  47. package/dist/cli/chunks/{chunk-Q7EBD24B.js → chunk-7JZCEQFR.js} +1 -1
  48. package/dist/cli/chunks/{chunk-JXIPRMAY.js → chunk-A3BDPU5F.js} +4 -4
  49. package/dist/cli/chunks/{chunk-I42R57ON.js → chunk-A7HGS7FW.js} +2 -2
  50. package/dist/cli/chunks/{chunk-NNZMEYLT.js → chunk-AMBIOEMO.js} +1 -1
  51. package/dist/cli/chunks/{chunk-BO2OV2RH.js → chunk-AVQD7KEN.js} +2 -2
  52. package/dist/cli/chunks/{chunk-6GCOIIHY.js → chunk-AZCKTAUI.js} +2 -2
  53. package/dist/cli/chunks/{chunk-GL3HZN3O.js → chunk-B4F5EPNR.js} +1 -1
  54. package/dist/cli/chunks/{chunk-HAO3SPOE.js → chunk-BB7MEGXD.js} +2 -2
  55. package/dist/cli/chunks/{chunk-VDTFRMES.js → chunk-BSRCL6RU.js} +2 -2
  56. package/dist/cli/chunks/{chunk-RZCAA2PZ.js → chunk-CS3UB2OL.js} +1 -1
  57. package/dist/cli/chunks/{chunk-4OUAHZX2.js → chunk-CTG3GJIM.js} +2 -2
  58. package/dist/cli/chunks/{chunk-BWP3UVPE.js → chunk-CUAM34RQ.js} +3 -3
  59. package/dist/cli/chunks/chunk-CUY2EUSQ.js +2 -0
  60. package/dist/cli/chunks/{chunk-X2B7SANM.js → chunk-D3Q4443B.js} +1 -1
  61. package/dist/cli/chunks/{chunk-5IBJURYB.js → chunk-D4WDJ4ZF.js} +2 -2
  62. package/dist/cli/chunks/chunk-D7NKRCIL.js +2 -0
  63. package/dist/cli/chunks/{chunk-JP63XACW.js → chunk-DBR4TQPK.js} +2 -2
  64. package/dist/cli/chunks/{chunk-FLTPHVZ3.js → chunk-DIJ74M7V.js} +1 -1
  65. package/dist/cli/chunks/{chunk-PFCAMX6H.js → chunk-DJQYZ4RZ.js} +1 -1
  66. package/dist/cli/chunks/{chunk-5LON3MLI.js → chunk-DN65ILSI.js} +2 -2
  67. package/dist/cli/chunks/{chunk-6ZK24V2Y.js → chunk-DWLGFYXV.js} +2 -2
  68. package/dist/cli/chunks/{chunk-5EWWA4QP.js → chunk-EIL7FQC4.js} +6 -6
  69. package/dist/cli/chunks/{chunk-IRR7YA3Q.js → chunk-FE3FGMNB.js} +2 -2
  70. package/dist/cli/chunks/{chunk-ADV4DH3W.js → chunk-FLYFNNSN.js} +3 -3
  71. package/dist/cli/chunks/{chunk-SWOG3PBD.js → chunk-FNJZBIR3.js} +2 -2
  72. package/dist/cli/chunks/chunk-FPWA73N6.js +2 -0
  73. package/dist/cli/chunks/{chunk-NEYYLAYS.js → chunk-FW3C4LWU.js} +2 -2
  74. package/dist/cli/chunks/{chunk-5G5AAEFF.js → chunk-G4GX6YKX.js} +2 -2
  75. package/dist/cli/chunks/{chunk-NNVXHC74.js → chunk-G5UIGH4C.js} +3 -3
  76. package/dist/cli/chunks/{chunk-QEODION5.js → chunk-G6FP3S3G.js} +2 -2
  77. package/dist/cli/chunks/{chunk-ZG4P3DTL.js → chunk-GDUGW6FZ.js} +2 -2
  78. package/dist/cli/chunks/{chunk-GJUGSH7T.js → chunk-GKG6IQP6.js} +3 -3
  79. package/dist/cli/chunks/chunk-GMU7P5O3.js +2 -0
  80. package/dist/cli/chunks/{chunk-NRCL3WCP.js → chunk-GTVXVYKE.js} +2 -2
  81. package/dist/cli/chunks/{chunk-2ULVCLOW.js → chunk-HHEHGERJ.js} +2 -2
  82. package/dist/cli/chunks/{chunk-6FL3GN4T.js → chunk-HKJ3LG3N.js} +2 -2
  83. package/dist/cli/chunks/{chunk-E2BJT6A7.js → chunk-HNYSBE5J.js} +2 -2
  84. package/dist/cli/chunks/{chunk-JTZ3Q2QS.js → chunk-HPKYIK7R.js} +2 -2
  85. package/dist/cli/chunks/{chunk-GHNNJHH3.js → chunk-HRORJ352.js} +2 -2
  86. package/dist/cli/chunks/{chunk-5ER3COX3.js → chunk-IIFCTJOF.js} +2 -2
  87. package/dist/cli/chunks/{chunk-UIJFU4KD.js → chunk-IOE6LDPF.js} +2 -2
  88. package/dist/cli/chunks/{chunk-JD2PG4KS.js → chunk-IRS4HKAR.js} +1 -1
  89. package/dist/cli/chunks/{chunk-VIWIO27R.js → chunk-IT7CEHAJ.js} +2 -2
  90. package/dist/cli/chunks/{chunk-JE3C7JYN.js → chunk-IUKERFLT.js} +1 -1
  91. package/dist/cli/chunks/{chunk-YDKYLNKZ.js → chunk-IVKSZNMI.js} +1 -1
  92. package/dist/cli/chunks/{chunk-3RZL4QTT.js → chunk-IWRORKD7.js} +2 -2
  93. package/dist/cli/chunks/{chunk-NZHOKLII.js → chunk-J533CJUN.js} +3 -3
  94. package/dist/cli/chunks/{chunk-5SGEOO2F.js → chunk-JPOEI7CJ.js} +2 -2
  95. package/dist/cli/chunks/{chunk-MBSJ5G4I.js → chunk-JY7T2AQQ.js} +4 -4
  96. package/dist/cli/chunks/{chunk-4QFAUSWQ.js → chunk-K5KKZWED.js} +2 -2
  97. package/dist/cli/chunks/{chunk-L74CHKFR.js → chunk-KIMJPTHD.js} +2 -2
  98. package/dist/cli/chunks/{chunk-N7IBYDW5.js → chunk-MEN3UW7W.js} +1 -1
  99. package/dist/cli/chunks/{chunk-UHDBM7QS.js → chunk-MFQIJ3HV.js} +2 -2
  100. package/dist/cli/chunks/{chunk-SL6YZAT4.js → chunk-MGCW5FWH.js} +2 -2
  101. package/dist/cli/chunks/{chunk-U6UK3UMX.js → chunk-MIMJVKJJ.js} +3 -3
  102. package/dist/cli/chunks/{chunk-7ZSPCGTI.js → chunk-MJRYHHOG.js} +2 -2
  103. package/dist/cli/chunks/{chunk-FU77CDEM.js → chunk-MRXKIXVV.js} +2 -2
  104. package/dist/cli/chunks/{chunk-DY5KEOHX.js → chunk-MWPFUBXS.js} +2 -2
  105. package/dist/cli/chunks/{chunk-C6BBRM2J.js → chunk-N2TJXGHG.js} +1 -1
  106. package/dist/cli/chunks/{chunk-MQOFFRTA.js → chunk-NGSA53GC.js} +2 -2
  107. package/dist/cli/chunks/{chunk-YXH2CVAF.js → chunk-NKW7VOZV.js} +1 -1
  108. package/dist/cli/chunks/{chunk-YIYV2JB6.js → chunk-O5OOUMBB.js} +2 -2
  109. package/dist/cli/chunks/{chunk-HM523MTQ.js → chunk-OATHXZYW.js} +1 -1
  110. package/dist/cli/chunks/{chunk-WPVCSFDA.js → chunk-OJNG6ZXG.js} +2 -2
  111. package/dist/cli/chunks/{chunk-7SEHQTYD.js → chunk-PGNQR2VM.js} +1 -1
  112. package/dist/cli/chunks/{chunk-UZL366ZI.js → chunk-PPM5D7LH.js} +1 -1
  113. package/dist/cli/chunks/{chunk-ERYMAYJW.js → chunk-PYBVFG6T.js} +2 -2
  114. package/dist/cli/chunks/{chunk-FJGSEPFL.js → chunk-Q6BKJZTG.js} +2 -2
  115. package/dist/cli/chunks/chunk-QAW6RVAR.js +699 -0
  116. package/dist/cli/chunks/chunk-QTDZS4U6.js +2 -0
  117. package/dist/cli/chunks/{chunk-USFZ4IJD.js → chunk-R573V37S.js} +15 -15
  118. package/dist/cli/chunks/{chunk-Z2K5IZM6.js → chunk-RCAIOTIF.js} +2 -2
  119. package/dist/cli/chunks/{chunk-7RMZAVGO.js → chunk-RFNEEDPQ.js} +2 -2
  120. package/dist/cli/chunks/{chunk-IL2KOW5W.js → chunk-RFVZMNYX.js} +2 -2
  121. package/dist/cli/chunks/{chunk-B5MMDMH6.js → chunk-RLU7764Y.js} +2 -2
  122. package/dist/cli/chunks/chunk-RLZDXQNM.js +2 -0
  123. package/dist/cli/chunks/{chunk-QWG76RHA.js → chunk-RONMVGCT.js} +2 -2
  124. package/dist/cli/chunks/{chunk-X3RJ6SFC.js → chunk-RR55MLD4.js} +1 -1
  125. package/dist/cli/chunks/{chunk-PL5SLO2W.js → chunk-RUQV3BTV.js} +1 -1
  126. package/dist/cli/chunks/{chunk-NXPFGPHV.js → chunk-RZ7D5SHS.js} +1 -1
  127. package/dist/cli/chunks/{chunk-3LRK7PYN.js → chunk-S73KENCH.js} +2 -2
  128. package/dist/cli/chunks/{chunk-3HBWDG62.js → chunk-S7FGTHFE.js} +2 -2
  129. package/dist/cli/chunks/{chunk-CAMEFWRK.js → chunk-S7HQOGVD.js} +1 -1
  130. package/dist/cli/chunks/{chunk-PZHZPX3O.js → chunk-SK6YRNXI.js} +2 -2
  131. package/dist/cli/chunks/{chunk-JTF6D2RJ.js → chunk-SXQIH2QA.js} +2 -2
  132. package/dist/cli/chunks/{chunk-6B4S7PKP.js → chunk-TISBFSDJ.js} +1 -1
  133. package/dist/cli/chunks/{chunk-72LE6PHL.js → chunk-TMD6IC6D.js} +2 -2
  134. package/dist/cli/chunks/{chunk-YDDZJCKY.js → chunk-TMTLWSSA.js} +1 -1
  135. package/dist/cli/chunks/{chunk-HQJMCTWN.js → chunk-UOIT5JZ6.js} +2 -2
  136. package/dist/cli/chunks/{chunk-OPDTDKN3.js → chunk-UTORITJT.js} +2 -2
  137. package/dist/cli/chunks/{chunk-3JAOFKEU.js → chunk-VB7DZVCI.js} +1 -1
  138. package/dist/cli/chunks/{chunk-2L73WXA4.js → chunk-VC256KH2.js} +2 -2
  139. package/dist/cli/chunks/{chunk-SNTMAVPH.js → chunk-VESYE5YO.js} +3 -3
  140. package/dist/cli/chunks/{chunk-YYAPO3CU.js → chunk-VKWDMOR4.js} +2 -2
  141. package/dist/cli/chunks/{chunk-HRLXU4LH.js → chunk-VWN66V7U.js} +2 -2
  142. package/dist/cli/chunks/{chunk-CNEWYJKT.js → chunk-W5C7R2LS.js} +3 -3
  143. package/dist/cli/chunks/{chunk-JLL27IGU.js → chunk-W7KGHW4T.js} +2 -2
  144. package/dist/cli/chunks/{chunk-H56AROF2.js → chunk-WFZ4DRIC.js} +2 -2
  145. package/dist/cli/chunks/{chunk-4CYLSXA6.js → chunk-WFZUKXV5.js} +2 -2
  146. package/dist/cli/chunks/{chunk-AEJVOJPT.js → chunk-X4B3R3ZZ.js} +2 -2
  147. package/dist/cli/chunks/{chunk-KG5SM36Y.js → chunk-XI6ZZMX7.js} +1 -1
  148. package/dist/cli/chunks/{chunk-R5ONQAQL.js → chunk-YEO2Z3UX.js} +2 -2
  149. package/dist/cli/chunks/{chunk-D2FBUOAR.js → chunk-YZD4VIE5.js} +1 -1
  150. package/dist/cli/chunks/{chunk-U7NMPZE2.js → chunk-YZFNPTGN.js} +2 -2
  151. package/dist/cli/chunks/{chunk-OX4R55T3.js → chunk-ZCYKWEAM.js} +2 -2
  152. package/dist/cli/chunks/{chunk-OG7CWWFR.js → chunk-ZG3DSWUA.js} +1 -1
  153. package/dist/cli/chunks/{chunk-EETVN2OJ.js → chunk-ZS4BGJJV.js} +1 -1
  154. package/dist/cli/chunks/{chunk-LZ6TNTGO.js → chunk-ZT7JSFGT.js} +2 -2
  155. package/dist/cli/chunks/{chunk-HMFEPKAR.js → chunk-ZTC64OJE.js} +2 -2
  156. package/dist/cli/chunks/{chunk-RNF47IJ5.js → chunk-ZUBJBAUD.js} +15 -15
  157. package/dist/cli/chunks/{ci-AWZ3S5OT.js → ci-M2BSQBLL.js} +2 -2
  158. package/dist/cli/chunks/{ci-output-JLCYTIMT.js → ci-output-Z4TMK6GZ.js} +2 -2
  159. package/dist/cli/chunks/{circuit-breaker-BJDKBDIL.js → circuit-breaker-E3G4GGWB.js} +2 -2
  160. package/dist/cli/chunks/{claude-flow-setup-KKOP5ZMO.js → claude-flow-setup-MASRQU54.js} +2 -2
  161. package/dist/cli/chunks/client-RPB6RYVY.js +2 -0
  162. package/dist/cli/chunks/{cline-installer-7M525SEA.js → cline-installer-P3BWAKQA.js} +2 -2
  163. package/dist/cli/chunks/{code-27SUVJDO.js → code-7HY5HQAV.js} +2 -2
  164. package/dist/cli/chunks/{code-index-extractor-TTQQZLAK.js → code-index-extractor-MBVKLOEU.js} +2 -2
  165. package/dist/cli/chunks/{codex-installer-GHNGNPKP.js → codex-installer-WZ6QO2PH.js} +2 -2
  166. package/dist/cli/chunks/{completions-JPJD24DG.js → completions-TOJC2UFP.js} +2 -2
  167. package/dist/cli/chunks/{complexity-analyzer-Q74EJV33.js → complexity-analyzer-QYVDIAAW.js} +2 -2
  168. package/dist/cli/chunks/{continuedev-installer-ULTRDIML.js → continuedev-installer-J72CV7P4.js} +2 -2
  169. package/dist/cli/chunks/{copilot-installer-EK52X4CG.js → copilot-installer-ACDA3GEA.js} +2 -2
  170. package/dist/cli/chunks/core-handlers-QFJT5NX6.js +2 -0
  171. package/dist/cli/chunks/{cost-tracker-2GKBRYXL.js → cost-tracker-BAYQJELE.js} +2 -2
  172. package/dist/cli/chunks/{coverage-YCLC3W2A.js → coverage-QD3XJV6W.js} +3 -3
  173. package/dist/cli/chunks/cross-domain-router-5GJ7WZKX.js +2 -0
  174. package/dist/cli/chunks/{cursor-installer-B3ALFW5E.js → cursor-installer-SPGZ4TQM.js} +2 -2
  175. package/dist/cli/chunks/{daemon-ZKEBVLJA.js → daemon-3EVOL2UH.js} +3 -3
  176. package/dist/cli/chunks/daemon-N4JKD5SO.js +10 -0
  177. package/dist/cli/chunks/{dag-attention-scheduler-OQPJ6ULA.js → dag-attention-scheduler-3BVLL3L5.js} +2 -2
  178. package/dist/cli/chunks/{detect-YMYIQH3Q.js → detect-SWACKB45.js} +2 -2
  179. package/dist/cli/chunks/{dist-node-R4FAYQRY.js → dist-node-LU4E7PI6.js} +2 -2
  180. package/dist/cli/chunks/{domain-handler-IGWXLF2S.js → domain-handler-5AKKAC43.js} +2 -2
  181. package/dist/cli/chunks/{domain-transfer-A7YNO76C.js → domain-transfer-LB6H7RPX.js} +2 -2
  182. package/dist/cli/chunks/dream-C6VNLTON.js +2 -0
  183. package/dist/cli/chunks/{embed-and-insert-pattern-KODZAS7Y.js → embed-and-insert-pattern-7RBA5NDK.js} +2 -2
  184. package/dist/cli/chunks/{eval-ALQW7Q2S.js → eval-ZZFPRENX.js} +5 -5
  185. package/dist/cli/chunks/{experience-capture-middleware-3WK4RXWK.js → experience-capture-middleware-HRO3EGIW.js} +3 -3
  186. package/dist/cli/chunks/{fast-paths-PQWDFIJZ.js → fast-paths-IRRNQBTY.js} +2 -2
  187. package/dist/cli/chunks/{feature-flags-JRUAZCND.js → feature-flags-R5N5IWI2.js} +2 -2
  188. package/dist/cli/chunks/{feature-flags-6X33B3WX.js → feature-flags-W54ABAUA.js} +2 -2
  189. package/dist/cli/chunks/{file-discovery-SA3YU3IH.js → file-discovery-6CIDLVID.js} +2 -2
  190. package/dist/cli/chunks/{fleet-7TXCAOKQ.js → fleet-YTFN64WE.js} +3 -3
  191. package/dist/cli/chunks/{gnn-wrapper-ZKNYACEC.js → gnn-wrapper-RXMPLMV2.js} +2 -2
  192. package/dist/cli/chunks/{heartbeat-handler-KRZRZ23F.js → heartbeat-handler-HQQWEEQQ.js} +4 -4
  193. package/dist/cli/chunks/heartbeat-scheduler-4SBO27BG.js +2 -0
  194. package/dist/cli/chunks/hnsw-adapter-W7G6VNXW.js +2 -0
  195. package/dist/cli/chunks/hnsw-index-LENA5QML.js +2 -0
  196. package/dist/cli/chunks/{hnsw-legacy-bridge-LVHQ5SG7.js → hnsw-legacy-bridge-GPZIKYFD.js} +2 -2
  197. package/dist/cli/chunks/{better-sqlite3-HP4JZS6K.js → hnswlib-node-P6HSEFLW.js} +2 -2
  198. package/dist/cli/chunks/hooks-AYLAGFOK.js +285 -0
  199. package/dist/cli/chunks/hybrid-router-IXHIC45P.js +2 -0
  200. package/dist/cli/chunks/{hypergraph-engine-2EZBZMFK.js → hypergraph-engine-56FMXI3T.js} +2 -2
  201. package/dist/cli/chunks/{hypergraph-handler-GLPWYII2.js → hypergraph-handler-APEVT5IE.js} +3 -3
  202. package/dist/cli/chunks/impact-analyzer-DKGVMYU6.js +2 -0
  203. package/dist/cli/chunks/{init-handler-ZSDO5VMA.js → init-handler-5DWF4REQ.js} +6 -6
  204. package/dist/cli/chunks/init-wizard-BBY3LY3F.js +2 -0
  205. package/dist/cli/chunks/kernel-7CUW7G62.js +2 -0
  206. package/dist/cli/chunks/{kilocode-installer-ATYSDWIV.js → kilocode-installer-XKAUA5VA.js} +2 -2
  207. package/dist/cli/chunks/{kiro-installer-K66YT6PC.js → kiro-installer-NI2KIYJE.js} +2 -2
  208. package/dist/cli/chunks/knowledge-graph-Q5CP47IP.js +2 -0
  209. package/dist/cli/chunks/{learning-BVYCC4RI.js → learning-ZIUMUNXZ.js} +3 -3
  210. package/dist/cli/chunks/{llm-router-VBCXE6DN.js → llm-router-IL52EF2V.js} +4 -4
  211. package/dist/cli/chunks/llm-router-service-MTXCX7TO.js +2 -0
  212. package/dist/cli/chunks/{load-AREDQE2U.js → load-B5LFYD6O.js} +2 -2
  213. package/dist/cli/chunks/load-test-YBWXASBO.js +2 -0
  214. package/dist/cli/chunks/{mcp-NG6H6UC5.js → mcp-K6GZLWBC.js} +2 -2
  215. package/dist/cli/chunks/{memory-Y65EHG6N.js → memory-NCQRVSN6.js} +5 -5
  216. package/dist/cli/chunks/memory-backend-52LANEA3.js +2 -0
  217. package/dist/cli/chunks/memory-handlers-KFW3HYAP.js +2 -0
  218. package/dist/cli/chunks/{multi-model-executor-VRPRFUZT.js → multi-model-executor-R4LBSJWK.js} +2 -2
  219. package/dist/cli/chunks/{opencode-installer-CKQXPM5R.js → opencode-installer-I6CBR3PV.js} +2 -2
  220. package/dist/cli/chunks/{orchestrator-I7JBKD6G.js → orchestrator-5FXUCES6.js} +10 -10
  221. package/dist/cli/chunks/{pipeline-MV2RWCBI.js → pipeline-GDKCTXJH.js} +2 -2
  222. package/dist/cli/chunks/{platform-VU5P3SOG.js → platform-ZFY3F4T3.js} +2 -2
  223. package/dist/cli/chunks/{plugin-6TERLKCB.js → plugin-HQMEN3OS.js} +2 -2
  224. package/dist/cli/chunks/{prime-radiant-advanced-wasm-WIUIN2DL.js → prime-radiant-advanced-wasm-LSJGF4CV.js} +2 -2
  225. package/dist/cli/chunks/protocol-executor-TRYUS77M.js +2 -0
  226. package/dist/cli/chunks/{protocol-handler-HKWBGARO.js → protocol-handler-BMDNIGPP.js} +2 -2
  227. package/dist/cli/chunks/{prove-7CQPHBRJ.js → prove-ABVGAG4Z.js} +2 -2
  228. package/dist/cli/chunks/provider-manager-6XQQN7FX.js +2 -0
  229. package/dist/cli/chunks/qe-reasoning-bank-3IUPE4DJ.js +2 -0
  230. package/dist/cli/chunks/{quality-VLUVXKVG.js → quality-ENJXPNP5.js} +2 -2
  231. package/dist/cli/chunks/queen-coordinator-VWPH4XPX.js +2 -0
  232. package/dist/cli/chunks/{real-embeddings-JPZ64KK2.js → real-embeddings-W3GNAEJO.js} +2 -2
  233. package/dist/cli/chunks/{roocode-installer-NONVB3UE.js → roocode-installer-4FJNQ7PU.js} +2 -2
  234. package/dist/cli/chunks/router-OIB6ODHA.js +2 -0
  235. package/dist/cli/chunks/routing-feedback-EKYPCZYG.js +2 -0
  236. package/dist/cli/chunks/{routing-handler-YYXDT4J2.js → routing-handler-GFS5FA4F.js} +2 -2
  237. package/dist/cli/chunks/{ruvector-commands-5PFMNDLR.js → ruvector-commands-GBMYNJKN.js} +2 -2
  238. package/dist/cli/chunks/{rvf-dual-writer-TF6H7AXH.js → rvf-dual-writer-STUAQT6U.js} +2 -2
  239. package/dist/cli/chunks/{rvf-migration-adapter-VNGIUZCO.js → rvf-migration-adapter-LO6DBNJH.js} +2 -2
  240. package/dist/cli/chunks/{rvf-migration-coordinator-VA52YAIY.js → rvf-migration-coordinator-I5AD4VJ2.js} +2 -2
  241. package/dist/cli/chunks/rvf-native-adapter-7RXP2Q4Q.js +2 -0
  242. package/dist/cli/chunks/safe-db-MNKFEPBX.js +2 -0
  243. package/dist/cli/chunks/schedule-AJXABVXX.js +2 -0
  244. package/dist/cli/chunks/scheduler-LDWYHIAW.js +2 -0
  245. package/dist/cli/chunks/{security-62HEETBF.js → security-X3WCA5K5.js} +3 -3
  246. package/dist/cli/chunks/shared-rvf-adapter-Z4FSPWNP.js +2 -0
  247. package/dist/cli/chunks/{shared-rvf-dual-writer-JTZK7LRD.js → shared-rvf-dual-writer-QOPOIRIC.js} +2 -2
  248. package/dist/cli/chunks/sqlite-persistence-A6GKDMOJ.js +2 -0
  249. package/dist/cli/chunks/{status-handler-LSUPUKRF.js → status-handler-B2B5QBVK.js} +2 -2
  250. package/dist/cli/chunks/{structural-health-Z75A666N.js → structural-health-KT47LBVH.js} +2 -2
  251. package/dist/cli/chunks/sync-CKID22IW.js +2 -0
  252. package/dist/cli/chunks/{sync-M3O4T3A3.js → sync-VWD6OOUR.js} +2 -2
  253. package/dist/cli/chunks/{task-handler-AQBSZAQC.js → task-handler-X5JT5YBF.js} +2 -2
  254. package/dist/cli/chunks/{task-handlers-BOZP247V.js → task-handlers-IW4GQDW4.js} +3 -3
  255. package/dist/cli/chunks/{test-FTEGPNN2.js → test-MBZSUASD.js} +4 -4
  256. package/dist/cli/chunks/{test-scheduling-IGR4U2VQ.js → test-scheduling-E5KHKRZS.js} +3 -3
  257. package/dist/cli/chunks/token-bootstrap-TIDPJ5IG.js +2 -0
  258. package/dist/cli/chunks/{token-usage-VCHV47EO.js → token-usage-ECJSPOQB.js} +2 -2
  259. package/dist/cli/chunks/{transformers-M27QSNFH.js → transformers-UZJAQ7OZ.js} +2 -2
  260. package/dist/cli/chunks/{tree-sitter-wasm-parser-IIGEJYFU.js → tree-sitter-wasm-parser-H6BU2E5R.js} +2 -2
  261. package/dist/cli/chunks/{types-RQFPUUKA.js → types-PM7NT3MH.js} +2 -2
  262. package/dist/cli/chunks/unified-memory-27QJHABO.js +2 -0
  263. package/dist/cli/chunks/unified-memory-hnsw-76VUXR4H.js +2 -0
  264. package/dist/cli/chunks/unified-persistence-QRCGDEXH.js +2 -0
  265. package/dist/cli/chunks/{upgrade-VJMYX3AL.js → upgrade-FS2XYC2P.js} +2 -2
  266. package/dist/cli/chunks/{validate-ML7HUAU5.js → validate-4Y2BNN3A.js} +3 -3
  267. package/dist/cli/chunks/{validate-swarm-RCR6EYRC.js → validate-swarm-Z7QXZSUE.js} +4 -4
  268. package/dist/cli/chunks/{vibium-ZOOS3W5L.js → vibium-VZ6L3O2G.js} +2 -2
  269. package/dist/cli/chunks/visual-security-KB27O7BE.js +2 -0
  270. package/dist/cli/chunks/{web-tree-sitter-2YPGYLWK.js → web-tree-sitter-H7P37W5U.js} +2 -2
  271. package/dist/cli/chunks/{windsurf-installer-GOJWUWC5.js → windsurf-installer-IB2VHSZS.js} +2 -2
  272. package/dist/cli/chunks/{witness-chain-3MGSS3Q4.js → witness-chain-C4DISYJN.js} +2 -2
  273. package/dist/cli/chunks/witness-chain-EYPXHRDV.js +2 -0
  274. package/dist/cli/chunks/{workflow-B5Q77BI4.js → workflow-IGM7KVIO.js} +4 -4
  275. package/dist/cli/chunks/workflow-orchestrator-6AQZ3USU.js +2 -0
  276. package/dist/cli/chunks/wrappers-PQXC263L.js +2 -0
  277. package/dist/cli/commands/arena.d.ts +10 -0
  278. package/dist/cli/commands/arena.js +129 -0
  279. package/dist/cli/commands/hooks-handlers/command-hooks.js +38 -2
  280. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.d.ts +4 -0
  281. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +66 -3
  282. package/dist/cli/commands/hooks-handlers/nesting-provenance.d.ts +27 -0
  283. package/dist/cli/commands/hooks-handlers/nesting-provenance.js +46 -0
  284. package/dist/cli/commands/hooks-handlers/task-hooks.js +72 -1
  285. package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.d.ts +71 -0
  286. package/dist/cli/commands/hooks-handlers/tool-loop-guardrail.js +142 -0
  287. package/dist/cli/index.js +17 -0
  288. package/dist/contracts/verdicts.d.ts +297 -0
  289. package/dist/contracts/verdicts.js +178 -0
  290. package/dist/coordination/queen-types.d.ts +4 -0
  291. package/dist/integrations/agentic-flow/reasoning-bank/experience-replay.js +15 -6
  292. package/dist/integrations/agentic-flow/reasoning-bank/trajectory-tracker.js +12 -0
  293. package/dist/integrations/ruvector/shared-rvf-adapter.js +12 -1
  294. package/dist/integrations/ruvector/shared-rvf-dual-writer.js +6 -2
  295. package/dist/kernel/project-root.d.ts +33 -0
  296. package/dist/kernel/project-root.js +86 -0
  297. package/dist/kernel/unified-memory.d.ts +2 -19
  298. package/dist/kernel/unified-memory.js +8 -64
  299. package/dist/learning/local-judge-client.d.ts +55 -0
  300. package/dist/learning/local-judge-client.js +127 -0
  301. package/dist/learning/nagual-client.d.ts +73 -0
  302. package/dist/learning/nagual-client.js +150 -0
  303. package/dist/learning/pattern-store.js +10 -3
  304. package/dist/mcp/bundle.js +393 -391
  305. package/dist/mcp/entry.js +44 -33
  306. package/dist/mcp/handlers/core-handlers.d.ts +20 -0
  307. package/dist/mcp/handlers/core-handlers.js +28 -0
  308. package/dist/mcp/handlers/domain-handler-configs.d.ts +3 -0
  309. package/dist/mcp/handlers/domain-handler-configs.js +22 -10
  310. package/dist/mcp/transport/stdio.d.ts +7 -0
  311. package/dist/mcp/transport/stdio.js +39 -2
  312. package/dist/shared/llm/cost-tracker.js +6 -2
  313. package/dist/shared/llm/interfaces.d.ts +4 -0
  314. package/dist/shared/llm/providers/claude.js +16 -2
  315. package/dist/shared/reasoning-scrub.d.ts +29 -0
  316. package/dist/shared/reasoning-scrub.js +75 -0
  317. package/dist/workers/daemon.js +2 -0
  318. package/dist/workers/quality-daemon/git-watcher.js +2 -0
  319. package/dist/workers/quality-daemon/index.js +2 -0
  320. package/dist/workers/worker-manager.js +4 -0
  321. package/package.json +1 -1
  322. package/dist/cli/chunks/adapter-BHPUKMJ5.js +0 -2
  323. package/dist/cli/chunks/aqe-learning-engine-JQ5WD2HM.js +0 -2
  324. package/dist/cli/chunks/audit-BMQ3VESB.js +0 -3
  325. package/dist/cli/chunks/base-E32WLGY2.js +0 -2
  326. package/dist/cli/chunks/browser-workflow-LNNXXAJG.js +0 -2
  327. package/dist/cli/chunks/chunk-2EQVYYBF.js +0 -2
  328. package/dist/cli/chunks/chunk-3VF3HCG4.js +0 -2
  329. package/dist/cli/chunks/chunk-GELF4ILR.js +0 -699
  330. package/dist/cli/chunks/chunk-JOLDCS6X.js +0 -2
  331. package/dist/cli/chunks/chunk-JSFYPLMQ.js +0 -2
  332. package/dist/cli/chunks/chunk-YX2HY4MX.js +0 -2
  333. package/dist/cli/chunks/client-2UKBYFX4.js +0 -2
  334. package/dist/cli/chunks/cross-domain-router-FPM3L27L.js +0 -2
  335. package/dist/cli/chunks/daemon-YWINEHG4.js +0 -10
  336. package/dist/cli/chunks/dream-XM33US3V.js +0 -2
  337. package/dist/cli/chunks/heartbeat-scheduler-GM3M2MTG.js +0 -2
  338. package/dist/cli/chunks/hnsw-adapter-K62GEHIL.js +0 -2
  339. package/dist/cli/chunks/hnsw-index-VCAK3TWN.js +0 -2
  340. package/dist/cli/chunks/hooks-6Y3UHYI2.js +0 -248
  341. package/dist/cli/chunks/hybrid-router-432QNCNG.js +0 -2
  342. package/dist/cli/chunks/impact-analyzer-VTSISNN4.js +0 -2
  343. package/dist/cli/chunks/init-wizard-COB5AH7Q.js +0 -2
  344. package/dist/cli/chunks/kernel-ROK7X5FM.js +0 -2
  345. package/dist/cli/chunks/knowledge-graph-YUWIDIWW.js +0 -2
  346. package/dist/cli/chunks/llm-router-service-7VLXJ7VE.js +0 -2
  347. package/dist/cli/chunks/load-test-32524DL3.js +0 -2
  348. package/dist/cli/chunks/memory-backend-BI2V5AAB.js +0 -2
  349. package/dist/cli/chunks/memory-handlers-NSOFWVFN.js +0 -2
  350. package/dist/cli/chunks/protocol-executor-2UPB7SPI.js +0 -2
  351. package/dist/cli/chunks/provider-manager-PDT37MIJ.js +0 -2
  352. package/dist/cli/chunks/qe-reasoning-bank-AQQ2BI4V.js +0 -2
  353. package/dist/cli/chunks/queen-coordinator-6DVDVEU4.js +0 -2
  354. package/dist/cli/chunks/router-O2G4KQ6L.js +0 -2
  355. package/dist/cli/chunks/routing-feedback-TAGTD3KQ.js +0 -2
  356. package/dist/cli/chunks/rvf-native-adapter-46GRWQJR.js +0 -2
  357. package/dist/cli/chunks/safe-db-LNIPXXHH.js +0 -2
  358. package/dist/cli/chunks/schedule-AUH3ZALY.js +0 -2
  359. package/dist/cli/chunks/scheduler-KK3OYPWW.js +0 -2
  360. package/dist/cli/chunks/shared-rvf-adapter-XWTQPGCT.js +0 -2
  361. package/dist/cli/chunks/sqlite-persistence-CYESP7NG.js +0 -2
  362. package/dist/cli/chunks/sync-VI37UHHH.js +0 -2
  363. package/dist/cli/chunks/token-bootstrap-2DFRVMBM.js +0 -2
  364. package/dist/cli/chunks/unified-memory-RISHEANP.js +0 -2
  365. package/dist/cli/chunks/unified-memory-hnsw-2IKXGMNZ.js +0 -2
  366. package/dist/cli/chunks/unified-persistence-ZTTUJNTU.js +0 -2
  367. package/dist/cli/chunks/visual-security-D66DTAO5.js +0 -2
  368. package/dist/cli/chunks/witness-chain-RHWHHDLV.js +0 -2
  369. package/dist/cli/chunks/workflow-orchestrator-OQMFW2TC.js +0 -2
  370. package/dist/cli/chunks/wrappers-MM5VLEPG.js +0 -2
@@ -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.10.3");process.exit(0)}
2
- import{k as y,o as S}from"./chunk-USFZ4IJD.js";import"./chunk-R5ONQAQL.js";import"./chunk-KTRB3L53.js";import"./chunk-3VF3HCG4.js";import{d as x,e as C}from"./chunk-2L73WXA4.js";import{a as g,c as N}from"./chunk-3LRK7PYN.js";import{i as f}from"./chunk-RTDHWOAG.js";import"./chunk-L74CHKFR.js";import"./chunk-VRXY4T22.js";import"./chunk-JTZ3Q2QS.js";import"./chunk-7ZSPCGTI.js";import"./chunk-QWG76RHA.js";import"./chunk-3RZL4QTT.js";import"./chunk-NRCL3WCP.js";import"./chunk-HMFEPKAR.js";import"./chunk-YIYV2JB6.js";import"./chunk-CAMEFWRK.js";S();N();C();var D=x("ExperienceCapture"),R=600*1e3,O=120*1e3,M=1024*1024;function m(e,t=M){if(e==null)return null;try{let n=JSON.stringify(e);return n.length>t?(console.warn(`[ExperienceCaptureMiddleware] JSON payload exceeds size limit (${n.length} > ${t} bytes), truncating`),JSON.stringify({_truncated:!0,_originalSize:n.length,_preview:typeof e=="object"?Object.keys(e).slice(0,10):String(e).slice(0,100)})):n}catch(n){return console.warn("[ExperienceCaptureMiddleware] Failed to serialize JSON:",n),null}}var d=new Map,l=null;function U(){let e=Date.now(),t=0;for(let[n,a]of d){let i=e-a.context.startedAt.getTime();i>R&&(console.warn(`[ExperienceCaptureMiddleware] Cleaning up stale experience: ${n} (age=${Math.round(i/1e3)}s, domain=${a.context.domain})`),d.delete(n),t++)}return t>0&&console.log(`[ExperienceCaptureMiddleware] Cleaned ${t} stale experiences`),t}function I(){l||(l=setInterval(()=>{U()},O),l.unref())}function z(){l&&(clearInterval(l),l=null)}var c=null,E=null;async function A(){return E||(E=F(),E)}async function F(){try{c=y(),await c.initialize();let e=c.getDatabase();if(e){let t=!1;if(e.prepare("SELECT COUNT(*) as cnt FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get().cnt>0){let s=e.prepare("PRAGMA table_info(captured_experiences)").all(),r=new Set(s.map(u=>u.name));!r.has("success")||!r.has("task")?(e.exec("ALTER TABLE captured_experiences RENAME TO captured_experiences_v2_backup"),t=!0):(r.has("domain")||e.exec("ALTER TABLE captured_experiences ADD COLUMN domain TEXT NOT NULL DEFAULT ''"),r.has("source")||e.exec("ALTER TABLE captured_experiences ADD COLUMN source TEXT DEFAULT 'middleware'"))}else t=!0;t&&e.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.10.5");process.exit(0)}
2
+ import{i as y,m as S}from"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import"./chunk-D7NKRCIL.js";import"./chunk-56RA6YPN.js";import"./chunk-RLZDXQNM.js";import{d as x,e as C}from"./chunk-VC256KH2.js";import{a as g,c as N}from"./chunk-S73KENCH.js";import{i as f}from"./chunk-7DU35D4M.js";import"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";S();N();C();var D=x("ExperienceCapture"),R=600*1e3,O=120*1e3,M=1024*1024;function m(e,t=M){if(e==null)return null;try{let n=JSON.stringify(e);return n.length>t?(console.warn(`[ExperienceCaptureMiddleware] JSON payload exceeds size limit (${n.length} > ${t} bytes), truncating`),JSON.stringify({_truncated:!0,_originalSize:n.length,_preview:typeof e=="object"?Object.keys(e).slice(0,10):String(e).slice(0,100)})):n}catch(n){return console.warn("[ExperienceCaptureMiddleware] Failed to serialize JSON:",n),null}}var d=new Map,l=null;function U(){let e=Date.now(),t=0;for(let[n,a]of d){let i=e-a.context.startedAt.getTime();i>R&&(console.warn(`[ExperienceCaptureMiddleware] Cleaning up stale experience: ${n} (age=${Math.round(i/1e3)}s, domain=${a.context.domain})`),d.delete(n),t++)}return t>0&&console.log(`[ExperienceCaptureMiddleware] Cleaned ${t} stale experiences`),t}function I(){l||(l=setInterval(()=>{U()},O),l.unref())}function z(){l&&(clearInterval(l),l=null)}var c=null,E=null;async function A(){return E||(E=F(),E)}async function F(){try{c=y(),await c.initialize();let e=c.getDatabase();if(e){let t=!1;if(e.prepare("SELECT COUNT(*) as cnt FROM sqlite_master WHERE type='table' AND name='captured_experiences'").get().cnt>0){let s=e.prepare("PRAGMA table_info(captured_experiences)").all(),r=new Set(s.map(u=>u.name));!r.has("success")||!r.has("task")?(e.exec("ALTER TABLE captured_experiences RENAME TO captured_experiences_v2_backup"),t=!0):(r.has("domain")||e.exec("ALTER TABLE captured_experiences ADD COLUMN domain TEXT NOT NULL DEFAULT ''"),r.has("source")||e.exec("ALTER TABLE captured_experiences ADD COLUMN source TEXT DEFAULT 'middleware'"))}else t=!0;t&&e.exec(`
3
3
  CREATE TABLE IF NOT EXISTS captured_experiences (
4
4
  id TEXT PRIMARY KEY,
5
5
  task TEXT NOT NULL,
@@ -27,7 +27,7 @@ import{k as y,o as S}from"./chunk-USFZ4IJD.js";import"./chunk-R5ONQAQL.js";impor
27
27
  (id, task, agent, domain, success, quality, duration_ms, model_tier,
28
28
  routing_json, steps_json, result_json, error, started_at, completed_at, source)
29
29
  VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), ?)
30
- `).run(t.id,e.task,e.agent,e.domain,t.success?1:0,t.quality,t.durationMs,e.modelTier||null,m(e.routing),m(t.steps),m(t.result),t.error||null,e.startedAt.toISOString(),"middleware"),X(n,t.id,e.task,e.domain).catch(i=>{D.warn("Embedding computation failed",{error:i instanceof Error?i.message:String(i),experienceId:t.id,domain:e.domain})})}catch(n){console.error("[ExperienceCaptureMiddleware] Failed to persist experience:",n)}}async function X(e,t,n,a){try{let{computeRealEmbedding:i}=await import("./real-embeddings-JPZ64KK2.js"),s=`${a}: ${n}`.slice(0,512),r=await i(s);if(!r||r.length===0)return;let u=Buffer.from(new Float32Array(r).buffer);e.prepare(`
30
+ `).run(t.id,e.task,e.agent,e.domain,t.success?1:0,t.quality,t.durationMs,e.modelTier||null,m(e.routing),m(t.steps),m(t.result),t.error||null,e.startedAt.toISOString(),"middleware"),X(n,t.id,e.task,e.domain).catch(i=>{D.warn("Embedding computation failed",{error:i instanceof Error?i.message:String(i),experienceId:t.id,domain:e.domain})})}catch(n){console.error("[ExperienceCaptureMiddleware] Failed to persist experience:",n)}}async function X(e,t,n,a){try{let{computeRealEmbedding:i}=await import("./real-embeddings-W3GNAEJO.js"),s=`${a}: ${n}`.slice(0,512),r=await i(s);if(!r||r.length===0)return;let u=Buffer.from(new Float32Array(r).buffer);e.prepare(`
31
31
  UPDATE captured_experiences
32
32
  SET embedding = ?, embedding_dimension = ?
33
33
  WHERE id = ? AND embedding IS NULL
@@ -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.10.3");process.exit(0)}
2
- import"./chunk-CAMEFWRK.js";function n(e){return e.includes("--version")||e.includes("-v")?"cli-version":e[2]==="health"?"cli-health":process.env.AQE_MCP==="1"||process.env.AQE_MCP_MODE==="1"?"mcp":process.env.AQE_HTTP_PORT?"http":"cli-full"}function o(e){return process.env.AQE_FAST_PATHS==="false"?!1:e.includes("--version")||e.includes("-v")}function r(e){return e[2]==="health"}export{n as detectBootMode,r as isHealthFastPath,o as isVersionFastPath};
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.10.5");process.exit(0)}
2
+ import"./chunk-S7HQOGVD.js";function n(e){return e.includes("--version")||e.includes("-v")?"cli-version":e[2]==="health"?"cli-health":process.env.AQE_MCP==="1"||process.env.AQE_MCP_MODE==="1"?"mcp":process.env.AQE_HTTP_PORT?"http":"cli-full"}function o(e){return process.env.AQE_FAST_PATHS==="false"?!1:e.includes("--version")||e.includes("-v")}function r(e){return e[2]==="health"}export{n as detectBootMode,r as isHealthFastPath,o as isVersionFastPath};
@@ -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.10.3");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-3HBWDG62.js";import"./chunk-CAMEFWRK.js";q();export{a as DEFAULT_FEATURE_FLAGS,n as configureForCI,o as configureForDevelopment,p as configureForHeuristicMode,b as getVibiumFeatureFlags,m as initVibiumFeatureFlagsFromEnv,j as isAutoRetryEnabled,l as isAxeCoreEnabled,e as isBrowserModeEnabled,i as isDefaultHeadless,h as isE2EExecutionEnabled,f as isScreenshotCaptureEnabled,g as isVisualRegressionEnabled,d as resetVibiumFeatureFlags,c as setVibiumFeatureFlags,k as shouldLogPerformanceMetrics};
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.10.5");process.exit(0)}
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q}from"./chunk-S7FGTHFE.js";import"./chunk-S7HQOGVD.js";q();export{a as DEFAULT_FEATURE_FLAGS,n as configureForCI,o as configureForDevelopment,p as configureForHeuristicMode,b as getVibiumFeatureFlags,m as initVibiumFeatureFlagsFromEnv,j as isAutoRetryEnabled,l as isAxeCoreEnabled,e as isBrowserModeEnabled,i as isDefaultHeadless,h as isE2EExecutionEnabled,f as isScreenshotCaptureEnabled,g as isVisualRegressionEnabled,d as resetVibiumFeatureFlags,c as setVibiumFeatureFlags,k as shouldLogPerformanceMetrics};
@@ -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.10.3");process.exit(0)}
2
- import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,S as R,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-YIYV2JB6.js";import"./chunk-CAMEFWRK.js";R();export{a as DEFAULT_FEATURE_FLAGS,b as getRuVectorFeatureFlags,A as getRvfMigrationStage,Q as initFeatureFlagsFromEnv,y as isAgentMemoryBranchingEnabled,t as isCNNVisualRegressionEnabled,O as isCognitiveRoutingEnabled,v as isCoherenceActionGateEnabled,r as isCoherenceGateEnabled,H as isColdTierGNNEnabled,o as isCrossDomainTransferEnabled,C as isCusumDriftDetectionEnabled,u as isDAGAttentionEnabled,D as isDeltaEventSourcingEnabled,l as isDeterministicDitherEnabled,M as isEpropOnlineLearningEnabled,E as isEwcPlusPlusEnabled,f as isFlashAttentionEnabled,g as isGNNIndexEnabled,N as isGrangerCausalityEnabled,F as isGraphMAEEnabled,B as isHDCFingerprintingEnabled,p as isHnswHealthMonitorEnabled,G as isHopfieldMemoryEnabled,P as isHyperbolicHnswEnabled,I as isMetaLearningEnabled,k as isMetadataFilteringEnabled,i as isNativeHNSWEnabled,m as isNeuralRoutingEnabled,x as isRVFPatternStoreEnabled,w as isReasoningQECEnabled,q as isRegretTrackingEnabled,L as isReservoirReplayEnabled,e as isSONAEnabled,n as isSONAThreeLoopEnabled,K as isSpectralSparsificationEnabled,J as isSublinearSolverEnabled,j as isTemporalCompressionEnabled,z as isUnifiedHnswEnabled,s as isWitnessChainEnabled,d as resetRuVectorFeatureFlags,c as setRuVectorFeatureFlags,h as shouldLogMigrationMetrics};
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.10.5");process.exit(0)}
2
+ import{A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,S as R,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z}from"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";R();export{a as DEFAULT_FEATURE_FLAGS,b as getRuVectorFeatureFlags,A as getRvfMigrationStage,Q as initFeatureFlagsFromEnv,y as isAgentMemoryBranchingEnabled,t as isCNNVisualRegressionEnabled,O as isCognitiveRoutingEnabled,v as isCoherenceActionGateEnabled,r as isCoherenceGateEnabled,H as isColdTierGNNEnabled,o as isCrossDomainTransferEnabled,C as isCusumDriftDetectionEnabled,u as isDAGAttentionEnabled,D as isDeltaEventSourcingEnabled,l as isDeterministicDitherEnabled,M as isEpropOnlineLearningEnabled,E as isEwcPlusPlusEnabled,f as isFlashAttentionEnabled,g as isGNNIndexEnabled,N as isGrangerCausalityEnabled,F as isGraphMAEEnabled,B as isHDCFingerprintingEnabled,p as isHnswHealthMonitorEnabled,G as isHopfieldMemoryEnabled,P as isHyperbolicHnswEnabled,I as isMetaLearningEnabled,k as isMetadataFilteringEnabled,i as isNativeHNSWEnabled,m as isNeuralRoutingEnabled,x as isRVFPatternStoreEnabled,w as isReasoningQECEnabled,q as isRegretTrackingEnabled,L as isReservoirReplayEnabled,e as isSONAEnabled,n as isSONAThreeLoopEnabled,K as isSpectralSparsificationEnabled,J as isSublinearSolverEnabled,j as isTemporalCompressionEnabled,z as isUnifiedHnswEnabled,s as isWitnessChainEnabled,d as resetRuVectorFeatureFlags,c as setRuVectorFeatureFlags,h as shouldLogMigrationMetrics};
@@ -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.10.3");process.exit(0)}
2
- import{a,b}from"./chunk-NNZMEYLT.js";import"./chunk-CAMEFWRK.js";export{a as SOURCE_EXTENSIONS,b as walkSourceFiles};
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.10.5");process.exit(0)}
2
+ import{a,b}from"./chunk-AMBIOEMO.js";import"./chunk-S7HQOGVD.js";export{a as SOURCE_EXTENSIONS,b as walkSourceFiles};
@@ -1,8 +1,8 @@
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.10.3");process.exit(0)}
2
- import{a as k,b as K,c as x,d as T,e as H,f as F,g as Q,j as _}from"./chunk-6B4S7PKP.js";import{a as G}from"./chunk-MBSJ5G4I.js";import{c as C,d as S}from"./chunk-DF3MJ2YL.js";import{a as v,b as V}from"./chunk-AEJVOJPT.js";import"./chunk-HWM2XJ3P.js";import"./chunk-GL3HZN3O.js";import{a as W}from"./chunk-MC7K44M4.js";import{a as E}from"./chunk-ZG4P3DTL.js";import{d as j}from"./chunk-SNTMAVPH.js";import"./chunk-WWD5IWTV.js";import"./chunk-4OUAHZX2.js";import"./chunk-EETVN2OJ.js";import{b as N}from"./chunk-6FL3GN4T.js";import"./chunk-YYAPO3CU.js";import"./chunk-OG7CWWFR.js";import{v as q}from"./chunk-FND6V2RV.js";import"./chunk-X2B7SANM.js";import"./chunk-YDKYLNKZ.js";import"./chunk-UZL366ZI.js";import"./chunk-ADV4DH3W.js";import"./chunk-SL6YZAT4.js";import"./chunk-3JAOFKEU.js";import"./chunk-X3RJ6SFC.js";import"./chunk-B5MMDMH6.js";import"./chunk-PZHZPX3O.js";import"./chunk-D2FBUOAR.js";import"./chunk-Q7EBD24B.js";import"./chunk-NNVXHC74.js";import"./chunk-3HBWDG62.js";import"./chunk-JXIPRMAY.js";import"./chunk-M5CDW2ZH.js";import{c as L}from"./chunk-VIWIO27R.js";import"./chunk-IRR7YA3Q.js";import"./chunk-VDTFRMES.js";import"./chunk-UIJFU4KD.js";import"./chunk-IL2KOW5W.js";import"./chunk-U6UK3UMX.js";import"./chunk-5LON3MLI.js";import"./chunk-MQOFFRTA.js";import"./chunk-T63EK6GH.js";import"./chunk-QM65UGPV.js";import"./chunk-RNF47IJ5.js";import"./chunk-FJGSEPFL.js";import"./chunk-5SGEOO2F.js";import"./chunk-PFCAMX6H.js";import"./chunk-N7IBYDW5.js";import"./chunk-RZCAA2PZ.js";import"./chunk-4QFAUSWQ.js";import"./chunk-JSFYPLMQ.js";import"./chunk-HQJMCTWN.js";import"./chunk-6GCOIIHY.js";import"./chunk-CNEWYJKT.js";import"./chunk-72LE6PHL.js";import"./chunk-BWP3UVPE.js";import"./chunk-JE3C7JYN.js";import"./chunk-5EWWA4QP.js";import"./chunk-HRLXU4LH.js";import"./chunk-PL5SLO2W.js";import"./chunk-UDV4YB42.js";import"./chunk-NXPFGPHV.js";import"./chunk-JOLDCS6X.js";import"./chunk-5G5AAEFF.js";import"./chunk-BT3QLWII.js";import"./chunk-JLL27IGU.js";import"./chunk-DY5KEOHX.js";import"./chunk-YX2HY4MX.js";import"./chunk-7RMZAVGO.js";import"./chunk-NZHOKLII.js";import"./chunk-USFZ4IJD.js";import"./chunk-R5ONQAQL.js";import"./chunk-KTRB3L53.js";import"./chunk-UHDBM7QS.js";import"./chunk-FU77CDEM.js";import"./chunk-3VF3HCG4.js";import"./chunk-2L73WXA4.js";import{a as I}from"./chunk-JD2PG4KS.js";import{a as B,c as ee}from"./chunk-3LRK7PYN.js";import"./chunk-RTDHWOAG.js";import"./chunk-2ULVCLOW.js";import{a as z,b as te}from"./chunk-L74CHKFR.js";import"./chunk-VRXY4T22.js";import"./chunk-JTZ3Q2QS.js";import{c as $,d as ne}from"./chunk-7ZSPCGTI.js";import"./chunk-QWG76RHA.js";import"./chunk-3RZL4QTT.js";import"./chunk-NRCL3WCP.js";import"./chunk-HMFEPKAR.js";import"./chunk-YIYV2JB6.js";import"./chunk-CAMEFWRK.js";ne();import{Command as ie}from"commander";import t from"chalk";ee();te();import h from"chalk";import{existsSync as oe}from"fs";import{join as P}from"path";var R=class{projectRoot;options;orchestrator;constructor(e){this.options=e,this.projectRoot=e.projectRoot}async checkCodeIntelligence(){if(this.options.skipCodeScan)return console.log(h.yellow(" Code intelligence scan skipped (--skip-code-scan flag)")),{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!1,scanRequested:!1},shouldProceed:!0,skipReason:"skip-flag"};if(await this.hasCodeIntelligenceIndex()){let i=await this.getKGEntryCount();return console.log(h.green(` \u2713 Code intelligence index found (${i} entries)`)),{codeIntelligence:{hasIndex:!0,entryCount:i,wasPrompted:!1,scanRequested:!1},shouldProceed:!0}}return!this.options.nonInteractive&&(console.log(h.yellow(`
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.10.5");process.exit(0)}
2
+ import{a as k,b as K,c as x,d as T,e as H,f as F,g as Q,j as _}from"./chunk-TISBFSDJ.js";import{c as C,d as S}from"./chunk-75MP7JMV.js";import{a as v,b as V}from"./chunk-X4B3R3ZZ.js";import{a as G}from"./chunk-JY7T2AQQ.js";import"./chunk-3JWV4GE6.js";import"./chunk-ZG3DSWUA.js";import"./chunk-B4F5EPNR.js";import{a as W}from"./chunk-2RLRPKCG.js";import{a as E}from"./chunk-GDUGW6FZ.js";import{d as j}from"./chunk-VESYE5YO.js";import"./chunk-4K7T6AKM.js";import"./chunk-ZS4BGJJV.js";import"./chunk-CTG3GJIM.js";import{b as N}from"./chunk-HKJ3LG3N.js";import"./chunk-VKWDMOR4.js";import{v as q}from"./chunk-54IPDQIZ.js";import"./chunk-D3Q4443B.js";import"./chunk-FLYFNNSN.js";import"./chunk-MGCW5FWH.js";import"./chunk-PPM5D7LH.js";import"./chunk-VB7DZVCI.js";import"./chunk-IVKSZNMI.js";import"./chunk-RR55MLD4.js";import"./chunk-RLU7764Y.js";import"./chunk-SK6YRNXI.js";import"./chunk-YZD4VIE5.js";import"./chunk-7JZCEQFR.js";import"./chunk-G5UIGH4C.js";import"./chunk-S7FGTHFE.js";import"./chunk-A3BDPU5F.js";import"./chunk-66LOFIBP.js";import{c as L}from"./chunk-IT7CEHAJ.js";import"./chunk-FE3FGMNB.js";import"./chunk-BSRCL6RU.js";import"./chunk-IOE6LDPF.js";import"./chunk-RFVZMNYX.js";import"./chunk-MIMJVKJJ.js";import"./chunk-DN65ILSI.js";import"./chunk-NGSA53GC.js";import"./chunk-3WOQY6UL.js";import"./chunk-4FTO3TPH.js";import"./chunk-ZUBJBAUD.js";import"./chunk-Q6BKJZTG.js";import"./chunk-JPOEI7CJ.js";import"./chunk-DJQYZ4RZ.js";import"./chunk-MEN3UW7W.js";import"./chunk-CS3UB2OL.js";import"./chunk-K5KKZWED.js";import"./chunk-FPWA73N6.js";import"./chunk-UOIT5JZ6.js";import"./chunk-AZCKTAUI.js";import"./chunk-W5C7R2LS.js";import"./chunk-TMD6IC6D.js";import"./chunk-CUAM34RQ.js";import"./chunk-EIL7FQC4.js";import"./chunk-IUKERFLT.js";import"./chunk-VWN66V7U.js";import"./chunk-RUQV3BTV.js";import"./chunk-RZ7D5SHS.js";import"./chunk-2Z7HIT5I.js";import"./chunk-QTDZS4U6.js";import"./chunk-G4GX6YKX.js";import"./chunk-3KGUP2SD.js";import"./chunk-W7KGHW4T.js";import"./chunk-MWPFUBXS.js";import"./chunk-CUY2EUSQ.js";import"./chunk-RFNEEDPQ.js";import"./chunk-J533CJUN.js";import"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import"./chunk-D7NKRCIL.js";import"./chunk-56RA6YPN.js";import"./chunk-MFQIJ3HV.js";import"./chunk-MRXKIXVV.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import{a as I}from"./chunk-IRS4HKAR.js";import{a as B,c as ee}from"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-HHEHGERJ.js";import{a as z,b as te}from"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import{c as $,d as ne}from"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";ne();import{Command as ie}from"commander";import t from"chalk";ee();te();import h from"chalk";import{existsSync as oe}from"fs";import{join as P}from"path";var R=class{projectRoot;options;orchestrator;constructor(e){this.options=e,this.projectRoot=e.projectRoot}async checkCodeIntelligence(){if(this.options.skipCodeScan)return console.log(h.yellow(" Code intelligence scan skipped (--skip-code-scan flag)")),{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!1,scanRequested:!1},shouldProceed:!0,skipReason:"skip-flag"};if(await this.hasCodeIntelligenceIndex()){let i=await this.getKGEntryCount();return console.log(h.green(` \u2713 Code intelligence index found (${i} entries)`)),{codeIntelligence:{hasIndex:!0,entryCount:i,wasPrompted:!1,scanRequested:!1},shouldProceed:!0}}return!this.options.nonInteractive&&(console.log(h.yellow(`
3
3
  \u26A0 No code intelligence index found`)),console.log(h.gray(" Building a knowledge graph improves agent accuracy by 80%")),console.log(h.gray(" This is a one-time operation and can be run later with:")),console.log(h.cyan(` aqe code-intelligence index
4
4
  `)),await this.promptScan())?{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!0,scanRequested:!0},shouldProceed:!1,skipReason:"scan-requested"}:(console.log(h.gray(" Continuing without code intelligence index")),{codeIntelligence:{hasIndex:!1,entryCount:0,wasPrompted:!this.options.nonInteractive,scanRequested:!1},shouldProceed:!0})}async runCodeIntelligenceScan(){try{if(console.log(h.blue(`
5
- Building code intelligence knowledge graph...`)),this.orchestrator||(this.orchestrator=new G({projectRoot:this.projectRoot,autoMode:!0,...this.options.initOptions})),await this.hasCodeIntelligenceIndex()){let s=await this.getKGEntryCount();return console.log(h.green(` \u2713 Index already exists (${s} entries)`)),{success:!0,entries:s}}let{KnowledgeGraphService:i}=await import("./knowledge-graph-YUWIDIWW.js"),{InMemoryBackend:c}=await import("./memory-backend-BI2V5AAB.js"),m=new c;await m.initialize();let n=new i(m,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),g=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:this.projectRoot,ignore:["node_modules/**","dist/**","coverage/**",".agentic-qe/**"]});console.log(h.gray(` Indexing ${g.length} files...`));let o=await n.index({paths:g.map(s=>P(this.projectRoot,s)),incremental:!1,includeTests:!0});if(n.destroy(),o.success){let s=o.value.nodesCreated+o.value.edgesCreated;return console.log(h.green(` \u2713 Indexed ${s} knowledge graph entries`)),{success:!0,entries:s}}return console.log(h.yellow(" \u26A0 Code intelligence scan completed with warnings")),{success:!1,entries:0}}catch(e){return console.error(h.red(" \u2717 Code intelligence scan failed:"),B(e)),{success:!1,entries:0}}}async getStatusForAgents(){let e=await this.hasCodeIntelligenceIndex(),i=e?await this.getKGEntryCount():0;return{codeIntelligenceAvailable:e,knowledgeGraphSize:i,recommendedCapabilities:e?["semantic-search","code-analysis","context-aware"]:["basic-analysis"]}}async hasCodeIntelligenceIndex(){let e=P(this.projectRoot,".agentic-qe","memory.db");if(!oe(e))return!1;try{let i=z(e),c=i.prepare(`
5
+ Building code intelligence knowledge graph...`)),this.orchestrator||(this.orchestrator=new G({projectRoot:this.projectRoot,autoMode:!0,...this.options.initOptions})),await this.hasCodeIntelligenceIndex()){let s=await this.getKGEntryCount();return console.log(h.green(` \u2713 Index already exists (${s} entries)`)),{success:!0,entries:s}}let{KnowledgeGraphService:i}=await import("./knowledge-graph-Q5CP47IP.js"),{InMemoryBackend:c}=await import("./memory-backend-52LANEA3.js"),m=new c;await m.initialize();let n=new i(m,{namespace:"code-intelligence:kg",enableVectorEmbeddings:!0}),g=await(await import("fast-glob")).default(["**/*.ts","**/*.tsx","**/*.js","**/*.jsx","**/*.py"],{cwd:this.projectRoot,ignore:["node_modules/**","dist/**","coverage/**",".agentic-qe/**"]});console.log(h.gray(` Indexing ${g.length} files...`));let o=await n.index({paths:g.map(s=>P(this.projectRoot,s)),incremental:!1,includeTests:!0});if(n.destroy(),o.success){let s=o.value.nodesCreated+o.value.edgesCreated;return console.log(h.green(` \u2713 Indexed ${s} knowledge graph entries`)),{success:!0,entries:s}}return console.log(h.yellow(" \u26A0 Code intelligence scan completed with warnings")),{success:!1,entries:0}}catch(e){return console.error(h.red(" \u2717 Code intelligence scan failed:"),B(e)),{success:!1,entries:0}}}async getStatusForAgents(){let e=await this.hasCodeIntelligenceIndex(),i=e?await this.getKGEntryCount():0;return{codeIntelligenceAvailable:e,knowledgeGraphSize:i,recommendedCapabilities:e?["semantic-search","code-analysis","context-aware"]:["basic-analysis"]}}async hasCodeIntelligenceIndex(){let e=P(this.projectRoot,".agentic-qe","memory.db");if(!oe(e))return!1;try{let i=z(e),c=i.prepare(`
6
6
  SELECT COUNT(*) as count FROM kv_store
7
7
  WHERE namespace = 'code-intelligence:kg'
8
8
  `).get();return i.close(),c.count>0}catch{return!1}}async getKGEntryCount(){let e=P(this.projectRoot,".agentic-qe","memory.db");try{let i=z(e),c=i.prepare(`
@@ -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.10.3");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-UIJFU4KD.js";import"./chunk-KTRB3L53.js";import"./chunk-HMFEPKAR.js";import"./chunk-YIYV2JB6.js";import"./chunk-CAMEFWRK.js";export{e as GNNLayerFactory,c as QEGNNEmbeddingIndex,d as QEGNNIndexFactory,f as TensorCompressionFactory,p as batchDifferentiableSearch,i as getDifferentiableSearch,k as getGetCompressionLevel,j as getHierarchicalForward,l as getInit,g as getRuvectorLayer,h as getTensorCompress,b as initGNN,a as isGNNAvailable,m as toFloat32Array,o as toIEmbedding,n as toNumberArray};
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.10.5");process.exit(0)}
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p}from"./chunk-IOE6LDPF.js";import"./chunk-56RA6YPN.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{e as GNNLayerFactory,c as QEGNNEmbeddingIndex,d as QEGNNIndexFactory,f as TensorCompressionFactory,p as batchDifferentiableSearch,i as getDifferentiableSearch,k as getGetCompressionLevel,j as getHierarchicalForward,l as getInit,g as getRuvectorLayer,h as getTensorCompress,b as initGNN,a as isGNNAvailable,m as toFloat32Array,o as toIEmbedding,n as toNumberArray};
@@ -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.10.3");process.exit(0)}
2
- import{b as d}from"./chunk-CTDO2UB2.js";import{a as c,c as f}from"./chunk-3LRK7PYN.js";import"./chunk-CAMEFWRK.js";import*as s from"fs";import*as l from"path";import e from"chalk";f();var h=class{name="heartbeat";description="Manage the token-free heartbeat scheduler";cleanupAndExit;worker;constructor(t){this.cleanupAndExit=t}async getWorker(){if(!this.worker){let{HeartbeatSchedulerWorker:t}=await import("./heartbeat-scheduler-GM3M2MTG.js");this.worker=new t}return this.worker}register(t,o){let a=t.command("heartbeat").description(this.description);a.command("status").description("Show heartbeat worker status, health, and schedule").action(async()=>{await this.executeStatus()}),a.command("run-now").description("Trigger an immediate heartbeat cycle").option("-t, --timeout <ms>","Timeout in milliseconds (default: worker built-in 60s)").action(async n=>{let i=n.timeout?parseInt(n.timeout,10):void 0;await this.executeRunNow(i)}),a.command("history").description("Show recent heartbeat results").option("-n, --count <count>","Number of entries to show","10").action(async n=>{await this.executeHistory(parseInt(n.count,10)||10)}),a.command("log").description("Show today's daily log entries").option("-d, --date <date>","Show log for specific date (YYYY-MM-DD)").action(async n=>{await this.executeLog(n.date)}),a.command("pause").description("Pause the heartbeat worker").action(async()=>{await this.executePause()}),a.command("resume").description("Resume the heartbeat worker").action(async()=>{await this.executeResume()})}async executeStatus(){try{this.worker=await this.getWorker(),await this.worker.initialize();let t=this.worker.getHealth(),o=this.worker.lastResult;if(console.log(e.blue(`
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.10.5");process.exit(0)}
2
+ import{b as d}from"./chunk-3BGGNHHZ.js";import{a as c,c as f}from"./chunk-S73KENCH.js";import"./chunk-S7HQOGVD.js";import*as s from"fs";import*as l from"path";import e from"chalk";f();var h=class{name="heartbeat";description="Manage the token-free heartbeat scheduler";cleanupAndExit;worker;constructor(t){this.cleanupAndExit=t}async getWorker(){if(!this.worker){let{HeartbeatSchedulerWorker:t}=await import("./heartbeat-scheduler-4SBO27BG.js");this.worker=new t}return this.worker}register(t,o){let a=t.command("heartbeat").description(this.description);a.command("status").description("Show heartbeat worker status, health, and schedule").action(async()=>{await this.executeStatus()}),a.command("run-now").description("Trigger an immediate heartbeat cycle").option("-t, --timeout <ms>","Timeout in milliseconds (default: worker built-in 60s)").action(async n=>{let i=n.timeout?parseInt(n.timeout,10):void 0;await this.executeRunNow(i)}),a.command("history").description("Show recent heartbeat results").option("-n, --count <count>","Number of entries to show","10").action(async n=>{await this.executeHistory(parseInt(n.count,10)||10)}),a.command("log").description("Show today's daily log entries").option("-d, --date <date>","Show log for specific date (YYYY-MM-DD)").action(async n=>{await this.executeLog(n.date)}),a.command("pause").description("Pause the heartbeat worker").action(async()=>{await this.executePause()}),a.command("resume").description("Resume the heartbeat worker").action(async()=>{await this.executeResume()})}async executeStatus(){try{this.worker=await this.getWorker(),await this.worker.initialize();let t=this.worker.getHealth(),o=this.worker.lastResult;if(console.log(e.blue(`
3
3
  Heartbeat Scheduler Status`)),console.log(e.gray(" "+"\u2500".repeat(35))),console.log(` Status: ${x(t.status)}`),console.log(` Health Score: ${y(t.healthScore)}${e.gray("/100")}`),this.worker.lastRunAt){let n=p(this.worker.lastRunAt);console.log(` Last Run: ${e.cyan(this.worker.lastRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}else console.log(` Last Run: ${e.gray("never")}`);if(this.worker.nextRunAt){let n=p(this.worker.nextRunAt,!0);console.log(` Next Run: ${e.cyan(this.worker.nextRunAt.toISOString().replace("T"," ").slice(0,19))} ${e.gray(`(${n})`)}`)}console.log(` Total Runs: ${e.cyan(String(t.totalExecutions))}`);let a=t.totalExecutions>0?(t.successfulExecutions/t.totalExecutions*100).toFixed(1):"100.0";if(console.log(` Success Rate: ${e.cyan(a+"%")}`),o?.metrics?.domainMetrics){let n=o.metrics.domainMetrics;console.log(""),console.log(e.blue(" Last Result:")),console.log(` Promoted: ${e.cyan(String(n.promoted??0))} patterns`),console.log(` Deprecated: ${e.cyan(String(n.deprecated??0))} patterns`),console.log(` Decayed: ${e.cyan(String(n.decayed??0))} patterns`),console.log(` Pending Exp: ${e.cyan(String(n.pendingExperiences??0))}`),console.log(` Avg Conf: ${e.cyan(String(n.avgConfidence??0))}`)}console.log(""),await this.cleanupAndExit(0)}catch(t){console.error(e.red(`
4
4
  Failed to get heartbeat status:`),c(t)),await this.cleanupAndExit(1)}}async executeRunNow(t){try{this.worker=await this.getWorker(),console.log(e.blue(`
5
5
  Triggering heartbeat cycle...
@@ -8,7 +8,7 @@ import{b as d}from"./chunk-CTDO2UB2.js";import{a as c,c as f}from"./chunk-3LRK7P
8
8
  Heartbeat History (last ${o.length})`)),console.log(e.gray(" "+"\u2500".repeat(60)));for(let a of o){let n=a.success?e.green("OK"):e.red("FAIL"),i=a.timestamp.slice(0,19).replace("T"," "),u=a.domainMetrics||{};console.log(` ${e.gray(i)} ${n} score:${e.cyan(String(a.healthScore))} +${u.promoted??0}/-${u.deprecated??0} ${e.gray(d(a.durationMs))}`)}console.log(""),await this.cleanupAndExit(0)}catch(o){console.error(e.red(`
9
9
  Failed to load history:`),c(o)),await this.cleanupAndExit(1)}}async executeLog(t){try{let o=t||new Date().toISOString().split("T")[0];if(!/^\d{4}-\d{2}-\d{2}$/.test(o)){console.error(e.red(`
10
10
  Invalid date format: "${o}". Use YYYY-MM-DD.
11
- `)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-RISHEANP.js"),n=l.join(a(),".agentic-qe","logs"),i=l.join(n,`${o}.md`);if(!s.existsSync(i)){console.log(e.yellow(`
11
+ `)),await this.cleanupAndExit(1);return}let{findProjectRoot:a}=await import("./unified-memory-27QJHABO.js"),n=l.join(a(),".agentic-qe","logs"),i=l.join(n,`${o}.md`);if(!s.existsSync(i)){console.log(e.yellow(`
12
12
  No daily log found for ${o}.
13
13
  `)),await this.cleanupAndExit(0);return}let u=s.readFileSync(i,"utf-8");console.log(e.blue(`
14
14
  Daily Log \u2014 ${o}`)),console.log(e.gray(" "+"\u2500".repeat(40)));for(let g of u.split(`
@@ -45,4 +45,4 @@ Examples:
45
45
  aqe heartbeat log --date 2026-03-25
46
46
  aqe heartbeat pause
47
47
  aqe heartbeat resume
48
- `}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-RISHEANP.js");return l.join(r(),".agentic-qe","heartbeat-history.json")}async function b(r){try{let t=await w(),o=l.dirname(t);s.existsSync(o)||s.mkdirSync(o,{recursive:!0});let a=[];if(s.existsSync(t))try{a=JSON.parse(s.readFileSync(t,"utf-8"))}catch{a=[]}a.unshift({timestamp:r.timestamp.toISOString(),success:r.success,durationMs:r.durationMs,healthScore:r.metrics.healthScore,domainMetrics:r.metrics.domainMetrics}),a.length>m&&(a=a.slice(0,m)),s.writeFileSync(t,JSON.stringify(a,null,2))}catch{}}async function S(r){try{let t=await w();return s.existsSync(t)?JSON.parse(s.readFileSync(t,"utf-8")).slice(0,r):[]}catch{return[]}}function x(r){switch(r){case"idle":return e.cyan(r);case"running":return e.yellow(r);case"paused":return e.yellow(r);case"stopped":return e.gray(r);case"error":return e.red(r);default:return e.white(r)}}function y(r){return r>=80?e.green(String(r)):r>=50?e.yellow(String(r)):e.red(String(r))}function k(r){switch(r){case"improving":return e.green(r);case"stable":return e.cyan(r);case"degrading":return e.red(r);default:return e.gray(r)}}function p(r,t=!1){let o=t?r.getTime()-Date.now():Date.now()-r.getTime();return o<0?t?"now":"just now":o<6e4?`${Math.floor(o/1e3)}s ${t?"from now":"ago"}`:o<36e5?`${Math.floor(o/6e4)}m ${t?"from now":"ago"}`:`${Math.floor(o/36e5)}h ${t?"from now":"ago"}`}function A(r){return new h(r)}export{h as HeartbeatHandler,A as createHeartbeatHandler};
48
+ `}},m=100;async function w(){let{findProjectRoot:r}=await import("./unified-memory-27QJHABO.js");return l.join(r(),".agentic-qe","heartbeat-history.json")}async function b(r){try{let t=await w(),o=l.dirname(t);s.existsSync(o)||s.mkdirSync(o,{recursive:!0});let a=[];if(s.existsSync(t))try{a=JSON.parse(s.readFileSync(t,"utf-8"))}catch{a=[]}a.unshift({timestamp:r.timestamp.toISOString(),success:r.success,durationMs:r.durationMs,healthScore:r.metrics.healthScore,domainMetrics:r.metrics.domainMetrics}),a.length>m&&(a=a.slice(0,m)),s.writeFileSync(t,JSON.stringify(a,null,2))}catch{}}async function S(r){try{let t=await w();return s.existsSync(t)?JSON.parse(s.readFileSync(t,"utf-8")).slice(0,r):[]}catch{return[]}}function x(r){switch(r){case"idle":return e.cyan(r);case"running":return e.yellow(r);case"paused":return e.yellow(r);case"stopped":return e.gray(r);case"error":return e.red(r);default:return e.white(r)}}function y(r){return r>=80?e.green(String(r)):r>=50?e.yellow(String(r)):e.red(String(r))}function k(r){switch(r){case"improving":return e.green(r);case"stable":return e.cyan(r);case"degrading":return e.red(r);default:return e.gray(r)}}function p(r,t=!1){let o=t?r.getTime()-Date.now():Date.now()-r.getTime();return o<0?t?"now":"just now":o<6e4?`${Math.floor(o/1e3)}s ${t?"from now":"ago"}`:o<36e5?`${Math.floor(o/6e4)}m ${t?"from now":"ago"}`:`${Math.floor(o/36e5)}h ${t?"from now":"ago"}`}function A(r){return new h(r)}export{h as HeartbeatHandler,A as createHeartbeatHandler};
@@ -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.10.5");process.exit(0)}
2
+ import{b as a}from"./chunk-OJNG6ZXG.js";import"./chunk-PYBVFG6T.js";import"./chunk-PGNQR2VM.js";import"./chunk-RZ7D5SHS.js";import"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import"./chunk-D7NKRCIL.js";import"./chunk-56RA6YPN.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import"./chunk-S73KENCH.js";import"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{a as HeartbeatSchedulerWorker};
@@ -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.10.5");process.exit(0)}
2
+ import{a,c as b}from"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";b();export{a as HnswAdapter};
@@ -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.10.5");process.exit(0)}
2
+ import{a,b,c,d}from"./chunk-MRXKIXVV.js";import"./chunk-RLZDXQNM.js";import"./chunk-VC256KH2.js";import"./chunk-MJRYHHOG.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";export{a as DEFAULT_HNSW_CONFIG,b as HNSWIndex,d as benchmarkHNSW,c as createHNSWIndex};
@@ -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.10.3");process.exit(0)}
2
- import"./chunk-CAMEFWRK.js";var s=class{adapter;metadataMap=new Map;insertCount=0;constructor(e){this.adapter=e}async initialize(){}async insert(e,t,r){this.adapter.addByStringId(e,t),this.insertCount++,r&&this.metadataMap.set(e,r)}async search(e,t){return this.adapter.searchByArray(e,t).map(a=>({key:a.id,score:a.score,distance:1-a.score,metadata:this.metadataMap.get(a.id)}))}async batchInsert(e){for(let t of e)await this.insert(t.key,t.vector,t.metadata)}async delete(e){let t=this.adapter.removeByStringId(e);return t&&this.metadataMap.delete(e),t}async getStats(){return{nativeHNSW:!0,backendType:"ruvector-gnn",vectorCount:this.adapter.size(),indexSizeBytes:this.adapter.size()*this.adapter.dimensions()*4,avgSearchLatencyMs:this.adapter.lastSearchLatencyMs,p95SearchLatencyMs:0,p99SearchLatencyMs:0,searchOperations:0,insertOperations:this.insertCount}}async clear(){this.adapter.clear(),this.metadataMap.clear(),this.insertCount=0}isNativeAvailable(){return!0}};export{s as HnswLegacyBridge};
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.10.5");process.exit(0)}
2
+ import"./chunk-S7HQOGVD.js";var s=class{adapter;metadataMap=new Map;insertCount=0;constructor(e){this.adapter=e}async initialize(){}async insert(e,t,r){this.adapter.addByStringId(e,t),this.insertCount++,r&&this.metadataMap.set(e,r)}async search(e,t){return this.adapter.searchByArray(e,t).map(a=>({key:a.id,score:a.score,distance:1-a.score,metadata:this.metadataMap.get(a.id)}))}async batchInsert(e){for(let t of e)await this.insert(t.key,t.vector,t.metadata)}async delete(e){let t=this.adapter.removeByStringId(e);return t&&this.metadataMap.delete(e),t}async getStats(){return{nativeHNSW:!0,backendType:"ruvector-gnn",vectorCount:this.adapter.size(),indexSizeBytes:this.adapter.size()*this.adapter.dimensions()*4,avgSearchLatencyMs:this.adapter.lastSearchLatencyMs,p95SearchLatencyMs:0,p99SearchLatencyMs:0,searchOperations:0,insertOperations:this.insertCount}}async clear(){this.adapter.clear(),this.metadataMap.clear(),this.insertCount=0}isNativeAvailable(){return!0}};export{s as HnswLegacyBridge};
@@ -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.10.3");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-VRXY4T22.js";import"./chunk-CAMEFWRK.js";p();export{i as DotProductAttention,h as FlashAttention,k as HyperbolicAttention,l as LinearAttention,m as MoEAttention,j as MultiHeadAttention,b as RuvectorLayer,n as SonaEngine,c as TensorCompress,a as default,d as differentiableSearch,f as getCompressionLevel,e as hierarchicalForward,g as init,o as pipeline};
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.10.5");process.exit(0)}
2
+ import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,q as p}from"./chunk-A7HGS7FW.js";import"./chunk-S7HQOGVD.js";p();export{i as DotProductAttention,h as FlashAttention,k as HyperbolicAttention,l as LinearAttention,m as MoEAttention,j as MultiHeadAttention,b as RuvectorLayer,n as SonaEngine,c as TensorCompress,a as default,d as differentiableSearch,f as getCompressionLevel,e as hierarchicalForward,g as init,o as pipeline};
@@ -0,0 +1,285 @@
1
+ #!/usr/bin/env node
2
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.10.5");process.exit(0)}
3
+ import{a as K}from"./chunk-5D7GLMT3.js";import{a as v,b as fe,c as he}from"./chunk-FLYFNNSN.js";import{a as ue}from"./chunk-K5KKZWED.js";import{a as pe,b as ge}from"./chunk-TMD6IC6D.js";import{d as z,h as ne}from"./chunk-CUAM34RQ.js";import"./chunk-EIL7FQC4.js";import"./chunk-IUKERFLT.js";import"./chunk-VWN66V7U.js";import"./chunk-RUQV3BTV.js";import{b as X}from"./chunk-RZ7D5SHS.js";import"./chunk-2Z7HIT5I.js";import"./chunk-QTDZS4U6.js";import"./chunk-G4GX6YKX.js";import{a as me}from"./chunk-RFNEEDPQ.js";import"./chunk-J533CJUN.js";import{i as j,m as M}from"./chunk-R573V37S.js";import"./chunk-YEO2Z3UX.js";import{b as R}from"./chunk-D7NKRCIL.js";import{b as le,d as $e}from"./chunk-56RA6YPN.js";import"./chunk-MFQIJ3HV.js";import{a as xe}from"./chunk-RLZDXQNM.js";import{c as de}from"./chunk-VC256KH2.js";import"./chunk-IRS4HKAR.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-KIMJPTHD.js";import"./chunk-2UQWVF4P.js";import"./chunk-HPKYIK7R.js";import"./chunk-MJRYHHOG.js";import"./chunk-RONMVGCT.js";import"./chunk-IWRORKD7.js";import"./chunk-GTVXVYKE.js";import"./chunk-ZTC64OJE.js";import"./chunk-O5OOUMBB.js";import"./chunk-S7HQOGVD.js";import{Command as st}from"commander";import x from"chalk";import ke from"node:path";M();import{randomUUID as U}from"crypto";import H from"chalk";var F="dream-scheduler:hook-state";async function D(o){try{let e=await o.get(F);return e||(e={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0}),e.experienceCount++,await o.set(F,e),e.experienceCount}catch{return 0}}async function G(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let{initializeExperienceCapture:n}=await import("./experience-capture-middleware-HRO3EGIW.js");await n();let r=t.getDatabase();try{r.pragma("busy_timeout = 60000")}catch{}let s=`cli-${Date.now()}-${U().slice(0,8)}`,a=o.durationMs||0,c;if(o.success){let i=a>0&&a<5e3?.1:0,h=o.source.includes("post-task")?.1:o.source.includes("post-edit")?.05:0;c=Math.min(.95,.7+i+h)}else{let i=o.source.includes("post-task")?.15:o.source.includes("post-edit")?.1:0;c=Math.min(.6,.3+i)}r.prepare(`
4
+ INSERT OR REPLACE INTO captured_experiences
5
+ (id, task, agent, domain, success, quality, duration_ms,
6
+ started_at, completed_at, source)
7
+ VALUES (?, ?, ?, ?, ?, ?, ?, datetime('now'), datetime('now'), ?)
8
+ `).run(s,o.task.slice(0,500),o.agent,o.domain,o.success?1:0,c,a,o.source),(async()=>{try{let{computeRealEmbedding:i}=await import("./real-embeddings-W3GNAEJO.js"),h=`${o.domain}: ${o.task}`.slice(0,512),l=await i(h);r.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(l).buffer),l.length,s)}catch{}})()}catch(e){console.error(H.dim(`[hooks] persistCommandExperience: ${e instanceof Error?e.message:"unknown"}`))}}async function oe(o){let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}try{n.exec(`
9
+ CREATE TABLE IF NOT EXISTS captured_experiences (
10
+ id TEXT PRIMARY KEY,
11
+ task TEXT NOT NULL,
12
+ agent TEXT NOT NULL,
13
+ domain TEXT NOT NULL DEFAULT '',
14
+ success INTEGER NOT NULL DEFAULT 0,
15
+ quality REAL NOT NULL DEFAULT 0.5,
16
+ duration_ms INTEGER NOT NULL DEFAULT 0,
17
+ model_tier INTEGER,
18
+ routing_json TEXT,
19
+ steps_json TEXT,
20
+ result_json TEXT,
21
+ error TEXT,
22
+ started_at TEXT NOT NULL DEFAULT (datetime('now')),
23
+ completed_at TEXT NOT NULL DEFAULT (datetime('now')),
24
+ source TEXT DEFAULT 'middleware',
25
+ application_count INTEGER DEFAULT 0,
26
+ avg_token_savings REAL DEFAULT 0,
27
+ embedding BLOB,
28
+ embedding_dimension INTEGER,
29
+ tags TEXT,
30
+ last_applied_at TEXT
31
+ );
32
+ CREATE TABLE IF NOT EXISTS experience_applications (
33
+ id TEXT PRIMARY KEY,
34
+ experience_id TEXT NOT NULL,
35
+ task TEXT NOT NULL,
36
+ success INTEGER NOT NULL,
37
+ tokens_saved INTEGER DEFAULT 0,
38
+ feedback TEXT,
39
+ applied_at TEXT DEFAULT (datetime('now')),
40
+ FOREIGN KEY (experience_id) REFERENCES captured_experiences(id) ON DELETE CASCADE
41
+ );
42
+ CREATE INDEX IF NOT EXISTS idx_exp_apps_experience ON experience_applications(experience_id);
43
+ `)}catch{}try{let u=n.prepare("PRAGMA table_info(qe_trajectories)").all();u.length>0&&!u.some(E=>E.name==="metadata_json")&&n.exec("ALTER TABLE qe_trajectories ADD COLUMN metadata_json TEXT")}catch{}let r=`exp-${Date.now()}-${U().slice(0,8)}`,s=`${o.agent}:${o.taskId}`,a=o.durationMs??0,c=o.success?1:0,i=a<100?1:a<500?.8:a<2e3?.6:a<5e3?.4:a<1e4?.2:.1,h=.25*c+.325+.1*i,l=null,p=0,d=0,k=n.transaction(()=>{n.prepare(`
44
+ INSERT INTO captured_experiences
45
+ (id, task, agent, domain, success, quality, duration_ms,
46
+ model_tier, started_at, completed_at, source)
47
+ VALUES (?, ?, ?, ?, ?, ?, ?, NULL, datetime('now'), datetime('now'), ?)
48
+ `).run(r,s.slice(0,500),o.agent,o.domain??"general",o.success?1:0,h,a,"cli-hook-post-task"),n.prepare(`
49
+ INSERT INTO experience_applications
50
+ (id, experience_id, task, success, tokens_saved, feedback, applied_at)
51
+ VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
52
+ `).run(`app-${Date.now()}-${U().slice(0,8)}`,r,s,o.success?1:0,Math.round(h*100),`[Patch 060] post-task outcome: ${o.success?"success":"failure"}`);try{let m=n.prepare(`
53
+ SELECT key, value FROM kv_store
54
+ WHERE namespace = 'task-bridge'
55
+ AND (expires_at IS NULL OR expires_at > strftime('%s','now') * 1000)
56
+ ORDER BY created_at DESC
57
+ LIMIT 1
58
+ `).get();if(m?.value)try{l=JSON.parse(m.value)}catch{l=null}if(l&&Array.isArray(l.selectedPatternIds)&&l.selectedPatternIds.length>0){let T=l.estimatedTokenSavings&&l.selectedPatternIds.length?Math.round(l.estimatedTokenSavings/l.selectedPatternIds.length):0,I=n.prepare(`
59
+ INSERT INTO experience_applications
60
+ (id, experience_id, task, success, tokens_saved, feedback, applied_at)
61
+ VALUES (?, ?, ?, ?, ?, ?, datetime('now'))
62
+ `),L=n.prepare(`
63
+ SELECT tier, successful_uses, success_rate, confidence
64
+ FROM qe_patterns
65
+ WHERE id = ?
66
+ `),P=n.prepare(`
67
+ UPDATE qe_patterns
68
+ SET tier = 'long-term', updated_at = datetime('now')
69
+ WHERE id = ?
70
+ AND tier = 'short-term'
71
+ AND successful_uses >= 3
72
+ AND success_rate >= 0.7
73
+ AND confidence >= 0.6
74
+ `);for(let S of l.selectedPatternIds){I.run(`app-${Date.now()}-${U().slice(0,8)}`,r,`${s}:pattern:${S}`,o.success?1:0,T,`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`);try{me(n,{patternId:S,success:o.success,metrics:{tokens_saved:T,source:"cli-hook-post-task",experience_id:r},feedback:`[Patch 160+300] task-bridge pattern_id=${S} ts=${T}`})}catch{}try{let q=L.get(S);q?.tier==="short-term"&&q.successful_uses>=3&&q.success_rate>=.7&&q.confidence>=.6&&P.run(S)}catch{}}m&&n.prepare("DELETE FROM kv_store WHERE namespace='task-bridge' AND key = ?").run(m.key)}}catch(m){console.error(H.dim(`[hooks] post-task bridge: ${m instanceof Error?m.message:"unknown"}`))}let u=`traj-${Date.now()}-${U().slice(0,8)}`,E=o.parentAgentId!==void 0||o.depth!==void 0?JSON.stringify({...o.parentAgentId!==void 0?{parentAgentId:o.parentAgentId}:{},...o.depth!==void 0?{depth:o.depth}:{}}):null;n.prepare(`
75
+ INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json, metadata_json)
76
+ VALUES (?, ?, ?, ?, datetime('now'), datetime('now'), ?, ?, ?)
77
+ `).run(u,s,o.agent,o.domain??"general",o.success?1:0,JSON.stringify([{step:1,task:o.taskId,success:o.success}]),E);try{let m=n.prepare(`
78
+ SELECT id, task, agent, success, started_at, completed_at
79
+ FROM captured_experiences
80
+ WHERE consolidated_into IS NULL
81
+ AND task LIKE ?
82
+ AND started_at > datetime('now', '-1 hour')
83
+ ORDER BY started_at ASC
84
+ `).all(`%:${o.taskId}`);if(m.length>=2){let T=`traj-multi-${Date.now()}-${U().slice(0,8)}`,I=JSON.stringify(m.map((S,q)=>({step:q+1,task:S.task,agent:S.agent,success:!!S.success,started_at:S.started_at,completed_at:S.completed_at}))),L=m.every(S=>!!S.success);n.prepare(`
85
+ INSERT INTO qe_trajectories (id, task, agent, domain, started_at, ended_at, success, steps_json)
86
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
87
+ `).run(T,`multi:${o.taskId}`,o.agent,o.domain??"general",m[0].started_at,m[m.length-1].completed_at,L?1:0,I);let P=m.map(()=>"?").join(",");n.prepare(`UPDATE captured_experiences SET consolidated_into = ? WHERE id IN (${P})`).run(T,...m.map(S=>S.id)),p=m.length}}catch(m){console.error(H.dim(`[hooks] post-task stitch: ${m instanceof Error?m.message:"unknown"}`))}if(o.success)try{d=n.prepare(`
88
+ UPDATE dream_insights
89
+ SET applied = COALESCE(applied, 0) + 1
90
+ WHERE id IN (
91
+ SELECT id FROM dream_insights
92
+ WHERE actionable = 1
93
+ ORDER BY created_at DESC
94
+ LIMIT 3
95
+ )
96
+ `).run().changes??0}catch{}});try{k()}catch(u){console.error(H.dim(`[hooks] persistTaskOutcome txn: ${u instanceof Error?u.message:"unknown"}`))}return(async()=>{try{let{computeRealEmbedding:u}=await import("./real-embeddings-W3GNAEJO.js"),E=`${o.domain??"general"}: ${s}`.slice(0,512),m=await u(E);n.prepare("UPDATE captured_experiences SET embedding = ?, embedding_dimension = ? WHERE id = ?").run(Buffer.from(new Float32Array(m).buffer),m.length,r)}catch{}})(),{experienceId:r,qualityScore:h,bridge:l,stitchedSiblings:p,insightsApplied:d}}async function W(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}let r=`${o.taskType}|${o.priority}|${o.domain||"any"}`,s=o.agent,a=`q-learning:aqe-hook-router:${r}:${s}`,c=o.success?.1:-1,i=.1,h=.9,l=n.prepare(`
97
+ SELECT q_value FROM rl_q_values WHERE id = ?
98
+ `).get(a),p=l&&typeof l.q_value=="number"?l.q_value:0,d=n.prepare(`
99
+ SELECT MAX(q_value) AS m FROM rl_q_values WHERE state_key = ?
100
+ `).get(r),k=d&&typeof d.m=="number"?d.m:0,u=p+i*(c+h*k-p);n.prepare(`
101
+ INSERT INTO rl_q_values
102
+ (id, algorithm, agent_id, state_key, action_key, q_value, visits, last_reward, domain, created_at, updated_at)
103
+ VALUES (?, 'q-learning', 'aqe-hook-router', ?, ?, ?, 1, ?, ?, datetime('now'), datetime('now'))
104
+ ON CONFLICT(algorithm, agent_id, state_key, action_key) DO UPDATE SET
105
+ q_value = excluded.q_value,
106
+ visits = visits + 1,
107
+ last_reward = excluded.last_reward,
108
+ updated_at = datetime('now')
109
+ `).run(a,r,s,u,c,o.domain||"any")}catch(e){console.error(H.dim(`[hooks] q-learning update: ${e instanceof Error?e.message:"unknown"}`))}}async function re(o){try{let{getUnifiedMemory:e}=await import("./unified-memory-27QJHABO.js"),t=e();t.isInitialized()||await t.initialize();let n=t.getDatabase();try{n.pragma("busy_timeout = 60000")}catch{}n.prepare(`
110
+ UPDATE routing_outcomes
111
+ SET success = ?, quality_score = ?, duration_ms = ?
112
+ WHERE id IN (
113
+ SELECT id FROM routing_outcomes
114
+ WHERE quality_score = -1
115
+ AND task_json LIKE '%"taskId"%'
116
+ AND created_at > datetime('now', '-30 minutes')
117
+ ORDER BY (CASE WHEN used_agent = ? THEN 0 ELSE 1 END), created_at DESC
118
+ LIMIT 1
119
+ )
120
+ `).run(o.success?1:0,o.qualityScore,o.durationMs,o.agent)}catch(e){console.error(H.dim(`[hooks] routing UPDATE: ${e instanceof Error?e.message:"unknown"}`))}}async function se(){let{getUnifiedMemory:o}=await import("./unified-memory-27QJHABO.js"),e=o();e.isInitialized()||await e.initialize();let t=e.getDatabase();try{t.pragma("busy_timeout = 60000")}catch{}let n=new Set(t.prepare("PRAGMA table_info(captured_experiences)").all().map(i=>i.name)),r=[["consolidated_into","TEXT DEFAULT NULL"],["consolidation_count","INTEGER DEFAULT 1"],["quality_updated_at","TEXT DEFAULT NULL"],["reuse_success_count","INTEGER DEFAULT 0"],["reuse_failure_count","INTEGER DEFAULT 0"]];for(let[i,h]of r)n.has(i)||t.exec(`ALTER TABLE captured_experiences ADD COLUMN ${i} ${h}`);let s=t.prepare(`
121
+ SELECT
122
+ domain,
123
+ agent,
124
+ COUNT(*) as cnt,
125
+ AVG(quality) as avg_quality,
126
+ SUM(success) as successes,
127
+ CAST(SUM(success) AS REAL) / COUNT(*) as success_rate,
128
+ AVG(duration_ms) as avg_duration,
129
+ GROUP_CONCAT(DISTINCT source) as sources
130
+ FROM captured_experiences
131
+ WHERE application_count = 0
132
+ GROUP BY domain, agent
133
+ HAVING cnt >= 3 AND avg_quality >= 0.5 AND success_rate >= 0.6
134
+ ORDER BY avg_quality DESC
135
+ LIMIT 50
136
+ `).all();if(s.length===0)return 0;let{v4:a}=await import("./dist-node-LU4E7PI6.js"),c=0;for(let i of s)try{let h=new Date().toISOString().slice(0,7),l=`${i.agent}-${i.domain}-${h}`,p=t.prepare(`
137
+ SELECT id FROM qe_patterns
138
+ WHERE qe_domain = ? AND name = ?
139
+ LIMIT 1
140
+ `).get(i.domain,l);if(p)t.prepare(`
141
+ UPDATE qe_patterns
142
+ SET usage_count = usage_count + ?,
143
+ successful_uses = successful_uses + ?,
144
+ confidence = MIN(0.99, confidence + 0.01),
145
+ quality_score = MIN(0.99, quality_score + 0.005),
146
+ updated_at = datetime('now')
147
+ WHERE id = ?
148
+ `).run(i.cnt,i.successes,p.id);else{let d=a(),k=Math.min(.95,i.avg_quality*.8+i.success_rate*.2),u=k*.3+Math.min(i.cnt,100)/100*.2+i.success_rate*.5,E=`Auto-consolidated from ${i.cnt} experiences. Agent: ${i.agent}, success rate: ${(i.success_rate*100).toFixed(0)}%`,m=(i.sources||"").split(",").filter(Boolean);t.prepare(`
149
+ INSERT INTO qe_patterns (
150
+ id, pattern_type, qe_domain, domain, name, description,
151
+ confidence, usage_count, success_rate, quality_score, tier,
152
+ template_json, context_json, created_at, successful_uses
153
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, datetime('now'), ?)
154
+ `).run(d,"workflow",i.domain,i.domain,l,E,k,i.cnt,i.success_rate,u,"short-term",JSON.stringify({type:"workflow",content:`${i.agent} pattern for ${i.domain}`,variables:[]}),JSON.stringify({tags:m,sourceType:"session-consolidation",extractedAt:new Date().toISOString()}),i.successes);let{ensurePatternEmbedding:T}=await import("./embed-and-insert-pattern-7RBA5NDK.js");await T(t,d,l,E,m),c++}t.prepare(`
155
+ UPDATE captured_experiences
156
+ SET application_count = application_count + 1
157
+ WHERE domain = ? AND agent = ? AND application_count = 0
158
+ `).run(i.domain,i.agent)}catch{}return c}var g={reasoningBank:null,hookRegistry:null,coherenceService:null,sessionId:null,initialized:!1,initializationPromise:null};async function _(){if(g.initializationPromise&&await g.initializationPromise,g.initialized&&g.reasoningBank&&g.hookRegistry)return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry};if(g.initializationPromise=Ie(),await g.initializationPromise,g.initializationPromise=null,!g.reasoningBank||!g.hookRegistry)throw new Error("Failed to initialize hooks system");return{reasoningBank:g.reasoningBank,hookRegistry:g.hookRegistry}}async function Ie(){if(!g.initialized)try{let o=R(),e=ke.join(o,".agentic-qe"),t=await O(e);try{g.coherenceService=await pe(ge),console.log(x.dim("[hooks] CoherenceService initialized with WASM engines"))}catch(a){console.log(x.dim(`[hooks] CoherenceService WASM unavailable, using fallback: ${a instanceof Error?a.message:"unknown"}`))}g.reasoningBank=ne(t,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0},g.coherenceService??void 0);let n=1e4,r=new AbortController,s=setTimeout(()=>r.abort(new Error("ReasoningBank init timeout")),n);try{await g.reasoningBank.initialize({signal:r.signal})}finally{clearTimeout(s)}try{let{getSharedRvfDualWriter:a}=await import("./shared-rvf-dual-writer-QOPOIRIC.js"),c=await a();c&&g.reasoningBank.setRvfDualWriter(c)}catch(a){process.env.DEBUG&&console.debug("[hooks] RVF wiring skipped:",a instanceof Error?a.message:a)}g.hookRegistry=he(g.reasoningBank),g.initialized=!0,console.log(x.dim("[hooks] System initialized"))}catch(o){console.warn(x.yellow(`[hooks] Using fallback mode: ${o instanceof Error?o.message:"unknown error"}`));let e=Le();g.reasoningBank=ne(e,void 0,{enableLearning:!0,enableGuidance:!0,enableRouting:!0}),g.hookRegistry=new fe,g.hookRegistry.initialize(g.reasoningBank),g.initialized=!0}}function C(o){try{o.pragma("busy_timeout = 60000")}catch{}}async function O(o){let t=new ue({sqlite:{path:ke.join(o,"memory.db"),walMode:!0,poolSize:3,busyTimeout:6e4},enableFallback:!0,defaultNamespace:"qe-patterns"}),n=new AbortController,r=setTimeout(()=>n.abort(new Error("Backend init timeout")),5e3);try{await t.initialize({signal:n.signal})}finally{clearTimeout(r)}return t}function Le(){let o=new Map;return{initialize:async()=>{},dispose:async()=>{o.clear()},get:async e=>{let t=o.get(e);return t?t.value:void 0},set:async(e,t,n)=>{o.set(e,{value:t})},delete:async e=>o.delete(e),has:async e=>o.has(e),search:async(e,t)=>{let n=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(n.replace(/\*/g,".*"));return Array.from(o.keys()).filter(s=>r.test(s))},vectorSearch:async(e,t)=>[],storeVector:async(e,t,n)=>{},count:async e=>{let t=0,n=`${e}:`;for(let r of o.keys())r.startsWith(n)&&t++;return t},hasCodeIntelligenceIndex:async()=>{let e="code-intelligence:kg:";for(let t of o.keys())if(t.startsWith(e))return!0;return!1}}}function f(o){console.log(JSON.stringify(o,null,2))}function N(o){console.log(x.green("\u2713"),o)}function b(o){console.error(x.red("\u2717"),o)}function Y(o){if(o.length===0){console.log(x.dim(" No specific guidance"));return}o.forEach((e,t)=>{console.log(x.cyan(` ${t+1}.`),e)})}async function Z(o=500){return process.stdin.isTTY?"":new Promise(e=>{let t="",n=setTimeout(()=>{process.stdin.removeAllListeners(),process.stdin.pause(),e(t)},o);process.stdin.setEncoding("utf8"),process.stdin.on("data",r=>{t+=r}),process.stdin.on("end",()=>{clearTimeout(n),e(t)}),process.stdin.on("error",()=>{clearTimeout(n),e(t)}),process.stdin.resume()})}function ye(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return""}let t=e.tool_input,n=e.toolInput,r=[t?.file_path,t?.filePath,n?.file_path,n?.filePath,e.file_path,e.filePath];for(let s of r)if(typeof s=="string"&&s.trim())return s;return""}import $ from"chalk";import Pe from"node:path";M();function Ee(o){o.command("pre-edit").description("Get context and guidance before editing a file").requiredOption("-f, --file <path>","File path to edit").option("-o, --operation <type>","Operation type: create, update, delete, refactor","update").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),r=(await t.emit(v.PreTestGeneration,{targetFile:e.file,testType:"unit",operation:e.operation}))[0]||{success:!0,guidance:[],routing:null};if(e.json){let s=r.guidance||[],c=[r.routing?.recommendedAgent?`Recommended agent: ${r.routing.recommendedAgent} (${(r.routing.confidence*100).toFixed(0)}% confidence).`:"",...s.map(i=>i)].filter(Boolean).join(" ");f({hookSpecificOutput:{hookEventName:"PreToolUse",additionalContext:c||void 0},file:e.file,operation:e.operation,patterns:r.routing?.patterns?.length||0})}else console.log($.bold(`
159
+ \u{1F4DD} Pre-Edit Analysis`)),console.log($.dim(` File: ${e.file}`)),console.log($.dim(` Operation: ${e.operation}`)),r.routing&&(console.log($.bold(`
160
+ \u{1F3AF} Recommended Agent:`),$.cyan(r.routing.recommendedAgent)),console.log($.dim(` Confidence: ${(r.routing.confidence*100).toFixed(1)}%`))),console.log($.bold(`
161
+ \u{1F4A1} Guidance:`)),Y(r.guidance||[]);return}catch(t){throw b(`pre-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-edit").description("Record editing outcome for pattern learning").requiredOption("-f, --file <path>","File path that was edited").option("--success","Edit was successful").option("--failure","Edit failed").option("--pattern-id <id>","Pattern ID that was applied").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=e.success||!e.failure,r=e.file||"";if(!r.trim())try{let p=await Z();r=ye(p)}catch{}let s=r.split("/").pop()||"unknown",c=/\.(test|spec)\.(ts|js|tsx|jsx)$/.test(s)?"test-generation":"code-intelligence",i=e.patternId||`edit:${c}:${s}`,l=(await t.emit(v.PostTestGeneration,{targetFile:r,success:n,patternId:i,generatedTests:null,testCount:0}))[0]||{success:!0,patternsLearned:0};try{let{reasoningBank:p}=await _();await p.recordOutcome({patternId:i,success:n,metrics:{executionTimeMs:0},feedback:`Edit ${n?"succeeded":"failed"}: ${r}`})}catch{}try{await G({task:`edit: ${r}`,agent:"cli-hook",domain:c,success:n,source:"cli-hook-post-edit"})}catch{}try{let p=R(),d=Pe.join(p,".agentic-qe"),k=await O(d);await D(k)}catch{}e.json?f({success:!0,file:r,editSuccess:n,patternsLearned:l.patternsLearned||0,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Recorded edit outcome for ${r||"(unknown file)"}`),l.patternsLearned&&console.log($.green(` Patterns learned: ${l.patternsLearned}`)));return}catch(t){throw b(`post-edit failed: ${t instanceof Error?t.message:"unknown"}`),t}})}import{randomUUID as Ce}from"crypto";M();import A from"chalk";import qe from"node:path";function je(o){if(!o.trim())return"";let e;try{e=JSON.parse(o)}catch{return o.trim()}let t=[e.prompt,e.user_prompt,e.command,e.tool_input?.prompt,e.tool_input?.description,e.toolInput?.prompt,e.toolInput?.description];for(let n of t)if(typeof n=="string"&&n.trim())return n;return""}function Te(o){o.command("route").description("Route a task to the optimal QE agent").option("-t, --task <description>","Task description (falls back to stdin event JSON)").option("-d, --domain <domain>","Target QE domain hint").option("-c, --capabilities <caps...>","Required capabilities").option("--json","Output as JSON").action(async e=>{try{let t=e.task??"";if(!t.trim()){let c=await Z();t=je(c)}if(!t.trim())throw new Error("No task provided. Pass --task <description> or pipe a Claude Code hook event JSON to stdin.");let{reasoningBank:n}=await _(),r={task:t,domain:e.domain,capabilities:e.capabilities},s=await n.routeTask(r);if(!s.success)throw new Error(s.error.message);let a=s.value;e.json?f({recommendedAgent:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,domains:a.domains,patternCount:a.patterns.length,guidance:a.guidance,reasoning:a.reasoning,exploration:a.exploration??!1,criticality:a.criticality??null,qWeight:a.qWeight??null}):(console.log(A.bold(`
162
+ \u{1F3AF} Task Routing Result`)),console.log(A.dim(` Task: "${t}"`)),console.log(A.bold(`
163
+ \u{1F464} Recommended Agent:`),A.cyan(a.recommendedAgent)),console.log(A.dim(` Confidence: ${(a.confidence*100).toFixed(1)}%`)),a.alternatives.length>0&&(console.log(A.bold(`
164
+ \u{1F504} Alternatives:`)),a.alternatives.forEach(c=>{console.log(A.dim(` - ${c.agent}: ${(c.score*100).toFixed(1)}%`))})),console.log(A.bold(`
165
+ \u{1F4C2} Detected Domains:`),a.domains.join(", ")),console.log(A.bold(`
166
+ \u{1F4A1} Guidance:`)),Y(a.guidance),console.log(A.bold(`
167
+ \u{1F4D6} Reasoning:`),A.dim(a.reasoning)));try{let{getUnifiedMemory:c}=await import("./unified-memory-27QJHABO.js"),i=c();i.isInitialized()||await i.initialize();let h=i.getDatabase();C(h),K(h);let l=`route-${Date.now()}-${Ce().slice(0,8)}`,p=a.confidence<.5,d=a;h.prepare(`
168
+ INSERT OR REPLACE INTO routing_outcomes (
169
+ id, task_json, decision_json, used_agent,
170
+ followed_recommendation, success, quality_score,
171
+ duration_ms, error,
172
+ exploration, criticality, q_weight
173
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
174
+ `).run(l,JSON.stringify({description:t,domain:e.domain}),JSON.stringify({recommended:a.recommendedAgent,confidence:a.confidence,alternatives:a.alternatives,lowConfidence:p,exploration:d.exploration??!1,criticality:d.criticality??null,qWeight:d.qWeight??null}),a.recommendedAgent,1,0,-1,0,p?"low-confidence":null,d.exploration?1:0,d.criticality??null,d.qWeight??null);let k=R(),u=qe.join(k,".agentic-qe"),E=await O(u);await D(E)}catch(c){console.error(A.dim(`[hooks] route persist: ${c instanceof Error?c.message:"unknown"}`))}return}catch(t){throw b(`route failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("post-route").description("Close the most-recent route sentinel from a Stop hook (#451)").option("--success [bool]","Whether the turn completed successfully","true").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=.325+(t?.25:0)+.1,r=j();r.isInitialized()||await r.initialize();let s=r.getDatabase();C(s);let a=s.prepare(`
175
+ SELECT id, task_json, used_agent FROM routing_outcomes
176
+ WHERE quality_score = -1
177
+ AND task_json NOT LIKE '%"taskId"%'
178
+ ORDER BY created_at DESC
179
+ LIMIT 1
180
+ `).get(),c=a?s.prepare(`
181
+ UPDATE routing_outcomes
182
+ SET success = ?, quality_score = ?, duration_ms = 0, error = NULL
183
+ WHERE id = ?
184
+ `).run(t?1:0,n,a.id):{changes:0};if(a)try{let h=JSON.parse(a.task_json),l=String(h.description??"");l&&await W({taskType:z(l),priority:"normal",domain:X(l)[0]??"any",agent:a.used_agent,success:t})}catch{}let i=s.prepare(`
185
+ UPDATE routing_outcomes
186
+ SET success = 0,
187
+ quality_score = 0.325,
188
+ duration_ms = 0,
189
+ error = 'stale-sentinel'
190
+ WHERE quality_score = -1
191
+ AND task_json NOT LIKE '%"taskId"%'
192
+ AND created_at < datetime('now', '-300 seconds')
193
+ `).run();e.json?f({success:!0,resolved:c.changes>0,staleSwept:i.changes,qualityScore:n,turnSuccess:t}):i.changes>0&&console.log(A.dim(`[hooks] post-route: swept ${i.changes} stale sentinel(s)`));return}catch(t){e.json?f({success:!1,error:t instanceof Error?t.message:"unknown"}):console.error(A.dim(`[hooks] post-route: ${t instanceof Error?t.message:"unknown"}`));return}})}import y from"chalk";$e();function _e(o){o.command("stats").description("Display hooks system statistics").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.getStats();if(e.json)f(n);else{console.log(y.bold(`
194
+ \u{1F4CA} Hooks System Statistics
195
+ `)),console.log(y.bold("Patterns:")),console.log(` Total: ${y.cyan(n.totalPatterns)}`),console.log(` Short-term: ${n.patternStoreStats.byTier.shortTerm}`),console.log(` Long-term: ${n.patternStoreStats.byTier.longTerm}`),console.log(y.bold(`
196
+ By Domain:`));for(let[r,s]of Object.entries(n.byDomain))s>0&&console.log(` ${r}: ${s}`);console.log(y.bold(`
197
+ Routing:`)),console.log(` Requests: ${n.routingRequests}`),console.log(` Avg Confidence: ${(n.avgRoutingConfidence*100).toFixed(1)}%`),console.log(y.bold(`
198
+ Learning:`)),console.log(` Outcomes: ${n.learningOutcomes}`),console.log(` Success Rate: ${(n.patternSuccessRate*100).toFixed(1)}%`),console.log(y.bold(`
199
+ Search Performance:`)),console.log(` Operations: ${n.patternStoreStats.searchOperations}`),console.log(` Avg Latency: ${n.patternStoreStats.avgSearchLatencyMs.toFixed(2)}ms`),console.log(` HNSW Native: ${n.patternStoreStats.hnswStats.nativeAvailable?"\u2713":"\u2717"}`)}}catch(t){throw b(`stats failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("list").description("List all registered QE hook events").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n=t.getRegisteredEvents();if(e.json)f({events:n,totalEvents:Object.keys(v).length,registeredEvents:n.length});else{console.log(y.bold(`
200
+ \u{1F4CB} Registered QE Hook Events
201
+ `)),console.log(y.bold("All Available Events:"));for(let[r,s]of Object.entries(v)){let c=n.includes(s)?y.green("\u2713"):y.dim("\u25CB");console.log(` ${c} ${r}: ${y.dim(s)}`)}console.log(y.dim(`
202
+ Registered: ${n.length}/${Object.keys(v).length}`))}}catch(t){throw b(`list failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("emit").description("Emit a QE hook event").requiredOption("-e, --event <name>","Event name (e.g., qe:pattern-applied)").option("-d, --data <json>","Event data as JSON","{}").option("--json","Output as JSON").action(async e=>{try{let{hookRegistry:t}=await _(),n;try{n=le(e.data)}catch{throw new Error(`Invalid JSON data: ${e.data}`)}let r=await t.emit(e.event,n);e.json?f({event:e.event,results:r}):(console.log(y.bold(`
203
+ \u{1F4E1} Hook Event Emitted`)),console.log(y.dim(` Event: ${e.event}`)),console.log(y.dim(` Handlers: ${r.length}`)),r.forEach((s,a)=>{let c=s.success?y.green("\u2713"):y.red("\u2717");console.log(` ${c} Handler ${a+1}: ${s.success?"success":s.error}`),s.patternsLearned&&console.log(y.green(` Patterns learned: ${s.patternsLearned}`))}))}catch(t){throw b(`emit failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("learn").description("Store a new pattern in the reasoning bank").requiredOption("-n, --name <name>","Pattern name").requiredOption("-d, --description <desc>","Pattern description").option("-t, --type <type>","Pattern type","test-template").option("--domain <domain>","QE domain").option("--tags <tags...>","Pattern tags").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.storePattern({patternType:e.type,name:e.name,description:e.description,template:{type:"prompt",content:e.description,variables:[]},context:{tags:e.tags||[]}});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({success:!0,pattern:{id:r.id,name:r.name,type:r.patternType,domain:r.qeDomain}}):(N(`Pattern stored: ${r.name}`),console.log(y.dim(` ID: ${r.id}`)),console.log(y.dim(` Domain: ${r.qeDomain}`)),console.log(y.dim(` Tier: ${r.tier}`)))}catch(t){throw b(`learn failed: ${t instanceof Error?t.message:"unknown"}`),t}}),o.command("search").description("Search for patterns in the reasoning bank").requiredOption("-q, --query <query>","Search query").option("-l, --limit <n>","Maximum results","10").option("-d, --domain <domain>","Filter by domain").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=await t.searchPatterns(e.query,{limit:parseInt(e.limit,10),domain:e.domain});if(!n.success)throw new Error(n.error.message);let r=n.value;e.json?f({query:e.query,total:r.length,patterns:r.map(s=>({id:s.pattern.id,name:s.pattern.name,score:s.score,domain:s.pattern.qeDomain,matchType:s.matchType}))}):(console.log(y.bold(`
204
+ \u{1F50D} Search Results for "${e.query}"
205
+ `)),r.length===0?console.log(y.dim(" No patterns found")):r.forEach((s,a)=>{console.log(`${y.cyan(`${a+1}.`)} ${s.pattern.name} ${y.dim(`(${(s.score*100).toFixed(1)}%)`)}`),console.log(y.dim(` Domain: ${s.pattern.qeDomain}`)),console.log(y.dim(` Match: ${s.matchType}`)),console.log(y.dim(` ID: ${s.pattern.id}`)),console.log()}),console.log(y.dim(`Found ${r.length} pattern(s)`)))}catch(t){throw b(`search failed: ${t instanceof Error?t.message:"unknown"}`),t}})}M();import J from"chalk";import Me from"node:path";function Se(o){o.command("session-start").description("Initialize session state when Claude Code session starts").option("-s, --session-id <id>","Session ID").option("--json","Output as JSON").action(async e=>{try{let t=e.sessionId||`session-${Date.now()}`;g.sessionId=t;let{reasoningBank:n}=await _(),r=await n.getStats(),s=R(),a=Me.join(s,".agentic-qe"),c=await O(a),i=await c.get(F),h=!i||!i.sessionStartTime;i?(i.sessionStartTime=new Date().toISOString(),i.totalDreamsThisSession=0):i={lastDreamTime:null,experienceCount:0,sessionStartTime:new Date().toISOString(),totalDreamsThisSession:0},await c.set(F,i);let l=[];l.push(`AQE Learning: ${r.totalPatterns} patterns loaded`);let p=Object.entries(r.byDomain).filter(([,k])=>k>0).sort(([,k],[,u])=>u-k).slice(0,5);p.length>0&&l.push(`Top domains: ${p.map(([k,u])=>`${k}(${u})`).join(", ")}`),r.patternSuccessRate>0&&l.push(`Pattern success rate: ${(r.patternSuccessRate*100).toFixed(0)}%`),r.routingRequests>0&&l.push(`Routing confidence: ${(r.avgRoutingConfidence*100).toFixed(0)}% across ${r.routingRequests} requests`);let d=l.join(". ")+".";e.json?f({hookSpecificOutput:{hookEventName:"SessionStart",additionalContext:d},sessionId:t,initialized:!0,patternsLoaded:r.totalPatterns,dreamScheduler:{enabled:!0,lastDreamTime:i.lastDreamTime,pendingExperiences:i.experienceCount}}):(N(`Session started: ${t}`),console.log(J.dim(` Patterns loaded: ${r.totalPatterns}`)),console.log(J.dim(` Dream scheduler: enabled (${i.experienceCount} pending experiences)`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("session-end").description("Save session state when Claude Code session ends").option("--save-state","Save learning state to disk").option("--export-metrics","Export session metrics").option("--json","Output as JSON").action(async e=>{try{let t=g.sessionId||"unknown",n=null;if(g.initialized&&g.reasoningBank)try{n=await g.reasoningBank.getStats()}catch{}let r=0;try{r=await se()}catch{}if(e.json){let s=n?`Session complete: ${n.totalPatterns} patterns, ${n.routingRequests} routings, ${(n.patternSuccessRate*100).toFixed(0)}% success rate`:"Session complete";f({continue:!0,sessionId:t,stateSaved:e.saveState||!1,metricsExported:e.exportMetrics||!1,patternsConsolidated:r,finalStats:n?{patternsLearned:n.totalPatterns,routingRequests:n.routingRequests,successRate:n.patternSuccessRate}:null})}else N(`Session ended: ${t}`),n&&(console.log(J.dim(` Patterns: ${n.totalPatterns}`)),console.log(J.dim(` Routing requests: ${n.routingRequests}`))),r>0&&console.log(J.dim(` Patterns consolidated: ${r}`));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{createHash as We,randomUUID as Je}from"node:crypto";import w from"chalk";import Qe from"node:path";M();xe();import{readFileSync as Ue}from"node:fs";import{homedir as He}from"node:os";var ee=de.create("nagual-client");function Fe(){try{let o=Ue(`${He()}/.nagual/cloud-hooks.env`,"utf8");for(let e of o.split(`
206
+ `)){let t=e.match(/^(?:export\s+)?NAGUAL_CLOUD_KEY=(.+)/);if(t)return t[1].trim().replace(/^['"]|['"]$/g,"")}}catch{}}var Be="http://localhost:3333",be=3e3,ze=5e3;var ie=class{baseUrl;token;enabled;constructor(){this.baseUrl=process.env.NAGUAL_URL??Be,this.token=process.env.NAGUAL_CLOUD_KEY??process.env.NAGUAL_API_TOKEN??Fe(),this.enabled=!0}async search(e,t,n=5){try{let r=await fetch(`${this.baseUrl}/api/patterns/search`,{method:"POST",headers:this.headers(),body:JSON.stringify({query:e,domain:t,limit:n}),signal:AbortSignal.timeout(be)});return r.ok?(await r.json()).patterns??[]:[]}catch{return[]}}async recordOutcome(e,t){try{let n=await fetch(`${this.baseUrl}/api/patterns/${encodeURIComponent(e)}/outcome`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(be)});n.ok||ee.debug("nagual recordOutcome non-OK",{patternId:e,status:n.status})}catch(n){ee.debug("nagual recordOutcome failed (non-fatal)",{patternId:e,err:n})}}async promotePattern(e){let t={problem:e.problem,solution:e.solution,domain:e.domain,reward:e.reward*.8,tags:[...e.tags??[],"source:aqe",e.source_project?`project:${e.source_project}`:null].filter(n=>n!==null)};try{let n=await fetch(`${this.baseUrl}/api/patterns`,{method:"POST",headers:this.headers(),body:JSON.stringify(t),signal:AbortSignal.timeout(ze)});n.ok||ee.debug("nagual promotePattern non-OK",{status:n.status})}catch(n){ee.debug("nagual promotePattern failed (non-fatal)",{err:n})}}headers(){let e={"Content-Type":"application/json"};return this.token&&(e.Authorization=`Bearer ${this.token}`),e}},ae;function we(){return ae||(ae=new ie),ae}var Ge=/^[A-Za-z0-9][A-Za-z0-9_.:-]{0,127}$/;function Re(o,e){let t={};if(o!==void 0){if(!Ge.test(o))return{error:`Invalid --parent-agent-id "${o}": must start with a letter or digit and contain only letters, digits, "_", ".", ":", "-" (max 128 chars)`};t.parentAgentId=o}if(e!==void 0){let n=typeof e=="number"?e:Number(e);if(!Number.isInteger(n))return{error:`Invalid --depth "${e}": must be an integer`};if(n<0)return{error:`Invalid --depth ${n}: must be >= 0`};if(n>32)return{error:`Invalid --depth ${n}: must be <= 32`};t.depth=n}return t}var Ve="task-bridge",Xe=6e5,Ae=.5;function Ke(o){return We("sha256").update(o).digest("hex").slice(0,16)}var Ye=new Set(["test-generation","coverage-analysis","defect-intelligence","security-compliance","quality-assessment","requirements-validation"]),Ze=80;async function et(o,e){return!process.env.NAGUAL_URL&&!process.env.NAGUAL_CLOUD_URL&&!process.env.NAGUAL_CLOUD_KEY?[]:o.length<Ze?[]:e&&!Ye.has(e)?[]:we().search(o.slice(0,300),e,3)}function ve(o){o.command("pre-task").description("Get context and guidance before spawning a Task agent").option("--task-id <id>","Task identifier").option("-d, --description <desc>","Task description").option("--json","Output as JSON").action(async e=>{try{let{reasoningBank:t}=await _(),n=null;if(e.description){let d=await t.routeTask({task:e.description});d.success&&(n=d.value)}let r=(n?.patterns??[]).slice(0,5).map(d=>d?.id).filter(d=>typeof d=="string"),s=n?.domains?.[0],a=e.description?await et(String(e.description),s):[],c=null,i=[],h=0,l=null;try{let d=j();d.isInitialized()||await d.initialize();let k=d.getDatabase();C(k);try{let u=k.prepare(`
207
+ SELECT used_agent AS agent,
208
+ ROUND(AVG(quality_score), 3) AS avgQuality,
209
+ COUNT(*) AS n
210
+ FROM routing_outcomes
211
+ WHERE success = 1 AND quality_score >= 0
212
+ GROUP BY used_agent
213
+ ORDER BY avgQuality DESC, n DESC
214
+ LIMIT 1
215
+ `).get();u&&(c=u)}catch{}try{i=k.prepare(`
216
+ SELECT key, value
217
+ FROM kv_store
218
+ WHERE namespace = 'verdicts'
219
+ AND created_at > datetime('now', '-7 days')
220
+ ORDER BY created_at DESC
221
+ LIMIT 3
222
+ `).all().map(E=>({key:E.key,summary:String(E.value).slice(0,200)}))}catch{}if(r.length>0)try{let u=r.map(()=>"?").join(","),E=k.prepare(`
223
+ SELECT COALESCE(SUM(average_token_savings), 0) AS sum
224
+ FROM qe_patterns
225
+ WHERE id IN (${u})
226
+ `).get(...r);h=Math.max(0,Math.round(E?.sum??0))}catch{}if(e.description)try{let u=String(e.description),E=z(u),m="normal",T=n?.domains?.[0]??"any",I=Math.max(0,Math.min(10,Math.round(Math.min(u.length/200,1)*10)));l=`task:${Ke(u)}`;let L=JSON.stringify({selectedPatternIds:r,agent:n?.recommendedAgent??null,description:u.slice(0,200),taskType:E,priority:m,domain:T,complexityBucket:I,estimatedTokenSavings:h,ts:Date.now()}),P=Date.now()+Xe;k.prepare(`
227
+ INSERT OR REPLACE INTO kv_store (key, namespace, value, expires_at, created_at)
228
+ VALUES (?, ?, ?, ?, strftime('%s','now')*1000)
229
+ `).run(l,Ve,L,P)}catch(u){console.error(w.dim(`[hooks] pre-task bridge: ${u instanceof Error?u.message:"unknown"}`))}if(n?.recommendedAgent)try{K(k);let u=e.taskId||`hook-${Date.now()}`,E=`route-${Date.now()}-${Je().slice(0,8)}`,m=n.confidence<Ae,T=n;k.prepare(`
230
+ INSERT INTO routing_outcomes (
231
+ id, task_json, decision_json, used_agent,
232
+ followed_recommendation, success, quality_score,
233
+ duration_ms, error,
234
+ exploration, criticality, q_weight
235
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
236
+ `).run(E,JSON.stringify({description:e.description,taskId:u}),JSON.stringify({recommended:n.recommendedAgent,confidence:n.confidence,alternatives:n.alternatives,lowConfidence:m,exploration:T.exploration??!1,criticality:T.criticality??null,qWeight:T.qWeight??null}),n.recommendedAgent,1,0,-1,0,m?"low-confidence":null,T.exploration?1:0,T.criticality??null,T.qWeight??null)}catch(u){console.error(w.dim(`[hooks] pre-task sentinel: ${u instanceof Error?u.message:"unknown"}`))}}catch(d){console.error(w.dim(`[hooks] pre-task memory: ${d instanceof Error?d.message:"unknown"}`))}let p=n?n.confidence<Ae:!1;if(e.json)f({success:!0,taskId:e.taskId,description:e.description,recommendedAgent:n?.recommendedAgent,confidence:n?.confidence,guidance:n?.guidance||[],selectedPatternIds:r,historicalBest:c,priorVerdicts:i,estimatedTokenSavings:h,lowConfidence:p,bridgeKey:l,nagualPatterns:a.map(d=>({id:d.id,problem:d.problem,solution:d.solution.slice(0,400),domain:d.domain,reward:d.reward}))});else if(console.log(w.bold(`
237
+ \u{1F680} Pre-Task Analysis`)),console.log(w.dim(` Task ID: ${e.taskId||"N/A"}`)),n&&(console.log(w.bold(`
238
+ \u{1F3AF} Recommended:`),w.cyan(n.recommendedAgent)),console.log(w.dim(` Confidence: ${(n.confidence*100).toFixed(1)}%`)),p&&console.log(w.yellow(" \u26A0 Low confidence \u2014 consider providing more context"))),a.length>0){console.log(w.bold(`
239
+ \u{1F4DA} Nagual context (cross-project):`));for(let d of a)console.log(w.dim(` [${d.domain}] ${d.problem.slice(0,80)} (reward: ${d.reward.toFixed(2)})`))}return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}}),o.command("post-task").description("Record task outcome for pattern learning").option("--task-id <id>","Task identifier").option("--success [bool]","Whether task succeeded","true").option("--agent <name>","Agent that executed the task").option("--duration <ms>","Task duration in milliseconds").option("-d, --description <desc>","Task description \u2014 fallback Q-state source when pre-task bridge is absent (issue #499)").option("--parent-agent-id <id>","Agent that spawned this task (ADR-101 nesting provenance)").option("--depth <n>","Nesting depth of this task, 0 = top-level (ADR-101)").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=Re(e.parentAgentId,e.depth);if(n.error){e.json?console.log(JSON.stringify({success:!1,error:n.error})):console.error(w.red(` \u2717 ${n.error}`)),process.exitCode=1;return}let r=0;try{let{hookRegistry:s,reasoningBank:a}=await _();r=(await s.emit(v.QEAgentCompletion,{taskId:e.taskId,success:t,agent:e.agent,duration:e.duration?parseInt(e.duration,10):void 0,timestamp:Date.now()})).reduce((p,d)=>p+(d.patternsLearned||0),0);{let p=e.taskId||`hook-${Date.now()}`,d=e.agent||"unknown",k=e.duration?parseInt(e.duration,10):0,u=(n.parentAgentId?`, Parent: ${n.parentAgentId}`:"")+(n.depth!==void 0?`, Depth: ${n.depth}`:"");await a.recordOutcome({patternId:`task:${d}:${p}`,success:t,metrics:{executionTimeMs:k},feedback:`Agent: ${d}, Task: ${p}${u}`});let E=await oe({taskId:p,agent:d,durationMs:k,success:t,parentAgentId:n.parentAgentId,depth:n.depth}),m=d==="unknown"&&E.bridge?.agent?E.bridge.agent:d;await re({agent:m,success:t,durationMs:k,qualityScore:E.qualityScore});let T=String(e.description??"");if(E.bridge||T){let I=E.bridge?.taskType??z(T),L=E.bridge?.priority??"normal",P=E.bridge?.domain??X(T)[0]??"any";await W({taskType:I,priority:L,domain:P,agent:m,success:t})}}let i=R(),h=Qe.join(i,".agentic-qe"),l=await O(h);await D(l)}catch(s){console.error(w.dim(`[hooks] Learning init: ${s instanceof Error?s.message:"unknown"}`))}e.json?f({success:!0,taskId:e.taskId,taskSuccess:t,patternsLearned:r,dreamTriggered:!1,dreamReason:"deferred-to-kernel"}):(N(`Task completed: ${e.taskId||"unknown"}`),console.log(w.dim(` Success: ${t}`)),r>0&&console.log(w.green(` Patterns learned: ${r}`)));return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}import{existsSync as tt,readFileSync as nt}from"node:fs";import{randomUUID as Oe}from"node:crypto";import V from"chalk";import Ne from"node:path";M();import*as B from"fs";import*as te from"path";var Q=class o{statePath;warnThreshold;blockThreshold;halfOpenAfterMs;staleAfterMs;constructor(e){this.statePath=e.statePath,this.warnThreshold=e.warnThreshold??3,this.blockThreshold=e.blockThreshold??5,this.halfOpenAfterMs=e.halfOpenAfterMs??12e4,this.staleAfterMs=e.staleAfterMs??30*6e4}static signature(e){return e.trim().replace(/\s+/g," ").slice(0,200)}check(e,t=Date.now()){let n=o.signature(e);if(!n)return{verdict:"allow",consecutiveFailures:0,halfOpen:!1};let r=this.readState()[n];if(!r||r.consecutiveFailures<this.warnThreshold)return{verdict:"allow",consecutiveFailures:r?.consecutiveFailures??0,halfOpen:!1};let s=r.consecutiveFailures;return s>=this.blockThreshold?t-r.lastFailureAt>=this.halfOpenAfterMs?{verdict:"warn",consecutiveFailures:s,halfOpen:!0,hint:`This command has failed ${s}x consecutively; allowing one probe attempt. If it fails again it will be flagged immediately.`}:{verdict:"block",consecutiveFailures:s,halfOpen:!1,hint:`The same command failed ${s}x consecutively. Re-running it unchanged is unlikely to succeed \u2014 inspect the error output, change the approach, or fix the underlying problem first. (A successful run resets this breaker.)`}:{verdict:"warn",consecutiveFailures:s,halfOpen:!1,hint:`This command has failed ${s}x consecutively \u2014 consider changing approach before retrying.`}}record(e,t,n=Date.now()){let r=o.signature(e);if(r)try{let s=this.readState();if(t){s[r]&&(delete s[r],this.writeState(s,n));return}let a=s[r]??{consecutiveFailures:0,lastFailureAt:n};a.consecutiveFailures+=1,a.lastFailureAt=n,s[r]=a,this.writeState(s,n)}catch{}}static isStrict(e=process.env){return e.AQE_STRICT_TOOL_LOOP==="1"||e.AQE_STRICT_TOOL_LOOP==="true"}readState(){try{let e=B.readFileSync(this.statePath,"utf8"),t=JSON.parse(e);return typeof t=="object"&&t!==null?t:{}}catch{return{}}}writeState(e,t){for(let[n,r]of Object.entries(e))t-r.lastFailureAt>this.staleAfterMs&&delete e[n];B.mkdirSync(te.dirname(this.statePath),{recursive:!0}),B.writeFileSync(this.statePath,JSON.stringify(e))}};function ce(o){return new Q({statePath:te.join(o,".agentic-qe","tool-loop-state.json")})}function ot(o){return/\bjest\b/i.test(o)?"jest":/\bvitest\b/i.test(o)?"vitest":/\bpytest\b/i.test(o)?"pytest":/\bmocha\b/i.test(o)?"mocha":null}async function rt(o){try{let e=j();e.isInitialized()||await e.initialize();let t=e.getDatabase();C(t);let n=o.framework==="pytest"?"python":"javascript",r=o.command.split(/\s+/).slice(0,3).join("-").slice(0,80);t.prepare(`
240
+ INSERT INTO test_outcomes (
241
+ id, test_id, test_name, generated_by, framework, language, domain,
242
+ passed, execution_time_ms, maintainability_score, created_at
243
+ ) VALUES (?, ?, ?, 'cli-hook-post-command', ?, ?, 'test-execution',
244
+ ?, ?, 0.5, datetime('now'))
245
+ `).run(`to-${Date.now()}-${Oe().slice(0,8)}`,`cmd:${r}`,o.command.slice(0,200),o.framework,n,o.success?1:0,o.durationMs);try{let s=Ne.join(process.cwd(),"coverage","coverage-summary.json");if(tt(s)){let c=JSON.parse(nt(s,"utf-8")).total??{},i=Number(c.lines?.pct??0),h=Number(c.branches?.pct??0),l=Number(c.functions?.pct??0),p=t.prepare(`
246
+ SELECT after_lines, after_branches, after_functions
247
+ FROM coverage_sessions
248
+ WHERE target_path = ?
249
+ ORDER BY created_at DESC
250
+ LIMIT 1
251
+ `).get(process.cwd()),d=new Date().toISOString();t.prepare(`
252
+ INSERT INTO coverage_sessions (
253
+ id, target_path, agent_id, technique,
254
+ before_lines, before_branches, before_functions,
255
+ after_lines, after_branches, after_functions,
256
+ tests_generated, tests_passed, duration_ms,
257
+ started_at, completed_at
258
+ ) VALUES (?, ?, 'cli-hook-post-command', ?, ?, ?, ?, ?, ?, ?, 0, ?, ?, ?, ?)
259
+ `).run(`cs-${Date.now()}-${Oe().slice(0,8)}`,process.cwd(),o.framework,p?.after_lines??0,p?.after_branches??0,p?.after_functions??0,i,h,l,o.success?1:0,o.durationMs,d,d)}}catch(s){console.error(V.dim(`[hooks] coverage_sessions: ${s instanceof Error?s.message:"unknown"}`))}}catch(e){console.error(V.dim(`[hooks] test_outcomes: ${e instanceof Error?e.message:"unknown"}`))}}function De(o){o.command("guard").description("File guardian - block edits to protected files").requiredOption("-f, --file <path>","File path to check").option("--json","Output as JSON (required for hook API)").action(async e=>{try{let t=e.file||"",n=t.replace(/\\/g,"/"),s=[{pattern:/^\.env($|\.)/,reason:"Environment file contains secrets"},{pattern:/\.env\.[a-zA-Z]+$/,reason:"Environment file contains secrets"},{pattern:/\.lock$/,reason:"Lock files are auto-generated"},{pattern:/(^|\/)node_modules\//,reason:"node_modules is managed by package manager"},{pattern:/(^|\/)\.agentic-qe\/memory\.db/,reason:"AQE memory database must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-wal$/,reason:"AQE WAL file must not be directly edited"},{pattern:/(^|\/)\.agentic-qe\/memory\.db-shm$/,reason:"AQE shared memory file must not be directly edited"}].find(a=>a.pattern.test(n));s?e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Protected file: ${s.reason} (${t})`}}):b(`Blocked: ${s.reason} (${t})`):e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}}):N(`Allowed: ${t}`);return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("pre-command").description("Get context before executing a Bash command").option("-c, --command <cmd>","Command to be executed").option("--json","Output as JSON").action(async e=>{try{let t=e.command||"",n=[{pattern:/rm\s+(-[a-zA-Z]*f[a-zA-Z]*\s+)?-[a-zA-Z]*r[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+(-[a-zA-Z]*r[a-zA-Z]*\s+)?-[a-zA-Z]*f[a-zA-Z]*\s+\/(?!\w)/,reason:"Recursive delete of root filesystem"},{pattern:/rm\s+-rf\s+~/,reason:"Recursive delete of home directory"},{pattern:/DROP\s+(TABLE|DATABASE|SCHEMA)/i,reason:"Destructive SQL operation"},{pattern:/git\s+push\s+.*--force(?!-)/,reason:"Force push can overwrite remote history"},{pattern:/git\s+reset\s+--hard/,reason:"Hard reset discards uncommitted changes"},{pattern:/>\s*\/dev\/sd[a-z]/,reason:"Direct write to block device"},{pattern:/dd\s+if=.*of=\/dev\/sd/,reason:"Direct disk write via dd"},{pattern:/chmod\s+777\s/,reason:"World-writable permissions are a security risk"},{pattern:/:\(\)\s*\{\s*:\|\s*:&\s*\}\s*;?\s*:/,reason:"Fork bomb detected"},{pattern:/mkfs\./,reason:"Filesystem format operation"},{pattern:/>\s*\/dev\/null\s*2>&1\s*&\s*disown/,reason:"Stealth background process"}],r=[{pattern:/\.agentic-qe.*rm/,reason:"Deleting AQE data files"},{pattern:/rm\s+-rf\s/,reason:"Recursive force delete"},{pattern:/git\s+clean\s+-[a-zA-Z]*f/,reason:"Force cleaning untracked files"}],s=n.find(i=>i.pattern.test(t)),a=r.filter(i=>i.pattern.test(t)).map(i=>i.reason),c=null;try{c=ce(R()).check(t)}catch{}if(c&&c.verdict==="block"&&Q.isStrict()){e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Tool-loop breaker (AQE_STRICT_TOOL_LOOP): ${c.hint}`}}):b(`Blocked by tool-loop breaker: ${c.hint}`);return}if(c&&c.verdict==="block"?a.push(`\u{1F6D1} TOOL-LOOP BREAKER: ${c.hint}`):c&&c.verdict==="warn"&&a.push(`Tool-loop breaker: ${c.hint}`),s)e.json?f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"deny",permissionDecisionReason:`Dangerous command blocked: ${s.reason}`}}):b(`Blocked: ${s.reason}`);else if(e.json){let i={hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}};a.length>0&&(i.hookSpecificOutput.additionalContext=`Warnings: ${a.join("; ")}`),f(i)}else a.length>0&&(console.log(V.yellow(`
260
+ \u26A0\uFE0F Command Warnings:`)),a.forEach(i=>console.log(V.yellow(` - ${i}`))));return}catch{e.json&&f({hookSpecificOutput:{hookEventName:"PreToolUse",permissionDecision:"allow"}});return}}),o.command("post-command").description("Record Bash command outcome").option("-c, --command <cmd>","Command that was executed").option("--success [bool]","Whether command succeeded","true").option("--exit-code <code>","Command exit code").option("--json","Output as JSON").action(async e=>{try{let t=e.success==="true"||e.success===!0,n=e.exitCode?parseInt(e.exitCode,10):t?0:1,r=(e.command||"").substring(0,200);try{ce(R()).record(r,t)}catch{}let s=/\b(test|vitest|jest|pytest|mocha)\b/i.test(r),a=/\b(build|compile|tsc)\b/i.test(r),c=/\b(lint|eslint|prettier)\b/i.test(r),i=0,h=!1;try{let{reasoningBank:l}=await _();if(s){let{hookRegistry:T}=await _();await T.emit(v.TestExecutionResult,{runId:`cmd-${Date.now()}`,patternId:`cmd:test:${r.split(/\s+/).slice(0,3).join("-")}`,passed:t?1:0,failed:t?0:1,duration:0,flaky:!1})}let p=r.replace(/[^a-zA-Z0-9]/g,"-").slice(0,80),d=s?"test-execution":a?"code-intelligence":c?"quality-assessment":"code-intelligence";await l.recordOutcome({patternId:`cmd:${p}`,success:t,metrics:{executionTimeMs:0},feedback:`Command: ${r}, exit: ${n}`}),i=1,(s||a||c)&&(await G({task:`bash: ${r}`,agent:"cli-hook",domain:d,success:t,source:"cli-hook-post-command"}),h=!0);let k=ot(r);k&&await rt({command:r,framework:k,success:t,durationMs:0});let u=R(),E=Ne.join(u,".agentic-qe"),m=await O(E);await D(m)}catch(l){console.error(V.dim(`[hooks] post-command learning: ${l instanceof Error?l.message:"unknown"}`))}e.json&&f({success:!0,command:r.substring(0,100),commandSuccess:t,exitCode:n,patternsLearned:i,experienceRecorded:h});return}catch(t){e.json&&f({success:!1,error:t instanceof Error?t.message:"unknown"});return}})}function xn(){let o=new st("hooks").description("Self-learning QE hooks for pattern recognition and guidance").addHelpText("after",`
261
+ Examples:
262
+ # File editing hooks (learning from edits)
263
+ aqe hooks pre-edit --file src/utils.ts --operation create
264
+ aqe hooks post-edit --file src/utils.ts --success
265
+
266
+ # Task routing and guidance
267
+ aqe hooks route --task "Generate tests for UserService"
268
+ aqe hooks pre-task --description "Generate tests" --json
269
+ aqe hooks post-task --task-id "task-123" --success true
270
+ aqe hooks post-route --success true --json # Stop hook (#451)
271
+
272
+ # Bash command hooks
273
+ aqe hooks pre-command --command "npm test" --json
274
+ aqe hooks post-command --command "npm test" --success true
275
+
276
+ # Session lifecycle (Stop hook)
277
+ aqe hooks session-start --session-id "session-123"
278
+ aqe hooks session-end --save-state --json
279
+
280
+ # Pattern management
281
+ aqe hooks learn --name "test-pattern" --description "A test pattern"
282
+ aqe hooks search --query "authentication"
283
+ aqe hooks stats
284
+ aqe hooks list
285
+ `);return Ee(o),Te(o),_e(o),Se(o),ve(o),De(o),o}export{v as QE_HOOK_EVENTS,xn as createHooksCommand,_ as getHooksSystem,g as hooksState};
@@ -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.10.5");process.exit(0)}
2
+ import{a,b,c}from"./chunk-JPOEI7CJ.js";import"./chunk-DJQYZ4RZ.js";import"./chunk-MEN3UW7W.js";import"./chunk-CS3UB2OL.js";import"./chunk-MWPFUBXS.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-S7HQOGVD.js";export{a as HybridRouter,b as createHybridRouter,c as createQERouter};
@@ -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.10.3");process.exit(0)}
2
- import{a,b,c,d,e}from"./chunk-MQOFFRTA.js";import"./chunk-R5ONQAQL.js";import"./chunk-KTRB3L53.js";import"./chunk-3LRK7PYN.js";import"./chunk-RTDHWOAG.js";import"./chunk-CAMEFWRK.js";export{a as DEFAULT_HYPERGRAPH_ENGINE_CONFIG,b as HypergraphEngine,c as createHypergraphEngine,d as createHypergraphEngineSync,e as default};
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.10.5");process.exit(0)}
2
+ import{a,b,c,d,e}from"./chunk-NGSA53GC.js";import"./chunk-YEO2Z3UX.js";import"./chunk-56RA6YPN.js";import"./chunk-S73KENCH.js";import"./chunk-7DU35D4M.js";import"./chunk-S7HQOGVD.js";export{a as DEFAULT_HYPERGRAPH_ENGINE_CONFIG,b as HypergraphEngine,c as createHypergraphEngine,d as createHypergraphEngineSync,e as default};