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,224 @@
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
+ /**
8
+ * Default routing rules, ordered by priority (highest first)
9
+ */
10
+ export const DEFAULT_ROUTING_RULES = [
11
+ // ============ Override Rules (Highest Priority) ============
12
+ {
13
+ name: 'explicit-model-specified',
14
+ condition: (ctx) => ctx.explicitModel !== undefined,
15
+ action: { tier: 'EXPLICIT', reason: 'User specified model explicitly' },
16
+ priority: 100,
17
+ },
18
+ // NOTE: ALL agents are now ADAPTIVE based on task complexity
19
+ // Only orchestrators (orchestrator-olympus) are fixed to Opus
20
+ // This includes: oracle, prometheus, momus, metis, explore, document-writer, etc.
21
+ // ============ Orchestrator Rule (Fixed Tier) ============
22
+ {
23
+ name: 'orchestrator-fixed-opus',
24
+ condition: (ctx) => ctx.agentType === 'orchestrator-olympus',
25
+ action: { tier: 'HIGH', reason: 'Orchestrator requires Opus to analyze complexity and delegate' },
26
+ priority: 90,
27
+ },
28
+ // ============ Advisory Agent Adaptive Rules ============
29
+ // Oracle: Simple lookups → LOW, tracing → MEDIUM, debugging/architecture → HIGH
30
+ // Higher priority (85) to override generic rules like short-local-change
31
+ {
32
+ name: 'oracle-complex-debugging',
33
+ condition: (ctx, signals) => ctx.agentType === 'oracle' &&
34
+ (signals.lexical.hasDebuggingKeywords ||
35
+ signals.lexical.hasArchitectureKeywords ||
36
+ signals.lexical.hasRiskKeywords),
37
+ action: { tier: 'HIGH', reason: 'Oracle: Complex debugging/architecture decision' },
38
+ priority: 85,
39
+ },
40
+ {
41
+ name: 'oracle-simple-lookup',
42
+ condition: (ctx, signals) => ctx.agentType === 'oracle' &&
43
+ signals.lexical.hasSimpleKeywords &&
44
+ !signals.lexical.hasDebuggingKeywords &&
45
+ !signals.lexical.hasArchitectureKeywords &&
46
+ !signals.lexical.hasRiskKeywords,
47
+ action: { tier: 'LOW', reason: 'Oracle: Simple lookup query' },
48
+ priority: 80,
49
+ },
50
+ // Prometheus: Simple breakdown → LOW, moderate planning → MEDIUM, cross-domain → HIGH
51
+ {
52
+ name: 'prometheus-simple-breakdown',
53
+ condition: (ctx, signals) => ctx.agentType === 'prometheus' &&
54
+ signals.structural.estimatedSubtasks <= 3 &&
55
+ !signals.lexical.hasRiskKeywords &&
56
+ signals.structural.impactScope === 'local',
57
+ action: { tier: 'LOW', reason: 'Prometheus: Simple task breakdown' },
58
+ priority: 75,
59
+ },
60
+ {
61
+ name: 'prometheus-strategic-planning',
62
+ condition: (ctx, signals) => ctx.agentType === 'prometheus' &&
63
+ (signals.structural.impactScope === 'system-wide' ||
64
+ signals.lexical.hasArchitectureKeywords ||
65
+ signals.structural.estimatedSubtasks > 10),
66
+ action: { tier: 'HIGH', reason: 'Prometheus: Cross-domain strategic planning' },
67
+ priority: 75,
68
+ },
69
+ // Momus: Checklist → LOW, gap analysis → MEDIUM, adversarial review → HIGH
70
+ {
71
+ name: 'momus-checklist-review',
72
+ condition: (ctx, signals) => ctx.agentType === 'momus' &&
73
+ signals.lexical.wordCount < 30 &&
74
+ !signals.lexical.hasRiskKeywords,
75
+ action: { tier: 'LOW', reason: 'Momus: Checklist verification' },
76
+ priority: 75,
77
+ },
78
+ {
79
+ name: 'momus-adversarial-review',
80
+ condition: (ctx, signals) => ctx.agentType === 'momus' &&
81
+ (signals.lexical.hasRiskKeywords || signals.structural.impactScope === 'system-wide'),
82
+ action: { tier: 'HIGH', reason: 'Momus: Adversarial review for critical system' },
83
+ priority: 75,
84
+ },
85
+ // Metis: Simple impact → LOW, dependency mapping → MEDIUM, risk analysis → HIGH
86
+ {
87
+ name: 'metis-simple-impact',
88
+ condition: (ctx, signals) => ctx.agentType === 'metis' &&
89
+ signals.structural.impactScope === 'local' &&
90
+ !signals.lexical.hasRiskKeywords,
91
+ action: { tier: 'LOW', reason: 'Metis: Simple impact analysis' },
92
+ priority: 75,
93
+ },
94
+ {
95
+ name: 'metis-risk-analysis',
96
+ condition: (ctx, signals) => ctx.agentType === 'metis' &&
97
+ (signals.lexical.hasRiskKeywords || signals.structural.impactScope === 'system-wide'),
98
+ action: { tier: 'HIGH', reason: 'Metis: Risk analysis and unknown-unknowns detection' },
99
+ priority: 75,
100
+ },
101
+ // ============ Task-Based Rules ============
102
+ {
103
+ name: 'architecture-system-wide',
104
+ condition: (ctx, signals) => signals.lexical.hasArchitectureKeywords &&
105
+ signals.structural.impactScope === 'system-wide',
106
+ action: { tier: 'HIGH', reason: 'Architectural decisions with system-wide impact' },
107
+ priority: 70,
108
+ },
109
+ {
110
+ name: 'security-domain',
111
+ condition: (ctx, signals) => signals.structural.domainSpecificity === 'security',
112
+ action: { tier: 'HIGH', reason: 'Security-related tasks require careful reasoning' },
113
+ priority: 70,
114
+ },
115
+ {
116
+ name: 'difficult-reversibility-risk',
117
+ condition: (ctx, signals) => signals.structural.reversibility === 'difficult' &&
118
+ signals.lexical.hasRiskKeywords,
119
+ action: { tier: 'HIGH', reason: 'High-risk, difficult-to-reverse changes' },
120
+ priority: 70,
121
+ },
122
+ {
123
+ name: 'deep-debugging',
124
+ condition: (ctx, signals) => signals.lexical.hasDebuggingKeywords &&
125
+ signals.lexical.questionDepth === 'why',
126
+ action: { tier: 'HIGH', reason: 'Root cause analysis requires deep reasoning' },
127
+ priority: 65,
128
+ },
129
+ {
130
+ name: 'complex-multi-step',
131
+ condition: (ctx, signals) => signals.structural.estimatedSubtasks > 5 &&
132
+ signals.structural.crossFileDependencies,
133
+ action: { tier: 'HIGH', reason: 'Complex multi-step task with cross-file changes' },
134
+ priority: 60,
135
+ },
136
+ {
137
+ name: 'simple-search-query',
138
+ condition: (ctx, signals) => signals.lexical.hasSimpleKeywords &&
139
+ signals.structural.estimatedSubtasks <= 1 &&
140
+ signals.structural.impactScope === 'local' &&
141
+ !signals.lexical.hasArchitectureKeywords &&
142
+ !signals.lexical.hasDebuggingKeywords,
143
+ action: { tier: 'LOW', reason: 'Simple search or lookup task' },
144
+ priority: 60,
145
+ },
146
+ {
147
+ name: 'short-local-change',
148
+ condition: (ctx, signals) => signals.lexical.wordCount < 50 &&
149
+ signals.structural.impactScope === 'local' &&
150
+ signals.structural.reversibility === 'easy' &&
151
+ !signals.lexical.hasRiskKeywords,
152
+ action: { tier: 'LOW', reason: 'Short, local, easily reversible change' },
153
+ priority: 55,
154
+ },
155
+ {
156
+ name: 'moderate-complexity',
157
+ condition: (ctx, signals) => signals.structural.estimatedSubtasks > 1 &&
158
+ signals.structural.estimatedSubtasks <= 5,
159
+ action: { tier: 'MEDIUM', reason: 'Moderate complexity with multiple subtasks' },
160
+ priority: 50,
161
+ },
162
+ {
163
+ name: 'module-level-work',
164
+ condition: (ctx, signals) => signals.structural.impactScope === 'module',
165
+ action: { tier: 'MEDIUM', reason: 'Module-level changes' },
166
+ priority: 45,
167
+ },
168
+ // ============ Default Rule ============
169
+ {
170
+ name: 'default-medium',
171
+ condition: () => true,
172
+ action: { tier: 'MEDIUM', reason: 'Default tier for unclassified tasks' },
173
+ priority: 0,
174
+ },
175
+ ];
176
+ /**
177
+ * Evaluate routing rules and return the first matching rule's action
178
+ */
179
+ export function evaluateRules(context, signals, rules = DEFAULT_ROUTING_RULES) {
180
+ // Sort rules by priority (highest first)
181
+ const sortedRules = [...rules].sort((a, b) => b.priority - a.priority);
182
+ for (const rule of sortedRules) {
183
+ if (rule.condition(context, signals)) {
184
+ return {
185
+ tier: rule.action.tier,
186
+ reason: rule.action.reason,
187
+ ruleName: rule.name,
188
+ };
189
+ }
190
+ }
191
+ // Should never reach here due to default rule, but just in case
192
+ return {
193
+ tier: 'MEDIUM',
194
+ reason: 'Fallback to medium tier',
195
+ ruleName: 'fallback',
196
+ };
197
+ }
198
+ /**
199
+ * Get all rules that would match for a given context (for debugging)
200
+ */
201
+ export function getMatchingRules(context, signals, rules = DEFAULT_ROUTING_RULES) {
202
+ return rules.filter(rule => rule.condition(context, signals));
203
+ }
204
+ /**
205
+ * Create a custom routing rule
206
+ */
207
+ export function createRule(name, condition, tier, reason, priority) {
208
+ return {
209
+ name,
210
+ condition,
211
+ action: { tier, reason },
212
+ priority,
213
+ };
214
+ }
215
+ /**
216
+ * Merge custom rules with default rules
217
+ */
218
+ export function mergeRules(customRules) {
219
+ // Custom rules override defaults with the same name
220
+ const customNames = new Set(customRules.map(r => r.name));
221
+ const filteredDefaults = DEFAULT_ROUTING_RULES.filter(r => !customNames.has(r.name));
222
+ return [...customRules, ...filteredDefaults];
223
+ }
224
+ //# sourceMappingURL=rules.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../src/features/model-routing/rules.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAkB;IAClD,8DAA8D;IAE9D;QACE,IAAI,EAAE,0BAA0B;QAChC,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,aAAa,KAAK,SAAS;QACnD,MAAM,EAAE,EAAE,IAAI,EAAE,UAAiB,EAAE,MAAM,EAAE,iCAAiC,EAAE;QAC9E,QAAQ,EAAE,GAAG;KACd;IAED,6DAA6D;IAC7D,8DAA8D;IAC9D,kFAAkF;IAElF,2DAA2D;IAE3D;QACE,IAAI,EAAE,yBAAyB;QAC/B,SAAS,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,SAAS,KAAK,sBAAsB;QAC5D,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,+DAA+D,EAAE;QACjG,QAAQ,EAAE,EAAE;KACb;IAED,0DAA0D;IAE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ier based on extracted signals.
5
+ * Uses weighted scoring to determine LOW/MEDIUM/HIGH tier.
6
+ */
7
+ import type { ComplexitySignals, ComplexityTier } from './types.js';
8
+ /**
9
+ * Calculate total complexity score
10
+ */
11
+ export declare function calculateComplexityScore(signals: ComplexitySignals): number;
12
+ /**
13
+ * Determine complexity tier from score
14
+ */
15
+ export declare function scoreToTier(score: number): ComplexityTier;
16
+ /**
17
+ * Calculate complexity tier from signals
18
+ */
19
+ export declare function calculateComplexityTier(signals: ComplexitySignals): ComplexityTier;
20
+ /**
21
+ * Get detailed score breakdown for debugging/logging
22
+ */
23
+ export declare function getScoreBreakdown(signals: ComplexitySignals): {
24
+ lexical: number;
25
+ structural: number;
26
+ context: number;
27
+ total: number;
28
+ tier: ComplexityTier;
29
+ };
30
+ /**
31
+ * Calculate confidence in the tier assignment
32
+ * Higher confidence when score is far from thresholds
33
+ */
34
+ export declare function calculateConfidence(score: number, tier: ComplexityTier): number;
35
+ //# sourceMappingURL=scorer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorer.d.ts","sourceRoot":"","sources":["../../../src/features/model-routing/scorer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EAIf,MAAM,YAAY,CAAC;AAmMpB;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,iBAAiB,GAAG,MAAM,CAM3E;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAIzD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,iBAAiB,GAAG,cAAc,CAGlF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,iBAAiB,GAAG;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;CACtB,CAaA;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,cAAc,GAAG,MAAM,CAsB/E"}
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Complexity Scorer
3
+ *
4
+ * Calculates complexity tier based on extracted signals.
5
+ * Uses weighted scoring to determine LOW/MEDIUM/HIGH tier.
6
+ */
7
+ /**
8
+ * Score thresholds for tier classification
9
+ */
10
+ const TIER_THRESHOLDS = {
11
+ HIGH: 8, // Score >= 8 -> HIGH (Opus)
12
+ MEDIUM: 4, // Score >= 4 -> MEDIUM (Sonnet)
13
+ // Score < 4 -> LOW (Haiku)
14
+ };
15
+ /**
16
+ * Weight configuration for different signal categories
17
+ * Total should roughly sum to enable score range 0-15+
18
+ */
19
+ const WEIGHTS = {
20
+ lexical: {
21
+ wordCountHigh: 2, // Long prompts (+2)
22
+ wordCountVeryHigh: 1, // Very long prompts (+1 additional)
23
+ filePathsMultiple: 1, // Multiple file paths (+1)
24
+ codeBlocksPresent: 1, // Code blocks (+1)
25
+ architectureKeywords: 3, // Architecture keywords (+3)
26
+ debuggingKeywords: 2, // Debugging keywords (+2)
27
+ simpleKeywords: -2, // Simple keywords (-2)
28
+ riskKeywords: 2, // Risk keywords (+2)
29
+ questionDepthWhy: 2, // 'Why' questions (+2)
30
+ questionDepthHow: 1, // 'How' questions (+1)
31
+ implicitRequirements: 1, // Vague requirements (+1)
32
+ },
33
+ structural: {
34
+ subtasksMany: 3, // Many subtasks (+3)
35
+ subtasksSome: 1, // Some subtasks (+1)
36
+ crossFile: 2, // Cross-file changes (+2)
37
+ testRequired: 1, // Tests required (+1)
38
+ securityDomain: 2, // Security domain (+2)
39
+ infrastructureDomain: 1, // Infrastructure domain (+1)
40
+ externalKnowledge: 1, // External knowledge needed (+1)
41
+ reversibilityDifficult: 2, // Difficult to reverse (+2)
42
+ reversibilityModerate: 1, // Moderate reversibility (+1)
43
+ impactSystemWide: 3, // System-wide impact (+3)
44
+ impactModule: 1, // Module-level impact (+1)
45
+ },
46
+ context: {
47
+ previousFailure: 2, // Per previous failure (+2 each)
48
+ previousFailureMax: 4, // Max from failures
49
+ deepChain: 2, // Deep agent chain (+2)
50
+ complexPlan: 1, // Complex plan (+1)
51
+ },
52
+ };
53
+ /**
54
+ * Calculate complexity score from lexical signals
55
+ */
56
+ function scoreLexicalSignals(signals) {
57
+ let score = 0;
58
+ // Word count scoring
59
+ if (signals.wordCount > 200) {
60
+ score += WEIGHTS.lexical.wordCountHigh;
61
+ if (signals.wordCount > 500) {
62
+ score += WEIGHTS.lexical.wordCountVeryHigh;
63
+ }
64
+ }
65
+ // File paths
66
+ if (signals.filePathCount >= 2) {
67
+ score += WEIGHTS.lexical.filePathsMultiple;
68
+ }
69
+ // Code blocks
70
+ if (signals.codeBlockCount > 0) {
71
+ score += WEIGHTS.lexical.codeBlocksPresent;
72
+ }
73
+ // Keyword scoring
74
+ if (signals.hasArchitectureKeywords) {
75
+ score += WEIGHTS.lexical.architectureKeywords;
76
+ }
77
+ if (signals.hasDebuggingKeywords) {
78
+ score += WEIGHTS.lexical.debuggingKeywords;
79
+ }
80
+ if (signals.hasSimpleKeywords) {
81
+ score += WEIGHTS.lexical.simpleKeywords; // Negative weight
82
+ }
83
+ if (signals.hasRiskKeywords) {
84
+ score += WEIGHTS.lexical.riskKeywords;
85
+ }
86
+ // Question depth
87
+ switch (signals.questionDepth) {
88
+ case 'why':
89
+ score += WEIGHTS.lexical.questionDepthWhy;
90
+ break;
91
+ case 'how':
92
+ score += WEIGHTS.lexical.questionDepthHow;
93
+ break;
94
+ // 'what', 'where', 'none' add nothing
95
+ }
96
+ // Implicit requirements
97
+ if (signals.hasImplicitRequirements) {
98
+ score += WEIGHTS.lexical.implicitRequirements;
99
+ }
100
+ return score;
101
+ }
102
+ /**
103
+ * Calculate complexity score from structural signals
104
+ */
105
+ function scoreStructuralSignals(signals) {
106
+ let score = 0;
107
+ // Subtask scoring
108
+ if (signals.estimatedSubtasks > 3) {
109
+ score += WEIGHTS.structural.subtasksMany;
110
+ }
111
+ else if (signals.estimatedSubtasks > 1) {
112
+ score += WEIGHTS.structural.subtasksSome;
113
+ }
114
+ // Cross-file dependencies
115
+ if (signals.crossFileDependencies) {
116
+ score += WEIGHTS.structural.crossFile;
117
+ }
118
+ // Test requirements
119
+ if (signals.hasTestRequirements) {
120
+ score += WEIGHTS.structural.testRequired;
121
+ }
122
+ // Domain specificity
123
+ switch (signals.domainSpecificity) {
124
+ case 'security':
125
+ score += WEIGHTS.structural.securityDomain;
126
+ break;
127
+ case 'infrastructure':
128
+ score += WEIGHTS.structural.infrastructureDomain;
129
+ break;
130
+ // Other domains add nothing
131
+ }
132
+ // External knowledge
133
+ if (signals.requiresExternalKnowledge) {
134
+ score += WEIGHTS.structural.externalKnowledge;
135
+ }
136
+ // Reversibility
137
+ switch (signals.reversibility) {
138
+ case 'difficult':
139
+ score += WEIGHTS.structural.reversibilityDifficult;
140
+ break;
141
+ case 'moderate':
142
+ score += WEIGHTS.structural.reversibilityModerate;
143
+ break;
144
+ }
145
+ // Impact scope
146
+ switch (signals.impactScope) {
147
+ case 'system-wide':
148
+ score += WEIGHTS.structural.impactSystemWide;
149
+ break;
150
+ case 'module':
151
+ score += WEIGHTS.structural.impactModule;
152
+ break;
153
+ }
154
+ return score;
155
+ }
156
+ /**
157
+ * Calculate complexity score from context signals
158
+ */
159
+ function scoreContextSignals(signals) {
160
+ let score = 0;
161
+ // Previous failures (capped)
162
+ const failureScore = Math.min(signals.previousFailures * WEIGHTS.context.previousFailure, WEIGHTS.context.previousFailureMax);
163
+ score += failureScore;
164
+ // Deep agent chain (3+ levels)
165
+ if (signals.agentChainDepth >= 3) {
166
+ score += WEIGHTS.context.deepChain;
167
+ }
168
+ // Complex plan (5+ tasks)
169
+ if (signals.planComplexity >= 5) {
170
+ score += WEIGHTS.context.complexPlan;
171
+ }
172
+ return score;
173
+ }
174
+ /**
175
+ * Calculate total complexity score
176
+ */
177
+ export function calculateComplexityScore(signals) {
178
+ const lexicalScore = scoreLexicalSignals(signals.lexical);
179
+ const structuralScore = scoreStructuralSignals(signals.structural);
180
+ const contextScore = scoreContextSignals(signals.context);
181
+ return lexicalScore + structuralScore + contextScore;
182
+ }
183
+ /**
184
+ * Determine complexity tier from score
185
+ */
186
+ export function scoreToTier(score) {
187
+ if (score >= TIER_THRESHOLDS.HIGH)
188
+ return 'HIGH';
189
+ if (score >= TIER_THRESHOLDS.MEDIUM)
190
+ return 'MEDIUM';
191
+ return 'LOW';
192
+ }
193
+ /**
194
+ * Calculate complexity tier from signals
195
+ */
196
+ export function calculateComplexityTier(signals) {
197
+ const score = calculateComplexityScore(signals);
198
+ return scoreToTier(score);
199
+ }
200
+ /**
201
+ * Get detailed score breakdown for debugging/logging
202
+ */
203
+ export function getScoreBreakdown(signals) {
204
+ const lexical = scoreLexicalSignals(signals.lexical);
205
+ const structural = scoreStructuralSignals(signals.structural);
206
+ const context = scoreContextSignals(signals.context);
207
+ const total = lexical + structural + context;
208
+ return {
209
+ lexical,
210
+ structural,
211
+ context,
212
+ total,
213
+ tier: scoreToTier(total),
214
+ };
215
+ }
216
+ /**
217
+ * Calculate confidence in the tier assignment
218
+ * Higher confidence when score is far from thresholds
219
+ */
220
+ export function calculateConfidence(score, tier) {
221
+ const distanceFromLow = Math.abs(score - TIER_THRESHOLDS.MEDIUM);
222
+ const distanceFromHigh = Math.abs(score - TIER_THRESHOLDS.HIGH);
223
+ // Minimum distance from any threshold
224
+ let minDistance;
225
+ switch (tier) {
226
+ case 'LOW':
227
+ minDistance = TIER_THRESHOLDS.MEDIUM - score;
228
+ break;
229
+ case 'MEDIUM':
230
+ minDistance = Math.min(distanceFromLow, distanceFromHigh);
231
+ break;
232
+ case 'HIGH':
233
+ minDistance = score - TIER_THRESHOLDS.HIGH;
234
+ break;
235
+ }
236
+ // Convert distance to confidence (0-1)
237
+ // Distance of 0 = 0.5 confidence, distance of 4+ = 0.9+ confidence
238
+ const confidence = 0.5 + (Math.min(minDistance, 4) / 4) * 0.4;
239
+ return Math.round(confidence * 100) / 100;
240
+ }
241
+ //# sourceMappingURL=scorer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scorer.js","sourceRoot":"","sources":["../../../src/features/model-routing/scorer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAUH;;GAEG;AACH,MAAM,eAAe,GAAG;IACtB,IAAI,EAAE,CAAC,EAAK,4BAA4B;IACxC,MAAM,EAAE,CAAC,EAAG,gCAAgC;IAC5C,2BAA2B;CAC5B,CAAC;AAEF;;;GAGG;AACH,MAAM,OAAO,GAAG;IACd,OAAO,EAAE;QACP,aAAa,EAAE,CAAC,EAAU,oBAAoB;QAC9C,iBAAiB,EAAE,CAAC,EAAM,oCAAoC;QAC9D,iBAAiB,EAAE,CAAC,EAAM,2BAA2B;QACrD,iBAAiB,EAAE,CAAC,EAAM,mBAAmB;QAC7C,oBAAoB,EAAE,CAAC,EAAG,6BAA6B;QACvD,iBAAiB,EAAE,CAAC,EAAM,0BAA0B;QACpD,cAAc,EAAE,CAAC,CAAC,EAAQ,uBAAuB;QACjD,YAAY,EAAE,CAAC,EAAW,qBAAqB;QAC/C,gBAAgB,EAAE,CAAC,EAAO,uBAAuB;QACjD,gBAAgB,EAAE,CAAC,EAAO,uBAAuB;QACjD,oBAAoB,EAAE,CAAC,EAAG,0BAA0B;KACrD;IACD,UAAU,EAAE;QACV,YAAY,EAAE,CAAC,EAAW,qBAAqB;QAC/C,YAAY,EAAE,CAAC,EAAW,qBAAqB;QAC/C,SAAS,EAAE,CAAC,EAAc,0BAA0B;QACpD,YAAY,EAAE,CAAC,EAAW,sBAAsB;QAChD,cAAc,EAAE,CAAC,EAAS,uBAAuB;QACjD,oBAAoB,EAAE,CAAC,EAAG,6BAA6B;QACvD,iBAAiB,EAAE,CAAC,EAAM,iCAAiC;QAC3D,sBAAsB,EAAE,CAAC,EAAE,4BAA4B;QACvD,qBAAqB,E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QACV,OAAO;QACP,KAAK;QACL,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC;KACzB,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,IAAoB;IACrE,MAAM,eAAe,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACjE,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IAEhE,sCAAsC;IACtC,IAAI,WAAmB,CAAC;IACxB,QAAQ,IAAI,EAAE,CAAC;QACb,KAAK,KAAK;YACR,WAAW,GAAG,eAAe,CAAC,MAAM,GAAG,KAAK,CAAC;YAC7C,MAAM;QACR,KAAK,QAAQ;YACX,WAAW,GAAG,IAAI,CAAC,GAAG,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAC;YAC1D,MAAM;QACR,KAAK,MAAM;YACT,WAAW,GAAG,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC;YAC3C,MAAM;IACV,CAAC;IAED,uCAAuC;IACvC,mEAAmE;IACnE,MAAM,UAAU,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC;IAC9D,OAAO,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,GAAG,CAAC,GAAG,GAAG,CAAC;AAC5C,CAAC"}
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Complexity Signal Extraction
3
+ *
4
+ * Extracts complexity signals from task prompts to inform routing decisions.
5
+ * Signals are categorized into lexical, structural, and context types.
6
+ */
7
+ import type { LexicalSignals, StructuralSignals, ContextSignals, ComplexitySignals, RoutingContext } from './types.js';
8
+ /**
9
+ * Extract lexical signals from task prompt
10
+ * These are fast, regex-based extractions that don't require model calls
11
+ */
12
+ export declare function extractLexicalSignals(prompt: string): LexicalSignals;
13
+ /**
14
+ * Extract structural signals from task prompt
15
+ * These require more sophisticated parsing
16
+ */
17
+ export declare function extractStructuralSignals(prompt: string): StructuralSignals;
18
+ /**
19
+ * Extract context signals from routing context
20
+ */
21
+ export declare function extractContextSignals(context: RoutingContext): ContextSignals;
22
+ /**
23
+ * Extract all complexity signals
24
+ */
25
+ export declare function extractAllSignals(prompt: string, context: RoutingContext): ComplexitySignals;
26
+ //# sourceMappingURL=signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signals.d.ts","sourceRoot":"","sources":["../../../src/features/model-routing/signals.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,cAAc,EACf,MAAM,YAAY,CAAC;AAGpB;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,CAepE;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,MAAM,GAAG,iBAAiB,CAY1E;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAQ7E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,cAAc,GACtB,iBAAiB,CAMnB"}