agentic-qe 3.15.1 → 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 (447) 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 +129 -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-XUHRLKWP.js → agent-booster-wasm-CYG3PKHH.js} +2 -2
  11. package/dist/cli/chunks/{agent-handler-CL7MJP5W.js → agent-handler-WTFYFZKL.js} +2 -2
  12. package/dist/cli/chunks/{agent-memory-branch-F7RV72FC.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-GRRNK7IN.js → arena-S72QW44C.js} +4 -4
  15. package/dist/cli/chunks/{arena-LHLVOQHW.js → arena-ZFXQEVUQ.js} +2 -2
  16. package/dist/cli/chunks/{audit-EOP2K34L.js → audit-KPYIEQJ3.js} +3 -3
  17. package/dist/cli/chunks/base-CZSB27VO.js +2 -0
  18. package/dist/cli/chunks/{better-sqlite3-YERQ5DOL.js → better-sqlite3-L2M3TI5D.js} +2 -2
  19. package/dist/cli/chunks/{brain-handler-FBXBM5XE.js → brain-handler-FHKLQTB4.js} +3 -3
  20. package/dist/cli/chunks/{branch-enumerator-NWO6LNHB.js → branch-enumerator-3BSHOPOK.js} +2 -2
  21. package/dist/cli/chunks/{browser-EDCG7TNF.js → browser-JUIJPL6Y.js} +2 -2
  22. package/dist/cli/chunks/browser-workflow-AEMIS6PA.js +2 -0
  23. package/dist/cli/chunks/{chunk-ARWSPV2C.js → chunk-2GJJGO5D.js} +2 -2
  24. package/dist/cli/chunks/{chunk-SUFXUM6W.js → chunk-2M75CW5Q.js} +2 -2
  25. package/dist/cli/chunks/{chunk-ZX4I7IND.js → chunk-2MEWIXW4.js} +2 -2
  26. package/dist/cli/chunks/{chunk-VEKRK3R6.js → chunk-2TBHPYOU.js} +2 -2
  27. package/dist/cli/chunks/{chunk-OH4SKOAM.js → chunk-34Y4CIHD.js} +2 -2
  28. package/dist/cli/chunks/{chunk-JY6HWYC4.js → chunk-35VDOH4Y.js} +1 -1
  29. package/dist/cli/chunks/{chunk-NK2BR4QZ.js → chunk-366IBPZB.js} +2 -2
  30. package/dist/cli/chunks/{chunk-PZBYZV5M.js → chunk-3MNKYCLH.js} +1 -1
  31. package/dist/cli/chunks/chunk-3UUMGWHW.js +316 -0
  32. package/dist/cli/chunks/{chunk-REGPCPEJ.js → chunk-3Y4GX5FL.js} +2 -2
  33. package/dist/cli/chunks/{chunk-PGARKOE6.js → chunk-3ZTBV6M3.js} +1 -1
  34. package/dist/cli/chunks/{chunk-GUHJWBPN.js → chunk-4IYHYHTG.js} +2 -2
  35. package/dist/cli/chunks/{chunk-J2WALRWR.js → chunk-4JVVVKAX.js} +6 -6
  36. package/dist/cli/chunks/chunk-4N7YXTV3.js +4 -0
  37. package/dist/cli/chunks/{chunk-YM3GAJMN.js → chunk-4TM5K6EZ.js} +2 -2
  38. package/dist/cli/chunks/{chunk-IUGY6Z4Q.js → chunk-5LEUEWJY.js} +2 -2
  39. package/dist/cli/chunks/{chunk-Q7ONRZBD.js → chunk-5QUOM357.js} +1 -1
  40. package/dist/cli/chunks/{chunk-5B5TA3X4.js → chunk-5WOBFN2T.js} +2 -2
  41. package/dist/cli/chunks/{chunk-JEXPSOT2.js → chunk-6AKJ73X3.js} +2 -2
  42. package/dist/cli/chunks/{chunk-K4NB3MYN.js → chunk-6EQDA4EC.js} +2 -2
  43. package/dist/cli/chunks/{chunk-HU4QGCIJ.js → chunk-6TYTBQPV.js} +2 -2
  44. package/dist/cli/chunks/{chunk-RXKOZ6VS.js → chunk-6V6XVGCL.js} +3 -3
  45. package/dist/cli/chunks/{chunk-4KHSWNFW.js → chunk-6W6GZHQA.js} +6 -6
  46. package/dist/cli/chunks/{chunk-WTFVYFRZ.js → chunk-7IJVCDDC.js} +1 -1
  47. package/dist/cli/chunks/{chunk-T5K6ZCA6.js → chunk-7PDC4SKR.js} +1 -1
  48. package/dist/cli/chunks/{chunk-NF6SLLE6.js → chunk-7SWHW5AC.js} +20 -20
  49. package/dist/cli/chunks/{chunk-UE33MZOC.js → chunk-7TW5UGDP.js} +2 -2
  50. package/dist/cli/chunks/{chunk-4AEFJEZH.js → chunk-7UUSV2SK.js} +1 -1
  51. package/dist/cli/chunks/{chunk-WONHFDWF.js → chunk-A3IQU2ND.js} +2 -2
  52. package/dist/cli/chunks/{chunk-ALLABEUK.js → chunk-A5H7TF7C.js} +2 -2
  53. package/dist/cli/chunks/{chunk-C3BW3Q27.js → chunk-A6PII4R4.js} +1 -1
  54. package/dist/cli/chunks/{chunk-ZE6WJDXM.js → chunk-AEL4XJGJ.js} +2 -2
  55. package/dist/cli/chunks/{chunk-5QEXDXHQ.js → chunk-AOZJ6UUZ.js} +2 -2
  56. package/dist/cli/chunks/chunk-APV5UWTU.js +15 -0
  57. package/dist/cli/chunks/{chunk-YWX7KLNG.js → chunk-AQTQ24SK.js} +3 -3
  58. package/dist/cli/chunks/{chunk-PBWR2SKH.js → chunk-AS54N3H7.js} +2 -2
  59. package/dist/cli/chunks/chunk-ASUXS4N4.js +2 -0
  60. package/dist/cli/chunks/{chunk-JSHASVQ2.js → chunk-B23ROYST.js} +3 -3
  61. package/dist/cli/chunks/{chunk-NTLWHLAY.js → chunk-BDKQSEEY.js} +1 -1
  62. package/dist/cli/chunks/{chunk-VLL7ASGH.js → chunk-BO43BGHX.js} +2 -2
  63. package/dist/cli/chunks/{chunk-KP6LNSDO.js → chunk-CF3BPD2R.js} +161 -159
  64. package/dist/cli/chunks/{chunk-KTBA2HJC.js → chunk-CFXROOIU.js} +2 -2
  65. package/dist/cli/chunks/{chunk-SRXXPZVT.js → chunk-CNQUU6CF.js} +2 -2
  66. package/dist/cli/chunks/{chunk-OKS25EGZ.js → chunk-D5V6C3XG.js} +3 -3
  67. package/dist/cli/chunks/{chunk-ADEYBXAS.js → chunk-D6PUDLJ4.js} +2 -2
  68. package/dist/cli/chunks/{chunk-D3LREV4P.js → chunk-DE3QNPTG.js} +1 -1
  69. package/dist/cli/chunks/{chunk-TJCMG3QE.js → chunk-DH5NWHH2.js} +2 -2
  70. package/dist/cli/chunks/{chunk-GDSYJHVB.js → chunk-DLA3EHKJ.js} +1 -1
  71. package/dist/cli/chunks/{chunk-VGYLV6VD.js → chunk-DWG4TN6A.js} +1 -1
  72. package/dist/cli/chunks/{chunk-4KSCJ462.js → chunk-EBIMVSPH.js} +4 -4
  73. package/dist/cli/chunks/{chunk-4XEZ562Q.js → chunk-ED5HUPUR.js} +2 -2
  74. package/dist/cli/chunks/{chunk-CHX65QXY.js → chunk-EQGT4VLC.js} +1 -1
  75. package/dist/cli/chunks/{chunk-WFDDWRWY.js → chunk-F5BREV2Q.js} +8 -8
  76. package/dist/cli/chunks/{chunk-7FGSX4UD.js → chunk-FPFGN2Z5.js} +2 -2
  77. package/dist/cli/chunks/{chunk-3TZRJ5QD.js → chunk-FTUNC4EI.js} +3 -3
  78. package/dist/cli/chunks/chunk-FXTZXZCU.js +54 -0
  79. package/dist/cli/chunks/{chunk-DREYYJ7A.js → chunk-GJB3LPCS.js} +2 -2
  80. package/dist/cli/chunks/{chunk-4P7CGSRL.js → chunk-GPZH6OPP.js} +4 -4
  81. package/dist/cli/chunks/{chunk-NWNZMXNO.js → chunk-HR7RL4PB.js} +2 -2
  82. package/dist/cli/chunks/{chunk-NGDRSF6Y.js → chunk-HSR53REE.js} +2 -2
  83. package/dist/cli/chunks/{chunk-UOHZRR5C.js → chunk-HU474NXP.js} +1 -1
  84. package/dist/cli/chunks/{chunk-LI7N45GM.js → chunk-HV3ZVUHO.js} +1 -1
  85. package/dist/cli/chunks/{chunk-WPG6SW7C.js → chunk-HVIFA73X.js} +2 -2
  86. package/dist/cli/chunks/{chunk-6U6JQS4Z.js → chunk-HW4V7BVV.js} +2 -2
  87. package/dist/cli/chunks/{chunk-X6W35QXO.js → chunk-I5VJ3FBC.js} +2 -2
  88. package/dist/cli/chunks/{chunk-YTMWPGVR.js → chunk-IARE5VGI.js} +1 -1
  89. package/dist/cli/chunks/chunk-INVDDFJC.js +2 -0
  90. package/dist/cli/chunks/{chunk-RDI3W4H6.js → chunk-JJBTM4JO.js} +2 -2
  91. package/dist/cli/chunks/chunk-JVQK6NGI.js +14 -0
  92. package/dist/cli/chunks/{chunk-CFZJEOCD.js → chunk-K65X6CQA.js} +1 -1
  93. package/dist/cli/chunks/{chunk-6DF6X3SZ.js → chunk-KCBCYF7M.js} +2 -2
  94. package/dist/cli/chunks/{chunk-QOOADAT7.js → chunk-KGS6H2HB.js} +2 -2
  95. package/dist/cli/chunks/{chunk-TCJ65NPY.js → chunk-L6OSEWOS.js} +1 -1
  96. package/dist/cli/chunks/{chunk-BW7S6LIJ.js → chunk-LEB6O2IN.js} +2 -2
  97. package/dist/cli/chunks/{chunk-WHBDSJUE.js → chunk-LPZAB3N2.js} +3 -3
  98. package/dist/cli/chunks/{chunk-JYF3QF4C.js → chunk-M3ACHBC7.js} +2 -2
  99. package/dist/cli/chunks/{chunk-WQZR6DS6.js → chunk-M3ONCPSU.js} +2 -2
  100. package/dist/cli/chunks/{chunk-7B3XVVYP.js → chunk-MUSYQF53.js} +2 -2
  101. package/dist/cli/chunks/{chunk-6AVVC7Y3.js → chunk-MZDUBFLP.js} +1 -1
  102. package/dist/cli/chunks/{chunk-53HWWWFZ.js → chunk-NT6FYFJA.js} +2 -2
  103. package/dist/cli/chunks/{chunk-6WW6A6JM.js → chunk-O66D4NEJ.js} +2 -2
  104. package/dist/cli/chunks/{chunk-3NOSMJS4.js → chunk-OGARNKLS.js} +2 -2
  105. package/dist/cli/chunks/{chunk-KHVWIUAF.js → chunk-OKNMZLGB.js} +2 -2
  106. package/dist/cli/chunks/{chunk-XCVD57GW.js → chunk-OMHISPPF.js} +1 -1
  107. package/dist/cli/chunks/{chunk-N5OSH5JO.js → chunk-OT6SOPAL.js} +2 -2
  108. package/dist/cli/chunks/{chunk-ZZV6GR46.js → chunk-OTTTHNIT.js} +1 -1
  109. package/dist/cli/chunks/{chunk-XZGRHJGC.js → chunk-P36IODAM.js} +2 -2
  110. package/dist/cli/chunks/{chunk-JHKMUY4W.js → chunk-P6EGRAQG.js} +2 -2
  111. package/dist/cli/chunks/{chunk-5JJWVFUV.js → chunk-PBUWNMZ2.js} +1 -1
  112. package/dist/cli/chunks/{chunk-LQI5GVH7.js → chunk-POTVF6BY.js} +1 -1
  113. package/dist/cli/chunks/{chunk-N4HQ6FE2.js → chunk-POVP6O6K.js} +1 -1
  114. package/dist/cli/chunks/{chunk-P24ZBDZY.js → chunk-PPA53NJB.js} +2 -2
  115. package/dist/cli/chunks/{chunk-OABFAREV.js → chunk-PUPEKA2J.js} +2 -2
  116. package/dist/cli/chunks/{chunk-27S47AYK.js → chunk-QDQLL2QB.js} +2 -2
  117. package/dist/cli/chunks/{chunk-MEOAKMKF.js → chunk-QSVNVDA5.js} +1 -1
  118. package/dist/cli/chunks/{chunk-66HKJJFH.js → chunk-QUXX2DP7.js} +2 -2
  119. package/dist/cli/chunks/{chunk-TLUMENRZ.js → chunk-QVNMTMDJ.js} +2 -2
  120. package/dist/cli/chunks/{chunk-LDDIYDIP.js → chunk-QZBFMXO5.js} +54 -54
  121. package/dist/cli/chunks/{chunk-4THIRDBL.js → chunk-RDTR43YN.js} +2 -2
  122. package/dist/cli/chunks/{chunk-6MGJMGAD.js → chunk-RGD2CG23.js} +2 -2
  123. package/dist/cli/chunks/{chunk-V5RP2SU3.js → chunk-RQUSJEON.js} +2 -2
  124. package/dist/cli/chunks/{chunk-WYE3ICSL.js → chunk-RRSZ27A7.js} +2 -2
  125. package/dist/cli/chunks/{chunk-GUKBN3BS.js → chunk-RWLOERKK.js} +2 -2
  126. package/dist/cli/chunks/{chunk-5TEDVUEB.js → chunk-RWQDRPN5.js} +2 -2
  127. package/dist/cli/chunks/{chunk-2IPBCXTT.js → chunk-S7D4GD7H.js} +2 -2
  128. package/dist/cli/chunks/{chunk-FTHXV7N7.js → chunk-SKHP5WUP.js} +2 -2
  129. package/dist/cli/chunks/{chunk-QVTV47TM.js → chunk-SP2JO53K.js} +2 -2
  130. package/dist/cli/chunks/{chunk-UTFNHITI.js → chunk-SRDECRTL.js} +2 -2
  131. package/dist/cli/chunks/{chunk-HVAYG54D.js → chunk-TBVPNN65.js} +2 -2
  132. package/dist/cli/chunks/{chunk-JQVECGYL.js → chunk-U5AVZ3T2.js} +1 -1
  133. package/dist/cli/chunks/{chunk-EQ3BJS37.js → chunk-UCSGZVJX.js} +1 -1
  134. package/dist/cli/chunks/{chunk-5C4UYXQL.js → chunk-UGNTLSBL.js} +2 -2
  135. package/dist/cli/chunks/{chunk-W5NHBYYS.js → chunk-UTALYUMW.js} +2 -2
  136. package/dist/cli/chunks/{chunk-35XRY6ZW.js → chunk-UZDTRCVU.js} +9 -9
  137. package/dist/cli/chunks/{chunk-AVOYMVD6.js → chunk-V5NYGDSX.js} +2 -2
  138. package/dist/cli/chunks/{chunk-FQYXPSWD.js → chunk-VGN46ZT4.js} +2 -2
  139. package/dist/cli/chunks/{chunk-QMHWJBD3.js → chunk-VHBZADYK.js} +2 -2
  140. package/dist/cli/chunks/{chunk-54JYUOSR.js → chunk-VOKIUF7I.js} +1 -1
  141. package/dist/cli/chunks/{chunk-PDLVO3ZR.js → chunk-VRT736E3.js} +2 -2
  142. package/dist/cli/chunks/{chunk-DV7I6CRH.js → chunk-VUBLJBHQ.js} +2 -2
  143. package/dist/cli/chunks/{chunk-FRGNM6SW.js → chunk-VX7CQUO7.js} +2 -2
  144. package/dist/cli/chunks/{chunk-YDM2DPUU.js → chunk-W7EHNX3Y.js} +2 -2
  145. package/dist/cli/chunks/{chunk-W5HQQTVH.js → chunk-WI7I6LMM.js} +1 -1
  146. package/dist/cli/chunks/{chunk-46DUU44C.js → chunk-WLOHTLHO.js} +2 -2
  147. package/dist/cli/chunks/{chunk-W6K77PQR.js → chunk-WQZBKLAG.js} +1 -1
  148. package/dist/cli/chunks/{chunk-UGUZFUQG.js → chunk-WSND64RL.js} +2 -2
  149. package/dist/cli/chunks/{chunk-PNK5KHSI.js → chunk-WSUYEVSY.js} +1 -1
  150. package/dist/cli/chunks/{chunk-FIIHSEXP.js → chunk-WTMLRMKW.js} +2 -2
  151. package/dist/cli/chunks/{chunk-OPBPFNBO.js → chunk-WW4RJ6BH.js} +2 -2
  152. package/dist/cli/chunks/{chunk-KBK4GBJQ.js → chunk-X335K4SU.js} +2 -2
  153. package/dist/cli/chunks/{chunk-NS4RIZ4F.js → chunk-X33LID2T.js} +1 -1
  154. package/dist/cli/chunks/{chunk-L5GEWKR3.js → chunk-XTGVGZ4J.js} +3 -3
  155. package/dist/cli/chunks/{chunk-CTLHNFPM.js → chunk-XV2TIODR.js} +1 -1
  156. package/dist/cli/chunks/{chunk-GAKVCN3C.js → chunk-XXW4KFBB.js} +1 -1
  157. package/dist/cli/chunks/{chunk-CTK7NMSJ.js → chunk-YCGU2LI7.js} +2 -2
  158. package/dist/cli/chunks/chunk-YGEC3PSD.js +2 -0
  159. package/dist/cli/chunks/{chunk-ARGMYSDY.js → chunk-YGKU2QRC.js} +1 -1
  160. package/dist/cli/chunks/{chunk-6Q7PWKWV.js → chunk-YHZGFWJE.js} +2 -2
  161. package/dist/cli/chunks/{chunk-V3ISBQ5Q.js → chunk-YJH7UFA2.js} +2 -2
  162. package/dist/cli/chunks/{chunk-A5LOELVV.js → chunk-YQ3ZW47V.js} +2 -2
  163. package/dist/cli/chunks/{chunk-25IWHVMW.js → chunk-YTRGMILO.js} +2 -2
  164. package/dist/cli/chunks/chunk-YW4GM36K.js +2 -0
  165. package/dist/cli/chunks/{chunk-JW2HNT3J.js → chunk-Z7JPWXW2.js} +2 -2
  166. package/dist/cli/chunks/{chunk-PZDI7WQ3.js → chunk-Z7UGEQ4G.js} +1 -1
  167. package/dist/cli/chunks/{chunk-TBCQWD5A.js → chunk-ZATQLTYL.js} +1 -1
  168. package/dist/cli/chunks/{chunk-DKWB4ERY.js → chunk-ZI6NJEBY.js} +1 -1
  169. package/dist/cli/chunks/{chunk-B3DWOR5R.js → chunk-ZJW4HRUA.js} +1 -1
  170. package/dist/cli/chunks/{chunk-X4PGLEPQ.js → chunk-ZL2GYU7H.js} +2 -2
  171. package/dist/cli/chunks/{ci-K7DG4GSO.js → ci-JPISJ25U.js} +3 -3
  172. package/dist/cli/chunks/{ci-output-EBSUG6HP.js → ci-output-DPHTFIGX.js} +2 -2
  173. package/dist/cli/chunks/{circuit-breaker-P6N6YIRZ.js → circuit-breaker-PQ65VU2M.js} +2 -2
  174. package/dist/cli/chunks/{claude-flow-setup-P6EZPQZT.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-EVZZ3EFY.js → cline-installer-HWMQZJ64.js} +2 -2
  177. package/dist/cli/chunks/{code-3WLBG2XK.js → code-OTY7BF3D.js} +3 -3
  178. package/dist/cli/chunks/{code-index-extractor-ZP6D4WL2.js → code-index-extractor-FG3TMHHR.js} +2 -2
  179. package/dist/cli/chunks/{codex-installer-XAUI4SB7.js → codex-installer-63JARKKS.js} +2 -2
  180. package/dist/cli/chunks/{completions-RHFNDDG3.js → completions-4ZHONFML.js} +2 -2
  181. package/dist/cli/chunks/{complexity-analyzer-DCW7Q3OR.js → complexity-analyzer-FYHTJW5Y.js} +2 -2
  182. package/dist/cli/chunks/{continuedev-installer-53SQA5T6.js → continuedev-installer-ZAWDSUR3.js} +2 -2
  183. package/dist/cli/chunks/{copilot-installer-SXXMFB6T.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-AWCS2SP7.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-4TYF5V5J.js → cursor-installer-3BL7JACV.js} +2 -2
  189. package/dist/cli/chunks/{daemon-CTZXGN5V.js → daemon-OJ624POF.js} +4 -4
  190. package/dist/cli/chunks/{daemon-OOY4H6RJ.js → daemon-R6ULBHHF.js} +3 -3
  191. package/dist/cli/chunks/{dag-attention-scheduler-3WG24Q33.js → dag-attention-scheduler-J6I3LTMY.js} +2 -2
  192. package/dist/cli/chunks/{detect-O7MUZ6NX.js → detect-5Q5W33UR.js} +2 -2
  193. package/dist/cli/chunks/{dist-node-H4XI7BAF.js → dist-node-GJNW56NA.js} +2 -2
  194. package/dist/cli/chunks/{domain-handler-FU4WZ23B.js → domain-handler-IZQY2G44.js} +2 -2
  195. package/dist/cli/chunks/{domain-plugins-XK26KYNJ.js → domain-plugins-PIGO3KI2.js} +2 -2
  196. package/dist/cli/chunks/{domain-transfer-6B5NOVH6.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-XNZXPZNL.js → embed-and-insert-pattern-5QDDRPWV.js} +2 -2
  199. package/dist/cli/chunks/{eval-J3Q5TTI7.js → eval-TB5HOAUY.js} +2 -2
  200. package/dist/cli/chunks/{experience-capture-middleware-COKIGMXW.js → experience-capture-middleware-SIYVLKDE.js} +3 -3
  201. package/dist/cli/chunks/{fast-paths-IHWPJI6I.js → fast-paths-T7QELS6D.js} +2 -2
  202. package/dist/cli/chunks/{feature-flags-WUXFWZLR.js → feature-flags-T3CNNYMJ.js} +2 -2
  203. package/dist/cli/chunks/{feature-flags-G7ONDNTT.js → feature-flags-TNZ7ZAJV.js} +2 -2
  204. package/dist/cli/chunks/{file-discovery-JN3YMBOJ.js → file-discovery-M45P2ZCY.js} +2 -2
  205. package/dist/cli/chunks/{fleet-OUHUZJE4.js → fleet-DSBZPHBZ.js} +3 -3
  206. package/dist/cli/chunks/{gnn-wrapper-PRH55ZT6.js → gnn-wrapper-EHODCF32.js} +2 -2
  207. package/dist/cli/chunks/{heartbeat-handler-6YF35AQS.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-7PAFSTJO.js → hnsw-legacy-bridge-IYKDYA2F.js} +2 -2
  212. package/dist/cli/chunks/{hnswlib-node-UETDZNNN.js → hnswlib-node-DKG4LW3X.js} +2 -2
  213. package/dist/cli/chunks/{hooks-QQNUKQAS.js → hooks-VKNMAILY.js} +10 -10
  214. package/dist/cli/chunks/hybrid-backend-DYVJQENQ.js +2 -0
  215. package/dist/cli/chunks/{hypergraph-engine-5GDGE3ET.js → hypergraph-engine-AXZVP7A7.js} +2 -2
  216. package/dist/cli/chunks/{hypergraph-handler-C3F2OJYA.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-N3NG3RHN.js +86 -0
  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-VLJENC76.js → kilocode-installer-JICGAHLM.js} +2 -2
  222. package/dist/cli/chunks/{kiro-installer-UYPYM6LA.js → kiro-installer-VYBFP6ZH.js} +2 -2
  223. package/dist/cli/chunks/knowledge-graph-2ICXFUUV.js +2 -0
  224. package/dist/cli/chunks/{learning-SFIWIG6Z.js → learning-3BHEZEPK.js} +3 -3
  225. package/dist/cli/chunks/{llm-router-V633KAS5.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-UWZV4JRA.js → load-W5BIRPU4.js} +2 -2
  228. package/dist/cli/chunks/load-test-LRDAW3N6.js +2 -0
  229. package/dist/cli/chunks/{mcp-XVFHUKCP.js → mcp-EBV4DZPG.js} +2 -2
  230. package/dist/cli/chunks/{memory-BQ5652VK.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-X6AQ7VVR.js → multi-model-executor-3ZIA2YOL.js} +2 -2
  234. package/dist/cli/chunks/{opencode-installer-N3V2Z4EF.js → opencode-installer-2XRZUTLR.js} +2 -2
  235. package/dist/cli/chunks/{orchestrator-KNEKS4F7.js → orchestrator-VSZVJUJW.js} +87 -28
  236. package/dist/cli/chunks/pattern-null-store-27FCITT3.js +2 -0
  237. package/dist/cli/chunks/{pattern-usage-recorder-MZIM6XWU.js → pattern-usage-recorder-I2IGVHRL.js} +2 -2
  238. package/dist/cli/chunks/{pipeline-LNLBKSXR.js → pipeline-5G3O6WBY.js} +2 -2
  239. package/dist/cli/chunks/{platform-OMUDXHD3.js → platform-6GUFDIA3.js} +2 -2
  240. package/dist/cli/chunks/{plugin-HGY6KKZW.js → plugin-GYXE4CIC.js} +2 -2
  241. package/dist/cli/chunks/{prime-radiant-advanced-wasm-LZBHLQYN.js → prime-radiant-advanced-wasm-THX6JLGZ.js} +2 -2
  242. package/dist/cli/chunks/{project-root-VPSCDBMD.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-LZXT3TXU.js → protocol-handler-B54LRU26.js} +2 -2
  245. package/dist/cli/chunks/{prove-I4VKQEYQ.js → prove-PCY2WQOD.js} +2 -2
  246. package/dist/cli/chunks/qe-reasoning-bank-3RMYXENE.js +2 -0
  247. package/dist/cli/chunks/{quality-VVAWK2DD.js → quality-LPVDZC7U.js} +2 -2
  248. package/dist/cli/chunks/{quality-gate-RGXLWYT6.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-WM66PMQ6.js → real-embeddings-N3H523PJ.js} +2 -2
  251. package/dist/cli/chunks/{ref-validation-ZIWJNI6M.js → ref-validation-6BKDPHZ7.js} +2 -2
  252. package/dist/cli/chunks/{roocode-installer-QYSI3STC.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-BID3EOLE.js → routing-handler-SRQNUBG3.js} +2 -2
  256. package/dist/cli/chunks/{ruvector-commands-DXIFMF4W.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-EV5E6SAO.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-IT6DCCJK.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-AAFAEATQ.js → security-JW4EBARW.js} +3 -3
  266. package/dist/cli/chunks/{shared-rvf-adapter-QIHSYHAF.js → shared-rvf-adapter-VQ7NJTGY.js} +2 -2
  267. package/dist/cli/chunks/{shared-rvf-dual-writer-V7OZ6TBR.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-ALZI6VPX.js → standalone-memory-3N4YJCSY.js} +2 -2
  270. package/dist/cli/chunks/{status-handler-DED5A3OW.js → status-handler-5BQ2IIDG.js} +2 -2
  271. package/dist/cli/chunks/{structural-health-CB7L3NWH.js → structural-health-WGYR2RJB.js} +2 -2
  272. package/dist/cli/chunks/{sync-QNPGETIO.js → sync-DLKSXTIR.js} +2 -2
  273. package/dist/cli/chunks/sync-R5OKUBTQ.js +2 -0
  274. package/dist/cli/chunks/{task-handler-CGHXYFIF.js → task-handler-Z5KNTSUX.js} +2 -2
  275. package/dist/cli/chunks/{task-handlers-A6BGQJIB.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-25BRFKJ5.js → token-usage-PFC2BYBS.js} +2 -2
  280. package/dist/cli/chunks/{transformers-TBVVSZMF.js → transformers-VZCC4SHC.js} +2 -2
  281. package/dist/cli/chunks/{tree-sitter-wasm-parser-N7KCOQT4.js → tree-sitter-wasm-parser-ZYDQXGKN.js} +2 -2
  282. package/dist/cli/chunks/{types-TFHWJGRK.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-4VWQU7RD.js → upgrade-T7SG75PA.js} +2 -2
  287. package/dist/cli/chunks/{validate-FF7WVXMP.js → validate-YLYEHTY3.js} +2 -2
  288. package/dist/cli/chunks/{validate-swarm-NRLH4EDC.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-VVU3LULW.js → web-tree-sitter-JUM7ZY5M.js} +2 -2
  291. package/dist/cli/chunks/{windsurf-installer-Q2ZNWG2D.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-FP3D4PQL.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-LACGL6BK.js → witness-chain-verifier-LBWJHO7Y.js} +2 -2
  296. package/dist/cli/chunks/{witness-key-manager-GQZIB5ZE.js → witness-key-manager-5IHVMXHJ.js} +2 -2
  297. package/dist/cli/chunks/{workflow-JPA5Y7L6.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 +42 -9
  301. package/dist/cli/handlers/init-flags.d.ts +45 -0
  302. package/dist/cli/handlers/init-flags.js +35 -0
  303. package/dist/cli/handlers/init-handler.d.ts +6 -0
  304. package/dist/cli/handlers/init-handler.js +24 -10
  305. package/dist/cli/utils/generated-test-writer.d.ts +35 -0
  306. package/dist/cli/utils/generated-test-writer.js +44 -0
  307. package/dist/context/compiler.js +4 -1
  308. package/dist/coordination/consensus/providers/ollama-provider.js +16 -27
  309. package/dist/coordination/consensus/providers/openrouter-provider.js +13 -24
  310. package/dist/coordination/handlers/test-execution-handlers.js +4 -2
  311. package/dist/coordination/protocols/defect-investigation.js +4 -1
  312. package/dist/coordination/task-executor.js +4 -2
  313. package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +3 -3
  314. package/dist/domains/coverage-analysis/services/gap-detector.js +3 -1
  315. package/dist/domains/learning-optimization/services/learning-coordinator.js +4 -2
  316. package/dist/domains/test-execution/services/flaky-detector.js +8 -2
  317. package/dist/domains/test-execution/services/retry-handler.js +23 -20
  318. package/dist/domains/test-execution/services/test-executor.js +5 -2
  319. package/dist/domains/test-generation/services/test-generator.js +5 -2
  320. package/dist/governance/compliance-reporter.js +8 -7
  321. package/dist/governance/proof-envelope-integration.js +3 -1
  322. package/dist/init/claude-plugin-detection.d.ts +63 -0
  323. package/dist/init/claude-plugin-detection.js +118 -0
  324. package/dist/init/init-wizard-hooks.d.ts +6 -1
  325. package/dist/init/init-wizard-hooks.js +9 -1
  326. package/dist/init/init-wizard.d.ts +4 -0
  327. package/dist/init/init-wizard.js +3 -1
  328. package/dist/init/orchestrator.js +1 -0
  329. package/dist/init/phases/07-hooks.js +30 -4
  330. package/dist/init/phases/08-mcp.d.ts +7 -0
  331. package/dist/init/phases/08-mcp.js +22 -0
  332. package/dist/init/phases/10-workers.js +42 -6
  333. package/dist/init/phases/phase-interface.d.ts +5 -1
  334. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.d.ts +4 -1
  335. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +6 -2
  336. package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +2 -1
  337. package/dist/integrations/ruvector/coverage-router.d.ts +3 -1
  338. package/dist/integrations/ruvector/coverage-router.js +7 -6
  339. package/dist/integrations/ruvector/diff-risk-classifier.js +5 -4
  340. package/dist/integrations/ruvector/rvf-dual-writer.js +10 -1
  341. package/dist/integrations/vibium/runtime.js +2 -6
  342. package/dist/learning/dream/dream-engine.d.ts +5 -0
  343. package/dist/learning/dream/dream-engine.js +20 -3
  344. package/dist/learning/embedding-space.d.ts +18 -0
  345. package/dist/learning/embedding-space.js +33 -0
  346. package/dist/learning/rvf-pattern-store.js +19 -5
  347. package/dist/mcp/bundle.js +443 -441
  348. package/dist/mcp/handlers/domain-handler-configs.js +3 -1
  349. package/dist/mcp/handlers/handler-factory.js +7 -0
  350. package/dist/mcp/handlers/save-results-option.d.ts +97 -0
  351. package/dist/mcp/handlers/save-results-option.js +94 -0
  352. package/dist/mcp/protocol-server.js +23 -11
  353. package/dist/mcp/security/rate-limiter.d.ts +8 -1
  354. package/dist/mcp/security/rate-limiter.js +33 -4
  355. package/dist/mcp/services/session-resume.js +11 -0
  356. package/dist/mcp/services/session-store.d.ts +31 -2
  357. package/dist/mcp/services/session-store.js +84 -15
  358. package/dist/mcp/services/session-write-buffer.d.ts +55 -0
  359. package/dist/mcp/services/session-write-buffer.js +144 -0
  360. package/dist/mcp/types.d.ts +9 -0
  361. package/dist/memory/crdt/g-counter.js +10 -8
  362. package/dist/shared/embeddings/ollama-client.d.ts +1 -1
  363. package/dist/shared/embeddings/ollama-client.js +30 -31
  364. package/dist/shared/git/git-analyzer.d.ts +4 -1
  365. package/dist/shared/git/git-analyzer.js +9 -4
  366. package/dist/shared/llm/cost-tracker.js +8 -6
  367. package/dist/shared/llm/providers/azure-openai.js +5 -21
  368. package/dist/shared/llm/providers/bedrock.js +5 -21
  369. package/dist/shared/llm/providers/claude.js +5 -21
  370. package/dist/shared/llm/providers/cognitum.js +5 -17
  371. package/dist/shared/llm/providers/gemini.js +9 -23
  372. package/dist/shared/llm/providers/ollama.js +5 -21
  373. package/dist/shared/llm/providers/openai.js +5 -21
  374. package/dist/shared/llm/providers/openrouter.js +9 -23
  375. package/dist/shared/llm/providers/response-deadline.d.ts +3 -0
  376. package/dist/shared/llm/providers/response-deadline.js +100 -0
  377. package/dist/shared/llm/spend-ledger.js +3 -2
  378. package/dist/shared/metrics/code-metrics.d.ts +1 -0
  379. package/dist/shared/metrics/code-metrics.js +3 -44
  380. package/dist/shared/metrics/cognitive-complexity.d.ts +17 -0
  381. package/dist/shared/metrics/cognitive-complexity.js +108 -0
  382. package/dist/shared/npm-cli-invocation.d.ts +21 -0
  383. package/dist/shared/npm-cli-invocation.js +28 -0
  384. package/dist/shared/optional-module.js +24 -0
  385. package/dist/shared/test-runner-args.d.ts +42 -0
  386. package/dist/shared/test-runner-args.js +74 -0
  387. package/dist/shared/utils/safe-record.d.ts +18 -0
  388. package/dist/shared/utils/safe-record.js +28 -0
  389. package/dist/test-scheduling/executors/vitest-executor.js +23 -5
  390. package/dist/workers/quality-daemon/git-watcher.js +5 -0
  391. package/package.json +1 -1
  392. package/dist/adapters/ag-ui/json-patch-utils.d.ts +0 -136
  393. package/dist/adapters/ag-ui/json-patch-utils.js +0 -575
  394. package/dist/cli/chunks/adapter-Q6RPGMUE.js +0 -2
  395. package/dist/cli/chunks/aqe-learning-engine-JQPXIU7C.js +0 -2
  396. package/dist/cli/chunks/base-5SK64NXB.js +0 -2
  397. package/dist/cli/chunks/browser-workflow-WN7XNTCJ.js +0 -2
  398. package/dist/cli/chunks/chunk-2K3QFLX2.js +0 -2
  399. package/dist/cli/chunks/chunk-53C7TGC4.js +0 -4
  400. package/dist/cli/chunks/chunk-J4ULR4QR.js +0 -54
  401. package/dist/cli/chunks/chunk-R2ICZKQA.js +0 -2
  402. package/dist/cli/chunks/chunk-TR37Q7A6.js +0 -15
  403. package/dist/cli/chunks/chunk-XYZUBAR6.js +0 -316
  404. package/dist/cli/chunks/chunk-YDMPTCJ3.js +0 -14
  405. package/dist/cli/chunks/client-ZYH66YRI.js +0 -2
  406. package/dist/cli/chunks/core-handlers-XKSPHEHE.js +0 -2
  407. package/dist/cli/chunks/cost-tracker-CKLDQ5AZ.js +0 -2
  408. package/dist/cli/chunks/cross-domain-router-6VYNFQZA.js +0 -2
  409. package/dist/cli/chunks/dream-DRSSIHPP.js +0 -2
  410. package/dist/cli/chunks/heartbeat-scheduler-FMICCNWK.js +0 -2
  411. package/dist/cli/chunks/hnsw-adapter-4TGBNJEZ.js +0 -2
  412. package/dist/cli/chunks/hnsw-index-J4NSCPAZ.js +0 -2
  413. package/dist/cli/chunks/hybrid-backend-NKPA3QE7.js +0 -2
  414. package/dist/cli/chunks/impact-analyzer-MWX7XY7X.js +0 -2
  415. package/dist/cli/chunks/init-handler-C7ZBDAC5.js +0 -81
  416. package/dist/cli/chunks/init-wizard-EX5N5Q7X.js +0 -2
  417. package/dist/cli/chunks/kernel-EQLZDHDD.js +0 -2
  418. package/dist/cli/chunks/knowledge-graph-A3WSMQ6U.js +0 -2
  419. package/dist/cli/chunks/llm-router-service-A6XYWTL6.js +0 -2
  420. package/dist/cli/chunks/load-test-WF2PCXLI.js +0 -2
  421. package/dist/cli/chunks/memory-backend-BKGLI2RF.js +0 -2
  422. package/dist/cli/chunks/memory-handlers-PWI3G4P4.js +0 -2
  423. package/dist/cli/chunks/pattern-null-store-YTBLEH7D.js +0 -2
  424. package/dist/cli/chunks/protocol-executor-HFR2D54O.js +0 -2
  425. package/dist/cli/chunks/qe-reasoning-bank-MYFBQUYV.js +0 -2
  426. package/dist/cli/chunks/queen-coordinator-CQQMOTIW.js +0 -2
  427. package/dist/cli/chunks/router-GKWLPA3N.js +0 -2
  428. package/dist/cli/chunks/routing-feedback-WA4D5JRF.js +0 -2
  429. package/dist/cli/chunks/rvf-dual-writer-H3ZXS5MA.js +0 -2
  430. package/dist/cli/chunks/rvf-migration-adapter-J7MTCOQA.js +0 -2
  431. package/dist/cli/chunks/rvf-native-adapter-HXBY4VYI.js +0 -2
  432. package/dist/cli/chunks/safe-db-INVJ5LHR.js +0 -2
  433. package/dist/cli/chunks/schedule-XRIPPL52.js +0 -2
  434. package/dist/cli/chunks/scheduler-HBN3KPRW.js +0 -2
  435. package/dist/cli/chunks/sqlite-persistence-6KNLT5Q2.js +0 -2
  436. package/dist/cli/chunks/sync-S6Z2U46T.js +0 -2
  437. package/dist/cli/chunks/test-IISTF5W6.js +0 -33
  438. package/dist/cli/chunks/test-scheduling-FKYX4OLF.js +0 -15
  439. package/dist/cli/chunks/token-bootstrap-OKO3JEKT.js +0 -2
  440. package/dist/cli/chunks/unified-memory-WVELSL6T.js +0 -2
  441. package/dist/cli/chunks/unified-memory-hnsw-7P5MVKXD.js +0 -2
  442. package/dist/cli/chunks/unified-persistence-YLFCEWYY.js +0 -2
  443. package/dist/cli/chunks/visual-security-T5OM742H.js +0 -2
  444. package/dist/cli/chunks/witness-chain-D6X4OZP5.js +0 -2
  445. package/dist/cli/chunks/witness-chain-repair-3LG4BF7C.js +0 -2
  446. package/dist/cli/chunks/workflow-orchestrator-OORDDKT3.js +0 -2
  447. package/dist/cli/chunks/wrappers-2B5NHICD.js +0 -2
@@ -7,6 +7,7 @@
7
7
  * @module mcp/handlers/domain-handler-configs
8
8
  */
9
9
  import { generateV2LearningFeedback, analyzeComplexity, generateV2AIInsights, generateV2Tests, detectAntiPatterns, generateTestId, } from './handler-factory.js';
10
+ import { describeSavedResults } from './save-results-option.js';
10
11
  import { MetricsCollector } from '../metrics/index.js';
11
12
  import { DEFAULT_FRAMEWORKS, FRAMEWORK_TO_LANGUAGE, } from '../../shared/types/test-frameworks.js';
12
13
  import { buildRiskDecisionFromQualityGate, validateRiskDecision, } from '../../contracts/verdicts.js';
@@ -163,7 +164,8 @@ export const testGenerateConfig = {
163
164
  coverageEstimate: data.coverageEstimate ?? null,
164
165
  patternsUsed: data.patternsUsed || ['assertion-patterns', 'mock-generation', 'edge-case-detection'],
165
166
  duration,
166
- savedFiles,
167
+ // #925: state plainly whether result files were written, with their paths.
168
+ ...describeSavedResults(params?.saveResults !== false, savedFiles),
167
169
  // #567: propagate the LLM-enhancement signal to the MCP caller.
168
170
  llmEnhanced,
169
171
  ...(data.generationMode ? { generationMode: data.generationMode } : {}),
@@ -15,6 +15,7 @@ import { getFleetState, isFleetInitialized } from './core-handlers.js';
15
15
  import { createTaskExecutor } from '../../coordination/task-executor.js';
16
16
  import { getTaskRouter } from '../services/task-router.js';
17
17
  import { toErrorMessage } from '../../shared/error-utils.js';
18
+ import { describeSavedResults, readSaveResultsOption } from './save-results-option.js';
18
19
  import { createInitializedFeedbackLoop, getQualityFeedbackLoop } from '../../feedback/feedback-loop.js';
19
20
  // ============================================================================
20
21
  // Shared Utilities (exported for response mappers)
@@ -594,6 +595,8 @@ export function createDomainHandler(config) {
594
595
  const { queen } = getFleetState();
595
596
  let routingResult = null;
596
597
  try {
598
+ // #925: per-call opt-out of result files, validated before any work.
599
+ const saveResults = readSaveResultsOption(params);
597
600
  // Step 2: Route task to optimal model tier (ADR-051).
598
601
  // Bounded by ROUTE_ADVISORY_TIMEOUT_MS — routing is an advisory hint and
599
602
  // must never block the tool; on timeout we proceed with null routing
@@ -603,6 +606,8 @@ export function createDomainHandler(config) {
603
606
  routingResult = await withTimeout(routeDomainTask(taskDescription, domain, codeContext), ROUTE_ADVISORY_TIMEOUT_MS, null);
604
607
  // Step 3: Build payload and submit task
605
608
  const payload = mapToPayload(params, routingResult);
609
+ if (!saveResults)
610
+ payload.saveResults = false;
606
611
  const timeout = calculateTimeout?.(params) ?? defaultTimeout;
607
612
  const submitResult = await queen.submitTask({
608
613
  type: taskType,
@@ -636,6 +641,8 @@ export function createDomainHandler(config) {
636
641
  // Step 5: Map result
637
642
  const data = result.data;
638
643
  const mappedResult = mapToResult(submitResult.value, data, result.duration, result.savedFiles, params);
644
+ // #933: every result-saving tool reports what it wrote, the same way.
645
+ Object.assign(mappedResult, describeSavedResults(saveResults, result.savedFiles));
639
646
  // Step 5b: Record pattern usage on success (Phase 5.3 — fire-and-forget)
640
647
  recordPatternUsageAsync(routingResult?.patternHints, true, domain, result.duration);
641
648
  // Step 5c: Capture real execution learning (fire-and-forget)
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Agentic QE v3 - saveResults option (#925)
3
+ *
4
+ * Domain tools that run through the handler factory persist their output via
5
+ * the task executor's ResultSaver (.agentic-qe/results/<kind>/...). This module
6
+ * holds the boundary validation for the per-call `saveResults` opt-out and the
7
+ * wording the tools report back, so every tool states the same thing.
8
+ *
9
+ * @module mcp/handlers/save-results-option
10
+ */
11
+ import type { ToolParameter } from '../types';
12
+ /** Directory (relative to the project) that ResultSaver writes under. */
13
+ export declare const RESULTS_DIR = ".agentic-qe/results/";
14
+ /**
15
+ * Every MCP tool whose handler is built by createDomainHandler, and so writes
16
+ * through ResultSaver (#933): what it saves, and the verb for "Set false to
17
+ * <verb> without writing...". Subdirectories match ResultSaver.save().
18
+ */
19
+ export declare const RESULT_SAVING_TOOLS: {
20
+ readonly test_generate_enhanced: {
21
+ readonly saves: "a manifest and report under .agentic-qe/results/tests/";
22
+ readonly verb: "generate";
23
+ };
24
+ readonly test_execute_parallel: {
25
+ readonly saves: "the run results under .agentic-qe/results/other/";
26
+ readonly verb: "run the tests";
27
+ };
28
+ readonly coverage_analyze_sublinear: {
29
+ readonly saves: "coverage results and a report under .agentic-qe/results/coverage/";
30
+ readonly verb: "analyze";
31
+ };
32
+ readonly quality_assess: {
33
+ readonly saves: "an assessment and report under .agentic-qe/results/quality/";
34
+ readonly verb: "assess";
35
+ };
36
+ readonly security_scan_comprehensive: {
37
+ readonly saves: "scan results and a report under .agentic-qe/results/security/";
38
+ readonly verb: "scan";
39
+ };
40
+ readonly contract_validate: {
41
+ readonly saves: "the validation results under .agentic-qe/results/contracts/";
42
+ readonly verb: "validate";
43
+ };
44
+ readonly accessibility_test: {
45
+ readonly saves: "the test results under .agentic-qe/results/accessibility/";
46
+ readonly verb: "test";
47
+ };
48
+ readonly chaos_test: {
49
+ readonly saves: "the chaos run results under .agentic-qe/results/chaos/";
50
+ readonly verb: "run";
51
+ };
52
+ readonly defect_predict: {
53
+ readonly saves: "the prediction under .agentic-qe/results/defects/";
54
+ readonly verb: "predict";
55
+ };
56
+ readonly requirements_validate: {
57
+ readonly saves: "the validation results under .agentic-qe/results/other/";
58
+ readonly verb: "validate";
59
+ };
60
+ readonly code_index: {
61
+ readonly saves: "the index results under .agentic-qe/results/code-index/";
62
+ readonly verb: "index";
63
+ };
64
+ };
65
+ export type ResultSavingTool = keyof typeof RESULT_SAVING_TOOLS;
66
+ /**
67
+ * Short hint a result-saving tool adds to its top-level description. Tool
68
+ * descriptions are kept short for clients that truncate them (OpenCode shows
69
+ * about 200 characters), so the full explanation lives in the `saveResults`
70
+ * parameter description instead.
71
+ */
72
+ export declare const SAVE_RESULTS_HINT = "Saves results (saveResults).";
73
+ /** The `saveResults` input parameter, worded the same for every tool. */
74
+ export declare function saveResultsParameter(tool: ResultSavingTool): ToolParameter;
75
+ /**
76
+ * Read and validate the optional `saveResults` parameter.
77
+ *
78
+ * @returns true when results should be saved (the default), false to opt out.
79
+ * @throws Error when the parameter is present but not a boolean.
80
+ */
81
+ export declare function readSaveResultsOption(params: unknown): boolean;
82
+ export interface SavedResultsReport {
83
+ /** True when at least one result file was written. */
84
+ resultsSaved: boolean;
85
+ /** Paths of the files written; empty when nothing was written. */
86
+ savedFiles: string[];
87
+ /** Plain statement of what was written, for the caller to relay. */
88
+ resultsNote: string;
89
+ }
90
+ /**
91
+ * Describe what the result saver did for one call.
92
+ *
93
+ * @param saveResults - the validated option value
94
+ * @param savedFiles - paths the task executor reported as written
95
+ */
96
+ export declare function describeSavedResults(saveResults: boolean, savedFiles: string[] | undefined): SavedResultsReport;
97
+ //# sourceMappingURL=save-results-option.d.ts.map
@@ -0,0 +1,94 @@
1
+ /**
2
+ * Agentic QE v3 - saveResults option (#925)
3
+ *
4
+ * Domain tools that run through the handler factory persist their output via
5
+ * the task executor's ResultSaver (.agentic-qe/results/<kind>/...). This module
6
+ * holds the boundary validation for the per-call `saveResults` opt-out and the
7
+ * wording the tools report back, so every tool states the same thing.
8
+ *
9
+ * @module mcp/handlers/save-results-option
10
+ */
11
+ /** Directory (relative to the project) that ResultSaver writes under. */
12
+ export const RESULTS_DIR = '.agentic-qe/results/';
13
+ /**
14
+ * Every MCP tool whose handler is built by createDomainHandler, and so writes
15
+ * through ResultSaver (#933): what it saves, and the verb for "Set false to
16
+ * <verb> without writing...". Subdirectories match ResultSaver.save().
17
+ */
18
+ export const RESULT_SAVING_TOOLS = {
19
+ test_generate_enhanced: { saves: 'a manifest and report under .agentic-qe/results/tests/', verb: 'generate' },
20
+ test_execute_parallel: { saves: 'the run results under .agentic-qe/results/other/', verb: 'run the tests' },
21
+ coverage_analyze_sublinear: { saves: 'coverage results and a report under .agentic-qe/results/coverage/', verb: 'analyze' },
22
+ quality_assess: { saves: 'an assessment and report under .agentic-qe/results/quality/', verb: 'assess' },
23
+ security_scan_comprehensive: { saves: 'scan results and a report under .agentic-qe/results/security/', verb: 'scan' },
24
+ contract_validate: { saves: 'the validation results under .agentic-qe/results/contracts/', verb: 'validate' },
25
+ accessibility_test: { saves: 'the test results under .agentic-qe/results/accessibility/', verb: 'test' },
26
+ chaos_test: { saves: 'the chaos run results under .agentic-qe/results/chaos/', verb: 'run' },
27
+ defect_predict: { saves: 'the prediction under .agentic-qe/results/defects/', verb: 'predict' },
28
+ requirements_validate: { saves: 'the validation results under .agentic-qe/results/other/', verb: 'validate' },
29
+ code_index: { saves: 'the index results under .agentic-qe/results/code-index/', verb: 'index' },
30
+ };
31
+ /**
32
+ * Short hint a result-saving tool adds to its top-level description. Tool
33
+ * descriptions are kept short for clients that truncate them (OpenCode shows
34
+ * about 200 characters), so the full explanation lives in the `saveResults`
35
+ * parameter description instead.
36
+ */
37
+ export const SAVE_RESULTS_HINT = 'Saves results (saveResults).';
38
+ /** The `saveResults` input parameter, worded the same for every tool. */
39
+ export function saveResultsParameter(tool) {
40
+ const { saves, verb } = RESULT_SAVING_TOOLS[tool];
41
+ return {
42
+ name: 'saveResults',
43
+ type: 'boolean',
44
+ description: `Save ${saves} (default true). Set false to ${verb} without writing any files under ${RESULTS_DIR}. The server state store (.agentic-qe/memory.db) is updated either way.`,
45
+ default: true,
46
+ };
47
+ }
48
+ /**
49
+ * Read and validate the optional `saveResults` parameter.
50
+ *
51
+ * @returns true when results should be saved (the default), false to opt out.
52
+ * @throws Error when the parameter is present but not a boolean.
53
+ */
54
+ export function readSaveResultsOption(params) {
55
+ if (params === null || typeof params !== 'object')
56
+ return true;
57
+ const value = params.saveResults;
58
+ // Some clients send null for an omitted optional; treat it as unset.
59
+ if (value === undefined || value === null)
60
+ return true;
61
+ if (typeof value !== 'boolean') {
62
+ throw new Error(`saveResults must be a boolean (true or false), got ${typeof value}.`);
63
+ }
64
+ return value;
65
+ }
66
+ /**
67
+ * Describe what the result saver did for one call.
68
+ *
69
+ * @param saveResults - the validated option value
70
+ * @param savedFiles - paths the task executor reported as written
71
+ */
72
+ export function describeSavedResults(saveResults, savedFiles) {
73
+ if (!saveResults) {
74
+ return {
75
+ resultsSaved: false,
76
+ savedFiles: [],
77
+ resultsNote: `saveResults was false: no files were written under ${RESULTS_DIR}.`,
78
+ };
79
+ }
80
+ const files = savedFiles ?? [];
81
+ if (files.length === 0) {
82
+ return {
83
+ resultsSaved: false,
84
+ savedFiles: [],
85
+ resultsNote: `No result files were written under ${RESULTS_DIR} (saving is disabled or failed).`,
86
+ };
87
+ }
88
+ return {
89
+ resultsSaved: true,
90
+ savedFiles: files,
91
+ resultsNote: `Saved ${files.length} result file(s) under ${RESULTS_DIR}; see savedFiles. Pass saveResults: false to skip.`,
92
+ };
93
+ }
94
+ //# sourceMappingURL=save-results-option.js.map
@@ -43,6 +43,7 @@ import { getPerformanceMonitor, } from './performance-monitor.js';
43
43
  import { ToolCallSignatureTracker } from '../kernel/anti-drift-middleware.js';
44
44
  import { formatErrorForLog } from '../logging/redaction.js';
45
45
  import { BEHAVIOR_EXAMPLE_ITEM_SCHEMA } from '../domains/test-generation/services/behavior-example-validation.js';
46
+ import { SAVE_RESULTS_HINT, saveResultsParameter } from './handlers/save-results-option.js';
46
47
  import { requestOwnedShutdown } from '../kernel/process-lifecycle.js';
47
48
  import { createRequire } from 'module';
48
49
  const _require = createRequire(import.meta.url);
@@ -848,7 +849,7 @@ export class MCPProtocolServer {
848
849
  this.registerTool({
849
850
  definition: {
850
851
  name: 'test_generate_enhanced',
851
- description: 'Generate unit/integration/e2e tests with AI pattern recognition and anti-pattern detection. Example: test_generate_enhanced({ sourceCode: "function add(a,b){return a+b}", testType: "unit", framework: "jest" })',
852
+ description: 'Generate unit/integration/e2e tests with AI pattern recognition and anti-pattern detection. By default saves a manifest and report under .agentic-qe/results/tests/ (paths returned in savedFiles); pass saveResults: false to generate without writing any result files. Example: test_generate_enhanced({ sourceCode: "function add(a,b){return a+b}", testType: "unit", framework: "jest" })',
852
853
  category: 'domain',
853
854
  parameters: [
854
855
  { name: 'sourceCode', type: 'string', description: 'Source code to generate tests for' },
@@ -860,6 +861,7 @@ export class MCPProtocolServer {
860
861
  { name: 'behaviorExamples', type: 'array', description: 'Trusted specification fixtures: [{functionName: "add", args: [2,3], expected: 5}]. Named JS/TS functions with required simple parameters; unit vitest/jest/node-test. No source-derived oracle. Omit for scaffolding.', items: BEHAVIOR_EXAMPLE_ITEM_SCHEMA },
861
862
  { name: 'aiEnhancement', type: 'boolean', description: 'Enable AI-powered enhancement', default: true },
862
863
  { name: 'detectAntiPatterns', type: 'boolean', description: 'Detect and report anti-patterns', default: false },
864
+ saveResultsParameter('test_generate_enhanced'),
863
865
  ],
864
866
  },
865
867
  handler: (params) => handleTestGenerate(params),
@@ -868,11 +870,12 @@ export class MCPProtocolServer {
868
870
  this.registerTool({
869
871
  definition: {
870
872
  name: 'test_execute_parallel',
871
- description: 'Execute test files in parallel with automatic retry on flaky failures. Example: test_execute_parallel({ testFiles: ["tests/auth.test.ts"], parallel: true })',
873
+ description: `Execute test files in parallel with automatic retry on flaky failures. ${SAVE_RESULTS_HINT} Example: test_execute_parallel({ testFiles: ["tests/auth.test.ts"], parallel: true })`,
872
874
  category: 'domain',
873
875
  parameters: [
874
876
  { name: 'testFiles', type: 'array', description: 'Nonempty list of concrete test file paths (relative to the project working directory or absolute). Expand glob patterns before calling; glob patterns are rejected.' },
875
877
  { name: 'parallel', type: 'boolean', description: 'Enable parallel execution', default: true },
878
+ saveResultsParameter('test_execute_parallel'),
876
879
  ],
877
880
  },
878
881
  handler: (params) => handleTestExecute(params),
@@ -881,12 +884,13 @@ export class MCPProtocolServer {
881
884
  this.registerTool({
882
885
  definition: {
883
886
  name: 'coverage_analyze_sublinear',
884
- description: 'Analyze code coverage with O(log n) sublinear algorithm and ML-powered gap detection. Example: coverage_analyze_sublinear({ target: "src/", detectGaps: true })',
887
+ description: `Analyze code coverage with O(log n) sublinear algorithm and ML-powered gap detection. ${SAVE_RESULTS_HINT} Example: coverage_analyze_sublinear({ target: "src/", detectGaps: true })`,
885
888
  category: 'domain',
886
889
  isConcurrencySafe: true,
887
890
  parameters: [
888
891
  { name: 'target', type: 'string', description: 'Target path to analyze', required: true },
889
892
  { name: 'detectGaps', type: 'boolean', description: 'Detect coverage gaps', default: true },
893
+ saveResultsParameter('coverage_analyze_sublinear'),
890
894
  ],
891
895
  },
892
896
  handler: (params) => handleCoverageAnalyze(params),
@@ -895,11 +899,12 @@ export class MCPProtocolServer {
895
899
  this.registerTool({
896
900
  definition: {
897
901
  name: 'quality_assess',
898
- description: 'Assess code quality metrics and optionally run a pass/fail quality gate. Example: quality_assess({ runGate: true })',
902
+ description: `Assess code quality metrics and optionally run a pass/fail quality gate. ${SAVE_RESULTS_HINT} Example: quality_assess({ runGate: true })`,
899
903
  category: 'domain',
900
904
  isConcurrencySafe: true,
901
905
  parameters: [
902
906
  { name: 'runGate', type: 'boolean', description: 'Evaluate all seven canonical measured quality checks; requires complete, valid evidence from the last 24 hours. Returns individual checks, not a static aggregate score.', default: false },
907
+ saveResultsParameter('quality_assess'),
903
908
  ],
904
909
  },
905
910
  handler: (params) => handleQualityAssess(params),
@@ -908,13 +913,14 @@ export class MCPProtocolServer {
908
913
  this.registerTool({
909
914
  definition: {
910
915
  name: 'security_scan_comprehensive',
911
- description: 'Run security scans with execution evidence and explicit coverage limitations. Complete means the declared required scope ran, not that all vulnerabilities are absent. Example: security_scan_comprehensive({ target: "src/", sast: true })',
916
+ description: `Run security scans with execution evidence and explicit coverage limitations. Complete means the declared required scope ran, not that all vulnerabilities are absent. Example: security_scan_comprehensive({ target: "src/", sast: true })`,
912
917
  category: 'domain',
913
918
  parameters: [
914
919
  { name: 'sast', type: 'boolean', description: 'Run SAST scan', default: true },
915
920
  { name: 'dast', type: 'boolean', description: 'Run DAST scan', default: false },
916
921
  { name: 'target', type: 'string', description: 'Source file or directory for SAST' },
917
922
  { name: 'targetUrl', type: 'string', description: 'URL for a requested DAST scan' },
923
+ saveResultsParameter('security_scan_comprehensive'),
918
924
  ],
919
925
  },
920
926
  handler: (params) => handleSecurityScan(params),
@@ -923,10 +929,11 @@ export class MCPProtocolServer {
923
929
  this.registerTool({
924
930
  definition: {
925
931
  name: 'contract_validate',
926
- description: 'Validate API contracts for breaking changes against consumers. Example: contract_validate({ contractPath: "api/openapi.yaml" })',
932
+ description: `Validate API contracts for breaking changes against consumers. ${SAVE_RESULTS_HINT} Example: contract_validate({ contractPath: "api/openapi.yaml" })`,
927
933
  category: 'domain',
928
934
  parameters: [
929
935
  { name: 'contractPath', type: 'string', description: 'Path to contract file' },
936
+ saveResultsParameter('contract_validate'),
930
937
  ],
931
938
  },
932
939
  handler: (params) => handleContractValidate(params),
@@ -935,11 +942,12 @@ export class MCPProtocolServer {
935
942
  this.registerTool({
936
943
  definition: {
937
944
  name: 'accessibility_test',
938
- description: 'Test accessibility against WCAG 2.1/2.2 and Section 508 standards. Example: accessibility_test({ url: "http://localhost:3000", standard: "wcag21-aa" })',
945
+ description: `Test accessibility against WCAG 2.1/2.2 and Section 508 standards. ${SAVE_RESULTS_HINT} Example: accessibility_test({ url: "http://localhost:3000", standard: "wcag21-aa" })`,
939
946
  category: 'domain',
940
947
  parameters: [
941
948
  { name: 'url', type: 'string', description: 'URL to test', required: true },
942
949
  { name: 'standard', type: 'string', description: 'Accessibility standard' },
950
+ saveResultsParameter('accessibility_test'),
943
951
  ],
944
952
  },
945
953
  handler: (params) => handleAccessibilityTest(params),
@@ -948,11 +956,12 @@ export class MCPProtocolServer {
948
956
  this.registerTool({
949
957
  definition: {
950
958
  name: 'chaos_test',
951
- description: 'Inject faults (latency, errors, CPU) for chaos engineering resilience testing. Example: chaos_test({ faultType: "latency", target: "api-service" })',
959
+ description: `Inject faults (latency, errors, CPU) for chaos engineering resilience testing. ${SAVE_RESULTS_HINT} Example: chaos_test({ faultType: "latency", target: "api-service" })`,
952
960
  category: 'domain',
953
961
  parameters: [
954
962
  { name: 'faultType', type: 'string', description: 'Type of fault to inject' },
955
963
  { name: 'target', type: 'string', description: 'Target service' },
964
+ saveResultsParameter('chaos_test'),
956
965
  ],
957
966
  },
958
967
  handler: (params) => handleChaosTest(params),
@@ -961,11 +970,12 @@ export class MCPProtocolServer {
961
970
  this.registerTool({
962
971
  definition: {
963
972
  name: 'defect_predict',
964
- description: 'Predict potential defects using AI analysis of code complexity and change history. Example: defect_predict({ target: "src/auth/" })',
973
+ description: `Predict potential defects using AI analysis of code complexity and change history. ${SAVE_RESULTS_HINT} Example: defect_predict({ target: "src/auth/" })`,
965
974
  category: 'domain',
966
975
  isConcurrencySafe: true,
967
976
  parameters: [
968
977
  { name: 'target', type: 'string', description: 'Target path', required: true },
978
+ saveResultsParameter('defect_predict'),
969
979
  ],
970
980
  },
971
981
  handler: (params) => handleDefectPredict(params),
@@ -974,11 +984,12 @@ export class MCPProtocolServer {
974
984
  this.registerTool({
975
985
  definition: {
976
986
  name: 'requirements_validate',
977
- description: 'Validate requirements for completeness and generate BDD scenarios. Example: requirements_validate({ requirementsPath: "docs/requirements.md" })',
987
+ description: `Validate requirements for completeness and generate BDD scenarios. ${SAVE_RESULTS_HINT} Example: requirements_validate({ requirementsPath: "docs/requirements.md" })`,
978
988
  category: 'domain',
979
989
  isConcurrencySafe: true,
980
990
  parameters: [
981
991
  { name: 'requirementsPath', type: 'string', description: 'Path to requirements' },
992
+ saveResultsParameter('requirements_validate'),
982
993
  ],
983
994
  },
984
995
  handler: (params) => handleRequirementsValidate(params),
@@ -987,11 +998,12 @@ export class MCPProtocolServer {
987
998
  this.registerTool({
988
999
  definition: {
989
1000
  name: 'code_index',
990
- description: 'Index source code into the knowledge graph for dependency and impact analysis. Example: code_index({ target: "src/" })',
1001
+ description: `Index source code into the knowledge graph for dependency and impact analysis. ${SAVE_RESULTS_HINT} Example: code_index({ target: "src/" })`,
991
1002
  category: 'domain',
992
1003
  isConcurrencySafe: true,
993
1004
  parameters: [
994
1005
  { name: 'target', type: 'string', description: 'Target path', required: true },
1006
+ saveResultsParameter('code_index'),
995
1007
  ],
996
1008
  },
997
1009
  handler: (params) => handleCodeIndex(params),
@@ -101,7 +101,12 @@ export declare class RateLimiter {
101
101
  */
102
102
  consume(clientId?: string, endpoint?: string, tokens?: number): RateLimitResult;
103
103
  /**
104
- * Wait until tokens are available (async)
104
+ * Wait until tokens are available (async).
105
+ *
106
+ * Rejects with a RangeError instead of waiting forever when the request can
107
+ * never be admitted: the cost exceeds the resolved bucket's maxBurst, or the
108
+ * bucket cannot refill (tokensPerSecond <= 0), or the refill delay exceeds
109
+ * what setTimeout can represent (it would clamp to 1 ms and spin). See #905.
105
110
  */
106
111
  wait(clientId?: string, endpoint?: string, tokens?: number): Promise<RateLimitResult>;
107
112
  /**
@@ -132,6 +137,8 @@ export declare class RateLimiter {
132
137
  * Dispose the rate limiter
133
138
  */
134
139
  dispose(): void;
140
+ /** Throw if `tokens` can never fit in the bucket resolved for `endpoint`. */
141
+ private assertAdmissible;
135
142
  private createBucket;
136
143
  private getBucket;
137
144
  private getEndpointKey;
@@ -9,6 +9,8 @@
9
9
  * - Configurable limits per endpoint
10
10
  */
11
11
  import { createSafeRegex } from './validators/regex-safety-validator.js';
12
+ /** Largest delay setTimeout honours; larger values are clamped to 1 ms. */
13
+ const MAX_TIMER_DELAY_MS = 2_147_483_647;
12
14
  // ============================================================================
13
15
  // Token Bucket Implementation
14
16
  // ============================================================================
@@ -121,12 +123,29 @@ export class RateLimiter {
121
123
  };
122
124
  }
123
125
  /**
124
- * Wait until tokens are available (async)
126
+ * Wait until tokens are available (async).
127
+ *
128
+ * Rejects with a RangeError instead of waiting forever when the request can
129
+ * never be admitted: the cost exceeds the resolved bucket's maxBurst, or the
130
+ * bucket cannot refill (tokensPerSecond <= 0), or the refill delay exceeds
131
+ * what setTimeout can represent (it would clamp to 1 ms and spin). See #905.
125
132
  */
126
133
  async wait(clientId, endpoint, tokens = 1) {
134
+ this.assertAdmissible(endpoint, tokens);
127
135
  let result = this.consume(clientId, endpoint, tokens);
128
- while (!result.allowed && result.retryAfter) {
129
- await this.sleep(result.retryAfter);
136
+ while (!result.allowed) {
137
+ const delay = result.retryAfter;
138
+ if (delay === undefined || !Number.isFinite(delay) || delay <= 0) {
139
+ throw new RangeError(`Rate limit bucket for ${endpoint ?? 'default'} cannot refill (retryAfter=${delay}); ` +
140
+ 'wait() would never settle');
141
+ }
142
+ if (delay > MAX_TIMER_DELAY_MS) {
143
+ throw new RangeError(`Rate limit retryAfter ${delay}ms for ${endpoint ?? 'default'} bucket exceeds the ` +
144
+ `${MAX_TIMER_DELAY_MS}ms setTimeout maximum; wait() would spin instead of sleeping`);
145
+ }
146
+ await this.sleep(delay);
147
+ // Endpoint limits may change while sleeping; re-check before retrying.
148
+ this.assertAdmissible(endpoint, tokens);
130
149
  result = this.consume(clientId, endpoint, tokens);
131
150
  }
132
151
  return result;
@@ -199,6 +218,14 @@ export class RateLimiter {
199
218
  // ============================================================================
200
219
  // Private Methods
201
220
  // ============================================================================
221
+ /** Throw if `tokens` can never fit in the bucket resolved for `endpoint`. */
222
+ assertAdmissible(endpoint, tokens) {
223
+ const { maxBurst } = this.getConfig(endpoint);
224
+ if (tokens > maxBurst) {
225
+ throw new RangeError(`Token cost ${tokens} exceeds maxBurst ${maxBurst} for ${endpoint ?? 'default'} bucket; ` +
226
+ 'wait() can never admit it');
227
+ }
228
+ }
202
229
  createBucket() {
203
230
  const now = Date.now();
204
231
  return {
@@ -274,7 +301,9 @@ export class RateLimiter {
274
301
  };
275
302
  }
276
303
  refillBucket(bucket, tokensPerSecond, maxBurst, now) {
277
- const elapsed = (now - bucket.lastUpdate) / 1000;
304
+ // A bucket created after `now` was read (or a clock step back) must not
305
+ // remove tokens, so negative elapsed time counts as zero.
306
+ const elapsed = Math.max(0, now - bucket.lastUpdate) / 1000;
278
307
  const newTokens = elapsed * tokensPerSecond;
279
308
  bucket.tokens = Math.min(maxBurst, bucket.tokens + newTokens);
280
309
  bucket.lastUpdate = now;
@@ -43,6 +43,14 @@ function isValidEntry(value) {
43
43
  && Number.isSafeInteger(entry.tokenEstimate)
44
44
  && entry.tokenEstimate >= 0));
45
45
  }
46
+ /** Entries a session-store gap marker stands for (#910), or 0 for an ordinary entry. */
47
+ function gapSize(entry) {
48
+ if (entry.type !== 'state_change' || !entry.result || typeof entry.result !== 'object')
49
+ return 0;
50
+ const gap = entry.result.journalGap;
51
+ const dropped = gap?.droppedEntries;
52
+ return typeof dropped === 'number' && Number.isSafeInteger(dropped) && dropped > 0 ? dropped : 0;
53
+ }
46
54
  function resolveLimit(value, defaultValue) {
47
55
  const limit = value ?? defaultValue;
48
56
  return Number.isSafeInteger(limit) && limit > 0 && limit <= defaultValue ? limit : undefined;
@@ -168,6 +176,7 @@ export function resumeSession(filePath, options) {
168
176
  const entries = [];
169
177
  const seen = new Set();
170
178
  let previous;
179
+ let droppedInGaps = 0;
171
180
  for (const rawLine of lines) {
172
181
  if (!rawLine.trim())
173
182
  continue;
@@ -198,6 +207,7 @@ export function resumeSession(filePath, options) {
198
207
  return emptyResult(filePath, 'INVALID', ['first entry has a forged parentUuid']);
199
208
  }
200
209
  seen.add(parsed.uuid);
210
+ droppedInGaps += gapSize(parsed);
201
211
  entries.push(parsed);
202
212
  previous = parsed;
203
213
  }
@@ -208,6 +218,7 @@ export function resumeSession(filePath, options) {
208
218
  const diagnostics = [
209
219
  'legacy JSONL has no durable commit marker',
210
220
  ...(hasTornTail ? ['discarded an incomplete final record'] : []),
221
+ ...(droppedInGaps > 0 ? [`journal gap: ${droppedInGaps} entries dropped while the disk was failing`] : []),
211
222
  ];
212
223
  return {
213
224
  metadata: {
@@ -6,6 +6,12 @@
6
6
  * changes within a session. Supports write batching (100ms window) and
7
7
  * lazy file creation (no file until first append).
8
8
  *
9
+ * Issue #910: writes track progress byte by byte, so a write that fails partway
10
+ * (ENOSPC, EIO) resumes where it stopped instead of re-appending what already
11
+ * reached the disk. The unwritten backlog is bounded while the disk keeps
12
+ * failing; dropped entries become one gap marker that keeps the transcript
13
+ * resumable (see session-write-buffer.ts).
14
+ *
9
15
  * @module mcp/services/session-store
10
16
  */
11
17
  export interface SessionEntry {
@@ -27,6 +33,18 @@ export interface SessionMetadata {
27
33
  state: 'idle' | 'running' | 'requires_action';
28
34
  }
29
35
  export type SessionEntryInput = Omit<SessionEntry, 'uuid' | 'parentUuid'>;
36
+ export interface SessionStoreOptions {
37
+ /** Most unwritten entries held while writes fail. Oldest are dropped beyond it. */
38
+ maxBufferedEntries?: number;
39
+ /** Most unwritten bytes held while writes fail. Oldest are dropped beyond it. */
40
+ maxBufferedBytes?: number;
41
+ }
42
+ export interface SessionWriteBufferStats {
43
+ bufferedEntries: number;
44
+ bufferedBytes: number;
45
+ /** Entries replaced by a gap marker in this session because the buffer hit a cap. */
46
+ droppedEntries: number;
47
+ }
30
48
  export declare class SessionStore {
31
49
  private readonly sessionDir;
32
50
  private sessionId;
@@ -37,11 +55,15 @@ export declare class SessionStore {
37
55
  private createdAt;
38
56
  private lastActivityAt;
39
57
  private currentState;
58
+ /** Lines not yet fully on disk, oldest first. */
40
59
  private writeBuffer;
60
+ private dropWarned;
61
+ private readonly maxBufferedEntries;
62
+ private readonly maxBufferedBytes;
41
63
  private flushTimer;
42
64
  private closed;
43
65
  private readonly persistDisabled;
44
- constructor(sessionDir?: string);
66
+ constructor(sessionDir?: string, options?: SessionStoreOptions);
45
67
  /**
46
68
  * Start a new session. Returns the sessionId (UUID).
47
69
  * File is NOT created until the first append (lazy creation).
@@ -52,7 +74,7 @@ export declare class SessionStore {
52
74
  * Assigns a uuid, links parentUuid to the previous entry,
53
75
  * and writes a JSON line to the file.
54
76
  *
55
- * First write uses appendFileSync for write-ahead guarantee.
77
+ * The first write is synchronous for a write-ahead guarantee.
56
78
  * Subsequent writes are batched for up to 100ms before flushing.
57
79
  *
58
80
  * Returns the assigned uuid.
@@ -62,6 +84,10 @@ export declare class SessionStore {
62
84
  * Force sync any buffered writes to disk immediately.
63
85
  */
64
86
  flush(): void;
87
+ /**
88
+ * Size of the unwritten backlog and how many entries the cap has dropped.
89
+ */
90
+ getWriteBufferStats(): SessionWriteBufferStats;
65
91
  /**
66
92
  * Returns metadata about the current session.
67
93
  */
@@ -80,6 +106,9 @@ export declare class SessionStore {
80
106
  */
81
107
  getFilePath(): string | null;
82
108
  private ensureDirectory;
109
+ private accept;
110
+ private writePending;
111
+ private createWriteBuffer;
83
112
  private scheduleBatchFlush;
84
113
  }
85
114
  //# sourceMappingURL=session-store.d.ts.map