agentic-qe 3.15.2 → 3.15.4

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 (445) 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 +155 -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-T54G3TBK.js +2 -0
  10. package/dist/cli/chunks/{agent-booster-wasm-664M7426.js → agent-booster-wasm-MHJBRXMK.js} +2 -2
  11. package/dist/cli/chunks/{agent-handler-E47ITH45.js → agent-handler-G64SD7J2.js} +2 -2
  12. package/dist/cli/chunks/{agent-memory-branch-CFWVOJX3.js → agent-memory-branch-G4UXFPKH.js} +2 -2
  13. package/dist/cli/chunks/aqe-learning-engine-HLCJJ3JM.js +2 -0
  14. package/dist/cli/chunks/{arena-ZU5CGBGH.js → arena-63M3M6EW.js} +2 -2
  15. package/dist/cli/chunks/{arena-JM3OY263.js → arena-QJMKYPHS.js} +4 -4
  16. package/dist/cli/chunks/{audit-HVBRC5AS.js → audit-UDFVTWSX.js} +3 -3
  17. package/dist/cli/chunks/base-VLD755UU.js +2 -0
  18. package/dist/cli/chunks/{better-sqlite3-45JLBQX3.js → better-sqlite3-JLX2G56I.js} +2 -2
  19. package/dist/cli/chunks/{brain-handler-FKDONZYA.js → brain-handler-PWF32LLW.js} +3 -3
  20. package/dist/cli/chunks/{branch-enumerator-M3DPS3D5.js → branch-enumerator-PB7QWXDP.js} +2 -2
  21. package/dist/cli/chunks/{browser-TG2TV6NR.js → browser-CYNV2F3U.js} +2 -2
  22. package/dist/cli/chunks/browser-workflow-6M6VLWRF.js +2 -0
  23. package/dist/cli/chunks/{chunk-JFFVYCTV.js → chunk-2534PXIV.js} +2 -2
  24. package/dist/cli/chunks/{chunk-GHXNRF63.js → chunk-2DRMTRBM.js} +2 -2
  25. package/dist/cli/chunks/{chunk-L77Z3Q6L.js → chunk-2ICC4H6K.js} +2 -2
  26. package/dist/cli/chunks/{chunk-EATZW5T2.js → chunk-2LL35V3A.js} +2 -2
  27. package/dist/cli/chunks/{chunk-MEUJWTOX.js → chunk-2MU4WCMQ.js} +2 -2
  28. package/dist/cli/chunks/{chunk-3RC5UMRJ.js → chunk-33IUCP34.js} +2 -2
  29. package/dist/cli/chunks/{chunk-UX4BOI6K.js → chunk-35A22AUL.js} +1 -1
  30. package/dist/cli/chunks/{chunk-Z7XCXHEB.js → chunk-3BDDOFYW.js} +2 -2
  31. package/dist/cli/chunks/chunk-3C2BFLYC.js +54 -0
  32. package/dist/cli/chunks/{chunk-56CE7UO4.js → chunk-3MSBVOYW.js} +6 -6
  33. package/dist/cli/chunks/{chunk-EDRIROCG.js → chunk-3ZIVBTX6.js} +2 -2
  34. package/dist/cli/chunks/{chunk-CRYZXTSQ.js → chunk-4GLR2S2M.js} +2 -2
  35. package/dist/cli/chunks/{chunk-DHSGCI6H.js → chunk-54ITMOFM.js} +6 -6
  36. package/dist/cli/chunks/{chunk-2AWU2E6R.js → chunk-54XTJBHV.js} +1 -1
  37. package/dist/cli/chunks/{chunk-JSTKSPYT.js → chunk-5B5D5KCV.js} +1 -1
  38. package/dist/cli/chunks/{chunk-NP2WWIZ3.js → chunk-5GWTJJEO.js} +1 -1
  39. package/dist/cli/chunks/{chunk-D75HDHX3.js → chunk-5H7MR6HP.js} +1 -1
  40. package/dist/cli/chunks/{chunk-NWYAV2UG.js → chunk-5SS2Z7JC.js} +2 -2
  41. package/dist/cli/chunks/chunk-5XXLWJU7.js +2 -0
  42. package/dist/cli/chunks/{chunk-B4H66LPR.js → chunk-6EHVPFHW.js} +1 -1
  43. package/dist/cli/chunks/{chunk-HSXLHNSS.js → chunk-6HO3XRXE.js} +2 -2
  44. package/dist/cli/chunks/chunk-6HTO4BLV.js +2 -0
  45. package/dist/cli/chunks/{chunk-SVHFSOGT.js → chunk-6QPW4OVH.js} +1 -1
  46. package/dist/cli/chunks/{chunk-BKZSTZDB.js → chunk-6TMUZGM2.js} +1 -1
  47. package/dist/cli/chunks/{chunk-2AOAEMJG.js → chunk-73MTUM6F.js} +2 -2
  48. package/dist/cli/chunks/{chunk-ANI3KPB7.js → chunk-73PCVMGA.js} +2 -2
  49. package/dist/cli/chunks/{chunk-HADOG2PT.js → chunk-76PRW2KY.js} +2 -2
  50. package/dist/cli/chunks/{chunk-NL6HKEPR.js → chunk-7INP6HZH.js} +3 -3
  51. package/dist/cli/chunks/{chunk-QB7H62A4.js → chunk-7X2IVMXN.js} +2 -2
  52. package/dist/cli/chunks/{chunk-ZVQSIH7Y.js → chunk-A4OPQJ4A.js} +8 -8
  53. package/dist/cli/chunks/{chunk-SKQTRYE7.js → chunk-ADF6LGHZ.js} +2 -2
  54. package/dist/cli/chunks/{chunk-5YS2DF5G.js → chunk-AHVN3UQZ.js} +2 -2
  55. package/dist/cli/chunks/{chunk-3XF7YTQC.js → chunk-AOKSLWON.js} +54 -54
  56. package/dist/cli/chunks/{chunk-CFDIYZGA.js → chunk-ASKPTGUU.js} +2 -2
  57. package/dist/cli/chunks/{chunk-LH3H4V7C.js → chunk-B7GJXQD2.js} +2 -2
  58. package/dist/cli/chunks/{chunk-HOBBYORR.js → chunk-B7J3O2WM.js} +1 -1
  59. package/dist/cli/chunks/{chunk-J4EJMAH3.js → chunk-BBKLVHDQ.js} +1 -1
  60. package/dist/cli/chunks/{chunk-WMNVFCKY.js → chunk-BND6M2JX.js} +2 -2
  61. package/dist/cli/chunks/{chunk-LRVR56PD.js → chunk-BPGFCUDO.js} +1 -1
  62. package/dist/cli/chunks/{chunk-O6QTCUSL.js → chunk-BY3IL56R.js} +1 -1
  63. package/dist/cli/chunks/{chunk-3KXKJSKS.js → chunk-BY5PLEPZ.js} +32 -32
  64. package/dist/cli/chunks/{chunk-DGKPGRBT.js → chunk-BZWZTGMF.js} +2 -2
  65. package/dist/cli/chunks/{chunk-AS27JP67.js → chunk-C5EN5WB6.js} +1 -1
  66. package/dist/cli/chunks/chunk-CFXFGQEN.js +15 -0
  67. package/dist/cli/chunks/{chunk-X4CADOSD.js → chunk-CQ3WSTJ2.js} +2 -2
  68. package/dist/cli/chunks/{chunk-HFF5ERIE.js → chunk-D7RVZ5C2.js} +2 -2
  69. package/dist/cli/chunks/{chunk-HS3O763N.js → chunk-DAYMT7TH.js} +21 -21
  70. package/dist/cli/chunks/{chunk-W6PLBRRS.js → chunk-DBIK4OFX.js} +1 -1
  71. package/dist/cli/chunks/{chunk-OWZ3F7DJ.js → chunk-DEJM2P5K.js} +1 -1
  72. package/dist/cli/chunks/{chunk-TC4B5D4Z.js → chunk-DF4Y3HPO.js} +1 -1
  73. package/dist/cli/chunks/{chunk-7UA7SMM4.js → chunk-DFJGXXCL.js} +1 -1
  74. package/dist/cli/chunks/{chunk-SZYK5JL7.js → chunk-DPL4ZXTE.js} +1 -1
  75. package/dist/cli/chunks/{chunk-6WVEICL2.js → chunk-DVE5SM5G.js} +4 -4
  76. package/dist/cli/chunks/{chunk-QR5ILM34.js → chunk-EGHK6NMH.js} +2 -2
  77. package/dist/cli/chunks/{chunk-E6GANSLP.js → chunk-EWUFVWRT.js} +2 -2
  78. package/dist/cli/chunks/{chunk-HBMBO4FD.js → chunk-EY5IUF7U.js} +2 -2
  79. package/dist/cli/chunks/{chunk-JCB6K24D.js → chunk-FDK2GF4G.js} +2 -2
  80. package/dist/cli/chunks/{chunk-QZNFZ5IQ.js → chunk-FRBCX46J.js} +2 -2
  81. package/dist/cli/chunks/{chunk-FCMCQ6OX.js → chunk-G3ZUB3HD.js} +2 -2
  82. package/dist/cli/chunks/{chunk-QGCFMACF.js → chunk-GAXTPQCZ.js} +2 -2
  83. package/dist/cli/chunks/{chunk-6O4KVU4K.js → chunk-GJVRQBLI.js} +2 -2
  84. package/dist/cli/chunks/{chunk-NLY5NUHZ.js → chunk-GLKLEHK3.js} +2 -2
  85. package/dist/cli/chunks/{chunk-IM67YHDK.js → chunk-HCDTLV5J.js} +2 -2
  86. package/dist/cli/chunks/{chunk-MY2XZHW3.js → chunk-HEDLZWPM.js} +1 -1
  87. package/dist/cli/chunks/{chunk-WUSSZ2S6.js → chunk-HEKCN5XQ.js} +2 -2
  88. package/dist/cli/chunks/{chunk-FRZVLRVR.js → chunk-HFSBONCS.js} +2 -2
  89. package/dist/cli/chunks/{chunk-IAOB2G3X.js → chunk-HX5KQK7I.js} +2 -2
  90. package/dist/cli/chunks/{chunk-BT6TZTCL.js → chunk-I43QRLLB.js} +2 -2
  91. package/dist/cli/chunks/{chunk-QJN5RW2U.js → chunk-I53365HG.js} +3 -3
  92. package/dist/cli/chunks/{chunk-55T7PDYP.js → chunk-I5A3HGO6.js} +2 -2
  93. package/dist/cli/chunks/{chunk-AR5V7VNC.js → chunk-I6E4X3L3.js} +1 -1
  94. package/dist/cli/chunks/chunk-IKWAPHJA.js +2 -0
  95. package/dist/cli/chunks/{chunk-UKRK3IE3.js → chunk-ISASRHZP.js} +2 -2
  96. package/dist/cli/chunks/{chunk-IHKRKRAV.js → chunk-J3RNVHDH.js} +1 -1
  97. package/dist/cli/chunks/{chunk-T75PWWK4.js → chunk-JFQDWAU3.js} +2 -2
  98. package/dist/cli/chunks/{chunk-3KTAMNKI.js → chunk-JL3TI43V.js} +2 -2
  99. package/dist/cli/chunks/{chunk-3DCRAW43.js → chunk-K2VUYRMG.js} +2 -2
  100. package/dist/cli/chunks/{chunk-RIAKRZCZ.js → chunk-KOLHZSEC.js} +2 -2
  101. package/dist/cli/chunks/{chunk-HXT4XDQO.js → chunk-LGA6J4I4.js} +2 -2
  102. package/dist/cli/chunks/{chunk-MDDECCAC.js → chunk-LJRZAALA.js} +169 -168
  103. package/dist/cli/chunks/{chunk-2B2MGJ2W.js → chunk-LOLAEDZD.js} +2 -2
  104. package/dist/cli/chunks/{chunk-2JEPRQMT.js → chunk-LPSE6DOQ.js} +1 -1
  105. package/dist/cli/chunks/{chunk-6KEYA4EH.js → chunk-LRTF5RMG.js} +4 -4
  106. package/dist/cli/chunks/{chunk-CV7E627D.js → chunk-LXYTC62V.js} +2 -2
  107. package/dist/cli/chunks/{chunk-YYVLMW65.js → chunk-LY53L6NH.js} +2 -2
  108. package/dist/cli/chunks/{chunk-HMDSBWF6.js → chunk-LZSLJJII.js} +2 -2
  109. package/dist/cli/chunks/{chunk-IT753IPZ.js → chunk-M6SJALLA.js} +2 -2
  110. package/dist/cli/chunks/{chunk-GDSLQTJC.js → chunk-MBV57LKC.js} +2 -2
  111. package/dist/cli/chunks/{chunk-I7J2ESGR.js → chunk-MGH4XIHH.js} +2 -2
  112. package/dist/cli/chunks/{chunk-Q32UGPWK.js → chunk-MVTUFPM2.js} +2 -2
  113. package/dist/cli/chunks/{chunk-UZL4JYVW.js → chunk-N6CRIUTO.js} +2 -2
  114. package/dist/cli/chunks/{chunk-326V7N25.js → chunk-NBMQOP2R.js} +1 -1
  115. package/dist/cli/chunks/{chunk-ZIKH7U5A.js → chunk-NIJMLEAX.js} +2 -2
  116. package/dist/cli/chunks/{chunk-MYDZBABD.js → chunk-O7TMY4GS.js} +2 -2
  117. package/dist/cli/chunks/{chunk-LVDZ25VX.js → chunk-OFQDM73J.js} +2 -2
  118. package/dist/cli/chunks/{chunk-WBZIOTY6.js → chunk-OG4KHX7S.js} +2 -2
  119. package/dist/cli/chunks/{chunk-GJTH6VBH.js → chunk-OHH6BUZK.js} +1 -1
  120. package/dist/cli/chunks/{chunk-T5N2PIPS.js → chunk-OOK6GPJR.js} +2 -2
  121. package/dist/cli/chunks/{chunk-AXJ75X6I.js → chunk-P7GM3EE7.js} +1 -1
  122. package/dist/cli/chunks/{chunk-IQB5ZBYO.js → chunk-PB2WSCBW.js} +3 -3
  123. package/dist/cli/chunks/{chunk-M36DAETL.js → chunk-PCWZCXBD.js} +2 -2
  124. package/dist/cli/chunks/{chunk-Z3PANQUT.js → chunk-PEA4DVXW.js} +1 -1
  125. package/dist/cli/chunks/{chunk-WBCE6V2N.js → chunk-PJAXWCFC.js} +1 -1
  126. package/dist/cli/chunks/{chunk-V67UQRQN.js → chunk-PMXWDTDK.js} +2 -2
  127. package/dist/cli/chunks/chunk-QIAX3JJB.js +3 -0
  128. package/dist/cli/chunks/chunk-R47LNH5W.js +2 -0
  129. package/dist/cli/chunks/{chunk-A6L2OCMO.js → chunk-RA3MI5WK.js} +2 -2
  130. package/dist/cli/chunks/{chunk-ITM26I6O.js → chunk-RB2SL5GD.js} +2 -2
  131. package/dist/cli/chunks/{chunk-XQBH3366.js → chunk-RG67RZIX.js} +2 -2
  132. package/dist/cli/chunks/{chunk-NBV37CEK.js → chunk-RI4JPBZD.js} +2 -2
  133. package/dist/cli/chunks/{chunk-2Q4Y3VQ6.js → chunk-RJ5CZ7B6.js} +2 -2
  134. package/dist/cli/chunks/{chunk-ATGIGJSL.js → chunk-RJMBHZYL.js} +1 -1
  135. package/dist/cli/chunks/{chunk-MOSXT6AO.js → chunk-RWZ4F44Y.js} +2 -2
  136. package/dist/cli/chunks/{chunk-URWT3EQT.js → chunk-S5D3HCGN.js} +2 -2
  137. package/dist/cli/chunks/{chunk-KQMCCHPO.js → chunk-SCL2OYN7.js} +2 -2
  138. package/dist/cli/chunks/{chunk-Y5VPLOA7.js → chunk-SIUUAKCE.js} +1 -1
  139. package/dist/cli/chunks/{chunk-JIRX6KUR.js → chunk-SJB4KMZS.js} +3 -3
  140. package/dist/cli/chunks/{chunk-TZH2QAFZ.js → chunk-SOSJFEFB.js} +2 -2
  141. package/dist/cli/chunks/{chunk-IBAXNCR2.js → chunk-SZWXUG36.js} +2 -2
  142. package/dist/cli/chunks/{chunk-KTLYL3BS.js → chunk-T3BMCEQR.js} +2 -2
  143. package/dist/cli/chunks/chunk-TB22Y3WW.js +4 -0
  144. package/dist/cli/chunks/{chunk-GJ7DON5S.js → chunk-TVQPYP2Z.js} +3 -3
  145. package/dist/cli/chunks/chunk-U2E5F3VZ.js +14 -0
  146. package/dist/cli/chunks/{chunk-ZSKQPXRW.js → chunk-UK5HY6LC.js} +1 -1
  147. package/dist/cli/chunks/{chunk-RO6HAZLV.js → chunk-UORI2CZ4.js} +1 -1
  148. package/dist/cli/chunks/{chunk-VTGAPHJE.js → chunk-V3NZ23X6.js} +2 -2
  149. package/dist/cli/chunks/{chunk-W7P7EOJ4.js → chunk-VAXQUD5G.js} +1 -1
  150. package/dist/cli/chunks/{chunk-EQG3JYSV.js → chunk-VMSO6DMF.js} +2 -2
  151. package/dist/cli/chunks/{chunk-6UO5YSNN.js → chunk-W3PPYNHF.js} +2 -2
  152. package/dist/cli/chunks/{chunk-FH6N2LKG.js → chunk-W6TJXK5Y.js} +2 -2
  153. package/dist/cli/chunks/{chunk-WJ7657IX.js → chunk-WEDVLKRB.js} +2 -2
  154. package/dist/cli/chunks/{chunk-N653RGT3.js → chunk-WI5AEB7Q.js} +2 -2
  155. package/dist/cli/chunks/{chunk-W5EKSBS4.js → chunk-WO4NSPLX.js} +2 -2
  156. package/dist/cli/chunks/{chunk-YH7VOLBP.js → chunk-WW6WUMS7.js} +2 -2
  157. package/dist/cli/chunks/{chunk-6OL2WES5.js → chunk-WYO5VN2L.js} +1 -1
  158. package/dist/cli/chunks/{chunk-PZK7O445.js → chunk-X5S5UEM6.js} +2 -2
  159. package/dist/cli/chunks/{chunk-NKWMTXBL.js → chunk-XHCCH7UC.js} +3 -3
  160. package/dist/cli/chunks/{chunk-GSC6JXDE.js → chunk-XKIFNKHV.js} +1 -1
  161. package/dist/cli/chunks/{chunk-FNPZINHV.js → chunk-XZ5Z56OP.js} +1 -1
  162. package/dist/cli/chunks/{chunk-6XLCFDIB.js → chunk-YQ6BK7QC.js} +2 -2
  163. package/dist/cli/chunks/{chunk-DNS37AHW.js → chunk-YUWUFYHK.js} +1 -1
  164. package/dist/cli/chunks/{chunk-YJSKT6G6.js → chunk-YZ2AGC7O.js} +1 -1
  165. package/dist/cli/chunks/{chunk-5TEPPW4J.js → chunk-Z56QTRRB.js} +2 -2
  166. package/dist/cli/chunks/{chunk-4MCO43NX.js → chunk-ZAOQIVHG.js} +4 -4
  167. package/dist/cli/chunks/{chunk-TMYGGYRY.js → chunk-ZF5JTQEE.js} +1 -1
  168. package/dist/cli/chunks/{chunk-HYWW4A2E.js → chunk-ZKXZTIVF.js} +2 -2
  169. package/dist/cli/chunks/{chunk-N4MNSEKY.js → chunk-ZP6ANUP7.js} +1 -1
  170. package/dist/cli/chunks/{chunk-5DFPAJ5O.js → chunk-ZURYZEHX.js} +2 -2
  171. package/dist/cli/chunks/{ci-JNBOR6FP.js → ci-NGMGB43T.js} +3 -3
  172. package/dist/cli/chunks/{ci-output-FYNKONEQ.js → ci-output-BMJABAEX.js} +2 -2
  173. package/dist/cli/chunks/{circuit-breaker-KOIXRDAD.js → circuit-breaker-GYD5CMJQ.js} +2 -2
  174. package/dist/cli/chunks/{claude-flow-setup-4CO7KHRN.js → claude-flow-setup-MMOYVBVD.js} +2 -2
  175. package/dist/cli/chunks/client-FUHNNK5O.js +2 -0
  176. package/dist/cli/chunks/{cline-installer-CMYAPKK5.js → cline-installer-B2SOZ44R.js} +2 -2
  177. package/dist/cli/chunks/{code-WFIAEP3H.js → code-V3FIRAXD.js} +3 -3
  178. package/dist/cli/chunks/{code-index-extractor-IYM6HWJN.js → code-index-extractor-CV6A756Z.js} +2 -2
  179. package/dist/cli/chunks/{codex-installer-DORVWRSU.js → codex-installer-EUC6J47Y.js} +2 -2
  180. package/dist/cli/chunks/{completions-54VM2MX2.js → completions-DQQIBAHR.js} +2 -2
  181. package/dist/cli/chunks/{complexity-analyzer-EGZDP5N4.js → complexity-analyzer-HPXMXP5I.js} +2 -2
  182. package/dist/cli/chunks/{continuedev-installer-4SDVDD4T.js → continuedev-installer-RCIYXH6V.js} +2 -2
  183. package/dist/cli/chunks/{copilot-installer-7FJQ7PCL.js → copilot-installer-VUH32SHF.js} +2 -2
  184. package/dist/cli/chunks/core-handlers-F7TLX4LM.js +2 -0
  185. package/dist/cli/chunks/cost-tracker-YLCKLOAL.js +2 -0
  186. package/dist/cli/chunks/{coverage-DI5LDRJ7.js → coverage-IVKDV236.js} +3 -3
  187. package/dist/cli/chunks/cross-domain-router-EGWPY67O.js +2 -0
  188. package/dist/cli/chunks/{cursor-installer-RTSZP5YD.js → cursor-installer-B42FN62K.js} +2 -2
  189. package/dist/cli/chunks/{daemon-SP3APEZY.js → daemon-DECQRQII.js} +3 -3
  190. package/dist/cli/chunks/{daemon-LM7LETPV.js → daemon-IPTOSCHM.js} +4 -4
  191. package/dist/cli/chunks/{dag-attention-scheduler-C3QBODFE.js → dag-attention-scheduler-RY7CDYSC.js} +2 -2
  192. package/dist/cli/chunks/{detect-I4RBUFFJ.js → detect-NW53BMJN.js} +2 -2
  193. package/dist/cli/chunks/{dist-node-PT6TCBCO.js → dist-node-LE6KHXAB.js} +2 -2
  194. package/dist/cli/chunks/{domain-handler-MJMTMB5X.js → domain-handler-JGXFT4LW.js} +2 -2
  195. package/dist/cli/chunks/{domain-plugins-Y4A2WYJW.js → domain-plugins-GY3RYKKK.js} +2 -2
  196. package/dist/cli/chunks/{domain-transfer-DUO42TLA.js → domain-transfer-CGBRXNTC.js} +2 -2
  197. package/dist/cli/chunks/dream-V4QN6OF5.js +2 -0
  198. package/dist/cli/chunks/{embed-and-insert-pattern-66ZQK4AI.js → embed-and-insert-pattern-65H4XHWR.js} +2 -2
  199. package/dist/cli/chunks/{eval-NQ7H27UF.js → eval-YPYIZQUR.js} +2 -2
  200. package/dist/cli/chunks/{experience-capture-middleware-MHEYPTIG.js → experience-capture-middleware-4JXVF5PL.js} +3 -3
  201. package/dist/cli/chunks/{fast-paths-YYDGN6ZC.js → fast-paths-HYQTAF2S.js} +2 -2
  202. package/dist/cli/chunks/{feature-flags-FY4DOYS2.js → feature-flags-HNSAFFX2.js} +2 -2
  203. package/dist/cli/chunks/{feature-flags-YFGUORHY.js → feature-flags-YACUH6OW.js} +2 -2
  204. package/dist/cli/chunks/{file-discovery-TOMDY7TK.js → file-discovery-R73BYEXB.js} +2 -2
  205. package/dist/cli/chunks/{fleet-MO3UCWB4.js → fleet-6M3BP4OO.js} +3 -3
  206. package/dist/cli/chunks/{gnn-wrapper-SLW4PPXQ.js → gnn-wrapper-QLD7KHXV.js} +2 -2
  207. package/dist/cli/chunks/{heartbeat-handler-36RFCP4E.js → heartbeat-handler-EZP333X4.js} +4 -4
  208. package/dist/cli/chunks/heartbeat-scheduler-3N3L6CRM.js +2 -0
  209. package/dist/cli/chunks/hnsw-adapter-2BXJYDXI.js +2 -0
  210. package/dist/cli/chunks/hnsw-index-2DLI5OVO.js +2 -0
  211. package/dist/cli/chunks/{hnsw-legacy-bridge-BJLWBKHE.js → hnsw-legacy-bridge-47CUCSAU.js} +2 -2
  212. package/dist/cli/chunks/{hnswlib-node-RAYNVJCJ.js → hnswlib-node-SVNYDJZH.js} +2 -2
  213. package/dist/cli/chunks/{hooks-JMHFWVEQ.js → hooks-6V5LMWP6.js} +10 -10
  214. package/dist/cli/chunks/hybrid-backend-OW4J65YH.js +2 -0
  215. package/dist/cli/chunks/{hypergraph-engine-JUDBKPOX.js → hypergraph-engine-L2FOBIFF.js} +2 -2
  216. package/dist/cli/chunks/{hypergraph-handler-AXTWXOZU.js → hypergraph-handler-DU6Z57EE.js} +3 -3
  217. package/dist/cli/chunks/impact-analyzer-ZH5I2RG6.js +2 -0
  218. package/dist/cli/chunks/{init-handler-PARJNZFF.js → init-handler-HETPWU67.js} +6 -6
  219. package/dist/cli/chunks/init-wizard-NIKM3ZOK.js +2 -0
  220. package/dist/cli/chunks/kernel-2EOSVM6X.js +2 -0
  221. package/dist/cli/chunks/{kilocode-installer-22HX2E4V.js → kilocode-installer-NHKYGJ7Q.js} +2 -2
  222. package/dist/cli/chunks/{kiro-installer-OVPBLY7J.js → kiro-installer-24UK6GGR.js} +2 -2
  223. package/dist/cli/chunks/knowledge-graph-D3BPWNNO.js +2 -0
  224. package/dist/cli/chunks/{learning-DWXPJ3R6.js → learning-QLVRZNHT.js} +3 -3
  225. package/dist/cli/chunks/{llm-router-7PPVVKNG.js → llm-router-XRMI2VMG.js} +4 -4
  226. package/dist/cli/chunks/llm-router-service-TJPPZFUN.js +2 -0
  227. package/dist/cli/chunks/{load-VI5XHNZA.js → load-W5UWL5C7.js} +2 -2
  228. package/dist/cli/chunks/load-test-RFT7IDOL.js +2 -0
  229. package/dist/cli/chunks/{mcp-UW4Z3Z64.js → mcp-N7ALQ4BL.js} +2 -2
  230. package/dist/cli/chunks/{memory-UD2KCB5M.js → memory-WV52DLSA.js} +5 -5
  231. package/dist/cli/chunks/memory-backend-O2O4CFKZ.js +2 -0
  232. package/dist/cli/chunks/memory-handlers-DAEGUDBD.js +2 -0
  233. package/dist/cli/chunks/{multi-model-executor-5O4WWU5Z.js → multi-model-executor-3FVTZCSO.js} +2 -2
  234. package/dist/cli/chunks/{opencode-installer-DTRFDGM7.js → opencode-installer-NTPWGHUW.js} +2 -2
  235. package/dist/cli/chunks/{orchestrator-ENJIKV6Z.js → orchestrator-ORGJ6VAA.js} +85 -26
  236. package/dist/cli/chunks/pattern-null-store-TUBNXS34.js +2 -0
  237. package/dist/cli/chunks/{pattern-usage-recorder-QPNIU5PD.js → pattern-usage-recorder-WWXHUH5U.js} +2 -2
  238. package/dist/cli/chunks/{pipeline-G3JYDNPE.js → pipeline-ZOKZFXTH.js} +2 -2
  239. package/dist/cli/chunks/{platform-P4WR6N3D.js → platform-CDNL322F.js} +2 -2
  240. package/dist/cli/chunks/{plugin-C7763Q5W.js → plugin-ZVLFNZZ4.js} +2 -2
  241. package/dist/cli/chunks/{prime-radiant-advanced-wasm-DH6R3XSZ.js → prime-radiant-advanced-wasm-FVJDU2JY.js} +2 -2
  242. package/dist/cli/chunks/{project-root-7DTXDLEG.js → project-root-UCHQH3QL.js} +2 -2
  243. package/dist/cli/chunks/protocol-executor-6FQTTO3Y.js +2 -0
  244. package/dist/cli/chunks/{protocol-handler-EODULGOZ.js → protocol-handler-4YBN5R23.js} +2 -2
  245. package/dist/cli/chunks/{prove-A7G3SIOF.js → prove-BHDHY664.js} +2 -2
  246. package/dist/cli/chunks/qe-reasoning-bank-TKPND56C.js +2 -0
  247. package/dist/cli/chunks/{quality-JTURFUX3.js → quality-46AK277P.js} +2 -2
  248. package/dist/cli/chunks/{quality-gate-M2EI754V.js → quality-gate-WANE7TCN.js} +3 -3
  249. package/dist/cli/chunks/queen-coordinator-DWMXLPJG.js +2 -0
  250. package/dist/cli/chunks/{real-embeddings-DI7JMCG7.js → real-embeddings-56MNGJGJ.js} +2 -2
  251. package/dist/cli/chunks/{ref-validation-MSFMNKDR.js → ref-validation-S7UWXQIP.js} +2 -2
  252. package/dist/cli/chunks/{roocode-installer-XIMFFHOH.js → roocode-installer-TEYOQYL6.js} +2 -2
  253. package/dist/cli/chunks/router-QIMUYRCC.js +2 -0
  254. package/dist/cli/chunks/routing-feedback-4OH5ZNF4.js +2 -0
  255. package/dist/cli/chunks/{routing-handler-MCDKNBQW.js → routing-handler-KDTLMRWD.js} +2 -2
  256. package/dist/cli/chunks/{ruvector-commands-OBSYAK2X.js → ruvector-commands-AOUDXCYE.js} +2 -2
  257. package/dist/cli/chunks/rvf-dual-writer-S6JBZL54.js +2 -0
  258. package/dist/cli/chunks/rvf-migration-adapter-TSGMLMYR.js +2 -0
  259. package/dist/cli/chunks/{rvf-migration-coordinator-4DTRIHY6.js → rvf-migration-coordinator-V74MVBHS.js} +2 -2
  260. package/dist/cli/chunks/rvf-native-adapter-Z7QOW47S.js +2 -0
  261. package/dist/cli/chunks/{rvf-store-integrity-CWAVMRC4.js → rvf-store-integrity-QI47Y354.js} +2 -2
  262. package/dist/cli/chunks/safe-db-JLOVBJNC.js +2 -0
  263. package/dist/cli/chunks/schedule-IM6XOBGR.js +2 -0
  264. package/dist/cli/chunks/scheduler-XL2SVVK5.js +2 -0
  265. package/dist/cli/chunks/{security-74TWSO74.js → security-SN6MWOJT.js} +3 -3
  266. package/dist/cli/chunks/{shared-rvf-adapter-ZHNAGE5H.js → shared-rvf-adapter-2LB56LP4.js} +2 -2
  267. package/dist/cli/chunks/{shared-rvf-dual-writer-BS5WAVCC.js → shared-rvf-dual-writer-WU7PFKQM.js} +2 -2
  268. package/dist/cli/chunks/sqlite-persistence-LWMIIC4U.js +2 -0
  269. package/dist/cli/chunks/{standalone-memory-3HGHTE7S.js → standalone-memory-F6FSRFWC.js} +2 -2
  270. package/dist/cli/chunks/{status-handler-XWEEGNGH.js → status-handler-DHD5MS4G.js} +2 -2
  271. package/dist/cli/chunks/{structural-health-TB5JGMVS.js → structural-health-P6HPSQMR.js} +2 -2
  272. package/dist/cli/chunks/{sync-T4VLBURM.js → sync-LISJGDSE.js} +2 -2
  273. package/dist/cli/chunks/sync-SNAXAVCN.js +2 -0
  274. package/dist/cli/chunks/{task-handler-RQ65QKXX.js → task-handler-ZT44NT5Z.js} +2 -2
  275. package/dist/cli/chunks/{task-handlers-USYWJ4H2.js → task-handlers-R6DQ5324.js} +3 -3
  276. package/dist/cli/chunks/test-MUFHR4JQ.js +34 -0
  277. package/dist/cli/chunks/test-scheduling-TAUSLZJP.js +15 -0
  278. package/dist/cli/chunks/token-bootstrap-UGRH7OPU.js +2 -0
  279. package/dist/cli/chunks/{token-usage-CISTB5K5.js → token-usage-IX65ECBR.js} +2 -2
  280. package/dist/cli/chunks/{transformers-C7LV763N.js → transformers-QKPSVW2W.js} +2 -2
  281. package/dist/cli/chunks/{tree-sitter-wasm-parser-P26JC3YV.js → tree-sitter-wasm-parser-Z7PPA2JO.js} +2 -2
  282. package/dist/cli/chunks/{types-YMVMKIWB.js → types-ULNNGGGH.js} +2 -2
  283. package/dist/cli/chunks/unified-memory-F5IJY7W7.js +2 -0
  284. package/dist/cli/chunks/unified-memory-hnsw-C3WAMAQL.js +2 -0
  285. package/dist/cli/chunks/unified-persistence-EWXXOTCB.js +2 -0
  286. package/dist/cli/chunks/{upgrade-U2REOPAW.js → upgrade-ECI3YUYA.js} +2 -2
  287. package/dist/cli/chunks/{validate-NDTCKN7P.js → validate-3JKRUW2S.js} +2 -2
  288. package/dist/cli/chunks/{validate-swarm-OJUGVH5Q.js → validate-swarm-LZWANCIE.js} +2 -2
  289. package/dist/cli/chunks/visual-security-CKLTAIAB.js +2 -0
  290. package/dist/cli/chunks/{web-tree-sitter-2CLRSA7K.js → web-tree-sitter-N5V4A6XG.js} +2 -2
  291. package/dist/cli/chunks/{windsurf-installer-DSUJJ4PG.js → windsurf-installer-5TBM5B3C.js} +2 -2
  292. package/dist/cli/chunks/{witness-chain-TEGL4ZWB.js → witness-chain-MFP3HBWQ.js} +2 -2
  293. package/dist/cli/chunks/witness-chain-Z6LWFEZS.js +2 -0
  294. package/dist/cli/chunks/witness-chain-repair-5QWRFVUK.js +2 -0
  295. package/dist/cli/chunks/{witness-chain-verifier-SPXKFC67.js → witness-chain-verifier-SRAT7LVY.js} +2 -2
  296. package/dist/cli/chunks/{witness-key-manager-EALOV4OV.js → witness-key-manager-FYZXQTLJ.js} +2 -2
  297. package/dist/cli/chunks/{workflow-PYI6HCAG.js → workflow-M7TUYYXY.js} +5 -5
  298. package/dist/cli/chunks/workflow-orchestrator-OFTAR2NA.js +2 -0
  299. package/dist/cli/chunks/wrappers-COU73OQ6.js +2 -0
  300. package/dist/cli/commands/test.js +30 -12
  301. package/dist/cli/commands/workflow.js +3 -0
  302. package/dist/cli/scheduler/persistent-scheduler.d.ts +2 -0
  303. package/dist/cli/scheduler/persistent-scheduler.js +12 -2
  304. package/dist/cli/utils/generated-test-writer.d.ts +35 -0
  305. package/dist/cli/utils/generated-test-writer.js +44 -0
  306. package/dist/context/compiler.js +4 -1
  307. package/dist/coordination/consensus/providers/ollama-provider.js +16 -27
  308. package/dist/coordination/consensus/providers/openrouter-provider.js +13 -24
  309. package/dist/coordination/handlers/test-execution-handlers.js +4 -2
  310. package/dist/coordination/protocols/defect-investigation.js +4 -1
  311. package/dist/domains/code-intelligence/services/metric-collector/listing-process-owner.d.ts +3 -0
  312. package/dist/domains/code-intelligence/services/metric-collector/listing-process-owner.js +57 -0
  313. package/dist/domains/code-intelligence/services/metric-collector/test-counter.js +127 -39
  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/phases/07-hooks.js +30 -4
  323. package/dist/init/phases/10-workers.js +42 -6
  324. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.d.ts +4 -1
  325. package/dist/integrations/agentic-flow/onnx-embeddings/embedding-generator.js +6 -2
  326. package/dist/integrations/browser/qe-dashboard/wasm-vector-store.js +2 -1
  327. package/dist/integrations/ruvector/coverage-router.d.ts +3 -1
  328. package/dist/integrations/ruvector/coverage-router.js +7 -6
  329. package/dist/integrations/ruvector/diff-risk-classifier.js +5 -4
  330. package/dist/integrations/ruvector/rvf-dual-writer.js +10 -1
  331. package/dist/integrations/vibium/runtime.js +2 -6
  332. package/dist/learning/dream/dream-engine.d.ts +5 -0
  333. package/dist/learning/dream/dream-engine.js +20 -3
  334. package/dist/learning/embedding-space.d.ts +18 -0
  335. package/dist/learning/embedding-space.js +33 -0
  336. package/dist/learning/rvf-pattern-store.js +19 -5
  337. package/dist/mcp/bundle.js +442 -441
  338. package/dist/mcp/handlers/domain-handler-configs.d.ts +42 -0
  339. package/dist/mcp/handlers/handler-factory.js +3 -1
  340. package/dist/mcp/handlers/save-results-option.d.ts +62 -0
  341. package/dist/mcp/handlers/save-results-option.js +35 -0
  342. package/dist/mcp/protocol-server.js +22 -11
  343. package/dist/mcp/security/rate-limiter.d.ts +8 -1
  344. package/dist/mcp/security/rate-limiter.js +33 -4
  345. package/dist/mcp/services/session-resume.js +11 -0
  346. package/dist/mcp/services/session-store.d.ts +31 -2
  347. package/dist/mcp/services/session-store.js +95 -16
  348. package/dist/mcp/services/session-write-buffer.d.ts +55 -0
  349. package/dist/mcp/services/session-write-buffer.js +144 -0
  350. package/dist/mcp/types.d.ts +18 -0
  351. package/dist/memory/crdt/convergence-tracker.js +14 -24
  352. package/dist/memory/crdt/crdt-store.js +15 -0
  353. package/dist/memory/crdt/g-counter.js +10 -8
  354. package/dist/memory/crdt/lww-register.js +3 -3
  355. package/dist/memory/crdt/or-set.js +18 -0
  356. package/dist/planning/goap-planner.js +18 -10
  357. package/dist/shared/embeddings/embedding-cache.d.ts +3 -3
  358. package/dist/shared/embeddings/embedding-cache.js +8 -8
  359. package/dist/shared/embeddings/nomic-embedder.js +9 -6
  360. package/dist/shared/embeddings/ollama-client.d.ts +1 -1
  361. package/dist/shared/embeddings/ollama-client.js +30 -31
  362. package/dist/shared/git/git-analyzer.d.ts +4 -1
  363. package/dist/shared/git/git-analyzer.js +9 -4
  364. package/dist/shared/llm/cache.js +1 -1
  365. package/dist/shared/llm/cost-tracker.js +8 -6
  366. package/dist/shared/llm/providers/azure-openai.js +5 -21
  367. package/dist/shared/llm/providers/bedrock.js +5 -21
  368. package/dist/shared/llm/providers/claude.js +5 -21
  369. package/dist/shared/llm/providers/cognitum.js +5 -17
  370. package/dist/shared/llm/providers/gemini.js +9 -23
  371. package/dist/shared/llm/providers/ollama.js +5 -21
  372. package/dist/shared/llm/providers/openai.js +5 -21
  373. package/dist/shared/llm/providers/openrouter.js +9 -23
  374. package/dist/shared/llm/providers/response-deadline.d.ts +3 -0
  375. package/dist/shared/llm/providers/response-deadline.js +100 -0
  376. package/dist/shared/llm/spend-ledger.js +3 -2
  377. package/dist/shared/metrics/code-metrics.d.ts +1 -0
  378. package/dist/shared/metrics/code-metrics.js +3 -44
  379. package/dist/shared/metrics/cognitive-complexity.d.ts +17 -0
  380. package/dist/shared/metrics/cognitive-complexity.js +108 -0
  381. package/dist/shared/npm-cli-invocation.d.ts +21 -0
  382. package/dist/shared/npm-cli-invocation.js +28 -0
  383. package/dist/shared/optional-module.js +24 -0
  384. package/dist/shared/test-runner-args.d.ts +42 -0
  385. package/dist/shared/test-runner-args.js +74 -0
  386. package/dist/shared/utils/safe-record.d.ts +18 -0
  387. package/dist/shared/utils/safe-record.js +28 -0
  388. package/dist/test-scheduling/executors/vitest-executor.js +23 -5
  389. package/dist/workers/quality-daemon/git-watcher.js +5 -0
  390. package/package.json +1 -1
  391. package/dist/adapters/ag-ui/json-patch-utils.d.ts +0 -136
  392. package/dist/adapters/ag-ui/json-patch-utils.js +0 -575
  393. package/dist/cli/chunks/adapter-EUIELRLI.js +0 -2
  394. package/dist/cli/chunks/aqe-learning-engine-LXRKHASR.js +0 -2
  395. package/dist/cli/chunks/base-4DSLX33Y.js +0 -2
  396. package/dist/cli/chunks/browser-workflow-AWCQLQZK.js +0 -2
  397. package/dist/cli/chunks/chunk-E2QHUMCR.js +0 -2
  398. package/dist/cli/chunks/chunk-I7ECEOFV.js +0 -2
  399. package/dist/cli/chunks/chunk-LW4BCFIV.js +0 -15
  400. package/dist/cli/chunks/chunk-QJGKL67W.js +0 -54
  401. package/dist/cli/chunks/chunk-RLQ4MYB6.js +0 -3
  402. package/dist/cli/chunks/chunk-X43HA3RF.js +0 -14
  403. package/dist/cli/chunks/chunk-Z3K4JZXQ.js +0 -4
  404. package/dist/cli/chunks/client-UJVHZXNQ.js +0 -2
  405. package/dist/cli/chunks/core-handlers-AFXZOSH3.js +0 -2
  406. package/dist/cli/chunks/cost-tracker-D6YSKTQC.js +0 -2
  407. package/dist/cli/chunks/cross-domain-router-ZLNVKLIR.js +0 -2
  408. package/dist/cli/chunks/dream-4OPJXXEG.js +0 -2
  409. package/dist/cli/chunks/heartbeat-scheduler-J5KLHO6C.js +0 -2
  410. package/dist/cli/chunks/hnsw-adapter-56P6XSFR.js +0 -2
  411. package/dist/cli/chunks/hnsw-index-GFZ6XCEW.js +0 -2
  412. package/dist/cli/chunks/hybrid-backend-TUBWJDDN.js +0 -2
  413. package/dist/cli/chunks/impact-analyzer-FXVGKS6B.js +0 -2
  414. package/dist/cli/chunks/init-wizard-LK73HQ7W.js +0 -2
  415. package/dist/cli/chunks/kernel-TCZDKRSI.js +0 -2
  416. package/dist/cli/chunks/knowledge-graph-TWMB2GH2.js +0 -2
  417. package/dist/cli/chunks/llm-router-service-HPDH3P77.js +0 -2
  418. package/dist/cli/chunks/load-test-HTYOUYSN.js +0 -2
  419. package/dist/cli/chunks/memory-backend-X5BE2MPK.js +0 -2
  420. package/dist/cli/chunks/memory-handlers-SQXMFX5X.js +0 -2
  421. package/dist/cli/chunks/pattern-null-store-OCQGQZU6.js +0 -2
  422. package/dist/cli/chunks/protocol-executor-CYEQHQCL.js +0 -2
  423. package/dist/cli/chunks/qe-reasoning-bank-GSTA5WJ4.js +0 -2
  424. package/dist/cli/chunks/queen-coordinator-Y2Q5RQL7.js +0 -2
  425. package/dist/cli/chunks/router-4QB5L4IW.js +0 -2
  426. package/dist/cli/chunks/routing-feedback-YBVHJY5L.js +0 -2
  427. package/dist/cli/chunks/rvf-dual-writer-T5B456SW.js +0 -2
  428. package/dist/cli/chunks/rvf-migration-adapter-2O2NL7ZF.js +0 -2
  429. package/dist/cli/chunks/rvf-native-adapter-RDB3GWTW.js +0 -2
  430. package/dist/cli/chunks/safe-db-YXVMLFU4.js +0 -2
  431. package/dist/cli/chunks/schedule-K6XWCCSK.js +0 -2
  432. package/dist/cli/chunks/scheduler-4MW22D6Q.js +0 -2
  433. package/dist/cli/chunks/sqlite-persistence-UVDHUSAU.js +0 -2
  434. package/dist/cli/chunks/sync-LSPNSVDI.js +0 -2
  435. package/dist/cli/chunks/test-M2XTKD62.js +0 -33
  436. package/dist/cli/chunks/test-scheduling-GYXJQHJL.js +0 -15
  437. package/dist/cli/chunks/token-bootstrap-OTEMRUFR.js +0 -2
  438. package/dist/cli/chunks/unified-memory-UUK77NSE.js +0 -2
  439. package/dist/cli/chunks/unified-memory-hnsw-JOUE6WNF.js +0 -2
  440. package/dist/cli/chunks/unified-persistence-3DRJGNQE.js +0 -2
  441. package/dist/cli/chunks/visual-security-EM7FQG5X.js +0 -2
  442. package/dist/cli/chunks/witness-chain-7NZ6IIUN.js +0 -2
  443. package/dist/cli/chunks/witness-chain-repair-ZWS5WXFL.js +0 -2
  444. package/dist/cli/chunks/workflow-orchestrator-3C3S5FIM.js +0 -2
  445. package/dist/cli/chunks/wrappers-NXJHGK3W.js +0 -2
@@ -12,6 +12,7 @@ import { createLLMError, } from '../interfaces.js';
12
12
  import { TokenMetricsCollector } from '../../../learning/token-tracker.js';
13
13
  import { toError } from '../../error-utils.js';
14
14
  import { backoffDelay } from '../retry.js';
15
+ import { fetchWithResponseDeadline } from './response-deadline.js';
15
16
  import { safeJsonParse } from '../../safe-json.js';
16
17
  /**
17
18
  * Default Gemini configuration
@@ -246,7 +247,7 @@ export class GeminiProvider {
246
247
  method: 'POST',
247
248
  headers: { 'Content-Type': 'application/json' },
248
249
  body: JSON.stringify(body),
249
- }, options?.timeoutMs ?? this.config.timeoutMs ?? 60000);
250
+ }, options?.timeoutMs ?? this.config.timeoutMs ?? 60000, 'idle');
250
251
  if (!response.ok) {
251
252
  const errorData = await response.json().catch(() => ({
252
253
  error: { message: 'Unknown error', code: 0, status: 'UNKNOWN' },
@@ -304,6 +305,8 @@ export class GeminiProvider {
304
305
  }
305
306
  }
306
307
  finally {
308
+ // Returning early from the generator must also release its request deadline.
309
+ await reader.cancel().catch(() => { });
307
310
  reader.releaseLock();
308
311
  }
309
312
  const latencyMs = Date.now() - start;
@@ -574,28 +577,11 @@ export class GeminiProvider {
574
577
  /**
575
578
  * Fetch with timeout
576
579
  */
577
- async fetchWithTimeout(url, options, timeoutMs) {
578
- const controller = new AbortController();
579
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
580
- try {
581
- const response = await fetch(url, {
582
- ...options,
583
- signal: controller.signal,
584
- });
585
- return response;
586
- }
587
- catch (error) {
588
- if (error instanceof Error && error.name === 'AbortError') {
589
- throw createLLMError('Request timed out', 'TIMEOUT', {
590
- provider: 'gemini',
591
- retryable: true,
592
- });
593
- }
594
- throw error;
595
- }
596
- finally {
597
- clearTimeout(timeoutId);
598
- }
580
+ async fetchWithTimeout(url, options, timeoutMs, bodyDeadline = 'absolute') {
581
+ return fetchWithResponseDeadline(url, options, timeoutMs, () => createLLMError('Request timed out', 'TIMEOUT', {
582
+ provider: 'gemini',
583
+ retryable: true,
584
+ }), bodyDeadline);
599
585
  }
600
586
  /**
601
587
  * Fetch with retry logic
@@ -5,6 +5,7 @@
5
5
  * Local LLM provider using Ollama for fast iteration and zero-cost development.
6
6
  * Supports Llama, Mistral, CodeLlama, and other local models.
7
7
  */
8
+ import { fetchWithResponseDeadline } from './response-deadline.js';
8
9
  import { createLLMError, } from '../interfaces.js';
9
10
  import { CostTracker } from '../cost-tracker.js';
10
11
  import { TokenMetricsCollector } from '../../../learning/token-tracker.js';
@@ -410,27 +411,10 @@ export class OllamaProvider {
410
411
  * Fetch with timeout
411
412
  */
412
413
  async fetchWithTimeout(url, options, timeoutMs) {
413
- const controller = new AbortController();
414
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
415
- try {
416
- const response = await fetch(url, {
417
- ...options,
418
- signal: controller.signal,
419
- });
420
- return response;
421
- }
422
- catch (error) {
423
- if (error instanceof Error && error.name === 'AbortError') {
424
- throw createLLMError('Request timed out', 'TIMEOUT', {
425
- provider: 'ollama',
426
- retryable: true,
427
- });
428
- }
429
- throw error;
430
- }
431
- finally {
432
- clearTimeout(timeoutId);
433
- }
414
+ return fetchWithResponseDeadline(url, options, timeoutMs, () => createLLMError('Request timed out', 'TIMEOUT', {
415
+ provider: 'ollama',
416
+ retryable: true,
417
+ }));
434
418
  }
435
419
  }
436
420
  //# sourceMappingURL=ollama.js.map
@@ -11,6 +11,7 @@ import { applyOpenAIParams } from '../openai-params.js';
11
11
  import { TokenMetricsCollector } from '../../../learning/token-tracker.js';
12
12
  import { toError } from '../../error-utils.js';
13
13
  import { backoffDelay } from '../retry.js';
14
+ import { fetchWithResponseDeadline } from './response-deadline.js';
14
15
  /**
15
16
  * Default OpenAI configuration
16
17
  */
@@ -378,27 +379,10 @@ export class OpenAIProvider {
378
379
  * Fetch with timeout
379
380
  */
380
381
  async fetchWithTimeout(url, options, timeoutMs) {
381
- const controller = new AbortController();
382
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
383
- try {
384
- const response = await fetch(url, {
385
- ...options,
386
- signal: controller.signal,
387
- });
388
- return response;
389
- }
390
- catch (error) {
391
- if (error instanceof Error && error.name === 'AbortError') {
392
- throw createLLMError('Request timed out', 'TIMEOUT', {
393
- provider: 'openai',
394
- retryable: true,
395
- });
396
- }
397
- throw error;
398
- }
399
- finally {
400
- clearTimeout(timeoutId);
401
- }
382
+ return fetchWithResponseDeadline(url, options, timeoutMs, () => createLLMError('Request timed out', 'TIMEOUT', {
383
+ provider: 'openai',
384
+ retryable: true,
385
+ }));
402
386
  }
403
387
  /**
404
388
  * Fetch with retry logic
@@ -13,6 +13,7 @@ import { createLLMError, } from '../interfaces.js';
13
13
  import { TokenMetricsCollector } from '../../../learning/token-tracker.js';
14
14
  import { toError } from '../../error-utils.js';
15
15
  import { backoffDelay } from '../retry.js';
16
+ import { fetchWithResponseDeadline } from './response-deadline.js';
16
17
  import { safeJsonParse } from '../../safe-json.js';
17
18
  import { resolveModelPricing } from '../cost-tracker.js';
18
19
  /**
@@ -273,7 +274,7 @@ export class OpenRouterProvider {
273
274
  method: 'POST',
274
275
  headers: this.getHeaders(),
275
276
  body: JSON.stringify(body),
276
- }, options?.timeoutMs ?? this.config.timeoutMs ?? 60000);
277
+ }, options?.timeoutMs ?? this.config.timeoutMs ?? 60000, 'idle');
277
278
  if (!response.ok) {
278
279
  const errorData = await response.json().catch(() => ({
279
280
  error: { message: 'Unknown error', type: 'unknown', code: null },
@@ -327,6 +328,8 @@ export class OpenRouterProvider {
327
328
  }
328
329
  }
329
330
  finally {
331
+ // Returning early from the generator must also release its request deadline.
332
+ await reader.cancel().catch(() => { });
330
333
  reader.releaseLock();
331
334
  }
332
335
  const latencyMs = Date.now() - start;
@@ -620,28 +623,11 @@ export class OpenRouterProvider {
620
623
  /**
621
624
  * Fetch with timeout
622
625
  */
623
- async fetchWithTimeout(url, options, timeoutMs) {
624
- const controller = new AbortController();
625
- const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
626
- try {
627
- const response = await fetch(url, {
628
- ...options,
629
- signal: controller.signal,
630
- });
631
- return response;
632
- }
633
- catch (error) {
634
- if (error instanceof Error && error.name === 'AbortError') {
635
- throw createLLMError('Request timed out', 'TIMEOUT', {
636
- provider: 'openrouter',
637
- retryable: true,
638
- });
639
- }
640
- throw error;
641
- }
642
- finally {
643
- clearTimeout(timeoutId);
644
- }
626
+ async fetchWithTimeout(url, options, timeoutMs, bodyDeadline = 'absolute') {
627
+ return fetchWithResponseDeadline(url, options, timeoutMs, () => createLLMError('Request timed out', 'TIMEOUT', {
628
+ provider: 'openrouter',
629
+ retryable: true,
630
+ }), bodyDeadline);
645
631
  }
646
632
  /**
647
633
  * Fetch with retry logic
@@ -0,0 +1,3 @@
1
+ /** Bound headers and bodies; streaming callers may use an idle body deadline. */
2
+ export declare function fetchWithResponseDeadline(url: string, options: RequestInit, timeoutMs: number, timeoutError: () => Error, bodyDeadline?: 'absolute' | 'idle'): Promise<Response>;
3
+ //# sourceMappingURL=response-deadline.d.ts.map
@@ -0,0 +1,100 @@
1
+ /** Bound headers and bodies; streaming callers may use an idle body deadline. */
2
+ export async function fetchWithResponseDeadline(url, options, timeoutMs, timeoutError, bodyDeadline = 'absolute') {
3
+ const abort = new AbortController();
4
+ let expired = false;
5
+ let expireBody;
6
+ const expire = () => {
7
+ expired = true;
8
+ const error = timeoutError();
9
+ expireBody?.(error);
10
+ abort.abort(error);
11
+ };
12
+ let timer = setTimeout(expire, timeoutMs);
13
+ const resetIdleDeadline = () => {
14
+ if (bodyDeadline !== 'idle')
15
+ return;
16
+ clearTimeout(timer);
17
+ timer = setTimeout(expire, timeoutMs);
18
+ timer.unref?.();
19
+ };
20
+ // A status-only caller must not keep a process alive until its deadline.
21
+ timer.unref?.();
22
+ try {
23
+ const response = await fetch(url, { ...options, signal: abort.signal });
24
+ if (!response.body) {
25
+ clearTimeout(timer);
26
+ return response;
27
+ }
28
+ resetIdleDeadline();
29
+ const reader = response.body.getReader();
30
+ let finished = false;
31
+ const finish = () => {
32
+ finished = true;
33
+ clearTimeout(timer);
34
+ };
35
+ const body = new ReadableStream({
36
+ start(controller) {
37
+ expireBody = error => {
38
+ if (finished)
39
+ return;
40
+ finish();
41
+ controller.error(error);
42
+ // Cancel also settles any pending read before releasing its lock.
43
+ void reader.cancel(error).catch(() => { }).finally(() => reader.releaseLock());
44
+ };
45
+ },
46
+ async pull(controller) {
47
+ try {
48
+ const result = await reader.read();
49
+ if (finished)
50
+ return;
51
+ if (result.done) {
52
+ finish();
53
+ reader.releaseLock();
54
+ controller.close();
55
+ }
56
+ else {
57
+ resetIdleDeadline();
58
+ controller.enqueue(result.value);
59
+ }
60
+ }
61
+ catch (error) {
62
+ if (finished)
63
+ return;
64
+ finish();
65
+ reader.releaseLock();
66
+ controller.error(error);
67
+ }
68
+ },
69
+ async cancel(reason) {
70
+ if (finished)
71
+ return;
72
+ finish();
73
+ try {
74
+ await reader.cancel(reason);
75
+ }
76
+ finally {
77
+ reader.releaseLock();
78
+ }
79
+ },
80
+ }, { highWaterMark: 0 });
81
+ const bounded = new Response(body, {
82
+ status: response.status,
83
+ statusText: response.statusText,
84
+ headers: response.headers,
85
+ });
86
+ // Keep fetch metadata while using the bounded stream for body consumers.
87
+ for (const key of ['url', 'redirected', 'type']) {
88
+ Object.defineProperty(bounded, key, { value: response[key] });
89
+ }
90
+ return bounded;
91
+ }
92
+ catch (error) {
93
+ clearTimeout(timer);
94
+ if (expired || (error instanceof Error && error.name === 'AbortError')) {
95
+ throw timeoutError();
96
+ }
97
+ throw error;
98
+ }
99
+ }
100
+ //# sourceMappingURL=response-deadline.js.map
@@ -17,6 +17,7 @@
17
17
  * connections (one per process) to a WAL-mode DB is exactly the supported
18
18
  * cross-process pattern.
19
19
  */
20
+ import { createSafeRecord } from '../utils/safe-record.js';
20
21
  /** Bucket used for charges recorded without an agent context. */
21
22
  export const UNATTRIBUTED_AGENT = '(unattributed)';
22
23
  const CREATE_TABLE_SQL = `
@@ -127,7 +128,7 @@ export class SqliteSpendLedger {
127
128
  .prepare(`SELECT COALESCE(agent_type, ?) AS agent, COALESCE(SUM(cost_usd), 0) AS total
128
129
  FROM llm_spend WHERE ts >= ? GROUP BY COALESCE(agent_type, ?)`)
129
130
  .all(UNATTRIBUTED_AGENT, nowMs - windowMs, UNATTRIBUTED_AGENT);
130
- const out = {};
131
+ const out = createSafeRecord();
131
132
  for (const r of rows)
132
133
  out[r.agent] = r.total;
133
134
  return out;
@@ -157,7 +158,7 @@ export class InMemorySpendLedger {
157
158
  }
158
159
  spentByAgentSince(windowMs, nowMs = Date.now()) {
159
160
  const cutoff = nowMs - windowMs;
160
- const out = {};
161
+ const out = createSafeRecord();
161
162
  for (const e of this.entries) {
162
163
  if (e.ts >= cutoff)
163
164
  out[e.agent] = (out[e.agent] ?? 0) + e.costUsd;
@@ -63,6 +63,7 @@ export declare class CodeMetricsAnalyzer {
63
63
  detectDuplication(files: string[], minLines?: number): Promise<DuplicationResult>;
64
64
  private countLines;
65
65
  private calculateCyclomaticComplexity;
66
+ /** SonarSource cognitive complexity heuristic; see ./cognitive-complexity.ts (#907). */
66
67
  private calculateCognitiveComplexity;
67
68
  private estimateCyclomaticComplexity;
68
69
  private estimateCognitiveComplexity;
@@ -6,6 +6,7 @@ import { TypeScriptParser } from '../parsers/index.js';
6
6
  import { FileReader } from '../io/index.js';
7
7
  import { treeSitterRegistry } from '../parsers/multi-language-parser.js';
8
8
  import { getLanguageFromExtension } from '../types/test-frameworks.js';
9
+ import { calculateCognitiveComplexity } from './cognitive-complexity.js';
9
10
  // ============================================================================
10
11
  // Code Metrics Analyzer
11
12
  // ============================================================================
@@ -247,51 +248,9 @@ export class CodeMetricsAnalyzer {
247
248
  }
248
249
  return complexity;
249
250
  }
251
+ /** SonarSource cognitive complexity heuristic; see ./cognitive-complexity.ts (#907). */
250
252
  calculateCognitiveComplexity(code) {
251
- let complexity = 0;
252
- let nestingLevel = 0;
253
- const lines = code.split('\n');
254
- for (const line of lines) {
255
- const trimmed = line.trim();
256
- // Increase nesting
257
- if (/\bif\s*\(/.test(trimmed)) {
258
- complexity += 1 + nestingLevel;
259
- nestingLevel++;
260
- }
261
- if (/\belse\s+if\s*\(/.test(trimmed)) {
262
- complexity += 1 + nestingLevel;
263
- }
264
- if (/\belse\s*{/.test(trimmed)) {
265
- complexity += 1;
266
- }
267
- if (/\bfor\s*\(/.test(trimmed)) {
268
- complexity += 1 + nestingLevel;
269
- nestingLevel++;
270
- }
271
- if (/\bwhile\s*\(/.test(trimmed)) {
272
- complexity += 1 + nestingLevel;
273
- nestingLevel++;
274
- }
275
- if (/\bswitch\s*\(/.test(trimmed)) {
276
- complexity += 1 + nestingLevel;
277
- nestingLevel++;
278
- }
279
- if (/\bcatch\s*\(/.test(trimmed)) {
280
- complexity += 1 + nestingLevel;
281
- nestingLevel++;
282
- }
283
- if (/\?\s*[^:]/.test(trimmed)) {
284
- complexity += 1 + nestingLevel; // Ternary
285
- }
286
- if (/&&|\|\|/.test(trimmed)) {
287
- complexity += 1; // Boolean operators
288
- }
289
- // Track nesting via braces (simplified)
290
- const openBraces = (trimmed.match(/{/g) || []).length;
291
- const closeBraces = (trimmed.match(/}/g) || []).length;
292
- nestingLevel = Math.max(0, nestingLevel + openBraces - closeBraces);
293
- }
294
- return complexity;
253
+ return calculateCognitiveComplexity(code);
295
254
  }
296
255
  estimateCyclomaticComplexity(code) {
297
256
  // Fallback heuristic for non-parseable code
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Line-based cognitive complexity heuristic (SonarSource rules, issues #907).
3
+ * Known gaps (lambdas, labelled jumps, boolean sequences, ...) are tracked in #967.
4
+ */
5
+ /**
6
+ * Blank out comments and the contents of string, template and regex literals,
7
+ * keeping newlines and delimiters, so keywords and braces inside them are not counted.
8
+ */
9
+ export declare function maskCommentsAndLiterals(code: string): string;
10
+ /**
11
+ * `if`, loops, `switch`, `catch` and ternaries score +1 plus the nesting level;
12
+ * `else if` and `else` score a flat +1 (an `else if` is not also an `if`).
13
+ * Nesting rises only inside the braces of those structures, so a function
14
+ * body, try block or object literal adds no nesting bonus.
15
+ */
16
+ export declare function calculateCognitiveComplexity(code: string): number;
17
+ //# sourceMappingURL=cognitive-complexity.d.ts.map
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Line-based cognitive complexity heuristic (SonarSource rules, issues #907).
3
+ * Known gaps (lambdas, labelled jumps, boolean sequences, ...) are tracked in #967.
4
+ */
5
+ // A `/` after one of these starts a regex literal; after an operand it is division.
6
+ const REGEX_PREFIX = /(?:^|[(,=:[!&|?{;+\-*%~^]|\b(?:return|typeof|case|do|else|in|of|void|yield|await))$/;
7
+ const blank = (text) => text.replace(/[^\n]/g, ' ');
8
+ /** True when a `/` appended to `out` would start a regex literal (checks only the last token). */
9
+ function regexCanStart(out) {
10
+ let k = out.length - 1;
11
+ while (k >= 0 && /\s/.test(out[k]))
12
+ k--;
13
+ return REGEX_PREFIX.test(out.slice(Math.max(0, k - 9), k + 1));
14
+ }
15
+ /** Index just past a string, template or regex literal starting at `start`, and whether it closed. */
16
+ function scanLiteral(code, start) {
17
+ const quote = code[start];
18
+ let inClass = false;
19
+ for (let j = start + 1; j < code.length; j++) {
20
+ const c = code[j];
21
+ if (c === '\\') {
22
+ j++;
23
+ continue;
24
+ }
25
+ if (c === '\n' && quote !== '`')
26
+ return { end: j, closed: false };
27
+ if (quote === '/' && c === '[')
28
+ inClass = true;
29
+ else if (quote === '/' && c === ']')
30
+ inClass = false;
31
+ else if (c === quote && !(quote === '/' && inClass))
32
+ return { end: j + 1, closed: true };
33
+ }
34
+ return { end: code.length, closed: false };
35
+ }
36
+ /**
37
+ * Blank out comments and the contents of string, template and regex literals,
38
+ * keeping newlines and delimiters, so keywords and braces inside them are not counted.
39
+ */
40
+ export function maskCommentsAndLiterals(code) {
41
+ let out = '';
42
+ let i = 0;
43
+ while (i < code.length) {
44
+ const ch = code[i];
45
+ const next = code[i + 1];
46
+ if (ch === '/' && (next === '/' || next === '*')) {
47
+ const close = next === '/' ? code.indexOf('\n', i) : code.indexOf('*/', i + 2);
48
+ const end = close < 0 ? code.length : next === '/' ? close : close + 2;
49
+ out += blank(code.slice(i, end));
50
+ i = end;
51
+ }
52
+ else if (ch === '"' || ch === "'" || ch === '`' || (ch === '/' && regexCanStart(out))) {
53
+ const { end, closed } = scanLiteral(code, i);
54
+ out += ch + blank(code.slice(i + 1, closed ? end - 1 : end)) + (closed ? code[end - 1] : '');
55
+ i = end;
56
+ }
57
+ else {
58
+ out += ch;
59
+ i++;
60
+ }
61
+ }
62
+ return out;
63
+ }
64
+ /**
65
+ * `if`, loops, `switch`, `catch` and ternaries score +1 plus the nesting level;
66
+ * `else if` and `else` score a flat +1 (an `else if` is not also an `if`).
67
+ * Nesting rises only inside the braces of those structures, so a function
68
+ * body, try block or object literal adds no nesting bonus.
69
+ */
70
+ export function calculateCognitiveComplexity(code) {
71
+ const count = (text, pattern) => (text.match(pattern) || []).length;
72
+ let complexity = 0;
73
+ const braces = []; // one entry per open `{`: true when it opens a nesting structure
74
+ let pendingNest = false; // nesting structure whose `{` has not been seen yet
75
+ for (const line of maskCommentsAndLiterals(code).split('\n')) {
76
+ let rest = line.trim();
77
+ // `} else {` / `} catch (e) {`: the previous block closes before this structure is scored.
78
+ while (rest.startsWith('}')) {
79
+ braces.pop();
80
+ rest = rest.slice(1).trimStart();
81
+ }
82
+ const nesting = braces.filter(Boolean).length;
83
+ const flat = count(rest, /\belse\s+if\s*\(/g) + count(rest, /\belse\b(?!\s+if\b)/g);
84
+ const nested = count(rest, /(?<!\belse\s+)\bif\s*\(/g) + count(rest, /\b(?:for|while|switch|catch)\s*\(/g);
85
+ complexity += flat + nested * (1 + nesting);
86
+ if (/\?\s*[^:]/.test(rest)) {
87
+ complexity += 1 + nesting; // Ternary
88
+ }
89
+ if (/&&|\|\|/.test(rest)) {
90
+ complexity += 1; // Boolean operators
91
+ }
92
+ pendingNest ||= flat + nested > 0 || /\bdo\b/.test(rest);
93
+ for (const ch of rest.match(/[{}]/g) || []) {
94
+ if (ch === '{') {
95
+ braces.push(pendingNest);
96
+ pendingNest = false;
97
+ }
98
+ else {
99
+ braces.pop();
100
+ }
101
+ }
102
+ // A brace-less body (`if (x) return;`) ends the structure without nesting anything.
103
+ if (rest.endsWith(';'))
104
+ pendingNest = false;
105
+ }
106
+ return complexity;
107
+ }
108
+ //# sourceMappingURL=cognitive-complexity.js.map
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Run npm / npx without a shell on every platform.
3
+ *
4
+ * On Windows `npm` and `npx` are `npm.cmd` / `npx.cmd` batch shims. Since the
5
+ * CVE-2024-27980 fix (Node 18.20.2 / 20.12.2 / 21.7.3+), child_process refuses
6
+ * to start a `.cmd`/`.bat` without `shell: true` and fails with EINVAL. Turning
7
+ * the shell on would route caller-supplied arguments through cmd.exe, so we run
8
+ * the JavaScript CLI that ships next to node.exe with process.execPath instead
9
+ * (#812, #872).
10
+ */
11
+ export type NpmCliTool = 'npm' | 'npx';
12
+ /**
13
+ * Resolve `[executable, leadingArgs]` for npm/npx.
14
+ *
15
+ * - POSIX: `[tool, []]` (the real executable on PATH; unchanged behaviour).
16
+ * - Windows: `[execPath, ['<node dir>\\node_modules\\npm\\bin\\<tool>-cli.js']]`,
17
+ * or `null` when that layout is absent. Callers must then fail clearly rather
18
+ * than spawn `<tool>.cmd` without a shell.
19
+ */
20
+ export declare function npmCliInvocation(tool: NpmCliTool, platform?: NodeJS.Platform, execPath?: string, exists?: (path: string) => boolean): [string, string[]] | null;
21
+ //# sourceMappingURL=npm-cli-invocation.d.ts.map
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Run npm / npx without a shell on every platform.
3
+ *
4
+ * On Windows `npm` and `npx` are `npm.cmd` / `npx.cmd` batch shims. Since the
5
+ * CVE-2024-27980 fix (Node 18.20.2 / 20.12.2 / 21.7.3+), child_process refuses
6
+ * to start a `.cmd`/`.bat` without `shell: true` and fails with EINVAL. Turning
7
+ * the shell on would route caller-supplied arguments through cmd.exe, so we run
8
+ * the JavaScript CLI that ships next to node.exe with process.execPath instead
9
+ * (#812, #872).
10
+ */
11
+ import { existsSync } from 'node:fs';
12
+ import { dirname, join } from 'node:path';
13
+ /**
14
+ * Resolve `[executable, leadingArgs]` for npm/npx.
15
+ *
16
+ * - POSIX: `[tool, []]` (the real executable on PATH; unchanged behaviour).
17
+ * - Windows: `[execPath, ['<node dir>\\node_modules\\npm\\bin\\<tool>-cli.js']]`,
18
+ * or `null` when that layout is absent. Callers must then fail clearly rather
19
+ * than spawn `<tool>.cmd` without a shell.
20
+ */
21
+ export function npmCliInvocation(tool, platform = process.platform, execPath = process.execPath, exists = existsSync) {
22
+ if (platform !== 'win32')
23
+ return [tool, []];
24
+ // Host path module: it is path.win32 whenever this branch runs for real.
25
+ const cli = join(dirname(execPath), 'node_modules', 'npm', 'bin', `${tool}-cli.js`);
26
+ return exists(cli) ? [execPath, [cli]] : null;
27
+ }
28
+ //# sourceMappingURL=npm-cli-invocation.js.map
@@ -33,6 +33,30 @@ export function loadOptionalModule(name, req = defaultRequire) {
33
33
  }
34
34
  catch (err) {
35
35
  if (isModuleAbsent(err)) {
36
+ // MODULE_NOT_FOUND can name a transitive dependency of a present package.
37
+ // Resolution checks availability without executing the package again.
38
+ if (typeof req.resolve === 'function') {
39
+ try {
40
+ req.resolve(name);
41
+ }
42
+ catch (resolutionError) {
43
+ if (!isModuleAbsent(resolutionError))
44
+ throw resolutionError;
45
+ return { available: false, degraded: true, name, reason: `optional module "${name}" not installed (running degraded)` };
46
+ }
47
+ // Installed optional wrappers may lack the binary for this platform.
48
+ // Preserve degradation, but identify the missing inner dependency.
49
+ const message = err.message;
50
+ const inner = typeof message === 'string'
51
+ ? /Cannot find (?:module|package) ['"]([^'"]+)['"]/.exec(message)?.[1]
52
+ : undefined;
53
+ const dependency = inner ? ` its dependency "${inner}" is missing` : ' a dependency is missing';
54
+ return {
55
+ available: false, degraded: true, name,
56
+ reason: `optional module "${name}" is installed but${dependency} (running degraded)`,
57
+ };
58
+ }
59
+ // Injected minimal require functions retain the historical absence contract.
36
60
  return { available: false, degraded: true, name, reason: `optional module "${name}" not installed (running degraded)` };
37
61
  }
38
62
  throw err; // present but broken — do NOT mask a real failure (#528)
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Safe argument builders for spawning test runners (issue #909).
3
+ *
4
+ * Runner CLIs read some values in ways that can select the wrong tests:
5
+ * - Jest treats positional TestPathPatterns as regular expressions, so a path
6
+ * containing `(`, `[`, `+` or `.` can match other files or miss its own.
7
+ * - A value that starts with `-` (a test name such as `-x`, or a relative path
8
+ * such as `-dash.test.ts`) is parsed as a flag by Jest, Vitest and Mocha.
9
+ * Vitest ignores everything after a `--` separator, so a separator alone
10
+ * cannot protect positional file filters.
11
+ *
12
+ * The rules used here:
13
+ * - Name filters use the `--flag=value` form, so the value is never a flag.
14
+ * - File filters are absolute paths, which never start with `-`.
15
+ * - Jest file filters are regex-escaped and anchored as `^<path>$`, so they
16
+ * select exactly one file, and the leading `^` cannot be read as a flag.
17
+ */
18
+ /** Runners whose test-name filter is a regular expression. */
19
+ export type NameFilterRunner = 'vitest' | 'jest' | 'mocha';
20
+ /** Escape every regular-expression metacharacter in a literal string. */
21
+ export declare function escapeRegExpLiteral(value: string): string;
22
+ /**
23
+ * Absolute path for a test file. Directory symlinks (for example `/tmp` on
24
+ * macOS) are resolved the same way runners resolve their root, while the file
25
+ * name itself is kept. The result never begins with `-`.
26
+ */
27
+ export declare function runnerFilePath(file: string, cwd?: string): string;
28
+ /**
29
+ * Jest positional TestPathPattern for `file`. A file matches exactly; a
30
+ * directory matches every path beneath it but not a sibling that shares its
31
+ * prefix (`app` vs `app-other`). Separators are normalised to `/`, which Jest
32
+ * maps to the platform separator.
33
+ */
34
+ export declare function jestExactPathPattern(file: string, cwd?: string): string;
35
+ /**
36
+ * Literal test-name filter in `--flag=value` form. Mocha uses `--grep`; Jest
37
+ * and Vitest use `--testNamePattern` (the long form of `-t`).
38
+ */
39
+ export declare function nameFilterArg(runner: NameFilterRunner, testName: string): string;
40
+ /** True when a command vector (runner command plus its arguments) runs Jest. */
41
+ export declare function isJestCommand(args: readonly string[]): boolean;
42
+ //# sourceMappingURL=test-runner-args.d.ts.map