agentic-qe 3.11.4 → 3.11.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (398) hide show
  1. package/.claude/hooks/aqe-hook.cjs +44 -10
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +58 -0
  4. package/assets/skills/skills-manifest.json +1 -1
  5. package/dist/audit/witness-chain.d.ts +25 -0
  6. package/dist/audit/witness-chain.js +69 -22
  7. package/dist/audit/witness-key-manager.d.ts +11 -0
  8. package/dist/audit/witness-key-manager.js +24 -0
  9. package/dist/cli/brain-commands.js +2 -1
  10. package/dist/cli/bundle.js +5 -5
  11. package/dist/cli/chunks/adapter-KNM5R47J.js +2 -0
  12. package/dist/cli/chunks/{agent-booster-wasm-62I6ZNRW.js → agent-booster-wasm-CSTBLNYZ.js} +2 -2
  13. package/dist/cli/chunks/{agent-handler-E2TZKKBS.js → agent-handler-M4W4GTXN.js} +2 -2
  14. package/dist/cli/chunks/{agent-memory-branch-JHAHC2NH.js → agent-memory-branch-VGXFYLSQ.js} +2 -2
  15. package/dist/cli/chunks/aqe-learning-engine-MXPJLVR3.js +2 -0
  16. package/dist/cli/chunks/{arena-72ZV65BR.js → arena-FKSD3LLM.js} +4 -4
  17. package/dist/cli/chunks/{arena-KLG3YSSR.js → arena-IQBRGWAG.js} +2 -2
  18. package/dist/cli/chunks/audit-7NSGRR4Z.js +3 -0
  19. package/dist/cli/chunks/base-X4EXQ2AS.js +2 -0
  20. package/dist/cli/chunks/{hnswlib-node-LAFK5QZ4.js → better-sqlite3-2KR4LQRU.js} +2 -2
  21. package/dist/cli/chunks/brain-handler-M6A3UB66.js +89 -0
  22. package/dist/cli/chunks/{branch-enumerator-C7MPNYT7.js → branch-enumerator-2JGKY4BB.js} +2 -2
  23. package/dist/cli/chunks/{browser-UUDUDYLR.js → browser-J43WQPJL.js} +2 -2
  24. package/dist/cli/chunks/browser-workflow-4HX6RP5F.js +2 -0
  25. package/dist/cli/chunks/{chunk-UJMTKXPI.js → chunk-26WEI3P4.js} +2 -2
  26. package/dist/cli/chunks/{chunk-TQ373GGI.js → chunk-2XPMATEK.js} +2 -2
  27. package/dist/cli/chunks/{chunk-QJ5NCYJ3.js → chunk-2XQHG56O.js} +2 -2
  28. package/dist/cli/chunks/{chunk-EONKMHKO.js → chunk-354367AP.js} +2 -2
  29. package/dist/cli/chunks/{chunk-THKZVOZV.js → chunk-37ZUF5NX.js} +1 -1
  30. package/dist/cli/chunks/{chunk-5P7Q5YNC.js → chunk-3I4TCMOJ.js} +1 -1
  31. package/dist/cli/chunks/{chunk-PQUXFSN6.js → chunk-3JF5A72M.js} +2 -2
  32. package/dist/cli/chunks/{chunk-B5XUWHKQ.js → chunk-3LY7OCSO.js} +1 -1
  33. package/dist/cli/chunks/{chunk-HJ24KMC2.js → chunk-3V36WMIO.js} +1 -1
  34. package/dist/cli/chunks/{chunk-6JUOH6L4.js → chunk-3WR35GFF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-T76RFXQX.js → chunk-4LODYRNV.js} +2 -2
  36. package/dist/cli/chunks/{chunk-D5S47YUS.js → chunk-4MHN7JWC.js} +3 -3
  37. package/dist/cli/chunks/chunk-4QOI5JS7.js +14 -0
  38. package/dist/cli/chunks/{chunk-63QUN3JK.js → chunk-4RTWPR3X.js} +1 -1
  39. package/dist/cli/chunks/chunk-4XJ2A3HY.js +65 -0
  40. package/dist/cli/chunks/{chunk-KUZMVH6N.js → chunk-4Y3LGBKJ.js} +3 -3
  41. package/dist/cli/chunks/{chunk-JFLSQH2X.js → chunk-52U5BFZP.js} +2 -2
  42. package/dist/cli/chunks/{chunk-YNK6SUPU.js → chunk-53YOYZW5.js} +2 -2
  43. package/dist/cli/chunks/{chunk-O7PVZ32A.js → chunk-5WMU7XCF.js} +1 -1
  44. package/dist/cli/chunks/{chunk-ZKCKOQJI.js → chunk-62OTU2AP.js} +2 -2
  45. package/dist/cli/chunks/{chunk-3SKIZDKL.js → chunk-62UM7Q5N.js} +1 -1
  46. package/dist/cli/chunks/{chunk-SFDUT5WM.js → chunk-6Q57K4YD.js} +2 -2
  47. package/dist/cli/chunks/{chunk-3SBUL72V.js → chunk-6R3YOAKO.js} +2 -2
  48. package/dist/cli/chunks/chunk-6T65OKUM.js +2 -0
  49. package/dist/cli/chunks/{chunk-TCVEKRPI.js → chunk-7BCRULCP.js} +2 -2
  50. package/dist/cli/chunks/{chunk-VKJQAKYG.js → chunk-7DTMENY6.js} +2 -2
  51. package/dist/cli/chunks/{chunk-XQ6DW5FV.js → chunk-7KXPNNMR.js} +2 -2
  52. package/dist/cli/chunks/{chunk-N2BJN6AO.js → chunk-7P6X4BFO.js} +3 -3
  53. package/dist/cli/chunks/{chunk-SL3SNOO2.js → chunk-7YSBATSN.js} +2 -2
  54. package/dist/cli/chunks/{chunk-5U2WHPXL.js → chunk-ABU64UWB.js} +1 -1
  55. package/dist/cli/chunks/{chunk-4RHNPRAP.js → chunk-AF6P5RWY.js} +2 -2
  56. package/dist/cli/chunks/{chunk-4JFH3MVA.js → chunk-AGJOGUP5.js} +1 -1
  57. package/dist/cli/chunks/{chunk-5Z4FBCBK.js → chunk-AL5VJJN4.js} +1 -1
  58. package/dist/cli/chunks/{chunk-Z2REKBD6.js → chunk-AOQYORVA.js} +2 -2
  59. package/dist/cli/chunks/{chunk-X64BEXUY.js → chunk-AOXJFDH5.js} +117 -113
  60. package/dist/cli/chunks/{chunk-DRMHVY4T.js → chunk-AXKWV5NF.js} +4 -4
  61. package/dist/cli/chunks/{chunk-3FJZMQJ7.js → chunk-B2VBDMDI.js} +2 -2
  62. package/dist/cli/chunks/{chunk-ARPBG6FQ.js → chunk-BJLA2IX7.js} +2 -2
  63. package/dist/cli/chunks/{chunk-6W3QHS45.js → chunk-BLPWJQTY.js} +2 -2
  64. package/dist/cli/chunks/{chunk-O5NEJIHB.js → chunk-BTLUWH4R.js} +2 -2
  65. package/dist/cli/chunks/{chunk-Y4AXOHW4.js → chunk-C4EZNOWK.js} +1 -1
  66. package/dist/cli/chunks/{chunk-FRFVN6AA.js → chunk-C5C4W572.js} +2 -2
  67. package/dist/cli/chunks/{chunk-7AWK43JN.js → chunk-CDJP6COA.js} +2 -2
  68. package/dist/cli/chunks/{chunk-VJGHRWMH.js → chunk-CKOF27L7.js} +2 -2
  69. package/dist/cli/chunks/{chunk-3E7D3A35.js → chunk-D45QLJEL.js} +1 -1
  70. package/dist/cli/chunks/{chunk-MALOUGSF.js → chunk-DFRRWOEX.js} +2 -2
  71. package/dist/cli/chunks/{chunk-JDFPAJGB.js → chunk-DLBVADWQ.js} +92 -92
  72. package/dist/cli/chunks/{chunk-7IKWF2AD.js → chunk-DPL762HU.js} +1 -1
  73. package/dist/cli/chunks/{chunk-RFQBDMAP.js → chunk-DVW66FPU.js} +1 -1
  74. package/dist/cli/chunks/{chunk-JPENUVCI.js → chunk-EDOGRFAG.js} +1 -1
  75. package/dist/cli/chunks/{chunk-HWBMYR5W.js → chunk-EEKG35K5.js} +5 -5
  76. package/dist/cli/chunks/{chunk-WQZ2WRO4.js → chunk-EK3HPH6A.js} +1 -1
  77. package/dist/cli/chunks/{chunk-WZYNY3VF.js → chunk-FGD6HINU.js} +1 -1
  78. package/dist/cli/chunks/{chunk-ZSBJNE35.js → chunk-FGSIID5C.js} +2 -2
  79. package/dist/cli/chunks/{chunk-TCWR6TDN.js → chunk-FHTYEAQ3.js} +2 -2
  80. package/dist/cli/chunks/{chunk-BRLUNIR4.js → chunk-FII3WCCY.js} +2 -2
  81. package/dist/cli/chunks/{chunk-VCUCD3B5.js → chunk-FIPKIIMS.js} +2 -2
  82. package/dist/cli/chunks/{chunk-6545AS2J.js → chunk-FMNXHVIN.js} +2 -2
  83. package/dist/cli/chunks/{chunk-VO6YJGB4.js → chunk-G2ZIJZJ7.js} +2 -2
  84. package/dist/cli/chunks/{chunk-7ADD2ZQL.js → chunk-GODAWJMZ.js} +2 -2
  85. package/dist/cli/chunks/{chunk-AQIEK4SY.js → chunk-GW6XWMX2.js} +2 -2
  86. package/dist/cli/chunks/{chunk-GOQ4P2PB.js → chunk-HC6KTVFR.js} +2 -2
  87. package/dist/cli/chunks/{chunk-2KNFS3L5.js → chunk-HJWT4KME.js} +1 -1
  88. package/dist/cli/chunks/{chunk-NV3TXXOW.js → chunk-I3ANRYQ6.js} +2 -2
  89. package/dist/cli/chunks/{chunk-IQBZBUP5.js → chunk-I3NWKPXJ.js} +2 -2
  90. package/dist/cli/chunks/chunk-IBDQWKI3.js +2 -0
  91. package/dist/cli/chunks/{chunk-LW5DHT3Z.js → chunk-IU5RSN6M.js} +2 -2
  92. package/dist/cli/chunks/{chunk-XHRLBJTM.js → chunk-J5XDKVI7.js} +2 -2
  93. package/dist/cli/chunks/{chunk-QEVX4GWF.js → chunk-J6PFPY7V.js} +2 -2
  94. package/dist/cli/chunks/{chunk-AE6HXMOG.js → chunk-JATLFS6A.js} +1 -1
  95. package/dist/cli/chunks/{chunk-HJO4RNOW.js → chunk-JBKZ5TUM.js} +2 -2
  96. package/dist/cli/chunks/{chunk-7QTB5XIQ.js → chunk-JDSHUECG.js} +2 -2
  97. package/dist/cli/chunks/{chunk-GRQ36XUH.js → chunk-K4C25BWV.js} +2 -2
  98. package/dist/cli/chunks/{chunk-BMQDELPA.js → chunk-K4I7UIU5.js} +1 -1
  99. package/dist/cli/chunks/{chunk-AJXGGTX7.js → chunk-KP3R2M2G.js} +1 -1
  100. package/dist/cli/chunks/chunk-KQVIWE3W.js +2 -0
  101. package/dist/cli/chunks/{chunk-ZFCVT43J.js → chunk-KVVJVMDM.js} +2 -2
  102. package/dist/cli/chunks/{chunk-WMIRAD3J.js → chunk-LOE2JETO.js} +2 -2
  103. package/dist/cli/chunks/{chunk-54B6P2WS.js → chunk-LPR2R3AN.js} +3 -3
  104. package/dist/cli/chunks/{chunk-EZRHSHOQ.js → chunk-M6FW56MV.js} +2 -2
  105. package/dist/cli/chunks/{chunk-IF3HPQNV.js → chunk-MCHEUSY4.js} +1 -1
  106. package/dist/cli/chunks/{chunk-NBBLPDJX.js → chunk-MEIU7457.js} +2 -2
  107. package/dist/cli/chunks/{chunk-4BFCLSDN.js → chunk-MHMQ6MCT.js} +2 -2
  108. package/dist/cli/chunks/{chunk-UQ72K44T.js → chunk-MIU5RUBJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-LKURMUBU.js → chunk-MMEXHZUC.js} +37 -12
  110. package/dist/cli/chunks/{chunk-SRVTNG6L.js → chunk-MTBGOWJA.js} +2 -2
  111. package/dist/cli/chunks/{chunk-TPMBFARK.js → chunk-NCSXLMDL.js} +67 -22
  112. package/dist/cli/chunks/{chunk-TU6YN43Q.js → chunk-O7J54OHN.js} +1 -1
  113. package/dist/cli/chunks/{chunk-JCTCM6IR.js → chunk-OGNTCZKK.js} +1 -1
  114. package/dist/cli/chunks/{chunk-FSGMRQFC.js → chunk-OS2HHJTM.js} +2 -2
  115. package/dist/cli/chunks/{chunk-TSWF3AGQ.js → chunk-OS62Y77J.js} +2 -2
  116. package/dist/cli/chunks/{chunk-VQU7DMEY.js → chunk-PVDXNQPL.js} +2 -2
  117. package/dist/cli/chunks/{chunk-DNOU2HVQ.js → chunk-PW72M2FE.js} +2 -2
  118. package/dist/cli/chunks/{chunk-HH6NCBSP.js → chunk-Q5TR6ETB.js} +22 -22
  119. package/dist/cli/chunks/{chunk-PFWJQPUC.js → chunk-QKK7VBVB.js} +2 -2
  120. package/dist/cli/chunks/{chunk-JNQN5DNS.js → chunk-RFLHPLET.js} +1 -1
  121. package/dist/cli/chunks/{chunk-IB3ZPLFA.js → chunk-RJN2RM76.js} +2 -2
  122. package/dist/cli/chunks/{chunk-PEIQDQXN.js → chunk-RKXZLTWR.js} +2 -2
  123. package/dist/cli/chunks/{chunk-5VSQAGA2.js → chunk-SE3JFUKP.js} +1 -1
  124. package/dist/cli/chunks/{chunk-LMJUMUQJ.js → chunk-SK754ZSH.js} +4 -4
  125. package/dist/cli/chunks/{chunk-UCYTY4LG.js → chunk-SO6G4IX3.js} +2 -2
  126. package/dist/cli/chunks/{chunk-ICCTQ5LO.js → chunk-SUL3I6QZ.js} +2 -2
  127. package/dist/cli/chunks/{chunk-G3TFNY4T.js → chunk-TBT3OFRW.js} +2 -2
  128. package/dist/cli/chunks/{chunk-AYGEWPN4.js → chunk-TEIWJ3GJ.js} +1 -1
  129. package/dist/cli/chunks/{chunk-YKSWC7I4.js → chunk-TRNBQFFG.js} +8 -20
  130. package/dist/cli/chunks/{chunk-NSPCZPTB.js → chunk-TTJJ4DQE.js} +2 -2
  131. package/dist/cli/chunks/{chunk-2WPSMQIL.js → chunk-UBI2EOS3.js} +1 -1
  132. package/dist/cli/chunks/{chunk-ADFKY3X2.js → chunk-UBY322ED.js} +2 -2
  133. package/dist/cli/chunks/{chunk-QSDIY3E2.js → chunk-UORTQXJ2.js} +1 -1
  134. package/dist/cli/chunks/{chunk-ODZSQVEW.js → chunk-URP75DL4.js} +1 -1
  135. package/dist/cli/chunks/{chunk-37ZDGJ3H.js → chunk-V6NAB5UZ.js} +1 -1
  136. package/dist/cli/chunks/{chunk-YZ5EQR37.js → chunk-VMFAANWX.js} +2 -2
  137. package/dist/cli/chunks/{chunk-NFJT7XXR.js → chunk-VMWRMINE.js} +1 -1
  138. package/dist/cli/chunks/{chunk-MCT4CD5M.js → chunk-VN2HHBZN.js} +2 -2
  139. package/dist/cli/chunks/{chunk-QMC5MTBV.js → chunk-W72FJA2H.js} +2 -2
  140. package/dist/cli/chunks/chunk-W7TYKPLY.js +27 -0
  141. package/dist/cli/chunks/{chunk-YUHM72VQ.js → chunk-WHHQIL4F.js} +2 -2
  142. package/dist/cli/chunks/{chunk-4YT5YN5G.js → chunk-WMZ2QGGS.js} +2 -2
  143. package/dist/cli/chunks/{chunk-Q7ORVHJB.js → chunk-WPSK237F.js} +3 -3
  144. package/dist/cli/chunks/{chunk-ZYZT2CDX.js → chunk-XKQY2Z3Q.js} +1 -1
  145. package/dist/cli/chunks/{chunk-WNMDWP5A.js → chunk-XLT3FYS7.js} +2 -2
  146. package/dist/cli/chunks/{chunk-U34OZXD6.js → chunk-XT4TDLOB.js} +2 -2
  147. package/dist/cli/chunks/{chunk-6GYGAW53.js → chunk-Y25PO65W.js} +2 -2
  148. package/dist/cli/chunks/{chunk-3SRPFBU7.js → chunk-Y6DWJKHU.js} +3 -3
  149. package/dist/cli/chunks/{chunk-D6CKKNYC.js → chunk-YBPLJRVT.js} +2 -2
  150. package/dist/cli/chunks/{chunk-LLUPRGOR.js → chunk-YFCULQBP.js} +2 -2
  151. package/dist/cli/chunks/{chunk-HT6WAYIR.js → chunk-YGVDP6X7.js} +1 -1
  152. package/dist/cli/chunks/{chunk-RCPD6F4R.js → chunk-YR2JKBZO.js} +2 -2
  153. package/dist/cli/chunks/{chunk-P6S6ZVB5.js → chunk-YZSTZUGJ.js} +1 -1
  154. package/dist/cli/chunks/{chunk-CNF3ZWLM.js → chunk-ZG5UAEEO.js} +2 -2
  155. package/dist/cli/chunks/{chunk-MWFJC5HR.js → chunk-ZLBY25MB.js} +1 -1
  156. package/dist/cli/chunks/chunk-ZMPAM4DY.js +2 -0
  157. package/dist/cli/chunks/{chunk-A4OMK3FO.js → chunk-ZPP57WQU.js} +2 -2
  158. package/dist/cli/chunks/{chunk-U3AVZGQA.js → chunk-ZXEWTZFR.js} +1 -1
  159. package/dist/cli/chunks/{ci-HQCRSCC7.js → ci-CBNVLOOQ.js} +2 -2
  160. package/dist/cli/chunks/{ci-output-YBVXLA6O.js → ci-output-I4HY2FYJ.js} +2 -2
  161. package/dist/cli/chunks/{circuit-breaker-ULGMF2QN.js → circuit-breaker-5VRBKGWL.js} +2 -2
  162. package/dist/cli/chunks/{claude-flow-setup-MKZ2LJXK.js → claude-flow-setup-XPJPKHIO.js} +2 -2
  163. package/dist/cli/chunks/client-AHXNCOHK.js +2 -0
  164. package/dist/cli/chunks/{cline-installer-WZQ6XBWN.js → cline-installer-OFRDUUWZ.js} +2 -2
  165. package/dist/cli/chunks/{code-H3KGH45S.js → code-QIZQVB3E.js} +2 -2
  166. package/dist/cli/chunks/{code-index-extractor-NUVEAJ7C.js → code-index-extractor-LMUUWEX4.js} +2 -2
  167. package/dist/cli/chunks/{codex-installer-JQI6E6CV.js → codex-installer-N2MKIZ2S.js} +2 -2
  168. package/dist/cli/chunks/{completions-NDF4PFE7.js → completions-Y36S3C5J.js} +2 -2
  169. package/dist/cli/chunks/{complexity-analyzer-XCZH66HG.js → complexity-analyzer-73YS3WUD.js} +2 -2
  170. package/dist/cli/chunks/{continuedev-installer-Z4AJGZ7S.js → continuedev-installer-SAOTP6J3.js} +2 -2
  171. package/dist/cli/chunks/{copilot-installer-K4IPAL7C.js → copilot-installer-A4HXF6HE.js} +2 -2
  172. package/dist/cli/chunks/core-handlers-EEFLLMAZ.js +2 -0
  173. package/dist/cli/chunks/{cost-tracker-35KXAB23.js → cost-tracker-P26XUVZS.js} +2 -2
  174. package/dist/cli/chunks/{coverage-QW5I4TYZ.js → coverage-HVNHSMVJ.js} +3 -3
  175. package/dist/cli/chunks/cross-domain-router-LT3H4SNJ.js +2 -0
  176. package/dist/cli/chunks/{cursor-installer-P4Z7RMIZ.js → cursor-installer-46BQFTYZ.js} +2 -2
  177. package/dist/cli/chunks/{daemon-WQWTCYBM.js → daemon-Y54O3FLT.js} +3 -3
  178. package/dist/cli/chunks/daemon-YE7K2AZF.js +10 -0
  179. package/dist/cli/chunks/{dag-attention-scheduler-7XD2VGON.js → dag-attention-scheduler-ETA7YY52.js} +2 -2
  180. package/dist/cli/chunks/{detect-GZ3P4DI7.js → detect-5WLQ2J3E.js} +2 -2
  181. package/dist/cli/chunks/{dist-node-6WWAW7OP.js → dist-node-45WW6I7J.js} +2 -2
  182. package/dist/cli/chunks/{domain-handler-3GTLWARQ.js → domain-handler-J7DQV74M.js} +2 -2
  183. package/dist/cli/chunks/domain-transfer-GD2EGQVR.js +2 -0
  184. package/dist/cli/chunks/dream-4K3BK4IG.js +2 -0
  185. package/dist/cli/chunks/{embed-and-insert-pattern-BGIMA77V.js → embed-and-insert-pattern-JELNEA2D.js} +2 -2
  186. package/dist/cli/chunks/{eval-SXV6DRDD.js → eval-A4PA5G2U.js} +2 -2
  187. package/dist/cli/chunks/{experience-capture-middleware-TT6WCT2S.js → experience-capture-middleware-MLHTYWTA.js} +3 -3
  188. package/dist/cli/chunks/{fast-paths-HTAZHEQP.js → fast-paths-QYDTITRV.js} +2 -2
  189. package/dist/cli/chunks/{feature-flags-WBUKU54W.js → feature-flags-H4MSY26Z.js} +2 -2
  190. package/dist/cli/chunks/{feature-flags-DIE3Z2B4.js → feature-flags-MQYYRHIK.js} +2 -2
  191. package/dist/cli/chunks/{file-discovery-SKDETFS3.js → file-discovery-RMFVJNGL.js} +2 -2
  192. package/dist/cli/chunks/{fleet-WCWEPAVU.js → fleet-7KZQOTAC.js} +4 -4
  193. package/dist/cli/chunks/{gnn-wrapper-KWZOWBYS.js → gnn-wrapper-NMZFTGVH.js} +2 -2
  194. package/dist/cli/chunks/{heartbeat-handler-3AGYHVG2.js → heartbeat-handler-7BQDK7MG.js} +4 -4
  195. package/dist/cli/chunks/heartbeat-scheduler-IMPPGQUK.js +2 -0
  196. package/dist/cli/chunks/hnsw-adapter-EIAA6R2L.js +2 -0
  197. package/dist/cli/chunks/hnsw-index-ZXXP6AXZ.js +2 -0
  198. package/dist/cli/chunks/{hnsw-legacy-bridge-6OJJDZHL.js → hnsw-legacy-bridge-TPPGBPKF.js} +2 -2
  199. package/dist/cli/chunks/{better-sqlite3-URULPKRF.js → hnswlib-node-E6NSZPP2.js} +2 -2
  200. package/dist/cli/chunks/{hooks-OXEBTLXV.js → hooks-CYZIUYSH.js} +48 -52
  201. package/dist/cli/chunks/hybrid-router-LXWG4MLH.js +2 -0
  202. package/dist/cli/chunks/{hypergraph-engine-NL74PRHD.js → hypergraph-engine-WC6DMTYQ.js} +2 -2
  203. package/dist/cli/chunks/{hypergraph-handler-KZ54AEEL.js → hypergraph-handler-GTGA3TXJ.js} +3 -3
  204. package/dist/cli/chunks/impact-analyzer-TP5LRFYH.js +2 -0
  205. package/dist/cli/chunks/{init-handler-XKZXRXPG.js → init-handler-N3Z72JNI.js} +6 -6
  206. package/dist/cli/chunks/init-wizard-AIOA5KOY.js +2 -0
  207. package/dist/cli/chunks/kernel-SQALRU6Q.js +2 -0
  208. package/dist/cli/chunks/{kilocode-installer-WISQMJK7.js → kilocode-installer-FUX4V6II.js} +2 -2
  209. package/dist/cli/chunks/{kiro-installer-O7TBB3GM.js → kiro-installer-ZSNZT7ZR.js} +2 -2
  210. package/dist/cli/chunks/knowledge-graph-JFVT6SNN.js +2 -0
  211. package/dist/cli/chunks/{learning-6IZBGVRU.js → learning-UQY64COU.js} +3 -3
  212. package/dist/cli/chunks/{llm-router-QDMQPPQ7.js → llm-router-CMHGGX6N.js} +4 -4
  213. package/dist/cli/chunks/llm-router-service-XHFKTH3I.js +2 -0
  214. package/dist/cli/chunks/{load-KLAJJGL5.js → load-E6WH4QN2.js} +2 -2
  215. package/dist/cli/chunks/load-test-JEIFJKNN.js +2 -0
  216. package/dist/cli/chunks/{mcp-SZOPQZIZ.js → mcp-UM5VTW6N.js} +2 -2
  217. package/dist/cli/chunks/{memory-G3WY74C6.js → memory-7Q3XDUE5.js} +5 -5
  218. package/dist/cli/chunks/memory-backend-NT7I37CP.js +2 -0
  219. package/dist/cli/chunks/memory-handlers-746D7NE7.js +2 -0
  220. package/dist/cli/chunks/{multi-model-executor-TDNQGTOT.js → multi-model-executor-LZENWVRR.js} +2 -2
  221. package/dist/cli/chunks/{opencode-installer-NGYGEDMV.js → opencode-installer-O2JAIPLF.js} +2 -2
  222. package/dist/cli/chunks/{orchestrator-KPI5DY2C.js → orchestrator-DKZWXDRI.js} +5 -5
  223. package/dist/cli/chunks/pattern-null-store-6QU6WHDW.js +2 -0
  224. package/dist/cli/chunks/pattern-usage-recorder-CLUL4M55.js +2 -0
  225. package/dist/cli/chunks/{pipeline-CSDCC675.js → pipeline-2VDLTR5J.js} +2 -2
  226. package/dist/cli/chunks/{platform-Q5XKEVKH.js → platform-4N4Q5XYX.js} +2 -2
  227. package/dist/cli/chunks/{plugin-XKKR3GVL.js → plugin-GY5AU5CS.js} +2 -2
  228. package/dist/cli/chunks/{prime-radiant-advanced-wasm-22QVNKEN.js → prime-radiant-advanced-wasm-TQ4DKDZS.js} +2 -2
  229. package/dist/cli/chunks/protocol-executor-GT2MZYUU.js +2 -0
  230. package/dist/cli/chunks/{protocol-handler-REQKTJGG.js → protocol-handler-T3LZ3WRG.js} +2 -2
  231. package/dist/cli/chunks/{prove-NOFUFSQN.js → prove-OV7S5J4W.js} +2 -2
  232. package/dist/cli/chunks/provider-manager-OATJ7R3D.js +2 -0
  233. package/dist/cli/chunks/qe-reasoning-bank-IJXNQ67O.js +2 -0
  234. package/dist/cli/chunks/{quality-3DQ2H5TK.js → quality-AXD4NLQA.js} +2 -2
  235. package/dist/cli/chunks/queen-coordinator-6RBHWCUG.js +2 -0
  236. package/dist/cli/chunks/{real-embeddings-FCGNYWLL.js → real-embeddings-2PUCC7FG.js} +2 -2
  237. package/dist/cli/chunks/{roocode-installer-HX3CNRIR.js → roocode-installer-WJ5ARGLW.js} +2 -2
  238. package/dist/cli/chunks/router-XKQRT5JK.js +2 -0
  239. package/dist/cli/chunks/routing-feedback-ACPSD4LW.js +2 -0
  240. package/dist/cli/chunks/{routing-handler-YRZ2LDCR.js → routing-handler-CU6657SZ.js} +2 -2
  241. package/dist/cli/chunks/{ruvector-commands-GCQVBJ4E.js → ruvector-commands-IIF6VSFW.js} +2 -2
  242. package/dist/cli/chunks/{rvf-dual-writer-B562P3ZC.js → rvf-dual-writer-YMQI7XO2.js} +2 -2
  243. package/dist/cli/chunks/{rvf-migration-adapter-NAGFKCMD.js → rvf-migration-adapter-HDE3PR2W.js} +2 -2
  244. package/dist/cli/chunks/{rvf-migration-coordinator-WWFBEJ5Q.js → rvf-migration-coordinator-MQV5OA7K.js} +2 -2
  245. package/dist/cli/chunks/rvf-native-adapter-SIWRKE33.js +2 -0
  246. package/dist/cli/chunks/safe-db-LCPUYMX4.js +2 -0
  247. package/dist/cli/chunks/schedule-HIQJCWXG.js +2 -0
  248. package/dist/cli/chunks/scheduler-QE5EJ5LE.js +2 -0
  249. package/dist/cli/chunks/{security-IFOYTD75.js → security-UM3IGDSM.js} +3 -3
  250. package/dist/cli/chunks/{shared-rvf-adapter-TYD5TQ35.js → shared-rvf-adapter-I3SOJ6M4.js} +2 -2
  251. package/dist/cli/chunks/{shared-rvf-dual-writer-YGOOVDQZ.js → shared-rvf-dual-writer-KQGC2UO7.js} +2 -2
  252. package/dist/cli/chunks/sqlite-persistence-EU54UTMH.js +2 -0
  253. package/dist/cli/chunks/status-handler-OX4CJZME.js +46 -0
  254. package/dist/cli/chunks/{structural-health-KZI6YMKV.js → structural-health-PYUMVBXJ.js} +2 -2
  255. package/dist/cli/chunks/{sync-Z5BDDBMK.js → sync-2TED3YTY.js} +2 -2
  256. package/dist/cli/chunks/{sync-ABZNNYRC.js → sync-VALFNTA6.js} +2 -2
  257. package/dist/cli/chunks/{task-handler-5ACZEPJ7.js → task-handler-VPGAJVPC.js} +2 -2
  258. package/dist/cli/chunks/{task-handlers-UZWDPL6A.js → task-handlers-IB4UAMU6.js} +3 -3
  259. package/dist/cli/chunks/{test-APO3MCVV.js → test-OMRJOZB6.js} +4 -4
  260. package/dist/cli/chunks/{test-scheduling-EFZA5G5C.js → test-scheduling-ZL3YFPBU.js} +3 -3
  261. package/dist/cli/chunks/{token-bootstrap-J2OPLNUK.js → token-bootstrap-DNWZI7SH.js} +2 -2
  262. package/dist/cli/chunks/{token-usage-VHWVNN4R.js → token-usage-IYO7RGFF.js} +2 -2
  263. package/dist/cli/chunks/{transformers-PX4HPO75.js → transformers-53ALC34T.js} +2 -2
  264. package/dist/cli/chunks/{tree-sitter-wasm-parser-44HA2Z3F.js → tree-sitter-wasm-parser-WUKJ2I2Q.js} +2 -2
  265. package/dist/cli/chunks/{types-IMOP7F4R.js → types-47FTEPMV.js} +2 -2
  266. package/dist/cli/chunks/unified-memory-CJLMC2I4.js +2 -0
  267. package/dist/cli/chunks/unified-memory-hnsw-FDGR4D2J.js +2 -0
  268. package/dist/cli/chunks/unified-persistence-UFH5GLDN.js +2 -0
  269. package/dist/cli/chunks/{upgrade-OZ3O6ZZI.js → upgrade-QPLMJA5Z.js} +2 -2
  270. package/dist/cli/chunks/{validate-DRY5BMWX.js → validate-3GVKZOVF.js} +2 -2
  271. package/dist/cli/chunks/{validate-swarm-QD3LYPUF.js → validate-swarm-XCRTLVM6.js} +2 -2
  272. package/dist/cli/chunks/{vibium-2J3H2ITD.js → vibium-CH4VPKVZ.js} +2 -2
  273. package/dist/cli/chunks/visual-security-4ARJ7J2Y.js +2 -0
  274. package/dist/cli/chunks/{web-tree-sitter-KRNUOGKI.js → web-tree-sitter-JDBNAZTV.js} +2 -2
  275. package/dist/cli/chunks/{windsurf-installer-PQIPH3WP.js → windsurf-installer-3MNPVJBP.js} +2 -2
  276. package/dist/cli/chunks/witness-chain-73QC33ED.js +2 -0
  277. package/dist/cli/chunks/{witness-chain-HPLOYPS7.js → witness-chain-HR5UBV5J.js} +2 -2
  278. package/dist/cli/chunks/witness-key-manager-G5SQTIBZ.js +2 -0
  279. package/dist/cli/chunks/{workflow-OAQ3FWCY.js → workflow-43EMD5FY.js} +4 -4
  280. package/dist/cli/chunks/workflow-orchestrator-RKMMPXNA.js +2 -0
  281. package/dist/cli/chunks/{wrappers-UPIU6S5S.js → wrappers-3N7AYNM3.js} +2 -2
  282. package/dist/cli/commands/audit.d.ts +12 -0
  283. package/dist/cli/commands/audit.js +64 -4
  284. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
  285. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
  286. package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
  287. package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
  288. package/dist/cli/handlers/status-handler.d.ts +18 -0
  289. package/dist/cli/handlers/status-handler.js +47 -0
  290. package/dist/coordination/mincut/queen-integration.js +24 -7
  291. package/dist/coordination/protocol-executor.js +2 -1
  292. package/dist/coordination/queen-lifecycle.js +4 -1
  293. package/dist/domains/code-intelligence/coordinator.js +10 -6
  294. package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
  295. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
  296. package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
  297. package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
  298. package/dist/domains/learning-optimization/plugin.js +5 -0
  299. package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
  300. package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
  301. package/dist/domains/test-execution/plugin.js +2 -2
  302. package/dist/domains/test-execution/services/flaky-detector.js +1 -1
  303. package/dist/domains/test-generation/coordinator.js +22 -8
  304. package/dist/domains/test-generation/interfaces.d.ts +3 -0
  305. package/dist/domains/test-generation/services/test-generator.js +9 -1
  306. package/dist/integrations/ruvector/delta-tracker.js +10 -1
  307. package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
  308. package/dist/integrations/ruvector/sona-persistence.js +76 -0
  309. package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
  310. package/dist/integrations/ruvector/sona-three-loop.js +17 -0
  311. package/dist/kernel/unified-memory-schemas.d.ts +2 -2
  312. package/dist/kernel/unified-memory-schemas.js +48 -2
  313. package/dist/kernel/unified-memory.d.ts +22 -0
  314. package/dist/kernel/unified-memory.js +43 -0
  315. package/dist/learning/aqe-learning-engine.js +3 -1
  316. package/dist/learning/dream/concept-graph.d.ts +31 -1
  317. package/dist/learning/dream/concept-graph.js +109 -3
  318. package/dist/learning/dream/dream-engine.d.ts +13 -1
  319. package/dist/learning/dream/dream-engine.js +146 -10
  320. package/dist/learning/dream/index.d.ts +1 -1
  321. package/dist/learning/dream/types.d.ts +23 -0
  322. package/dist/learning/pattern-store.d.ts +2 -2
  323. package/dist/learning/pattern-store.js +14 -3
  324. package/dist/learning/qe-reasoning-bank.js +34 -31
  325. package/dist/learning/routing-topology-gate.d.ts +12 -2
  326. package/dist/learning/routing-topology-gate.js +15 -3
  327. package/dist/learning/rvf-pattern-store.d.ts +1 -1
  328. package/dist/learning/rvf-pattern-store.js +21 -8
  329. package/dist/learning/sqlite-persistence.js +12 -9
  330. package/dist/mcp/bundle.js +516 -442
  331. package/dist/mcp/qe-tool-bridge.js +7 -2
  332. package/dist/mcp/tools/base.d.ts +29 -0
  333. package/dist/mcp/tools/base.js +25 -0
  334. package/dist/mcp/tools/coverage-analysis/index.js +6 -4
  335. package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
  336. package/dist/mcp/tools/learning-optimization/dream.js +10 -96
  337. package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
  338. package/dist/mcp/tools/planning/goap-execute.js +33 -18
  339. package/dist/mcp/tools/registry.js +7 -2
  340. package/dist/persistence/rvf-migration-coordinator.js +2 -1
  341. package/dist/planning/actions/qe-action-library.js +124 -1
  342. package/dist/planning/goap-planner.d.ts +14 -2
  343. package/dist/planning/goap-planner.js +51 -9
  344. package/dist/planning/index.d.ts +1 -1
  345. package/dist/planning/plan-executor.d.ts +84 -4
  346. package/dist/planning/plan-executor.js +221 -56
  347. package/dist/planning/types.d.ts +27 -0
  348. package/dist/shared/events/domain-events.d.ts +2 -0
  349. package/dist/workers/workers/learning-consolidation.js +21 -1
  350. package/package.json +1 -1
  351. package/dist/cli/chunks/adapter-2HMUXHWY.js +0 -2
  352. package/dist/cli/chunks/aqe-learning-engine-M2NKRVRE.js +0 -2
  353. package/dist/cli/chunks/audit-EPB7ETMT.js +0 -3
  354. package/dist/cli/chunks/base-CCHC2DAC.js +0 -2
  355. package/dist/cli/chunks/brain-handler-FBMYEERK.js +0 -89
  356. package/dist/cli/chunks/browser-workflow-4DGHFYY3.js +0 -2
  357. package/dist/cli/chunks/chunk-5AQ7FXYG.js +0 -27
  358. package/dist/cli/chunks/chunk-KYTFIP6R.js +0 -2
  359. package/dist/cli/chunks/chunk-MYMIEQSZ.js +0 -65
  360. package/dist/cli/chunks/chunk-XXRTWG7O.js +0 -2
  361. package/dist/cli/chunks/chunk-ZSA6V5FH.js +0 -2
  362. package/dist/cli/chunks/client-2OVEDWGU.js +0 -2
  363. package/dist/cli/chunks/core-handlers-UXRRYP52.js +0 -2
  364. package/dist/cli/chunks/cross-domain-router-PV3VQVLO.js +0 -2
  365. package/dist/cli/chunks/daemon-ESUEM6VB.js +0 -10
  366. package/dist/cli/chunks/domain-transfer-TQYO3SVG.js +0 -2
  367. package/dist/cli/chunks/dream-UFUXVJQC.js +0 -2
  368. package/dist/cli/chunks/heartbeat-scheduler-MBG3SARO.js +0 -2
  369. package/dist/cli/chunks/hnsw-adapter-5HXA3QB3.js +0 -2
  370. package/dist/cli/chunks/hnsw-index-PZRQWBRG.js +0 -2
  371. package/dist/cli/chunks/hybrid-router-NQRIE2GG.js +0 -2
  372. package/dist/cli/chunks/impact-analyzer-46347ZDV.js +0 -2
  373. package/dist/cli/chunks/init-wizard-CJYP4WKO.js +0 -2
  374. package/dist/cli/chunks/kernel-22KQZ56U.js +0 -2
  375. package/dist/cli/chunks/knowledge-graph-KM3JDBGR.js +0 -2
  376. package/dist/cli/chunks/llm-router-service-IFO6GRRO.js +0 -2
  377. package/dist/cli/chunks/load-test-TTKCYAPB.js +0 -2
  378. package/dist/cli/chunks/memory-backend-ELHCX2ZT.js +0 -2
  379. package/dist/cli/chunks/memory-handlers-3SKYQZTL.js +0 -2
  380. package/dist/cli/chunks/pattern-null-store-TMXAYD43.js +0 -2
  381. package/dist/cli/chunks/protocol-executor-BPLR5EJC.js +0 -2
  382. package/dist/cli/chunks/provider-manager-4MMD5QKL.js +0 -2
  383. package/dist/cli/chunks/qe-reasoning-bank-P7KNT3WZ.js +0 -2
  384. package/dist/cli/chunks/queen-coordinator-NBZZ4MGC.js +0 -2
  385. package/dist/cli/chunks/router-2RXR6J2Q.js +0 -2
  386. package/dist/cli/chunks/routing-feedback-AVAA76TK.js +0 -2
  387. package/dist/cli/chunks/rvf-native-adapter-X2YDJA55.js +0 -2
  388. package/dist/cli/chunks/safe-db-4PRU65BK.js +0 -2
  389. package/dist/cli/chunks/schedule-2AST5CHW.js +0 -2
  390. package/dist/cli/chunks/scheduler-SW6II7OU.js +0 -2
  391. package/dist/cli/chunks/sqlite-persistence-OB5NEGAK.js +0 -2
  392. package/dist/cli/chunks/status-handler-HFPWSCBY.js +0 -45
  393. package/dist/cli/chunks/unified-memory-X7OJYGSD.js +0 -2
  394. package/dist/cli/chunks/unified-memory-hnsw-O6HOD5YL.js +0 -2
  395. package/dist/cli/chunks/unified-persistence-C332CER2.js +0 -2
  396. package/dist/cli/chunks/visual-security-MPUG5HPI.js +0 -2
  397. package/dist/cli/chunks/witness-chain-Q4BZHPDF.js +0 -2
  398. package/dist/cli/chunks/workflow-orchestrator-4NDWECYK.js +0 -2
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.4");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.11.5");process.exit(0)}
2
2
  var u={0:{tier:0,name:"Agent Booster",description:"Mechanical code transforms via Rust/WASM",useCases:["var-to-const conversion","add-types","remove-console statements","promise-to-async","cjs-to-esm","func-to-arrow"],typicalLatencyMs:1,relativeCost:0,exampleModels:["agent-booster-wasm","agent-booster-typescript"],requiresNetwork:!1,complexityRange:[0,10]},1:{tier:1,name:"Haiku",description:"Fast, cost-effective for simple tasks",useCases:["Simple bug fixes","Code formatting","Documentation updates","Basic refactoring","Test generation (simple)"],typicalLatencyMs:500,relativeCost:1,exampleModels:["claude-haiku-4-5-20251001","gpt-4o-mini","gemini-flash"],requiresNetwork:!0,complexityRange:[10,35]},2:{tier:2,name:"Sonnet",description:"Balanced capability for complex reasoning",useCases:["Feature implementation","Complex refactoring","Security analysis","Performance optimization","Test generation (complex)"],typicalLatencyMs:3e3,relativeCost:2,exampleModels:["claude-sonnet-4-6","gpt-4o","gemini-pro"],requiresNetwork:!0,complexityRange:[35,70]},3:{tier:3,name:"Sonnet Extended",description:"Extended context for multi-step workflows",useCases:["Multi-file refactoring","Workflow orchestration","Cross-domain coordination","Large codebase analysis"],typicalLatencyMs:7e3,relativeCost:3,exampleModels:["claude-sonnet-4-6"],requiresNetwork:!0,complexityRange:[60,85]},4:{tier:4,name:"Opus",description:"Maximum capability for critical decisions",useCases:["Architecture design","Security audits","Complex algorithm design","Critical bug analysis","System-wide refactoring"],typicalLatencyMs:5e3,relativeCost:4,exampleModels:["claude-opus-4-7","gpt-4-turbo"],requiresNetwork:!0,complexityRange:[75,100]}},d={enabled:!0,tierBudgets:{0:{tier:0,maxCostPerRequest:0,maxRequestsPerHour:1e4,maxRequestsPerDay:1e5,maxDailyCostUsd:0,enabled:!0},1:{tier:1,maxCostPerRequest:.01,maxRequestsPerHour:100,maxRequestsPerDay:1e3,maxDailyCostUsd:5,enabled:!0},2:{tier:2,maxCostPerRequest:.1,maxRequestsPerHour:50,maxRequestsPerDay:500,maxDailyCostUsd:20,enabled:!0},3:{tier:3,maxCostPerRequest:.5,maxRequestsPerHour:20,maxRequestsPerDay:100,maxDailyCostUsd:30,enabled:!0},4:{tier:4,maxCostPerRequest:2,maxRequestsPerHour:10,maxRequestsPerDay:50,maxDailyCostUsd:50,enabled:!0}},maxDailyCostUsd:100,warningThreshold:.8,onBudgetExceeded:"downgrade",onBudgetWarning:"warn",allowCriticalOverrides:!0},y={budgetConfig:d,enableAgentBooster:!0,agentBoosterThreshold:.7,enableAutoRouting:!0,complexityThresholds:{0:10,1:35,2:70,3:85,4:100},allowManualOverrides:!0,enableDecisionCache:!0,decisionCacheTtlMs:300*1e3,enableMetrics:!0,maxDecisionTimeMs:10,fallbackTier:2,tierModels:{0:"agent-booster",1:"claude-haiku-4-5-20251001",2:"claude-sonnet-4-6",3:"claude-sonnet-4-6",4:"claude-opus-4-7"}},r=class extends Error{constructor(e,t,l){super(e);this.code=t;this.cause=l;this.name="ModelRouterError"}code;cause},a=class extends r{constructor(e,t,l){super(e,"BUDGET_EXCEEDED");this.tier=t;this.usage=l;this.name="BudgetExceededError"}tier;usage},i=class extends r{constructor(o,e){super(o,"COMPLEXITY_ANALYSIS_ERROR",e),this.name="ComplexityAnalysisError"}},s=class extends r{constructor(e,t){super(e,"ROUTING_TIMEOUT");this.timeoutMs=t;this.name="RoutingTimeoutError"}timeoutMs};export{u as a,d as b,y as c,r as d,a as e,i as f,s as g};
@@ -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.11.4");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.11.5");process.exit(0)}
2
2
  import{existsSync as _,readdirSync as d,statSync as w}from"fs";import{join as i,extname as E}from"path";var T=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),v=[".test.",".spec.","_test.","_spec."],b=new Set(["node_modules","dist","build","coverage",".git","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".next",".nuxt",".output"]);function O(s,p={}){let{maxDepth:f=6,includeTests:m=!1,testsOnly:x=!1,extraExtensions:S=[]}=p;if(!_(s))return[];let o=w(s);if(o.isFile())return[s];if(!o.isDirectory())return[];let y=new Set(S.map(t=>t.startsWith(".")?t:`.${t}`)),n=[];function r(t,c){if(c>f)return;let a;try{a=d(t,{withFileTypes:!0})}catch{return}for(let e of a)if(e.isDirectory()){if(b.has(e.name))continue;r(i(t,e.name),c+1)}else if(e.isFile()){let u=E(e.name).toLowerCase();if(!(T.has(u)||y.has(u))||e.name.endsWith(".d.ts"))continue;let l=v.some(h=>e.name.includes(h))||e.name.startsWith("test_");x?l&&n.push(i(t,e.name)):(m||!l)&&n.push(i(t,e.name))}}return r(s,0),n}export{T as a,O as 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.11.4");process.exit(0)}
2
- import{b as d,d as c}from"./chunk-VJGHRWMH.js";import{a as l,c as g}from"./chunk-PEIQDQXN.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x 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.11.5");process.exit(0)}
2
+ import{b as d,d as c}from"./chunk-CKOF27L7.js";import{a as l,c as g}from"./chunk-RKXZLTWR.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x as a};
@@ -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.11.4");process.exit(0)}
2
- import{a as f}from"./chunk-XXRTWG7O.js";import{c as p}from"./chunk-6GYGAW53.js";import{a as l,d as b}from"./chunk-7AWK43JN.js";import{a as d,c as g}from"./chunk-TQ373GGI.js";f();g();b();var v={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine",namespace:"coverage-hnsw",maxElements:1e5},S=p.create("coverage-analysis/hnsw-index"),u=class{constructor(e,t={}){this.memory=e;this.config={...v,...t},this.stats={vectorCount:0,searchOperations:0,insertOperations:0}}memory;config;stats;searchLatencies=[];backendType="ruvector-gnn";adapter=null;initialized=!1;metadataStore=new Map;async initialize(){if(this.initialized)return;let e=this.config.metric==="cosine"?"cosine":"euclidean",t=`coverage-${this.config.namespace}`;d.close(t),this.adapter=d.create(t,{dimensions:this.config.dimensions,M:this.config.M,efConstruction:this.config.efConstruction,efSearch:this.config.efSearch,metric:e}),S.info(`HnswAdapter initialized: dimension=${this.config.dimensions}, metric=${this.config.metric}, M=${this.config.M} (unified backend via ADR-071)`),this.initialized=!0}isNativeAvailable(){return this.initialized&&this.adapter!==null}getBackendType(){return this.backendType}isRuvectorAvailable(){return this.initialized&&this.adapter!==null&&this.adapter.isRuvectorAvailable()}async insert(e,t,a){this.initialized||await this.initialize(),t=this.validateVector(t),this.adapter.addByStringId(e,t),a&&this.metadataStore.set(e,a),this.stats.insertOperations++,this.stats.vectorCount=this.adapter.size()}async search(e,t){this.initialized||await this.initialize(),e=this.validateVector(e);let a=performance.now(),n=[];this.adapter.size()>0&&(n=this.adapter.searchByArray(e,t).map(({id:i,score:o})=>({key:i,score:o,distance:1-o,metadata:this.metadataStore.get(i)})));let s=performance.now()-a;return this.recordSearchLatency(s),this.stats.searchOperations++,n}async batchInsert(e){this.initialized||await this.initialize();let t=100;for(let a=0;a<e.length;a+=t){let n=e.slice(a,a+t);await Promise.all(n.map(r=>this.insert(r.key,r.vector,r.metadata)))}}async delete(e){if(!this.adapter)return!1;let t=this.adapter.removeByStringId(e);if(t){this.metadataStore.delete(e);let a=this.buildKey(e);await this.memory.delete(a),this.stats.vectorCount=this.adapter.size()}return t}async getStats(){return{nativeHNSW:this.initialized&&this.adapter!==null,backendType:this.backendType,vectorCount:this.stats.vectorCount,indexSizeBytes:this.stats.vectorCount*this.config.dimensions*4,avgSearchLatencyMs:this.calculateAvgLatency(),p95SearchLatencyMs:this.calculatePercentileLatency(95),p99SearchLatencyMs:this.calculatePercentileLatency(99),searchOperations:this.stats.searchOperations,insertOperations:this.stats.insertOperations}}async clear(){this.metadataStore.clear(),this.adapter&&this.adapter.clear(),this.stats.vectorCount=0,this.searchLatencies=[]}validateVector(e){if(e.length!==this.config.dimensions)return this.resizeVector(e,this.config.dimensions);for(let t=0;t<e.length;t++)if(!Number.isFinite(e[t]))throw new Error(`Invalid vector value at index ${t}: ${e[t]}`);return e}resizeVector(e,t){if(e.length===t)return e;if(e.length>t){let n=new Array(t).fill(0),r=e.length/t;for(let s=0;s<t;s++){let h=Math.floor(s*r),i=Math.floor((s+1)*r),o=0;for(let m=h;m<i;m++)o+=e[m];n[s]=o/(i-h)}return n}let a=new Array(t).fill(0);for(let n=0;n<e.length;n++)a[n]=e[n];return a}buildKey(e){return`${this.config.namespace}:${e}`}recordSearchLatency(e){this.searchLatencies.push(e);let t=1e3;this.searchLatencies.length>t&&(this.searchLatencies=this.searchLatencies.slice(-t))}calculateAvgLatency(){return this.searchLatencies.length===0?0:this.searchLatencies.reduce((t,a)=>t+a,0)/this.searchLatencies.length}calculatePercentileLatency(e){if(this.searchLatencies.length===0)return 0;let t=[...this.searchLatencies].sort((n,r)=>n-r),a=Math.ceil(e/100*t.length)-1;return t[Math.max(0,a)]}setEfSearch(e){this.config.efSearch=e}};function C(c,e){return new u(c,e)}async function H(c,e=1e4,t=1e3){let n=performance.now();for(let i=0;i<e;i++){let o=Array.from({length:384},()=>l());await c.insert(`bench-${i}`,o)}let r=performance.now()-n,s=performance.now();for(let i=0;i<t;i++){let o=Array.from({length:384},()=>l());await c.search(o,10)}let h=performance.now()-s;return{insertTimeMs:r,searchTimeMs:h,avgSearchLatencyMs:h/t,isNative:c.isNativeAvailable(),backendType:c.getBackendType()}}export{v as a,u as b,C as c,H as d};
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.11.5");process.exit(0)}
2
+ import{a as f}from"./chunk-ZMPAM4DY.js";import{c as p}from"./chunk-Y25PO65W.js";import{a as l,d as b}from"./chunk-CDJP6COA.js";import{a as d,c as g}from"./chunk-2XPMATEK.js";f();g();b();var v={dimensions:384,M:16,efConstruction:200,efSearch:100,metric:"cosine",namespace:"coverage-hnsw",maxElements:1e5},S=p.create("coverage-analysis/hnsw-index"),u=class{constructor(e,t={}){this.memory=e;this.config={...v,...t},this.stats={vectorCount:0,searchOperations:0,insertOperations:0}}memory;config;stats;searchLatencies=[];backendType="ruvector-gnn";adapter=null;initialized=!1;metadataStore=new Map;async initialize(){if(this.initialized)return;let e=this.config.metric==="cosine"?"cosine":"euclidean",t=`coverage-${this.config.namespace}`;d.close(t),this.adapter=d.create(t,{dimensions:this.config.dimensions,M:this.config.M,efConstruction:this.config.efConstruction,efSearch:this.config.efSearch,metric:e}),S.info(`HnswAdapter initialized: dimension=${this.config.dimensions}, metric=${this.config.metric}, M=${this.config.M} (unified backend via ADR-071)`),this.initialized=!0}isNativeAvailable(){return this.initialized&&this.adapter!==null}getBackendType(){return this.backendType}isRuvectorAvailable(){return this.initialized&&this.adapter!==null&&this.adapter.isRuvectorAvailable()}async insert(e,t,a){this.initialized||await this.initialize(),t=this.validateVector(t),this.adapter.addByStringId(e,t),a&&this.metadataStore.set(e,a),this.stats.insertOperations++,this.stats.vectorCount=this.adapter.size()}async search(e,t){this.initialized||await this.initialize(),e=this.validateVector(e);let a=performance.now(),n=[];this.adapter.size()>0&&(n=this.adapter.searchByArray(e,t).map(({id:i,score:o})=>({key:i,score:o,distance:1-o,metadata:this.metadataStore.get(i)})));let s=performance.now()-a;return this.recordSearchLatency(s),this.stats.searchOperations++,n}async batchInsert(e){this.initialized||await this.initialize();let t=100;for(let a=0;a<e.length;a+=t){let n=e.slice(a,a+t);await Promise.all(n.map(r=>this.insert(r.key,r.vector,r.metadata)))}}async delete(e){if(!this.adapter)return!1;let t=this.adapter.removeByStringId(e);if(t){this.metadataStore.delete(e);let a=this.buildKey(e);await this.memory.delete(a),this.stats.vectorCount=this.adapter.size()}return t}async getStats(){return{nativeHNSW:this.initialized&&this.adapter!==null,backendType:this.backendType,vectorCount:this.stats.vectorCount,indexSizeBytes:this.stats.vectorCount*this.config.dimensions*4,avgSearchLatencyMs:this.calculateAvgLatency(),p95SearchLatencyMs:this.calculatePercentileLatency(95),p99SearchLatencyMs:this.calculatePercentileLatency(99),searchOperations:this.stats.searchOperations,insertOperations:this.stats.insertOperations}}async clear(){this.metadataStore.clear(),this.adapter&&this.adapter.clear(),this.stats.vectorCount=0,this.searchLatencies=[]}validateVector(e){if(e.length!==this.config.dimensions)return this.resizeVector(e,this.config.dimensions);for(let t=0;t<e.length;t++)if(!Number.isFinite(e[t]))throw new Error(`Invalid vector value at index ${t}: ${e[t]}`);return e}resizeVector(e,t){if(e.length===t)return e;if(e.length>t){let n=new Array(t).fill(0),r=e.length/t;for(let s=0;s<t;s++){let h=Math.floor(s*r),i=Math.floor((s+1)*r),o=0;for(let m=h;m<i;m++)o+=e[m];n[s]=o/(i-h)}return n}let a=new Array(t).fill(0);for(let n=0;n<e.length;n++)a[n]=e[n];return a}buildKey(e){return`${this.config.namespace}:${e}`}recordSearchLatency(e){this.searchLatencies.push(e);let t=1e3;this.searchLatencies.length>t&&(this.searchLatencies=this.searchLatencies.slice(-t))}calculateAvgLatency(){return this.searchLatencies.length===0?0:this.searchLatencies.reduce((t,a)=>t+a,0)/this.searchLatencies.length}calculatePercentileLatency(e){if(this.searchLatencies.length===0)return 0;let t=[...this.searchLatencies].sort((n,r)=>n-r),a=Math.ceil(e/100*t.length)-1;return t[Math.max(0,a)]}setEfSearch(e){this.config.efSearch=e}};function C(c,e){return new u(c,e)}async function H(c,e=1e4,t=1e3){let n=performance.now();for(let i=0;i<e;i++){let o=Array.from({length:384},()=>l());await c.insert(`bench-${i}`,o)}let r=performance.now()-n,s=performance.now();for(let i=0;i<t;i++){let o=Array.from({length:384},()=>l());await c.search(o,10)}let h=performance.now()-s;return{insertTimeMs:r,searchTimeMs:h,avgSearchLatencyMs:h/t,isNative:c.isNativeAvailable(),backendType:c.getBackendType()}}export{v as a,u as b,C as c,H as d};
@@ -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.11.4");process.exit(0)}
2
- import{a as k}from"./chunk-THKZVOZV.js";import{b as ne}from"./chunk-TU6YN43Q.js";import{a as ee,b as te}from"./chunk-63QUN3JK.js";import{b as E,d as fe}from"./chunk-VJGHRWMH.js";import{a as b,c as T}from"./chunk-PEIQDQXN.js";var he={M:16,efConstruction:200,efSearch:100},P={enabled:!0,pretrainedPatterns:!0,hnswConfig:he,promotionThreshold:3,qualityThreshold:.7,embeddingModel:"auto"},_={mode:"hybrid",confidenceThreshold:.7,feedbackEnabled:!0,cacheEnabled:!0,cacheTTLMs:300*1e3},F={enabled:["pattern-consolidator","coverage-gap-scanner","flaky-test-detector","routing-accuracy-monitor"],intervals:{"pattern-consolidator":1800*1e3,"coverage-gap-scanner":3600*1e3,"flaky-test-detector":7200*1e3,"routing-accuracy-monitor":900*1e3},maxConcurrent:4,daemonAutoStart:!0},N={claudeCode:!0,preCommit:!1,ciIntegration:!1},$={install:!0,installV2:!0,installV3:!0,overwrite:!1},O={enabled:!0,parameters:["hnsw.efSearch","routing.confidenceThreshold","pattern.promotionThreshold","testGen.complexityLimit"],tuningIntervalMs:10080*60*1e3,evaluationPeriodMs:5e3};var L=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization","enterprise-integration"];function M(){return"3.11.4"}function Fe(r,e){return{version:M(),project:{name:r,root:e,type:"single"},learning:P,routing:_,workers:F,hooks:N,skills:$,autoTuning:O,domains:{enabled:L,disabled:[]},agents:{maxConcurrent:15,defaultTimeout:6e4}}}fe();import{readFileSync as w,existsSync as p,statSync as ye,readdirSync as ve}from"fs";import{join as u,basename as re,extname as ie,relative as V}from"path";var be=[{name:"jest",detect:r=>{let e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs"];for(let n of e)if(p(u(r,n)))return{name:"jest",version:A(r,"jest"),configFile:n,confidence:1};let t=S(r);return t?.jest?{name:"jest",version:A(r,"jest"),configFile:"package.json",confidence:.9}:t?.devDependencies?.jest||t?.dependencies?.jest?{name:"jest",version:t.devDependencies?.jest||t.dependencies?.jest,confidence:.7}:null}},{name:"vitest",detect:r=>{let e=["vitest.config.ts","vitest.config.js","vitest.config.mts","vite.config.ts"];for(let n of e)if(p(u(r,n)))return{name:"vitest",version:A(r,"vitest"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.vitest||t?.dependencies?.vitest?{name:"vitest",version:t.devDependencies?.vitest,confidence:.8}:null}},{name:"mocha",detect:r=>{let e=[".mocharc.js",".mocharc.json",".mocharc.yaml",".mocharc.yml"];for(let n of e)if(p(u(r,n)))return{name:"mocha",version:A(r,"mocha"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.mocha?{name:"mocha",version:t.devDependencies?.mocha,confidence:.8}:null}},{name:"pytest",detect:r=>{let e=["pytest.ini","pyproject.toml","setup.cfg"];for(let n of e){let i=u(r,n);if(p(i))try{let s=w(i,"utf-8");if(s.includes("[pytest]")||s.includes("[tool.pytest]"))return{name:"pytest",configFile:n,confidence:1}}catch(s){console.debug("[ProjectAnalyzer] Config read failed:",s instanceof Error?s.message:s)}}let t=u(r,"requirements.txt");if(p(t))try{if(w(t,"utf-8").includes("pytest"))return{name:"pytest",configFile:"requirements.txt",confidence:.8}}catch(n){console.debug("[ProjectAnalyzer] requirements.txt read failed:",n instanceof Error?n.message:n)}return null}},{name:"playwright",detect:r=>{let e=["playwright.config.ts","playwright.config.js"];for(let n of e)if(p(u(r,n)))return{name:"playwright",version:A(r,"@playwright/test"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.["@playwright/test"]?{name:"playwright",version:t.devDependencies["@playwright/test"],confidence:.8}:null}},{name:"cypress",detect:r=>{let e=["cypress.config.ts","cypress.config.js","cypress.json"];for(let t of e)if(p(u(r,t)))return{name:"cypress",version:A(r,"cypress"),configFile:t,confidence:1};return p(u(r,"cypress"))?{name:"cypress",configFile:"cypress/",confidence:.9}:null}}],ke=[{name:"typescript",extensions:[".ts",".tsx",".mts",".cts"]},{name:"javascript",extensions:[".js",".jsx",".mjs",".cjs"]},{name:"python",extensions:[".py",".pyw"]},{name:"java",extensions:[".java"]},{name:"go",extensions:[".go"]},{name:"rust",extensions:[".rs"]},{name:"csharp",extensions:[".cs"]},{name:"ruby",extensions:[".rb"]},{name:"php",extensions:[".php"]},{name:"kotlin",extensions:[".kt",".kts"]},{name:"swift",extensions:[".swift"]}];function S(r){let e=u(r,"package.json");if(!p(e))return null;try{return E(w(e,"utf-8"))}catch{return null}}function A(r,e){let t=S(r);if(t)return t.devDependencies?.[e]||t.dependencies?.[e]}function Q(r,e,t={}){let{maxDepth:n=10,exclude:i=["node_modules",".git","dist","build","coverage",".next","__pycache__"]}=t;function s(o,a){if(a>n)return;let l;try{l=ve(o)}catch{return}for(let g of l){if(i.includes(g))continue;let c=u(o,g),x;try{x=ye(c)}catch{continue}x.isDirectory()?s(c,a+1):x.isFile()&&e(c)}}s(r,0)}var W=class{projectRoot;constructor(e){this.projectRoot=e}async analyze(){let e=Date.now(),[t,n,i,s,o]=await Promise.all([this.detectFrameworks(),this.detectLanguages(),this.detectExistingTests(),this.analyzeComplexity(),this.measureCoverage()]);return{projectName:S(this.projectRoot)?.name||re(this.projectRoot),projectRoot:this.projectRoot,projectType:this.detectProjectType(),frameworks:t,languages:n,existingTests:i,codeComplexity:s,coverage:o,packageManager:this.detectPackageManager(),hasTypeScript:p(u(this.projectRoot,"tsconfig.json")),hasCIConfig:this.detectCIConfig(),ciProvider:this.detectCIProvider(),analysisTimestamp:new Date,analysisDurationMs:Date.now()-e}}async detectFrameworks(){let e=[];for(let t of be){let n=t.detect(this.projectRoot);n&&e.push(n)}return e.sort((t,n)=>n.confidence-t.confidence)}async detectLanguages(){let e=new Map,t=0;Q(this.projectRoot,i=>{let s=ie(i).toLowerCase();if(s){for(let o of ke)if(o.extensions.includes(s)){let a=e.get(o.name)||{count:0,extensions:new Set};a.count++,a.extensions.add(s),e.set(o.name,a),t++;break}}});let n=[];for(let[i,s]of e)n.push({name:i,percentage:t>0?Math.round(s.count/t*100):0,fileCount:s.count,extensions:Array.from(s.extensions)});return n.sort((i,s)=>s.fileCount-i.fileCount)}async detectExistingTests(){let e={totalCount:0,byFramework:{},byType:{unit:0,integration:0,e2e:0,unknown:0},directories:[]},t=new Set,n=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/_test\.[jt]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/,/.*Test\.java$/];return Q(this.projectRoot,i=>{let s=re(i);if(n.some(a=>a.test(s))){e.totalCount++;let a=V(this.projectRoot,i).toLowerCase();a.includes("e2e")||a.includes("cypress")||a.includes("playwright")?e.byType.e2e++:a.includes("integration")||a.includes("int-test")?e.byType.integration++:a.includes("unit")||a.includes("__tests__")||a.includes("test/")?e.byType.unit++:e.byType.unknown++;let l=V(this.projectRoot,u(i,".."));t.add(l)}}),e.directories=Array.from(t).slice(0,10),e}async analyzeComplexity(){let e=[],t=[],n=0,i=0;Q(this.projectRoot,a=>{let l=ie(a);if([".ts",".tsx",".js",".jsx",".py",".java",".go"].includes(l))try{let g=w(a,"utf-8"),c=this.calculateFileComplexity(g,l);t.push(...c.functionComplexities),c.maxComplexity>n&&(n=c.maxComplexity),i++,c.maxComplexity>10&&e.push(V(this.projectRoot,a))}catch(g){console.debug("[ProjectAnalyzer] Complexity analysis read failed:",g instanceof Error?g.message:g)}});let s=t.reduce((a,l)=>a+l,0),o=t.length>0?s/t.length:0;return{averageCyclomatic:Math.round(o*10)/10,maxCyclomatic:n,totalFiles:i,complexFiles:e.slice(0,20),recommendation:o<5?"simple":o<15?"medium":"complex"}}calculateFileComplexity(e,t){let n=this.stripCommentsAndStrings(e,t),i=this.calculateComplexity(n);return{functionComplexities:[i],maxComplexity:i}}removeDelimitedBlocks(e,t,n){let i="",s=0;for(;s<e.length;){let o=e.indexOf(t,s);if(o===-1){i+=e.slice(s);break}i+=e.slice(s,o);let a=e.indexOf(n,o+t.length);if(a===-1)break;s=a+n.length}return i}stripCommentsAndStrings(e,t){let n=e;return[".ts",".tsx",".js",".jsx",".java",".go"].includes(t)?(n=n.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.11.5");process.exit(0)}
2
+ import{a as k}from"./chunk-37ZUF5NX.js";import{a as te,b as ne}from"./chunk-4RTWPR3X.js";import{b as ee}from"./chunk-O7J54OHN.js";import{b as E,d as fe}from"./chunk-CKOF27L7.js";import{a as b,c as T}from"./chunk-RKXZLTWR.js";var he={M:16,efConstruction:200,efSearch:100},P={enabled:!0,pretrainedPatterns:!0,hnswConfig:he,promotionThreshold:3,qualityThreshold:.7,embeddingModel:"auto"},_={mode:"hybrid",confidenceThreshold:.7,feedbackEnabled:!0,cacheEnabled:!0,cacheTTLMs:300*1e3},F={enabled:["pattern-consolidator","coverage-gap-scanner","flaky-test-detector","routing-accuracy-monitor"],intervals:{"pattern-consolidator":1800*1e3,"coverage-gap-scanner":3600*1e3,"flaky-test-detector":7200*1e3,"routing-accuracy-monitor":900*1e3},maxConcurrent:4,daemonAutoStart:!0},N={claudeCode:!0,preCommit:!1,ciIntegration:!1},$={install:!0,installV2:!0,installV3:!0,overwrite:!1},O={enabled:!0,parameters:["hnsw.efSearch","routing.confidenceThreshold","pattern.promotionThreshold","testGen.complexityLimit"],tuningIntervalMs:10080*60*1e3,evaluationPeriodMs:5e3};var L=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization","enterprise-integration"];function M(){return"3.11.5"}function Fe(r,e){return{version:M(),project:{name:r,root:e,type:"single"},learning:P,routing:_,workers:F,hooks:N,skills:$,autoTuning:O,domains:{enabled:L,disabled:[]},agents:{maxConcurrent:15,defaultTimeout:6e4}}}fe();import{readFileSync as w,existsSync as p,statSync as ye,readdirSync as ve}from"fs";import{join as u,basename as re,extname as ie,relative as V}from"path";var be=[{name:"jest",detect:r=>{let e=["jest.config.js","jest.config.ts","jest.config.mjs","jest.config.cjs"];for(let n of e)if(p(u(r,n)))return{name:"jest",version:A(r,"jest"),configFile:n,confidence:1};let t=S(r);return t?.jest?{name:"jest",version:A(r,"jest"),configFile:"package.json",confidence:.9}:t?.devDependencies?.jest||t?.dependencies?.jest?{name:"jest",version:t.devDependencies?.jest||t.dependencies?.jest,confidence:.7}:null}},{name:"vitest",detect:r=>{let e=["vitest.config.ts","vitest.config.js","vitest.config.mts","vite.config.ts"];for(let n of e)if(p(u(r,n)))return{name:"vitest",version:A(r,"vitest"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.vitest||t?.dependencies?.vitest?{name:"vitest",version:t.devDependencies?.vitest,confidence:.8}:null}},{name:"mocha",detect:r=>{let e=[".mocharc.js",".mocharc.json",".mocharc.yaml",".mocharc.yml"];for(let n of e)if(p(u(r,n)))return{name:"mocha",version:A(r,"mocha"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.mocha?{name:"mocha",version:t.devDependencies?.mocha,confidence:.8}:null}},{name:"pytest",detect:r=>{let e=["pytest.ini","pyproject.toml","setup.cfg"];for(let n of e){let i=u(r,n);if(p(i))try{let s=w(i,"utf-8");if(s.includes("[pytest]")||s.includes("[tool.pytest]"))return{name:"pytest",configFile:n,confidence:1}}catch(s){console.debug("[ProjectAnalyzer] Config read failed:",s instanceof Error?s.message:s)}}let t=u(r,"requirements.txt");if(p(t))try{if(w(t,"utf-8").includes("pytest"))return{name:"pytest",configFile:"requirements.txt",confidence:.8}}catch(n){console.debug("[ProjectAnalyzer] requirements.txt read failed:",n instanceof Error?n.message:n)}return null}},{name:"playwright",detect:r=>{let e=["playwright.config.ts","playwright.config.js"];for(let n of e)if(p(u(r,n)))return{name:"playwright",version:A(r,"@playwright/test"),configFile:n,confidence:1};let t=S(r);return t?.devDependencies?.["@playwright/test"]?{name:"playwright",version:t.devDependencies["@playwright/test"],confidence:.8}:null}},{name:"cypress",detect:r=>{let e=["cypress.config.ts","cypress.config.js","cypress.json"];for(let t of e)if(p(u(r,t)))return{name:"cypress",version:A(r,"cypress"),configFile:t,confidence:1};return p(u(r,"cypress"))?{name:"cypress",configFile:"cypress/",confidence:.9}:null}}],ke=[{name:"typescript",extensions:[".ts",".tsx",".mts",".cts"]},{name:"javascript",extensions:[".js",".jsx",".mjs",".cjs"]},{name:"python",extensions:[".py",".pyw"]},{name:"java",extensions:[".java"]},{name:"go",extensions:[".go"]},{name:"rust",extensions:[".rs"]},{name:"csharp",extensions:[".cs"]},{name:"ruby",extensions:[".rb"]},{name:"php",extensions:[".php"]},{name:"kotlin",extensions:[".kt",".kts"]},{name:"swift",extensions:[".swift"]}];function S(r){let e=u(r,"package.json");if(!p(e))return null;try{return E(w(e,"utf-8"))}catch{return null}}function A(r,e){let t=S(r);if(t)return t.devDependencies?.[e]||t.dependencies?.[e]}function Q(r,e,t={}){let{maxDepth:n=10,exclude:i=["node_modules",".git","dist","build","coverage",".next","__pycache__"]}=t;function s(o,a){if(a>n)return;let l;try{l=ve(o)}catch{return}for(let g of l){if(i.includes(g))continue;let c=u(o,g),x;try{x=ye(c)}catch{continue}x.isDirectory()?s(c,a+1):x.isFile()&&e(c)}}s(r,0)}var W=class{projectRoot;constructor(e){this.projectRoot=e}async analyze(){let e=Date.now(),[t,n,i,s,o]=await Promise.all([this.detectFrameworks(),this.detectLanguages(),this.detectExistingTests(),this.analyzeComplexity(),this.measureCoverage()]);return{projectName:S(this.projectRoot)?.name||re(this.projectRoot),projectRoot:this.projectRoot,projectType:this.detectProjectType(),frameworks:t,languages:n,existingTests:i,codeComplexity:s,coverage:o,packageManager:this.detectPackageManager(),hasTypeScript:p(u(this.projectRoot,"tsconfig.json")),hasCIConfig:this.detectCIConfig(),ciProvider:this.detectCIProvider(),analysisTimestamp:new Date,analysisDurationMs:Date.now()-e}}async detectFrameworks(){let e=[];for(let t of be){let n=t.detect(this.projectRoot);n&&e.push(n)}return e.sort((t,n)=>n.confidence-t.confidence)}async detectLanguages(){let e=new Map,t=0;Q(this.projectRoot,i=>{let s=ie(i).toLowerCase();if(s){for(let o of ke)if(o.extensions.includes(s)){let a=e.get(o.name)||{count:0,extensions:new Set};a.count++,a.extensions.add(s),e.set(o.name,a),t++;break}}});let n=[];for(let[i,s]of e)n.push({name:i,percentage:t>0?Math.round(s.count/t*100):0,fileCount:s.count,extensions:Array.from(s.extensions)});return n.sort((i,s)=>s.fileCount-i.fileCount)}async detectExistingTests(){let e={totalCount:0,byFramework:{},byType:{unit:0,integration:0,e2e:0,unknown:0},directories:[]},t=new Set,n=[/\.test\.[jt]sx?$/,/\.spec\.[jt]sx?$/,/_test\.[jt]sx?$/,/test_.*\.py$/,/.*_test\.py$/,/.*_test\.go$/,/.*Test\.java$/];return Q(this.projectRoot,i=>{let s=re(i);if(n.some(a=>a.test(s))){e.totalCount++;let a=V(this.projectRoot,i).toLowerCase();a.includes("e2e")||a.includes("cypress")||a.includes("playwright")?e.byType.e2e++:a.includes("integration")||a.includes("int-test")?e.byType.integration++:a.includes("unit")||a.includes("__tests__")||a.includes("test/")?e.byType.unit++:e.byType.unknown++;let l=V(this.projectRoot,u(i,".."));t.add(l)}}),e.directories=Array.from(t).slice(0,10),e}async analyzeComplexity(){let e=[],t=[],n=0,i=0;Q(this.projectRoot,a=>{let l=ie(a);if([".ts",".tsx",".js",".jsx",".py",".java",".go"].includes(l))try{let g=w(a,"utf-8"),c=this.calculateFileComplexity(g,l);t.push(...c.functionComplexities),c.maxComplexity>n&&(n=c.maxComplexity),i++,c.maxComplexity>10&&e.push(V(this.projectRoot,a))}catch(g){console.debug("[ProjectAnalyzer] Complexity analysis read failed:",g instanceof Error?g.message:g)}});let s=t.reduce((a,l)=>a+l,0),o=t.length>0?s/t.length:0;return{averageCyclomatic:Math.round(o*10)/10,maxCyclomatic:n,totalFiles:i,complexFiles:e.slice(0,20),recommendation:o<5?"simple":o<15?"medium":"complex"}}calculateFileComplexity(e,t){let n=this.stripCommentsAndStrings(e,t),i=this.calculateComplexity(n);return{functionComplexities:[i],maxComplexity:i}}removeDelimitedBlocks(e,t,n){let i="",s=0;for(;s<e.length;){let o=e.indexOf(t,s);if(o===-1){i+=e.slice(s);break}i+=e.slice(s,o);let a=e.indexOf(n,o+t.length);if(a===-1)break;s=a+n.length}return i}stripCommentsAndStrings(e,t){let n=e;return[".ts",".tsx",".js",".jsx",".java",".go"].includes(t)?(n=n.split(`
3
3
  `).map(i=>{let s=i.indexOf("//");return s>=0?i.slice(0,s):i}).join(`
4
4
  `),n=this.removeDelimitedBlocks(n,"/*","*/"),n=this.removeDelimitedBlocks(n,"`","`"),n=this.removeDelimitedBlocks(n,'"','"'),n=this.removeDelimitedBlocks(n,"'","'")):t===".py"&&(n=n.split(`
5
5
  `).map(i=>{let s=i.indexOf("#");return s>=0?i.slice(0,s):i}).join(`
@@ -58,7 +58,7 @@ See \`.validation/README.md\` for usage instructions.
58
58
  updated: ${e}`):i=n+`
59
59
  updated: ${e}`,r.replace(/^---\n[\s\S]*?\n---/,`---
60
60
  ${i}
61
- ---`)}var qe=["qe-test-architect","qe-bdd-generator","qe-property-tester","qe-mutation-tester","qe-test-idea-rewriter","qe-quality-criteria-recommender","qe-parallel-executor","qe-flaky-hunter","qe-retry-handler","qe-coverage-specialist","qe-gap-detector","qe-quality-gate","qe-code-complexity","qe-deployment-advisor","qe-risk-assessor","qe-defect-predictor","qe-regression-analyzer","qe-root-cause-analyzer","qe-impact-analyzer","qe-requirements-validator","qe-qx-partner","qe-product-factors-assessor","qe-code-intelligence","qe-kg-builder","qe-dependency-mapper","qe-security-scanner","qe-security-auditor","qe-pentest-validator","qe-contract-validator","qe-graphql-tester","qe-visual-tester","qe-accessibility-auditor","qe-responsive-tester","qe-chaos-engineer","qe-load-tester","qe-performance-tester","qe-learning-coordinator","qe-pattern-learner","qe-metrics-optimizer","qe-transfer-specialist","qe-soap-tester","qe-sap-rfc-tester","qe-sap-idoc-tester","qe-odata-contract-tester","qe-middleware-validator","qe-message-broker-tester","qe-sod-analyzer","qe-fleet-commander","qe-queen-coordinator","qe-tdd-specialist","qe-integration-tester","qe-integration-architect"],Te=["qe-code-reviewer","qe-integration-reviewer","qe-performance-reviewer","qe-security-reviewer","qe-tdd-red","qe-tdd-green","qe-tdd-refactor"],Y=class{projectRoot;options;sourceAgentsDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installQEAgents:!0,installSubagents:!0,overwrite:!1,exclude:[],include:void 0,...e},this.sourceAgentsDir=this.findSourceAgentsDir()}findSourceAgentsDir(){let e=k(import.meta.url),t=[];e&&(t.push(d(e,"assets/agents/v3")),t.push(d(e,".claude/agents/v3"))),t.push(d(this.projectRoot,"node_modules/agentic-qe/assets/agents/v3"));for(let n of t)if(f(n))return n;return t[0]}preserveOverridesDir(){let e=d(this.projectRoot,".claude","agent-overrides");f(e)||D(e,{recursive:!0});let t=d(e,"_example.yaml");if(!f(t))try{let n=k(import.meta.url),i=[...n?[d(n,"assets","templates","agent-override-example.yaml")]:[],d(this.projectRoot,"node_modules","agentic-qe","assets","templates","agent-override-example.yaml")];for(let s of i)if(f(s)){J(s,t);break}}catch{}}async install(){let e={installed:[],skipped:[],errors:[],totalCount:0,agentsDir:d(this.projectRoot,".claude","agents","v3"),overlaysApplied:[],overlayWarnings:[]};if(this.preserveOverridesDir(),!f(this.sourceAgentsDir))return e.errors.push(`Source agents directory not found: ${this.sourceAgentsDir}`),e;let t=d(this.projectRoot,".claude","agents","v3");f(t)||D(t,{recursive:!0});let n=d(t,"subagents");f(n)||D(n,{recursive:!0}),await this.copyHelpersDirectory(t),await this.copyTemplatesDirectory(t);let i=this.getAvailableAgents();e.totalCount=i.length;let s=this.filterAgents(i);for(let l of s)try{let g=await this.installAgent(l,t,n);g?e.installed.push(g):e.skipped.push(l)}catch(g){e.errors.push(`Failed to install ${l}: ${b(g)}`)}let o=ee(this.projectRoot);if(o.warnings.length>0){e.overlayWarnings=o.warnings;for(let l of o.warnings)console.error(`[AgentsInstaller] Overlay warning: ${l}`)}if(o.errors.length>0)for(let l of o.errors)e.errors.push(`Overlay error: ${l}`);for(let l of o.overlays){let g=l.agent,x=Te.includes(g)?d(n,`${g}.md`):d(t,`${g}.md`);if(!f(x)){e.overlayWarnings.push(`Overlay for "${g}" found but agent file does not exist. Skipping.`);continue}try{let I=ae(x,"utf-8"),{content:de,applied:q}=te(I,l),pe=Ie(de);le(x,pe,"utf-8"),e.overlaysApplied.push(g);let me=[...q.replacedFields.map(C=>`replaced:${C}`),...q.appendedFields.map(C=>`appended:${C}`),...q.configOverrides.map(C=>`config:${C}`)];console.error(`[AgentsInstaller] Applied overlay for ${g}: ${me.join(", ")}`)}catch(I){e.overlayWarnings.push(`Failed to apply overlay for "${g}": ${b(I)}`)}}e.overlaysApplied.length>0&&console.error(`[AgentsInstaller] Applied ${e.overlaysApplied.length} agent overlay(s): ${e.overlaysApplied.join(", ")}`);let a=ne(t,this.projectRoot);if(e.mcpValidationWarnings=a.warnings,a.warnings.length>0){console.error(`[AgentsInstaller] MCP dependency warnings (${a.agentsWithMissingDeps.length} agents affected):`);for(let l of a.warnings.slice(0,10))console.error(` ${l}`);a.warnings.length>10&&console.error(` ... and ${a.warnings.length-10} more warnings`)}return await this.createAgentsIndex(t,e.installed),e}getAvailableAgents(){let e=[];try{let t=K(this.sourceAgentsDir);for(let n of t){let i=d(this.sourceAgentsDir,n),s=oe(i);if(s.isFile()&&n.endsWith(".md"))e.push(n.replace(".md",""));else if(s.isDirectory()&&n==="subagents"){let o=K(i);for(let a of o)a.endsWith(".md")&&e.push(`subagents/${a.replace(".md","")}`)}}}catch{return[]}return e}filterAgents(e){let t=e.filter(n=>(n.includes("/")?n.split("/")[1]:n).startsWith("qe-"));return this.options.include&&this.options.include.length>0&&(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return this.options.include.includes(i)})),this.options.exclude&&this.options.exclude.length>0&&(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return!this.options.exclude.some(s=>i.includes(s)||i.match(new RegExp(s)))})),this.options.installQEAgents||(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return!qe.includes(i)})),this.options.installSubagents||(t=t.filter(n=>!n.startsWith("subagents/"))),t}async installAgent(e,t,n){let i=e.startsWith("subagents/"),s=i?e.split("/")[1]:e,o=d(this.sourceAgentsDir,`${e}.md`),a=i?d(n,`${s}.md`):d(t,`${s}.md`);if(f(a)&&!this.options.overwrite)return null;if(f(o))J(o,a);else throw new Error(`Source file not found: ${o}`);let l=this.getAgentType(s,i),g=this.getAgentDescription(a),c=this.getAgentDomain(s);return{name:s,type:l,description:g,domain:c}}getAgentType(e,t){return t?"v3-subagent":"v3-qe"}copyDirectoryRecursive(e,t){if(!f(e))return;f(t)||D(t,{recursive:!0});let n=K(e);for(let i of n){let s=d(e,i),o=d(t,i);oe(s).isDirectory()?this.copyDirectoryRecursive(s,o):(!f(o)||this.options.overwrite)&&J(s,o)}}async copyHelpersDirectory(e){let t=d(this.sourceAgentsDir,"helpers"),n=d(this.projectRoot,".claude","helpers","v3");f(t)?this.copyDirectoryRecursive(t,n):console.error(`[AgentsInstaller] Helpers source not found: ${t}`)}async copyTemplatesDirectory(e){let t=d(this.sourceAgentsDir,"templates"),n=d(e,"templates");f(t)?this.copyDirectoryRecursive(t,n):console.error(`[AgentsInstaller] Templates source not found: ${t}`)}getAgentDescription(e){if(f(e))try{let t=ae(e,"utf-8"),n=t.match(/description:\s*["']?([^"'\n]+)["']?/i);if(n)return n[1].trim();let i=t.split(`
61
+ ---`)}var qe=["qe-test-architect","qe-bdd-generator","qe-property-tester","qe-mutation-tester","qe-test-idea-rewriter","qe-quality-criteria-recommender","qe-parallel-executor","qe-flaky-hunter","qe-retry-handler","qe-coverage-specialist","qe-gap-detector","qe-quality-gate","qe-code-complexity","qe-deployment-advisor","qe-risk-assessor","qe-defect-predictor","qe-regression-analyzer","qe-root-cause-analyzer","qe-impact-analyzer","qe-requirements-validator","qe-qx-partner","qe-product-factors-assessor","qe-code-intelligence","qe-kg-builder","qe-dependency-mapper","qe-security-scanner","qe-security-auditor","qe-pentest-validator","qe-contract-validator","qe-graphql-tester","qe-visual-tester","qe-accessibility-auditor","qe-responsive-tester","qe-chaos-engineer","qe-load-tester","qe-performance-tester","qe-learning-coordinator","qe-pattern-learner","qe-metrics-optimizer","qe-transfer-specialist","qe-soap-tester","qe-sap-rfc-tester","qe-sap-idoc-tester","qe-odata-contract-tester","qe-middleware-validator","qe-message-broker-tester","qe-sod-analyzer","qe-fleet-commander","qe-queen-coordinator","qe-tdd-specialist","qe-integration-tester","qe-integration-architect"],Te=["qe-code-reviewer","qe-integration-reviewer","qe-performance-reviewer","qe-security-reviewer","qe-tdd-red","qe-tdd-green","qe-tdd-refactor"],Y=class{projectRoot;options;sourceAgentsDir;constructor(e){this.projectRoot=e.projectRoot,this.options={installQEAgents:!0,installSubagents:!0,overwrite:!1,exclude:[],include:void 0,...e},this.sourceAgentsDir=this.findSourceAgentsDir()}findSourceAgentsDir(){let e=k(import.meta.url),t=[];e&&(t.push(d(e,"assets/agents/v3")),t.push(d(e,".claude/agents/v3"))),t.push(d(this.projectRoot,"node_modules/agentic-qe/assets/agents/v3"));for(let n of t)if(f(n))return n;return t[0]}preserveOverridesDir(){let e=d(this.projectRoot,".claude","agent-overrides");f(e)||D(e,{recursive:!0});let t=d(e,"_example.yaml");if(!f(t))try{let n=k(import.meta.url),i=[...n?[d(n,"assets","templates","agent-override-example.yaml")]:[],d(this.projectRoot,"node_modules","agentic-qe","assets","templates","agent-override-example.yaml")];for(let s of i)if(f(s)){J(s,t);break}}catch{}}async install(){let e={installed:[],skipped:[],errors:[],totalCount:0,agentsDir:d(this.projectRoot,".claude","agents","v3"),overlaysApplied:[],overlayWarnings:[]};if(this.preserveOverridesDir(),!f(this.sourceAgentsDir))return e.errors.push(`Source agents directory not found: ${this.sourceAgentsDir}`),e;let t=d(this.projectRoot,".claude","agents","v3");f(t)||D(t,{recursive:!0});let n=d(t,"subagents");f(n)||D(n,{recursive:!0}),await this.copyHelpersDirectory(t),await this.copyTemplatesDirectory(t);let i=this.getAvailableAgents();e.totalCount=i.length;let s=this.filterAgents(i);for(let l of s)try{let g=await this.installAgent(l,t,n);g?e.installed.push(g):e.skipped.push(l)}catch(g){e.errors.push(`Failed to install ${l}: ${b(g)}`)}let o=te(this.projectRoot);if(o.warnings.length>0){e.overlayWarnings=o.warnings;for(let l of o.warnings)console.error(`[AgentsInstaller] Overlay warning: ${l}`)}if(o.errors.length>0)for(let l of o.errors)e.errors.push(`Overlay error: ${l}`);for(let l of o.overlays){let g=l.agent,x=Te.includes(g)?d(n,`${g}.md`):d(t,`${g}.md`);if(!f(x)){e.overlayWarnings.push(`Overlay for "${g}" found but agent file does not exist. Skipping.`);continue}try{let I=ae(x,"utf-8"),{content:de,applied:q}=ne(I,l),pe=Ie(de);le(x,pe,"utf-8"),e.overlaysApplied.push(g);let me=[...q.replacedFields.map(C=>`replaced:${C}`),...q.appendedFields.map(C=>`appended:${C}`),...q.configOverrides.map(C=>`config:${C}`)];console.error(`[AgentsInstaller] Applied overlay for ${g}: ${me.join(", ")}`)}catch(I){e.overlayWarnings.push(`Failed to apply overlay for "${g}": ${b(I)}`)}}e.overlaysApplied.length>0&&console.error(`[AgentsInstaller] Applied ${e.overlaysApplied.length} agent overlay(s): ${e.overlaysApplied.join(", ")}`);let a=ee(t,this.projectRoot);if(e.mcpValidationWarnings=a.warnings,a.warnings.length>0){console.error(`[AgentsInstaller] MCP dependency warnings (${a.agentsWithMissingDeps.length} agents affected):`);for(let l of a.warnings.slice(0,10))console.error(` ${l}`);a.warnings.length>10&&console.error(` ... and ${a.warnings.length-10} more warnings`)}return await this.createAgentsIndex(t,e.installed),e}getAvailableAgents(){let e=[];try{let t=K(this.sourceAgentsDir);for(let n of t){let i=d(this.sourceAgentsDir,n),s=oe(i);if(s.isFile()&&n.endsWith(".md"))e.push(n.replace(".md",""));else if(s.isDirectory()&&n==="subagents"){let o=K(i);for(let a of o)a.endsWith(".md")&&e.push(`subagents/${a.replace(".md","")}`)}}}catch{return[]}return e}filterAgents(e){let t=e.filter(n=>(n.includes("/")?n.split("/")[1]:n).startsWith("qe-"));return this.options.include&&this.options.include.length>0&&(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return this.options.include.includes(i)})),this.options.exclude&&this.options.exclude.length>0&&(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return!this.options.exclude.some(s=>i.includes(s)||i.match(new RegExp(s)))})),this.options.installQEAgents||(t=t.filter(n=>{let i=n.includes("/")?n.split("/")[1]:n;return!qe.includes(i)})),this.options.installSubagents||(t=t.filter(n=>!n.startsWith("subagents/"))),t}async installAgent(e,t,n){let i=e.startsWith("subagents/"),s=i?e.split("/")[1]:e,o=d(this.sourceAgentsDir,`${e}.md`),a=i?d(n,`${s}.md`):d(t,`${s}.md`);if(f(a)&&!this.options.overwrite)return null;if(f(o))J(o,a);else throw new Error(`Source file not found: ${o}`);let l=this.getAgentType(s,i),g=this.getAgentDescription(a),c=this.getAgentDomain(s);return{name:s,type:l,description:g,domain:c}}getAgentType(e,t){return t?"v3-subagent":"v3-qe"}copyDirectoryRecursive(e,t){if(!f(e))return;f(t)||D(t,{recursive:!0});let n=K(e);for(let i of n){let s=d(e,i),o=d(t,i);oe(s).isDirectory()?this.copyDirectoryRecursive(s,o):(!f(o)||this.options.overwrite)&&J(s,o)}}async copyHelpersDirectory(e){let t=d(this.sourceAgentsDir,"helpers"),n=d(this.projectRoot,".claude","helpers","v3");f(t)?this.copyDirectoryRecursive(t,n):console.error(`[AgentsInstaller] Helpers source not found: ${t}`)}async copyTemplatesDirectory(e){let t=d(this.sourceAgentsDir,"templates"),n=d(e,"templates");f(t)?this.copyDirectoryRecursive(t,n):console.error(`[AgentsInstaller] Templates source not found: ${t}`)}getAgentDescription(e){if(f(e))try{let t=ae(e,"utf-8"),n=t.match(/description:\s*["']?([^"'\n]+)["']?/i);if(n)return n[1].trim();let i=t.split(`
62
62
  `);for(let s of i){let o=s.trim();if(o&&!o.startsWith("#")&&!o.startsWith("-")&&!o.startsWith("```")&&!o.startsWith("---"))return o.slice(0,100)+(o.length>100?"...":"")}}catch(t){console.debug("[AgentsInstaller] Failed to read agent description:",t instanceof Error?t.message:t)}}getAgentDomain(e){let t={"test-architect":"test-generation","bdd-generator":"test-generation","property-tester":"test-generation","mutation-tester":"test-generation","parallel-executor":"test-execution","flaky-hunter":"test-execution","retry-handler":"test-execution","coverage-specialist":"coverage-analysis","gap-detector":"coverage-analysis","quality-gate":"quality-assessment","code-complexity":"quality-assessment","deployment-advisor":"quality-assessment","risk-assessor":"quality-assessment","defect-predictor":"defect-intelligence","regression-analyzer":"defect-intelligence","root-cause-analyzer":"defect-intelligence","impact-analyzer":"defect-intelligence","requirements-validator":"requirements-validation","qx-partner":"requirements-validation","product-factors-assessor":"requirements-validation","quality-criteria-recommender":"requirements-validation","test-idea-rewriter":"test-generation","code-intelligence":"code-intelligence","kg-builder":"code-intelligence","dependency-mapper":"code-intelligence","security-scanner":"security-compliance","security-auditor":"security-compliance","pentest-validator":"security-compliance","contract-validator":"contract-testing","graphql-tester":"contract-testing","visual-tester":"visual-accessibility","accessibility-auditor":"visual-accessibility","responsive-tester":"visual-accessibility","chaos-engineer":"chaos-resilience","load-tester":"chaos-resilience","performance-tester":"chaos-resilience","learning-coordinator":"learning-optimization","pattern-learner":"learning-optimization","metrics-optimizer":"learning-optimization","transfer-specialist":"learning-optimization","soap-tester":"enterprise-integration","sap-rfc-tester":"enterprise-integration","sap-idoc-tester":"enterprise-integration","odata-contract-tester":"enterprise-integration","middleware-validator":"enterprise-integration","message-broker-tester":"enterprise-integration","sod-analyzer":"enterprise-integration"},n=e.replace(/^(v3-)?qe-/,"");return t[n]}async createAgentsIndex(e,t){let n=t.filter(l=>l.type==="v3-qe"),i=t.filter(l=>l.type==="v3-subagent"),s=new Map;for(let l of n){let g=l.domain||"general";s.has(g)||s.set(g,[]),s.get(g).push(l)}let o=`# AQE V3 Agents Index
63
63
 
64
64
  This directory contains V3 QE agents installed by \`aqe init\`.
@@ -0,0 +1,14 @@
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.11.5");process.exit(0)}
2
+ function l(s,e){let t=s.prepare("SELECT confidence, usage_count, successful_uses FROM qe_patterns WHERE id = ?").get(e.patternId);if(!t)return{updated:!1};let c=e.success?1:0,n=t.usage_count+1,a=t.successful_uses+c,u=a/n,o=Math.min(1,n/100),r=t.confidence*.3+o*.2+u*.5,i=s.prepare(`
3
+ INSERT INTO qe_pattern_usage (pattern_id, success, metrics_json, feedback)
4
+ VALUES (?, ?, ?, ?)
5
+ `),p=s.prepare(`
6
+ UPDATE qe_patterns SET
7
+ usage_count = ?,
8
+ successful_uses = ?,
9
+ success_rate = ?,
10
+ quality_score = ?,
11
+ last_used_at = datetime('now'),
12
+ updated_at = datetime('now')
13
+ WHERE id = ?
14
+ `);return s.transaction(()=>{i.run(e.patternId,c,e.metrics?JSON.stringify(e.metrics):null,e.feedback??null),p.run(n,a,u,r,e.patternId)})(),{updated:!0,usageCount:n,successfulUses:a,successRate:u,qualityScore:r}}export{l as a};
@@ -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.11.4");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.11.5");process.exit(0)}
2
2
  import{readFileSync as O,existsSync as x,readdirSync as A}from"fs";import{join as y,basename as v}from"path";function m(r){let e=[];if(!r||typeof r!="object")return e.push("Overlay must be a non-null object"),e;let t=r;if((!t.agent||typeof t.agent!="string")&&e.push('Overlay must have a string "agent" field'),t.replace!==void 0)if(typeof t.replace!="object"||t.replace===null)e.push('"replace" must be an object');else{let n=t.replace;n.description!==void 0&&typeof n.description!="string"&&e.push('"replace.description" must be a string'),n.domains!==void 0&&!Array.isArray(n.domains)&&e.push('"replace.domains" must be an array'),n.complexity!==void 0&&typeof n.complexity!="string"&&e.push('"replace.complexity" must be a string')}if(t.append!==void 0)if(typeof t.append!="object"||t.append===null)e.push('"append" must be an object');else{let n=t.append;n.instructions!==void 0&&typeof n.instructions!="string"&&e.push('"append.instructions" must be a string'),n.capabilities!==void 0&&!Array.isArray(n.capabilities)&&e.push('"append.capabilities" must be an array'),n.tags!==void 0&&!Array.isArray(n.tags)&&e.push('"append.tags" must be an array')}if(t.config!==void 0)if(typeof t.config!="object"||t.config===null)e.push('"config" must be an object');else{let n=t.config;n.minimumFindings!==void 0&&typeof n.minimumFindings!="number"&&e.push('"config.minimumFindings" must be a number'),n.maxParallelAgents!==void 0&&typeof n.maxParallelAgents!="number"&&e.push('"config.maxParallelAgents" must be a number'),n.preferredFrameworks!==void 0&&!Array.isArray(n.preferredFrameworks)&&e.push('"config.preferredFrameworks" must be an array'),n.needsContext!==void 0&&typeof n.needsContext!="boolean"&&e.push('"config.needsContext" must be a boolean')}return e}var w=".claude/agent-overrides";function $(r){let e={},t=r.split(`
3
3
  `),n=null,i=null,s=null,a=null;for(let o of t){let l=o.replace(/\r$/,"");if(l.trim().startsWith("#")||l.trim()==="")continue;let u=l.length-l.trimStart().length,g=l.trim();if(g.startsWith("- ")){let c=g.slice(2).trim().replace(/^["']|["']$/g,"");s&&s.push(c);continue}if(s&&a){if(i&&n){let c=e[n]||{};c[a]=s,e[n]=c}else if(n){let c=e[n]||{};c[a]=s,e[n]=c}s=null,a=null}let f=g.match(/^(\w[\w.-]*)\s*:\s*(.*)$/);if(!f)continue;let[,p,b]=f,d=b.trim().replace(/^["']|["']$/g,"");if(u===0)d===""||d===void 0?(n=p,i=null,e[p]||(e[p]={})):(e[p]=h(d),n=null,i=null);else if(u<=4&&n)if(d===""||d===void 0)i=p,s=[],a=p;else{let c=e[n]||{};c[p]=h(d),e[n]=c}}if(s&&a&&n){let o=e[n]||{};o[a]=s,e[n]=o}return e}function h(r){if(r==="true")return!0;if(r==="false")return!1;if(r==="null")return null;let e=Number(r);return!isNaN(e)&&r!==""?e:r}function N(r){let e=y(r,w),t={overlays:[],warnings:[],errors:[]};if(!x(e))return t;let n;try{n=A(e).filter(i=>(i.endsWith(".yaml")||i.endsWith(".yml"))&&!i.startsWith("_"))}catch(i){return t.errors.push(`Failed to read overrides directory: ${i.message}`),t}for(let i of n){let s=y(e,i);try{let a=O(s,"utf-8"),o=$(a);if(!o.agent){let u=v(i).replace(/\.(override|customize)\.(yaml|yml)$/,"");o.agent=u}let l=m(o);if(l.length>0){t.warnings.push(`Overlay ${i} has validation issues: ${l.join("; ")}. Loading without overlay.`);continue}t.overlays.push(o)}catch(a){t.warnings.push(`Failed to parse overlay ${i}: ${a.message}. Agent loads without overlay.`)}}return t}function E(r,e){let t=r,n={agentName:e.agent,overlayFile:`${e.agent}.override.yaml`,replacedFields:[],appendedFields:[],configOverrides:[]};if(e.replace){if(e.replace.description){let i=/^(description:\s*).+$/m;i.test(t)&&(t=t.replace(i,`$1${e.replace.description}`),n.replacedFields.push("description"))}if(e.replace.domains){let i=/^(domain:\s*).+$/m;i.test(t)&&(t=t.replace(i,`$1${e.replace.domains.join(", ")}`),n.replacedFields.push("domains"))}if(e.replace.complexity){let i=/^(complexity:\s*).+$/m;i.test(t)&&(t=t.replace(i,`$1${e.replace.complexity}`),n.replacedFields.push("complexity"))}}if(e.append){if(e.append.instructions&&(t+=`
4
4
 
@@ -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.11.5");process.exit(0)}
2
+ import{d as J,e as B,f as te,g as j}from"./chunk-MCHEUSY4.js";import{a as re}from"./chunk-YGVDP6X7.js";import{g as it,h as st}from"./chunk-JBKZ5TUM.js";import{b as De,c as rt}from"./chunk-YFCULQBP.js";import{a as Fe,d as Oe,e as nt,f as Ie}from"./chunk-RJN2RM76.js";import{a as ne}from"./chunk-OS62Y77J.js";import{b as P,c as w}from"./chunk-5WMU7XCF.js";import{a as v,b as xe,c as Ce}from"./chunk-RKXZLTWR.js";import{i as C}from"./chunk-K4I7UIU5.js";import{B as q,D as H,G as ee,P as M,S as F,b as D}from"./chunk-GODAWJMZ.js";import{a as Ae,d as $,f as tt,g as Te}from"./chunk-C4EZNOWK.js";var G=$(E=>{var mt=E&&E.__extends||(function(){var n=function(e,t){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var i in s)s.hasOwnProperty(i)&&(r[i]=s[i])},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(E,"__esModule",{value:!0});var pt=Object.prototype.hasOwnProperty;function le(n,e){return pt.call(n,e)}E.hasOwnProperty=le;function Qe(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 s in n)le(n,s)&&r.push(s);return r}E._objectKeys=Qe;function gt(n){switch(typeof n){case"object":return JSON.parse(JSON.stringify(n));case"undefined":return null;default:return n}}E._deepClone=gt;function yt(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}E.isInteger=yt;function oe(n){return n.indexOf("/")===-1&&n.indexOf("~")===-1?n:n.replace(/~/g,"~0").replace(/\//g,"~1")}E.escapePathComponent=oe;function vt(n){return n.replace(/~1/g,"/").replace(/~0/g,"~")}E.unescapePathComponent=vt;function ue(n,e){var t;for(var r in n)if(le(n,r)){if(n[r]===e)return oe(r)+"/";if(typeof n[r]=="object"&&(t=ue(n[r],e),t!=""))return oe(r)+"/"+t}return""}E._getPathRecursive=ue;function Pt(n,e){if(n===e)return"/";var t=ue(n,e);if(t==="")throw new Error("Object not found in root");return"/"+t}E.getPath=Pt;function ce(n){if(n===void 0)return!0;if(n){if(Array.isArray(n)){for(var e=0,t=n.length;e<t;e++)if(ce(n[e]))return!0}else if(typeof n=="object"){for(var r=Qe(n),s=r.length,i=0;i<s;i++)if(ce(n[r[i]]))return!0}}return!1}E.hasUndefined=ce;function qe(n,e){var t=[n];for(var r in e){var s=typeof e[r]=="object"?JSON.stringify(e[r],null,2):e[r];typeof s<"u"&&t.push(r+": "+s)}return t.join(`
3
+ `)}var wt=(function(n){mt(e,n);function e(t,r,s,i,a){var c=this.constructor,u=n.call(this,qe(t,{name:r,index:s,operation:i,tree:a}))||this;return u.name=r,u.index=s,u.operation=i,u.tree=a,Object.setPrototypeOf(u,c.prototype),u.message=qe(t,{name:r,index:s,operation:i,tree:a}),u}return e})(Error);E.PatchError=wt});var he=$(y=>{Object.defineProperty(y,"__esModule",{value:!0});var R=G();y.JsonPatchError=R.PatchError;y.deepClone=R._deepClone;var L={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=V(t,this.path);r&&(r=R._deepClone(r));var s=O(t,{op:"remove",path:this.from}).removed;return O(t,{op:"add",path:this.path,value:s}),{newDocument:t,removed:r}},copy:function(n,e,t){var r=V(t,this.from);return O(t,{op:"add",path:this.path,value:R._deepClone(r)}),{newDocument:t}},test:function(n,e,t){return{newDocument:t,test:z(n[e],this.value)}},_get:function(n,e,t){return this.value=n[e],{newDocument:t}}},St={add:function(n,e,t){return R.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:L.move,copy:L.copy,test:L.test,_get:L._get};function V(n,e){if(e=="")return n;var t={op:"_get",path:e};return O(n,t),t.value}y.getValueByPointer=V;function O(n,e,t,r,s,i){if(t===void 0&&(t=!1),r===void 0&&(r=!0),s===void 0&&(s=!0),i===void 0&&(i=0),t&&(typeof t=="function"?t(e,0,n,e.path):Y(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=V(n,e.from),e.op==="move"&&(a.removed=n),a;if(e.op==="test"){if(a.test=z(n,e.value),a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,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 y.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",i,e,n);return a}}else{r||(n=R._deepClone(n));var c=e.path||"",u=c.split("/"),o=n,l=1,f=u.length,d=void 0,h=void 0,p=void 0;for(typeof t=="function"?p=t:p=Y;;){if(h=u[l],h&&h.indexOf("~")!=-1&&(h=R.unescapePathComponent(h)),s&&(h=="__proto__"||h=="prototype"&&l>0&&u[l-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&&d===void 0&&(o[h]===void 0?d=u.slice(0,l).join("/"):l==f-1&&(d=e.path),d!==void 0&&p(e,0,n,d)),l++,Array.isArray(o)){if(h==="-")h=o.length;else{if(t&&!R.isInteger(h))throw new y.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",i,e,n);R.isInteger(h)&&(h=~~h)}if(l>=f){if(t&&e.op==="add"&&h>o.length)throw new y.JsonPatchError("The specified index MUST NOT be greater than the number of elements in the array","OPERATION_VALUE_OUT_OF_BOUNDS",i,e,n);var a=St[e.op].call(e,o,h,n);if(a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,e,n);return a}}else if(l>=f){var a=L[e.op].call(e,o,h,n);if(a.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",i,e,n);return a}if(o=o[h],t&&l<f&&(!o||typeof o!="object"))throw new y.JsonPatchError("Cannot perform operation at the desired path","OPERATION_PATH_UNRESOLVABLE",i,e,n)}}}y.applyOperation=O;function ze(n,e,t,r,s){if(r===void 0&&(r=!0),s===void 0&&(s=!0),t&&!Array.isArray(e))throw new y.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");r||(n=R._deepClone(n));for(var i=new Array(e.length),a=0,c=e.length;a<c;a++)i[a]=O(n,e[a],t,!0,s,a),n=i[a].newDocument;return i.newDocument=n,i}y.applyPatch=ze;function bt(n,e,t){var r=O(n,e);if(r.test===!1)throw new y.JsonPatchError("Test operation failed","TEST_OPERATION_FAILED",t,e,n);return r.newDocument}y.applyReducer=bt;function Y(n,e,t,r){if(typeof n!="object"||n===null||Array.isArray(n))throw new y.JsonPatchError("Operation is not an object","OPERATION_NOT_AN_OBJECT",e,n,t);if(L[n.op]){if(typeof n.path!="string")throw new y.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 y.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 y.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 y.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")&&R.hasUndefined(n.value))throw new y.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 s=n.path.split("/").length,i=r.split("/").length;if(s!==i+1&&s!==i)throw new y.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 y.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},c=$e([a],t);if(c&&c.name==="OPERATION_PATH_UNRESOLVABLE")throw new y.JsonPatchError("Cannot perform the operation from a path that does not exist","OPERATION_FROM_UNRESOLVABLE",e,n,t)}}}else throw new y.JsonPatchError("Operation `op` property is not one of operations defined in RFC-6902","OPERATION_OP_INVALID",e,n,t)}y.validator=Y;function $e(n,e,t){try{if(!Array.isArray(n))throw new y.JsonPatchError("Patch sequence must be an array","SEQUENCE_NOT_AN_ARRAY");if(e)ze(R._deepClone(e),R._deepClone(n),t||!0);else{t=t||Y;for(var r=0;r<n.length;r++)t(n[r],r,e,void 0)}}catch(s){if(s instanceof y.JsonPatchError)return s;throw s}}y.validate=$e;function z(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),s,i,a;if(t&&r){if(i=n.length,i!=e.length)return!1;for(s=i;s--!==0;)if(!z(n[s],e[s]))return!1;return!0}if(t!=r)return!1;var c=Object.keys(n);if(i=c.length,i!==Object.keys(e).length)return!1;for(s=i;s--!==0;)if(!e.hasOwnProperty(c[s]))return!1;for(s=i;s--!==0;)if(a=c[s],!z(n[a],e[a]))return!1;return!0}return n!==n&&e!==e}y._areEquals=z});var Je=$(k=>{Object.defineProperty(k,"__esModule",{value:!0});var b=G(),Et=he(),fe=new WeakMap,Rt=(function(){function n(e){this.observers=new Map,this.obj=e}return n})(),At=(function(){function n(e,t){this.callback=e,this.observer=t}return n})();function Tt(n){return fe.get(n)}function xt(n,e){return n.observers.get(e)}function Ct(n,e){n.observers.delete(e.callback)}function Dt(n,e){e.unobserve()}k.unobserve=Dt;function Ft(n,e){var t=[],r,s=Tt(n);if(!s)s=new Rt(n),fe.set(n,s);else{var i=xt(s,e);r=i&&i.observer}if(r)return r;if(r={},s.value=b._deepClone(n),e){r.callback=e,r.next=null;var a=function(){de(r)},c=function(){clearTimeout(r.next),r.next=setTimeout(a)};typeof window<"u"&&(window.addEventListener("mouseup",c),window.addEventListener("keyup",c),window.addEventListener("mousedown",c),window.addEventListener("keydown",c),window.addEventListener("change",c))}return r.patches=t,r.object=n,r.unobserve=function(){de(r),clearTimeout(r.next),Ct(s,r),typeof window<"u"&&(window.removeEventListener("mouseup",c),window.removeEventListener("keyup",c),window.removeEventListener("mousedown",c),window.removeEventListener("keydown",c),window.removeEventListener("change",c))},s.observers.set(e,new At(e,r)),r}k.observe=Ft;function de(n,e){e===void 0&&(e=!1);var t=fe.get(n.object);me(t.value,n.object,n.patches,"",e),n.patches.length&&Et.applyPatch(t.value,n.patches);var r=n.patches;return r.length>0&&(n.patches=[],n.callback&&n.callback(r)),r}k.generate=de;function me(n,e,t,r,s){if(e!==n){typeof e.toJSON=="function"&&(e=e.toJSON());for(var i=b._objectKeys(e),a=b._objectKeys(n),c=!1,u=!1,o=a.length-1;o>=0;o--){var l=a[o],f=n[l];if(b.hasOwnProperty(e,l)&&!(e[l]===void 0&&f!==void 0&&Array.isArray(e)===!1)){var d=e[l];typeof f=="object"&&f!=null&&typeof d=="object"&&d!=null&&Array.isArray(f)===Array.isArray(d)?me(f,d,t,r+"/"+b.escapePathComponent(l),s):f!==d&&(c=!0,s&&t.push({op:"test",path:r+"/"+b.escapePathComponent(l),value:b._deepClone(f)}),t.push({op:"replace",path:r+"/"+b.escapePathComponent(l),value:b._deepClone(d)}))}else Array.isArray(n)===Array.isArray(e)?(s&&t.push({op:"test",path:r+"/"+b.escapePathComponent(l),value:b._deepClone(f)}),t.push({op:"remove",path:r+"/"+b.escapePathComponent(l)}),u=!0):(s&&t.push({op:"test",path:r,value:n}),t.push({op:"replace",path:r,value:e}),c=!0)}if(!(!u&&i.length==a.length))for(var o=0;o<i.length;o++){var l=i[o];!b.hasOwnProperty(n,l)&&e[l]!==void 0&&t.push({op:"add",path:r+"/"+b.escapePathComponent(l),value:b._deepClone(e[l])})}}}function Ot(n,e,t){t===void 0&&(t=!1);var r=[];return me(n,e,r,"",t),r}k.compare=Ot});var Be=$(I=>{var It=he();Object.assign(I,It);var Nt=Je();Object.assign(I,Nt);var K=G();I.JsonPatchError=K.PatchError;I.deepClone=K._deepClone;I.escapePathComponent=K.escapePathComponent;I.unescapePathComponent=K.unescapePathComponent});rt();Ce();var Q=class{constructor(e,t){this.createAdapter=e;this.config=t?.base??W,this.rvfPath=t?.rvfPath??".agentic-qe/patterns.rvf",this.skipCloseOnDispose=t?.skipCloseOnDispose??!1}createAdapter;config;rvfPath;skipCloseOnDispose;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(process.env.AQE_MEMORY_BACKEND==="memory"){this.adapter=null,this.initialized=!0;return}try{this.adapter=this.createAdapter(this.rvfPath,this.config.embeddingDimension),this.initialized=!0,console.log(`[RvfPatternStore] Initialized: ${this.rvfPath} (dim=${this.config.embeddingDimension})`)}catch(e){this.rvfInitError=v(e),console.error(`[RvfPatternStore] ERROR: RVF native init failed \u2014 vector search is DISABLED. Cause: ${this.rvfInitError}. Fix: install @ruvector/rvf-node native bindings, or set useRVFPatternStore=false to use SQLite HNSW.`),this.adapter=null,this.initialized=!0}if(!this.sqliteStore)try{let{createSQLitePatternStore:e}=await import("./sqlite-persistence-EU54UTMH.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:s}=await import("node:fs"),i=`${this.rvfPath}.idmap.json`;if(!s(i))return;let a=JSON.parse(r(i,"utf-8")),c=new Set((a.entries??[]).map(l=>Array.isArray(l)?l[0]:void 0).filter(l=>typeof l=="string")),u=new Set(this.sqliteStore.getPatterns({limit:1e4}).map(l=>l.id)),o=[...c].filter(l=>!u.has(l));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: ${v(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=j(e);if(!t.valid)return w(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return w(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));if(this.sqliteStore)try{let r=this.sqliteStore.storePattern(e,e.embedding);r&&r!==e.id&&(e.id=r)}catch(r){console.warn(`[RvfPatternStore] SQLite persist failed for ${e.id}:`,v(r))}if(e.embedding&&this.adapter)try{let r=e.embedding instanceof Float32Array?e.embedding:new Float32Array(e.embedding);this.adapter.ingest([{id:e.id,vector:r}])}catch(r){console.warn(`[RvfPatternStore] RVF ingest failed for ${e.id}:`,v(r))}return P(e.id)}async create(e){let t=e.confidence??.5,r=e.qeDomain??"test-generation",s={id:C(),patternType:e.patternType,qeDomain:r,domain:r,name:e.name,description:e.description,confidence:t,usageCount:0,successRate:0,qualityScore:J({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},i=await this.store(s);return i.success?P(s):w(i.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(),s=t.limit??10,i=[];if(Array.isArray(e)&&this.adapter)try{let c=e instanceof Float32Array?e:new Float32Array(e),u=this.adapter.search(c,s*2);for(let o of u){let l=await this.get(o.id);if(l&&this.matchesFilters(l,t)){let f=this.calculateReuseInfo(l,o.score);i.push({pattern:l,score:o.score,matchType:"vector",similarity:o.score,canReuse:f.canReuse,estimatedTokenSavings:f.estimatedTokenSavings,reuseConfidence:f.reuseConfidence})}}}catch(c){console.warn("[RvfPatternStore] RVF search failed:",v(c))}if(Array.isArray(e)&&!this.adapter&&this.sqliteStore&&i.length===0)try{let c=this.sqliteStore.getPatterns({limit:s*4}),u=e,o=Math.sqrt(u.reduce((l,f)=>l+f*f,0));if(o>0)for(let l of c){if(!this.matchesFilters(l,t))continue;let f=this.sqliteStore.getPattern(l.id),d=f?.embedding;if(!d||d.length!==u.length)continue;let h=0,p=0;for(let S=0;S<u.length;S++)h+=u[S]*d[S],p+=d[S]*d[S];if(p=Math.sqrt(p),p===0)continue;let m=h/(o*p),g=this.calculateReuseInfo(f,m);i.push({pattern:f,score:m,matchType:"vector",similarity:m,canReuse:g.canReuse,estimatedTokenSavings:g.estimatedTokenSavings,reuseConfidence:g.reuseConfidence})}}catch{}if(typeof e=="string"&&!e.trim()&&this.sqliteStore)try{let c=this.sqliteStore.getPatterns({limit:s*2}),u=new Set(i.map(o=>o.pattern.id));for(let o of c){if(u.has(o.id)||!this.matchesFilters(o,t))continue;let l=this.calculateReuseInfo(o,o.confidence);i.push({pattern:o,score:o.confidence,matchType:"exact",similarity:o.confidence,canReuse:l.canReuse,estimatedTokenSavings:l.estimatedTokenSavings,reuseConfidence:l.reuseConfidence})}}catch{}if(typeof e=="string"&&e.trim()&&this.sqliteStore)try{let c=this.sqliteStore.searchFTS(e,s*2),u=new Set(i.map(o=>o.pattern.id));for(let o of c){if(u.has(o.id))continue;let l=await this.get(o.id);if(l&&this.matchesFilters(l,t)){let f=this.calculateReuseInfo(l,o.ftsScore);i.push({pattern:l,score:.5*o.ftsScore,matchType:"exact",similarity:o.ftsScore,canReuse:f.canReuse,estimatedTokenSavings:f.estimatedTokenSavings,reuseConfidence:f.reuseConfidence})}}}catch{}i.sort((c,u)=>u.score-c.score);let a=performance.now()-r;return this.searchOps++,this.totalSearchMs+=a,P(i.slice(0,s))}async recordUsage(e,t,r,s){if(!this.sqliteStore)return w(new Error("No SQLite store attached"));try{return this.sqliteStore.recordUsage(e,t,r,s),P(void 0)}catch(i){return w(new Error(`recordUsage failed: ${v(i)}`))}}async promote(e){if(!this.sqliteStore)return w(new Error("No SQLite store attached"));try{return this.sqliteStore.promotePattern(e),P(void 0)}catch(t){return w(new Error(`promote failed: ${v(t)}`))}}async delete(e){if(this.adapter)try{this.adapter.delete([e])}catch(t){console.warn(`[RvfPatternStore] RVF delete failed for ${e}:`,v(t))}if(this.sqliteStore)try{this.sqliteStore.deletePattern(e)}catch(t){return w(new Error(`SQLite delete failed: ${v(t)}`))}return P(void 0)}async getStats(){let e=this.adapter?.status(),t=0,r={},s={shortTerm:0,longTerm:0};if(this.sqliteStore)try{let i=this.sqliteStore.getStats();t=i.totalPatterns,r=i.byDomain,s={shortTerm:i.byTier["short-term"]??0,longTerm:i.byTier["long-term"]??0}}catch{}return{totalPatterns:t,byTier:s,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 s of r)s.confidence<this.config.minConfidence&&s.usageCount>3?(await this.delete(s.id),e++):s.tier==="short-term"&&s.successfulUses>=B&&(await this.promote(s.id),t++)}catch(r){console.warn("[RvfPatternStore] Cleanup error:",v(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,s=r.enabled&&t>=r.minSimilarityForReuse&&e.successRate>=r.minSuccessRateForReuse;return{canReuse:s,estimatedTokenSavings:s?500:0,reuseConfidence:s?t*e.successRate:0}}};Ie();Ce();F();function ot(n,e){let r=[n.pattern,n];for(let s of r){let i=e.split("."),a=s;for(let c of i){if(a==null)break;if(typeof a=="object")a=a[c];else{a=void 0;break}}if(a!==void 0)return a}}function ct(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 i=n.getTime(),a=t[0]instanceof Date?t[0].getTime():Number(t[0]),c=t[1]instanceof Date?t[1].getTime():Number(t[1]);return i>=a&&i<=c}return!1}let[r,s]=t;return n>=r&&n<=s}default:return!1}}function X(n,e){switch(e.type){case"AND":return(e.children??[]).every(r=>X(n,r));case"OR":{let t=e.children??[];return t.length===0?!0:t.some(r=>X(n,r))}case"NOT":return e.child?!X(n,e.child):!0;case"FIELD":{if(!e.field||!e.operator)return!0;let t=ot(n,e.field);return ct(t,e.operator,e.value)}default:return!0}}function Ne(n,e){return e?n.filter(t=>X(t,e)):n}F();F();var He=1e4,Me=2166136261;function Le(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 ae=new Uint8Array(256);for(let n=0;n<256;n++){let e=0,t=n;for(;t;)e++,t&=t-1;ae[n]=e}var _e="0123456789abcdef";function lt(n){let e=Math.min(n.length,16),t="";for(let r=0;r<e;r++){let s=n[r];t+=_e[s>>4]+_e[s&15]}return t}function ut(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 ht(n){if(n.length===0)throw new Error("Cannot bundle zero vectors");let e=n[0].length;for(let s=1;s<n.length;s++)if(n[s].length!==e)throw new Error(`Vector length mismatch at index ${s}: expected ${e}, got ${n[s].length}`);let t=new Uint8Array(e),r=n.length/2;for(let s=0;s<e;s++){let i=0;for(let a=0;a<8;a++){let c=0,u=1<<a;for(let o=0;o<n.length;o++)n[o][s]&u&&c++;c>=r&&(i|=u)}t[s]=i}return t}function dt(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 i=0;i<n.length;i++)r+=ae[n[i]^e[i]];let s=t??n.length*8;return s>0?r/s:0}function ft(n,e,t){return 1-dt(n,e,t)}var ie=class{dimensions;baseSeed;byteLen;tokenCache=new Map;constructor(e){if(this.dimensions=e?.dimensions??He,this.baseSeed=e?.seed??Me,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=Le(e)^this.baseSeed,s=this.generateSeededVector(r);return this.tokenCache.set(e,s),new Uint8Array(s)}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=ut(t,this.tokenToHypervector(e[r]));return t}fingerprintWithContext(e,t){let r=this.fingerprintPattern(e);if(t.length===0)return r;let s=this.fingerprintPattern(t);return ht([r,s])}similarity(e,t){return ft(e,t,this.dimensions)}generateSeededVector(e){let t=new Uint8Array(this.byteLen),r=new re(e),s=0;for(;s<this.byteLen;){let a=r.next(),c=Math.min(4,this.byteLen-s);for(let u=0;u<c;u++)t[s++]=a>>>u*8&255}let i=this.dimensions%8;return i>0&&(t[this.byteLen-1]&=(1<<i)-1),t}},se=class{dimensions;baseSeed;constructor(e){if(this.dimensions=e?.dimensions??He,this.baseSeed=e?.seed??Me,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=Le(t)^this.baseSeed,s=this.generateVector(r);return{vector:s,dimensions:this.dimensions,hash:lt(s)}}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 s=0;s<e.length;s++)r[s]=e[s]^t[s];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 s=0;s<e.length;s++)r+=ae[e[s]^t[s]];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),s=new re(e),i=0;for(;i<t;){let c=s.next(),u=t-i,o=u<4?u:4;for(let l=0;l<o;l++)r[i++]=c>>>l*8&255}let a=this.dimensions%8;return a>0&&(r[t-1]&=(1<<a)-1),r}};function ke(n){return new se(n)}function Ue(n){return q()?new ie(n):null}var ge=tt(Be(),1),pe=ge.default??ge,_t=`
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 je(n,e){let t=pe.compare(n,e),r=pe.compare(e,n);return{forward:t,reverse:r}}function Ht(n,e){let t=JSON.parse(JSON.stringify(n));return pe.applyPatch(t,e).newDocument}function We(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 Z=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(_t),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 s=this.getCurrentVersion(e);if(s>=0)throw new Error(`Genesis already exists for pattern ${e} (current version: ${s})`);let i={id:C(),patternId:e,version:0,timestamp:Date.now(),type:"genesis",patch:[],reversePatch:[],metadata:{...r,snapshot:t}};return this.insertEvent(i),i}recordDelta(e,t,r,s){this.ensureInitialized();let i=this.getCurrentVersion(e);if(i<0)throw new Error(`No genesis found for pattern ${e}. Call createGenesis() first.`);let{forward:a,reverse:c}=je(t,r),u={id:C(),patternId:e,version:i+1,timestamp:Date.now(),type:"update",patch:a,reversePatch:c,metadata:s};return this.insertEvent(u),this.enforceRetention(e),u}rollback(e,t){this.ensureInitialized();let r=this.getHistory(e);if(r.length===0)throw new Error(`No history found for pattern ${e}`);let s=r[r.length-1].version;if(t<0||t>s)throw new Error(`Invalid rollback version ${t}. Valid range: 0-${s}`);if(t===s)return this.reconstructState(r,s);let i=this.reconstructState(r,t),a=this.reconstructState(r,s),{forward:c,reverse:u}=je(a,i),o={id:C(),patternId:e,version:s+1,timestamp:Date.now(),type:"rollback",patch:c,reversePatch:u,metadata:{rolledBackTo:t}};return this.insertEvent(o),this.enforceRetention(e),i}getHistory(e){return this.ensureInitialized(),this.prepared.get("getHistory").all(e).map(We)}incrementalSync(e){return this.ensureInitialized(),this.prepared.get("incrementalSync").all(e).map(We)}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(i=>i.type==="genesis");if(!r||!r.metadata?.snapshot)throw new Error("Cannot reconstruct state: no genesis snapshot found");let s=JSON.parse(JSON.stringify(r.metadata.snapshot));for(let i of e)if(i.version!==0){if(i.version>t)break;s=Ht(s,i.patch)}return s}enforceRetention(e){let{maxVersionsPerPattern:t}=this.config,s=this.prepared.get("countForPattern").get(e).cnt;if(s>t){let i=s-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,i)}}};F();var Mt={maxHistoryPerPattern:50,snapshotInterval:10,batchSize:20,epsilon:1e-7},ye=class{config;history=new Map;snapshots=new Map;versions=new Map;buffer=[];constructor(e){this.config={...Mt,...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 s=this.computeSparseChanges(new Array(t.length).fill(0),t),i={patternId:e,version:0,timestamp:Date.now(),deltaType:"genesis",sparseChanges:s,metadata:r,compressedSize:s.length},a={patternId:e,version:0,fullVector:[...t],timestamp:i.timestamp};return this.versions.set(e,0),this.getOrCreate(this.history,e).push(i),this.getOrCreate(this.snapshots,e).push(a),this.buffer.push(i),i}recordDelta(e,t,r,s){let i=this.versions.get(e);if(i===void 0)throw new Error(`No genesis found for pattern ${e}. Call recordGenesis() first.`);let a=i+1,c=this.computeSparseChanges(t,r),u={patternId:e,version:a,timestamp:Date.now(),deltaType:"update",sparseChanges:c,metadata:s,compressedSize:c.length};return this.versions.set(e,a),this.getOrCreate(this.history,e).push(u),this.buffer.push(u),a%this.config.snapshotInterval===0&&this.getOrCreate(this.snapshots,e).push({patternId:e,version:a,fullVector:[...r],timestamp:u.timestamp}),this.enforceRetention(e),u}getHistory(e,t){let r=this.history.get(e);if(!r||r.length===0)return[];let s=[...r].reverse();return t!==void 0&&t>0?s.slice(0,t):s}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 s=this.versions.get(e);if(t<0||t>s)return null;let i=this.snapshots.get(e)||[],a=null;for(let o=i.length-1;o>=0;o--)if(i[o].version<=t){a=i[o];break}if(!a)return null;let c=[...a.fullVector],u=a.version+1;for(let o of r)if(!(o.version<u)){if(o.version>t)break;this.applySparseForward(c,o.sparseChanges)}return c}pruneHistory(e,t){let r=t??this.config.maxHistoryPerPattern,s=this.history.get(e);if(!s||s.length<=r)return 0;let i=s.length-r,a=s.slice(0,i),c=s.slice(i),u=a.findIndex(f=>f.deltaType==="genesis");u>=0&&(c.unshift(a[u]),a.splice(u,1)),this.history.set(e,c);let o=c[0]?.version??0,l=this.snapshots.get(e);return l&&this.snapshots.set(e,l.filter(f=>f.version===0||f.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=[],s=Math.max(e.length,t.length);for(let i=0;i<s;i++){let a=i<e.length?e[i]:0,c=i<t.length?t[i]:0;Math.abs(a-c)>this.config.epsilon&&r.push({index:i,oldValue:a,newValue:c})}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 Xe(n){return H()?new ye(n):null}F();var Lt=128,kt=8,Ut=1e4,ve=class{dimension;beta;maxPatterns;patterns;constructor(e){if(this.dimension=e?.dimension??Lt,this.beta=e?.beta??kt,this.maxPatterns=e?.maxPatterns??Ut,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 s=this.normalize(e);this.patterns.length>=this.maxPatterns&&this.patterns.shift(),this.patterns.push({pattern:s,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 l=0;l<this.patterns.length;l++)r[l]=this.beta*this.dotProduct(this.patterns[l].pattern,t);let s=this.softmax(r),i=0,a=s[0];for(let l=1;l<s.length;l++)s[l]>a&&(a=s[l],i=l);let c=this.patterns[i],u=this.getEnergy(t),o=this.cosineSimilarity(t,c.pattern);return{pattern:new Float32Array(c.pattern),metadata:{...c.metadata},energy:u,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 s=new Float32Array(this.patterns.length),i=-1/0;for(let o=0;o<this.patterns.length;o++)s[o]=this.beta*r[o],s[o]>i&&(i=s[o]);let a=0;for(let o=0;o<this.patterns.length;o++)a+=Math.exp(s[o]-i);let c=1/this.beta*(i+Math.log(a)),u=this.dotProduct(t,t);return-c+.5*u}softmax(e){let t=new Float32Array(e.length),r=-1/0;for(let i=0;i<e.length;i++)e[i]>r&&(r=e[i]);let s=0;for(let i=0;i<e.length;i++)t[i]=Math.exp(e[i]-r),s+=t[i];if(s>0)for(let i=0;i<t.length;i++)t[i]/=s;return t}dotProduct(e,t){let r=0;for(let s=0;s<e.length;s++)r+=e[s]*t[s];return r}cosineSimilarity(e,t){let r=this.dotProduct(e,t),s=Math.sqrt(this.dotProduct(e,e)),i=Math.sqrt(this.dotProduct(t,t));return s===0||i===0?0:r/(s*i)}normalize(e){let t=Math.sqrt(this.dotProduct(e,e)),r=new Float32Array(e.length);if(t>0)for(let s=0;s<e.length;s++)r[s]=e[s]/t;return r}assertEnabled(){if(!D().useHopfieldMemory)throw new Error("Hopfield memory is disabled (useHopfieldMemory feature flag is false)")}};function Ge(n){return new ve(n)}F();var qt={dimensions:32,curvature:-1,maxElements:1e4,efConstruction:200,M:16},N=1e-5,Ve=1-N;function Qt(n,e){let t=0;for(let r=0;r<n.length;r++)t+=n[r]*e[r];return t}function A(n){let e=0;for(let t=0;t<n.length;t++)e+=n[t]*n[t];return e}function zt(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 T=class n{static poincareDistance(e,t){let r=A(zt(e,t)),s=Math.max(N,1-A(e)),i=Math.max(N,1-A(t));return Math.acosh(Math.max(1,1+2*r/(s*i)))}static mobiusAdd(e,t){let r=Qt(e,t),s=A(e),i=A(t),a=Math.max(N,1+2*r+s*i),c=1+2*r+i,u=1-s,o=new Float32Array(e.length);for(let l=0;l<e.length;l++)o[l]=(c*e[l]+u*t[l])/a;return n.project(o)}static expMap(e,t){let r=2/Math.max(N,1-A(e)),s=Math.sqrt(A(t));if(s<N)return new Float32Array(e);let i=Math.tanh(r*s/2),a=new Float32Array(t.length);for(let c=0;c<t.length;c++)a[c]=i/s*t[c];return n.mobiusAdd(e,a)}static project(e){let t=Math.sqrt(A(e));if(t<=Ve)return new Float32Array(e);let r=Ve/t,s=new Float32Array(e.length);for(let i=0;i<e.length;i++)s[i]=e[i]*r;return s}static euclideanToHyperbolic(e){let t=Math.sqrt(A(e));if(t<N)return new Float32Array(e.length);let r=Math.tanh(t)/t,s=new Float32Array(e.length);for(let i=0;i<e.length;i++)s[i]=e[i]*r;return n.project(s)}},Pe=class{config;points=new Map;constructor(e){if(this.config={...qt,...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:T.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=T.project(e),s=[];for(let i of this.points.values())s.push({id:i.id,distance:T.poincareDistance(r,i.coordinates),point:i});return s.sort((i,a)=>i.distance-a.distance),s.slice(0,Math.max(0,t))}embedHierarchy(e){let t=new Map;if(e.length===0)return t;let r=this.config.dimensions,s=new Map,i=new Map,a=[];for(let u of e)if(i.set(u.id,u),!u.parentId)a.push(u.id);else{let o=s.get(u.parentId);o||(o=[],s.set(u.parentId,o)),o.push(u.id)}let c=a.map((u,o)=>({id:u,depth:0,angOff:2*Math.PI*o/Math.max(1,a.length),angSpan:2*Math.PI/Math.max(1,a.length)}));for(;c.length>0;){let{id:u,depth:o,angOff:l,angSpan:f}=c.shift(),d=Math.tanh(.3*(o+.1)),h=l+f/2,p=new Float32Array(r);p[0]=d*Math.cos(h),p[1]=d*Math.sin(h);let m=i.get(u);if(m&&m.features.length>0){let _=d*.1;for(let x=2;x<r&&x-2<m.features.length;x++)p[x]=m.features[x-2]*_}let g=T.project(p);t.set(u,g),this.points.set(u,{id:u,coordinates:g,metadata:{depth:o,parentId:m?.parentId}});let S=s.get(u)??[];for(let _=0;_<S.length;_++){let x=f/Math.max(1,S.length);c.push({id:S[_],depth:o+1,angOff:l+_*x,angSpan:x})}}return t}getStats(){return{elementCount:this.points.size,dimensions:this.config.dimensions,curvature:this.config.curvature}}};function Ye(n){return $t()?new Pe(n):null}function $t(){return D().useHyperbolicHnsw}F();var we=class{index=null;initialized=!1;config;constructor(e){this.config=e??{}}ensureInitialized(){if(this.initialized)return this.index!==null;if(this.initialized=!0,!M())return!1;try{return this.index=Ye(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 s=t instanceof Float32Array?t:new Float32Array(t),i=T.euclideanToHyperbolic(s);this.index.insert(e,i,r)}catch(s){console.debug(`[HyperbolicPatternIndex] Failed to index pattern ${e}:`,s instanceof Error?s.message:s)}}search(e,t){if(!this.ensureInitialized()||!this.index)return[];try{let r=e instanceof Float32Array?e:new Float32Array(e),s=T.euclideanToHyperbolic(r);return this.index.search(s,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 Ke(n){return new we(n)}var Se=null;function Ze(){return Se||(Se=ke({dimensions:1e4})),Se}var be;function Jt(){return be===void 0&&(be=Ue()),be}var U=null,Ee=0;function et(n){return(!U||Ee!==n)&&(U=Ge({dimension:n,maxPatterns:1e4}),Ee=n),U}var W={namespace:"qe-patterns",embeddingDimension:384,hnsw:{M:16,efConstruction:200,efSearch:100,maxElements:5e4},promotionThreshold:B,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}},Re=class{constructor(e,t={}){this.memory=e;this.config={...W,...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;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,H()&&!this.deltaTracker)try{let t=e.getDb();this.deltaTracker=new Z(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(){return this.hnswIndex!==null?this.hnswIndex: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(D().useUnifiedHnsw)try{let{HnswLegacyBridge:a}=await import("./hnsw-legacy-bridge-TPPGBPKF.js"),{HnswAdapter:c}=await import("./hnsw-adapter-EIAA6R2L.js"),u=new c("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(u),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-ZXXP6AXZ.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,s=this.hnswIndex.initialize(),i=new Promise((a,c)=>setTimeout(()=>c(new Error("HNSW init timeout")),r));await Promise.race([s,i]),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:",v(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,s=0;for(let{patternId:i,embedding:a}of e){if(r>=t)break;if(!a||a.length!==this.config.embeddingDimension){s++;continue}let c=this.patternCache.get(i);if(!c){s++;continue}try{await this.hnswIndex.insert(i,a,{filePath:c.patternType,lineCoverage:c.confidence*100,branchCoverage:c.qualityScore*100,functionCoverage:0,statementCoverage:0,uncoveredLineCount:0,uncoveredBranchCount:0,riskScore:1-c.confidence,lastUpdated:Date.now(),totalLines:0}),r++}catch{s++}}r>0&&console.log(`[PatternStore] Loaded ${r} embeddings into HNSW (skipped ${s})`)}catch(e){console.warn("[PatternStore] Failed to load SQLite embeddings into HNSW:",v(e))}}getVectorDeltaTracker(){return this.vectorDeltaTracker===void 0&&(this.vectorDeltaTracker=Xe()),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:",v(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=j(e);if(!t.valid)return w(new Error(`Invalid pattern: ${t.errors.join(", ")}`));if(e.confidence<this.config.minConfidence)return w(new Error(`Pattern confidence ${e.confidence} below threshold ${this.config.minConfidence}`));(this.domainIndex.get(e.qeDomain)?.size||0)>=this.config.maxPatternsPerDomain&&await this.cleanupDomain(e.qeDomain);let s=this.patternCache.get(e.id)??null;if(this.indexPattern(e),this.sqliteStore)try{let i=this.sqliteStore.storePattern(e,e.embedding);i&&i!==e.id&&(this.unindexPattern(e),e.id=i,this.indexPattern(e))}catch(i){console.warn(`[PatternStore] SQLite persist failed for ${e.id}:`,v(i))}if(e.embedding){let i=await this.ensureHNSW();if(i)try{await i.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(a){console.warn(`[PatternStore] Failed to index embedding for ${e.id}:`,a)}}if(q())try{let a=Ze().fingerprint({id:e.id,domain:e.qeDomain,type:e.patternType,content:e.description});this.hdcCache.set(e.id,a.vector)}catch(i){console.debug(`[PatternStore] HDC fingerprint failed for ${e.id}:`,v(i))}try{let i=Jt();if(i){let a=[e.patternType,e.qeDomain];e.context?.tags&&a.push(...e.context.tags),e.name&&a.push(e.name);let c=i.fingerprintPattern(a);this.hdcTokenCache.set(e.id,c)}}catch(i){console.debug(`[PatternStore] HDC token fingerprint failed for ${e.id}:`,v(i))}if(ee()&&e.embedding)try{et(e.embedding.length).store(new Float32Array(e.embedding),{id:e.id,name:e.name,domain:e.qeDomain})}catch(i){console.debug(`[PatternStore] Hopfield store failed for ${e.id}:`,v(i))}if(H()&&this.deltaTracker)try{let i={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,i)}catch(i){console.debug(`[PatternStore] Delta genesis for ${e.id}:`,v(i))}if(e.embedding)try{let i=this.getVectorDeltaTracker();i&&(s?.embedding?i.recordDelta(e.id,s.embedding,e.embedding):i.getVersion(e.id)<0&&i.recordGenesis(e.id,e.embedding))}catch(i){console.debug(`[PatternStore] VectorDeltaTracker for ${e.id}:`,v(i))}try{M()&&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),s={id:C(),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},i=await this.store(s);return i.success?P(s):w(i.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(),s=t.limit||10,i=[];try{if(Array.isArray(e)&&ee())try{let d=et(e.length);if(d.getPatternCount()>0){let h=d.recall(new Float32Array(e));if(h&&h.similarity>.98){let p=h.metadata.id,m=await this.get(p);if(m&&this.matchesFilters(m,t)){let g=this.calculateReuseInfo(m,h.similarity);i.push({pattern:m,score:h.similarity,matchType:"vector",similarity:h.similarity,canReuse:g.canReuse,estimatedTokenSavings:g.estimatedTokenSavings,reuseConfidence:g.reuseConfidence})}}}}catch(d){console.debug("[PatternStore] Hopfield recall failed:",v(d))}if(Array.isArray(e)&&t.useVectorSearch!==!1){let d=await this.ensureHNSW();if(d){let h=await d.search(e,s*2);for(let p of h){let m=await this.get(p.key);if(m&&this.matchesFilters(m,t)){let g=this.calculateReuseInfo(m,p.score);i.push({pattern:m,score:p.score,matchType:"vector",similarity:p.score,canReuse:g.canReuse,estimatedTokenSavings:g.estimatedTokenSavings,reuseConfidence:g.reuseConfidence})}}}}if(typeof e=="string"&&e.trim()&&this.sqliteStore)try{let d=this.sqliteStore.searchFTS(e,s*2);if(d.length>0){let h=new Map(d.map(m=>[m.id,m.ftsScore])),p=new Set(i.map(m=>m.pattern.id));for(let m of i){let g=h.get(m.pattern.id);g!==void 0&&(m.score=.75*m.score+.25*g)}for(let m of d){if(p.has(m.id))continue;let g=await this.get(m.id);if(g&&this.matchesFilters(g,t)){let S=this.calculateReuseInfo(g,m.ftsScore);i.push({pattern:g,score:.5*m.ftsScore,matchType:"exact",similarity:m.ftsScore,canReuse:S.canReuse,estimatedTokenSavings:S.estimatedTokenSavings,reuseConfidence:S.reuseConfidence})}}}}catch{}if(typeof e=="string"||i.length<s){let d=await this.searchByText(typeof e=="string"?e:"",t,s-i.length),h=new Set(i.map(p=>p.pattern.id));for(let p of d)h.has(p.pattern.id)||i.push(p)}let a=720*60*60*1e3,c=Date.now();for(let d of i){let h=d.pattern.lastUsedAt?.getTime()??d.pattern.createdAt.getTime(),p=c-h,m=Math.pow(.5,p/a),g=d.pattern.usageCount>0?m:.5;d.score=d.score*(.7+.3*g)}let u=this.sqliteStore?.getDatabase();if(u&&i.length>0)try{this.nullStore||(this.nullStore=new ne(u));let d=this.nullStore.getNullSummaries(i.map(h=>h.pattern.id));for(let h of i){let p=d.get(h.pattern.id);p&&(h.nullSummary=p,h.score=ne.applyNullDiscount(h.score,p,t.contextFingerprint))}}catch(d){console.debug("[PatternStore] null discount skipped:",v(d))}i.sort((d,h)=>h.score-d.score);let o=i;t.filter&&(o=Ne(i,t.filter));let l=o.slice(0,s),f=performance.now()-r;return this.recordSearchLatency(f),P(l)}catch(a){return w(xe(a))}}async searchByText(e,t,r){let s=[],i=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 c=[...a];if(q()&&i&&this.hdcCache.size>0)try{let u=Ze(),o=u.fingerprint({id:"query",domain:t.domain??"unknown",type:t.patternType??"unknown",content:e}),l=c.filter(h=>this.hdcCache.has(h)).map(h=>({id:h,similarity:u.similarity(o.vector,this.hdcCache.get(h))}));l.sort((h,p)=>p.similarity-h.similarity);let f=l.map(h=>h.id),d=c.filter(h=>!this.hdcCache.has(h));c=[...f,...d]}catch{}for(let u of c){if(s.length>=r)break;let o=this.patternCache.get(u);if(!o||!this.matchesFilters(o,t))continue;let l=0;if(i){let f=o.name.toLowerCase(),d=o.description.toLowerCase();f.includes(i)&&(l+=.5),d.includes(i)&&(i.length/d.length>.3?l+=.5:l+=.3);for(let h of o.context.tags)if(h.toLowerCase().includes(i)){l+=.2;break}l=Math.min(l,1)}else l=o.qualityScore;if(l>0||!i){let f=this.calculateReuseInfo(o,l);s.push({pattern:o,score:l||o.qualityScore,matchType:i?"exact":"context",similarity:l||o.qualityScore,canReuse:f.canReuse,estimatedTokenSavings:f.estimatedTokenSavings,reuseConfidence:f.reuseConfidence})}}return s}calculateReuseInfo(e,t){let{reuseOptimization:r}=this.config,s=t>=r.minSimilarityForReuse,i=e.successRate>=r.minSuccessRateForReuse,a=e.lastUsedAt instanceof Date?e.lastUsedAt.getTime():new Date(e.lastUsedAt).getTime(),u=(Date.now()-a)/(1e3*60*60*24)<=r.maxAgeForReuse,o=r.enabled&&e.reusable&&s&&i&&u,l=o?e.averageTokenSavings>0?e.averageTokenSavings:e.tokensUsed||0:0,f=t,d=e.successRate,h=Math.min(e.reuseCount/10,1),p=o?f*.4+d*.4+h*.2:0;return{canReuse:o,estimatedTokenSavings:l,reuseConfidence:p}}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,s){let i=await this.get(e);if(!i)return w(new Error(`Pattern not found: ${e}`));let a=new Date,c=i.usageCount+1,u=i.successfulUses+(t?1:0),o=u/c,l=t?.02:-.01,f=Math.max(.1,Math.min(1,i.confidence+l)),d=J({confidence:f,usageCount:c,successRate:o}),h={...i,usageCount:c,successfulUses:u,successRate:o,confidence:f,qualityScore:d,lastUsedAt:a};if(this.sqliteStore)try{this.sqliteStore.recordUsage(e,t,r,s)}catch(g){console.warn(`[PatternStore] SQLite recordUsage failed for ${e}:`,v(g))}if(H()&&this.deltaTracker)try{let g={id:i.id,name:i.name,confidence:i.confidence,qualityScore:i.qualityScore,usageCount:i.usageCount,successRate:i.successRate,tier:i.tier},S={id:h.id,name:h.name,confidence:h.confidence,qualityScore:h.qualityScore,usageCount:h.usageCount,successRate:h.successRate,tier:h.tier};this.deltaTracker.recordDelta(e,g,S,{success:t})}catch(g){console.debug(`[PatternStore] Delta recordDelta for ${e}:`,v(g))}let p=te(h);return p.meetsUsageCriteria&&p.meetsQualityCriteria&&p.meetsCoherenceCriteria&&h.tier==="short-term"?await this.promote(e):this.patternCache.set(e,h),P(void 0)}async promote(e){let t=await this.get(e);if(!t)return w(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(s){console.debug("[PatternStore] SQLite promotion error:",s instanceof Error?s.message:s)}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 w(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,l]of this.domainIndex)e[o]=l.size;for(let[o,l]of this.typeIndex)t[o]=l.size;let r=0,s=0,i=0,a=0;for(let o of this.patternCache.values())r+=o.confidence,s+=o.qualityScore,i+=o.successRate,a++;let c=await this.ensureHNSW(),u=c!==null?await c.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?s/a:0,avgSuccessRate:a>0?i/a:0,searchOperations:this.stats.searchOperations,avgSearchLatencyMs:this.calculateAvgLatency(),hnswStats:{nativeAvailable:u.nativeHNSW,vectorCount:u.vectorCount,indexSizeBytes:u.indexSizeBytes}}}async cleanup(){let e=0,t=0,r=[],s=[];for(let i of this.patternCache.values()){let a=te(i);if(a.meetsUsageCriteria&&a.meetsQualityCriteria&&a.meetsCoherenceCriteria){s.push(i.id);continue}if(i.tier==="short-term"){let u=i.createdAt instanceof Date?i.createdAt.getTime():new Date(i.createdAt).getTime(),o=Date.now()-u,l=o>10080*60*1e3,f=i.qualityScore<.2,d=i.usageCount===0&&o>1440*60*1e3;(l&&f||d)&&r.push(i.id)}}for(let i of s)(await this.promote(i)).success&&t++;for(let i of r)(await this.delete(i)).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 c=this.patternCache.get(a);c&&r.push(c)}r.sort((a,c)=>a.qualityScore-c.qualityScore);let s=Math.ceil(r.length*.1),i=0;for(let a of r){if(i>=s)break;a.tier==="short-term"&&(await this.delete(a.id),i++)}}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),U&&(U.clear(),U=null,Ee=0),this.initialized=!1}indexHyperbolic(e,t,r){if(M())try{this.hyperbolicIndex||(this.hyperbolicIndex=Ke({dimensions:this.config.embeddingDimension,maxElements:this.config.hnsw.maxElements})),this.hyperbolicIndex.indexPattern(e,t,r)}catch(s){console.debug(`[PatternStore] Hyperbolic indexing failed for ${e}:`,s instanceof Error?s.message:s)}}async searchHyperbolic(e,t=10){if(!M()||!this.hyperbolicIndex)return P([]);try{let r=this.hyperbolicIndex.search(e,t),s=[];for(let i of r){let a=await this.get(i.patternId);if(!a)continue;let c=Math.exp(-i.distance),u=this.calculateReuseInfo(a,c);s.push({pattern:a,score:c,matchType:"vector",similarity:c,canReuse:u.canReuse,estimatedTokenSavings:u.estimatedTokenSavings,reuseConfidence:u.reuseConfidence})}return P(s)}catch(r){return console.warn("[PatternStore] Hyperbolic search failed, returning empty results:",r instanceof Error?r.message:r),P([])}}};function $r(n,e){try{if(D().useRVFPatternStore&&Oe()){let{existsSync:r}=Ae("fs"),{join:s}=Ae("path"),i=process.env.AQE_PROJECT_ROOT??De(),a=s(i,".agentic-qe"),c=s(a,"patterns.rvf");if(r(a)){let u={...W,...e},o=!1;try{let{getSharedRvfAdapter:l}=(st(),Te(it)),f=l(a,u.embeddingDimension);if(f){o=!0;let d=new Q(()=>f,{rvfPath:c,base:u,skipCloseOnDispose:!0});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),d}}catch{}if(!o){let l=new Q((f,d)=>{let{openRvfStore:h}=(Ie(),Te(nt)),p=()=>{try{return h(f)}catch{return null}},m=p();if(m){if(m.dimension()!==d){try{m.close()}catch{}throw new Error(`RVF dimension mismatch (file=${m.dimension()}, requested=${d})`)}return m}try{return Fe(f,d)}catch(g){if(m=p(),m&&m.dimension()===d)return m;throw g}},{rvfPath:c,base:u});return console.log("[PatternStore] Using RVF-backed store (ADR-066)"),l}}}}catch(t){console.warn("[PatternStore] RVF store unavailable, using in-memory HNSW:",t instanceof Error?t.message:t)}return new Re(n,e)}export{$r as a};
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,12 +1,12 @@
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.11.4");process.exit(0)}
2
- import{a as v}from"./chunk-IF3HPQNV.js";import{a as h}from"./chunk-XXRTWG7O.js";import{c as E}from"./chunk-6GYGAW53.js";import{a as y,c as k}from"./chunk-PEIQDQXN.js";k();h();var l=E.create("qe-hooks"),u={PreTestGeneration:"qe:pre-test-generation",PostTestGeneration:"qe:post-test-generation",TestExecutionResult:"qe:test-execution-result",PreCoverageAnalysis:"qe:pre-coverage-analysis",PostCoverageAnalysis:"qe:post-coverage-analysis",CoverageGapIdentified:"qe:coverage-gap-identified",QEAgentRouting:"qe:agent-routing",QEAgentCompletion:"qe:agent-completion",QualityScoreCalculated:"qe:quality-score",RiskAssessmentComplete:"qe:risk-assessment",PatternLearned:"qe:pattern-learned",PatternApplied:"qe:pattern-applied",PatternPromoted:"qe:pattern-promoted",PreCompaction:"qe:pre-compaction"};function Q(i){return{[u.PreTestGeneration]:async t=>{let{targetFile:s,testType:a,framework:e,language:r}=t.data,n=await i.routeTask({task:`Generate ${a} tests for ${s}`,taskType:"test-generation",context:{framework:e,language:r,testType:a}});if(!n.success)return{success:!1,error:n.error.message};let o=[];try{let{getUnifiedMemory:c}=await import("./unified-memory-X7OJYGSD.js");o=c().getDatabase().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.11.5");process.exit(0)}
2
+ import{a as v}from"./chunk-MCHEUSY4.js";import{a as h}from"./chunk-ZMPAM4DY.js";import{c as E}from"./chunk-Y25PO65W.js";import{a as y,c as k}from"./chunk-RKXZLTWR.js";k();h();var l=E.create("qe-hooks"),u={PreTestGeneration:"qe:pre-test-generation",PostTestGeneration:"qe:post-test-generation",TestExecutionResult:"qe:test-execution-result",PreCoverageAnalysis:"qe:pre-coverage-analysis",PostCoverageAnalysis:"qe:post-coverage-analysis",CoverageGapIdentified:"qe:coverage-gap-identified",QEAgentRouting:"qe:agent-routing",QEAgentCompletion:"qe:agent-completion",QualityScoreCalculated:"qe:quality-score",RiskAssessmentComplete:"qe:risk-assessment",PatternLearned:"qe:pattern-learned",PatternApplied:"qe:pattern-applied",PatternPromoted:"qe:pattern-promoted",PreCompaction:"qe:pre-compaction"};function Q(i){return{[u.PreTestGeneration]:async t=>{let{targetFile:s,testType:a,framework:e,language:r}=t.data,n=await i.routeTask({task:`Generate ${a} tests for ${s}`,taskType:"test-generation",context:{framework:e,language:r,testType:a}});if(!n.success)return{success:!1,error:n.error.message};let o=[];try{let{getUnifiedMemory:c}=await import("./unified-memory-CJLMC2I4.js");o=c().getDatabase().prepare(`
3
3
  SELECT u.pattern_id, u.success, u.feedback
4
4
  FROM qe_pattern_usage u
5
5
  JOIN qe_patterns p ON u.pattern_id = p.id
6
6
  WHERE p.qe_domain = 'test-generation'
7
7
  ORDER BY u.created_at DESC
8
8
  LIMIT 10
9
- `).all()}catch{}return{success:!0,routing:n.value,guidance:n.value.guidance,data:{recommendedAgent:n.value.recommendedAgent,patterns:n.value.patterns.map(c=>c.id),recentExperiences:o}}},[u.PostTestGeneration]:async t=>{let{targetFile:s,generatedTests:a,testCount:e,framework:r,language:n,success:o,patternId:c}=t.data,d=0;if(c&&await i.recordOutcome({patternId:c,success:o,metrics:{testsPassed:0,testsFailed:0}}),o&&a&&e>0)try{(await i.storePattern({patternType:"test-template",name:`Generated tests for ${s.split("/").pop()}`,description:`Test template extracted from successful test generation for ${s}`,template:{type:"code",content:a,variables:[]},context:{framework:r,language:n,testType:"unit",tags:["generated","test-template",r,n]}})).success&&(d=1)}catch(p){l.debug("Pattern learning failed",{error:p instanceof Error?p.message:String(p)})}return{success:!0,patternsLearned:d,data:{learned:d>0}}},[u.TestExecutionResult]:async t=>{let{runId:s,patternId:a,passed:e,failed:r,duration:n,flaky:o}=t.data;if(a){let c=e+r>0?e/(e+r):0;await i.recordOutcome({patternId:a,success:c>.8&&!o,metrics:{testsPassed:e,testsFailed:r,executionTimeMs:n}})}return{success:!0,data:{runId:s,successRate:e+r>0?e/(e+r):0}}},[u.PreCoverageAnalysis]:async t=>{let{targetPath:s,currentCoverage:a}=t.data,e=await i.routeTask({task:`Analyze coverage gaps for ${s} (current: ${a}%)`,taskType:"analysis",domain:"coverage-analysis"});if(!e.success)return{success:!1,error:e.error.message};let r=[];try{let{getUnifiedMemory:n}=await import("./unified-memory-X7OJYGSD.js");r=n().getDatabase().prepare(`
9
+ `).all()}catch{}return{success:!0,routing:n.value,guidance:n.value.guidance,data:{recommendedAgent:n.value.recommendedAgent,patterns:n.value.patterns.map(c=>c.id),recentExperiences:o}}},[u.PostTestGeneration]:async t=>{let{targetFile:s,generatedTests:a,testCount:e,framework:r,language:n,success:o,patternId:c}=t.data,d=0;if(c&&await i.recordOutcome({patternId:c,success:o,metrics:{testsPassed:0,testsFailed:0}}),o&&a&&e>0)try{(await i.storePattern({patternType:"test-template",name:`Generated tests for ${s.split("/").pop()}`,description:`Test template extracted from successful test generation for ${s}`,template:{type:"code",content:a,variables:[]},context:{framework:r,language:n,testType:"unit",tags:["generated","test-template",r,n]}})).success&&(d=1)}catch(p){l.debug("Pattern learning failed",{error:p instanceof Error?p.message:String(p)})}return{success:!0,patternsLearned:d,data:{learned:d>0}}},[u.TestExecutionResult]:async t=>{let{runId:s,patternId:a,passed:e,failed:r,duration:n,flaky:o}=t.data;if(a){let c=e+r>0?e/(e+r):0;await i.recordOutcome({patternId:a,success:c>.8&&!o,metrics:{testsPassed:e,testsFailed:r,executionTimeMs:n}})}return{success:!0,data:{runId:s,successRate:e+r>0?e/(e+r):0}}},[u.PreCoverageAnalysis]:async t=>{let{targetPath:s,currentCoverage:a}=t.data,e=await i.routeTask({task:`Analyze coverage gaps for ${s} (current: ${a}%)`,taskType:"analysis",domain:"coverage-analysis"});if(!e.success)return{success:!1,error:e.error.message};let r=[];try{let{getUnifiedMemory:n}=await import("./unified-memory-CJLMC2I4.js");r=n().getDatabase().prepare(`
10
10
  SELECT u.pattern_id, u.success, u.feedback
11
11
  FROM qe_pattern_usage u
12
12
  JOIN qe_patterns p ON u.pattern_id = p.id
@@ -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.11.4");process.exit(0)}
2
- import{f as s,i as o,k as c,m}from"./chunk-TPMBFARK.js";import{a,c as d}from"./chunk-PEIQDQXN.js";import{a as r,e as l}from"./chunk-VCUCD3B5.js";d();m();l();var u={dbPath:s.dbPath,walMode:!0,mmapSize:r.MMAP_SIZE_BYTES,cacheSize:r.CACHE_SIZE_KB,busyTimeout:r.BUSY_TIMEOUT_MS},n=class e{static instance=null;static instancePromise=null;unifiedMemory=null;config;initialized=!1;initPromise=null;constructor(i){this.config={...u,...i}}static getInstance(i){return e.instance||(e.instance=new e(i)),e.instance}static async getInstanceAsync(i){return e.instance?.initialized?e.instance:(e.instancePromise||(e.instancePromise=(async()=>{let t=e.getInstance(i);return await t.initialize(),t})()),e.instancePromise)}static resetInstance(){e.instance&&(e.instance.close(),e.instance=null),e.instancePromise=null,c()}async initialize(){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize()),this.initPromise}async _doInitialize(){if(!this.initialized)try{let i={dbPath:this.config.dbPath,walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,mmapSize:this.config.mmapSize,cacheSize:this.config.cacheSize};this.unifiedMemory=o(i),await this.unifiedMemory.initialize(),this.initialized=!0,console.log(`[UnifiedPersistence] Initialized via UnifiedMemoryManager: ${this.config.dbPath}`)}catch(i){throw this.initPromise=null,new Error(`Failed to initialize UnifiedPersistenceManager: ${a(i)}`)}}getDatabase(){if(!this.unifiedMemory||!this.initialized)throw new Error("UnifiedPersistenceManager not initialized");return this.unifiedMemory.getDatabase()}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(i,t){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.prepare(i,t)}transaction(i){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.transaction(i)}getStats(){if(!this.unifiedMemory)throw new Error("Database not initialized");let i=this.unifiedMemory.getStats();return{tables:i.tables,fileSize:i.fileSize,walSize:i.walSize}}vacuum(){this.getDatabase().exec("VACUUM")}checkpoint(){this.getDatabase().pragma("wal_checkpoint(TRUNCATE)")}close(){this.initialized=!1,console.log("[UnifiedPersistence] Facade closed")}};function g(e){return n.getInstance(e)}async function U(e){let i=g(e);return await i.initialize(),i}function z(){n.resetInstance()}var f=!1;function h(){if(f)return;f=!0;let e=()=>{try{let i=n.instance;i&&i.close()}catch(i){console.debug("[UnifiedPersistence] Cleanup error:",i instanceof Error?i.message:i)}};process.on("beforeExit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)})}h();export{u as a,n as b,g as c,U as d,z as e};
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.11.5");process.exit(0)}
2
+ import{f as s,i as o,k as c,m}from"./chunk-NCSXLMDL.js";import{a,c as d}from"./chunk-RKXZLTWR.js";import{a as r,e as l}from"./chunk-FIPKIIMS.js";d();m();l();var u={dbPath:s.dbPath,walMode:!0,mmapSize:r.MMAP_SIZE_BYTES,cacheSize:r.CACHE_SIZE_KB,busyTimeout:r.BUSY_TIMEOUT_MS},n=class e{static instance=null;static instancePromise=null;unifiedMemory=null;config;initialized=!1;initPromise=null;constructor(i){this.config={...u,...i}}static getInstance(i){return e.instance||(e.instance=new e(i)),e.instance}static async getInstanceAsync(i){return e.instance?.initialized?e.instance:(e.instancePromise||(e.instancePromise=(async()=>{let t=e.getInstance(i);return await t.initialize(),t})()),e.instancePromise)}static resetInstance(){e.instance&&(e.instance.close(),e.instance=null),e.instancePromise=null,c()}async initialize(){if(!this.initialized)return this.initPromise||(this.initPromise=this._doInitialize()),this.initPromise}async _doInitialize(){if(!this.initialized)try{let i={dbPath:this.config.dbPath,walMode:this.config.walMode,busyTimeout:this.config.busyTimeout,mmapSize:this.config.mmapSize,cacheSize:this.config.cacheSize};this.unifiedMemory=o(i),await this.unifiedMemory.initialize(),this.initialized=!0,console.log(`[UnifiedPersistence] Initialized via UnifiedMemoryManager: ${this.config.dbPath}`)}catch(i){throw this.initPromise=null,new Error(`Failed to initialize UnifiedPersistenceManager: ${a(i)}`)}}getDatabase(){if(!this.unifiedMemory||!this.initialized)throw new Error("UnifiedPersistenceManager not initialized");return this.unifiedMemory.getDatabase()}isInitialized(){return this.initialized}getDbPath(){return this.config.dbPath}prepare(i,t){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.prepare(i,t)}transaction(i){if(!this.unifiedMemory)throw new Error("Database not initialized");return this.unifiedMemory.transaction(i)}getStats(){if(!this.unifiedMemory)throw new Error("Database not initialized");let i=this.unifiedMemory.getStats();return{tables:i.tables,fileSize:i.fileSize,walSize:i.walSize}}vacuum(){this.getDatabase().exec("VACUUM")}checkpoint(){this.getDatabase().pragma("wal_checkpoint(TRUNCATE)")}close(){this.initialized=!1,console.log("[UnifiedPersistence] Facade closed")}};function g(e){return n.getInstance(e)}async function U(e){let i=g(e);return await i.initialize(),i}function z(){n.resetInstance()}var f=!1;function h(){if(f)return;f=!0;let e=()=>{try{let i=n.instance;i&&i.close()}catch(i){console.debug("[UnifiedPersistence] Cleanup error:",i instanceof Error?i.message:i)}};process.on("beforeExit",e),process.on("SIGINT",()=>{e(),process.exit(0)}),process.on("SIGTERM",()=>{e(),process.exit(0)})}h();export{u as a,n as b,g as c,U as d,z as e};
@@ -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.11.4");process.exit(0)}
2
- import{b as c,d as p}from"./chunk-VJGHRWMH.js";import{a as f}from"./chunk-Y4AXOHW4.js";p();import{existsSync as l,readFileSync as i}from"node:fs";import{join as a}from"node:path";import{execSync as m}from"node:child_process";var s=null,d=0,g=6e4;function S(){s=null,d=0}function b(e){if(s&&Date.now()-d<g)return s;let n=w(e);return s=n,d=Date.now(),n}function w(e){let n=h(e);if(n)return n;let r=v(e);if(r)return r;let t=k(e);return t||{available:!1}}function h(e){let n=a(e,".mcp.json");if(l(n))try{let o=c(i(n,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let r=a(e,".claude","mcp.json");if(l(r))try{let o=c(i(r,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let t=a(e,".claude","settings.json");if(l(t))try{let o=c(i(t,"utf-8")),u=o.mcpServers||o.mcp?.servers||{};if(u.ruflo||u["claude-flow"]||u["@anthropic/claude-flow"])return{available:!0,method:"mcp-config"}}catch{}return null}function v(e){let n=a(e,"package.json");if(!l(n))return null;try{let r=c(i(n,"utf-8")),t={...r.dependencies,...r.devDependencies};if(t.ruflo||t["@claude-flow/cli"]||t["claude-flow"])return{available:!0,method:"npm-dependency"}}catch{}return null}function k(e){for(let n of["ruflo","@claude-flow/cli"])try{return{available:!0,method:"npx-cached",version:m(`npx --no-install ${n} --version`,{encoding:"utf-8",timeout:5e3,cwd:e,stdio:["pipe","pipe","pipe"]}).trim().match(/\d+\.\d+\.\d+[\w.-]*/)?.[0]}}catch{}return null}function x(){for(let e of["ruflo","@claude-flow/cli"])try{return f.resolve(`${e}/package.json`),e}catch{}return"ruflo"}function P(){return[" Claude Flow not found \u2014 running in standalone mode.",""," Claude Flow adds optional features:"," - SONA trajectory tracking (reinforcement learning)"," - 3-tier model routing (haiku / sonnet / opus)"," - Codebase pretrain analysis",""," To install later:"," npm install -g ruflo"," claude mcp add ruflo -- npx -y ruflo@3.5.18"," aqe init --auto --with-claude-flow"].join(`
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.11.5");process.exit(0)}
2
+ import{b as c,d as p}from"./chunk-CKOF27L7.js";import{a as f}from"./chunk-C4EZNOWK.js";p();import{existsSync as l,readFileSync as i}from"node:fs";import{join as a}from"node:path";import{execSync as m}from"node:child_process";var s=null,d=0,g=6e4;function S(){s=null,d=0}function b(e){if(s&&Date.now()-d<g)return s;let n=w(e);return s=n,d=Date.now(),n}function w(e){let n=h(e);if(n)return n;let r=v(e);if(r)return r;let t=k(e);return t||{available:!1}}function h(e){let n=a(e,".mcp.json");if(l(n))try{let o=c(i(n,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let r=a(e,".claude","mcp.json");if(l(r))try{let o=c(i(r,"utf-8"));if(o.mcpServers?.ruflo||o.mcpServers?.["claude-flow"])return{available:!0,method:"mcp-config"}}catch{}let t=a(e,".claude","settings.json");if(l(t))try{let o=c(i(t,"utf-8")),u=o.mcpServers||o.mcp?.servers||{};if(u.ruflo||u["claude-flow"]||u["@anthropic/claude-flow"])return{available:!0,method:"mcp-config"}}catch{}return null}function v(e){let n=a(e,"package.json");if(!l(n))return null;try{let r=c(i(n,"utf-8")),t={...r.dependencies,...r.devDependencies};if(t.ruflo||t["@claude-flow/cli"]||t["claude-flow"])return{available:!0,method:"npm-dependency"}}catch{}return null}function k(e){for(let n of["ruflo","@claude-flow/cli"])try{return{available:!0,method:"npx-cached",version:m(`npx --no-install ${n} --version`,{encoding:"utf-8",timeout:5e3,cwd:e,stdio:["pipe","pipe","pipe"]}).trim().match(/\d+\.\d+\.\d+[\w.-]*/)?.[0]}}catch{}return null}function x(){for(let e of["ruflo","@claude-flow/cli"])try{return f.resolve(`${e}/package.json`),e}catch{}return"ruflo"}function P(){return[" Claude Flow not found \u2014 running in standalone mode.",""," Claude Flow adds optional features:"," - SONA trajectory tracking (reinforcement learning)"," - 3-tier model routing (haiku / sonnet / opus)"," - Codebase pretrain analysis",""," To install later:"," npm install -g ruflo"," claude mcp add ruflo -- npx -y ruflo@3.5.18"," aqe init --auto --with-claude-flow"].join(`
3
3
  `)}export{S as a,b,x as c,P as d};
@@ -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.11.4");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.11.5");process.exit(0)}
2
2
  var n=["test-generation","test-execution","coverage-analysis","quality-assessment","defect-intelligence","requirements-validation","code-intelligence","security-compliance","contract-testing","visual-accessibility","chaos-resilience","learning-optimization","enterprise-integration","coordination"];function t(e){return{success:!0,value:e}}function r(e){return{success:!1,error:e}}export{n as a,t as b,r as c};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.4");process.exit(0)}
2
- import{a as u,c as v,d as p}from"./chunk-FRFVN6AA.js";import{b as l}from"./chunk-GRQ36XUH.js";import{a}from"./chunk-RCPD6F4R.js";var P=["ollama","onnx","gemini","openrouter","openai","claude","azure-openai","bedrock"];async function x(e={}){if(e.providerManager){let d=v({projectRoot:e.projectRoot,override:e.override,env:e.env}),f=new a(e.providerManager,d);return await f.initialize(),{router:f,resolvedConfig:d,enabledProviders:y(d)}}if(!p({projectRoot:e.projectRoot,env:e.env}))return null;let r=v({projectRoot:e.projectRoot,override:e.override,env:e.env}),o=g(r,e.env??process.env);if(o.length===0)return null;let{primary:n,fallbacks:t}=R(r,o),i={primary:n,fallbacks:t,providers:m(r,o),loadBalancing:"round-robin",global:{enableCostTracking:!0,enableMetrics:!0}},c=new l(i),s=new a(c,r);return await s.initialize(),{router:s,resolvedConfig:r,enabledProviders:o}}function g(e,r=process.env){let o=u(r),n=[],t=i=>{n.includes(i)||!e.providers?.[i]?.enabled||o.has(i)&&n.push(i)};t(e.defaultProvider);for(let i of e.fallbackChain?.entries??[])t(i.provider);for(let i of P)t(i);return n}function y(e){let r=new Set([e.defaultProvider]);for(let o of e.fallbackChain?.entries??[])r.add(o.provider);return Array.from(r)}function R(e,r){if(r.length===0)throw new Error("pickPrimaryAndFallbacks: no enabled providers");let o=r.includes(e.defaultProvider)?e.defaultProvider:r[0],n=r.filter(t=>t!==o);return{primary:o,fallbacks:n}}function m(e,r){let o={};for(let n of r){let t=e.providers?.[n];t&&(o[n]=t)}return o}export{x as a,g as b,R as c};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.5");process.exit(0)}
2
+ import{a as u,c as v,d as p}from"./chunk-C5C4W572.js";import{b as l}from"./chunk-K4C25BWV.js";import{a}from"./chunk-YR2JKBZO.js";var P=["ollama","onnx","gemini","openrouter","openai","claude","azure-openai","bedrock"];async function x(e={}){if(e.providerManager){let d=v({projectRoot:e.projectRoot,override:e.override,env:e.env}),f=new a(e.providerManager,d);return await f.initialize(),{router:f,resolvedConfig:d,enabledProviders:y(d)}}if(!p({projectRoot:e.projectRoot,env:e.env}))return null;let r=v({projectRoot:e.projectRoot,override:e.override,env:e.env}),o=g(r,e.env??process.env);if(o.length===0)return null;let{primary:n,fallbacks:t}=R(r,o),i={primary:n,fallbacks:t,providers:m(r,o),loadBalancing:"round-robin",global:{enableCostTracking:!0,enableMetrics:!0}},c=new l(i),s=new a(c,r);return await s.initialize(),{router:s,resolvedConfig:r,enabledProviders:o}}function g(e,r=process.env){let o=u(r),n=[],t=i=>{n.includes(i)||!e.providers?.[i]?.enabled||o.has(i)&&n.push(i)};t(e.defaultProvider);for(let i of e.fallbackChain?.entries??[])t(i.provider);for(let i of P)t(i);return n}function y(e){let r=new Set([e.defaultProvider]);for(let o of e.fallbackChain?.entries??[])r.add(o.provider);return Array.from(r)}function R(e,r){if(r.length===0)throw new Error("pickPrimaryAndFallbacks: no enabled providers");let o=r.includes(e.defaultProvider)?e.defaultProvider:r[0],n=r.filter(t=>t!==o);return{primary:o,fallbacks:n}}function m(e,r){let o={};for(let n of r){let t=e.providers?.[n];t&&(o[n]=t)}return o}export{x as a,g as b,R as c};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.4");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.11.5");process.exit(0)}
2
2
  import{createRequire as t}from"module";var o=t(import.meta.url),e=o("@huggingface/transformers"),n=e,{RuvectorLayer:i,TensorCompress:a,differentiableSearch:c,hierarchicalForward:s,getCompressionLevel:l,init:p,FlashAttention:m,DotProductAttention:u,MultiHeadAttention:d,HyperbolicAttention:f,LinearAttention:A,MoEAttention:g,SonaEngine:h,pipeline:_}=e||{};export{n as a,i as b,a as c,c as d,s as e,l as f,p as g,m as h,u as i,d as j,f as k,A as l,g as m,h as n,_ as o};
@@ -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.11.4");process.exit(0)}
2
- import{a as w,b as E}from"./chunk-WNMDWP5A.js";import{a as C}from"./chunk-MYMIEQSZ.js";import{a as T}from"./chunk-IF3HPQNV.js";import{l as D,m as F}from"./chunk-TPMBFARK.js";import{a as _,c as A}from"./chunk-PEIQDQXN.js";import{g as O}from"./chunk-Y4AXOHW4.js";import{createHash as M}from"crypto";var $={enabled:!0,maxEntries:500,ttlMs:3600*1e3,persistToDb:!0};function x(o){if(o==null||typeof o!="object")return JSON.stringify(o);if(Array.isArray(o))return"["+o.map(i=>x(i)).join(",")+"]";let e=o;return"{"+Object.keys(e).sort().map(i=>JSON.stringify(i)+":"+x(e[i])).join(",")+"}"}var b=class{cache=new Map;config;hits=0;misses=0;constructor(e){this.config={...$,...e}}computeFingerprint(e,t,r){let i=x({action:t,domain:e,input:r});return M("sha256").update(i).digest("hex").slice(0,16)}get(e){if(!this.config.enabled)return null;let t=this.cache.get(e);return t?Date.now()-t.cachedAt>this.config.ttlMs?(this.cache.delete(e),this.misses++,null):(t.hitCount++,t.lastHitAt=Date.now(),this.hits++,t):(this.misses++,null)}set(e,t,r,i,n){if(!this.config.enabled)return;this.cache.size>=this.config.maxEntries&&this.evictOldest();let s={fingerprint:e,domain:t,action:r,result:i,tokensSaved:n,cachedAt:Date.now(),hitCount:0,lastHitAt:0};this.cache.set(e,s),this.config.persistToDb&&this.persistEntry(s)}loadFromDb(){try{let e=S();if(!e)return;let t=Date.now()-this.config.ttlMs,r=e.prepare(`SELECT key, value FROM kv_store
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.11.5");process.exit(0)}
2
+ import{a as w,b as E}from"./chunk-XLT3FYS7.js";import{a as C}from"./chunk-4XJ2A3HY.js";import{a as T}from"./chunk-MCHEUSY4.js";import{l as D,m as F}from"./chunk-NCSXLMDL.js";import{a as _,c as A}from"./chunk-RKXZLTWR.js";import{g as O}from"./chunk-C4EZNOWK.js";import{createHash as M}from"crypto";var $={enabled:!0,maxEntries:500,ttlMs:3600*1e3,persistToDb:!0};function x(o){if(o==null||typeof o!="object")return JSON.stringify(o);if(Array.isArray(o))return"["+o.map(i=>x(i)).join(",")+"]";let e=o;return"{"+Object.keys(e).sort().map(i=>JSON.stringify(i)+":"+x(e[i])).join(",")+"}"}var b=class{cache=new Map;config;hits=0;misses=0;constructor(e){this.config={...$,...e}}computeFingerprint(e,t,r){let i=x({action:t,domain:e,input:r});return M("sha256").update(i).digest("hex").slice(0,16)}get(e){if(!this.config.enabled)return null;let t=this.cache.get(e);return t?Date.now()-t.cachedAt>this.config.ttlMs?(this.cache.delete(e),this.misses++,null):(t.hitCount++,t.lastHitAt=Date.now(),this.hits++,t):(this.misses++,null)}set(e,t,r,i,n){if(!this.config.enabled)return;this.cache.size>=this.config.maxEntries&&this.evictOldest();let s={fingerprint:e,domain:t,action:r,result:i,tokensSaved:n,cachedAt:Date.now(),hitCount:0,lastHitAt:0};this.cache.set(e,s),this.config.persistToDb&&this.persistEntry(s)}loadFromDb(){try{let e=S();if(!e)return;let t=Date.now()-this.config.ttlMs,r=e.prepare(`SELECT key, value FROM kv_store
3
3
  WHERE namespace = 'session_cache'
4
4
  AND created_at > ?
5
5
  ORDER BY created_at DESC LIMIT ?`).all(t,this.config.maxEntries);for(let i of r)try{let n=JSON.parse(i.value);Date.now()-n.cachedAt<=this.config.ttlMs&&this.cache.set(n.fingerprint,n)}catch{}}catch{}}getStats(){let e=this.hits+this.misses,t=0;for(let r of this.cache.values())t+=r.tokensSaved*r.hitCount;return{size:this.cache.size,hits:this.hits,misses:this.misses,hitRate:e>0?this.hits/e:0,estimatedTokensSaved:t}}clear(){this.cache.clear(),this.hits=0,this.misses=0}invalidateDomain(e){let t=0;for(let[r,i]of this.cache)i.domain===e&&(this.cache.delete(r),this.deletePersisted(i.fingerprint),t++);return t}evictOldest(){let e=null,t=1/0;for(let[r,i]of this.cache)i.cachedAt<t&&(t=i.cachedAt,e=r);e&&this.cache.delete(e)}persistEntry(e){try{let t=S();if(!t)return;t.prepare(`INSERT OR REPLACE INTO kv_store (key, namespace, value, created_at)
@@ -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.11.4");process.exit(0)}
2
- import{c as s}from"./chunk-Y4AXOHW4.js";function A(r=l,o=process.env){let t=o.AQE_OLLAMA_URL??o.OLLAMA_URL??r,e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e-=1;return t.slice(0,e)}var l,n=s(()=>{"use strict";l="http://localhost:11434"});export{A as a,n as 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.11.5");process.exit(0)}
2
+ import{c as s}from"./chunk-C4EZNOWK.js";function A(r=l,o=process.env){let t=o.AQE_OLLAMA_URL??o.OLLAMA_URL??r,e=t.length;for(;e>0&&t.charCodeAt(e-1)===47;)e-=1;return t.slice(0,e)}var l,n=s(()=>{"use strict";l="http://localhost:11434"});export{A as a,n as b};
@@ -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.11.5");process.exit(0)}
2
+ import{a as R}from"./chunk-I3NWKPXJ.js";import{m as T}from"./chunk-NCSXLMDL.js";import{b as S}from"./chunk-YFCULQBP.js";import{a as b,c as P}from"./chunk-RKXZLTWR.js";import{i as h}from"./chunk-K4I7UIU5.js";import{a as M}from"./chunk-SUL3I6QZ.js";T();P();import*as f from"path";import*as c from"fs";function C(){return process.env.AQE_MEMORY_BACKEND==="memory"}var s=null,d=null,g=null;function O(o){g=o}async function x(){return s||d||(d=(async()=>{if(C()){let r=new M;return await r.initialize(),s=r,r}let o=S(),e=f.join(o,".agentic-qe");c.existsSync(e)||c.mkdirSync(e,{recursive:!0});let t=new R({sqlite:{path:f.join(e,"memory.db"),walMode:!0,poolSize:3,busyTimeout:5e3},enableFallback:!0,defaultNamespace:"mcp-tools"});return await t.initialize(),s=t,t})(),d)}function E(){if(g)try{g()}catch{}s&&(s.dispose().catch(()=>{}),s=null),d=null}async function q(o){return o?.memory?o.memory:x()}var m=null,l=null;function L(){let o=(process.env.AQE_LLM_ROUTER_DISABLED??"").trim().toLowerCase();return o?o!=="false"&&o!=="0"&&o!=="no"&&o!=="off":!1}function I(o){m=o,l=null}async function w(){return L()?null:m||l||(l=(async()=>{let{createLLMRouterService:o}=await import("./llm-router-service-XHFKTH3I.js"),e=await o();return e?(m=e.router,m):null})(),l)}function H(){m=null,l=null}async function K(o){return o?.llmRouter?o.llmRouter:await w()??void 0}async function N(o){if(o?.kernel)return o.kernel;try{let{getFleetState:e}=await import("./core-handlers-EEFLLMAZ.js");return e().kernel??void 0}catch{return}}var v={info:(o,e)=>console.log(`[MCP-TOOL] ${o}`,e||""),warn:(o,e)=>console.warn(`[MCP-TOOL] \u26A0\uFE0F ${o}`,e||""),error:(o,e)=>console.error(`[MCP-TOOL] \u274C ${o}`,e||"")},k=class{logger=v;currentDataSource="real";setLogger(e){this.logger=e}markAsDemoData(e,t){this.currentDataSource=e.demoMode?"demo":"fallback",this.logger.warn(`${this.config.name} returning ${this.currentDataSource} data`,{reason:t,requestId:e.requestId,demoMode:e.demoMode})}markAsRealData(){this.currentDataSource="real"}isDemoMode(e){return e.demoMode===!0}validate(e){let t=[];if(typeof e!="object"||e===null)return{valid:!1,errors:["Parameters must be an object"]};let r=e,{properties:i,required:n}=this.config.schema;if(n)for(let a of n)a in r||t.push(`Missing required field: ${a}`);for(let[a,u]of Object.entries(r)){let p=i[a];if(!p)continue;let y=this.validateType(a,u,p);y&&t.push(y)}return{valid:t.length===0,errors:t}}validateType(e,t,r){if(t==null)return null;let i=Array.isArray(t)?"array":typeof t;if(r.type==="array"&&!Array.isArray(t))return`${e} must be an array`;if(r.type!=="array"&&i!==r.type)return`${e} must be of type ${r.type}, got ${i}`;if(r.enum&&!r.enum.includes(t))return`${e} must be one of: ${r.enum.join(", ")}`;if(r.type==="number"){let n=t;if(r.minimum!==void 0&&n<r.minimum)return`${e} must be >= ${r.minimum}`;if(r.maximum!==void 0&&n>r.maximum)return`${e} must be <= ${r.maximum}`}if(r.type==="string"){let n=t;if(r.minLength!==void 0&&n.length<r.minLength)return`${e} must be at least ${r.minLength} characters`;if(r.maxLength!==void 0&&n.length>r.maxLength)return`${e} must be at most ${r.maxLength} characters`}return null}async invoke(e,t={}){let r=Date.now(),i=h();this.currentDataSource="real";let n=this.validate(e);if(!n.valid)return{success:!1,error:`Validation failed: ${n.errors.join("; ")}`,metadata:this.createMetadata(r,i)};let a={requestId:i,startTime:r,streaming:t.streaming,onStream:t.onStream,abortSignal:t.abortSignal,demoMode:t.demoMode,memory:t.memory,llmRouter:t.llmRouter,kernel:t.kernel};try{let u=await this.execute(e,a);return{...u,metadata:{...u.metadata,...this.createMetadata(r,i)}}}catch(u){return{success:!1,error:b(u),metadata:this.createMetadata(r,i)}}}createMetadata(e,t){return{executionTime:Date.now()-e,timestamp:new Date().toISOString(),requestId:t,domain:this.config.domain,toolName:this.config.name,dataSource:this.currentDataSource}}emitStream(e,t){e.streaming&&e.onStream&&e.onStream(t)}isAborted(e){return e.abortSignal?.aborted??!1}get name(){return this.config.name}get description(){return this.config.description}get domain(){return this.config.domain}getSchema(){return this.config.schema}get timeout(){return this.config.timeout??6e4}get supportsStreaming(){return this.config.streaming??!1}resetInstanceCache(){}};export{C as a,O as b,x as c,E as d,q as e,I as f,w as g,H as h,K as i,N as j,v as k,k as l};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.11.4");process.exit(0)}
2
- import{k as m}from"./chunk-ZSA6V5FH.js";import{a as l,c as d}from"./chunk-PEIQDQXN.js";d();var c=class extends m{config={name:"qe/tests/load",description:"Run agent load tests to validate fleet scalability. Supports light, medium, and heavy workload profiles. Uses mock agents by default (safe); set mockMode=false to test with real fleet agents (requires fleet_init). Reports bottlenecks and pass/fail criteria.",domain:"test-execution",schema:this.buildSchema(),timeout:3e5};buildSchema(){return{type:"object",properties:{targetAgents:{type:"number",description:"Target number of concurrent agents to simulate",default:10,minimum:1,maximum:200},profile:{type:"string",description:"Workload profile: light, medium, or heavy",enum:["light","medium","heavy"],default:"medium"},durationMs:{type:"number",description:"Test duration in milliseconds",default:3e4,minimum:5e3,maximum:3e5},mockMode:{type:"boolean",description:"Use mock agents (true, default) or real fleet agents (false, requires fleet_init)",default:!0}}}}async execute(t,u){try{let{createAgentLoadTester:r}=await import("./load-KLAJJGL5.js"),a=t.profile||"medium",o=t.targetAgents||10,i=t.durationMs||3e4,n=t.mockMode!==!1,s=await r({maxAgents:o,workloadProfile:a,mockMode:n}).runTest(o,i),e=s.bottlenecks;return{success:!0,data:{testId:u.requestId,profile:a,targetAgents:o,duration:s.duration,mockMode:n,passed:s.success,bottleneckCount:e?.bottlenecks?.length??0,report:{overallSeverity:e?.overallSeverity??"none",hasCritical:e?.hasCritical??!1,checksPerformed:e?.summary?.totalChecks??0,bottlenecksDetected:e?.summary?.detected??0},summary:`Load test (${a}, ${n?"mock":"real"}): ${o} agents, ${i}ms \u2014 ${s.success?"PASSED":"FAILED"}`+(e?.hasCritical?" [CRITICAL BOTTLENECKS]":"")}}}catch(r){return{success:!1,error:l(r)}}}};export{c 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.11.5");process.exit(0)}
2
+ import{l as m}from"./chunk-6T65OKUM.js";import{a as l,c as d}from"./chunk-RKXZLTWR.js";d();var c=class extends m{config={name:"qe/tests/load",description:"Run agent load tests to validate fleet scalability. Supports light, medium, and heavy workload profiles. Uses mock agents by default (safe); set mockMode=false to test with real fleet agents (requires fleet_init). Reports bottlenecks and pass/fail criteria.",domain:"test-execution",schema:this.buildSchema(),timeout:3e5};buildSchema(){return{type:"object",properties:{targetAgents:{type:"number",description:"Target number of concurrent agents to simulate",default:10,minimum:1,maximum:200},profile:{type:"string",description:"Workload profile: light, medium, or heavy",enum:["light","medium","heavy"],default:"medium"},durationMs:{type:"number",description:"Test duration in milliseconds",default:3e4,minimum:5e3,maximum:3e5},mockMode:{type:"boolean",description:"Use mock agents (true, default) or real fleet agents (false, requires fleet_init)",default:!0}}}}async execute(t,u){try{let{createAgentLoadTester:r}=await import("./load-E6WH4QN2.js"),a=t.profile||"medium",o=t.targetAgents||10,i=t.durationMs||3e4,n=t.mockMode!==!1,s=await r({maxAgents:o,workloadProfile:a,mockMode:n}).runTest(o,i),e=s.bottlenecks;return{success:!0,data:{testId:u.requestId,profile:a,targetAgents:o,duration:s.duration,mockMode:n,passed:s.success,bottleneckCount:e?.bottlenecks?.length??0,report:{overallSeverity:e?.overallSeverity??"none",hasCritical:e?.hasCritical??!1,checksPerformed:e?.summary?.totalChecks??0,bottlenecksDetected:e?.summary?.detected??0},summary:`Load test (${a}, ${n?"mock":"real"}): ${o} agents, ${i}ms \u2014 ${s.success?"PASSED":"FAILED"}`+(e?.hasCritical?" [CRITICAL BOTTLENECKS]":"")}}}catch(r){return{success:!1,error:l(r)}}}};export{c as a};