agentic-qe 3.14.6 → 3.14.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (416) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +74 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/cli/bundle.js +8 -8
  5. package/dist/cli/chunks/adapter-TVQKH65T.js +2 -0
  6. package/dist/cli/chunks/{agent-booster-wasm-2YGML6OU.js → agent-booster-wasm-AK2W76RG.js} +2 -2
  7. package/dist/cli/chunks/{agent-handler-D5SSQYNU.js → agent-handler-MGZCWHIY.js} +2 -2
  8. package/dist/cli/chunks/{agent-memory-branch-YHPLTITV.js → agent-memory-branch-JZ54MCSP.js} +2 -2
  9. package/dist/cli/chunks/aqe-learning-engine-ULGTVVWE.js +2 -0
  10. package/dist/cli/chunks/{arena-7BGOXGXO.js → arena-CUVH3V7H.js} +2 -2
  11. package/dist/cli/chunks/{arena-MCE6EU7K.js → arena-YSWTKBCL.js} +4 -4
  12. package/dist/cli/chunks/{audit-BMWTQECB.js → audit-LVU76QGA.js} +3 -3
  13. package/dist/cli/chunks/base-W42BURDL.js +2 -0
  14. package/dist/cli/chunks/{better-sqlite3-PMUNGASU.js → better-sqlite3-DB3LOJQU.js} +2 -2
  15. package/dist/cli/chunks/{brain-handler-QPUFYX7F.js → brain-handler-SD63KOQ6.js} +3 -3
  16. package/dist/cli/chunks/{branch-enumerator-WKFDGRN4.js → branch-enumerator-4MNOPUC7.js} +2 -2
  17. package/dist/cli/chunks/{browser-VY5HKH5X.js → browser-OLPNTWQE.js} +2 -2
  18. package/dist/cli/chunks/browser-workflow-HKGHFFFT.js +2 -0
  19. package/dist/cli/chunks/{chunk-62N4NUJH.js → chunk-23CX7JNL.js} +2 -2
  20. package/dist/cli/chunks/{chunk-MW2GGZZ5.js → chunk-25P6JA6V.js} +1 -1
  21. package/dist/cli/chunks/{chunk-RSXXCL4A.js → chunk-2G63VIJE.js} +1 -1
  22. package/dist/cli/chunks/{chunk-3NIG7S5W.js → chunk-2IMSJ7IO.js} +1 -1
  23. package/dist/cli/chunks/{chunk-I33ERSGB.js → chunk-36VKMAMN.js} +2 -2
  24. package/dist/cli/chunks/{chunk-2TMWAQQ3.js → chunk-3M7J4U74.js} +3 -3
  25. package/dist/cli/chunks/{chunk-CM7U6TAX.js → chunk-3QJU4Q4R.js} +2 -2
  26. package/dist/cli/chunks/{chunk-H5BS5VH7.js → chunk-4EKV7PHB.js} +2 -2
  27. package/dist/cli/chunks/{chunk-IG5GNEC6.js → chunk-4INST4ZL.js} +1 -1
  28. package/dist/cli/chunks/{chunk-YHKEDEAA.js → chunk-53BXTTRO.js} +3 -3
  29. package/dist/cli/chunks/{chunk-ENGZ4D5V.js → chunk-5D7ZFWDS.js} +2 -2
  30. package/dist/cli/chunks/{chunk-DZ3AUAAB.js → chunk-5FSLMYAC.js} +2 -2
  31. package/dist/cli/chunks/{chunk-FBMN7B46.js → chunk-5GFKTJ65.js} +2 -2
  32. package/dist/cli/chunks/{chunk-NMAIY4PX.js → chunk-5U6N4V5M.js} +11 -11
  33. package/dist/cli/chunks/{chunk-B6D2CHEH.js → chunk-6EGS77BB.js} +1 -1
  34. package/dist/cli/chunks/{chunk-NQZ5AR3D.js → chunk-6PJPQGF4.js} +2 -2
  35. package/dist/cli/chunks/{chunk-ICTXTNQZ.js → chunk-6RD44SCE.js} +1 -1
  36. package/dist/cli/chunks/{chunk-2NPKIBAZ.js → chunk-74IOEOMH.js} +2 -2
  37. package/dist/cli/chunks/{chunk-RTFO5UQH.js → chunk-77QZHIVX.js} +2 -2
  38. package/dist/cli/chunks/{chunk-D45SG6CP.js → chunk-7EZ2Z2CK.js} +1 -1
  39. package/dist/cli/chunks/{chunk-UNFFDHER.js → chunk-7MIOK72I.js} +10 -32
  40. package/dist/cli/chunks/{chunk-HNFVJP4I.js → chunk-7QYOTUOX.js} +2 -2
  41. package/dist/cli/chunks/{chunk-Q7EAGKAE.js → chunk-A2VUCUTT.js} +2 -2
  42. package/dist/cli/chunks/{chunk-TVYY3OCX.js → chunk-A3DK3XNZ.js} +1 -1
  43. package/dist/cli/chunks/{chunk-RETBYIAC.js → chunk-A5MA7A23.js} +4 -4
  44. package/dist/cli/chunks/{chunk-DUYOVM5I.js → chunk-AEUEMVJK.js} +2 -2
  45. package/dist/cli/chunks/{chunk-6U7LNMWZ.js → chunk-AJUBT4NP.js} +2 -2
  46. package/dist/cli/chunks/{chunk-7CUQCCMD.js → chunk-B2YGVSOP.js} +2 -2
  47. package/dist/cli/chunks/{chunk-SNOBH4AZ.js → chunk-B4I43GE2.js} +2 -2
  48. package/dist/cli/chunks/{chunk-VMNWDJIZ.js → chunk-BD7FEUN3.js} +2 -2
  49. package/dist/cli/chunks/{chunk-HM6ZSCPI.js → chunk-BE4KALTE.js} +1 -1
  50. package/dist/cli/chunks/{chunk-WGM35YWL.js → chunk-BEFTQVEW.js} +2 -2
  51. package/dist/cli/chunks/{chunk-SMDN3BQZ.js → chunk-BLG7SH4A.js} +1 -1
  52. package/dist/cli/chunks/{chunk-AJRUJAAK.js → chunk-C3FXFU2T.js} +1 -1
  53. package/dist/cli/chunks/{chunk-IQO7UCFR.js → chunk-CBONQM5D.js} +2 -2
  54. package/dist/cli/chunks/{chunk-L4RUBPLR.js → chunk-CQNMGK6Y.js} +2 -2
  55. package/dist/cli/chunks/{chunk-NHWGMJAP.js → chunk-CVOQ6ESD.js} +2 -2
  56. package/dist/cli/chunks/{chunk-P6OYS755.js → chunk-DOBKEXMJ.js} +1 -1
  57. package/dist/cli/chunks/{chunk-QZANMBIT.js → chunk-DYTQHRUS.js} +1 -1
  58. package/dist/cli/chunks/{chunk-FZOBD67M.js → chunk-EADSQN5T.js} +1 -1
  59. package/dist/cli/chunks/{chunk-DHVX5UB2.js → chunk-EGOIIUBD.js} +2 -2
  60. package/dist/cli/chunks/{chunk-6OS76PHI.js → chunk-EIGRV3J6.js} +2 -2
  61. package/dist/cli/chunks/{chunk-CD542DNJ.js → chunk-EJ6MMYLK.js} +1 -1
  62. package/dist/cli/chunks/{chunk-ELLBS5RP.js → chunk-ENK44A6Q.js} +2 -2
  63. package/dist/cli/chunks/{chunk-VGFFFKGK.js → chunk-EYXE2XKP.js} +2 -2
  64. package/dist/cli/chunks/{chunk-72KXSMWI.js → chunk-F2OPFVQH.js} +1 -1
  65. package/dist/cli/chunks/{chunk-DK4XN4CU.js → chunk-FBZC4IGB.js} +2 -2
  66. package/dist/cli/chunks/{chunk-MUOG6QXR.js → chunk-FSSR6WBE.js} +2 -2
  67. package/dist/cli/chunks/{chunk-DPYSUDAO.js → chunk-FW4DJ4FJ.js} +1 -1
  68. package/dist/cli/chunks/{chunk-ZVWVV4EX.js → chunk-FYPX5WBJ.js} +1 -1
  69. package/dist/cli/chunks/{chunk-7J6QC567.js → chunk-G367W7XR.js} +3 -3
  70. package/dist/cli/chunks/{chunk-IAF6T27S.js → chunk-GLGKQX2V.js} +2 -2
  71. package/dist/cli/chunks/{chunk-JXGFRBUO.js → chunk-GV4DYPJP.js} +2 -2
  72. package/dist/cli/chunks/{chunk-BPEDWS6O.js → chunk-GVVFTFMB.js} +2 -2
  73. package/dist/cli/chunks/{chunk-CF2ISEOJ.js → chunk-H5RQPO3X.js} +2 -2
  74. package/dist/cli/chunks/{chunk-GSF6MB64.js → chunk-HPWWYT67.js} +2 -2
  75. package/dist/cli/chunks/{chunk-RG52OKAM.js → chunk-HXXHMLJ5.js} +1 -1
  76. package/dist/cli/chunks/{chunk-SESK3ARK.js → chunk-HYFQUWNB.js} +2 -2
  77. package/dist/cli/chunks/{chunk-7D3V65N5.js → chunk-HYOPJHHW.js} +1 -1
  78. package/dist/cli/chunks/{chunk-7LPR6HJG.js → chunk-HZY42OVU.js} +2 -2
  79. package/dist/cli/chunks/{chunk-SDRHUMJB.js → chunk-IAENZ2DR.js} +2 -2
  80. package/dist/cli/chunks/{chunk-B6MOJC3X.js → chunk-IEJ7ZV3M.js} +1 -1
  81. package/dist/cli/chunks/{chunk-UCFQALXO.js → chunk-IWFFO6VT.js} +2 -2
  82. package/dist/cli/chunks/chunk-J7AQZLIH.js +21 -0
  83. package/dist/cli/chunks/{chunk-H52HZ67P.js → chunk-JHJUSSAU.js} +2 -2
  84. package/dist/cli/chunks/{chunk-2YXGBZWV.js → chunk-JOZ47MV6.js} +1 -1
  85. package/dist/cli/chunks/{chunk-EAY2JMZG.js → chunk-JZT7BU44.js} +2 -2
  86. package/dist/cli/chunks/{chunk-BVR7RMC5.js → chunk-KD2BLA5Y.js} +1 -1
  87. package/dist/cli/chunks/{chunk-BAMN2CHI.js → chunk-KUHLTVWC.js} +1 -1
  88. package/dist/cli/chunks/{chunk-5QQSIGUA.js → chunk-LU2EDWQK.js} +2 -2
  89. package/dist/cli/chunks/{chunk-D6CJIGRU.js → chunk-LXZMP3VX.js} +54 -54
  90. package/dist/cli/chunks/{chunk-GPYVDFB3.js → chunk-LY7MFGBD.js} +196 -187
  91. package/dist/cli/chunks/{chunk-W6HXLH5G.js → chunk-MM56VPNE.js} +2 -2
  92. package/dist/cli/chunks/{chunk-E6G2RD5H.js → chunk-MNQN7UZX.js} +2 -2
  93. package/dist/cli/chunks/{chunk-ZCRTRYXK.js → chunk-MQZ53OR3.js} +2 -2
  94. package/dist/cli/chunks/{chunk-3HZS4M3O.js → chunk-MT7UNBZ7.js} +2 -2
  95. package/dist/cli/chunks/{chunk-XAS3XRYM.js → chunk-MZB2UV2O.js} +1 -1
  96. package/dist/cli/chunks/{chunk-GDSXITFH.js → chunk-MZMG6CUJ.js} +2 -2
  97. package/dist/cli/chunks/{chunk-6SQM2MUX.js → chunk-N5XOXPHZ.js} +2 -2
  98. package/dist/cli/chunks/{chunk-5OOMJGFN.js → chunk-NBLDBVAW.js} +1 -1
  99. package/dist/cli/chunks/{chunk-PI7TJS62.js → chunk-ND4QTZOL.js} +2 -2
  100. package/dist/cli/chunks/{chunk-H6ZM3PUT.js → chunk-NHUGHAY6.js} +1 -1
  101. package/dist/cli/chunks/{chunk-5VFPCSK7.js → chunk-NOHWJOBS.js} +1 -1
  102. package/dist/cli/chunks/{chunk-DBDPRORT.js → chunk-O5V7RHVG.js} +2 -2
  103. package/dist/cli/chunks/{chunk-UQ32JHES.js → chunk-O6MO5KMR.js} +2 -2
  104. package/dist/cli/chunks/{chunk-WO4QMXIG.js → chunk-OAZX6WFU.js} +2 -2
  105. package/dist/cli/chunks/{chunk-GGRHV6D7.js → chunk-OEPNNLR4.js} +1 -1
  106. package/dist/cli/chunks/{chunk-AIRGNL55.js → chunk-OIDWDGLG.js} +2 -2
  107. package/dist/cli/chunks/{chunk-V4DM6ELU.js → chunk-ON2UTP2U.js} +2 -2
  108. package/dist/cli/chunks/{chunk-MBRHSU6W.js → chunk-ONR2NXXD.js} +10 -10
  109. package/dist/cli/chunks/{chunk-WCJBU2KI.js → chunk-OXHF3L2T.js} +2 -2
  110. package/dist/cli/chunks/{chunk-AVBJYI5I.js → chunk-OZGIOKEA.js} +1 -1
  111. package/dist/cli/chunks/{chunk-YFBSPLJG.js → chunk-P2UPYSDJ.js} +1 -1
  112. package/dist/cli/chunks/{chunk-C6KWXUFJ.js → chunk-P7XSPP5D.js} +2 -2
  113. package/dist/cli/chunks/{chunk-QDFTT3RF.js → chunk-PCJQCEBA.js} +2 -2
  114. package/dist/cli/chunks/chunk-PELENDDQ.js +2 -0
  115. package/dist/cli/chunks/{chunk-257E2A5M.js → chunk-PYKY22GC.js} +5 -5
  116. package/dist/cli/chunks/{chunk-LL3IGZBI.js → chunk-Q3NSU24F.js} +2 -2
  117. package/dist/cli/chunks/{chunk-Y3LZ35OG.js → chunk-Q6NTEICT.js} +2 -2
  118. package/dist/cli/chunks/chunk-QFETNCNN.js +12 -0
  119. package/dist/cli/chunks/{chunk-SE4WIB26.js → chunk-QGOWNVVG.js} +1 -1
  120. package/dist/cli/chunks/{chunk-6RE3X4V5.js → chunk-QPLSYEWJ.js} +2 -2
  121. package/dist/cli/chunks/{chunk-FWASDOT2.js → chunk-QQFQDEUE.js} +2 -2
  122. package/dist/cli/chunks/{chunk-2JVWITNK.js → chunk-QUORH2MG.js} +55 -79
  123. package/dist/cli/chunks/{chunk-5J6W7SIA.js → chunk-QVH5Y7AP.js} +1 -1
  124. package/dist/cli/chunks/{chunk-YSLL6VSL.js → chunk-RC2A4JZ5.js} +2 -2
  125. package/dist/cli/chunks/{chunk-IB27QACC.js → chunk-RDGPXENG.js} +2 -2
  126. package/dist/cli/chunks/{chunk-PX5YDCRH.js → chunk-RKI3IQKQ.js} +2 -2
  127. package/dist/cli/chunks/{chunk-BMAPORJ7.js → chunk-RKUAWQOF.js} +2 -2
  128. package/dist/cli/chunks/chunk-RLW25X66.js +2 -0
  129. package/dist/cli/chunks/{chunk-RFNPJK6N.js → chunk-ROVZSZCS.js} +3 -3
  130. package/dist/cli/chunks/{chunk-MQROI74N.js → chunk-RT6O2HW2.js} +2 -2
  131. package/dist/cli/chunks/{chunk-Y3UOUNHM.js → chunk-SM2YJ2AL.js} +2 -2
  132. package/dist/cli/chunks/{chunk-BBT64TII.js → chunk-SRPLERER.js} +3 -3
  133. package/dist/cli/chunks/{chunk-YS4FCTWF.js → chunk-T77GZF4B.js} +1 -1
  134. package/dist/cli/chunks/{chunk-IV5UZOHH.js → chunk-TFK2AYIN.js} +2 -2
  135. package/dist/cli/chunks/chunk-TW3SR4TS.js +2 -0
  136. package/dist/cli/chunks/{chunk-7Z5LHRC3.js → chunk-TXSPBLBT.js} +2 -2
  137. package/dist/cli/chunks/chunk-UA7TDVL7.js +12 -0
  138. package/dist/cli/chunks/{chunk-3EZOZN25.js → chunk-UBJG3IHT.js} +2 -2
  139. package/dist/cli/chunks/{chunk-QW6VMTBR.js → chunk-UFSVUBTR.js} +2 -2
  140. package/dist/cli/chunks/{chunk-ZEV3YTO7.js → chunk-UOI6ULCH.js} +2 -2
  141. package/dist/cli/chunks/{chunk-JZOS5FCX.js → chunk-UYUJT6QO.js} +2 -2
  142. package/dist/cli/chunks/{chunk-3EA536JF.js → chunk-V5AK56DA.js} +2 -2
  143. package/dist/cli/chunks/{chunk-UKA2KOXE.js → chunk-V6RE4YRQ.js} +2 -2
  144. package/dist/cli/chunks/{chunk-RZZCUIAI.js → chunk-VW6FRMLW.js} +2 -2
  145. package/dist/cli/chunks/chunk-VXKWNRGA.js +2 -0
  146. package/dist/cli/chunks/{chunk-6SH5VZUD.js → chunk-VYDVI6FZ.js} +2 -2
  147. package/dist/cli/chunks/{chunk-BJTJLJRZ.js → chunk-WF6UISKW.js} +3 -3
  148. package/dist/cli/chunks/{chunk-ZL6SYKUK.js → chunk-WIH522AP.js} +1 -1
  149. package/dist/cli/chunks/{chunk-JIXUMYKZ.js → chunk-WOV6XI3A.js} +1 -1
  150. package/dist/cli/chunks/{chunk-JBTPOIAC.js → chunk-X7ADKL7T.js} +2 -2
  151. package/dist/cli/chunks/{chunk-JVNTSNWU.js → chunk-XBYQ2BS4.js} +2 -2
  152. package/dist/cli/chunks/{chunk-Z7WODOTH.js → chunk-XL5KIYE3.js} +2 -2
  153. package/dist/cli/chunks/{chunk-JMONHE4B.js → chunk-XWYELBZS.js} +1 -1
  154. package/dist/cli/chunks/{chunk-SJUXE4IC.js → chunk-XYLQZWF6.js} +2 -2
  155. package/dist/cli/chunks/{chunk-KNNISEDY.js → chunk-Y6AKKQIQ.js} +1 -1
  156. package/dist/cli/chunks/{chunk-CCK4BF76.js → chunk-YMW57PEL.js} +1 -1
  157. package/dist/cli/chunks/{chunk-64VGZQLB.js → chunk-YO4ESCB4.js} +1 -1
  158. package/dist/cli/chunks/{chunk-ZSPU4MOS.js → chunk-YRHTQZU4.js} +2 -2
  159. package/dist/cli/chunks/chunk-Z4Q5PCRZ.js +65 -0
  160. package/dist/cli/chunks/{chunk-Q5XTSMWR.js → chunk-ZELWDJXT.js} +2 -2
  161. package/dist/cli/chunks/{chunk-SPV2VKC5.js → chunk-ZQZD55MN.js} +2 -2
  162. package/dist/cli/chunks/{chunk-66VWCR67.js → chunk-ZS4XVJGV.js} +2 -2
  163. package/dist/cli/chunks/{chunk-6LIHFV7O.js → chunk-ZUB5YOCM.js} +2 -2
  164. package/dist/cli/chunks/chunk-ZUOVNFXK.js +2 -0
  165. package/dist/cli/chunks/{chunk-7NITCZWD.js → chunk-ZWEKAEEV.js} +1 -1
  166. package/dist/cli/chunks/{ci-W6K6G2KZ.js → ci-J3TDK5RA.js} +8 -8
  167. package/dist/cli/chunks/{ci-output-LDT24TS3.js → ci-output-RLS32FUY.js} +2 -2
  168. package/dist/cli/chunks/{circuit-breaker-F5V4KITU.js → circuit-breaker-MRCC7WCM.js} +2 -2
  169. package/dist/cli/chunks/{claude-flow-setup-DT6WQQVD.js → claude-flow-setup-LIZCEKDF.js} +2 -2
  170. package/dist/cli/chunks/client-3BD2DI4N.js +2 -0
  171. package/dist/cli/chunks/{cline-installer-G7TJOAEX.js → cline-installer-T7H6R2RC.js} +2 -2
  172. package/dist/cli/chunks/{code-PGE6A42V.js → code-XMBLI7OF.js} +3 -3
  173. package/dist/cli/chunks/{code-index-extractor-RNITH372.js → code-index-extractor-QS7BYLEX.js} +2 -2
  174. package/dist/cli/chunks/{codex-installer-LBX77AI3.js → codex-installer-6PGT5FM6.js} +2 -2
  175. package/dist/cli/chunks/{completions-4AWLAARX.js → completions-2A3WRXY2.js} +2 -2
  176. package/dist/cli/chunks/{complexity-analyzer-ZPNSS476.js → complexity-analyzer-23HOOGJ7.js} +2 -2
  177. package/dist/cli/chunks/{continuedev-installer-UAPWX6OA.js → continuedev-installer-4FSF7B3N.js} +2 -2
  178. package/dist/cli/chunks/{copilot-installer-BJN2YJGI.js → copilot-installer-A5GRQQUU.js} +2 -2
  179. package/dist/cli/chunks/core-handlers-C3H2ZCS2.js +2 -0
  180. package/dist/cli/chunks/{cost-tracker-MHP2VJ63.js → cost-tracker-Z4STQ5VB.js} +2 -2
  181. package/dist/cli/chunks/{coverage-PQB4IEFG.js → coverage-NUPP6KZZ.js} +3 -3
  182. package/dist/cli/chunks/cross-domain-router-JCQ7SWDP.js +2 -0
  183. package/dist/cli/chunks/{cursor-installer-ZXBWYAS3.js → cursor-installer-FVJ7ROPJ.js} +2 -2
  184. package/dist/cli/chunks/{daemon-N2BEGEFY.js → daemon-7ZZA2MMN.js} +4 -4
  185. package/dist/cli/chunks/{daemon-64C7R6OJ.js → daemon-D662EX5N.js} +3 -3
  186. package/dist/cli/chunks/{dag-attention-scheduler-SPZDAPNL.js → dag-attention-scheduler-IB4TQ2KA.js} +2 -2
  187. package/dist/cli/chunks/{detect-LXJBSSZW.js → detect-LGLBZN4I.js} +2 -2
  188. package/dist/cli/chunks/{dist-node-U3TKZ2IZ.js → dist-node-Z3OL42YE.js} +2 -2
  189. package/dist/cli/chunks/{domain-handler-3DDWUVSR.js → domain-handler-L3CLNL7U.js} +2 -2
  190. package/dist/cli/chunks/{domain-plugins-JJVWI4OQ.js → domain-plugins-GQ3V5X6L.js} +2 -2
  191. package/dist/cli/chunks/{domain-transfer-M36KUJ2U.js → domain-transfer-MFCI76IY.js} +2 -2
  192. package/dist/cli/chunks/dream-FTP33IJB.js +2 -0
  193. package/dist/cli/chunks/{embed-and-insert-pattern-JPAR7TXX.js → embed-and-insert-pattern-UGD6USYH.js} +2 -2
  194. package/dist/cli/chunks/{eval-SOLG23EA.js → eval-3B7UIYGY.js} +2 -2
  195. package/dist/cli/chunks/{experience-capture-middleware-T7G2VOOD.js → experience-capture-middleware-3RQ4NYY3.js} +3 -3
  196. package/dist/cli/chunks/{fast-paths-32N3ELI4.js → fast-paths-QOSAEPYD.js} +2 -2
  197. package/dist/cli/chunks/{feature-flags-NAHKLDRN.js → feature-flags-3S5TH6P4.js} +2 -2
  198. package/dist/cli/chunks/{feature-flags-APJDQ4N7.js → feature-flags-TLF4NKOH.js} +2 -2
  199. package/dist/cli/chunks/{file-discovery-YKVM3MDB.js → file-discovery-AEVMJRNB.js} +2 -2
  200. package/dist/cli/chunks/{fleet-55M5CJS4.js → fleet-E6WTXWFL.js} +3 -3
  201. package/dist/cli/chunks/{gnn-wrapper-UD6E6S6Z.js → gnn-wrapper-MCKH3AUU.js} +2 -2
  202. package/dist/cli/chunks/{heartbeat-handler-OYVW3VSC.js → heartbeat-handler-U7XENHRR.js} +4 -4
  203. package/dist/cli/chunks/heartbeat-scheduler-HXBJVJL2.js +2 -0
  204. package/dist/cli/chunks/hnsw-adapter-TU6WG2ME.js +2 -0
  205. package/dist/cli/chunks/hnsw-index-MS5KODD7.js +2 -0
  206. package/dist/cli/chunks/{hnsw-legacy-bridge-HBYIS3ZW.js → hnsw-legacy-bridge-5GW4SAEI.js} +2 -2
  207. package/dist/cli/chunks/{hnswlib-node-EQPM42OU.js → hnswlib-node-7BLZBK5T.js} +2 -2
  208. package/dist/cli/chunks/{hooks-5ZSSJWO6.js → hooks-F3O2SB6H.js} +10 -10
  209. package/dist/cli/chunks/hybrid-backend-HT45LBHC.js +2 -0
  210. package/dist/cli/chunks/{hypergraph-engine-XBGVQ4PD.js → hypergraph-engine-PV4EKXHB.js} +2 -2
  211. package/dist/cli/chunks/{hypergraph-handler-CAWAQ673.js → hypergraph-handler-VOWO5ZTW.js} +3 -3
  212. package/dist/cli/chunks/impact-analyzer-AP4AGTG5.js +2 -0
  213. package/dist/cli/chunks/{init-handler-PRHXSARK.js → init-handler-ENJ5ONJX.js} +16 -14
  214. package/dist/cli/chunks/init-wizard-I5DFZUQL.js +2 -0
  215. package/dist/cli/chunks/kernel-MISPSPPA.js +2 -0
  216. package/dist/cli/chunks/{kilocode-installer-F7LXBM7I.js → kilocode-installer-HNNJOOPE.js} +2 -2
  217. package/dist/cli/chunks/{kiro-installer-NM723ZRG.js → kiro-installer-UZBIQ3IC.js} +2 -2
  218. package/dist/cli/chunks/knowledge-graph-L26JESGE.js +2 -0
  219. package/dist/cli/chunks/{learning-5QYIDHH3.js → learning-YMLCVFUT.js} +3 -3
  220. package/dist/cli/chunks/{llm-router-43HKWPSX.js → llm-router-YWTARCCT.js} +4 -4
  221. package/dist/cli/chunks/llm-router-service-MWGC43ZA.js +2 -0
  222. package/dist/cli/chunks/{load-5YDBWSCS.js → load-DKE3F3IP.js} +2 -2
  223. package/dist/cli/chunks/load-test-H5ISNNM5.js +2 -0
  224. package/dist/cli/chunks/{mcp-UMAPMNMY.js → mcp-5PSGIUCW.js} +2 -2
  225. package/dist/cli/chunks/{memory-FWCPCQFP.js → memory-3L3O6JMM.js} +5 -5
  226. package/dist/cli/chunks/memory-backend-HWDNOBKW.js +2 -0
  227. package/dist/cli/chunks/memory-handlers-ZFDVQZM5.js +2 -0
  228. package/dist/cli/chunks/{multi-model-executor-2XTBGLE4.js → multi-model-executor-AEEO7IA4.js} +2 -2
  229. package/dist/cli/chunks/{opencode-installer-GIXOJ6NS.js → opencode-installer-ABBO355U.js} +2 -2
  230. package/dist/cli/chunks/{orchestrator-VW6BKHLI.js → orchestrator-E36Q7MKE.js} +17 -17
  231. package/dist/cli/chunks/pattern-null-store-GQP6ICWK.js +2 -0
  232. package/dist/cli/chunks/{pattern-usage-recorder-7CEUC3J7.js → pattern-usage-recorder-H4XKSID4.js} +2 -2
  233. package/dist/cli/chunks/{pipeline-IGUQPPPO.js → pipeline-BGFEHXIN.js} +2 -2
  234. package/dist/cli/chunks/{platform-2P636I7B.js → platform-GK7ZVDJI.js} +2 -2
  235. package/dist/cli/chunks/{plugin-NY6SWDPE.js → plugin-CAH2CKI6.js} +2 -2
  236. package/dist/cli/chunks/{prime-radiant-advanced-wasm-2UUDTIO2.js → prime-radiant-advanced-wasm-M5EYRONA.js} +2 -2
  237. package/dist/cli/chunks/{project-root-IOISG5KX.js → project-root-BSNZC243.js} +2 -2
  238. package/dist/cli/chunks/protocol-executor-AD5A4DAI.js +2 -0
  239. package/dist/cli/chunks/{protocol-handler-ZTPCRQ5W.js → protocol-handler-JDSSC2SF.js} +2 -2
  240. package/dist/cli/chunks/{prove-SQX5A3IG.js → prove-ANPTOZJE.js} +2 -2
  241. package/dist/cli/chunks/qe-reasoning-bank-W3Z2PKTR.js +2 -0
  242. package/dist/cli/chunks/{quality-DROILKRY.js → quality-SXWGYRQR.js} +2 -2
  243. package/dist/cli/chunks/{quality-gate-PWKWDJY2.js → quality-gate-GYNCA4ZY.js} +3 -3
  244. package/dist/cli/chunks/queen-coordinator-HQRHLIJX.js +2 -0
  245. package/dist/cli/chunks/{real-embeddings-P5U3MGYC.js → real-embeddings-WSRYAOZM.js} +2 -2
  246. package/dist/cli/chunks/{ref-validation-KY73NQXD.js → ref-validation-AZ3LRWEK.js} +2 -2
  247. package/dist/cli/chunks/{roocode-installer-6JPPRB3W.js → roocode-installer-2QKGFIEU.js} +2 -2
  248. package/dist/cli/chunks/router-MTP5LH4H.js +2 -0
  249. package/dist/cli/chunks/routing-feedback-GWETVB4L.js +2 -0
  250. package/dist/cli/chunks/{routing-handler-VTJIVFUO.js → routing-handler-UYDC5MMD.js} +2 -2
  251. package/dist/cli/chunks/{ruvector-commands-C6RPSJJO.js → ruvector-commands-QXADPVEY.js} +2 -2
  252. package/dist/cli/chunks/rvf-dual-writer-4UE5S7WP.js +2 -0
  253. package/dist/cli/chunks/rvf-migration-adapter-PHH3HF4Q.js +2 -0
  254. package/dist/cli/chunks/{rvf-migration-coordinator-R53URRIO.js → rvf-migration-coordinator-GD4NBFKT.js} +2 -2
  255. package/dist/cli/chunks/rvf-native-adapter-KTLZBUWV.js +2 -0
  256. package/dist/cli/chunks/{rvf-store-integrity-MMXN5TEJ.js → rvf-store-integrity-7SXG66IL.js} +2 -2
  257. package/dist/cli/chunks/safe-db-FWWGAPVE.js +2 -0
  258. package/dist/cli/chunks/schedule-TPA4V4D5.js +2 -0
  259. package/dist/cli/chunks/scheduler-5ZTEPNDD.js +2 -0
  260. package/dist/cli/chunks/{security-3B3R2NL4.js → security-YKB622PK.js} +3 -3
  261. package/dist/cli/chunks/{shared-rvf-adapter-VIJB7JUS.js → shared-rvf-adapter-KMLAV7JK.js} +2 -2
  262. package/dist/cli/chunks/{shared-rvf-dual-writer-UVWGDUWC.js → shared-rvf-dual-writer-OYY27DFV.js} +2 -2
  263. package/dist/cli/chunks/sqlite-persistence-HPTT624C.js +2 -0
  264. package/dist/cli/chunks/{standalone-memory-M4LWAAYZ.js → standalone-memory-2DOABVLC.js} +2 -2
  265. package/dist/cli/chunks/{status-handler-YYFV6OZL.js → status-handler-EXRKETV7.js} +2 -2
  266. package/dist/cli/chunks/{structural-health-27E6LLKB.js → structural-health-2SKK6DU6.js} +2 -2
  267. package/dist/cli/chunks/sync-DQ2YUNI6.js +2 -0
  268. package/dist/cli/chunks/{sync-J3LJ56WN.js → sync-UW7SX7GO.js} +2 -2
  269. package/dist/cli/chunks/{task-handler-4MCEBQZL.js → task-handler-LYQ6WYUY.js} +2 -2
  270. package/dist/cli/chunks/task-handlers-DIJO232S.js +9 -0
  271. package/dist/cli/chunks/test-WRHZMUCW.js +33 -0
  272. package/dist/cli/chunks/{test-scheduling-ZJBFRZ3J.js → test-scheduling-HI23RXFK.js} +3 -3
  273. package/dist/cli/chunks/token-bootstrap-23SA6SWZ.js +2 -0
  274. package/dist/cli/chunks/{token-usage-3X5WMTG2.js → token-usage-M7RRDPXO.js} +2 -2
  275. package/dist/cli/chunks/{transformers-MVL4C5IX.js → transformers-4TC35KKS.js} +2 -2
  276. package/dist/cli/chunks/{tree-sitter-wasm-parser-SLW65ZFO.js → tree-sitter-wasm-parser-F4LTKAWD.js} +2 -2
  277. package/dist/cli/chunks/{types-TG5P3CRS.js → types-NBXV6LXQ.js} +2 -2
  278. package/dist/cli/chunks/unified-memory-OVFEPRPS.js +2 -0
  279. package/dist/cli/chunks/unified-memory-hnsw-KKRSCZHR.js +2 -0
  280. package/dist/cli/chunks/unified-persistence-7GLR4RI3.js +2 -0
  281. package/dist/cli/chunks/{upgrade-ETBHDEPY.js → upgrade-4BGOU5RM.js} +2 -2
  282. package/dist/cli/chunks/{validate-C2A73LZK.js → validate-EDWAR63H.js} +2 -2
  283. package/dist/cli/chunks/{validate-swarm-67XN42ML.js → validate-swarm-VI72CPR7.js} +2 -2
  284. package/dist/cli/chunks/visual-security-2FUM5GLI.js +2 -0
  285. package/dist/cli/chunks/{web-tree-sitter-USJN77P4.js → web-tree-sitter-Y5XBRQXF.js} +2 -2
  286. package/dist/cli/chunks/{windsurf-installer-5GGZXGJW.js → windsurf-installer-VEX23WAF.js} +2 -2
  287. package/dist/cli/chunks/{witness-chain-IWS5ZHHL.js → witness-chain-3YNL6YGY.js} +2 -2
  288. package/dist/cli/chunks/witness-chain-MH6GA5L6.js +2 -0
  289. package/dist/cli/chunks/witness-chain-repair-MJZGZRWT.js +2 -0
  290. package/dist/cli/chunks/{witness-chain-verifier-3GEADWPE.js → witness-chain-verifier-TTJYXTBE.js} +2 -2
  291. package/dist/cli/chunks/{witness-key-manager-ZWEIK3VJ.js → witness-key-manager-EM6YXYOY.js} +2 -2
  292. package/dist/cli/chunks/{workflow-KHMVVBBA.js → workflow-2RBDOM7V.js} +4 -4
  293. package/dist/cli/chunks/workflow-orchestrator-H6G65YKU.js +2 -0
  294. package/dist/cli/chunks/wrappers-5OTAVVOV.js +2 -0
  295. package/dist/cli/commands/ci.js +1 -1
  296. package/dist/cli/commands/test.js +18 -3
  297. package/dist/cli/handlers/init-handler.d.ts +2 -0
  298. package/dist/cli/handlers/init-handler.js +8 -2
  299. package/dist/cli/index.js +8 -0
  300. package/dist/coordination/handlers/test-execution-handlers.js +13 -8
  301. package/dist/coordination/index.d.ts +1 -1
  302. package/dist/coordination/queen-event-handlers.js +9 -6
  303. package/dist/coordination/result-saver.js +1 -1
  304. package/dist/coordination/services/index.d.ts +1 -1
  305. package/dist/coordination/services/task-audit-logger.d.ts +38 -13
  306. package/dist/coordination/services/task-audit-logger.js +33 -5
  307. package/dist/coordination/task-executor.d.ts +5 -0
  308. package/dist/coordination/task-executor.js +10 -5
  309. package/dist/domains/test-generation/coordinator.js +6 -5
  310. package/dist/domains/test-generation/interfaces.d.ts +11 -1
  311. package/dist/domains/test-generation/services/behavior-example-validation.d.ts +36 -0
  312. package/dist/domains/test-generation/services/behavior-example-validation.js +89 -0
  313. package/dist/domains/test-generation/services/behavior-examples.d.ts +8 -0
  314. package/dist/domains/test-generation/services/behavior-examples.js +65 -0
  315. package/dist/domains/test-generation/services/test-generator.d.ts +1 -1
  316. package/dist/domains/test-generation/services/test-generator.js +59 -30
  317. package/dist/domains/visual-accessibility/services/axe-core-audit.d.ts +0 -15
  318. package/dist/domains/visual-accessibility/services/axe-core-audit.js +12 -10
  319. package/dist/init/browser-engine-installer.d.ts +5 -5
  320. package/dist/init/browser-engine-installer.js +28 -6
  321. package/dist/init/init-wizard.d.ts +2 -0
  322. package/dist/init/orchestrator.js +1 -0
  323. package/dist/init/phases/09-assets.js +8 -18
  324. package/dist/init/phases/phase-interface.d.ts +2 -0
  325. package/dist/integrations/agentic-flow/reasoning-bank/index.d.ts +2 -5
  326. package/dist/integrations/vibium/client.d.ts +1 -0
  327. package/dist/integrations/vibium/client.js +24 -11
  328. package/dist/integrations/vibium/runtime.d.ts +14 -0
  329. package/dist/integrations/vibium/runtime.js +94 -0
  330. package/dist/kernel/pattern-fts-self-heal.d.ts +63 -0
  331. package/dist/kernel/pattern-fts-self-heal.js +193 -0
  332. package/dist/kernel/process-lifecycle.d.ts +60 -0
  333. package/dist/kernel/process-lifecycle.js +91 -0
  334. package/dist/kernel/unified-memory-schemas.d.ts +15 -1
  335. package/dist/kernel/unified-memory-schemas.js +53 -25
  336. package/dist/kernel/unified-memory.js +31 -34
  337. package/dist/kernel/unified-persistence.js +12 -6
  338. package/dist/learning/experience-capture.d.ts +2 -1
  339. package/dist/learning/experience-capture.js +23 -8
  340. package/dist/learning/pattern-store.d.ts +1 -1
  341. package/dist/learning/pattern-store.js +27 -30
  342. package/dist/learning/qe-patterns.d.ts +6 -0
  343. package/dist/learning/qe-reasoning-bank.d.ts +1 -0
  344. package/dist/learning/qe-reasoning-bank.js +14 -4
  345. package/dist/learning/real-qe-reasoning-bank.d.ts +9 -4
  346. package/dist/learning/real-qe-reasoning-bank.js +28 -4
  347. package/dist/learning/rvf-pattern-store.js +19 -19
  348. package/dist/learning/sqlite-persistence.js +9 -24
  349. package/dist/mcp/bundle.js +508 -545
  350. package/dist/mcp/entry.js +52 -6
  351. package/dist/mcp/handlers/domain-handler-configs.js +12 -4
  352. package/dist/mcp/handlers/task-handlers.js +11 -7
  353. package/dist/mcp/protocol-server.js +18 -3
  354. package/dist/mcp/services/reasoning-bank-service.d.ts +6 -1
  355. package/dist/mcp/services/reasoning-bank-service.js +5 -1
  356. package/dist/mcp/tools/test-execution/e2e-execute.js +9 -1
  357. package/dist/mcp/tools/test-generation/generate.d.ts +6 -1
  358. package/dist/mcp/tools/test-generation/generate.js +8 -0
  359. package/dist/mcp/types.d.ts +6 -2
  360. package/dist/shared/error-utils.d.ts +15 -0
  361. package/dist/shared/error-utils.js +21 -0
  362. package/dist/shared/events/domain-events.d.ts +2 -1
  363. package/package.json +10 -6
  364. package/dist/cli/chunks/adapter-UYOJPTOX.js +0 -2
  365. package/dist/cli/chunks/aqe-learning-engine-JR5AVQXR.js +0 -2
  366. package/dist/cli/chunks/base-DRZ2LS6X.js +0 -2
  367. package/dist/cli/chunks/browser-workflow-CJ7T3MXF.js +0 -2
  368. package/dist/cli/chunks/chunk-4N23RFDU.js +0 -2
  369. package/dist/cli/chunks/chunk-AHKELLIO.js +0 -12
  370. package/dist/cli/chunks/chunk-MJS53PRX.js +0 -2
  371. package/dist/cli/chunks/chunk-PZPWRQ2M.js +0 -21
  372. package/dist/cli/chunks/chunk-QGA55PFM.js +0 -12
  373. package/dist/cli/chunks/chunk-TCHGOB2N.js +0 -2
  374. package/dist/cli/chunks/chunk-Z6GGIRQQ.js +0 -65
  375. package/dist/cli/chunks/client-KHWJT6FB.js +0 -2
  376. package/dist/cli/chunks/core-handlers-HING5RRG.js +0 -2
  377. package/dist/cli/chunks/cross-domain-router-PQTD6AZN.js +0 -2
  378. package/dist/cli/chunks/dream-WUGRSNCV.js +0 -2
  379. package/dist/cli/chunks/heartbeat-scheduler-33XX5XNQ.js +0 -2
  380. package/dist/cli/chunks/hnsw-adapter-XQPERX3H.js +0 -2
  381. package/dist/cli/chunks/hnsw-index-2GNXTWHH.js +0 -2
  382. package/dist/cli/chunks/hybrid-backend-CCF7URKI.js +0 -2
  383. package/dist/cli/chunks/impact-analyzer-HGKAZWIG.js +0 -2
  384. package/dist/cli/chunks/init-wizard-72MFBI3G.js +0 -2
  385. package/dist/cli/chunks/kernel-BRCBVMSK.js +0 -2
  386. package/dist/cli/chunks/knowledge-graph-DG44IPEI.js +0 -2
  387. package/dist/cli/chunks/llm-router-service-24KXFX32.js +0 -2
  388. package/dist/cli/chunks/load-test-N4TAYJY3.js +0 -2
  389. package/dist/cli/chunks/memory-backend-NVYFYVAU.js +0 -2
  390. package/dist/cli/chunks/memory-handlers-UTWCNCHL.js +0 -2
  391. package/dist/cli/chunks/pattern-null-store-SBPNYDBR.js +0 -2
  392. package/dist/cli/chunks/protocol-executor-IBYEII5Q.js +0 -2
  393. package/dist/cli/chunks/qe-reasoning-bank-7IETWW6W.js +0 -2
  394. package/dist/cli/chunks/queen-coordinator-NHUK2MWJ.js +0 -2
  395. package/dist/cli/chunks/router-SRSO3IHF.js +0 -2
  396. package/dist/cli/chunks/routing-feedback-PASRE5HY.js +0 -2
  397. package/dist/cli/chunks/rvf-dual-writer-4M4J67OU.js +0 -2
  398. package/dist/cli/chunks/rvf-migration-adapter-TSXGT5LF.js +0 -2
  399. package/dist/cli/chunks/rvf-native-adapter-MOF3E7BR.js +0 -2
  400. package/dist/cli/chunks/safe-db-QJLFO33B.js +0 -2
  401. package/dist/cli/chunks/schedule-YIVXW5O2.js +0 -2
  402. package/dist/cli/chunks/scheduler-AON7DWSJ.js +0 -2
  403. package/dist/cli/chunks/sqlite-persistence-75VHKKQB.js +0 -2
  404. package/dist/cli/chunks/sync-26CEGSTC.js +0 -2
  405. package/dist/cli/chunks/task-handlers-GYBAWKE2.js +0 -9
  406. package/dist/cli/chunks/test-MPC5HRH5.js +0 -33
  407. package/dist/cli/chunks/token-bootstrap-2Y2XITBX.js +0 -2
  408. package/dist/cli/chunks/unified-memory-UCQ6AB32.js +0 -2
  409. package/dist/cli/chunks/unified-memory-hnsw-IXYUMKRR.js +0 -2
  410. package/dist/cli/chunks/unified-persistence-7E6JQ4FZ.js +0 -2
  411. package/dist/cli/chunks/vibium-NILGKHLN.js +0 -2
  412. package/dist/cli/chunks/visual-security-4VZXPEVG.js +0 -2
  413. package/dist/cli/chunks/witness-chain-JQA2VPZI.js +0 -2
  414. package/dist/cli/chunks/witness-chain-repair-4UA7IPS3.js +0 -2
  415. package/dist/cli/chunks/workflow-orchestrator-GI5NQH7C.js +0 -2
  416. package/dist/cli/chunks/wrappers-N6XIK5PT.js +0 -2
@@ -0,0 +1,65 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{d as W,e as V,g as se,h as X}from"./chunk-HYOPJHHW.js";import{a as oe}from"./chunk-P2UPYSDJ.js";import{c as Ue}from"./chunk-Q6NTEICT.js";import{a as ae,b as Me,d as He,f as ht}from"./chunk-XBYQ2BS4.js";import{c as G,e as Le,f as ke}from"./chunk-BLG7SH4A.js";import{a as ce}from"./chunk-AJUBT4NP.js";import{c as Ne,n as R,o as j}from"./chunk-3M7J4U74.js";import{b as _e,c as ut}from"./chunk-IAENZ2DR.js";import{c as P,d as S}from"./chunk-Y6AKKQIQ.js";import{a as b,b as Fe,e as Oe}from"./chunk-ZUOVNFXK.js";import{i as O}from"./chunk-FW4DJ4FJ.js";import{B as $,D as L,G as ie,P as k,S as _,b as F}from"./chunk-AEUEMVJK.js";import{c as B,e as dt}from"./chunk-YO4ESCB4.js";var Z=B(T=>{var bt=T&&T.__extends||(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var s in i)i.hasOwnProperty(s)&&(r[s]=i[s])},n(e,t)};return function(e,t){n(e,t);function r(){this.constructor=e}e.prototype=t===null?Object.create(t):(r.prototype=t.prototype,new r)}})();Object.defineProperty(T,"__esModule",{value:!0});var Pt=Object.prototype.hasOwnProperty;function pe(n,e){return Pt.call(n,e)}T.hasOwnProperty=pe;function Ve(n){if(Array.isArray(n)){for(var e=new Array(n.length),t=0;t<e.length;t++)e[t]=""+t;return e}if(Object.keys)return Object.keys(n);var r=[];for(var i in n)pe(n,i)&&r.push(i);return r}T._objectKeys=Ve;function Et(n){switch(typeof n){case"object":return JSON.parse(JSON.stringify(n));case"undefined":return null;default:return n}}T._deepClone=Et;function At(n){for(var e=0,t=n.length,r;e<t;){if(r=n.charCodeAt(e),r>=48&&r<=57){e++;continue}return!1}return!0}T.isInteger=At;function fe(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(/~/g,"~0").replace(/\//g,"~1")}T.escapePathComponent=fe;function Tt(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}T.unescapePathComponent=Tt;function ge(n,e){var t;for(var r in n)if(pe(n,r)){if(n[r]===e)return fe(r)+"/";if(typeof n[r]=="object"&&(t=ge(n[r],e),t!=""))return fe(r)+"/"+t}return""}T._getPathRecursive=ge;function Rt(n,e){if(n===e)return"/";var t=ge(n,e);if(t==="")throw new Error("Object not found in root");return"/"+t}T.getPath=Rt;function me(n){if(n===void 0)return!0;if(n){if(Array.isArray(n)){for(var e=0,t=n.length;e<t;e++)if(me(n[e]))return!0}else if(typeof n=="object"){for(var r=Ve(n),i=r.length,s=0;s<i;s++)if(me(n[r[s]]))return!0}}return!1}T.hasUndefined=me;function We(n,e){var t=[n];for(var r in e){var i=typeof e[r]=="object"?JSON.stringify(e[r],null,2):e[r];typeof i<"u"&&t.push(r+": "+i)}return t.join(`
3
+ `)}var xt=(function(n){bt(e,n);function e(t,r,i,s,a){var l=this.constructor,d=n.call(this,We(t,{name:r,index:i,operation:s,tree:a}))||this;return d.name=r,d.index=i,d.operation=s,d.tree=a,Object.setPrototypeOf(d,l.prototype),d.message=We(t,{name:r,index:i,operation:s,tree:a}),d}return e})(Error);T.PatchError=xt});var ye=B(v=>{Object.defineProperty(v,"__esModule",{value:!0});var C=Z();v.JsonPatchError=C.PatchError;v.deepClone=C._deepClone;var U={add:function(n,e,t){return n[e]=this.value,{newDocument:t}},remove:function(n,e,t){var r=n[e];return delete n[e],{newDocument:t,removed:r}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:function(n,e,t){var r=ee(t,this.path);r&&(r=C._deepClone(r));var i=N(t,{op:"remove",path:this.from}).removed;return N(t,{op:"add",path:this.path,value:i}),{newDocument:t,removed:r}},copy:function(n,e,t){var r=ee(t,this.from);return N(t,{op:"add",path:this.path,value:C._deepClone(r)}),{newDocument:t}},test:function(n,e,t){return{newDocument:t,test:J(n[e],this.value)}},_get:function(n,e,t){return this.value=n[e],{newDocument:t}}},Ct={add:function(n,e,t){return C.isInteger(e)?n.splice(e,0,this.value):n[e]=this.value,{newDocument:t,index:e}},remove:function(n,e,t){var r=n.splice(e,1);return{newDocument:t,removed:r[0]}},replace:function(n,e,t){var r=n[e];return n[e]=this.value,{newDocument:t,removed:r}},move:U.move,copy:U.copy,test:U.test,_get:U._get};function ee(n,e){if(e=="")return n;var t={op:"_get",path:e};return N(n,t),t.value}v.getValueByPointer=ee;function N(n,e,t,r,i,s){if(t===void 0&&(t=!1),r===void 0&&(r=!0),i===void 0&&(i=!0),s===void 0&&(s=0),t&&(typeof t=="function"?t(e,0,n,e.path):te(e,0)),e.path===""){var a={newDocument:n};if(e.op==="add")return a.newDocument=e.value,a;if(e.op==="replace")return a.newDocument=e.value,a.removed=n,a;if(e.op==="move"||e.op==="copy")return a.newDocument=ee(n,e.from),e.op==="move"&&(a.removed=n),a;if(e.op==="test"){if(a.test=J(n,e.value),a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a.newDocument=n,a}else{if(e.op==="remove")return a.removed=n,a.newDocument=null,a;if(e.op==="_get")return e.value=n,a;if(t)throw new v.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",s,e,n);return a}}else{r||(n=C._deepClone(n));var l=e.path||"",d=l.split("/"),o=n,c=1,h=d.length,m=void 0,u=void 0,f=void 0;for(typeof t=="function"?f=t:f=te;;){if(u=d[c],u&&u.indexOf("~")!=-1&&(u=C.unescapePathComponent(u)),i&&(u=="__proto__"||u=="prototype"&&c>0&&d[c-1]=="constructor"))throw new TypeError("JSON-Patch: modifying `__proto__` or `constructor/prototype` prop is banned for security reasons, if this was on purpose, please set `banPrototypeModifications` flag false and pass it to this function. More info in fast-json-patch README");if(t&&m===void 0&&(o[u]===void 0?m=d.slice(0,c).join("/"):c==h-1&&(m=e.path),m!==void 0&&f(e,0,n,m)),c++,Array.isArray(o)){if(u==="-")u=o.length;else{if(t&&!C.isInteger(u))throw new v.JsonPatchError("Expected an unsigned base-10 integer value, making the new referenced value the array element with the zero-based index","OPERATION_PATH_ILLEGAL_ARRAY_INDEX",s,e,n);C.isInteger(u)&&(u=~~u)}if(c>=h){if(t&&e.op==="add"&&u>o.length)throw new v.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",s,e,n);var a=Ct[e.op].call(e,o,u,n);if(a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}}else if(c>=h){var a=U[e.op].call(e,o,u,n);if(a.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",s,e,n);return a}if(o=o[u],t&&c<h&&(!o||typeof o!="object"))throw new v.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",s,e,n)}}}v.applyOperation=N;function Xe(n,e,t,r,i){if(r===void 0&&(r=!0),i===void 0&&(i=!0),t&&!Array.isArray(e))throw new v.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(n=C._deepClone(n));for(var s=new Array(e.length),a=0,l=e.length;a<l;a++)s[a]=N(n,e[a],t,!0,i,a),n=s[a].newDocument;return s.newDocument=n,s}v.applyPatch=Xe;function It(n,e,t){var r=N(n,e);if(r.test===!1)throw new v.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",t,e,n);return r.newDocument}v.applyReducer=It;function te(n,e,t,r){if(typeof n!="object"||n===null||Array.isArray(n))throw new v.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,n,t);if(U[n.op]){if(typeof n.path!="string")throw new v.JsonPatchError("Operation `path` property is not a string","OPERATION_PATH_INVALID",e,n,t);if(n.path.indexOf("/")!==0&&n.path.length>0)throw new v.JsonPatchError('Operation `path` property must start with "/"',"OPERATION_PATH_INVALID",e,n,t);if((n.op==="move"||n.op==="copy")&&typeof n.from!="string")throw new v.JsonPatchError("Operation `from` property is not present (applicable in `move` and `copy` operations)","OPERATION_FROM_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&n.value===void 0)throw new v.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_REQUIRED",e,n,t);if((n.op==="add"||n.op==="replace"||n.op==="test")&&C.hasUndefined(n.value))throw new v.JsonPatchError("Operation `value` property is not present (applicable in `add`, `replace` and `test` operations)","OPERATION_VALUE_CANNOT_CONTAIN_UNDEFINED",e,n,t);if(t){if(n.op=="add"){var i=n.path.split("/").length,s=r.split("/").length;if(i!==s+1&&i!==s)throw new v.JsonPatchError("Cannot perform an `add` operation at the desired path","OPERATION_PATH_CANNOT_ADD",e,n,t)}else if(n.op==="replace"||n.op==="remove"||n.op==="_get"){if(n.path!==r)throw new v.JsonPatchError("Cannot perform the operation at a path that does not exist","OPERATION_PATH_UNRESOLVABLE",e,n,t)}else if(n.op==="move"||n.op==="copy"){var a={op:"_get",path:n.from,value:void 0},l=Ge([a],t);if(l&&l.name==="OPERATION_PATH_UNRESOLVABLE")throw new v.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,n,t)}}}else throw new v.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,n,t)}v.validator=te;function Ge(n,e,t){try{if(!Array.isArray(n))throw new v.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)Xe(C._deepClone(e),C._deepClone(n),t||!0);else{t=t||te;for(var r=0;r<n.length;r++)t(n[r],r,e,void 0)}}catch(i){if(i instanceof v.JsonPatchError)return i;throw i}}v.validate=Ge;function J(n,e){if(n===e)return!0;if(n&&e&&typeof n=="object"&&typeof e=="object"){var t=Array.isArray(n),r=Array.isArray(e),i,s,a;if(t&&r){if(s=n.length,s!=e.length)return!1;for(i=s;i--!==0;)if(!J(n[i],e[i]))return!1;return!0}if(t!=r)return!1;var l=Object.keys(n);if(s=l.length,s!==Object.keys(e).length)return!1;for(i=s;i--!==0;)if(!e.hasOwnProperty(l[i]))return!1;for(i=s;i--!==0;)if(a=l[i],!J(n[a],e[a]))return!1;return!0}return n!==n&&e!==e}v._areEquals=J});var Ye=B(q=>{Object.defineProperty(q,"__esModule",{value:!0});var A=Z(),Dt=ye(),Se=new WeakMap,Ft=(function(){function n(e){this.observers=new Map,this.obj=e}return n})(),Ot=(function(){function n(e,t){this.callback=e,this.observer=t}return n})();function _t(n){return Se.get(n)}function Nt(n,e){return n.observers.get(e)}function Mt(n,e){n.observers.delete(e.callback)}function Ht(n,e){e.unobserve()}q.unobserve=Ht;function Lt(n,e){var t=[],r,i=_t(n);if(!i)i=new Ft(n),Se.set(n,i);else{var s=Nt(i,e);r=s&&s.observer}if(r)return r;if(r={},i.value=A._deepClone(n),e){r.callback=e,r.next=null;var a=function(){ve(r)},l=function(){clearTimeout(r.next),r.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",l),window.addEventListener("keyup",l),window.addEventListener("mousedown",l),window.addEventListener("keydown",l),window.addEventListener("change",l))}return r.patches=t,r.object=n,r.unobserve=function(){ve(r),clearTimeout(r.next),Mt(i,r),typeof window<"u"&&(window.removeEventListener("mouseup",l),window.removeEventListener("keyup",l),window.removeEventListener("mousedown",l),window.removeEventListener("keydown",l),window.removeEventListener("change",l))},i.observers.set(e,new Ot(e,r)),r}q.observe=Lt;function ve(n,e){e===void 0&&(e=!1);var t=Se.get(n.object);we(t.value,n.object,n.patches,"",e),n.patches.length&&Dt.applyPatch(t.value,n.patches);var r=n.patches;return r.length>0&&(n.patches=[],n.callback&&n.callback(r)),r}q.generate=ve;function we(n,e,t,r,i){if(e!==n){typeof e.toJSON=="function"&&(e=e.toJSON());for(var s=A._objectKeys(e),a=A._objectKeys(n),l=!1,d=!1,o=a.length-1;o>=0;o--){var c=a[o],h=n[c];if(A.hasOwnProperty(e,c)&&!(e[c]===void 0&&h!==void 0&&Array.isArray(e)===!1)){var m=e[c];typeof h=="object"&&h!=null&&typeof m=="object"&&m!=null&&Array.isArray(h)===Array.isArray(m)?we(h,m,t,r+"/"+A.escapePathComponent(c),i):h!==m&&(l=!0,i&&t.push({op:"test",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(h)}),t.push({op:"replace",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(m)}))}else Array.isArray(n)===Array.isArray(e)?(i&&t.push({op:"test",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(h)}),t.push({op:"remove",path:r+"/"+A.escapePathComponent(c)}),d=!0):(i&&t.push({op:"test",path:r,value:n}),t.push({op:"replace",path:r,value:e}),l=!0)}if(!(!d&&s.length==a.length))for(var o=0;o<s.length;o++){var c=s[o];!A.hasOwnProperty(n,c)&&e[c]!==void 0&&t.push({op:"add",path:r+"/"+A.escapePathComponent(c),value:A._deepClone(e[c])})}}}function kt(n,e,t){t===void 0&&(t=!1);var r=[];return we(n,e,r,"",t),r}q.compare=kt});var Ke=B(M=>{var Ut=ye();Object.assign(M,Ut);var qt=Ye();Object.assign(M,qt);var re=Z();M.JsonPatchError=re.PatchError;M.deepClone=re._deepClone;M.escapePathComponent=re.escapePathComponent;M.unescapePathComponent=re.unescapePathComponent});var x=class extends Error{patternId;disposition;cause;constructor(e,t,r){super(`${t}: pattern ${e}: ${r instanceof Error?r.message:String(r)}`),this.name="PatternMutationError",this.patternId=e,this.disposition=t,this.cause=r}};ut();import{existsSync as Yt}from"node:fs";import{join as at}from"node:path";Oe();var z=class{constructor(e,t){this.createAdapter=e;this.config=t?.base??Y,this.rvfPath=t?.rvfPath??".agentic-qe/patterns.rvf",this.skipCloseOnDispose=t?.skipCloseOnDispose??!1,this.embeddingSpaceId=t?.embeddingSpaceId}createAdapter;config;rvfPath;skipCloseOnDispose;embeddingSpaceId;adapter=null;sqliteStore=null;initialized=!1;rvfInitError=null;searchOps=0;totalSearchMs=0;setSqliteStore(e){this.sqliteStore=e}getAdapter(){return this.adapter}async initialize(){if(!this.initialized){if(this.rvfInitError=null,process.env.AQE_MEMORY_BACKEND==="memory"){this.adapter=null,this.initialized=!0;return}try{!this.embeddingSpaceId&&!R()&&await j(),this.adapter=this.createAdapter(this.rvfPath,this.config.embeddingDimension);let e=R()?.spaceId??this.embeddingSpaceId??null;Ne(this.rvfPath,e,this.adapter.status()?.totalVectors??0),this.initialized=!0,console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`)}catch(e){this.rvfInitError=b(e);try{this.adapter?.close()}catch{}console.error(`[RvfPatternStore] ERROR: RVF initialization failed \u2014 vector search is DISABLED. Cause: ${this.rvfInitError}. Fix: check the embedder endpoint and @ruvector/rvf-node binding, or set RUVECTOR_USE_RVF_PATTERN_STORE=false to use SQLite HNSW.`),this.adapter=null,this.initialized=!0}if(!this.sqliteStore)try{let{createSQLitePatternStore:e}=await import("./sqlite-persistence-HPTT624C.js"),t=e();await t.initialize(),this.sqliteStore=t}catch{}await this.purgeOrphanedVectors()}}async purgeOrphanedVectors(){if(!(!this.adapter||!this.sqliteStore))try{let e=this.adapter.status()?.totalVectors??0,t=this.sqliteStore.getStats()?.totalPatterns??0;if(e<=t)return;let{readFileSync:r,existsSync:i}=await import("node:fs"),s=`${this.rvfPath}.idmap.json`;if(!i(s))return;let a=JSON.parse(r(s,"utf-8")),l=new Set((a.entries??[]).map(c=>Array.isArray(c)?c[0]:void 0).filter(c=>typeof c=="string")),d=new Set(this.sqliteStore.getPatterns({limit:1e4}).map(c=>c.id)),o=[...l].filter(c=>!d.has(c));if(o.length===0)return;this.adapter.delete(o),console.log(`[RvfPatternStore] Removed ${o.length} ghost vectors (index ${e} > DB ${t})`)}catch(e){console.warn(`[RvfPatternStore] orphan purge skipped: ${b(e)}`)}}async dispose(){if(this.adapter&&!this.skipCloseOnDispose)try{this.adapter.close()}catch{}this.adapter=null,this.initialized=!1}async store(e){await this.ensureInitialized();let t=X(e);if(!t.valid)return S(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return S(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));if(!this.sqliteStore)return S(new x(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let r=R()?.spaceId??this.embeddingSpaceId;if(e.embedding&&!r)return S(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));let i=!1;if(this.sqliteStore)try{let s=this.sqliteStore.storePattern(e,e.embedding,r);s&&s!==e.id&&(e.id=s),i=!0}catch(s){return S(new x(e.id,"FAILED",s))}if(e.embedding&&!this.adapter&&this.rvfInitError)return S(new x(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",new Error(`RVF unavailable ${i?"after":"before"} authoritative pattern commit: ${this.rvfInitError}`)));if(e.embedding&&this.adapter)try{let s=e.embedding instanceof Float32Array?e.embedding:new Float32Array(e.embedding),a=this.adapter.ingest([{id:e.id,vector:s}]);if(a.accepted!==1||a.rejected!==0)throw new Error(`RVF rejected pattern vector (accepted=${a.accepted}, rejected=${a.rejected})`)}catch(s){return S(new x(e.id,i?"COMMITTED_PENDING_INDEX":"FAILED",s))}return P(e.id)}async create(e){let t=e.confidence??.5,r=e.qeDomain??"test-generation",i={id:O(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:t,usageCount:0,successRate:0,qualityScore:W({confidence:t,usageCount:0,successRate:0}),context:{tags:[],...e.context},template:{example:"",...e.template},embedding:e.embedding,tier:"short-term",createdAt:new Date,lastUsedAt:new Date,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?P(i):S(s.error)}async get(e){if(this.sqliteStore)try{return this.sqliteStore.getPattern(e)??null}catch{return null}return null}async search(e,t={}){await this.ensureInitialized();let r=performance.now(),i=t.limit??10,s=[];if(Array.isArray(e)){let d=R()?.spaceId??this.embeddingSpaceId;if(!d||t.embeddingSpaceId!==d)return S(new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId"))}if(Array.isArray(e)&&this.adapter)try{let d=e instanceof Float32Array?e:new Float32Array(e),o=this.adapter.search(d,i*2);for(let c of o){let h=await this.get(c.id);if(h&&this.matchesFilters(h,t)){let m=this.calculateReuseInfo(h,c.score);s.push({pattern:h,score:c.score,matchType:"vector",similarity:c.score,canReuse:m.canReuse,estimatedTokenSavings:m.estimatedTokenSavings,reuseConfidence:m.reuseConfidence})}}}catch(d){console.warn("[RvfPatternStore] RVF search failed:",b(d))}if(Array.isArray(e)&&!this.adapter&&this.sqliteStore&&s.length===0)try{let d=R()?.spaceId??this.embeddingSpaceId,o=this.sqliteStore.getAllEmbeddings(),c=e,h=Math.sqrt(c.reduce((m,u)=>m+u*u,0));if(h>0)for(let m of o){if(!d||m.spaceId!==d)continue;let u=this.sqliteStore.getPattern(m.patternId);if(!u||!this.matchesFilters(u,t))continue;let f=m.embedding;if(!f||f.length!==c.length)continue;let g=0,y=0;for(let E=0;E<c.length;E++)g+=c[E]*f[E],y+=f[E]*f[E];if(y=Math.sqrt(y),y===0)continue;let p=g/(h*y),w=this.calculateReuseInfo(u,p);s.push({pattern:u,score:p,matchType:"vector",similarity:p,canReuse:w.canReuse,estimatedTokenSavings:w.estimatedTokenSavings,reuseConfidence:w.reuseConfidence})}}catch{}if(typeof e=="string"&&!e.trim()&&this.sqliteStore)try{let d=this.sqliteStore.getPatterns({limit:i*2}),o=new Set(s.map(c=>c.pattern.id));for(let c of d)o.has(c.id)||this.matchesFilters(c,t)&&s.push({pattern:c,score:c.confidence,matchType:"context",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}catch{}let a=typeof e=="string"?e:t.textQuery;if(a?.trim()&&this.sqliteStore)try{let d=this.sqliteStore.searchFTS(a,i*2),o=new Set(s.map(h=>h.pattern.id)),c=new Map(d.map(h=>[h.id,h.ftsScore*h.coverage]));for(let h of s){let m=c.get(h.pattern.id);m!==void 0&&(h.score=le(h.score,m))}for(let h of d){if(o.has(h.id))continue;let m=await this.get(h.id);if(m&&this.matchesFilters(m,t)){let u=.5*h.ftsScore*h.coverage;s.push({pattern:m,score:u,matchType:"lexical",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}}}catch{}s.sort((d,o)=>o.score-d.score);let l=performance.now()-r;return this.searchOps++,this.totalSearchMs+=l,P(s.slice(0,i))}async recordUsage(e,t,r,i){if(!this.sqliteStore)return S(new Error("No SQLite store attached"));try{return this.sqliteStore.recordUsage(e,t,r,i),P(void 0)}catch(s){return S(new Error(`recordUsage failed: ${b(s)}`))}}async promote(e){if(!this.sqliteStore)return S(new Error("No SQLite store attached"));try{return this.sqliteStore.promotePattern(e),P(void 0)}catch(t){return S(new Error(`promote failed: ${b(t)}`))}}async delete(e){if(this.adapter)try{this.adapter.delete([e])}catch(t){console.warn(`[RvfPatternStore] RVF delete failed for ${e}:`,b(t))}if(this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(t){return S(new Error(`SQLite delete failed: ${b(t)}`))}return P(void 0)}async getStats(){let e=this.adapter?.status(),t=0,r={},i={shortTerm:0,longTerm:0};if(this.sqliteStore)try{let s=this.sqliteStore.getStats();t=s.totalPatterns,r=s.byDomain,i={shortTerm:s.byTier["short-term"]??0,longTerm:s.byTier["long-term"]??0}}catch{}return{totalPatterns:t,byTier:i,byDomain:r,byType:{},avgConfidence:0,avgQualityScore:0,avgSuccessRate:0,searchOperations:this.searchOps,avgSearchLatencyMs:this.searchOps>0?this.totalSearchMs/this.searchOps:0,hnswStats:{nativeAvailable:this.adapter!==null,vectorCount:e?.totalVectors??0,indexSizeBytes:e?.fileSizeBytes??0,...this.rvfInitError?{rvfInitError:this.rvfInitError}:{}}}}async cleanup(){if(!this.sqliteStore)return{removed:0,promoted:0};let e=0,t=0;try{let r=this.sqliteStore.getPatterns({limit:1e4});for(let i of r)i.confidence<this.config.minConfidence&&i.usageCount>3?(await this.delete(i.id),e++):i.tier==="short-term"&&i.successfulUses>=V&&(await this.promote(i.id),t++)}catch(r){console.warn("[RvfPatternStore] Cleanup error:",b(r))}return{removed:e,promoted:t}}async ensureInitialized(){this.initialized||await this.initialize()}matchesFilters(e,t){return!(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence&&e.confidence<t.minConfidence||t.minQualityScore&&e.qualityScore<t.minQualityScore)}calculateReuseInfo(e,t){let r=this.config.reuseOptimization,i=r.enabled&&t>=r.minSimilarityForReuse&&e.successRate>=r.minSuccessRateForReuse;return{canReuse:i,estimatedTokenSavings:i?500:0,reuseConfidence:i?t*e.successRate:0}}};ht();Oe();_();function mt(n,e){let r=[n.pattern,n];for(let i of r){let s=e.split("."),a=i;for(let l of s){if(a==null)break;if(typeof a=="object")a=a[l];else{a=void 0;break}}if(a!==void 0)return a}}function pt(n,e,t){switch(e){case"eq":return n===t;case"gt":return typeof n=="number"&&typeof t=="number"&&n>t;case"lt":return typeof n=="number"&&typeof t=="number"&&n<t;case"gte":return typeof n=="number"&&typeof t=="number"&&n>=t;case"lte":return typeof n=="number"&&typeof t=="number"&&n<=t;case"in":return Array.isArray(t)?t.includes(n):!1;case"contains":return Array.isArray(n)||typeof n=="string"&&typeof t=="string"?n.includes(t):!1;case"between":{if(typeof n!="number"||!Array.isArray(t)||t.length!==2){if(n instanceof Date&&Array.isArray(t)&&t.length===2){let s=n.getTime(),a=t[0]instanceof Date?t[0].getTime():Number(t[0]),l=t[1]instanceof Date?t[1].getTime():Number(t[1]);return s>=a&&s<=l}return!1}let[r,i]=t;return n>=r&&n<=i}default:return!1}}function K(n,e){switch(e.type){case"AND":return(e.children??[]).every(r=>K(n,r));case"OR":{let t=e.children??[];return t.length===0?!0:t.some(r=>K(n,r))}case"NOT":return e.child?!K(n,e.child):!0;case"FIELD":{if(!e.field||!e.operator)return!0;let t=mt(n,e.field);return pt(t,e.operator,e.value)}default:return!0}}function qe(n,e){return e?n.filter(t=>K(t,e)):n}_();_();var $e=1e4,ze=2166136261;function Je(n){let e=2166136261;for(let t=0;t<n.length;t++)e^=n.charCodeAt(t),e=Math.imul(e,16777619);return e>>>0}var he=new Uint8Array(256);for(let n=0;n<256;n++){let e=0,t=n;for(;t;)e++,t&=t-1;he[n]=e}var Qe="0123456789abcdef";function gt(n){let e=Math.min(n.length,16),t="";for(let r=0;r<e;r++){let i=n[r];t+=Qe[i>>4]+Qe[i&15]}return t}function yt(n,e){if(n.length!==e.length)throw new Error(`Cannot bind vectors of different lengths: ${n.length} vs ${e.length}`);let t=new Uint8Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]^e[r];return t}function vt(n){if(n.length===0)throw new Error("Cannot bundle zero vectors");let e=n[0].length;for(let i=1;i<n.length;i++)if(n[i].length!==e)throw new Error(`Vector length mismatch at index ${i}: expected ${e}, got ${n[i].length}`);let t=new Uint8Array(e),r=n.length/2;for(let i=0;i<e;i++){let s=0;for(let a=0;a<8;a++){let l=0,d=1<<a;for(let o=0;o<n.length;o++)n[o][i]&d&&l++;l>=r&&(s|=d)}t[i]=s}return t}function St(n,e,t){if(n.length!==e.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${n.length} vs ${e.length}`);let r=0;for(let s=0;s<n.length;s++)r+=he[n[s]^e[s]];let i=t??n.length*8;return i>0?r/i:0}function wt(n,e,t){return 1-St(n,e,t)}var de=class{dimensions;baseSeed;byteLen;tokenCache=new Map;constructor(e){if(this.dimensions=e?.dimensions??$e,this.baseSeed=e?.seed??ze,this.byteLen=Math.ceil(this.dimensions/8),this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}tokenToHypervector(e){let t=this.tokenCache.get(e);if(t)return new Uint8Array(t);let r=Je(e)^this.baseSeed,i=this.generateSeededVector(r);return this.tokenCache.set(e,i),new Uint8Array(i)}fingerprintPattern(e){if(e.length===0)return new Uint8Array(this.byteLen);let t=this.tokenToHypervector(e[0]);for(let r=1;r<e.length;r++)t=yt(t,this.tokenToHypervector(e[r]));return t}fingerprintWithContext(e,t){let r=this.fingerprintPattern(e);if(t.length===0)return r;let i=this.fingerprintPattern(t);return vt([r,i])}similarity(e,t){return wt(e,t,this.dimensions)}generateSeededVector(e){let t=new Uint8Array(this.byteLen),r=new oe(e),i=0;for(;i<this.byteLen;){let a=r.next(),l=Math.min(4,this.byteLen-i);for(let d=0;d<l;d++)t[i++]=a>>>d*8&255}let s=this.dimensions%8;return s>0&&(t[this.byteLen-1]&=(1<<s)-1),t}},ue=class{dimensions;baseSeed;constructor(e){if(this.dimensions=e?.dimensions??$e,this.baseSeed=e?.seed??ze,this.dimensions<=0)throw new Error(`HDC dimensions must be positive, got ${this.dimensions}`)}fingerprint(e){let t=`${e.id}|${e.domain}|${e.type}|${e.content??""}`,r=Je(t)^this.baseSeed,i=this.generateVector(r);return{vector:i,dimensions:this.dimensions,hash:gt(i)}}compositionalBind(e,t){if(e.length!==t.length)throw new Error(`Cannot bind vectors of different lengths: ${e.length} vs ${t.length}`);let r=new Uint8Array(e.length);for(let i=0;i<e.length;i++)r[i]=e[i]^t[i];return r}hammingDistance(e,t){if(e.length!==t.length)throw new Error(`Cannot compute Hamming distance for vectors of different lengths: ${e.length} vs ${t.length}`);let r=0;for(let i=0;i<e.length;i++)r+=he[e[i]^t[i]];return r}similarity(e,t){return 1-this.hammingDistance(e,t)/this.dimensions}batchFingerprint(e){return e.map(t=>this.fingerprint(t))}generateVector(e){let t=Math.ceil(this.dimensions/8),r=new Uint8Array(t),i=new oe(e),s=0;for(;s<t;){let l=i.next(),d=t-s,o=d<4?d:4;for(let c=0;c<o;c++)r[s++]=l>>>c*8&255}let a=this.dimensions%8;return a>0&&(r[t-1]&=(1<<a)-1),r}};function Be(n){return new ue(n)}function je(n){return $()?new de(n):null}var Pe=dt(Ke(),1),be=Pe.default??Pe,Qt=`
4
+ CREATE TABLE IF NOT EXISTS pattern_deltas (
5
+ id TEXT PRIMARY KEY,
6
+ pattern_id TEXT NOT NULL,
7
+ version INTEGER NOT NULL,
8
+ timestamp INTEGER NOT NULL,
9
+ type TEXT NOT NULL CHECK (type IN ('genesis', 'update', 'rollback')),
10
+ patch TEXT NOT NULL DEFAULT '[]',
11
+ reverse_patch TEXT NOT NULL DEFAULT '[]',
12
+ metadata TEXT
13
+ );
14
+ CREATE INDEX IF NOT EXISTS idx_pattern_deltas_pid_version
15
+ ON pattern_deltas (pattern_id, version);
16
+ CREATE INDEX IF NOT EXISTS idx_pattern_deltas_timestamp
17
+ ON pattern_deltas (timestamp);
18
+ `;function Ze(n,e){let t=be.compare(n,e),r=be.compare(e,n);return{forward:t,reverse:r}}function $t(n,e){let t=JSON.parse(JSON.stringify(n));return be.applyPatch(t,e).newDocument}function et(n){return{id:n.id,patternId:n.pattern_id,version:n.version,timestamp:n.timestamp,type:n.type,patch:JSON.parse(n.patch),reversePatch:JSON.parse(n.reverse_patch),metadata:n.metadata?JSON.parse(n.metadata):void 0}}var ne=class{db;config;prepared=new Map;initialized=!1;constructor(e,t){this.db=e,this.config={maxVersionsPerPattern:t?.maxVersionsPerPattern??100,compressDeltas:t?.compressDeltas??!1}}initialize(){this.initialized||(this.db.exec(Qt),this.prepareStatements(),this.initialized=!0)}prepareStatements(){this.prepared.set("insert",this.db.prepare(`
19
+ INSERT INTO pattern_deltas (id, pattern_id, version, timestamp, type, patch, reverse_patch, metadata)
20
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
21
+ `)),this.prepared.set("getHistory",this.db.prepare(`
22
+ SELECT * FROM pattern_deltas
23
+ WHERE pattern_id = ?
24
+ ORDER BY version ASC
25
+ `)),this.prepared.set("currentVersion",this.db.prepare(`
26
+ SELECT MAX(version) as max_version FROM pattern_deltas
27
+ WHERE pattern_id = ?
28
+ `)),this.prepared.set("incrementalSync",this.db.prepare(`
29
+ SELECT * FROM pattern_deltas
30
+ WHERE timestamp > ?
31
+ ORDER BY timestamp ASC
32
+ `)),this.prepared.set("countForPattern",this.db.prepare(`
33
+ SELECT COUNT(*) as cnt FROM pattern_deltas
34
+ WHERE pattern_id = ?
35
+ `)),this.prepared.set("deleteOldest",this.db.prepare(`
36
+ DELETE FROM pattern_deltas
37
+ WHERE pattern_id = ? AND version IN (
38
+ SELECT version FROM pattern_deltas
39
+ WHERE pattern_id = ?
40
+ ORDER BY version ASC
41
+ LIMIT ?
42
+ )
43
+ `))}ensureInitialized(){if(!this.initialized)throw new Error("DeltaTracker not initialized. Call initialize() first.")}createGenesis(e,t,r){this.ensureInitialized();let i=this.getCurrentVersion(e);if(i>=0)throw new Error(`Genesis already exists for pattern ${e} (current version: ${i})`);let s={id:O(),patternId:e,version:0,timestamp:Date.now(),type:"genesis",patch:[],reversePatch:[],metadata:{...r,snapshot:t}};return this.insertEvent(s),s}recordDelta(e,t,r,i){this.ensureInitialized();let s=this.getCurrentVersion(e);if(s<0)throw new Error(`No genesis found for pattern ${e}. Call createGenesis() first.`);let{forward:a,reverse:l}=Ze(t,r),d={id:O(),patternId:e,version:s+1,timestamp:Date.now(),type:"update",patch:a,reversePatch:l,metadata:i};return this.insertEvent(d),this.enforceRetention(e),d}rollback(e,t){this.ensureInitialized();let r=this.getHistory(e);if(r.length===0)throw new Error(`No history found for pattern ${e}`);let i=r[r.length-1].version;if(t<0||t>i)throw new Error(`Invalid rollback version ${t}. Valid range: 0-${i}`);if(t===i)return this.reconstructState(r,i);let s=this.reconstructState(r,t),a=this.reconstructState(r,i),{forward:l,reverse:d}=Ze(a,s),o={id:O(),patternId:e,version:i+1,timestamp:Date.now(),type:"rollback",patch:l,reversePatch:d,metadata:{rolledBackTo:t}};return this.insertEvent(o),this.enforceRetention(e),s}getHistory(e){return this.ensureInitialized(),this.prepared.get("getHistory").all(e).map(et)}incrementalSync(e){return this.ensureInitialized(),this.prepared.get("incrementalSync").all(e).map(et)}getCurrentVersion(e){return this.ensureInitialized(),this.prepared.get("currentVersion").get(e).max_version??-1}insertEvent(e){this.prepared.get("insert").run(e.id,e.patternId,e.version,e.timestamp,e.type,JSON.stringify(e.patch),JSON.stringify(e.reversePatch),e.metadata?JSON.stringify(e.metadata):null)}reconstructState(e,t){let r=e.find(s=>s.type==="genesis");if(!r||!r.metadata?.snapshot)throw new Error("Cannot reconstruct state: no genesis snapshot found");let i=JSON.parse(JSON.stringify(r.metadata.snapshot));for(let s of e)if(s.version!==0){if(s.version>t)break;i=$t(i,s.patch)}return i}enforceRetention(e){let{maxVersionsPerPattern:t}=this.config,i=this.prepared.get("countForPattern").get(e).cnt;if(i>t){let s=i-t;this.db.prepare(`DELETE FROM pattern_deltas
44
+ WHERE pattern_id = ? AND version != 0 AND id IN (
45
+ SELECT id FROM pattern_deltas
46
+ WHERE pattern_id = ? AND version != 0
47
+ ORDER BY version ASC
48
+ LIMIT ?
49
+ )`).run(e,e,s)}}};_();var zt={maxHistoryPerPattern:50,snapshotInterval:10,batchSize:20,epsilon:1e-7},Ee=class{config;history=new Map;snapshots=new Map;versions=new Map;buffer=[];constructor(e){this.config={...zt,...e}}recordGenesis(e,t,r){if(this.versions.has(e))throw new Error(`Genesis already exists for pattern ${e} (version ${this.versions.get(e)})`);let i=this.computeSparseChanges(new Array(t.length).fill(0),t),s={patternId:e,version:0,timestamp:Date.now(),deltaType:"genesis",sparseChanges:i,metadata:r,compressedSize:i.length},a={patternId:e,version:0,fullVector:[...t],timestamp:s.timestamp};return this.versions.set(e,0),this.getOrCreate(this.history,e).push(s),this.getOrCreate(this.snapshots,e).push(a),this.buffer.push(s),s}recordDelta(e,t,r,i){let s=this.versions.get(e);if(s===void 0)throw new Error(`No genesis found for pattern ${e}. Call recordGenesis() first.`);let a=s+1,l=this.computeSparseChanges(t,r),d={patternId:e,version:a,timestamp:Date.now(),deltaType:"update",sparseChanges:l,metadata:i,compressedSize:l.length};return this.versions.set(e,a),this.getOrCreate(this.history,e).push(d),this.buffer.push(d),a%this.config.snapshotInterval===0&&this.getOrCreate(this.snapshots,e).push({patternId:e,version:a,fullVector:[...r],timestamp:d.timestamp}),this.enforceRetention(e),d}getHistory(e,t){let r=this.history.get(e);if(!r||r.length===0)return[];let i=[...r].reverse();return t!==void 0&&t>0?i.slice(0,t):i}rollback(e,t){let r=this.reconstructAtVersion(e,t);return r===null?null:{patternId:e,version:t,fullVector:r,timestamp:Date.now()}}getVersion(e){return this.versions.get(e)??-1}reconstructAtVersion(e,t){let r=this.history.get(e);if(!r||r.length===0)return null;let i=this.versions.get(e);if(t<0||t>i)return null;let s=this.snapshots.get(e)||[],a=null;for(let o=s.length-1;o>=0;o--)if(s[o].version<=t){a=s[o];break}if(!a)return null;let l=[...a.fullVector],d=a.version+1;for(let o of r)if(!(o.version<d)){if(o.version>t)break;this.applySparseForward(l,o.sparseChanges)}return l}pruneHistory(e,t){let r=t??this.config.maxHistoryPerPattern,i=this.history.get(e);if(!i||i.length<=r)return 0;let s=i.length-r,a=i.slice(0,s),l=i.slice(s),d=a.findIndex(h=>h.deltaType==="genesis");d>=0&&(l.unshift(a[d]),a.splice(d,1)),this.history.set(e,l);let o=l[0]?.version??0,c=this.snapshots.get(e);return c&&this.snapshots.set(e,c.filter(h=>h.version===0||h.version>=o)),a.length}getStats(){let e=0;for(let r of this.history.values())e+=r.length;let t=this.history.size;return{totalPatterns:t,totalDeltas:e,avgDeltasPerPattern:t>0?e/t:0}}flush(){let e=[...this.buffer];return this.buffer.length=0,e}getBufferSize(){return this.buffer.length}clear(){this.history.clear(),this.snapshots.clear(),this.versions.clear(),this.buffer.length=0}computeSparseChanges(e,t){let r=[],i=Math.max(e.length,t.length);for(let s=0;s<i;s++){let a=s<e.length?e[s]:0,l=s<t.length?t[s]:0;Math.abs(a-l)>this.config.epsilon&&r.push({index:s,oldValue:a,newValue:l})}return r}applySparseForward(e,t){for(let r of t){for(;e.length<=r.index;)e.push(0);e[r.index]=r.newValue}}enforceRetention(e){this.pruneHistory(e,this.config.maxHistoryPerPattern)}getOrCreate(e,t){let r=e.get(t);return r||(r=[],e.set(t,r)),r}};function tt(n){return L()?new Ee(n):null}_();var Jt=128,Bt=8,jt=1e4,Ae=class{dimension;beta;maxPatterns;patterns;constructor(e){if(this.dimension=e?.dimension??Jt,this.beta=e?.beta??Bt,this.maxPatterns=e?.maxPatterns??jt,this.patterns=[],this.dimension<=0)throw new Error(`Hopfield dimension must be positive, got ${this.dimension}`);if(this.beta<=0)throw new Error(`Hopfield beta must be positive, got ${this.beta}`);if(this.maxPatterns<=0)throw new Error(`Hopfield maxPatterns must be positive, got ${this.maxPatterns}`)}store(e,t){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Pattern dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.dotProduct(e,e)===0)throw new Error("Cannot store zero-magnitude pattern in Hopfield memory");let i=this.normalize(e);this.patterns.length>=this.maxPatterns&&this.patterns.shift(),this.patterns.push({pattern:i,metadata:t??{},storedAt:Date.now()})}recall(e){if(this.assertEnabled(),e.length!==this.dimension)throw new Error(`Query dimension mismatch: expected ${this.dimension}, got ${e.length}`);if(this.patterns.length===0)return null;let t=this.normalize(e),r=new Float32Array(this.patterns.length);for(let c=0;c<this.patterns.length;c++)r[c]=this.beta*this.dotProduct(this.patterns[c].pattern,t);let i=this.softmax(r),s=0,a=i[0];for(let c=1;c<i.length;c++)i[c]>a&&(a=i[c],s=c);let l=this.patterns[s],d=this.getEnergy(t),o=this.cosineSimilarity(t,l.pattern);return{pattern:new Float32Array(l.pattern),metadata:{...l.metadata},energy:d,similarity:o}}batchRecall(e){return this.assertEnabled(),e.map(t=>this.recall(t))}getPatternCount(){return this.patterns.length}clear(){this.patterns.length=0}getEnergy(e){if(e.length!==this.dimension)throw new Error(`State dimension mismatch: expected ${this.dimension}, got ${e.length}`);let t=this.normalize(e);if(this.patterns.length===0)return .5*this.dotProduct(t,t);let r=new Float32Array(this.patterns.length);for(let o=0;o<this.patterns.length;o++)r[o]=this.dotProduct(this.patterns[o].pattern,t);let i=new Float32Array(this.patterns.length),s=-1/0;for(let o=0;o<this.patterns.length;o++)i[o]=this.beta*r[o],i[o]>s&&(s=i[o]);let a=0;for(let o=0;o<this.patterns.length;o++)a+=Math.exp(i[o]-s);let l=1/this.beta*(s+Math.log(a)),d=this.dotProduct(t,t);return-l+.5*d}softmax(e){let t=new Float32Array(e.length),r=-1/0;for(let s=0;s<e.length;s++)e[s]>r&&(r=e[s]);let i=0;for(let s=0;s<e.length;s++)t[s]=Math.exp(e[s]-r),i+=t[s];if(i>0)for(let s=0;s<t.length;s++)t[s]/=i;return t}dotProduct(e,t){let r=0;for(let i=0;i<e.length;i++)r+=e[i]*t[i];return r}cosineSimilarity(e,t){let r=this.dotProduct(e,t),i=Math.sqrt(this.dotProduct(e,e)),s=Math.sqrt(this.dotProduct(t,t));return i===0||s===0?0:r/(i*s)}normalize(e){let t=Math.sqrt(this.dotProduct(e,e)),r=new Float32Array(e.length);if(t>0)for(let i=0;i<e.length;i++)r[i]=e[i]/t;return r}assertEnabled(){if(!F().useHopfieldMemory)throw new Error("Hopfield memory is disabled (useHopfieldMemory feature flag is false)")}};function rt(n){return new Ae(n)}_();var Wt={dimensions:32,curvature:-1,maxElements:1e4,efConstruction:200,M:16},H=1e-5,nt=1-H;function Vt(n,e){let t=0;for(let r=0;r<n.length;r++)t+=n[r]*e[r];return t}function I(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t]*n[t];return e}function Xt(n,e){let t=new Float32Array(n.length);for(let r=0;r<n.length;r++)t[r]=n[r]-e[r];return t}var D=class n{static poincareDistance(e,t){let r=I(Xt(e,t)),i=Math.max(H,1-I(e)),s=Math.max(H,1-I(t));return Math.acosh(Math.max(1,1+2*r/(i*s)))}static mobiusAdd(e,t){let r=Vt(e,t),i=I(e),s=I(t),a=Math.max(H,1+2*r+i*s),l=1+2*r+s,d=1-i,o=new Float32Array(e.length);for(let c=0;c<e.length;c++)o[c]=(l*e[c]+d*t[c])/a;return n.project(o)}static expMap(e,t){let r=2/Math.max(H,1-I(e)),i=Math.sqrt(I(t));if(i<H)return new Float32Array(e);let s=Math.tanh(r*i/2),a=new Float32Array(t.length);for(let l=0;l<t.length;l++)a[l]=s/i*t[l];return n.mobiusAdd(e,a)}static project(e){let t=Math.sqrt(I(e));if(t<=nt)return new Float32Array(e);let r=nt/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return i}static euclideanToHyperbolic(e){let t=Math.sqrt(I(e));if(t<H)return new Float32Array(e.length);let r=Math.tanh(t)/t,i=new Float32Array(e.length);for(let s=0;s<e.length;s++)i[s]=e[s]*r;return n.project(i)}},Te=class{config;points=new Map;constructor(e){if(this.config={...Wt,...e},this.config.dimensions<=0)throw new Error(`dimensions must be positive, got ${this.config.dimensions}`);if(this.config.curvature>=0)throw new Error(`curvature must be negative for hyperbolic space, got ${this.config.curvature}`);if(this.config.maxElements<=0)throw new Error(`maxElements must be positive, got ${this.config.maxElements}`)}insert(e,t,r){if(t.length!==this.config.dimensions)throw new Error(`Dimension mismatch: expected ${this.config.dimensions}, got ${t.length}`);if(this.points.size>=this.config.maxElements)throw new Error(`Maximum elements (${this.config.maxElements}) reached`);this.points.set(e,{id:e,coordinates:D.project(t),metadata:r?{...r}:void 0})}search(e,t){if(e.length!==this.config.dimensions)throw new Error(`Query dimension mismatch: expected ${this.config.dimensions}, got ${e.length}`);let r=D.project(e),i=[];for(let s of this.points.values())i.push({id:s.id,distance:D.poincareDistance(r,s.coordinates),point:s});return i.sort((s,a)=>s.distance-a.distance),i.slice(0,Math.max(0,t))}embedHierarchy(e){let t=new Map;if(e.length===0)return t;let r=this.config.dimensions,i=new Map,s=new Map,a=[];for(let d of e)if(s.set(d.id,d),!d.parentId)a.push(d.id);else{let o=i.get(d.parentId);o||(o=[],i.set(d.parentId,o)),o.push(d.id)}let l=a.map((d,o)=>({id:d,depth:0,angOff:2*Math.PI*o/Math.max(1,a.length),angSpan:2*Math.PI/Math.max(1,a.length)}));for(;l.length>0;){let{id:d,depth:o,angOff:c,angSpan:h}=l.shift(),m=Math.tanh(.3*(o+.1)),u=c+h/2,f=new Float32Array(r);f[0]=m*Math.cos(u),f[1]=m*Math.sin(u);let g=s.get(d);if(g&&g.features.length>0){let w=m*.1;for(let E=2;E<r&&E-2<g.features.length;E++)f[E]=g.features[E-2]*w}let y=D.project(f);t.set(d,y),this.points.set(d,{id:d,coordinates:y,metadata:{depth:o,parentId:g?.parentId}});let p=i.get(d)??[];for(let w=0;w<p.length;w++){let E=h/Math.max(1,p.length);l.push({id:p[w],depth:o+1,angOff:c+w*E,angSpan:E})}}return t}getStats(){return{elementCount:this.points.size,dimensions:this.config.dimensions,curvature:this.config.curvature}}};function it(n){return Gt()?new Te(n):null}function Gt(){return F().useHyperbolicHnsw}_();var Re=class{index=null;initialized=!1;config;constructor(e){this.config=e??{}}ensureInitialized(){if(this.initialized)return this.index!==null;if(this.initialized=!0,!k())return!1;try{return this.index=it(this.config),this.index!==null}catch(e){return console.warn("[HyperbolicPatternIndex] Failed to create HyperbolicHNSW:",e instanceof Error?e.message:e),this.index=null,!1}}get isAvailable(){return this.index!==null}indexPattern(e,t,r){if(!(!this.ensureInitialized()||!this.index))try{let i=t instanceof Float32Array?t:new Float32Array(t),s=D.euclideanToHyperbolic(i);this.index.insert(e,s,r)}catch(i){console.debug(`[HyperbolicPatternIndex] Failed to index pattern ${e}:`,i instanceof Error?i.message:i)}}search(e,t){if(!this.ensureInitialized()||!this.index)return[];try{let r=e instanceof Float32Array?e:new Float32Array(e),i=D.euclideanToHyperbolic(r);return this.index.search(i,t).map(a=>({patternId:a.id,distance:a.distance,metadata:a.point.metadata}))}catch(r){return console.warn("[HyperbolicPatternIndex] Search failed:",r instanceof Error?r.message:r),[]}}getStats(){return this.index?this.index.getStats():null}reset(){this.index=null,this.initialized=!1}};function st(n){return new Re(n)}var xe=null;function ot(){return xe||(xe=Be({dimensions:1e4})),xe}var Ce;function Kt(){return Ce===void 0&&(Ce=je()),Ce}var Q=null,Ie=0,ct;function lt(n,e){return(!Q||Ie!==n||ct!==e)&&(Q=rt({dimension:n,maxPatterns:1e4}),Ie=n,ct=e),Q}var Y={namespace:"qe-patterns",embeddingDimension:384,hnsw:{M:16,efConstruction:200,efSearch:100,maxElements:5e4},promotionThreshold:V,minConfidence:.3,maxPatternsPerDomain:5e3,autoCleanup:!0,cleanupIntervalMs:36e5,tokenTracking:{enabled:!0,trackInputOutput:!0,estimateCosts:!0,costPerInputToken:3e-6,costPerOutputToken:15e-6},reuseOptimization:{enabled:!0,minSimilarityForReuse:.85,minSuccessRateForReuse:.9,maxAgeForReuse:7}},De=class{constructor(e,t={}){this.memory=e;this.config={...Y,...t}}memory;config;initialized=!1;cleanupTimer;sqliteStore=null;nullStore=null;loadingPromise=null;patternCache=new Map;domainIndex=new Map;typeIndex=new Map;tierIndex=new Map;hnswIndex=null;hnswSpaceId=null;hnswAvailable=!1;hnswInitPromise=null;hdcCache=new Map;hdcTokenCache=new Map;deltaTracker=null;vectorDeltaTracker=void 0;hyperbolicIndex=null;stats={searchOperations:0,searchLatencies:[]};setSqliteStore(e){if(this.sqliteStore=e,L()&&!this.deltaTracker)try{let t=e.getDb();this.deltaTracker=new ne(t),this.deltaTracker.initialize(),console.log("[PatternStore] Delta event sourcing initialized")}catch(t){console.warn("[PatternStore] Delta tracker init failed:",t instanceof Error?t.message:t)}this.initialized&&(this.loadingPromise=this.loadPatterns().catch(t=>console.warn("[PatternStore] Failed to load patterns after setSqliteStore:",t)).finally(()=>{this.loadingPromise=null}))}async initialize(){this.initialized||(this.tierIndex.set("short-term",new Set),this.tierIndex.set("long-term",new Set),await this.loadPatterns(),this.config.autoCleanup&&(this.cleanupTimer=setInterval(()=>this.cleanup(),this.config.cleanupIntervalMs)),this.initialized=!0)}async ensureHNSW(){if(this.hnswIndex!==null){let e=R()?.spaceId??this.config.embeddingSpaceId??null;return this.hnswSpaceId!==e?(console.warn("[PatternStore] VECTOR_SPACE_MISMATCH: active embedder changed; semantic index disabled"),null):this.hnswIndex}return this.hnswAvailable===!1&&this.hnswInitPromise===null&&!(this.hnswIndex===null&&this.hnswAvailable===!1)?null:this.hnswInitPromise?(await this.hnswInitPromise,this.hnswIndex):(this.hnswInitPromise=this.initializeHNSWInternal(),await this.hnswInitPromise,this.hnswInitPromise=null,this.hnswIndex)}async initializeHNSWInternal(){try{if(!R()&&!this.config.embeddingSpaceId&&await j(),this.hnswSpaceId=R()?.spaceId??this.config.embeddingSpaceId??null,!this.hnswSpaceId)throw new Error("VECTOR_SPACE_UNVERIFIED: cannot initialize HNSW without runtime provenance");if(F().useUnifiedHnsw)try{let{HnswLegacyBridge:a}=await import("./hnsw-legacy-bridge-5GW4SAEI.js"),{HnswAdapter:l}=await import("./hnsw-adapter-TU6WG2ME.js"),d=new l("patterns",{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,metric:"cosine"});this.hnswIndex=new a(d),this.hnswAvailable=!0,console.log("[PatternStore] Using unified HNSW via HnswLegacyBridge (ADR-071)"),await this.loadEmbeddingsIntoHNSW();return}catch(a){console.warn("[PatternStore] Unified HNSW bridge failed, falling back:",a)}let{HNSWIndex:t}=await import("./hnsw-index-MS5KODD7.js");this.hnswIndex=new t(this.memory,{dimensions:this.config.embeddingDimension,M:this.config.hnsw.M,efConstruction:this.config.hnsw.efConstruction,efSearch:this.config.hnsw.efSearch,maxElements:this.config.hnsw.maxElements,namespace:`${this.config.namespace}:hnsw`,metric:"cosine"});let r=5e3,i=this.hnswIndex.initialize(),s=new Promise((a,l)=>setTimeout(()=>l(new Error("HNSW init timeout")),r));await Promise.race([i,s]),this.hnswAvailable=this.hnswIndex.isNativeAvailable(),await this.loadEmbeddingsIntoHNSW(),console.log(`[PatternStore] HNSW lazy-initialized (native: ${this.hnswAvailable})`)}catch(e){console.warn("[PatternStore] HNSW not available, using memory backend search:",b(e)),this.hnswIndex=null,this.hnswAvailable=!1}}async loadEmbeddingsIntoHNSW(){if(!(!this.hnswIndex||!this.sqliteStore))try{let e=this.sqliteStore.getAllEmbeddings(),t=this.config.hnsw.maxElements,r=0,i=0,s=R()?.spaceId??this.config.embeddingSpaceId;for(let{patternId:a,embedding:l,spaceId:d}of e){if(r>=t)break;if(!s||d!==s||!l||l.length!==this.config.embeddingDimension){i++;continue}let o=this.patternCache.get(a);if(!o){i++;continue}try{await this.hnswIndex.insert(a,l,{filePath:o.patternType,lineCoverage:o.confidence*100,branchCoverage:o.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-o.confidence,lastUpdated:Date.now(),totalLines:0}),r++}catch{i++}}r>0&&console.log(`[PatternStore] Loaded ${r} embeddings into HNSW (skipped ${i})`)}catch(e){console.warn("[PatternStore] Failed to load SQLite embeddings into HNSW:",b(e))}}getVectorDeltaTracker(){return this.vectorDeltaTracker===void 0&&(this.vectorDeltaTracker=tt()),this.vectorDeltaTracker}async loadPatterns(){if(this.sqliteStore)try{let e=this.sqliteStore.getPatterns({limit:5e4});for(let t of e)this.indexPattern(t);e.length>0&&console.log(`[PatternStore] Loaded ${e.length} patterns from SQLite into memory cache`)}catch(e){console.warn("[PatternStore] Failed to load patterns from SQLite:",b(e))}}indexPattern(e){this.patternCache.set(e.id,e),this.domainIndex.has(e.qeDomain)||this.domainIndex.set(e.qeDomain,new Set),this.domainIndex.get(e.qeDomain).add(e.id),this.typeIndex.has(e.patternType)||this.typeIndex.set(e.patternType,new Set),this.typeIndex.get(e.patternType).add(e.id);let t=e.tier==="long-term"?"long-term":"short-term";e.tier!==t&&(e.tier=t),this.tierIndex.get(t).add(e.id)}unindexPattern(e){this.patternCache.delete(e.id),this.domainIndex.get(e.qeDomain)?.delete(e.id),this.typeIndex.get(e.patternType)?.delete(e.id),this.tierIndex.get(e.tier)?.delete(e.id),this.hdcCache.delete(e.id),this.hdcTokenCache.delete(e.id)}async store(e){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let t=X(e);if(!t.valid)return S(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return S(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));let r=(process.env.AQE_MEMORY_BACKEND??"memory")!=="memory";if(r&&!this.sqliteStore)return S(new x(e.id,"FAILED",new Error("authoritative SQLite pattern store is unavailable")));let i=R()?.spaceId??this.config.embeddingSpaceId;if(e.embedding&&!i)return S(new Error("VECTOR_SPACE_UNVERIFIED: refusing to persist or index an embedding without runtime provenance"));(this.domainIndex.get(e.qeDomain)?.size||0)>=this.config.maxPatternsPerDomain&&await this.cleanupDomain(e.qeDomain);let a=this.patternCache.get(e.id)??null,l=!1,d=()=>{this.unindexPattern(e),a&&this.indexPattern(a)};if(this.indexPattern(e),this.sqliteStore)try{let o=this.sqliteStore.storePattern(e,e.embedding,i);o&&o!==e.id&&(this.unindexPattern(e),e.id=o,this.indexPattern(e)),l=!0}catch(o){return d(),S(new x(e.id,"FAILED",o))}if(e.embedding){let o=await this.ensureHNSW();if(!o&&l)return S(new x(e.id,"COMMITTED_PENDING_INDEX",new Error("HNSW unavailable after authoritative pattern commit")));if(!o&&r)return d(),S(new x(e.id,"FAILED",new Error("HNSW unavailable before an authoritative pattern commit")));if(o)try{await o.insert(e.id,e.embedding,{filePath:e.patternType,lineCoverage:e.confidence*100,branchCoverage:e.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-e.confidence,lastUpdated:Date.now(),totalLines:0})}catch(c){return l||d(),S(new x(e.id,l?"COMMITTED_PENDING_INDEX":"FAILED",c))}}if($())try{let c=ot().fingerprint({id:e.id,domain:e.qeDomain,type:e.patternType,content:e.description});this.hdcCache.set(e.id,c.vector)}catch(o){console.debug(`[PatternStore] HDC fingerprint failed for ${e.id}:`,b(o))}try{let o=Kt();if(o){let c=[e.patternType,e.qeDomain];e.context?.tags&&c.push(...e.context.tags),e.name&&c.push(e.name);let h=o.fingerprintPattern(c);this.hdcTokenCache.set(e.id,h)}}catch(o){console.debug(`[PatternStore] HDC token fingerprint failed for ${e.id}:`,b(o))}if(ie()&&e.embedding&&i)try{lt(e.embedding.length,i).store(new Float32Array(e.embedding),{id:e.id,name:e.name,domain:e.qeDomain})}catch(o){console.debug(`[PatternStore] Hopfield store failed for ${e.id}:`,b(o))}if(L()&&this.deltaTracker)try{let o={id:e.id,name:e.name,confidence:e.confidence,qualityScore:e.qualityScore,usageCount:e.usageCount,successRate:e.successRate,tier:e.tier};this.deltaTracker.createGenesis(e.id,o)}catch(o){console.debug(`[PatternStore] Delta genesis for ${e.id}:`,b(o))}if(e.embedding)try{let o=this.getVectorDeltaTracker();o&&(a?.embedding?o.recordDelta(e.id,a.embedding,e.embedding):o.getVersion(e.id)<0&&o.recordGenesis(e.id,e.embedding))}catch(o){console.debug(`[PatternStore] VectorDeltaTracker for ${e.id}:`,b(o))}try{k()&&e.embedding&&this.indexHyperbolic(e.id,e.embedding,{domain:e.qeDomain,type:e.patternType,name:e.name})}catch{}return P(e.id)}async create(e){let t=new Date,r=e.qeDomain||this.detectDomainFromType(e.patternType),i={id:O(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:e.confidence??.5,usageCount:0,successRate:0,qualityScore:.25,context:{...e.context,tags:e.context?.tags||[]},template:{...e.template,example:void 0},embedding:e.embedding,tier:"short-term",createdAt:t,lastUsedAt:t,successfulUses:0,reusable:!1,reuseCount:0,averageTokenSavings:0},s=await this.store(i);return s.success?P(i):S(s.error)}detectDomainFromType(e){return{"test-template":"test-generation","assertion-pattern":"test-generation","mock-pattern":"test-generation","coverage-strategy":"coverage-analysis","mutation-strategy":"test-generation","api-contract":"contract-testing","visual-baseline":"visual-accessibility","a11y-check":"visual-accessibility","perf-benchmark":"chaos-resilience","flaky-fix":"test-execution","refactor-safe":"code-intelligence","error-handling":"test-generation","meta-optimization":"learning-optimization"}[e]||"test-generation"}async get(e){return this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise,this.patternCache.get(e)??null}async search(e,t={}){this.initialized||await this.initialize(),this.loadingPromise&&await this.loadingPromise;let r=performance.now(),i=t.limit||10,s=[];try{let a=R()?.spaceId??this.config.embeddingSpaceId;if(Array.isArray(e)&&(!a||t.embeddingSpaceId!==a))throw new Error("VECTOR_SPACE_UNVERIFIED: pre-computed query vectors require the active embeddingSpaceId");if(Array.isArray(e)&&t.useVectorSearch!==!1&&a&&ie())try{let f=lt(e.length,a);if(f.getPatternCount()>0){let g=f.recall(new Float32Array(e));if(g&&g.similarity>.98){let y=g.metadata.id,p=await this.get(y);if(p&&this.matchesFilters(p,t)){let w=this.calculateReuseInfo(p,g.similarity);s.push({pattern:p,score:g.similarity,matchType:"vector",similarity:g.similarity,canReuse:w.canReuse,estimatedTokenSavings:w.estimatedTokenSavings,reuseConfidence:w.reuseConfidence})}}}}catch(f){console.debug("[PatternStore] Hopfield recall failed:",b(f))}if(Array.isArray(e)&&t.useVectorSearch!==!1){let f=await this.ensureHNSW();if(f){let g=await f.search(e,i*2);for(let y of g){let p=await this.get(y.key);if(p&&this.matchesFilters(p,t)){let w=this.calculateReuseInfo(p,y.score);s.push({pattern:p,score:y.score,matchType:"vector",similarity:y.score,canReuse:w.canReuse,estimatedTokenSavings:w.estimatedTokenSavings,reuseConfidence:w.reuseConfidence})}}}}let l=typeof e=="string"?e:t.textQuery;if(l?.trim()&&this.sqliteStore)try{let f=this.sqliteStore.searchFTS(l,i*2);if(f.length>0){let g=new Map(f.map(p=>[p.id,p.ftsScore*p.coverage])),y=new Set(s.map(p=>p.pattern.id));for(let p of s){let w=g.get(p.pattern.id);w!==void 0&&(p.score=le(p.score,w))}for(let p of f){if(y.has(p.id))continue;let w=await this.get(p.id);if(w&&this.matchesFilters(w,t)){let E=.5*p.ftsScore*p.coverage;s.push({pattern:w,score:E,matchType:"lexical",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}}}}catch{}if(typeof e=="string"||s.length<i){let f=await this.searchByText(l??"",t,i-s.length),g=new Set(s.map(y=>y.pattern.id));for(let y of f)g.has(y.pattern.id)||s.push(y)}let d=720*60*60*1e3,o=Date.now();for(let f of s){let g=f.pattern.lastUsedAt?.getTime()??f.pattern.createdAt.getTime(),y=o-g,p=Math.pow(.5,y/d),w=f.pattern.usageCount>0?p:.5;f.score=f.score*(.7+.3*w)}let c=this.sqliteStore?.getDatabase();if(c&&s.length>0)try{this.nullStore||(this.nullStore=new ce(c));let f=this.nullStore.getNullSummaries(s.map(g=>g.pattern.id));for(let g of s){let y=f.get(g.pattern.id);y&&(g.nullSummary=y,g.score=ce.applyNullDiscount(g.score,y,t.contextFingerprint))}}catch(f){console.debug("[PatternStore] null discount skipped:",b(f))}s.sort((f,g)=>g.score-f.score);let h=s;t.filter&&(h=qe(s,t.filter));let m=h.slice(0,i),u=performance.now()-r;return this.recordSearchLatency(u),P(m)}catch(a){return S(Fe(a))}}async searchByText(e,t,r){let i=[],s=e.toLowerCase(),a;t.domain?a=this.domainIndex.get(t.domain)||new Set:t.patternType?a=this.typeIndex.get(t.patternType)||new Set:t.tier?a=this.tierIndex.get(t.tier)||new Set:a=new Set(this.patternCache.keys());let l=[...a];if($()&&s&&this.hdcCache.size>0)try{let d=ot(),o=d.fingerprint({id:"query",domain:t.domain??"unknown",type:t.patternType??"unknown",content:e}),c=l.filter(u=>this.hdcCache.has(u)).map(u=>({id:u,similarity:d.similarity(o.vector,this.hdcCache.get(u))}));c.sort((u,f)=>f.similarity-u.similarity);let h=c.map(u=>u.id),m=l.filter(u=>!this.hdcCache.has(u));l=[...h,...m]}catch{}for(let d of l){if(i.length>=r)break;let o=this.patternCache.get(d);if(!o||!this.matchesFilters(o,t))continue;let c=0;if(s){let h=o.name.toLowerCase(),m=o.description.toLowerCase();h.includes(s)&&(c+=.5),m.includes(s)&&(s.length/m.length>.3?c+=.5:c+=.3);for(let u of o.context.tags)if(u.toLowerCase().includes(s)){c+=.2;break}c=Math.min(c,1)}else c=o.qualityScore;(c>0||!s)&&i.push({pattern:o,score:s?.5*c:o.qualityScore,matchType:s?"lexical":"context",similarity:0,canReuse:!1,estimatedTokenSavings:0,reuseConfidence:0})}return i}calculateReuseInfo(e,t){let{reuseOptimization:r}=this.config,i=t>=r.minSimilarityForReuse,s=e.successRate>=r.minSuccessRateForReuse,a=e.lastUsedAt instanceof Date?e.lastUsedAt.getTime():new Date(e.lastUsedAt).getTime(),d=(Date.now()-a)/(1e3*60*60*24)<=r.maxAgeForReuse,o=r.enabled&&e.reusable&&i&&s&&d,c=o?e.averageTokenSavings>0?e.averageTokenSavings:e.tokensUsed||0:0,h=t,m=e.successRate,u=Math.min(e.reuseCount/10,1),f=o?h*.4+m*.4+u*.2:0;return{canReuse:o,estimatedTokenSavings:c,reuseConfidence:f}}matchesFilters(e,t){if(t.patternType&&e.patternType!==t.patternType||t.domain&&e.qeDomain!==t.domain||t.tier&&e.tier!==t.tier||t.minConfidence!==void 0&&e.confidence<t.minConfidence||t.minQualityScore!==void 0&&e.qualityScore<t.minQualityScore)return!1;if(t.context){let r=t.context;if(r.language&&e.context.language!==r.language||r.framework&&e.context.framework!==r.framework||r.testType&&e.context.testType!==r.testType)return!1}return!0}async recordUsage(e,t,r,i){let s=await this.get(e);if(!s)return S(new Error(`Pattern not found: ${e}`));let a=new Date,l=s.usageCount+1,d=s.successfulUses+(t?1:0),o=d/l,c=t?.02:-.01,h=Math.max(.1,Math.min(1,s.confidence+c)),m=W({confidence:h,usageCount:l,successRate:o}),u={...s,usageCount:l,successfulUses:d,successRate:o,confidence:h,qualityScore:m,lastUsedAt:a};if(this.sqliteStore)try{this.sqliteStore.recordUsage(e,t,r,i)}catch(y){console.warn(`[PatternStore] SQLite recordUsage failed for ${e}:`,b(y))}if(L()&&this.deltaTracker)try{let y={id:s.id,name:s.name,confidence:s.confidence,qualityScore:s.qualityScore,usageCount:s.usageCount,successRate:s.successRate,tier:s.tier},p={id:u.id,name:u.name,confidence:u.confidence,qualityScore:u.qualityScore,usageCount:u.usageCount,successRate:u.successRate,tier:u.tier};this.deltaTracker.recordDelta(e,y,p,{success:t})}catch(y){console.debug(`[PatternStore] Delta recordDelta for ${e}:`,b(y))}let f=se(u);return f.meetsUsageCriteria&&f.meetsQualityCriteria&&f.meetsCoherenceCriteria&&u.tier==="short-term"?await this.promote(e):this.patternCache.set(e,u),P(void 0)}async promote(e){let t=await this.get(e);if(!t)return S(new Error(`Pattern not found: ${e}`));if(t.tier==="long-term")return P(void 0);let r={...t,tier:"long-term",confidence:Math.min(1,t.confidence+.1)};if(this.tierIndex.get("short-term")?.delete(e),this.tierIndex.get("long-term")?.add(e),this.patternCache.set(e,r),this.sqliteStore)try{this.sqliteStore.promotePattern(e)}catch(i){console.debug("[PatternStore] SQLite promotion error:",i instanceof Error?i.message:i)}return console.log(`[PatternStore] Promoted pattern ${e} (${t.name}) to long-term storage`),P(void 0)}async delete(e){let t=this.patternCache.get(e);if(!t)return S(new Error(`Pattern not found: ${e}`));if(this.unindexPattern(t),this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(r){console.debug("[PatternStore] SQLite deletion error:",r instanceof Error?r.message:r)}if(this.hnswIndex!==null)try{await this.hnswIndex.delete(e)}catch(r){console.debug("[PatternStore] HNSW deletion error:",r instanceof Error?r.message:r)}return P(void 0)}async getStats(){let e={},t={};for(let[o,c]of this.domainIndex)e[o]=c.size;for(let[o,c]of this.typeIndex)t[o]=c.size;let r=0,i=0,s=0,a=0;for(let o of this.patternCache.values())r+=o.confidence,i+=o.qualityScore,s+=o.successRate,a++;let l=await this.ensureHNSW(),d=l!==null?await l.getStats():{nativeHNSW:!1,vectorCount:0,indexSizeBytes:0,lazyLoaded:!0};return{totalPatterns:this.patternCache.size,byTier:{shortTerm:this.tierIndex.get("short-term")?.size||0,longTerm:this.tierIndex.get("long-term")?.size||0},byDomain:e,byType:t,avgConfidence:a>0?r/a:0,avgQualityScore:a>0?i/a:0,avgSuccessRate:a>0?s/a:0,searchOperations:this.stats.searchOperations,avgSearchLatencyMs:this.calculateAvgLatency(),hnswStats:{nativeAvailable:d.nativeHNSW,vectorCount:d.vectorCount,indexSizeBytes:d.indexSizeBytes}}}async cleanup(){let e=0,t=0,r=[],i=[];for(let s of this.patternCache.values()){let a=se(s);if(a.meetsUsageCriteria&&a.meetsQualityCriteria&&a.meetsCoherenceCriteria){i.push(s.id);continue}if(s.tier==="short-term"){let d=s.createdAt instanceof Date?s.createdAt.getTime():new Date(s.createdAt).getTime(),o=Date.now()-d,c=o>10080*60*1e3,h=s.qualityScore<.2,m=s.usageCount===0&&o>1440*60*1e3;(c&&h||m)&&r.push(s.id)}}for(let s of i)(await this.promote(s)).success&&t++;for(let s of r)(await this.delete(s)).success&&e++;return console.log(`[PatternStore] Cleanup: removed ${e}, promoted ${t}`),{removed:e,promoted:t}}async cleanupDomain(e){let t=this.domainIndex.get(e);if(!t||t.size<this.config.maxPatternsPerDomain)return;let r=[];for(let a of t){let l=this.patternCache.get(a);l&&r.push(l)}r.sort((a,l)=>a.qualityScore-l.qualityScore);let i=Math.ceil(r.length*.1),s=0;for(let a of r){if(s>=i)break;a.tier==="short-term"&&(await this.delete(a.id),s++)}}recordSearchLatency(e){this.stats.searchOperations++,this.stats.searchLatencies.push(e),this.stats.searchLatencies.length>1e3&&(this.stats.searchLatencies=this.stats.searchLatencies.slice(-1e3))}calculateAvgLatency(){return this.stats.searchLatencies.length===0?0:this.stats.searchLatencies.reduce((t,r)=>t+r,0)/this.stats.searchLatencies.length}async dispose(){this.cleanupTimer&&(clearInterval(this.cleanupTimer),this.cleanupTimer=void 0),this.patternCache.clear(),this.domainIndex.clear(),this.typeIndex.clear(),this.tierIndex.clear(),this.hdcCache.clear(),this.deltaTracker=null,this.hyperbolicIndex&&(this.hyperbolicIndex.reset(),this.hyperbolicIndex=null),Q&&(Q.clear(),Q=null,Ie=0),this.initialized=!1}indexHyperbolic(e,t,r){if(k())try{this.hyperbolicIndex||(this.hyperbolicIndex=st({dimensions:this.config.embeddingDimension,maxElements:this.config.hnsw.maxElements})),this.hyperbolicIndex.indexPattern(e,t,r)}catch(i){console.debug(`[PatternStore] Hyperbolic indexing failed for ${e}:`,i instanceof Error?i.message:i)}}async searchHyperbolic(e,t=10){if(!k()||!this.hyperbolicIndex)return P([]);try{let r=this.hyperbolicIndex.search(e,t),i=[];for(let s of r){let a=await this.get(s.patternId);if(!a)continue;let l=Math.exp(-s.distance),d=this.calculateReuseInfo(a,l);i.push({pattern:a,score:l,matchType:"vector",similarity:l,canReuse:d.canReuse,estimatedTokenSavings:d.estimatedTokenSavings,reuseConfidence:d.reuseConfidence})}return P(i)}catch(r){return console.warn("[PatternStore] Hyperbolic search failed, returning empty results:",r instanceof Error?r.message:r),P([])}}};function le(n,e){return Math.max(n,.75*n+.25*e)}function ln(n,e){try{if(F().useRVFPatternStore&&He()){let r=process.env.AQE_PROJECT_ROOT??_e(),i=at(r,".agentic-qe"),s=at(i,"patterns.rvf");if(Yt(i)){let a={...Y,...e},l=!1;try{let d=Ue(i,a.embeddingDimension);if(d){l=!0;let o=new z(()=>d,{rvfPath:s,base:a,skipCloseOnDispose:!0,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),o}}catch{}if(!l){let d=new z((o,c)=>{let h,m=()=>{try{return Me(o)}catch(f){return h=f,null}},u=m();if(!u&&G(h)&&(!Le(o)||(u=m(),!u&&G(h))))throw h;if(u){let f=u.dimension();if(f!==c){try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${f}, requested=${c})`)}return u}try{return ae(o,c)}catch(f){if(u=m(),u){if(u.dimension()!==c){let g=u.dimension();try{u.close()}catch{}throw new Error(`RVF dimension mismatch (file=${g}, requested=${c})`)}return u}if(G(h))throw h;if(ke(o,f instanceof Error?f.message:String(f),h))return ae(o,c);throw f}},{rvfPath:s,base:a,embeddingSpaceId:a.embeddingSpaceId});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),d}}}}catch(t){console.warn("[PatternStore] RVF store unavailable, using in-memory HNSW:",t instanceof Error?t.message:t)}return new De(n,e)}export{x as a,Y as b,le as c,ln as d};
50
+ /*! Bundled license information:
51
+
52
+ fast-json-patch/commonjs/helpers.js:
53
+ (*!
54
+ * https://github.com/Starcounter-Jack/JSON-Patch
55
+ * (c) 2017-2022 Joachim Wester
56
+ * MIT licensed
57
+ *)
58
+
59
+ fast-json-patch/commonjs/duplex.js:
60
+ (*!
61
+ * https://github.com/Starcounter-Jack/JSON-Patch
62
+ * (c) 2017-2021 Joachim Wester
63
+ * MIT license
64
+ *)
65
+ */
@@ -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.14.6");process.exit(0)}
2
- import{b as t}from"./chunk-64VGZQLB.js";function o(e){try{return e.prepare(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{b as t}from"./chunk-YO4ESCB4.js";function o(e){try{return e.prepare(`
3
3
  SELECT COUNT(*) as count FROM sqlite_master
4
4
  WHERE type='table' AND name IN ('hypergraph_nodes', 'hypergraph_edges')
5
5
  `).get().count===2}catch{return!1}}var r,a,E,n,p=t(()=>{"use strict";r=`
@@ -1,3 +1,3 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
2
- import{a as L}from"./chunk-KNNISEDY.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},x=1e4,M=20,S=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as L}from"./chunk-Y6AKKQIQ.js";import*as w from"fs";var R={"aqe test generate":{domain:"test-generation",action:"generateTests"},"aqe test execute":{domain:"test-execution",action:"execute"},"aqe coverage analyze":{domain:"coverage-analysis",action:"analyze"},"aqe coverage gaps":{domain:"coverage-analysis",action:"detectGaps"},"aqe quality gate":{domain:"quality-assessment",action:"evaluateGate"},"aqe quality assess":{domain:"quality-assessment",action:"analyzeQuality"},"aqe security scan":{domain:"security-compliance",action:"runSASTScan"},"aqe security audit":{domain:"security-compliance",action:"runAudit"},"aqe defect predict":{domain:"defect-intelligence",action:"predictDefects"},"aqe code index":{domain:"code-intelligence",action:"index"},"aqe code impact":{domain:"code-intelligence",action:"analyzeImpact"},"aqe contract validate":{domain:"contract-testing",action:"validateContract"},"aqe chaos test":{domain:"chaos-resilience",action:"runChaosTest"},"aqe requirements validate":{domain:"requirements-validation",action:"validateRequirements"},"aqe visual test":{domain:"visual-accessibility",action:"runVisualTest"},"aqe accessibility test":{domain:"visual-accessibility",action:"runAccessibilityTest"},"aqe learn optimize":{domain:"learning-optimization",action:"optimizeAllStrategies"}},D={daily:"0 0 * * *",weekly:"0 0 * * 0",hourly:"0 * * * *",minutely:"* * * * *"},x=1e4,M=20,S=1e4,W=["__proto__","constructor","prototype"];function v(t){return!W.includes(t)}function C(t){let n=t.split(`
3
3
  `);if(n.length>x)throw new Error(`YAML content exceeds maximum allowed lines (${x}). File has ${n.length} lines.`);for(let i=0;i<n.length;i++)if(n[i].length>S)throw new Error(`YAML line ${i+1} exceeds maximum allowed length (${S} characters).`);let a={};for(let i=0;i<n.length;i++){let e=n[i];if(e.trim()===""||e.trim().startsWith("#")||e.search(/\S/)!==0)continue;let o=e.match(/^([\w_-]+):\s*(.+)$/);if(o){let[,c,u]=o;v(c)&&(a[c]=f(u))}}let r=["tags","stages","triggers"];for(let i of r){let e=new RegExp(`^${i}:\\s*$`),s=-1;for(let l=0;l<n.length;l++){let d=n[l];if(!(d.trim()===""||d.trim().startsWith("#"))&&e.test(d.trim())){s=l;break}}if(s===-1)continue;let o=[];a[i]=o;let c=n[s].search(/\S/),u=s+1;for(;u<n.length;){let l=n[u];if(l.trim()===""||l.trim().startsWith("#")){u++;continue}let d=l.search(/\S/),p=l.trim();if(d<=c&&!p.startsWith("-"))break;if(p.startsWith("- ")){let m=p.slice(2).trim();if(!m.includes(":")){o.push(f(m)),u++;continue}let g={},k=m.match(/^([\w_-]+):\s*(.*)$/);if(k){let[,h,y]=k;g[h]=f(y)}let T=d;for(u++;u<n.length;){let h=n[u];if(h.trim()===""||h.trim().startsWith("#")){u++;continue}let y=h.search(/\S/),q=h.trim();if(y<=T)break;let _=q.match(/^([\w_-]+):\s*(.*)$/);if(_){let[,A,$]=_;if($===""){let b=E(n,u+1,y,1);g[A]=b.value,u=b.nextLine;continue}else g[A]=f($)}u++}o.push(g)}else u++}}return a}function E(t,n,a,r=0){if(r>M)throw new Error(`YAML nesting exceeds maximum allowed depth (${M}).`);let i={},e=null,s=null,o=n;for(;o<t.length;){let u=t[o];if(u.trim()===""||u.trim().startsWith("#")){o++;continue}let l=u.search(/\S/),d=u.trim();if(l<=a)break;if(d.startsWith("- ")){let m=d.slice(2).trim();s&&!Array.isArray(i[s])&&(i[s]=[]),s?i[s].push(f(m)):(e||(e=[]),e.push(f(m))),o++;continue}let p=d.match(/^([\w_-]+):\s*(.*)$/);if(p){let[,m,g]=p;if(!v(m)){o++;continue}g===""?(s=m,i[m]=[]):(i[m]=f(g),s=null)}o++}if(e&&Object.keys(i).length===0)return{value:e,nextLine:o};let c=Object.keys(i);return c.length===1&&Array.isArray(i[c[0]])?{value:i[c[0]],nextLine:o}:{value:i,nextLine:o}}function f(t){if(t==="")return"";if(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))return t.slice(1,-1);if(t==="true")return!0;if(t==="false")return!1;if(t==="null"||t==="~")return null;let n=Number(t);return!isNaN(n)&&t!==""?n:t.startsWith("[")&&t.endsWith("]")?t.slice(1,-1).split(",").map(r=>f(r.trim())):t}function K(t){let n=[];if(!w.existsSync(t))return{success:!1,errors:[`File not found: ${t}`]};let a;try{a=w.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read file: ${r}`]}}return Y(a,t)}function Y(t,n){let a=[],r;try{r=C(t)}catch(s){return{success:!1,errors:[`Invalid YAML syntax: ${s}`]}}if((!r.name||typeof r.name!="string")&&a.push('Pipeline must have a "name" field'),(!r.stages||!Array.isArray(r.stages))&&a.push('Pipeline must have a "stages" array'),a.length>0)return{success:!1,errors:a};let i={name:r.name,description:r.description,version:r.version||"1.0.0",schedule:r.schedule,stages:r.stages.map((s,o)=>{let c=s;return{name:c.name||`stage-${o}`,command:c.command,params:c.params,depends_on:c.depends_on,condition:c.condition,timeout:c.timeout,retry:c.retry,continue_on_failure:c.continue_on_failure}}),triggers:r.triggers,tags:r.tags,timeout:r.timeout};for(let s=0;s<i.stages.length;s++){let o=i.stages[s];o.command||a.push(`Stage ${s+1} (${o.name}) must have a "command" field`)}if(a.length>0)return{success:!1,pipeline:i,errors:a};let e=O(i,n);return{success:!0,pipeline:i,workflow:e,errors:[]}}function O(t,n){let a=`pipeline-${t.name.replace(/\s+/g,"-").toLowerCase()}`,r=t.stages.map((e,s)=>{let o=P(e.command),c={};if(e.params)for(let[l,d]of Object.entries(e.params))v(l)&&(c[l]=`input.${l}`);let u={id:`stage-${e.name.replace(/\s+/g,"-").toLowerCase()}`,name:e.name,domain:o.domain,action:o.action,inputMapping:Object.keys(c).length>0?c:void 0,dependsOn:e.depends_on?.map(l=>`stage-${l.replace(/\s+/g,"-").toLowerCase()}`),timeout:e.timeout?e.timeout*1e3:void 0,continueOnFailure:e.continue_on_failure};return e.condition&&(u.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),e.retry&&(u.retry={maxAttempts:e.retry.max_attempts||3,backoffMs:(e.retry.backoff_seconds||1)*1e3}),u}),i=t.triggers?.map(e=>{let s={eventType:I(e),sourceDomain:e.source_domain};return e.condition&&(s.condition={path:e.condition.path,operator:e.condition.operator,value:e.condition.value}),s});return{id:a,name:t.name,description:t.description||`Pipeline from ${n||"inline YAML"}`,version:t.version||"1.0.0",steps:r,triggers:i,tags:t.tags,timeout:t.timeout?t.timeout*1e3:void 0}}function P(t){let n=t.trim().replace(/\s+/g," ").toLowerCase();for(let[a,r]of Object.entries(R))if(n.startsWith(a.toLowerCase()))return r;return n.includes("test")&&n.includes("generate")?{domain:"test-generation",action:"generateTests"}:n.includes("test")&&(n.includes("execute")||n.includes("run"))?{domain:"test-execution",action:"execute"}:n.includes("coverage")?{domain:"coverage-analysis",action:"analyze"}:n.includes("quality")||n.includes("gate")?{domain:"quality-assessment",action:"evaluateGate"}:n.includes("security")||n.includes("scan")?{domain:"security-compliance",action:"runSASTScan"}:n.includes("defect")||n.includes("predict")?{domain:"defect-intelligence",action:"predictDefects"}:{domain:"learning-optimization",action:"runLearningCycle"}}function I(t){let n=t.event.toLowerCase();return n==="push"?"code-intelligence.CodePushed":n==="pull_request"||n==="pr"?"code-intelligence.PullRequestOpened":n==="schedule"?"workflow.ScheduleTrigger":n==="quality_gate"?"quality-assessment.QualityGateEvaluated":n==="test_complete"?"test-execution.TestRunCompleted":n}function F(t){let n=[],a=[];if(t.name||n.push({path:"name",message:"Pipeline name is required",severity:"error"}),!t.stages||t.stages.length===0)n.push({path:"stages",message:"Pipeline must have at least one stage",severity:"error"});else{let r=new Set;for(let e=0;e<t.stages.length;e++){let s=t.stages[e],o=`stages[${e}]`;if(r.has(s.name)&&n.push({path:`${o}.name`,message:`Duplicate stage name: ${s.name}`,severity:"error"}),r.add(s.name),s.command?P(s.command).domain==="learning-optimization"&&!s.command.toLowerCase().includes("learn")&&a.push({path:`${o}.command`,message:`Command "${s.command}" not recognized, will default to learning-optimization domain`,severity:"warning"}):n.push({path:`${o}.command`,message:"Stage must have a command",severity:"error"}),s.depends_on)for(let c of s.depends_on)t.stages.some(u=>u.name===c)||n.push({path:`${o}.depends_on`,message:`Unknown dependency: ${c}`,severity:"error"});s.timeout!==void 0&&s.timeout<=0&&n.push({path:`${o}.timeout`,message:"Timeout must be a positive number",severity:"error"}),s.retry&&s.retry.max_attempts!==void 0&&s.retry.max_attempts<1&&n.push({path:`${o}.retry.max_attempts`,message:"max_attempts must be at least 1",severity:"error"})}let i=N(t.stages);i&&n.push({path:"stages",message:`Circular dependency detected: ${i}`,severity:"error"})}if(t.schedule&&(z(t.schedule)||n.push({path:"schedule",message:`Invalid cron expression: ${t.schedule}`,severity:"error"})),t.triggers)for(let r=0;r<t.triggers.length;r++){let i=t.triggers[r],e=`triggers[${r}]`;i.event||n.push({path:`${e}.event`,message:"Trigger must have an event type",severity:"error"}),i.source_domain&&!L.includes(i.source_domain)&&a.push({path:`${e}.source_domain`,message:`Unknown domain: ${i.source_domain}`,severity:"warning"})}return{valid:n.length===0,errors:n,warnings:a}}function N(t){let n=new Set,a=new Set,r=(i,e)=>{if(a.has(i))return[...e,i].join(" -> ");if(n.has(i))return null;n.add(i),a.add(i);let s=t.find(o=>o.name===i);if(s?.depends_on)for(let o of s.depends_on){let c=r(o,[...e,i]);if(c)return c}return a.delete(i),null};for(let i of t){let e=r(i.name,[]);if(e)return e}return null}function z(t){if(Object.keys(D).includes(t))return!0;let n=t.trim().split(/\s+/);if(n.length!==5)return!1;let a=[/^(\*|[0-5]?\d)(-[0-5]?\d)?(\/\d+)?$/,/^(\*|1?\d|2[0-3])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|[12]\d|3[01])(-\d+)?(\/\d+)?$/,/^(\*|[1-9]|1[0-2])(-\d+)?(\/\d+)?$/,/^(\*|[0-7])(-[0-7])?(\/\d+)?$/];for(let r=0;r<5;r++){let i=n[r].split(",");for(let e of i)if(!a[r].test(e)&&e!=="*")return!1}return!0}function G(t){let n={"@daily":"Daily at midnight","@weekly":"Weekly on Sunday at midnight","@hourly":"Every hour","@minutely":"Every minute"};if(n[t])return n[t];if(Object.keys(D).includes(t))return{daily:"Daily at midnight",weekly:"Weekly on Sunday at midnight",hourly:"Every hour",minutely:"Every minute"}[t]||t;let a=t.trim().split(/\s+/);if(a.length!==5)return t;let[r,i,e,s,o]=a;return r==="0"&&i==="0"&&e==="*"&&s==="*"&&o==="*"?"Daily at midnight":r==="0"&&e==="*"&&s==="*"&&o==="*"?`Daily at ${i}:00`:r!=="*"&&i!=="*"&&e==="*"&&s==="*"?`Daily at ${i}:${r.padStart(2,"0")}`:i==="*"&&r==="0"?"Every hour":r!=="*"&&i==="*"?`Every hour at minute ${r}`:t}function H(t,n=new Date){let a=t.trim().split(/\s+/);if(a.length!==5)return new Date(n.getTime()+1440*60*1e3);let[r,i]=a,e=new Date(n);return i!=="*"&&r!=="*"?(e.setHours(parseInt(i,10),parseInt(r,10),0,0),e<=n&&e.setDate(e.getDate()+1)):i!=="*"?(e.setHours(parseInt(i,10),0,0,0),e<=n&&e.setDate(e.getDate()+1)):r!=="*"?(e.setMinutes(parseInt(r,10),0,0),e<=n&&e.setHours(e.getHours()+1)):(e.setSeconds(0,0),e.setMinutes(e.getMinutes()+1)),e}export{C as a,K as b,F as c,G as d,H as e};
@@ -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.14.6");process.exit(0)}
2
- import{a as v,b as k}from"./chunk-ELLBS5RP.js";import{k as g,o as P}from"./chunk-2JVWITNK.js";import{a as d,b as y,c as R}from"./chunk-MJS53PRX.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as v,b as k}from"./chunk-ENK44A6Q.js";import{o as g,s as P}from"./chunk-QUORH2MG.js";import{a as d,b as y,e as R}from"./chunk-ZUOVNFXK.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
@@ -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.14.6");process.exit(0)}
2
- import{e as l,l as c}from"./chunk-5QQSIGUA.js";import{a as i}from"./chunk-5OOMJGFN.js";import{a as n,c as h}from"./chunk-MJS53PRX.js";h();var d=class extends c{config={name:"qe/tests/schedule",description:"Schedule and execute tests using phase-based pipeline with git-aware selection and flaky tracking. Runs tests in phases (unit, integration, e2e), selects affected tests from git changes, and tracks flaky tests.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{cwd:{type:"string",description:"Working directory for test execution (defaults to project root)"},gitRef:{type:"string",description:'Git ref to compare for affected test selection (e.g., "main", "HEAD~3")'},useGitAware:{type:"boolean",description:"Enable git-aware test selection to only run affected tests",default:!0},trackFlaky:{type:"boolean",description:"Enable flaky test tracking and quarantine",default:!0}}}}async execute(s,o){if(s.gitRef!==void 0){let a=i(s.gitRef,"gitRef");if(a)return{success:!1,error:a}}try{let{runTestPipeline:a}=await import("./test-scheduling-ZJBFRZ3J.js"),u=await l(o),t=await a({cwd:s.cwd||process.cwd(),memory:u,baseRef:s.gitRef,flakyHistoryPath:s.trackFlaky!==!1?".agentic-qe/flaky-history.json":void 0,runAllTests:s.useGitAware===!1}),f=t.phaseResults.reduce((e,r)=>e+r.totalTests,0),p=t.phaseResults.reduce((e,r)=>e+r.passed,0),g=t.phaseResults.reduce((e,r)=>e+r.failed,0);return{success:!0,data:{pipelineId:o.requestId,phases:t.phaseResults.map(e=>({phaseId:e.phaseId,phaseName:e.phaseName,totalTests:e.totalTests,passed:e.passed,failed:e.failed,passRate:e.passRate,durationMs:e.durationMs})),gitAware:{enabled:!t.ranAllTests,selectedTests:t.selectedTests.length,gitRef:s.gitRef},flakyTracking:{enabled:s.trackFlaky!==!1},totalDuration:t.totalDurationMs,ranAllTests:t.ranAllTests,summary:`Executed ${t.phaseResults.length} phases, ${f} tests (${p} passed, ${g} failed) in ${t.totalDurationMs}ms`}}}catch(a){return{success:!1,error:n(a)}}}};export{d as a};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{e as l,l as c}from"./chunk-LU2EDWQK.js";import{a as i}from"./chunk-NBLDBVAW.js";import{a as n,e as h}from"./chunk-ZUOVNFXK.js";h();var d=class extends c{config={name:"qe/tests/schedule",description:"Schedule and execute tests using phase-based pipeline with git-aware selection and flaky tracking. Runs tests in phases (unit, integration, e2e), selects affected tests from git changes, and tracks flaky tests.",domain:"test-execution",schema:this.buildSchema()};buildSchema(){return{type:"object",properties:{cwd:{type:"string",description:"Working directory for test execution (defaults to project root)"},gitRef:{type:"string",description:'Git ref to compare for affected test selection (e.g., "main", "HEAD~3")'},useGitAware:{type:"boolean",description:"Enable git-aware test selection to only run affected tests",default:!0},trackFlaky:{type:"boolean",description:"Enable flaky test tracking and quarantine",default:!0}}}}async execute(s,o){if(s.gitRef!==void 0){let a=i(s.gitRef,"gitRef");if(a)return{success:!1,error:a}}try{let{runTestPipeline:a}=await import("./test-scheduling-HI23RXFK.js"),u=await l(o),t=await a({cwd:s.cwd||process.cwd(),memory:u,baseRef:s.gitRef,flakyHistoryPath:s.trackFlaky!==!1?".agentic-qe/flaky-history.json":void 0,runAllTests:s.useGitAware===!1}),f=t.phaseResults.reduce((e,r)=>e+r.totalTests,0),p=t.phaseResults.reduce((e,r)=>e+r.passed,0),g=t.phaseResults.reduce((e,r)=>e+r.failed,0);return{success:!0,data:{pipelineId:o.requestId,phases:t.phaseResults.map(e=>({phaseId:e.phaseId,phaseName:e.phaseName,totalTests:e.totalTests,passed:e.passed,failed:e.failed,passRate:e.passRate,durationMs:e.durationMs})),gitAware:{enabled:!t.ranAllTests,selectedTests:t.selectedTests.length,gitRef:s.gitRef},flakyTracking:{enabled:s.trackFlaky!==!1},totalDuration:t.totalDurationMs,ranAllTests:t.ranAllTests,summary:`Executed ${t.phaseResults.length} phases, ${f} tests (${p} passed, ${g} failed) in ${t.totalDurationMs}ms`}}}catch(a){return{success:!1,error:n(a)}}}};export{d as a};
@@ -0,0 +1,2 @@
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{b as o}from"./chunk-YO4ESCB4.js";function s(n){return n instanceof Error?n.message:String(n)}function u(n){return n instanceof Error?n:new Error(String(n))}function a(n){return n instanceof r||typeof n=="object"&&n!==null&&n.callerError===!0}var r,e=o(()=>{"use strict";r=class extends Error{callerError=!0;constructor(t){super(t),this.name="CallerInputError"}}});export{s as a,u as b,r as c,a as d,e};
@@ -1 +1 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
@@ -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.14.6");process.exit(0)}
2
- import{a as O}from"./chunk-RG52OKAM.js";import{d as D,e as P}from"./chunk-RSXXCL4A.js";import{a as Q}from"./chunk-SPV2VKC5.js";import{c as E,d as _}from"./chunk-3NIG7S5W.js";import"./chunk-KNNISEDY.js";import"./chunk-64VGZQLB.js";import{Command as Y}from"commander";import i from"chalk";import*as b from"fs";import*as g from"path";import*as F from"fs";import*as R from"path";var q={version:"1",name:"aqe-ci",phases:[{name:"Test Generation",type:"test",enabled:!0,config:{target:".",framework:"vitest",type:"unit"},continueOnFailure:!1,timeout:300},{name:"Coverage Analysis",type:"coverage",enabled:!0,config:{target:".",threshold:80},continueOnFailure:!0,timeout:300},{name:"Security Scan",type:"security",enabled:!0,config:{sast:!0},continueOnFailure:!0,timeout:300},{name:"Quality Gate",type:"quality-gate",enabled:!0,config:{},continueOnFailure:!1,timeout:60}],output:{format:"json",directory:".aqe-ci-output",combinedReport:!0},qualityGate:{enforced:!0,thresholds:{coverage:80,security:"medium",quality:70}}},M=[".aqe-ci.yml",".aqe-ci.yaml","aqe-ci.yml","aqe-ci.yaml"];function x(t=process.cwd()){let n=R.resolve(t);for(let r=0;r<10;r++){for(let a of M){let e=R.join(n,a);if(F.existsSync(e))return e}let l=R.dirname(n);if(l===n)break;n=l}return null}function A(t){if(!F.existsSync(t))return{success:!1,errors:[`Config file not found: ${t}`]};let n;try{n=F.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read config: ${r}`]}}return V(n,t)}function V(t,n){let r=[],l;try{l=Q(t)}catch(e){return{success:!1,errors:[`Invalid YAML: ${e}`]}}let a={version:l.version||q.version,name:l.name||q.name,phases:[],output:{...q.output},qualityGate:{...q.qualityGate,thresholds:{...q.qualityGate.thresholds}}};if(l.output&&typeof l.output=="object"){let e=l.output;e.format&&(a.output.format=e.format),e.directory&&(a.output.directory=e.directory),e.combined_report!==void 0&&(a.output.combinedReport=e.combined_report)}if(l.quality_gate&&typeof l.quality_gate=="object"){let e=l.quality_gate;if(e.enforced!==void 0&&(a.qualityGate.enforced=e.enforced),e.thresholds&&typeof e.thresholds=="object"){let s=e.thresholds;s.coverage!==void 0&&(a.qualityGate.thresholds.coverage=s.coverage),s.security!==void 0&&(a.qualityGate.thresholds.security=s.security),s.quality!==void 0&&(a.qualityGate.thresholds.quality=s.quality)}}if(l.phases&&Array.isArray(l.phases))for(let e=0;e<l.phases.length;e++){let s=l.phases[e];if(!s.name){r.push(`Phase ${e+1} must have a "name" field`);continue}if(!s.type){r.push(`Phase "${s.name}" must have a "type" field`);continue}let c=["test","coverage","security","quality-gate","code-intelligence","custom"];if(!c.includes(s.type)){r.push(`Phase "${s.name}" has invalid type "${s.type}". Valid: ${c.join(", ")}`);continue}let p={name:s.name,type:s.type,enabled:s.enabled!==!1,config:s.config||{},continueOnFailure:s.continue_on_failure||!1,timeout:s.timeout||300};a.phases.push(p)}else a.phases=[...q.phases];return a.phases.length===0&&r.push("Config must have at least one phase"),r.length>0?{success:!1,config:a,errors:r}:{success:!0,config:a,errors:[],configPath:n}}function L(){return{...q,phases:q.phases.map(t=>({...t,config:{...t.config}})),output:{...q.output},qualityGate:{...q.qualityGate,thresholds:{...q.qualityGate.thresholds}}}}async function B(t,n,r,l){let a=Date.now(),e=[];if(!t.enabled)return{phase:t.name,type:t.type,status:"skipped",duration:0,exitCode:0,summary:"Phase disabled",artifacts:[]};try{let s={},c="passed",p="";switch(t.type){case"test":{let h=await n.kernel.getDomainAPIAsync("test-generation");if(!h)return T(t,a,"failed",1,"Test generation domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-YKVM3MDB.js"),I=g.resolve(u),v=C(I,{includeTests:!1}),y=await h.generateTests({sourceFiles:v,testType:t.config.type||"unit",framework:t.config.framework||"vitest",coverageTarget:80});if(y.success&&y.value){let m=y.value;s={testsGenerated:m.tests.length,coverageEstimate:m.coverageEstimate},p=`Generated ${m.tests.length} tests (est. ${m.coverageEstimate}% coverage)`;let f=g.join(r,"test-generation.json");b.writeFileSync(f,P(m),"utf-8"),e.push(f)}else c="failed",p=y.error?.message||"Test generation failed";break}case"coverage":{let h=await n.kernel.getDomainAPIAsync("coverage-analysis");if(!h)return T(t,a,"failed",1,"Coverage analysis domain not available",e);let u=t.config.target||".",C=t.config.threshold||80,{walkSourceFiles:I}=await import("./file-discovery-YKVM3MDB.js"),v=g.resolve(u),y=I(v,{includeTests:!1}),m=O(y),f=await h.analyze({coverageData:m,threshold:C,includeFileDetails:!0});if(f.success&&f.value){let w=f.value;s={...w.summary,meetsThreshold:w.meetsThreshold,threshold:C},c=w.meetsThreshold?"passed":"warning",p=`Line: ${w.summary.line}%, Branch: ${w.summary.branch}% \u2014 ${w.meetsThreshold?"meets":"below"} ${C}% threshold`;let k=g.join(r,"coverage.json");b.writeFileSync(k,P(f.value),"utf-8"),e.push(k)}else c="failed",p=f.error?.message||"Coverage analysis failed";break}case"security":{let h=await n.kernel.getDomainAPIAsync("security-compliance");if(!h)return T(t,a,"failed",1,"Security domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-YKVM3MDB.js"),I=g.resolve(u),v=C(I,{includeTests:!0}),y=await h.runSASTScan(v);if(y.success&&y.value){let m=y.value,f=m.vulnerabilities||[],w=f.filter(o=>o.severity==="high"||o.severity==="critical").length;s={vulnerabilities:f.length,high:w},c=w>0?"failed":f.length>0?"warning":"passed",p=f.length===0?"No vulnerabilities found":`${f.length} vulnerabilities (${w} high/critical)`;let{toSARIF:k}=await import("./ci-output-LDT24TS3.js"),G=g.join(r,"security.sarif");b.writeFileSync(G,k({vulnerabilities:f,target:u,scanType:"SAST"}),"utf-8"),e.push(G);let $=g.join(r,"security.json");b.writeFileSync($,P(m),"utf-8"),e.push($)}else c="failed",p=y.error?.message||"Security scan failed";break}case"quality-gate":{try{let u=await E(n.kernel.memory),C=_(u);s={...C,metrics:u,evidenceStatus:"measured"},c=C.passed?"passed":"failed",p=`Quality gate: ${C.passed?"PASSED":"FAILED"} (${C.checks.filter(I=>I.passed).length}/${C.checks.length} measured checks passed)`}catch(u){c="failed",p=`Quality gate: ${u instanceof Error?u.message:String(u)}`,s={passed:!1,evidenceStatus:"unavailable",error:p,checks:[]}}let h=g.join(r,`quality-gate-${l+1}.json`);b.writeFileSync(h,P(s),"utf-8"),e.push(h);break}case"code-intelligence":{let h=await n.kernel.getDomainAPIAsync("code-intelligence");if(!h)return T(t,a,"failed",1,"Code intelligence domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-YKVM3MDB.js"),I=g.resolve(u),v=C(I,{includeTests:!1}),y=await h.index({paths:v,incremental:!0});if(y.success&&y.value){let m=y.value;s=m,p=`Indexed ${m.filesIndexed} files, ${m.nodesCreated} nodes`;let f=g.join(r,"code-intelligence.json");b.writeFileSync(f,P(m),"utf-8"),e.push(f)}else c="warning",p=y.error?.message||"Code intelligence indexing incomplete";break}default:p=`Custom phase "${t.name}" \u2014 no built-in handler`,c="warning"}let S=Date.now()-a;return{phase:t.name,type:t.type,status:c,duration:S,exitCode:c==="failed"?1:0,summary:p,artifacts:e,details:s}}catch(s){let c=Date.now()-a;return{phase:t.name,type:t.type,status:"failed",duration:c,exitCode:1,summary:`Error: ${s instanceof Error?s.message:String(s)}`,artifacts:e}}}function T(t,n,r,l,a,e){return{phase:t.name,type:t.type,status:r,duration:Date.now()-n,exitCode:l,summary:a,artifacts:e}}function N(t){let n=`# AQE CI/CD Report
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as O}from"./chunk-HXXHMLJ5.js";import{d as D,e as P}from"./chunk-2G63VIJE.js";import{a as Q}from"./chunk-ZQZD55MN.js";import{c as E,d as _}from"./chunk-2IMSJ7IO.js";import"./chunk-Y6AKKQIQ.js";import"./chunk-YO4ESCB4.js";import{Command as Y}from"commander";import i from"chalk";import*as b from"fs";import*as g from"path";import*as F from"fs";import*as R from"path";var q={version:"1",name:"aqe-ci",phases:[{name:"Test Generation",type:"test",enabled:!0,config:{target:".",framework:"vitest",type:"unit"},continueOnFailure:!1,timeout:300},{name:"Coverage Analysis",type:"coverage",enabled:!0,config:{target:".",threshold:80},continueOnFailure:!0,timeout:300},{name:"Security Scan",type:"security",enabled:!0,config:{sast:!0},continueOnFailure:!0,timeout:300},{name:"Quality Gate",type:"quality-gate",enabled:!0,config:{},continueOnFailure:!1,timeout:60}],output:{format:"json",directory:".aqe-ci-output",combinedReport:!0},qualityGate:{enforced:!0,thresholds:{coverage:80,security:"medium",quality:70}}},M=[".aqe-ci.yml",".aqe-ci.yaml","aqe-ci.yml","aqe-ci.yaml"];function x(t=process.cwd()){let n=R.resolve(t);for(let r=0;r<10;r++){for(let a of M){let e=R.join(n,a);if(F.existsSync(e))return e}let l=R.dirname(n);if(l===n)break;n=l}return null}function A(t){if(!F.existsSync(t))return{success:!1,errors:[`Config file not found: ${t}`]};let n;try{n=F.readFileSync(t,"utf-8")}catch(r){return{success:!1,errors:[`Failed to read config: ${r}`]}}return V(n,t)}function V(t,n){let r=[],l;try{l=Q(t)}catch(e){return{success:!1,errors:[`Invalid YAML: ${e}`]}}let a={version:l.version||q.version,name:l.name||q.name,phases:[],output:{...q.output},qualityGate:{...q.qualityGate,thresholds:{...q.qualityGate.thresholds}}};if(l.output&&typeof l.output=="object"){let e=l.output;e.format&&(a.output.format=e.format),e.directory&&(a.output.directory=e.directory),e.combined_report!==void 0&&(a.output.combinedReport=e.combined_report)}if(l.quality_gate&&typeof l.quality_gate=="object"){let e=l.quality_gate;if(e.enforced!==void 0&&(a.qualityGate.enforced=e.enforced),e.thresholds&&typeof e.thresholds=="object"){let s=e.thresholds;s.coverage!==void 0&&(a.qualityGate.thresholds.coverage=s.coverage),s.security!==void 0&&(a.qualityGate.thresholds.security=s.security),s.quality!==void 0&&(a.qualityGate.thresholds.quality=s.quality)}}if(l.phases&&Array.isArray(l.phases))for(let e=0;e<l.phases.length;e++){let s=l.phases[e];if(!s.name){r.push(`Phase ${e+1} must have a "name" field`);continue}if(!s.type){r.push(`Phase "${s.name}" must have a "type" field`);continue}let c=["test","coverage","security","quality-gate","code-intelligence","custom"];if(!c.includes(s.type)){r.push(`Phase "${s.name}" has invalid type "${s.type}". Valid: ${c.join(", ")}`);continue}let m={name:s.name,type:s.type,enabled:s.enabled!==!1,config:s.config||{},continueOnFailure:s.continue_on_failure||!1,timeout:s.timeout||300};a.phases.push(m)}else a.phases=[...q.phases];return a.phases.length===0&&r.push("Config must have at least one phase"),r.length>0?{success:!1,config:a,errors:r}:{success:!0,config:a,errors:[],configPath:n}}function L(){return{...q,phases:q.phases.map(t=>({...t,config:{...t.config}})),output:{...q.output},qualityGate:{...q.qualityGate,thresholds:{...q.qualityGate.thresholds}}}}async function B(t,n,r,l){let a=Date.now(),e=[];if(!t.enabled)return{phase:t.name,type:t.type,status:"skipped",duration:0,exitCode:0,summary:"Phase disabled",artifacts:[]};try{let s={},c="passed",m="";switch(t.type){case"test":{let h=await n.kernel.getDomainAPIAsync("test-generation");if(!h)return T(t,a,"failed",1,"Test generation domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-AEVMJRNB.js"),I=g.resolve(u),w=C(I,{includeTests:!1}),y=await h.generateTests({sourceFiles:w,testType:t.config.type||"unit",framework:t.config.framework||"vitest",coverageTarget:80});if(y.success&&y.value){let d=y.value;s={testsGenerated:d.tests.length,coverageEstimate:d.coverageEstimate},m=`Generated ${d.tests.length} tests (${d.coverageEstimate==null?"coverage unmeasured":`est. ${d.coverageEstimate}% coverage`})`;let f=g.join(r,"test-generation.json");b.writeFileSync(f,P(d),"utf-8"),e.push(f)}else c="failed",m=y.error?.message||"Test generation failed";break}case"coverage":{let h=await n.kernel.getDomainAPIAsync("coverage-analysis");if(!h)return T(t,a,"failed",1,"Coverage analysis domain not available",e);let u=t.config.target||".",C=t.config.threshold||80,{walkSourceFiles:I}=await import("./file-discovery-AEVMJRNB.js"),w=g.resolve(u),y=I(w,{includeTests:!1}),d=O(y),f=await h.analyze({coverageData:d,threshold:C,includeFileDetails:!0});if(f.success&&f.value){let v=f.value;s={...v.summary,meetsThreshold:v.meetsThreshold,threshold:C},c=v.meetsThreshold?"passed":"warning",m=`Line: ${v.summary.line}%, Branch: ${v.summary.branch}% \u2014 ${v.meetsThreshold?"meets":"below"} ${C}% threshold`;let k=g.join(r,"coverage.json");b.writeFileSync(k,P(f.value),"utf-8"),e.push(k)}else c="failed",m=f.error?.message||"Coverage analysis failed";break}case"security":{let h=await n.kernel.getDomainAPIAsync("security-compliance");if(!h)return T(t,a,"failed",1,"Security domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-AEVMJRNB.js"),I=g.resolve(u),w=C(I,{includeTests:!0}),y=await h.runSASTScan(w);if(y.success&&y.value){let d=y.value,f=d.vulnerabilities||[],v=f.filter(o=>o.severity==="high"||o.severity==="critical").length;s={vulnerabilities:f.length,high:v},c=v>0?"failed":f.length>0?"warning":"passed",m=f.length===0?"No vulnerabilities found":`${f.length} vulnerabilities (${v} high/critical)`;let{toSARIF:k}=await import("./ci-output-RLS32FUY.js"),G=g.join(r,"security.sarif");b.writeFileSync(G,k({vulnerabilities:f,target:u,scanType:"SAST"}),"utf-8"),e.push(G);let $=g.join(r,"security.json");b.writeFileSync($,P(d),"utf-8"),e.push($)}else c="failed",m=y.error?.message||"Security scan failed";break}case"quality-gate":{try{let u=await E(n.kernel.memory),C=_(u);s={...C,metrics:u,evidenceStatus:"measured"},c=C.passed?"passed":"failed",m=`Quality gate: ${C.passed?"PASSED":"FAILED"} (${C.checks.filter(I=>I.passed).length}/${C.checks.length} measured checks passed)`}catch(u){c="failed",m=`Quality gate: ${u instanceof Error?u.message:String(u)}`,s={passed:!1,evidenceStatus:"unavailable",error:m,checks:[]}}let h=g.join(r,`quality-gate-${l+1}.json`);b.writeFileSync(h,P(s),"utf-8"),e.push(h);break}case"code-intelligence":{let h=await n.kernel.getDomainAPIAsync("code-intelligence");if(!h)return T(t,a,"failed",1,"Code intelligence domain not available",e);let u=t.config.target||".",{walkSourceFiles:C}=await import("./file-discovery-AEVMJRNB.js"),I=g.resolve(u),w=C(I,{includeTests:!1}),y=await h.index({paths:w,incremental:!0});if(y.success&&y.value){let d=y.value;s=d,m=`Indexed ${d.filesIndexed} files, ${d.nodesCreated} nodes`;let f=g.join(r,"code-intelligence.json");b.writeFileSync(f,P(d),"utf-8"),e.push(f)}else c="warning",m=y.error?.message||"Code intelligence indexing incomplete";break}default:m=`Custom phase "${t.name}" \u2014 no built-in handler`,c="warning"}let S=Date.now()-a;return{phase:t.name,type:t.type,status:c,duration:S,exitCode:c==="failed"?1:0,summary:m,artifacts:e,details:s}}catch(s){let c=Date.now()-a;return{phase:t.name,type:t.type,status:"failed",duration:c,exitCode:1,summary:`Error: ${s instanceof Error?s.message:String(s)}`,artifacts:e}}}function T(t,n,r,l,a,e){return{phase:t.name,type:t.type,status:r,duration:Date.now()-n,exitCode:l,summary:a,artifacts:e}}function N(t){let n=`# AQE CI/CD Report
3
3
 
4
4
  `;n+=`**Status:** ${t.overallStatus==="passed"?"PASSED":t.overallStatus==="warning"?"WARNING":"FAILED"}
5
5
  `,n+=`**Duration:** ${(t.duration/1e3).toFixed(1)}s
@@ -17,14 +17,14 @@ import{a as O}from"./chunk-RG52OKAM.js";import{d as D,e as P}from"./chunk-RSXXCL
17
17
  `;for(let l of r.artifacts)n+=`- \`${g.basename(l)}\`
18
18
  `;n+=`
19
19
  `}return n}function U(t){return`${t.qualityGateStatus==="not-run"?"Not run":t.qualityGatePassed?"Passed":"Failed"} (${t.qualityGateEnforced?"enforced":"advisory"})`}function ne(t,n,r){let l=new Y("ci").description("CI/CD pipeline orchestration");return l.command("run").description("Execute CI pipeline from .aqe-ci.yml").option("-c, --config <path>","Path to .aqe-ci.yml config file").option("--phase <phases>","Run only specific phases (comma-separated)").option("--no-quality-gate","Skip quality gate enforcement").option("-F, --format <format>","Output format (text|json|markdown)","text").option("-o, --output <path>","Write combined report to file").action(async a=>{if(await r())try{let e,s=null;if(a.config){let o=A(g.resolve(a.config));if(!o.success){console.error(i.red(`
20
- Config errors:`));for(let d of o.errors)console.error(i.red(` - ${d}`));await n(1);return}e=o.config,s=a.config}else if(s=x(),s){let o=A(s);if(!o.success){console.error(i.red(`
21
- Config errors:`));for(let d of o.errors)console.error(i.red(` - ${d}`));await n(1);return}e=o.config}else e=L(),s="(defaults)";if(a.phase){let o=a.phase.split(",").map(d=>d.trim().toLowerCase());e.phases=e.phases.filter(d=>o.includes(d.name.toLowerCase())||o.includes(d.type))}a.qualityGate===!1&&(e.qualityGate.enforced=!1);let c=a.format,p=new Date;c==="text"&&(console.log(i.blue(`
20
+ Config errors:`));for(let p of o.errors)console.error(i.red(` - ${p}`));await n(1);return}e=o.config,s=a.config}else if(s=x(),s){let o=A(s);if(!o.success){console.error(i.red(`
21
+ Config errors:`));for(let p of o.errors)console.error(i.red(` - ${p}`));await n(1);return}e=o.config}else e=L(),s="(defaults)";if(a.phase){let o=a.phase.split(",").map(p=>p.trim().toLowerCase());e.phases=e.phases.filter(p=>o.includes(p.name.toLowerCase())||o.includes(p.type))}a.qualityGate===!1&&(e.qualityGate.enforced=!1);let c=a.format,m=new Date;c==="text"&&(console.log(i.blue(`
22
22
  AQE CI Pipeline
23
23
  `)),console.log(i.gray(` Config: ${s}`)),console.log(i.gray(` Phases: ${e.phases.length}`)),console.log(i.gray(` Quality Gate: ${e.qualityGate.enforced?"enforced":"advisory"}
24
- `)));let S=g.resolve(e.output.directory);b.mkdirSync(S,{recursive:!0});let h=g.join(S,"quality-gate.json");b.writeFileSync(h,P({passed:!1,status:"not-run",evidenceStatus:"not-run",enforced:e.qualityGate.enforced,phases:[]}),"utf-8");let u=[];for(let o of e.phases){if(c==="text"){let j=` [${u.length+1}/${e.phases.length}] ${o.name}...`;process.stdout.write(i.cyan(j))}let d=await B(o,t,S,u.length);if(u.push(d),c==="text"){let j=d.status==="passed"?i.green:d.status==="failed"?i.red:d.status==="warning"?i.yellow:i.gray,W=d.status.toUpperCase(),z=`${(d.duration/1e3).toFixed(1)}s`;process.stdout.write(`\r [${u.length}/${e.phases.length}] ${o.name} ${j(W)} (${z})
25
- `),d.summary&&console.log(i.gray(` ${d.summary}`))}if(d.status==="failed"&&(d.type!=="quality-gate"||e.qualityGate.enforced)&&!o.continueOnFailure){c==="text"&&console.log(i.red(`
24
+ `)));let S=g.resolve(e.output.directory);b.mkdirSync(S,{recursive:!0});let h=g.join(S,"quality-gate.json");b.writeFileSync(h,P({passed:!1,status:"not-run",evidenceStatus:"not-run",enforced:e.qualityGate.enforced,phases:[]}),"utf-8");let u=[];for(let o of e.phases){if(c==="text"){let j=` [${u.length+1}/${e.phases.length}] ${o.name}...`;process.stdout.write(i.cyan(j))}let p=await B(o,t,S,u.length);if(u.push(p),c==="text"){let j=p.status==="passed"?i.green:p.status==="failed"?i.red:p.status==="warning"?i.yellow:i.gray,W=p.status.toUpperCase(),z=`${(p.duration/1e3).toFixed(1)}s`;process.stdout.write(`\r [${u.length}/${e.phases.length}] ${o.name} ${j(W)} (${z})
25
+ `),p.summary&&console.log(i.gray(` ${p.summary}`))}if(p.status==="failed"&&(p.type!=="quality-gate"||e.qualityGate.enforced)&&!o.continueOnFailure){c==="text"&&console.log(i.red(`
26
26
  Pipeline stopped: "${o.name}" failed (continue_on_failure: false)
27
- `));break}}let C=u.some(o=>o.status==="failed"&&o.type!=="quality-gate"),I=u.some(o=>o.status==="warning"||o.type==="quality-gate"&&o.status==="failed"&&!e.qualityGate.enforced),v=u.filter(o=>o.type==="quality-gate"),y=e.phases.filter(o=>o.type==="quality-gate").length,m=v.length>0&&v.length===y&&v.every(o=>o.status==="passed"),f=m?"passed":v.some(o=>o.status==="failed")?"failed":"not-run",w=C||e.qualityGate.enforced&&!m?"failed":I?"warning":"passed",k=new Date,G=k.getTime()-p.getTime(),$={config:s||"(defaults)",startedAt:p,completedAt:k,duration:G,phases:u,qualityGatePassed:m,qualityGateStatus:f,qualityGateEnforced:e.qualityGate.enforced,overallStatus:w,exitCode:w==="failed"?1:0};if(b.writeFileSync(h,P({...v.length===1?v[0].details:{},passed:m,status:f,enforced:e.qualityGate.enforced,...f==="not-run"?{evidenceStatus:"not-run"}:{},phases:v}),"utf-8"),e.output.combinedReport){let o=g.join(S,"ci-report.md");b.writeFileSync(o,N($),"utf-8");let d=g.join(S,"ci-report.json");b.writeFileSync(d,P($),"utf-8")}if(c==="json")D(P($),a.output);else if(c==="markdown")D(N($),a.output);else{console.log("");let o=w==="passed"?i.green:w==="failed"?i.red:i.yellow;console.log(` ${o(`Pipeline: ${w.toUpperCase()}`)} (${(G/1e3).toFixed(1)}s)`),console.log(` Quality Gate: ${U($)}`),console.log(i.gray(` Artifacts: ${S}/`)),console.log("")}await n($.exitCode)}catch(e){console.error(i.red(`
27
+ `));break}}let C=u.some(o=>o.status==="failed"&&o.type!=="quality-gate"),I=u.some(o=>o.status==="warning"||o.type==="quality-gate"&&o.status==="failed"&&!e.qualityGate.enforced),w=u.filter(o=>o.type==="quality-gate"),y=e.phases.filter(o=>o.type==="quality-gate").length,d=w.length>0&&w.length===y&&w.every(o=>o.status==="passed"),f=d?"passed":w.some(o=>o.status==="failed")?"failed":"not-run",v=C||e.qualityGate.enforced&&!d?"failed":I?"warning":"passed",k=new Date,G=k.getTime()-m.getTime(),$={config:s||"(defaults)",startedAt:m,completedAt:k,duration:G,phases:u,qualityGatePassed:d,qualityGateStatus:f,qualityGateEnforced:e.qualityGate.enforced,overallStatus:v,exitCode:v==="failed"?1:0};if(b.writeFileSync(h,P({...w.length===1?w[0].details:{},passed:d,status:f,enforced:e.qualityGate.enforced,...f==="not-run"?{evidenceStatus:"not-run"}:{},phases:w}),"utf-8"),e.output.combinedReport){let o=g.join(S,"ci-report.md");b.writeFileSync(o,N($),"utf-8");let p=g.join(S,"ci-report.json");b.writeFileSync(p,P($),"utf-8")}if(c==="json")D(P($),a.output);else if(c==="markdown")D(N($),a.output);else{console.log("");let o=v==="passed"?i.green:v==="failed"?i.red:i.yellow;console.log(` ${o(`Pipeline: ${v.toUpperCase()}`)} (${(G/1e3).toFixed(1)}s)`),console.log(` Quality Gate: ${U($)}`),console.log(i.gray(` Artifacts: ${S}/`)),console.log("")}await n($.exitCode)}catch(e){console.error(i.red(`
28
28
  CI pipeline failed:`),e),await n(1)}}),l.command("init").description("Create a .aqe-ci.yml config file").option("--force","Overwrite existing config").action(async a=>{let e=x();if(e&&!a.force){console.log(i.yellow(`
29
29
  Config already exists: ${e}`)),console.log(i.gray(` Use --force to overwrite
30
30
  `)),await n(0);return}let s=`# AQE CI/CD Pipeline Configuration
@@ -77,5 +77,5 @@ quality_gate:
77
77
  `)),await n(0)}),l.command("validate").description("Validate .aqe-ci.yml config").option("-c, --config <path>","Path to config file").action(async a=>{let e=a.config?g.resolve(a.config):x();if(!e){console.log(i.red(`
78
78
  No .aqe-ci.yml found`)),console.log(i.gray(` Run: aqe ci init
79
79
  `)),await n(1);return}let s=A(e);if(s.success){console.log(i.green(`
80
- Config valid: ${e}`)),console.log(i.gray(` Phases: ${s.config.phases.length}`));for(let c of s.config.phases){let p=c.enabled?i.green("*"):i.gray("o");console.log(` ${p} ${c.name} (${c.type})`)}console.log(i.gray(` Quality Gate: ${s.config.qualityGate.enforced?"enforced":"advisory"}`)),console.log(""),await n(0)}else{console.log(i.red(`
80
+ Config valid: ${e}`)),console.log(i.gray(` Phases: ${s.config.phases.length}`));for(let c of s.config.phases){let m=c.enabled?i.green("*"):i.gray("o");console.log(` ${m} ${c.name} (${c.type})`)}console.log(i.gray(` Quality Gate: ${s.config.qualityGate.enforced?"enforced":"advisory"}`)),console.log(""),await n(0)}else{console.log(i.red(`
81
81
  Config invalid: ${e}`));for(let c of s.errors)console.log(i.red(` - ${c}`));console.log(""),await n(1)}}),l}export{ne as createCICommand};
@@ -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.14.6");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-RSXXCL4A.js";import"./chunk-64VGZQLB.js";export{b as FORMAT_OPTION,c as OUTPUT_OPTION,h as coverageToMarkdown,i as qualityGateToMarkdown,a as securityExecutionStatus,j as securityToMarkdown,k as testRunToMarkdown,e as toJSON,g as toJUnit,f as toSARIF,d as writeOutput};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a,b,c,d,e,f,g,h,i,j,k}from"./chunk-2G63VIJE.js";import"./chunk-YO4ESCB4.js";export{b as FORMAT_OPTION,c as OUTPUT_OPTION,h as coverageToMarkdown,i as qualityGateToMarkdown,a as securityExecutionStatus,j as securityToMarkdown,k as testRunToMarkdown,e as toJSON,g as toJUnit,f as toSARIF,d as writeOutput};
@@ -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.14.6");process.exit(0)}
2
- import{a,b}from"./chunk-YS4FCTWF.js";import"./chunk-64VGZQLB.js";export{a as AdvisorCircuitBreaker,b as AdvisorCircuitBreakerError};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a,b}from"./chunk-T77GZF4B.js";import"./chunk-YO4ESCB4.js";export{a as AdvisorCircuitBreaker,b as AdvisorCircuitBreakerError};
@@ -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.14.6");process.exit(0)}
2
- import{a as g}from"./chunk-6SQM2MUX.js";import{b as p}from"./chunk-3HZS4M3O.js";import{b as f,d as h}from"./chunk-AIRGNL55.js";import{a as d,c as v}from"./chunk-MJS53PRX.js";import{a as b}from"./chunk-64VGZQLB.js";import{existsSync as c,readFileSync as m}from"node:fs";h();v();import{join as a}from"node:path";async function C(t,e){let o=p(t);if(e&&o.available&&console.log(`[ClaudeFlow] Detected via ${o.method}${o.version?`: v${o.version}`:""}`),!o.available)return{available:!1};let r={"mcp-config":"mcp","local-binary":"cli","npx-cached":"cli","npm-dependency":"npm"};return{available:!0,version:o.version,method:o.method?r[o.method]:void 0}}async function F(t){return{trajectories:!0,modelRouting:!0,pretrain:!0,workers:!0,patternSearch:!0}}function S(t,e){return{version:"1.0",projectRoot:t,integration:{enabled:!0,features:{trajectories:e.trajectories,modelRouting:e.modelRouting,pretrain:e.pretrain,workers:e.workers}},learning:{trajectoryStorage:e.trajectories?"claude-flow":"local",patternSearch:e.patternSearch?"claude-flow":"local"},routing:{modelRouting:e.modelRouting?"claude-flow":"rule-based",preferences:{simple:"haiku",standard:"sonnet",complex:"opus"}},pretrain:{enabled:e.pretrain,depth:"medium",autoRun:!0},workers:{enabled:e.workers,autoDispatch:["optimize","consolidate"]}}}function R(t){let e=a(t,".claude","settings.json"),o={};if(c(e))try{o=f(m(e,"utf-8"))}catch{}o.mcpServers||(o.mcpServers={});let r=o.mcpServers;!r.ruflo&&!r["claude-flow"]&&(r.ruflo={command:"npx",args:["ruflo@3.5.18","mcp"],env:{}}),g(e,JSON.stringify(o,null,2))}async function O(t){let{projectRoot:e,force:o,checkOnly:r,debug:s}=t,n=await C(e,s);if(!n.available&&!o)return{available:!1,features:{trajectories:!1,modelRouting:!1,pretrain:!1,workers:!1,patternSearch:!1}};let l=await F(e);if(r)return{available:n.available,version:n.version,features:l};let w=a(e,".agentic-qe"),u=a(w,"claude-flow-integration.json");try{let i=S(e,l);g(u,JSON.stringify(i,null,2)),s&&console.log(`[ClaudeFlow] Config written to: ${u}`)}catch(i){return{available:n.available,version:n.version,features:l,error:`Failed to write config: ${d(i)}`}}try{R(e)}catch(i){s&&console.log("[ClaudeFlow] MCP config update failed:",d(i))}return{available:!0,version:n.version,features:l,configPath:u}}function $(t){let e=a(t,".agentic-qe","claude-flow-integration.json");return c(e)}function D(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(!c(e))return null;try{return f(m(e,"utf-8"))}catch{return null}}function M(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(c(e))try{return b("node:fs").rmSync(e),!0}catch{return!1}return!0}export{D as getClaudeFlowConfig,$ as isClaudeFlowConfigured,M as removeClaudeFlowIntegration,O as setupClaudeFlowIntegration};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as g}from"./chunk-N5XOXPHZ.js";import{b as p}from"./chunk-MT7UNBZ7.js";import{b as f,d as h}from"./chunk-OIDWDGLG.js";import{a as d,e as v}from"./chunk-ZUOVNFXK.js";import{a as b}from"./chunk-YO4ESCB4.js";import{existsSync as c,readFileSync as m}from"node:fs";h();v();import{join as a}from"node:path";async function C(t,e){let o=p(t);if(e&&o.available&&console.log(`[ClaudeFlow] Detected via ${o.method}${o.version?`: v${o.version}`:""}`),!o.available)return{available:!1};let r={"mcp-config":"mcp","local-binary":"cli","npx-cached":"cli","npm-dependency":"npm"};return{available:!0,version:o.version,method:o.method?r[o.method]:void 0}}async function F(t){return{trajectories:!0,modelRouting:!0,pretrain:!0,workers:!0,patternSearch:!0}}function S(t,e){return{version:"1.0",projectRoot:t,integration:{enabled:!0,features:{trajectories:e.trajectories,modelRouting:e.modelRouting,pretrain:e.pretrain,workers:e.workers}},learning:{trajectoryStorage:e.trajectories?"claude-flow":"local",patternSearch:e.patternSearch?"claude-flow":"local"},routing:{modelRouting:e.modelRouting?"claude-flow":"rule-based",preferences:{simple:"haiku",standard:"sonnet",complex:"opus"}},pretrain:{enabled:e.pretrain,depth:"medium",autoRun:!0},workers:{enabled:e.workers,autoDispatch:["optimize","consolidate"]}}}function R(t){let e=a(t,".claude","settings.json"),o={};if(c(e))try{o=f(m(e,"utf-8"))}catch{}o.mcpServers||(o.mcpServers={});let r=o.mcpServers;!r.ruflo&&!r["claude-flow"]&&(r.ruflo={command:"npx",args:["ruflo@3.5.18","mcp"],env:{}}),g(e,JSON.stringify(o,null,2))}async function O(t){let{projectRoot:e,force:o,checkOnly:r,debug:s}=t,n=await C(e,s);if(!n.available&&!o)return{available:!1,features:{trajectories:!1,modelRouting:!1,pretrain:!1,workers:!1,patternSearch:!1}};let l=await F(e);if(r)return{available:n.available,version:n.version,features:l};let w=a(e,".agentic-qe"),u=a(w,"claude-flow-integration.json");try{let i=S(e,l);g(u,JSON.stringify(i,null,2)),s&&console.log(`[ClaudeFlow] Config written to: ${u}`)}catch(i){return{available:n.available,version:n.version,features:l,error:`Failed to write config: ${d(i)}`}}try{R(e)}catch(i){s&&console.log("[ClaudeFlow] MCP config update failed:",d(i))}return{available:!0,version:n.version,features:l,configPath:u}}function $(t){let e=a(t,".agentic-qe","claude-flow-integration.json");return c(e)}function D(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(!c(e))return null;try{return f(m(e,"utf-8"))}catch{return null}}function M(t){let e=a(t,".agentic-qe","claude-flow-integration.json");if(c(e))try{return b("node:fs").rmSync(e),!0}catch{return!1}return!0}export{D as getClaudeFlowConfig,$ as isClaudeFlowConfigured,M as removeClaudeFlowIntegration,O as setupClaudeFlowIntegration};
@@ -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.14.7");process.exit(0)}
2
+ import{c as a,d as b,e as c}from"./chunk-QFETNCNN.js";import"./chunk-XYLQZWF6.js";import"./chunk-ZUOVNFXK.js";import"./chunk-YO4ESCB4.js";c();export{a as VibiumClientImpl,b as VibiumClientProvider};
@@ -1,4 +1,4 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
2
- import{b as f}from"./chunk-GGRHV6D7.js";import{a as m,c as v}from"./chunk-MJS53PRX.js";import"./chunk-64VGZQLB.js";v();import{existsSync as s,mkdirSync as p,readFileSync as u,writeFileSync as a}from"fs";import{join as h,dirname as d}from"path";var l=class{projectRoot;overwrite;options;generator;constructor(e){this.projectRoot=e.projectRoot,this.overwrite=e.overwrite??!1,this.options=e,this.generator=f()}async install(){let e={success:!0,mcpConfigured:!1,modeInstalled:!1,errors:[],configPath:"",modePath:""};try{let t=this.generator.generateMcpConfig("cline",{memoryBackend:this.options.memoryBackend}),r=h(this.projectRoot,t.path);if(e.configPath=r,!s(r)||this.overwrite){let o=d(r);if(s(o)||p(o,{recursive:!0}),s(r)&&this.overwrite){let c=this.mergeExistingConfig(r,t.content);a(r,c)}else a(r,t.content);e.mcpConfigured=!0}let n=this.generator.generateBehavioralRules("cline"),i=h(this.projectRoot,n.path);if(e.modePath=i,!s(i)||this.overwrite){let o=d(i);if(s(o)||p(o,{recursive:!0}),s(i)&&this.overwrite){let c=this.mergeExistingModes(i,n.content);a(i,c)}else a(i,n.content);e.modeInstalled=!0}}catch(t){e.success=!1,e.errors.push(`Cline installation failed: ${m(t)}`)}return e}mergeExistingConfig(e,t){try{let r=JSON.parse(u(e,"utf-8")),n=JSON.parse(t);return r.mcpServers||(r.mcpServers={}),Object.assign(r.mcpServers,n.mcpServers),JSON.stringify(r,null,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.14.7");process.exit(0)}
2
+ import{b as f}from"./chunk-OEPNNLR4.js";import{a as m,e as v}from"./chunk-ZUOVNFXK.js";import"./chunk-YO4ESCB4.js";v();import{existsSync as s,mkdirSync as p,readFileSync as u,writeFileSync as a}from"fs";import{join as h,dirname as d}from"path";var l=class{projectRoot;overwrite;options;generator;constructor(e){this.projectRoot=e.projectRoot,this.overwrite=e.overwrite??!1,this.options=e,this.generator=f()}async install(){let e={success:!0,mcpConfigured:!1,modeInstalled:!1,errors:[],configPath:"",modePath:""};try{let t=this.generator.generateMcpConfig("cline",{memoryBackend:this.options.memoryBackend}),r=h(this.projectRoot,t.path);if(e.configPath=r,!s(r)||this.overwrite){let o=d(r);if(s(o)||p(o,{recursive:!0}),s(r)&&this.overwrite){let c=this.mergeExistingConfig(r,t.content);a(r,c)}else a(r,t.content);e.mcpConfigured=!0}let n=this.generator.generateBehavioralRules("cline"),i=h(this.projectRoot,n.path);if(e.modePath=i,!s(i)||this.overwrite){let o=d(i);if(s(o)||p(o,{recursive:!0}),s(i)&&this.overwrite){let c=this.mergeExistingModes(i,n.content);a(i,c)}else a(i,n.content);e.modeInstalled=!0}}catch(t){e.success=!1,e.errors.push(`Cline installation failed: ${m(t)}`)}return e}mergeExistingConfig(e,t){try{let r=JSON.parse(u(e,"utf-8")),n=JSON.parse(t);return r.mcpServers||(r.mcpServers={}),Object.assign(r.mcpServers,n.mcpServers),JSON.stringify(r,null,2)+`
3
3
  `}catch{return t}}mergeExistingModes(e,t){try{let r=JSON.parse(u(e,"utf-8")),n=JSON.parse(t);if(!Array.isArray(r))return t;let i=r.filter(o=>o.slug!=="qe-engineer");return i.push(...n),JSON.stringify(i,null,2)+`
4
4
  `}catch{return t}}};function x(g){return new l(g)}export{l as ClineInstaller,x as createClineInstaller};
@@ -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.14.6");process.exit(0)}
2
- import{a as T,b as I}from"./chunk-ICTXTNQZ.js";import{d as $,e as C}from"./chunk-RSXXCL4A.js";import"./chunk-64VGZQLB.js";import{Command as z}from"commander";import e from"chalk";function O(A,y,P){return new z("code").description("Code intelligence analysis").argument("<action>","Action (index|search|impact|deps|complexity|c4)").argument("[target]","Target path or query").option("--depth <depth>","Analysis depth","3").option("--include-tests","Include test files").option("--incremental","Incremental indexing (index action only)").option("--git-since <ref>","Index changes since git ref (index action only)").option("--level <level>","C4 level for c4 action (context|container|component|all)","all").option("-F, --format <format>","Output format (text|json)","text").option("-o, --output <path>","Write output to file").addHelpText("after",`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as T,b as I}from"./chunk-6RD44SCE.js";import{d as $,e as C}from"./chunk-2G63VIJE.js";import"./chunk-YO4ESCB4.js";import{Command as z}from"commander";import e from"chalk";function O(A,y,P){return new z("code").description("Code intelligence analysis").argument("<action>","Action (index|search|impact|deps|complexity|c4)").argument("[target]","Target path or query").option("--depth <depth>","Analysis depth","3").option("--include-tests","Include test files").option("--incremental","Incremental indexing (index action only)").option("--git-since <ref>","Index changes since git ref (index action only)").option("--level <level>","C4 level for c4 action (context|container|component|all)","all").option("-F, --format <format>","Output format (text|json)","text").option("-o, --output <path>","Write output to file").addHelpText("after",`
3
3
  Examples:
4
4
  aqe code index src/ Index source files into knowledge graph
5
5
  aqe code index src/ --incremental Incremental index (only changed files)
@@ -13,7 +13,7 @@ Examples:
13
13
  aqe code c4 . --format json -o c4.json Full C4 result as JSON
14
14
  `).action(async(b,m,c)=>{if(await P())try{let u=await A.kernel.getDomainAPIAsync("code-intelligence");if(!u){console.log(e.red("Code intelligence domain not available"));return}let v=await import("path"),D=c.format||"text",F=parseInt(c.depth);if(isNaN(F)||F<1){console.log(e.red(`Invalid --depth value: "${c.depth}" (must be a positive integer)`));return}if(b==="index"){let g=c.incremental||!1,l=c.gitSince,r=g?"Incrementally indexing":"Indexing";console.log(e.blue(`
15
15
  ${r} codebase at ${m||"."}${l?` (since ${l})`:""}...
16
- `));let n=v.resolve(m||"."),a;if(l){let{getGitRefError:t}=await import("./ref-validation-KY73NQXD.js"),d=t(l,"--git-since ref");if(d)return console.log(e.red(d)),await y(1);let{execFileSync:f}=await import("child_process");try{let h=f("git",["diff","--name-only","--diff-filter=ACMR",l,"--",n],{encoding:"utf-8",cwd:process.cwd()}).trim();a=h?h.split(`
16
+ `));let n=v.resolve(m||"."),a;if(l){let{getGitRefError:t}=await import("./ref-validation-AZ3LRWEK.js"),d=t(l,"--git-since ref");if(d)return console.log(e.red(d)),await y(1);let{execFileSync:f}=await import("child_process");try{let h=f("git",["diff","--name-only","--diff-filter=ACMR",l,"--",n],{encoding:"utf-8",cwd:process.cwd()}).trim();a=h?h.split(`
17
17
  `).filter(p=>T.has(v.extname(p))).map(p=>v.resolve(p)):[]}catch{console.log(e.yellow(` Warning: git diff failed for ref "${l}", falling back to full scan`)),a=I(n,{includeTests:c.includeTests||!1})}}else a=I(n,{includeTests:c.includeTests||!1});console.log(e.gray(` Found ${a.length} files to index...
18
18
  `));let o=await u.index({paths:a,incremental:g,includeTests:c.includeTests||!1});if(o.success&&o.value){let t=o.value;if(D==="json")$(C(t),c.output);else{if(console.log(e.green(`Indexing complete
19
19
  `)),console.log(e.cyan(" Results:")),console.log(` Files indexed: ${e.white(t.filesIndexed)}`),console.log(` Nodes created: ${e.white(t.nodesCreated)}`),console.log(` Edges created: ${e.white(t.edgesCreated)}`),console.log(` Duration: ${e.yellow(t.duration+"ms")}`),t.warnings&&t.warnings.length>0){console.log(e.yellow(`
@@ -1,3 +1,3 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.6");process.exit(0)}
2
- import"./chunk-64VGZQLB.js";import{readFile as m}from"fs/promises";var d=new Set(["if","for","while","switch","catch","return","new","throw","import","export","constructor"]),h=50;function x(o,c){let n=c.split(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import"./chunk-YO4ESCB4.js";import{readFile as m}from"fs/promises";var d=new Set(["if","for","while","switch","catch","return","new","throw","import","export","constructor"]),h=50;function x(o,c){let n=c.split(`
3
3
  `),e=[],i=[];for(let t=0;t<n.length;t++){let s=n[t],a=s.match(/(?:export\s+)?(?:default\s+)?(?:async\s+)?function\s+(\w+)/);if(a){e.push({type:"function",name:a[1],lineStart:t+1});continue}let l=s.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(?:async\s+)?(?:\([^)]*\)|[a-zA-Z_]\w*)\s*(?::\s*[^=]+)?\s*=>/);if(l){e.push({type:"function",name:l[1],lineStart:t+1});continue}let u=s.match(/(?:export\s+)?(?:default\s+)?(?:abstract\s+)?class\s+(\w+)/);if(u){e.push({type:"class",name:u[1],lineStart:t+1});continue}let f=s.match(/(?:export\s+)?interface\s+(\w+)/);if(f){e.push({type:"interface",name:f[1],lineStart:t+1});continue}let r=s.match(/^\s+(?:(?:public|private|protected|static|readonly|override|abstract|async)\s+)*(\w+)\s*(?:<[^>]*>)?\s*\([^)]*\)\s*(?::\s*[^{]+)?\s*\{?\s*$/);if(r&&!d.has(r[1])){e.push({type:"function",name:r[1],lineStart:t+1});continue}let p=s.match(/(?:import|from)\s+['"](\.[^'"]+)['"]/);p&&i.push(p[1])}return{path:o,entities:e,imports:i}}async function y(o){let c=[];for(let n=0;n<o.length;n+=h){let e=o.slice(n,n+h),i=await Promise.allSettled(e.map(async t=>{let s=await m(t,"utf-8");return x(t,s)}));for(let t of i)t.status==="fulfilled"&&c.push(t.value)}return{files:c}}export{y as extractCodeIndex};
@@ -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.14.6");process.exit(0)}
2
- import{a as N}from"./chunk-BAMN2CHI.js";import{a as P}from"./chunk-6SQM2MUX.js";import{a as j}from"./chunk-5VFPCSK7.js";import{b as I}from"./chunk-GGRHV6D7.js";import"./chunk-AIRGNL55.js";import{a as b,c as B}from"./chunk-MJS53PRX.js";import"./chunk-64VGZQLB.js";B();import{copyFileSync as E,existsSync as l,mkdirSync as k,readFileSync as v,readdirSync as G,statSync as w,writeFileSync as C}from"fs";import{join as n,dirname as S}from"path";import{fileURLToPath as $}from"url";var U=512,D=`# Agentic QE
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import{a as N}from"./chunk-KUHLTVWC.js";import{a as P}from"./chunk-N5XOXPHZ.js";import{a as j}from"./chunk-NOHWJOBS.js";import{b as I}from"./chunk-OEPNNLR4.js";import"./chunk-OIDWDGLG.js";import{a as b,e as B}from"./chunk-ZUOVNFXK.js";import"./chunk-YO4ESCB4.js";B();import{copyFileSync as E,existsSync as l,mkdirSync as k,readFileSync as v,readdirSync as G,statSync as w,writeFileSync as C}from"fs";import{join as n,dirname as S}from"path";import{fileURLToPath as $}from"url";var U=512,D=`# Agentic QE
3
3
 
4
4
  Preserve project data, especially .agentic-qe/memory.db. Read affected code and tests before editing, validate inputs at system boundaries, and run focused checks before broader gates. Discover AQE tools and skills from their live schemas.`,O=class y{projectRoot;overwrite;options;generator;static AGENTS_START="<!-- BEGIN AGENTIC-QE CODEX -->";static AGENTS_END="<!-- END AGENTIC-QE CODEX -->";constructor(e){this.projectRoot=e.projectRoot,this.overwrite=e.overwrite??!1,this.options=e,this.generator=I()}async install(){let e={success:!0,mcpConfigured:!1,agentsMdInstalled:!1,hooksConfigured:!1,skillsInstalled:0,errors:[],configPath:"",agentsMdPath:"",hooksPath:n(this.projectRoot,".codex","hooks.json"),skillsPath:n(this.projectRoot,".agents","skills"),guidancePolicy:this.options.guidancePolicy??"full",ownedGuidanceBytes:0,components:{mcp:{status:"skipped"},rules:{status:"skipped"},hooks:{status:"unavailable"},skills:{status:"unavailable"}}};try{let t=this.generator.generateMcpConfig("codex",{memoryBackend:this.options.memoryBackend}),s=n(this.projectRoot,t.path);e.configPath=s;let o=l(s);if(this.options.installMcp!==!1&&(!o||this.overwrite)){let r=S(s);if(l(r)||k(r,{recursive:!0}),l(s)&&this.overwrite){let c=this.mergeExistingTomlConfig(s,t.content);C(s,c)}else C(s,t.content);e.mcpConfigured=!0,e.components.mcp.status=o?"updated":"installed"}else this.options.installMcp!==!1&&o&&(e.components.mcp.status="preserved")}catch(t){this.recordComponentFailure(e,"mcp",t)}try{let t=this.options.guidancePolicy??"full",s=this.generator.generateBehavioralRules("codex"),o=n(this.projectRoot,s.path);e.agentsMdPath=o;let r=l(o);if(t==="none")if(!r)e.components.rules.status="skipped";else{let c=v(o,"utf-8"),i=this.removeOwnedAgentsSections(c);i!==c?(C(o,i),e.components.rules.status="updated"):e.components.rules.status="preserved"}else if(r){let c=t==="compact"?D:s.content,i=v(o,"utf-8"),d=this.mergeExistingAgentsMdContent(i,c);d!==i?(C(o,d),e.agentsMdInstalled=!0,e.components.rules.status="updated"):e.components.rules.status="preserved",e.ownedGuidanceBytes=this.measureOwnedAgentsSection(d)}else{let c=t==="compact"?D:s.content,i=this.markAgentsSection(c);C(o,i),e.agentsMdInstalled=!0,e.ownedGuidanceBytes=Buffer.byteLength(i),e.components.rules.status="installed"}}catch(t){this.recordComponentFailure(e,"rules",t)}try{e.components.hooks.status=this.installCodexHooks(e)}catch(t){this.recordComponentFailure(e,"hooks",t)}try{let t=this.installCodexSkills();e.skillsInstalled=t.count,e.components.skills.status=t.status}catch(t){this.recordComponentFailure(e,"skills",t)}for(let t of["hooks","skills"])if(e.components[t].status==="unavailable"){let s=`Codex ${t} unavailable: packaged assets could not be located`;e.components[t].error=s,e.errors.push(s)}return e.success=e.errors.length===0,e}recordComponentFailure(e,t,s){let o=b(s);e.components[t]={status:"failed",error:o},e.errors.push(`Codex ${t} installation failed: ${o}`)}installCodexHooks(e){let t=this.resolvePackageRoot();if(!t)return"unavailable";let s=n(t,".codex","hooks.json"),o=n(t,".codex","hooks");if(!l(s)||!l(o))return"unavailable";let r=n(this.projectRoot,".codex"),c=n(r,"hooks");k(c,{recursive:!0});for(let a of G(o)){if(!this.options.includeRuflo&&a==="ruflo-codex-hook.cjs")continue;let u=n(o,a);if(!w(u).isFile())continue;let f=n(c,a);(!l(f)||this.overwrite)&&E(u,f)}let i=[{source:n(t,".claude","hooks","aqe-hook.cjs"),target:n(c,"aqe-runtime.cjs")},...this.options.includeRuflo?[{source:n(t,".claude","helpers","ruflo-hook.cjs"),target:n(c,"ruflo-runtime.cjs")}]:[]];for(let a of i)l(a.source)&&(!l(a.target)||this.overwrite)&&E(a.source,a.target);let d=JSON.parse(v(s,"utf-8")),g=a=>a.flatMap(u=>{if(!u||typeof u!="object")return[u];let f=u;if(!Array.isArray(f.hooks))return JSON.stringify(u).includes("ruflo-codex-hook.cjs")?[]:[u];let R=f.hooks.filter(F=>!JSON.stringify(F).includes("ruflo-codex-hook.cjs"));return R.length>0?[{...f,hooks:R}]:[]}),h={...d,hooks:Object.fromEntries(Object.entries(d.hooks||{}).map(([a,u])=>[a,this.options.includeRuflo?u:g(u)]))},p=n(r,"hooks.json");if(!l(p))return C(p,JSON.stringify(h,null,2)+`
5
5
  `),e.hooksConfigured=!0,"installed";let m=JSON.parse(v(p,"utf-8")),x=a=>JSON.stringify(a).includes("/.codex/hooks/aqe-codex-hook.cjs")||JSON.stringify(a).includes("/.codex/hooks/ruflo-codex-hook.cjs"),A={},T=new Set([...Object.keys(m.hooks||{}),...Object.keys(h.hooks||{})]);for(let a of T){let u=(m.hooks?.[a]||[]).filter(f=>!x(f));A[a]=[...u,...h.hooks?.[a]||[]]}let M=P(p,JSON.stringify({...m,description:h.description,hooks:A},null,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.14.6");process.exit(0)}
2
- import"./chunk-64VGZQLB.js";import{Command as v}from"commander";import o from"chalk";var c=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization"],a=["qe-tdd-specialist","qe-test-architect","qe-parallel-executor","qe-flaky-hunter","qe-retry-handler","qe-coverage-specialist","qe-gap-detector","qe-quality-gate","qe-deployment-advisor","qe-code-complexity","qe-qx-partner","qe-security-scanner","qe-security-auditor","qe-contract-validator","qe-integration-tester","qe-graphql-tester","qe-visual-tester","qe-accessibility-auditor","qe-responsive-tester","qe-performance-tester","qe-load-tester","qe-chaos-engineer","qe-code-intelligence","qe-dependency-mapper","qe-kg-builder","qe-requirements-validator","qe-bdd-generator","qe-defect-predictor","qe-root-cause-analyzer","qe-regression-analyzer","qe-impact-analyzer","qe-risk-assessor","qe-learning-coordinator","qe-pattern-learner","qe-transfer-specialist","qe-metrics-optimizer","qe-fleet-commander","qe-queen-coordinator","qe-property-tester","qe-mutation-tester","qe-tdd-red","qe-tdd-green","qe-tdd-refactor","qe-code-reviewer","qe-integration-reviewer","qe-performance-reviewer","qe-security-reviewer"],i=["tester","reviewer","security-auditor","security-architect","performance-engineer","code-analyzer","cicd-engineer","reasoningbank-learner","adr-architect","ddd-domain-expert","v3-integration-architect","memory-specialist","claims-authorizer","sparc-orchestrator","sona-learning-optimizer","safla-neural","production-validator","tdd-london-swarm","queen-coordinator","swarm-memory-manager","worker-specialist","collective-intelligence-coordinator","scout-explorer","adaptive-coordinator","mesh-coordinator","hierarchical-coordinator","consensus-coordinator","byzantine-coordinator","raft-manager","crdt-synchronizer","n8n-workflow-executor","n8n-unit-tester","n8n-integration-test","n8n-trigger-test","n8n-security-auditor"],P=[...a,...i];var p=["generate-tests","execute-tests","analyze-coverage","assess-quality","predict-defects","validate-requirements","analyze-code","scan-security","validate-contracts","test-accessibility","chaos-test","optimize-learning"],b=["p0","p1","p2","p3"],y=["pending","running","completed","failed","cancelled"],d=["jest","vitest","pytest","junit","playwright","cypress","go-test","node-test"],w=["unit","integration","e2e"],C=["sqlite","agentdb","hybrid"];function q(){return`#!/bin/bash
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.14.7");process.exit(0)}
2
+ import"./chunk-YO4ESCB4.js";import{Command as v}from"commander";import o from"chalk";var c=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization"],a=["qe-tdd-specialist","qe-test-architect","qe-parallel-executor","qe-flaky-hunter","qe-retry-handler","qe-coverage-specialist","qe-gap-detector","qe-quality-gate","qe-deployment-advisor","qe-code-complexity","qe-qx-partner","qe-security-scanner","qe-security-auditor","qe-contract-validator","qe-integration-tester","qe-graphql-tester","qe-visual-tester","qe-accessibility-auditor","qe-responsive-tester","qe-performance-tester","qe-load-tester","qe-chaos-engineer","qe-code-intelligence","qe-dependency-mapper","qe-kg-builder","qe-requirements-validator","qe-bdd-generator","qe-defect-predictor","qe-root-cause-analyzer","qe-regression-analyzer","qe-impact-analyzer","qe-risk-assessor","qe-learning-coordinator","qe-pattern-learner","qe-transfer-specialist","qe-metrics-optimizer","qe-fleet-commander","qe-queen-coordinator","qe-property-tester","qe-mutation-tester","qe-tdd-red","qe-tdd-green","qe-tdd-refactor","qe-code-reviewer","qe-integration-reviewer","qe-performance-reviewer","qe-security-reviewer"],i=["tester","reviewer","security-auditor","security-architect","performance-engineer","code-analyzer","cicd-engineer","reasoningbank-learner","adr-architect","ddd-domain-expert","v3-integration-architect","memory-specialist","claims-authorizer","sparc-orchestrator","sona-learning-optimizer","safla-neural","production-validator","tdd-london-swarm","queen-coordinator","swarm-memory-manager","worker-specialist","collective-intelligence-coordinator","scout-explorer","adaptive-coordinator","mesh-coordinator","hierarchical-coordinator","consensus-coordinator","byzantine-coordinator","raft-manager","crdt-synchronizer","n8n-workflow-executor","n8n-unit-tester","n8n-integration-test","n8n-trigger-test","n8n-security-auditor"],P=[...a,...i];var p=["generate-tests","execute-tests","analyze-coverage","assess-quality","predict-defects","validate-requirements","analyze-code","scan-security","validate-contracts","test-accessibility","chaos-test","optimize-learning"],b=["p0","p1","p2","p3"],y=["pending","running","completed","failed","cancelled"],d=["jest","vitest","pytest","junit","playwright","cypress","go-test","node-test"],w=["unit","integration","e2e"],C=["sqlite","agentdb","hybrid"];function q(){return`#!/bin/bash
3
3
  # AQE CLI Bash Completion Script
4
4
  # Generated by aqe completions bash
5
5
  # ADR-041: Shell Completions for Enhanced Developer Experience