olympus-ai 1.0.0

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 (573) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +691 -0
  3. package/dist/__tests__/example.test.d.ts +2 -0
  4. package/dist/__tests__/example.test.d.ts.map +1 -0
  5. package/dist/__tests__/example.test.js +20 -0
  6. package/dist/__tests__/example.test.js.map +1 -0
  7. package/dist/__tests__/hooks.test.d.ts +2 -0
  8. package/dist/__tests__/hooks.test.d.ts.map +1 -0
  9. package/dist/__tests__/hooks.test.js +644 -0
  10. package/dist/__tests__/hooks.test.js.map +1 -0
  11. package/dist/__tests__/installer.test.d.ts +2 -0
  12. package/dist/__tests__/installer.test.d.ts.map +1 -0
  13. package/dist/__tests__/installer.test.js +369 -0
  14. package/dist/__tests__/installer.test.js.map +1 -0
  15. package/dist/__tests__/model-routing.test.d.ts +2 -0
  16. package/dist/__tests__/model-routing.test.d.ts.map +1 -0
  17. package/dist/__tests__/model-routing.test.js +814 -0
  18. package/dist/__tests__/model-routing.test.js.map +1 -0
  19. package/dist/__tests__/skills.test.d.ts +2 -0
  20. package/dist/__tests__/skills.test.d.ts.map +1 -0
  21. package/dist/__tests__/skills.test.js +126 -0
  22. package/dist/__tests__/skills.test.js.map +1 -0
  23. package/dist/__tests__/types.test.d.ts +2 -0
  24. package/dist/__tests__/types.test.d.ts.map +1 -0
  25. package/dist/__tests__/types.test.js +77 -0
  26. package/dist/__tests__/types.test.js.map +1 -0
  27. package/dist/agents/definitions.d.ts +105 -0
  28. package/dist/agents/definitions.d.ts.map +1 -0
  29. package/dist/agents/definitions.js +1379 -0
  30. package/dist/agents/definitions.js.map +1 -0
  31. package/dist/agents/document-writer.d.ts +11 -0
  32. package/dist/agents/document-writer.d.ts.map +1 -0
  33. package/dist/agents/document-writer.js +209 -0
  34. package/dist/agents/document-writer.js.map +1 -0
  35. package/dist/agents/explore.d.ts +12 -0
  36. package/dist/agents/explore.d.ts.map +1 -0
  37. package/dist/agents/explore.js +103 -0
  38. package/dist/agents/explore.js.map +1 -0
  39. package/dist/agents/frontend-engineer.d.ts +11 -0
  40. package/dist/agents/frontend-engineer.d.ts.map +1 -0
  41. package/dist/agents/frontend-engineer.js +115 -0
  42. package/dist/agents/frontend-engineer.js.map +1 -0
  43. package/dist/agents/index.d.ts +21 -0
  44. package/dist/agents/index.d.ts.map +1 -0
  45. package/dist/agents/index.js +27 -0
  46. package/dist/agents/index.js.map +1 -0
  47. package/dist/agents/librarian.d.ts +12 -0
  48. package/dist/agents/librarian.d.ts.map +1 -0
  49. package/dist/agents/librarian.js +103 -0
  50. package/dist/agents/librarian.js.map +1 -0
  51. package/dist/agents/metis.d.ts +12 -0
  52. package/dist/agents/metis.d.ts.map +1 -0
  53. package/dist/agents/metis.js +117 -0
  54. package/dist/agents/metis.js.map +1 -0
  55. package/dist/agents/momus.d.ts +12 -0
  56. package/dist/agents/momus.d.ts.map +1 -0
  57. package/dist/agents/momus.js +128 -0
  58. package/dist/agents/momus.js.map +1 -0
  59. package/dist/agents/multimodal-looker.d.ts +11 -0
  60. package/dist/agents/multimodal-looker.d.ts.map +1 -0
  61. package/dist/agents/multimodal-looker.js +70 -0
  62. package/dist/agents/multimodal-looker.js.map +1 -0
  63. package/dist/agents/olympian.d.ts +12 -0
  64. package/dist/agents/olympian.d.ts.map +1 -0
  65. package/dist/agents/olympian.js +93 -0
  66. package/dist/agents/olympian.js.map +1 -0
  67. package/dist/agents/oracle.d.ts +13 -0
  68. package/dist/agents/oracle.d.ts.map +1 -0
  69. package/dist/agents/oracle.js +191 -0
  70. package/dist/agents/oracle.js.map +1 -0
  71. package/dist/agents/orchestrator-olympus.d.ts +11 -0
  72. package/dist/agents/orchestrator-olympus.d.ts.map +1 -0
  73. package/dist/agents/orchestrator-olympus.js +115 -0
  74. package/dist/agents/orchestrator-olympus.js.map +1 -0
  75. package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
  76. package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
  77. package/dist/agents/orchestrator-sisyphus.js +115 -0
  78. package/dist/agents/orchestrator-sisyphus.js.map +1 -0
  79. package/dist/agents/prometheus.d.ts +12 -0
  80. package/dist/agents/prometheus.d.ts.map +1 -0
  81. package/dist/agents/prometheus.js +156 -0
  82. package/dist/agents/prometheus.js.map +1 -0
  83. package/dist/agents/qa-tester.d.ts +16 -0
  84. package/dist/agents/qa-tester.d.ts.map +1 -0
  85. package/dist/agents/qa-tester.js +367 -0
  86. package/dist/agents/qa-tester.js.map +1 -0
  87. package/dist/agents/sisyphus-junior.d.ts +12 -0
  88. package/dist/agents/sisyphus-junior.d.ts.map +1 -0
  89. package/dist/agents/sisyphus-junior.js +93 -0
  90. package/dist/agents/sisyphus-junior.js.map +1 -0
  91. package/dist/agents/types.d.ts +120 -0
  92. package/dist/agents/types.d.ts.map +1 -0
  93. package/dist/agents/types.js +38 -0
  94. package/dist/agents/types.js.map +1 -0
  95. package/dist/agents/utils.d.ts +49 -0
  96. package/dist/agents/utils.d.ts.map +1 -0
  97. package/dist/agents/utils.js +164 -0
  98. package/dist/agents/utils.js.map +1 -0
  99. package/dist/cli/index.d.ts +13 -0
  100. package/dist/cli/index.d.ts.map +1 -0
  101. package/dist/cli/index.js +496 -0
  102. package/dist/cli/index.js.map +1 -0
  103. package/dist/commands/index.d.ts +78 -0
  104. package/dist/commands/index.d.ts.map +1 -0
  105. package/dist/commands/index.js +148 -0
  106. package/dist/commands/index.js.map +1 -0
  107. package/dist/config/index.d.ts +5 -0
  108. package/dist/config/index.d.ts.map +1 -0
  109. package/dist/config/index.js +5 -0
  110. package/dist/config/index.js.map +1 -0
  111. package/dist/config/loader.d.ts +49 -0
  112. package/dist/config/loader.d.ts.map +1 -0
  113. package/dist/config/loader.js +380 -0
  114. package/dist/config/loader.js.map +1 -0
  115. package/dist/features/auto-update.d.ts +187 -0
  116. package/dist/features/auto-update.d.ts.map +1 -0
  117. package/dist/features/auto-update.js +539 -0
  118. package/dist/features/auto-update.js.map +1 -0
  119. package/dist/features/background-agent/concurrency.d.ts +53 -0
  120. package/dist/features/background-agent/concurrency.d.ts.map +1 -0
  121. package/dist/features/background-agent/concurrency.js +121 -0
  122. package/dist/features/background-agent/concurrency.js.map +1 -0
  123. package/dist/features/background-agent/index.d.ts +12 -0
  124. package/dist/features/background-agent/index.d.ts.map +1 -0
  125. package/dist/features/background-agent/index.js +12 -0
  126. package/dist/features/background-agent/index.js.map +1 -0
  127. package/dist/features/background-agent/manager.d.ts +134 -0
  128. package/dist/features/background-agent/manager.d.ts.map +1 -0
  129. package/dist/features/background-agent/manager.js +412 -0
  130. package/dist/features/background-agent/manager.js.map +1 -0
  131. package/dist/features/background-agent/types.d.ts +99 -0
  132. package/dist/features/background-agent/types.d.ts.map +1 -0
  133. package/dist/features/background-agent/types.js +9 -0
  134. package/dist/features/background-agent/types.js.map +1 -0
  135. package/dist/features/background-tasks.d.ts +99 -0
  136. package/dist/features/background-tasks.d.ts.map +1 -0
  137. package/dist/features/background-tasks.js +265 -0
  138. package/dist/features/background-tasks.js.map +1 -0
  139. package/dist/features/boulder-state/constants.d.ts +20 -0
  140. package/dist/features/boulder-state/constants.d.ts.map +1 -0
  141. package/dist/features/boulder-state/constants.js +20 -0
  142. package/dist/features/boulder-state/constants.js.map +1 -0
  143. package/dist/features/boulder-state/index.d.ts +12 -0
  144. package/dist/features/boulder-state/index.d.ts.map +1 -0
  145. package/dist/features/boulder-state/index.js +13 -0
  146. package/dist/features/boulder-state/index.js.map +1 -0
  147. package/dist/features/boulder-state/storage.d.ts +58 -0
  148. package/dist/features/boulder-state/storage.d.ts.map +1 -0
  149. package/dist/features/boulder-state/storage.js +174 -0
  150. package/dist/features/boulder-state/storage.js.map +1 -0
  151. package/dist/features/boulder-state/types.d.ts +48 -0
  152. package/dist/features/boulder-state/types.d.ts.map +1 -0
  153. package/dist/features/boulder-state/types.js +10 -0
  154. package/dist/features/boulder-state/types.js.map +1 -0
  155. package/dist/features/builtin-skills/index.d.ts +10 -0
  156. package/dist/features/builtin-skills/index.d.ts.map +1 -0
  157. package/dist/features/builtin-skills/index.js +10 -0
  158. package/dist/features/builtin-skills/index.js.map +1 -0
  159. package/dist/features/builtin-skills/skills.d.ts +21 -0
  160. package/dist/features/builtin-skills/skills.d.ts.map +1 -0
  161. package/dist/features/builtin-skills/skills.js +1082 -0
  162. package/dist/features/builtin-skills/skills.js.map +1 -0
  163. package/dist/features/builtin-skills/types.d.ts +60 -0
  164. package/dist/features/builtin-skills/types.d.ts.map +1 -0
  165. package/dist/features/builtin-skills/types.js +9 -0
  166. package/dist/features/builtin-skills/types.js.map +1 -0
  167. package/dist/features/context-injector/collector.d.ts +56 -0
  168. package/dist/features/context-injector/collector.d.ts.map +1 -0
  169. package/dist/features/context-injector/collector.js +122 -0
  170. package/dist/features/context-injector/collector.js.map +1 -0
  171. package/dist/features/context-injector/index.d.ts +12 -0
  172. package/dist/features/context-injector/index.d.ts.map +1 -0
  173. package/dist/features/context-injector/index.js +13 -0
  174. package/dist/features/context-injector/index.js.map +1 -0
  175. package/dist/features/context-injector/injector.d.ts +47 -0
  176. package/dist/features/context-injector/injector.d.ts.map +1 -0
  177. package/dist/features/context-injector/injector.js +103 -0
  178. package/dist/features/context-injector/injector.js.map +1 -0
  179. package/dist/features/context-injector/types.d.ts +103 -0
  180. package/dist/features/context-injector/types.d.ts.map +1 -0
  181. package/dist/features/context-injector/types.js +11 -0
  182. package/dist/features/context-injector/types.js.map +1 -0
  183. package/dist/features/continuation-enforcement.d.ts +36 -0
  184. package/dist/features/continuation-enforcement.d.ts.map +1 -0
  185. package/dist/features/continuation-enforcement.js +175 -0
  186. package/dist/features/continuation-enforcement.js.map +1 -0
  187. package/dist/features/index.d.ts +12 -0
  188. package/dist/features/index.d.ts.map +1 -0
  189. package/dist/features/index.js +49 -0
  190. package/dist/features/index.js.map +1 -0
  191. package/dist/features/magic-keywords.d.ts +28 -0
  192. package/dist/features/magic-keywords.d.ts.map +1 -0
  193. package/dist/features/magic-keywords.js +421 -0
  194. package/dist/features/magic-keywords.js.map +1 -0
  195. package/dist/features/model-routing/index.d.ts +34 -0
  196. package/dist/features/model-routing/index.d.ts.map +1 -0
  197. package/dist/features/model-routing/index.js +48 -0
  198. package/dist/features/model-routing/index.js.map +1 -0
  199. package/dist/features/model-routing/prompts/haiku.d.ts +54 -0
  200. package/dist/features/model-routing/prompts/haiku.d.ts.map +1 -0
  201. package/dist/features/model-routing/prompts/haiku.js +141 -0
  202. package/dist/features/model-routing/prompts/haiku.js.map +1 -0
  203. package/dist/features/model-routing/prompts/index.d.ts +45 -0
  204. package/dist/features/model-routing/prompts/index.d.ts.map +1 -0
  205. package/dist/features/model-routing/prompts/index.js +116 -0
  206. package/dist/features/model-routing/prompts/index.js.map +1 -0
  207. package/dist/features/model-routing/prompts/opus.d.ts +34 -0
  208. package/dist/features/model-routing/prompts/opus.d.ts.map +1 -0
  209. package/dist/features/model-routing/prompts/opus.js +153 -0
  210. package/dist/features/model-routing/prompts/opus.js.map +1 -0
  211. package/dist/features/model-routing/prompts/sonnet.d.ts +38 -0
  212. package/dist/features/model-routing/prompts/sonnet.d.ts.map +1 -0
  213. package/dist/features/model-routing/prompts/sonnet.js +149 -0
  214. package/dist/features/model-routing/prompts/sonnet.js.map +1 -0
  215. package/dist/features/model-routing/router.d.ts +92 -0
  216. package/dist/features/model-routing/router.d.ts.map +1 -0
  217. package/dist/features/model-routing/router.js +267 -0
  218. package/dist/features/model-routing/router.js.map +1 -0
  219. package/dist/features/model-routing/rules.d.ts +32 -0
  220. package/dist/features/model-routing/rules.d.ts.map +1 -0
  221. package/dist/features/model-routing/rules.js +224 -0
  222. package/dist/features/model-routing/rules.js.map +1 -0
  223. package/dist/features/model-routing/scorer.d.ts +35 -0
  224. package/dist/features/model-routing/scorer.d.ts.map +1 -0
  225. package/dist/features/model-routing/scorer.js +241 -0
  226. package/dist/features/model-routing/scorer.js.map +1 -0
  227. package/dist/features/model-routing/signals.d.ts +26 -0
  228. package/dist/features/model-routing/signals.d.ts.map +1 -0
  229. package/dist/features/model-routing/signals.js +283 -0
  230. package/dist/features/model-routing/signals.js.map +1 -0
  231. package/dist/features/model-routing/types.d.ts +195 -0
  232. package/dist/features/model-routing/types.d.ts.map +1 -0
  233. package/dist/features/model-routing/types.js +86 -0
  234. package/dist/features/model-routing/types.js.map +1 -0
  235. package/dist/hooks/agent-usage-reminder/constants.d.ts +17 -0
  236. package/dist/hooks/agent-usage-reminder/constants.d.ts.map +1 -0
  237. package/dist/hooks/agent-usage-reminder/constants.js +58 -0
  238. package/dist/hooks/agent-usage-reminder/constants.js.map +1 -0
  239. package/dist/hooks/agent-usage-reminder/index.d.ts +36 -0
  240. package/dist/hooks/agent-usage-reminder/index.d.ts.map +1 -0
  241. package/dist/hooks/agent-usage-reminder/index.js +89 -0
  242. package/dist/hooks/agent-usage-reminder/index.js.map +1 -0
  243. package/dist/hooks/agent-usage-reminder/storage.d.ts +12 -0
  244. package/dist/hooks/agent-usage-reminder/storage.d.ts.map +1 -0
  245. package/dist/hooks/agent-usage-reminder/storage.js +39 -0
  246. package/dist/hooks/agent-usage-reminder/storage.js.map +1 -0
  247. package/dist/hooks/agent-usage-reminder/types.d.ts +14 -0
  248. package/dist/hooks/agent-usage-reminder/types.d.ts.map +1 -0
  249. package/dist/hooks/agent-usage-reminder/types.js +9 -0
  250. package/dist/hooks/agent-usage-reminder/types.js.map +1 -0
  251. package/dist/hooks/ascent-verifier/index.d.ts +72 -0
  252. package/dist/hooks/ascent-verifier/index.d.ts.map +1 -0
  253. package/dist/hooks/ascent-verifier/index.js +223 -0
  254. package/dist/hooks/ascent-verifier/index.js.map +1 -0
  255. package/dist/hooks/auto-slash-command/constants.d.ts +19 -0
  256. package/dist/hooks/auto-slash-command/constants.d.ts.map +1 -0
  257. package/dist/hooks/auto-slash-command/constants.js +28 -0
  258. package/dist/hooks/auto-slash-command/constants.js.map +1 -0
  259. package/dist/hooks/auto-slash-command/detector.d.ts +33 -0
  260. package/dist/hooks/auto-slash-command/detector.d.ts.map +1 -0
  261. package/dist/hooks/auto-slash-command/detector.js +73 -0
  262. package/dist/hooks/auto-slash-command/detector.js.map +1 -0
  263. package/dist/hooks/auto-slash-command/executor.d.ts +29 -0
  264. package/dist/hooks/auto-slash-command/executor.d.ts.map +1 -0
  265. package/dist/hooks/auto-slash-command/executor.js +214 -0
  266. package/dist/hooks/auto-slash-command/executor.js.map +1 -0
  267. package/dist/hooks/auto-slash-command/index.d.ts +53 -0
  268. package/dist/hooks/auto-slash-command/index.d.ts.map +1 -0
  269. package/dist/hooks/auto-slash-command/index.js +105 -0
  270. package/dist/hooks/auto-slash-command/index.js.map +1 -0
  271. package/dist/hooks/auto-slash-command/types.d.ts +77 -0
  272. package/dist/hooks/auto-slash-command/types.d.ts.map +1 -0
  273. package/dist/hooks/auto-slash-command/types.js +9 -0
  274. package/dist/hooks/auto-slash-command/types.js.map +1 -0
  275. package/dist/hooks/background-notification/index.d.ts +60 -0
  276. package/dist/hooks/background-notification/index.d.ts.map +1 -0
  277. package/dist/hooks/background-notification/index.js +180 -0
  278. package/dist/hooks/background-notification/index.js.map +1 -0
  279. package/dist/hooks/background-notification/types.d.ts +64 -0
  280. package/dist/hooks/background-notification/types.d.ts.map +1 -0
  281. package/dist/hooks/background-notification/types.js +8 -0
  282. package/dist/hooks/background-notification/types.js.map +1 -0
  283. package/dist/hooks/bridge.d.ts +68 -0
  284. package/dist/hooks/bridge.d.ts.map +1 -0
  285. package/dist/hooks/bridge.js +321 -0
  286. package/dist/hooks/bridge.js.map +1 -0
  287. package/dist/hooks/comment-checker/constants.d.ts +28 -0
  288. package/dist/hooks/comment-checker/constants.d.ts.map +1 -0
  289. package/dist/hooks/comment-checker/constants.js +189 -0
  290. package/dist/hooks/comment-checker/constants.js.map +1 -0
  291. package/dist/hooks/comment-checker/filters.d.ts +39 -0
  292. package/dist/hooks/comment-checker/filters.d.ts.map +1 -0
  293. package/dist/hooks/comment-checker/filters.js +126 -0
  294. package/dist/hooks/comment-checker/filters.js.map +1 -0
  295. package/dist/hooks/comment-checker/index.d.ts +58 -0
  296. package/dist/hooks/comment-checker/index.d.ts.map +1 -0
  297. package/dist/hooks/comment-checker/index.js +298 -0
  298. package/dist/hooks/comment-checker/index.js.map +1 -0
  299. package/dist/hooks/comment-checker/types.d.ts +88 -0
  300. package/dist/hooks/comment-checker/types.d.ts.map +1 -0
  301. package/dist/hooks/comment-checker/types.js +9 -0
  302. package/dist/hooks/comment-checker/types.js.map +1 -0
  303. package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
  304. package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
  305. package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
  306. package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
  307. package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
  308. package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
  309. package/dist/hooks/context-window-limit-recovery/index.js +201 -0
  310. package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
  311. package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
  312. package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
  313. package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
  314. package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
  315. package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
  316. package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
  317. package/dist/hooks/context-window-limit-recovery/types.js +34 -0
  318. package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
  319. package/dist/hooks/directory-readme-injector/constants.d.ts +15 -0
  320. package/dist/hooks/directory-readme-injector/constants.d.ts.map +1 -0
  321. package/dist/hooks/directory-readme-injector/constants.js +17 -0
  322. package/dist/hooks/directory-readme-injector/constants.js.map +1 -0
  323. package/dist/hooks/directory-readme-injector/index.d.ts +41 -0
  324. package/dist/hooks/directory-readme-injector/index.d.ts.map +1 -0
  325. package/dist/hooks/directory-readme-injector/index.js +162 -0
  326. package/dist/hooks/directory-readme-injector/index.js.map +1 -0
  327. package/dist/hooks/directory-readme-injector/storage.d.ts +20 -0
  328. package/dist/hooks/directory-readme-injector/storage.d.ts.map +1 -0
  329. package/dist/hooks/directory-readme-injector/storage.js +56 -0
  330. package/dist/hooks/directory-readme-injector/storage.js.map +1 -0
  331. package/dist/hooks/directory-readme-injector/types.d.ts +20 -0
  332. package/dist/hooks/directory-readme-injector/types.d.ts.map +1 -0
  333. package/dist/hooks/directory-readme-injector/types.js +9 -0
  334. package/dist/hooks/directory-readme-injector/types.js.map +1 -0
  335. package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
  336. package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
  337. package/dist/hooks/edit-error-recovery/index.js +89 -0
  338. package/dist/hooks/edit-error-recovery/index.js.map +1 -0
  339. package/dist/hooks/empty-message-sanitizer/constants.d.ts +33 -0
  340. package/dist/hooks/empty-message-sanitizer/constants.d.ts.map +1 -0
  341. package/dist/hooks/empty-message-sanitizer/constants.js +37 -0
  342. package/dist/hooks/empty-message-sanitizer/constants.js.map +1 -0
  343. package/dist/hooks/empty-message-sanitizer/index.d.ts +59 -0
  344. package/dist/hooks/empty-message-sanitizer/index.d.ts.map +1 -0
  345. package/dist/hooks/empty-message-sanitizer/index.js +171 -0
  346. package/dist/hooks/empty-message-sanitizer/index.js.map +1 -0
  347. package/dist/hooks/empty-message-sanitizer/types.d.ts +79 -0
  348. package/dist/hooks/empty-message-sanitizer/types.d.ts.map +1 -0
  349. package/dist/hooks/empty-message-sanitizer/types.js +10 -0
  350. package/dist/hooks/empty-message-sanitizer/types.js.map +1 -0
  351. package/dist/hooks/index.d.ts +35 -0
  352. package/dist/hooks/index.d.ts.map +1 -0
  353. package/dist/hooks/index.js +81 -0
  354. package/dist/hooks/index.js.map +1 -0
  355. package/dist/hooks/keyword-detector/index.d.ts +40 -0
  356. package/dist/hooks/keyword-detector/index.d.ts.map +1 -0
  357. package/dist/hooks/keyword-detector/index.js +88 -0
  358. package/dist/hooks/keyword-detector/index.js.map +1 -0
  359. package/dist/hooks/non-interactive-env/constants.d.ts +35 -0
  360. package/dist/hooks/non-interactive-env/constants.d.ts.map +1 -0
  361. package/dist/hooks/non-interactive-env/constants.js +69 -0
  362. package/dist/hooks/non-interactive-env/constants.js.map +1 -0
  363. package/dist/hooks/non-interactive-env/detector.d.ts +2 -0
  364. package/dist/hooks/non-interactive-env/detector.d.ts.map +1 -0
  365. package/dist/hooks/non-interactive-env/detector.js +16 -0
  366. package/dist/hooks/non-interactive-env/detector.js.map +1 -0
  367. package/dist/hooks/non-interactive-env/index.d.ts +14 -0
  368. package/dist/hooks/non-interactive-env/index.d.ts.map +1 -0
  369. package/dist/hooks/non-interactive-env/index.js +72 -0
  370. package/dist/hooks/non-interactive-env/index.js.map +1 -0
  371. package/dist/hooks/non-interactive-env/types.d.ts +14 -0
  372. package/dist/hooks/non-interactive-env/types.d.ts.map +1 -0
  373. package/dist/hooks/non-interactive-env/types.js +2 -0
  374. package/dist/hooks/non-interactive-env/types.js.map +1 -0
  375. package/dist/hooks/olympus-orchestrator/constants.d.ts +23 -0
  376. package/dist/hooks/olympus-orchestrator/constants.d.ts.map +1 -0
  377. package/dist/hooks/olympus-orchestrator/constants.js +142 -0
  378. package/dist/hooks/olympus-orchestrator/constants.js.map +1 -0
  379. package/dist/hooks/olympus-orchestrator/index.d.ts +113 -0
  380. package/dist/hooks/olympus-orchestrator/index.d.ts.map +1 -0
  381. package/dist/hooks/olympus-orchestrator/index.js +283 -0
  382. package/dist/hooks/olympus-orchestrator/index.js.map +1 -0
  383. package/dist/hooks/persistent-mode/index.d.ts +40 -0
  384. package/dist/hooks/persistent-mode/index.d.ts.map +1 -0
  385. package/dist/hooks/persistent-mode/index.js +322 -0
  386. package/dist/hooks/persistent-mode/index.js.map +1 -0
  387. package/dist/hooks/plugin-patterns/index.d.ts +107 -0
  388. package/dist/hooks/plugin-patterns/index.d.ts.map +1 -0
  389. package/dist/hooks/plugin-patterns/index.js +289 -0
  390. package/dist/hooks/plugin-patterns/index.js.map +1 -0
  391. package/dist/hooks/preemptive-compaction/constants.d.ts +48 -0
  392. package/dist/hooks/preemptive-compaction/constants.d.ts.map +1 -0
  393. package/dist/hooks/preemptive-compaction/constants.js +90 -0
  394. package/dist/hooks/preemptive-compaction/constants.js.map +1 -0
  395. package/dist/hooks/preemptive-compaction/index.d.ts +55 -0
  396. package/dist/hooks/preemptive-compaction/index.d.ts.map +1 -0
  397. package/dist/hooks/preemptive-compaction/index.js +227 -0
  398. package/dist/hooks/preemptive-compaction/index.js.map +1 -0
  399. package/dist/hooks/preemptive-compaction/types.d.ts +76 -0
  400. package/dist/hooks/preemptive-compaction/types.d.ts.map +1 -0
  401. package/dist/hooks/preemptive-compaction/types.js +9 -0
  402. package/dist/hooks/preemptive-compaction/types.js.map +1 -0
  403. package/dist/hooks/ralph-loop/index.d.ts +60 -0
  404. package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
  405. package/dist/hooks/ralph-loop/index.js +155 -0
  406. package/dist/hooks/ralph-loop/index.js.map +1 -0
  407. package/dist/hooks/ralph-verifier/index.d.ts +72 -0
  408. package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
  409. package/dist/hooks/ralph-verifier/index.js +223 -0
  410. package/dist/hooks/ralph-verifier/index.js.map +1 -0
  411. package/dist/hooks/rules-injector/constants.d.ts +25 -0
  412. package/dist/hooks/rules-injector/constants.d.ts.map +1 -0
  413. package/dist/hooks/rules-injector/constants.js +40 -0
  414. package/dist/hooks/rules-injector/constants.js.map +1 -0
  415. package/dist/hooks/rules-injector/finder.d.ts +24 -0
  416. package/dist/hooks/rules-injector/finder.d.ts.map +1 -0
  417. package/dist/hooks/rules-injector/finder.js +215 -0
  418. package/dist/hooks/rules-injector/finder.js.map +1 -0
  419. package/dist/hooks/rules-injector/index.d.ts +45 -0
  420. package/dist/hooks/rules-injector/index.d.ts.map +1 -0
  421. package/dist/hooks/rules-injector/index.js +187 -0
  422. package/dist/hooks/rules-injector/index.js.map +1 -0
  423. package/dist/hooks/rules-injector/matcher.d.ts +25 -0
  424. package/dist/hooks/rules-injector/matcher.d.ts.map +1 -0
  425. package/dist/hooks/rules-injector/matcher.js +70 -0
  426. package/dist/hooks/rules-injector/matcher.js.map +1 -0
  427. package/dist/hooks/rules-injector/parser.d.ts +20 -0
  428. package/dist/hooks/rules-injector/parser.d.ts.map +1 -0
  429. package/dist/hooks/rules-injector/parser.js +179 -0
  430. package/dist/hooks/rules-injector/parser.js.map +1 -0
  431. package/dist/hooks/rules-injector/storage.d.ts +26 -0
  432. package/dist/hooks/rules-injector/storage.d.ts.map +1 -0
  433. package/dist/hooks/rules-injector/storage.js +61 -0
  434. package/dist/hooks/rules-injector/storage.js.map +1 -0
  435. package/dist/hooks/rules-injector/types.d.ts +101 -0
  436. package/dist/hooks/rules-injector/types.d.ts.map +1 -0
  437. package/dist/hooks/rules-injector/types.js +10 -0
  438. package/dist/hooks/rules-injector/types.js.map +1 -0
  439. package/dist/hooks/session-recovery/constants.d.ts +56 -0
  440. package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
  441. package/dist/hooks/session-recovery/constants.js +78 -0
  442. package/dist/hooks/session-recovery/constants.js.map +1 -0
  443. package/dist/hooks/session-recovery/index.d.ts +53 -0
  444. package/dist/hooks/session-recovery/index.d.ts.map +1 -0
  445. package/dist/hooks/session-recovery/index.js +321 -0
  446. package/dist/hooks/session-recovery/index.js.map +1 -0
  447. package/dist/hooks/session-recovery/storage.d.ts +76 -0
  448. package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
  449. package/dist/hooks/session-recovery/storage.js +383 -0
  450. package/dist/hooks/session-recovery/storage.js.map +1 -0
  451. package/dist/hooks/session-recovery/types.d.ts +145 -0
  452. package/dist/hooks/session-recovery/types.d.ts.map +1 -0
  453. package/dist/hooks/session-recovery/types.js +8 -0
  454. package/dist/hooks/session-recovery/types.js.map +1 -0
  455. package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
  456. package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
  457. package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
  458. package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
  459. package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
  460. package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
  461. package/dist/hooks/sisyphus-orchestrator/index.js +283 -0
  462. package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
  463. package/dist/hooks/the-ascent/index.d.ts +60 -0
  464. package/dist/hooks/the-ascent/index.d.ts.map +1 -0
  465. package/dist/hooks/the-ascent/index.js +155 -0
  466. package/dist/hooks/the-ascent/index.js.map +1 -0
  467. package/dist/hooks/think-mode/detector.d.ts +28 -0
  468. package/dist/hooks/think-mode/detector.d.ts.map +1 -0
  469. package/dist/hooks/think-mode/detector.js +105 -0
  470. package/dist/hooks/think-mode/detector.js.map +1 -0
  471. package/dist/hooks/think-mode/index.d.ts +70 -0
  472. package/dist/hooks/think-mode/index.d.ts.map +1 -0
  473. package/dist/hooks/think-mode/index.js +144 -0
  474. package/dist/hooks/think-mode/index.js.map +1 -0
  475. package/dist/hooks/think-mode/switcher.d.ts +39 -0
  476. package/dist/hooks/think-mode/switcher.d.ts.map +1 -0
  477. package/dist/hooks/think-mode/switcher.js +180 -0
  478. package/dist/hooks/think-mode/switcher.js.map +1 -0
  479. package/dist/hooks/think-mode/types.d.ts +60 -0
  480. package/dist/hooks/think-mode/types.d.ts.map +1 -0
  481. package/dist/hooks/think-mode/types.js +9 -0
  482. package/dist/hooks/think-mode/types.js.map +1 -0
  483. package/dist/hooks/thinking-block-validator/constants.d.ts +37 -0
  484. package/dist/hooks/thinking-block-validator/constants.d.ts.map +1 -0
  485. package/dist/hooks/thinking-block-validator/constants.js +50 -0
  486. package/dist/hooks/thinking-block-validator/constants.js.map +1 -0
  487. package/dist/hooks/thinking-block-validator/index.d.ts +35 -0
  488. package/dist/hooks/thinking-block-validator/index.d.ts.map +1 -0
  489. package/dist/hooks/thinking-block-validator/index.js +156 -0
  490. package/dist/hooks/thinking-block-validator/index.js.map +1 -0
  491. package/dist/hooks/thinking-block-validator/types.d.ts +67 -0
  492. package/dist/hooks/thinking-block-validator/types.d.ts.map +1 -0
  493. package/dist/hooks/thinking-block-validator/types.js +9 -0
  494. package/dist/hooks/thinking-block-validator/types.js.map +1 -0
  495. package/dist/hooks/todo-continuation/index.d.ts +39 -0
  496. package/dist/hooks/todo-continuation/index.d.ts.map +1 -0
  497. package/dist/hooks/todo-continuation/index.js +140 -0
  498. package/dist/hooks/todo-continuation/index.js.map +1 -0
  499. package/dist/hooks/ultrawork-state/index.d.ts +60 -0
  500. package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
  501. package/dist/hooks/ultrawork-state/index.js +207 -0
  502. package/dist/hooks/ultrawork-state/index.js.map +1 -0
  503. package/dist/index.d.ts +117 -0
  504. package/dist/index.d.ts.map +1 -0
  505. package/dist/index.js +175 -0
  506. package/dist/index.js.map +1 -0
  507. package/dist/installer/hooks.d.ts +196 -0
  508. package/dist/installer/hooks.d.ts.map +1 -0
  509. package/dist/installer/hooks.js +1385 -0
  510. package/dist/installer/hooks.js.map +1 -0
  511. package/dist/installer/index.d.ts +92 -0
  512. package/dist/installer/index.d.ts.map +1 -0
  513. package/dist/installer/index.js +2249 -0
  514. package/dist/installer/index.js.map +1 -0
  515. package/dist/mcp/index.d.ts +6 -0
  516. package/dist/mcp/index.d.ts.map +1 -0
  517. package/dist/mcp/index.js +5 -0
  518. package/dist/mcp/index.js.map +1 -0
  519. package/dist/mcp/servers.d.ts +77 -0
  520. package/dist/mcp/servers.d.ts.map +1 -0
  521. package/dist/mcp/servers.js +122 -0
  522. package/dist/mcp/servers.js.map +1 -0
  523. package/dist/shared/index.d.ts +5 -0
  524. package/dist/shared/index.d.ts.map +1 -0
  525. package/dist/shared/index.js +5 -0
  526. package/dist/shared/index.js.map +1 -0
  527. package/dist/shared/types.d.ts +159 -0
  528. package/dist/shared/types.d.ts.map +1 -0
  529. package/dist/shared/types.js +5 -0
  530. package/dist/shared/types.js.map +1 -0
  531. package/dist/tools/ast-tools.d.ts +63 -0
  532. package/dist/tools/ast-tools.d.ts.map +1 -0
  533. package/dist/tools/ast-tools.js +450 -0
  534. package/dist/tools/ast-tools.js.map +1 -0
  535. package/dist/tools/index.d.ts +52 -0
  536. package/dist/tools/index.d.ts.map +1 -0
  537. package/dist/tools/index.js +120 -0
  538. package/dist/tools/index.js.map +1 -0
  539. package/dist/tools/lsp/client.d.ts +201 -0
  540. package/dist/tools/lsp/client.d.ts.map +1 -0
  541. package/dist/tools/lsp/client.js +454 -0
  542. package/dist/tools/lsp/client.js.map +1 -0
  543. package/dist/tools/lsp/index.d.ts +9 -0
  544. package/dist/tools/lsp/index.d.ts.map +1 -0
  545. package/dist/tools/lsp/index.js +7 -0
  546. package/dist/tools/lsp/index.js.map +1 -0
  547. package/dist/tools/lsp/servers.d.ts +37 -0
  548. package/dist/tools/lsp/servers.d.ts.map +1 -0
  549. package/dist/tools/lsp/servers.js +149 -0
  550. package/dist/tools/lsp/servers.js.map +1 -0
  551. package/dist/tools/lsp/utils.d.ts +58 -0
  552. package/dist/tools/lsp/utils.d.ts.map +1 -0
  553. package/dist/tools/lsp/utils.js +236 -0
  554. package/dist/tools/lsp/utils.js.map +1 -0
  555. package/dist/tools/lsp-tools.d.ts +151 -0
  556. package/dist/tools/lsp-tools.d.ts.map +1 -0
  557. package/dist/tools/lsp-tools.js +358 -0
  558. package/dist/tools/lsp-tools.js.map +1 -0
  559. package/package.json +85 -0
  560. package/scripts/claude-sisyphus.sh +9 -0
  561. package/scripts/install.sh +1774 -0
  562. package/scripts/keyword-detector.mjs +209 -0
  563. package/scripts/keyword-detector.sh +71 -0
  564. package/scripts/persistent-mode.mjs +241 -0
  565. package/scripts/persistent-mode.sh +300 -0
  566. package/scripts/post-tool-verifier.mjs +217 -0
  567. package/scripts/post-tool-verifier.sh +196 -0
  568. package/scripts/pre-tool-enforcer.mjs +99 -0
  569. package/scripts/pre-tool-enforcer.sh +76 -0
  570. package/scripts/sisyphus-aliases.sh +18 -0
  571. package/scripts/stop-continuation.sh +31 -0
  572. package/scripts/test-pr25.sh +525 -0
  573. package/scripts/uninstall.sh +171 -0
@@ -0,0 +1,149 @@
1
+ /**
2
+ * Sonnet-Optimized Prompt Adaptations
3
+ *
4
+ * Sonnet (MEDIUM tier) prompts are designed for:
5
+ * - Balanced reasoning with good speed
6
+ * - Focused task execution
7
+ * - Clear deliverables with structured output
8
+ * - Efficient multi-step workflows
9
+ */
10
+ /**
11
+ * Sonnet prompt prefix for focused execution
12
+ */
13
+ export const SONNET_PROMPT_PREFIX = `## Task Execution Mode
14
+
15
+ Execute this task efficiently with clear deliverables:
16
+
17
+ `;
18
+ /**
19
+ * Sonnet prompt suffix for verification
20
+ */
21
+ export const SONNET_PROMPT_SUFFIX = `
22
+
23
+ ---
24
+ Focus on delivering the requested outcome. Be thorough but efficient.
25
+ `;
26
+ /**
27
+ * Adapt a base prompt for Sonnet execution
28
+ */
29
+ export function adaptPromptForSonnet(basePrompt) {
30
+ return SONNET_PROMPT_PREFIX + basePrompt + SONNET_PROMPT_SUFFIX;
31
+ }
32
+ /**
33
+ * Sonnet delegation template
34
+ */
35
+ export const SONNET_DELEGATION_TEMPLATE = `## TASK DELEGATION
36
+
37
+ **Tier**: MEDIUM (balanced)
38
+
39
+ ### Task
40
+ {TASK}
41
+
42
+ ### Expected Outcome
43
+ {DELIVERABLES}
44
+
45
+ ### Success Criteria
46
+ {SUCCESS_CRITERIA}
47
+
48
+ ### Context
49
+ {CONTEXT}
50
+
51
+ ### Required Tools
52
+ {TOOLS}
53
+
54
+ ### Constraints
55
+ - MUST DO: {MUST_DO}
56
+ - MUST NOT DO: {MUST_NOT}
57
+
58
+ ---
59
+ Execute efficiently. Report completion status.
60
+ `;
61
+ /**
62
+ * Sonnet implementation template
63
+ */
64
+ export const SONNET_IMPLEMENTATION_TEMPLATE = `## IMPLEMENTATION TASK
65
+
66
+ ### What to Build
67
+ {TASK}
68
+
69
+ ### Acceptance Criteria
70
+ {CRITERIA}
71
+
72
+ ### Approach
73
+ 1. Read relevant files to understand patterns
74
+ 2. Plan changes before making them
75
+ 3. Implement following existing conventions
76
+ 4. Verify changes work correctly
77
+
78
+ ### Files to Modify
79
+ {FILES}
80
+
81
+ ### Existing Patterns to Follow
82
+ {PATTERNS}
83
+
84
+ ---
85
+ Match existing code style. Test your changes.
86
+ `;
87
+ /**
88
+ * Sonnet research template
89
+ */
90
+ export const SONNET_RESEARCH_TEMPLATE = `## RESEARCH TASK
91
+
92
+ ### Query
93
+ {QUERY}
94
+
95
+ ### Required Information
96
+ {REQUIREMENTS}
97
+
98
+ ### Sources to Search
99
+ {SOURCES}
100
+
101
+ ### Output Format
102
+ \`\`\`
103
+ ## Query: [restated query]
104
+
105
+ ## Findings
106
+ ### [Source 1]
107
+ [Key information]
108
+ **Reference**: [URL/file path]
109
+
110
+ ### [Source 2]
111
+ [Key information]
112
+ **Reference**: [URL/file path]
113
+
114
+ ## Summary
115
+ [Synthesized answer]
116
+
117
+ ## Recommendations
118
+ [Actionable next steps]
119
+ \`\`\`
120
+
121
+ ---
122
+ Cite sources. Provide actionable information.
123
+ `;
124
+ /**
125
+ * Sonnet frontend template
126
+ */
127
+ export const SONNET_FRONTEND_TEMPLATE = `## FRONTEND TASK
128
+
129
+ ### Change Required
130
+ {TASK}
131
+
132
+ ### Visual Expectations
133
+ {VISUAL_REQUIREMENTS}
134
+
135
+ ### Technical Constraints
136
+ - Framework: {FRAMEWORK}
137
+ - Styling: {STYLING_APPROACH}
138
+ - Components: {COMPONENT_PATTERNS}
139
+
140
+ ### Existing Patterns
141
+ {PATTERNS}
142
+
143
+ ### Files to Modify
144
+ {FILES}
145
+
146
+ ---
147
+ Match the existing aesthetic. Test in browser if applicable.
148
+ `;
149
+ //# sourceMappingURL=sonnet.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sonnet.js","sourceRoot":"","sources":["../../../../src/features/model-routing/prompts/sonnet.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;CAInC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;CAInC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,oBAAoB,CAAC,UAAkB;IACrD,OAAO,oBAAoB,GAAG,UAAU,GAAG,oBAAoB,CAAC;AAClE,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;CAyBzC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG;;;;;;;;;;;;;;;;;;;;;;CAsB7C,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiCvC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBvC,CAAC"}
@@ -0,0 +1,92 @@
1
+ /**
2
+ * Model Router
3
+ *
4
+ * Main routing engine that determines which model tier to use for a given task.
5
+ * Combines signal extraction, scoring, and rules evaluation.
6
+ */
7
+ import type { RoutingContext, RoutingDecision, RoutingConfig, ComplexityTier } from './types.js';
8
+ /**
9
+ * Route a task to the appropriate model tier
10
+ */
11
+ export declare function routeTask(context: RoutingContext, config?: Partial<RoutingConfig>): RoutingDecision;
12
+ /**
13
+ * Escalate to a higher tier after failure
14
+ */
15
+ export declare function escalateModel(currentTier: ComplexityTier): ComplexityTier;
16
+ /**
17
+ * Check if we can escalate further
18
+ */
19
+ export declare function canEscalate(currentTier: ComplexityTier): boolean;
20
+ /**
21
+ * Get routing recommendation for orchestrator
22
+ *
23
+ * This is designed for PROACTIVE routing - the orchestrator (Opus) analyzes
24
+ * task complexity BEFORE delegation and chooses the appropriate model tier.
25
+ *
26
+ * NOT reactive escalation - the right model is chosen upfront.
27
+ */
28
+ export declare function getRoutingRecommendation(context: RoutingContext, config?: Partial<RoutingConfig>): RoutingDecision;
29
+ /**
30
+ * Legacy: Route with escalation support
31
+ * @deprecated Use getRoutingRecommendation for proactive routing instead.
32
+ * The orchestrator should analyze complexity upfront, not escalate reactively.
33
+ */
34
+ export declare function routeWithEscalation(context: RoutingContext, config?: Partial<RoutingConfig>): RoutingDecision;
35
+ /**
36
+ * Get routing explanation for debugging/logging
37
+ */
38
+ export declare function explainRouting(context: RoutingContext, config?: Partial<RoutingConfig>): string;
39
+ /**
40
+ * Quick tier lookup for known agent types
41
+ * Useful for cases where we don't need full signal analysis
42
+ */
43
+ export declare function quickTierForAgent(agentType: string): ComplexityTier | null;
44
+ /**
45
+ * Check if an agent has a fixed tier (cannot be overridden)
46
+ *
47
+ * Only ORCHESTRATOR agents are fixed to Opus - they need to analyze
48
+ * complexity and delegate. All other agents are adaptive.
49
+ *
50
+ * NOTE: orchestrator-olympus was deprecated in v2.0 (merged into default mode)
51
+ * but kept here for backward compatibility if users still have it installed.
52
+ */
53
+ export declare function isFixedTierAgent(agentType: string): boolean;
54
+ /**
55
+ * Get recommended model for an agent based on task complexity
56
+ *
57
+ * This is the main entry point for orchestrator model routing.
58
+ * The orchestrator calls this to determine which model to use when delegating.
59
+ *
60
+ * ALL agents are adaptive EXCEPT orchestrators (which need Opus to analyze and delegate).
61
+ *
62
+ * Routing hierarchy:
63
+ * 1. Fixed-tier (orchestrators only) → always Opus (they analyze complexity)
64
+ * 2. All other agents → adaptive based on task complexity
65
+ *
66
+ * @param agentType - The agent to delegate to
67
+ * @param taskPrompt - The task description
68
+ * @returns The recommended model type ('haiku', 'sonnet', or 'opus')
69
+ */
70
+ export declare function getModelForTask(agentType: string, taskPrompt: string, config?: Partial<RoutingConfig>): {
71
+ model: 'haiku' | 'sonnet' | 'opus';
72
+ tier: ComplexityTier;
73
+ reason: string;
74
+ };
75
+ /**
76
+ * Generate a complexity analysis summary for the orchestrator
77
+ *
78
+ * Returns a human-readable analysis explaining the routing recommendation.
79
+ */
80
+ export declare function analyzeTaskComplexity(taskPrompt: string, agentType?: string): {
81
+ tier: ComplexityTier;
82
+ model: string;
83
+ analysis: string;
84
+ signals: {
85
+ wordCount: number;
86
+ hasArchitectureKeywords: boolean;
87
+ hasRiskKeywords: boolean;
88
+ estimatedSubtasks: number;
89
+ impactScope: string;
90
+ };
91
+ };
92
+ //# sourceMappingURL=router.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/features/model-routing/router.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,aAAa,EACb,cAAc,EACf,MAAM,YAAY,CAAC;AAUpB;;GAEG;AACH,wBAAgB,SAAS,CACvB,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,eAAe,CAkDjB;AAqCD;;GAEG;AACH,wBAAgB,aAAa,CAAC,WAAW,EAAE,cAAc,GAAG,cAAc,CASzE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,WAAW,EAAE,cAAc,GAAG,OAAO,CAEhE;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,eAAe,CAEjB;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,eAAe,CAIjB;AAED;;GAEG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,cAAc,EACvB,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC,MAAM,CAkCR;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAkB1E;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAK3D;AAGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,eAAe,CAC7B,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,OAAO,CAAC,aAAa,CAAM,GAClC;IAAE,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,CAAC;IAAC,IAAI,EAAE,cAAc,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAoB9E;AAGD;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,SAAS,CAAC,EAAE,MAAM,GACjB;IACD,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE;QACP,SAAS,EAAE,MAAM,CAAC;QAClB,uBAAuB,EAAE,OAAO,CAAC;QACjC,eAAe,EAAE,OAAO,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,WAAW,EAAE,MAAM,CAAC;KACrB,CAAC;CACH,CA+BA"}
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Model Router
3
+ *
4
+ * Main routing engine that determines which model tier to use for a given task.
5
+ * Combines signal extraction, scoring, and rules evaluation.
6
+ */
7
+ import { DEFAULT_ROUTING_CONFIG, TIER_MODELS, TIER_TO_MODEL_TYPE, } from './types.js';
8
+ import { extractAllSignals } from './signals.js';
9
+ import { calculateComplexityScore, calculateConfidence, scoreToTier } from './scorer.js';
10
+ import { evaluateRules, DEFAULT_ROUTING_RULES } from './rules.js';
11
+ /**
12
+ * Route a task to the appropriate model tier
13
+ */
14
+ export function routeTask(context, config = {}) {
15
+ const mergedConfig = { ...DEFAULT_ROUTING_CONFIG, ...config };
16
+ // If routing is disabled, use default tier
17
+ if (!mergedConfig.enabled) {
18
+ return createDecision(mergedConfig.defaultTier, ['Routing disabled, using default tier'], false);
19
+ }
20
+ // If explicit model is specified, respect it
21
+ if (context.explicitModel) {
22
+ const tier = modelTypeToTier(context.explicitModel);
23
+ return createDecision(tier, ['Explicit model specified by user'], false);
24
+ }
25
+ // Check for agent-specific overrides
26
+ if (context.agentType && mergedConfig.agentOverrides?.[context.agentType]) {
27
+ const override = mergedConfig.agentOverrides[context.agentType];
28
+ return createDecision(override.tier, [override.reason], false);
29
+ }
30
+ // Extract signals from the task
31
+ const signals = extractAllSignals(context.taskPrompt, context);
32
+ // Evaluate routing rules
33
+ const ruleResult = evaluateRules(context, signals, DEFAULT_ROUTING_RULES);
34
+ if (ruleResult.tier === 'EXPLICIT') {
35
+ // Explicit model was handled above, this shouldn't happen
36
+ return createDecision('MEDIUM', ['Unexpected EXPLICIT tier'], false);
37
+ }
38
+ // Calculate score for confidence and logging
39
+ const score = calculateComplexityScore(signals);
40
+ const scoreTier = scoreToTier(score);
41
+ const confidence = calculateConfidence(score, ruleResult.tier);
42
+ const reasons = [
43
+ ruleResult.reason,
44
+ `Rule: ${ruleResult.ruleName}`,
45
+ `Score: ${score} (${scoreTier} tier by score)`,
46
+ ];
47
+ return {
48
+ model: mergedConfig.tierModels[ruleResult.tier],
49
+ modelType: TIER_TO_MODEL_TYPE[ruleResult.tier],
50
+ tier: ruleResult.tier,
51
+ confidence,
52
+ reasons,
53
+ escalated: false,
54
+ };
55
+ }
56
+ /**
57
+ * Create a routing decision for a given tier
58
+ */
59
+ function createDecision(tier, reasons, escalated, originalTier) {
60
+ return {
61
+ model: TIER_MODELS[tier],
62
+ modelType: TIER_TO_MODEL_TYPE[tier],
63
+ tier,
64
+ confidence: escalated ? 0.9 : 0.7, // Higher confidence after escalation
65
+ reasons,
66
+ escalated,
67
+ originalTier,
68
+ };
69
+ }
70
+ /**
71
+ * Convert ModelType to ComplexityTier
72
+ */
73
+ function modelTypeToTier(modelType) {
74
+ switch (modelType) {
75
+ case 'opus':
76
+ return 'HIGH';
77
+ case 'haiku':
78
+ return 'LOW';
79
+ case 'sonnet':
80
+ default:
81
+ return 'MEDIUM';
82
+ }
83
+ }
84
+ /**
85
+ * Escalate to a higher tier after failure
86
+ */
87
+ export function escalateModel(currentTier) {
88
+ switch (currentTier) {
89
+ case 'LOW':
90
+ return 'MEDIUM';
91
+ case 'MEDIUM':
92
+ return 'HIGH';
93
+ case 'HIGH':
94
+ return 'HIGH'; // Already at max
95
+ }
96
+ }
97
+ /**
98
+ * Check if we can escalate further
99
+ */
100
+ export function canEscalate(currentTier) {
101
+ return currentTier !== 'HIGH';
102
+ }
103
+ /**
104
+ * Get routing recommendation for orchestrator
105
+ *
106
+ * This is designed for PROACTIVE routing - the orchestrator (Opus) analyzes
107
+ * task complexity BEFORE delegation and chooses the appropriate model tier.
108
+ *
109
+ * NOT reactive escalation - the right model is chosen upfront.
110
+ */
111
+ export function getRoutingRecommendation(context, config = {}) {
112
+ return routeTask(context, config);
113
+ }
114
+ /**
115
+ * Legacy: Route with escalation support
116
+ * @deprecated Use getRoutingRecommendation for proactive routing instead.
117
+ * The orchestrator should analyze complexity upfront, not escalate reactively.
118
+ */
119
+ export function routeWithEscalation(context, config = {}) {
120
+ // Simply return the routing recommendation
121
+ // Reactive escalation is deprecated - orchestrator decides upfront
122
+ return routeTask(context, config);
123
+ }
124
+ /**
125
+ * Get routing explanation for debugging/logging
126
+ */
127
+ export function explainRouting(context, config = {}) {
128
+ const decision = routeTask(context, config);
129
+ const signals = extractAllSignals(context.taskPrompt, context);
130
+ const lines = [
131
+ '=== Model Routing Decision ===',
132
+ `Task: ${context.taskPrompt.substring(0, 100)}${context.taskPrompt.length > 100 ? '...' : ''}`,
133
+ `Agent: ${context.agentType ?? 'unspecified'}`,
134
+ '',
135
+ '--- Signals ---',
136
+ `Word count: ${signals.lexical.wordCount}`,
137
+ `File paths: ${signals.lexical.filePathCount}`,
138
+ `Architecture keywords: ${signals.lexical.hasArchitectureKeywords}`,
139
+ `Debugging keywords: ${signals.lexical.hasDebuggingKeywords}`,
140
+ `Simple keywords: ${signals.lexical.hasSimpleKeywords}`,
141
+ `Risk keywords: ${signals.lexical.hasRiskKeywords}`,
142
+ `Question depth: ${signals.lexical.questionDepth}`,
143
+ `Estimated subtasks: ${signals.structural.estimatedSubtasks}`,
144
+ `Cross-file: ${signals.structural.crossFileDependencies}`,
145
+ `Impact scope: ${signals.structural.impactScope}`,
146
+ `Reversibility: ${signals.structural.reversibility}`,
147
+ `Previous failures: ${signals.context.previousFailures}`,
148
+ '',
149
+ '--- Decision ---',
150
+ `Tier: ${decision.tier}`,
151
+ `Model: ${decision.model}`,
152
+ `Confidence: ${decision.confidence}`,
153
+ `Escalated: ${decision.escalated}`,
154
+ '',
155
+ '--- Reasons ---',
156
+ ...decision.reasons.map(r => ` - ${r}`),
157
+ ];
158
+ return lines.join('\n');
159
+ }
160
+ /**
161
+ * Quick tier lookup for known agent types
162
+ * Useful for cases where we don't need full signal analysis
163
+ */
164
+ export function quickTierForAgent(agentType) {
165
+ const agentTiers = {
166
+ oracle: 'HIGH',
167
+ prometheus: 'HIGH',
168
+ momus: 'HIGH',
169
+ metis: 'HIGH',
170
+ explore: 'LOW',
171
+ 'document-writer': 'LOW',
172
+ librarian: 'MEDIUM',
173
+ 'olympian': 'MEDIUM',
174
+ 'frontend-engineer': 'MEDIUM',
175
+ 'multimodal-looker': 'MEDIUM',
176
+ // DEPRECATED: orchestrator-olympus merged into default mode (v2.0)
177
+ // Kept for backward compatibility if users still have it installed
178
+ 'orchestrator-olympus': 'MEDIUM',
179
+ };
180
+ return agentTiers[agentType] ?? null;
181
+ }
182
+ /**
183
+ * Check if an agent has a fixed tier (cannot be overridden)
184
+ *
185
+ * Only ORCHESTRATOR agents are fixed to Opus - they need to analyze
186
+ * complexity and delegate. All other agents are adaptive.
187
+ *
188
+ * NOTE: orchestrator-olympus was deprecated in v2.0 (merged into default mode)
189
+ * but kept here for backward compatibility if users still have it installed.
190
+ */
191
+ export function isFixedTierAgent(agentType) {
192
+ // Only orchestrators are fixed - they need Opus to analyze and delegate
193
+ // DEPRECATED: orchestrator-olympus merged into default mode (v2.0)
194
+ const fixedAgents = ['orchestrator-olympus'];
195
+ return fixedAgents.includes(agentType);
196
+ }
197
+ /**
198
+ * Get recommended model for an agent based on task complexity
199
+ *
200
+ * This is the main entry point for orchestrator model routing.
201
+ * The orchestrator calls this to determine which model to use when delegating.
202
+ *
203
+ * ALL agents are adaptive EXCEPT orchestrators (which need Opus to analyze and delegate).
204
+ *
205
+ * Routing hierarchy:
206
+ * 1. Fixed-tier (orchestrators only) → always Opus (they analyze complexity)
207
+ * 2. All other agents → adaptive based on task complexity
208
+ *
209
+ * @param agentType - The agent to delegate to
210
+ * @param taskPrompt - The task description
211
+ * @returns The recommended model type ('haiku', 'sonnet', or 'opus')
212
+ */
213
+ export function getModelForTask(agentType, taskPrompt, config = {}) {
214
+ // Fixed-tier agents (orchestrators only) always use Opus
215
+ // They need to analyze complexity and delegate - can't use a simpler model
216
+ if (isFixedTierAgent(agentType)) {
217
+ return {
218
+ model: 'opus',
219
+ tier: 'HIGH',
220
+ reason: `${agentType} is an orchestrator (always Opus - analyzes and delegates)`,
221
+ };
222
+ }
223
+ // All other agents are adaptive based on task complexity
224
+ // Use agent-specific rules for advisory agents, general rules for others
225
+ const decision = routeTask({ taskPrompt, agentType }, config);
226
+ return {
227
+ model: decision.modelType,
228
+ tier: decision.tier,
229
+ reason: decision.reasons[0] ?? 'Complexity analysis',
230
+ };
231
+ }
232
+ /**
233
+ * Generate a complexity analysis summary for the orchestrator
234
+ *
235
+ * Returns a human-readable analysis explaining the routing recommendation.
236
+ */
237
+ export function analyzeTaskComplexity(taskPrompt, agentType) {
238
+ const signals = extractAllSignals(taskPrompt, { taskPrompt, agentType });
239
+ const decision = routeTask({ taskPrompt, agentType });
240
+ const analysis = [
241
+ `**Tier: ${decision.tier}** → ${decision.model}`,
242
+ '',
243
+ '**Why:**',
244
+ ...decision.reasons.map(r => `- ${r}`),
245
+ '',
246
+ '**Signals detected:**',
247
+ signals.lexical.hasArchitectureKeywords ? '- Architecture keywords (refactor, redesign, etc.)' : null,
248
+ signals.lexical.hasRiskKeywords ? '- Risk keywords (migration, production, critical)' : null,
249
+ signals.lexical.hasDebuggingKeywords ? '- Debugging keywords (root cause, investigate)' : null,
250
+ signals.structural.crossFileDependencies ? '- Cross-file dependencies' : null,
251
+ signals.structural.impactScope === 'system-wide' ? '- System-wide impact' : null,
252
+ signals.structural.reversibility === 'difficult' ? '- Difficult to reverse' : null,
253
+ ].filter(Boolean).join('\n');
254
+ return {
255
+ tier: decision.tier,
256
+ model: decision.model,
257
+ analysis,
258
+ signals: {
259
+ wordCount: signals.lexical.wordCount,
260
+ hasArchitectureKeywords: signals.lexical.hasArchitectureKeywords,
261
+ hasRiskKeywords: signals.lexical.hasRiskKeywords,
262
+ estimatedSubtasks: signals.structural.estimatedSubtasks,
263
+ impactScope: signals.structural.impactScope,
264
+ },
265
+ };
266
+ }
267
+ //# sourceMappingURL=router.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"router.js","sourceRoot":"","sources":["../../../src/features/model-routing/router.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAQH,OAAO,EACL,sBAAsB,EACtB,WAAW,EACX,kBAAkB,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAElE;;GAEG;AACH,MAAM,UAAU,SAAS,CACvB,OAAuB,EACvB,SAAiC,EAAE;IAEnC,MAAM,YAAY,GAAG,EAAE,GAAG,sBAAsB,EAAE,GAAG,MAAM,EAAE,CAAC;IAE9D,2CAA2C;IAC3C,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,CAAC,IAAI;QACrG,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,mDAAmD,CAAC,CAAC,CAAC,IAAI;QAC5F,OAAO,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,CAAC,gDAAgD,CAAC,CAAC,CAAC,IAAI;QAC9F,OAAO,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,IAAI;QAC7E,OAAO,CAAC,UAAU,CAAC,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI;QAChF,OAAO,CAAC,UAAU,CAAC,aAAa,KAAK,WAAW,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI;KACnF,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAE7B,OAAO;QACL,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,KAAK,EAAE,QAAQ,CAAC,KAAK;QACrB,QAAQ;QACR,OAAO,EAAE;YACP,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS;YACpC,uBAAuB,EAAE,OAAO,CAAC,OAAO,CAAC,uBAAuB;YAChE,eAAe,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe;YAChD,iBAAiB,EAAE,OAAO,CAAC,UAAU,CAAC,iBAAiB;YACvD,WAAW,EAAE,OAAO,CAAC,UAAU,CAAC,WAAW;SAC5C;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Routing Rules
3
+ *
4
+ * Defines the rules engine for model routing decisions.
5
+ * Rules are evaluated in priority order, and the first matching rule wins.
6
+ */
7
+ import type { RoutingRule, RoutingContext, ComplexitySignals, ComplexityTier } from './types.js';
8
+ /**
9
+ * Default routing rules, ordered by priority (highest first)
10
+ */
11
+ export declare const DEFAULT_ROUTING_RULES: RoutingRule[];
12
+ /**
13
+ * Evaluate routing rules and return the first matching rule's action
14
+ */
15
+ export declare function evaluateRules(context: RoutingContext, signals: ComplexitySignals, rules?: RoutingRule[]): {
16
+ tier: ComplexityTier | 'EXPLICIT';
17
+ reason: string;
18
+ ruleName: string;
19
+ };
20
+ /**
21
+ * Get all rules that would match for a given context (for debugging)
22
+ */
23
+ export declare function getMatchingRules(context: RoutingContext, signals: ComplexitySignals, rules?: RoutingRule[]): RoutingRule[];
24
+ /**
25
+ * Create a custom routing rule
26
+ */
27
+ export declare function createRule(name: string, condition: (context: RoutingContext, signals: ComplexitySignals) => boolean, tier: ComplexityTier, reason: string, priority: number): RoutingRule;
28
+ /**
29
+ * Merge custom rules with default rules
30
+ */
31
+ export declare function mergeRules(customRules: RoutingRule[]): RoutingRule[];
32
+ //# sourceMappingURL=rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/features/model-routing/rules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,WAAW,EA+M9C,CAAC;AAEF;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,GAAE,WAAW,EAA0B,GAC3C;IAAE,IAAI,EAAE,cAAc,GAAG,UAAU,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAoBzE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,iBAAiB,EAC1B,KAAK,GAAE,WAAW,EAA0B,GAC3C,WAAW,EAAE,CAEf;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,iBAAiB,KAAK,OAAO,EAC3E,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,WAAW,CAOb;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,WAAW,EAAE,CAOpE"}