agentic-qe 3.12.0 → 3.12.1

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 (324) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +35 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/cli/bundle.js +5 -5
  5. package/dist/cli/chunks/adapter-X4UEC6UJ.js +2 -0
  6. package/dist/cli/chunks/{agent-booster-wasm-IO54X6IQ.js → agent-booster-wasm-P4VYM5KK.js} +2 -2
  7. package/dist/cli/chunks/{agent-handler-A57SZUCW.js → agent-handler-PBQ7L2TO.js} +2 -2
  8. package/dist/cli/chunks/{agent-memory-branch-BX7LRFGN.js → agent-memory-branch-UPWO3X6V.js} +2 -2
  9. package/dist/cli/chunks/aqe-learning-engine-5FG7JCY7.js +2 -0
  10. package/dist/cli/chunks/{arena-Y3XTX6O7.js → arena-LEUTILZ7.js} +2 -2
  11. package/dist/cli/chunks/{arena-UTC4YY6Y.js → arena-QYTP3FG6.js} +4 -4
  12. package/dist/cli/chunks/{audit-L4RL2AOY.js → audit-TB6M2YLK.js} +3 -3
  13. package/dist/cli/chunks/base-CWPMFSZG.js +2 -0
  14. package/dist/cli/chunks/{hnswlib-node-VS6L5VUG.js → better-sqlite3-IPKCAVLS.js} +2 -2
  15. package/dist/cli/chunks/{brain-handler-OHDPI5TQ.js → brain-handler-JF3OK35F.js} +3 -3
  16. package/dist/cli/chunks/{branch-enumerator-ZRXE2CQ7.js → branch-enumerator-WEIP3DXB.js} +2 -2
  17. package/dist/cli/chunks/{browser-NT33FG76.js → browser-HY6VLXHZ.js} +2 -2
  18. package/dist/cli/chunks/browser-workflow-A77OFBVY.js +2 -0
  19. package/dist/cli/chunks/{chunk-5FR5GBUT.js → chunk-2PQ7YADF.js} +2 -2
  20. package/dist/cli/chunks/{chunk-VWJSWXHG.js → chunk-3I3Z4C5X.js} +1 -1
  21. package/dist/cli/chunks/{chunk-VMP4M5PB.js → chunk-3W2FZXFD.js} +1 -1
  22. package/dist/cli/chunks/{chunk-RQN4HWGV.js → chunk-42GFB7VX.js} +2 -2
  23. package/dist/cli/chunks/{chunk-36MPDANH.js → chunk-42PYEEYQ.js} +1 -1
  24. package/dist/cli/chunks/{chunk-MBF3Q7FQ.js → chunk-45QNHMTP.js} +1 -1
  25. package/dist/cli/chunks/{chunk-7F7U2HUH.js → chunk-4KI72C2E.js} +1 -1
  26. package/dist/cli/chunks/{chunk-7ZIVDGSN.js → chunk-4LKQZW2H.js} +1 -1
  27. package/dist/cli/chunks/{chunk-TJ6N4CCX.js → chunk-4U5MJX2H.js} +2 -2
  28. package/dist/cli/chunks/{chunk-TED4KOSK.js → chunk-55MQ2SFP.js} +2 -2
  29. package/dist/cli/chunks/{chunk-OPIWFXME.js → chunk-5H5A74U2.js} +1 -1
  30. package/dist/cli/chunks/{chunk-C6GYLCTX.js → chunk-5HMGDB7B.js} +2 -2
  31. package/dist/cli/chunks/{chunk-2UMCB7AH.js → chunk-6432JORM.js} +1 -1
  32. package/dist/cli/chunks/{chunk-KJWQ7ENF.js → chunk-6BCVKCG5.js} +2 -2
  33. package/dist/cli/chunks/{chunk-ZVPAFX4I.js → chunk-6ONUCDVL.js} +2 -2
  34. package/dist/cli/chunks/{chunk-MJPYNGZ7.js → chunk-6RX5QZMU.js} +1 -1
  35. package/dist/cli/chunks/{chunk-SCMXIBI7.js → chunk-74VIADSJ.js} +2 -2
  36. package/dist/cli/chunks/{chunk-6JNNZGI2.js → chunk-75AVUS5U.js} +1 -1
  37. package/dist/cli/chunks/{chunk-FEEMJDUF.js → chunk-774X6OJY.js} +2 -2
  38. package/dist/cli/chunks/{chunk-POKMJTD2.js → chunk-7KHIOWBN.js} +1 -1
  39. package/dist/cli/chunks/{chunk-JOBCMNTP.js → chunk-7KK6XSYK.js} +2 -2
  40. package/dist/cli/chunks/{chunk-RMFRFING.js → chunk-7N2SCRWJ.js} +1 -1
  41. package/dist/cli/chunks/{chunk-CVGXB7IX.js → chunk-AGWKCY42.js} +2 -2
  42. package/dist/cli/chunks/{chunk-5XFX25AJ.js → chunk-BAHXVVX3.js} +2 -2
  43. package/dist/cli/chunks/{chunk-7WX3MKRS.js → chunk-BALFQQB7.js} +2 -2
  44. package/dist/cli/chunks/{chunk-KZMRU7DL.js → chunk-BBNQDHGF.js} +2 -2
  45. package/dist/cli/chunks/{chunk-I6WHYRWB.js → chunk-BCBITOMT.js} +2 -2
  46. package/dist/cli/chunks/{chunk-KN5GOEYK.js → chunk-BKKJEKNT.js} +2 -2
  47. package/dist/cli/chunks/{chunk-W2OMW6UU.js → chunk-BLU7OLQZ.js} +2 -2
  48. package/dist/cli/chunks/{chunk-QJ6H2HQQ.js → chunk-BNMV5DCM.js} +1 -1
  49. package/dist/cli/chunks/{chunk-5VBPIJUZ.js → chunk-BPM7NEHS.js} +4 -4
  50. package/dist/cli/chunks/{chunk-EGH3H7QO.js → chunk-BWNMAXV7.js} +1 -1
  51. package/dist/cli/chunks/{chunk-HW62TB4T.js → chunk-BXIJY6SB.js} +1 -1
  52. package/dist/cli/chunks/{chunk-Q5YRPS4P.js → chunk-C2K4LQI5.js} +1 -1
  53. package/dist/cli/chunks/{chunk-IKVNYK7Y.js → chunk-C7HGYLNF.js} +2 -2
  54. package/dist/cli/chunks/{chunk-3B4XXFKD.js → chunk-CDVKFAYP.js} +2 -2
  55. package/dist/cli/chunks/{chunk-FI5SSLEF.js → chunk-CJTXZI37.js} +2 -2
  56. package/dist/cli/chunks/{chunk-ZWC6CM4R.js → chunk-CP4GSICY.js} +1 -1
  57. package/dist/cli/chunks/{chunk-AEX75YGI.js → chunk-CXUHD2O5.js} +2 -2
  58. package/dist/cli/chunks/{chunk-NW7G57NR.js → chunk-CYYT6YEV.js} +2 -2
  59. package/dist/cli/chunks/{chunk-MK3J7JVZ.js → chunk-D72N5V2S.js} +2 -2
  60. package/dist/cli/chunks/{chunk-KI5BP4X5.js → chunk-DQ3J7ZT6.js} +2 -2
  61. package/dist/cli/chunks/{chunk-IJUYHIKN.js → chunk-DSNFOX22.js} +2 -2
  62. package/dist/cli/chunks/{chunk-VZ67ZDB3.js → chunk-EOBZJDJR.js} +3 -3
  63. package/dist/cli/chunks/{chunk-MUV56BPK.js → chunk-FBYFDD7L.js} +2 -2
  64. package/dist/cli/chunks/{chunk-7HJHXSYT.js → chunk-FFSS3Y6W.js} +2 -2
  65. package/dist/cli/chunks/chunk-FNMEVLSN.js +2 -0
  66. package/dist/cli/chunks/{chunk-BUYPRUNY.js → chunk-GASACVTU.js} +2 -2
  67. package/dist/cli/chunks/{chunk-62RELCU6.js → chunk-GGF5FZWS.js} +1 -1
  68. package/dist/cli/chunks/{chunk-AAATFEIL.js → chunk-GLO53MUQ.js} +2 -2
  69. package/dist/cli/chunks/{chunk-EM2JIIAQ.js → chunk-GW3M7GQH.js} +2 -2
  70. package/dist/cli/chunks/{chunk-PM566XEO.js → chunk-GXMNCW2M.js} +1 -1
  71. package/dist/cli/chunks/{chunk-Y2MCIIJD.js → chunk-HDI3FD4G.js} +1 -1
  72. package/dist/cli/chunks/{chunk-NNGCUJWQ.js → chunk-HGKSU4QV.js} +2 -2
  73. package/dist/cli/chunks/{chunk-2ALNNXFF.js → chunk-HHMTQQUE.js} +2 -2
  74. package/dist/cli/chunks/{chunk-VS4GMNJK.js → chunk-HZGFER4N.js} +3 -3
  75. package/dist/cli/chunks/{chunk-RG552ROA.js → chunk-I4BZLVFE.js} +3 -3
  76. package/dist/cli/chunks/{chunk-27JCWG5J.js → chunk-IC6SOVGO.js} +2 -2
  77. package/dist/cli/chunks/{chunk-L5ZLOW3K.js → chunk-IE6FDICX.js} +2 -2
  78. package/dist/cli/chunks/{chunk-DXOMRWDC.js → chunk-IHWWZOHP.js} +1 -1
  79. package/dist/cli/chunks/{chunk-PQMLIVGV.js → chunk-J4IAMQZI.js} +2 -2
  80. package/dist/cli/chunks/{chunk-ICK3B24H.js → chunk-J6ZCULWG.js} +2 -2
  81. package/dist/cli/chunks/{chunk-WT4ZDDFM.js → chunk-JDZIBSMY.js} +1 -1
  82. package/dist/cli/chunks/{chunk-TC2JE5OK.js → chunk-JIM4VSLF.js} +3 -3
  83. package/dist/cli/chunks/{chunk-CMGYUCM7.js → chunk-JRHRC2MP.js} +1 -1
  84. package/dist/cli/chunks/{chunk-FZIHOMGY.js → chunk-JRNDFC23.js} +2 -2
  85. package/dist/cli/chunks/{chunk-DR7PCO3S.js → chunk-JWZNWVLG.js} +2 -2
  86. package/dist/cli/chunks/{chunk-335GHVJV.js → chunk-KQV5644J.js} +3 -3
  87. package/dist/cli/chunks/{chunk-HDJMD6UH.js → chunk-LAJHHR3Q.js} +1 -1
  88. package/dist/cli/chunks/{chunk-WNASEUBW.js → chunk-LF5XOYR7.js} +10 -10
  89. package/dist/cli/chunks/{chunk-4SALW7OT.js → chunk-LRWBOJ5Y.js} +2 -2
  90. package/dist/cli/chunks/{chunk-BGRJZH5Q.js → chunk-LZ6TJ7XL.js} +2 -2
  91. package/dist/cli/chunks/{chunk-BB4OVXWF.js → chunk-M5P5WNXA.js} +1 -1
  92. package/dist/cli/chunks/{chunk-DQDFACYW.js → chunk-MCUILJ33.js} +1 -1
  93. package/dist/cli/chunks/{chunk-2AR4B3DI.js → chunk-MIAY35K6.js} +2 -2
  94. package/dist/cli/chunks/{chunk-JYXSVSH2.js → chunk-N3PSRG6F.js} +2 -2
  95. package/dist/cli/chunks/{chunk-SPEUF7ZL.js → chunk-NEXJUTHF.js} +2 -2
  96. package/dist/cli/chunks/{chunk-PT3FTGKZ.js → chunk-NHRBKOYD.js} +2 -2
  97. package/dist/cli/chunks/{chunk-JYX7AZHE.js → chunk-NK2Z6FGF.js} +2 -2
  98. package/dist/cli/chunks/{chunk-TJEJ4UVX.js → chunk-NOCPO55P.js} +2 -2
  99. package/dist/cli/chunks/{chunk-6X3RJBA3.js → chunk-NTMN2ZJY.js} +2 -2
  100. package/dist/cli/chunks/{chunk-KZ37VHMJ.js → chunk-NVXSM7UO.js} +2 -2
  101. package/dist/cli/chunks/{chunk-K5SN66B4.js → chunk-O65OPAZH.js} +2 -2
  102. package/dist/cli/chunks/{chunk-UGJQJSPB.js → chunk-OEXSBR72.js} +1 -1
  103. package/dist/cli/chunks/{chunk-O3C5RRDQ.js → chunk-OJORNYN3.js} +3 -3
  104. package/dist/cli/chunks/{chunk-4GU656WM.js → chunk-ONSNNY6J.js} +1 -1
  105. package/dist/cli/chunks/{chunk-XEYW3V5I.js → chunk-OXVAGR64.js} +2 -2
  106. package/dist/cli/chunks/{chunk-IDLNLSQI.js → chunk-P7G5LGUE.js} +2 -2
  107. package/dist/cli/chunks/{chunk-NLHISTL2.js → chunk-PDS5P5QD.js} +2 -2
  108. package/dist/cli/chunks/{chunk-SSXAW3ER.js → chunk-PQ4NSXZM.js} +2 -2
  109. package/dist/cli/chunks/{chunk-DTOE3NYW.js → chunk-PRA73XZY.js} +12 -12
  110. package/dist/cli/chunks/{chunk-64M3FFM4.js → chunk-PZ3Q34OT.js} +2 -2
  111. package/dist/cli/chunks/{chunk-GCF42L7M.js → chunk-PZZDAECU.js} +3 -3
  112. package/dist/cli/chunks/{chunk-G6RKUEGL.js → chunk-QJXUK54J.js} +2 -2
  113. package/dist/cli/chunks/{chunk-WJYTLRA5.js → chunk-QOAI6ETC.js} +3 -3
  114. package/dist/cli/chunks/{chunk-CC5G3K4X.js → chunk-QORWBION.js} +2 -2
  115. package/dist/cli/chunks/{chunk-GGMQOEZZ.js → chunk-QXZOUETY.js} +2 -2
  116. package/dist/cli/chunks/{chunk-TO5PQSDD.js → chunk-QZBPXJ5C.js} +2 -2
  117. package/dist/cli/chunks/{chunk-YKOTOCO6.js → chunk-R4A6PY5D.js} +2 -2
  118. package/dist/cli/chunks/{chunk-ESDGCTC4.js → chunk-R7XEACKR.js} +1 -1
  119. package/dist/cli/chunks/{chunk-BBC526PL.js → chunk-RAS7WRN5.js} +2 -2
  120. package/dist/cli/chunks/{chunk-G6LR7FK7.js → chunk-REJGZP27.js} +2 -2
  121. package/dist/cli/chunks/{chunk-KDLYTJ5C.js → chunk-RIASOMB2.js} +2 -2
  122. package/dist/cli/chunks/{chunk-OHSVDMF7.js → chunk-RJ7TU2MP.js} +1 -1
  123. package/dist/cli/chunks/{chunk-CSEEGX5T.js → chunk-S42RFOZJ.js} +2 -2
  124. package/dist/cli/chunks/{chunk-BA6U7NSR.js → chunk-SFQFBLWQ.js} +1 -1
  125. package/dist/cli/chunks/{chunk-BZPF6GTL.js → chunk-SHKOPOPD.js} +1 -1
  126. package/dist/cli/chunks/{chunk-HAEUPIKW.js → chunk-TGIKKD43.js} +2 -2
  127. package/dist/cli/chunks/{chunk-UVVKFBF7.js → chunk-TMPRR3FZ.js} +2 -2
  128. package/dist/cli/chunks/{chunk-FU5RNEXV.js → chunk-U55X2ZUM.js} +2 -2
  129. package/dist/cli/chunks/{chunk-3AFNXU45.js → chunk-U5ITD7ZD.js} +1 -1
  130. package/dist/cli/chunks/{chunk-RHC7TFPU.js → chunk-UBPJQKYS.js} +2 -2
  131. package/dist/cli/chunks/{chunk-VA7TEOPM.js → chunk-UBWSYDO5.js} +1 -1
  132. package/dist/cli/chunks/chunk-UEC53US3.js +316 -0
  133. package/dist/cli/chunks/{chunk-CHO54B34.js → chunk-UGPBL7LX.js} +2 -2
  134. package/dist/cli/chunks/{chunk-TR5GOGH3.js → chunk-UKF4V7LE.js} +5 -5
  135. package/dist/cli/chunks/{chunk-V2MD5EDD.js → chunk-UR655D4K.js} +2 -2
  136. package/dist/cli/chunks/{chunk-2KHDGC7N.js → chunk-USTUWUCE.js} +2 -2
  137. package/dist/cli/chunks/{chunk-P52YORQG.js → chunk-UZXDYT6O.js} +2 -2
  138. package/dist/cli/chunks/{chunk-72VZGAMJ.js → chunk-VFRWLSQO.js} +1 -1
  139. package/dist/cli/chunks/{chunk-USB44IHJ.js → chunk-VHJCQBD2.js} +2 -2
  140. package/dist/cli/chunks/{chunk-FKPUPQQT.js → chunk-VTFYY4SH.js} +2 -2
  141. package/dist/cli/chunks/{chunk-RZDNCTOA.js → chunk-W52R3G22.js} +2 -2
  142. package/dist/cli/chunks/{chunk-FZRU73M4.js → chunk-WBDV4V3H.js} +2 -2
  143. package/dist/cli/chunks/{chunk-RYUSZ43T.js → chunk-WPEGG6DX.js} +1 -1
  144. package/dist/cli/chunks/{chunk-ZT2WHCVM.js → chunk-WPG5LXR7.js} +2 -2
  145. package/dist/cli/chunks/{chunk-UUOXV3NS.js → chunk-X2CEX4KC.js} +10 -10
  146. package/dist/cli/chunks/{chunk-EZE2HRQB.js → chunk-X2K3BTI4.js} +2 -2
  147. package/dist/cli/chunks/{chunk-C4SZSPXY.js → chunk-XDRAU3W6.js} +2 -2
  148. package/dist/cli/chunks/{chunk-FOPS6DRZ.js → chunk-XJTGLG7G.js} +1 -1
  149. package/dist/cli/chunks/{chunk-Z3W3R4CW.js → chunk-XS6BIOPQ.js} +2 -2
  150. package/dist/cli/chunks/{chunk-G5JQLUUO.js → chunk-XTAXSKPC.js} +2 -2
  151. package/dist/cli/chunks/{chunk-MUAHFGIX.js → chunk-XYV6YUWS.js} +2 -2
  152. package/dist/cli/chunks/{chunk-5YGESYBC.js → chunk-YGB3MT3R.js} +1 -1
  153. package/dist/cli/chunks/{chunk-LMJUQWR7.js → chunk-YNXQMJGJ.js} +1 -1
  154. package/dist/cli/chunks/{chunk-XIFPIVZI.js → chunk-ZCDGLNJ7.js} +2 -2
  155. package/dist/cli/chunks/{chunk-W766S4SK.js → chunk-ZNITDSWL.js} +1 -1
  156. package/dist/cli/chunks/{ci-RJH5LAL3.js → ci-IU5HVUL5.js} +2 -2
  157. package/dist/cli/chunks/{ci-output-62SGMGB2.js → ci-output-CLI4A43F.js} +2 -2
  158. package/dist/cli/chunks/{circuit-breaker-QXTS5ZAW.js → circuit-breaker-ZR5OFMW7.js} +2 -2
  159. package/dist/cli/chunks/{claude-flow-setup-BBCCT5WV.js → claude-flow-setup-UBMA6ZHJ.js} +2 -2
  160. package/dist/cli/chunks/client-KKCFGD7R.js +2 -0
  161. package/dist/cli/chunks/{cline-installer-IZCUJJ3I.js → cline-installer-EWYELOBI.js} +2 -2
  162. package/dist/cli/chunks/{code-AWNVOZ7S.js → code-YSPF4MXN.js} +2 -2
  163. package/dist/cli/chunks/{code-index-extractor-MX65BKMI.js → code-index-extractor-WW5OKSTN.js} +2 -2
  164. package/dist/cli/chunks/{codex-installer-EQT6JVLM.js → codex-installer-GLADK5PY.js} +2 -2
  165. package/dist/cli/chunks/{completions-WOJAM45W.js → completions-2KTWZ3AK.js} +2 -2
  166. package/dist/cli/chunks/{complexity-analyzer-3DJB7V3K.js → complexity-analyzer-KMX4OWKB.js} +2 -2
  167. package/dist/cli/chunks/{continuedev-installer-P4KWUTCJ.js → continuedev-installer-4FHU4OEJ.js} +2 -2
  168. package/dist/cli/chunks/{copilot-installer-FFZWTMWQ.js → copilot-installer-AKR4WE7B.js} +2 -2
  169. package/dist/cli/chunks/core-handlers-KRSSJEO5.js +2 -0
  170. package/dist/cli/chunks/{cost-tracker-CYBOV3NI.js → cost-tracker-BUJ6WEWY.js} +2 -2
  171. package/dist/cli/chunks/{coverage-GTZJBSC4.js → coverage-OB6HVQS4.js} +3 -3
  172. package/dist/cli/chunks/cross-domain-router-27QGWU27.js +2 -0
  173. package/dist/cli/chunks/{cursor-installer-WZIVXGGB.js → cursor-installer-3AOE4O3Q.js} +2 -2
  174. package/dist/cli/chunks/{daemon-MSFN2LXY.js → daemon-4RAL5URG.js} +3 -3
  175. package/dist/cli/chunks/{daemon-JWMHEJEN.js → daemon-JGSPLYGO.js} +4 -4
  176. package/dist/cli/chunks/{dag-attention-scheduler-4TWOTTQE.js → dag-attention-scheduler-DSBTHIMH.js} +2 -2
  177. package/dist/cli/chunks/{detect-YZ6AGQPB.js → detect-6CVW2VUQ.js} +2 -2
  178. package/dist/cli/chunks/{dist-node-3EM2XH54.js → dist-node-EWPKBTYA.js} +2 -2
  179. package/dist/cli/chunks/{domain-handler-4XU5BINU.js → domain-handler-HLVIJU25.js} +2 -2
  180. package/dist/cli/chunks/{domain-transfer-HUFC7I52.js → domain-transfer-7Y3BR3YU.js} +2 -2
  181. package/dist/cli/chunks/dream-M6K47Q4H.js +2 -0
  182. package/dist/cli/chunks/{embed-and-insert-pattern-J5ZFM6YX.js → embed-and-insert-pattern-ZMJ3263X.js} +2 -2
  183. package/dist/cli/chunks/{eval-XYOA3EH2.js → eval-73XW2WJD.js} +2 -2
  184. package/dist/cli/chunks/{experience-capture-middleware-E3RYQB6Z.js → experience-capture-middleware-OGJ3JOSQ.js} +3 -3
  185. package/dist/cli/chunks/{fast-paths-DKIYN2YS.js → fast-paths-5XCY3Y6U.js} +2 -2
  186. package/dist/cli/chunks/{feature-flags-ZB63Z7N5.js → feature-flags-R5V2FRJR.js} +2 -2
  187. package/dist/cli/chunks/{feature-flags-S2RNZATS.js → feature-flags-VULQI6KY.js} +2 -2
  188. package/dist/cli/chunks/{file-discovery-USJJLYQU.js → file-discovery-HW33C3HC.js} +2 -2
  189. package/dist/cli/chunks/{fleet-4MUPHSF5.js → fleet-NH3XR5OY.js} +3 -3
  190. package/dist/cli/chunks/{gnn-wrapper-PYOQZKX6.js → gnn-wrapper-L3XMLPTG.js} +2 -2
  191. package/dist/cli/chunks/{heartbeat-handler-HLO5XCG7.js → heartbeat-handler-TIQFBT4D.js} +4 -4
  192. package/dist/cli/chunks/heartbeat-scheduler-URXBF5RW.js +2 -0
  193. package/dist/cli/chunks/hnsw-adapter-WWAGM6HK.js +2 -0
  194. package/dist/cli/chunks/hnsw-index-UFV2HSZE.js +2 -0
  195. package/dist/cli/chunks/{hnsw-legacy-bridge-FZEH2KLM.js → hnsw-legacy-bridge-YL2SUIPA.js} +2 -2
  196. package/dist/cli/chunks/{better-sqlite3-LRDXKYOJ.js → hnswlib-node-62RTSHAY.js} +2 -2
  197. package/dist/cli/chunks/{hooks-R2757K57.js → hooks-UR2ZF54G.js} +10 -10
  198. package/dist/cli/chunks/hybrid-router-3U6Q6OTL.js +2 -0
  199. package/dist/cli/chunks/{hypergraph-engine-EAV3GJ5D.js → hypergraph-engine-NX45AOPY.js} +2 -2
  200. package/dist/cli/chunks/{hypergraph-handler-5ERXAVGH.js → hypergraph-handler-LUM4YI4K.js} +3 -3
  201. package/dist/cli/chunks/impact-analyzer-EUEX6ZRO.js +2 -0
  202. package/dist/cli/chunks/{init-handler-RXUSEMG7.js → init-handler-YTKKNTVV.js} +6 -6
  203. package/dist/cli/chunks/init-wizard-POKY2LRY.js +2 -0
  204. package/dist/cli/chunks/kernel-HPAONLZY.js +2 -0
  205. package/dist/cli/chunks/{kilocode-installer-ZUBVBHGT.js → kilocode-installer-ZW7DVH7T.js} +2 -2
  206. package/dist/cli/chunks/{kiro-installer-TRTRQDGL.js → kiro-installer-IA7INW4N.js} +2 -2
  207. package/dist/cli/chunks/knowledge-graph-2WCUFG63.js +2 -0
  208. package/dist/cli/chunks/{learning-UYXWAU5D.js → learning-4AZ5PGTT.js} +3 -3
  209. package/dist/cli/chunks/{llm-router-TB5OJPEV.js → llm-router-WQ4E3AOP.js} +4 -4
  210. package/dist/cli/chunks/llm-router-service-D5VMG6SD.js +2 -0
  211. package/dist/cli/chunks/{load-ELPSUIPV.js → load-4FAH7CZO.js} +2 -2
  212. package/dist/cli/chunks/load-test-DHG26REU.js +2 -0
  213. package/dist/cli/chunks/{mcp-UX7TK3XV.js → mcp-KLLHI6DG.js} +2 -2
  214. package/dist/cli/chunks/{memory-W3LG6H6N.js → memory-Q5HLIUC6.js} +5 -5
  215. package/dist/cli/chunks/memory-backend-GLWQ4DAL.js +2 -0
  216. package/dist/cli/chunks/{memory-handlers-BNXAYS2P.js → memory-handlers-P72I4VV4.js} +2 -2
  217. package/dist/cli/chunks/{multi-model-executor-227LWZRY.js → multi-model-executor-ABI73AFV.js} +2 -2
  218. package/dist/cli/chunks/{opencode-installer-F4WKVWDL.js → opencode-installer-KRPQ6JOJ.js} +2 -2
  219. package/dist/cli/chunks/{orchestrator-V4DBMGK6.js → orchestrator-SUPEONRG.js} +18 -18
  220. package/dist/cli/chunks/pattern-null-store-Y2YFTE3V.js +2 -0
  221. package/dist/cli/chunks/{pattern-usage-recorder-BY3HEWSU.js → pattern-usage-recorder-R4GKK6RZ.js} +2 -2
  222. package/dist/cli/chunks/{pipeline-3F5RIESX.js → pipeline-LCUETNGD.js} +2 -2
  223. package/dist/cli/chunks/{platform-KCGXTZO3.js → platform-WJDIB4X3.js} +2 -2
  224. package/dist/cli/chunks/{plugin-2H552KOV.js → plugin-2X5NY2RF.js} +2 -2
  225. package/dist/cli/chunks/{prime-radiant-advanced-wasm-EFKVL7VN.js → prime-radiant-advanced-wasm-3T665QC6.js} +2 -2
  226. package/dist/cli/chunks/protocol-executor-HNT67NN5.js +2 -0
  227. package/dist/cli/chunks/{protocol-handler-ELGYV7D2.js → protocol-handler-JTXRF7GU.js} +2 -2
  228. package/dist/cli/chunks/{prove-AYJCQYNI.js → prove-BFPWWPOC.js} +2 -2
  229. package/dist/cli/chunks/provider-manager-5YGPZIEZ.js +2 -0
  230. package/dist/cli/chunks/qe-reasoning-bank-Z5UGOA3F.js +2 -0
  231. package/dist/cli/chunks/{quality-HH7L5A7V.js → quality-F7UZU4RN.js} +2 -2
  232. package/dist/cli/chunks/{quality-gate-NAQLXE4C.js → quality-gate-R5L4UZIX.js} +3 -3
  233. package/dist/cli/chunks/queen-coordinator-P5LU5NWI.js +2 -0
  234. package/dist/cli/chunks/{real-embeddings-IO3F4ZFR.js → real-embeddings-LZD6HTQF.js} +2 -2
  235. package/dist/cli/chunks/{roocode-installer-X4TU5HO4.js → roocode-installer-6TTG7VSH.js} +2 -2
  236. package/dist/cli/chunks/router-CRGHUAVR.js +2 -0
  237. package/dist/cli/chunks/routing-feedback-BVX5ZBCF.js +2 -0
  238. package/dist/cli/chunks/{routing-handler-ZJKGDDMT.js → routing-handler-SW442GK7.js} +2 -2
  239. package/dist/cli/chunks/{ruvector-commands-NXCSUBN2.js → ruvector-commands-CLFGKXMW.js} +2 -2
  240. package/dist/cli/chunks/{rvf-dual-writer-JMA74SKP.js → rvf-dual-writer-EVPPXXXS.js} +2 -2
  241. package/dist/cli/chunks/{rvf-migration-adapter-BNTGH2KU.js → rvf-migration-adapter-NOHDIRIP.js} +2 -2
  242. package/dist/cli/chunks/{rvf-migration-coordinator-7T2HHUOH.js → rvf-migration-coordinator-BYJ3M7WZ.js} +2 -2
  243. package/dist/cli/chunks/rvf-native-adapter-FZJSQOJM.js +2 -0
  244. package/dist/cli/chunks/safe-db-USYNEOC6.js +2 -0
  245. package/dist/cli/chunks/schedule-KCRCQ3PS.js +2 -0
  246. package/dist/cli/chunks/scheduler-CX3UHI4U.js +2 -0
  247. package/dist/cli/chunks/{security-XSK2QHB3.js → security-IXDKBPSG.js} +3 -3
  248. package/dist/cli/chunks/{shared-rvf-adapter-WLRKI7RY.js → shared-rvf-adapter-VCOK3OVD.js} +2 -2
  249. package/dist/cli/chunks/{shared-rvf-dual-writer-SZW3J7ZK.js → shared-rvf-dual-writer-FFKBKYNL.js} +2 -2
  250. package/dist/cli/chunks/sqlite-persistence-K23C4TFH.js +2 -0
  251. package/dist/cli/chunks/{status-handler-HGCKYJX2.js → status-handler-M5W64S5U.js} +2 -2
  252. package/dist/cli/chunks/{structural-health-4SJCFX63.js → structural-health-55X6BTLT.js} +2 -2
  253. package/dist/cli/chunks/{sync-ATR4DUSA.js → sync-BUGDXW3Y.js} +2 -2
  254. package/dist/cli/chunks/{sync-7WAVNZGL.js → sync-NUG67HGK.js} +2 -2
  255. package/dist/cli/chunks/{task-handler-O6REL34Y.js → task-handler-T6ZKXV4S.js} +2 -2
  256. package/dist/cli/chunks/{task-handlers-WFV2ZYWW.js → task-handlers-H63TB2UI.js} +3 -3
  257. package/dist/cli/chunks/{test-4LXUVHEU.js → test-VEK76SBT.js} +4 -4
  258. package/dist/cli/chunks/{test-scheduling-OTN3DMKY.js → test-scheduling-QZM6PNZH.js} +3 -3
  259. package/dist/cli/chunks/{token-bootstrap-VA7T4P42.js → token-bootstrap-W5IAMJW4.js} +2 -2
  260. package/dist/cli/chunks/{token-usage-TLT6OXXR.js → token-usage-OBY6UEUR.js} +2 -2
  261. package/dist/cli/chunks/{transformers-JI7LZRQ3.js → transformers-EFNY2MRX.js} +2 -2
  262. package/dist/cli/chunks/{tree-sitter-wasm-parser-QNIMHB4K.js → tree-sitter-wasm-parser-EU2S5NVM.js} +2 -2
  263. package/dist/cli/chunks/{types-DJNWOAC6.js → types-3DYRKX23.js} +2 -2
  264. package/dist/cli/chunks/unified-memory-NCDBQLLF.js +2 -0
  265. package/dist/cli/chunks/unified-memory-hnsw-T7NSGQ2H.js +2 -0
  266. package/dist/cli/chunks/unified-persistence-XUAYDCMM.js +2 -0
  267. package/dist/cli/chunks/{upgrade-VEW4FL23.js → upgrade-H5V53FRF.js} +2 -2
  268. package/dist/cli/chunks/{validate-O3P6PF7B.js → validate-IL22VB5I.js} +2 -2
  269. package/dist/cli/chunks/{validate-swarm-M2HXHZVC.js → validate-swarm-WZKECK3W.js} +2 -2
  270. package/dist/cli/chunks/{vibium-GOU55LUO.js → vibium-KKM23OTQ.js} +2 -2
  271. package/dist/cli/chunks/visual-security-3TUC4GPP.js +2 -0
  272. package/dist/cli/chunks/{web-tree-sitter-MXOI4GH3.js → web-tree-sitter-NJM5YBOY.js} +2 -2
  273. package/dist/cli/chunks/{windsurf-installer-6GKT53IH.js → windsurf-installer-SLP43TVT.js} +2 -2
  274. package/dist/cli/chunks/witness-chain-QLOKUZXC.js +2 -0
  275. package/dist/cli/chunks/{witness-chain-OXGQGL26.js → witness-chain-XBEPT4XD.js} +2 -2
  276. package/dist/cli/chunks/{witness-key-manager-PGFSQXUJ.js → witness-key-manager-DAAMNYOW.js} +2 -2
  277. package/dist/cli/chunks/{workflow-ENBWRMBA.js → workflow-SZOOU6D3.js} +4 -4
  278. package/dist/cli/chunks/workflow-orchestrator-6JAYTZ7L.js +2 -0
  279. package/dist/cli/chunks/{wrappers-MHLNYANQ.js → wrappers-I2CBKWGF.js} +2 -2
  280. package/dist/init/init-wizard-hooks.js +11 -25
  281. package/dist/init/phases/07-hooks.js +15 -25
  282. package/dist/init/settings-merge.d.ts +44 -0
  283. package/dist/init/settings-merge.js +119 -4
  284. package/dist/mcp/bundle.js +1 -1
  285. package/package.json +1 -1
  286. package/dist/cli/chunks/adapter-6IWRIHF3.js +0 -2
  287. package/dist/cli/chunks/aqe-learning-engine-FSF5U67K.js +0 -2
  288. package/dist/cli/chunks/base-2CKCJU3O.js +0 -2
  289. package/dist/cli/chunks/browser-workflow-UGYJE64S.js +0 -2
  290. package/dist/cli/chunks/chunk-2AOOIAW3.js +0 -316
  291. package/dist/cli/chunks/chunk-MDT3LIXS.js +0 -2
  292. package/dist/cli/chunks/client-E2XUBCLK.js +0 -2
  293. package/dist/cli/chunks/core-handlers-46Z5VOO6.js +0 -2
  294. package/dist/cli/chunks/cross-domain-router-SXQ3HFRY.js +0 -2
  295. package/dist/cli/chunks/dream-R6MQQQ3N.js +0 -2
  296. package/dist/cli/chunks/heartbeat-scheduler-OSDPJT6A.js +0 -2
  297. package/dist/cli/chunks/hnsw-adapter-KMGSHBIN.js +0 -2
  298. package/dist/cli/chunks/hnsw-index-IMFRAOPE.js +0 -2
  299. package/dist/cli/chunks/hybrid-router-57QSWSWC.js +0 -2
  300. package/dist/cli/chunks/impact-analyzer-OC4MPBGA.js +0 -2
  301. package/dist/cli/chunks/init-wizard-CDBRL4PO.js +0 -2
  302. package/dist/cli/chunks/kernel-CQ7R3AAV.js +0 -2
  303. package/dist/cli/chunks/knowledge-graph-UXNH7RY4.js +0 -2
  304. package/dist/cli/chunks/llm-router-service-UV34YXBE.js +0 -2
  305. package/dist/cli/chunks/load-test-2VEN3PQZ.js +0 -2
  306. package/dist/cli/chunks/memory-backend-TZL5U6F3.js +0 -2
  307. package/dist/cli/chunks/pattern-null-store-KLX2RNHM.js +0 -2
  308. package/dist/cli/chunks/protocol-executor-5HJKW6MC.js +0 -2
  309. package/dist/cli/chunks/provider-manager-TRZSBXD3.js +0 -2
  310. package/dist/cli/chunks/qe-reasoning-bank-RCEYSLVV.js +0 -2
  311. package/dist/cli/chunks/queen-coordinator-6JFZD54W.js +0 -2
  312. package/dist/cli/chunks/router-KRLC46NS.js +0 -2
  313. package/dist/cli/chunks/routing-feedback-WW26H6SA.js +0 -2
  314. package/dist/cli/chunks/rvf-native-adapter-OVQKPQUH.js +0 -2
  315. package/dist/cli/chunks/safe-db-UQOCQIH2.js +0 -2
  316. package/dist/cli/chunks/schedule-EUX7ZQUK.js +0 -2
  317. package/dist/cli/chunks/scheduler-MALHQKNR.js +0 -2
  318. package/dist/cli/chunks/sqlite-persistence-OBCLRP4L.js +0 -2
  319. package/dist/cli/chunks/unified-memory-A5BS3LGX.js +0 -2
  320. package/dist/cli/chunks/unified-memory-hnsw-WJLJO5MY.js +0 -2
  321. package/dist/cli/chunks/unified-persistence-CFC2BKI5.js +0 -2
  322. package/dist/cli/chunks/visual-security-VPB6KVYJ.js +0 -2
  323. package/dist/cli/chunks/witness-chain-ZZAUAXDY.js +0 -2
  324. package/dist/cli/chunks/workflow-orchestrator-S4LBFTYD.js +0 -2
@@ -8,6 +8,18 @@
8
8
  * - Generates full env vars and v3 settings sections
9
9
  */
10
10
  import type { AQEInitConfig } from './types.js';
11
+ /**
12
+ * Create a one-time `.backup` of an existing settings.json before AQE modifies
13
+ * it — mirroring the CLAUDE.md backup convention.
14
+ *
15
+ * The backup captures the pristine, pre-AQE file and is NOT overwritten on
16
+ * subsequent re-inits, so the user's original settings are always recoverable.
17
+ * No-op when the file does not exist yet (fresh install) or a backup already
18
+ * exists. Failures are swallowed — a backup problem must never block init.
19
+ *
20
+ * @returns the backup path when a backup was written, otherwise null.
21
+ */
22
+ export declare function backupSettingsFile(settingsPath: string): string | null;
11
23
  /**
12
24
  * Check if a single hook entry belongs to AQE (any variant).
13
25
  * Matches commands containing 'aqe' or 'agentic-qe' in any form.
@@ -23,10 +35,42 @@ export declare function isAqeHookEntry(entry: unknown): boolean;
23
35
  * 3. Preserve any hook types not in the new config
24
36
  */
25
37
  export declare function mergeHooksSmart(existingHooks: Record<string, unknown[]>, newAqeHooks: Record<string, unknown[]>): Record<string, unknown[]>;
38
+ /**
39
+ * Merge AQE's environment variables into a user's existing `env` block WITHOUT
40
+ * clobbering values the user already set — including AQE_-prefixed ones.
41
+ *
42
+ * Re-running `aqe init` fills in any missing AQE env vars but leaves every
43
+ * existing value untouched, so a user who intentionally flipped, say,
44
+ * `AQE_LEARNING_ENABLED=false` keeps their choice. Non-AQE env vars are always
45
+ * preserved. Returns a new object; inputs are not mutated.
46
+ */
47
+ export declare function mergeAqeEnv(existingEnv: Record<string, string> | undefined, aqeEnv: Record<string, string>): Record<string, string>;
26
48
  /**
27
49
  * Generate the full set of AQE environment variables for settings.json.
28
50
  */
29
51
  export declare function generateAqeEnvVars(config: AQEInitConfig): Record<string, string>;
52
+ /**
53
+ * Detect whether a `statusLine` block is one AQE generated (vs. a user's own).
54
+ * AQE's status line invokes the statusline-v3.cjs helper (or falls back to the
55
+ * "Agentic QE v3" banner). Anything else is treated as user-owned and preserved.
56
+ */
57
+ export declare function isAqeStatusLine(statusLine: unknown): boolean;
58
+ /**
59
+ * Apply the generated v3 settings sections onto an existing settings object
60
+ * WITHOUT clobbering configuration the user already set:
61
+ *
62
+ * - `_aqePermissions`: union-merge into `permissions.allow`, preserving the
63
+ * user's existing allow/deny entries (#362).
64
+ * - `statusLine`: generic Claude Code setting — only written when absent or when
65
+ * the existing one is AQE's own (so a user's custom status line is preserved).
66
+ * - `includeCoAuthoredBy`: generic Claude Code setting — only written when the
67
+ * user has not set it explicitly (respects an intentional `false`).
68
+ * - `aqe` / `v3Configuration` / `v3Learning`: AQE-owned sections, deep-merged so
69
+ * AQE values are refreshed while any user-added keys survive.
70
+ *
71
+ * Mutates and returns `settings`.
72
+ */
73
+ export declare function applyV3Sections(settings: Record<string, unknown>, sections: Record<string, unknown>): Record<string, unknown>;
30
74
  /**
31
75
  * Generate v3-specific settings sections for settings.json.
32
76
  * These sections enable the self-learning system, status line, and permissions.
@@ -7,16 +7,49 @@
7
7
  * - Preserves non-AQE hooks from the user's config
8
8
  * - Generates full env vars and v3 settings sections
9
9
  */
10
- // Patterns that identify a hook command as belonging to AQE
10
+ import { existsSync, readFileSync, writeFileSync } from 'fs';
11
+ /**
12
+ * Create a one-time `.backup` of an existing settings.json before AQE modifies
13
+ * it — mirroring the CLAUDE.md backup convention.
14
+ *
15
+ * The backup captures the pristine, pre-AQE file and is NOT overwritten on
16
+ * subsequent re-inits, so the user's original settings are always recoverable.
17
+ * No-op when the file does not exist yet (fresh install) or a backup already
18
+ * exists. Failures are swallowed — a backup problem must never block init.
19
+ *
20
+ * @returns the backup path when a backup was written, otherwise null.
21
+ */
22
+ export function backupSettingsFile(settingsPath) {
23
+ if (!existsSync(settingsPath))
24
+ return null;
25
+ const backupPath = `${settingsPath}.backup`;
26
+ if (existsSync(backupPath))
27
+ return null; // keep the pristine original
28
+ try {
29
+ writeFileSync(backupPath, readFileSync(settingsPath, 'utf-8'), 'utf-8');
30
+ return backupPath;
31
+ }
32
+ catch {
33
+ return null;
34
+ }
35
+ }
36
+ // Patterns that identify a hook command as belonging to AQE.
37
+ //
38
+ // These MUST be specific to AQE's own hooks. They must NOT match hooks that
39
+ // other tools install (e.g. ruflo / claude-flow), otherwise re-running
40
+ // `aqe init` in a project that already ran `ruflo init` would strip the user's
41
+ // ruflo hooks. In particular:
42
+ // - do NOT match on `.claude/helpers/` broadly — ruflo's hook-handler.cjs and
43
+ // auto-memory-hook.mjs live there too (match AQE's own helpers by name)
44
+ // - do NOT match on `ruflo` — those are the user's hooks, preserve them
11
45
  const AQE_COMMAND_PATTERNS = [
12
46
  /\baqe\b/i,
13
47
  /\bagentic-qe\b/i,
14
48
  /\bnpx\s+agentic-qe\b/i,
15
49
  /\bnpx\s+@anthropics\/agentic-qe\b/i,
50
+ /aqe-hook\.cjs/i,
16
51
  /brain-checkpoint\.cjs/i,
17
- /\.claude\/helpers\//i,
18
- /\bruflo\b/i,
19
- /dist\/cli\/bundle\.js/i,
52
+ /statusline-v3\.cjs/i,
20
53
  ];
21
54
  /**
22
55
  * Check if a single hook entry belongs to AQE (any variant).
@@ -62,6 +95,19 @@ export function mergeHooksSmart(existingHooks, newAqeHooks) {
62
95
  }
63
96
  return merged;
64
97
  }
98
+ /**
99
+ * Merge AQE's environment variables into a user's existing `env` block WITHOUT
100
+ * clobbering values the user already set — including AQE_-prefixed ones.
101
+ *
102
+ * Re-running `aqe init` fills in any missing AQE env vars but leaves every
103
+ * existing value untouched, so a user who intentionally flipped, say,
104
+ * `AQE_LEARNING_ENABLED=false` keeps their choice. Non-AQE env vars are always
105
+ * preserved. Returns a new object; inputs are not mutated.
106
+ */
107
+ export function mergeAqeEnv(existingEnv, aqeEnv) {
108
+ // AQE defaults first, then existing values win on any key collision.
109
+ return { ...aqeEnv, ...(existingEnv || {}) };
110
+ }
65
111
  /**
66
112
  * Generate the full set of AQE environment variables for settings.json.
67
113
  */
@@ -85,6 +131,75 @@ export function generateAqeEnvVars(config) {
85
131
  AQE_V3_SUCCESS_RATE_THRESHOLD: String(config.learning?.qualityThreshold ?? 0.7),
86
132
  };
87
133
  }
134
+ /**
135
+ * Detect whether a `statusLine` block is one AQE generated (vs. a user's own).
136
+ * AQE's status line invokes the statusline-v3.cjs helper (or falls back to the
137
+ * "Agentic QE v3" banner). Anything else is treated as user-owned and preserved.
138
+ */
139
+ export function isAqeStatusLine(statusLine) {
140
+ const cmd = statusLine?.command;
141
+ return typeof cmd === 'string' && /statusline-v3\.cjs|Agentic QE v3/.test(cmd);
142
+ }
143
+ /**
144
+ * Deep-merge `source` (AQE-owned values) onto `target` (whatever the user has):
145
+ * plain-object subtrees merge recursively so a user's extra keys survive, while
146
+ * AQE's values win on conflicting leaves. Arrays and primitives are replaced by
147
+ * the AQE value (these sections are AQE-managed).
148
+ */
149
+ function deepMergeOwned(target, source) {
150
+ if (!isPlainObject(target) || !isPlainObject(source))
151
+ return source;
152
+ const out = { ...target };
153
+ for (const [key, value] of Object.entries(source)) {
154
+ out[key] = deepMergeOwned(out[key], value);
155
+ }
156
+ return out;
157
+ }
158
+ function isPlainObject(value) {
159
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
160
+ }
161
+ /**
162
+ * Apply the generated v3 settings sections onto an existing settings object
163
+ * WITHOUT clobbering configuration the user already set:
164
+ *
165
+ * - `_aqePermissions`: union-merge into `permissions.allow`, preserving the
166
+ * user's existing allow/deny entries (#362).
167
+ * - `statusLine`: generic Claude Code setting — only written when absent or when
168
+ * the existing one is AQE's own (so a user's custom status line is preserved).
169
+ * - `includeCoAuthoredBy`: generic Claude Code setting — only written when the
170
+ * user has not set it explicitly (respects an intentional `false`).
171
+ * - `aqe` / `v3Configuration` / `v3Learning`: AQE-owned sections, deep-merged so
172
+ * AQE values are refreshed while any user-added keys survive.
173
+ *
174
+ * Mutates and returns `settings`.
175
+ */
176
+ export function applyV3Sections(settings, sections) {
177
+ for (const [key, value] of Object.entries(sections)) {
178
+ if (key === '_aqePermissions') {
179
+ const existingPerms = settings.permissions || {};
180
+ const existingAllow = existingPerms.allow || [];
181
+ const merged = [...new Set([...existingAllow, ...value])];
182
+ settings.permissions = { ...existingPerms, allow: merged };
183
+ }
184
+ else if (key === 'statusLine') {
185
+ // Preserve a user's (or another tool's) custom status line.
186
+ if (settings.statusLine === undefined || isAqeStatusLine(settings.statusLine)) {
187
+ settings.statusLine = value;
188
+ }
189
+ }
190
+ else if (key === 'includeCoAuthoredBy') {
191
+ // Respect an explicit user choice; only set the default when unset.
192
+ if (settings.includeCoAuthoredBy === undefined) {
193
+ settings.includeCoAuthoredBy = value;
194
+ }
195
+ }
196
+ else {
197
+ // AQE-owned section — deep-merge so user additions are not dropped.
198
+ settings[key] = deepMergeOwned(settings[key], value);
199
+ }
200
+ }
201
+ return settings;
202
+ }
88
203
  /**
89
204
  * Generate v3-specific settings sections for settings.json.
90
205
  * These sections enable the self-learning system, status line, and permissions.
@@ -6080,7 +6080,7 @@ ${i.errors.join(`
6080
6080
  ORDER BY ended_at DESC
6081
6081
  LIMIT ?
6082
6082
  `).all(yAe);if(i.length===0)return;let s=r.prepare("UPDATE qe_trajectories SET feedback = ? WHERE id = ?");for(let a of i)try{let c=await vAe(a,o,e);c&&s.run(JSON.stringify(c),a.id)}catch{}}async function vAe(o,e,t){let r=["You are a quality engineering judge scoring a completed task trajectory.","",`Task: ${o.task.slice(0,400)}`,`Agent: ${o.agent??"unknown"}`,`Domain: ${o.domain??"general"}`,`Outcome: ${o.success?"success":"failure"}`,"",'Respond ONLY with JSON: {"quality": 0..1, "reasoning": "\u2264120 chars", "improvement": "\u2264120 chars or omit"}.'].join(`
6083
- `),n=await fetch(`${t}/v1/messages`,{method:"POST",headers:{"content-type":"application/json","x-api-key":e,"anthropic-version":"2023-06-01"},body:JSON.stringify({model:hAe,max_tokens:fAe,messages:[{role:"user",content:r}]})});if(!n.ok)return null;let s=(await n.json()).content?.[0]?.text;if(!s)return null;let a=s.match(/\{[\s\S]*\}/);if(!a)return null;try{let c=JSON.parse(a[0]);return typeof c.quality!="number"||typeof c.reasoning!="string"?null:{quality:Math.max(0,Math.min(1,c.quality)),reasoning:c.reasoning.slice(0,200),improvement:typeof c.improvement=="string"?c.improvement.slice(0,200):void 0}}catch{return null}}var hAe,fAe,yAe,WZ=v(()=>{"use strict";Y();hAe="claude-haiku-4-5-20251001",fAe=200,yAe=5});var J$={};j(J$,{handleModelRoute:()=>t0,handleReasoningBankStats:()=>wAe,handleRoutingEconomics:()=>n0,handleRoutingMetrics:()=>r0,handleTaskCancel:()=>ZR,handleTaskList:()=>JR,handleTaskOrchestrate:()=>e0,handleTaskOutcomeRecord:()=>SAe,handleTaskStatus:()=>YR,handleTaskStatusWithLearning:()=>EAe,handleTaskSubmit:()=>XR,subscribeTrajectoryEvents:()=>RAe,unsubscribeTrajectoryEvents:()=>KZ});async function XR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=await e.submitTask({type:o.type,priority:o.priority||"p1",targetDomains:o.targetDomains||[],payload:o.payload||{},timeout:o.timeout||3e5});if(!t.success)return{success:!1,error:t.error.message};let r=e.getTaskStatus(t.value);return{success:!0,data:{taskId:t.value,type:o.type,priority:o.priority||"p1",status:r?.status==="running"?"pending":"queued",assignedDomain:r?.assignedDomain}}}catch(t){return{success:!1,error:`Failed to submit task: ${S(t)}`}}}async function JR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.listTasks({status:o.status,priority:o.priority,domain:o.domain});return{success:!0,data:(typeof o.limit=="number"?t.slice(0,o.limit):t).map(i=>({taskId:i.taskId,type:i.task.type,status:i.status,priority:i.task.priority,assignedDomain:i.assignedDomain,assignedAgents:i.assignedAgents,result:i.result,error:i.error,createdAt:i.task.createdAt.toISOString(),startedAt:i.startedAt?.toISOString(),completedAt:i.completedAt?.toISOString(),duration:i.completedAt&&i.startedAt?i.completedAt.getTime()-i.startedAt.getTime():void 0}))}}catch(t){return{success:!1,error:`Failed to list tasks: ${S(t)}`}}}async function YR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.getTaskStatus(o.taskId);return t?{success:!0,data:{taskId:t.taskId,type:t.task.type,status:t.status,priority:t.task.priority,assignedDomain:t.assignedDomain,assignedAgents:t.assignedAgents,result:o.detailed?t.result:void 0,error:t.error,createdAt:t.task.createdAt.toISOString(),startedAt:t.startedAt?.toISOString(),completedAt:t.completedAt?.toISOString(),duration:t.completedAt&&t.startedAt?t.completedAt.getTime()-t.startedAt.getTime():void 0}}:{success:!1,error:`Task not found: ${o.taskId}`}}catch(t){return{success:!1,error:`Failed to get task status: ${S(t)}`}}}async function ZR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=await e.cancelTask(o.taskId);return t.success?{success:!0,data:{taskId:o.taskId,cancelled:!0}}:{success:!1,error:t.error.message}}catch(t){return{success:!1,error:`Failed to cancel task: ${S(t)}`}}}async function e0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e,workflowOrchestrator:t}=ye();try{let r=o.context?.project||QZ(o.task),n=o.priority==="critical"||/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),s=await(await $s()).routeTask({task:o.task,codeContext:o.codeContext,filePaths:o.filePaths,manualTier:o.manualTier,isCritical:n,agentType:`qe-${r}`,domain:r,metadata:{inferredDomain:r,hasCodeContext:!!o.codeContext,fileCount:o.filePaths?.length}}),a=await On(),c=await a.getExperienceGuidance(o.task,o.context?.project),l=await a.searchPatterns(o.task,{limit:5,domain:o.context?.project??r}).catch(()=>[]),u=CAe(o.task),d=TAe(o.priority||"medium"),p=bAe[u];if(p&&t){console.log(`[TaskOrchestrate] Task type '${u}' has workflow '${p}' - executing workflow`);let y=o.task.match(/https?:\/\/[^\s]+/i),b=y?y[0]:void 0;b&&console.log(`[TaskOrchestrate] Detected URL for analysis: ${b}`);let C={targetId:o.context?.project||b||`task-${Date.now()}`,targetType:b?"website":"epic",description:o.task,acceptanceCriteria:o.context?.requirements||[],url:b,routing:{tier:s.decision.tier,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall},patternHints:l.length>0?l.map(A=>({patternId:A.id,name:A.name,description:A.description,confidence:A.confidence,similarity:A.qualityScore,canReuse:A.tier==="long-term"})):void 0},E=await t.executeWorkflow(p,C);return E.success?{success:!0,data:{taskId:E.value,type:u,priority:d,strategy:o.strategy||"adaptive",status:"workflow-started",message:`Workflow '${p}' started for task: ${o.task}`,routing:{tier:s.decision.tier,tierName:s.tierInfo.name,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence,useAgentBooster:s.useAgentBooster,rationale:s.decision.rationale,decisionTimeMs:s.decision.metadata.decisionTimeMs}}}:{success:!1,error:`Workflow execution failed: ${E.error.message}`}}let m={description:o.task,strategy:o.strategy||"adaptive",maxAgents:o.maxAgents,context:o.context};u==="generate-tests"&&(m.sourceFiles=o.filePaths||[],m.sourceCode=o.codeContext||"",m.language=m.language||"typescript",m.testType=m.testType||"unit");let g=await e.submitTask({type:u,priority:d,targetDomains:[],payload:{...m,routing:{tier:s.decision.tier,modelId:s.modelId,executionStrategy:s.executionStrategy,useAgentBooster:s.useAgentBooster,agentBoosterTransform:s.decision.agentBoosterTransform,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence},experienceGuidance:c?{strategy:c.recommendedStrategy,actions:c.suggestedActions,confidence:c.confidence,tokenSavings:c.estimatedTokenSavings}:void 0,patternHints:l.length>0?l.map(y=>({patternId:y.id,name:y.name,description:y.description,confidence:y.confidence,similarity:y.qualityScore,canReuse:y.tier==="long-term"})):void 0},timeout:6e5});if(!g.success)return{success:!1,error:g.error.message};let h=g.value;return await Q$(h,o.task,{agent:"queen-coordinator",domain:o.context?.project}),process.env.AQE_TRAJECTORY_JUDGE==="1"&&process.env.ANTHROPIC_API_KEY&&HZ().catch(y=>{console.warn("[TrajectoryJudge] failed:",y instanceof Error?y.message:y)}),{success:!0,data:{taskId:h,type:u,priority:d,strategy:o.strategy||"adaptive",status:"submitted",message:`Task orchestrated: ${o.task}${c?" (with experience guidance)":""}`,routing:{tier:s.decision.tier,tierName:s.tierInfo.name,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence,useAgentBooster:s.useAgentBooster,rationale:s.decision.rationale,decisionTimeMs:s.decision.metadata.decisionTimeMs}}}}catch(r){return{success:!1,error:`Failed to orchestrate task: ${S(r)}`}}}async function t0(o){try{let e=await $s(),t=o.domain||QZ(o.task),r=o.isCritical??/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),n=await e.routeTask({task:o.task,codeContext:o.codeContext,filePaths:o.filePaths,manualTier:o.manualTier,isCritical:r,agentType:o.agentType||`qe-${t}`,domain:t,metadata:{inferredDomain:t,hasCodeContext:!!o.codeContext,fileCount:o.filePaths?.length}});return{success:!0,data:{tier:n.decision.tier,tierName:n.tierInfo.name,modelId:n.modelId,executionStrategy:n.executionStrategy,useAgentBooster:n.useAgentBooster,agentBoosterTransform:n.decision.agentBoosterTransform,complexity:{overall:n.decision.complexityAnalysis.overall,code:n.decision.complexityAnalysis.codeComplexity,reasoning:n.decision.complexityAnalysis.reasoningComplexity,scope:n.decision.complexityAnalysis.scopeComplexity},confidence:n.decision.confidence,rationale:n.decision.rationale,warnings:n.decision.warnings,budget:{allowed:n.decision.budgetDecision.allowed,wasDowngraded:n.decision.budgetDecision.wasDowngraded,estimatedCostUsd:n.decision.budgetDecision.estimatedCostUsd},decisionTimeMs:n.decision.metadata.decisionTimeMs}}}catch(e){return{success:!1,error:`Failed to route task: ${S(e)}`}}}async function r0(o){try{let e=await $s(),t=e.getRoutingStats(),r=e.getMetrics(),n={stats:t,modelRouterMetrics:{totalDecisions:r.totalDecisions,avgDecisionTimeMs:r.avgDecisionTimeMs,agentBoosterStats:r.agentBoosterStats,budgetStats:r.budgetStats}};return o.includeLog&&(n.log=e.getRoutingLog(o.logLimit||100)),{success:!0,data:n}}catch(e){return{success:!1,error:`Failed to get routing metrics: ${S(e)}`}}}async function n0(o){try{let{createRoutingFeedbackCollector:e}=await Promise.resolve().then(()=>(Fm(),I3)),{getGlobalCostTracker:t}=await Promise.resolve().then(()=>(bn(),_2)),r=e(100);await r.initialize(),r.enableEconomicRouting({...o.taskComplexity!=null?{}:{}},t());let n=r.getEconomicReport();return n?{success:!0,data:{tierEfficiency:n.tierEfficiency.map(s=>({...s,qualityPerDollar:isFinite(s.qualityPerDollar)?s.qualityPerDollar:"Infinity"})),currentHourlyCostUsd:n.currentHourlyCostUsd,currentDailyCostUsd:n.currentDailyCostUsd,budgetRemaining:n.budgetRemaining,recommendation:n.recommendation,savingsOpportunity:n.savingsOpportunity}}:{success:!1,error:"Economic routing is not available"}}catch(e){return{success:!1,error:`Failed to get economic routing report: ${S(e)}`}}}function QZ(o){let e=o.toLowerCase();return/\b(security|vulnerabilit|cve|owasp|secret|credential|injection|xss|csrf)\b/.test(e)?"security-compliance":/\b(chaos|resilience|fault.?inject|disaster|failover)\b/.test(e)?"chaos-resilience":/\b(defect|bug.?predict|risk.?assess|mutation)\b/.test(e)?"defect-intelligence":/\b(coverage|uncovered|gap.?analy)\b/.test(e)?"coverage-analysis":/\b(quality|code.?review|maintain|tech.?debt)\b/.test(e)?"quality-assessment":/\b(contract|api.?compat|breaking.?change|pact)\b/.test(e)?"contract-testing":/\b(index|knowledge.?graph|semantic|code.?intel)\b/.test(e)?"code-intelligence":/\b(accessib|a11y|wcag|screen.?read)\b/.test(e)?"visual-accessibility":/\b(requirement|bdd|acceptance|user.?stor)\b/.test(e)?"requirements-validation":/\b(generat.*test|test.*generat|write.*test|create.*test)\b/.test(e)?"test-generation":/\b(run.*test|execut.*test)\b/.test(e)?"test-execution":"test-generation"}function CAe(o){let e=o.toLowerCase();return/run\s+(?:\w+\s+)*tests?/.test(e)||/execute\s+(?:\w+\s+)*tests?/.test(e)||e.includes("run tests")||e.includes("execute tests")?"execute-tests":e.includes("generate test")||e.includes("create test")||e.includes("write test")?"generate-tests":e.includes("coverage")||e.includes("uncovered")?"analyze-coverage":e.includes("quality")||e.includes("code quality")?"assess-quality":e.includes("defect")||e.includes("bug")||e.includes("predict")?"predict-defects":e.includes("requirement")||e.includes("bdd")||e.includes("acceptance")?"validate-requirements":e.includes("index")||e.includes("knowledge graph")||e.includes("semantic")?"index-code":e.includes("security")||e.includes("vulnerability")||e.includes("owasp")?"scan-security":e.includes("contract")||e.includes("api contract")||e.includes("pact")?"validate-contracts":e.includes("accessibility")||e.includes("a11y")||e.includes("wcag")?"test-accessibility":e.includes("chaos")||e.includes("resilience")||e.includes("fault")?"run-chaos":e.includes("learn")||e.includes("optimize")||e.includes("improve")?"optimize-learning":e.includes("ideation")||e.includes("quality criteria")||e.includes("htsm")||e.includes("qcsd")||e.includes("testability")||e.includes("pi planning")||e.includes("sprint planning")?"ideation-assessment":"generate-tests"}function TAe(o){switch(o){case"critical":return"p0";case"high":return"p1";case"medium":return"p2";case"low":return"p3";default:return"p1"}}async function SAe(o){try{let e=await On(),t={taskId:o.taskId,task:o.task,taskType:o.taskType,success:o.success,executionTimeMs:o.executionTimeMs,agentId:o.agentId,domain:o.domain,modelTier:o.modelTier,qualityScore:o.qualityScore,error:o.error,metrics:o.metrics};await e.recordTaskOutcome(t);let r=o.success&&(o.qualityScore||.5)>=.6;return{success:!0,data:{recorded:!0,patternStored:r,message:r?`Outcome recorded and pattern stored for task ${o.taskId}`:`Outcome recorded for task ${o.taskId}`}}}catch(e){return{success:!1,error:`Failed to record task outcome: ${S(e)}`}}}async function wAe(){try{let e=await(await On()).getStats();return{success:!0,data:{service:e.service,patterns:{totalPatterns:e.reasoningBank.totalPatterns,byDomain:e.reasoningBank.byDomain,byTier:e.reasoningBank.byTier,learningOutcomes:e.reasoningBank.learningOutcomes,patternSuccessRate:e.reasoningBank.patternSuccessRate},embeddings:{cacheSize:e.reasoningBank.embeddingCacheSize,dimension:e.reasoningBank.embeddingDimension,transformerAvailable:e.reasoningBank.transformerAvailable},performance:{avgRoutingLatencyMs:e.reasoningBank.avgRoutingLatencyMs,p95RoutingLatencyMs:e.reasoningBank.p95RoutingLatencyMs}}}}catch(o){return{success:!1,error:`Failed to get ReasoningBank stats: ${S(o)}`}}}async function EAe(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.getTaskStatus(o.taskId);if(!t)return{success:!1,error:`Task not found: ${o.taskId}`};let r={taskId:t.taskId,type:t.task.type,status:t.status,priority:t.task.priority,assignedDomain:t.assignedDomain,assignedAgents:t.assignedAgents,result:o.detailed?t.result:void 0,error:t.error,createdAt:t.task.createdAt.toISOString(),startedAt:t.startedAt?.toISOString(),completedAt:t.completedAt?.toISOString(),duration:t.completedAt&&t.startedAt?t.completedAt.getTime()-t.startedAt.getTime():void 0};if((t.status==="completed"||t.status==="failed")&&!jZ.has(o.taskId)){jZ.add(o.taskId);try{let n=await On(),i=r.duration||0,s=t.status==="completed",a=t.task.payload||{},c=typeof a.description=="string"?a.description:t.task.type,l=a.routing,u=await yf(o.taskId,s,t.error),d=u?.metrics.averageQuality??(s?.7:.3);await n.recordTaskOutcome({taskId:o.taskId,task:c,taskType:t.task.type,success:s,executionTimeMs:i,agentId:t.assignedAgents?.[0],domain:t.assignedDomain,modelTier:l?.tier,qualityScore:d,error:t.error,metrics:{testsGenerated:typeof t.result=="object"&&t.result?t.result.testsGenerated:void 0,testsPassed:typeof t.result=="object"&&t.result?t.result.testsPassed:void 0}}),console.error(`[TaskHandler] Recorded learning outcome: task=${o.taskId} success=${s} quality=${d.toFixed(2)} trajectorySteps=${u?.steps.length??0}`)}catch(n){console.error("[TaskHandler] Failed to record outcome:",n)}}return{success:!0,data:r}}catch(t){return{success:!1,error:`Failed to get task status: ${S(t)}`}}}function RAe(o){KZ(o);let e=o.subscribeToEventType("TaskCompleted",async r=>{let{taskId:n}=r.payload;n&&await yf(n,!0).catch(()=>{})}),t=o.subscribeToEventType("TaskFailed",async r=>{let{taskId:n,error:i}=r.payload;n&&await yf(n,!1,i).catch(()=>{})});X$=[e,t]}function KZ(o){for(let e of X$)o.unsubscribe(e);X$=[]}var bAe,jZ,X$,i0=v(()=>{"use strict";Zn();NE();K$();WZ();P();bAe={"ideation-assessment":"qcsd-ideation-swarm"};jZ=new Set;X$=[]});var JZ={};j(JZ,{DEFAULT_STRUCTURAL_HEALTH_CONFIG:()=>XZ,StructuralHealthMonitor:()=>s0,createStructuralHealthMonitor:()=>AAe});function AAe(o){return new s0(o)}var XZ,s0,YZ=v(()=>{"use strict";VN();XZ={healthyThreshold:.4,warningThreshold:.2,maxHistoryEntries:100,enableLogging:!1},s0=class{config;minCutService;history=[];constructor(e){this.config={...XZ,...e},this.minCutService=PE()}computeFleetHealth(e){if(e.length===0)return this.emptyFleetResult();let t=this.minCutService.buildTaskGraphFromTopology(e);return this.computeFleetHealthFromGraph(t,e.length)}computeFleetHealthFromGraph(e,t){if(e.nodes.length===0)return this.emptyFleetResult();let r=this.minCutService.getStructuralHealth(e),n=this.determineStatus(r.normalizedLambda),i={lambda:r.lambda,healthy:r.healthy,weakPoints:r.weakPoints,normalizedLambda:r.normalizedLambda,riskScore:r.riskScore,status:n,suggestions:r.suggestions,measuredAt:new Date};return this.addHistoryEntry({lambda:r.lambda,healthy:r.healthy,weakPointCount:r.weakPoints.length,agentCount:t??e.nodes.length,timestamp:i.measuredAt}),this.config.enableLogging&&this.logHealth(i),i}getTrend(){if(this.history.length<2)return"stable";let e=Math.min(5,this.history.length),t=this.history.slice(-e),r=t[0].lambda,i=t[t.length-1].lambda-r;return Math.abs(i)<.05?"stable":i>0?"improving":"degrading"}getHistory(e){let t=[...this.history];return e!==void 0&&e<t.length?t.slice(-e):t}clearHistory(){this.history.length=0}getMinCutService(){return this.minCutService}determineStatus(e){return e>=this.config.healthyThreshold?"healthy":e>=this.config.warningThreshold?"warning":"critical"}addHistoryEntry(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}emptyFleetResult(){return{lambda:0,healthy:!1,weakPoints:[],normalizedLambda:0,riskScore:1,status:"empty",suggestions:["No agents in fleet. Spawn agents to build a topology."],measuredAt:new Date}}logHealth(e){console.error(`[StructuralHealth] Status: ${e.status} | Lambda: ${e.normalizedLambda.toFixed(3)} | Weak points: ${e.weakPoints.length} | Risk: ${(e.riskScore*100).toFixed(0)}%`)}}});var vW={};j(vW,{adoptExternalFleet:()=>xAe,assignAgentLevel:()=>Y$,disposeFleet:()=>c0,getAgentLevel:()=>Z$,getAllAgentLevels:()=>PAe,getFleetState:()=>ye,getFleetTopology:()=>kAe,handleAQEHealth:()=>l0,handleFleetHealth:()=>o0,handleFleetInit:()=>ku,handleFleetStatus:()=>a0,isFleetInitialized:()=>ge});function ye(){return B}function ge(){return B.initialized&&B.kernel!==null&&B.queen!==null}function xAe(o){return ge()||(B.fleetId=`fleet-${R().slice(0,8)}`,B.kernel=o.kernel,B.queen=o.queen,B.router=o.router??null,B.workflowOrchestrator=o.workflowOrchestrator??null,B.initialized=!0,B.initTime=new Date,B.topology=o.topology??"hierarchical",B.agentLevels.clear()),B.fleetId}function kAe(){return B.topology}function Y$(o,e){if(B.topology!=="hierarchical"){let i={agentId:o,domain:e,level:"worker",spawnedAt:new Date};return B.agentLevels.set(o,i),"worker"}let r=Array.from(B.agentLevels.values()).find(i=>i.domain===e&&i.level==="lead")?"worker":"lead",n={agentId:o,domain:e,level:r,spawnedAt:new Date};return B.agentLevels.set(o,n),r}function Z$(o){return B.agentLevels.get(o)}function PAe(){return B.agentLevels}async function ku(o){try{if(B.initialized&&B.kernel&&B.queen)return{success:!0,data:{fleetId:B.fleetId,topology:o.topology||"hierarchical",maxAgents:o.maxAgents||15,enabledDomains:o.enabledDomains||ZZ,status:"ready"}};B.fleetId=`fleet-${R().slice(0,8)}`;let e=o.enabledDomains||[...re],t=e.filter(l=>l!=="coordination"),r=process.env.AQE_MEMORY_BACKEND==="memory"?"memory":o.memoryBackend||"hybrid";B.kernel=new Rw({maxConcurrentAgents:o.maxAgents||15,memoryBackend:r,hnswEnabled:!0,lazyLoading:o.lazyLoading!==!1,enabledDomains:e}),await B.kernel.initialize(),B.router=new aE(B.kernel.eventBus),await B.router.initialize();let n=l=>B.kernel.getDomainAPI(l),i=new qR(B.kernel.eventBus,B.kernel.memory,n),s=B.kernel.plugins;await s.loadAll();let a=new Map;for(let l of s.getLoaded()){let u=s.getPlugin(l);u&&a.set(l,u)}try{let{getDaemon:l}=await Promise.resolve().then(()=>(QR(),jR)),u=l().getWorkerManager();u.setKernel(B.kernel),u.setMemory(B.kernel.memory)}catch(l){console.warn(`[fleet_init] Daemon worker manager wiring skipped: ${S(l)}`)}B.queen=HX(B.kernel,B.router,i,void 0,a),await B.queen.initialize(),B.workflowOrchestrator=new Vg(B.kernel.eventBus,B.kernel.memory,B.kernel.coordinator),await B.workflowOrchestrator.initialize(),MAe(B.kernel,B.workflowOrchestrator);let{subscribeTrajectoryEvents:c}=await Promise.resolve().then(()=>(i0(),J$));return c(B.router),B.initialized=!0,B.initTime=new Date,B.topology=o.topology||"hierarchical",B.agentLevels.clear(),{success:!0,data:{fleetId:B.fleetId,topology:B.topology,maxAgents:o.maxAgents||15,enabledDomains:t,status:"initialized"}}}catch(e){return{success:!1,error:`Failed to initialize fleet: ${S(e)}`}}}async function a0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let e=B.queen.getHealth(),t=B.queen.getMetrics(),r={status:e.status,uptime:t.uptime,agents:{total:e.totalAgents,active:e.activeAgents,idle:e.totalAgents-e.activeAgents},tasks:{pending:e.pendingTasks,running:e.runningTasks,completed:t.tasksCompleted,failed:t.tasksFailed}};if(o.includeDomains){let i=[];for(let[s,a]of e.domainHealth)i.push({domain:s,status:a.status,agents:a.agents.total,load:B.queen.getDomainLoad(s)});r.domains=i}let n=B.queen.getDomainTeamManager?.();if(n){let i=n.listDomainTeams(),s=0,a=0;for(let c of i)s+=1+c.teammateIds.length,n.getTeamHealth(c.domain)?.healthy&&a++;r.teams={active:i.length,totalAgentsInTeams:s,healthyCount:a}}o.includeMetrics&&(r.metrics={tasksReceived:t.tasksReceived,tasksCompleted:t.tasksCompleted,tasksFailed:t.tasksFailed,agentUtilization:t.agentUtilization,averageTaskDuration:t.averageTaskDuration});try{let{getUnifiedMemory:i}=await Promise.resolve().then(()=>(Y(),vr)),s=i();if(s.isInitialized()){let a=l=>{try{return s.queryCount(l)}catch{return 0}},c=await s.vectorCount();r.learning={totalPatterns:a("qe_patterns"),totalExperiences:a("captured_experiences"),totalTrajectories:a("qe_trajectories"),vectorCount:c,experienceApplications:a("experience_applications"),dreamCycles:a("dream_cycles"),embeddingDimension:384}}}catch{}return{success:!0,data:r}}catch(e){return{success:!1,error:`Failed to get fleet status: ${S(e)}`}}}async function o0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{if(o.domain){let r=B.queen.getDomainHealth(o.domain);return r?{success:!0,data:{domain:o.domain,status:r.status,agents:r.agents,errors:r.errors,lastActivity:r.lastActivity?.toISOString()}}:{success:!1,error:`Domain not found: ${o.domain}`}}let e=B.queen.getHealth(),t={status:e.status,totalAgents:e.totalAgents,activeAgents:e.activeAgents,pendingTasks:e.pendingTasks,runningTasks:e.runningTasks,workStealingActive:e.workStealingActive,lastHealthCheck:e.lastHealthCheck.toISOString()};if(o.detailed){let r={};for(let[n,i]of e.domainHealth)r[n]={status:i.status,agents:i.agents,errors:i.errors.length,lastActivity:i.lastActivity?.toISOString()};t.domains=r,t.issues=e.issues.map(n=>({severity:n.severity,message:n.message,domain:n.domain,timestamp:n.timestamp.toISOString()}))}try{let{StructuralHealthMonitor:r}=await Promise.resolve().then(()=>(YZ(),JZ)),n=new r,i=[];for(let[c]of e.domainHealth){let l=B.queen.getAgentsByDomain(c);for(let u of l)i.push({id:u.id,name:u.name,domain:u.domain})}let s=i.map(c=>({id:c.id,name:c.name,domain:c.domain,capabilities:[c.domain],dependsOn:[],weight:1})),a=n.computeFleetHealth(s);t.structuralHealth={lambda:a.lambda,healthy:a.healthy,normalizedLambda:a.normalizedLambda,riskScore:a.riskScore,status:a.status,weakPoints:a.weakPoints,suggestions:a.suggestions}}catch{}return{success:!0,data:t}}catch(e){return{success:!1,error:`Failed to get fleet health: ${S(e)}`}}}async function c0(){if(t9(),VE(),hZ(),B.workflowOrchestrator&&(await B.workflowOrchestrator.dispose(),B.workflowOrchestrator=null),B.queen&&(await B.queen.dispose(),B.queen=null),B.router){try{let{unsubscribeTrajectoryEvents:o}=await Promise.resolve().then(()=>(i0(),J$));o(B.router)}catch{}await B.router.dispose(),B.router=null}B.kernel&&(await B.kernel.dispose(),B.kernel=null),B.initialized=!1,B.fleetId=null,B.initTime=null,B.topology="hierarchical",B.agentLevels.clear()}async function l0(){let o=performance.now();try{let e=ge(),t=B.initTime?Date.now()-B.initTime.getTime():0,r={connected:!1,totalEntries:0,namespaces:0},n={enabled:!1,vectorCount:0},i=0;if(e&&B.kernel){let u=B.kernel.memory;try{r.connected=!0;let d=await u.count("default"),p=await u.count("learning"),m=await u.count("patterns");r.totalEntries=d+p+m;let g=0;for(let h of["default","learning","patterns","mcp-tools","coordination"])await u.count(h)>0&&g++;r.namespaces=g}catch{}try{let d=process.env.AQE_V3_HNSW_ENABLED==="true";n.enabled=d;let p=u;d&&typeof p.vectorCount=="function"&&(n.vectorCount=await p.vectorCount())}catch{}try{i=(await u.search("pattern:*",1e3)).length}catch{}}let s=e&&B.kernel?(B.kernel.getLoadedDomains?.()??ZZ).length:0,a=null;try{let{getSharedRvfDualWriterSync:u}=await Promise.resolve().then(()=>(Xi(),Ea)),d=u();if(d){let p=d.status(),m=d.getDivergenceReport();a={mode:p.mode,vectorCount:p.rvf?.totalVectors??0,divergences:m.divergences,promotionSafe:d.isPromotionSafe()}}}catch{}let c=null;try{let{SQLitePatternStore:u}=await Promise.resolve().then(()=>(hc(),wk)),d=new u;await d.initialize(),c=d.getGhostPatternCount(),d.close()}catch{}return{success:!0,data:{status:e?"healthy":"unhealthy",version:"3.12.0",loadedDomains:s,memory:r,hnsw:n,rvf:a??void 0,ghostPatterns:c??void 0,loadedPatterns:i,uptimeMs:t,timestamp:new Date().toISOString()},metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:R(),toolName:"aqe_health"}}}catch(e){return{success:!1,error:S(e),metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:R(),toolName:"aqe_health"}}}}function MAe(o,e){let t=o.getDomainAPI("requirements-validation");t?.registerWorkflowActions&&(t.registerWorkflowActions(e),console.log("[Fleet] Registered requirements-validation workflow actions (includes QCSD Ideation)"));let r=o.getDomainAPI("visual-accessibility");r?.registerWorkflowActions&&(r.registerWorkflowActions(e),console.log("[Fleet] Registered visual-accessibility workflow actions"))}var ZZ,B,Zn=v(()=>{"use strict";N();S8();L();WX();GO();jX();c1();GE();D$();fZ();P();ZZ=re.filter(o=>o!=="coordination"),B={fleetId:null,kernel:null,queen:null,router:null,workflowOrchestrator:null,initialized:!1,initTime:null,topology:"hierarchical",agentLevels:new Map}});U();import*as dU from"readline";var nn={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,SERVER_ERROR:-32e3},Fo=class extends Error{constructor(t,r,n){super(r);this.code=t;this.data=n;this.name="McpError"}code;data};function fA(o){return typeof o=="object"&&o!==null&&typeof o.code=="number"&&typeof o.message=="string"}var hA=class{inputStream;outputStream;maxMessageSize;rl=null;requestHandler=null;notificationHandler=null;errorHandler=null;closeHandler=null;running=!1;metrics={messagesReceived:0,messagesSent:0,errors:0,bytesReceived:0,bytesSent:0};constructor(e={}){this.inputStream=e.inputStream??process.stdin,this.outputStream=e.outputStream??process.stdout,this.maxMessageSize=e.maxMessageSize??10*1024*1024}onRequest(e){this.requestHandler=e}onNotification(e){this.notificationHandler=e}start(){this.running||(this.running=!0,this.rl=dU.createInterface({input:this.inputStream,crlfDelay:1/0}),this.rl.on("line",e=>{this.handleLine(e).catch(t=>{this.metrics.errors++,console.error("[StdioTransport] Error handling line:",t)})}),this.rl.on("close",()=>{let e=this.running;if(this.running=!1,!e)return;if(this.inputStream.readableEnded===!0){this.closeHandler&&this.closeHandler();return}this.errorHandler&&this.errorHandler(new Error("Transport connection closed unexpectedly"))}),this.rl.on("error",e=>{this.metrics.errors++,console.error("[StdioTransport] Readline error:",e),this.errorHandler&&this.errorHandler(e)}))}stop(){this.running=!1,this.rl&&(this.rl.close(),this.rl=null)}async sendResponse(e){await this.write(JSON.stringify(e))}async sendNotification(e,t){let r={jsonrpc:"2.0",method:e,params:t};await this.write(JSON.stringify(r))}onError(e){this.errorHandler=e}onClose(e){this.closeHandler=e}reconnect(){if(this.inputStream.readableEnded===!0){this.running=!1,this.closeHandler&&this.closeHandler();return}this.rl&&(this.rl.close(),this.rl=null),this.running=!1,this.start()}getMetrics(){return{...this.metrics}}isRunning(){return this.running}async handleLine(e){if(!e.trim())return;if(this.metrics.bytesReceived+=Buffer.byteLength(e,"utf-8"),Buffer.byteLength(e,"utf-8")>this.maxMessageSize){this.metrics.errors++,await this.sendError(null,nn.INVALID_REQUEST,"Message too large");return}let t;try{t=k(e)}catch{this.metrics.errors++,await this.sendError(null,nn.PARSE_ERROR,"Parse error");return}if(t.jsonrpc!=="2.0"){this.metrics.errors++,await this.sendError(t.id??null,nn.INVALID_REQUEST,"Invalid JSON-RPC version");return}if(!t.method||typeof t.method!="string"){this.metrics.errors++,await this.sendError(t.id??null,nn.INVALID_REQUEST,"Missing or invalid method");return}this.metrics.messagesReceived++,t.id!==void 0?await this.handleRequest(t):await this.handleNotification(t)}async handleRequest(e){if(!this.requestHandler){await this.sendError(e.id,nn.INTERNAL_ERROR,"No request handler registered");return}try{let t=await this.requestHandler(e);await this.sendResponse({jsonrpc:"2.0",id:e.id,result:t})}catch(t){if(fA(t))await this.sendError(e.id,t.code,t.message,t.data);else{let r=t;await this.sendError(e.id,nn.INTERNAL_ERROR,r.message||"Internal error")}}}async handleNotification(e){if(this.notificationHandler)try{await this.notificationHandler(e)}catch(t){this.metrics.errors++,console.error("[StdioTransport] Notification handler error:",t)}}async sendError(e,t,r,n){let i={jsonrpc:"2.0",id:e,error:{code:t,message:r,data:n}};await this.sendResponse(i)}async write(e){let r=[0,500,1e3];for(let n=0;n<3;n++)try{await this.writeOnce(e);return}catch(i){if(n<2)console.error(`[StdioTransport] Write attempt ${n+1} failed, retrying in ${r[n+1]}ms...`),await new Promise(s=>setTimeout(s,r[n+1]));else throw i}}async writeOnce(e){let t=e+`
6083
+ `),n=await fetch(`${t}/v1/messages`,{method:"POST",headers:{"content-type":"application/json","x-api-key":e,"anthropic-version":"2023-06-01"},body:JSON.stringify({model:hAe,max_tokens:fAe,messages:[{role:"user",content:r}]})});if(!n.ok)return null;let s=(await n.json()).content?.[0]?.text;if(!s)return null;let a=s.match(/\{[\s\S]*\}/);if(!a)return null;try{let c=JSON.parse(a[0]);return typeof c.quality!="number"||typeof c.reasoning!="string"?null:{quality:Math.max(0,Math.min(1,c.quality)),reasoning:c.reasoning.slice(0,200),improvement:typeof c.improvement=="string"?c.improvement.slice(0,200):void 0}}catch{return null}}var hAe,fAe,yAe,WZ=v(()=>{"use strict";Y();hAe="claude-haiku-4-5-20251001",fAe=200,yAe=5});var J$={};j(J$,{handleModelRoute:()=>t0,handleReasoningBankStats:()=>wAe,handleRoutingEconomics:()=>n0,handleRoutingMetrics:()=>r0,handleTaskCancel:()=>ZR,handleTaskList:()=>JR,handleTaskOrchestrate:()=>e0,handleTaskOutcomeRecord:()=>SAe,handleTaskStatus:()=>YR,handleTaskStatusWithLearning:()=>EAe,handleTaskSubmit:()=>XR,subscribeTrajectoryEvents:()=>RAe,unsubscribeTrajectoryEvents:()=>KZ});async function XR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=await e.submitTask({type:o.type,priority:o.priority||"p1",targetDomains:o.targetDomains||[],payload:o.payload||{},timeout:o.timeout||3e5});if(!t.success)return{success:!1,error:t.error.message};let r=e.getTaskStatus(t.value);return{success:!0,data:{taskId:t.value,type:o.type,priority:o.priority||"p1",status:r?.status==="running"?"pending":"queued",assignedDomain:r?.assignedDomain}}}catch(t){return{success:!1,error:`Failed to submit task: ${S(t)}`}}}async function JR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.listTasks({status:o.status,priority:o.priority,domain:o.domain});return{success:!0,data:(typeof o.limit=="number"?t.slice(0,o.limit):t).map(i=>({taskId:i.taskId,type:i.task.type,status:i.status,priority:i.task.priority,assignedDomain:i.assignedDomain,assignedAgents:i.assignedAgents,result:i.result,error:i.error,createdAt:i.task.createdAt.toISOString(),startedAt:i.startedAt?.toISOString(),completedAt:i.completedAt?.toISOString(),duration:i.completedAt&&i.startedAt?i.completedAt.getTime()-i.startedAt.getTime():void 0}))}}catch(t){return{success:!1,error:`Failed to list tasks: ${S(t)}`}}}async function YR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.getTaskStatus(o.taskId);return t?{success:!0,data:{taskId:t.taskId,type:t.task.type,status:t.status,priority:t.task.priority,assignedDomain:t.assignedDomain,assignedAgents:t.assignedAgents,result:o.detailed?t.result:void 0,error:t.error,createdAt:t.task.createdAt.toISOString(),startedAt:t.startedAt?.toISOString(),completedAt:t.completedAt?.toISOString(),duration:t.completedAt&&t.startedAt?t.completedAt.getTime()-t.startedAt.getTime():void 0}}:{success:!1,error:`Task not found: ${o.taskId}`}}catch(t){return{success:!1,error:`Failed to get task status: ${S(t)}`}}}async function ZR(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=await e.cancelTask(o.taskId);return t.success?{success:!0,data:{taskId:o.taskId,cancelled:!0}}:{success:!1,error:t.error.message}}catch(t){return{success:!1,error:`Failed to cancel task: ${S(t)}`}}}async function e0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e,workflowOrchestrator:t}=ye();try{let r=o.context?.project||QZ(o.task),n=o.priority==="critical"||/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),s=await(await $s()).routeTask({task:o.task,codeContext:o.codeContext,filePaths:o.filePaths,manualTier:o.manualTier,isCritical:n,agentType:`qe-${r}`,domain:r,metadata:{inferredDomain:r,hasCodeContext:!!o.codeContext,fileCount:o.filePaths?.length}}),a=await On(),c=await a.getExperienceGuidance(o.task,o.context?.project),l=await a.searchPatterns(o.task,{limit:5,domain:o.context?.project??r}).catch(()=>[]),u=CAe(o.task),d=TAe(o.priority||"medium"),p=bAe[u];if(p&&t){console.log(`[TaskOrchestrate] Task type '${u}' has workflow '${p}' - executing workflow`);let y=o.task.match(/https?:\/\/[^\s]+/i),b=y?y[0]:void 0;b&&console.log(`[TaskOrchestrate] Detected URL for analysis: ${b}`);let C={targetId:o.context?.project||b||`task-${Date.now()}`,targetType:b?"website":"epic",description:o.task,acceptanceCriteria:o.context?.requirements||[],url:b,routing:{tier:s.decision.tier,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall},patternHints:l.length>0?l.map(A=>({patternId:A.id,name:A.name,description:A.description,confidence:A.confidence,similarity:A.qualityScore,canReuse:A.tier==="long-term"})):void 0},E=await t.executeWorkflow(p,C);return E.success?{success:!0,data:{taskId:E.value,type:u,priority:d,strategy:o.strategy||"adaptive",status:"workflow-started",message:`Workflow '${p}' started for task: ${o.task}`,routing:{tier:s.decision.tier,tierName:s.tierInfo.name,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence,useAgentBooster:s.useAgentBooster,rationale:s.decision.rationale,decisionTimeMs:s.decision.metadata.decisionTimeMs}}}:{success:!1,error:`Workflow execution failed: ${E.error.message}`}}let m={description:o.task,strategy:o.strategy||"adaptive",maxAgents:o.maxAgents,context:o.context};u==="generate-tests"&&(m.sourceFiles=o.filePaths||[],m.sourceCode=o.codeContext||"",m.language=m.language||"typescript",m.testType=m.testType||"unit");let g=await e.submitTask({type:u,priority:d,targetDomains:[],payload:{...m,routing:{tier:s.decision.tier,modelId:s.modelId,executionStrategy:s.executionStrategy,useAgentBooster:s.useAgentBooster,agentBoosterTransform:s.decision.agentBoosterTransform,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence},experienceGuidance:c?{strategy:c.recommendedStrategy,actions:c.suggestedActions,confidence:c.confidence,tokenSavings:c.estimatedTokenSavings}:void 0,patternHints:l.length>0?l.map(y=>({patternId:y.id,name:y.name,description:y.description,confidence:y.confidence,similarity:y.qualityScore,canReuse:y.tier==="long-term"})):void 0},timeout:6e5});if(!g.success)return{success:!1,error:g.error.message};let h=g.value;return await Q$(h,o.task,{agent:"queen-coordinator",domain:o.context?.project}),process.env.AQE_TRAJECTORY_JUDGE==="1"&&process.env.ANTHROPIC_API_KEY&&HZ().catch(y=>{console.warn("[TrajectoryJudge] failed:",y instanceof Error?y.message:y)}),{success:!0,data:{taskId:h,type:u,priority:d,strategy:o.strategy||"adaptive",status:"submitted",message:`Task orchestrated: ${o.task}${c?" (with experience guidance)":""}`,routing:{tier:s.decision.tier,tierName:s.tierInfo.name,modelId:s.modelId,executionStrategy:s.executionStrategy,complexity:s.decision.complexityAnalysis.overall,confidence:s.decision.confidence,useAgentBooster:s.useAgentBooster,rationale:s.decision.rationale,decisionTimeMs:s.decision.metadata.decisionTimeMs}}}}catch(r){return{success:!1,error:`Failed to orchestrate task: ${S(r)}`}}}async function t0(o){try{let e=await $s(),t=o.domain||QZ(o.task),r=o.isCritical??/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),n=await e.routeTask({task:o.task,codeContext:o.codeContext,filePaths:o.filePaths,manualTier:o.manualTier,isCritical:r,agentType:o.agentType||`qe-${t}`,domain:t,metadata:{inferredDomain:t,hasCodeContext:!!o.codeContext,fileCount:o.filePaths?.length}});return{success:!0,data:{tier:n.decision.tier,tierName:n.tierInfo.name,modelId:n.modelId,executionStrategy:n.executionStrategy,useAgentBooster:n.useAgentBooster,agentBoosterTransform:n.decision.agentBoosterTransform,complexity:{overall:n.decision.complexityAnalysis.overall,code:n.decision.complexityAnalysis.codeComplexity,reasoning:n.decision.complexityAnalysis.reasoningComplexity,scope:n.decision.complexityAnalysis.scopeComplexity},confidence:n.decision.confidence,rationale:n.decision.rationale,warnings:n.decision.warnings,budget:{allowed:n.decision.budgetDecision.allowed,wasDowngraded:n.decision.budgetDecision.wasDowngraded,estimatedCostUsd:n.decision.budgetDecision.estimatedCostUsd},decisionTimeMs:n.decision.metadata.decisionTimeMs}}}catch(e){return{success:!1,error:`Failed to route task: ${S(e)}`}}}async function r0(o){try{let e=await $s(),t=e.getRoutingStats(),r=e.getMetrics(),n={stats:t,modelRouterMetrics:{totalDecisions:r.totalDecisions,avgDecisionTimeMs:r.avgDecisionTimeMs,agentBoosterStats:r.agentBoosterStats,budgetStats:r.budgetStats}};return o.includeLog&&(n.log=e.getRoutingLog(o.logLimit||100)),{success:!0,data:n}}catch(e){return{success:!1,error:`Failed to get routing metrics: ${S(e)}`}}}async function n0(o){try{let{createRoutingFeedbackCollector:e}=await Promise.resolve().then(()=>(Fm(),I3)),{getGlobalCostTracker:t}=await Promise.resolve().then(()=>(bn(),_2)),r=e(100);await r.initialize(),r.enableEconomicRouting({...o.taskComplexity!=null?{}:{}},t());let n=r.getEconomicReport();return n?{success:!0,data:{tierEfficiency:n.tierEfficiency.map(s=>({...s,qualityPerDollar:isFinite(s.qualityPerDollar)?s.qualityPerDollar:"Infinity"})),currentHourlyCostUsd:n.currentHourlyCostUsd,currentDailyCostUsd:n.currentDailyCostUsd,budgetRemaining:n.budgetRemaining,recommendation:n.recommendation,savingsOpportunity:n.savingsOpportunity}}:{success:!1,error:"Economic routing is not available"}}catch(e){return{success:!1,error:`Failed to get economic routing report: ${S(e)}`}}}function QZ(o){let e=o.toLowerCase();return/\b(security|vulnerabilit|cve|owasp|secret|credential|injection|xss|csrf)\b/.test(e)?"security-compliance":/\b(chaos|resilience|fault.?inject|disaster|failover)\b/.test(e)?"chaos-resilience":/\b(defect|bug.?predict|risk.?assess|mutation)\b/.test(e)?"defect-intelligence":/\b(coverage|uncovered|gap.?analy)\b/.test(e)?"coverage-analysis":/\b(quality|code.?review|maintain|tech.?debt)\b/.test(e)?"quality-assessment":/\b(contract|api.?compat|breaking.?change|pact)\b/.test(e)?"contract-testing":/\b(index|knowledge.?graph|semantic|code.?intel)\b/.test(e)?"code-intelligence":/\b(accessib|a11y|wcag|screen.?read)\b/.test(e)?"visual-accessibility":/\b(requirement|bdd|acceptance|user.?stor)\b/.test(e)?"requirements-validation":/\b(generat.*test|test.*generat|write.*test|create.*test)\b/.test(e)?"test-generation":/\b(run.*test|execut.*test)\b/.test(e)?"test-execution":"test-generation"}function CAe(o){let e=o.toLowerCase();return/run\s+(?:\w+\s+)*tests?/.test(e)||/execute\s+(?:\w+\s+)*tests?/.test(e)||e.includes("run tests")||e.includes("execute tests")?"execute-tests":e.includes("generate test")||e.includes("create test")||e.includes("write test")?"generate-tests":e.includes("coverage")||e.includes("uncovered")?"analyze-coverage":e.includes("quality")||e.includes("code quality")?"assess-quality":e.includes("defect")||e.includes("bug")||e.includes("predict")?"predict-defects":e.includes("requirement")||e.includes("bdd")||e.includes("acceptance")?"validate-requirements":e.includes("index")||e.includes("knowledge graph")||e.includes("semantic")?"index-code":e.includes("security")||e.includes("vulnerability")||e.includes("owasp")?"scan-security":e.includes("contract")||e.includes("api contract")||e.includes("pact")?"validate-contracts":e.includes("accessibility")||e.includes("a11y")||e.includes("wcag")?"test-accessibility":e.includes("chaos")||e.includes("resilience")||e.includes("fault")?"run-chaos":e.includes("learn")||e.includes("optimize")||e.includes("improve")?"optimize-learning":e.includes("ideation")||e.includes("quality criteria")||e.includes("htsm")||e.includes("qcsd")||e.includes("testability")||e.includes("pi planning")||e.includes("sprint planning")?"ideation-assessment":"generate-tests"}function TAe(o){switch(o){case"critical":return"p0";case"high":return"p1";case"medium":return"p2";case"low":return"p3";default:return"p1"}}async function SAe(o){try{let e=await On(),t={taskId:o.taskId,task:o.task,taskType:o.taskType,success:o.success,executionTimeMs:o.executionTimeMs,agentId:o.agentId,domain:o.domain,modelTier:o.modelTier,qualityScore:o.qualityScore,error:o.error,metrics:o.metrics};await e.recordTaskOutcome(t);let r=o.success&&(o.qualityScore||.5)>=.6;return{success:!0,data:{recorded:!0,patternStored:r,message:r?`Outcome recorded and pattern stored for task ${o.taskId}`:`Outcome recorded for task ${o.taskId}`}}}catch(e){return{success:!1,error:`Failed to record task outcome: ${S(e)}`}}}async function wAe(){try{let e=await(await On()).getStats();return{success:!0,data:{service:e.service,patterns:{totalPatterns:e.reasoningBank.totalPatterns,byDomain:e.reasoningBank.byDomain,byTier:e.reasoningBank.byTier,learningOutcomes:e.reasoningBank.learningOutcomes,patternSuccessRate:e.reasoningBank.patternSuccessRate},embeddings:{cacheSize:e.reasoningBank.embeddingCacheSize,dimension:e.reasoningBank.embeddingDimension,transformerAvailable:e.reasoningBank.transformerAvailable},performance:{avgRoutingLatencyMs:e.reasoningBank.avgRoutingLatencyMs,p95RoutingLatencyMs:e.reasoningBank.p95RoutingLatencyMs}}}}catch(o){return{success:!1,error:`Failed to get ReasoningBank stats: ${S(o)}`}}}async function EAe(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=ye();try{let t=e.getTaskStatus(o.taskId);if(!t)return{success:!1,error:`Task not found: ${o.taskId}`};let r={taskId:t.taskId,type:t.task.type,status:t.status,priority:t.task.priority,assignedDomain:t.assignedDomain,assignedAgents:t.assignedAgents,result:o.detailed?t.result:void 0,error:t.error,createdAt:t.task.createdAt.toISOString(),startedAt:t.startedAt?.toISOString(),completedAt:t.completedAt?.toISOString(),duration:t.completedAt&&t.startedAt?t.completedAt.getTime()-t.startedAt.getTime():void 0};if((t.status==="completed"||t.status==="failed")&&!jZ.has(o.taskId)){jZ.add(o.taskId);try{let n=await On(),i=r.duration||0,s=t.status==="completed",a=t.task.payload||{},c=typeof a.description=="string"?a.description:t.task.type,l=a.routing,u=await yf(o.taskId,s,t.error),d=u?.metrics.averageQuality??(s?.7:.3);await n.recordTaskOutcome({taskId:o.taskId,task:c,taskType:t.task.type,success:s,executionTimeMs:i,agentId:t.assignedAgents?.[0],domain:t.assignedDomain,modelTier:l?.tier,qualityScore:d,error:t.error,metrics:{testsGenerated:typeof t.result=="object"&&t.result?t.result.testsGenerated:void 0,testsPassed:typeof t.result=="object"&&t.result?t.result.testsPassed:void 0}}),console.error(`[TaskHandler] Recorded learning outcome: task=${o.taskId} success=${s} quality=${d.toFixed(2)} trajectorySteps=${u?.steps.length??0}`)}catch(n){console.error("[TaskHandler] Failed to record outcome:",n)}}return{success:!0,data:r}}catch(t){return{success:!1,error:`Failed to get task status: ${S(t)}`}}}function RAe(o){KZ(o);let e=o.subscribeToEventType("TaskCompleted",async r=>{let{taskId:n}=r.payload;n&&await yf(n,!0).catch(()=>{})}),t=o.subscribeToEventType("TaskFailed",async r=>{let{taskId:n,error:i}=r.payload;n&&await yf(n,!1,i).catch(()=>{})});X$=[e,t]}function KZ(o){for(let e of X$)o.unsubscribe(e);X$=[]}var bAe,jZ,X$,i0=v(()=>{"use strict";Zn();NE();K$();WZ();P();bAe={"ideation-assessment":"qcsd-ideation-swarm"};jZ=new Set;X$=[]});var JZ={};j(JZ,{DEFAULT_STRUCTURAL_HEALTH_CONFIG:()=>XZ,StructuralHealthMonitor:()=>s0,createStructuralHealthMonitor:()=>AAe});function AAe(o){return new s0(o)}var XZ,s0,YZ=v(()=>{"use strict";VN();XZ={healthyThreshold:.4,warningThreshold:.2,maxHistoryEntries:100,enableLogging:!1},s0=class{config;minCutService;history=[];constructor(e){this.config={...XZ,...e},this.minCutService=PE()}computeFleetHealth(e){if(e.length===0)return this.emptyFleetResult();let t=this.minCutService.buildTaskGraphFromTopology(e);return this.computeFleetHealthFromGraph(t,e.length)}computeFleetHealthFromGraph(e,t){if(e.nodes.length===0)return this.emptyFleetResult();let r=this.minCutService.getStructuralHealth(e),n=this.determineStatus(r.normalizedLambda),i={lambda:r.lambda,healthy:r.healthy,weakPoints:r.weakPoints,normalizedLambda:r.normalizedLambda,riskScore:r.riskScore,status:n,suggestions:r.suggestions,measuredAt:new Date};return this.addHistoryEntry({lambda:r.lambda,healthy:r.healthy,weakPointCount:r.weakPoints.length,agentCount:t??e.nodes.length,timestamp:i.measuredAt}),this.config.enableLogging&&this.logHealth(i),i}getTrend(){if(this.history.length<2)return"stable";let e=Math.min(5,this.history.length),t=this.history.slice(-e),r=t[0].lambda,i=t[t.length-1].lambda-r;return Math.abs(i)<.05?"stable":i>0?"improving":"degrading"}getHistory(e){let t=[...this.history];return e!==void 0&&e<t.length?t.slice(-e):t}clearHistory(){this.history.length=0}getMinCutService(){return this.minCutService}determineStatus(e){return e>=this.config.healthyThreshold?"healthy":e>=this.config.warningThreshold?"warning":"critical"}addHistoryEntry(e){this.history.push(e),this.history.length>this.config.maxHistoryEntries&&this.history.splice(0,this.history.length-this.config.maxHistoryEntries)}emptyFleetResult(){return{lambda:0,healthy:!1,weakPoints:[],normalizedLambda:0,riskScore:1,status:"empty",suggestions:["No agents in fleet. Spawn agents to build a topology."],measuredAt:new Date}}logHealth(e){console.error(`[StructuralHealth] Status: ${e.status} | Lambda: ${e.normalizedLambda.toFixed(3)} | Weak points: ${e.weakPoints.length} | Risk: ${(e.riskScore*100).toFixed(0)}%`)}}});var vW={};j(vW,{adoptExternalFleet:()=>xAe,assignAgentLevel:()=>Y$,disposeFleet:()=>c0,getAgentLevel:()=>Z$,getAllAgentLevels:()=>PAe,getFleetState:()=>ye,getFleetTopology:()=>kAe,handleAQEHealth:()=>l0,handleFleetHealth:()=>o0,handleFleetInit:()=>ku,handleFleetStatus:()=>a0,isFleetInitialized:()=>ge});function ye(){return B}function ge(){return B.initialized&&B.kernel!==null&&B.queen!==null}function xAe(o){return ge()||(B.fleetId=`fleet-${R().slice(0,8)}`,B.kernel=o.kernel,B.queen=o.queen,B.router=o.router??null,B.workflowOrchestrator=o.workflowOrchestrator??null,B.initialized=!0,B.initTime=new Date,B.topology=o.topology??"hierarchical",B.agentLevels.clear()),B.fleetId}function kAe(){return B.topology}function Y$(o,e){if(B.topology!=="hierarchical"){let i={agentId:o,domain:e,level:"worker",spawnedAt:new Date};return B.agentLevels.set(o,i),"worker"}let r=Array.from(B.agentLevels.values()).find(i=>i.domain===e&&i.level==="lead")?"worker":"lead",n={agentId:o,domain:e,level:r,spawnedAt:new Date};return B.agentLevels.set(o,n),r}function Z$(o){return B.agentLevels.get(o)}function PAe(){return B.agentLevels}async function ku(o){try{if(B.initialized&&B.kernel&&B.queen)return{success:!0,data:{fleetId:B.fleetId,topology:o.topology||"hierarchical",maxAgents:o.maxAgents||15,enabledDomains:o.enabledDomains||ZZ,status:"ready"}};B.fleetId=`fleet-${R().slice(0,8)}`;let e=o.enabledDomains||[...re],t=e.filter(l=>l!=="coordination"),r=process.env.AQE_MEMORY_BACKEND==="memory"?"memory":o.memoryBackend||"hybrid";B.kernel=new Rw({maxConcurrentAgents:o.maxAgents||15,memoryBackend:r,hnswEnabled:!0,lazyLoading:o.lazyLoading!==!1,enabledDomains:e}),await B.kernel.initialize(),B.router=new aE(B.kernel.eventBus),await B.router.initialize();let n=l=>B.kernel.getDomainAPI(l),i=new qR(B.kernel.eventBus,B.kernel.memory,n),s=B.kernel.plugins;await s.loadAll();let a=new Map;for(let l of s.getLoaded()){let u=s.getPlugin(l);u&&a.set(l,u)}try{let{getDaemon:l}=await Promise.resolve().then(()=>(QR(),jR)),u=l().getWorkerManager();u.setKernel(B.kernel),u.setMemory(B.kernel.memory)}catch(l){console.warn(`[fleet_init] Daemon worker manager wiring skipped: ${S(l)}`)}B.queen=HX(B.kernel,B.router,i,void 0,a),await B.queen.initialize(),B.workflowOrchestrator=new Vg(B.kernel.eventBus,B.kernel.memory,B.kernel.coordinator),await B.workflowOrchestrator.initialize(),MAe(B.kernel,B.workflowOrchestrator);let{subscribeTrajectoryEvents:c}=await Promise.resolve().then(()=>(i0(),J$));return c(B.router),B.initialized=!0,B.initTime=new Date,B.topology=o.topology||"hierarchical",B.agentLevels.clear(),{success:!0,data:{fleetId:B.fleetId,topology:B.topology,maxAgents:o.maxAgents||15,enabledDomains:t,status:"initialized"}}}catch(e){return{success:!1,error:`Failed to initialize fleet: ${S(e)}`}}}async function a0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let e=B.queen.getHealth(),t=B.queen.getMetrics(),r={status:e.status,uptime:t.uptime,agents:{total:e.totalAgents,active:e.activeAgents,idle:e.totalAgents-e.activeAgents},tasks:{pending:e.pendingTasks,running:e.runningTasks,completed:t.tasksCompleted,failed:t.tasksFailed}};if(o.includeDomains){let i=[];for(let[s,a]of e.domainHealth)i.push({domain:s,status:a.status,agents:a.agents.total,load:B.queen.getDomainLoad(s)});r.domains=i}let n=B.queen.getDomainTeamManager?.();if(n){let i=n.listDomainTeams(),s=0,a=0;for(let c of i)s+=1+c.teammateIds.length,n.getTeamHealth(c.domain)?.healthy&&a++;r.teams={active:i.length,totalAgentsInTeams:s,healthyCount:a}}o.includeMetrics&&(r.metrics={tasksReceived:t.tasksReceived,tasksCompleted:t.tasksCompleted,tasksFailed:t.tasksFailed,agentUtilization:t.agentUtilization,averageTaskDuration:t.averageTaskDuration});try{let{getUnifiedMemory:i}=await Promise.resolve().then(()=>(Y(),vr)),s=i();if(s.isInitialized()){let a=l=>{try{return s.queryCount(l)}catch{return 0}},c=await s.vectorCount();r.learning={totalPatterns:a("qe_patterns"),totalExperiences:a("captured_experiences"),totalTrajectories:a("qe_trajectories"),vectorCount:c,experienceApplications:a("experience_applications"),dreamCycles:a("dream_cycles"),embeddingDimension:384}}}catch{}return{success:!0,data:r}}catch(e){return{success:!1,error:`Failed to get fleet status: ${S(e)}`}}}async function o0(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{if(o.domain){let r=B.queen.getDomainHealth(o.domain);return r?{success:!0,data:{domain:o.domain,status:r.status,agents:r.agents,errors:r.errors,lastActivity:r.lastActivity?.toISOString()}}:{success:!1,error:`Domain not found: ${o.domain}`}}let e=B.queen.getHealth(),t={status:e.status,totalAgents:e.totalAgents,activeAgents:e.activeAgents,pendingTasks:e.pendingTasks,runningTasks:e.runningTasks,workStealingActive:e.workStealingActive,lastHealthCheck:e.lastHealthCheck.toISOString()};if(o.detailed){let r={};for(let[n,i]of e.domainHealth)r[n]={status:i.status,agents:i.agents,errors:i.errors.length,lastActivity:i.lastActivity?.toISOString()};t.domains=r,t.issues=e.issues.map(n=>({severity:n.severity,message:n.message,domain:n.domain,timestamp:n.timestamp.toISOString()}))}try{let{StructuralHealthMonitor:r}=await Promise.resolve().then(()=>(YZ(),JZ)),n=new r,i=[];for(let[c]of e.domainHealth){let l=B.queen.getAgentsByDomain(c);for(let u of l)i.push({id:u.id,name:u.name,domain:u.domain})}let s=i.map(c=>({id:c.id,name:c.name,domain:c.domain,capabilities:[c.domain],dependsOn:[],weight:1})),a=n.computeFleetHealth(s);t.structuralHealth={lambda:a.lambda,healthy:a.healthy,normalizedLambda:a.normalizedLambda,riskScore:a.riskScore,status:a.status,weakPoints:a.weakPoints,suggestions:a.suggestions}}catch{}return{success:!0,data:t}}catch(e){return{success:!1,error:`Failed to get fleet health: ${S(e)}`}}}async function c0(){if(t9(),VE(),hZ(),B.workflowOrchestrator&&(await B.workflowOrchestrator.dispose(),B.workflowOrchestrator=null),B.queen&&(await B.queen.dispose(),B.queen=null),B.router){try{let{unsubscribeTrajectoryEvents:o}=await Promise.resolve().then(()=>(i0(),J$));o(B.router)}catch{}await B.router.dispose(),B.router=null}B.kernel&&(await B.kernel.dispose(),B.kernel=null),B.initialized=!1,B.fleetId=null,B.initTime=null,B.topology="hierarchical",B.agentLevels.clear()}async function l0(){let o=performance.now();try{let e=ge(),t=B.initTime?Date.now()-B.initTime.getTime():0,r={connected:!1,totalEntries:0,namespaces:0},n={enabled:!1,vectorCount:0},i=0;if(e&&B.kernel){let u=B.kernel.memory;try{r.connected=!0;let d=await u.count("default"),p=await u.count("learning"),m=await u.count("patterns");r.totalEntries=d+p+m;let g=0;for(let h of["default","learning","patterns","mcp-tools","coordination"])await u.count(h)>0&&g++;r.namespaces=g}catch{}try{let d=process.env.AQE_V3_HNSW_ENABLED==="true";n.enabled=d;let p=u;d&&typeof p.vectorCount=="function"&&(n.vectorCount=await p.vectorCount())}catch{}try{i=(await u.search("pattern:*",1e3)).length}catch{}}let s=e&&B.kernel?(B.kernel.getLoadedDomains?.()??ZZ).length:0,a=null;try{let{getSharedRvfDualWriterSync:u}=await Promise.resolve().then(()=>(Xi(),Ea)),d=u();if(d){let p=d.status(),m=d.getDivergenceReport();a={mode:p.mode,vectorCount:p.rvf?.totalVectors??0,divergences:m.divergences,promotionSafe:d.isPromotionSafe()}}}catch{}let c=null;try{let{SQLitePatternStore:u}=await Promise.resolve().then(()=>(hc(),wk)),d=new u;await d.initialize(),c=d.getGhostPatternCount(),d.close()}catch{}return{success:!0,data:{status:e?"healthy":"unhealthy",version:"3.12.1",loadedDomains:s,memory:r,hnsw:n,rvf:a??void 0,ghostPatterns:c??void 0,loadedPatterns:i,uptimeMs:t,timestamp:new Date().toISOString()},metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:R(),toolName:"aqe_health"}}}catch(e){return{success:!1,error:S(e),metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:R(),toolName:"aqe_health"}}}}function MAe(o,e){let t=o.getDomainAPI("requirements-validation");t?.registerWorkflowActions&&(t.registerWorkflowActions(e),console.log("[Fleet] Registered requirements-validation workflow actions (includes QCSD Ideation)"));let r=o.getDomainAPI("visual-accessibility");r?.registerWorkflowActions&&(r.registerWorkflowActions(e),console.log("[Fleet] Registered visual-accessibility workflow actions"))}var ZZ,B,Zn=v(()=>{"use strict";N();S8();L();WX();GO();jX();c1();GE();D$();fZ();P();ZZ=re.filter(o=>o!=="coordination"),B={fleetId:null,kernel:null,queen:null,router:null,workflowOrchestrator:null,initialized:!1,initTime:null,topology:"hierarchical",agentLevels:new Map}});U();import*as dU from"readline";var nn={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,SERVER_ERROR:-32e3},Fo=class extends Error{constructor(t,r,n){super(r);this.code=t;this.data=n;this.name="McpError"}code;data};function fA(o){return typeof o=="object"&&o!==null&&typeof o.code=="number"&&typeof o.message=="string"}var hA=class{inputStream;outputStream;maxMessageSize;rl=null;requestHandler=null;notificationHandler=null;errorHandler=null;closeHandler=null;running=!1;metrics={messagesReceived:0,messagesSent:0,errors:0,bytesReceived:0,bytesSent:0};constructor(e={}){this.inputStream=e.inputStream??process.stdin,this.outputStream=e.outputStream??process.stdout,this.maxMessageSize=e.maxMessageSize??10*1024*1024}onRequest(e){this.requestHandler=e}onNotification(e){this.notificationHandler=e}start(){this.running||(this.running=!0,this.rl=dU.createInterface({input:this.inputStream,crlfDelay:1/0}),this.rl.on("line",e=>{this.handleLine(e).catch(t=>{this.metrics.errors++,console.error("[StdioTransport] Error handling line:",t)})}),this.rl.on("close",()=>{let e=this.running;if(this.running=!1,!e)return;if(this.inputStream.readableEnded===!0){this.closeHandler&&this.closeHandler();return}this.errorHandler&&this.errorHandler(new Error("Transport connection closed unexpectedly"))}),this.rl.on("error",e=>{this.metrics.errors++,console.error("[StdioTransport] Readline error:",e),this.errorHandler&&this.errorHandler(e)}))}stop(){this.running=!1,this.rl&&(this.rl.close(),this.rl=null)}async sendResponse(e){await this.write(JSON.stringify(e))}async sendNotification(e,t){let r={jsonrpc:"2.0",method:e,params:t};await this.write(JSON.stringify(r))}onError(e){this.errorHandler=e}onClose(e){this.closeHandler=e}reconnect(){if(this.inputStream.readableEnded===!0){this.running=!1,this.closeHandler&&this.closeHandler();return}this.rl&&(this.rl.close(),this.rl=null),this.running=!1,this.start()}getMetrics(){return{...this.metrics}}isRunning(){return this.running}async handleLine(e){if(!e.trim())return;if(this.metrics.bytesReceived+=Buffer.byteLength(e,"utf-8"),Buffer.byteLength(e,"utf-8")>this.maxMessageSize){this.metrics.errors++,await this.sendError(null,nn.INVALID_REQUEST,"Message too large");return}let t;try{t=k(e)}catch{this.metrics.errors++,await this.sendError(null,nn.PARSE_ERROR,"Parse error");return}if(t.jsonrpc!=="2.0"){this.metrics.errors++,await this.sendError(t.id??null,nn.INVALID_REQUEST,"Invalid JSON-RPC version");return}if(!t.method||typeof t.method!="string"){this.metrics.errors++,await this.sendError(t.id??null,nn.INVALID_REQUEST,"Missing or invalid method");return}this.metrics.messagesReceived++,t.id!==void 0?await this.handleRequest(t):await this.handleNotification(t)}async handleRequest(e){if(!this.requestHandler){await this.sendError(e.id,nn.INTERNAL_ERROR,"No request handler registered");return}try{let t=await this.requestHandler(e);await this.sendResponse({jsonrpc:"2.0",id:e.id,result:t})}catch(t){if(fA(t))await this.sendError(e.id,t.code,t.message,t.data);else{let r=t;await this.sendError(e.id,nn.INTERNAL_ERROR,r.message||"Internal error")}}}async handleNotification(e){if(this.notificationHandler)try{await this.notificationHandler(e)}catch(t){this.metrics.errors++,console.error("[StdioTransport] Notification handler error:",t)}}async sendError(e,t,r,n){let i={jsonrpc:"2.0",id:e,error:{code:t,message:r,data:n}};await this.sendResponse(i)}async write(e){let r=[0,500,1e3];for(let n=0;n<3;n++)try{await this.writeOnce(e);return}catch(i){if(n<2)console.error(`[StdioTransport] Write attempt ${n+1} failed, retrying in ${r[n+1]}ms...`),await new Promise(s=>setTimeout(s,r[n+1]));else throw i}}async writeOnce(e){let t=e+`
6084
6084
  `;return this.outputStream.writableNeedDrain&&await new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error("Transport drain timeout after 30 seconds"))},3e4);this.outputStream.once("drain",()=>{clearTimeout(i),r()})}),new Promise((r,n)=>{let i=setTimeout(()=>{this.metrics.errors++,n(new Error("Transport write timeout after 120 seconds"))},12e4);this.outputStream.write(t,"utf-8",s=>{clearTimeout(i),s?(this.metrics.errors++,n(s)):(this.metrics.messagesSent++,this.metrics.bytesSent+=Buffer.byteLength(t,"utf-8"),r())})})}};function yA(o){return new hA(o)}N();U();N();var nie={keepAliveInterval:15e3,connectionTimeout:3e5,maxConnections:1e3,enableMetrics:!0},Gf=class{config;connections=new Map;threadIndex=new Map;closedConnections=[];keepAliveTimers=new Map;timeoutTimers=new Map;disposed=!1;constructor(e={}){this.config={...nie,...e}}createConnection(e,t,r){if(this.disposed)throw new Error("ConnectionManager has been disposed");if(this.connections.size>=this.config.maxConnections)throw new Error(`Maximum connections (${this.config.maxConnections}) exceeded`);let n=R(),i=Date.now(),s={id:n,threadId:e,runId:t,createdAt:i,lastActivity:i,response:r,abortController:new AbortController,state:"connecting",metrics:{eventsSent:0,bytesSent:0,keepAlivesSent:0,errors:0,startTime:i}};this.connections.set(n,s);let a=this.threadIndex.get(e);return a||(a=new Set,this.threadIndex.set(e,a)),a.add(n),this.startKeepAlive(n),this.startTimeout(n),s}getConnection(e){return this.connections.get(e)}getConnectionByThreadId(e){let t=this.threadIndex.get(e);if(t)for(let r of t){let n=this.connections.get(r);if(n)return n}}getActiveConnections(){return Array.from(this.connections.values()).filter(e=>e.state==="open"||e.state==="connecting")}updateState(e,t){let r=this.connections.get(e);r&&(r.state=t,r.lastActivity=Date.now(),t==="closed"&&(r.metrics.endTime=Date.now()))}recordEventSent(e,t){let r=this.connections.get(e);r&&(r.metrics.eventsSent++,r.metrics.bytesSent+=t,r.lastActivity=Date.now(),this.resetTimeout(e))}recordError(e){let t=this.connections.get(e);t&&t.metrics.errors++}closeConnection(e,t){let r=this.connections.get(e);if(!r)return;if(this.stopKeepAlive(e),this.stopTimeout(e),r.state="closing",r.metrics.endTime=Date.now(),r.abortController.abort(t||"Connection closed"),!r.response.writableEnded)try{r.response.end()}catch{}for(r.state="closed",this.closedConnections.push(r);this.closedConnections.length>1e3;)this.closedConnections.shift();let n=this.threadIndex.get(r.threadId);n&&(n.delete(e),n.size===0&&this.threadIndex.delete(r.threadId)),this.connections.delete(e)}closeThreadConnections(e,t){let r=this.threadIndex.get(e);if(!r)return;let n=Array.from(r);for(let i of n)this.closeConnection(i,t)}getMetrics(){let e=Array.from(this.connections.values()),t=[...e,...this.closedConnections],r=e.filter(s=>s.state==="open"||s.state==="connecting"),n=t.filter(s=>s.metrics.endTime).map(s=>(s.metrics.endTime??0)-s.metrics.startTime),i=n.length>0?n.reduce((s,a)=>s+a,0)/n.length:0;return{totalConnections:t.length,activeConnections:r.length,totalEventsSent:t.reduce((s,a)=>s+a.metrics.eventsSent,0),totalBytesSent:t.reduce((s,a)=>s+a.metrics.bytesSent,0),totalErrors:t.reduce((s,a)=>s+a.metrics.errors,0),averageConnectionDuration:i}}dispose(){if(this.disposed)return;this.disposed=!0;let e=Array.from(this.connections.keys());for(let n of e)this.closeConnection(n,"Manager disposed");let t=Array.from(this.keepAliveTimers.values());for(let n of t)clearInterval(n);this.keepAliveTimers.clear();let r=Array.from(this.timeoutTimers.values());for(let n of r)clearTimeout(n);this.timeoutTimers.clear()}startKeepAlive(e){let t=setInterval(()=>{this.sendKeepAlive(e)},this.config.keepAliveInterval);this.keepAliveTimers.set(e,t)}stopKeepAlive(e){let t=this.keepAliveTimers.get(e);t&&(clearInterval(t),this.keepAliveTimers.delete(e))}sendKeepAlive(e){let t=this.connections.get(e);if(!(!t||t.state!=="open"))try{t.response.write(`: keep-alive
6085
6085
 
6086
6086
  `),t.metrics.keepAlivesSent++,t.lastActivity=Date.now();let n=t.response;n.flush&&typeof n.flush=="function"&&n.flush()}catch{this.closeConnection(e,"Keep-alive failed")}}startTimeout(e){let t=setTimeout(()=>{this.closeConnection(e,"Connection timeout")},this.config.connectionTimeout);this.timeoutTimers.set(e,t)}stopTimeout(e){let t=this.timeoutTimers.get(e);t&&(clearTimeout(t),this.timeoutTimers.delete(e))}resetTimeout(e){this.stopTimeout(e),this.startTimeout(e)}};function RA(o){return new Gf(o)}var Ye={RUN_STARTED:"RUN_STARTED",RUN_FINISHED:"RUN_FINISHED",RUN_ERROR:"RUN_ERROR",STEP_STARTED:"STEP_STARTED",STEP_FINISHED:"STEP_FINISHED",TEXT_MESSAGE_START:"TEXT_MESSAGE_START",TEXT_MESSAGE_CONTENT:"TEXT_MESSAGE_CONTENT",TEXT_MESSAGE_END:"TEXT_MESSAGE_END",TOOL_CALL_START:"TOOL_CALL_START",TOOL_CALL_ARGS:"TOOL_CALL_ARGS",TOOL_CALL_END:"TOOL_CALL_END",TOOL_CALL_RESULT:"TOOL_CALL_RESULT",STATE_SNAPSHOT:"STATE_SNAPSHOT",STATE_DELTA:"STATE_DELTA",MESSAGES_SNAPSHOT:"MESSAGES_SNAPSHOT",ACTIVITY_SNAPSHOT:"ACTIVITY_SNAPSHOT",ACTIVITY_DELTA:"ACTIVITY_DELTA",RAW:"RAW",CUSTOM:"CUSTOM"};var iie={keepAliveInterval:15e3,maxBufferSize:100,flushInterval:50,parseBody:!0,maxBodySize:1024*1024,connectionTimeout:3e5,customHeaders:{}},AA=class{buffer=[];flushTimer=null;flushInterval;maxSize;onFlush;constructor(e,t,r){this.flushInterval=e,this.maxSize=t,this.onFlush=r}add(e){if(this.buffer.push(e),this.buffer.length>=this.maxSize){this.flush();return}this.flushTimer||(this.flushTimer=setTimeout(()=>{this.flush()},this.flushInterval))}flush(){if(this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.buffer.length>0){let e=this.buffer;this.buffer=[],this.onFlush(e)}}clear(){this.flushTimer&&(clearTimeout(this.flushTimer),this.flushTimer=null),this.buffer=[]}get size(){return this.buffer.length}},Hf=class{config;connectionManager;agentHandler=null;disposed=!1;constructor(e={}){this.config={...iie,...e},this.connectionManager=RA({keepAliveInterval:this.config.keepAliveInterval,connectionTimeout:this.config.connectionTimeout})}setAgentHandler(e){this.agentHandler=e}async handleRequest(e,t){if(this.disposed){this.sendError(t,503,"Service Unavailable","Transport disposed");return}if(e.method!=="POST"){this.sendError(t,405,"Method Not Allowed","Only POST is supported");return}let r;try{r=await this.parseRequestBody(e)}catch(c){let l=c instanceof Error?c.message:"Failed to parse request body";this.sendError(t,400,"Bad Request",l);return}if(!r.threadId){this.sendError(t,400,"Bad Request","Missing required field: threadId");return}let n=r.runId||R();this.setSSEHeaders(t);let i;try{i=this.connectionManager.createConnection(r.threadId,n,t)}catch(c){let l=c instanceof Error?c.message:"Failed to create connection";this.sendError(t,503,"Service Unavailable",l);return}this.connectionManager.updateState(i.id,"open");let s=new AA(this.config.flushInterval,this.config.maxBufferSize,c=>this.writeEvents(i,c)),a=c=>{i.state==="open"&&(c.timestamp||(c.timestamp=Date.now()),s.add(c))};e.on("close",()=>{s.clear(),this.connectionManager.closeConnection(i.id,"Client disconnected")}),e.on("error",()=>{s.clear(),this.connectionManager.recordError(i.id),this.connectionManager.closeConnection(i.id,"Request error")}),t.on("error",()=>{s.clear(),this.connectionManager.recordError(i.id),this.connectionManager.closeConnection(i.id,"Response error")}),a({type:Ye.RUN_STARTED,threadId:r.threadId,runId:n}),s.flush();try{if(!this.agentHandler)throw new Error("No agent handler registered");await this.agentHandler(r,a,i.abortController.signal),s.flush(),i.state==="open"&&this.writeEvent(i,{type:Ye.RUN_FINISHED,runId:n,outcome:"success",timestamp:Date.now()})}catch(c){s.flush();let l=c instanceof Error?c.message:"Unknown error";!(c instanceof Error&&c.name==="AbortError")&&i.state==="open"&&(this.writeEvent(i,{type:Ye.RUN_ERROR,runId:n,message:l,code:"INTERNAL_ERROR",timestamp:Date.now()}),this.connectionManager.recordError(i.id))}finally{s.clear(),this.connectionManager.closeConnection(i.id,"Request complete")}}getMetrics(){return this.connectionManager.getMetrics()}getActiveConnectionsCount(){return this.connectionManager.getActiveConnections().length}closeAllConnections(e){let t=this.connectionManager.getActiveConnections();for(let r of t)this.connectionManager.closeConnection(r.id,e)}dispose(){this.disposed||(this.disposed=!0,this.connectionManager.dispose())}async parseRequestBody(e){if(e.body)return e.body;if(!this.config.parseBody)throw new Error("Request body parsing is disabled");return new Promise((t,r)=>{let n=[],i=0;e.on("data",s=>{if(i+=s.length,i>this.config.maxBodySize){r(new Error(`Request body exceeds maximum size of ${this.config.maxBodySize} bytes`));return}n.push(s)}),e.on("end",()=>{try{let s=Buffer.concat(n).toString("utf-8");if(!s){r(new Error("Empty request body"));return}let a=k(s);t(a)}catch{r(new Error("Invalid JSON in request body"))}}),e.on("error",s=>{r(s)})})}setSSEHeaders(e){e.setHeader("Content-Type","text/event-stream"),e.setHeader("Cache-Control","no-cache"),e.setHeader("Connection","keep-alive"),e.setHeader("X-Accel-Buffering","no");for(let[t,r]of Object.entries(this.config.customHeaders))e.setHeader(t,r);e.flushHeaders()}writeEvent(e,t){if(!(e.state!=="open"||e.response.writableEnded))try{let r=this.formatSSEEvent(t);e.response.write(r),this.connectionManager.recordEventSent(e.id,Buffer.byteLength(r,"utf-8"));let n=e.response;n.flush&&typeof n.flush=="function"&&n.flush()}catch{this.connectionManager.recordError(e.id)}}writeEvents(e,t){if(!(e.state!=="open"||e.response.writableEnded))try{let r=0,n=[];for(let a of t){let c=this.formatSSEEvent(a);n.push(c),r+=Buffer.byteLength(c,"utf-8")}let i=n.join("");e.response.write(i),this.connectionManager.recordEventSent(e.id,r);let s=e.response;s.flush&&typeof s.flush=="function"&&s.flush()}catch{this.connectionManager.recordError(e.id)}}formatSSEEvent(e){let t=e.type,r=JSON.stringify(e);return`event: ${t}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.12.0",
3
+ "version": "3.12.1",
4
4
  "description": "Agentic Quality Engineering V3 - Domain-Driven Design Architecture with 13 Bounded Contexts, O(log n) coverage analysis, ReasoningBank learning, 60 specialized QE agents, mathematical Coherence verification, deep Claude Flow integration",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,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.12.0");process.exit(0)}
2
- import{a,b,c}from"./chunk-WJYTLRA5.js";import"./chunk-IKVNYK7Y.js";import"./chunk-OHSVDMF7.js";import"./chunk-K5SN66B4.js";import"./chunk-RHC7TFPU.js";import"./chunk-3AFNXU45.js";export{a as AgentBoosterAdapter,b as createAgentBoosterAdapter,c as createAgentBoosterAdapterSync};
@@ -1,2 +0,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.12.0");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-O3C5RRDQ.js";import"./chunk-G6RKUEGL.js";import"./chunk-GCF42L7M.js";import"./chunk-5YGESYBC.js";import"./chunk-5VBPIJUZ.js";import"./chunk-KDLYTJ5C.js";import"./chunk-36MPDANH.js";import"./chunk-VMP4M5PB.js";import"./chunk-WT4ZDDFM.js";import"./chunk-FI5SSLEF.js";import"./chunk-NW7G57NR.js";import"./chunk-XEYW3V5I.js";import"./chunk-CC5G3K4X.js";import"./chunk-Z3W3R4CW.js";import"./chunk-VZ67ZDB3.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-BB4OVXWF.js";import"./chunk-PT3FTGKZ.js";import"./chunk-GGMQOEZZ.js";import"./chunk-W2OMW6UU.js";import"./chunk-7ZIVDGSN.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{b as AQELearningEngine,a as DEFAULT_ENGINE_CONFIG,c as DEFAULT_META_LEARNING_CONFIG,d as MetaLearningEngine,e as createAQELearningEngine,f as createDefaultLearningEngine};
@@ -1,2 +0,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.12.0");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l}from"./chunk-7WX3MKRS.js";import"./chunk-4SALW7OT.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-W2OMW6UU.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-TJ6N4CCX.js";import"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{l as MCPToolBase,k as defaultToolLogger,j as getKernel,i as getLLMRouter,e as getMemoryBackend,g as getSharedLLMRouter,c as getSharedMemoryBackend,a as isMemoryOnlyMode,b as registerRvfResetFn,h as resetSharedLLMRouter,d as resetSharedMemoryBackend,f as setSharedLLMRouter};
@@ -1,2 +0,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.12.0");process.exit(0)}
2
- import{a}from"./chunk-FEEMJDUF.js";import"./chunk-7WX3MKRS.js";import"./chunk-4SALW7OT.js";import"./chunk-C4SZSPXY.js";import"./chunk-SSXAW3ER.js";import"./chunk-MDT3LIXS.js";import"./chunk-TJEJ4UVX.js";import"./chunk-L5ZLOW3K.js";import"./chunk-K5SN66B4.js";import"./chunk-W2OMW6UU.js";import"./chunk-RHC7TFPU.js";import"./chunk-6JNNZGI2.js";import"./chunk-TJ6N4CCX.js";import"./chunk-UVVKFBF7.js";import"./chunk-YKOTOCO6.js";import"./chunk-FZIHOMGY.js";import"./chunk-KJWQ7ENF.js";import"./chunk-V2MD5EDD.js";import"./chunk-64M3FFM4.js";import"./chunk-AEX75YGI.js";import"./chunk-27JCWG5J.js";import"./chunk-2KHDGC7N.js";import"./chunk-3AFNXU45.js";export{a as BrowserWorkflowTool};