agentic-qe 3.11.3 → 3.11.5

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 (426) hide show
  1. package/.claude/hooks/aqe-hook.cjs +44 -10
  2. package/.claude/skills/skills-manifest.json +1 -1
  3. package/CHANGELOG.md +106 -0
  4. package/assets/skills/skills-manifest.json +1 -1
  5. package/dist/audit/witness-chain.d.ts +25 -0
  6. package/dist/audit/witness-chain.js +69 -22
  7. package/dist/audit/witness-key-manager.d.ts +11 -0
  8. package/dist/audit/witness-key-manager.js +24 -0
  9. package/dist/cli/brain-commands.js +2 -1
  10. package/dist/cli/bundle.js +5 -5
  11. package/dist/cli/chunks/adapter-KNM5R47J.js +2 -0
  12. package/dist/cli/chunks/{agent-booster-wasm-BFRW7HEU.js → agent-booster-wasm-CSTBLNYZ.js} +2 -2
  13. package/dist/cli/chunks/{agent-handler-ZVC3VFPC.js → agent-handler-M4W4GTXN.js} +2 -2
  14. package/dist/cli/chunks/{agent-memory-branch-3WU3CVSX.js → agent-memory-branch-VGXFYLSQ.js} +2 -2
  15. package/dist/cli/chunks/aqe-learning-engine-MXPJLVR3.js +2 -0
  16. package/dist/cli/chunks/{arena-QMRLNQUC.js → arena-FKSD3LLM.js} +4 -4
  17. package/dist/cli/chunks/{arena-JMVTWWG5.js → arena-IQBRGWAG.js} +2 -2
  18. package/dist/cli/chunks/audit-7NSGRR4Z.js +3 -0
  19. package/dist/cli/chunks/base-X4EXQ2AS.js +2 -0
  20. package/dist/cli/chunks/{hnswlib-node-EBRXKEX5.js → better-sqlite3-2KR4LQRU.js} +2 -2
  21. package/dist/cli/chunks/brain-handler-M6A3UB66.js +89 -0
  22. package/dist/cli/chunks/{branch-enumerator-CJJG6X3I.js → branch-enumerator-2JGKY4BB.js} +2 -2
  23. package/dist/cli/chunks/{browser-LI2CDWVR.js → browser-J43WQPJL.js} +2 -2
  24. package/dist/cli/chunks/browser-workflow-4HX6RP5F.js +2 -0
  25. package/dist/cli/chunks/{chunk-DS7AZD26.js → chunk-26WEI3P4.js} +2 -2
  26. package/dist/cli/chunks/{chunk-OVEG5MEL.js → chunk-2XPMATEK.js} +2 -2
  27. package/dist/cli/chunks/{chunk-36HTS4EP.js → chunk-2XQHG56O.js} +2 -2
  28. package/dist/cli/chunks/{chunk-CGKHG46K.js → chunk-354367AP.js} +2 -2
  29. package/dist/cli/chunks/{chunk-FPKKKUWF.js → chunk-37ZUF5NX.js} +1 -1
  30. package/dist/cli/chunks/{chunk-H7Y43HBQ.js → chunk-3I4TCMOJ.js} +1 -1
  31. package/dist/cli/chunks/{chunk-WV66MXJI.js → chunk-3JF5A72M.js} +2 -2
  32. package/dist/cli/chunks/{chunk-MX5FMAY5.js → chunk-3LY7OCSO.js} +1 -1
  33. package/dist/cli/chunks/{chunk-KHUN65Q3.js → chunk-3V36WMIO.js} +1 -1
  34. package/dist/cli/chunks/{chunk-VFEU4JM4.js → chunk-3WR35GFF.js} +2 -2
  35. package/dist/cli/chunks/{chunk-A43MKBSX.js → chunk-4LODYRNV.js} +2 -2
  36. package/dist/cli/chunks/{chunk-3E3PSEC5.js → chunk-4MHN7JWC.js} +3 -3
  37. package/dist/cli/chunks/chunk-4QOI5JS7.js +14 -0
  38. package/dist/cli/chunks/{chunk-LKLWIP4Z.js → chunk-4RTWPR3X.js} +1 -1
  39. package/dist/cli/chunks/chunk-4XJ2A3HY.js +65 -0
  40. package/dist/cli/chunks/{chunk-PMHSTMHV.js → chunk-4Y3LGBKJ.js} +3 -3
  41. package/dist/cli/chunks/{chunk-SFDBIO64.js → chunk-52U5BFZP.js} +2 -2
  42. package/dist/cli/chunks/{chunk-YPRM6ZFL.js → chunk-53YOYZW5.js} +2 -2
  43. package/dist/cli/chunks/{chunk-REZ2GZQ3.js → chunk-5WMU7XCF.js} +1 -1
  44. package/dist/cli/chunks/{chunk-VUEYLW5P.js → chunk-62OTU2AP.js} +2 -2
  45. package/dist/cli/chunks/{chunk-3XLGXCSX.js → chunk-62UM7Q5N.js} +1 -1
  46. package/dist/cli/chunks/{chunk-DZZ4AJQI.js → chunk-6Q57K4YD.js} +2 -2
  47. package/dist/cli/chunks/chunk-6R3YOAKO.js +2 -0
  48. package/dist/cli/chunks/chunk-6T65OKUM.js +2 -0
  49. package/dist/cli/chunks/{chunk-VTDWQ7WI.js → chunk-7BCRULCP.js} +2 -2
  50. package/dist/cli/chunks/{chunk-XCSEJQXR.js → chunk-7DTMENY6.js} +2 -2
  51. package/dist/cli/chunks/{chunk-N2K2EQFH.js → chunk-7KXPNNMR.js} +2 -2
  52. package/dist/cli/chunks/{chunk-XKUN5PDH.js → chunk-7P6X4BFO.js} +3 -3
  53. package/dist/cli/chunks/{chunk-3CBYKKRW.js → chunk-7YSBATSN.js} +2 -2
  54. package/dist/cli/chunks/{chunk-ZDPQB67L.js → chunk-ABU64UWB.js} +1 -1
  55. package/dist/cli/chunks/{chunk-IJHPZMEQ.js → chunk-AF6P5RWY.js} +2 -2
  56. package/dist/cli/chunks/{chunk-7S7QF4HJ.js → chunk-AGJOGUP5.js} +1 -1
  57. package/dist/cli/chunks/{chunk-EHEFI6LR.js → chunk-AL5VJJN4.js} +1 -1
  58. package/dist/cli/chunks/{chunk-Q2A2XQGF.js → chunk-AOQYORVA.js} +2 -2
  59. package/dist/cli/chunks/{chunk-6WWNK67C.js → chunk-AOXJFDH5.js} +180 -176
  60. package/dist/cli/chunks/{chunk-SWRGPCZ2.js → chunk-AXKWV5NF.js} +4 -4
  61. package/dist/cli/chunks/{chunk-3BREKEL5.js → chunk-B2VBDMDI.js} +2 -2
  62. package/dist/cli/chunks/{chunk-RXN5DWVM.js → chunk-BJLA2IX7.js} +2 -2
  63. package/dist/cli/chunks/{chunk-DPYNXEBC.js → chunk-BLPWJQTY.js} +2 -2
  64. package/dist/cli/chunks/{chunk-SMHYPPO6.js → chunk-BTLUWH4R.js} +2 -2
  65. package/dist/cli/chunks/{chunk-PUK5NE47.js → chunk-C4EZNOWK.js} +1 -1
  66. package/dist/cli/chunks/{chunk-ATFADWGD.js → chunk-C5C4W572.js} +2 -2
  67. package/dist/cli/chunks/{chunk-WTKT2AD3.js → chunk-CDJP6COA.js} +2 -2
  68. package/dist/cli/chunks/{chunk-G6MPXBCD.js → chunk-CKOF27L7.js} +2 -2
  69. package/dist/cli/chunks/{chunk-BQ5EJPK3.js → chunk-D45QLJEL.js} +1 -1
  70. package/dist/cli/chunks/{chunk-WCVZHXWL.js → chunk-DFRRWOEX.js} +2 -2
  71. package/dist/cli/chunks/{chunk-PSL53AQ4.js → chunk-DLBVADWQ.js} +92 -92
  72. package/dist/cli/chunks/{chunk-HRD5I7ES.js → chunk-DPL762HU.js} +1 -1
  73. package/dist/cli/chunks/{chunk-7QIYYYUE.js → chunk-DVW66FPU.js} +1 -1
  74. package/dist/cli/chunks/{chunk-ABD6JBNO.js → chunk-EDOGRFAG.js} +1 -1
  75. package/dist/cli/chunks/{chunk-7SBMTSGY.js → chunk-EEKG35K5.js} +5 -5
  76. package/dist/cli/chunks/{chunk-PW4GGJMP.js → chunk-EK3HPH6A.js} +1 -1
  77. package/dist/cli/chunks/{chunk-QPMISAWB.js → chunk-FGD6HINU.js} +1 -1
  78. package/dist/cli/chunks/{chunk-SLU35IDJ.js → chunk-FGSIID5C.js} +2 -2
  79. package/dist/cli/chunks/{chunk-DNOBN3IR.js → chunk-FHTYEAQ3.js} +2 -2
  80. package/dist/cli/chunks/{chunk-S2T2BXUL.js → chunk-FII3WCCY.js} +2 -2
  81. package/dist/cli/chunks/{chunk-77QJQRL2.js → chunk-FIPKIIMS.js} +2 -2
  82. package/dist/cli/chunks/{chunk-WYJFVSEB.js → chunk-FMNXHVIN.js} +2 -2
  83. package/dist/cli/chunks/{chunk-FZLCKIPP.js → chunk-G2ZIJZJ7.js} +2 -2
  84. package/dist/cli/chunks/{chunk-L6PH7JIE.js → chunk-GODAWJMZ.js} +2 -2
  85. package/dist/cli/chunks/{chunk-KTYESESI.js → chunk-GW6XWMX2.js} +2 -2
  86. package/dist/cli/chunks/{chunk-AC6OZTY4.js → chunk-HC6KTVFR.js} +2 -2
  87. package/dist/cli/chunks/{chunk-EXCU4J7T.js → chunk-HJWT4KME.js} +1 -1
  88. package/dist/cli/chunks/{chunk-GBCDJJWH.js → chunk-I3ANRYQ6.js} +2 -2
  89. package/dist/cli/chunks/{chunk-KXRI4MR3.js → chunk-I3NWKPXJ.js} +2 -2
  90. package/dist/cli/chunks/chunk-IBDQWKI3.js +2 -0
  91. package/dist/cli/chunks/{chunk-7FVWETN4.js → chunk-IU5RSN6M.js} +2 -2
  92. package/dist/cli/chunks/{chunk-L44XXD3X.js → chunk-J5XDKVI7.js} +2 -2
  93. package/dist/cli/chunks/{chunk-NJ2RY4OL.js → chunk-J6PFPY7V.js} +2 -2
  94. package/dist/cli/chunks/{chunk-27MMZQ7X.js → chunk-JATLFS6A.js} +1 -1
  95. package/dist/cli/chunks/{chunk-SIAJP3YA.js → chunk-JBKZ5TUM.js} +2 -2
  96. package/dist/cli/chunks/{chunk-PLQADRA6.js → chunk-JDSHUECG.js} +2 -2
  97. package/dist/cli/chunks/chunk-K4C25BWV.js +24 -0
  98. package/dist/cli/chunks/{chunk-UFZCHVLH.js → chunk-K4I7UIU5.js} +1 -1
  99. package/dist/cli/chunks/{chunk-6F43POT6.js → chunk-KP3R2M2G.js} +1 -1
  100. package/dist/cli/chunks/chunk-KQVIWE3W.js +2 -0
  101. package/dist/cli/chunks/{chunk-JWTMVC6E.js → chunk-KVVJVMDM.js} +2 -2
  102. package/dist/cli/chunks/{chunk-EZ4GKHSI.js → chunk-LOE2JETO.js} +2 -2
  103. package/dist/cli/chunks/{chunk-O7ZDQ5FF.js → chunk-LPR2R3AN.js} +3 -3
  104. package/dist/cli/chunks/{chunk-AKOGQT3A.js → chunk-M6FW56MV.js} +2 -2
  105. package/dist/cli/chunks/{chunk-NBOEXSV2.js → chunk-MCHEUSY4.js} +1 -1
  106. package/dist/cli/chunks/{chunk-B7XPSXK6.js → chunk-MEIU7457.js} +2 -2
  107. package/dist/cli/chunks/{chunk-3FOFPGHH.js → chunk-MHMQ6MCT.js} +2 -2
  108. package/dist/cli/chunks/{chunk-6JR2RSY2.js → chunk-MIU5RUBJ.js} +2 -2
  109. package/dist/cli/chunks/{chunk-QCCXH5DK.js → chunk-MMEXHZUC.js} +37 -12
  110. package/dist/cli/chunks/{chunk-LW5TUN5F.js → chunk-MTBGOWJA.js} +2 -2
  111. package/dist/cli/chunks/{chunk-JVXPKHND.js → chunk-NCSXLMDL.js} +77 -27
  112. package/dist/cli/chunks/{chunk-WLLGPGQY.js → chunk-O7J54OHN.js} +1 -1
  113. package/dist/cli/chunks/{chunk-ZM7WOA3K.js → chunk-OGNTCZKK.js} +1 -1
  114. package/dist/cli/chunks/{chunk-CYJ6O5VZ.js → chunk-OS2HHJTM.js} +2 -2
  115. package/dist/cli/chunks/{chunk-242B625Q.js → chunk-OS62Y77J.js} +2 -2
  116. package/dist/cli/chunks/{chunk-CLZ5RQVA.js → chunk-PVDXNQPL.js} +2 -2
  117. package/dist/cli/chunks/{chunk-PUUGIBFF.js → chunk-PW72M2FE.js} +2 -2
  118. package/dist/cli/chunks/{chunk-RWUGXU2K.js → chunk-Q5TR6ETB.js} +22 -22
  119. package/dist/cli/chunks/{chunk-CCDGNJZX.js → chunk-QKK7VBVB.js} +2 -2
  120. package/dist/cli/chunks/{chunk-BHZI6PDR.js → chunk-RFLHPLET.js} +1 -1
  121. package/dist/cli/chunks/{chunk-KULBMV6K.js → chunk-RJN2RM76.js} +2 -2
  122. package/dist/cli/chunks/{chunk-LGEZ3ZJX.js → chunk-RKXZLTWR.js} +2 -2
  123. package/dist/cli/chunks/{chunk-OFMVC6P3.js → chunk-SE3JFUKP.js} +1 -1
  124. package/dist/cli/chunks/{chunk-S7KDHA6P.js → chunk-SK754ZSH.js} +4 -4
  125. package/dist/cli/chunks/{chunk-OQGELUM2.js → chunk-SO6G4IX3.js} +2 -2
  126. package/dist/cli/chunks/{chunk-5746QYRF.js → chunk-SUL3I6QZ.js} +2 -2
  127. package/dist/cli/chunks/{chunk-22CUJA33.js → chunk-TBT3OFRW.js} +2 -2
  128. package/dist/cli/chunks/{chunk-26KHL4VO.js → chunk-TEIWJ3GJ.js} +1 -1
  129. package/dist/cli/chunks/{chunk-SFGBC5RP.js → chunk-TRNBQFFG.js} +8 -20
  130. package/dist/cli/chunks/{chunk-UTGW75AZ.js → chunk-TTJJ4DQE.js} +2 -2
  131. package/dist/cli/chunks/{chunk-H6YFMUFG.js → chunk-UBI2EOS3.js} +1 -1
  132. package/dist/cli/chunks/{chunk-GCIL7PK7.js → chunk-UBY322ED.js} +2 -2
  133. package/dist/cli/chunks/{chunk-P4UGVVVX.js → chunk-UORTQXJ2.js} +1 -1
  134. package/dist/cli/chunks/{chunk-BFBZFUBP.js → chunk-URP75DL4.js} +1 -1
  135. package/dist/cli/chunks/chunk-V6NAB5UZ.js +2 -0
  136. package/dist/cli/chunks/{chunk-DZ7PWB6E.js → chunk-VMFAANWX.js} +2 -2
  137. package/dist/cli/chunks/{chunk-6KKKPVOF.js → chunk-VMWRMINE.js} +1 -1
  138. package/dist/cli/chunks/{chunk-ECGASTG7.js → chunk-VN2HHBZN.js} +2 -2
  139. package/dist/cli/chunks/{chunk-6GVRP64A.js → chunk-W72FJA2H.js} +2 -2
  140. package/dist/cli/chunks/chunk-W7TYKPLY.js +27 -0
  141. package/dist/cli/chunks/{chunk-2OUXYSQV.js → chunk-WHHQIL4F.js} +2 -2
  142. package/dist/cli/chunks/{chunk-RRSUW2TK.js → chunk-WMZ2QGGS.js} +2 -2
  143. package/dist/cli/chunks/{chunk-54TDOQAH.js → chunk-WPSK237F.js} +3 -3
  144. package/dist/cli/chunks/{chunk-LMA6KEZH.js → chunk-XKQY2Z3Q.js} +1 -1
  145. package/dist/cli/chunks/{chunk-UMWYL37S.js → chunk-XLT3FYS7.js} +2 -2
  146. package/dist/cli/chunks/{chunk-5EW36WTI.js → chunk-XT4TDLOB.js} +2 -2
  147. package/dist/cli/chunks/{chunk-7UOH55UT.js → chunk-Y25PO65W.js} +2 -2
  148. package/dist/cli/chunks/{chunk-ED7MD6OI.js → chunk-Y6DWJKHU.js} +3 -3
  149. package/dist/cli/chunks/{chunk-A4NYOH7P.js → chunk-YBPLJRVT.js} +2 -2
  150. package/dist/cli/chunks/{chunk-BA7PJS3Y.js → chunk-YFCULQBP.js} +2 -2
  151. package/dist/cli/chunks/{chunk-B65CRJN6.js → chunk-YGVDP6X7.js} +1 -1
  152. package/dist/cli/chunks/chunk-YR2JKBZO.js +2 -0
  153. package/dist/cli/chunks/{chunk-FJRRXCIS.js → chunk-YZSTZUGJ.js} +1 -1
  154. package/dist/cli/chunks/{chunk-H2YOWAEB.js → chunk-ZG5UAEEO.js} +2 -2
  155. package/dist/cli/chunks/{chunk-MU36VPXV.js → chunk-ZLBY25MB.js} +1 -1
  156. package/dist/cli/chunks/chunk-ZMPAM4DY.js +2 -0
  157. package/dist/cli/chunks/{chunk-4ITHKHR5.js → chunk-ZPP57WQU.js} +2 -2
  158. package/dist/cli/chunks/{chunk-B6USJW5E.js → chunk-ZXEWTZFR.js} +1 -1
  159. package/dist/cli/chunks/{ci-JW4O2J3W.js → ci-CBNVLOOQ.js} +2 -2
  160. package/dist/cli/chunks/{ci-output-JNXJV4B2.js → ci-output-I4HY2FYJ.js} +2 -2
  161. package/dist/cli/chunks/{circuit-breaker-XDD4KUGR.js → circuit-breaker-5VRBKGWL.js} +2 -2
  162. package/dist/cli/chunks/{claude-flow-setup-L6IZOGYZ.js → claude-flow-setup-XPJPKHIO.js} +2 -2
  163. package/dist/cli/chunks/client-AHXNCOHK.js +2 -0
  164. package/dist/cli/chunks/{cline-installer-PK5SMN2B.js → cline-installer-OFRDUUWZ.js} +2 -2
  165. package/dist/cli/chunks/{code-ZDVX3SQH.js → code-QIZQVB3E.js} +2 -2
  166. package/dist/cli/chunks/{code-index-extractor-VXZNKEU5.js → code-index-extractor-LMUUWEX4.js} +2 -2
  167. package/dist/cli/chunks/{codex-installer-OXKSIX7H.js → codex-installer-N2MKIZ2S.js} +2 -2
  168. package/dist/cli/chunks/{completions-VRFFK223.js → completions-Y36S3C5J.js} +2 -2
  169. package/dist/cli/chunks/{complexity-analyzer-FTIMV74J.js → complexity-analyzer-73YS3WUD.js} +2 -2
  170. package/dist/cli/chunks/{continuedev-installer-KTYBBPN4.js → continuedev-installer-SAOTP6J3.js} +2 -2
  171. package/dist/cli/chunks/{copilot-installer-WDC3YNUR.js → copilot-installer-A4HXF6HE.js} +2 -2
  172. package/dist/cli/chunks/core-handlers-EEFLLMAZ.js +2 -0
  173. package/dist/cli/chunks/{cost-tracker-6MH4H33B.js → cost-tracker-P26XUVZS.js} +2 -2
  174. package/dist/cli/chunks/{coverage-NHATLNS4.js → coverage-HVNHSMVJ.js} +3 -3
  175. package/dist/cli/chunks/cross-domain-router-LT3H4SNJ.js +2 -0
  176. package/dist/cli/chunks/{cursor-installer-VQSUJDFB.js → cursor-installer-46BQFTYZ.js} +2 -2
  177. package/dist/cli/chunks/{daemon-3VAOEKQW.js → daemon-Y54O3FLT.js} +3 -3
  178. package/dist/cli/chunks/daemon-YE7K2AZF.js +10 -0
  179. package/dist/cli/chunks/{dag-attention-scheduler-HZ6OGYIH.js → dag-attention-scheduler-ETA7YY52.js} +2 -2
  180. package/dist/cli/chunks/{detect-CGU3SC63.js → detect-5WLQ2J3E.js} +2 -2
  181. package/dist/cli/chunks/{dist-node-DIBQ7PTA.js → dist-node-45WW6I7J.js} +2 -2
  182. package/dist/cli/chunks/{domain-handler-DCMGAYXS.js → domain-handler-J7DQV74M.js} +2 -2
  183. package/dist/cli/chunks/domain-transfer-GD2EGQVR.js +2 -0
  184. package/dist/cli/chunks/dream-4K3BK4IG.js +2 -0
  185. package/dist/cli/chunks/{embed-and-insert-pattern-7247LAU3.js → embed-and-insert-pattern-JELNEA2D.js} +2 -2
  186. package/dist/cli/chunks/{eval-6KR7TFOK.js → eval-A4PA5G2U.js} +2 -2
  187. package/dist/cli/chunks/{experience-capture-middleware-IIOR6RVV.js → experience-capture-middleware-MLHTYWTA.js} +3 -3
  188. package/dist/cli/chunks/{fast-paths-M7OGD4ZI.js → fast-paths-QYDTITRV.js} +2 -2
  189. package/dist/cli/chunks/{feature-flags-U75KFIGH.js → feature-flags-H4MSY26Z.js} +2 -2
  190. package/dist/cli/chunks/{feature-flags-GGUXHRJI.js → feature-flags-MQYYRHIK.js} +2 -2
  191. package/dist/cli/chunks/{file-discovery-V52AYEB7.js → file-discovery-RMFVJNGL.js} +2 -2
  192. package/dist/cli/chunks/{fleet-2UH72CK4.js → fleet-7KZQOTAC.js} +4 -4
  193. package/dist/cli/chunks/{gnn-wrapper-J2GDLT3P.js → gnn-wrapper-NMZFTGVH.js} +2 -2
  194. package/dist/cli/chunks/{heartbeat-handler-QIDQHRXT.js → heartbeat-handler-7BQDK7MG.js} +4 -4
  195. package/dist/cli/chunks/heartbeat-scheduler-IMPPGQUK.js +2 -0
  196. package/dist/cli/chunks/hnsw-adapter-EIAA6R2L.js +2 -0
  197. package/dist/cli/chunks/hnsw-index-ZXXP6AXZ.js +2 -0
  198. package/dist/cli/chunks/{hnsw-legacy-bridge-IU62PIY5.js → hnsw-legacy-bridge-TPPGBPKF.js} +2 -2
  199. package/dist/cli/chunks/{better-sqlite3-QNZJOJAB.js → hnswlib-node-E6NSZPP2.js} +2 -2
  200. package/dist/cli/chunks/{hooks-ZI4D3ATS.js → hooks-CYZIUYSH.js} +48 -52
  201. package/dist/cli/chunks/hybrid-router-LXWG4MLH.js +2 -0
  202. package/dist/cli/chunks/{hypergraph-engine-6JEERAGA.js → hypergraph-engine-WC6DMTYQ.js} +2 -2
  203. package/dist/cli/chunks/{hypergraph-handler-YMDGYCB6.js → hypergraph-handler-GTGA3TXJ.js} +3 -3
  204. package/dist/cli/chunks/impact-analyzer-TP5LRFYH.js +2 -0
  205. package/dist/cli/chunks/{init-handler-N57NW3QI.js → init-handler-N3Z72JNI.js} +6 -6
  206. package/dist/cli/chunks/init-wizard-AIOA5KOY.js +2 -0
  207. package/dist/cli/chunks/kernel-SQALRU6Q.js +2 -0
  208. package/dist/cli/chunks/{kilocode-installer-7ABTGXJ5.js → kilocode-installer-FUX4V6II.js} +2 -2
  209. package/dist/cli/chunks/{kiro-installer-2JFOHLVI.js → kiro-installer-ZSNZT7ZR.js} +2 -2
  210. package/dist/cli/chunks/knowledge-graph-JFVT6SNN.js +2 -0
  211. package/dist/cli/chunks/{learning-3P3ZXRGD.js → learning-UQY64COU.js} +3 -3
  212. package/dist/cli/chunks/{llm-router-AWB2KHDW.js → llm-router-CMHGGX6N.js} +4 -4
  213. package/dist/cli/chunks/llm-router-service-XHFKTH3I.js +2 -0
  214. package/dist/cli/chunks/{load-GGVBCBGX.js → load-E6WH4QN2.js} +2 -2
  215. package/dist/cli/chunks/load-test-JEIFJKNN.js +2 -0
  216. package/dist/cli/chunks/{mcp-33NHIBN3.js → mcp-UM5VTW6N.js} +2 -2
  217. package/dist/cli/chunks/{memory-IVAQS4OW.js → memory-7Q3XDUE5.js} +5 -5
  218. package/dist/cli/chunks/memory-backend-NT7I37CP.js +2 -0
  219. package/dist/cli/chunks/memory-handlers-746D7NE7.js +2 -0
  220. package/dist/cli/chunks/{multi-model-executor-NWQY6IN2.js → multi-model-executor-LZENWVRR.js} +2 -2
  221. package/dist/cli/chunks/{opencode-installer-FBB4JOEV.js → opencode-installer-O2JAIPLF.js} +2 -2
  222. package/dist/cli/chunks/{orchestrator-GDAXR7DH.js → orchestrator-DKZWXDRI.js} +5 -5
  223. package/dist/cli/chunks/pattern-null-store-6QU6WHDW.js +2 -0
  224. package/dist/cli/chunks/pattern-usage-recorder-CLUL4M55.js +2 -0
  225. package/dist/cli/chunks/{pipeline-VIKAOIBE.js → pipeline-2VDLTR5J.js} +2 -2
  226. package/dist/cli/chunks/{platform-FFVP36LH.js → platform-4N4Q5XYX.js} +2 -2
  227. package/dist/cli/chunks/{plugin-TI6QOLXH.js → plugin-GY5AU5CS.js} +2 -2
  228. package/dist/cli/chunks/{prime-radiant-advanced-wasm-AZRNI2OL.js → prime-radiant-advanced-wasm-TQ4DKDZS.js} +2 -2
  229. package/dist/cli/chunks/protocol-executor-GT2MZYUU.js +2 -0
  230. package/dist/cli/chunks/{protocol-handler-J4EA34B3.js → protocol-handler-T3LZ3WRG.js} +2 -2
  231. package/dist/cli/chunks/{prove-ADVRMAWS.js → prove-OV7S5J4W.js} +2 -2
  232. package/dist/cli/chunks/provider-manager-OATJ7R3D.js +2 -0
  233. package/dist/cli/chunks/qe-reasoning-bank-IJXNQ67O.js +2 -0
  234. package/dist/cli/chunks/{quality-GB5SJFSD.js → quality-AXD4NLQA.js} +2 -2
  235. package/dist/cli/chunks/queen-coordinator-6RBHWCUG.js +2 -0
  236. package/dist/cli/chunks/{real-embeddings-GDRJ4XSH.js → real-embeddings-2PUCC7FG.js} +2 -2
  237. package/dist/cli/chunks/{roocode-installer-Q6EISUDV.js → roocode-installer-WJ5ARGLW.js} +2 -2
  238. package/dist/cli/chunks/router-XKQRT5JK.js +2 -0
  239. package/dist/cli/chunks/routing-feedback-ACPSD4LW.js +2 -0
  240. package/dist/cli/chunks/{routing-handler-RO4RTRAG.js → routing-handler-CU6657SZ.js} +2 -2
  241. package/dist/cli/chunks/{ruvector-commands-FFIHCGVQ.js → ruvector-commands-IIF6VSFW.js} +2 -2
  242. package/dist/cli/chunks/{rvf-dual-writer-JGEK3A5Y.js → rvf-dual-writer-YMQI7XO2.js} +2 -2
  243. package/dist/cli/chunks/{rvf-migration-adapter-OVYC4QM6.js → rvf-migration-adapter-HDE3PR2W.js} +2 -2
  244. package/dist/cli/chunks/{rvf-migration-coordinator-U6L77QTS.js → rvf-migration-coordinator-MQV5OA7K.js} +2 -2
  245. package/dist/cli/chunks/rvf-native-adapter-SIWRKE33.js +2 -0
  246. package/dist/cli/chunks/safe-db-LCPUYMX4.js +2 -0
  247. package/dist/cli/chunks/schedule-HIQJCWXG.js +2 -0
  248. package/dist/cli/chunks/scheduler-QE5EJ5LE.js +2 -0
  249. package/dist/cli/chunks/{security-QPQIDAIL.js → security-UM3IGDSM.js} +3 -3
  250. package/dist/cli/chunks/{shared-rvf-adapter-JRJTI4UD.js → shared-rvf-adapter-I3SOJ6M4.js} +2 -2
  251. package/dist/cli/chunks/{shared-rvf-dual-writer-DSHGURDA.js → shared-rvf-dual-writer-KQGC2UO7.js} +2 -2
  252. package/dist/cli/chunks/sqlite-persistence-EU54UTMH.js +2 -0
  253. package/dist/cli/chunks/status-handler-OX4CJZME.js +46 -0
  254. package/dist/cli/chunks/{structural-health-UVECCN7U.js → structural-health-PYUMVBXJ.js} +2 -2
  255. package/dist/cli/chunks/{sync-XXIGTGCG.js → sync-2TED3YTY.js} +2 -2
  256. package/dist/cli/chunks/{sync-ZLZ4CZFJ.js → sync-VALFNTA6.js} +2 -2
  257. package/dist/cli/chunks/{task-handler-73YAVOKJ.js → task-handler-VPGAJVPC.js} +2 -2
  258. package/dist/cli/chunks/{task-handlers-PKECV27D.js → task-handlers-IB4UAMU6.js} +3 -3
  259. package/dist/cli/chunks/{test-U3SXW4SV.js → test-OMRJOZB6.js} +4 -4
  260. package/dist/cli/chunks/{test-scheduling-POJND3GV.js → test-scheduling-ZL3YFPBU.js} +3 -3
  261. package/dist/cli/chunks/{token-bootstrap-ICX6SIXJ.js → token-bootstrap-DNWZI7SH.js} +2 -2
  262. package/dist/cli/chunks/{token-usage-WCHJUVGT.js → token-usage-IYO7RGFF.js} +2 -2
  263. package/dist/cli/chunks/{transformers-L77UIHIY.js → transformers-53ALC34T.js} +2 -2
  264. package/dist/cli/chunks/{tree-sitter-wasm-parser-CVAXURQP.js → tree-sitter-wasm-parser-WUKJ2I2Q.js} +2 -2
  265. package/dist/cli/chunks/{types-LNVJBDM2.js → types-47FTEPMV.js} +2 -2
  266. package/dist/cli/chunks/unified-memory-CJLMC2I4.js +2 -0
  267. package/dist/cli/chunks/unified-memory-hnsw-FDGR4D2J.js +2 -0
  268. package/dist/cli/chunks/unified-persistence-UFH5GLDN.js +2 -0
  269. package/dist/cli/chunks/{upgrade-4ND5RQFY.js → upgrade-QPLMJA5Z.js} +2 -2
  270. package/dist/cli/chunks/{validate-ZA4XT6K2.js → validate-3GVKZOVF.js} +2 -2
  271. package/dist/cli/chunks/{validate-swarm-FNK3GCJ4.js → validate-swarm-XCRTLVM6.js} +2 -2
  272. package/dist/cli/chunks/{vibium-E2CK2GBQ.js → vibium-CH4VPKVZ.js} +2 -2
  273. package/dist/cli/chunks/visual-security-4ARJ7J2Y.js +2 -0
  274. package/dist/cli/chunks/{web-tree-sitter-63VRNKZV.js → web-tree-sitter-JDBNAZTV.js} +2 -2
  275. package/dist/cli/chunks/{windsurf-installer-5BTCVOLH.js → windsurf-installer-3MNPVJBP.js} +2 -2
  276. package/dist/cli/chunks/witness-chain-73QC33ED.js +2 -0
  277. package/dist/cli/chunks/{witness-chain-6CUUGISD.js → witness-chain-HR5UBV5J.js} +2 -2
  278. package/dist/cli/chunks/witness-key-manager-G5SQTIBZ.js +2 -0
  279. package/dist/cli/chunks/{workflow-V7ED22XT.js → workflow-43EMD5FY.js} +4 -4
  280. package/dist/cli/chunks/workflow-orchestrator-RKMMPXNA.js +2 -0
  281. package/dist/cli/chunks/{wrappers-7S3NTTLW.js → wrappers-3N7AYNM3.js} +2 -2
  282. package/dist/cli/commands/audit.d.ts +12 -0
  283. package/dist/cli/commands/audit.js +64 -4
  284. package/dist/cli/commands/hooks-handlers/hooks-dream-learning.js +45 -19
  285. package/dist/cli/commands/hooks-handlers/hooks-shared.d.ts +13 -0
  286. package/dist/cli/commands/hooks-handlers/hooks-shared.js +38 -0
  287. package/dist/cli/commands/hooks-handlers/task-hooks.js +19 -1
  288. package/dist/cli/handlers/status-handler.d.ts +18 -0
  289. package/dist/cli/handlers/status-handler.js +47 -0
  290. package/dist/coordination/consensus/providers/ollama-provider.js +3 -2
  291. package/dist/coordination/mincut/queen-integration.js +24 -7
  292. package/dist/coordination/protocol-executor.js +2 -1
  293. package/dist/coordination/queen-lifecycle.js +4 -1
  294. package/dist/domains/code-intelligence/coordinator.js +10 -6
  295. package/dist/domains/code-intelligence/services/product-factors-bridge.js +3 -1
  296. package/dist/domains/defect-intelligence/services/defect-predictor.d.ts +6 -0
  297. package/dist/domains/defect-intelligence/services/defect-predictor.js +21 -0
  298. package/dist/domains/learning-optimization/interfaces.d.ts +7 -0
  299. package/dist/domains/learning-optimization/plugin.js +5 -0
  300. package/dist/domains/learning-optimization/services/learning-coordinator.d.ts +10 -0
  301. package/dist/domains/learning-optimization/services/learning-coordinator.js +57 -0
  302. package/dist/domains/test-execution/plugin.js +2 -2
  303. package/dist/domains/test-execution/services/flaky-detector.js +1 -1
  304. package/dist/domains/test-generation/coordinator.js +22 -8
  305. package/dist/domains/test-generation/interfaces.d.ts +3 -0
  306. package/dist/domains/test-generation/services/test-generator.js +9 -1
  307. package/dist/integrations/ruvector/delta-tracker.js +10 -1
  308. package/dist/integrations/ruvector/proof-gate.d.ts +68 -0
  309. package/dist/integrations/ruvector/proof-gate.js +135 -0
  310. package/dist/integrations/ruvector/sona-persistence.d.ts +24 -0
  311. package/dist/integrations/ruvector/sona-persistence.js +76 -0
  312. package/dist/integrations/ruvector/sona-three-loop.d.ts +15 -0
  313. package/dist/integrations/ruvector/sona-three-loop.js +17 -0
  314. package/dist/kernel/unified-memory-schemas.d.ts +2 -2
  315. package/dist/kernel/unified-memory-schemas.js +48 -2
  316. package/dist/kernel/unified-memory.d.ts +57 -0
  317. package/dist/kernel/unified-memory.js +148 -0
  318. package/dist/learning/aqe-learning-engine.js +3 -1
  319. package/dist/learning/dream/concept-graph.d.ts +31 -1
  320. package/dist/learning/dream/concept-graph.js +109 -3
  321. package/dist/learning/dream/dream-engine.d.ts +13 -1
  322. package/dist/learning/dream/dream-engine.js +146 -10
  323. package/dist/learning/dream/index.d.ts +1 -1
  324. package/dist/learning/dream/types.d.ts +23 -0
  325. package/dist/learning/local-judge-client.js +2 -1
  326. package/dist/learning/pattern-store.d.ts +2 -2
  327. package/dist/learning/pattern-store.js +14 -3
  328. package/dist/learning/qe-reasoning-bank.js +34 -31
  329. package/dist/learning/routing-topology-gate.d.ts +12 -2
  330. package/dist/learning/routing-topology-gate.js +15 -3
  331. package/dist/learning/rvf-pattern-store.d.ts +1 -1
  332. package/dist/learning/rvf-pattern-store.js +21 -8
  333. package/dist/learning/sqlite-persistence.js +12 -9
  334. package/dist/mcp/bundle.js +524 -445
  335. package/dist/mcp/qe-tool-bridge.js +7 -2
  336. package/dist/mcp/tools/base.d.ts +29 -0
  337. package/dist/mcp/tools/base.js +25 -0
  338. package/dist/mcp/tools/coverage-analysis/index.js +6 -4
  339. package/dist/mcp/tools/learning-optimization/dream.d.ts +4 -13
  340. package/dist/mcp/tools/learning-optimization/dream.js +10 -96
  341. package/dist/mcp/tools/planning/goap-execute.d.ts +13 -1
  342. package/dist/mcp/tools/planning/goap-execute.js +33 -18
  343. package/dist/mcp/tools/registry.js +7 -2
  344. package/dist/persistence/rvf-migration-coordinator.js +2 -1
  345. package/dist/planning/actions/qe-action-library.js +124 -1
  346. package/dist/planning/goap-planner.d.ts +14 -2
  347. package/dist/planning/goap-planner.js +51 -9
  348. package/dist/planning/index.d.ts +1 -1
  349. package/dist/planning/plan-executor.d.ts +84 -4
  350. package/dist/planning/plan-executor.js +221 -56
  351. package/dist/planning/types.d.ts +27 -0
  352. package/dist/routing/free-tier/coordinator-support.d.ts +6 -3
  353. package/dist/routing/free-tier/coordinator-support.js +6 -3
  354. package/dist/routing/free-tier/executor.d.ts +14 -0
  355. package/dist/routing/free-tier/executor.js +21 -0
  356. package/dist/routing/free-tier/index.d.ts +1 -0
  357. package/dist/routing/free-tier/index.js +1 -0
  358. package/dist/routing/free-tier/pattern-cache.d.ts +57 -0
  359. package/dist/routing/free-tier/pattern-cache.js +148 -0
  360. package/dist/routing/free-tier/provider.js +9 -1
  361. package/dist/routing/value-score.js +3 -0
  362. package/dist/shared/embeddings/ollama-client.js +2 -1
  363. package/dist/shared/events/domain-events.d.ts +2 -0
  364. package/dist/shared/llm/model-mapping.js +26 -0
  365. package/dist/shared/llm/model-registry.d.ts +10 -0
  366. package/dist/shared/llm/model-registry.js +92 -0
  367. package/dist/shared/llm/ollama-url.d.ts +17 -0
  368. package/dist/shared/llm/ollama-url.js +25 -0
  369. package/dist/shared/llm/providers/ollama-timeout.d.ts +26 -0
  370. package/dist/shared/llm/providers/ollama-timeout.js +31 -0
  371. package/dist/shared/llm/providers/ollama.d.ts +10 -0
  372. package/dist/shared/llm/providers/ollama.js +31 -4
  373. package/dist/shared/llm/router/hybrid-router.js +18 -1
  374. package/dist/workers/workers/learning-consolidation.js +21 -1
  375. package/package.json +5 -1
  376. package/dist/cli/chunks/adapter-IU3H3MD7.js +0 -2
  377. package/dist/cli/chunks/aqe-learning-engine-BGOC63IN.js +0 -2
  378. package/dist/cli/chunks/audit-TTWAAV7P.js +0 -3
  379. package/dist/cli/chunks/base-DVPRE3WO.js +0 -2
  380. package/dist/cli/chunks/brain-handler-FXPLJCPV.js +0 -89
  381. package/dist/cli/chunks/browser-workflow-MP5P7KZF.js +0 -2
  382. package/dist/cli/chunks/chunk-2SZQDTI5.js +0 -2
  383. package/dist/cli/chunks/chunk-6IHB3T6M.js +0 -2
  384. package/dist/cli/chunks/chunk-7PDUD7FF.js +0 -2
  385. package/dist/cli/chunks/chunk-EBCUWMLX.js +0 -27
  386. package/dist/cli/chunks/chunk-NWUVXLBB.js +0 -65
  387. package/dist/cli/chunks/chunk-OCACCUFO.js +0 -2
  388. package/dist/cli/chunks/chunk-PY2Q6MN3.js +0 -24
  389. package/dist/cli/chunks/chunk-UNH2DE2G.js +0 -2
  390. package/dist/cli/chunks/client-ADCDBTEE.js +0 -2
  391. package/dist/cli/chunks/core-handlers-HCACMLUW.js +0 -2
  392. package/dist/cli/chunks/cross-domain-router-HXFQAU4M.js +0 -2
  393. package/dist/cli/chunks/daemon-ZSK6CLQR.js +0 -10
  394. package/dist/cli/chunks/domain-transfer-UWFKBZTJ.js +0 -2
  395. package/dist/cli/chunks/dream-SVWQH62A.js +0 -2
  396. package/dist/cli/chunks/heartbeat-scheduler-QW5TW5QS.js +0 -2
  397. package/dist/cli/chunks/hnsw-adapter-D6EJWYAL.js +0 -2
  398. package/dist/cli/chunks/hnsw-index-4MWR4U5W.js +0 -2
  399. package/dist/cli/chunks/hybrid-router-BYVUBHER.js +0 -2
  400. package/dist/cli/chunks/impact-analyzer-OK2UIMSG.js +0 -2
  401. package/dist/cli/chunks/init-wizard-6NNPNS6J.js +0 -2
  402. package/dist/cli/chunks/kernel-F4A4GRNO.js +0 -2
  403. package/dist/cli/chunks/knowledge-graph-MSJDEZCF.js +0 -2
  404. package/dist/cli/chunks/llm-router-service-27IQAO7G.js +0 -2
  405. package/dist/cli/chunks/load-test-TT5VLAN7.js +0 -2
  406. package/dist/cli/chunks/memory-backend-FVSK53IM.js +0 -2
  407. package/dist/cli/chunks/memory-handlers-OPUDOZNT.js +0 -2
  408. package/dist/cli/chunks/pattern-null-store-7MVEDWCY.js +0 -2
  409. package/dist/cli/chunks/protocol-executor-BLDDYEJ4.js +0 -2
  410. package/dist/cli/chunks/provider-manager-ZYCFRYZQ.js +0 -2
  411. package/dist/cli/chunks/qe-reasoning-bank-P66CCPHM.js +0 -2
  412. package/dist/cli/chunks/queen-coordinator-LPHT3SX5.js +0 -2
  413. package/dist/cli/chunks/router-XQ2TERUT.js +0 -2
  414. package/dist/cli/chunks/routing-feedback-K52O752B.js +0 -2
  415. package/dist/cli/chunks/rvf-native-adapter-G4DV7FK3.js +0 -2
  416. package/dist/cli/chunks/safe-db-TMSEITES.js +0 -2
  417. package/dist/cli/chunks/schedule-RWFLA43O.js +0 -2
  418. package/dist/cli/chunks/scheduler-2V55MJJR.js +0 -2
  419. package/dist/cli/chunks/sqlite-persistence-L7QM6IWF.js +0 -2
  420. package/dist/cli/chunks/status-handler-SBT3MZTX.js +0 -45
  421. package/dist/cli/chunks/unified-memory-ZSULA46X.js +0 -2
  422. package/dist/cli/chunks/unified-memory-hnsw-SQEWFUBN.js +0 -2
  423. package/dist/cli/chunks/unified-persistence-EDCTT6SE.js +0 -2
  424. package/dist/cli/chunks/visual-security-SOGAETFP.js +0 -2
  425. package/dist/cli/chunks/witness-chain-AJCECBH5.js +0 -2
  426. package/dist/cli/chunks/workflow-orchestrator-UXRUCOZR.js +0 -2
@@ -34,8 +34,11 @@ export class FreeTierEscalatingExecutor {
34
34
  onOutcome;
35
35
  /** Resolved cross-model generator pool (A12); undefined ⇒ single-model best-of-k. */
36
36
  candidateProviders;
37
+ /** #6: optional pattern cache; undefined ⇒ caching disabled. */
38
+ patternCache;
37
39
  constructor(opts) {
38
40
  this.ladder = opts.ladder;
41
+ this.patternCache = opts.patternCache;
39
42
  this.claudeRunner = opts.claudeRunner;
40
43
  this.env = opts.env ?? process.env;
41
44
  this.onOutcome = opts.onOutcome;
@@ -124,6 +127,20 @@ export class FreeTierEscalatingExecutor {
124
127
  let passedAtStart = false;
125
128
  const t0 = Date.now();
126
129
  let result = { ok: false, content: '', tierUsed: startTier, escalated: false, repaired: false, bestOf: false, goodhartGuarded: false, attempts };
130
+ // #6: pattern-cache skip. A hit is only a CANDIDATE — re-verify with the same
131
+ // objective oracle before returning, so a stale/wrong hit falls through to
132
+ // real generation. Cache hits are NOT fed to the tracker/onOutcome (they are
133
+ // not a tier-capability signal).
134
+ if (this.patternCache && req.cacheText) {
135
+ const cached = await this.patternCache.lookup(req.cacheText);
136
+ if (cached !== undefined) {
137
+ const verdict = normalizeVerdict(await Promise.resolve(req.verify(cached)));
138
+ attempts.push({ tier: 'cache', provider: 'free-tier', repairRound: 0, ok: true, passed: verdict.passed, latencyMs: 0, feedback: verdict.feedback });
139
+ if (verdict.passed) {
140
+ return { ok: true, content: cached, tierUsed: 'cache', escalated: false, repaired: false, bestOf: false, goodhartGuarded: !objectiveOracle, attempts };
141
+ }
142
+ }
143
+ }
127
144
  outer: for (let idx = startIdx; idx <= topIdx; idx++) {
128
145
  const tier = order[idx];
129
146
  const resolved = resolveTier(this.ladder, tier, this.env);
@@ -151,6 +168,10 @@ export class FreeTierEscalatingExecutor {
151
168
  passedAtStart = true;
152
169
  if (verdict.passed) {
153
170
  result = { ok: true, content: run.content, tierUsed: tier, escalated: idx > startIdx, repaired: round > 0, bestOf: round === 0 && k > 0, goodhartGuarded: false, attempts };
171
+ // #6: cache the VERIFIED output so an identical/near-identical code
172
+ // under test can skip generation next time.
173
+ if (this.patternCache && req.cacheText)
174
+ await this.patternCache.put(req.cacheText, run.content);
154
175
  break outer;
155
176
  }
156
177
  result = { ok: false, content: run.content || result.content, tierUsed: tier, escalated: idx > startIdx, repaired: round > 0, bestOf: false, goodhartGuarded: false, attempts };
@@ -10,6 +10,7 @@ export type { FreeTierKind, FreeTierProviderConfig, ResolvedFreeTierProvider, Ti
10
10
  export { FREE_TIER_PRESETS, resolveFreeTierProvider, freeTierChat, freeTierHealth, type ChatMessage, type FreeTierChatResult, } from './provider.js';
11
11
  export { defaultFreeTierLadder, validateLadder, createFreeTierEscalation, resolveTier, type ResolvedTier, } from './ladder.js';
12
12
  export { FreeTierEscalatingExecutor, type ClaudeTierRunner, type QeVerifier, type QeVerdict, type QeTaskRequest, type QeExecutionResult, type TierAttempt, type FreeTierExecutorOptions, } from './executor.js';
13
+ export { TestGenPatternCache, normalizeCode, cosineSimilarity, type CodeEmbedder, type PatternCacheOptions, } from './pattern-cache.js';
13
14
  export { createRoutingFeedbackSink, type RoutingFeedbackLike, type FreeTierOutcomeEvent, type RoutingFeedbackSinkOptions, } from './feedback-sink.js';
14
15
  export { buildFreeTierExecutor, runFreeTierTextTask, DEFAULT_FREE_TIER_MODEL, type FreeTierCoordinatorConfig, type FreeTierLlmRouter, type BuildFreeTierExecutorOptions, } from './coordinator-support.js';
15
16
  //# sourceMappingURL=index.d.ts.map
@@ -1,6 +1,7 @@
1
1
  export { FREE_TIER_PRESETS, resolveFreeTierProvider, freeTierChat, freeTierHealth, } from './provider.js';
2
2
  export { defaultFreeTierLadder, validateLadder, createFreeTierEscalation, resolveTier, } from './ladder.js';
3
3
  export { FreeTierEscalatingExecutor, } from './executor.js';
4
+ export { TestGenPatternCache, normalizeCode, cosineSimilarity, } from './pattern-cache.js';
4
5
  export { createRoutingFeedbackSink, } from './feedback-sink.js';
5
6
  export { buildFreeTierExecutor, runFreeTierTextTask, DEFAULT_FREE_TIER_MODEL, } from './coordinator-support.js';
6
7
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * ruvLLM-style test-gen pattern cache (#6).
3
+ *
4
+ * The local test-gen model is the slow part of the free tier (a thinking MoE
5
+ * spends ~100s/gen). This cache lets the executor SKIP generation when it has
6
+ * already produced a durable test for the same — or near-identical — code under
7
+ * test. Two tiers:
8
+ * 1. exact: normalized-source key match (whitespace/comments stripped).
9
+ * 2. similarity: cosine over an injected code embedding, ≥ threshold.
10
+ *
11
+ * SAFETY: a cache hit is only a CANDIDATE. The executor re-runs the same
12
+ * objective oracle on it before use, so a stale or wrong-but-similar hit simply
13
+ * fails verification and falls through to real generation — the cache can never
14
+ * bypass the oracle. Only outputs that PASSED verification are stored.
15
+ *
16
+ * Persistence: in-memory + per-process by design — it opens no database, so it
17
+ * does not touch the unified memory.db (ADR). A durable variant would go through
18
+ * the unified memory layer; out of scope here.
19
+ */
20
+ /** Minimal embedder contract (subset of IEmbeddingProvider), injected & optional. */
21
+ export interface CodeEmbedder {
22
+ embed(text: string): Promise<number[]>;
23
+ }
24
+ export interface PatternCacheOptions {
25
+ /** Optional embedder; without it only the exact-match tier is active. */
26
+ embedder?: CodeEmbedder;
27
+ /** Cosine threshold for a similarity hit (default 0.97 — deliberately strict). */
28
+ similarityThreshold?: number;
29
+ /** Max entries retained (LRU by insertion/last-hit); default 200. */
30
+ maxEntries?: number;
31
+ }
32
+ /** Strip line/block comments and collapse whitespace → stable exact-match key. */
33
+ export declare function normalizeCode(code: string): string;
34
+ /** Cosine similarity of two equal-length vectors; 0 for empty/mismatched/zero. */
35
+ export declare function cosineSimilarity(a: number[], b: number[]): number;
36
+ export declare class TestGenPatternCache {
37
+ private readonly embedder?;
38
+ private readonly threshold;
39
+ private readonly maxEntries;
40
+ /** key = normalized code; Map preserves insertion order for cheap LRU eviction. */
41
+ private readonly store;
42
+ private hits;
43
+ private misses;
44
+ constructor(opts?: PatternCacheOptions);
45
+ get stats(): {
46
+ size: number;
47
+ hits: number;
48
+ misses: number;
49
+ };
50
+ /** Return a cached test for `code` (exact, then similarity), or undefined. */
51
+ lookup(code: string): Promise<string | undefined>;
52
+ /** Cache a VERIFIED test for `code`. Computes an embedding when an embedder is set. */
53
+ put(code: string, test: string): Promise<void>;
54
+ private touch;
55
+ private evictIfNeeded;
56
+ }
57
+ //# sourceMappingURL=pattern-cache.d.ts.map
@@ -0,0 +1,148 @@
1
+ /**
2
+ * ruvLLM-style test-gen pattern cache (#6).
3
+ *
4
+ * The local test-gen model is the slow part of the free tier (a thinking MoE
5
+ * spends ~100s/gen). This cache lets the executor SKIP generation when it has
6
+ * already produced a durable test for the same — or near-identical — code under
7
+ * test. Two tiers:
8
+ * 1. exact: normalized-source key match (whitespace/comments stripped).
9
+ * 2. similarity: cosine over an injected code embedding, ≥ threshold.
10
+ *
11
+ * SAFETY: a cache hit is only a CANDIDATE. The executor re-runs the same
12
+ * objective oracle on it before use, so a stale or wrong-but-similar hit simply
13
+ * fails verification and falls through to real generation — the cache can never
14
+ * bypass the oracle. Only outputs that PASSED verification are stored.
15
+ *
16
+ * Persistence: in-memory + per-process by design — it opens no database, so it
17
+ * does not touch the unified memory.db (ADR). A durable variant would go through
18
+ * the unified memory layer; out of scope here.
19
+ */
20
+ /** Strip line/block comments and collapse whitespace → stable exact-match key. */
21
+ export function normalizeCode(code) {
22
+ return stripBlockComments(code)
23
+ .replace(/\/\/[^\n]*/g, ' ') // line comments (linear, single quantifier)
24
+ .replace(/\s+/g, ' ')
25
+ .trim();
26
+ }
27
+ /**
28
+ * Remove `/* ... *\/` block comments in a single linear pass. A regex here
29
+ * (`/\/\*[\s\S]*?\*\//g`) backtracks polynomially on unterminated `/*` input —
30
+ * a ReDoS CodeQL flags — so we scan with native `indexOf` instead. An
31
+ * unterminated block comment is left in place, matching the old regex behavior.
32
+ */
33
+ function stripBlockComments(code) {
34
+ let out = '';
35
+ let i = 0;
36
+ const n = code.length;
37
+ while (i < n) {
38
+ if (code.charCodeAt(i) === 47 /* / */ && code.charCodeAt(i + 1) === 42 /* * */) {
39
+ const end = code.indexOf('*/', i + 2);
40
+ if (end === -1) {
41
+ out += code.slice(i);
42
+ break;
43
+ } // unterminated → leave as-is
44
+ out += ' ';
45
+ i = end + 2;
46
+ }
47
+ else {
48
+ out += code[i];
49
+ i += 1;
50
+ }
51
+ }
52
+ return out;
53
+ }
54
+ /** Cosine similarity of two equal-length vectors; 0 for empty/mismatched/zero. */
55
+ export function cosineSimilarity(a, b) {
56
+ if (a.length === 0 || a.length !== b.length)
57
+ return 0;
58
+ let dot = 0, na = 0, nb = 0;
59
+ for (let i = 0; i < a.length; i++) {
60
+ dot += a[i] * b[i];
61
+ na += a[i] * a[i];
62
+ nb += b[i] * b[i];
63
+ }
64
+ if (na === 0 || nb === 0)
65
+ return 0;
66
+ return dot / (Math.sqrt(na) * Math.sqrt(nb));
67
+ }
68
+ export class TestGenPatternCache {
69
+ embedder;
70
+ threshold;
71
+ maxEntries;
72
+ /** key = normalized code; Map preserves insertion order for cheap LRU eviction. */
73
+ store = new Map();
74
+ hits = 0;
75
+ misses = 0;
76
+ constructor(opts = {}) {
77
+ this.embedder = opts.embedder;
78
+ this.threshold = opts.similarityThreshold ?? 0.97;
79
+ this.maxEntries = Math.max(1, opts.maxEntries ?? 200);
80
+ }
81
+ get stats() {
82
+ return { size: this.store.size, hits: this.hits, misses: this.misses };
83
+ }
84
+ /** Return a cached test for `code` (exact, then similarity), or undefined. */
85
+ async lookup(code) {
86
+ const key = normalizeCode(code);
87
+ const exact = this.store.get(key);
88
+ if (exact) {
89
+ this.touch(key, exact);
90
+ this.hits++;
91
+ return exact.test;
92
+ }
93
+ if (this.embedder) {
94
+ let query;
95
+ try {
96
+ query = await this.embedder.embed(key);
97
+ }
98
+ catch {
99
+ this.misses++;
100
+ return undefined; // embedder unavailable → no similarity tier this call
101
+ }
102
+ let best;
103
+ for (const [k, entry] of this.store) {
104
+ if (!entry.embedding)
105
+ continue;
106
+ const sim = cosineSimilarity(query, entry.embedding);
107
+ if (sim >= this.threshold && (!best || sim > best.sim))
108
+ best = { key: k, entry, sim };
109
+ }
110
+ if (best) {
111
+ this.touch(best.key, best.entry);
112
+ this.hits++;
113
+ return best.entry.test;
114
+ }
115
+ }
116
+ this.misses++;
117
+ return undefined;
118
+ }
119
+ /** Cache a VERIFIED test for `code`. Computes an embedding when an embedder is set. */
120
+ async put(code, test) {
121
+ const key = normalizeCode(code);
122
+ let embedding;
123
+ if (this.embedder) {
124
+ try {
125
+ embedding = await this.embedder.embed(key);
126
+ }
127
+ catch {
128
+ embedding = undefined; // still cache for the exact-match tier
129
+ }
130
+ }
131
+ this.store.delete(key); // re-insert so it becomes most-recent
132
+ this.store.set(key, { test, embedding });
133
+ this.evictIfNeeded();
134
+ }
135
+ touch(key, entry) {
136
+ this.store.delete(key);
137
+ this.store.set(key, entry);
138
+ }
139
+ evictIfNeeded() {
140
+ while (this.store.size > this.maxEntries) {
141
+ const oldest = this.store.keys().next().value;
142
+ if (oldest === undefined)
143
+ break;
144
+ this.store.delete(oldest);
145
+ }
146
+ }
147
+ }
148
+ //# sourceMappingURL=pattern-cache.js.map
@@ -6,6 +6,7 @@
6
6
  * universal `/v1/chat/completions` shape (verified live against the M5 host
7
7
  * Ollama on 2026-06-19) and is reasoning-model aware.
8
8
  */
9
+ import { resolveOllamaBaseUrl } from '../../shared/llm/ollama-url.js';
9
10
  /**
10
11
  * Endpoint presets. `local-ollama` defaults to the Docker-Desktop host gateway
11
12
  * (the M5 host) — override baseUrl to 'http://localhost:11434/v1' for a same-box
@@ -28,7 +29,14 @@ export function resolveFreeTierProvider(cfg, env = process.env) {
28
29
  const preset = FREE_TIER_PRESETS[cfg.kind];
29
30
  if (!preset)
30
31
  throw new Error(`free-tier: unknown provider kind "${cfg.kind}"`);
31
- const baseUrl = (cfg.baseUrl ?? preset.baseUrl).replace(/\/$/, '');
32
+ // For the local Ollama preset, honour AQE_OLLAMA_URL / OLLAMA_URL (keeping the
33
+ // host.docker.internal default + the /v1 OpenAI-compat suffix) so the free
34
+ // tier follows the same single knob as every other local client. An explicit
35
+ // cfg.baseUrl still wins.
36
+ const presetBaseUrl = cfg.kind === 'local-ollama' && !cfg.baseUrl
37
+ ? `${resolveOllamaBaseUrl('http://host.docker.internal:11434', env)}/v1`
38
+ : preset.baseUrl;
39
+ const baseUrl = (cfg.baseUrl ?? presetBaseUrl).replace(/\/$/, '');
32
40
  if (!baseUrl) {
33
41
  throw new Error(`free-tier: kind "${cfg.kind}" requires an explicit baseUrl`);
34
42
  }
@@ -48,6 +48,9 @@ export function paretoFrontier(models) {
48
48
  export const MEASURED_QE_TEST_GEN = [
49
49
  { model: 'qwen3:8b', quality: 0.0, costPerInstance: 0 }, // D3: below the generation floor (0/3 valid)
50
50
  { model: 'qwen3:30b-a3b', quality: 0.62, costPerInstance: 0 }, // D3: clears the floor (best-of-k ~0.673 on judged)
51
+ { model: 'qwen3-coder:30b', quality: 0.62, costPerInstance: 0 }, // 2026-06-29 oracle bench: ties 30b-a3b (both 6/8, 75% mut) but ~14× faster wall-clock; default local test-gen model
52
+ { model: 'qwen2.5-coder:7b', quality: 0.50, costPerInstance: 0 }, // 2026-06-29: stock 7B coder = 4/8 (50%) — beats general qwen3:8b (38%), 16× faster; ~25pp below 30B (PEFT-tune target)
53
+ { model: 'qwen2.5-coder:1.5b', quality: 0.08, costPerInstance: 0 }, // 2026-06-29: stock 1.5B coder = 1/8 (8%); below floor, size dominates coder-tuning at tiny scale
51
54
  { model: 'z-ai/glm-5.2', quality: 0.71, costPerInstance: 0.0065 }, // A12: diverse, higher per-model best
52
55
  { model: 'claude-sonnet-4-6', quality: 0.83, costPerInstance: 0.045 }, // D3: frontier ceiling
53
56
  ];
@@ -4,6 +4,7 @@
4
4
  */
5
5
  import { toError } from '../error-utils.js';
6
6
  import { EMBEDDING_CONFIG, } from './types';
7
+ import { resolveOllamaBaseUrl } from '../llm/ollama-url.js';
7
8
  /**
8
9
  * Client for Ollama API
9
10
  */
@@ -12,7 +13,7 @@ export class OllamaClient {
12
13
  maxRetries;
13
14
  retryDelayMs;
14
15
  timeoutMs;
15
- constructor(baseUrl = EMBEDDING_CONFIG.DEFAULT_OLLAMA_URL, maxRetries = EMBEDDING_CONFIG.MAX_RETRIES, retryDelayMs = EMBEDDING_CONFIG.RETRY_DELAY_MS, timeoutMs = EMBEDDING_CONFIG.TIMEOUT_MS) {
16
+ constructor(baseUrl = resolveOllamaBaseUrl(EMBEDDING_CONFIG.DEFAULT_OLLAMA_URL), maxRetries = EMBEDDING_CONFIG.MAX_RETRIES, retryDelayMs = EMBEDDING_CONFIG.RETRY_DELAY_MS, timeoutMs = EMBEDDING_CONFIG.TIMEOUT_MS) {
16
17
  this.baseUrl = baseUrl.replace(/\/$/, ''); // Remove trailing slash
17
18
  this.maxRetries = maxRetries;
18
19
  this.retryDelayMs = retryDelayMs;
@@ -10,6 +10,8 @@ export interface TestGeneratedPayload {
10
10
  framework: string;
11
11
  sourceFile: string;
12
12
  testType: 'unit' | 'integration' | 'e2e' | 'property';
13
+ /** ReasoningBank pattern IDs applied across the generation request (ADR-110). */
14
+ patternsUsed?: string[];
13
15
  }
14
16
  export interface TestSuiteCreatedPayload {
15
17
  suiteId: string;
@@ -282,6 +282,32 @@ export const MODEL_MAPPINGS = {
282
282
  openrouter: 'qwen/qwen-2-7b-instruct',
283
283
  },
284
284
  },
285
+ // Qwen3 local models (Ollama). Canonical id == Ollama tag so normalizeModelId
286
+ // resolves the tags AQE's local clients actually use.
287
+ 'qwen3:8b': {
288
+ canonical: 'Qwen3 8B',
289
+ family: 'qwen',
290
+ tier: 'economy',
291
+ providers: {
292
+ ollama: 'qwen3:8b',
293
+ },
294
+ },
295
+ 'qwen3:30b-a3b': {
296
+ canonical: 'Qwen3 30B-A3B',
297
+ family: 'qwen',
298
+ tier: 'economy',
299
+ providers: {
300
+ ollama: 'qwen3:30b-a3b',
301
+ },
302
+ },
303
+ 'qwen3-coder:30b': {
304
+ canonical: 'Qwen3 Coder 30B-A3B',
305
+ family: 'qwen',
306
+ tier: 'economy',
307
+ providers: {
308
+ ollama: 'qwen3-coder:30b',
309
+ },
310
+ },
285
311
  };
286
312
  // ============================================================================
287
313
  // Reverse Lookup Table (Provider-specific ID -> Canonical ID)
@@ -128,6 +128,16 @@ export declare const MODEL_REGISTRY: Record<string, Omit<ModelInfo, 'id' | 'prov
128
128
  * ```
129
129
  */
130
130
  export declare function getModelCapabilities(modelId: string): ModelCapabilities;
131
+ /**
132
+ * Whether a model is KNOWN to support tool / function calling.
133
+ *
134
+ * Fail-open: an unknown model id (not in the registry) returns `true` so a
135
+ * capability guard never strands a request on an unrecognized id — the guard
136
+ * only acts on models the registry explicitly marks tool-less.
137
+ *
138
+ * @param modelId - Any model ID (canonical or provider-specific)
139
+ */
140
+ export declare function modelSupportsTools(modelId: string): boolean;
131
141
  /**
132
142
  * Get cost information for a model
133
143
  *
@@ -686,6 +686,81 @@ export const MODEL_REGISTRY = {
686
686
  outputCostPerMillion: 0,
687
687
  },
688
688
  },
689
+ 'qwen3:8b': {
690
+ name: 'Qwen3 8B',
691
+ family: 'qwen',
692
+ tier: 'economy',
693
+ description: 'Alibaba Qwen3 8B — tools + thinking; below the QE test-gen floor (use for judge/triage)',
694
+ releaseDate: '2025-04-29',
695
+ recommended: false,
696
+ capabilities: {
697
+ contextLength: 40960,
698
+ maxOutputTokens: 8192,
699
+ supportsTools: true,
700
+ supportsStreaming: true,
701
+ supportsVision: false,
702
+ supportsJsonMode: true,
703
+ supportsSystemPrompt: true,
704
+ supportsExtendedThinking: true,
705
+ supportsMCP: false,
706
+ supportsEmbeddings: false,
707
+ supportsCodeExecution: false,
708
+ },
709
+ cost: {
710
+ inputCostPerMillion: 0,
711
+ outputCostPerMillion: 0,
712
+ },
713
+ },
714
+ 'qwen3:30b-a3b': {
715
+ name: 'Qwen3 30B-A3B',
716
+ family: 'qwen',
717
+ tier: 'economy',
718
+ description: 'Alibaba Qwen3 30B MoE (3B active) — fast general local model; clears the QE test-gen floor',
719
+ releaseDate: '2025-04-29',
720
+ recommended: true,
721
+ capabilities: {
722
+ contextLength: 262144,
723
+ maxOutputTokens: 8192,
724
+ supportsTools: true,
725
+ supportsStreaming: true,
726
+ supportsVision: false,
727
+ supportsJsonMode: true,
728
+ supportsSystemPrompt: true,
729
+ supportsExtendedThinking: true,
730
+ supportsMCP: false,
731
+ supportsEmbeddings: false,
732
+ supportsCodeExecution: false,
733
+ },
734
+ cost: {
735
+ inputCostPerMillion: 0,
736
+ outputCostPerMillion: 0,
737
+ },
738
+ },
739
+ 'qwen3-coder:30b': {
740
+ name: 'Qwen3 Coder 30B-A3B',
741
+ family: 'qwen',
742
+ tier: 'economy',
743
+ description: 'Alibaba Qwen3-Coder 30B MoE (3B active) — code-tuned, non-thinking; preferred local QE test-gen model',
744
+ releaseDate: '2025-07-31',
745
+ recommended: true,
746
+ capabilities: {
747
+ contextLength: 262144,
748
+ maxOutputTokens: 8192,
749
+ supportsTools: true,
750
+ supportsStreaming: true,
751
+ supportsVision: false,
752
+ supportsJsonMode: true,
753
+ supportsSystemPrompt: true,
754
+ supportsExtendedThinking: false,
755
+ supportsMCP: false,
756
+ supportsEmbeddings: false,
757
+ supportsCodeExecution: false,
758
+ },
759
+ cost: {
760
+ inputCostPerMillion: 0,
761
+ outputCostPerMillion: 0,
762
+ },
763
+ },
689
764
  };
690
765
  // ============================================================================
691
766
  // Core Functions
@@ -716,6 +791,23 @@ export function getModelCapabilities(modelId) {
716
791
  }
717
792
  return { ...entry.capabilities };
718
793
  }
794
+ /**
795
+ * Whether a model is KNOWN to support tool / function calling.
796
+ *
797
+ * Fail-open: an unknown model id (not in the registry) returns `true` so a
798
+ * capability guard never strands a request on an unrecognized id — the guard
799
+ * only acts on models the registry explicitly marks tool-less.
800
+ *
801
+ * @param modelId - Any model ID (canonical or provider-specific)
802
+ */
803
+ export function modelSupportsTools(modelId) {
804
+ try {
805
+ return getModelCapabilities(modelId).supportsTools;
806
+ }
807
+ catch {
808
+ return true;
809
+ }
810
+ }
719
811
  /**
720
812
  * Get cost information for a model
721
813
  *
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Single source of truth for resolving the local Ollama base URL.
3
+ *
4
+ * Precedence: AQE_OLLAMA_URL (project-namespaced) → OLLAMA_URL (generic) → the
5
+ * call-site's own default. Trailing slashes are stripped. This lets a user
6
+ * point every AQE local-model client (chat provider, consensus provider, local
7
+ * judge, embeddings, free-tier) at a non-localhost Ollama — a Docker host
8
+ * gateway (host.docker.internal), a remote GPU box — with ONE env var, while
9
+ * changing nothing when the vars are unset (each call-site keeps its own
10
+ * default via the `fallback` argument).
11
+ *
12
+ * The `env` parameter is injectable so resolution stays unit-testable without
13
+ * mutating process.env.
14
+ */
15
+ export declare const DEFAULT_OLLAMA_BASE_URL = "http://localhost:11434";
16
+ export declare function resolveOllamaBaseUrl(fallback?: string, env?: NodeJS.ProcessEnv): string;
17
+ //# sourceMappingURL=ollama-url.d.ts.map
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Single source of truth for resolving the local Ollama base URL.
3
+ *
4
+ * Precedence: AQE_OLLAMA_URL (project-namespaced) → OLLAMA_URL (generic) → the
5
+ * call-site's own default. Trailing slashes are stripped. This lets a user
6
+ * point every AQE local-model client (chat provider, consensus provider, local
7
+ * judge, embeddings, free-tier) at a non-localhost Ollama — a Docker host
8
+ * gateway (host.docker.internal), a remote GPU box — with ONE env var, while
9
+ * changing nothing when the vars are unset (each call-site keeps its own
10
+ * default via the `fallback` argument).
11
+ *
12
+ * The `env` parameter is injectable so resolution stays unit-testable without
13
+ * mutating process.env.
14
+ */
15
+ export const DEFAULT_OLLAMA_BASE_URL = 'http://localhost:11434';
16
+ export function resolveOllamaBaseUrl(fallback = DEFAULT_OLLAMA_BASE_URL, env = process.env) {
17
+ const raw = env['AQE_OLLAMA_URL'] ?? env['OLLAMA_URL'] ?? fallback;
18
+ // Strip trailing slashes via a linear char-scan — a `/\/+$/` regex backtracks
19
+ // polynomially on adversarial input (many '/'), a ReDoS flagged by CodeQL.
20
+ let end = raw.length;
21
+ while (end > 0 && raw.charCodeAt(end - 1) === 47 /* '/' */)
22
+ end -= 1;
23
+ return raw.slice(0, end);
24
+ }
25
+ //# sourceMappingURL=ollama-url.js.map
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Adaptive request-timeout sizing for local Ollama generations (#3).
3
+ *
4
+ * Local models vary ~6× in speed (a dense 27B ≈ 15 tok/s vs a 30B MoE ≈ 90
5
+ * tok/s on the same Mac) and thinking models can spend thousands of tokens
6
+ * before answering, so one fixed timeout either strands fast models or times
7
+ * out slow ones mid-generation. We size the timeout from the output cap
8
+ * (num_predict) and the model's observed throughput, with generous headroom.
9
+ *
10
+ * Pure + dependency-free so it is unit-testable in isolation.
11
+ */
12
+ export declare const OLLAMA_TIMEOUT: {
13
+ /** Conservative throughput assumed before a model has been observed (dense floor). */
14
+ readonly DEFAULT_TOK_PER_SEC: 15;
15
+ /** Multiplier over ideal generation time to absorb variance. */
16
+ readonly SAFETY_FACTOR: 2.5;
17
+ /** Fixed overhead for cold model load / prompt eval (~6–9s measured). */
18
+ readonly LOAD_OVERHEAD_MS: 15000;
19
+ /** Never time out faster than this. */
20
+ readonly FLOOR_MS: 30000;
21
+ /** Never wait longer than this. */
22
+ readonly CEIL_MS: 600000;
23
+ };
24
+ /** Size a timeout (ms) from the output token cap and observed tok/s. */
25
+ export declare function computeAdaptiveTimeoutMs(numPredict: number, tokPerSec?: number): number;
26
+ //# sourceMappingURL=ollama-timeout.d.ts.map
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Adaptive request-timeout sizing for local Ollama generations (#3).
3
+ *
4
+ * Local models vary ~6× in speed (a dense 27B ≈ 15 tok/s vs a 30B MoE ≈ 90
5
+ * tok/s on the same Mac) and thinking models can spend thousands of tokens
6
+ * before answering, so one fixed timeout either strands fast models or times
7
+ * out slow ones mid-generation. We size the timeout from the output cap
8
+ * (num_predict) and the model's observed throughput, with generous headroom.
9
+ *
10
+ * Pure + dependency-free so it is unit-testable in isolation.
11
+ */
12
+ export const OLLAMA_TIMEOUT = {
13
+ /** Conservative throughput assumed before a model has been observed (dense floor). */
14
+ DEFAULT_TOK_PER_SEC: 15,
15
+ /** Multiplier over ideal generation time to absorb variance. */
16
+ SAFETY_FACTOR: 2.5,
17
+ /** Fixed overhead for cold model load / prompt eval (~6–9s measured). */
18
+ LOAD_OVERHEAD_MS: 15_000,
19
+ /** Never time out faster than this. */
20
+ FLOOR_MS: 30_000,
21
+ /** Never wait longer than this. */
22
+ CEIL_MS: 600_000,
23
+ };
24
+ /** Size a timeout (ms) from the output token cap and observed tok/s. */
25
+ export function computeAdaptiveTimeoutMs(numPredict, tokPerSec = OLLAMA_TIMEOUT.DEFAULT_TOK_PER_SEC) {
26
+ const tps = tokPerSec > 0 ? tokPerSec : OLLAMA_TIMEOUT.DEFAULT_TOK_PER_SEC;
27
+ const genMs = (Math.max(0, numPredict) / tps) * 1000;
28
+ const computed = genMs * OLLAMA_TIMEOUT.SAFETY_FACTOR + OLLAMA_TIMEOUT.LOAD_OVERHEAD_MS;
29
+ return Math.min(OLLAMA_TIMEOUT.CEIL_MS, Math.max(OLLAMA_TIMEOUT.FLOOR_MS, Math.round(computed)));
30
+ }
31
+ //# sourceMappingURL=ollama-timeout.js.map
@@ -19,7 +19,17 @@ export declare class OllamaProvider implements LLMProvider {
19
19
  private config;
20
20
  private requestId;
21
21
  private availableModels;
22
+ /** EMA of observed generation throughput (tok/s) per model, for adaptive timeouts (#3). */
23
+ private observedTokPerSec;
22
24
  constructor(config?: Partial<OllamaConfig>);
25
+ /**
26
+ * Adaptive per-request timeout (#3). An explicitly customized config.timeoutMs
27
+ * (≠ the built-in default) is honored as the caller's intent; otherwise the
28
+ * timeout is sized from num_predict and the model's observed throughput.
29
+ */
30
+ private timeoutFor;
31
+ /** Fold a completed generation's throughput into the per-model EMA. */
32
+ private recordThroughput;
23
33
  /**
24
34
  * Check if Ollama is available and running
25
35
  */