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,171 @@
1
+ /**
2
+ * Empty Message Sanitizer Hook
3
+ *
4
+ * Sanitizes empty messages to prevent API errors.
5
+ * According to the Anthropic API spec, all messages must have non-empty content
6
+ * except for the optional final assistant message.
7
+ *
8
+ * This hook:
9
+ * 1. Detects messages with no valid content (empty text or no parts)
10
+ * 2. Injects placeholder text to prevent API errors
11
+ * 3. Marks injected content as synthetic
12
+ *
13
+ * NOTE: This sanitizer would ideally run on a message transform hook that executes
14
+ * AFTER all other message processing. In the shell hooks system, this should be
15
+ * invoked at the last stage before messages are sent to the API.
16
+ *
17
+ * Adapted from oh-my-opencode's empty-message-sanitizer hook.
18
+ */
19
+ import * as fs from 'fs';
20
+ import * as path from 'path';
21
+ import { tmpdir } from 'os';
22
+ import { PLACEHOLDER_TEXT, TOOL_PART_TYPES, HOOK_NAME, DEBUG_PREFIX, } from './constants.js';
23
+ const DEBUG = process.env.EMPTY_MESSAGE_SANITIZER_DEBUG === '1';
24
+ const DEBUG_FILE = path.join(tmpdir(), 'empty-message-sanitizer-debug.log');
25
+ function debugLog(...args) {
26
+ if (DEBUG) {
27
+ const msg = `[${new Date().toISOString()}] ${DEBUG_PREFIX} ${args
28
+ .map((a) => (typeof a === 'object' ? JSON.stringify(a, null, 2) : String(a)))
29
+ .join(' ')}\n`;
30
+ fs.appendFileSync(DEBUG_FILE, msg);
31
+ }
32
+ }
33
+ /**
34
+ * Check if a part has non-empty text content
35
+ */
36
+ export function hasTextContent(part) {
37
+ if (part.type === 'text') {
38
+ const text = part.text;
39
+ return Boolean(text && text.trim().length > 0);
40
+ }
41
+ return false;
42
+ }
43
+ /**
44
+ * Check if a part is a tool-related part
45
+ */
46
+ export function isToolPart(part) {
47
+ return TOOL_PART_TYPES.has(part.type);
48
+ }
49
+ /**
50
+ * Check if message parts contain valid content
51
+ * Valid content = non-empty text OR tool parts
52
+ */
53
+ export function hasValidContent(parts) {
54
+ return parts.some((part) => hasTextContent(part) || isToolPart(part));
55
+ }
56
+ /**
57
+ * Sanitize a single message to ensure it has valid content
58
+ */
59
+ export function sanitizeMessage(message, isLastMessage, placeholderText = PLACEHOLDER_TEXT) {
60
+ const isAssistant = message.info.role === 'assistant';
61
+ // Skip final assistant message (allowed to be empty per API spec)
62
+ if (isLastMessage && isAssistant) {
63
+ debugLog('skipping final assistant message');
64
+ return false;
65
+ }
66
+ const parts = message.parts;
67
+ // FIX: Removed `&& parts.length > 0` - empty arrays also need sanitization
68
+ // When parts is [], the message has no content and would cause API error:
69
+ // "all messages must have non-empty content except for the optional final assistant message"
70
+ if (!hasValidContent(parts)) {
71
+ debugLog(`sanitizing message ${message.info.id}: no valid content`);
72
+ let injected = false;
73
+ // Try to find an existing empty text part and replace its content
74
+ for (const part of parts) {
75
+ if (part.type === 'text') {
76
+ if (!part.text || !part.text.trim()) {
77
+ part.text = placeholderText;
78
+ part.synthetic = true;
79
+ injected = true;
80
+ debugLog(`replaced empty text in existing part`);
81
+ break;
82
+ }
83
+ }
84
+ }
85
+ // If no text part was found, inject a new one
86
+ if (!injected) {
87
+ const insertIndex = parts.findIndex((p) => isToolPart(p));
88
+ const newPart = {
89
+ id: `synthetic_${Date.now()}`,
90
+ messageID: message.info.id,
91
+ sessionID: message.info.sessionID ?? '',
92
+ type: 'text',
93
+ text: placeholderText,
94
+ synthetic: true,
95
+ };
96
+ if (insertIndex === -1) {
97
+ // No tool parts, append to end
98
+ parts.push(newPart);
99
+ debugLog(`appended synthetic text part`);
100
+ }
101
+ else {
102
+ // Insert before first tool part
103
+ parts.splice(insertIndex, 0, newPart);
104
+ debugLog(`inserted synthetic text part before tool part`);
105
+ }
106
+ }
107
+ return true;
108
+ }
109
+ // Also sanitize any empty text parts that exist alongside valid content
110
+ let sanitized = false;
111
+ for (const part of parts) {
112
+ if (part.type === 'text') {
113
+ if (part.text !== undefined && part.text.trim() === '') {
114
+ part.text = placeholderText;
115
+ part.synthetic = true;
116
+ sanitized = true;
117
+ debugLog(`sanitized empty text part in message ${message.info.id}`);
118
+ }
119
+ }
120
+ }
121
+ return sanitized;
122
+ }
123
+ /**
124
+ * Sanitize all messages in the input
125
+ */
126
+ export function sanitizeMessages(input, config) {
127
+ const { messages } = input;
128
+ const placeholderText = config?.placeholderText ?? PLACEHOLDER_TEXT;
129
+ debugLog('sanitizing messages', { count: messages.length });
130
+ let sanitizedCount = 0;
131
+ for (let i = 0; i < messages.length; i++) {
132
+ const message = messages[i];
133
+ const isLastMessage = i === messages.length - 1;
134
+ const wasSanitized = sanitizeMessage(message, isLastMessage, placeholderText);
135
+ if (wasSanitized) {
136
+ sanitizedCount++;
137
+ }
138
+ }
139
+ debugLog(`sanitized ${sanitizedCount} messages`);
140
+ return {
141
+ messages,
142
+ sanitizedCount,
143
+ modified: sanitizedCount > 0,
144
+ };
145
+ }
146
+ /**
147
+ * Create empty message sanitizer hook for Claude Code shell hooks
148
+ *
149
+ * This hook ensures all messages have valid content before being sent to the API.
150
+ * It should be called at the last stage of message processing.
151
+ */
152
+ export function createEmptyMessageSanitizerHook(config) {
153
+ debugLog('createEmptyMessageSanitizerHook called', { config });
154
+ return {
155
+ /**
156
+ * Sanitize messages (called during message transform phase)
157
+ */
158
+ sanitize: (input) => {
159
+ return sanitizeMessages(input, config);
160
+ },
161
+ /**
162
+ * Get hook name
163
+ */
164
+ getName: () => {
165
+ return HOOK_NAME;
166
+ },
167
+ };
168
+ }
169
+ // Re-export constants
170
+ export { PLACEHOLDER_TEXT, TOOL_PART_TYPES, HOOK_NAME, DEBUG_PREFIX, ERROR_PATTERNS, } from './constants.js';
171
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3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,KAAiC,EAA+B,EAAE;YAC3E,OAAO,gBAAgB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACzC,CAAC;QAED;;WAEG;QACH,OAAO,EAAE,GAAW,EAAE;YACpB,OAAO,SAAS,CAAC;QACnB,CAAC;KACF,CAAC;AACJ,CAAC;AAYD,sBAAsB;AACtB,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,SAAS,EACT,YAAY,EACZ,cAAc,GACf,MAAM,gBAAgB,CAAC"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Empty Message Sanitizer Types
3
+ *
4
+ * Type definitions for the empty message sanitizer hook.
5
+ * This hook prevents API errors by ensuring all messages have valid content.
6
+ *
7
+ * Adapted from oh-my-opencode's empty-message-sanitizer hook.
8
+ */
9
+ /**
10
+ * A message part in Claude Code's message format
11
+ */
12
+ export interface MessagePart {
13
+ /** Unique identifier for this part */
14
+ id?: string;
15
+ /** Message ID this part belongs to */
16
+ messageID?: string;
17
+ /** Session ID this part belongs to */
18
+ sessionID?: string;
19
+ /** Part type (text, tool, tool_use, tool_result, etc.) */
20
+ type: string;
21
+ /** Text content (for text parts) */
22
+ text?: string;
23
+ /** Whether this is synthetically injected content */
24
+ synthetic?: boolean;
25
+ /** Additional properties */
26
+ [key: string]: unknown;
27
+ }
28
+ /**
29
+ * Message info metadata
30
+ */
31
+ export interface MessageInfo {
32
+ /** Message identifier */
33
+ id: string;
34
+ /** Message role (user, assistant) */
35
+ role: 'user' | 'assistant';
36
+ /** Session ID */
37
+ sessionID?: string;
38
+ /** Additional properties */
39
+ [key: string]: unknown;
40
+ }
41
+ /**
42
+ * A message with its parts
43
+ */
44
+ export interface MessageWithParts {
45
+ /** Message metadata */
46
+ info: MessageInfo;
47
+ /** Message content parts */
48
+ parts: MessagePart[];
49
+ }
50
+ /**
51
+ * Input for the empty message sanitizer hook
52
+ */
53
+ export interface EmptyMessageSanitizerInput {
54
+ /** List of messages to sanitize */
55
+ messages: MessageWithParts[];
56
+ /** Session identifier */
57
+ sessionId?: string;
58
+ }
59
+ /**
60
+ * Output from the empty message sanitizer hook
61
+ */
62
+ export interface EmptyMessageSanitizerOutput {
63
+ /** Sanitized messages */
64
+ messages: MessageWithParts[];
65
+ /** Number of messages sanitized */
66
+ sanitizedCount: number;
67
+ /** Whether any sanitization occurred */
68
+ modified: boolean;
69
+ }
70
+ /**
71
+ * Hook configuration
72
+ */
73
+ export interface EmptyMessageSanitizerConfig {
74
+ /** Custom placeholder text (default: "[user interrupted]") */
75
+ placeholderText?: string;
76
+ /** Enable debug logging */
77
+ debug?: boolean;
78
+ }
79
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/empty-message-sanitizer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,sCAAsC;IACtC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0DAA0D;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,oCAAoC;IACpC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,4BAA4B;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,yBAAyB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,qCAAqC;IACrC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,iBAAiB;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4BAA4B;IAC5B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,uBAAuB;IACvB,IAAI,EAAE,WAAW,CAAC;IAClB,4BAA4B;IAC5B,KAAK,EAAE,WAAW,EAAE,CAAC;CACtB;AAED;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,mCAAmC;IACnC,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,yBAAyB;IACzB,QAAQ,EAAE,gBAAgB,EAAE,CAAC;IAC7B,mCAAmC;IACnC,cAAc,EAAE,MAAM,CAAC;IACvB,wCAAwC;IACxC,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,8DAA8D;IAC9D,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Empty Message Sanitizer Types
3
+ *
4
+ * Type definitions for the empty message sanitizer hook.
5
+ * This hook prevents API errors by ensuring all messages have valid content.
6
+ *
7
+ * Adapted from oh-my-opencode's empty-message-sanitizer hook.
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hooks/empty-message-sanitizer/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Hooks Module for Olympus
3
+ *
4
+ * This module provides the TypeScript bridge for Claude Code's native shell hook system.
5
+ * Shell scripts call these TypeScript functions for complex logic processing.
6
+ *
7
+ * Architecture:
8
+ * - Claude Code runs shell scripts on hook events (UserPromptSubmit, Stop, etc.)
9
+ * - Shell scripts invoke Node.js bridge for complex processing
10
+ * - Bridge returns JSON response that shell passes back to Claude Code
11
+ */
12
+ export { detectKeywordsWithType, extractPromptText, removeCodeBlocks, type DetectedKeyword, type KeywordType } from './keyword-detector/index.js';
13
+ export { createAscentLoopHook, readAscentState, writeAscentState, clearAscentState, type AscentLoopState, type AscentLoopHook } from './the-ascent/index.js';
14
+ export { createTodoContinuationHook, checkIncompleteTodos, type TodoContinuationHook } from './todo-continuation/index.js';
15
+ export { processHook, type HookInput, type HookOutput } from './bridge.js';
16
+ export { createEditErrorRecoveryHook, detectEditError, injectEditErrorRecovery, processEditOutput, EDIT_ERROR_PATTERNS, EDIT_ERROR_REMINDER, type ToolExecuteInput, type ToolExecuteOutput } from './edit-error-recovery/index.js';
17
+ export { createThinkModeHook, detectThinkKeyword, detectUltrathinkKeyword, extractPromptText as extractThinkPromptText, removeCodeBlocks as removeThinkCodeBlocks, getHighVariant, isAlreadyHighVariant, getThinkingConfig, getClaudeThinkingConfig, clearThinkModeState, getThinkModeState, isThinkModeActive, processThinkMode, shouldActivateThinkMode, shouldActivateUltrathink, THINKING_CONFIGS, type ThinkModeState, type ModelRef, type MessageWithModel, type ThinkModeInput, type ClaudeThinkingConfig, type ThinkingConfig } from './think-mode/index.js';
18
+ export { createRulesInjectorHook, getRulesForPath, findProjectRoot, findRuleFiles, parseRuleFrontmatter, shouldApplyRule, createContentHash, isDuplicateByRealPath, isDuplicateByContentHash, loadInjectedRules, saveInjectedRules, clearInjectedRules, RULES_INJECTOR_STORAGE, PROJECT_MARKERS, PROJECT_RULE_SUBDIRS, PROJECT_RULE_FILES, USER_RULE_DIR, RULE_EXTENSIONS, TRACKED_TOOLS, type RuleMetadata, type RuleInfo, type RuleFileCandidate, type InjectedRulesData, type RuleToInject, type MatchResult, type RuleFrontmatterResult } from './rules-injector/index.js';
19
+ export { createOlympusOrchestratorHook, isAllowedPath, isWriteEditTool, getGitDiffStats, formatFileChanges, buildVerificationReminder, buildOrchestratorReminder, buildBoulderContinuation, checkBoulderContinuation, processOrchestratorPreTool, processOrchestratorPostTool, HOOK_NAME as OLYMPUS_ORCHESTRATOR_HOOK_NAME, ALLOWED_PATH_PREFIX, WRITE_EDIT_TOOLS, DIRECT_WORK_REMINDER, ORCHESTRATOR_DELEGATION_REQUIRED, BOULDER_CONTINUATION_PROMPT, VERIFICATION_REMINDER, SINGLE_TASK_DIRECTIVE, type ToolExecuteInput as OrchestratorToolInput, type ToolExecuteOutput as OrchestratorToolOutput } from './olympus-orchestrator/index.js';
20
+ export { createAutoSlashCommandHook, processSlashCommand, detectSlashCommand, extractPromptText as extractSlashPromptText, parseSlashCommand, removeCodeBlocks as removeSlashCodeBlocks, isExcludedCommand, executeSlashCommand, findCommand, discoverAllCommands, listAvailableCommands, HOOK_NAME as AUTO_SLASH_COMMAND_HOOK_NAME, AUTO_SLASH_COMMAND_TAG_OPEN, AUTO_SLASH_COMMAND_TAG_CLOSE, SLASH_COMMAND_PATTERN, EXCLUDED_COMMANDS, type AutoSlashCommandHookInput, type AutoSlashCommandHookOutput, type ParsedSlashCommand, type AutoSlashCommandResult, type CommandInfo, type CommandMetadata, type CommandScope, type ExecuteResult } from './auto-slash-command/index.js';
21
+ export { createCommentCheckerHook, checkForComments, applyFilters as applyCommentFilters, BDD_KEYWORDS, TYPE_CHECKER_PREFIXES, HOOK_MESSAGE_HEADER as COMMENT_CHECKER_MESSAGE_HEADER, LINE_COMMENT_PATTERNS, EXTENSION_TO_LANGUAGE, type CommentInfo, type CommentCheckResult, type PendingCall as CommentPendingCall, type CommentCheckerConfig } from './comment-checker/index.js';
22
+ export { createContextLimitRecoveryHook, detectContextLimitError, parseContextLimitError, parseTokenLimitError, containsTokenLimitError, TOKEN_LIMIT_PATTERNS, TOKEN_LIMIT_KEYWORDS, CONTEXT_LIMIT_RECOVERY_MESSAGE, CONTEXT_LIMIT_SHORT_MESSAGE, NON_EMPTY_CONTENT_RECOVERY_MESSAGE, TRUNCATION_APPLIED_MESSAGE, RECOVERY_FAILED_MESSAGE, RETRY_CONFIG, TRUNCATE_CONFIG, type ParsedTokenLimitError, type RetryState, type TruncateState, type RecoveryResult, type ContextLimitRecoveryConfig } from './context-window-limit-recovery/index.js';
23
+ export { createPreemptiveCompactionHook, estimateTokens, analyzeContextUsage, getSessionTokenEstimate, resetSessionTokenEstimate, DEFAULT_THRESHOLD as PREEMPTIVE_DEFAULT_THRESHOLD, CRITICAL_THRESHOLD, COMPACTION_COOLDOWN_MS, MAX_WARNINGS, CLAUDE_DEFAULT_CONTEXT_LIMIT, CHARS_PER_TOKEN, CONTEXT_WARNING_MESSAGE, CONTEXT_CRITICAL_MESSAGE, type ContextUsageResult, type PreemptiveCompactionConfig } from './preemptive-compaction/index.js';
24
+ export { createBackgroundNotificationHook, processBackgroundNotification, processBackgroundNotificationHook, checkBackgroundNotifications, handleBackgroundEvent, HOOK_NAME as BACKGROUND_NOTIFICATION_HOOK_NAME, type BackgroundNotificationHookConfig, type BackgroundNotificationHookInput, type BackgroundNotificationHookOutput, type NotificationCheckResult } from './background-notification/index.js';
25
+ export { createDirectoryReadmeInjectorHook, getReadmesForPath, loadInjectedPaths, saveInjectedPaths, clearInjectedPaths, README_INJECTOR_STORAGE, README_FILENAME, TRACKED_TOOLS as README_TRACKED_TOOLS, type InjectedPathsData } from './directory-readme-injector/index.js';
26
+ export { createEmptyMessageSanitizerHook, sanitizeMessages, sanitizeMessage, hasTextContent, isToolPart, hasValidContent, PLACEHOLDER_TEXT, TOOL_PART_TYPES, HOOK_NAME as EMPTY_MESSAGE_SANITIZER_HOOK_NAME, DEBUG_PREFIX as EMPTY_MESSAGE_SANITIZER_DEBUG_PREFIX, ERROR_PATTERNS as EMPTY_MESSAGE_SANITIZER_ERROR_PATTERNS, type MessagePart, type MessageInfo, type MessageWithParts, type EmptyMessageSanitizerInput, type EmptyMessageSanitizerOutput, type EmptyMessageSanitizerConfig } from './empty-message-sanitizer/index.js';
27
+ export { createThinkingBlockValidatorHook, isExtendedThinkingModel, hasContentParts, startsWithThinkingBlock, findPreviousThinkingContent, prependThinkingBlock, validateMessage, validateMessages, getValidationStats, HOOK_NAME as THINKING_BLOCK_VALIDATOR_HOOK_NAME, CONTENT_PART_TYPES, THINKING_PART_TYPES, THINKING_MODEL_PATTERNS, DEFAULT_THINKING_CONTENT, SYNTHETIC_THINKING_ID_PREFIX, PREVENTED_ERROR, type MessagePart as ThinkingValidatorMessagePart, type MessageInfo as ThinkingValidatorMessageInfo, type MessageWithParts as ThinkingValidatorMessageWithParts, type MessagesTransformInput, type MessagesTransformOutput, type MessagesTransformHook, type ValidationResult } from './thinking-block-validator/index.js';
28
+ export { nonInteractiveEnvHook, isNonInteractive, HOOK_NAME as NON_INTERACTIVE_ENV_HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS, type NonInteractiveEnvConfig, type ShellHook } from './non-interactive-env/index.js';
29
+ export { createSessionRecoveryHook, handleSessionRecovery, detectErrorType, isRecoverableError, findEmptyMessages as findRecoveryEmptyMessages, findMessagesWithThinkingBlocks as findRecoveryThinkingBlocks, findMessagesWithOrphanThinking as findRecoveryOrphanThinking, readMessages as readRecoveryMessages, readParts as readRecoveryParts, RECOVERY_MESSAGES, PLACEHOLDER_TEXT as RECOVERY_PLACEHOLDER_TEXT, type MessageData, type RecoveryErrorType, type RecoveryResult as SessionRecoveryResult, type SessionRecoveryConfig, type StoredMessageMeta, type StoredPart, type StoredTextPart, type StoredToolPart } from './session-recovery/index.js';
30
+ export { createAgentUsageReminderHook, loadAgentUsageState, saveAgentUsageState, clearAgentUsageState, TARGET_TOOLS, AGENT_TOOLS, REMINDER_MESSAGE, type AgentUsageState } from './agent-usage-reminder/index.js';
31
+ export { activateUltrawork, deactivateUltrawork, readUltraworkState, writeUltraworkState, incrementReinforcement, shouldReinforceUltrawork, getUltraworkPersistenceMessage, createUltraworkStateHook, type UltraworkState } from './ultrawork-state/index.js';
32
+ export { checkPersistentModes, createHookOutput, type PersistentModeResult } from './persistent-mode/index.js';
33
+ export { getFormatter, isFormatterAvailable, formatFile, getLinter, lintFile, validateCommitMessage, runTypeCheck, runTests, runPreCommitChecks, getPreCommitReminderMessage, getAutoFormatMessage, type FormatConfig, type LintConfig, type CommitConfig, type PreCommitResult } from './plugin-patterns/index.js';
34
+ export { readVerificationState, writeVerificationState, clearVerificationState, startVerification, recordOracleFeedback, getOracleVerificationPrompt, getOracleRejectionContinuationPrompt, detectOracleApproval, detectOracleRejection, type VerificationState } from './ascent-verifier/index.js';
35
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAEL,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAEL,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAEL,0BAA0B,EAC1B,oBAAoB,EACpB,KAAK,oBAAoB,EAC1B,MAAM,8BAA8B,CAAC;AAEtC,OAAO,EAEL,WAAW,EACX,KAAK,SAAS,EACd,KAAK,UAAU,EAChB,MAAM,aAAa,CAAC;AAErB,OAAO,EAEL,2BAA2B,EAC3B,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAEL,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,IAAI,sBAAsB,EAC3C,gBAAgB,IAAI,qBAAqB,EACzC,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,QAAQ,EACb,KAA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4BAA4B,CAAC"}
@@ -0,0 +1,81 @@
1
+ /**
2
+ * Hooks Module for Olympus
3
+ *
4
+ * This module provides the TypeScript bridge for Claude Code's native shell hook system.
5
+ * Shell scripts call these TypeScript functions for complex logic processing.
6
+ *
7
+ * Architecture:
8
+ * - Claude Code runs shell scripts on hook events (UserPromptSubmit, Stop, etc.)
9
+ * - Shell scripts invoke Node.js bridge for complex processing
10
+ * - Bridge returns JSON response that shell passes back to Claude Code
11
+ */
12
+ export {
13
+ // Keyword detection
14
+ detectKeywordsWithType, extractPromptText, removeCodeBlocks } from './keyword-detector/index.js';
15
+ export {
16
+ // The Ascent (persistence)
17
+ createAscentLoopHook, readAscentState, writeAscentState, clearAscentState } from './the-ascent/index.js';
18
+ export {
19
+ // Todo Continuation
20
+ createTodoContinuationHook, checkIncompleteTodos } from './todo-continuation/index.js';
21
+ export {
22
+ // Hook Bridge (main entry point for shell scripts)
23
+ processHook } from './bridge.js';
24
+ export {
25
+ // Edit Error Recovery
26
+ createEditErrorRecoveryHook, detectEditError, injectEditErrorRecovery, processEditOutput, EDIT_ERROR_PATTERNS, EDIT_ERROR_REMINDER } from './edit-error-recovery/index.js';
27
+ export {
28
+ // Think Mode
29
+ createThinkModeHook, detectThinkKeyword, detectUltrathinkKeyword, extractPromptText as extractThinkPromptText, removeCodeBlocks as removeThinkCodeBlocks, getHighVariant, isAlreadyHighVariant, getThinkingConfig, getClaudeThinkingConfig, clearThinkModeState, getThinkModeState, isThinkModeActive, processThinkMode, shouldActivateThinkMode, shouldActivateUltrathink, THINKING_CONFIGS } from './think-mode/index.js';
30
+ export {
31
+ // Rules Injector
32
+ createRulesInjectorHook, getRulesForPath, findProjectRoot, findRuleFiles, parseRuleFrontmatter, shouldApplyRule, createContentHash, isDuplicateByRealPath, isDuplicateByContentHash, loadInjectedRules, saveInjectedRules, clearInjectedRules, RULES_INJECTOR_STORAGE, PROJECT_MARKERS, PROJECT_RULE_SUBDIRS, PROJECT_RULE_FILES, USER_RULE_DIR, RULE_EXTENSIONS, TRACKED_TOOLS } from './rules-injector/index.js';
33
+ export {
34
+ // Olympus Orchestrator
35
+ createOlympusOrchestratorHook, isAllowedPath, isWriteEditTool, getGitDiffStats, formatFileChanges, buildVerificationReminder, buildOrchestratorReminder, buildBoulderContinuation, checkBoulderContinuation, processOrchestratorPreTool, processOrchestratorPostTool, HOOK_NAME as OLYMPUS_ORCHESTRATOR_HOOK_NAME, ALLOWED_PATH_PREFIX, WRITE_EDIT_TOOLS, DIRECT_WORK_REMINDER, ORCHESTRATOR_DELEGATION_REQUIRED, BOULDER_CONTINUATION_PROMPT, VERIFICATION_REMINDER, SINGLE_TASK_DIRECTIVE } from './olympus-orchestrator/index.js';
36
+ export {
37
+ // Auto Slash Command
38
+ createAutoSlashCommandHook, processSlashCommand, detectSlashCommand, extractPromptText as extractSlashPromptText, parseSlashCommand, removeCodeBlocks as removeSlashCodeBlocks, isExcludedCommand, executeSlashCommand, findCommand, discoverAllCommands, listAvailableCommands, HOOK_NAME as AUTO_SLASH_COMMAND_HOOK_NAME, AUTO_SLASH_COMMAND_TAG_OPEN, AUTO_SLASH_COMMAND_TAG_CLOSE, SLASH_COMMAND_PATTERN, EXCLUDED_COMMANDS } from './auto-slash-command/index.js';
39
+ export {
40
+ // Comment Checker
41
+ createCommentCheckerHook, checkForComments, applyFilters as applyCommentFilters, BDD_KEYWORDS, TYPE_CHECKER_PREFIXES, HOOK_MESSAGE_HEADER as COMMENT_CHECKER_MESSAGE_HEADER, LINE_COMMENT_PATTERNS, EXTENSION_TO_LANGUAGE } from './comment-checker/index.js';
42
+ export {
43
+ // Context Window Limit Recovery
44
+ createContextLimitRecoveryHook, detectContextLimitError, parseContextLimitError, parseTokenLimitError, containsTokenLimitError, TOKEN_LIMIT_PATTERNS, TOKEN_LIMIT_KEYWORDS, CONTEXT_LIMIT_RECOVERY_MESSAGE, CONTEXT_LIMIT_SHORT_MESSAGE, NON_EMPTY_CONTENT_RECOVERY_MESSAGE, TRUNCATION_APPLIED_MESSAGE, RECOVERY_FAILED_MESSAGE, RETRY_CONFIG, TRUNCATE_CONFIG } from './context-window-limit-recovery/index.js';
45
+ export {
46
+ // Preemptive Compaction
47
+ createPreemptiveCompactionHook, estimateTokens, analyzeContextUsage, getSessionTokenEstimate, resetSessionTokenEstimate, DEFAULT_THRESHOLD as PREEMPTIVE_DEFAULT_THRESHOLD, CRITICAL_THRESHOLD, COMPACTION_COOLDOWN_MS, MAX_WARNINGS, CLAUDE_DEFAULT_CONTEXT_LIMIT, CHARS_PER_TOKEN, CONTEXT_WARNING_MESSAGE, CONTEXT_CRITICAL_MESSAGE } from './preemptive-compaction/index.js';
48
+ export {
49
+ // Background Notification
50
+ createBackgroundNotificationHook, processBackgroundNotification, processBackgroundNotificationHook, checkBackgroundNotifications, handleBackgroundEvent, HOOK_NAME as BACKGROUND_NOTIFICATION_HOOK_NAME } from './background-notification/index.js';
51
+ export {
52
+ // Directory README Injector
53
+ createDirectoryReadmeInjectorHook, getReadmesForPath, loadInjectedPaths, saveInjectedPaths, clearInjectedPaths, README_INJECTOR_STORAGE, README_FILENAME, TRACKED_TOOLS as README_TRACKED_TOOLS } from './directory-readme-injector/index.js';
54
+ export {
55
+ // Empty Message Sanitizer
56
+ createEmptyMessageSanitizerHook, sanitizeMessages, sanitizeMessage, hasTextContent, isToolPart, hasValidContent, PLACEHOLDER_TEXT, TOOL_PART_TYPES, HOOK_NAME as EMPTY_MESSAGE_SANITIZER_HOOK_NAME, DEBUG_PREFIX as EMPTY_MESSAGE_SANITIZER_DEBUG_PREFIX, ERROR_PATTERNS as EMPTY_MESSAGE_SANITIZER_ERROR_PATTERNS } from './empty-message-sanitizer/index.js';
57
+ export {
58
+ // Thinking Block Validator
59
+ createThinkingBlockValidatorHook, isExtendedThinkingModel, hasContentParts, startsWithThinkingBlock, findPreviousThinkingContent, prependThinkingBlock, validateMessage, validateMessages, getValidationStats, HOOK_NAME as THINKING_BLOCK_VALIDATOR_HOOK_NAME, CONTENT_PART_TYPES, THINKING_PART_TYPES, THINKING_MODEL_PATTERNS, DEFAULT_THINKING_CONTENT, SYNTHETIC_THINKING_ID_PREFIX, PREVENTED_ERROR } from './thinking-block-validator/index.js';
60
+ export {
61
+ // Non-Interactive Environment
62
+ nonInteractiveEnvHook, isNonInteractive, HOOK_NAME as NON_INTERACTIVE_ENV_HOOK_NAME, NON_INTERACTIVE_ENV, SHELL_COMMAND_PATTERNS } from './non-interactive-env/index.js';
63
+ export {
64
+ // Session Recovery
65
+ createSessionRecoveryHook, handleSessionRecovery, detectErrorType, isRecoverableError, findEmptyMessages as findRecoveryEmptyMessages, findMessagesWithThinkingBlocks as findRecoveryThinkingBlocks, findMessagesWithOrphanThinking as findRecoveryOrphanThinking, readMessages as readRecoveryMessages, readParts as readRecoveryParts, RECOVERY_MESSAGES, PLACEHOLDER_TEXT as RECOVERY_PLACEHOLDER_TEXT } from './session-recovery/index.js';
66
+ export {
67
+ // Agent Usage Reminder
68
+ createAgentUsageReminderHook, loadAgentUsageState, saveAgentUsageState, clearAgentUsageState, TARGET_TOOLS, AGENT_TOOLS, REMINDER_MESSAGE } from './agent-usage-reminder/index.js';
69
+ export {
70
+ // Ultrawork State (Persistent Mode)
71
+ activateUltrawork, deactivateUltrawork, readUltraworkState, writeUltraworkState, incrementReinforcement, shouldReinforceUltrawork, getUltraworkPersistenceMessage, createUltraworkStateHook } from './ultrawork-state/index.js';
72
+ export {
73
+ // Persistent Mode (Unified Stop Handler)
74
+ checkPersistentModes, createHookOutput } from './persistent-mode/index.js';
75
+ export {
76
+ // Plugin Patterns (Popular Community Patterns)
77
+ getFormatter, isFormatterAvailable, formatFile, getLinter, lintFile, validateCommitMessage, runTypeCheck, runTests, runPreCommitChecks, getPreCommitReminderMessage, getAutoFormatMessage } from './plugin-patterns/index.js';
78
+ export {
79
+ // Ascent Verifier (Oracle-verified completion)
80
+ readVerificationState, writeVerificationState, clearVerificationState, startVerification, recordOracleFeedback, getOracleVerificationPrompt, getOracleRejectionContinuationPrompt, detectOracleApproval, detectOracleRejection } from './ascent-verifier/index.js';
81
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO;AACL,oBAAoB;AACpB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAGjB,MAAM,6BAA6B,CAAC;AAErC,OAAO;AACL,2BAA2B;AAC3B,oBAAoB,EACpB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAGjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO;AACL,oBAAoB;AACpB,0BAA0B,EAC1B,oBAAoB,EAErB,MAAM,8BAA8B,CAAC;AAEtC,OAAO;AACL,mDAAmD;AACnD,WAAW,EAGZ,MAAM,aAAa,CAAC;AAErB,OAAO;AACL,sBAAsB;AACtB,2BAA2B,EAC3B,eAAe,EACf,uBAAuB,EACvB,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EAGpB,MAAM,gCAAgC,CAAC;AAExC,OAAO;AACL,aAAa;AACb,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,iBAAiB,IAAI,sBAAsB,EAC3C,gBAAgB,IAAI,qBAAqB,EACzC,cAAc,EACd,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAOjB,MAAM,uBAAuB,CAAC;AAE/B,OAAO;AACL,iBAAiB;AACjB,uBAAuB,EACvB,eAAe,EACf,eAAe,EACf,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,iBAAiB,EACjB,qBAAqB,EACrB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,eAAe,EACf,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,eAA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AAe,EACf,kBAAkB,EAClB,iBAAiB,IAAI,yBAAyB,EAC9C,8BAA8B,IAAI,0BAA0B,EAC5D,8BAA8B,IAAI,0BAA0B,EAC5D,YAAY,IAAI,oBAAoB,EACpC,SAAS,IAAI,iBAAiB,EAC9B,iBAAiB,EACjB,gBAAgB,IAAI,yBAAyB,EAS9C,MAAM,6BAA6B,CAAC;AAErC,OAAO;AACL,uBAAuB;AACvB,4BAA4B,EAC5B,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,gBAAgB,EAEjB,MAAM,iCAAiC,CAAC;AAEzC,OAAO;AACL,oCAAoC;AACpC,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,EACtB,wBAAwB,EACxB,8BAA8B,EAC9B,wBAAwB,EAEzB,MAAM,4BAA4B,CAAC;AAEpC,OAAO;AACL,yCAAyC;AACzC,oBAAoB,EACpB,gBAAgB,EAEjB,MAAM,4BAA4B,CAAC;AAEpC,OAAO;AACL,+CAA+C;AAC/C,YAAY,EACZ,oBAAoB,EACpB,UAAU,EACV,SAAS,EACT,QAAQ,EACR,qBAAqB,EACrB,YAAY,EACZ,QAAQ,EACR,kBAAkB,EAClB,2BAA2B,EAC3B,oBAAoB,EAKrB,MAAM,4BAA4B,CAAC;AAEpC,OAAO;AACL,+CAA+C;AAC/C,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,iBAAiB,EACjB,oBAAoB,EACpB,2BAA2B,EAC3B,oCAAoC,EACpC,oBAAoB,EACpB,qBAAqB,EAEtB,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Keyword Detector Hook
3
+ *
4
+ * Detects magic keywords in user prompts and returns the appropriate
5
+ * mode message to inject into context.
6
+ *
7
+ * Ported from oh-my-opencode's keyword-detector hook.
8
+ */
9
+ export type KeywordType = 'ultrawork' | 'ultrathink' | 'search' | 'analyze';
10
+ export interface DetectedKeyword {
11
+ type: KeywordType;
12
+ keyword: string;
13
+ position: number;
14
+ }
15
+ /**
16
+ * Remove code blocks from text to prevent false positives
17
+ * Handles both fenced code blocks and inline code
18
+ */
19
+ export declare function removeCodeBlocks(text: string): string;
20
+ /**
21
+ * Extract prompt text from message parts
22
+ */
23
+ export declare function extractPromptText(parts: Array<{
24
+ type: string;
25
+ text?: string;
26
+ [key: string]: unknown;
27
+ }>): string;
28
+ /**
29
+ * Detect keywords in text and return matches with type info
30
+ */
31
+ export declare function detectKeywordsWithType(text: string, _agentName?: string): DetectedKeyword[];
32
+ /**
33
+ * Check if text contains any magic keyword
34
+ */
35
+ export declare function hasKeyword(text: string): boolean;
36
+ /**
37
+ * Get the highest priority keyword detected
38
+ */
39
+ export declare function getPrimaryKeyword(text: string): DetectedKeyword | null;
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/keyword-detector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,MAAM,WAAW,GAAG,WAAW,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE5E,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,WAAW,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAkBD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CASrD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,KAAK,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;CAAE,CAAC,GACpE,MAAM,CAKR;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAClB,eAAe,EAAE,CAkBnB;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAGhD;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAiBtE"}
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Keyword Detector Hook
3
+ *
4
+ * Detects magic keywords in user prompts and returns the appropriate
5
+ * mode message to inject into context.
6
+ *
7
+ * Ported from oh-my-opencode's keyword-detector hook.
8
+ */
9
+ /**
10
+ * Keyword patterns for each mode
11
+ */
12
+ const KEYWORD_PATTERNS = {
13
+ ultrawork: /\b(ultrawork|ulw)\b/i,
14
+ ultrathink: /\b(ultrathink|think)\b/i,
15
+ search: /\b(search|find|locate|lookup|explore|discover|scan|grep|query|browse|detect|trace|seek|track|pinpoint|hunt)\b|where\s+is|show\s+me|list\s+all/i,
16
+ analyze: /\b(analyze|analyse|investigate|examine|research|study|deep.?dive|inspect|audit|evaluate|assess|review|diagnose|scrutinize|dissect|debug|comprehend|interpret|breakdown|understand)\b|why\s+is|how\s+does|how\s+to/i
17
+ };
18
+ /**
19
+ * Priority order for keyword detection
20
+ * Higher priority keywords take precedence
21
+ */
22
+ const KEYWORD_PRIORITY = ['ultrawork', 'ultrathink', 'search', 'analyze'];
23
+ /**
24
+ * Remove code blocks from text to prevent false positives
25
+ * Handles both fenced code blocks and inline code
26
+ */
27
+ export function removeCodeBlocks(text) {
28
+ // Remove fenced code blocks (``` or ~~~)
29
+ let result = text.replace(/```[\s\S]*?```/g, '');
30
+ result = result.replace(/~~~[\s\S]*?~~~/g, '');
31
+ // Remove inline code (single backticks)
32
+ result = result.replace(/`[^`]+`/g, '');
33
+ return result;
34
+ }
35
+ /**
36
+ * Extract prompt text from message parts
37
+ */
38
+ export function extractPromptText(parts) {
39
+ return parts
40
+ .filter(p => p.type === 'text' && p.text)
41
+ .map(p => p.text)
42
+ .join(' ');
43
+ }
44
+ /**
45
+ * Detect keywords in text and return matches with type info
46
+ */
47
+ export function detectKeywordsWithType(text, _agentName) {
48
+ const detected = [];
49
+ // Check each keyword type
50
+ for (const type of KEYWORD_PRIORITY) {
51
+ const pattern = KEYWORD_PATTERNS[type];
52
+ const match = text.match(pattern);
53
+ if (match && match.index !== undefined) {
54
+ detected.push({
55
+ type,
56
+ keyword: match[0],
57
+ position: match.index
58
+ });
59
+ }
60
+ }
61
+ return detected;
62
+ }
63
+ /**
64
+ * Check if text contains any magic keyword
65
+ */
66
+ export function hasKeyword(text) {
67
+ const cleanText = removeCodeBlocks(text);
68
+ return detectKeywordsWithType(cleanText).length > 0;
69
+ }
70
+ /**
71
+ * Get the highest priority keyword detected
72
+ */
73
+ export function getPrimaryKeyword(text) {
74
+ const cleanText = removeCodeBlocks(text);
75
+ const detected = detectKeywordsWithType(cleanText);
76
+ if (detected.length === 0) {
77
+ return null;
78
+ }
79
+ // Return highest priority (first in KEYWORD_PRIORITY order)
80
+ for (const type of KEYWORD_PRIORITY) {
81
+ const match = detected.find(d => d.type === type);
82
+ if (match) {
83
+ return match;
84
+ }
85
+ }
86
+ return detected[0];
87
+ }
88
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/keyword-detector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAUH;;GAEG;AACH,MAAM,gBAAgB,GAAgC;IACpD,SAAS,EAAE,sBAAsB;IACjC,UAAU,EAAE,yBAAyB;IACrC,MAAM,EAAE,gJAAgJ;IACxJ,OAAO,EAAE,oNAAoN;CAC9N,CAAC;AAEF;;;GAGG;AACH,MAAM,gBAAgB,GAAkB,CAAC,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;AAEzF;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,yCAAyC;IACzC,IAAI,MAAM,GAAG,IAAI,CAA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CAAC,MAAM,GAAG,CAAC,CAAC;AACtD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC5C,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,QAAQ,GAAG,sBAAsB,CAAC,SAAS,CAAC,CAAC;IAEnD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,4DAA4D;IAC5D,KAAK,MAAM,IAAI,IAAI,gBAAgB,EAAE,CAAC;QACpC,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAClD,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;AACrB,CAAC"}
@@ -0,0 +1,35 @@
1
+ export declare const HOOK_NAME = "non-interactive-env";
2
+ export declare const NON_INTERACTIVE_ENV: Record<string, string>;
3
+ /**
4
+ * Shell command guidance for non-interactive environments.
5
+ * These patterns should be followed to avoid hanging on user input.
6
+ */
7
+ export declare const SHELL_COMMAND_PATTERNS: {
8
+ readonly npm: {
9
+ readonly bad: readonly ["npm init", "npm install (prompts)"];
10
+ readonly good: readonly ["npm init -y", "npm install --yes"];
11
+ };
12
+ readonly apt: {
13
+ readonly bad: readonly ["apt-get install pkg"];
14
+ readonly good: readonly ["apt-get install -y pkg", "DEBIAN_FRONTEND=noninteractive apt-get install pkg"];
15
+ };
16
+ readonly pip: {
17
+ readonly bad: readonly ["pip install pkg (with prompts)"];
18
+ readonly good: readonly ["pip install --no-input pkg", "PIP_NO_INPUT=1 pip install pkg"];
19
+ };
20
+ readonly git: {
21
+ readonly bad: readonly ["git commit", "git merge branch", "git add -p", "git rebase -i"];
22
+ readonly good: readonly ["git commit -m 'msg'", "git merge --no-edit branch", "git add .", "git rebase --no-edit"];
23
+ };
24
+ readonly system: {
25
+ readonly bad: readonly ["rm file (prompts)", "cp a b (prompts)", "ssh host"];
26
+ readonly good: readonly ["rm -f file", "cp -f a b", "ssh -o BatchMode=yes host", "unzip -o file.zip"];
27
+ };
28
+ readonly banned: readonly ["vim", "nano", "vi", "emacs", "less", "more", "man", "python (REPL)", "node (REPL)", "git add -p", "git rebase -i"];
29
+ readonly workarounds: {
30
+ readonly yesPipe: "yes | ./script.sh";
31
+ readonly heredoc: "./script.sh <<EOF\noption1\noption2\nEOF";
32
+ readonly expectAlternative: "Use environment variables or config files instead of expect";
33
+ };
34
+ };
35
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/non-interactive-env/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,wBAAwB,CAAA;AAE9C,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAqBtD,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCzB,CAAA"}