agentic-qe 3.15.2 → 3.15.3

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 (428) hide show
  1. package/.claude/helpers/brain-checkpoint.cjs +46 -6
  2. package/.claude/hooks/aqe-hook.cjs +280 -51
  3. package/.claude/skills/skills-manifest.json +1 -1
  4. package/CHANGELOG.md +86 -0
  5. package/assets/skills/skills-manifest.json +1 -1
  6. package/dist/adapters/ag-ui/state-delta-cache.js +14 -5
  7. package/dist/adapters/trajectory-adapter.js +3 -1
  8. package/dist/cli/bundle.js +5 -5
  9. package/dist/cli/chunks/adapter-WQSFQES5.js +2 -0
  10. package/dist/cli/chunks/{agent-booster-wasm-664M7426.js → agent-booster-wasm-CYG3PKHH.js} +2 -2
  11. package/dist/cli/chunks/{agent-handler-E47ITH45.js → agent-handler-WTFYFZKL.js} +2 -2
  12. package/dist/cli/chunks/{agent-memory-branch-CFWVOJX3.js → agent-memory-branch-G6WE3ZXU.js} +2 -2
  13. package/dist/cli/chunks/aqe-learning-engine-TDHBBADE.js +2 -0
  14. package/dist/cli/chunks/{arena-JM3OY263.js → arena-S72QW44C.js} +4 -4
  15. package/dist/cli/chunks/{arena-ZU5CGBGH.js → arena-ZFXQEVUQ.js} +2 -2
  16. package/dist/cli/chunks/{audit-HVBRC5AS.js → audit-KPYIEQJ3.js} +3 -3
  17. package/dist/cli/chunks/base-CZSB27VO.js +2 -0
  18. package/dist/cli/chunks/{better-sqlite3-45JLBQX3.js → better-sqlite3-L2M3TI5D.js} +2 -2
  19. package/dist/cli/chunks/{brain-handler-FKDONZYA.js → brain-handler-FHKLQTB4.js} +3 -3
  20. package/dist/cli/chunks/{branch-enumerator-M3DPS3D5.js → branch-enumerator-3BSHOPOK.js} +2 -2
  21. package/dist/cli/chunks/{browser-TG2TV6NR.js → browser-JUIJPL6Y.js} +2 -2
  22. package/dist/cli/chunks/browser-workflow-AEMIS6PA.js +2 -0
  23. package/dist/cli/chunks/{chunk-3KTAMNKI.js → chunk-2GJJGO5D.js} +2 -2
  24. package/dist/cli/chunks/{chunk-HSXLHNSS.js → chunk-2M75CW5Q.js} +2 -2
  25. package/dist/cli/chunks/{chunk-MEUJWTOX.js → chunk-2MEWIXW4.js} +2 -2
  26. package/dist/cli/chunks/{chunk-SKQTRYE7.js → chunk-2TBHPYOU.js} +2 -2
  27. package/dist/cli/chunks/{chunk-PZK7O445.js → chunk-34Y4CIHD.js} +2 -2
  28. package/dist/cli/chunks/{chunk-RO6HAZLV.js → chunk-35VDOH4Y.js} +1 -1
  29. package/dist/cli/chunks/{chunk-KQMCCHPO.js → chunk-366IBPZB.js} +2 -2
  30. package/dist/cli/chunks/{chunk-GJTH6VBH.js → chunk-3MNKYCLH.js} +1 -1
  31. package/dist/cli/chunks/{chunk-6KEYA4EH.js → chunk-3UUMGWHW.js} +4 -4
  32. package/dist/cli/chunks/{chunk-EQG3JYSV.js → chunk-3Y4GX5FL.js} +2 -2
  33. package/dist/cli/chunks/{chunk-BKZSTZDB.js → chunk-3ZTBV6M3.js} +1 -1
  34. package/dist/cli/chunks/{chunk-UZL4JYVW.js → chunk-4IYHYHTG.js} +2 -2
  35. package/dist/cli/chunks/{chunk-56CE7UO4.js → chunk-4JVVVKAX.js} +6 -6
  36. package/dist/cli/chunks/chunk-4N7YXTV3.js +4 -0
  37. package/dist/cli/chunks/{chunk-N653RGT3.js → chunk-4TM5K6EZ.js} +2 -2
  38. package/dist/cli/chunks/{chunk-IAOB2G3X.js → chunk-5LEUEWJY.js} +2 -2
  39. package/dist/cli/chunks/{chunk-LRVR56PD.js → chunk-5QUOM357.js} +1 -1
  40. package/dist/cli/chunks/{chunk-NBV37CEK.js → chunk-5WOBFN2T.js} +2 -2
  41. package/dist/cli/chunks/{chunk-I7J2ESGR.js → chunk-6AKJ73X3.js} +2 -2
  42. package/dist/cli/chunks/{chunk-L77Z3Q6L.js → chunk-6EQDA4EC.js} +2 -2
  43. package/dist/cli/chunks/{chunk-3DCRAW43.js → chunk-6TYTBQPV.js} +2 -2
  44. package/dist/cli/chunks/{chunk-IQB5ZBYO.js → chunk-6V6XVGCL.js} +3 -3
  45. package/dist/cli/chunks/{chunk-DHSGCI6H.js → chunk-6W6GZHQA.js} +6 -6
  46. package/dist/cli/chunks/{chunk-MY2XZHW3.js → chunk-7IJVCDDC.js} +1 -1
  47. package/dist/cli/chunks/{chunk-AS27JP67.js → chunk-7PDC4SKR.js} +1 -1
  48. package/dist/cli/chunks/{chunk-3KXKJSKS.js → chunk-7SWHW5AC.js} +20 -20
  49. package/dist/cli/chunks/{chunk-FH6N2LKG.js → chunk-7TW5UGDP.js} +2 -2
  50. package/dist/cli/chunks/{chunk-SZYK5JL7.js → chunk-7UUSV2SK.js} +1 -1
  51. package/dist/cli/chunks/{chunk-HFF5ERIE.js → chunk-A3IQU2ND.js} +2 -2
  52. package/dist/cli/chunks/{chunk-RIAKRZCZ.js → chunk-A5H7TF7C.js} +2 -2
  53. package/dist/cli/chunks/{chunk-ATGIGJSL.js → chunk-A6PII4R4.js} +1 -1
  54. package/dist/cli/chunks/{chunk-X4CADOSD.js → chunk-AEL4XJGJ.js} +2 -2
  55. package/dist/cli/chunks/{chunk-JCB6K24D.js → chunk-AOZJ6UUZ.js} +2 -2
  56. package/dist/cli/chunks/chunk-APV5UWTU.js +15 -0
  57. package/dist/cli/chunks/{chunk-QJN5RW2U.js → chunk-AQTQ24SK.js} +3 -3
  58. package/dist/cli/chunks/{chunk-GDSLQTJC.js → chunk-AS54N3H7.js} +2 -2
  59. package/dist/cli/chunks/chunk-ASUXS4N4.js +2 -0
  60. package/dist/cli/chunks/{chunk-HS3O763N.js → chunk-B23ROYST.js} +3 -3
  61. package/dist/cli/chunks/{chunk-IHKRKRAV.js → chunk-BDKQSEEY.js} +1 -1
  62. package/dist/cli/chunks/{chunk-2B2MGJ2W.js → chunk-BO43BGHX.js} +2 -2
  63. package/dist/cli/chunks/{chunk-MDDECCAC.js → chunk-CF3BPD2R.js} +161 -159
  64. package/dist/cli/chunks/{chunk-ANI3KPB7.js → chunk-CFXROOIU.js} +2 -2
  65. package/dist/cli/chunks/{chunk-3RC5UMRJ.js → chunk-CNQUU6CF.js} +2 -2
  66. package/dist/cli/chunks/{chunk-NKWMTXBL.js → chunk-D5V6C3XG.js} +3 -3
  67. package/dist/cli/chunks/{chunk-ZIKH7U5A.js → chunk-D6PUDLJ4.js} +2 -2
  68. package/dist/cli/chunks/{chunk-FNPZINHV.js → chunk-DE3QNPTG.js} +1 -1
  69. package/dist/cli/chunks/{chunk-VTGAPHJE.js → chunk-DH5NWHH2.js} +2 -2
  70. package/dist/cli/chunks/{chunk-OWZ3F7DJ.js → chunk-DLA3EHKJ.js} +1 -1
  71. package/dist/cli/chunks/{chunk-7UA7SMM4.js → chunk-DWG4TN6A.js} +1 -1
  72. package/dist/cli/chunks/{chunk-4MCO43NX.js → chunk-EBIMVSPH.js} +4 -4
  73. package/dist/cli/chunks/{chunk-WMNVFCKY.js → chunk-ED5HUPUR.js} +2 -2
  74. package/dist/cli/chunks/{chunk-Y5VPLOA7.js → chunk-EQGT4VLC.js} +1 -1
  75. package/dist/cli/chunks/{chunk-ZVQSIH7Y.js → chunk-F5BREV2Q.js} +8 -8
  76. package/dist/cli/chunks/{chunk-CV7E627D.js → chunk-FPFGN2Z5.js} +2 -2
  77. package/dist/cli/chunks/{chunk-GJ7DON5S.js → chunk-FTUNC4EI.js} +3 -3
  78. package/dist/cli/chunks/chunk-FXTZXZCU.js +54 -0
  79. package/dist/cli/chunks/{chunk-6UO5YSNN.js → chunk-GJB3LPCS.js} +2 -2
  80. package/dist/cli/chunks/{chunk-6WVEICL2.js → chunk-GPZH6OPP.js} +4 -4
  81. package/dist/cli/chunks/{chunk-T5N2PIPS.js → chunk-HR7RL4PB.js} +2 -2
  82. package/dist/cli/chunks/{chunk-IT753IPZ.js → chunk-HSR53REE.js} +2 -2
  83. package/dist/cli/chunks/{chunk-DNS37AHW.js → chunk-HU474NXP.js} +1 -1
  84. package/dist/cli/chunks/{chunk-NP2WWIZ3.js → chunk-HV3ZVUHO.js} +1 -1
  85. package/dist/cli/chunks/{chunk-ITM26I6O.js → chunk-HVIFA73X.js} +2 -2
  86. package/dist/cli/chunks/{chunk-Q32UGPWK.js → chunk-HW4V7BVV.js} +2 -2
  87. package/dist/cli/chunks/{chunk-5DFPAJ5O.js → chunk-I5VJ3FBC.js} +2 -2
  88. package/dist/cli/chunks/{chunk-AR5V7VNC.js → chunk-IARE5VGI.js} +1 -1
  89. package/dist/cli/chunks/chunk-INVDDFJC.js +2 -0
  90. package/dist/cli/chunks/{chunk-M36DAETL.js → chunk-JJBTM4JO.js} +2 -2
  91. package/dist/cli/chunks/chunk-JVQK6NGI.js +14 -0
  92. package/dist/cli/chunks/{chunk-TMYGGYRY.js → chunk-K65X6CQA.js} +1 -1
  93. package/dist/cli/chunks/{chunk-HBMBO4FD.js → chunk-KCBCYF7M.js} +2 -2
  94. package/dist/cli/chunks/{chunk-V67UQRQN.js → chunk-KGS6H2HB.js} +2 -2
  95. package/dist/cli/chunks/{chunk-JSTKSPYT.js → chunk-L6OSEWOS.js} +1 -1
  96. package/dist/cli/chunks/{chunk-LH3H4V7C.js → chunk-LEB6O2IN.js} +2 -2
  97. package/dist/cli/chunks/{chunk-JIRX6KUR.js → chunk-LPZAB3N2.js} +3 -3
  98. package/dist/cli/chunks/{chunk-A6L2OCMO.js → chunk-M3ACHBC7.js} +2 -2
  99. package/dist/cli/chunks/{chunk-WBZIOTY6.js → chunk-M3ONCPSU.js} +2 -2
  100. package/dist/cli/chunks/{chunk-EATZW5T2.js → chunk-MUSYQF53.js} +2 -2
  101. package/dist/cli/chunks/{chunk-GSC6JXDE.js → chunk-MZDUBFLP.js} +1 -1
  102. package/dist/cli/chunks/{chunk-2Q4Y3VQ6.js → chunk-NT6FYFJA.js} +2 -2
  103. package/dist/cli/chunks/{chunk-HADOG2PT.js → chunk-O66D4NEJ.js} +2 -2
  104. package/dist/cli/chunks/{chunk-QZNFZ5IQ.js → chunk-OGARNKLS.js} +2 -2
  105. package/dist/cli/chunks/{chunk-QGCFMACF.js → chunk-OKNMZLGB.js} +2 -2
  106. package/dist/cli/chunks/{chunk-TC4B5D4Z.js → chunk-OMHISPPF.js} +1 -1
  107. package/dist/cli/chunks/{chunk-DGKPGRBT.js → chunk-OT6SOPAL.js} +2 -2
  108. package/dist/cli/chunks/{chunk-W6PLBRRS.js → chunk-OTTTHNIT.js} +1 -1
  109. package/dist/cli/chunks/{chunk-JFFVYCTV.js → chunk-P36IODAM.js} +2 -2
  110. package/dist/cli/chunks/{chunk-EDRIROCG.js → chunk-P6EGRAQG.js} +2 -2
  111. package/dist/cli/chunks/{chunk-HOBBYORR.js → chunk-PBUWNMZ2.js} +1 -1
  112. package/dist/cli/chunks/{chunk-Z3PANQUT.js → chunk-POTVF6BY.js} +1 -1
  113. package/dist/cli/chunks/{chunk-SVHFSOGT.js → chunk-POVP6O6K.js} +1 -1
  114. package/dist/cli/chunks/{chunk-LVDZ25VX.js → chunk-PPA53NJB.js} +2 -2
  115. package/dist/cli/chunks/{chunk-GHXNRF63.js → chunk-PUPEKA2J.js} +2 -2
  116. package/dist/cli/chunks/{chunk-RLQ4MYB6.js → chunk-QDQLL2QB.js} +2 -2
  117. package/dist/cli/chunks/{chunk-O6QTCUSL.js → chunk-QSVNVDA5.js} +1 -1
  118. package/dist/cli/chunks/{chunk-UKRK3IE3.js → chunk-QUXX2DP7.js} +2 -2
  119. package/dist/cli/chunks/{chunk-T75PWWK4.js → chunk-QVNMTMDJ.js} +2 -2
  120. package/dist/cli/chunks/{chunk-3XF7YTQC.js → chunk-QZBFMXO5.js} +52 -52
  121. package/dist/cli/chunks/{chunk-BT6TZTCL.js → chunk-RDTR43YN.js} +2 -2
  122. package/dist/cli/chunks/{chunk-55T7PDYP.js → chunk-RGD2CG23.js} +2 -2
  123. package/dist/cli/chunks/{chunk-NWYAV2UG.js → chunk-RQUSJEON.js} +2 -2
  124. package/dist/cli/chunks/{chunk-2AOAEMJG.js → chunk-RRSZ27A7.js} +2 -2
  125. package/dist/cli/chunks/{chunk-6XLCFDIB.js → chunk-RWLOERKK.js} +2 -2
  126. package/dist/cli/chunks/{chunk-5YS2DF5G.js → chunk-RWQDRPN5.js} +2 -2
  127. package/dist/cli/chunks/{chunk-CFDIYZGA.js → chunk-S7D4GD7H.js} +2 -2
  128. package/dist/cli/chunks/{chunk-NLY5NUHZ.js → chunk-SKHP5WUP.js} +2 -2
  129. package/dist/cli/chunks/{chunk-HMDSBWF6.js → chunk-SP2JO53K.js} +2 -2
  130. package/dist/cli/chunks/{chunk-WJ7657IX.js → chunk-SRDECRTL.js} +2 -2
  131. package/dist/cli/chunks/{chunk-CRYZXTSQ.js → chunk-TBVPNN65.js} +2 -2
  132. package/dist/cli/chunks/{chunk-UX4BOI6K.js → chunk-U5AVZ3T2.js} +1 -1
  133. package/dist/cli/chunks/{chunk-ZSKQPXRW.js → chunk-UCSGZVJX.js} +1 -1
  134. package/dist/cli/chunks/{chunk-URWT3EQT.js → chunk-UGNTLSBL.js} +2 -2
  135. package/dist/cli/chunks/{chunk-IM67YHDK.js → chunk-UTALYUMW.js} +2 -2
  136. package/dist/cli/chunks/{chunk-FCMCQ6OX.js → chunk-UZDTRCVU.js} +2 -2
  137. package/dist/cli/chunks/{chunk-WUSSZ2S6.js → chunk-V5NYGDSX.js} +2 -2
  138. package/dist/cli/chunks/{chunk-KTLYL3BS.js → chunk-VGN46ZT4.js} +2 -2
  139. package/dist/cli/chunks/{chunk-MOSXT6AO.js → chunk-VHBZADYK.js} +2 -2
  140. package/dist/cli/chunks/{chunk-6OL2WES5.js → chunk-VOKIUF7I.js} +1 -1
  141. package/dist/cli/chunks/{chunk-HYWW4A2E.js → chunk-VRT736E3.js} +2 -2
  142. package/dist/cli/chunks/{chunk-Z7XCXHEB.js → chunk-VUBLJBHQ.js} +2 -2
  143. package/dist/cli/chunks/{chunk-6O4KVU4K.js → chunk-VX7CQUO7.js} +2 -2
  144. package/dist/cli/chunks/{chunk-YYVLMW65.js → chunk-W7EHNX3Y.js} +2 -2
  145. package/dist/cli/chunks/{chunk-J4EJMAH3.js → chunk-WI7I6LMM.js} +1 -1
  146. package/dist/cli/chunks/{chunk-5TEPPW4J.js → chunk-WLOHTLHO.js} +2 -2
  147. package/dist/cli/chunks/{chunk-WBCE6V2N.js → chunk-WQZBKLAG.js} +1 -1
  148. package/dist/cli/chunks/{chunk-YH7VOLBP.js → chunk-WSND64RL.js} +2 -2
  149. package/dist/cli/chunks/{chunk-D75HDHX3.js → chunk-WSUYEVSY.js} +1 -1
  150. package/dist/cli/chunks/{chunk-HXT4XDQO.js → chunk-WTMLRMKW.js} +2 -2
  151. package/dist/cli/chunks/{chunk-FRZVLRVR.js → chunk-WW4RJ6BH.js} +2 -2
  152. package/dist/cli/chunks/{chunk-QR5ILM34.js → chunk-X335K4SU.js} +2 -2
  153. package/dist/cli/chunks/{chunk-326V7N25.js → chunk-X33LID2T.js} +1 -1
  154. package/dist/cli/chunks/{chunk-NL6HKEPR.js → chunk-XTGVGZ4J.js} +3 -3
  155. package/dist/cli/chunks/{chunk-AXJ75X6I.js → chunk-XV2TIODR.js} +1 -1
  156. package/dist/cli/chunks/{chunk-2JEPRQMT.js → chunk-XXW4KFBB.js} +1 -1
  157. package/dist/cli/chunks/{chunk-TZH2QAFZ.js → chunk-YCGU2LI7.js} +2 -2
  158. package/dist/cli/chunks/chunk-YGEC3PSD.js +2 -0
  159. package/dist/cli/chunks/{chunk-W7P7EOJ4.js → chunk-YGKU2QRC.js} +1 -1
  160. package/dist/cli/chunks/{chunk-XQBH3366.js → chunk-YHZGFWJE.js} +2 -2
  161. package/dist/cli/chunks/{chunk-E6GANSLP.js → chunk-YJH7UFA2.js} +2 -2
  162. package/dist/cli/chunks/{chunk-IBAXNCR2.js → chunk-YQ3ZW47V.js} +2 -2
  163. package/dist/cli/chunks/{chunk-MYDZBABD.js → chunk-YTRGMILO.js} +2 -2
  164. package/dist/cli/chunks/chunk-YW4GM36K.js +2 -0
  165. package/dist/cli/chunks/{chunk-W5EKSBS4.js → chunk-Z7JPWXW2.js} +2 -2
  166. package/dist/cli/chunks/{chunk-2AWU2E6R.js → chunk-Z7UGEQ4G.js} +1 -1
  167. package/dist/cli/chunks/{chunk-B4H66LPR.js → chunk-ZATQLTYL.js} +1 -1
  168. package/dist/cli/chunks/{chunk-N4MNSEKY.js → chunk-ZI6NJEBY.js} +1 -1
  169. package/dist/cli/chunks/{chunk-YJSKT6G6.js → chunk-ZJW4HRUA.js} +1 -1
  170. package/dist/cli/chunks/{chunk-QB7H62A4.js → chunk-ZL2GYU7H.js} +2 -2
  171. package/dist/cli/chunks/{ci-JNBOR6FP.js → ci-JPISJ25U.js} +3 -3
  172. package/dist/cli/chunks/{ci-output-FYNKONEQ.js → ci-output-DPHTFIGX.js} +2 -2
  173. package/dist/cli/chunks/{circuit-breaker-KOIXRDAD.js → circuit-breaker-PQ65VU2M.js} +2 -2
  174. package/dist/cli/chunks/{claude-flow-setup-4CO7KHRN.js → claude-flow-setup-GKHVO7AD.js} +2 -2
  175. package/dist/cli/chunks/client-BS7I637W.js +2 -0
  176. package/dist/cli/chunks/{cline-installer-CMYAPKK5.js → cline-installer-HWMQZJ64.js} +2 -2
  177. package/dist/cli/chunks/{code-WFIAEP3H.js → code-OTY7BF3D.js} +3 -3
  178. package/dist/cli/chunks/{code-index-extractor-IYM6HWJN.js → code-index-extractor-FG3TMHHR.js} +2 -2
  179. package/dist/cli/chunks/{codex-installer-DORVWRSU.js → codex-installer-63JARKKS.js} +2 -2
  180. package/dist/cli/chunks/{completions-54VM2MX2.js → completions-4ZHONFML.js} +2 -2
  181. package/dist/cli/chunks/{complexity-analyzer-EGZDP5N4.js → complexity-analyzer-FYHTJW5Y.js} +2 -2
  182. package/dist/cli/chunks/{continuedev-installer-4SDVDD4T.js → continuedev-installer-ZAWDSUR3.js} +2 -2
  183. package/dist/cli/chunks/{copilot-installer-7FJQ7PCL.js → copilot-installer-5QK565JX.js} +2 -2
  184. package/dist/cli/chunks/core-handlers-UG7RMTK5.js +2 -0
  185. package/dist/cli/chunks/cost-tracker-AWWMPPBJ.js +2 -0
  186. package/dist/cli/chunks/{coverage-DI5LDRJ7.js → coverage-SMFQEGKE.js} +3 -3
  187. package/dist/cli/chunks/cross-domain-router-NX7F6TOF.js +2 -0
  188. package/dist/cli/chunks/{cursor-installer-RTSZP5YD.js → cursor-installer-3BL7JACV.js} +2 -2
  189. package/dist/cli/chunks/{daemon-LM7LETPV.js → daemon-OJ624POF.js} +4 -4
  190. package/dist/cli/chunks/{daemon-SP3APEZY.js → daemon-R6ULBHHF.js} +3 -3
  191. package/dist/cli/chunks/{dag-attention-scheduler-C3QBODFE.js → dag-attention-scheduler-J6I3LTMY.js} +2 -2
  192. package/dist/cli/chunks/{detect-I4RBUFFJ.js → detect-5Q5W33UR.js} +2 -2
  193. package/dist/cli/chunks/{dist-node-PT6TCBCO.js → dist-node-GJNW56NA.js} +2 -2
  194. package/dist/cli/chunks/{domain-handler-MJMTMB5X.js → domain-handler-IZQY2G44.js} +2 -2
  195. package/dist/cli/chunks/{domain-plugins-Y4A2WYJW.js → domain-plugins-PIGO3KI2.js} +2 -2
  196. package/dist/cli/chunks/{domain-transfer-DUO42TLA.js → domain-transfer-NU3B4FQG.js} +2 -2
  197. package/dist/cli/chunks/dream-GYEH57FW.js +2 -0
  198. package/dist/cli/chunks/{embed-and-insert-pattern-66ZQK4AI.js → embed-and-insert-pattern-5QDDRPWV.js} +2 -2
  199. package/dist/cli/chunks/{eval-NQ7H27UF.js → eval-TB5HOAUY.js} +2 -2
  200. package/dist/cli/chunks/{experience-capture-middleware-MHEYPTIG.js → experience-capture-middleware-SIYVLKDE.js} +3 -3
  201. package/dist/cli/chunks/{fast-paths-YYDGN6ZC.js → fast-paths-T7QELS6D.js} +2 -2
  202. package/dist/cli/chunks/{feature-flags-YFGUORHY.js → feature-flags-T3CNNYMJ.js} +2 -2
  203. package/dist/cli/chunks/{feature-flags-FY4DOYS2.js → feature-flags-TNZ7ZAJV.js} +2 -2
  204. package/dist/cli/chunks/{file-discovery-TOMDY7TK.js → file-discovery-M45P2ZCY.js} +2 -2
  205. package/dist/cli/chunks/{fleet-MO3UCWB4.js → fleet-DSBZPHBZ.js} +3 -3
  206. package/dist/cli/chunks/{gnn-wrapper-SLW4PPXQ.js → gnn-wrapper-EHODCF32.js} +2 -2
  207. package/dist/cli/chunks/{heartbeat-handler-36RFCP4E.js → heartbeat-handler-V5DBVF7V.js} +4 -4
  208. package/dist/cli/chunks/heartbeat-scheduler-4TJ3T7LR.js +2 -0
  209. package/dist/cli/chunks/hnsw-adapter-PHFK4EAP.js +2 -0
  210. package/dist/cli/chunks/hnsw-index-434XDDBH.js +2 -0
  211. package/dist/cli/chunks/{hnsw-legacy-bridge-BJLWBKHE.js → hnsw-legacy-bridge-IYKDYA2F.js} +2 -2
  212. package/dist/cli/chunks/{hnswlib-node-RAYNVJCJ.js → hnswlib-node-DKG4LW3X.js} +2 -2
  213. package/dist/cli/chunks/{hooks-JMHFWVEQ.js → hooks-VKNMAILY.js} +10 -10
  214. package/dist/cli/chunks/hybrid-backend-DYVJQENQ.js +2 -0
  215. package/dist/cli/chunks/{hypergraph-engine-JUDBKPOX.js → hypergraph-engine-AXZVP7A7.js} +2 -2
  216. package/dist/cli/chunks/{hypergraph-handler-AXTWXOZU.js → hypergraph-handler-6EO6JN4Z.js} +3 -3
  217. package/dist/cli/chunks/impact-analyzer-CBAST6M2.js +2 -0
  218. package/dist/cli/chunks/{init-handler-PARJNZFF.js → init-handler-N3NG3RHN.js} +6 -6
  219. package/dist/cli/chunks/init-wizard-DWIJW7HY.js +2 -0
  220. package/dist/cli/chunks/kernel-AQGCS4X2.js +2 -0
  221. package/dist/cli/chunks/{kilocode-installer-22HX2E4V.js → kilocode-installer-JICGAHLM.js} +2 -2
  222. package/dist/cli/chunks/{kiro-installer-OVPBLY7J.js → kiro-installer-VYBFP6ZH.js} +2 -2
  223. package/dist/cli/chunks/knowledge-graph-2ICXFUUV.js +2 -0
  224. package/dist/cli/chunks/{learning-DWXPJ3R6.js → learning-3BHEZEPK.js} +3 -3
  225. package/dist/cli/chunks/{llm-router-7PPVVKNG.js → llm-router-GPTEZCUN.js} +4 -4
  226. package/dist/cli/chunks/llm-router-service-C47RGTH6.js +2 -0
  227. package/dist/cli/chunks/{load-VI5XHNZA.js → load-W5BIRPU4.js} +2 -2
  228. package/dist/cli/chunks/load-test-LRDAW3N6.js +2 -0
  229. package/dist/cli/chunks/{mcp-UW4Z3Z64.js → mcp-EBV4DZPG.js} +2 -2
  230. package/dist/cli/chunks/{memory-UD2KCB5M.js → memory-7F6YYKNL.js} +5 -5
  231. package/dist/cli/chunks/memory-backend-UFBAYPQ6.js +2 -0
  232. package/dist/cli/chunks/memory-handlers-OGLJHAAJ.js +2 -0
  233. package/dist/cli/chunks/{multi-model-executor-5O4WWU5Z.js → multi-model-executor-3ZIA2YOL.js} +2 -2
  234. package/dist/cli/chunks/{opencode-installer-DTRFDGM7.js → opencode-installer-2XRZUTLR.js} +2 -2
  235. package/dist/cli/chunks/{orchestrator-ENJIKV6Z.js → orchestrator-VSZVJUJW.js} +85 -26
  236. package/dist/cli/chunks/pattern-null-store-27FCITT3.js +2 -0
  237. package/dist/cli/chunks/{pattern-usage-recorder-QPNIU5PD.js → pattern-usage-recorder-I2IGVHRL.js} +2 -2
  238. package/dist/cli/chunks/{pipeline-G3JYDNPE.js → pipeline-5G3O6WBY.js} +2 -2
  239. package/dist/cli/chunks/{platform-P4WR6N3D.js → platform-6GUFDIA3.js} +2 -2
  240. package/dist/cli/chunks/{plugin-C7763Q5W.js → plugin-GYXE4CIC.js} +2 -2
  241. package/dist/cli/chunks/{prime-radiant-advanced-wasm-DH6R3XSZ.js → prime-radiant-advanced-wasm-THX6JLGZ.js} +2 -2
  242. package/dist/cli/chunks/{project-root-7DTXDLEG.js → project-root-QJRBKZQU.js} +2 -2
  243. package/dist/cli/chunks/protocol-executor-XWXXTMEW.js +2 -0
  244. package/dist/cli/chunks/{protocol-handler-EODULGOZ.js → protocol-handler-B54LRU26.js} +2 -2
  245. package/dist/cli/chunks/{prove-A7G3SIOF.js → prove-PCY2WQOD.js} +2 -2
  246. package/dist/cli/chunks/qe-reasoning-bank-3RMYXENE.js +2 -0
  247. package/dist/cli/chunks/{quality-JTURFUX3.js → quality-LPVDZC7U.js} +2 -2
  248. package/dist/cli/chunks/{quality-gate-M2EI754V.js → quality-gate-L3KXL6WE.js} +3 -3
  249. package/dist/cli/chunks/queen-coordinator-AS6DZ7UJ.js +2 -0
  250. package/dist/cli/chunks/{real-embeddings-DI7JMCG7.js → real-embeddings-N3H523PJ.js} +2 -2
  251. package/dist/cli/chunks/{ref-validation-MSFMNKDR.js → ref-validation-6BKDPHZ7.js} +2 -2
  252. package/dist/cli/chunks/{roocode-installer-XIMFFHOH.js → roocode-installer-NSGGTWXE.js} +2 -2
  253. package/dist/cli/chunks/router-OVNLNGHO.js +2 -0
  254. package/dist/cli/chunks/routing-feedback-TBOWEB6H.js +2 -0
  255. package/dist/cli/chunks/{routing-handler-MCDKNBQW.js → routing-handler-SRQNUBG3.js} +2 -2
  256. package/dist/cli/chunks/{ruvector-commands-OBSYAK2X.js → ruvector-commands-2IGULGDE.js} +2 -2
  257. package/dist/cli/chunks/rvf-dual-writer-YJYRCYGT.js +2 -0
  258. package/dist/cli/chunks/rvf-migration-adapter-VMRQ2SFO.js +2 -0
  259. package/dist/cli/chunks/{rvf-migration-coordinator-4DTRIHY6.js → rvf-migration-coordinator-ZD6WK5CK.js} +2 -2
  260. package/dist/cli/chunks/rvf-native-adapter-B75L3ALW.js +2 -0
  261. package/dist/cli/chunks/{rvf-store-integrity-CWAVMRC4.js → rvf-store-integrity-QULKUBBI.js} +2 -2
  262. package/dist/cli/chunks/safe-db-CRQHMCV6.js +2 -0
  263. package/dist/cli/chunks/schedule-L3DKJRXU.js +2 -0
  264. package/dist/cli/chunks/scheduler-VRHYUGY5.js +2 -0
  265. package/dist/cli/chunks/{security-74TWSO74.js → security-JW4EBARW.js} +3 -3
  266. package/dist/cli/chunks/{shared-rvf-adapter-ZHNAGE5H.js → shared-rvf-adapter-VQ7NJTGY.js} +2 -2
  267. package/dist/cli/chunks/{shared-rvf-dual-writer-BS5WAVCC.js → shared-rvf-dual-writer-SKTS52HK.js} +2 -2
  268. package/dist/cli/chunks/sqlite-persistence-JVAZETTL.js +2 -0
  269. package/dist/cli/chunks/{standalone-memory-3HGHTE7S.js → standalone-memory-3N4YJCSY.js} +2 -2
  270. package/dist/cli/chunks/{status-handler-XWEEGNGH.js → status-handler-5BQ2IIDG.js} +2 -2
  271. package/dist/cli/chunks/{structural-health-TB5JGMVS.js → structural-health-WGYR2RJB.js} +2 -2
  272. package/dist/cli/chunks/{sync-T4VLBURM.js → sync-DLKSXTIR.js} +2 -2
  273. package/dist/cli/chunks/sync-R5OKUBTQ.js +2 -0
  274. package/dist/cli/chunks/{task-handler-RQ65QKXX.js → task-handler-Z5KNTSUX.js} +2 -2
  275. package/dist/cli/chunks/{task-handlers-USYWJ4H2.js → task-handlers-RZFMYFSC.js} +3 -3
  276. package/dist/cli/chunks/test-LHWKZJRN.js +34 -0
  277. package/dist/cli/chunks/test-scheduling-EN7WXUMS.js +15 -0
  278. package/dist/cli/chunks/token-bootstrap-4V3OO4EC.js +2 -0
  279. package/dist/cli/chunks/{token-usage-CISTB5K5.js → token-usage-PFC2BYBS.js} +2 -2
  280. package/dist/cli/chunks/{transformers-C7LV763N.js → transformers-VZCC4SHC.js} +2 -2
  281. package/dist/cli/chunks/{tree-sitter-wasm-parser-P26JC3YV.js → tree-sitter-wasm-parser-ZYDQXGKN.js} +2 -2
  282. package/dist/cli/chunks/{types-YMVMKIWB.js → types-I6AWHZZQ.js} +2 -2
  283. package/dist/cli/chunks/unified-memory-WOOCCIUM.js +2 -0
  284. package/dist/cli/chunks/unified-memory-hnsw-PDDHFLUB.js +2 -0
  285. package/dist/cli/chunks/unified-persistence-6ETD3JSC.js +2 -0
  286. package/dist/cli/chunks/{upgrade-U2REOPAW.js → upgrade-T7SG75PA.js} +2 -2
  287. package/dist/cli/chunks/{validate-NDTCKN7P.js → validate-YLYEHTY3.js} +2 -2
  288. package/dist/cli/chunks/{validate-swarm-OJUGVH5Q.js → validate-swarm-VTLTRUE3.js} +2 -2
  289. package/dist/cli/chunks/visual-security-O4OT2YPY.js +2 -0
  290. package/dist/cli/chunks/{web-tree-sitter-2CLRSA7K.js → web-tree-sitter-JUM7ZY5M.js} +2 -2
  291. package/dist/cli/chunks/{windsurf-installer-DSUJJ4PG.js → windsurf-installer-4KS2466T.js} +2 -2
  292. package/dist/cli/chunks/witness-chain-67JHPDCN.js +2 -0
  293. package/dist/cli/chunks/{witness-chain-TEGL4ZWB.js → witness-chain-E4X6TOCT.js} +2 -2
  294. package/dist/cli/chunks/witness-chain-repair-MB53OZO6.js +2 -0
  295. package/dist/cli/chunks/{witness-chain-verifier-SPXKFC67.js → witness-chain-verifier-LBWJHO7Y.js} +2 -2
  296. package/dist/cli/chunks/{witness-key-manager-EALOV4OV.js → witness-key-manager-5IHVMXHJ.js} +2 -2
  297. package/dist/cli/chunks/{workflow-PYI6HCAG.js → workflow-XUQXIRNE.js} +4 -4
  298. package/dist/cli/chunks/workflow-orchestrator-ZVFSNRYZ.js +2 -0
  299. package/dist/cli/chunks/wrappers-YVF5SQUN.js +2 -0
  300. package/dist/cli/commands/test.js +30 -12
  301. package/dist/cli/utils/generated-test-writer.d.ts +35 -0
  302. package/dist/cli/utils/generated-test-writer.js +44 -0
  303. package/dist/context/compiler.js +4 -1
  304. package/dist/coordination/consensus/providers/ollama-provider.js +16 -27
  305. package/dist/coordination/consensus/providers/openrouter-provider.js +13 -24
  306. package/dist/coordination/handlers/test-execution-handlers.js +4 -2
  307. package/dist/coordination/protocols/defect-investigation.js +4 -1
  308. package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +3 -3
  309. package/dist/domains/coverage-analysis/services/gap-detector.js +3 -1
  310. package/dist/domains/learning-optimization/services/learning-coordinator.js +4 -2
  311. package/dist/domains/test-execution/services/flaky-detector.js +8 -2
  312. package/dist/domains/test-execution/services/retry-handler.js +23 -20
  313. package/dist/domains/test-execution/services/test-executor.js +5 -2
  314. package/dist/domains/test-generation/services/test-generator.js +5 -2
  315. package/dist/governance/compliance-reporter.js +8 -7
  316. package/dist/governance/proof-envelope-integration.js +3 -1
  317. package/dist/init/phases/07-hooks.js +30 -4
  318. package/dist/init/phases/10-workers.js +42 -6
  319. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.d.ts +4 -1
  320. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +6 -2
  321. package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +2 -1
  322. package/dist/integrations/ruvector/coverage-router.d.ts +3 -1
  323. package/dist/integrations/ruvector/coverage-router.js +7 -6
  324. package/dist/integrations/ruvector/diff-risk-classifier.js +5 -4
  325. package/dist/integrations/ruvector/rvf-dual-writer.js +10 -1
  326. package/dist/integrations/vibium/runtime.js +2 -6
  327. package/dist/learning/dream/dream-engine.d.ts +5 -0
  328. package/dist/learning/dream/dream-engine.js +20 -3
  329. package/dist/learning/embedding-space.d.ts +18 -0
  330. package/dist/learning/embedding-space.js +33 -0
  331. package/dist/learning/rvf-pattern-store.js +19 -5
  332. package/dist/mcp/bundle.js +443 -441
  333. package/dist/mcp/handlers/handler-factory.js +3 -1
  334. package/dist/mcp/handlers/save-results-option.d.ts +62 -0
  335. package/dist/mcp/handlers/save-results-option.js +35 -0
  336. package/dist/mcp/protocol-server.js +22 -11
  337. package/dist/mcp/security/rate-limiter.d.ts +8 -1
  338. package/dist/mcp/security/rate-limiter.js +33 -4
  339. package/dist/mcp/services/session-resume.js +11 -0
  340. package/dist/mcp/services/session-store.d.ts +31 -2
  341. package/dist/mcp/services/session-store.js +84 -15
  342. package/dist/mcp/services/session-write-buffer.d.ts +55 -0
  343. package/dist/mcp/services/session-write-buffer.js +144 -0
  344. package/dist/memory/crdt/g-counter.js +10 -8
  345. package/dist/shared/embeddings/ollama-client.d.ts +1 -1
  346. package/dist/shared/embeddings/ollama-client.js +30 -31
  347. package/dist/shared/git/git-analyzer.d.ts +4 -1
  348. package/dist/shared/git/git-analyzer.js +9 -4
  349. package/dist/shared/llm/cost-tracker.js +8 -6
  350. package/dist/shared/llm/providers/azure-openai.js +5 -21
  351. package/dist/shared/llm/providers/bedrock.js +5 -21
  352. package/dist/shared/llm/providers/claude.js +5 -21
  353. package/dist/shared/llm/providers/cognitum.js +5 -17
  354. package/dist/shared/llm/providers/gemini.js +9 -23
  355. package/dist/shared/llm/providers/ollama.js +5 -21
  356. package/dist/shared/llm/providers/openai.js +5 -21
  357. package/dist/shared/llm/providers/openrouter.js +9 -23
  358. package/dist/shared/llm/providers/response-deadline.d.ts +3 -0
  359. package/dist/shared/llm/providers/response-deadline.js +100 -0
  360. package/dist/shared/llm/spend-ledger.js +3 -2
  361. package/dist/shared/metrics/code-metrics.d.ts +1 -0
  362. package/dist/shared/metrics/code-metrics.js +3 -44
  363. package/dist/shared/metrics/cognitive-complexity.d.ts +17 -0
  364. package/dist/shared/metrics/cognitive-complexity.js +108 -0
  365. package/dist/shared/npm-cli-invocation.d.ts +21 -0
  366. package/dist/shared/npm-cli-invocation.js +28 -0
  367. package/dist/shared/optional-module.js +24 -0
  368. package/dist/shared/test-runner-args.d.ts +42 -0
  369. package/dist/shared/test-runner-args.js +74 -0
  370. package/dist/shared/utils/safe-record.d.ts +18 -0
  371. package/dist/shared/utils/safe-record.js +28 -0
  372. package/dist/test-scheduling/executors/vitest-executor.js +23 -5
  373. package/dist/workers/quality-daemon/git-watcher.js +5 -0
  374. package/package.json +1 -1
  375. package/dist/adapters/ag-ui/json-patch-utils.d.ts +0 -136
  376. package/dist/adapters/ag-ui/json-patch-utils.js +0 -575
  377. package/dist/cli/chunks/adapter-EUIELRLI.js +0 -2
  378. package/dist/cli/chunks/aqe-learning-engine-LXRKHASR.js +0 -2
  379. package/dist/cli/chunks/base-4DSLX33Y.js +0 -2
  380. package/dist/cli/chunks/browser-workflow-AWCQLQZK.js +0 -2
  381. package/dist/cli/chunks/chunk-E2QHUMCR.js +0 -2
  382. package/dist/cli/chunks/chunk-I7ECEOFV.js +0 -2
  383. package/dist/cli/chunks/chunk-LW4BCFIV.js +0 -15
  384. package/dist/cli/chunks/chunk-QJGKL67W.js +0 -54
  385. package/dist/cli/chunks/chunk-X43HA3RF.js +0 -14
  386. package/dist/cli/chunks/chunk-Z3K4JZXQ.js +0 -4
  387. package/dist/cli/chunks/client-UJVHZXNQ.js +0 -2
  388. package/dist/cli/chunks/core-handlers-AFXZOSH3.js +0 -2
  389. package/dist/cli/chunks/cost-tracker-D6YSKTQC.js +0 -2
  390. package/dist/cli/chunks/cross-domain-router-ZLNVKLIR.js +0 -2
  391. package/dist/cli/chunks/dream-4OPJXXEG.js +0 -2
  392. package/dist/cli/chunks/heartbeat-scheduler-J5KLHO6C.js +0 -2
  393. package/dist/cli/chunks/hnsw-adapter-56P6XSFR.js +0 -2
  394. package/dist/cli/chunks/hnsw-index-GFZ6XCEW.js +0 -2
  395. package/dist/cli/chunks/hybrid-backend-TUBWJDDN.js +0 -2
  396. package/dist/cli/chunks/impact-analyzer-FXVGKS6B.js +0 -2
  397. package/dist/cli/chunks/init-wizard-LK73HQ7W.js +0 -2
  398. package/dist/cli/chunks/kernel-TCZDKRSI.js +0 -2
  399. package/dist/cli/chunks/knowledge-graph-TWMB2GH2.js +0 -2
  400. package/dist/cli/chunks/llm-router-service-HPDH3P77.js +0 -2
  401. package/dist/cli/chunks/load-test-HTYOUYSN.js +0 -2
  402. package/dist/cli/chunks/memory-backend-X5BE2MPK.js +0 -2
  403. package/dist/cli/chunks/memory-handlers-SQXMFX5X.js +0 -2
  404. package/dist/cli/chunks/pattern-null-store-OCQGQZU6.js +0 -2
  405. package/dist/cli/chunks/protocol-executor-CYEQHQCL.js +0 -2
  406. package/dist/cli/chunks/qe-reasoning-bank-GSTA5WJ4.js +0 -2
  407. package/dist/cli/chunks/queen-coordinator-Y2Q5RQL7.js +0 -2
  408. package/dist/cli/chunks/router-4QB5L4IW.js +0 -2
  409. package/dist/cli/chunks/routing-feedback-YBVHJY5L.js +0 -2
  410. package/dist/cli/chunks/rvf-dual-writer-T5B456SW.js +0 -2
  411. package/dist/cli/chunks/rvf-migration-adapter-2O2NL7ZF.js +0 -2
  412. package/dist/cli/chunks/rvf-native-adapter-RDB3GWTW.js +0 -2
  413. package/dist/cli/chunks/safe-db-YXVMLFU4.js +0 -2
  414. package/dist/cli/chunks/schedule-K6XWCCSK.js +0 -2
  415. package/dist/cli/chunks/scheduler-4MW22D6Q.js +0 -2
  416. package/dist/cli/chunks/sqlite-persistence-UVDHUSAU.js +0 -2
  417. package/dist/cli/chunks/sync-LSPNSVDI.js +0 -2
  418. package/dist/cli/chunks/test-M2XTKD62.js +0 -33
  419. package/dist/cli/chunks/test-scheduling-GYXJQHJL.js +0 -15
  420. package/dist/cli/chunks/token-bootstrap-OTEMRUFR.js +0 -2
  421. package/dist/cli/chunks/unified-memory-UUK77NSE.js +0 -2
  422. package/dist/cli/chunks/unified-memory-hnsw-JOUE6WNF.js +0 -2
  423. package/dist/cli/chunks/unified-persistence-3DRJGNQE.js +0 -2
  424. package/dist/cli/chunks/visual-security-EM7FQG5X.js +0 -2
  425. package/dist/cli/chunks/witness-chain-7NZ6IIUN.js +0 -2
  426. package/dist/cli/chunks/witness-chain-repair-ZWS5WXFL.js +0 -2
  427. package/dist/cli/chunks/workflow-orchestrator-3C3S5FIM.js +0 -2
  428. package/dist/cli/chunks/wrappers-NXJHGK3W.js +0 -2
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{a as v,b as k}from"./chunk-Z7XCXHEB.js";import{o as g,s as P}from"./chunk-3KXKJSKS.js";import{a as d,b as y,e as R}from"./chunk-3KTAMNKI.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
+ import{a as v,b as k}from"./chunk-VUBLJBHQ.js";import{o as g,s as P}from"./chunk-7SWHW5AC.js";import{a as d,b as y,e as R}from"./chunk-2GJJGO5D.js";R();import{randomUUID as M}from"crypto";var p=class{constructor(e){this.config=e}config;_status="idle";_lastResult;_lastRunAt;_nextRunAt;_totalExecutions=0;_successfulExecutions=0;_failedExecutions=0;_executionDurations=[];_recentResults=[];get status(){return this._status}get lastResult(){return this._lastResult}get lastRunAt(){return this._lastRunAt}get nextRunAt(){return this._nextRunAt}async initialize(){this._status="idle",this._nextRunAt=new Date(Date.now()+this.config.intervalMs)}async execute(e){let r=Date.now();this._status="running",this._lastRunAt=new Date,this._totalExecutions++;let n,t;for(let a=0;a<=this.config.retryCount;a++)try{if(e.signal.aborted)throw new Error("Worker execution aborted");t=await this.executeWithTimeout(()=>this.doExecute(e),this.config.timeoutMs,e.signal);break}catch(u){n=y(u),e.logger.warn(`Worker ${this.config.id} attempt ${a+1} failed: ${n.message}`),a<this.config.retryCount&&await this.delay(this.config.retryDelayMs)}let o=Date.now()-r;return t?(this._successfulExecutions++,this._lastResult=t):(this._failedExecutions++,t=this.createErrorResult(n,o),this._lastResult=t),this._executionDurations.push(o),this._executionDurations.length>100&&this._executionDurations.shift(),this._recentResults.push({timestamp:new Date,success:t.success,durationMs:o}),this._recentResults.length>5&&this._recentResults.shift(),this._nextRunAt=new Date(Date.now()+this.config.intervalMs),this._status=t.success?"idle":"error",await e.eventBus.publish({type:"worker.executed",workerId:this.config.id,timestamp:new Date,payload:{success:t.success,durationMs:o,findingsCount:t.findings.length,healthScore:t.metrics.healthScore}}),t}pause(){this._status!=="stopped"&&(this._status="paused")}resume(){this._status==="paused"&&(this._status="idle")}async stop(){this._status="stopped"}getHealth(){let e=this._executionDurations.length>0?this._executionDurations.reduce((n,t)=>n+t,0)/this._executionDurations.length:0,r=this._totalExecutions>0?this._successfulExecutions/this._totalExecutions:1;return{status:this._status,healthScore:Math.round(r*100),totalExecutions:this._totalExecutions,successfulExecutions:this._successfulExecutions,failedExecutions:this._failedExecutions,avgDurationMs:Math.round(e),recentResults:[...this._recentResults]}}async executeWithTimeout(e,r,n){return new Promise((t,o)=>{let a=setTimeout(()=>{o(new Error(`Worker execution timed out after ${r}ms`))},r),u=()=>{clearTimeout(a),o(new Error("Worker execution aborted"))};n.addEventListener("abort",u,{once:!0}),e().then(c=>{clearTimeout(a),n.removeEventListener("abort",u),t(c)}).catch(c=>{clearTimeout(a),n.removeEventListener("abort",u),o(c)})})}createErrorResult(e,r){return{workerId:this.config.id,timestamp:new Date,durationMs:r,success:!1,error:e.message,metrics:{itemsAnalyzed:0,issuesFound:0,healthScore:0,trend:"degrading",domainMetrics:{}},findings:[],recommendations:[]}}createResult(e,r,n,t){return{workerId:this.config.id,timestamp:new Date,durationMs:e,success:!0,metrics:r,findings:n,recommendations:t}}delay(e){return new Promise(r=>setTimeout(r,e))}generateId(){return`${Date.now()}-${M().slice(0,9)}`}};P();R();var W={id:"heartbeat-scheduler",name:"Heartbeat Scheduler",description:"Token-free maintenance: pattern promotion, stale detection, experience buffer monitoring",intervalMs:1800*1e3,priority:"normal",targetDomains:["learning-optimization"],enabled:!0,timeoutMs:6e4,retryCount:1,retryDelayMs:5e3},b=class extends p{lifecycleManager=null;dailyLogger;lastRunTimestamp=0;constructor(){super(W),this.dailyLogger=new k}async getLifecycleManager(){if(this.lifecycleManager)return this.lifecycleManager;try{let e=g();await e.initialize();let r=e.getDatabase();return this.lifecycleManager=v(r,{promotionRewardThreshold:.7,promotionMinOccurrences:2,promotionMinSuccessRate:.7,deprecationFailureThreshold:3,staleDaysThreshold:30,confidenceDecayRate:.01,minActiveConfidence:.3}),this.lifecycleManager}catch{return null}}getPendingExperienceCount(){try{return g().getDatabase().prepare("SELECT COUNT(*) as pending FROM qe_pattern_usage WHERE created_at > datetime('now', '-1 day')").get()?.pending??0}catch{return 0}}async doExecute(e){let r=Date.now();e.logger.info("Heartbeat scheduler running (token-free maintenance)");let n=[],t=[],o=await this.getLifecycleManager();if(!o)return e.logger.warn("Unified memory unavailable \u2014 returning zero-metric heartbeat"),this.createResult(Date.now()-r,{itemsAnalyzed:0,issuesFound:0,healthScore:50,trend:"stable",domainMetrics:{promoted:0,deprecated:0,decayed:0,stalePatterns:0,pendingExperiences:0,avgConfidence:0,avgSuccessRate:0}},[],[]);let a=0,u=0;try{let s=o.promoteEligiblePatterns();a=s.promoted,u=s.checked,a>0&&n.push({type:"heartbeat-promotion",severity:"info",domain:"learning-optimization",title:"Patterns Promoted",description:`${a} of ${u} short-term patterns promoted to long-term`})}catch(s){e.logger.warn("Pattern promotion failed",{error:d(s)})}let c=0,h=0;try{let s=o.deprecateStalePatterns();c=s.deprecated,h=s.checked,c>0&&n.push({type:"heartbeat-deprecation",severity:"low",domain:"learning-optimization",title:"Stale Patterns Deprecated",description:`${c} of ${h} patterns deprecated (stale, failed, or low confidence)`})}catch(s){e.logger.warn("Stale pattern detection failed",{error:d(s)})}let l=0;try{let s=this.lastRunTimestamp>0?(Date.now()-this.lastRunTimestamp)/864e5:1;l=o.applyConfidenceDecay(Math.min(s,7)).decayed}catch(s){e.logger.warn("Confidence decay failed",{error:d(s)})}let m=this.getPendingExperienceCount(),i={totalPatterns:0,activePatterns:0,deprecatedPatterns:0,promotedPatterns:0,shortTermPatterns:0,longTermPatterns:0,avgConfidence:0,avgSuccessRate:0,patternsNearDeprecation:0};try{i=o.getStats()}catch(s){e.logger.warn("Stats retrieval failed",{error:d(s)})}try{this.dailyLogger.log({timestamp:new Date,type:"pattern-promoted",summary:`Heartbeat: ${a} promoted, ${c} deprecated, ${l} decayed, ${m} pending exp, ${i.activePatterns} active patterns (avg conf: ${i.avgConfidence.toFixed(2)})`,details:{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,totalPatterns:i.totalPatterns,activePatterns:i.activePatterns,avgConfidence:i.avgConfidence,avgSuccessRate:i.avgSuccessRate}}),this.dailyLogger.flush()}catch(s){e.logger.warn("Daily log write failed",{error:d(s)})}this.lastRunTimestamp=Date.now(),i.activePatterns>0&&i.patternsNearDeprecation/i.activePatterns>.5&&t.push({priority:"p2",domain:"learning-optimization",action:"Review At-Risk Patterns",description:`${i.patternsNearDeprecation} of ${i.activePatterns} active patterns are near deprecation. Manual review recommended.`,estimatedImpact:"medium",effort:"low",autoFixable:!1});let f=this.calculateHealthScore(i,a,c),D=this.determineTrend(a,c,i.activePatterns),_=Math.max(u,h),x=a+c+i.patternsNearDeprecation;return e.logger.info("Heartbeat complete",{promoted:a,deprecated:c,decayed:l,pendingExperiences:m,healthScore:f}),this.createResult(Date.now()-r,{itemsAnalyzed:_,issuesFound:x,healthScore:f,trend:D,domainMetrics:{promoted:a,deprecated:c,decayed:l,stalePatterns:i.patternsNearDeprecation,pendingExperiences:m,avgConfidence:Number(i.avgConfidence.toFixed(3)),avgSuccessRate:Number(i.avgSuccessRate.toFixed(3))}},n,t)}calculateHealthScore(e,r,n){let t=70;if(t+=Math.min(15,r*5),e.avgConfidence>0&&(t+=Math.round((e.avgConfidence-.5)*30)),e.activePatterns>0){let o=n/e.activePatterns;t-=Math.round(o*20)}return e.activePatterns>0&&e.patternsNearDeprecation/e.activePatterns>.5&&(t-=10),Math.max(0,Math.min(100,Math.round(t)))}determineTrend(e,r,n){return n===0?"stable":e>r?"improving":r>e&&r/n>.1?"degrading":"stable"}};export{p as a,b};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{b as h}from"./chunk-D75HDHX3.js";function i(t,r){if(t.length!==r.length)throw new Error(`Vector length mismatch: ${t.length} vs ${r.length}`);let e=0,o=0,l=0;for(let n=0;n<t.length;n++)e+=t[n]*r[n],o+=t[n]*t[n],l+=r[n]*r[n];let u=Math.sqrt(o)*Math.sqrt(l);return u===0?0:e/u}function c(t){let r=Math.sqrt(t.reduce((e,o)=>e+o*o,0));return r===0?t.slice():t.map(e=>e/r)}function g(t){let r=0;for(let e=0;e<t.length;e++)r+=t[e]*t[e];return Math.sqrt(r)}var m=h(()=>{"use strict"});export{i as a,c as b,g as c,m as d};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
+ import{b as h}from"./chunk-WSUYEVSY.js";function i(t,r){if(t.length!==r.length)throw new Error(`Vector length mismatch: ${t.length} vs ${r.length}`);let e=0,o=0,l=0;for(let n=0;n<t.length;n++)e+=t[n]*r[n],o+=t[n]*t[n],l+=r[n]*r[n];let u=Math.sqrt(o)*Math.sqrt(l);return u===0?0:e/u}function c(t){let r=Math.sqrt(t.reduce((e,o)=>e+o*o,0));return r===0?t.slice():t.map(e=>e/r)}function g(t){let r=0;for(let e=0;e<t.length;e++)r+=t[e]*t[e];return Math.sqrt(r)}var m=h(()=>{"use strict"});export{i as a,c as b,g as c,m as d};
@@ -1,5 +1,5 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{a as D,b as _,c as X,d as I,f as ne}from"./chunk-Y5VPLOA7.js";import{a as K,d as J}from"./chunk-DHSGCI6H.js";import{c as Z,d as ee,e as te,f as re}from"./chunk-M36DAETL.js";import{b as C,g as $,j as H}from"./chunk-BKZSTZDB.js";import{b as k}from"./chunk-JCB6K24D.js";import{d as Y}from"./chunk-UKRK3IE3.js";import{o as j,s as fe}from"./chunk-3KXKJSKS.js";import{n as U}from"./chunk-6WVEICL2.js";import{c as q,d as E}from"./chunk-2AWU2E6R.js";import{a as G}from"./chunk-I7ECEOFV.js";import{e as T}from"./chunk-CV7E627D.js";import{a as h,b as W,e as z}from"./chunk-3KTAMNKI.js";import{S as he,b as B}from"./chunk-3DCRAW43.js";G();z();var M={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var A=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
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.15.3");process.exit(0)}
2
+ import{a as D,b as _,c as X,d as I,f as ne}from"./chunk-EQGT4VLC.js";import{a as K,d as J}from"./chunk-6W6GZHQA.js";import{c as Z,d as ee,e as te,f as re}from"./chunk-JJBTM4JO.js";import{b as C,g as $,j as H}from"./chunk-3ZTBV6M3.js";import{b as k}from"./chunk-AOZJ6UUZ.js";import{d as Y}from"./chunk-QUXX2DP7.js";import{o as j,s as fe}from"./chunk-7SWHW5AC.js";import{p as U}from"./chunk-GPZH6OPP.js";import{c as q,d as E}from"./chunk-Z7UGEQ4G.js";import{a as G}from"./chunk-INVDDFJC.js";import{e as T}from"./chunk-FPFGN2Z5.js";import{a as h,b as W,e as z}from"./chunk-2GJJGO5D.js";import{S as he,b as B}from"./chunk-6TYTBQPV.js";G();z();var M={enableLearning:!0,enableGuidance:!0,enableRouting:!0,embeddingDimension:384,useONNXEmbeddings:!0,maxRoutingCandidates:10,routingWeights:{similarity:.3,performance:.4,capabilities:.3},coherenceThreshold:.4};var A=[{patternType:"test-template",name:"AAA Unit Test",description:"Arrange-Act-Assert pattern for clear, maintainable unit tests",template:{type:"code",content:`describe('{{className}}', () => {
3
3
  describe('{{methodName}}', () => {
4
4
  it('should {{expectedBehavior}}', {{async}} () => {
5
5
  // Arrange
@@ -317,4 +317,4 @@ On promotion:
317
317
  AND agent_id = 'aqe-hook-router'
318
318
  AND state_key = ?
319
319
  AND action_key = ?
320
- `);return s=>{try{let a=o.get(e,s);return a?{qValue:a.q_value,visits:a.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return D(e)}generateContext(e,r){return I(e,r||{})}checkAntiPatterns(e,r){return X(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-DI7JMCG7.js"),t=await r(e);if(t.length!==this.config.embeddingDimension)return ue(t,this.config.embeddingDimension);let n=U()?.spaceId;return n&&this.embeddingProvenance.set(t,n),t}catch(r){let{isUsingEndpoint:t}=await import("./real-embeddings-DI7JMCG7.js");if(t())throw r;process.env.DEBUG&&g.warn("ONNX embeddings unavailable, using hash fallback",{error:h(r)})}return de(e,this.config.embeddingDimension)}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let a of H)r[a]=e.byDomain[a]||0;let t=this.stats.routingRequests,n=this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,o=this.stats.learningOutcomes,s=this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0;try{let a=this.getSqliteStore().getAggregateOutcomeStats();a.routingRequests>t&&(t=a.routingRequests,n=a.avgRoutingConfidence),a.learningOutcomes>o&&(o=a.learningOutcomes,s=a.learningOutcomes>0?a.successfulOutcomes/a.learningOutcomes:a.avgPatternSuccessRate)}catch{}return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:t,avgRoutingConfidence:n,learningOutcomes:o,patternSuccessRate:s,patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function Et(i,e,r,t){return new V(i,e,r,t)}export{M as a,A as b,x as c,se as d,N as e,Q as f,V as g,Et as h};
320
+ `);return s=>{try{let a=o.get(e,s);return a?{qValue:a.q_value,visits:a.visits}:void 0}catch{return}}}catch{return()=>{}}}getGuidance(e,r){return D(e)}generateContext(e,r){return I(e,r||{})}checkAntiPatterns(e,r){return X(e,r)}async embed(e){if(this.config.useONNXEmbeddings)try{let{computeRealEmbedding:r}=await import("./real-embeddings-N3H523PJ.js"),t=await r(e);if(t.length!==this.config.embeddingDimension)return ue(t,this.config.embeddingDimension);let n=U()?.spaceId;return n&&this.embeddingProvenance.set(t,n),t}catch(r){let{isUsingEndpoint:t}=await import("./real-embeddings-N3H523PJ.js");if(t())throw r;process.env.DEBUG&&g.warn("ONNX embeddings unavailable, using hash fallback",{error:h(r)})}return de(e,this.config.embeddingDimension)}async getStats(){this.initialized||await this.initialize();let e=await this.patternStore.getStats(),r={};for(let a of H)r[a]=e.byDomain[a]||0;let t=this.stats.routingRequests,n=this.stats.routingRequests>0?this.stats.totalRoutingConfidence/this.stats.routingRequests:0,o=this.stats.learningOutcomes,s=this.stats.learningOutcomes>0?this.stats.successfulOutcomes/this.stats.learningOutcomes:0;try{let a=this.getSqliteStore().getAggregateOutcomeStats();a.routingRequests>t&&(t=a.routingRequests,n=a.avgRoutingConfidence),a.learningOutcomes>o&&(o=a.learningOutcomes,s=a.learningOutcomes>0?a.successfulOutcomes/a.learningOutcomes:a.avgPatternSuccessRate)}catch{}return{totalPatterns:e.totalPatterns,byDomain:r,routingRequests:t,avgRoutingConfidence:n,learningOutcomes:o,patternSuccessRate:s,patternStoreStats:e}}async dispose(){if(await this.patternStore.dispose(),this.sqliteStore&&(this.sqliteStore.close(),this.sqliteStore=null),this.rvfDualWriter){try{this.rvfDualWriter.close()}catch{}this.rvfDualWriter=null}this.initialized=!1}};function Et(i,e,r,t){return new V(i,e,r,t)}export{M as a,A as b,x as c,se as d,N as e,Q as f,V as g,Et as h};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{b as T}from"./chunk-D75HDHX3.js";var S,E,t,N,_=T(()=>{"use strict";S={MMAP_SIZE_BYTES:67108864,CACHE_SIZE_KB:-32e3,BUSY_TIMEOUT_MS:5e3,DEFAULT_VECTOR_DIMENSIONS:384,DEFAULT_SEARCH_LIMIT:100,CLEANUP_INTERVAL_MS:6e4,TTL_MULTIPLIER_MS:1e3},E={M_CONNECTIONS:16,EF_CONSTRUCTION:200,EF_SEARCH:100,DEFAULT_K_NEIGHBORS:10,COVERAGE_VECTOR_DIMENSION:384},t={MAX_CONCURRENT_AGENTS:15,DEFAULT_AGENT_TTL_MS:36e5,DEFAULT_AGENT_TIMEOUT_MS:12e4,MAX_POOL_SIZE:10},N={MAX_HISTORY_SIZE:1e4}});export{S as a,E as b,t as c,N as d,_ as e};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
+ import{b as T}from"./chunk-WSUYEVSY.js";var S,E,t,N,_=T(()=>{"use strict";S={MMAP_SIZE_BYTES:67108864,CACHE_SIZE_KB:-32e3,BUSY_TIMEOUT_MS:5e3,DEFAULT_VECTOR_DIMENSIONS:384,DEFAULT_SEARCH_LIMIT:100,CLEANUP_INTERVAL_MS:6e4,TTL_MULTIPLIER_MS:1e3},E={M_CONNECTIONS:16,EF_CONSTRUCTION:200,EF_SEARCH:100,DEFAULT_K_NEIGHBORS:10,COVERAGE_VECTOR_DIMENSION:384},t={MAX_CONCURRENT_AGENTS:15,DEFAULT_AGENT_TTL_MS:36e5,DEFAULT_AGENT_TIMEOUT_MS:12e4,MAX_POOL_SIZE:10},N={MAX_HISTORY_SIZE:1e4}});export{S as a,E as b,t as c,N as d,_ as e};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
2
  import*as p from"node:fs/promises";import*as o from"node:path";var S=new Set([".ts",".tsx",".js",".jsx",".mjs",".cjs",".py",".pyw",".go",".rs",".java",".kt",".kts",".rb",".cs",".php",".swift",".c",".h",".cpp",".hpp",".cc",".scala"]),E=new Set(["node_modules",".git","dist","build","coverage",".nyc_output","__pycache__",".venv","venv",".tox",".mypy_cache","target",".gradle","vendor",".bundle",".agentic-qe",".claude",".cache",".npm",".yarn",".next",".nuxt",".svelte-kit","out",".turbo","tmp","temp",".tmp"]);function x(l){return S.has(o.extname(l).toLowerCase())}async function _(l,y={}){let m=y.maxFiles??5e3,f=y.maxDepth??64;if(!Number.isSafeInteger(m)||m<1||!Number.isSafeInteger(f)||f<0)throw new Error("Security discovery requires a positive file limit and non-negative depth limit.");let a=[],i=[],h=[],n=o.resolve(l),c=!1,d=!1;function v(e,u){let r=u?.code;i.push({path:e,reason:typeof r=="string"&&/^[A-Z0-9_]{1,32}$/.test(r)?r:"DISCOVERY_FAILED"})}async function g(e,u){if(u>f){i.push({path:e,reason:"DEPTH_LIMIT"});return}let r;try{r=await p.readdir(e,{withFileTypes:!0})}catch(t){v(e,t),e===n&&(c=!0);return}r.sort((t,s)=>t.name<s.name?-1:t.name>s.name?1:0);for(let t of r){if(d)return;let s=o.join(e,t.name);if(t.isSymbolicLink())h.push(s);else if(t.isDirectory())E.has(t.name)?h.push(s):await g(s,u+1);else if(t.isFile()&&x(t.name)){if(a.length===m){i.push({path:s,reason:"FILE_LIMIT"}),d=!0;return}a.push(s)}}}try{let e=await p.lstat(n);e.isFile()?a.push(n):e.isDirectory()?await g(n,0):(c=!0,i.push({path:n,reason:e.isSymbolicLink()?"SYMLINK_TARGET":"NOT_REGULAR_INPUT"}))}catch(e){c=!0,v(n,e)}return{files:a,discovery:{status:c?"failed":i.length>0?"partial":"complete",policy:"aqe-security-source-files@1",issues:i,excludedPaths:h}}}export{x as a,_ as b};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{i as e}from"./chunk-Z3PANQUT.js";function g(t,n,r,a){return{id:e(),type:t,timestamp:new Date,source:n,correlationId:a,payload:r}}var i={TestGenerated:"test-generation.TestGenerated",TestSuiteCreated:"test-generation.TestSuiteCreated",PatternLearned:"test-generation.PatternLearned",GenerationFailed:"test-generation.GenerationFailed"},s={TestRunStarted:"test-execution.TestRunStarted",TestRunCompleted:"test-execution.TestRunCompleted",FlakyTestDetected:"test-execution.FlakyTestDetected",RetryTriggered:"test-execution.RetryTriggered"},o={CoverageReportCreated:"coverage-analysis.CoverageReportCreated",CoverageGapDetected:"coverage-analysis.CoverageGapDetected",RiskZoneIdentified:"coverage-analysis.RiskZoneIdentified"},d={QualityGateEvaluated:"quality-assessment.QualityGateEvaluated",DeploymentApproved:"quality-assessment.DeploymentApproved",DeploymentBlocked:"quality-assessment.DeploymentBlocked"},l={DefectPredicted:"defect-intelligence.DefectPredicted",RootCauseIdentified:"defect-intelligence.RootCauseIdentified",RegressionRiskAnalyzed:"defect-intelligence.RegressionRiskAnalyzed"},c={KnowledgeGraphUpdated:"code-intelligence.KnowledgeGraphUpdated",ImpactAnalysisCompleted:"code-intelligence.ImpactAnalysisCompleted",SemanticSearchCompleted:"code-intelligence.SemanticSearchCompleted",C4DiagramsGenerated:"code-intelligence.C4DiagramsGenerated"},m={VulnerabilityDetected:"security-compliance.VulnerabilityDetected",ComplianceValidated:"security-compliance.ComplianceValidated",SecurityAuditCompleted:"security-compliance.SecurityAuditCompleted"},p={PatternConsolidated:"learning-optimization.PatternConsolidated",TransferCompleted:"learning-optimization.TransferCompleted",OptimizationApplied:"learning-optimization.OptimizationApplied",DreamCycleCompleted:"learning-optimization.dream.completed"},y={...i,...s,...o,...d,...l,...c,...m,...p};export{g as a,i as b,s as c,o as d,d as e,l as f,c as g,m as h,p as i};
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.15.3");process.exit(0)}
2
+ import{i as e}from"./chunk-POTVF6BY.js";function g(t,n,r,a){return{id:e(),type:t,timestamp:new Date,source:n,correlationId:a,payload:r}}var i={TestGenerated:"test-generation.TestGenerated",TestSuiteCreated:"test-generation.TestSuiteCreated",PatternLearned:"test-generation.PatternLearned",GenerationFailed:"test-generation.GenerationFailed"},s={TestRunStarted:"test-execution.TestRunStarted",TestRunCompleted:"test-execution.TestRunCompleted",FlakyTestDetected:"test-execution.FlakyTestDetected",RetryTriggered:"test-execution.RetryTriggered"},o={CoverageReportCreated:"coverage-analysis.CoverageReportCreated",CoverageGapDetected:"coverage-analysis.CoverageGapDetected",RiskZoneIdentified:"coverage-analysis.RiskZoneIdentified"},d={QualityGateEvaluated:"quality-assessment.QualityGateEvaluated",DeploymentApproved:"quality-assessment.DeploymentApproved",DeploymentBlocked:"quality-assessment.DeploymentBlocked"},l={DefectPredicted:"defect-intelligence.DefectPredicted",RootCauseIdentified:"defect-intelligence.RootCauseIdentified",RegressionRiskAnalyzed:"defect-intelligence.RegressionRiskAnalyzed"},c={KnowledgeGraphUpdated:"code-intelligence.KnowledgeGraphUpdated",ImpactAnalysisCompleted:"code-intelligence.ImpactAnalysisCompleted",SemanticSearchCompleted:"code-intelligence.SemanticSearchCompleted",C4DiagramsGenerated:"code-intelligence.C4DiagramsGenerated"},m={VulnerabilityDetected:"security-compliance.VulnerabilityDetected",ComplianceValidated:"security-compliance.ComplianceValidated",SecurityAuditCompleted:"security-compliance.SecurityAuditCompleted"},p={PatternConsolidated:"learning-optimization.PatternConsolidated",TransferCompleted:"learning-optimization.TransferCompleted",OptimizationApplied:"learning-optimization.OptimizationApplied",DreamCycleCompleted:"learning-optimization.dream.completed"},y={...i,...s,...o,...d,...l,...c,...m,...p};export{g as a,i as b,s as c,o as d,d as e,l as f,c as g,m as h,p as i};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
2
  var i=class r{constructor(e){this._value=e;if(!e||e.trim()==="")throw new Error("FilePath cannot be empty")}_value;get value(){return this._value}get extension(){let e=this._value.split(".");return e.length>1?e[e.length-1]:""}get directory(){let e=this._value.lastIndexOf("/");return e>0?this._value.substring(0,e):""}get filename(){let e=this._value.lastIndexOf("/");return e>=0?this._value.substring(e+1):this._value}equals(e){return this._value===e._value}static create(e){return new r(e)}};var s=class r{constructor(e){this._value=e;if(e<0||e>1)throw new Error("RiskScore must be between 0 and 1")}_value;get value(){return this._value}get percentage(){return this._value*100}get level(){return this._value>=.8?"critical":this._value>=.6?"high":this._value>=.3?"medium":"low"}isHigherThan(e){return this._value>e._value}equals(e){return this._value===e._value}static create(e){return new r(e)}static fromPercentage(e){return new r(e/100)}},u=class r{constructor(e,t){this._start=e;this._end=t;if(e>t)throw new Error("Start date cannot be after end date")}_start;_end;get start(){return this._start}get end(){return this._end}get durationMs(){return this._end.getTime()-this._start.getTime()}get durationSeconds(){return this.durationMs/1e3}contains(e){return e>=this._start&&e<=this._end}overlaps(e){return this._start<=e._end&&e._start<=this._end}equals(e){return this._start.getTime()===e._start.getTime()&&this._end.getTime()===e._end.getTime()}static create(e,t){return new r(e,t)}static lastNDays(e){let t=new Date,n=new Date(t.getTime()-e*24*60*60*1e3);return new r(n,t)}},o=class r{constructor(e,t,n,a){this._major=e;this._minor=t;this._patch=n;this._prerelease=a}_major;_minor;_patch;_prerelease;get major(){return this._major}get minor(){return this._minor}get patch(){return this._patch}get prerelease(){return this._prerelease}toString(){let e=`${this._major}.${this._minor}.${this._patch}`;return this._prerelease?`${e}-${this._prerelease}`:e}isNewerThan(e){return this._major!==e._major?this._major>e._major:this._minor!==e._minor?this._minor>e._minor:this._patch>e._patch}equals(e){return this._major===e._major&&this._minor===e._minor&&this._patch===e._patch&&this._prerelease===e._prerelease}static create(e,t,n,a){return new r(e,t,n,a)}static parse(e){let t=e.match(/^(\d+)\.(\d+)\.(\d+)(?:-(.+))?$/);if(!t)throw new Error(`Invalid version format: ${e}`);return new r(parseInt(t[1]),parseInt(t[2]),parseInt(t[3]),t[4])}};export{i as a,s as b,u as c,o as d};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
2
  var l=["ECONNREFUSED","ETIMEOUT","ENOMEM","ENOSPC"];var s={successRate:.1,failureRate:1,viabilityThreshold:.3,rehabilitationThreshold:10,maxQuarantineDurationMs:6048e5,domainOverrides:{"security-compliance":{successRate:.05,failureRate:1,viabilityThreshold:.5},"test-generation":{successRate:.15,failureRate:1,viabilityThreshold:.2},"quality-assessment":{successRate:.1,failureRate:1,viabilityThreshold:.4}}},a=class{config;_witnessChain=null;set witnessChain(e){this._witnessChain=e}constructor(e={}){this.config={...s,...e,domainOverrides:{...s.domainOverrides,...e.domainOverrides}}}computeConfidenceUpdate(e,r,i){let{successRate:u,failureRate:o}=this.getConfigForDomain(i),n=r==="success"?u:-o;if(r==="failure")try{this._witnessChain?.append("HEBBIAN_PENALTY",{previousConfidence:e,delta:n,domain:i},"asymmetric-learning")}catch{}return c(e+n,0,1)}shouldQuarantine(e,r){let{viabilityThreshold:i}=this.getConfigForDomain(r);return{shouldQuarantine:e<i,confidence:e,viabilityThreshold:i,domain:r}}classifyFailure(e){if(e.infrastructureHealthy===!1||e.durationMs!==void 0&&e.durationMs>3e4)return"infrastructure";if(e.errorMessage){let r=e.errorMessage.toUpperCase();for(let i of l)if(r.includes(i))return"infrastructure"}return e.failureCategory==="infrastructure"?"infrastructure":(e.failureCategory==="pattern","pattern")}checkRehabilitation(e,r){let i=this.config.rehabilitationThreshold;return{canRehabilitate:e>=i,consecutiveSuccesses:e,requiredSuccesses:i,domain:r}}getConfigForDomain(e){return e&&this.config.domainOverrides?.[e]?this.config.domainOverrides[e]:{successRate:this.config.successRate,failureRate:this.config.failureRate,viabilityThreshold:this.config.viabilityThreshold}}getAsymmetryRatio(e){let{successRate:r,failureRate:i}=this.getConfigForDomain(e);return r===0?1/0:i/r}};function c(t,e,r){return t<e?e:t>r?r:t}export{a};
@@ -1,5 +1,5 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- var P="quality-daemon",x=class{constructor(e){this.backend=e}backend;async get(e){return this.backend.kvGet(e,P)}async set(e,t){await this.backend.kvSet(e,t,P)}async search(e){return this.backend.kvSearch(e,P)}};import{cpus as Z,freemem as ee,totalmem as te,loadavg as ie}from"os";var p=class{queues={now:[],next:[],later:[]};_maxSize;constructor(e=1e3){this._maxSize=e}enqueue(e){return this.size>=this._maxSize&&(this.pruneExpired(),this.size>=this._maxSize)?!1:(this.queues[e.priority].push(e),!0)}dequeue(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(;i.length>0;){let o=i.shift();if(!(o.ttlMs&&e-o.createdAt>o.ttlMs))return o}}}peek(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(let o of i)if(!o.ttlMs||e-o.createdAt<=o.ttlMs)return o}}drainPriority(e){let t=this.queues[e].splice(0),i=Date.now();return t.filter(o=>!o.ttlMs||i-o.createdAt<=o.ttlMs)}pruneExpired(){let e=0,t=Date.now();for(let i of["now","next","later"]){let o=this.queues[i].length;this.queues[i]=this.queues[i].filter(r=>!r.ttlMs||t-r.createdAt<=r.ttlMs),e+=o-this.queues[i].length}return e}get size(){return this.queues.now.length+this.queues.next.length+this.queues.later.length}get depths(){return{now:this.queues.now.length,next:this.queues.next.length,later:this.queues.later.length}}get isEmpty(){return this.size===0}clear(){this.queues.now=[],this.queues.next=[],this.queues.later=[]}};import{watch as G}from"fs";import{execFile as Q}from"child_process";import{promisify as $}from"util";import{resolve as q,join as H}from"path";import{existsSync as z,readFileSync as E}from"fs";var _=$(Q),L={repoRoot:process.cwd(),debounceMs:500,maxChangedFiles:200,pollIntervalMs:5e3},g=class{constructor(e,t){this.queue=e;this.options={...L,...t}}queue;watcher;pollTimer;options;lastKnownHeads=new Map;debounceTimer;_running=!1;_polling=!1;get running(){return this._running}async start(){if(this._running)return;let e=q(this.options.repoRoot,".git","refs","heads");if(!z(e))throw new Error(`Git refs directory not found: ${e}`);await this.snapshotHeads(),process.platform==="darwin"||process.platform==="win32"?this.watcher=G(e,{recursive:!0},(i,o)=>{o&&this.handleRefChange(o)}):(this.pollTimer=setInterval(()=>{this.poll().catch(i=>{console.debug("[GitWatcher] Poll error:",i)})},this.options.pollIntervalMs),this.pollTimer.unref?.()),this._running=!0}stop(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=void 0),this.watcher&&(this.watcher.close(),this.watcher=void 0),this._running=!1}async poll(){if(this._polling)return[];this._polling=!0;let e=[];try{let{stdout:t}=await _("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let i of t.trim().split(`
3
- `)){if(!i)continue;let[o,r]=i.split(" "),n=this.lastKnownHeads.get(o);n&&n!==r&&(e.push(o),await this.enqueueCommitAnalysis(o,r)),this.lastKnownHeads.set(o,r)}}catch{}finally{this._polling=!1}return e}handleRefChange(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.processRefChange(e).catch(t=>{console.debug("[GitWatcher] Error processing ref change:",t)})},this.options.debounceMs)}async processRefChange(e){let t=e.replace(/\\/g,"/"),i=q(this.options.repoRoot,".git","refs","heads"),o=H(i,e),r;try{r=E(o,"utf-8").trim()}catch{return}this.lastKnownHeads.get(t)!==r&&(this.lastKnownHeads.set(t,r),await this.enqueueCommitAnalysis(t,r))}async enqueueCommitAnalysis(e,t){let i=[];try{let{stdout:n}=await _("git",["diff-tree","--no-commit-id","--name-only","-r",t],{cwd:this.options.repoRoot});i=n.trim().split(`
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
+ import{a as R}from"./chunk-QSVNVDA5.js";var P="quality-daemon",x=class{constructor(e){this.backend=e}backend;async get(e){return this.backend.kvGet(e,P)}async set(e,t){await this.backend.kvSet(e,t,P)}async search(e){return this.backend.kvSearch(e,P)}};import{cpus as ee,freemem as te,totalmem as ie,loadavg as oe}from"os";var p=class{queues={now:[],next:[],later:[]};_maxSize;constructor(e=1e3){this._maxSize=e}enqueue(e){return this.size>=this._maxSize&&(this.pruneExpired(),this.size>=this._maxSize)?!1:(this.queues[e.priority].push(e),!0)}dequeue(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(;i.length>0;){let o=i.shift();if(!(o.ttlMs&&e-o.createdAt>o.ttlMs))return o}}}peek(){let e=Date.now();for(let t of["now","next","later"]){let i=this.queues[t];for(let o of i)if(!o.ttlMs||e-o.createdAt<=o.ttlMs)return o}}drainPriority(e){let t=this.queues[e].splice(0),i=Date.now();return t.filter(o=>!o.ttlMs||i-o.createdAt<=o.ttlMs)}pruneExpired(){let e=0,t=Date.now();for(let i of["now","next","later"]){let o=this.queues[i].length;this.queues[i]=this.queues[i].filter(r=>!r.ttlMs||t-r.createdAt<=r.ttlMs),e+=o-this.queues[i].length}return e}get size(){return this.queues.now.length+this.queues.next.length+this.queues.later.length}get depths(){return{now:this.queues.now.length,next:this.queues.next.length,later:this.queues.later.length}}get isEmpty(){return this.size===0}clear(){this.queues.now=[],this.queues.next=[],this.queues.later=[]}};import{watch as Q}from"fs";import{execFile as $}from"child_process";import{promisify as H}from"util";import{resolve as q,join as z}from"path";import{existsSync as E,readFileSync as L}from"fs";var _=H($),U={repoRoot:process.cwd(),debounceMs:500,maxChangedFiles:200,pollIntervalMs:5e3},g=class{constructor(e,t){this.queue=e;this.options={...U,...t}}queue;watcher;pollTimer;options;lastKnownHeads=new Map;debounceTimer;_running=!1;_polling=!1;get running(){return this._running}async start(){if(this._running)return;let e=q(this.options.repoRoot,".git","refs","heads");if(!E(e))throw new Error(`Git refs directory not found: ${e}`);await this.snapshotHeads(),process.platform==="darwin"||process.platform==="win32"?this.watcher=Q(e,{recursive:!0},(i,o)=>{o&&this.handleRefChange(o)}):(this.pollTimer=setInterval(()=>{this.poll().catch(i=>{console.debug("[GitWatcher] Poll error:",i)})},this.options.pollIntervalMs),this.pollTimer.unref?.()),this._running=!0}stop(){this.debounceTimer&&(clearTimeout(this.debounceTimer),this.debounceTimer=void 0),this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=void 0),this.watcher&&(this.watcher.close(),this.watcher=void 0),this._running=!1}async poll(){if(this._polling)return[];this._polling=!0;let e=[];try{let{stdout:t}=await _("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let i of t.trim().split(`
3
+ `)){if(!i)continue;let[o,r]=i.split(" "),n=this.lastKnownHeads.get(o);n&&n!==r&&(e.push(o),await this.enqueueCommitAnalysis(o,r)),this.lastKnownHeads.set(o,r)}}catch{}finally{this._polling=!1}return e}handleRefChange(e){this.debounceTimer&&clearTimeout(this.debounceTimer),this.debounceTimer=setTimeout(()=>{this.processRefChange(e).catch(t=>{console.debug("[GitWatcher] Error processing ref change:",t)})},this.options.debounceMs)}async processRefChange(e){let t=e.replace(/\\/g,"/"),i=q(this.options.repoRoot,".git","refs","heads"),o=z(i,e),r;try{r=L(o,"utf-8").trim()}catch{return}this.lastKnownHeads.get(t)!==r&&(this.lastKnownHeads.set(t,r),await this.enqueueCommitAnalysis(t,r))}async enqueueCommitAnalysis(e,t){if(R(t,"commit hash"))return;let i=[];try{let{stdout:n}=await _("git",["diff-tree","--no-commit-id","--name-only","-r",t],{cwd:this.options.repoRoot});i=n.trim().split(`
4
4
  `).filter(Boolean).slice(0,this.options.maxChangedFiles)}catch{}let o={type:"git_commit",branch:e,commitHash:t,changedFiles:i},r={id:`git-${t}-${Date.now()}`,priority:"next",payload:o,createdAt:Date.now(),source:"git-watcher",ttlMs:300*1e3};this.queue.enqueue(r)}async snapshotHeads(){try{let{stdout:e}=await _("git",["for-each-ref","--format=%(refname:short) %(objectname:short)","refs/heads/"],{cwd:this.options.repoRoot});for(let t of e.trim().split(`
5
- `)){if(!t)continue;let[i,o]=t.split(" ");this.lastKnownHeads.set(i,o)}}catch{}}};var U={regressionThreshold:2,gapThreshold:60,memoryPrefix:"quality-daemon:coverage"},f=class{constructor(e,t){this.queue=e;this.options={...U,...t}}queue;options;async analyze(e,t,i){let o=await t.get(`${this.options.memoryPrefix}:snapshot`);if(await t.set(`${this.options.memoryPrefix}:snapshot`,e),!o)return{regressionDetected:!1,overallDelta:{line:0,branch:0,function:0,statement:0},affectedFiles:[],newGaps:[]};let r=o,n={line:e.overall.line-r.overall.line,branch:e.overall.branch-r.overall.branch,function:e.overall.function-r.overall.function,statement:e.overall.statement-r.overall.statement},s=n.line<-this.options.regressionThreshold||n.branch<-this.options.regressionThreshold,a=i??Object.keys(e.files),u=[],c=[];for(let d of a){let l=e.files[d],m=r.files[d];if(!l)continue;let M=m?l.line-m.line:0,I=m?l.branch-m.branch:0,D=m?l.uncoveredLines.filter(T=>!m.uncoveredLines.includes(T)):l.uncoveredLines;if((M!==0||I!==0||D.length>0)&&u.push({file:d,lineDelta:M,branchDelta:I,newUncoveredLines:D}),l.line<this.options.gapThreshold){let T=this.computeRiskScore(l,D.length);c.push({file:d,uncoveredLines:l.uncoveredLines,currentCoverage:l.line,riskScore:T})}}return(s||c.length>0)&&this.enqueueTestSuggestion(e,r,c),await t.set(`${this.options.memoryPrefix}:delta`,{timestamp:Date.now(),overallDelta:n,regressionDetected:s,affectedFileCount:u.length,gapCount:c.length}),{regressionDetected:s,overallDelta:n,affectedFiles:u,newGaps:c}}async buildSnapshot(e){let t=await e.get("coverage:latest");if(t)return{timestamp:Date.now(),overall:{line:t.line,branch:t.branch,function:t.function,statement:t.statement},files:t.files??{}}}computeRiskScore(e,t){let o=1-Math.min(100,Math.max(0,e.line))/100,r=Math.min(t/50,1);return Math.min(1,o*.6+r*.4)}enqueueTestSuggestion(e,t,i){let o={type:"coverage_delta",previousSnapshot:`snapshot-${t.timestamp}`,currentSnapshot:`snapshot-${e.timestamp}`},r={id:`coverage-delta-${Date.now()}`,priority:i.some(n=>n.riskScore>.8)?"now":"next",payload:o,createdAt:Date.now(),source:"coverage-delta",ttlMs:600*1e3};this.queue.enqueue(r)}};import{execFile as j}from"child_process";import{promisify as B}from"util";var J=B(j),K={runsPerWorkflow:10,flakyThreshold:3,repo:""},y=class{constructor(e,t){this.queue=e;this.options={...K,...t}}queue;options;async check(){let e=await this.fetchRecentRuns(),t=this.groupByWorkflow(e),i=[],o=[],r=0;for(let[s,a]of Object.entries(t)){let u=a.filter(m=>m.conclusion==="failure").length,c=a.length>0?(a.length-u)/a.length*100:100,d=this.countConsecutiveFailures(a),l=a[0]?.conclusion??"unknown";l==="failure"&&r++,d>=this.options.flakyThreshold&&(o.push(s),this.enqueueFailureAlert(s,a[0])),i.push({name:s,recentRuns:a.length,failedRuns:u,successRate:Math.round(c*10)/10,lastConclusion:l,consecutiveFailures:d})}let n=this.calculateHealthScore(i);return{timestamp:Date.now(),workflows:i,failingWorkflows:r,flakyWorkflows:o,healthScore:n}}async fetchRecentRuns(){try{let e=["run","list","--limit",String(this.options.runsPerWorkflow*5),"--json","name,status,conclusion,headBranch,number,databaseId,createdAt"];this.options.repo&&e.push("--repo",this.options.repo);let{stdout:t}=await J("gh",e,{timeout:15e3});return JSON.parse(t).map(o=>({name:o.name,status:o.status,conclusion:o.conclusion??"pending",headBranch:o.headBranch,runNumber:o.number,databaseId:o.databaseId,createdAt:o.createdAt}))}catch{return[]}}groupByWorkflow(e){let t={};for(let i of e)t[i.name]||(t[i.name]=[]),t[i.name].push(i);for(let i of Object.keys(t))t[i]=t[i].slice(0,this.options.runsPerWorkflow);return t}countConsecutiveFailures(e){let t=0;for(let i of e)if(i.conclusion==="failure")t++;else break;return t}calculateHealthScore(e){if(e.length===0)return 100;let t=e.reduce((i,o)=>i+o.successRate,0)/e.length;return Math.round(t)}enqueueFailureAlert(e,t){let i={type:"ci_failure",workflowName:e,runId:t.databaseId,conclusion:t.conclusion},o={id:`ci-failure-${e}-${Date.now()}`,priority:"now",payload:i,createdAt:Date.now(),source:"ci-monitor",ttlMs:1800*1e3};this.queue.enqueue(o)}};var V={memoryPrefix:"quality-daemon:suggestions",maxSuggestions:100,minRiskScore:.3},v=class{options;constructor(e){this.options={...V,...e}}async suggest(e,t,i){let o=[],r=e.filter(s=>s.riskScore>=this.options.minRiskScore);for(let s of r){let a=t.includes(s.file),u=this.determinePriority(s,a),c=this.determineTestType(s.file),d=this.estimateEffort(s);o.push({id:`suggestion-${Date.now()}-${o.length}`,file:s.file,uncoveredLines:s.uncoveredLines.slice(0,50),suggestedTestType:c,description:this.generateDescription(s,c),priority:u,estimatedEffort:d,createdAt:Date.now(),status:"pending"})}o.sort((s,a)=>{let u={high:0,medium:1,low:2};return u[s.priority]-u[a.priority]});let n=o.slice(0,this.options.maxSuggestions);return await this.storeSuggestions(n,i),n}async getPending(e){return(await e.get(`${this.options.memoryPrefix}:list`)??[]).filter(i=>i.status==="pending")}async updateStatus(e,t,i){let o=await i.get(`${this.options.memoryPrefix}:list`);if(!o)return!1;let r=o.findIndex(s=>s.id===e);if(r===-1)return!1;let n=o.map((s,a)=>a===r?{...s,status:t}:s);return await i.set(`${this.options.memoryPrefix}:list`,n),!0}determinePriority(e,t){return e.riskScore>.8?"high":t||e.riskScore>.5?"medium":"low"}determineTestType(e){return e.includes("/api/")||e.includes("/routes/")||e.includes("/handlers/")?"integration":e.includes("/e2e/")||e.includes("/pages/")||e.includes("/views/")?"e2e":"unit"}estimateEffort(e){return e.uncoveredLines.length<=10?"small":e.uncoveredLines.length<=50?"medium":"large"}generateDescription(e,t){let i=e.uncoveredLines.length,o=Math.round(e.currentCoverage);return`Add ${t} tests for ${e.file} (${i} uncovered lines, ${o}% coverage, risk ${(e.riskScore*100).toFixed(0)}%)`}async storeSuggestions(e,t){let r=[...(await t.get(`${this.options.memoryPrefix}:list`)??[]).filter(n=>n.status!=="pending"),...e].slice(-this.options.maxSuggestions);await t.set(`${this.options.memoryPrefix}:list`,r),await t.set(`${this.options.memoryPrefix}:count`,{pending:e.length,total:r.length,lastUpdated:Date.now()})}};var Y={memoryPrefix:"quality-daemon:nightly",maxEntryAge:6048e5,nightlyHour:2},w=class{constructor(e,t){this.queue=e;this.options={...Y,...t}}queue;options;lastRunDate;shouldRun(){let e=new Date,t=e.toISOString().split("T")[0];return this.lastRunDate===t?!1:e.getHours()>=this.options.nightlyHour}scheduleIfDue(){if(!this.shouldRun())return!1;let e={type:"nightly",tasks:["consolidate_patterns","prune_expired","generate_report"]},t={id:`nightly-${Date.now()}`,priority:"later",payload:e,createdAt:Date.now(),source:"nightly-consolidation",ttlMs:720*60*1e3};return this.queue.enqueue(t)}async execute(e,t){let i=Date.now(),o=new Date().toISOString().split("T")[0],r=await this.consolidatePatterns(e),n=await this.pruneExpired(e),s=this.generateReport(o,t);await e.set(`${this.options.memoryPrefix}:report:${o}`,s),this.lastRunDate=o;let a={timestamp:Date.now(),patternsConsolidated:r,entriesPruned:n,reportGenerated:!0,durationMs:Date.now()-i};return await e.set(`${this.options.memoryPrefix}:last-result`,a),a}async getLastResult(e){return e.get(`${this.options.memoryPrefix}:last-result`)}async consolidatePatterns(e){let t=await e.search("quality-daemon:*"),i=0;return await e.get("quality-daemon:suggestions:count")&&i++,await e.get("quality-daemon:coverage:delta")&&i++,i}async pruneExpired(e){let t=await e.search("quality-daemon:*"),i=0,o=Date.now();for(let r of t){if(r.endsWith(":snapshot")||r.endsWith(":list"))continue;let n=await e.get(r);n&&typeof n.timestamp=="number"&&o-n.timestamp>this.options.maxEntryAge&&(await e.set(r,{pruned:!0,prunedAt:o}),i++)}return i}generateReport(e,t){return{date:e,coverageHealth:t.coverageHealth??0,ciHealth:t.ciHealth??0,commitsAnalyzed:t.commitsAnalyzed??0,suggestionsGenerated:t.suggestionsGenerated??0,notificationsSent:t.notificationsSent??0,queueDepthAvg:t.queueDepthAvg??0,daemonUptime:t.uptimeSeconds??0}}};import{writeFileSync as R,mkdirSync as W,readdirSync as S,readFileSync as A,unlinkSync as N}from"fs";import{join as b,resolve as X}from"path";var F={notificationsDir:X(process.cwd(),".agentic-qe","notifications"),maxNotifications:200},k=class{notificationsDir;maxNotifications;webhookUrl;urlValidator;_sentCount=0;constructor(e){this.notificationsDir=e?.notificationsDir??F.notificationsDir,this.maxNotifications=e?.maxNotifications??F.maxNotifications,this.webhookUrl=e?.webhookUrl,this.urlValidator=e?.urlValidator}get sentCount(){return this._sentCount}initialize(){W(this.notificationsDir,{recursive:!0})}async send(e){let t={...e,id:`notif-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:Date.now(),read:!1};return this.writeToFile(t),this.webhookUrl&&await this.sendWebhook(t),this._sentCount++,this.pruneOldNotifications(),t}list(e){let t=e?.limit??50;try{let i=S(this.notificationsDir).filter(r=>r.endsWith(".json")).sort().reverse(),o=[];for(let r of i){if(o.length>=t)break;try{let n=A(b(this.notificationsDir,r),"utf-8"),s=JSON.parse(n);if(e?.unreadOnly&&s.read||e?.type&&s.type!==e.type)continue;o.push(s)}catch{}}return o}catch{return[]}}markRead(e){try{let t=S(this.notificationsDir).filter(n=>n.endsWith(`-${e}.json`));if(t.length===0)return!1;let i=b(this.notificationsDir,t[0]),r={...JSON.parse(A(i,"utf-8")),read:!0};return R(i,JSON.stringify(r,null,2)),!0}catch{return!1}}clear(){try{let e=S(this.notificationsDir).filter(t=>t.endsWith(".json"));for(let t of e)N(b(this.notificationsDir,t));return e.length}catch{return 0}}writeToFile(e){try{W(this.notificationsDir,{recursive:!0});let t=`${e.timestamp}-${e.id}.json`,i=b(this.notificationsDir,t);R(i,JSON.stringify(e,null,2))}catch(t){console.debug("[NotificationService] Failed to write notification:",t)}}async sendWebhook(e){if(this.webhookUrl){if(this.urlValidator&&!this.urlValidator(this.webhookUrl)){console.warn("[NotificationService] Webhook URL blocked by SSRF guard:",this.webhookUrl);return}try{let t=await fetch(this.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(5e3)});t.ok||console.debug(`[NotificationService] Webhook returned ${t.status}`)}catch(t){console.debug("[NotificationService] Webhook delivery failed:",t)}}}pruneOldNotifications(){try{let e=S(this.notificationsDir).filter(i=>i.endsWith(".json")).sort();if(e.length<=this.maxNotifications)return;let t=e.slice(0,e.length-this.maxNotifications);for(let i of t)N(b(this.notificationsDir,i))}catch{}}};var C={tickIntervalMs:3e4,ciPollIntervalMs:5*6e4,coverageCheckIntervalMs:2*6e4,cpuThreshold:.7,memoryThreshold:.8},O=class{queue;gitWatcher;coverageDelta;ciMonitor;testSuggester;nightlyConsolidation;notificationService;tickTimer;_running=!1;_startedAt=0;_tickCount=0;_lastTickAt;_throttled=!1;_commitsAnalyzed=0;_suggestionsGenerated=0;_ciHealth=100;_coverageHealth=100;_lastCICheck;_lastCoverageCheck;_memory;config;constructor(e){this.config={tickIntervalMs:e?.tickIntervalMs??C.tickIntervalMs,ciPollIntervalMs:e?.ciPollIntervalMs??C.ciPollIntervalMs,coverageCheckIntervalMs:e?.coverageCheckIntervalMs??C.coverageCheckIntervalMs,cpuThreshold:e?.cpuThreshold??C.cpuThreshold,memoryThreshold:e?.memoryThreshold??C.memoryThreshold},this.queue=new p,this.gitWatcher=new g(this.queue,e?.git),this.coverageDelta=new f(this.queue,e?.coverage),this.ciMonitor=new y(this.queue,e?.ci),this.testSuggester=new v(e?.suggestions),this.nightlyConsolidation=new w(this.queue,e?.nightly),this.notificationService=new k(e?.notifications)}get running(){return this._running}async start(e){this._running||(this._memory=e,this._running=!0,this._startedAt=Date.now(),this.notificationService.initialize(),await this.gitWatcher.start().catch(t=>{console.debug("[QualityDaemon] Git watcher failed to start:",t)}),this.scheduleTick())}async stop(){this._running&&(this._running=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=void 0),this.gitWatcher.stop(),this._memory&&await this._memory.set("quality-daemon:state",{stoppedAt:Date.now(),tickCount:this._tickCount,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated}))}getStatus(){return{running:this._running,uptimeSeconds:this._running?Math.floor((Date.now()-this._startedAt)/1e3):0,tickCount:this._tickCount,queueDepth:this.queue.depths,lastTickAt:this._lastTickAt,throttled:this._throttled,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,ciHealth:this._ciHealth,coverageHealth:this._coverageHealth,lastCICheck:this._lastCICheck,lastCoverageCheck:this._lastCoverageCheck}}scheduleTick(){this._running&&(this.tickTimer=setTimeout(()=>this.tick(),this.config.tickIntervalMs),this.tickTimer.unref?.())}async tick(){if(!(!this._running||!this._memory)){if(this._tickCount++,this._lastTickAt=Date.now(),this._throttled=this.isResourceConstrained(),this._throttled){await this.processNowItems(this._memory),this.scheduleTick();return}await this.processQueue(this._memory),await this.runPeriodicChecks(this._memory),this.nightlyConsolidation.scheduleIfDue(),this.queue.pruneExpired(),this.scheduleTick()}}async processQueue(e){let t=0,i=10;for(;t<i&&!this.queue.isEmpty;){let o=this.queue.dequeue();if(!o)break;await this.handleQueueItem(o,e),t++}}async processNowItems(e){let t=this.queue.drainPriority("now");for(let i of t)await this.handleQueueItem(i,e)}async handleQueueItem(e,t){let i=e.payload;switch(i.type){case"git_commit":{this._commitsAnalyzed++;let o=await this.coverageDelta.buildSnapshot(t);if(o){let r=await this.coverageDelta.analyze(o,t,i.changedFiles);if(r.regressionDetected&&await this.notificationService.send({type:"coverage_drop",title:"Coverage Regression Detected",message:`Line coverage delta: ${r.overallDelta.line.toFixed(1)}% (${r.affectedFiles.length} files affected)`,severity:"high",metadata:{delta:r.overallDelta,commit:i.commitHash}}),r.newGaps.length>0){let n=await this.testSuggester.suggest(r.newGaps,i.changedFiles,t);this._suggestionsGenerated+=n.length,n.length>0&&await this.notificationService.send({type:"suggestion_available",title:"New Test Suggestions Available",message:`${n.length} test suggestions generated for uncovered code`,severity:"info",metadata:{count:n.length}})}}break}case"coverage_delta":{let o=await this.testSuggester.getPending(t);o.length>0&&await this.notificationService.send({type:"suggestion_available",title:"Test Suggestions Pending",message:`${o.length} test suggestions awaiting review`,severity:"info",metadata:{count:o.length}});break}case"gate_failure":await this.notificationService.send({type:"gate_failure",title:`Quality Gate Failed: ${i.gateName}`,message:`Score ${i.score} below threshold ${i.threshold}`,severity:"critical",metadata:{gate:i.gateName,score:i.score,threshold:i.threshold}});break;case"ci_failure":await this.notificationService.send({type:"ci_failure",title:`CI Failure: ${i.workflowName}`,message:`Workflow ${i.workflowName} run #${i.runId} concluded: ${i.conclusion}`,severity:"high",metadata:{workflow:i.workflowName,runId:i.runId}});break;case"nightly":{let o={coverageHealth:this._coverageHealth,ciHealth:this._ciHealth,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,queueDepthAvg:this.queue.size,uptimeSeconds:Math.floor((Date.now()-this._startedAt)/1e3)};await this.nightlyConsolidation.execute(t,o);break}default:console.warn("[QualityDaemon] Unhandled payload type:",i.type)}}async runPeriodicChecks(e){let t=Date.now();if(!this._lastCICheck||t-this._lastCICheck>=this.config.ciPollIntervalMs)try{let i=await this.ciMonitor.check();this._ciHealth=i.healthScore,this._lastCICheck=t,i.flakyWorkflows.length>0&&await this.notificationService.send({type:"flaky_detected",title:"Flaky Workflows Detected",message:`${i.flakyWorkflows.length} workflows showing repeated failures: ${i.flakyWorkflows.join(", ")}`,severity:"medium",metadata:{workflows:i.flakyWorkflows}})}catch{}if(!this._lastCoverageCheck||t-this._lastCoverageCheck>=this.config.coverageCheckIntervalMs)try{let i=await this.coverageDelta.buildSnapshot(e);i&&(this._coverageHealth=Math.round((i.overall.line+i.overall.branch+i.overall.function+i.overall.statement)/4),this._lastCoverageCheck=t)}catch{}}isResourceConstrained(){if(1-ee()/te()>this.config.memoryThreshold)return!0;let t=Z().length;return(t>0?ie()[0]/t:0)>this.config.cpuThreshold}};export{x as a,O as b};
5
+ `)){if(!t)continue;let[i,o]=t.split(" ");this.lastKnownHeads.set(i,o)}}catch{}}};var j={regressionThreshold:2,gapThreshold:60,memoryPrefix:"quality-daemon:coverage"},f=class{constructor(e,t){this.queue=e;this.options={...j,...t}}queue;options;async analyze(e,t,i){let o=await t.get(`${this.options.memoryPrefix}:snapshot`);if(await t.set(`${this.options.memoryPrefix}:snapshot`,e),!o)return{regressionDetected:!1,overallDelta:{line:0,branch:0,function:0,statement:0},affectedFiles:[],newGaps:[]};let r=o,n={line:e.overall.line-r.overall.line,branch:e.overall.branch-r.overall.branch,function:e.overall.function-r.overall.function,statement:e.overall.statement-r.overall.statement},s=n.line<-this.options.regressionThreshold||n.branch<-this.options.regressionThreshold,a=i??Object.keys(e.files),u=[],c=[];for(let d of a){let l=e.files[d],m=r.files[d];if(!l)continue;let M=m?l.line-m.line:0,I=m?l.branch-m.branch:0,D=m?l.uncoveredLines.filter(T=>!m.uncoveredLines.includes(T)):l.uncoveredLines;if((M!==0||I!==0||D.length>0)&&u.push({file:d,lineDelta:M,branchDelta:I,newUncoveredLines:D}),l.line<this.options.gapThreshold){let T=this.computeRiskScore(l,D.length);c.push({file:d,uncoveredLines:l.uncoveredLines,currentCoverage:l.line,riskScore:T})}}return(s||c.length>0)&&this.enqueueTestSuggestion(e,r,c),await t.set(`${this.options.memoryPrefix}:delta`,{timestamp:Date.now(),overallDelta:n,regressionDetected:s,affectedFileCount:u.length,gapCount:c.length}),{regressionDetected:s,overallDelta:n,affectedFiles:u,newGaps:c}}async buildSnapshot(e){let t=await e.get("coverage:latest");if(t)return{timestamp:Date.now(),overall:{line:t.line,branch:t.branch,function:t.function,statement:t.statement},files:t.files??{}}}computeRiskScore(e,t){let o=1-Math.min(100,Math.max(0,e.line))/100,r=Math.min(t/50,1);return Math.min(1,o*.6+r*.4)}enqueueTestSuggestion(e,t,i){let o={type:"coverage_delta",previousSnapshot:`snapshot-${t.timestamp}`,currentSnapshot:`snapshot-${e.timestamp}`},r={id:`coverage-delta-${Date.now()}`,priority:i.some(n=>n.riskScore>.8)?"now":"next",payload:o,createdAt:Date.now(),source:"coverage-delta",ttlMs:600*1e3};this.queue.enqueue(r)}};import{execFile as B}from"child_process";import{promisify as J}from"util";var K=J(B),V={runsPerWorkflow:10,flakyThreshold:3,repo:""},y=class{constructor(e,t){this.queue=e;this.options={...V,...t}}queue;options;async check(){let e=await this.fetchRecentRuns(),t=this.groupByWorkflow(e),i=[],o=[],r=0;for(let[s,a]of Object.entries(t)){let u=a.filter(m=>m.conclusion==="failure").length,c=a.length>0?(a.length-u)/a.length*100:100,d=this.countConsecutiveFailures(a),l=a[0]?.conclusion??"unknown";l==="failure"&&r++,d>=this.options.flakyThreshold&&(o.push(s),this.enqueueFailureAlert(s,a[0])),i.push({name:s,recentRuns:a.length,failedRuns:u,successRate:Math.round(c*10)/10,lastConclusion:l,consecutiveFailures:d})}let n=this.calculateHealthScore(i);return{timestamp:Date.now(),workflows:i,failingWorkflows:r,flakyWorkflows:o,healthScore:n}}async fetchRecentRuns(){try{let e=["run","list","--limit",String(this.options.runsPerWorkflow*5),"--json","name,status,conclusion,headBranch,number,databaseId,createdAt"];this.options.repo&&e.push("--repo",this.options.repo);let{stdout:t}=await K("gh",e,{timeout:15e3});return JSON.parse(t).map(o=>({name:o.name,status:o.status,conclusion:o.conclusion??"pending",headBranch:o.headBranch,runNumber:o.number,databaseId:o.databaseId,createdAt:o.createdAt}))}catch{return[]}}groupByWorkflow(e){let t={};for(let i of e)t[i.name]||(t[i.name]=[]),t[i.name].push(i);for(let i of Object.keys(t))t[i]=t[i].slice(0,this.options.runsPerWorkflow);return t}countConsecutiveFailures(e){let t=0;for(let i of e)if(i.conclusion==="failure")t++;else break;return t}calculateHealthScore(e){if(e.length===0)return 100;let t=e.reduce((i,o)=>i+o.successRate,0)/e.length;return Math.round(t)}enqueueFailureAlert(e,t){let i={type:"ci_failure",workflowName:e,runId:t.databaseId,conclusion:t.conclusion},o={id:`ci-failure-${e}-${Date.now()}`,priority:"now",payload:i,createdAt:Date.now(),source:"ci-monitor",ttlMs:1800*1e3};this.queue.enqueue(o)}};var Y={memoryPrefix:"quality-daemon:suggestions",maxSuggestions:100,minRiskScore:.3},v=class{options;constructor(e){this.options={...Y,...e}}async suggest(e,t,i){let o=[],r=e.filter(s=>s.riskScore>=this.options.minRiskScore);for(let s of r){let a=t.includes(s.file),u=this.determinePriority(s,a),c=this.determineTestType(s.file),d=this.estimateEffort(s);o.push({id:`suggestion-${Date.now()}-${o.length}`,file:s.file,uncoveredLines:s.uncoveredLines.slice(0,50),suggestedTestType:c,description:this.generateDescription(s,c),priority:u,estimatedEffort:d,createdAt:Date.now(),status:"pending"})}o.sort((s,a)=>{let u={high:0,medium:1,low:2};return u[s.priority]-u[a.priority]});let n=o.slice(0,this.options.maxSuggestions);return await this.storeSuggestions(n,i),n}async getPending(e){return(await e.get(`${this.options.memoryPrefix}:list`)??[]).filter(i=>i.status==="pending")}async updateStatus(e,t,i){let o=await i.get(`${this.options.memoryPrefix}:list`);if(!o)return!1;let r=o.findIndex(s=>s.id===e);if(r===-1)return!1;let n=o.map((s,a)=>a===r?{...s,status:t}:s);return await i.set(`${this.options.memoryPrefix}:list`,n),!0}determinePriority(e,t){return e.riskScore>.8?"high":t||e.riskScore>.5?"medium":"low"}determineTestType(e){return e.includes("/api/")||e.includes("/routes/")||e.includes("/handlers/")?"integration":e.includes("/e2e/")||e.includes("/pages/")||e.includes("/views/")?"e2e":"unit"}estimateEffort(e){return e.uncoveredLines.length<=10?"small":e.uncoveredLines.length<=50?"medium":"large"}generateDescription(e,t){let i=e.uncoveredLines.length,o=Math.round(e.currentCoverage);return`Add ${t} tests for ${e.file} (${i} uncovered lines, ${o}% coverage, risk ${(e.riskScore*100).toFixed(0)}%)`}async storeSuggestions(e,t){let r=[...(await t.get(`${this.options.memoryPrefix}:list`)??[]).filter(n=>n.status!=="pending"),...e].slice(-this.options.maxSuggestions);await t.set(`${this.options.memoryPrefix}:list`,r),await t.set(`${this.options.memoryPrefix}:count`,{pending:e.length,total:r.length,lastUpdated:Date.now()})}};var X={memoryPrefix:"quality-daemon:nightly",maxEntryAge:6048e5,nightlyHour:2},w=class{constructor(e,t){this.queue=e;this.options={...X,...t}}queue;options;lastRunDate;shouldRun(){let e=new Date,t=e.toISOString().split("T")[0];return this.lastRunDate===t?!1:e.getHours()>=this.options.nightlyHour}scheduleIfDue(){if(!this.shouldRun())return!1;let e={type:"nightly",tasks:["consolidate_patterns","prune_expired","generate_report"]},t={id:`nightly-${Date.now()}`,priority:"later",payload:e,createdAt:Date.now(),source:"nightly-consolidation",ttlMs:720*60*1e3};return this.queue.enqueue(t)}async execute(e,t){let i=Date.now(),o=new Date().toISOString().split("T")[0],r=await this.consolidatePatterns(e),n=await this.pruneExpired(e),s=this.generateReport(o,t);await e.set(`${this.options.memoryPrefix}:report:${o}`,s),this.lastRunDate=o;let a={timestamp:Date.now(),patternsConsolidated:r,entriesPruned:n,reportGenerated:!0,durationMs:Date.now()-i};return await e.set(`${this.options.memoryPrefix}:last-result`,a),a}async getLastResult(e){return e.get(`${this.options.memoryPrefix}:last-result`)}async consolidatePatterns(e){let t=await e.search("quality-daemon:*"),i=0;return await e.get("quality-daemon:suggestions:count")&&i++,await e.get("quality-daemon:coverage:delta")&&i++,i}async pruneExpired(e){let t=await e.search("quality-daemon:*"),i=0,o=Date.now();for(let r of t){if(r.endsWith(":snapshot")||r.endsWith(":list"))continue;let n=await e.get(r);n&&typeof n.timestamp=="number"&&o-n.timestamp>this.options.maxEntryAge&&(await e.set(r,{pruned:!0,prunedAt:o}),i++)}return i}generateReport(e,t){return{date:e,coverageHealth:t.coverageHealth??0,ciHealth:t.ciHealth??0,commitsAnalyzed:t.commitsAnalyzed??0,suggestionsGenerated:t.suggestionsGenerated??0,notificationsSent:t.notificationsSent??0,queueDepthAvg:t.queueDepthAvg??0,daemonUptime:t.uptimeSeconds??0}}};import{writeFileSync as W,mkdirSync as A,readdirSync as S,readFileSync as N,unlinkSync as F}from"fs";import{join as b,resolve as Z}from"path";var O={notificationsDir:Z(process.cwd(),".agentic-qe","notifications"),maxNotifications:200},k=class{notificationsDir;maxNotifications;webhookUrl;urlValidator;_sentCount=0;constructor(e){this.notificationsDir=e?.notificationsDir??O.notificationsDir,this.maxNotifications=e?.maxNotifications??O.maxNotifications,this.webhookUrl=e?.webhookUrl,this.urlValidator=e?.urlValidator}get sentCount(){return this._sentCount}initialize(){A(this.notificationsDir,{recursive:!0})}async send(e){let t={...e,id:`notif-${Date.now()}-${Math.random().toString(36).slice(2,8)}`,timestamp:Date.now(),read:!1};return this.writeToFile(t),this.webhookUrl&&await this.sendWebhook(t),this._sentCount++,this.pruneOldNotifications(),t}list(e){let t=e?.limit??50;try{let i=S(this.notificationsDir).filter(r=>r.endsWith(".json")).sort().reverse(),o=[];for(let r of i){if(o.length>=t)break;try{let n=N(b(this.notificationsDir,r),"utf-8"),s=JSON.parse(n);if(e?.unreadOnly&&s.read||e?.type&&s.type!==e.type)continue;o.push(s)}catch{}}return o}catch{return[]}}markRead(e){try{let t=S(this.notificationsDir).filter(n=>n.endsWith(`-${e}.json`));if(t.length===0)return!1;let i=b(this.notificationsDir,t[0]),r={...JSON.parse(N(i,"utf-8")),read:!0};return W(i,JSON.stringify(r,null,2)),!0}catch{return!1}}clear(){try{let e=S(this.notificationsDir).filter(t=>t.endsWith(".json"));for(let t of e)F(b(this.notificationsDir,t));return e.length}catch{return 0}}writeToFile(e){try{A(this.notificationsDir,{recursive:!0});let t=`${e.timestamp}-${e.id}.json`,i=b(this.notificationsDir,t);W(i,JSON.stringify(e,null,2))}catch(t){console.debug("[NotificationService] Failed to write notification:",t)}}async sendWebhook(e){if(this.webhookUrl){if(this.urlValidator&&!this.urlValidator(this.webhookUrl)){console.warn("[NotificationService] Webhook URL blocked by SSRF guard:",this.webhookUrl);return}try{let t=await fetch(this.webhookUrl,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e),signal:AbortSignal.timeout(5e3)});t.ok||console.debug(`[NotificationService] Webhook returned ${t.status}`)}catch(t){console.debug("[NotificationService] Webhook delivery failed:",t)}}}pruneOldNotifications(){try{let e=S(this.notificationsDir).filter(i=>i.endsWith(".json")).sort();if(e.length<=this.maxNotifications)return;let t=e.slice(0,e.length-this.maxNotifications);for(let i of t)F(b(this.notificationsDir,i))}catch{}}};var C={tickIntervalMs:3e4,ciPollIntervalMs:5*6e4,coverageCheckIntervalMs:2*6e4,cpuThreshold:.7,memoryThreshold:.8},G=class{queue;gitWatcher;coverageDelta;ciMonitor;testSuggester;nightlyConsolidation;notificationService;tickTimer;_running=!1;_startedAt=0;_tickCount=0;_lastTickAt;_throttled=!1;_commitsAnalyzed=0;_suggestionsGenerated=0;_ciHealth=100;_coverageHealth=100;_lastCICheck;_lastCoverageCheck;_memory;config;constructor(e){this.config={tickIntervalMs:e?.tickIntervalMs??C.tickIntervalMs,ciPollIntervalMs:e?.ciPollIntervalMs??C.ciPollIntervalMs,coverageCheckIntervalMs:e?.coverageCheckIntervalMs??C.coverageCheckIntervalMs,cpuThreshold:e?.cpuThreshold??C.cpuThreshold,memoryThreshold:e?.memoryThreshold??C.memoryThreshold},this.queue=new p,this.gitWatcher=new g(this.queue,e?.git),this.coverageDelta=new f(this.queue,e?.coverage),this.ciMonitor=new y(this.queue,e?.ci),this.testSuggester=new v(e?.suggestions),this.nightlyConsolidation=new w(this.queue,e?.nightly),this.notificationService=new k(e?.notifications)}get running(){return this._running}async start(e){this._running||(this._memory=e,this._running=!0,this._startedAt=Date.now(),this.notificationService.initialize(),await this.gitWatcher.start().catch(t=>{console.debug("[QualityDaemon] Git watcher failed to start:",t)}),this.scheduleTick())}async stop(){this._running&&(this._running=!1,this.tickTimer&&(clearTimeout(this.tickTimer),this.tickTimer=void 0),this.gitWatcher.stop(),this._memory&&await this._memory.set("quality-daemon:state",{stoppedAt:Date.now(),tickCount:this._tickCount,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated}))}getStatus(){return{running:this._running,uptimeSeconds:this._running?Math.floor((Date.now()-this._startedAt)/1e3):0,tickCount:this._tickCount,queueDepth:this.queue.depths,lastTickAt:this._lastTickAt,throttled:this._throttled,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,ciHealth:this._ciHealth,coverageHealth:this._coverageHealth,lastCICheck:this._lastCICheck,lastCoverageCheck:this._lastCoverageCheck}}scheduleTick(){this._running&&(this.tickTimer=setTimeout(()=>this.tick(),this.config.tickIntervalMs),this.tickTimer.unref?.())}async tick(){if(!(!this._running||!this._memory)){if(this._tickCount++,this._lastTickAt=Date.now(),this._throttled=this.isResourceConstrained(),this._throttled){await this.processNowItems(this._memory),this.scheduleTick();return}await this.processQueue(this._memory),await this.runPeriodicChecks(this._memory),this.nightlyConsolidation.scheduleIfDue(),this.queue.pruneExpired(),this.scheduleTick()}}async processQueue(e){let t=0,i=10;for(;t<i&&!this.queue.isEmpty;){let o=this.queue.dequeue();if(!o)break;await this.handleQueueItem(o,e),t++}}async processNowItems(e){let t=this.queue.drainPriority("now");for(let i of t)await this.handleQueueItem(i,e)}async handleQueueItem(e,t){let i=e.payload;switch(i.type){case"git_commit":{this._commitsAnalyzed++;let o=await this.coverageDelta.buildSnapshot(t);if(o){let r=await this.coverageDelta.analyze(o,t,i.changedFiles);if(r.regressionDetected&&await this.notificationService.send({type:"coverage_drop",title:"Coverage Regression Detected",message:`Line coverage delta: ${r.overallDelta.line.toFixed(1)}% (${r.affectedFiles.length} files affected)`,severity:"high",metadata:{delta:r.overallDelta,commit:i.commitHash}}),r.newGaps.length>0){let n=await this.testSuggester.suggest(r.newGaps,i.changedFiles,t);this._suggestionsGenerated+=n.length,n.length>0&&await this.notificationService.send({type:"suggestion_available",title:"New Test Suggestions Available",message:`${n.length} test suggestions generated for uncovered code`,severity:"info",metadata:{count:n.length}})}}break}case"coverage_delta":{let o=await this.testSuggester.getPending(t);o.length>0&&await this.notificationService.send({type:"suggestion_available",title:"Test Suggestions Pending",message:`${o.length} test suggestions awaiting review`,severity:"info",metadata:{count:o.length}});break}case"gate_failure":await this.notificationService.send({type:"gate_failure",title:`Quality Gate Failed: ${i.gateName}`,message:`Score ${i.score} below threshold ${i.threshold}`,severity:"critical",metadata:{gate:i.gateName,score:i.score,threshold:i.threshold}});break;case"ci_failure":await this.notificationService.send({type:"ci_failure",title:`CI Failure: ${i.workflowName}`,message:`Workflow ${i.workflowName} run #${i.runId} concluded: ${i.conclusion}`,severity:"high",metadata:{workflow:i.workflowName,runId:i.runId}});break;case"nightly":{let o={coverageHealth:this._coverageHealth,ciHealth:this._ciHealth,commitsAnalyzed:this._commitsAnalyzed,suggestionsGenerated:this._suggestionsGenerated,notificationsSent:this.notificationService.sentCount,queueDepthAvg:this.queue.size,uptimeSeconds:Math.floor((Date.now()-this._startedAt)/1e3)};await this.nightlyConsolidation.execute(t,o);break}default:console.warn("[QualityDaemon] Unhandled payload type:",i.type)}}async runPeriodicChecks(e){let t=Date.now();if(!this._lastCICheck||t-this._lastCICheck>=this.config.ciPollIntervalMs)try{let i=await this.ciMonitor.check();this._ciHealth=i.healthScore,this._lastCICheck=t,i.flakyWorkflows.length>0&&await this.notificationService.send({type:"flaky_detected",title:"Flaky Workflows Detected",message:`${i.flakyWorkflows.length} workflows showing repeated failures: ${i.flakyWorkflows.join(", ")}`,severity:"medium",metadata:{workflows:i.flakyWorkflows}})}catch{}if(!this._lastCoverageCheck||t-this._lastCoverageCheck>=this.config.coverageCheckIntervalMs)try{let i=await this.coverageDelta.buildSnapshot(e);i&&(this._coverageHealth=Math.round((i.overall.line+i.overall.branch+i.overall.function+i.overall.statement)/4),this._lastCoverageCheck=t)}catch{}}isResourceConstrained(){if(1-te()/ie()>this.config.memoryThreshold)return!0;let t=ee().length;return(t>0?oe()[0]/t:0)>this.config.cpuThreshold}};export{x as a,G as b};
@@ -1,2 +1,2 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
2
- import{b as d,d as c}from"./chunk-URWT3EQT.js";import{a as l,e as g}from"./chunk-3KTAMNKI.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x as a};
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
+ import{b as d,d as c}from"./chunk-UGNTLSBL.js";import{a as l,e as g}from"./chunk-2GJJGO5D.js";g();c();import{existsSync as y,readFileSync as p}from"node:fs";import{join as o,dirname as u}from"node:path";import{fileURLToPath as m}from"node:url";var i=class extends Error{constructor(t,n,r){super(t);this.code=n;this.cause=r;this.name="PatternLoaderError"}code;cause},s=class a{static instance=null;config;patterns;isLoading=!1;constructor(e={}){this.config={basePath:e.basePath??this.getDefaultBasePath(),throwOnMissing:e.throwOnMissing??!1,validatePatterns:e.validatePatterns??!0},this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]}}static getInstance(e){return a.instance||(a.instance=new a(e)),a.instance}static resetInstance(){a.instance=null}getDefaultBasePath(){try{let e=import.meta.url,t=m(e),n=u(t),r=o(n,"..","..","..");return o(r,"assets","patterns")}catch{return o(process.cwd(),"assets","patterns")}}async loadPatterns(){if(!this.isLoading){this.isLoading=!0,this.patterns.errors=[];try{this.patterns.index=this.loadJsonFile("index.json");let[e,t,n,r]=await Promise.all([Promise.resolve(this.loadJsonFile("adr-051-booster-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-router-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-embedding-patterns.json")),Promise.resolve(this.loadJsonFile("adr-051-reasoning-patterns.json"))]);this.patterns.booster=e,this.patterns.router=t,this.patterns.embedding=n,this.patterns.reasoning=r,this.patterns.loadedAt=new Date,this.config.validatePatterns&&this.validateLoadedPatterns()}finally{this.isLoading=!1}}}loadJsonFile(e){let t=o(this.config.basePath,e);try{if(!y(t)){let r=`Pattern file not found: ${t}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"FILE_NOT_FOUND");return null}let n=p(t,"utf-8");return d(n)}catch(n){if(n instanceof i)throw n;let r=`Failed to load pattern file ${e}: ${l(n)}`;if(this.patterns.errors.push(r),this.config.throwOnMissing)throw new i(r,"PARSE_ERROR",n instanceof Error?n:void 0);return null}}validateLoadedPatterns(){this.patterns.booster&&(Array.isArray(this.patterns.booster.patterns)||this.patterns.errors.push("Booster patterns file missing patterns array")),this.patterns.router&&(Array.isArray(this.patterns.router.patterns)||this.patterns.errors.push("Router patterns file missing patterns array")),this.patterns.embedding&&(Array.isArray(this.patterns.embedding.patterns)||this.patterns.errors.push("Embedding patterns file missing patterns array")),this.patterns.reasoning&&(Array.isArray(this.patterns.reasoning.patterns)||this.patterns.errors.push("Reasoning patterns file missing patterns array"))}async ensureLoaded(){this.patterns.loadedAt||await this.loadPatterns()}async getIndex(){return await this.ensureLoaded(),this.patterns.index}async getBoosterPatterns(){return await this.ensureLoaded(),this.patterns.booster}async getRouterPatterns(){return await this.ensureLoaded(),this.patterns.router}async getEmbeddingPatterns(){return await this.ensureLoaded(),this.patterns.embedding}async getReasoningPatterns(){return await this.ensureLoaded(),this.patterns.reasoning}async getBoosterPatternByKey(e){let t=await this.getBoosterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getRouterPatternByKey(e){let t=await this.getRouterPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEmbeddingPatternByKey(e){let t=await this.getEmbeddingPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getReasoningPatternByKey(e){let t=await this.getReasoningPatterns();return t?t.patterns.find(r=>r.key===e)??null:null}async getEligibleBoosterTransforms(){let e=await this.getBoosterPatternByKey("booster-transform-eligibility");return e?e.eligibility_criteria.simple_transforms:[]}async getTierHierarchy(){let e=await this.getRouterPatternByKey("router-5tier-complexity");return e?e.tier_hierarchy:null}async getQualityGateThresholds(){let e=await this.getReasoningPatternByKey("reasoning-pattern-quality-gates");return e?e.gate_thresholds:null}isLoaded(){return this.patterns.loadedAt!==null}getLoadedAt(){return this.patterns.loadedAt}getErrors(){return[...this.patterns.errors]}async getStatistics(){let e=await this.getIndex();return e?e.pattern_statistics:null}async reload(){this.patterns={index:null,booster:null,router:null,embedding:null,reasoning:null,loadedAt:null,errors:[]},await this.loadPatterns()}async getAllPatterns(){return await this.ensureLoaded(),{...this.patterns}}};function x(){return s.getInstance()}export{x as a};
@@ -1,4 +1,4 @@
1
- import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.2");process.exit(0)}
1
+ import{createRequire as __cr}from"module";const require=__cr(import.meta.url);if(process.argv.includes('--version')||process.argv.includes('-v')){console.log("3.15.3");process.exit(0)}
2
2
  var o={domain:"test-generation",bestPractices:["Follow Arrange-Act-Assert (AAA) pattern for clear test structure","One logical assertion per test - test one behavior at a time","Use descriptive test names: should_returnValue_when_condition","Mock external dependencies to isolate unit under test","Test edge cases and boundary conditions, not just happy paths","Keep tests deterministic - avoid time-dependent assertions","Use test data builders or factories for complex objects","Prefer integration tests for workflows, unit tests for logic","Maintain test independence - no shared mutable state between tests","Write failing test first (TDD Red) before implementation"],antiPatterns:[{name:"God Test",description:"A single test that verifies too many behaviors",reason:"Hard to diagnose failures, brittle, slow to run",alternative:"Split into focused tests, each verifying one behavior",detection:"expect.*expect.*expect.*expect.*expect"},{name:"Mystery Guest",description:"Test relies on external data files or state not visible in test",reason:"Tests are hard to understand and maintain",alternative:"Make test data explicit within the test or use fixtures"},{name:"Eager Test",description:"Test that verifies more than needed for the current behavior",reason:"Creates unnecessary coupling, breaks easily",alternative:"Only assert what is necessary for this specific test case"},{name:"Flaky Assertion",description:"Assertions that depend on timing, order, or external state",reason:"Creates unreliable test suite, erodes trust",alternative:"Use deterministic assertions, mock time/random",detection:"setTimeout|Date\\.now|Math\\.random"},{name:"Test Code Duplication",description:"Same setup or assertion code repeated across tests",reason:"Maintenance burden, inconsistency risk",alternative:"Extract to beforeEach, helpers, or fixtures"}],frameworkGuidance:{jest:["Use describe blocks to group related tests","Prefer toEqual for deep equality, toBe for primitives","Use jest.mock() at module level for consistent mocking","Use jest.spyOn for partial mocking of objects","Enable --coverage to track test coverage"],vitest:["Use vi.mock() for module mocking","Prefer vi.fn() over jest.fn() syntax","Use vitest/ui for interactive test debugging","Enable browser mode for component tests","Use inline snapshots for small expected values"],mocha:["Use beforeEach/afterEach for setup/teardown","Combine with chai for assertions","Use sinon for spies, stubs, and mocks","Set appropriate timeouts for async tests"],pytest:["Use fixtures for reusable test setup","Use parametrize for data-driven tests","Use conftest.py for shared fixtures","Use pytest.raises for exception testing","Use pytest-cov for coverage reporting"],junit:["Use @BeforeEach and @AfterEach for setup/teardown","Use @DisplayName for readable test names","Use @ParameterizedTest for data-driven tests","Use Mockito for mocking dependencies"],testng:["Use @BeforeMethod and @AfterMethod appropriately","Use @DataProvider for parameterized tests","Configure test groups for selective execution"],playwright:["Use page.locator() for resilient element selection","Use expect(locator) for auto-waiting assertions","Use page.waitForLoadState for navigation","Use test.describe for grouping tests","Use fixtures for reusable browser contexts"],cypress:["Use cy.intercept() for API mocking","Avoid conditional testing - use deterministic state","Use data-cy attributes for stable selectors","Use cy.within() for scoped queries","Prefer cy.contains() for text-based selection"],selenium:["Use explicit waits over implicit waits","Use Page Object Model for maintainability","Handle stale element references with retry logic","Clean up browser state between tests"]},languageGuidance:{typescript:["Use type assertions in tests for better IDE support","Create typed test fixtures and builders","Use satisfies operator for test data validation","Mock types with ts-mockito or typed mocking libs"],javascript:["Use JSDoc comments for test documentation","Consider TypeScript for larger test suites","Use ESLint with testing plugins"],python:["Use type hints in test functions","Use dataclasses for test data","Follow PEP 8 naming: test_should_do_something"],java:["Use AssertJ for fluent assertions","Use Lombok for test data classes","Follow naming: shouldDoSomething_whenCondition"],go:["Use table-driven tests for multiple cases","Use testify for assertions and mocking","Place tests in _test.go files"],rust:["Use #[test] attribute for test functions","Use assert!, assert_eq!, assert_ne! macros","Place unit tests in same file with #[cfg(test)]"],csharp:["Use xUnit or NUnit for testing","Use FluentAssertions for readable assertions","Use Moq for mocking interfaces"],kotlin:["Use kotest for BDD-style testing","Use MockK for Kotlin-first mocking","Use data classes for test fixtures"]},examples:[{title:"Unit Test Template (TypeScript + Vitest)",description:"Standard AAA pattern for unit tests",content:`describe('UserService', () => {
3
3
  describe('createUser', () => {
4
4
  it('should create user with valid data', async () => {