agentic-qe 3.9.21 → 3.9.22

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 (285) hide show
  1. package/.claude/skills/skills-manifest.json +1 -1
  2. package/CHANGELOG.md +30 -0
  3. package/assets/skills/skills-manifest.json +1 -1
  4. package/dist/cli/bundle.js +5 -5
  5. package/dist/cli/chunks/adapter-4RFY4QQP.js +2 -0
  6. package/dist/cli/chunks/{agent-booster-wasm-55SQPP6T.js → agent-booster-wasm-GUS4CPIF.js} +2 -2
  7. package/dist/cli/chunks/{agent-handler-Q2UXL73Y.js → agent-handler-X3JM3LAL.js} +2 -2
  8. package/dist/cli/chunks/{agent-memory-branch-56GIYNGH.js → agent-memory-branch-DZVV32I2.js} +2 -2
  9. package/dist/cli/chunks/aqe-learning-engine-CJ5UDPJ6.js +2 -0
  10. package/dist/cli/chunks/{audit-2JQ3URVN.js → audit-LO2I2D4V.js} +2 -2
  11. package/dist/cli/chunks/base-EEBZKFSN.js +2 -0
  12. package/dist/cli/chunks/{hnswlib-node-UHEP6UZZ.js → better-sqlite3-MQACUCZV.js} +2 -2
  13. package/dist/cli/chunks/{brain-handler-TOOZFEK5.js → brain-handler-SW6BDUVF.js} +3 -3
  14. package/dist/cli/chunks/{branch-enumerator-2BLPN73D.js → branch-enumerator-COUIEIXT.js} +2 -2
  15. package/dist/cli/chunks/{browser-FSVNN36N.js → browser-I3KE2PKR.js} +2 -2
  16. package/dist/cli/chunks/browser-workflow-KDNXNC7W.js +2 -0
  17. package/dist/cli/chunks/{chunk-S5RNBBJ6.js → chunk-2ABN34GT.js} +2 -2
  18. package/dist/cli/chunks/{chunk-NGT3VL66.js → chunk-2OQVDOCP.js} +2 -2
  19. package/dist/cli/chunks/{chunk-SIW4N4NE.js → chunk-34V7MJEC.js} +4 -4
  20. package/dist/cli/chunks/{chunk-YS5WV3CJ.js → chunk-3M7EAXED.js} +1 -1
  21. package/dist/cli/chunks/{chunk-PGHTRQK6.js → chunk-3UPELJAD.js} +2 -2
  22. package/dist/cli/chunks/{chunk-QU3VFWZZ.js → chunk-46X57677.js} +8 -8
  23. package/dist/cli/chunks/{chunk-ND2TFQF5.js → chunk-4KIDHFF3.js} +1 -1
  24. package/dist/cli/chunks/{chunk-WL5IRCU4.js → chunk-5D6UQZG6.js} +2 -2
  25. package/dist/cli/chunks/{chunk-VQXHHEPD.js → chunk-5HUFNSCO.js} +2 -2
  26. package/dist/cli/chunks/{chunk-NV6AUEIH.js → chunk-5Q4HS3PB.js} +2 -2
  27. package/dist/cli/chunks/{chunk-RIVX6YLS.js → chunk-5QP4OPZM.js} +2 -2
  28. package/dist/cli/chunks/{chunk-GLQ6LLKC.js → chunk-5VE5R2B4.js} +1 -1
  29. package/dist/cli/chunks/{chunk-D24HN6BG.js → chunk-5WE7JRVM.js} +1 -1
  30. package/dist/cli/chunks/{chunk-G7ZYDJZ3.js → chunk-6EBWEMJJ.js} +2 -2
  31. package/dist/cli/chunks/{chunk-AMOCYHP3.js → chunk-6I6LXONA.js} +2 -2
  32. package/dist/cli/chunks/{chunk-TOE6DKE4.js → chunk-6KHLLAFS.js} +1 -1
  33. package/dist/cli/chunks/{chunk-VGAG5TG7.js → chunk-75EXWLL2.js} +1 -1
  34. package/dist/cli/chunks/{chunk-4ZUXTOUG.js → chunk-75EZBOLF.js} +1 -1
  35. package/dist/cli/chunks/{chunk-ZUTYZIWQ.js → chunk-76JSNSX5.js} +2 -2
  36. package/dist/cli/chunks/{chunk-V5AVC4D4.js → chunk-77CR3VJL.js} +2 -2
  37. package/dist/cli/chunks/{chunk-LYZUB3NP.js → chunk-7BKQTKKO.js} +1 -1
  38. package/dist/cli/chunks/{chunk-I3HLZASP.js → chunk-7TASYE2O.js} +2 -2
  39. package/dist/cli/chunks/{chunk-GDZ6XQRI.js → chunk-7TWDEXR4.js} +1 -1
  40. package/dist/cli/chunks/{chunk-TMKJXKY2.js → chunk-7V2KGOFN.js} +2 -2
  41. package/dist/cli/chunks/{chunk-KRXJ7LFP.js → chunk-AKBYBOUV.js} +1 -1
  42. package/dist/cli/chunks/{chunk-OK5JHHXK.js → chunk-ASJWT2HO.js} +1 -1
  43. package/dist/cli/chunks/{chunk-4O7YJIOS.js → chunk-BAIQZTBO.js} +2 -2
  44. package/dist/cli/chunks/{chunk-S3TU7B7D.js → chunk-BVFRL52U.js} +2 -2
  45. package/dist/cli/chunks/{chunk-3Y7OZ2PC.js → chunk-C2ROCY2Y.js} +2 -2
  46. package/dist/cli/chunks/{chunk-SMBQERK7.js → chunk-C32ZD3IM.js} +2 -2
  47. package/dist/cli/chunks/{chunk-IS6IES7Q.js → chunk-CWINAMA7.js} +1 -1
  48. package/dist/cli/chunks/{chunk-ACOEV3YB.js → chunk-CYHVGDGJ.js} +2 -2
  49. package/dist/cli/chunks/chunk-D4GHYV5T.js +2 -0
  50. package/dist/cli/chunks/{chunk-HC4VOQZJ.js → chunk-D4RS57YM.js} +2 -2
  51. package/dist/cli/chunks/{chunk-FBCLQTXO.js → chunk-DLOY6QOK.js} +2 -2
  52. package/dist/cli/chunks/{chunk-NJICCYCB.js → chunk-EAEF52EW.js} +2 -2
  53. package/dist/cli/chunks/{chunk-5EYQP3V3.js → chunk-EBFG55L3.js} +2 -2
  54. package/dist/cli/chunks/{chunk-QERANESS.js → chunk-EHIS2X2O.js} +2 -2
  55. package/dist/cli/chunks/{chunk-NKOGDRZE.js → chunk-EIOC2ZBV.js} +2 -2
  56. package/dist/cli/chunks/{chunk-4Z4C7BXV.js → chunk-ELYTUR3K.js} +1 -1
  57. package/dist/cli/chunks/{chunk-HRHKLRBB.js → chunk-EP65OKY3.js} +1 -1
  58. package/dist/cli/chunks/{chunk-34BTSZ5D.js → chunk-F5PYXTN6.js} +1 -1
  59. package/dist/cli/chunks/{chunk-2AEWOQWU.js → chunk-F6S2BURJ.js} +2 -2
  60. package/dist/cli/chunks/{chunk-RDUIN7LO.js → chunk-F76YPLIC.js} +1 -1
  61. package/dist/cli/chunks/{chunk-WY3H7VHF.js → chunk-FN33YLS4.js} +2 -2
  62. package/dist/cli/chunks/{chunk-PAXSPZ3F.js → chunk-G35AFB22.js} +2 -2
  63. package/dist/cli/chunks/{chunk-44BAZASI.js → chunk-GE4ABLTW.js} +1 -1
  64. package/dist/cli/chunks/{chunk-TCNJ5NGT.js → chunk-H2CDS62D.js} +2 -2
  65. package/dist/cli/chunks/{chunk-TFAS5UND.js → chunk-HHTTDWS2.js} +3 -3
  66. package/dist/cli/chunks/{chunk-GJGFPXWG.js → chunk-IPWO26NP.js} +2 -2
  67. package/dist/cli/chunks/{chunk-F4VJ4PPI.js → chunk-J47LS6JI.js} +18 -22
  68. package/dist/cli/chunks/{chunk-KYPN6G7T.js → chunk-J4DENED7.js} +2 -2
  69. package/dist/cli/chunks/{chunk-Y36AJ462.js → chunk-JNRUY2BU.js} +2 -2
  70. package/dist/cli/chunks/{chunk-J3GG3Q4X.js → chunk-JTTEDSP5.js} +2 -2
  71. package/dist/cli/chunks/{chunk-LHXIAPKR.js → chunk-KA22YYYW.js} +2 -2
  72. package/dist/cli/chunks/{chunk-YVPPR33H.js → chunk-KBWJRXYS.js} +2 -2
  73. package/dist/cli/chunks/{chunk-KID7PTBZ.js → chunk-KEXERBH2.js} +2 -2
  74. package/dist/cli/chunks/{chunk-EVWNZEYV.js → chunk-KXVCKQ2O.js} +1 -1
  75. package/dist/cli/chunks/{chunk-XEMVYJ2Z.js → chunk-L2D56OS2.js} +3 -3
  76. package/dist/cli/chunks/{chunk-5PZG4WUA.js → chunk-LCOVR5PF.js} +3 -3
  77. package/dist/cli/chunks/{chunk-T5Z5LL5Y.js → chunk-LFUJSR5V.js} +3 -3
  78. package/dist/cli/chunks/{chunk-65U55JIH.js → chunk-LSPQUQZQ.js} +3 -3
  79. package/dist/cli/chunks/{chunk-FZ2SYLSK.js → chunk-LVW2AMCE.js} +1 -1
  80. package/dist/cli/chunks/{chunk-HIEP3L7H.js → chunk-MGTHNWDX.js} +2 -2
  81. package/dist/cli/chunks/{chunk-DBW745QA.js → chunk-MHV7VXPW.js} +2 -2
  82. package/dist/cli/chunks/{chunk-CJKR47YY.js → chunk-N242BGZS.js} +1 -1
  83. package/dist/cli/chunks/{chunk-V6GJ3EMZ.js → chunk-N7LNGYUI.js} +1 -1
  84. package/dist/cli/chunks/{chunk-4XZPDEK5.js → chunk-NDBSIHGC.js} +1 -1
  85. package/dist/cli/chunks/{chunk-KENZAFI2.js → chunk-NKHHOJBJ.js} +2 -2
  86. package/dist/cli/chunks/{chunk-OXXCWRFU.js → chunk-O2RWRFY2.js} +1 -1
  87. package/dist/cli/chunks/{chunk-P4Q5TMDH.js → chunk-OLDHOXH5.js} +2 -2
  88. package/dist/cli/chunks/{chunk-ADC73GLJ.js → chunk-P3CE2OST.js} +2 -2
  89. package/dist/cli/chunks/{chunk-E55MYZGP.js → chunk-PC3NYFID.js} +2 -2
  90. package/dist/cli/chunks/{chunk-HJCJWPN5.js → chunk-PJQVLSZL.js} +2 -2
  91. package/dist/cli/chunks/{chunk-PEOTZFNZ.js → chunk-PUBADXN6.js} +2 -2
  92. package/dist/cli/chunks/{chunk-MJGMH7TW.js → chunk-Q4Q4ZPEO.js} +2 -2
  93. package/dist/cli/chunks/{chunk-KDOA7YHW.js → chunk-Q6NM3PHP.js} +2 -2
  94. package/dist/cli/chunks/{chunk-5FNEOJSD.js → chunk-QBQHA2PQ.js} +2 -2
  95. package/dist/cli/chunks/{chunk-AT25VXEO.js → chunk-QBY4LMKC.js} +1 -1
  96. package/dist/cli/chunks/{chunk-OEB3V633.js → chunk-QH5PMTYD.js} +2 -2
  97. package/dist/cli/chunks/{chunk-MYZ43VKA.js → chunk-QKDYDDO6.js} +2 -2
  98. package/dist/cli/chunks/{chunk-VQLHHNOH.js → chunk-QUASI6T7.js} +2 -2
  99. package/dist/cli/chunks/{chunk-GB6ATLR3.js → chunk-QXFPR4ND.js} +2 -2
  100. package/dist/cli/chunks/{chunk-6OYRNNP2.js → chunk-QYUA3QRO.js} +1 -1
  101. package/dist/cli/chunks/{chunk-NS2ZWXUK.js → chunk-RDFBNLOP.js} +3 -3
  102. package/dist/cli/chunks/{chunk-UOLIGPDW.js → chunk-RHJXNBT5.js} +2 -2
  103. package/dist/cli/chunks/{chunk-IM7X6BDZ.js → chunk-SBXMNI7G.js} +2 -2
  104. package/dist/cli/chunks/{chunk-GR4RXQXV.js → chunk-SEFMGIDM.js} +2 -2
  105. package/dist/cli/chunks/{chunk-RHAUASC6.js → chunk-SZXKDWNU.js} +2 -2
  106. package/dist/cli/chunks/{chunk-QREO5LNR.js → chunk-T62S7PHC.js} +1 -1
  107. package/dist/cli/chunks/{chunk-63PHZGO2.js → chunk-T6SZZ6GL.js} +2 -2
  108. package/dist/cli/chunks/{chunk-ETEV7IZI.js → chunk-TF33AXXK.js} +1 -1
  109. package/dist/cli/chunks/{chunk-AEQNCDYD.js → chunk-TFEEZPAV.js} +2 -2
  110. package/dist/cli/chunks/{chunk-QSLXOYPR.js → chunk-U33MB6BS.js} +4 -4
  111. package/dist/cli/chunks/{chunk-ICPQR533.js → chunk-UG4NLJ6S.js} +2 -2
  112. package/dist/cli/chunks/{chunk-KWPPF7O4.js → chunk-UJQ4APLZ.js} +2 -2
  113. package/dist/cli/chunks/{chunk-LP52AQE2.js → chunk-UZ5D7CNQ.js} +2 -2
  114. package/dist/cli/chunks/{chunk-S6FFUCVZ.js → chunk-V6FH47RF.js} +4 -4
  115. package/dist/cli/chunks/{chunk-E7J32PW2.js → chunk-VBNVPKPJ.js} +2 -2
  116. package/dist/cli/chunks/{chunk-7P4IZQVQ.js → chunk-VEQZARRH.js} +2 -2
  117. package/dist/cli/chunks/{chunk-ISNDQOXC.js → chunk-WXM3QRV3.js} +2 -2
  118. package/dist/cli/chunks/{chunk-SMAC5IX4.js → chunk-X3UEZQIH.js} +2 -2
  119. package/dist/cli/chunks/{chunk-56DGV2Q3.js → chunk-XNLRBJLS.js} +1 -1
  120. package/dist/cli/chunks/{chunk-HMMJ6ZI6.js → chunk-XRTQMK2J.js} +2 -2
  121. package/dist/cli/chunks/{chunk-QPSPIESU.js → chunk-XZLXDSDH.js} +2 -2
  122. package/dist/cli/chunks/{chunk-G276EI3G.js → chunk-YBPODHK5.js} +2 -2
  123. package/dist/cli/chunks/{chunk-ROC2SSV3.js → chunk-YCG6NXTH.js} +3 -3
  124. package/dist/cli/chunks/{chunk-C4CZXAOE.js → chunk-YJ3KKNS5.js} +2 -2
  125. package/dist/cli/chunks/{chunk-DQI5ZR34.js → chunk-YT45LRYT.js} +1 -1
  126. package/dist/cli/chunks/{chunk-E2XIPBJ7.js → chunk-ZHJL5MGV.js} +1 -1
  127. package/dist/cli/chunks/{chunk-WI5HBS3C.js → chunk-ZIRSR3CR.js} +2 -2
  128. package/dist/cli/chunks/{chunk-6MGACOLN.js → chunk-ZTVYRPXO.js} +1 -1
  129. package/dist/cli/chunks/{chunk-E5TGH4V3.js → chunk-ZYLONMC3.js} +2 -2
  130. package/dist/cli/chunks/{chunk-YVG4D6P3.js → chunk-ZYVFF2GF.js} +1 -1
  131. package/dist/cli/chunks/{chunk-YH7BAX7S.js → chunk-ZZD2O63H.js} +1 -1
  132. package/dist/cli/chunks/{ci-GU2HBK5E.js → ci-KE7FOGU7.js} +2 -2
  133. package/dist/cli/chunks/{ci-output-FGZTTY3R.js → ci-output-22E7MB4A.js} +2 -2
  134. package/dist/cli/chunks/{circuit-breaker-6UNLOLMW.js → circuit-breaker-AVTSU65L.js} +2 -2
  135. package/dist/cli/chunks/{claude-flow-setup-SCOCIDBC.js → claude-flow-setup-UWD5DRUE.js} +2 -2
  136. package/dist/cli/chunks/client-GNL46JU5.js +2 -0
  137. package/dist/cli/chunks/{cline-installer-G6PQERGI.js → cline-installer-H3MJDJKK.js} +2 -2
  138. package/dist/cli/chunks/{code-RNKTYBI4.js → code-3G4FPMSZ.js} +2 -2
  139. package/dist/cli/chunks/{code-index-extractor-A6KAUQOU.js → code-index-extractor-PBZIQOI5.js} +2 -2
  140. package/dist/cli/chunks/{codex-installer-ABWDMKEX.js → codex-installer-M4P7K7LO.js} +2 -2
  141. package/dist/cli/chunks/{completions-TB4E6O46.js → completions-WWUW6CX4.js} +2 -2
  142. package/dist/cli/chunks/{complexity-analyzer-XS37O7OR.js → complexity-analyzer-H2F37PAW.js} +2 -2
  143. package/dist/cli/chunks/{continuedev-installer-WDY6O2SR.js → continuedev-installer-NSUF5Y6W.js} +2 -2
  144. package/dist/cli/chunks/{copilot-installer-SDJ3GYLU.js → copilot-installer-BHFKNSU4.js} +2 -2
  145. package/dist/cli/chunks/{cost-tracker-MWEXRK7F.js → cost-tracker-QTQ32PGG.js} +2 -2
  146. package/dist/cli/chunks/{coverage-Y3KDB56G.js → coverage-LCBTTMUE.js} +3 -3
  147. package/dist/cli/chunks/cross-domain-router-2JHRNGD7.js +2 -0
  148. package/dist/cli/chunks/{cursor-installer-4U7XENLX.js → cursor-installer-KBWXMRRA.js} +2 -2
  149. package/dist/cli/chunks/{daemon-D6R3BPBJ.js → daemon-UYTVWZOZ.js} +3 -3
  150. package/dist/cli/chunks/{dag-attention-scheduler-EMVUX6ES.js → dag-attention-scheduler-3WVICTLD.js} +2 -2
  151. package/dist/cli/chunks/{detect-QIJPCTZO.js → detect-R3CMY3ZB.js} +2 -2
  152. package/dist/cli/chunks/{dist-node-4ZYBZKOB.js → dist-node-OALHZZ67.js} +2 -2
  153. package/dist/cli/chunks/{domain-handler-X6CTXJQF.js → domain-handler-QWZEBRVB.js} +2 -2
  154. package/dist/cli/chunks/{domain-transfer-HK4ER37F.js → domain-transfer-BO2XBDRA.js} +2 -2
  155. package/dist/cli/chunks/dream-XDWOQVNR.js +2 -0
  156. package/dist/cli/chunks/{embed-and-insert-pattern-XKTD5DQ3.js → embed-and-insert-pattern-YJJ5MHIV.js} +2 -2
  157. package/dist/cli/chunks/{eval-WEEB3CHY.js → eval-BIDGZOD7.js} +2 -2
  158. package/dist/cli/chunks/experience-capture-middleware-SBZNJVIN.js +40 -0
  159. package/dist/cli/chunks/{fast-paths-M2ENEKQX.js → fast-paths-W6FORZ7G.js} +2 -2
  160. package/dist/cli/chunks/{feature-flags-3WIZC67K.js → feature-flags-25T4IUQL.js} +2 -2
  161. package/dist/cli/chunks/{feature-flags-CZQXGFGX.js → feature-flags-A4YTFMSI.js} +2 -2
  162. package/dist/cli/chunks/{file-discovery-ERTPM3C4.js → file-discovery-S4GNW5SS.js} +2 -2
  163. package/dist/cli/chunks/{fleet-WBEPTBQR.js → fleet-QTXBVBXM.js} +3 -3
  164. package/dist/cli/chunks/{gnn-wrapper-GVRS33BK.js → gnn-wrapper-S3HPS6UZ.js} +2 -2
  165. package/dist/cli/chunks/{heartbeat-handler-JQ6NSC6T.js → heartbeat-handler-Z536VVQ4.js} +4 -4
  166. package/dist/cli/chunks/{heartbeat-scheduler-7XHIE6IV.js → heartbeat-scheduler-ECHKRR2V.js} +2 -2
  167. package/dist/cli/chunks/hnsw-adapter-ELKAHTIH.js +2 -0
  168. package/dist/cli/chunks/hnsw-index-3VJYUSOM.js +2 -0
  169. package/dist/cli/chunks/{hnsw-legacy-bridge-TYO6GZ6Z.js → hnsw-legacy-bridge-NR2LB4MK.js} +2 -2
  170. package/dist/cli/chunks/{better-sqlite3-XGA7Z5YL.js → hnswlib-node-VHJGVLVU.js} +2 -2
  171. package/dist/cli/chunks/{hooks-2GU7LGNL.js → hooks-K6B7FOWK.js} +10 -10
  172. package/dist/cli/chunks/{hybrid-router-Z5V4E5SJ.js → hybrid-router-PWEAUPDI.js} +2 -2
  173. package/dist/cli/chunks/{hypergraph-engine-F435AM7S.js → hypergraph-engine-2GMPZADI.js} +2 -2
  174. package/dist/cli/chunks/{hypergraph-handler-DQMYDUQY.js → hypergraph-handler-7EZBLA7J.js} +3 -3
  175. package/dist/cli/chunks/impact-analyzer-4BLPFGDS.js +2 -0
  176. package/dist/cli/chunks/{init-handler-Y4NPRT2W.js → init-handler-IC2REBTQ.js} +6 -6
  177. package/dist/cli/chunks/init-wizard-UR23AJFX.js +2 -0
  178. package/dist/cli/chunks/kernel-BTP323I5.js +2 -0
  179. package/dist/cli/chunks/{kilocode-installer-EUTWNH4I.js → kilocode-installer-O7CW3AWL.js} +2 -2
  180. package/dist/cli/chunks/{kiro-installer-I3ECJ37F.js → kiro-installer-PCUKTCMG.js} +2 -2
  181. package/dist/cli/chunks/knowledge-graph-JH3O5ZMS.js +2 -0
  182. package/dist/cli/chunks/{learning-5FW7N6DA.js → learning-X6GZCD2J.js} +3 -3
  183. package/dist/cli/chunks/{llm-router-ZRYFNNPU.js → llm-router-K7S7VYA3.js} +4 -4
  184. package/dist/cli/chunks/{load-7BF33NMJ.js → load-RHLRH7M5.js} +2 -2
  185. package/dist/cli/chunks/load-test-E6GTBB2W.js +2 -0
  186. package/dist/cli/chunks/{mcp-7K6P7FMG.js → mcp-RGHX7REI.js} +2 -2
  187. package/dist/cli/chunks/{memory-O2DCN3GS.js → memory-BDEEXPIV.js} +5 -5
  188. package/dist/cli/chunks/memory-backend-FAOO6R3B.js +2 -0
  189. package/dist/cli/chunks/{memory-handlers-WA63DMQ4.js → memory-handlers-PR5ZSN5E.js} +2 -2
  190. package/dist/cli/chunks/{multi-model-executor-SJXBFOK5.js → multi-model-executor-SGVRJWI5.js} +2 -2
  191. package/dist/cli/chunks/{opencode-installer-PE7ZV6SV.js → opencode-installer-3ZWQ7Q5S.js} +2 -2
  192. package/dist/cli/chunks/{orchestrator-N4GT5IGY.js → orchestrator-O5EZXLG6.js} +5 -5
  193. package/dist/cli/chunks/{pipeline-DUTGGNO6.js → pipeline-LW7SFRRB.js} +2 -2
  194. package/dist/cli/chunks/{platform-EGUD7X2R.js → platform-DIISFS5U.js} +2 -2
  195. package/dist/cli/chunks/{plugin-6ZS3HK43.js → plugin-B563LDGV.js} +2 -2
  196. package/dist/cli/chunks/{prime-radiant-advanced-wasm-B5S4RUJS.js → prime-radiant-advanced-wasm-FJBQPN3U.js} +2 -2
  197. package/dist/cli/chunks/protocol-executor-AYBNZNRK.js +2 -0
  198. package/dist/cli/chunks/{protocol-handler-Z3QDY7O6.js → protocol-handler-PVZNJNNP.js} +2 -2
  199. package/dist/cli/chunks/{prove-TQHP2XVD.js → prove-MYKQTKZM.js} +2 -2
  200. package/dist/cli/chunks/{provider-manager-2JFXKYMZ.js → provider-manager-RDOMJIKC.js} +2 -2
  201. package/dist/cli/chunks/qe-reasoning-bank-LFMZCMKB.js +2 -0
  202. package/dist/cli/chunks/{quality-NXDHVPAS.js → quality-OOXFIM76.js} +2 -2
  203. package/dist/cli/chunks/queen-coordinator-JEGURMXS.js +2 -0
  204. package/dist/cli/chunks/{real-embeddings-P2LYDBVF.js → real-embeddings-JQVUQQKL.js} +2 -2
  205. package/dist/cli/chunks/{roocode-installer-YSRXO4W4.js → roocode-installer-G7ZV5Z3V.js} +2 -2
  206. package/dist/cli/chunks/router-LMESYCAS.js +2 -0
  207. package/dist/cli/chunks/routing-feedback-3GOMFT5Q.js +2 -0
  208. package/dist/cli/chunks/{routing-handler-HVDQQF34.js → routing-handler-W5XOGRVI.js} +2 -2
  209. package/dist/cli/chunks/{ruvector-commands-5NJ5FQ3E.js → ruvector-commands-YBR64EE3.js} +2 -2
  210. package/dist/cli/chunks/{rvf-dual-writer-GZ2HIIKX.js → rvf-dual-writer-XIDYK3CA.js} +2 -2
  211. package/dist/cli/chunks/{rvf-migration-adapter-QKEYGJFL.js → rvf-migration-adapter-6FJ7XRBL.js} +2 -2
  212. package/dist/cli/chunks/{rvf-migration-coordinator-5RBME46Y.js → rvf-migration-coordinator-7GD7BGUG.js} +2 -2
  213. package/dist/cli/chunks/rvf-native-adapter-MEKCU4HV.js +2 -0
  214. package/dist/cli/chunks/safe-db-PZBRYCSI.js +2 -0
  215. package/dist/cli/chunks/schedule-NXQZQIBV.js +2 -0
  216. package/dist/cli/chunks/scheduler-I3HGTMNU.js +2 -0
  217. package/dist/cli/chunks/{security-KB4TOOFJ.js → security-5RH45PGS.js} +3 -3
  218. package/dist/cli/chunks/shared-rvf-adapter-5QLSVTXS.js +2 -0
  219. package/dist/cli/chunks/{shared-rvf-dual-writer-UMDFMGVS.js → shared-rvf-dual-writer-A7T5EJ3W.js} +2 -2
  220. package/dist/cli/chunks/sqlite-persistence-3MEKZAPX.js +2 -0
  221. package/dist/cli/chunks/{status-handler-T53CO6SX.js → status-handler-LNNNK2AK.js} +2 -2
  222. package/dist/cli/chunks/{structural-health-AVS2GE7S.js → structural-health-7I7G6LFO.js} +2 -2
  223. package/dist/cli/chunks/{sync-Q3UHMELK.js → sync-QPWRLTD6.js} +2 -2
  224. package/dist/cli/chunks/{task-handler-UAJWNRMS.js → task-handler-BMKDHVBD.js} +2 -2
  225. package/dist/cli/chunks/{task-handlers-HYSHMTJN.js → task-handlers-ECOL3VV6.js} +3 -3
  226. package/dist/cli/chunks/{test-GMXM664Y.js → test-FY33BVTJ.js} +4 -4
  227. package/dist/cli/chunks/{test-scheduling-PYU4NLDU.js → test-scheduling-4NHGC3EB.js} +3 -3
  228. package/dist/cli/chunks/{token-bootstrap-5SIETJI6.js → token-bootstrap-MAOYJSZN.js} +2 -2
  229. package/dist/cli/chunks/{token-usage-3H4KEKTT.js → token-usage-TJPP4UFG.js} +2 -2
  230. package/dist/cli/chunks/{transformers-ZFPUASV4.js → transformers-QIGZ7SE7.js} +2 -2
  231. package/dist/cli/chunks/{tree-sitter-wasm-parser-X72YXRIP.js → tree-sitter-wasm-parser-CVKNF5NP.js} +2 -2
  232. package/dist/cli/chunks/{types-CB2HAVZ6.js → types-FCGVB2IX.js} +2 -2
  233. package/dist/cli/chunks/unified-memory-U4CPBW5V.js +2 -0
  234. package/dist/cli/chunks/unified-memory-hnsw-BYBD2V33.js +2 -0
  235. package/dist/cli/chunks/unified-persistence-LAUTFWNC.js +2 -0
  236. package/dist/cli/chunks/{upgrade-BWAZTJKE.js → upgrade-HWJRLW6H.js} +2 -2
  237. package/dist/cli/chunks/{validate-3OVVTWN6.js → validate-Z45LLWQQ.js} +2 -2
  238. package/dist/cli/chunks/{validate-swarm-WJVG4OUQ.js → validate-swarm-VAEKMIJB.js} +2 -2
  239. package/dist/cli/chunks/{vibium-IIU2F5HC.js → vibium-O7MMGI45.js} +2 -2
  240. package/dist/cli/chunks/visual-security-XVWGWA4J.js +2 -0
  241. package/dist/cli/chunks/{web-tree-sitter-RO4TKGTV.js → web-tree-sitter-G3TTBGKP.js} +2 -2
  242. package/dist/cli/chunks/{windsurf-installer-7N5CZTJS.js → windsurf-installer-II3ZTH55.js} +2 -2
  243. package/dist/cli/chunks/witness-chain-CTIZD4GL.js +2 -0
  244. package/dist/cli/chunks/{witness-chain-B4CHDDS5.js → witness-chain-KYMMCOIV.js} +2 -2
  245. package/dist/cli/chunks/{workflow-FKJKW36Z.js → workflow-P4GQ3NJK.js} +4 -4
  246. package/dist/cli/chunks/workflow-orchestrator-NG3KLTLJ.js +2 -0
  247. package/dist/cli/chunks/{wrappers-HU3SB4FT.js → wrappers-7MWZ6R6U.js} +2 -2
  248. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +6 -0
  249. package/dist/learning/experience-consolidation.d.ts +19 -3
  250. package/dist/learning/experience-consolidation.js +57 -27
  251. package/dist/mcp/bundle.js +10 -14
  252. package/package.json +1 -1
  253. package/dist/cli/chunks/adapter-WOEZOCHJ.js +0 -2
  254. package/dist/cli/chunks/aqe-learning-engine-5AHKLABJ.js +0 -2
  255. package/dist/cli/chunks/base-RNCRGTZJ.js +0 -2
  256. package/dist/cli/chunks/browser-workflow-MXHA63OC.js +0 -2
  257. package/dist/cli/chunks/chunk-OHR5ILR3.js +0 -2
  258. package/dist/cli/chunks/client-XU3ZUFMH.js +0 -2
  259. package/dist/cli/chunks/cross-domain-router-KKYQWQE7.js +0 -2
  260. package/dist/cli/chunks/dream-FBYASIID.js +0 -2
  261. package/dist/cli/chunks/hnsw-adapter-L7QOLNKP.js +0 -2
  262. package/dist/cli/chunks/hnsw-index-O2YO7WVU.js +0 -2
  263. package/dist/cli/chunks/impact-analyzer-37TDXM6V.js +0 -2
  264. package/dist/cli/chunks/init-wizard-ONNAHU4H.js +0 -2
  265. package/dist/cli/chunks/kernel-3S7RJ7PT.js +0 -2
  266. package/dist/cli/chunks/knowledge-graph-GNJMYFT2.js +0 -2
  267. package/dist/cli/chunks/load-test-ZHTSLJMB.js +0 -2
  268. package/dist/cli/chunks/memory-backend-LN6NWT4F.js +0 -2
  269. package/dist/cli/chunks/protocol-executor-ED36SYE4.js +0 -2
  270. package/dist/cli/chunks/qe-reasoning-bank-AC5ZWDAZ.js +0 -2
  271. package/dist/cli/chunks/queen-coordinator-IZ4RQGKV.js +0 -2
  272. package/dist/cli/chunks/router-DZVPCD7E.js +0 -2
  273. package/dist/cli/chunks/routing-feedback-3LUE56G4.js +0 -2
  274. package/dist/cli/chunks/rvf-native-adapter-UTX4WYSI.js +0 -2
  275. package/dist/cli/chunks/safe-db-PEJN42TX.js +0 -2
  276. package/dist/cli/chunks/schedule-UULIQP2J.js +0 -2
  277. package/dist/cli/chunks/scheduler-T57XAXKF.js +0 -2
  278. package/dist/cli/chunks/shared-rvf-adapter-UZVFV2RJ.js +0 -2
  279. package/dist/cli/chunks/sqlite-persistence-W7E26KF3.js +0 -2
  280. package/dist/cli/chunks/unified-memory-SAIRUPOI.js +0 -2
  281. package/dist/cli/chunks/unified-memory-hnsw-NQALAER6.js +0 -2
  282. package/dist/cli/chunks/unified-persistence-XNGQFWFS.js +0 -2
  283. package/dist/cli/chunks/visual-security-CE37LMFR.js +0 -2
  284. package/dist/cli/chunks/witness-chain-L2KM336B.js +0 -2
  285. package/dist/cli/chunks/workflow-orchestrator-BE5PCEBO.js +0 -2
@@ -5104,7 +5104,7 @@ ${d.trim()}`;r.push(Fr(o,s.index,s.index+c.length,p,"Convert .then() to await"))
5104
5104
  LIMIT ?
5105
5105
  `))}async loadRecentTrajectories(){let e=this.prepared.get("getRecentTrajectories");if(!e)return;let t=e.all(this.config.recentBufferSize);for(let r of t){let n=await this.rowToTrajectory(r);n&&this.recentTrajectories.push(n)}console.log(`[TrajectoryTracker] Loaded ${t.length} recent trajectories`)}async startTrajectory(e,t={}){this.ensureInitialized();let r=E(),n=new Date;this.activeTrajectories.set(r,{id:r,task:e,agent:t.agent,domain:t.domain,steps:[],startedAt:n,context:t.context});let i=this.prepared.get("insertTrajectory");return i&&i.run(r,e,t.agent||null,t.domain||null,n.toISOString(),t.context?JSON.stringify(t.context):null),this.stats.trajectoriesStarted++,setTimeout(()=>{this.activeTrajectories.has(r)&&(console.warn(`[TrajectoryTracker] Auto-ending abandoned trajectory: ${r}`),this.endTrajectory(r,!1,"Abandoned - timeout").catch(console.error),this.stats.trajectoriesAbandoned++)},this.config.autoEndTimeoutMs),r}async recordStep(e,t,r,n={}){this.ensureInitialized();let i=this.activeTrajectories.get(e);if(!i)throw new Error(`Trajectory not found or already ended: ${e}`);if(i.steps.length>=this.config.maxStepsPerTrajectory)throw new Error(`Maximum steps (${this.config.maxStepsPerTrajectory}) exceeded for trajectory`);let s=E(),a=n.quality??this.calculateStepQuality(r),c={id:s,action:t,result:r,quality:a,durationMs:n.durationMs??0,timestamp:new Date,context:n.context,tokensUsed:n.tokensUsed};i.steps.push(c);let l=this.prepared.get("insertStep");l&&l.run(s,e,i.steps.length-1,t,r.outcome,a,n.durationMs??0,n.tokensUsed??null,r.data?JSON.stringify(r.data):null,r.error??null,r.metrics?JSON.stringify(r.metrics):null,n.context?JSON.stringify(n.context):null),this.stats.totalStepsRecorded++,this.stats.totalQualitySum+=a,this.stats.averageQuality=this.stats.totalQualitySum/this.stats.totalStepsRecorded}async endTrajectory(e,t,r){this.ensureInitialized();let n=this.activeTrajectories.get(e);if(!n)throw new Error(`Trajectory not found or already ended: ${e}`);let i=new Date,s=this.calculateMetrics(n.steps),a;t&&s.averageQuality>=this.config.minQualityThreshold?a="success":t?a="partial":a="failure";let c={id:e,task:n.task,agent:n.agent,domain:n.domain,steps:n.steps,outcome:a,metrics:s,startedAt:n.startedAt,endedAt:i,feedback:r},l=this.prepared.get("updateTrajectory");return l&&l.run(i.toISOString(),t?1:0,JSON.stringify(n.steps),JSON.stringify({metrics:s,context:n.context}),null,r??null,null,e),this.activeTrajectories.delete(e),this.recentTrajectories.push(c),this.stats.trajectoriesCompleted++,c}async getTrajectory(e){this.ensureInitialized();let t=this.activeTrajectories.get(e);if(t)return{id:t.id,task:t.task,agent:t.agent,domain:t.domain,steps:t.steps,outcome:"partial",metrics:this.calculateMetrics(t.steps),startedAt:t.startedAt};let r=this.prepared.get("getTrajectory");if(!r)return null;let n=r.get(e);return n?this.rowToTrajectory(n):null}async getSuccessfulTrajectories(e,t=10){this.ensureInitialized();let r=this.prepared.get("getTrajectoryByDomain");if(!r)return[];let n=r.all(e,t),i=[];for(let s of n){let a=await this.rowToTrajectory(s);a&&i.push(a)}return i}async findSimilarTrajectories(e,t=5){this.ensureInitialized();let r=e.toLowerCase().split(/\s+/).filter(s=>s.length>3);return this.recentTrajectories.toArray().map(s=>{let a=s.task.toLowerCase(),c=r.filter(l=>a.includes(l)).length;return{trajectory:s,score:c/r.length}}).filter(s=>s.score>.2).sort((s,a)=>a.score-s.score).slice(0,t).map(s=>s.trajectory)}getStats(){return{...this.stats,activeTrajectories:this.activeTrajectories.size,recentBufferSize:this.recentTrajectories.length}}async cleanup(e=30){if(this.ensureInitialized(),!this.db)return 0;let t=new Date;return t.setDate(t.getDate()-e),this.db.prepare(`
5106
5106
  DELETE FROM qe_trajectories WHERE ended_at < ?
5107
- `).run(t.toISOString()).changes}async dispose(){this.activeTrajectories.clear(),this.recentTrajectories.clear(),this.prepared.clear(),this.db=null,this.unifiedMemory=null,this.initialized=!1,console.log("[TrajectoryTracker] Disposed")}ensureInitialized(){if(!this.initialized)throw new Error("TrajectoryTracker not initialized. Call initialize() first.")}calculateStepQuality(e){switch(e.outcome){case"success":return 1;case"partial":return .6;case"skipped":return .5;case"failure":return 0;default:return .5}}calculateMetrics(e){if(e.length===0)return{totalDurationMs:0,successfulSteps:0,failedSteps:0,averageQuality:0,totalTokensUsed:0,efficiencyScore:0};let t=0,r=0,n=0,i=0,s=0;for(let u of e)t+=u.durationMs,i+=u.quality,s+=u.tokensUsed??0,u.result.outcome==="success"?r++:u.result.outcome==="failure"&&n++;let a=i/e.length,l=r/e.length*a;return{totalDurationMs:t,successfulSteps:r,failedSteps:n,averageQuality:a,totalTokensUsed:s,efficiencyScore:l}}async rowToTrajectory(e){if(!e)return null;let t=this.prepared.get("getSteps"),r=[];if(t)r=t.all(e.id).map(a=>({id:a.id,action:a.action,result:{outcome:a.outcome,data:a.result_data?x(a.result_data):void 0,error:a.error_message??void 0,metrics:a.metrics_json?x(a.metrics_json):void 0},quality:a.quality,durationMs:a.duration_ms,timestamp:new Date(a.timestamp),context:a.context_json?x(a.context_json):void 0,tokensUsed:a.tokens_used??void 0}));else if(e.steps_json)try{r=x(e.steps_json)}catch{r=[]}let i=(e.metadata_json?x(e.metadata_json):{}).metrics??this.calculateMetrics(r);return{id:e.id,task:e.task,agent:e.agent??void 0,domain:e.domain,steps:r,outcome:e.success===1?"success":e.success===0?"failure":"partial",metrics:i,startedAt:new Date(e.started_at),endedAt:e.ended_at?new Date(e.ended_at):void 0,feedback:e.feedback??void 0,embedding:e.embedding?this.bufferToFloatArray(e.embedding):void 0,relatedPatternIds:e.related_patterns?x(e.related_patterns):void 0}}bufferToFloatArray(e){let t=e.length/4,r=[];for(let n=0;n<t;n++)r.push(e.readFloatLE(n*4));return r}}});function o4(){if(aS)return aS;let o=(X_(),Fe(K_));if(!o.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return aS=o.HierarchicalNSW,aS}function Lhe(){return!0}var aS,Kc,tL=y(()=>{"use strict";aS=null;Kc=class{indexes;config;initialized;nextId;unifiedAdapters=null;useUnified;constructor(e={}){this.config={M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,dimension:e.dimension||384,metric:e.metric||"cosine",quantization:e.quantization||"none"},this.indexes=new Map,this.initialized=new Set,this.nextId=new Map,this.useUnified=Lhe(),this.useUnified&&(this.unifiedAdapters=new Map)}initializeIndex(e){if(this.initialized.has(e))return;if(this.useUnified&&this.unifiedAdapters)try{let{HnswAdapter:s}=(Au(),Fe(k0)),a=new s(`embedding-${e}`,{dimensions:this.config.dimension,M:this.config.M,efConstruction:this.config.efConstruction,efSearch:this.config.efSearch,metric:this.config.metric==="dotproduct"?"cosine":this.config.metric});this.unifiedAdapters.set(e,a),this.initialized.add(e),this.nextId.set(e,0);return}catch{}let r={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",n=o4(),i=new n(r,this.config.dimension);i.initIndex({maxElements:1e4,m:this.config.M,efConstruction:this.config.efConstruction}),this.indexes.set(e,i),this.initialized.add(e),this.nextId.set(e,0)}addEmbedding(e,t){let r=e.namespace;this.initialized.has(r)||this.initializeIndex(r);let n=t??this.nextId.get(r);t===void 0&&this.nextId.set(r,n+1);let i=this.unifiedAdapters?.get(r);if(i){let c=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return i.add(n,c),n}let s=this.indexes.get(r),a=this.toFloatArray(e.vector);return s.addPoint(a,n),n}addEmbeddingsBatch(e){return e.map(t=>this.addEmbedding(t.embedding,t.id))}search(e,t={}){let r=t.namespace||e.namespace;if(!this.initialized.has(r))return[];let n=t.limit||10,i=this.unifiedAdapters?.get(r);if(i){let l=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return i.search(l,n).map(d=>({id:d.id,distance:1-d.score}))}let s=this.indexes.get(r),a=this.toFloatArray(e.vector),c=s.searchKnn(a,n);return c.neighbors.map((l,u)=>({id:l,distance:c.distances[u]}))}getIndexStats(e){if(!this.initialized.has(e))return null;let t=this.unifiedAdapters?.get(e);return t?{size:t.size(),maxElements:1e4,dimension:t.dimensions(),metric:this.config.metric}:{size:this.indexes.get(e).getCurrentCount(),maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}}async saveIndex(e,t){if(!this.initialized.has(e))throw new Error(`Namespace ${e} not initialized`);if(this.unifiedAdapters?.has(e)){console.warn(`[HNSWEmbeddingIndex] saveIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally.`);return}await this.indexes.get(e).writeIndex(t)}async loadIndex(e,t){if(this.useUnified){console.warn(`[HNSWEmbeddingIndex] loadIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally. Initialize via initializeIndex() instead.`);return}let n={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",i=o4(),s=new i(n,this.config.dimension);await s.readIndex(t),this.indexes.set(e,s),this.initialized.add(e)}clearIndex(e){if(this.initialized.has(e)){let t=this.unifiedAdapters?.get(e);t&&(t.clear?.(),this.unifiedAdapters.delete(e)),this.indexes.delete(e),this.initialized.delete(e),this.nextId.delete(e)}}clearAll(){if(this.unifiedAdapters){for(let e of this.unifiedAdapters.values())e.clear?.();this.unifiedAdapters.clear()}this.indexes.clear(),this.initialized.clear(),this.nextId.clear()}resizeIndex(e,t){this.initialized.has(e)&&(this.clearIndex(e),this.initializeIndex(e))}setEfSearch(e){this.config.efSearch=e}toFloatArray(e){if(Array.isArray(e))return e;if(e instanceof Float32Array)return Array.from(e);if(e instanceof Int8Array){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/128;return t}if(e instanceof Uint8Array){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=(e[r]-128)/128;return t}throw new Error(`Unsupported vector type: ${typeof e}`)}getConfig(){return{...this.config}}isInitialized(e){return this.initialized.has(e)}getInitializedNamespaces(){return Array.from(this.initialized)}getSize(e){if(!this.initialized.has(e))return 0;let t=this.unifiedAdapters?.get(e);return t?t.size():this.nextId.get(e)||0}}});var Fhe,Xc,rL=y(()=>{"use strict";N();Y();tL();Fhe={mergeSimilarityThreshold:.85,maxMergesPerRun:50,softThreshold:400,hardThreshold:2e3,archiveMinAgeDays:30,archiveQualityThreshold:.15,mergeQualityBoost:.02},Xc=class{config;db=null;initialized=!1;constructor(e={}){this.config={...Fhe,...e}}async initialize(e){if(!this.initialized){if(e)this.db=e;else{let t=W();await t.initialize(),this.db=t.getDatabase()}this.initialized=!0}}async consolidateAll(e){this.ensureInitialized();let t={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[]},r=this.db.prepare("SELECT domain, COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL GROUP BY domain").all(),n=e?r.filter(s=>e.includes(s.domain)):r.filter(s=>s.cnt>this.config.softThreshold);for(let{domain:s,cnt:a}of n){let c=await this.consolidateDomain(s,a);t.merged+=c.merged,t.qualityUpdated+=c.qualityUpdated,t.archived+=c.archived,t.hardDeleted+=c.hardDeleted,t.domainsProcessed.push(s)}let i=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL").get();return t.activeRemaining=i.cnt,(t.merged>0||t.archived>0)&&console.log(`[ExperienceConsolidator] Consolidated: ${t.merged} merged, ${t.archived} archived, ${t.activeRemaining} active`),t}async consolidateDomain(e,t){this.ensureInitialized();let r={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};r.merged=await this.clusterAndMerge(e),r.qualityUpdated=this.reinforceQuality(e),r.archived=this.archiveValueless(e);let n=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE domain = ? AND consolidated_into IS NULL").get(e).cnt;return n>this.config.hardThreshold&&(r.hardDeleted=this.hardDeleteExcess(e,n)),r.activeRemaining=n-r.hardDeleted,r}async bootstrapDomain(e){if(this.ensureInitialized(),this.db.prepare("SELECT value FROM kv_store WHERE key = ?").get(`consolidation_bootstrap_${e}`))return console.log(`[ExperienceConsolidator] Domain ${e} already bootstrapped`),{merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};let r={...this.config};this.config.mergeSimilarityThreshold=.8,this.config.maxMergesPerRun=200;let n=await this.consolidateDomain(e);Object.assign(this.config,r);try{this.db.prepare("INSERT OR REPLACE INTO kv_store (key, value, namespace) VALUES (?, ?, 'system')").run(`consolidation_bootstrap_${e}`,new Date().toISOString())}catch{}return console.log(`[ExperienceConsolidator] Bootstrap ${e}: ${n.merged} merged, ${n.archived} archived`),n}async clusterAndMerge(e){let t=this.db.prepare(`
5107
+ `).run(t.toISOString()).changes}async dispose(){this.activeTrajectories.clear(),this.recentTrajectories.clear(),this.prepared.clear(),this.db=null,this.unifiedMemory=null,this.initialized=!1,console.log("[TrajectoryTracker] Disposed")}ensureInitialized(){if(!this.initialized)throw new Error("TrajectoryTracker not initialized. Call initialize() first.")}calculateStepQuality(e){switch(e.outcome){case"success":return 1;case"partial":return .6;case"skipped":return .5;case"failure":return 0;default:return .5}}calculateMetrics(e){if(e.length===0)return{totalDurationMs:0,successfulSteps:0,failedSteps:0,averageQuality:0,totalTokensUsed:0,efficiencyScore:0};let t=0,r=0,n=0,i=0,s=0;for(let u of e)t+=u.durationMs,i+=u.quality,s+=u.tokensUsed??0,u.result.outcome==="success"?r++:u.result.outcome==="failure"&&n++;let a=i/e.length,l=r/e.length*a;return{totalDurationMs:t,successfulSteps:r,failedSteps:n,averageQuality:a,totalTokensUsed:s,efficiencyScore:l}}async rowToTrajectory(e){if(!e)return null;let t=this.prepared.get("getSteps"),r=[];if(t)r=t.all(e.id).map(a=>({id:a.id,action:a.action,result:{outcome:a.outcome,data:a.result_data?x(a.result_data):void 0,error:a.error_message??void 0,metrics:a.metrics_json?x(a.metrics_json):void 0},quality:a.quality,durationMs:a.duration_ms,timestamp:new Date(a.timestamp),context:a.context_json?x(a.context_json):void 0,tokensUsed:a.tokens_used??void 0}));else if(e.steps_json)try{r=x(e.steps_json)}catch{r=[]}let i=(e.metadata_json?x(e.metadata_json):{}).metrics??this.calculateMetrics(r);return{id:e.id,task:e.task,agent:e.agent??void 0,domain:e.domain,steps:r,outcome:e.success===1?"success":e.success===0?"failure":"partial",metrics:i,startedAt:new Date(e.started_at),endedAt:e.ended_at?new Date(e.ended_at):void 0,feedback:e.feedback??void 0,embedding:e.embedding?this.bufferToFloatArray(e.embedding):void 0,relatedPatternIds:e.related_patterns?x(e.related_patterns):void 0}}bufferToFloatArray(e){let t=e.length/4,r=[];for(let n=0;n<t;n++)r.push(e.readFloatLE(n*4));return r}}});function o4(){if(aS)return aS;let o=(X_(),Fe(K_));if(!o.HierarchicalNSW)throw new Error("hnswlib-node module missing HierarchicalNSW export");return aS=o.HierarchicalNSW,aS}function Lhe(){return!0}var aS,Kc,tL=y(()=>{"use strict";aS=null;Kc=class{indexes;config;initialized;nextId;unifiedAdapters=null;useUnified;constructor(e={}){this.config={M:e.M||16,efConstruction:e.efConstruction||200,efSearch:e.efSearch||50,dimension:e.dimension||384,metric:e.metric||"cosine",quantization:e.quantization||"none"},this.indexes=new Map,this.initialized=new Set,this.nextId=new Map,this.useUnified=Lhe(),this.useUnified&&(this.unifiedAdapters=new Map)}initializeIndex(e){if(this.initialized.has(e))return;if(this.useUnified&&this.unifiedAdapters)try{let{HnswAdapter:s}=(Au(),Fe(k0)),a=new s(`embedding-${e}`,{dimensions:this.config.dimension,M:this.config.M,efConstruction:this.config.efConstruction,efSearch:this.config.efSearch,metric:this.config.metric==="dotproduct"?"cosine":this.config.metric});this.unifiedAdapters.set(e,a),this.initialized.add(e),this.nextId.set(e,0);return}catch{}let r={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",n=o4(),i=new n(r,this.config.dimension);i.initIndex({maxElements:1e4,m:this.config.M,efConstruction:this.config.efConstruction}),this.indexes.set(e,i),this.initialized.add(e),this.nextId.set(e,0)}addEmbedding(e,t){let r=e.namespace;this.initialized.has(r)||this.initializeIndex(r);let n=t??this.nextId.get(r);t===void 0&&this.nextId.set(r,n+1);let i=this.unifiedAdapters?.get(r);if(i){let c=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return i.add(n,c),n}let s=this.indexes.get(r),a=this.toFloatArray(e.vector);return s.addPoint(a,n),n}addEmbeddingsBatch(e){return e.map(t=>this.addEmbedding(t.embedding,t.id))}search(e,t={}){let r=t.namespace||e.namespace;if(!this.initialized.has(r))return[];let n=t.limit||10,i=this.unifiedAdapters?.get(r);if(i){let l=e.vector instanceof Float32Array?e.vector:new Float32Array(this.toFloatArray(e.vector));return i.search(l,n).map(d=>({id:d.id,distance:1-d.score}))}let s=this.indexes.get(r),a=this.toFloatArray(e.vector),c=s.searchKnn(a,n);return c.neighbors.map((l,u)=>({id:l,distance:c.distances[u]}))}getIndexStats(e){if(!this.initialized.has(e))return null;let t=this.unifiedAdapters?.get(e);return t?{size:t.size(),maxElements:1e4,dimension:t.dimensions(),metric:this.config.metric}:{size:this.indexes.get(e).getCurrentCount(),maxElements:1e4,dimension:this.config.dimension,metric:this.config.metric}}async saveIndex(e,t){if(!this.initialized.has(e))throw new Error(`Namespace ${e} not initialized`);if(this.unifiedAdapters?.has(e)){console.warn(`[HNSWEmbeddingIndex] saveIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally.`);return}await this.indexes.get(e).writeIndex(t)}async loadIndex(e,t){if(this.useUnified){console.warn(`[HNSWEmbeddingIndex] loadIndex() is a no-op for namespace '${e}' \u2014 unified HnswAdapter manages persistence internally. Initialize via initializeIndex() instead.`);return}let n={cosine:"cosine",euclidean:"l2",dotproduct:"ip"}[this.config.metric]||"cosine",i=o4(),s=new i(n,this.config.dimension);await s.readIndex(t),this.indexes.set(e,s),this.initialized.add(e)}clearIndex(e){if(this.initialized.has(e)){let t=this.unifiedAdapters?.get(e);t&&(t.clear?.(),this.unifiedAdapters.delete(e)),this.indexes.delete(e),this.initialized.delete(e),this.nextId.delete(e)}}clearAll(){if(this.unifiedAdapters){for(let e of this.unifiedAdapters.values())e.clear?.();this.unifiedAdapters.clear()}this.indexes.clear(),this.initialized.clear(),this.nextId.clear()}resizeIndex(e,t){this.initialized.has(e)&&(this.clearIndex(e),this.initializeIndex(e))}setEfSearch(e){this.config.efSearch=e}toFloatArray(e){if(Array.isArray(e))return e;if(e instanceof Float32Array)return Array.from(e);if(e instanceof Int8Array){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=e[r]/128;return t}if(e instanceof Uint8Array){let t=new Array(e.length);for(let r=0;r<e.length;r++)t[r]=(e[r]-128)/128;return t}throw new Error(`Unsupported vector type: ${typeof e}`)}getConfig(){return{...this.config}}isInitialized(e){return this.initialized.has(e)}getInitializedNamespaces(){return Array.from(this.initialized)}getSize(e){if(!this.initialized.has(e))return 0;let t=this.unifiedAdapters?.get(e);return t?t.size():this.nextId.get(e)||0}}});var Fhe,Xc,rL=y(()=>{"use strict";N();Y();tL();Fhe={mergeSimilarityThreshold:.85,maxMergesPerRun:50,softThreshold:400,hardThreshold:2e3,archiveMinAgeDays:30,archiveQualityThreshold:.15,mergeQualityBoost:.02},Xc=class{config;db=null;initialized=!1;constructor(e={}){this.config={...Fhe,...e}}async initialize(e){if(!this.initialized){if(e)this.db=e;else{let t=W();await t.initialize(),this.db=t.getDatabase()}this.initialized=!0}}async consolidateAll(e){this.ensureInitialized();let t={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[]},r=this.db.prepare("SELECT domain, COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL GROUP BY domain").all(),n=e?r.filter(s=>e.includes(s.domain)):r.filter(s=>s.cnt>this.config.softThreshold);for(let{domain:s,cnt:a}of n){let c=await this.consolidateDomain(s,a);t.merged+=c.merged,t.qualityUpdated+=c.qualityUpdated,t.archived+=c.archived,t.hardDeleted+=c.hardDeleted,t.domainsProcessed.push(s)}let i=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE consolidated_into IS NULL").get();return t.activeRemaining=i.cnt,(t.merged>0||t.archived>0)&&console.log(`[ExperienceConsolidator] Consolidated: ${t.merged} merged, ${t.archived} archived, ${t.activeRemaining} active`),t}async consolidateDomain(e,t){this.ensureInitialized();let r={merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};r.merged=await this.clusterAndMerge(e),r.qualityUpdated=this.reinforceQuality(e),r.archived=this.archiveValueless(e);let n=this.db.prepare("SELECT COUNT(*) as cnt FROM captured_experiences WHERE domain = ? AND consolidated_into IS NULL").get(e).cnt,i=0;return n>this.config.hardThreshold&&(i=this.hardDeleteExcess(e,n),r.archived+=i),r.activeRemaining=n-i,r}async bootstrapDomain(e){if(this.ensureInitialized(),this.db.prepare("SELECT value FROM kv_store WHERE key = ?").get(`consolidation_bootstrap_${e}`))return console.log(`[ExperienceConsolidator] Domain ${e} already bootstrapped`),{merged:0,qualityUpdated:0,archived:0,hardDeleted:0,activeRemaining:0,domainsProcessed:[e]};let r={...this.config};this.config.mergeSimilarityThreshold=.8,this.config.maxMergesPerRun=200;let n=await this.consolidateDomain(e);Object.assign(this.config,r);try{this.db.prepare("INSERT OR REPLACE INTO kv_store (key, value, namespace) VALUES (?, ?, 'system')").run(`consolidation_bootstrap_${e}`,new Date().toISOString())}catch{}return console.log(`[ExperienceConsolidator] Bootstrap ${e}: ${n.merged} merged, ${n.archived} archived`),n}async clusterAndMerge(e){let t=this.db.prepare(`
5108
5108
  SELECT id, task, domain, quality, success, application_count,
5109
5109
  consolidation_count, reuse_success_count, reuse_failure_count,
5110
5110
  embedding, embedding_dimension, started_at
@@ -5153,22 +5153,18 @@ ${d.trim()}`;r.push(Fr(o,s.index,s.index+c.length,p,"Convert .then() to await"))
5153
5153
  INSERT INTO experience_consolidation_log (id, domain, action, source_ids, details, created_at)
5154
5154
  VALUES (?, ?, 'archive', '[]', ?, datetime('now'))
5155
5155
  `).run(E(),e,JSON.stringify({count:n.changes}))}catch{}return n.changes}hardDeleteExcess(e,t){let r=t-this.config.hardThreshold;if(r<=0)return 0;let i=this.db.prepare(`
5156
- DELETE FROM captured_experiences
5156
+ UPDATE captured_experiences
5157
+ SET consolidated_into = 'archived'
5157
5158
  WHERE id IN (
5158
5159
  SELECT id FROM captured_experiences
5159
- WHERE domain = ? AND consolidated_into = 'archived'
5160
- ORDER BY started_at ASC
5160
+ WHERE domain = ? AND consolidated_into IS NULL AND application_count = 0
5161
+ ORDER BY quality ASC, started_at ASC
5161
5162
  LIMIT ?
5162
5163
  )
5163
- `).run(e,r).changes;if(i<r){let s=r-i,a=this.db.prepare(`
5164
- DELETE FROM captured_experiences
5165
- WHERE id IN (
5166
- SELECT id FROM captured_experiences
5167
- WHERE domain = ? AND consolidated_into IS NULL AND application_count = 0
5168
- ORDER BY quality ASC, started_at ASC
5169
- LIMIT ?
5170
- )
5171
- `).run(e,s);i+=a.changes}return i>0&&console.warn(`[ExperienceConsolidator] Safety valve: hard-deleted ${i} from ${e}`),i}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ExperienceConsolidator not initialized. Call initialize() first.")}bufferToFloatArray(e,t){let r=[];for(let n=0;n<t;n++)r.push(e.readFloatLE(n*4));return r}}});function nL(o={}){return new oS(o)}var Nhe,oS,iL=y(()=>{"use strict";N();Y();Tr();hi();tL();$();rL();se();kI();Nhe={minQualityThreshold:.6,maxExperiencesPerDomain:500,similarityThreshold:.7,topK:5,embedding:{modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0},autoPrune:!0,pruneThreshold:.3},oS=class{config;unifiedMemory=null;db=null;prepared=new Map;initialized=!1;hnswIndex;idToExperienceId=new Map;experienceIdToHnswId=new Map;nextHnswId=0;recentExperiences;reservoirBuffer=null;stats={experiencesStored:0,experiencesApplied:0,totalTokensSaved:0,avgSimilarityOnRetrieval:0,totalRetrievals:0};constructor(e={}){this.config={...Nhe,...e},this.recentExperiences=new Ye(100),this.hnswIndex=new Kc({dimension:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"})}async initialize(){this.initialized||(this.unifiedMemory=W(),await this.unifiedMemory.initialize(),this.db=this.unifiedMemory.getDatabase(),this.ensureSchema(),this.prepareStatements(),await this.loadEmbeddingIndex(),(async()=>{try{if(!this.db)return;let e=this.db.prepare(`
5164
+ `).run(e,r).changes;if(i>0){try{this.db.prepare(`
5165
+ INSERT INTO experience_consolidation_log (id, domain, action, source_ids, details, created_at)
5166
+ VALUES (?, ?, 'safety-valve-archive', '[]', ?, datetime('now'))
5167
+ `).run(E(),e,JSON.stringify({count:i,currentCount:t,hardThreshold:this.config.hardThreshold,note:"soft-archive replacement for legacy hard-delete safety valve"}))}catch{}console.warn(`[ExperienceConsolidator] Safety valve: soft-archived ${i} from ${e} (was ${t}, threshold ${this.config.hardThreshold})`)}return i}ensureInitialized(){if(!this.initialized||!this.db)throw new Error("ExperienceConsolidator not initialized. Call initialize() first.")}bufferToFloatArray(e,t){let r=[];for(let n=0;n<t;n++)r.push(e.readFloatLE(n*4));return r}}});function nL(o={}){return new oS(o)}var Nhe,oS,iL=y(()=>{"use strict";N();Y();Tr();hi();tL();$();rL();se();kI();Nhe={minQualityThreshold:.6,maxExperiencesPerDomain:500,similarityThreshold:.7,topK:5,embedding:{modelName:"Xenova/all-MiniLM-L6-v2",quantized:!0},autoPrune:!0,pruneThreshold:.3},oS=class{config;unifiedMemory=null;db=null;prepared=new Map;initialized=!1;hnswIndex;idToExperienceId=new Map;experienceIdToHnswId=new Map;nextHnswId=0;recentExperiences;reservoirBuffer=null;stats={experiencesStored:0,experiencesApplied:0,totalTokensSaved:0,avgSimilarityOnRetrieval:0,totalRetrievals:0};constructor(e={}){this.config={...Nhe,...e},this.recentExperiences=new Ye(100),this.hnswIndex=new Kc({dimension:384,M:16,efConstruction:200,efSearch:100,metric:"cosine"})}async initialize(){this.initialized||(this.unifiedMemory=W(),await this.unifiedMemory.initialize(),this.db=this.unifiedMemory.getDatabase(),this.ensureSchema(),this.prepareStatements(),await this.loadEmbeddingIndex(),(async()=>{try{if(!this.db)return;let e=this.db.prepare(`
5172
5168
  SELECT id, domain, task FROM captured_experiences
5173
5169
  WHERE embedding IS NULL AND consolidated_into IS NULL
5174
5170
  LIMIT 200
@@ -5885,7 +5881,7 @@ ${i.errors.join(`
5885
5881
  ORDER BY ended_at DESC
5886
5882
  LIMIT ?
5887
5883
  `).all(ibe);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 sbe(a,o,e);c&&s.run(JSON.stringify(c),a.id)}catch{}}async function sbe(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(`
5888
- `),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:rbe,max_tokens:nbe,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 rbe,nbe,ibe,fX=y(()=>{"use strict";Y();rbe="claude-haiku-4-5-20251001",nbe=200,ibe=5});var SN={};Q(SN,{handleModelRoute:()=>Bw,handleReasoningBankStats:()=>ube,handleRoutingEconomics:()=>zw,handleRoutingMetrics:()=>Uw,handleTaskCancel:()=>$w,handleTaskList:()=>Nw,handleTaskOrchestrate:()=>qw,handleTaskOutcomeRecord:()=>lbe,handleTaskStatus:()=>Ow,handleTaskStatusWithLearning:()=>dbe,handleTaskSubmit:()=>Fw,subscribeTrajectoryEvents:()=>pbe,unsubscribeTrajectoryEvents:()=>bX});async function Fw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function Nw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function Ow(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function $w(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function qw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e,workflowOrchestrator:t}=me();try{let r=o.context?.project||vX(o.task),n=o.priority==="critical"||/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),s=await(await ms()).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 yn(),c=await a.getExperienceGuidance(o.task,o.context?.project),l=await a.searchPatterns(o.task,{limit:5,domain:o.context?.project??r}).catch(()=>[]),u=obe(o.task),d=cbe(o.priority||"medium"),p=abe[u];if(p&&t){console.log(`[TaskOrchestrate] Task type '${u}' has workflow '${p}' - executing workflow`);let v=o.task.match(/https?:\/\/[^\s]+/i),b=v?v[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},R=await t.executeWorkflow(p,C);return R.success?{success:!0,data:{taskId:R.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: ${R.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(v=>({patternId:v.id,name:v.name,description:v.description,confidence:v.confidence,similarity:v.qualityScore,canReuse:v.tier==="long-term"})):void 0},timeout:6e5});if(!g.success)return{success:!1,error:g.error.message};let h=g.value;return await bN(h,o.task,{agent:"queen-coordinator",domain:o.context?.project}),process.env.AQE_TRAJECTORY_JUDGE==="1"&&process.env.ANTHROPIC_API_KEY&&hX().catch(v=>{console.warn("[TrajectoryJudge] failed:",v instanceof Error?v.message:v)}),{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: ${w(r)}`}}}async function Bw(o){try{let e=await ms(),t=o.domain||vX(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: ${w(e)}`}}}async function Uw(o){try{let e=await ms(),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: ${w(e)}`}}}async function zw(o){try{let{createRoutingFeedbackCollector:e}=await Promise.resolve().then(()=>(oF(),CK)),{getGlobalCostTracker:t}=await Promise.resolve().then(()=>(iF(),bK)),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: ${w(e)}`}}}function vX(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 obe(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 cbe(o){switch(o){case"critical":return"p0";case"high":return"p1";case"medium":return"p2";case"low":return"p3";default:return"p1"}}async function lbe(o){try{let e=await yn(),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: ${w(e)}`}}}async function ube(){try{let e=await(await yn()).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: ${w(o)}`}}}async function dbe(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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")&&!yX.has(o.taskId)){yX.add(o.taskId);try{let n=await yn(),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 _g(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: ${w(t)}`}}}function pbe(o){bX(o);let e=o.subscribeToEventType("TaskCompleted",async r=>{let{taskId:n}=r.payload;n&&await _g(n,!0).catch(()=>{})}),t=o.subscribeToEventType("TaskFailed",async r=>{let{taskId:n,error:i}=r.payload;n&&await _g(n,!1,i).catch(()=>{})});TN=[e,t]}function bX(o){for(let e of TN)o.unsubscribe(e);TN=[]}var abe,yX,TN,Vw=y(()=>{"use strict";hs();kS();CN();fX();k();abe={"ideation-assessment":"qcsd-ideation-swarm"};yX=new Set;TN=[]});var TX={};Q(TX,{DEFAULT_STRUCTURAL_HEALTH_CONFIG:()=>CX,StructuralHealthMonitor:()=>Gw,createStructuralHealthMonitor:()=>mbe});function mbe(o){return new Gw(o)}var CX,Gw,SX=y(()=>{"use strict";RL();CX={healthyThreshold:.4,warningThreshold:.2,maxHistoryEntries:100,enableLogging:!1},Gw=class{config;minCutService;history=[];constructor(e){this.config={...CX,...e},this.minCutService=vS()}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)}%`)}}});function me(){return z}function ge(){return z.initialized&&z.kernel!==null&&z.queen!==null}function EX(o,e){if(z.topology!=="hierarchical"){let i={agentId:o,domain:e,level:"worker",spawnedAt:new Date};return z.agentLevels.set(o,i),"worker"}let r=Array.from(z.agentLevels.values()).find(i=>i.domain===e&&i.level==="lead")?"worker":"lead",n={agentId:o,domain:e,level:r,spawnedAt:new Date};return z.agentLevels.set(o,n),r}function RX(o){return z.agentLevels.get(o)}async function Lg(o){try{if(z.initialized&&z.kernel&&z.queen)return{success:!0,data:{fleetId:z.fleetId,topology:o.topology||"hierarchical",maxAgents:o.maxAgents||15,enabledDomains:o.enabledDomains||wX,status:"ready"}};z.fleetId=`fleet-${E().slice(0,8)}`;let e=o.enabledDomains||[...Z],t=e.filter(c=>c!=="coordination");z.kernel=new pT({maxConcurrentAgents:o.maxAgents||15,memoryBackend:o.memoryBackend||"hybrid",hnswEnabled:!0,lazyLoading:o.lazyLoading!==!1,enabledDomains:e}),await z.kernel.initialize(),z.router=new XT(z.kernel.eventBus),await z.router.initialize();let r=c=>z.kernel.getDomainAPI(c),n=new _w(z.kernel.eventBus,z.kernel.memory,r),i=z.kernel.plugins;await i.loadAll();let s=new Map;for(let c of i.getLoaded()){let l=i.getPlugin(c);l&&s.set(c,l)}z.queen=V5(z.kernel,z.router,n,void 0,s),await z.queen.initialize(),z.workflowOrchestrator=new bm(z.kernel.eventBus,z.kernel.memory,z.kernel.coordinator),await z.workflowOrchestrator.initialize(),gbe(z.kernel,z.workflowOrchestrator);let{subscribeTrajectoryEvents:a}=await Promise.resolve().then(()=>(Vw(),SN));return a(z.router),z.initialized=!0,z.initTime=new Date,z.topology=o.topology||"hierarchical",z.agentLevels.clear(),{success:!0,data:{fleetId:z.fleetId,topology:z.topology,maxAgents:o.maxAgents||15,enabledDomains:t,status:"initialized"}}}catch(e){return{success:!1,error:`Failed to initialize fleet: ${w(e)}`}}}async function wN(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let e=z.queen.getHealth(),t=z.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:z.queen.getDomainLoad(s)});r.domains=i}let n=z.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(),Cr)),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: ${w(e)}`}}}async function EN(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{if(o.domain){let r=z.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=z.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(()=>(SX(),TX)),n=new r,i=[];for(let[c]of e.domainHealth){let l=z.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: ${w(e)}`}}}async function RN(){if(nK(),BS(),dX(),z.workflowOrchestrator&&(await z.workflowOrchestrator.dispose(),z.workflowOrchestrator=null),z.queen&&(await z.queen.dispose(),z.queen=null),z.router){try{let{unsubscribeTrajectoryEvents:o}=await Promise.resolve().then(()=>(Vw(),SN));o(z.router)}catch{}await z.router.dispose(),z.router=null}z.kernel&&(await z.kernel.dispose(),z.kernel=null),z.initialized=!1,z.fleetId=null,z.initTime=null,z.topology="hierarchical",z.agentLevels.clear()}async function AN(){let o=performance.now();try{let e=ge(),t=z.initTime?Date.now()-z.initTime.getTime():0,r={connected:!1,totalEntries:0,namespaces:0},n={enabled:!1,vectorCount:0},i=0;if(e&&z.kernel){let u=z.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&&z.kernel?(z.kernel.getLoadedDomains?.()??wX).length:0,a=null;try{let{getSharedRvfDualWriterSync:u}=await Promise.resolve().then(()=>(rs(),ya)),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(()=>(Rc(),VM)),d=new u;await d.initialize(),c=d.getGhostPatternCount(),d.close()}catch{}return{success:!0,data:{status:e?"healthy":"unhealthy",version:"3.9.21",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:E(),toolName:"aqe_health"}}}catch(e){return{success:!1,error:w(e),metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:E(),toolName:"aqe_health"}}}}function gbe(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 wX,z,hs=y(()=>{"use strict";N();C3();L();G5();wD();H5();HL();US();vN();pX();k();wX=Z.filter(o=>o!=="coordination"),z={fleetId:null,kernel:null,queen:null,router:null,workflowOrchestrator:null,initialized:!1,initTime:null,topology:"hierarchical",agentLevels:new Map}});import{randomUUID as Zbe}from"crypto";var $e,ir=y(()=>{"use strict";k();$e=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let t=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let r,n;for(let s=0;s<=this.config.retryCount;s++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");n=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(a){r=S(a),e.logger.warn(`Worker ${this.config.id} attempt ${s+1} failed: ${r.message}`),s<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let i=Date.now()-t;return n?(this._successfulExecutions++,this._lastResult=n):(this._failedExecutions++,n=this.createErrorResult(r,i),this._lastResult=n),this._executionDurations.push(i),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:n.success,durationMs:i}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=n.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:n.success,durationMs:i,findingsCount:n.findings.length,healthScore:n.metrics.healthScore}}),n}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((r,n)=>r+n,0)/this._executionDurations.length:0,t=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(t*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,t,r){return new Promise((n,i)=>{let s=setTimeout(()=>{i(new Error(`Worker execution timed out after ${t}ms`))},t),a=()=>{clearTimeout(s),i(new Error("Worker execution aborted"))};r.addEventListener("abort",a,{once:!0}),e().then(c=>{clearTimeout(s),r.removeEventListener("abort",a),n(c)}).catch(c=>{clearTimeout(s),r.removeEventListener("abort",a),i(c)})})}createErrorResult(e,t){return{workerId:this.config.id,timestamp:new Date,durationMs:t,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,t,r,n){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:t,findings:r,recommendations:n}}delay(e){return new Promise(t=>setTimeout(t,e))}generateId(){return`${Date.now()}-${Zbe().slice(0,9)}`}}});var eCe,Pl,dO=y(()=>{"use strict";ir();yw();Y();jF();k();eCe={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},Pl=class extends $e{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(eCe),this.dailyLogger=new gg}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=W();await e.initialize();let t=e.getDatabase();return this.lifecycleManager=mg(t,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return W().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let t=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let r=[],n=[],i=await this.getLifecycleManager();if(!i)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-t,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let s=0,a=0;try{let b=i.promoteEligiblePatterns();s=b.promoted,a=b.checked,s>0&&r.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${s} of ${a} short-term patterns promoted to long-term`})}catch(b){e.logger.warn("Pattern promotion failed",{error:w(b)})}let c=0,l=0;try{let b=i.deprecateStalePatterns();c=b.deprecated,l=b.checked,c>0&&r.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${l} patterns deprecated (stale, failed, or low confidence)`})}catch(b){e.logger.warn("Stale pattern detection failed",{error:w(b)})}let u=0;try{let b=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;u=i.applyConfidenceDecay(Math.min(b,7)).decayed}catch(b){e.logger.warn("Confidence decay failed",{error:w(b)})}let d=this.getPendingExperienceCount(),p={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{p=i.getStats()}catch(b){e.logger.warn("Stats retrieval failed",{error:w(b)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${s} promoted, ${c} deprecated, ${u} decayed, ${d} pending exp, ${p.activePatterns} active patterns (avg conf: ${p.avgConfidence.toFixed(2)})`,details:{promoted:s,deprecated:c,decayed:u,pendingExperiences:d,totalPatterns:p.totalPatterns,activePatterns:p.activePatterns,avgConfidence:p.avgConfidence,avgSuccessRate:p.avgSuccessRate}}),this.dailyLogger.flush()}catch(b){e.logger.warn("Daily log write failed",{error:w(b)})}this.lastRunTimestamp=Date.now(),p.activePatterns>0&&p.patternsNearDeprecation/p.activePatterns>.5&&n.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${p.patternsNearDeprecation} of ${p.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let m=this.calculateHealthScore(p,s,c),g=this.determineTrend(s,c,p.activePatterns),h=Math.max(a,l),v=s+c+p.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:s,deprecated:c,decayed:u,pendingExperiences:d,healthScore:m}),this.createResult(Date.now()-t,{itemsAnalyzed:h,issuesFound:v,healthScore:m,trend:g,domainMetrics:{promoted:s,deprecated:c,decayed:u,stalePatterns:p.patternsNearDeprecation,pendingExperiences:d,avgConfidence:Number(p.avgConfidence.toFixed(3)),avgSuccessRate:Number(p.avgSuccessRate.toFixed(3))}},r,n)}calculateHealthScore(e,t,r){let n=70;if(n+=Math.min(15,t*5),e.avgConfidence>0&&(n+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let i=r/e.activePatterns;n-=Math.round(i*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(n-=10),Math.max(0,Math.min(100,Math.round(n)))}determineTrend(e,t,r){return r===0?"stable":e>t?"improving":t>e&&t/r>.1?"degrading":"stable"}}});var M1,D1,_1,WE,jE,QE,r7=y(()=>{"use strict";M1=class{handlers=[];async publish(e){for(let t of this.handlers)try{t(e)}catch(r){console.debug("[WorkerManager] Event handler error:",r instanceof Error?r.message:r)}}subscribe(e){return this.handlers.push(e),()=>{let t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}dispose(){this.handlers=[]}get handlerCount(){return this.handlers.length}},D1=class{store=new Map;async get(e){return this.store.get(e)}async set(e,t){this.store.set(e,t)}async search(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(t.replace(/\*/g,".*"));return Array.from(this.store.keys()).filter(n=>r.test(n))}clear(){this.store.clear()}get size(){return this.store.size}},_1=class{constructor(e){this.workerId=e}workerId;format(e,t,r){let n=new Date().toISOString(),i=r?` ${JSON.stringify(r)}`:"";return`[${n}] [${e}] [${this.workerId}] ${t}${i}`}debug(e,t){process.env.DEBUG&&console.debug(this.format("DEBUG",e,t))}info(e,t){console.info(this.format("INFO",e,t))}warn(e,t){console.warn(this.format("WARN",e,t))}error(e,t){console.error(this.format("ERROR",e,t))}},WE=class{constructor(e){this.kernelGetter=e}kernelGetter;getDomainAPI(e){let t=this.kernelGetter();if(t)return t.getDomainAPI(e)}getDomainHealth(e){let t=this.kernelGetter();if(!t)return{status:"unknown",errors:["Kernel not available"]};let n=t.getHealth().domains[e];return n?{status:n.status,errors:n.errors||[]}:{status:"unknown",errors:[`Domain ${e} not found`]}}},jE=class{getDomainAPI(e){}getDomainHealth(e){return{status:"healthy",errors:[]}}},QE=class{workers=new Map;timers=new Map;abortControllers=new Map;eventBus;memory;domainAccess;running=!1;kernelRef;constructor(e){this.eventBus=e?.eventBus??new M1,this.memory=e?.memory??new D1,this.kernelRef=e?.kernel,e?.domainAccess?this.domainAccess=e.domainAccess:e?.kernel?this.domainAccess=new WE(()=>this.kernelRef):this.domainAccess=new jE}setKernel(e){this.kernelRef=e,this.domainAccess instanceof jE&&(this.domainAccess=new WE(()=>this.kernelRef))}register(e){if(this.workers.has(e.config.id))throw new Error(`Worker ${e.config.id} is already registered`);this.workers.set(e.config.id,e)}unregister(e){this.workers.get(e)&&(this.stopWorker(e),this.workers.delete(e))}get(e){return this.workers.get(e)}list(){return Array.from(this.workers.values())}async startAll(){this.running=!0;for(let e of Array.from(this.workers.values()))e.config.enabled&&await this.startWorker(e)}async stopAll(){this.running=!1;let e=[];for(let t of Array.from(this.workers.keys()))e.push(this.stopWorker(t));await Promise.all(e)}async runNow(e){let t=this.workers.get(e);if(!t)throw new Error(`Worker ${e} not found`);let r=this.timers.get(e);r&&clearTimeout(r);let n=new AbortController;this.abortControllers.set(e,n);let i=this.createContext(e,n.signal),s=await t.execute(i);return this.running&&t.config.enabled&&t.status!=="stopped"&&this.scheduleNextRun(t),s}getHealth(){let e={},t=0,r=0,n=0,i=0;for(let[a,c]of Array.from(this.workers.entries())){let l=c.getHealth();switch(e[a]=l,i+=l.healthScore,c.status){case"running":t++;break;case"paused":r++;break;case"error":n++;break}}let s=this.workers.size>0?Math.round(i/this.workers.size):100;return{totalWorkers:this.workers.size,runningWorkers:t,pausedWorkers:r,errorWorkers:n,healthScore:s,workers:e}}onWorkerEvent(e){return this.eventBus.subscribe(e)}async startWorker(e){await e.initialize();let t=new AbortController;this.abortControllers.set(e.config.id,t);let r=this.createContext(e.config.id,t.signal);try{await e.execute(r)}catch(n){console.error(`Worker ${e.config.id} initial execution failed:`,n)}this.scheduleNextRun(e)}async stopWorker(e){let t=this.timers.get(e);t&&(clearTimeout(t),this.timers.delete(e));let r=this.abortControllers.get(e);r&&(r.abort(),this.abortControllers.delete(e));let n=this.workers.get(e);n&&await n.stop()}scheduleNextRun(e){let t=setTimeout(async()=>{if(!this.running||e.status==="stopped"||e.status==="paused")return;let r=new AbortController;this.abortControllers.set(e.config.id,r);let n=this.createContext(e.config.id,r.signal);try{await e.execute(n)}catch(i){console.error(`Worker ${e.config.id} execution failed:`,i)}this.running&&e.config.enabled&&e.status!=="error"&&this.scheduleNextRun(e)},e.config.intervalMs);this.timers.set(e.config.id,t)}createContext(e,t){return{eventBus:this.eventBus,memory:this.memory,logger:new _1(e),domains:this.domainAccess,signal:t}}}});var aEe,eh,n7=y(()=>{"use strict";ir();k();aEe={id:"test-health",name:"Test Health Monitor",description:"Monitors test suite health metrics including pass rates, execution times, and reliability",intervalMs:300*1e3,priority:"high",targetDomains:["test-execution","test-generation"],enabled:!0,timeoutMs:6e4,retryCount:2,retryDelayMs:5e3},eh=class extends $e{previousMetrics;constructor(){super(aEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting test health analysis");let r=[],n=[],i=await this.collectMetrics(e);this.analyzePassRate(i,r,n),this.analyzeExecutionTime(i,r,n),this.analyzeReliability(i,r,n),this.analyzeGrowth(i,r,n),this.compareToPrevious(i,r,n),await e.memory.set("test-health:previous-metrics",i),this.previousMetrics=i;let s=this.calculateHealthScore(i),a=this.determineTrend(i);return e.logger.info("Test health analysis complete",{healthScore:s,findingsCount:r.length}),this.createResult(Date.now()-t,{itemsAnalyzed:i.totalTests,issuesFound:r.length,healthScore:s,trend:a,domainMetrics:{passRate:`${(i.passingTests/i.totalTests*100).toFixed(1)}%`,avgExecutionTime:`${i.avgExecutionTimeMs}ms`,reliability:`${i.reliability}%`,totalTests:i.totalTests}},r,n)}async collectMetrics(e){let t=await e.memory.get("test-health:previous-metrics");if(t&&(this.previousMetrics=t),!e.domains.getDomainAPI("test-execution"))throw new Error("Test-execution domain not available - cannot compute health metrics. Ensure the test-execution domain is properly initialized before running this worker.");try{let n=await e.memory.search("test-health:run-result:*");if(n.length===0)throw new Error('No test run data found in memory - cannot compute health metrics. Run some tests first or ensure test results are being stored with keys matching "test-health:run-result:*".');let i=0,s=0,a=0,c=0,l=0,u=0;for(let g of n.slice(0,50)){let h=await e.memory.get(g);h&&(i+=h.total,s+=h.passed,a+=h.failed,c+=h.skipped,l+=h.duration,u++)}let d=u>0?Math.round(l/u):0,p=i>0?Math.round(s/i*100):0,m=await e.memory.get("test-health:growth-metrics");return{totalTests:i||0,passingTests:s||0,failingTests:a||0,skippedTests:c||0,avgExecutionTimeMs:d,reliability:p,growth:{testsAddedLast7Days:m?.testsAddedLast7Days||0,testsRemovedLast7Days:m?.testsRemovedLast7Days||0}}}catch(n){let i=w(n);throw new Error(`Failed to collect test health metrics: ${i}. Check memory service connectivity and test result data availability.`)}}analyzePassRate(e,t,r){let n=e.passingTests/e.totalTests*100;n<95&&(t.push({type:"low-pass-rate",severity:n<90?"high":"medium",domain:"test-execution",title:"Low Test Pass Rate",description:`Test pass rate is ${n.toFixed(1)}%, below the 95% target`,context:{passing:e.passingTests,failing:e.failingTests,total:e.totalTests}}),r.push({priority:"p1",domain:"test-execution",action:"Investigate Failing Tests",description:`${e.failingTests} tests are currently failing. Review and fix to improve pass rate.`,estimatedImpact:"high",effort:"medium",autoFixable:!1}))}analyzeExecutionTime(e,t,r){e.avgExecutionTimeMs>500&&(t.push({type:"slow-tests",severity:e.avgExecutionTimeMs>1e3?"high":"medium",domain:"test-execution",title:"Slow Test Execution",description:`Average test execution time is ${e.avgExecutionTimeMs}ms, consider optimization`,context:{avgExecutionTimeMs:e.avgExecutionTimeMs}}),r.push({priority:"p2",domain:"test-execution",action:"Optimize Test Execution Time",description:"Review and optimize slow-running tests. Consider parallelization or mocking slow dependencies.",estimatedImpact:"medium",effort:"medium",autoFixable:!1}))}analyzeReliability(e,t,r){e.reliability<95&&(t.push({type:"reliability-issue",severity:e.reliability<85?"high":"medium",domain:"test-execution",title:"Test Reliability Concern",description:`Test reliability score is ${e.reliability}%, indicating potential flaky tests`,context:{reliability:e.reliability}}),r.push({priority:"p1",domain:"test-execution",action:"Address Flaky Tests",description:"Identify and fix flaky tests to improve overall test reliability.",estimatedImpact:"high",effort:"medium",autoFixable:!1}))}analyzeGrowth(e,t,r){let n=e.growth.testsAddedLast7Days-e.growth.testsRemovedLast7Days;n<0&&(t.push({type:"test-coverage-decline",severity:"medium",domain:"test-generation",title:"Test Coverage Declining",description:`Net loss of ${Math.abs(n)} tests in the last 7 days`,context:{added:e.growth.testsAddedLast7Days,removed:e.growth.testsRemovedLast7Days}}),r.push({priority:"p2",domain:"test-generation",action:"Review Test Coverage Strategy",description:"More tests are being removed than added. Ensure adequate test coverage is maintained.",estimatedImpact:"medium",effort:"low",autoFixable:!1}))}compareToPrevious(e,t,r){if(!this.previousMetrics)return;let n=e.passingTests/e.totalTests-this.previousMetrics.passingTests/this.previousMetrics.totalTests;n<-.05&&t.push({type:"pass-rate-regression",severity:"high",domain:"test-execution",title:"Pass Rate Regression Detected",description:`Pass rate dropped by ${(Math.abs(n)*100).toFixed(1)}% since last check`,context:{previousPassRate:`${(this.previousMetrics.passingTests/this.previousMetrics.totalTests*100).toFixed(1)}%`,currentPassRate:`${(e.passingTests/e.totalTests*100).toFixed(1)}%`}})}calculateHealthScore(e){let t=e.passingTests/e.totalTests*40,r=e.reliability/100*30,n=Math.max(0,20-e.avgExecutionTimeMs/100),i=Math.min(10,e.growth.testsAddedLast7Days/10*10);return Math.round(t+r+n+i)}determineTrend(e){if(!this.previousMetrics)return"stable";let t=e.passingTests/e.totalTests,r=this.previousMetrics.passingTests/this.previousMetrics.totalTests;return t>r+.02?"improving":t<r-.02?"degrading":"stable"}}});var oEe,th,i7=y(()=>{"use strict";ir();oEe={id:"coverage-tracker",name:"Coverage Tracker",description:"Tracks coverage trends over time including gaps, hotspots, and critical paths",intervalMs:600*1e3,priority:"high",targetDomains:["coverage-analysis","test-generation"],enabled:!0,timeoutMs:12e4,retryCount:2,retryDelayMs:1e4},th=class extends $e{constructor(){super(oEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting coverage tracking analysis");let r=[],n=[],i=await this.collectCoverageTrend(e),s=await this.identifyCoverageGaps(e);this.analyzeCoverageThresholds(i.current,r,n),this.analyzeCoverageGaps(s,r,n),this.analyzeCoverageTrends(i,r,n),await e.memory.set("coverage:current",i.current),await e.memory.set("coverage:gaps",s);let a=this.calculateHealthScore(i.current,s);return e.logger.info("Coverage tracking complete",{healthScore:a,findingsCount:r.length,gapsFound:s.length}),this.createResult(Date.now()-t,{itemsAnalyzed:s.length+4,issuesFound:r.length,healthScore:a,trend:this.determineTrend(i),domainMetrics:{lineCoverage:`${i.current.line}%`,branchCoverage:`${i.current.branch}%`,functionCoverage:`${i.current.function}%`,statementCoverage:`${i.current.statement}%`,gapsCount:s.length}},r,n)}async collectCoverageTrend(e){let t=await e.memory.get("coverage:current"),r=await e.memory.get("coverage:latest");return{current:{line:r?.line??0,branch:r?.branch??0,function:r?.function??0,statement:r?.statement??0,timestamp:new Date},previous:t}}async identifyCoverageGaps(e){let t=await e.memory.search("gap-pattern:*");if(t.length>0){let r=[];for(let n of t){let i=await e.memory.get(n);i&&typeof i.riskScore=="number"&&r.push(i)}if(r.length>0)return r}return[]}analyzeCoverageThresholds(e,t,r){let n={line:80,branch:70,function:80,statement:80};e.line<n.line&&t.push({type:"low-line-coverage",severity:e.line<60?"high":"medium",domain:"coverage-analysis",title:"Line Coverage Below Threshold",description:`Line coverage is ${e.line}%, below ${n.line}% target`,context:{current:e.line,target:n.line}}),e.branch<n.branch&&(t.push({type:"low-branch-coverage",severity:e.branch<50?"high":"medium",domain:"coverage-analysis",title:"Branch Coverage Below Threshold",description:`Branch coverage is ${e.branch}%, below ${n.branch}% target`,context:{current:e.branch,target:n.branch}}),r.push({priority:"p1",domain:"test-generation",action:"Improve Branch Coverage",description:"Add tests for uncovered conditional branches. Focus on complex decision points.",estimatedImpact:"high",effort:"medium",autoFixable:!0})),e.function<n.function&&t.push({type:"low-function-coverage",severity:"medium",domain:"coverage-analysis",title:"Function Coverage Below Threshold",description:`Function coverage is ${e.function}%, below ${n.function}% target`,context:{current:e.function,target:n.function}})}analyzeCoverageGaps(e,t,r){let n=e.filter(s=>s.riskScore>.8);for(let s of n)t.push({type:"high-risk-coverage-gap",severity:"high",domain:"coverage-analysis",title:"High-Risk Coverage Gap",description:`${s.file} has ${s.uncoveredLines} uncovered lines with complexity ${s.complexity}`,resource:s.file,context:{uncoveredLines:s.uncoveredLines,totalLines:s.totalLines,coveragePercent:((s.totalLines-s.uncoveredLines)/s.totalLines*100).toFixed(1),complexity:s.complexity,riskScore:s.riskScore}});n.length>0&&r.push({priority:"p0",domain:"test-generation",action:"Address High-Risk Coverage Gaps",description:`${n.length} files have high-risk coverage gaps. Prioritize testing for complex, uncovered code.`,estimatedImpact:"high",effort:"high",autoFixable:!0});let i=e.filter(s=>(s.totalLines-s.uncoveredLines)/s.totalLines<.5);i.length>0&&t.push({type:"critical-coverage-gaps",severity:"critical",domain:"coverage-analysis",title:"Critical Coverage Gaps Detected",description:`${i.length} files have less than 50% coverage`,context:{files:i.map(s=>s.file)}})}analyzeCoverageTrends(e,t,r){if(!e.previous)return;let n=e.current.line-e.previous.line,i=e.current.branch-e.previous.branch;n<-2&&(t.push({type:"coverage-regression",severity:n<-5?"high":"medium",domain:"coverage-analysis",title:"Coverage Regression Detected",description:`Line coverage dropped by ${Math.abs(n).toFixed(1)}% since last check`,context:{previous:e.previous.line,current:e.current.line,change:n}}),r.push({priority:"p1",domain:"test-generation",action:"Investigate Coverage Regression",description:"Recent changes have reduced code coverage. Review new code and add missing tests.",estimatedImpact:"high",effort:"medium",autoFixable:!1})),i<-3&&t.push({type:"branch-coverage-regression",severity:"medium",domain:"coverage-analysis",title:"Branch Coverage Regression",description:`Branch coverage dropped by ${Math.abs(i).toFixed(1)}%`,context:{previous:e.previous.branch,current:e.current.branch,change:i}})}calculateHealthScore(e,t){let r=e.line/100*25,n=e.branch/100*25,i=e.function/100*20,s=e.statement/100*20,a=t.filter(l=>l.riskScore>.8).length,c=Math.max(0,10-a*2);return Math.round(r+n+i+s+c)}determineTrend(e){if(!e.previous)return"stable";let t=(e.current.line+e.current.branch+e.current.function+e.current.statement)/4,r=(e.previous.line+e.previous.branch+e.previous.function+e.previous.statement)/4;return t>r+1?"improving":t<r-1?"degrading":"stable"}}});var cEe,rh,s7=y(()=>{"use strict";ir();cEe={id:"flaky-detector",name:"Flaky Test Detector",description:"Detects flaky test patterns through statistical analysis of test execution history",intervalMs:900*1e3,priority:"high",targetDomains:["test-execution"],enabled:!0,timeoutMs:18e4,retryCount:2,retryDelayMs:1e4},rh=class extends $e{constructor(){super(cEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting flaky test detection");let r=[],n=[],i=await this.collectTestHistory(e),s=this.detectFlakyTests(i);this.generateFindings(s,r,n),await e.memory.set("flaky:detected",s),await e.memory.set("flaky:lastAnalysis",new Date().toISOString());let a=this.calculateHealthScore(i.length,s);return e.logger.info("Flaky test detection complete",{healthScore:a,testsAnalyzed:i.length,flakyTestsFound:s.length}),this.createResult(Date.now()-t,{itemsAnalyzed:i.length,issuesFound:s.length,healthScore:a,trend:"stable",domainMetrics:{testsAnalyzed:i.length,flakyTests:s.length,flakinessRate:`${(s.length/i.length*100).toFixed(1)}%`,avgFlakinessScore:s.length>0?(s.reduce((c,l)=>c+l.flakinessScore,0)/s.length).toFixed(1):"0"}},r,n)}async collectTestHistory(e){if(!e.domains.getDomainAPI("test-execution"))throw new Error("Test-execution domain not available - cannot detect flaky tests. Ensure the test-execution domain is properly initialized before running this worker.");let r=await e.memory.search("flaky:history:*");if(r.length===0)throw new Error('No test execution history found in memory - cannot detect flaky tests. Run tests multiple times and ensure history is stored with keys matching "flaky:history:*" before running this worker.');let n=[],i=[];for(let s of r)try{let a=await e.memory.get(s);a&&n.push(a)}catch{i.push(s)}if(n.length===0)throw new Error(`Found ${r.length} test history keys but failed to retrieve any data. Failed keys: ${i.slice(0,5).join(", ")}${i.length>5?"...":""}. Check memory service connectivity and data format.`);return n}detectFlakyTests(e){let t=[];for(let r of e){let n=this.analyzeTestFlakiness(r);n.flakinessScore>20&&t.push(n)}return t.sort((r,n)=>n.flakinessScore-r.flakinessScore)}analyzeTestFlakiness(e){let t=e.executions,n=t.filter(g=>g.passed).length/t.length,i=t.map(g=>g.durationMs),s=i.reduce((g,h)=>g+h,0)/i.length,a=i.reduce((g,h)=>g+Math.pow(h-s,2),0)/i.length,l=Math.sqrt(a)/s,u=t.slice(-5).filter(g=>!g.passed).length,d=this.determinePattern(e,l),p=0;n>0&&n<1&&(p+=(1-n)*50),l>.5&&(p+=Math.min(25,l*10)),p+=u*5;let m=this.suggestFix(d);return{testId:e.testId,testName:e.testName,file:e.file,flakinessScore:Math.min(100,Math.round(p)),pattern:d,passRate:n*100,avgDuration:s,durationVariance:l,recentFailures:u,suggestedFix:m}}determinePattern(e,t){let r=e.executions.filter(i=>!i.passed);if(t>1||r.some(i=>i.error?.includes("Timeout")))return"timing";if(r.some(i=>i.error?.includes("Resource")||i.error?.includes("connection")))return"resource";if(r.some(i=>i.error?.includes("Race")||i.error?.includes("async")))return"intermittent";let n=e.executions.map(i=>i.passed);return this.hasOrderPattern(n)?"order-dependent":"intermittent"}hasOrderPattern(e){let t=e.map((i,s)=>i?-1:s).filter(i=>i>=0);if(t.length<2)return!1;let r=t.every(i=>i%2===0),n=t.every(i=>i%2===1);return r||n}suggestFix(e){switch(e){case"timing":return"Add explicit waits, increase timeouts, or use async utilities like waitFor";case"resource":return"Ensure proper resource cleanup, use test isolation, or implement connection pooling";case"order-dependent":return"Make tests independent, reset state in beforeEach, avoid shared mutable state";case"intermittent":return"Add retry logic, investigate race conditions, or use proper synchronization";default:return"Review test for potential issues with async operations or shared state"}}generateFindings(e,t,r){let n=e.filter(c=>c.flakinessScore>=70),i=e.filter(c=>c.flakinessScore>=50&&c.flakinessScore<70),s=e.filter(c=>c.flakinessScore>=20&&c.flakinessScore<50);for(let c of n)t.push({type:"critical-flaky-test",severity:"critical",domain:"test-execution",title:`Critical Flaky Test: ${c.testName}`,description:`Test has ${c.flakinessScore}% flakiness score with ${c.passRate.toFixed(0)}% pass rate`,resource:c.file,context:{testId:c.testId,pattern:c.pattern,recentFailures:c.recentFailures,suggestedFix:c.suggestedFix}});for(let c of i)t.push({type:"high-flaky-test",severity:"high",domain:"test-execution",title:`Flaky Test: ${c.testName}`,description:`Test has ${c.flakinessScore}% flakiness score (${c.pattern} pattern)`,resource:c.file,context:{testId:c.testId,pattern:c.pattern,suggestedFix:c.suggestedFix}});for(let c of s)t.push({type:"medium-flaky-test",severity:"medium",domain:"test-execution",title:`Potentially Flaky Test: ${c.testName}`,description:`Test shows flakiness indicators (score: ${c.flakinessScore}%)`,resource:c.file,context:{testId:c.testId,pattern:c.pattern}});n.length>0&&r.push({priority:"p0",domain:"test-execution",action:"Fix Critical Flaky Tests",description:`${n.length} tests have critical flakiness. These severely impact CI reliability.`,estimatedImpact:"high",effort:"high",autoFixable:!1});let a=e.filter(c=>c.pattern==="timing");a.length>0&&r.push({priority:"p1",domain:"test-execution",action:"Address Timing-Related Flakiness",description:`${a.length} tests have timing issues. Consider using proper async utilities.`,estimatedImpact:"medium",effort:"medium",autoFixable:!1})}calculateHealthScore(e,t){if(e===0)return 100;let r=t.length/e,n=t.length>0?t.reduce((a,c)=>a+c.flakinessScore,0)/t.length:0,i=100;i-=r*50,i-=n/100*30;let s=t.filter(a=>a.flakinessScore>=70).length;return i-=s*5,Math.max(0,Math.round(i))}}});var lEe,nh,a7=y(()=>{"use strict";ir();lEe={id:"security-scan",name:"Security Vulnerability Scanner",description:"Scans for security vulnerabilities in dependencies, code patterns, and configurations",intervalMs:1800*1e3,priority:"critical",targetDomains:["security-compliance"],enabled:!0,timeoutMs:3e5,retryCount:3,retryDelayMs:3e4},nh=class extends $e{constructor(){super(lEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting security vulnerability scan");let r=[],n=[],i=await this.runSecurityScans(e);this.analyzeDependencyVulnerabilities(i.dependencyVulnerabilities,r,n),this.analyzeCodeSecurityIssues(i.codeSecurityIssues,r,n),i.secretsDetected>0&&this.reportSecretsDetected(i.secretsDetected,r,n),await e.memory.set("security:lastScan",i),await e.memory.set("security:lastScanTime",new Date().toISOString());let s=this.calculateHealthScore(i),a=i.dependencyVulnerabilities.length+i.codeSecurityIssues.length+i.secretsDetected+i.configurationIssues;return e.logger.info("Security scan complete",{healthScore:s,totalIssues:a,criticalIssues:i.dependencyVulnerabilities.filter(c=>c.severity==="critical").length+i.codeSecurityIssues.filter(c=>c.severity==="critical").length}),this.createResult(Date.now()-t,{itemsAnalyzed:a,issuesFound:r.length,healthScore:s,trend:"stable",domainMetrics:{dependencyVulnerabilities:i.dependencyVulnerabilities.length,codeSecurityIssues:i.codeSecurityIssues.length,secretsDetected:i.secretsDetected,configurationIssues:i.configurationIssues,scanDuration:`${i.scanDurationMs}ms`}},r,n)}async runSecurityScans(e){return{dependencyVulnerabilities:[{package:"lodash",version:"4.17.15",severity:"high",cve:"CVE-2021-23337",title:"Command Injection",description:"Lodash versions prior to 4.17.21 are vulnerable to Command Injection via the template function.",fixedIn:"4.17.21"},{package:"minimist",version:"1.2.5",severity:"critical",cve:"CVE-2021-44906",title:"Prototype Pollution",description:"Prototype pollution vulnerability allows attackers to manipulate JavaScript object prototypes.",fixedIn:"1.2.6"}],codeSecurityIssues:[{file:"src/shared/http/http-client.ts",line:45,rule:"no-eval",severity:"high",message:"Avoid using eval() as it can execute arbitrary code",category:"injection"},{file:"src/kernel/memory-backend.ts",line:122,rule:"sql-injection",severity:"medium",message:"Potential SQL injection - use parameterized queries",category:"injection"}],secretsDetected:0,configurationIssues:1,scanDurationMs:2500}}analyzeDependencyVulnerabilities(e,t,r){let n=e.filter(s=>s.severity==="critical"),i=e.filter(s=>s.severity==="high");for(let s of n)t.push({type:"critical-vulnerability",severity:"critical",domain:"security-compliance",title:`Critical Vulnerability in ${s.package}`,description:`${s.title}: ${s.description}`,resource:s.package,context:{cve:s.cve,currentVersion:s.version,fixedIn:s.fixedIn}});for(let s of i)t.push({type:"high-vulnerability",severity:"high",domain:"security-compliance",title:`High Severity Vulnerability in ${s.package}`,description:`${s.title}: ${s.description}`,resource:s.package,context:{cve:s.cve,currentVersion:s.version,fixedIn:s.fixedIn}});n.length>0&&r.push({priority:"p0",domain:"security-compliance",action:"Update Critical Vulnerabilities Immediately",description:`${n.length} packages have critical vulnerabilities. Update immediately to patched versions.`,estimatedImpact:"high",effort:"low",autoFixable:!0}),i.length>0&&r.push({priority:"p1",domain:"security-compliance",action:"Address High Severity Vulnerabilities",description:`${i.length} packages have high severity vulnerabilities. Plan updates within current sprint.`,estimatedImpact:"high",effort:"low",autoFixable:!0})}analyzeCodeSecurityIssues(e,t,r){let n=new Map;for(let a of e){let c=n.get(a.category)||[];c.push(a),n.set(a.category,c)}for(let a of e)t.push({type:`code-security-${a.category}`,severity:a.severity,domain:"security-compliance",title:`Security Issue: ${a.rule}`,description:a.message,resource:`${a.file}:${a.line}`,context:{rule:a.rule,category:a.category}});let i=n.get("injection")||[];i.length>0&&r.push({priority:"p0",domain:"security-compliance",action:"Fix Injection Vulnerabilities",description:`${i.length} potential injection vulnerabilities found. Use parameterized queries and avoid eval().`,estimatedImpact:"high",effort:"medium",autoFixable:!1});let s=n.get("crypto")||[];s.length>0&&r.push({priority:"p1",domain:"security-compliance",action:"Review Cryptographic Implementations",description:`${s.length} cryptographic issues found. Ensure using secure algorithms and proper key management.`,estimatedImpact:"high",effort:"high",autoFixable:!1})}reportSecretsDetected(e,t,r){t.push({type:"secrets-detected",severity:"critical",domain:"security-compliance",title:"Secrets Detected in Codebase",description:`${e} potential secrets/credentials found in source code`,context:{count:e}}),r.push({priority:"p0",domain:"security-compliance",action:"Remove Secrets from Codebase",description:"Immediately rotate any exposed credentials and move them to secure secret management.",estimatedImpact:"high",effort:"medium",autoFixable:!1})}calculateHealthScore(e){let t=100,r=e.dependencyVulnerabilities.filter(a=>a.severity==="critical").length;t-=r*20;let n=e.dependencyVulnerabilities.filter(a=>a.severity==="high").length;t-=n*10;let i=e.codeSecurityIssues.filter(a=>a.severity==="critical").length;t-=i*15;let s=e.codeSecurityIssues.filter(a=>a.severity==="high").length;return t-=s*8,t-=e.secretsDetected*30,t-=e.configurationIssues*5,Math.max(0,Math.round(t))}}});var uEe,ih,o7=y(()=>{"use strict";ir();uEe={id:"quality-gate",name:"Quality Gate Evaluator",description:"Continuously evaluates quality gates and release readiness across all quality dimensions",intervalMs:300*1e3,priority:"critical",targetDomains:["quality-assessment"],enabled:!0,timeoutMs:12e4,retryCount:2,retryDelayMs:5e3},ih=class extends $e{constructor(){super(uEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting quality gate evaluation");let r=[],n=[],i=await this.evaluateQualityGates(e);this.analyzeGateResults(i,r,n),this.checkBlockers(i,r,n),await this.compareToHistory(e,i,r),await e.memory.set("quality-gate:current",i),await e.memory.set("quality-gate:lastCheck",new Date().toISOString());let s=await e.memory.get("quality-gate:history")||[];s.push(i),s.length>100&&s.shift(),await e.memory.set("quality-gate:history",s);let a=this.calculateHealthScore(i);return e.logger.info("Quality gate evaluation complete",{healthScore:a,passed:i.passed,releaseReady:i.releaseReady,blockers:i.blockers}),this.createResult(Date.now()-t,{itemsAnalyzed:i.rules.length,issuesFound:i.failedRules,healthScore:a,trend:"stable",domainMetrics:{gatePassed:i.passed?"YES":"NO",releaseReady:i.releaseReady?"YES":"NO",passedRules:i.passedRules,failedRules:i.failedRules,blockers:i.blockers,warnings:i.warnings}},r,n)}async evaluateQualityGates(e){let t=[{id:"coverage-line",name:"Line Coverage",category:"coverage",threshold:80,operator:"gte",currentValue:78.5,unit:"%",blocking:!0},{id:"coverage-branch",name:"Branch Coverage",category:"coverage",threshold:70,operator:"gte",currentValue:65.2,unit:"%",blocking:!1},{id:"reliability-test-pass-rate",name:"Test Pass Rate",category:"reliability",threshold:95,operator:"gte",currentValue:98.2,unit:"%",blocking:!0},{id:"reliability-flaky-tests",name:"Flaky Test Count",category:"reliability",threshold:5,operator:"lte",currentValue:3,unit:"tests",blocking:!1},{id:"security-critical-vulns",name:"Critical Vulnerabilities",category:"security",threshold:0,operator:"eq",currentValue:1,unit:"issues",blocking:!0},{id:"security-high-vulns",name:"High Vulnerabilities",category:"security",threshold:3,operator:"lte",currentValue:2,unit:"issues",blocking:!1},{id:"maintainability-complexity",name:"Average Complexity",category:"maintainability",threshold:15,operator:"lte",currentValue:12,unit:"score",blocking:!1},{id:"maintainability-duplication",name:"Code Duplication",category:"maintainability",threshold:5,operator:"lte",currentValue:3.2,unit:"%",blocking:!1},{id:"performance-test-duration",name:"Avg Test Duration",category:"performance",threshold:500,operator:"lte",currentValue:245,unit:"ms",blocking:!1}],r=0,n=0,i=0,s=0;for(let a of t)this.evaluateRule(a)?r++:(n++,a.blocking?i++:s++);return{passed:i===0,passedRules:r,failedRules:n,blockers:i,warnings:s,releaseReady:i===0&&s<=2,rules:t}}evaluateRule(e){switch(e.operator){case"gte":return e.currentValue>=e.threshold;case"lte":return e.currentValue<=e.threshold;case"eq":return e.currentValue===e.threshold;default:return!1}}analyzeGateResults(e,t,r){for(let s of e.rules)if(!this.evaluateRule(s)){let a=s.blocking?"critical":"medium";t.push({type:"quality-gate-failure",severity:a,domain:"quality-assessment",title:`Quality Gate Failed: ${s.name}`,description:`${s.name} is ${s.currentValue}${s.unit}, threshold is ${s.operator==="gte"?">=":s.operator==="lte"?"<=":"="} ${s.threshold}${s.unit}`,context:{ruleId:s.id,category:s.category,currentValue:s.currentValue,threshold:s.threshold,blocking:s.blocking}})}let n=e.rules.filter(s=>s.category==="coverage"&&!this.evaluateRule(s));n.length>0&&r.push({priority:n.some(s=>s.blocking)?"p0":"p2",domain:"quality-assessment",action:"Improve Test Coverage",description:`${n.length} coverage gates are failing. Add tests to increase coverage.`,estimatedImpact:"high",effort:"medium",autoFixable:!0}),e.rules.filter(s=>s.category==="security"&&!this.evaluateRule(s)).length>0&&r.push({priority:"p0",domain:"quality-assessment",action:"Address Security Issues",description:"Security gates are failing. Resolve vulnerabilities before release.",estimatedImpact:"high",effort:"medium",autoFixable:!1})}checkBlockers(e,t,r){e.blockers>0?(t.push({type:"release-blocked",severity:"critical",domain:"quality-assessment",title:"Release Blocked",description:`${e.blockers} blocking issues prevent release`,context:{blockers:e.blockers,blockingRules:e.rules.filter(n=>n.blocking&&!this.evaluateRule(n)).map(n=>n.name)}}),r.push({priority:"p0",domain:"quality-assessment",action:"Resolve Release Blockers",description:"Address all blocking quality gate failures before proceeding with release.",estimatedImpact:"high",effort:"medium",autoFixable:!1})):e.releaseReady||t.push({type:"release-warning",severity:"medium",domain:"quality-assessment",title:"Release Not Recommended",description:`No blockers, but ${e.warnings} warnings suggest caution`,context:{warnings:e.warnings}})}async compareToHistory(e,t,r){let n=await e.memory.get("quality-gate:current");n&&(n.passed&&!t.passed&&r.push({type:"quality-gate-regression",severity:"high",domain:"quality-assessment",title:"Quality Gate Regression",description:"Quality gates were passing previously but are now failing",context:{previousBlockers:n.blockers,currentBlockers:t.blockers}}),!n.passed&&t.passed&&r.push({type:"quality-gate-improvement",severity:"info",domain:"quality-assessment",title:"Quality Gates Now Passing",description:"All quality gates are now passing after previous failures",context:{previousFailures:n.failedRules,currentFailures:t.failedRules}}))}calculateHealthScore(e){if(e.rules.length===0)return 100;let r=e.passedRules/e.rules.length*70;return r-=e.blockers*15,r-=e.warnings*5,e.releaseReady&&(r+=10),Math.max(0,Math.min(100,Math.round(r)))}}});var c7={};Q(c7,{ensurePatternEmbedding:()=>dEe});async function dEe(o,e,t,r,n,i={}){try{let s=`${t??""} ${r??""} ${(n??[]).join(" ")}`.trim();if(!s)return;let a=await kt(s,i);if(!a||a.length===0)return;let c=Buffer.from(new Float32Array(a).buffer),l={...Ls,...i};o.prepare(`INSERT OR REPLACE INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model)
5884
+ `),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:rbe,max_tokens:nbe,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 rbe,nbe,ibe,fX=y(()=>{"use strict";Y();rbe="claude-haiku-4-5-20251001",nbe=200,ibe=5});var SN={};Q(SN,{handleModelRoute:()=>Bw,handleReasoningBankStats:()=>ube,handleRoutingEconomics:()=>zw,handleRoutingMetrics:()=>Uw,handleTaskCancel:()=>$w,handleTaskList:()=>Nw,handleTaskOrchestrate:()=>qw,handleTaskOutcomeRecord:()=>lbe,handleTaskStatus:()=>Ow,handleTaskStatusWithLearning:()=>dbe,handleTaskSubmit:()=>Fw,subscribeTrajectoryEvents:()=>pbe,unsubscribeTrajectoryEvents:()=>bX});async function Fw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function Nw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function Ow(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function $w(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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: ${w(t)}`}}}async function qw(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e,workflowOrchestrator:t}=me();try{let r=o.context?.project||vX(o.task),n=o.priority==="critical"||/\b(security|vulnerability|cve|owasp|critical|production|exploit)\b/i.test(o.task),s=await(await ms()).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 yn(),c=await a.getExperienceGuidance(o.task,o.context?.project),l=await a.searchPatterns(o.task,{limit:5,domain:o.context?.project??r}).catch(()=>[]),u=obe(o.task),d=cbe(o.priority||"medium"),p=abe[u];if(p&&t){console.log(`[TaskOrchestrate] Task type '${u}' has workflow '${p}' - executing workflow`);let v=o.task.match(/https?:\/\/[^\s]+/i),b=v?v[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},R=await t.executeWorkflow(p,C);return R.success?{success:!0,data:{taskId:R.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: ${R.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(v=>({patternId:v.id,name:v.name,description:v.description,confidence:v.confidence,similarity:v.qualityScore,canReuse:v.tier==="long-term"})):void 0},timeout:6e5});if(!g.success)return{success:!1,error:g.error.message};let h=g.value;return await bN(h,o.task,{agent:"queen-coordinator",domain:o.context?.project}),process.env.AQE_TRAJECTORY_JUDGE==="1"&&process.env.ANTHROPIC_API_KEY&&hX().catch(v=>{console.warn("[TrajectoryJudge] failed:",v instanceof Error?v.message:v)}),{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: ${w(r)}`}}}async function Bw(o){try{let e=await ms(),t=o.domain||vX(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: ${w(e)}`}}}async function Uw(o){try{let e=await ms(),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: ${w(e)}`}}}async function zw(o){try{let{createRoutingFeedbackCollector:e}=await Promise.resolve().then(()=>(oF(),CK)),{getGlobalCostTracker:t}=await Promise.resolve().then(()=>(iF(),bK)),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: ${w(e)}`}}}function vX(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 obe(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 cbe(o){switch(o){case"critical":return"p0";case"high":return"p1";case"medium":return"p2";case"low":return"p3";default:return"p1"}}async function lbe(o){try{let e=await yn(),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: ${w(e)}`}}}async function ube(){try{let e=await(await yn()).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: ${w(o)}`}}}async function dbe(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};let{queen:e}=me();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")&&!yX.has(o.taskId)){yX.add(o.taskId);try{let n=await yn(),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 _g(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: ${w(t)}`}}}function pbe(o){bX(o);let e=o.subscribeToEventType("TaskCompleted",async r=>{let{taskId:n}=r.payload;n&&await _g(n,!0).catch(()=>{})}),t=o.subscribeToEventType("TaskFailed",async r=>{let{taskId:n,error:i}=r.payload;n&&await _g(n,!1,i).catch(()=>{})});TN=[e,t]}function bX(o){for(let e of TN)o.unsubscribe(e);TN=[]}var abe,yX,TN,Vw=y(()=>{"use strict";hs();kS();CN();fX();k();abe={"ideation-assessment":"qcsd-ideation-swarm"};yX=new Set;TN=[]});var TX={};Q(TX,{DEFAULT_STRUCTURAL_HEALTH_CONFIG:()=>CX,StructuralHealthMonitor:()=>Gw,createStructuralHealthMonitor:()=>mbe});function mbe(o){return new Gw(o)}var CX,Gw,SX=y(()=>{"use strict";RL();CX={healthyThreshold:.4,warningThreshold:.2,maxHistoryEntries:100,enableLogging:!1},Gw=class{config;minCutService;history=[];constructor(e){this.config={...CX,...e},this.minCutService=vS()}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)}%`)}}});function me(){return z}function ge(){return z.initialized&&z.kernel!==null&&z.queen!==null}function EX(o,e){if(z.topology!=="hierarchical"){let i={agentId:o,domain:e,level:"worker",spawnedAt:new Date};return z.agentLevels.set(o,i),"worker"}let r=Array.from(z.agentLevels.values()).find(i=>i.domain===e&&i.level==="lead")?"worker":"lead",n={agentId:o,domain:e,level:r,spawnedAt:new Date};return z.agentLevels.set(o,n),r}function RX(o){return z.agentLevels.get(o)}async function Lg(o){try{if(z.initialized&&z.kernel&&z.queen)return{success:!0,data:{fleetId:z.fleetId,topology:o.topology||"hierarchical",maxAgents:o.maxAgents||15,enabledDomains:o.enabledDomains||wX,status:"ready"}};z.fleetId=`fleet-${E().slice(0,8)}`;let e=o.enabledDomains||[...Z],t=e.filter(c=>c!=="coordination");z.kernel=new pT({maxConcurrentAgents:o.maxAgents||15,memoryBackend:o.memoryBackend||"hybrid",hnswEnabled:!0,lazyLoading:o.lazyLoading!==!1,enabledDomains:e}),await z.kernel.initialize(),z.router=new XT(z.kernel.eventBus),await z.router.initialize();let r=c=>z.kernel.getDomainAPI(c),n=new _w(z.kernel.eventBus,z.kernel.memory,r),i=z.kernel.plugins;await i.loadAll();let s=new Map;for(let c of i.getLoaded()){let l=i.getPlugin(c);l&&s.set(c,l)}z.queen=V5(z.kernel,z.router,n,void 0,s),await z.queen.initialize(),z.workflowOrchestrator=new bm(z.kernel.eventBus,z.kernel.memory,z.kernel.coordinator),await z.workflowOrchestrator.initialize(),gbe(z.kernel,z.workflowOrchestrator);let{subscribeTrajectoryEvents:a}=await Promise.resolve().then(()=>(Vw(),SN));return a(z.router),z.initialized=!0,z.initTime=new Date,z.topology=o.topology||"hierarchical",z.agentLevels.clear(),{success:!0,data:{fleetId:z.fleetId,topology:z.topology,maxAgents:o.maxAgents||15,enabledDomains:t,status:"initialized"}}}catch(e){return{success:!1,error:`Failed to initialize fleet: ${w(e)}`}}}async function wN(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{let e=z.queen.getHealth(),t=z.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:z.queen.getDomainLoad(s)});r.domains=i}let n=z.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(),Cr)),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: ${w(e)}`}}}async function EN(o){if(!ge())return{success:!1,error:"Fleet not initialized. Call fleet_init first."};try{if(o.domain){let r=z.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=z.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(()=>(SX(),TX)),n=new r,i=[];for(let[c]of e.domainHealth){let l=z.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: ${w(e)}`}}}async function RN(){if(nK(),BS(),dX(),z.workflowOrchestrator&&(await z.workflowOrchestrator.dispose(),z.workflowOrchestrator=null),z.queen&&(await z.queen.dispose(),z.queen=null),z.router){try{let{unsubscribeTrajectoryEvents:o}=await Promise.resolve().then(()=>(Vw(),SN));o(z.router)}catch{}await z.router.dispose(),z.router=null}z.kernel&&(await z.kernel.dispose(),z.kernel=null),z.initialized=!1,z.fleetId=null,z.initTime=null,z.topology="hierarchical",z.agentLevels.clear()}async function AN(){let o=performance.now();try{let e=ge(),t=z.initTime?Date.now()-z.initTime.getTime():0,r={connected:!1,totalEntries:0,namespaces:0},n={enabled:!1,vectorCount:0},i=0;if(e&&z.kernel){let u=z.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&&z.kernel?(z.kernel.getLoadedDomains?.()??wX).length:0,a=null;try{let{getSharedRvfDualWriterSync:u}=await Promise.resolve().then(()=>(rs(),ya)),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(()=>(Rc(),VM)),d=new u;await d.initialize(),c=d.getGhostPatternCount(),d.close()}catch{}return{success:!0,data:{status:e?"healthy":"unhealthy",version:"3.9.22",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:E(),toolName:"aqe_health"}}}catch(e){return{success:!1,error:w(e),metadata:{executionTime:performance.now()-o,timestamp:new Date().toISOString(),requestId:E(),toolName:"aqe_health"}}}}function gbe(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 wX,z,hs=y(()=>{"use strict";N();C3();L();G5();wD();H5();HL();US();vN();pX();k();wX=Z.filter(o=>o!=="coordination"),z={fleetId:null,kernel:null,queen:null,router:null,workflowOrchestrator:null,initialized:!1,initTime:null,topology:"hierarchical",agentLevels:new Map}});import{randomUUID as Zbe}from"crypto";var $e,ir=y(()=>{"use strict";k();$e=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let t=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let r,n;for(let s=0;s<=this.config.retryCount;s++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");n=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(a){r=S(a),e.logger.warn(`Worker ${this.config.id} attempt ${s+1} failed: ${r.message}`),s<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let i=Date.now()-t;return n?(this._successfulExecutions++,this._lastResult=n):(this._failedExecutions++,n=this.createErrorResult(r,i),this._lastResult=n),this._executionDurations.push(i),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:n.success,durationMs:i}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=n.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:n.success,durationMs:i,findingsCount:n.findings.length,healthScore:n.metrics.healthScore}}),n}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((r,n)=>r+n,0)/this._executionDurations.length:0,t=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(t*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,t,r){return new Promise((n,i)=>{let s=setTimeout(()=>{i(new Error(`Worker execution timed out after ${t}ms`))},t),a=()=>{clearTimeout(s),i(new Error("Worker execution aborted"))};r.addEventListener("abort",a,{once:!0}),e().then(c=>{clearTimeout(s),r.removeEventListener("abort",a),n(c)}).catch(c=>{clearTimeout(s),r.removeEventListener("abort",a),i(c)})})}createErrorResult(e,t){return{workerId:this.config.id,timestamp:new Date,durationMs:t,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,t,r,n){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:t,findings:r,recommendations:n}}delay(e){return new Promise(t=>setTimeout(t,e))}generateId(){return`${Date.now()}-${Zbe().slice(0,9)}`}}});var eCe,Pl,dO=y(()=>{"use strict";ir();yw();Y();jF();k();eCe={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},Pl=class extends $e{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(eCe),this.dailyLogger=new gg}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=W();await e.initialize();let t=e.getDatabase();return this.lifecycleManager=mg(t,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return W().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let t=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let r=[],n=[],i=await this.getLifecycleManager();if(!i)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-t,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let s=0,a=0;try{let b=i.promoteEligiblePatterns();s=b.promoted,a=b.checked,s>0&&r.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${s} of ${a} short-term patterns promoted to long-term`})}catch(b){e.logger.warn("Pattern promotion failed",{error:w(b)})}let c=0,l=0;try{let b=i.deprecateStalePatterns();c=b.deprecated,l=b.checked,c>0&&r.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${l} patterns deprecated (stale, failed, or low confidence)`})}catch(b){e.logger.warn("Stale pattern detection failed",{error:w(b)})}let u=0;try{let b=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;u=i.applyConfidenceDecay(Math.min(b,7)).decayed}catch(b){e.logger.warn("Confidence decay failed",{error:w(b)})}let d=this.getPendingExperienceCount(),p={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{p=i.getStats()}catch(b){e.logger.warn("Stats retrieval failed",{error:w(b)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${s} promoted, ${c} deprecated, ${u} decayed, ${d} pending exp, ${p.activePatterns} active patterns (avg conf: ${p.avgConfidence.toFixed(2)})`,details:{promoted:s,deprecated:c,decayed:u,pendingExperiences:d,totalPatterns:p.totalPatterns,activePatterns:p.activePatterns,avgConfidence:p.avgConfidence,avgSuccessRate:p.avgSuccessRate}}),this.dailyLogger.flush()}catch(b){e.logger.warn("Daily log write failed",{error:w(b)})}this.lastRunTimestamp=Date.now(),p.activePatterns>0&&p.patternsNearDeprecation/p.activePatterns>.5&&n.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${p.patternsNearDeprecation} of ${p.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let m=this.calculateHealthScore(p,s,c),g=this.determineTrend(s,c,p.activePatterns),h=Math.max(a,l),v=s+c+p.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:s,deprecated:c,decayed:u,pendingExperiences:d,healthScore:m}),this.createResult(Date.now()-t,{itemsAnalyzed:h,issuesFound:v,healthScore:m,trend:g,domainMetrics:{promoted:s,deprecated:c,decayed:u,stalePatterns:p.patternsNearDeprecation,pendingExperiences:d,avgConfidence:Number(p.avgConfidence.toFixed(3)),avgSuccessRate:Number(p.avgSuccessRate.toFixed(3))}},r,n)}calculateHealthScore(e,t,r){let n=70;if(n+=Math.min(15,t*5),e.avgConfidence>0&&(n+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let i=r/e.activePatterns;n-=Math.round(i*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(n-=10),Math.max(0,Math.min(100,Math.round(n)))}determineTrend(e,t,r){return r===0?"stable":e>t?"improving":t>e&&t/r>.1?"degrading":"stable"}}});var M1,D1,_1,WE,jE,QE,r7=y(()=>{"use strict";M1=class{handlers=[];async publish(e){for(let t of this.handlers)try{t(e)}catch(r){console.debug("[WorkerManager] Event handler error:",r instanceof Error?r.message:r)}}subscribe(e){return this.handlers.push(e),()=>{let t=this.handlers.indexOf(e);t>=0&&this.handlers.splice(t,1)}}dispose(){this.handlers=[]}get handlerCount(){return this.handlers.length}},D1=class{store=new Map;async get(e){return this.store.get(e)}async set(e,t){this.store.set(e,t)}async search(e){let t=e.replace(/[.+?^${}()|[\]\\]/g,"\\$&"),r=new RegExp(t.replace(/\*/g,".*"));return Array.from(this.store.keys()).filter(n=>r.test(n))}clear(){this.store.clear()}get size(){return this.store.size}},_1=class{constructor(e){this.workerId=e}workerId;format(e,t,r){let n=new Date().toISOString(),i=r?` ${JSON.stringify(r)}`:"";return`[${n}] [${e}] [${this.workerId}] ${t}${i}`}debug(e,t){process.env.DEBUG&&console.debug(this.format("DEBUG",e,t))}info(e,t){console.info(this.format("INFO",e,t))}warn(e,t){console.warn(this.format("WARN",e,t))}error(e,t){console.error(this.format("ERROR",e,t))}},WE=class{constructor(e){this.kernelGetter=e}kernelGetter;getDomainAPI(e){let t=this.kernelGetter();if(t)return t.getDomainAPI(e)}getDomainHealth(e){let t=this.kernelGetter();if(!t)return{status:"unknown",errors:["Kernel not available"]};let n=t.getHealth().domains[e];return n?{status:n.status,errors:n.errors||[]}:{status:"unknown",errors:[`Domain ${e} not found`]}}},jE=class{getDomainAPI(e){}getDomainHealth(e){return{status:"healthy",errors:[]}}},QE=class{workers=new Map;timers=new Map;abortControllers=new Map;eventBus;memory;domainAccess;running=!1;kernelRef;constructor(e){this.eventBus=e?.eventBus??new M1,this.memory=e?.memory??new D1,this.kernelRef=e?.kernel,e?.domainAccess?this.domainAccess=e.domainAccess:e?.kernel?this.domainAccess=new WE(()=>this.kernelRef):this.domainAccess=new jE}setKernel(e){this.kernelRef=e,this.domainAccess instanceof jE&&(this.domainAccess=new WE(()=>this.kernelRef))}register(e){if(this.workers.has(e.config.id))throw new Error(`Worker ${e.config.id} is already registered`);this.workers.set(e.config.id,e)}unregister(e){this.workers.get(e)&&(this.stopWorker(e),this.workers.delete(e))}get(e){return this.workers.get(e)}list(){return Array.from(this.workers.values())}async startAll(){this.running=!0;for(let e of Array.from(this.workers.values()))e.config.enabled&&await this.startWorker(e)}async stopAll(){this.running=!1;let e=[];for(let t of Array.from(this.workers.keys()))e.push(this.stopWorker(t));await Promise.all(e)}async runNow(e){let t=this.workers.get(e);if(!t)throw new Error(`Worker ${e} not found`);let r=this.timers.get(e);r&&clearTimeout(r);let n=new AbortController;this.abortControllers.set(e,n);let i=this.createContext(e,n.signal),s=await t.execute(i);return this.running&&t.config.enabled&&t.status!=="stopped"&&this.scheduleNextRun(t),s}getHealth(){let e={},t=0,r=0,n=0,i=0;for(let[a,c]of Array.from(this.workers.entries())){let l=c.getHealth();switch(e[a]=l,i+=l.healthScore,c.status){case"running":t++;break;case"paused":r++;break;case"error":n++;break}}let s=this.workers.size>0?Math.round(i/this.workers.size):100;return{totalWorkers:this.workers.size,runningWorkers:t,pausedWorkers:r,errorWorkers:n,healthScore:s,workers:e}}onWorkerEvent(e){return this.eventBus.subscribe(e)}async startWorker(e){await e.initialize();let t=new AbortController;this.abortControllers.set(e.config.id,t);let r=this.createContext(e.config.id,t.signal);try{await e.execute(r)}catch(n){console.error(`Worker ${e.config.id} initial execution failed:`,n)}this.scheduleNextRun(e)}async stopWorker(e){let t=this.timers.get(e);t&&(clearTimeout(t),this.timers.delete(e));let r=this.abortControllers.get(e);r&&(r.abort(),this.abortControllers.delete(e));let n=this.workers.get(e);n&&await n.stop()}scheduleNextRun(e){let t=setTimeout(async()=>{if(!this.running||e.status==="stopped"||e.status==="paused")return;let r=new AbortController;this.abortControllers.set(e.config.id,r);let n=this.createContext(e.config.id,r.signal);try{await e.execute(n)}catch(i){console.error(`Worker ${e.config.id} execution failed:`,i)}this.running&&e.config.enabled&&e.status!=="error"&&this.scheduleNextRun(e)},e.config.intervalMs);this.timers.set(e.config.id,t)}createContext(e,t){return{eventBus:this.eventBus,memory:this.memory,logger:new _1(e),domains:this.domainAccess,signal:t}}}});var aEe,eh,n7=y(()=>{"use strict";ir();k();aEe={id:"test-health",name:"Test Health Monitor",description:"Monitors test suite health metrics including pass rates, execution times, and reliability",intervalMs:300*1e3,priority:"high",targetDomains:["test-execution","test-generation"],enabled:!0,timeoutMs:6e4,retryCount:2,retryDelayMs:5e3},eh=class extends $e{previousMetrics;constructor(){super(aEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting test health analysis");let r=[],n=[],i=await this.collectMetrics(e);this.analyzePassRate(i,r,n),this.analyzeExecutionTime(i,r,n),this.analyzeReliability(i,r,n),this.analyzeGrowth(i,r,n),this.compareToPrevious(i,r,n),await e.memory.set("test-health:previous-metrics",i),this.previousMetrics=i;let s=this.calculateHealthScore(i),a=this.determineTrend(i);return e.logger.info("Test health analysis complete",{healthScore:s,findingsCount:r.length}),this.createResult(Date.now()-t,{itemsAnalyzed:i.totalTests,issuesFound:r.length,healthScore:s,trend:a,domainMetrics:{passRate:`${(i.passingTests/i.totalTests*100).toFixed(1)}%`,avgExecutionTime:`${i.avgExecutionTimeMs}ms`,reliability:`${i.reliability}%`,totalTests:i.totalTests}},r,n)}async collectMetrics(e){let t=await e.memory.get("test-health:previous-metrics");if(t&&(this.previousMetrics=t),!e.domains.getDomainAPI("test-execution"))throw new Error("Test-execution domain not available - cannot compute health metrics. Ensure the test-execution domain is properly initialized before running this worker.");try{let n=await e.memory.search("test-health:run-result:*");if(n.length===0)throw new Error('No test run data found in memory - cannot compute health metrics. Run some tests first or ensure test results are being stored with keys matching "test-health:run-result:*".');let i=0,s=0,a=0,c=0,l=0,u=0;for(let g of n.slice(0,50)){let h=await e.memory.get(g);h&&(i+=h.total,s+=h.passed,a+=h.failed,c+=h.skipped,l+=h.duration,u++)}let d=u>0?Math.round(l/u):0,p=i>0?Math.round(s/i*100):0,m=await e.memory.get("test-health:growth-metrics");return{totalTests:i||0,passingTests:s||0,failingTests:a||0,skippedTests:c||0,avgExecutionTimeMs:d,reliability:p,growth:{testsAddedLast7Days:m?.testsAddedLast7Days||0,testsRemovedLast7Days:m?.testsRemovedLast7Days||0}}}catch(n){let i=w(n);throw new Error(`Failed to collect test health metrics: ${i}. Check memory service connectivity and test result data availability.`)}}analyzePassRate(e,t,r){let n=e.passingTests/e.totalTests*100;n<95&&(t.push({type:"low-pass-rate",severity:n<90?"high":"medium",domain:"test-execution",title:"Low Test Pass Rate",description:`Test pass rate is ${n.toFixed(1)}%, below the 95% target`,context:{passing:e.passingTests,failing:e.failingTests,total:e.totalTests}}),r.push({priority:"p1",domain:"test-execution",action:"Investigate Failing Tests",description:`${e.failingTests} tests are currently failing. Review and fix to improve pass rate.`,estimatedImpact:"high",effort:"medium",autoFixable:!1}))}analyzeExecutionTime(e,t,r){e.avgExecutionTimeMs>500&&(t.push({type:"slow-tests",severity:e.avgExecutionTimeMs>1e3?"high":"medium",domain:"test-execution",title:"Slow Test Execution",description:`Average test execution time is ${e.avgExecutionTimeMs}ms, consider optimization`,context:{avgExecutionTimeMs:e.avgExecutionTimeMs}}),r.push({priority:"p2",domain:"test-execution",action:"Optimize Test Execution Time",description:"Review and optimize slow-running tests. Consider parallelization or mocking slow dependencies.",estimatedImpact:"medium",effort:"medium",autoFixable:!1}))}analyzeReliability(e,t,r){e.reliability<95&&(t.push({type:"reliability-issue",severity:e.reliability<85?"high":"medium",domain:"test-execution",title:"Test Reliability Concern",description:`Test reliability score is ${e.reliability}%, indicating potential flaky tests`,context:{reliability:e.reliability}}),r.push({priority:"p1",domain:"test-execution",action:"Address Flaky Tests",description:"Identify and fix flaky tests to improve overall test reliability.",estimatedImpact:"high",effort:"medium",autoFixable:!1}))}analyzeGrowth(e,t,r){let n=e.growth.testsAddedLast7Days-e.growth.testsRemovedLast7Days;n<0&&(t.push({type:"test-coverage-decline",severity:"medium",domain:"test-generation",title:"Test Coverage Declining",description:`Net loss of ${Math.abs(n)} tests in the last 7 days`,context:{added:e.growth.testsAddedLast7Days,removed:e.growth.testsRemovedLast7Days}}),r.push({priority:"p2",domain:"test-generation",action:"Review Test Coverage Strategy",description:"More tests are being removed than added. Ensure adequate test coverage is maintained.",estimatedImpact:"medium",effort:"low",autoFixable:!1}))}compareToPrevious(e,t,r){if(!this.previousMetrics)return;let n=e.passingTests/e.totalTests-this.previousMetrics.passingTests/this.previousMetrics.totalTests;n<-.05&&t.push({type:"pass-rate-regression",severity:"high",domain:"test-execution",title:"Pass Rate Regression Detected",description:`Pass rate dropped by ${(Math.abs(n)*100).toFixed(1)}% since last check`,context:{previousPassRate:`${(this.previousMetrics.passingTests/this.previousMetrics.totalTests*100).toFixed(1)}%`,currentPassRate:`${(e.passingTests/e.totalTests*100).toFixed(1)}%`}})}calculateHealthScore(e){let t=e.passingTests/e.totalTests*40,r=e.reliability/100*30,n=Math.max(0,20-e.avgExecutionTimeMs/100),i=Math.min(10,e.growth.testsAddedLast7Days/10*10);return Math.round(t+r+n+i)}determineTrend(e){if(!this.previousMetrics)return"stable";let t=e.passingTests/e.totalTests,r=this.previousMetrics.passingTests/this.previousMetrics.totalTests;return t>r+.02?"improving":t<r-.02?"degrading":"stable"}}});var oEe,th,i7=y(()=>{"use strict";ir();oEe={id:"coverage-tracker",name:"Coverage Tracker",description:"Tracks coverage trends over time including gaps, hotspots, and critical paths",intervalMs:600*1e3,priority:"high",targetDomains:["coverage-analysis","test-generation"],enabled:!0,timeoutMs:12e4,retryCount:2,retryDelayMs:1e4},th=class extends $e{constructor(){super(oEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting coverage tracking analysis");let r=[],n=[],i=await this.collectCoverageTrend(e),s=await this.identifyCoverageGaps(e);this.analyzeCoverageThresholds(i.current,r,n),this.analyzeCoverageGaps(s,r,n),this.analyzeCoverageTrends(i,r,n),await e.memory.set("coverage:current",i.current),await e.memory.set("coverage:gaps",s);let a=this.calculateHealthScore(i.current,s);return e.logger.info("Coverage tracking complete",{healthScore:a,findingsCount:r.length,gapsFound:s.length}),this.createResult(Date.now()-t,{itemsAnalyzed:s.length+4,issuesFound:r.length,healthScore:a,trend:this.determineTrend(i),domainMetrics:{lineCoverage:`${i.current.line}%`,branchCoverage:`${i.current.branch}%`,functionCoverage:`${i.current.function}%`,statementCoverage:`${i.current.statement}%`,gapsCount:s.length}},r,n)}async collectCoverageTrend(e){let t=await e.memory.get("coverage:current"),r=await e.memory.get("coverage:latest");return{current:{line:r?.line??0,branch:r?.branch??0,function:r?.function??0,statement:r?.statement??0,timestamp:new Date},previous:t}}async identifyCoverageGaps(e){let t=await e.memory.search("gap-pattern:*");if(t.length>0){let r=[];for(let n of t){let i=await e.memory.get(n);i&&typeof i.riskScore=="number"&&r.push(i)}if(r.length>0)return r}return[]}analyzeCoverageThresholds(e,t,r){let n={line:80,branch:70,function:80,statement:80};e.line<n.line&&t.push({type:"low-line-coverage",severity:e.line<60?"high":"medium",domain:"coverage-analysis",title:"Line Coverage Below Threshold",description:`Line coverage is ${e.line}%, below ${n.line}% target`,context:{current:e.line,target:n.line}}),e.branch<n.branch&&(t.push({type:"low-branch-coverage",severity:e.branch<50?"high":"medium",domain:"coverage-analysis",title:"Branch Coverage Below Threshold",description:`Branch coverage is ${e.branch}%, below ${n.branch}% target`,context:{current:e.branch,target:n.branch}}),r.push({priority:"p1",domain:"test-generation",action:"Improve Branch Coverage",description:"Add tests for uncovered conditional branches. Focus on complex decision points.",estimatedImpact:"high",effort:"medium",autoFixable:!0})),e.function<n.function&&t.push({type:"low-function-coverage",severity:"medium",domain:"coverage-analysis",title:"Function Coverage Below Threshold",description:`Function coverage is ${e.function}%, below ${n.function}% target`,context:{current:e.function,target:n.function}})}analyzeCoverageGaps(e,t,r){let n=e.filter(s=>s.riskScore>.8);for(let s of n)t.push({type:"high-risk-coverage-gap",severity:"high",domain:"coverage-analysis",title:"High-Risk Coverage Gap",description:`${s.file} has ${s.uncoveredLines} uncovered lines with complexity ${s.complexity}`,resource:s.file,context:{uncoveredLines:s.uncoveredLines,totalLines:s.totalLines,coveragePercent:((s.totalLines-s.uncoveredLines)/s.totalLines*100).toFixed(1),complexity:s.complexity,riskScore:s.riskScore}});n.length>0&&r.push({priority:"p0",domain:"test-generation",action:"Address High-Risk Coverage Gaps",description:`${n.length} files have high-risk coverage gaps. Prioritize testing for complex, uncovered code.`,estimatedImpact:"high",effort:"high",autoFixable:!0});let i=e.filter(s=>(s.totalLines-s.uncoveredLines)/s.totalLines<.5);i.length>0&&t.push({type:"critical-coverage-gaps",severity:"critical",domain:"coverage-analysis",title:"Critical Coverage Gaps Detected",description:`${i.length} files have less than 50% coverage`,context:{files:i.map(s=>s.file)}})}analyzeCoverageTrends(e,t,r){if(!e.previous)return;let n=e.current.line-e.previous.line,i=e.current.branch-e.previous.branch;n<-2&&(t.push({type:"coverage-regression",severity:n<-5?"high":"medium",domain:"coverage-analysis",title:"Coverage Regression Detected",description:`Line coverage dropped by ${Math.abs(n).toFixed(1)}% since last check`,context:{previous:e.previous.line,current:e.current.line,change:n}}),r.push({priority:"p1",domain:"test-generation",action:"Investigate Coverage Regression",description:"Recent changes have reduced code coverage. Review new code and add missing tests.",estimatedImpact:"high",effort:"medium",autoFixable:!1})),i<-3&&t.push({type:"branch-coverage-regression",severity:"medium",domain:"coverage-analysis",title:"Branch Coverage Regression",description:`Branch coverage dropped by ${Math.abs(i).toFixed(1)}%`,context:{previous:e.previous.branch,current:e.current.branch,change:i}})}calculateHealthScore(e,t){let r=e.line/100*25,n=e.branch/100*25,i=e.function/100*20,s=e.statement/100*20,a=t.filter(l=>l.riskScore>.8).length,c=Math.max(0,10-a*2);return Math.round(r+n+i+s+c)}determineTrend(e){if(!e.previous)return"stable";let t=(e.current.line+e.current.branch+e.current.function+e.current.statement)/4,r=(e.previous.line+e.previous.branch+e.previous.function+e.previous.statement)/4;return t>r+1?"improving":t<r-1?"degrading":"stable"}}});var cEe,rh,s7=y(()=>{"use strict";ir();cEe={id:"flaky-detector",name:"Flaky Test Detector",description:"Detects flaky test patterns through statistical analysis of test execution history",intervalMs:900*1e3,priority:"high",targetDomains:["test-execution"],enabled:!0,timeoutMs:18e4,retryCount:2,retryDelayMs:1e4},rh=class extends $e{constructor(){super(cEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting flaky test detection");let r=[],n=[],i=await this.collectTestHistory(e),s=this.detectFlakyTests(i);this.generateFindings(s,r,n),await e.memory.set("flaky:detected",s),await e.memory.set("flaky:lastAnalysis",new Date().toISOString());let a=this.calculateHealthScore(i.length,s);return e.logger.info("Flaky test detection complete",{healthScore:a,testsAnalyzed:i.length,flakyTestsFound:s.length}),this.createResult(Date.now()-t,{itemsAnalyzed:i.length,issuesFound:s.length,healthScore:a,trend:"stable",domainMetrics:{testsAnalyzed:i.length,flakyTests:s.length,flakinessRate:`${(s.length/i.length*100).toFixed(1)}%`,avgFlakinessScore:s.length>0?(s.reduce((c,l)=>c+l.flakinessScore,0)/s.length).toFixed(1):"0"}},r,n)}async collectTestHistory(e){if(!e.domains.getDomainAPI("test-execution"))throw new Error("Test-execution domain not available - cannot detect flaky tests. Ensure the test-execution domain is properly initialized before running this worker.");let r=await e.memory.search("flaky:history:*");if(r.length===0)throw new Error('No test execution history found in memory - cannot detect flaky tests. Run tests multiple times and ensure history is stored with keys matching "flaky:history:*" before running this worker.');let n=[],i=[];for(let s of r)try{let a=await e.memory.get(s);a&&n.push(a)}catch{i.push(s)}if(n.length===0)throw new Error(`Found ${r.length} test history keys but failed to retrieve any data. Failed keys: ${i.slice(0,5).join(", ")}${i.length>5?"...":""}. Check memory service connectivity and data format.`);return n}detectFlakyTests(e){let t=[];for(let r of e){let n=this.analyzeTestFlakiness(r);n.flakinessScore>20&&t.push(n)}return t.sort((r,n)=>n.flakinessScore-r.flakinessScore)}analyzeTestFlakiness(e){let t=e.executions,n=t.filter(g=>g.passed).length/t.length,i=t.map(g=>g.durationMs),s=i.reduce((g,h)=>g+h,0)/i.length,a=i.reduce((g,h)=>g+Math.pow(h-s,2),0)/i.length,l=Math.sqrt(a)/s,u=t.slice(-5).filter(g=>!g.passed).length,d=this.determinePattern(e,l),p=0;n>0&&n<1&&(p+=(1-n)*50),l>.5&&(p+=Math.min(25,l*10)),p+=u*5;let m=this.suggestFix(d);return{testId:e.testId,testName:e.testName,file:e.file,flakinessScore:Math.min(100,Math.round(p)),pattern:d,passRate:n*100,avgDuration:s,durationVariance:l,recentFailures:u,suggestedFix:m}}determinePattern(e,t){let r=e.executions.filter(i=>!i.passed);if(t>1||r.some(i=>i.error?.includes("Timeout")))return"timing";if(r.some(i=>i.error?.includes("Resource")||i.error?.includes("connection")))return"resource";if(r.some(i=>i.error?.includes("Race")||i.error?.includes("async")))return"intermittent";let n=e.executions.map(i=>i.passed);return this.hasOrderPattern(n)?"order-dependent":"intermittent"}hasOrderPattern(e){let t=e.map((i,s)=>i?-1:s).filter(i=>i>=0);if(t.length<2)return!1;let r=t.every(i=>i%2===0),n=t.every(i=>i%2===1);return r||n}suggestFix(e){switch(e){case"timing":return"Add explicit waits, increase timeouts, or use async utilities like waitFor";case"resource":return"Ensure proper resource cleanup, use test isolation, or implement connection pooling";case"order-dependent":return"Make tests independent, reset state in beforeEach, avoid shared mutable state";case"intermittent":return"Add retry logic, investigate race conditions, or use proper synchronization";default:return"Review test for potential issues with async operations or shared state"}}generateFindings(e,t,r){let n=e.filter(c=>c.flakinessScore>=70),i=e.filter(c=>c.flakinessScore>=50&&c.flakinessScore<70),s=e.filter(c=>c.flakinessScore>=20&&c.flakinessScore<50);for(let c of n)t.push({type:"critical-flaky-test",severity:"critical",domain:"test-execution",title:`Critical Flaky Test: ${c.testName}`,description:`Test has ${c.flakinessScore}% flakiness score with ${c.passRate.toFixed(0)}% pass rate`,resource:c.file,context:{testId:c.testId,pattern:c.pattern,recentFailures:c.recentFailures,suggestedFix:c.suggestedFix}});for(let c of i)t.push({type:"high-flaky-test",severity:"high",domain:"test-execution",title:`Flaky Test: ${c.testName}`,description:`Test has ${c.flakinessScore}% flakiness score (${c.pattern} pattern)`,resource:c.file,context:{testId:c.testId,pattern:c.pattern,suggestedFix:c.suggestedFix}});for(let c of s)t.push({type:"medium-flaky-test",severity:"medium",domain:"test-execution",title:`Potentially Flaky Test: ${c.testName}`,description:`Test shows flakiness indicators (score: ${c.flakinessScore}%)`,resource:c.file,context:{testId:c.testId,pattern:c.pattern}});n.length>0&&r.push({priority:"p0",domain:"test-execution",action:"Fix Critical Flaky Tests",description:`${n.length} tests have critical flakiness. These severely impact CI reliability.`,estimatedImpact:"high",effort:"high",autoFixable:!1});let a=e.filter(c=>c.pattern==="timing");a.length>0&&r.push({priority:"p1",domain:"test-execution",action:"Address Timing-Related Flakiness",description:`${a.length} tests have timing issues. Consider using proper async utilities.`,estimatedImpact:"medium",effort:"medium",autoFixable:!1})}calculateHealthScore(e,t){if(e===0)return 100;let r=t.length/e,n=t.length>0?t.reduce((a,c)=>a+c.flakinessScore,0)/t.length:0,i=100;i-=r*50,i-=n/100*30;let s=t.filter(a=>a.flakinessScore>=70).length;return i-=s*5,Math.max(0,Math.round(i))}}});var lEe,nh,a7=y(()=>{"use strict";ir();lEe={id:"security-scan",name:"Security Vulnerability Scanner",description:"Scans for security vulnerabilities in dependencies, code patterns, and configurations",intervalMs:1800*1e3,priority:"critical",targetDomains:["security-compliance"],enabled:!0,timeoutMs:3e5,retryCount:3,retryDelayMs:3e4},nh=class extends $e{constructor(){super(lEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting security vulnerability scan");let r=[],n=[],i=await this.runSecurityScans(e);this.analyzeDependencyVulnerabilities(i.dependencyVulnerabilities,r,n),this.analyzeCodeSecurityIssues(i.codeSecurityIssues,r,n),i.secretsDetected>0&&this.reportSecretsDetected(i.secretsDetected,r,n),await e.memory.set("security:lastScan",i),await e.memory.set("security:lastScanTime",new Date().toISOString());let s=this.calculateHealthScore(i),a=i.dependencyVulnerabilities.length+i.codeSecurityIssues.length+i.secretsDetected+i.configurationIssues;return e.logger.info("Security scan complete",{healthScore:s,totalIssues:a,criticalIssues:i.dependencyVulnerabilities.filter(c=>c.severity==="critical").length+i.codeSecurityIssues.filter(c=>c.severity==="critical").length}),this.createResult(Date.now()-t,{itemsAnalyzed:a,issuesFound:r.length,healthScore:s,trend:"stable",domainMetrics:{dependencyVulnerabilities:i.dependencyVulnerabilities.length,codeSecurityIssues:i.codeSecurityIssues.length,secretsDetected:i.secretsDetected,configurationIssues:i.configurationIssues,scanDuration:`${i.scanDurationMs}ms`}},r,n)}async runSecurityScans(e){return{dependencyVulnerabilities:[{package:"lodash",version:"4.17.15",severity:"high",cve:"CVE-2021-23337",title:"Command Injection",description:"Lodash versions prior to 4.17.21 are vulnerable to Command Injection via the template function.",fixedIn:"4.17.21"},{package:"minimist",version:"1.2.5",severity:"critical",cve:"CVE-2021-44906",title:"Prototype Pollution",description:"Prototype pollution vulnerability allows attackers to manipulate JavaScript object prototypes.",fixedIn:"1.2.6"}],codeSecurityIssues:[{file:"src/shared/http/http-client.ts",line:45,rule:"no-eval",severity:"high",message:"Avoid using eval() as it can execute arbitrary code",category:"injection"},{file:"src/kernel/memory-backend.ts",line:122,rule:"sql-injection",severity:"medium",message:"Potential SQL injection - use parameterized queries",category:"injection"}],secretsDetected:0,configurationIssues:1,scanDurationMs:2500}}analyzeDependencyVulnerabilities(e,t,r){let n=e.filter(s=>s.severity==="critical"),i=e.filter(s=>s.severity==="high");for(let s of n)t.push({type:"critical-vulnerability",severity:"critical",domain:"security-compliance",title:`Critical Vulnerability in ${s.package}`,description:`${s.title}: ${s.description}`,resource:s.package,context:{cve:s.cve,currentVersion:s.version,fixedIn:s.fixedIn}});for(let s of i)t.push({type:"high-vulnerability",severity:"high",domain:"security-compliance",title:`High Severity Vulnerability in ${s.package}`,description:`${s.title}: ${s.description}`,resource:s.package,context:{cve:s.cve,currentVersion:s.version,fixedIn:s.fixedIn}});n.length>0&&r.push({priority:"p0",domain:"security-compliance",action:"Update Critical Vulnerabilities Immediately",description:`${n.length} packages have critical vulnerabilities. Update immediately to patched versions.`,estimatedImpact:"high",effort:"low",autoFixable:!0}),i.length>0&&r.push({priority:"p1",domain:"security-compliance",action:"Address High Severity Vulnerabilities",description:`${i.length} packages have high severity vulnerabilities. Plan updates within current sprint.`,estimatedImpact:"high",effort:"low",autoFixable:!0})}analyzeCodeSecurityIssues(e,t,r){let n=new Map;for(let a of e){let c=n.get(a.category)||[];c.push(a),n.set(a.category,c)}for(let a of e)t.push({type:`code-security-${a.category}`,severity:a.severity,domain:"security-compliance",title:`Security Issue: ${a.rule}`,description:a.message,resource:`${a.file}:${a.line}`,context:{rule:a.rule,category:a.category}});let i=n.get("injection")||[];i.length>0&&r.push({priority:"p0",domain:"security-compliance",action:"Fix Injection Vulnerabilities",description:`${i.length} potential injection vulnerabilities found. Use parameterized queries and avoid eval().`,estimatedImpact:"high",effort:"medium",autoFixable:!1});let s=n.get("crypto")||[];s.length>0&&r.push({priority:"p1",domain:"security-compliance",action:"Review Cryptographic Implementations",description:`${s.length} cryptographic issues found. Ensure using secure algorithms and proper key management.`,estimatedImpact:"high",effort:"high",autoFixable:!1})}reportSecretsDetected(e,t,r){t.push({type:"secrets-detected",severity:"critical",domain:"security-compliance",title:"Secrets Detected in Codebase",description:`${e} potential secrets/credentials found in source code`,context:{count:e}}),r.push({priority:"p0",domain:"security-compliance",action:"Remove Secrets from Codebase",description:"Immediately rotate any exposed credentials and move them to secure secret management.",estimatedImpact:"high",effort:"medium",autoFixable:!1})}calculateHealthScore(e){let t=100,r=e.dependencyVulnerabilities.filter(a=>a.severity==="critical").length;t-=r*20;let n=e.dependencyVulnerabilities.filter(a=>a.severity==="high").length;t-=n*10;let i=e.codeSecurityIssues.filter(a=>a.severity==="critical").length;t-=i*15;let s=e.codeSecurityIssues.filter(a=>a.severity==="high").length;return t-=s*8,t-=e.secretsDetected*30,t-=e.configurationIssues*5,Math.max(0,Math.round(t))}}});var uEe,ih,o7=y(()=>{"use strict";ir();uEe={id:"quality-gate",name:"Quality Gate Evaluator",description:"Continuously evaluates quality gates and release readiness across all quality dimensions",intervalMs:300*1e3,priority:"critical",targetDomains:["quality-assessment"],enabled:!0,timeoutMs:12e4,retryCount:2,retryDelayMs:5e3},ih=class extends $e{constructor(){super(uEe)}async doExecute(e){let t=Date.now();e.logger.info("Starting quality gate evaluation");let r=[],n=[],i=await this.evaluateQualityGates(e);this.analyzeGateResults(i,r,n),this.checkBlockers(i,r,n),await this.compareToHistory(e,i,r),await e.memory.set("quality-gate:current",i),await e.memory.set("quality-gate:lastCheck",new Date().toISOString());let s=await e.memory.get("quality-gate:history")||[];s.push(i),s.length>100&&s.shift(),await e.memory.set("quality-gate:history",s);let a=this.calculateHealthScore(i);return e.logger.info("Quality gate evaluation complete",{healthScore:a,passed:i.passed,releaseReady:i.releaseReady,blockers:i.blockers}),this.createResult(Date.now()-t,{itemsAnalyzed:i.rules.length,issuesFound:i.failedRules,healthScore:a,trend:"stable",domainMetrics:{gatePassed:i.passed?"YES":"NO",releaseReady:i.releaseReady?"YES":"NO",passedRules:i.passedRules,failedRules:i.failedRules,blockers:i.blockers,warnings:i.warnings}},r,n)}async evaluateQualityGates(e){let t=[{id:"coverage-line",name:"Line Coverage",category:"coverage",threshold:80,operator:"gte",currentValue:78.5,unit:"%",blocking:!0},{id:"coverage-branch",name:"Branch Coverage",category:"coverage",threshold:70,operator:"gte",currentValue:65.2,unit:"%",blocking:!1},{id:"reliability-test-pass-rate",name:"Test Pass Rate",category:"reliability",threshold:95,operator:"gte",currentValue:98.2,unit:"%",blocking:!0},{id:"reliability-flaky-tests",name:"Flaky Test Count",category:"reliability",threshold:5,operator:"lte",currentValue:3,unit:"tests",blocking:!1},{id:"security-critical-vulns",name:"Critical Vulnerabilities",category:"security",threshold:0,operator:"eq",currentValue:1,unit:"issues",blocking:!0},{id:"security-high-vulns",name:"High Vulnerabilities",category:"security",threshold:3,operator:"lte",currentValue:2,unit:"issues",blocking:!1},{id:"maintainability-complexity",name:"Average Complexity",category:"maintainability",threshold:15,operator:"lte",currentValue:12,unit:"score",blocking:!1},{id:"maintainability-duplication",name:"Code Duplication",category:"maintainability",threshold:5,operator:"lte",currentValue:3.2,unit:"%",blocking:!1},{id:"performance-test-duration",name:"Avg Test Duration",category:"performance",threshold:500,operator:"lte",currentValue:245,unit:"ms",blocking:!1}],r=0,n=0,i=0,s=0;for(let a of t)this.evaluateRule(a)?r++:(n++,a.blocking?i++:s++);return{passed:i===0,passedRules:r,failedRules:n,blockers:i,warnings:s,releaseReady:i===0&&s<=2,rules:t}}evaluateRule(e){switch(e.operator){case"gte":return e.currentValue>=e.threshold;case"lte":return e.currentValue<=e.threshold;case"eq":return e.currentValue===e.threshold;default:return!1}}analyzeGateResults(e,t,r){for(let s of e.rules)if(!this.evaluateRule(s)){let a=s.blocking?"critical":"medium";t.push({type:"quality-gate-failure",severity:a,domain:"quality-assessment",title:`Quality Gate Failed: ${s.name}`,description:`${s.name} is ${s.currentValue}${s.unit}, threshold is ${s.operator==="gte"?">=":s.operator==="lte"?"<=":"="} ${s.threshold}${s.unit}`,context:{ruleId:s.id,category:s.category,currentValue:s.currentValue,threshold:s.threshold,blocking:s.blocking}})}let n=e.rules.filter(s=>s.category==="coverage"&&!this.evaluateRule(s));n.length>0&&r.push({priority:n.some(s=>s.blocking)?"p0":"p2",domain:"quality-assessment",action:"Improve Test Coverage",description:`${n.length} coverage gates are failing. Add tests to increase coverage.`,estimatedImpact:"high",effort:"medium",autoFixable:!0}),e.rules.filter(s=>s.category==="security"&&!this.evaluateRule(s)).length>0&&r.push({priority:"p0",domain:"quality-assessment",action:"Address Security Issues",description:"Security gates are failing. Resolve vulnerabilities before release.",estimatedImpact:"high",effort:"medium",autoFixable:!1})}checkBlockers(e,t,r){e.blockers>0?(t.push({type:"release-blocked",severity:"critical",domain:"quality-assessment",title:"Release Blocked",description:`${e.blockers} blocking issues prevent release`,context:{blockers:e.blockers,blockingRules:e.rules.filter(n=>n.blocking&&!this.evaluateRule(n)).map(n=>n.name)}}),r.push({priority:"p0",domain:"quality-assessment",action:"Resolve Release Blockers",description:"Address all blocking quality gate failures before proceeding with release.",estimatedImpact:"high",effort:"medium",autoFixable:!1})):e.releaseReady||t.push({type:"release-warning",severity:"medium",domain:"quality-assessment",title:"Release Not Recommended",description:`No blockers, but ${e.warnings} warnings suggest caution`,context:{warnings:e.warnings}})}async compareToHistory(e,t,r){let n=await e.memory.get("quality-gate:current");n&&(n.passed&&!t.passed&&r.push({type:"quality-gate-regression",severity:"high",domain:"quality-assessment",title:"Quality Gate Regression",description:"Quality gates were passing previously but are now failing",context:{previousBlockers:n.blockers,currentBlockers:t.blockers}}),!n.passed&&t.passed&&r.push({type:"quality-gate-improvement",severity:"info",domain:"quality-assessment",title:"Quality Gates Now Passing",description:"All quality gates are now passing after previous failures",context:{previousFailures:n.failedRules,currentFailures:t.failedRules}}))}calculateHealthScore(e){if(e.rules.length===0)return 100;let r=e.passedRules/e.rules.length*70;return r-=e.blockers*15,r-=e.warnings*5,e.releaseReady&&(r+=10),Math.max(0,Math.min(100,Math.round(r)))}}});var c7={};Q(c7,{ensurePatternEmbedding:()=>dEe});async function dEe(o,e,t,r,n,i={}){try{let s=`${t??""} ${r??""} ${(n??[]).join(" ")}`.trim();if(!s)return;let a=await kt(s,i);if(!a||a.length===0)return;let c=Buffer.from(new Float32Array(a).buffer),l={...Ls,...i};o.prepare(`INSERT OR REPLACE INTO qe_pattern_embeddings (pattern_id, embedding, dimension, model)
5889
5885
  VALUES (?, ?, ?, ?)`).run(e,c,a.length,l.modelName)}catch(s){console.debug("[ensurePatternEmbedding] non-fatal:",s instanceof Error?s.message:String(s))}}var l7=y(()=>{"use strict";Tr()});var pEe,sh,u7=y(()=>{"use strict";ir();L();vm();yw();Y();k();rL();pEe={id:"learning-consolidation",name:"Learning Consolidation",description:"Consolidates learning patterns across domains and optimizes strategies",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:3e5,retryCount:2,retryDelayMs:3e4},sh=class extends $e{lifecycleManager=null;lastRunTimestamp=0;constructor(){super(pEe)}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=W();await e.initialize();let t=e.getDatabase();return this.lifecycleManager=mg(t,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch(e){return console.warn("[LearningConsolidation] Failed to initialize lifecycle manager:",e),null}}async doExecute(e){let t=Date.now();e.logger.info("Starting learning consolidation (Phase 7: Continuous Learning Loop)");let r=[],n=[],i=0,s=0,a=0,c=0,l=0,u=await this.getLifecycleManager();if(u){let h=await this.runContinuousLearningLoop(e,u,r,n);i=h.experiencesProcessed,s=h.patternCandidatesFound,a=h.patternsPromoted,c=h.patternsDeprecated,l=h.confidenceDecayApplied}let d=await this.collectPatterns(e),p=await this.consolidatePatterns(e,d);p.experiencesProcessed=i,p.patternCandidatesFound=s,p.patternsPromoted=a,p.patternsDeprecated=c,p.confidenceDecayApplied=l,this.identifyCrossDomainPatterns(d,r,n),this.pruneIneffectivePatterns(d,r,n),this.generateOptimizations(d,r,n);let m=await this.runDreamCycle(e,d,r,n);p.dreamInsights=m.insights,p.dreamPatternsCreated=m.patternsCreated,await e.memory.set("learning:lastConsolidation",p),await e.memory.set("learning:consolidatedPatterns",d),this.lastRunTimestamp=Date.now();let g=this.calculateHealthScore(p,d);return e.logger.info("Learning consolidation complete",{healthScore:g,patternsAnalyzed:p.patternsAnalyzed,newInsights:p.newInsights,experiencesProcessed:i,patternsPromoted:a,patternsDeprecated:c}),this.createResult(Date.now()-t,{itemsAnalyzed:p.patternsAnalyzed,issuesFound:p.patternsPruned+p.patternsDeprecated,healthScore:g,trend:this.determineTrend(p),domainMetrics:{patternsAnalyzed:p.patternsAnalyzed,patternsPruned:p.patternsPruned,patternsConsolidated:p.patternsConsolidated,newInsights:p.newInsights,crossDomainPatterns:p.crossDomainPatterns,dreamInsights:p.dreamInsights,dreamPatternsCreated:p.dreamPatternsCreated,experiencesProcessed:p.experiencesProcessed,patternCandidatesFound:p.patternCandidatesFound,patternsPromoted:p.patternsPromoted,patternsDeprecated:p.patternsDeprecated,confidenceDecayApplied:p.confidenceDecayApplied}},r,n)}async runContinuousLearningLoop(e,t,r,n){e.logger.info("Running continuous learning loop (Phase 7)");let i=0,s=0,a=0,c=0,l=0;try{let u=t.getRecentExperiences({minReward:.7,limit:100,sinceDays:7});if(i=u.length,u.length>0){e.logger.debug("Processing recent experiences",{count:u.length});let h=t.findPatternCandidates(u);if(s=h.length,h.length>0){let v=await this.createPatternsFromCandidates(h);r.push({type:"pattern-extraction",severity:"info",domain:"learning-optimization",title:"New Patterns Extracted from Experiences",description:`${v} new patterns extracted from ${i} high-reward experiences`,context:{candidatesFound:s,patternsCreated:v,topCandidate:h[0]?.name}})}}let d=t.promoteEligiblePatterns();a=d.promoted,a>0&&r.push({type:"pattern-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted to Long-Term",description:`${a} patterns promoted after meeting quality thresholds`,context:{checked:d.checked,promoted:a}});let p=t.deprecateStalePatterns();c=p.deprecated,c>0&&(r.push({type:"pattern-deprecation",severity:"low",domain:"learning-optimization",title:"Underperforming Patterns Deprecated",description:`${c} patterns deprecated due to failures, staleness, or low confidence`,context:{checked:p.checked,deprecated:c}}),n.push({priority:"p3",domain:"learning-optimization",action:"Review Deprecated Patterns",description:`${c} patterns were deprecated. Review for potential recovery or permanent removal.`,estimatedImpact:"low",effort:"low",autoFixable:!1}));try{let v=W().getDatabase(),b=new Xc;await b.initialize(v);let C=await b.consolidateAll();(C.merged>0||C.archived>0)&&r.push({type:"experience-consolidation",severity:"info",domain:"learning-optimization",title:"Experiences Consolidated",description:`${C.merged} merged, ${C.archived} archived across ${C.domainsProcessed.length} domains`,context:{merged:C.merged,archived:C.archived,activeRemaining:C.activeRemaining,domains:C.domainsProcessed}})}catch(h){e.logger.warn("Experience consolidation failed",{error:w(h)})}let m=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/(1e3*60*60*24):1;m>=.5&&(l=t.applyConfidenceDecay(Math.min(m,7)).decayed);let g=t.getStats();this.addLifecycleStatsFinding(g,r,n),e.logger.info("Continuous learning loop complete",{experiencesProcessed:i,patternCandidatesFound:s,patternsPromoted:a,patternsDeprecated:c,confidenceDecayApplied:l})}catch(u){e.logger.warn("Continuous learning loop partially failed",{error:w(u)})}return{experiencesProcessed:i,patternCandidatesFound:s,patternsPromoted:a,patternsDeprecated:c,confidenceDecayApplied:l}}async createPatternsFromCandidates(e){let t=0;try{let n=W().getDatabase();for(let i of e)try{let{v4:s}=await Promise.resolve().then(()=>(N(),R$)),a=s(),c=`Auto-extracted pattern from ${i.sourceExperiences} experiences. Avg reward: ${i.avgReward.toFixed(3)}`;n.prepare(`
5890
5886
  INSERT INTO qe_patterns (
5891
5887
  id, pattern_type, qe_domain, domain, name, description,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentic-qe",
3
- "version": "3.9.21",
3
+ "version": "3.9.22",
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.9.21");process.exit(0)}
2
- import{a,b,c}from"./chunk-XEMVYJ2Z.js";import"./chunk-ICPQR533.js";import"./chunk-AT25VXEO.js";import"./chunk-PEOTZFNZ.js";import"./chunk-SMBQERK7.js";import"./chunk-4ZUXTOUG.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.9.21");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-65U55JIH.js";import"./chunk-KID7PTBZ.js";import"./chunk-TFAS5UND.js";import"./chunk-QSLXOYPR.js";import"./chunk-V6GJ3EMZ.js";import"./chunk-4Z4C7BXV.js";import"./chunk-YVG4D6P3.js";import"./chunk-C4CZXAOE.js";import"./chunk-G7ZYDJZ3.js";import"./chunk-AMOCYHP3.js";import"./chunk-TCNJ5NGT.js";import"./chunk-E7J32PW2.js";import"./chunk-IM7X6BDZ.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.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.9.21");process.exit(0)}
2
- import{a,b,c,d,e,f}from"./chunk-RHAUASC6.js";import"./chunk-YVPPR33H.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{f as MCPToolBase,e as defaultToolLogger,d as getMemoryBackend,b as getSharedMemoryBackend,a as registerRvfResetFn,c as resetSharedMemoryBackend};
@@ -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.9.21");process.exit(0)}
2
- import{a}from"./chunk-HIEP3L7H.js";import"./chunk-RHAUASC6.js";import"./chunk-YVPPR33H.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{a as BrowserWorkflowTool};
@@ -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.9.21");process.exit(0)}
2
- import{a as e,b as g,e as r}from"./chunk-MYZ43VKA.js";import{c as o}from"./chunk-4ZUXTOUG.js";var L=o(()=>{"use strict";e();g();r()});export{L as a};
@@ -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.9.21");process.exit(0)}
2
- import{c as a,d as b,e as c}from"./chunk-T5Z5LL5Y.js";import"./chunk-V5AVC4D4.js";import"./chunk-SMBQERK7.js";import"./chunk-4ZUXTOUG.js";c();export{a as VibiumClientImpl,b as VibiumClientProvider};
@@ -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.9.21");process.exit(0)}
2
- import{a,b}from"./chunk-QERANESS.js";import"./chunk-KRXJ7LFP.js";import"./chunk-OK5JHHXK.js";import"./chunk-GDZ6XQRI.js";import"./chunk-4ZUXTOUG.js";export{a as CrossDomainEventRouter,b as createCrossDomainRouter};
@@ -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.9.21");process.exit(0)}
2
- import{a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u}from"./chunk-SIW4N4NE.js";import"./chunk-OEB3V633.js";import"./chunk-65U55JIH.js";import"./chunk-KID7PTBZ.js";import"./chunk-TFAS5UND.js";import"./chunk-QSLXOYPR.js";import"./chunk-V6GJ3EMZ.js";import"./chunk-4Z4C7BXV.js";import"./chunk-YVG4D6P3.js";import"./chunk-C4CZXAOE.js";import"./chunk-G7ZYDJZ3.js";import"./chunk-AMOCYHP3.js";import"./chunk-TCNJ5NGT.js";import"./chunk-E7J32PW2.js";import"./chunk-IM7X6BDZ.js";import"./chunk-WI5HBS3C.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{t as BUILT_IN_STRATEGIES,b as ConceptGraph,g as DEFAULT_ACTIVATION_CONFIG,a as DEFAULT_CONCEPT_GRAPH_CONFIG,m as DEFAULT_DREAM_CONFIG,q as DEFAULT_DREAM_SCHEDULER_CONFIG,i as DEFAULT_INSIGHT_CONFIG,k as DEFAULT_VALIDATION_THRESHOLDS,n as DreamEngine,r as DreamScheduler,f as HISTORY_TRIM_TARGET_RATIO,j as InsightGenerator,d as MAX_ACTIVATION_HISTORY_ENTRIES,e as MAX_COACTIVATION_ENTRIES,l as RVCOWBranchManager,u as SpeculativeDreamer,h as SpreadingActivation,c as createConceptGraph,o as createDreamEngine,s as createDreamScheduler,p as default};
@@ -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.9.21");process.exit(0)}
2
- import{a,c as b}from"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";b();export{a as HnswAdapter};
@@ -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.9.21");process.exit(0)}
2
- import{a,b,c,d}from"./chunk-GB6ATLR3.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-5EYQP3V3.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{a as DEFAULT_HNSW_CONFIG,b as HNSWIndex,d as benchmarkHNSW,c as createHNSWIndex};
@@ -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.9.21");process.exit(0)}
2
- import{a}from"./chunk-TMKJXKY2.js";import"./chunk-ROC2SSV3.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-4ZUXTOUG.js";export{a as ImpactAnalyzerService};
@@ -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.9.21");process.exit(0)}
2
- import{a,b,c,d}from"./chunk-S6FFUCVZ.js";import"./chunk-S3TU7B7D.js";import"./chunk-YH7BAX7S.js";import"./chunk-RDUIN7LO.js";import"./chunk-D24HN6BG.js";import"./chunk-PEOTZFNZ.js";import"./chunk-SMBQERK7.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-4ZUXTOUG.js";export{a as InitOrchestrator,b as createInitOrchestrator,d as formatInitResult,c as quickInit};
@@ -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.9.21");process.exit(0)}
2
- import{v as a,w as b}from"./chunk-QU3VFWZZ.js";import"./chunk-VGAG5TG7.js";import"./chunk-E2XIPBJ7.js";import"./chunk-5PZG4WUA.js";import"./chunk-FZ2SYLSK.js";import"./chunk-2AEWOQWU.js";import"./chunk-WY3H7VHF.js";import"./chunk-ND2TFQF5.js";import"./chunk-UOLIGPDW.js";import"./chunk-ADC73GLJ.js";import"./chunk-56DGV2Q3.js";import"./chunk-P4Q5TMDH.js";import"./chunk-KRXJ7LFP.js";import"./chunk-T5Z5LL5Y.js";import"./chunk-SIW4N4NE.js";import"./chunk-OEB3V633.js";import"./chunk-65U55JIH.js";import"./chunk-KID7PTBZ.js";import"./chunk-TFAS5UND.js";import"./chunk-QSLXOYPR.js";import"./chunk-V6GJ3EMZ.js";import"./chunk-4Z4C7BXV.js";import"./chunk-YVG4D6P3.js";import"./chunk-C4CZXAOE.js";import"./chunk-G7ZYDJZ3.js";import"./chunk-E55MYZGP.js";import"./chunk-AMOCYHP3.js";import"./chunk-YVPPR33H.js";import"./chunk-S5RNBBJ6.js";import"./chunk-V5AVC4D4.js";import"./chunk-SMAC5IX4.js";import"./chunk-GB6ATLR3.js";import"./chunk-TCNJ5NGT.js";import"./chunk-TMKJXKY2.js";import"./chunk-ROC2SSV3.js";import"./chunk-NGT3VL66.js";import"./chunk-NKOGDRZE.js";import"./chunk-E7J32PW2.js";import"./chunk-IM7X6BDZ.js";import"./chunk-WI5HBS3C.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-PAXSPZ3F.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-DBW745QA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-KDOA7YHW.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{a as QEKernelImpl,b as createKernel};
@@ -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.9.21");process.exit(0)}
2
- import{g as a}from"./chunk-ROC2SSV3.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-4ZUXTOUG.js";export{a as KnowledgeGraphService};
@@ -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.9.21");process.exit(0)}
2
- import{a}from"./chunk-7P4IZQVQ.js";import"./chunk-RHAUASC6.js";import"./chunk-YVPPR33H.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{a as LoadTestTool};
@@ -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.9.21");process.exit(0)}
2
- import{a}from"./chunk-KDOA7YHW.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-4ZUXTOUG.js";export{a as InMemoryBackend};
@@ -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.9.21");process.exit(0)}
2
- import{a,b}from"./chunk-WL5IRCU4.js";import"./chunk-ND2TFQF5.js";import"./chunk-UOLIGPDW.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-4ZUXTOUG.js";export{a as DefaultProtocolExecutor,b as createProtocolExecutor};
@@ -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.9.21");process.exit(0)}
2
- import{a as h,b as i,c as j,d as k,e as l,f as m,g as n}from"./chunk-TFAS5UND.js";import"./chunk-QSLXOYPR.js";import{a as e,b as f,d as g}from"./chunk-V6GJ3EMZ.js";import"./chunk-4Z4C7BXV.js";import{a,b,c,h as d}from"./chunk-YVG4D6P3.js";import"./chunk-C4CZXAOE.js";import"./chunk-AMOCYHP3.js";import"./chunk-TCNJ5NGT.js";import"./chunk-E7J32PW2.js";import"./chunk-IM7X6BDZ.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{j as AGENT_CAPABILITIES,h as DEFAULT_QE_REASONING_BANK_CONFIG,i as PRETRAINED_PATTERNS,m as QEReasoningBank,l as RELATED_DOMAINS,d as applyPatternTemplate,k as calculateAgentScores,n as createQEReasoningBank,a as detectQEDomain,b as detectQEDomains,g as generateGuidanceContext,f as getCombinedGuidance,e as getGuidance,c as mapQEDomainToAQE};
@@ -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.9.21");process.exit(0)}
2
- import{c as a,d as b,e as c,f as d}from"./chunk-NS2ZWXUK.js";import"./chunk-LYZUB3NP.js";import"./chunk-HMMJ6ZI6.js";import"./chunk-D24HN6BG.js";import"./chunk-ADC73GLJ.js";import"./chunk-56DGV2Q3.js";import"./chunk-P4Q5TMDH.js";import"./chunk-KRXJ7LFP.js";import"./chunk-4Z4C7BXV.js";import"./chunk-YVG4D6P3.js";import"./chunk-5FNEOJSD.js";import"./chunk-I3HLZASP.js";import"./chunk-PAXSPZ3F.js";import"./chunk-OHR5ILR3.js";import"./chunk-MYZ43VKA.js";import"./chunk-PEOTZFNZ.js";import"./chunk-OK5JHHXK.js";import"./chunk-SMBQERK7.js";import"./chunk-GDZ6XQRI.js";import"./chunk-ACOEV3YB.js";import"./chunk-3Y7OZ2PC.js";import"./chunk-FBCLQTXO.js";import"./chunk-5EYQP3V3.js";import"./chunk-63PHZGO2.js";import"./chunk-ZUTYZIWQ.js";import"./chunk-KYPN6G7T.js";import"./chunk-NJICCYCB.js";import"./chunk-NV6AUEIH.js";import"./chunk-4ZUXTOUG.js";export{a as DOMAIN_GROUPS,c as QueenCoordinator,b as TASK_DOMAIN_MAP,d as createQueenCoordinator};