agentic-qe 3.10.9 → 3.11.1

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 (474) hide show
  1. package/.claude/agents/v3/qe-learning-coordinator.md +1 -1
  2. package/.claude/commands/agents/README.md +50 -0
  3. package/.claude/commands/agents/agent-capabilities.md +140 -0
  4. package/.claude/commands/agents/agent-coordination.md +28 -0
  5. package/.claude/commands/agents/agent-spawning.md +28 -0
  6. package/.claude/commands/agents/agent-types.md +216 -0
  7. package/.claude/commands/agents/health.md +139 -0
  8. package/.claude/commands/agents/list.md +100 -0
  9. package/.claude/commands/agents/logs.md +130 -0
  10. package/.claude/commands/agents/metrics.md +122 -0
  11. package/.claude/commands/agents/pool.md +127 -0
  12. package/.claude/commands/agents/spawn.md +140 -0
  13. package/.claude/commands/agents/status.md +115 -0
  14. package/.claude/commands/agents/stop.md +102 -0
  15. package/.claude/commands/claude-flow-help.md +1 -1
  16. package/.claude/commands/coordination/README.md +9 -0
  17. package/.claude/commands/coordination/agent-spawn.md +25 -0
  18. package/.claude/commands/coordination/init.md +44 -0
  19. package/.claude/commands/coordination/orchestrate.md +43 -0
  20. package/.claude/commands/coordination/spawn.md +45 -0
  21. package/.claude/commands/coordination/swarm-init.md +85 -0
  22. package/.claude/commands/coordination/task-orchestrate.md +25 -0
  23. package/.claude/commands/github/code-review-swarm.md +1 -1
  24. package/.claude/commands/github/issue-tracker.md +3 -3
  25. package/.claude/commands/github/release-manager.md +5 -3
  26. package/.claude/commands/github/release-swarm.md +1 -1
  27. package/.claude/commands/github/repo-architect.md +2 -2
  28. package/.claude/commands/github/swarm-issue.md +4 -1
  29. package/.claude/commands/github/swarm-pr.md +6 -3
  30. package/.claude/commands/github/sync-coordinator.md +3 -1
  31. package/.claude/commands/github/workflow-automation.md +2 -2
  32. package/.claude/commands/hive-mind/README.md +17 -0
  33. package/.claude/commands/hive-mind/hive-mind-consensus.md +8 -0
  34. package/.claude/commands/hive-mind/hive-mind-init.md +18 -0
  35. package/.claude/commands/hive-mind/hive-mind-memory.md +8 -0
  36. package/.claude/commands/hive-mind/hive-mind-metrics.md +8 -0
  37. package/.claude/commands/hive-mind/hive-mind-resume.md +8 -0
  38. package/.claude/commands/hive-mind/hive-mind-sessions.md +8 -0
  39. package/.claude/commands/hive-mind/hive-mind-spawn.md +21 -0
  40. package/.claude/commands/hive-mind/hive-mind-status.md +8 -0
  41. package/.claude/commands/hive-mind/hive-mind-stop.md +8 -0
  42. package/.claude/commands/hive-mind/hive-mind-wizard.md +8 -0
  43. package/.claude/commands/hive-mind/hive-mind.md +27 -0
  44. package/.claude/commands/memory/README.md +9 -0
  45. package/.claude/commands/memory/memory-persist.md +25 -0
  46. package/.claude/commands/memory/memory-search.md +25 -0
  47. package/.claude/commands/memory/memory-usage.md +25 -0
  48. package/.claude/commands/memory/neural.md +47 -0
  49. package/.claude/commands/swarm/README.md +15 -0
  50. package/.claude/commands/swarm/analysis.md +95 -0
  51. package/.claude/commands/swarm/development.md +96 -0
  52. package/.claude/commands/swarm/examples.md +168 -0
  53. package/.claude/commands/swarm/maintenance.md +102 -0
  54. package/.claude/commands/swarm/optimization.md +117 -0
  55. package/.claude/commands/swarm/research.md +136 -0
  56. package/.claude/commands/swarm/swarm-analysis.md +8 -0
  57. package/.claude/commands/swarm/swarm-background.md +8 -0
  58. package/.claude/commands/swarm/swarm-init.md +19 -0
  59. package/.claude/commands/swarm/swarm-modes.md +8 -0
  60. package/.claude/commands/swarm/swarm-monitor.md +8 -0
  61. package/.claude/commands/swarm/swarm-spawn.md +19 -0
  62. package/.claude/commands/swarm/swarm-status.md +8 -0
  63. package/.claude/commands/swarm/swarm-strategies.md +8 -0
  64. package/.claude/commands/swarm/swarm.md +87 -0
  65. package/.claude/commands/swarm/testing.md +131 -0
  66. package/.claude/commands/workflows/README.md +9 -0
  67. package/.claude/commands/workflows/development.md +78 -0
  68. package/.claude/commands/workflows/research.md +63 -0
  69. package/.claude/commands/workflows/workflow-create.md +25 -0
  70. package/.claude/commands/workflows/workflow-execute.md +25 -0
  71. package/.claude/commands/workflows/workflow-export.md +25 -0
  72. package/.claude/helpers/auto-commit.sh +1 -1
  73. package/.claude/helpers/auto-memory-hook.mjs +37 -4
  74. package/.claude/helpers/github-safe.js +90 -40
  75. package/.claude/helpers/github-setup.sh +30 -13
  76. package/.claude/helpers/hook-handler.cjs +68 -49
  77. package/.claude/helpers/intelligence.cjs +156 -27
  78. package/.claude/helpers/post-commit +1 -1
  79. package/.claude/helpers/pre-commit +1 -1
  80. package/.claude/helpers/quick-start.sh +4 -4
  81. package/.claude/helpers/router.js +70 -31
  82. package/.claude/helpers/ruflo-hook.cjs +59 -0
  83. package/.claude/helpers/session.js +28 -6
  84. package/.claude/helpers/setup-mcp.sh +3 -3
  85. package/.claude/helpers/statusline.cjs +584 -468
  86. package/.claude/helpers/statusline.js +47 -11
  87. package/.claude/skills/README.md +2 -2
  88. package/.claude/skills/agentic-quality-engineering/SKILL.md +6 -5
  89. package/.claude/skills/agentic-quality-engineering/schemas/output.json +7 -3
  90. package/.claude/skills/github-code-review/SKILL.md +2 -17
  91. package/.claude/skills/github-multi-repo/SKILL.md +4 -16
  92. package/.claude/skills/github-project-management/SKILL.md +18 -33
  93. package/.claude/skills/github-release-management/SKILL.md +4 -21
  94. package/.claude/skills/github-workflow-automation/SKILL.md +8 -26
  95. package/.claude/skills/holistic-testing-pact/SKILL.md +50 -17
  96. package/.claude/skills/pair-programming/SKILL.md +2 -2
  97. package/.claude/skills/reasoningbank-intelligence/SKILL.md +2 -2
  98. package/.claude/skills/skill-builder/SKILL.md +0 -103
  99. package/.claude/skills/skills-manifest.json +6 -6
  100. package/.claude/skills/sparc-methodology/SKILL.md +2 -11
  101. package/.claude/skills/stream-chain/SKILL.md +0 -3
  102. package/.claude/skills/swarm-advanced/SKILL.md +2 -5
  103. package/.claude/skills/swarm-orchestration/SKILL.md +1 -1
  104. package/.claude/skills/verification-quality/SKILL.md +121 -93
  105. package/.opencode/skills/qe-agentic-quality-engineering.yaml +5 -5
  106. package/.opencode/skills/qe-holistic-testing-pact.yaml +11 -11
  107. package/CHANGELOG.md +100 -0
  108. package/README.md +17 -0
  109. package/assets/agents/v3/qe-learning-coordinator.md +1 -1
  110. package/assets/skills/README.md +2 -2
  111. package/assets/skills/agentic-quality-engineering/SKILL.md +6 -5
  112. package/assets/skills/agentic-quality-engineering/schemas/output.json +7 -3
  113. package/assets/skills/holistic-testing-pact/SKILL.md +50 -17
  114. package/assets/skills/pair-programming/SKILL.md +2 -2
  115. package/assets/skills/skills-manifest.json +6 -6
  116. package/assets/skills/verification-quality/SKILL.md +121 -93
  117. package/dist/audit/witness-chain.d.ts +1 -1
  118. package/dist/audit/witness-findings.d.ts +50 -0
  119. package/dist/audit/witness-findings.js +41 -0
  120. package/dist/cli/bundle.js +5 -5
  121. package/dist/cli/chunks/adapter-A6GCBONS.js +2 -0
  122. package/dist/cli/chunks/{agent-booster-wasm-RPAOJXZ3.js → agent-booster-wasm-3OJAT664.js} +2 -2
  123. package/dist/cli/chunks/{agent-handler-SMD5CAS6.js → agent-handler-6TCTI5AT.js} +2 -2
  124. package/dist/cli/chunks/{agent-memory-branch-3IOQIQ7Y.js → agent-memory-branch-FAWCYEGJ.js} +2 -2
  125. package/dist/cli/chunks/aqe-learning-engine-FRCSXNMG.js +2 -0
  126. package/dist/cli/chunks/{arena-AP2J62WO.js → arena-O2TCUQBF.js} +4 -4
  127. package/dist/cli/chunks/{arena-GT3D6EAO.js → arena-UVYIGYUF.js} +2 -2
  128. package/dist/cli/chunks/{audit-Q3GJ5354.js → audit-AYESKHAJ.js} +2 -2
  129. package/dist/cli/chunks/base-CZ3EHBU5.js +2 -0
  130. package/dist/cli/chunks/{hnswlib-node-YTK7S7GL.js → better-sqlite3-MJNUEPYB.js} +2 -2
  131. package/dist/cli/chunks/{brain-handler-2Z4ILQF3.js → brain-handler-KSJBVTHZ.js} +3 -3
  132. package/dist/cli/chunks/{branch-enumerator-EZWGL4UM.js → branch-enumerator-4O3S42EG.js} +2 -2
  133. package/dist/cli/chunks/{browser-YZELFPLJ.js → browser-5VXK323P.js} +2 -2
  134. package/dist/cli/chunks/browser-workflow-EKTGQQBQ.js +2 -0
  135. package/dist/cli/chunks/{chunk-CDJIYJIA.js → chunk-22FHOXEE.js} +1 -1
  136. package/dist/cli/chunks/{chunk-OIN3Y4BY.js → chunk-2RE32VOF.js} +1 -1
  137. package/dist/cli/chunks/{chunk-RSWQY4NZ.js → chunk-3D4HNUZM.js} +2 -2
  138. package/dist/cli/chunks/{chunk-6TR3OM7C.js → chunk-3DS7ZHA7.js} +2 -2
  139. package/dist/cli/chunks/{chunk-HGKZOSAI.js → chunk-3G25ZBQ6.js} +1 -1
  140. package/dist/cli/chunks/{chunk-QHPLU5BU.js → chunk-3IMEDZIS.js} +3 -3
  141. package/dist/cli/chunks/{chunk-EL6F72JN.js → chunk-3V5DAM37.js} +2 -2
  142. package/dist/cli/chunks/{chunk-IR7PJUO7.js → chunk-3XCEFSUK.js} +2 -2
  143. package/dist/cli/chunks/{chunk-L5NEEGKO.js → chunk-437XL5VZ.js} +2 -2
  144. package/dist/cli/chunks/{chunk-C6GQIUKW.js → chunk-44HXRFOP.js} +2 -2
  145. package/dist/cli/chunks/{chunk-KAMFT25W.js → chunk-4565IIF6.js} +2 -2
  146. package/dist/cli/chunks/{chunk-X7677BX3.js → chunk-4BMPFEEG.js} +2 -2
  147. package/dist/cli/chunks/{chunk-3YKJGKOY.js → chunk-4G4GTF36.js} +4 -4
  148. package/dist/cli/chunks/{chunk-352W5G4G.js → chunk-4OYC5TIZ.js} +2 -2
  149. package/dist/cli/chunks/{chunk-VHCHBMZC.js → chunk-4RUS5E3Q.js} +2 -2
  150. package/dist/cli/chunks/{chunk-QHICG2NI.js → chunk-4S3UIY3G.js} +2 -2
  151. package/dist/cli/chunks/{chunk-FD37QFXW.js → chunk-4UHWZ47M.js} +1 -1
  152. package/dist/cli/chunks/{chunk-UU7OCRZM.js → chunk-56PICCZN.js} +2 -2
  153. package/dist/cli/chunks/chunk-57WGS6BI.js +2 -0
  154. package/dist/cli/chunks/{chunk-RRSJ7BMF.js → chunk-5LDUW2FD.js} +1 -1
  155. package/dist/cli/chunks/{chunk-J6GKKXCP.js → chunk-5PSIKJL5.js} +2 -2
  156. package/dist/cli/chunks/{chunk-QE3CZGAC.js → chunk-5QFZEEJ2.js} +3 -3
  157. package/dist/cli/chunks/{chunk-RHOBDQXA.js → chunk-5Y7GXQOM.js} +2 -2
  158. package/dist/cli/chunks/{chunk-5X73HV2P.js → chunk-6CH7476R.js} +1 -1
  159. package/dist/cli/chunks/{chunk-BG2FN5K2.js → chunk-6WNYBIPS.js} +2 -2
  160. package/dist/cli/chunks/{chunk-G4KVGUQN.js → chunk-6YNXH6H4.js} +2 -2
  161. package/dist/cli/chunks/{chunk-2WRVNEIR.js → chunk-6ZAUNPAI.js} +2 -2
  162. package/dist/cli/chunks/{chunk-2I5QLMQF.js → chunk-72UPBNVF.js} +2 -2
  163. package/dist/cli/chunks/{chunk-VDL277DX.js → chunk-76UVJLPM.js} +2 -2
  164. package/dist/cli/chunks/{chunk-4EJTE5TL.js → chunk-7DQLYWLR.js} +1 -1
  165. package/dist/cli/chunks/{chunk-4D3LVXUD.js → chunk-7GP7ZG3K.js} +2 -2
  166. package/dist/cli/chunks/{chunk-757YHKIJ.js → chunk-7OAKIXNM.js} +2 -2
  167. package/dist/cli/chunks/{chunk-7S6D5K4X.js → chunk-7QICU44H.js} +2 -2
  168. package/dist/cli/chunks/{chunk-ABJPFKHE.js → chunk-7SRSOZMP.js} +1 -1
  169. package/dist/cli/chunks/{chunk-2WSEJHFQ.js → chunk-7WQKKYYG.js} +1 -1
  170. package/dist/cli/chunks/{chunk-7NT34MLU.js → chunk-AEZMNFXM.js} +1 -1
  171. package/dist/cli/chunks/{chunk-MDED3HJI.js → chunk-AG4BYKUV.js} +2 -2
  172. package/dist/cli/chunks/{chunk-QL7OOCPO.js → chunk-AL54LED5.js} +2 -2
  173. package/dist/cli/chunks/{chunk-I7RTTJH5.js → chunk-ATQTTGSE.js} +2 -2
  174. package/dist/cli/chunks/{chunk-HQZX4XYH.js → chunk-B5EE63VE.js} +2 -2
  175. package/dist/cli/chunks/{chunk-QWXJRZEH.js → chunk-B6U56VWG.js} +1 -1
  176. package/dist/cli/chunks/{chunk-5HLOQEKL.js → chunk-BOQNPFO5.js} +1 -1
  177. package/dist/cli/chunks/{chunk-I5C7O5IQ.js → chunk-BR4ERWVD.js} +2 -2
  178. package/dist/cli/chunks/{chunk-GPALZJD3.js → chunk-BVFNF3RW.js} +1 -1
  179. package/dist/cli/chunks/{chunk-NYBAH76S.js → chunk-BXLWERBR.js} +3 -3
  180. package/dist/cli/chunks/{chunk-YQBL5XTM.js → chunk-C27UV6DO.js} +1 -1
  181. package/dist/cli/chunks/{chunk-UUA2NVUN.js → chunk-C7FYDE5F.js} +244 -233
  182. package/dist/cli/chunks/{chunk-6HPI6YX3.js → chunk-CIDTFU3C.js} +2 -2
  183. package/dist/cli/chunks/{chunk-VIHFC67B.js → chunk-CII57TME.js} +1 -1
  184. package/dist/cli/chunks/{chunk-57XCLC55.js → chunk-CN2HMHIY.js} +2 -2
  185. package/dist/cli/chunks/{chunk-CREORFJV.js → chunk-CXIFCN6G.js} +1 -1
  186. package/dist/cli/chunks/{chunk-EYGRNXQT.js → chunk-CZU5G6J4.js} +1 -1
  187. package/dist/cli/chunks/{chunk-HZSYCVLC.js → chunk-D4DAZ3P2.js} +2 -2
  188. package/dist/cli/chunks/{chunk-3HT4CT6F.js → chunk-D6MPGK7R.js} +2 -2
  189. package/dist/cli/chunks/{chunk-DK6WWNCL.js → chunk-DZT4A7R3.js} +2 -2
  190. package/dist/cli/chunks/{chunk-H7AQ7M3J.js → chunk-EFRIMR74.js} +1 -1
  191. package/dist/cli/chunks/{chunk-S73EBPI5.js → chunk-EJSDQQZH.js} +3 -3
  192. package/dist/cli/chunks/{chunk-X6YUGKMM.js → chunk-EQYDPF52.js} +1 -1
  193. package/dist/cli/chunks/{chunk-BYVARYGB.js → chunk-EZBXCEBV.js} +2 -2
  194. package/dist/cli/chunks/{chunk-L5IO7QNO.js → chunk-FBOPSWF6.js} +2 -2
  195. package/dist/cli/chunks/{chunk-K23XK33X.js → chunk-FK3XYV3A.js} +2 -2
  196. package/dist/cli/chunks/{chunk-4BB75U6N.js → chunk-FOD6JEEU.js} +2 -2
  197. package/dist/cli/chunks/{chunk-TIR3Z6TE.js → chunk-GUSW3OGX.js} +1 -1
  198. package/dist/cli/chunks/{chunk-2K2X75UF.js → chunk-H4V6WCF7.js} +2 -2
  199. package/dist/cli/chunks/{chunk-AHUX7QSE.js → chunk-H5GCRC2D.js} +2 -2
  200. package/dist/cli/chunks/{chunk-R2M3RMCN.js → chunk-HMVL55QX.js} +2 -2
  201. package/dist/cli/chunks/{chunk-NOWGQ6YZ.js → chunk-HOFEAA4R.js} +1 -1
  202. package/dist/cli/chunks/{chunk-PFGH7TWL.js → chunk-HYT5EMES.js} +2 -2
  203. package/dist/cli/chunks/{chunk-AU4DQMLJ.js → chunk-IAHJ62JS.js} +4 -4
  204. package/dist/cli/chunks/{chunk-ZVF7QY4R.js → chunk-IIX5Y7BO.js} +1 -1
  205. package/dist/cli/chunks/{chunk-QAP5S7YC.js → chunk-ILZHECWZ.js} +3 -3
  206. package/dist/cli/chunks/{chunk-ZT2DGSIO.js → chunk-IUVAWWQG.js} +2 -2
  207. package/dist/cli/chunks/{chunk-ABVBHH7P.js → chunk-IVZVVZZ3.js} +3 -3
  208. package/dist/cli/chunks/{chunk-DZWZASDV.js → chunk-J2LAYCYZ.js} +1 -1
  209. package/dist/cli/chunks/{chunk-G7V2HDTH.js → chunk-JGHEGMLD.js} +3 -3
  210. package/dist/cli/chunks/{chunk-QFIKEZB5.js → chunk-K3BBLIWW.js} +2 -2
  211. package/dist/cli/chunks/{chunk-BSMUT672.js → chunk-K7XPKGOL.js} +2 -2
  212. package/dist/cli/chunks/{chunk-YHFCLJMY.js → chunk-KIBP3LGY.js} +1 -1
  213. package/dist/cli/chunks/{chunk-U6TZVACK.js → chunk-KRUKMGPF.js} +2 -2
  214. package/dist/cli/chunks/{chunk-UX4UHYLE.js → chunk-L2QHZFC3.js} +1 -1
  215. package/dist/cli/chunks/{chunk-O36VC7B7.js → chunk-LNV76GGB.js} +2 -2
  216. package/dist/cli/chunks/{chunk-NMQEU4BG.js → chunk-LOPM3YIO.js} +2 -2
  217. package/dist/cli/chunks/{chunk-LT6QHDPK.js → chunk-LSZLXLZA.js} +2 -2
  218. package/dist/cli/chunks/{chunk-NLUWPS2H.js → chunk-MILWEZSZ.js} +3 -3
  219. package/dist/cli/chunks/{chunk-LHKQW72O.js → chunk-MX6M2VPB.js} +1 -1
  220. package/dist/cli/chunks/{chunk-KRAWWBX5.js → chunk-N4OWZLH5.js} +2 -2
  221. package/dist/cli/chunks/{chunk-4MUZGQPE.js → chunk-N52WQO3G.js} +2 -2
  222. package/dist/cli/chunks/{chunk-246Z3PH6.js → chunk-N6NSZG7Z.js} +2 -2
  223. package/dist/cli/chunks/{chunk-OQUH7657.js → chunk-N6RSJGTW.js} +5 -5
  224. package/dist/cli/chunks/{chunk-WOGWIMQK.js → chunk-NKCL6RAF.js} +2 -2
  225. package/dist/cli/chunks/{chunk-C6JULAWA.js → chunk-NVJIOCS5.js} +5 -5
  226. package/dist/cli/chunks/{chunk-TKZABUHO.js → chunk-NYWK7ZSX.js} +1 -1
  227. package/dist/cli/chunks/{chunk-DNE6MVNA.js → chunk-O5NF6BBD.js} +1 -1
  228. package/dist/cli/chunks/{chunk-CWRSQQHV.js → chunk-O75SVMMB.js} +2 -2
  229. package/dist/cli/chunks/{chunk-OD4OIPXO.js → chunk-OHBZON7T.js} +1 -1
  230. package/dist/cli/chunks/{chunk-CLJNAQXB.js → chunk-OUBYADPD.js} +2 -2
  231. package/dist/cli/chunks/{chunk-PYQZ4OA3.js → chunk-OUSD2RWO.js} +2 -2
  232. package/dist/cli/chunks/{chunk-TVU6NMO3.js → chunk-OX2PGDUM.js} +3 -3
  233. package/dist/cli/chunks/{chunk-XLK4GP3I.js → chunk-P7CMWL7Y.js} +2 -2
  234. package/dist/cli/chunks/{chunk-7C5HI4ZA.js → chunk-PY4YQDBM.js} +4 -4
  235. package/dist/cli/chunks/{chunk-5U5SEO7C.js → chunk-QEDS3MOJ.js} +2 -2
  236. package/dist/cli/chunks/{chunk-WPBVLIWQ.js → chunk-QMN563LV.js} +18 -18
  237. package/dist/cli/chunks/{chunk-D2JCSWYM.js → chunk-QOR4YAZY.js} +2 -2
  238. package/dist/cli/chunks/{chunk-H4SHHYRD.js → chunk-QUTKELAS.js} +2 -2
  239. package/dist/cli/chunks/{chunk-42FBJF73.js → chunk-QXDZN2WX.js} +1 -1
  240. package/dist/cli/chunks/{chunk-OSP5AJAB.js → chunk-S456W64P.js} +2 -2
  241. package/dist/cli/chunks/{chunk-VHYNRISI.js → chunk-S7IHSELP.js} +2 -2
  242. package/dist/cli/chunks/{chunk-62MH7QAQ.js → chunk-S7ZHD6VN.js} +2 -2
  243. package/dist/cli/chunks/{chunk-QL6ZJ7RV.js → chunk-SU4YXUVK.js} +2 -2
  244. package/dist/cli/chunks/{chunk-JZNMU63B.js → chunk-SZPTUV3B.js} +2 -2
  245. package/dist/cli/chunks/{chunk-FALB6Z2Y.js → chunk-T7PUM6OY.js} +1 -1
  246. package/dist/cli/chunks/{chunk-BVEQPMOF.js → chunk-TCKBICJ3.js} +2 -2
  247. package/dist/cli/chunks/{chunk-Z6FRNWQA.js → chunk-TOQJWLJV.js} +2 -2
  248. package/dist/cli/chunks/{chunk-YB3PQ3UV.js → chunk-TUEDIQHY.js} +1 -1
  249. package/dist/cli/chunks/{chunk-CVRTXIYP.js → chunk-U5GCSSYX.js} +1 -1
  250. package/dist/cli/chunks/{chunk-WWGGL3TR.js → chunk-UDLN2THT.js} +1 -1
  251. package/dist/cli/chunks/{chunk-CLSHSVMY.js → chunk-V6YDM37M.js} +1 -1
  252. package/dist/cli/chunks/{chunk-ILPIH4Z6.js → chunk-VGR65B4Y.js} +1 -1
  253. package/dist/cli/chunks/{chunk-XEMP2PNW.js → chunk-VRHLHGKR.js} +2 -2
  254. package/dist/cli/chunks/{chunk-BM52ZEAD.js → chunk-VS2G6LX5.js} +2 -2
  255. package/dist/cli/chunks/{chunk-TOGD2JH2.js → chunk-W6RS5S4Q.js} +2 -2
  256. package/dist/cli/chunks/{chunk-UJBIHPU5.js → chunk-WEPZOCN7.js} +1 -1
  257. package/dist/cli/chunks/{chunk-OF3EMOWN.js → chunk-WIC5UZCQ.js} +2 -2
  258. package/dist/cli/chunks/{chunk-D7NWDUY3.js → chunk-X2OVUBF6.js} +2 -2
  259. package/dist/cli/chunks/{chunk-XYRJL7YN.js → chunk-X4GKYSOH.js} +2 -2
  260. package/dist/cli/chunks/{chunk-TXWUV3S5.js → chunk-XEVUW4QL.js} +2 -2
  261. package/dist/cli/chunks/{chunk-HAC7NB6R.js → chunk-XMDZRULK.js} +2 -2
  262. package/dist/cli/chunks/{chunk-UPGKS6Z3.js → chunk-YFY35CSD.js} +2 -2
  263. package/dist/cli/chunks/{chunk-7D5JE46U.js → chunk-Z6ADE3KJ.js} +2 -2
  264. package/dist/cli/chunks/{chunk-KJA5A3TV.js → chunk-ZKPOKMJZ.js} +2 -2
  265. package/dist/cli/chunks/{chunk-7PYEJ4NV.js → chunk-ZRWAFMM7.js} +2 -2
  266. package/dist/cli/chunks/{ci-KDEFR2X3.js → ci-KTWY7BZT.js} +2 -2
  267. package/dist/cli/chunks/{ci-output-Z3WXRRFI.js → ci-output-WOX6QBMS.js} +2 -2
  268. package/dist/cli/chunks/{circuit-breaker-GS44DEW2.js → circuit-breaker-6XKOSFIF.js} +2 -2
  269. package/dist/cli/chunks/{claude-flow-setup-OHVMHAAH.js → claude-flow-setup-5JA4MNE4.js} +2 -2
  270. package/dist/cli/chunks/client-X3KUJ6R5.js +2 -0
  271. package/dist/cli/chunks/{cline-installer-5TCF4MZD.js → cline-installer-Z2ANHEKW.js} +2 -2
  272. package/dist/cli/chunks/{code-3KCGTG7Z.js → code-NO4ZKNDU.js} +2 -2
  273. package/dist/cli/chunks/{code-index-extractor-LJBI54MZ.js → code-index-extractor-VV4OEPG7.js} +2 -2
  274. package/dist/cli/chunks/{codex-installer-IB62Z6LA.js → codex-installer-BP7Y2NYR.js} +2 -2
  275. package/dist/cli/chunks/{completions-JDXX7KKB.js → completions-YULJQUF4.js} +2 -2
  276. package/dist/cli/chunks/{complexity-analyzer-6JVDXXXP.js → complexity-analyzer-D7XYPQ76.js} +2 -2
  277. package/dist/cli/chunks/{continuedev-installer-PUB45QVR.js → continuedev-installer-E3L7UF72.js} +2 -2
  278. package/dist/cli/chunks/{copilot-installer-QWJ36P22.js → copilot-installer-5TRUMJC5.js} +2 -2
  279. package/dist/cli/chunks/core-handlers-A2EQB3UH.js +2 -0
  280. package/dist/cli/chunks/{cost-tracker-J3KEJDL5.js → cost-tracker-QTYSJMSV.js} +2 -2
  281. package/dist/cli/chunks/{coverage-FWKRI2EY.js → coverage-D5DKZ3XT.js} +3 -3
  282. package/dist/cli/chunks/cross-domain-router-OKZ2PDHT.js +2 -0
  283. package/dist/cli/chunks/{cursor-installer-2HYCUCTH.js → cursor-installer-UDBHGUIG.js} +2 -2
  284. package/dist/cli/chunks/{daemon-G3DBRWDQ.js → daemon-2GXYN7F7.js} +3 -3
  285. package/dist/cli/chunks/{daemon-BVP66DIZ.js → daemon-IVWUMQKL.js} +4 -4
  286. package/dist/cli/chunks/{dag-attention-scheduler-2AQLNB4B.js → dag-attention-scheduler-PWXR4QTU.js} +2 -2
  287. package/dist/cli/chunks/{detect-RUM5SHNE.js → detect-C6P7ONFB.js} +2 -2
  288. package/dist/cli/chunks/{dist-node-GX7MJHFT.js → dist-node-2BUFM2JK.js} +2 -2
  289. package/dist/cli/chunks/{domain-handler-OFBGZ2U5.js → domain-handler-Q2GWZLDM.js} +2 -2
  290. package/dist/cli/chunks/{domain-transfer-6CGRPRGR.js → domain-transfer-GMUBAM3J.js} +2 -2
  291. package/dist/cli/chunks/dream-ZBP4Z5C3.js +2 -0
  292. package/dist/cli/chunks/{embed-and-insert-pattern-MUOEVQX2.js → embed-and-insert-pattern-EFUERRM2.js} +2 -2
  293. package/dist/cli/chunks/{eval-SJMG67DE.js → eval-24FIC43F.js} +2 -2
  294. package/dist/cli/chunks/{experience-capture-middleware-ICKN6IXX.js → experience-capture-middleware-R4UP2Q2M.js} +3 -3
  295. package/dist/cli/chunks/{fast-paths-HXLBG3J4.js → fast-paths-RQCGGTXB.js} +2 -2
  296. package/dist/cli/chunks/{feature-flags-CRUB2ASU.js → feature-flags-APTWWVNQ.js} +2 -2
  297. package/dist/cli/chunks/{feature-flags-JYZSSQJC.js → feature-flags-SOXVYIBN.js} +2 -2
  298. package/dist/cli/chunks/{file-discovery-YHHC7NTJ.js → file-discovery-66KRMXVF.js} +2 -2
  299. package/dist/cli/chunks/{fleet-2VGDL4YL.js → fleet-EMBNKO5Q.js} +3 -3
  300. package/dist/cli/chunks/{gnn-wrapper-7ZAGD4S4.js → gnn-wrapper-6TKDWFJF.js} +2 -2
  301. package/dist/cli/chunks/{heartbeat-handler-HAW3JRHN.js → heartbeat-handler-4ODKJ75H.js} +4 -4
  302. package/dist/cli/chunks/heartbeat-scheduler-6JUWQXWG.js +2 -0
  303. package/dist/cli/chunks/hnsw-adapter-JT4BU7XJ.js +2 -0
  304. package/dist/cli/chunks/hnsw-index-JC5YELJX.js +2 -0
  305. package/dist/cli/chunks/{hnsw-legacy-bridge-BO325POX.js → hnsw-legacy-bridge-25KFCLUC.js} +2 -2
  306. package/dist/cli/chunks/{better-sqlite3-6A6EAXAT.js → hnswlib-node-FUWQTM2D.js} +2 -2
  307. package/dist/cli/chunks/{hooks-HKM3JTFQ.js → hooks-JIDA2COE.js} +10 -10
  308. package/dist/cli/chunks/hybrid-router-SLTXHUFG.js +2 -0
  309. package/dist/cli/chunks/{hypergraph-engine-LGLGHK6B.js → hypergraph-engine-3YDFDPE3.js} +2 -2
  310. package/dist/cli/chunks/{hypergraph-handler-6QDVREZA.js → hypergraph-handler-VWZX2OJX.js} +3 -3
  311. package/dist/cli/chunks/impact-analyzer-JXHCMZXY.js +2 -0
  312. package/dist/cli/chunks/{init-handler-XUQ7XHIE.js → init-handler-DH7VQAMF.js} +6 -6
  313. package/dist/cli/chunks/init-wizard-EX37TYOG.js +2 -0
  314. package/dist/cli/chunks/kernel-JPHAG27D.js +2 -0
  315. package/dist/cli/chunks/{kilocode-installer-6CEZLVIX.js → kilocode-installer-2W2KZCGH.js} +2 -2
  316. package/dist/cli/chunks/{kiro-installer-6CJGATOS.js → kiro-installer-E5KP7OMD.js} +2 -2
  317. package/dist/cli/chunks/knowledge-graph-5QJZIRYB.js +2 -0
  318. package/dist/cli/chunks/{learning-EIYTYZJY.js → learning-XJRUVPLF.js} +3 -3
  319. package/dist/cli/chunks/{llm-router-J4CI7VHU.js → llm-router-AEEKEMF5.js} +4 -4
  320. package/dist/cli/chunks/llm-router-service-SE2RO4P5.js +2 -0
  321. package/dist/cli/chunks/{load-CQPWGLQQ.js → load-PZ4YOTBJ.js} +2 -2
  322. package/dist/cli/chunks/load-test-LOTBWIIS.js +2 -0
  323. package/dist/cli/chunks/{mcp-THOATWCO.js → mcp-IVA6LC2S.js} +2 -2
  324. package/dist/cli/chunks/{memory-NZHMHMRK.js → memory-Y3DHXFQE.js} +5 -5
  325. package/dist/cli/chunks/memory-backend-BSDKTFAN.js +2 -0
  326. package/dist/cli/chunks/{memory-handlers-L2J54AQE.js → memory-handlers-V5PXEJWL.js} +2 -2
  327. package/dist/cli/chunks/{multi-model-executor-3P5E773H.js → multi-model-executor-646G4S4Y.js} +2 -2
  328. package/dist/cli/chunks/{opencode-installer-IRZMKSNG.js → opencode-installer-P6KOOTUS.js} +2 -2
  329. package/dist/cli/chunks/{orchestrator-UADLXTKP.js → orchestrator-T2GVKYMX.js} +5 -5
  330. package/dist/cli/chunks/pattern-null-store-LRSXCZWM.js +2 -0
  331. package/dist/cli/chunks/{pipeline-QEH3XHXJ.js → pipeline-CK2ON45P.js} +2 -2
  332. package/dist/cli/chunks/{platform-NEZ3NXLT.js → platform-OQNSD3A3.js} +2 -2
  333. package/dist/cli/chunks/{plugin-O33HR2VO.js → plugin-UOG6RNRM.js} +2 -2
  334. package/dist/cli/chunks/{prime-radiant-advanced-wasm-MBUMFEX7.js → prime-radiant-advanced-wasm-37UE6TG5.js} +2 -2
  335. package/dist/cli/chunks/protocol-executor-WPUVJEL7.js +2 -0
  336. package/dist/cli/chunks/{protocol-handler-L455UOUT.js → protocol-handler-V722S6YH.js} +2 -2
  337. package/dist/cli/chunks/{prove-3XA3SMAA.js → prove-ANGY6W3W.js} +2 -2
  338. package/dist/cli/chunks/provider-manager-EVPWSH3E.js +2 -0
  339. package/dist/cli/chunks/qe-reasoning-bank-IH63FG33.js +2 -0
  340. package/dist/cli/chunks/{quality-H6Z5JH5B.js → quality-KG4ALI2L.js} +2 -2
  341. package/dist/cli/chunks/queen-coordinator-TTCAGYQO.js +2 -0
  342. package/dist/cli/chunks/{real-embeddings-5DNJ4KEM.js → real-embeddings-GUZDO5UN.js} +2 -2
  343. package/dist/cli/chunks/{roocode-installer-KHXKR2FK.js → roocode-installer-WROAR6MJ.js} +2 -2
  344. package/dist/cli/chunks/router-64Q4ILOQ.js +2 -0
  345. package/dist/cli/chunks/routing-feedback-KCZV4XXC.js +2 -0
  346. package/dist/cli/chunks/{routing-handler-WAMGESEM.js → routing-handler-UFPSSS5D.js} +2 -2
  347. package/dist/cli/chunks/{ruvector-commands-4J7XC6XY.js → ruvector-commands-XJQMKDRM.js} +2 -2
  348. package/dist/cli/chunks/{rvf-dual-writer-3PZEN6XN.js → rvf-dual-writer-QPRMDKYX.js} +2 -2
  349. package/dist/cli/chunks/{rvf-migration-adapter-OIUNRQSU.js → rvf-migration-adapter-SOHBK23K.js} +2 -2
  350. package/dist/cli/chunks/{rvf-migration-coordinator-QZXDI4I5.js → rvf-migration-coordinator-MTWUSPEJ.js} +2 -2
  351. package/dist/cli/chunks/rvf-native-adapter-GNJKMURU.js +2 -0
  352. package/dist/cli/chunks/safe-db-6VBZQIJI.js +2 -0
  353. package/dist/cli/chunks/schedule-4V7O5IPX.js +2 -0
  354. package/dist/cli/chunks/scheduler-CQDMHEHN.js +2 -0
  355. package/dist/cli/chunks/{security-5NY77AMD.js → security-5MAMQKP6.js} +3 -3
  356. package/dist/cli/chunks/{shared-rvf-adapter-MHPUZIMW.js → shared-rvf-adapter-YEUBSRNN.js} +2 -2
  357. package/dist/cli/chunks/{shared-rvf-dual-writer-ITLDYHCX.js → shared-rvf-dual-writer-DBQJHG42.js} +2 -2
  358. package/dist/cli/chunks/sqlite-persistence-7DHUFTHL.js +2 -0
  359. package/dist/cli/chunks/{status-handler-7RBRIXZD.js → status-handler-ZUB2UKQZ.js} +2 -2
  360. package/dist/cli/chunks/{structural-health-MQPY6GA6.js → structural-health-B2GHENWX.js} +2 -2
  361. package/dist/cli/chunks/{sync-66KCEANE.js → sync-7VMXJTR2.js} +2 -2
  362. package/dist/cli/chunks/{sync-USVQTHKN.js → sync-YCUUW3IP.js} +2 -2
  363. package/dist/cli/chunks/{task-handler-4UI4FPPW.js → task-handler-N7LJTXZM.js} +2 -2
  364. package/dist/cli/chunks/{task-handlers-KRII3GVV.js → task-handlers-GDHNJV2E.js} +3 -3
  365. package/dist/cli/chunks/{test-JHN2MVEG.js → test-6COGC5KI.js} +4 -4
  366. package/dist/cli/chunks/{test-scheduling-ZWTEGS3S.js → test-scheduling-CUERHJMF.js} +3 -3
  367. package/dist/cli/chunks/{token-bootstrap-YWXL6AS5.js → token-bootstrap-JTGSL6PP.js} +2 -2
  368. package/dist/cli/chunks/{token-usage-INII2XM3.js → token-usage-LSG3JYGX.js} +2 -2
  369. package/dist/cli/chunks/{transformers-DVFGDNZC.js → transformers-ODIITRCT.js} +2 -2
  370. package/dist/cli/chunks/{tree-sitter-wasm-parser-W2XJT3XF.js → tree-sitter-wasm-parser-KSP7ZZ5H.js} +2 -2
  371. package/dist/cli/chunks/{types-GBZ5Q2GP.js → types-6N6SUU2O.js} +2 -2
  372. package/dist/cli/chunks/unified-memory-MQA72NLP.js +2 -0
  373. package/dist/cli/chunks/unified-memory-hnsw-K7HA3CWV.js +2 -0
  374. package/dist/cli/chunks/unified-persistence-2DXB4OE4.js +2 -0
  375. package/dist/cli/chunks/{upgrade-2JEXEGQX.js → upgrade-7SCVOCPS.js} +2 -2
  376. package/dist/cli/chunks/{validate-GDCM5YTS.js → validate-762ISH2Y.js} +2 -2
  377. package/dist/cli/chunks/{validate-swarm-QZ5RSJEU.js → validate-swarm-R6WYYXGO.js} +2 -2
  378. package/dist/cli/chunks/{vibium-I5BMT734.js → vibium-5GZYSUDQ.js} +2 -2
  379. package/dist/cli/chunks/visual-security-UD6CARIJ.js +2 -0
  380. package/dist/cli/chunks/{web-tree-sitter-3QY2LMLP.js → web-tree-sitter-VYYVAJTY.js} +2 -2
  381. package/dist/cli/chunks/{windsurf-installer-V7OBPLOB.js → windsurf-installer-RRIOR3B6.js} +2 -2
  382. package/dist/cli/chunks/witness-chain-LWALPPMC.js +2 -0
  383. package/dist/cli/chunks/{witness-chain-BNJ4VSZX.js → witness-chain-SRVBEKDB.js} +2 -2
  384. package/dist/cli/chunks/{workflow-3FJSNLPI.js → workflow-XNUDHGEC.js} +4 -4
  385. package/dist/cli/chunks/workflow-orchestrator-QU652FLH.js +2 -0
  386. package/dist/cli/chunks/{wrappers-ERTQNIPK.js → wrappers-3STST7QW.js} +2 -2
  387. package/dist/domains/requirements-validation/coordinator.d.ts +16 -2
  388. package/dist/domains/requirements-validation/coordinator.js +112 -7
  389. package/dist/domains/requirements-validation/plugin.js +20 -1
  390. package/dist/domains/test-generation/coordinator.d.ts +26 -1
  391. package/dist/domains/test-generation/coordinator.js +119 -2
  392. package/dist/domains/test-generation/plugin.js +23 -1
  393. package/dist/integrations/darwin/index.d.ts +10 -0
  394. package/dist/integrations/darwin/index.js +2 -0
  395. package/dist/integrations/darwin/qe-fitness.d.ts +83 -0
  396. package/dist/integrations/darwin/qe-fitness.js +147 -0
  397. package/dist/integrations/darwin/types.d.ts +69 -0
  398. package/dist/integrations/darwin/types.js +21 -0
  399. package/dist/mcp/bundle.js +390 -379
  400. package/dist/mcp/tool-scoping.d.ts +8 -2
  401. package/dist/mcp/tool-scoping.js +13 -0
  402. package/dist/routing/escalation/auto-escalation-tracker.d.ts +34 -15
  403. package/dist/routing/escalation/auto-escalation-tracker.js +24 -15
  404. package/dist/routing/free-tier/coordinator-support.d.ts +90 -0
  405. package/dist/routing/free-tier/coordinator-support.js +78 -0
  406. package/dist/routing/free-tier/executor.d.ts +161 -0
  407. package/dist/routing/free-tier/executor.js +182 -0
  408. package/dist/routing/free-tier/feedback-sink.d.ts +49 -0
  409. package/dist/routing/free-tier/feedback-sink.js +52 -0
  410. package/dist/routing/free-tier/index.d.ts +15 -0
  411. package/dist/routing/free-tier/index.js +6 -0
  412. package/dist/routing/free-tier/ladder.d.ts +41 -0
  413. package/dist/routing/free-tier/ladder.js +78 -0
  414. package/dist/routing/free-tier/provider.d.ts +57 -0
  415. package/dist/routing/free-tier/provider.js +111 -0
  416. package/dist/routing/free-tier/types.d.ts +80 -0
  417. package/dist/routing/free-tier/types.js +16 -0
  418. package/dist/routing/value-score.d.ts +49 -0
  419. package/dist/routing/value-score.js +54 -0
  420. package/dist/shared/optional-module.d.ts +23 -0
  421. package/dist/shared/optional-module.js +46 -0
  422. package/dist/verification/adversarial-verify/calibrate.d.ts +32 -0
  423. package/dist/verification/adversarial-verify/calibrate.js +33 -0
  424. package/dist/verification/adversarial-verify/gate.d.ts +38 -0
  425. package/dist/verification/adversarial-verify/gate.js +32 -0
  426. package/dist/verification/adversarial-verify/index.d.ts +20 -0
  427. package/dist/verification/adversarial-verify/index.js +6 -0
  428. package/dist/verification/adversarial-verify/prompts.d.ts +14 -0
  429. package/dist/verification/adversarial-verify/prompts.js +17 -0
  430. package/dist/verification/adversarial-verify/synthesize.d.ts +18 -0
  431. package/dist/verification/adversarial-verify/synthesize.js +35 -0
  432. package/dist/verification/adversarial-verify/types.d.ts +59 -0
  433. package/dist/verification/adversarial-verify/types.js +10 -0
  434. package/dist/verification/adversarial-verify/verify.d.ts +20 -0
  435. package/dist/verification/adversarial-verify/verify.js +34 -0
  436. package/package.json +14 -1
  437. package/dist/cli/chunks/adapter-TRSV37EA.js +0 -2
  438. package/dist/cli/chunks/aqe-learning-engine-CVJRJOSO.js +0 -2
  439. package/dist/cli/chunks/base-BX4A2D4V.js +0 -2
  440. package/dist/cli/chunks/browser-workflow-O3RL7EYT.js +0 -2
  441. package/dist/cli/chunks/chunk-OPKEQYAC.js +0 -2
  442. package/dist/cli/chunks/client-T263ZXVV.js +0 -2
  443. package/dist/cli/chunks/core-handlers-ODKKGCFK.js +0 -2
  444. package/dist/cli/chunks/cross-domain-router-APU725GC.js +0 -2
  445. package/dist/cli/chunks/dream-PJ5GKY3J.js +0 -2
  446. package/dist/cli/chunks/heartbeat-scheduler-4ZHUIW3Q.js +0 -2
  447. package/dist/cli/chunks/hnsw-adapter-UVJJ6TTP.js +0 -2
  448. package/dist/cli/chunks/hnsw-index-K6HS34JZ.js +0 -2
  449. package/dist/cli/chunks/hybrid-router-25S7OH2Y.js +0 -2
  450. package/dist/cli/chunks/impact-analyzer-UP4RDMJH.js +0 -2
  451. package/dist/cli/chunks/init-wizard-2PAJ3GEC.js +0 -2
  452. package/dist/cli/chunks/kernel-7WOQGMMT.js +0 -2
  453. package/dist/cli/chunks/knowledge-graph-FN2AWHGR.js +0 -2
  454. package/dist/cli/chunks/llm-router-service-C3UPBAS3.js +0 -2
  455. package/dist/cli/chunks/load-test-PQSGLDXJ.js +0 -2
  456. package/dist/cli/chunks/memory-backend-6FR4RT5O.js +0 -2
  457. package/dist/cli/chunks/pattern-null-store-B2UX4NZY.js +0 -2
  458. package/dist/cli/chunks/protocol-executor-OQ6SL7SR.js +0 -2
  459. package/dist/cli/chunks/provider-manager-DQWHW2RG.js +0 -2
  460. package/dist/cli/chunks/qe-reasoning-bank-3JS2CZAE.js +0 -2
  461. package/dist/cli/chunks/queen-coordinator-KXCWEM3Y.js +0 -2
  462. package/dist/cli/chunks/router-OVLIKT55.js +0 -2
  463. package/dist/cli/chunks/routing-feedback-2BYCXNXX.js +0 -2
  464. package/dist/cli/chunks/rvf-native-adapter-YNUYOQ5C.js +0 -2
  465. package/dist/cli/chunks/safe-db-6TYYEU7C.js +0 -2
  466. package/dist/cli/chunks/schedule-XVH7RTVY.js +0 -2
  467. package/dist/cli/chunks/scheduler-DHZBN5HA.js +0 -2
  468. package/dist/cli/chunks/sqlite-persistence-NR5WXTPN.js +0 -2
  469. package/dist/cli/chunks/unified-memory-WJEZ5YAK.js +0 -2
  470. package/dist/cli/chunks/unified-memory-hnsw-6ZA2PMYO.js +0 -2
  471. package/dist/cli/chunks/unified-persistence-SWH6R7MA.js +0 -2
  472. package/dist/cli/chunks/visual-security-PH5JQZCZ.js +0 -2
  473. package/dist/cli/chunks/witness-chain-WYMBNGSL.js +0 -2
  474. package/dist/cli/chunks/workflow-orchestrator-56JIXCI4.js +0 -2
@@ -0,0 +1,182 @@
1
+ /**
2
+ * Free-tier escalating executor (cross-pollination plan 06, D7-wire + D8).
3
+ *
4
+ * Implements Ruv's SWE-bench economics for a QE task:
5
+ * 1. run on the CHEAP/free local tier
6
+ * 2. verify with an objective QE oracle (pass/fail [+ feedback])
7
+ * 3. D8 REPAIR LOOP: on failure, feed the failure back to the SAME tier and
8
+ * retry (Round-2 lever: 7.7% -> 15.3% on a fixed model), up to `repairAttempts`
9
+ * 4. only then escalate up the ladder (when `escalate` is true)
10
+ * 5. record the start-tier outcome so the base tier adapts across tasks
11
+ *
12
+ * Decoupled by injection: free tiers via `freeTierChat`; Claude tiers via an
13
+ * injected `ClaudeTierRunner` (no Anthropic SDK dep; coordinator delegates to
14
+ * its HybridRouter). No runner → local-only. `escalate:false` = repair-only,
15
+ * never leaves the start tier (the "no escalation yet" mode).
16
+ */
17
+ import { freeTierChat, resolveFreeTierProvider } from './provider.js';
18
+ import { resolveTier } from './ladder.js';
19
+ import { AutoEscalationTracker } from '../escalation/auto-escalation-tracker.js';
20
+ function normalizeVerdict(v) {
21
+ return typeof v === 'boolean' ? { passed: v } : v;
22
+ }
23
+ /**
24
+ * Executes QE tasks cheap-first with repair-then-escalate. Holds the per-agent
25
+ * adaptive base tier in an `AutoEscalationTracker`.
26
+ */
27
+ export class FreeTierEscalatingExecutor {
28
+ ladder;
29
+ claudeRunner;
30
+ tracker;
31
+ env;
32
+ baseTier;
33
+ defaultRepairAttempts;
34
+ onOutcome;
35
+ /** Resolved cross-model generator pool (A12); undefined ⇒ single-model best-of-k. */
36
+ candidateProviders;
37
+ constructor(opts) {
38
+ this.ladder = opts.ladder;
39
+ this.claudeRunner = opts.claudeRunner;
40
+ this.env = opts.env ?? process.env;
41
+ this.onOutcome = opts.onOutcome;
42
+ this.defaultRepairAttempts = opts.defaultRepairAttempts ?? 0;
43
+ this.baseTier = opts.ladder.tierOrder[0];
44
+ this.candidateProviders = opts.candidateProviders?.length
45
+ ? opts.candidateProviders.map((c) => resolveFreeTierProvider(c, this.env))
46
+ : undefined;
47
+ this.tracker =
48
+ opts.tracker ??
49
+ new AutoEscalationTracker({
50
+ tierOrder: opts.ladder.tierOrder,
51
+ minTier: opts.ladder.minTier ?? opts.ladder.tierOrder[0],
52
+ maxTier: opts.ladder.maxTier ?? opts.ladder.tierOrder[opts.ladder.tierOrder.length - 1],
53
+ escalateAfterFailures: opts.ladder.escalateAfterFailures ?? 2,
54
+ deEscalateAfterSuccesses: opts.ladder.deEscalateAfterSuccesses ?? 5,
55
+ });
56
+ }
57
+ /** Expose the tracker so a coordinator can inspect/share adaptation state. */
58
+ getTracker() {
59
+ return this.tracker;
60
+ }
61
+ /** Run ONE tier once; never throws — failure becomes `{ok:false}` so we repair/escalate. */
62
+ async runTier(resolved, messages) {
63
+ const started = Date.now();
64
+ if (resolved.provider === 'free-tier') {
65
+ const r = await freeTierChat(resolved.resolved, messages);
66
+ return { ok: r.ok, content: r.content, latencyMs: r.latencyMs, error: r.error };
67
+ }
68
+ if (!this.claudeRunner) {
69
+ return { ok: false, content: '', latencyMs: Date.now() - started, error: 'no claudeRunner (local-only mode)' };
70
+ }
71
+ try {
72
+ const r = await this.claudeRunner(resolved.claudeTier, messages);
73
+ return { ok: (r.content ?? '').trim().length > 0, content: r.content ?? '', latencyMs: Date.now() - started };
74
+ }
75
+ catch (e) {
76
+ return { ok: false, content: '', latencyMs: Date.now() - started, error: e.message };
77
+ }
78
+ }
79
+ /**
80
+ * Best-of-k diversity turn (06 §12): nudge the model toward a structurally
81
+ * different valid solution. Deterministic by `variant` index (no RNG) so runs
82
+ * replay identically.
83
+ */
84
+ diversify(base, variant) {
85
+ return [
86
+ ...base,
87
+ {
88
+ role: 'user',
89
+ content: `Alternative approach #${variant}: produce a different valid solution from any ` +
90
+ `previous attempt — vary the structure/strategy, not just naming. Return the full output only.`,
91
+ },
92
+ ];
93
+ }
94
+ /** Build the D8 repair turn: show the model its rejected output + why. */
95
+ repairMessages(base, lastOutput, feedback) {
96
+ return [
97
+ ...base,
98
+ { role: 'assistant', content: lastOutput },
99
+ {
100
+ role: 'user',
101
+ content: 'That output did not pass verification' +
102
+ (feedback ? `: ${feedback}` : '.') +
103
+ ' Fix it and return the corrected full output only.',
104
+ },
105
+ ];
106
+ }
107
+ /**
108
+ * Execute a QE task cheap-first: try a tier, repair in place on failure, then
109
+ * (optionally) escalate to the next tier; repeat until pass or top.
110
+ */
111
+ async execute(req) {
112
+ const order = this.ladder.tierOrder;
113
+ const escalate = req.escalate ?? true;
114
+ const repairAttempts = req.repairAttempts ?? this.defaultRepairAttempts;
115
+ const bestOfK = Math.max(1, req.bestOfK ?? 1);
116
+ const objectiveOracle = (req.oracleKind ?? 'objective') === 'objective';
117
+ const startTier = this.tracker.getCurrentTier(req.agentId) ?? this.baseTier;
118
+ const startIdx = Math.max(0, order.indexOf(startTier));
119
+ const maxIdx = order.indexOf(this.ladder.maxTier ?? order[order.length - 1]);
120
+ const topIdx = escalate
121
+ ? (req.maxEscalations != null ? Math.min(startIdx + req.maxEscalations, maxIdx) : maxIdx)
122
+ : startIdx; // repair-only: never leave the start tier
123
+ const attempts = [];
124
+ let passedAtStart = false;
125
+ const t0 = Date.now();
126
+ let result = { ok: false, content: '', tierUsed: startTier, escalated: false, repaired: false, bestOf: false, goodhartGuarded: false, attempts };
127
+ outer: for (let idx = startIdx; idx <= topIdx; idx++) {
128
+ const tier = order[idx];
129
+ const resolved = resolveTier(this.ladder, tier, this.env);
130
+ // round 0 = best-of-k diverse attempts (06 §12); rounds 1..repairAttempts = single repair turns (D8)
131
+ // A12: at the START free tier, round-0 candidates draw from a CROSS-MODEL pool
132
+ // (diverse models cover each other's failures) instead of one model's variants.
133
+ const pool = this.candidateProviders;
134
+ const xModelHere = !!pool && idx === startIdx && resolved.provider === 'free-tier';
135
+ for (let round = 0; round <= repairAttempts; round++) {
136
+ const attemptsThisRound = round === 0 ? bestOfK : 1;
137
+ for (let k = 0; k < attemptsThisRound; k++) {
138
+ const candProvider = round === 0 && xModelHere && pool ? pool[k % pool.length] : undefined;
139
+ const candResolved = candProvider ? { provider: 'free-tier', resolved: candProvider } : resolved;
140
+ const messages = round !== 0
141
+ ? this.repairMessages(req.messages, result.content, attempts[attempts.length - 1]?.feedback)
142
+ : candProvider
143
+ // model difference IS the diversity; only nudge when k wraps past the pool
144
+ ? (pool && k < pool.length ? req.messages : this.diversify(req.messages, k))
145
+ : (k === 0 ? req.messages : this.diversify(req.messages, k));
146
+ const run = await this.runTier(candResolved, messages);
147
+ const verdict = run.ok ? normalizeVerdict(await Promise.resolve(req.verify(run.content))) : { passed: false, feedback: run.error };
148
+ attempts.push({ tier, provider: candResolved.provider, repairRound: round, variant: round === 0 ? k : undefined, model: candProvider?.model, ok: run.ok, passed: verdict.passed, latencyMs: run.latencyMs, feedback: verdict.feedback, error: run.error });
149
+ // start-tier capability for adaptation: did ANY round-0 attempt pass?
150
+ if (idx === startIdx && round === 0 && verdict.passed)
151
+ passedAtStart = true;
152
+ if (verdict.passed) {
153
+ result = { ok: true, content: run.content, tierUsed: tier, escalated: idx > startIdx, repaired: round > 0, bestOf: round === 0 && k > 0, goodhartGuarded: false, attempts };
154
+ break outer;
155
+ }
156
+ result = { ok: false, content: run.content || result.content, tierUsed: tier, escalated: idx > startIdx, repaired: round > 0, bestOf: false, goodhartGuarded: false, attempts };
157
+ }
158
+ }
159
+ }
160
+ // Goodhart guard (06 §10): only an OBJECTIVE ground-truth oracle may move
161
+ // routing-feedback. A self-authored gate is an unreliable selection target —
162
+ // record nothing, so a Goodharted self-test pass can never lift confidence.
163
+ result.goodhartGuarded = !objectiveOracle;
164
+ if (objectiveOracle) {
165
+ // Cross-task adaptation: feed the START-tier verdict to the tracker so the
166
+ // base tier drifts up when the cheap tier keeps failing, down when it wins.
167
+ this.tracker.recordOutcome(req.agentId, passedAtStart, this.baseTier);
168
+ this.onOutcome?.({
169
+ agentId: req.agentId,
170
+ startTier,
171
+ tierUsed: result.tierUsed,
172
+ passed: result.ok,
173
+ escalated: result.escalated,
174
+ repaired: result.repaired,
175
+ durationMs: Date.now() - t0,
176
+ attempts: attempts.length,
177
+ });
178
+ }
179
+ return result;
180
+ }
181
+ }
182
+ //# sourceMappingURL=executor.js.map
@@ -0,0 +1,49 @@
1
+ /**
2
+ * D9 — route free-tier executor outcomes into the existing routing-feedback
3
+ * machinery so the stuck-at-40% routing confidence starts moving from REAL
4
+ * cheap-vs-escalated results.
5
+ *
6
+ * `RoutingFeedbackCollector.recordOutcome` already updates the calibrator, the
7
+ * auto-escalation tracker, the economic model, and the confidence metrics. This
8
+ * adapter maps a `FreeTierEscalatingExecutor.onOutcome` event onto that call,
9
+ * constructing a minimal-but-valid QETask + synthetic QERoutingDecision.
10
+ *
11
+ * Decoupled by a structural interface (`RoutingFeedbackLike`) so this module has
12
+ * no hard dependency on the concrete collector's constructor/DB — the coordinator
13
+ * passes whatever it already holds, and tests pass a stub.
14
+ */
15
+ import type { QETask, QERoutingDecision, RoutingOutcome } from '../types.js';
16
+ /** The slice of RoutingFeedbackCollector this adapter needs. */
17
+ export interface RoutingFeedbackLike {
18
+ recordOutcome(task: QETask, decision: QERoutingDecision, usedAgent: string, outcome: {
19
+ success: boolean;
20
+ qualityScore: number;
21
+ durationMs: number;
22
+ error?: string;
23
+ }): RoutingOutcome;
24
+ }
25
+ /** The executor's onOutcome payload (kept structural to avoid a circular import). */
26
+ export interface FreeTierOutcomeEvent {
27
+ agentId: string;
28
+ startTier: string;
29
+ tierUsed: string;
30
+ passed: boolean;
31
+ escalated: boolean;
32
+ repaired: boolean;
33
+ durationMs: number;
34
+ attempts: number;
35
+ }
36
+ export interface RoutingFeedbackSinkOptions {
37
+ /** Short label for the task description (e.g. 'test-generation'). */
38
+ taskKind?: string;
39
+ /** Confidence to attribute to the cheap-first decision (0..1). Default 0.5. */
40
+ decisionConfidence?: number;
41
+ }
42
+ /**
43
+ * Build an `onOutcome` handler that records each free-tier task result into the
44
+ * routing-feedback collector. `usedAgent` is set to the TIER that produced the
45
+ * result so the calibrator/escalation tracker learn per-tier reliability — i.e.
46
+ * sustained cheap-tier wins raise its confidence and keep work cheap.
47
+ */
48
+ export declare function createRoutingFeedbackSink(collector: RoutingFeedbackLike, opts?: RoutingFeedbackSinkOptions): (o: FreeTierOutcomeEvent) => void;
49
+ //# sourceMappingURL=feedback-sink.d.ts.map
@@ -0,0 +1,52 @@
1
+ /**
2
+ * D9 — route free-tier executor outcomes into the existing routing-feedback
3
+ * machinery so the stuck-at-40% routing confidence starts moving from REAL
4
+ * cheap-vs-escalated results.
5
+ *
6
+ * `RoutingFeedbackCollector.recordOutcome` already updates the calibrator, the
7
+ * auto-escalation tracker, the economic model, and the confidence metrics. This
8
+ * adapter maps a `FreeTierEscalatingExecutor.onOutcome` event onto that call,
9
+ * constructing a minimal-but-valid QETask + synthetic QERoutingDecision.
10
+ *
11
+ * Decoupled by a structural interface (`RoutingFeedbackLike`) so this module has
12
+ * no hard dependency on the concrete collector's constructor/DB — the coordinator
13
+ * passes whatever it already holds, and tests pass a stub.
14
+ */
15
+ /**
16
+ * Build an `onOutcome` handler that records each free-tier task result into the
17
+ * routing-feedback collector. `usedAgent` is set to the TIER that produced the
18
+ * result so the calibrator/escalation tracker learn per-tier reliability — i.e.
19
+ * sustained cheap-tier wins raise its confidence and keep work cheap.
20
+ */
21
+ export function createRoutingFeedbackSink(collector, opts = {}) {
22
+ const kind = opts.taskKind ?? 'free-tier-qe';
23
+ const confidence = opts.decisionConfidence ?? 0.5;
24
+ return (o) => {
25
+ const task = {
26
+ description: `${kind} task for ${o.agentId} (start=${o.startTier}${o.repaired ? ', repaired' : ''}${o.escalated ? ', escalated' : ''})`,
27
+ };
28
+ const decision = {
29
+ recommended: o.startTier, // cheap-first recommended the bottom tier
30
+ confidence,
31
+ alternatives: [],
32
+ reasoning: `free-tier cheap-first; resolved at ${o.tierUsed} after ${o.attempts} attempt(s)`,
33
+ scores: { similarity: 0, performance: o.passed ? 1 : 0, capabilities: 0, combined: o.passed ? 1 : 0 },
34
+ latencyMs: o.durationMs,
35
+ timestamp: new Date(),
36
+ };
37
+ // qualityScore: full marks on a clean cheap win; reduced when repair/escalation
38
+ // was needed (still a success, but it cost more) so the calibrator learns nuance.
39
+ const qualityScore = o.passed ? (o.escalated ? 0.6 : o.repaired ? 0.8 : 1.0) : 0;
40
+ try {
41
+ collector.recordOutcome(task, decision, o.tierUsed, {
42
+ success: o.passed,
43
+ qualityScore,
44
+ durationMs: o.durationMs,
45
+ });
46
+ }
47
+ catch {
48
+ // Feedback recording is best-effort — never break the QE task on a sink error.
49
+ }
50
+ };
51
+ }
52
+ //# sourceMappingURL=feedback-sink.js.map
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Free-tier routing (cross-pollination plan 06, D7).
3
+ *
4
+ * Adds a configurable FREE / low-cost model tier below haiku in the escalation
5
+ * ladder: local Ollama, cloud Ollama, OpenRouter, or any OpenAI-compatible
6
+ * endpoint. Cheap-local handles the bulk; only failures escalate up the chain.
7
+ * See docs/metaharness/06-darwin-qe-self-learning-action-lane.md (D7).
8
+ */
9
+ export type { FreeTierKind, FreeTierProviderConfig, ResolvedFreeTierProvider, TierBinding, QeRoutingLadder, } from './types.js';
10
+ export { FREE_TIER_PRESETS, resolveFreeTierProvider, freeTierChat, freeTierHealth, type ChatMessage, type FreeTierChatResult, } from './provider.js';
11
+ export { defaultFreeTierLadder, validateLadder, createFreeTierEscalation, resolveTier, type ResolvedTier, } from './ladder.js';
12
+ export { FreeTierEscalatingExecutor, type ClaudeTierRunner, type QeVerifier, type QeVerdict, type QeTaskRequest, type QeExecutionResult, type TierAttempt, type FreeTierExecutorOptions, } from './executor.js';
13
+ export { createRoutingFeedbackSink, type RoutingFeedbackLike, type FreeTierOutcomeEvent, type RoutingFeedbackSinkOptions, } from './feedback-sink.js';
14
+ export { buildFreeTierExecutor, runFreeTierTextTask, DEFAULT_FREE_TIER_MODEL, type FreeTierCoordinatorConfig, type FreeTierLlmRouter, type BuildFreeTierExecutorOptions, } from './coordinator-support.js';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ export { FREE_TIER_PRESETS, resolveFreeTierProvider, freeTierChat, freeTierHealth, } from './provider.js';
2
+ export { defaultFreeTierLadder, validateLadder, createFreeTierEscalation, resolveTier, } from './ladder.js';
3
+ export { FreeTierEscalatingExecutor, } from './executor.js';
4
+ export { createRoutingFeedbackSink, } from './feedback-sink.js';
5
+ export { buildFreeTierExecutor, runFreeTierTextTask, DEFAULT_FREE_TIER_MODEL, } from './coordinator-support.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Free-tier escalation ladder (D7).
3
+ *
4
+ * Ties the configurable provider layer to the real `AutoEscalationTracker`:
5
+ * builds a tracker whose ladder starts at a FREE tier and escalates up the
6
+ * existing Claude tiers on failure (Ruv's Round-3 economics), and resolves any
7
+ * tier name to the concrete provider that should serve it.
8
+ */
9
+ import { AutoEscalationTracker } from '../escalation/auto-escalation-tracker.js';
10
+ import type { ResolvedFreeTierProvider, QeRoutingLadder } from './types.js';
11
+ import type { AgentTier } from '../routing-config.js';
12
+ /**
13
+ * A ready-to-use, opinionated default: a free local Ollama tier under the three
14
+ * Claude tiers. Override `bindings.local.config.model` / `.kind` to point at
15
+ * cloud Ollama, OpenRouter, or any compatible endpoint.
16
+ */
17
+ export declare function defaultFreeTierLadder(model?: string): QeRoutingLadder;
18
+ /** Validate a ladder: every tier in `tierOrder` must have a binding, bounds must exist. */
19
+ export declare function validateLadder(ladder: QeRoutingLadder): void;
20
+ /**
21
+ * Build an `AutoEscalationTracker` over the ladder's string tiers. Agents start
22
+ * at the bottom (free) tier; consecutive failures escalate, successes de-escalate
23
+ * — bounded by min/maxTier. Reuses the unchanged, tested tracker engine.
24
+ */
25
+ export declare function createFreeTierEscalation(ladder: QeRoutingLadder): {
26
+ tracker: AutoEscalationTracker<string>;
27
+ baseTier: string;
28
+ };
29
+ export type ResolvedTier = {
30
+ provider: 'claude';
31
+ claudeTier: AgentTier;
32
+ } | {
33
+ provider: 'free-tier';
34
+ resolved: ResolvedFreeTierProvider;
35
+ };
36
+ /**
37
+ * Resolve a tier name to the concrete handler: either a Claude tier (for the
38
+ * existing router) or a fully-resolved free-tier provider (env key read here).
39
+ */
40
+ export declare function resolveTier(ladder: QeRoutingLadder, tier: string, env?: NodeJS.ProcessEnv): ResolvedTier;
41
+ //# sourceMappingURL=ladder.d.ts.map
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Free-tier escalation ladder (D7).
3
+ *
4
+ * Ties the configurable provider layer to the real `AutoEscalationTracker`:
5
+ * builds a tracker whose ladder starts at a FREE tier and escalates up the
6
+ * existing Claude tiers on failure (Ruv's Round-3 economics), and resolves any
7
+ * tier name to the concrete provider that should serve it.
8
+ */
9
+ import { AutoEscalationTracker } from '../escalation/auto-escalation-tracker.js';
10
+ import { resolveFreeTierProvider } from './provider.js';
11
+ /**
12
+ * A ready-to-use, opinionated default: a free local Ollama tier under the three
13
+ * Claude tiers. Override `bindings.local.config.model` / `.kind` to point at
14
+ * cloud Ollama, OpenRouter, or any compatible endpoint.
15
+ */
16
+ export function defaultFreeTierLadder(model = 'qwen3:8b') {
17
+ return {
18
+ tierOrder: ['local', 'haiku', 'sonnet', 'opus'],
19
+ minTier: 'local',
20
+ maxTier: 'opus',
21
+ escalateAfterFailures: 2,
22
+ deEscalateAfterSuccesses: 5,
23
+ bindings: {
24
+ local: { provider: 'free-tier', config: { kind: 'local-ollama', model } },
25
+ haiku: { provider: 'claude', claudeTier: 'haiku' },
26
+ sonnet: { provider: 'claude', claudeTier: 'sonnet' },
27
+ opus: { provider: 'claude', claudeTier: 'opus' },
28
+ },
29
+ };
30
+ }
31
+ /** Validate a ladder: every tier in `tierOrder` must have a binding, bounds must exist. */
32
+ export function validateLadder(ladder) {
33
+ if (ladder.tierOrder.length === 0)
34
+ throw new Error('free-tier ladder: tierOrder is empty');
35
+ for (const tier of ladder.tierOrder) {
36
+ if (!ladder.bindings[tier])
37
+ throw new Error(`free-tier ladder: no binding for tier "${tier}"`);
38
+ }
39
+ const min = ladder.minTier ?? ladder.tierOrder[0];
40
+ const max = ladder.maxTier ?? ladder.tierOrder[ladder.tierOrder.length - 1];
41
+ if (!ladder.tierOrder.includes(min))
42
+ throw new Error(`free-tier ladder: minTier "${min}" not in tierOrder`);
43
+ if (!ladder.tierOrder.includes(max))
44
+ throw new Error(`free-tier ladder: maxTier "${max}" not in tierOrder`);
45
+ if (ladder.tierOrder.indexOf(min) > ladder.tierOrder.indexOf(max)) {
46
+ throw new Error('free-tier ladder: minTier is above maxTier');
47
+ }
48
+ }
49
+ /**
50
+ * Build an `AutoEscalationTracker` over the ladder's string tiers. Agents start
51
+ * at the bottom (free) tier; consecutive failures escalate, successes de-escalate
52
+ * — bounded by min/maxTier. Reuses the unchanged, tested tracker engine.
53
+ */
54
+ export function createFreeTierEscalation(ladder) {
55
+ validateLadder(ladder);
56
+ const tracker = new AutoEscalationTracker({
57
+ tierOrder: ladder.tierOrder,
58
+ minTier: ladder.minTier ?? ladder.tierOrder[0],
59
+ maxTier: ladder.maxTier ?? ladder.tierOrder[ladder.tierOrder.length - 1],
60
+ escalateAfterFailures: ladder.escalateAfterFailures ?? 2,
61
+ deEscalateAfterSuccesses: ladder.deEscalateAfterSuccesses ?? 5,
62
+ });
63
+ return { tracker, baseTier: ladder.tierOrder[0] };
64
+ }
65
+ /**
66
+ * Resolve a tier name to the concrete handler: either a Claude tier (for the
67
+ * existing router) or a fully-resolved free-tier provider (env key read here).
68
+ */
69
+ export function resolveTier(ladder, tier, env = process.env) {
70
+ const binding = ladder.bindings[tier];
71
+ if (!binding)
72
+ throw new Error(`free-tier ladder: no binding for tier "${tier}"`);
73
+ if (binding.provider === 'claude') {
74
+ return { provider: 'claude', claudeTier: binding.claudeTier };
75
+ }
76
+ return { provider: 'free-tier', resolved: resolveFreeTierProvider(binding.config, env) };
77
+ }
78
+ //# sourceMappingURL=ladder.js.map
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Free-tier provider resolver + OpenAI-compatible chat (D7).
3
+ *
4
+ * Pure resolution (presets + env key) is split from the network call so the
5
+ * config logic is unit-testable without a server. The chat call targets the
6
+ * universal `/v1/chat/completions` shape (verified live against the M5 host
7
+ * Ollama on 2026-06-19) and is reasoning-model aware.
8
+ */
9
+ import type { FreeTierKind, FreeTierProviderConfig, ResolvedFreeTierProvider } from './types.js';
10
+ interface Preset {
11
+ baseUrl: string;
12
+ apiKeyEnv?: string;
13
+ /** True when this endpoint normally requires a key (→ missingKey flag). */
14
+ requiresKey: boolean;
15
+ }
16
+ /**
17
+ * Endpoint presets. `local-ollama` defaults to the Docker-Desktop host gateway
18
+ * (the M5 host) — override baseUrl to 'http://localhost:11434/v1' for a same-box
19
+ * Ollama. `openai-compatible` has no default URL (the caller must supply one).
20
+ */
21
+ export declare const FREE_TIER_PRESETS: Record<FreeTierKind, Preset>;
22
+ /**
23
+ * Merge a config with its preset, read the API key from the named env var, and
24
+ * produce a ready-to-call provider. Pure except for the single `process.env`
25
+ * read (injectable via `env` for testing). Throws only on a structural error
26
+ * (openai-compatible without a baseUrl); a missing key is flagged, not thrown,
27
+ * so the caller can decide (some local endpoints accept any/no key).
28
+ */
29
+ export declare function resolveFreeTierProvider(cfg: FreeTierProviderConfig, env?: NodeJS.ProcessEnv): ResolvedFreeTierProvider;
30
+ export interface ChatMessage {
31
+ role: 'system' | 'user' | 'assistant';
32
+ content: string;
33
+ }
34
+ export interface FreeTierChatResult {
35
+ ok: boolean;
36
+ /** Assistant text (answer channel only when contentOnly). Empty on failure. */
37
+ content: string;
38
+ /** Reasoning channel, when the model exposes one separately. */
39
+ reasoning?: string;
40
+ usage?: {
41
+ promptTokens?: number;
42
+ completionTokens?: number;
43
+ totalTokens?: number;
44
+ };
45
+ error?: string;
46
+ latencyMs: number;
47
+ }
48
+ /**
49
+ * One OpenAI-compatible chat completion. Never throws — a transport/timeout/HTTP
50
+ * error returns `{ ok:false, error }` so an escalation loop treats it as a tier
51
+ * failure (and escalates) rather than crashing.
52
+ */
53
+ export declare function freeTierChat(provider: ResolvedFreeTierProvider, messages: ChatMessage[]): Promise<FreeTierChatResult>;
54
+ /** Cheap liveness probe for a free-tier endpoint (Ollama /api/tags style or a tiny chat). */
55
+ export declare function freeTierHealth(provider: ResolvedFreeTierProvider): Promise<boolean>;
56
+ export {};
57
+ //# sourceMappingURL=provider.d.ts.map
@@ -0,0 +1,111 @@
1
+ /**
2
+ * Free-tier provider resolver + OpenAI-compatible chat (D7).
3
+ *
4
+ * Pure resolution (presets + env key) is split from the network call so the
5
+ * config logic is unit-testable without a server. The chat call targets the
6
+ * universal `/v1/chat/completions` shape (verified live against the M5 host
7
+ * Ollama on 2026-06-19) and is reasoning-model aware.
8
+ */
9
+ /**
10
+ * Endpoint presets. `local-ollama` defaults to the Docker-Desktop host gateway
11
+ * (the M5 host) — override baseUrl to 'http://localhost:11434/v1' for a same-box
12
+ * Ollama. `openai-compatible` has no default URL (the caller must supply one).
13
+ */
14
+ export const FREE_TIER_PRESETS = {
15
+ 'local-ollama': { baseUrl: 'http://host.docker.internal:11434/v1', requiresKey: false },
16
+ 'cloud-ollama': { baseUrl: 'https://ollama.com/v1', apiKeyEnv: 'OLLAMA_API_KEY', requiresKey: true },
17
+ openrouter: { baseUrl: 'https://openrouter.ai/api/v1', apiKeyEnv: 'OPENROUTER_API_KEY', requiresKey: true },
18
+ 'openai-compatible': { baseUrl: '', requiresKey: false },
19
+ };
20
+ /**
21
+ * Merge a config with its preset, read the API key from the named env var, and
22
+ * produce a ready-to-call provider. Pure except for the single `process.env`
23
+ * read (injectable via `env` for testing). Throws only on a structural error
24
+ * (openai-compatible without a baseUrl); a missing key is flagged, not thrown,
25
+ * so the caller can decide (some local endpoints accept any/no key).
26
+ */
27
+ export function resolveFreeTierProvider(cfg, env = process.env) {
28
+ const preset = FREE_TIER_PRESETS[cfg.kind];
29
+ if (!preset)
30
+ throw new Error(`free-tier: unknown provider kind "${cfg.kind}"`);
31
+ const baseUrl = (cfg.baseUrl ?? preset.baseUrl).replace(/\/$/, '');
32
+ if (!baseUrl) {
33
+ throw new Error(`free-tier: kind "${cfg.kind}" requires an explicit baseUrl`);
34
+ }
35
+ const keyEnvName = cfg.apiKeyEnv ?? preset.apiKeyEnv;
36
+ const apiKey = keyEnvName ? (env[keyEnvName] ?? '').trim() : '';
37
+ const headers = { 'Content-Type': 'application/json' };
38
+ if (apiKey)
39
+ headers.Authorization = `Bearer ${apiKey}`;
40
+ // OpenRouter etiquette headers (harmless elsewhere).
41
+ if (cfg.kind === 'openrouter') {
42
+ headers['HTTP-Referer'] = 'https://github.com/proffesor-for-testing/agentic-qe';
43
+ headers['X-Title'] = 'agentic-qe';
44
+ }
45
+ return {
46
+ kind: cfg.kind,
47
+ model: cfg.model,
48
+ baseUrl,
49
+ headers,
50
+ timeoutMs: cfg.timeoutMs ?? 120_000,
51
+ maxTokens: cfg.maxTokens ?? 2048,
52
+ temperature: cfg.temperature ?? 0.2,
53
+ contentOnly: cfg.contentOnly ?? true,
54
+ missingKey: preset.requiresKey && !apiKey,
55
+ };
56
+ }
57
+ /**
58
+ * One OpenAI-compatible chat completion. Never throws — a transport/timeout/HTTP
59
+ * error returns `{ ok:false, error }` so an escalation loop treats it as a tier
60
+ * failure (and escalates) rather than crashing.
61
+ */
62
+ export async function freeTierChat(provider, messages) {
63
+ const started = Date.now();
64
+ const controller = new AbortController();
65
+ const timer = setTimeout(() => controller.abort(), provider.timeoutMs);
66
+ try {
67
+ const res = await fetch(`${provider.baseUrl}/chat/completions`, {
68
+ method: 'POST',
69
+ headers: provider.headers,
70
+ body: JSON.stringify({
71
+ model: provider.model,
72
+ messages,
73
+ max_tokens: provider.maxTokens,
74
+ temperature: provider.temperature,
75
+ }),
76
+ signal: controller.signal,
77
+ });
78
+ if (!res.ok) {
79
+ const body = await res.text().catch(() => '');
80
+ return { ok: false, content: '', error: `HTTP ${res.status}: ${body.slice(0, 200)}`, latencyMs: Date.now() - started };
81
+ }
82
+ const j = (await res.json());
83
+ const msg = j.choices?.[0]?.message;
84
+ const content = (msg?.content ?? '').trim();
85
+ const reasoning = msg?.reasoning?.trim();
86
+ const text = provider.contentOnly || !reasoning ? content : `${reasoning}\n${content}`.trim();
87
+ return {
88
+ ok: text.length > 0,
89
+ content: text,
90
+ reasoning,
91
+ usage: j.usage
92
+ ? { promptTokens: j.usage.prompt_tokens, completionTokens: j.usage.completion_tokens, totalTokens: j.usage.total_tokens }
93
+ : undefined,
94
+ error: text.length === 0 ? 'empty content' : undefined,
95
+ latencyMs: Date.now() - started,
96
+ };
97
+ }
98
+ catch (e) {
99
+ return { ok: false, content: '', error: e.message, latencyMs: Date.now() - started };
100
+ }
101
+ finally {
102
+ clearTimeout(timer);
103
+ }
104
+ }
105
+ /** Cheap liveness probe for a free-tier endpoint (Ollama /api/tags style or a tiny chat). */
106
+ export async function freeTierHealth(provider) {
107
+ const r = await freeTierChat(provider, [{ role: 'user', content: 'ping' }]);
108
+ // A transport success (ok OR an "empty content" non-error reply) counts as alive.
109
+ return r.ok || r.error === 'empty content';
110
+ }
111
+ //# sourceMappingURL=provider.js.map