oh-my-claude-sisyphus 3.7.3 → 3.7.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (387) hide show
  1. package/agents/build-fixer-low.md +2 -2
  2. package/agents/build-fixer.md +74 -19
  3. package/agents/code-reviewer.md +7 -7
  4. package/agents/designer-high.md +2 -2
  5. package/agents/designer-low.md +1 -1
  6. package/agents/designer.md +17 -2
  7. package/agents/security-reviewer.md +86 -17
  8. package/agents/tdd-guide.md +151 -12
  9. package/commands/hud.md +3 -1
  10. package/dist/__tests__/analytics/analytics-summary.test.d.ts +2 -0
  11. package/dist/__tests__/analytics/analytics-summary.test.d.ts.map +1 -0
  12. package/dist/__tests__/analytics/analytics-summary.test.js +267 -0
  13. package/dist/__tests__/analytics/analytics-summary.test.js.map +1 -0
  14. package/dist/__tests__/analytics/cost-estimator.test.d.ts +2 -0
  15. package/dist/__tests__/analytics/cost-estimator.test.d.ts.map +1 -0
  16. package/dist/__tests__/analytics/cost-estimator.test.js +212 -0
  17. package/dist/__tests__/analytics/cost-estimator.test.js.map +1 -0
  18. package/dist/__tests__/analytics/output-estimator.test.js +18 -0
  19. package/dist/__tests__/analytics/output-estimator.test.js.map +1 -1
  20. package/dist/__tests__/analytics/token-extractor.test.js +44 -0
  21. package/dist/__tests__/analytics/token-extractor.test.js.map +1 -1
  22. package/dist/__tests__/analytics/token-tracker.test.d.ts +2 -0
  23. package/dist/__tests__/analytics/token-tracker.test.d.ts.map +1 -0
  24. package/dist/__tests__/analytics/token-tracker.test.js +189 -0
  25. package/dist/__tests__/analytics/token-tracker.test.js.map +1 -0
  26. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts +7 -0
  27. package/dist/__tests__/hooks/auto-slash-command/executor.test.d.ts.map +1 -0
  28. package/dist/__tests__/hooks/auto-slash-command/executor.test.js +374 -0
  29. package/dist/__tests__/hooks/auto-slash-command/executor.test.js.map +1 -0
  30. package/dist/__tests__/hud/analytics-display.test.js +3 -8
  31. package/dist/__tests__/hud/analytics-display.test.js.map +1 -1
  32. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts +2 -0
  33. package/dist/__tests__/hud/auto-tracking.integration.test.d.ts.map +1 -0
  34. package/dist/__tests__/hud/auto-tracking.integration.test.js +12 -0
  35. package/dist/__tests__/hud/auto-tracking.integration.test.js.map +1 -0
  36. package/dist/__tests__/hud/top-agents.test.d.ts +8 -0
  37. package/dist/__tests__/hud/top-agents.test.d.ts.map +1 -0
  38. package/dist/__tests__/hud/top-agents.test.js +157 -0
  39. package/dist/__tests__/hud/top-agents.test.js.map +1 -0
  40. package/dist/__tests__/installer.test.js +1 -1
  41. package/dist/__tests__/learned-skills/config.test.d.ts +2 -0
  42. package/dist/__tests__/learned-skills/config.test.d.ts.map +1 -0
  43. package/dist/__tests__/learned-skills/config.test.js +37 -0
  44. package/dist/__tests__/learned-skills/config.test.js.map +1 -0
  45. package/dist/__tests__/learned-skills/detector.test.d.ts +2 -0
  46. package/dist/__tests__/learned-skills/detector.test.d.ts.map +1 -0
  47. package/dist/__tests__/learned-skills/detector.test.js +99 -0
  48. package/dist/__tests__/learned-skills/detector.test.js.map +1 -0
  49. package/dist/__tests__/learned-skills/finder.test.d.ts +2 -0
  50. package/dist/__tests__/learned-skills/finder.test.d.ts.map +1 -0
  51. package/dist/__tests__/learned-skills/finder.test.js +59 -0
  52. package/dist/__tests__/learned-skills/finder.test.js.map +1 -0
  53. package/dist/__tests__/learned-skills/loader.test.d.ts +2 -0
  54. package/dist/__tests__/learned-skills/loader.test.d.ts.map +1 -0
  55. package/dist/__tests__/learned-skills/loader.test.js +69 -0
  56. package/dist/__tests__/learned-skills/loader.test.js.map +1 -0
  57. package/dist/__tests__/learned-skills/parser.test.d.ts +2 -0
  58. package/dist/__tests__/learned-skills/parser.test.d.ts.map +1 -0
  59. package/dist/__tests__/learned-skills/parser.test.js +81 -0
  60. package/dist/__tests__/learned-skills/parser.test.js.map +1 -0
  61. package/dist/__tests__/learned-skills/validator.test.d.ts +2 -0
  62. package/dist/__tests__/learned-skills/validator.test.d.ts.map +1 -0
  63. package/dist/__tests__/learned-skills/validator.test.js +85 -0
  64. package/dist/__tests__/learned-skills/validator.test.js.map +1 -0
  65. package/dist/__tests__/skills.test.js +6 -5
  66. package/dist/__tests__/skills.test.js.map +1 -1
  67. package/dist/agents/codex-agents.d.ts +20 -0
  68. package/dist/agents/codex-agents.d.ts.map +1 -0
  69. package/dist/agents/codex-agents.js +36 -0
  70. package/dist/agents/codex-agents.js.map +1 -0
  71. package/dist/agents/definitions.js +1 -1
  72. package/dist/agents/definitions.js.map +1 -1
  73. package/dist/agents/document-writer.d.ts +11 -0
  74. package/dist/agents/document-writer.d.ts.map +1 -0
  75. package/dist/agents/document-writer.js +209 -0
  76. package/dist/agents/document-writer.js.map +1 -0
  77. package/dist/agents/frontend-engineer.d.ts +11 -0
  78. package/dist/agents/frontend-engineer.d.ts.map +1 -0
  79. package/dist/agents/frontend-engineer.js +115 -0
  80. package/dist/agents/frontend-engineer.js.map +1 -0
  81. package/dist/agents/librarian.d.ts +12 -0
  82. package/dist/agents/librarian.d.ts.map +1 -0
  83. package/dist/agents/librarian.js +103 -0
  84. package/dist/agents/librarian.js.map +1 -0
  85. package/dist/agents/metis.d.ts +12 -0
  86. package/dist/agents/metis.d.ts.map +1 -0
  87. package/dist/agents/metis.js +117 -0
  88. package/dist/agents/metis.js.map +1 -0
  89. package/dist/agents/momus.d.ts +12 -0
  90. package/dist/agents/momus.d.ts.map +1 -0
  91. package/dist/agents/momus.js +128 -0
  92. package/dist/agents/momus.js.map +1 -0
  93. package/dist/agents/multimodal-looker.d.ts +11 -0
  94. package/dist/agents/multimodal-looker.d.ts.map +1 -0
  95. package/dist/agents/multimodal-looker.js +70 -0
  96. package/dist/agents/multimodal-looker.js.map +1 -0
  97. package/dist/agents/oracle.d.ts +13 -0
  98. package/dist/agents/oracle.d.ts.map +1 -0
  99. package/dist/agents/oracle.js +191 -0
  100. package/dist/agents/oracle.js.map +1 -0
  101. package/dist/agents/orchestrator-sisyphus.d.ts +11 -0
  102. package/dist/agents/orchestrator-sisyphus.d.ts.map +1 -0
  103. package/dist/agents/orchestrator-sisyphus.js +115 -0
  104. package/dist/agents/orchestrator-sisyphus.js.map +1 -0
  105. package/dist/agents/prometheus.d.ts +12 -0
  106. package/dist/agents/prometheus.d.ts.map +1 -0
  107. package/dist/agents/prometheus.js +195 -0
  108. package/dist/agents/prometheus.js.map +1 -0
  109. package/dist/agents/sisyphus-junior.d.ts +12 -0
  110. package/dist/agents/sisyphus-junior.d.ts.map +1 -0
  111. package/dist/agents/sisyphus-junior.js +93 -0
  112. package/dist/agents/sisyphus-junior.js.map +1 -0
  113. package/dist/analytics/output-estimator.d.ts.map +1 -1
  114. package/dist/analytics/output-estimator.js +5 -1
  115. package/dist/analytics/output-estimator.js.map +1 -1
  116. package/dist/analytics/token-extractor.js +2 -2
  117. package/dist/analytics/token-extractor.js.map +1 -1
  118. package/dist/cli/analytics.js +0 -0
  119. package/dist/cli/components/CostDashboard.d.ts +15 -0
  120. package/dist/cli/components/CostDashboard.d.ts.map +1 -0
  121. package/dist/cli/components/CostDashboard.js +15 -0
  122. package/dist/cli/components/CostDashboard.js.map +1 -0
  123. package/dist/cli/components/LiveStats.d.ts +16 -0
  124. package/dist/cli/components/LiveStats.d.ts.map +1 -0
  125. package/dist/cli/components/LiveStats.js +16 -0
  126. package/dist/cli/components/LiveStats.js.map +1 -0
  127. package/dist/cli/components/SessionBrowser.d.ts +14 -0
  128. package/dist/cli/components/SessionBrowser.d.ts.map +1 -0
  129. package/dist/cli/components/SessionBrowser.js +14 -0
  130. package/dist/cli/components/SessionBrowser.js.map +1 -0
  131. package/dist/cli/index.js +0 -0
  132. package/dist/cli/tui.d.ts +21 -0
  133. package/dist/cli/tui.d.ts.map +1 -0
  134. package/dist/cli/tui.js +21 -0
  135. package/dist/cli/tui.js.map +1 -0
  136. package/dist/compatibility/discovery.d.ts.map +1 -1
  137. package/dist/compatibility/discovery.js +3 -1
  138. package/dist/compatibility/discovery.js.map +1 -1
  139. package/dist/hooks/autopilot/prompts.d.ts.map +1 -1
  140. package/dist/hooks/autopilot/prompts.js +17 -3
  141. package/dist/hooks/autopilot/prompts.js.map +1 -1
  142. package/dist/hooks/autopilot/signals.d.ts +20 -0
  143. package/dist/hooks/autopilot/signals.d.ts.map +1 -0
  144. package/dist/hooks/autopilot/signals.js +75 -0
  145. package/dist/hooks/autopilot/signals.js.map +1 -0
  146. package/dist/hooks/autopilot/summary.d.ts +27 -0
  147. package/dist/hooks/autopilot/summary.d.ts.map +1 -0
  148. package/dist/hooks/autopilot/summary.js +160 -0
  149. package/dist/hooks/autopilot/summary.js.map +1 -0
  150. package/dist/hooks/autopilot/transition.d.ts +39 -0
  151. package/dist/hooks/autopilot/transition.d.ts.map +1 -0
  152. package/dist/hooks/autopilot/transition.js +216 -0
  153. package/dist/hooks/autopilot/transition.js.map +1 -0
  154. package/dist/hooks/context-window-limit-recovery/constants.d.ts +28 -0
  155. package/dist/hooks/context-window-limit-recovery/constants.d.ts.map +1 -0
  156. package/dist/hooks/context-window-limit-recovery/constants.js +85 -0
  157. package/dist/hooks/context-window-limit-recovery/constants.js.map +1 -0
  158. package/dist/hooks/context-window-limit-recovery/index.d.ts +62 -0
  159. package/dist/hooks/context-window-limit-recovery/index.d.ts.map +1 -0
  160. package/dist/hooks/context-window-limit-recovery/index.js +201 -0
  161. package/dist/hooks/context-window-limit-recovery/index.js.map +1 -0
  162. package/dist/hooks/context-window-limit-recovery/parser.d.ts +31 -0
  163. package/dist/hooks/context-window-limit-recovery/parser.d.ts.map +1 -0
  164. package/dist/hooks/context-window-limit-recovery/parser.js +241 -0
  165. package/dist/hooks/context-window-limit-recovery/parser.js.map +1 -0
  166. package/dist/hooks/context-window-limit-recovery/types.d.ts +84 -0
  167. package/dist/hooks/context-window-limit-recovery/types.d.ts.map +1 -0
  168. package/dist/hooks/context-window-limit-recovery/types.js +34 -0
  169. package/dist/hooks/context-window-limit-recovery/types.js.map +1 -0
  170. package/dist/hooks/edit-error-recovery/index.d.ts +62 -0
  171. package/dist/hooks/edit-error-recovery/index.d.ts.map +1 -0
  172. package/dist/hooks/edit-error-recovery/index.js +89 -0
  173. package/dist/hooks/edit-error-recovery/index.js.map +1 -0
  174. package/dist/hooks/github-auto-responder/classifier.d.ts +43 -0
  175. package/dist/hooks/github-auto-responder/classifier.d.ts.map +1 -0
  176. package/dist/hooks/github-auto-responder/classifier.js +150 -0
  177. package/dist/hooks/github-auto-responder/classifier.js.map +1 -0
  178. package/dist/hooks/github-auto-responder/config.d.ts +109 -0
  179. package/dist/hooks/github-auto-responder/config.d.ts.map +1 -0
  180. package/dist/hooks/github-auto-responder/config.js +69 -0
  181. package/dist/hooks/github-auto-responder/config.js.map +1 -0
  182. package/dist/hooks/github-auto-responder/constants.d.ts +45 -0
  183. package/dist/hooks/github-auto-responder/constants.d.ts.map +1 -0
  184. package/dist/hooks/github-auto-responder/constants.js +60 -0
  185. package/dist/hooks/github-auto-responder/constants.js.map +1 -0
  186. package/dist/hooks/github-auto-responder/filters.d.ts +95 -0
  187. package/dist/hooks/github-auto-responder/filters.d.ts.map +1 -0
  188. package/dist/hooks/github-auto-responder/filters.js +174 -0
  189. package/dist/hooks/github-auto-responder/filters.js.map +1 -0
  190. package/dist/hooks/github-auto-responder/github-client.d.ts +65 -0
  191. package/dist/hooks/github-auto-responder/github-client.d.ts.map +1 -0
  192. package/dist/hooks/github-auto-responder/github-client.js +128 -0
  193. package/dist/hooks/github-auto-responder/github-client.js.map +1 -0
  194. package/dist/hooks/github-auto-responder/idempotency.d.ts +68 -0
  195. package/dist/hooks/github-auto-responder/idempotency.d.ts.map +1 -0
  196. package/dist/hooks/github-auto-responder/idempotency.js +147 -0
  197. package/dist/hooks/github-auto-responder/idempotency.js.map +1 -0
  198. package/dist/hooks/github-auto-responder/index.d.ts +140 -0
  199. package/dist/hooks/github-auto-responder/index.d.ts.map +1 -0
  200. package/dist/hooks/github-auto-responder/index.js +145 -0
  201. package/dist/hooks/github-auto-responder/index.js.map +1 -0
  202. package/dist/hooks/github-auto-responder/persona.d.ts +40 -0
  203. package/dist/hooks/github-auto-responder/persona.d.ts.map +1 -0
  204. package/dist/hooks/github-auto-responder/persona.js +99 -0
  205. package/dist/hooks/github-auto-responder/persona.js.map +1 -0
  206. package/dist/hooks/github-auto-responder/responder.d.ts +122 -0
  207. package/dist/hooks/github-auto-responder/responder.d.ts.map +1 -0
  208. package/dist/hooks/github-auto-responder/responder.js +264 -0
  209. package/dist/hooks/github-auto-responder/responder.js.map +1 -0
  210. package/dist/hooks/github-auto-responder/server.d.ts +140 -0
  211. package/dist/hooks/github-auto-responder/server.d.ts.map +1 -0
  212. package/dist/hooks/github-auto-responder/server.js +301 -0
  213. package/dist/hooks/github-auto-responder/server.js.map +1 -0
  214. package/dist/hooks/github-auto-responder/signature.d.ts +34 -0
  215. package/dist/hooks/github-auto-responder/signature.d.ts.map +1 -0
  216. package/dist/hooks/github-auto-responder/signature.js +79 -0
  217. package/dist/hooks/github-auto-responder/signature.js.map +1 -0
  218. package/dist/hooks/github-auto-responder/templates.d.ts +16 -0
  219. package/dist/hooks/github-auto-responder/templates.d.ts.map +1 -0
  220. package/dist/hooks/github-auto-responder/templates.js +93 -0
  221. package/dist/hooks/github-auto-responder/templates.js.map +1 -0
  222. package/dist/hooks/github-auto-responder/types.d.ts +246 -0
  223. package/dist/hooks/github-auto-responder/types.d.ts.map +1 -0
  224. package/dist/hooks/github-auto-responder/types.js +7 -0
  225. package/dist/hooks/github-auto-responder/types.js.map +1 -0
  226. package/dist/hooks/learned-skills/config.d.ts +53 -0
  227. package/dist/hooks/learned-skills/config.d.ts.map +1 -0
  228. package/dist/hooks/learned-skills/config.js +103 -0
  229. package/dist/hooks/learned-skills/config.js.map +1 -0
  230. package/dist/hooks/learned-skills/constants.d.ts +24 -0
  231. package/dist/hooks/learned-skills/constants.d.ts.map +1 -0
  232. package/dist/hooks/learned-skills/constants.js +26 -0
  233. package/dist/hooks/learned-skills/constants.js.map +1 -0
  234. package/dist/hooks/learned-skills/detection-hook.d.ts +39 -0
  235. package/dist/hooks/learned-skills/detection-hook.d.ts.map +1 -0
  236. package/dist/hooks/learned-skills/detection-hook.js +83 -0
  237. package/dist/hooks/learned-skills/detection-hook.js.map +1 -0
  238. package/dist/hooks/learned-skills/detector.d.ts +30 -0
  239. package/dist/hooks/learned-skills/detector.d.ts.map +1 -0
  240. package/dist/hooks/learned-skills/detector.js +150 -0
  241. package/dist/hooks/learned-skills/detector.js.map +1 -0
  242. package/dist/hooks/learned-skills/finder.d.ts +21 -0
  243. package/dist/hooks/learned-skills/finder.d.ts.map +1 -0
  244. package/dist/hooks/learned-skills/finder.js +117 -0
  245. package/dist/hooks/learned-skills/finder.js.map +1 -0
  246. package/dist/hooks/learned-skills/index.d.ts +62 -0
  247. package/dist/hooks/learned-skills/index.d.ts.map +1 -0
  248. package/dist/hooks/learned-skills/index.js +137 -0
  249. package/dist/hooks/learned-skills/index.js.map +1 -0
  250. package/dist/hooks/learned-skills/loader.d.ts +20 -0
  251. package/dist/hooks/learned-skills/loader.d.ts.map +1 -0
  252. package/dist/hooks/learned-skills/loader.js +107 -0
  253. package/dist/hooks/learned-skills/loader.js.map +1 -0
  254. package/dist/hooks/learned-skills/parser.d.ts +21 -0
  255. package/dist/hooks/learned-skills/parser.d.ts.map +1 -0
  256. package/dist/hooks/learned-skills/parser.js +190 -0
  257. package/dist/hooks/learned-skills/parser.js.map +1 -0
  258. package/dist/hooks/learned-skills/promotion.d.ts +29 -0
  259. package/dist/hooks/learned-skills/promotion.d.ts.map +1 -0
  260. package/dist/hooks/learned-skills/promotion.js +87 -0
  261. package/dist/hooks/learned-skills/promotion.js.map +1 -0
  262. package/dist/hooks/learned-skills/types.d.ts +109 -0
  263. package/dist/hooks/learned-skills/types.d.ts.map +1 -0
  264. package/dist/hooks/learned-skills/types.js +8 -0
  265. package/dist/hooks/learned-skills/types.js.map +1 -0
  266. package/dist/hooks/learned-skills/validator.d.ts +15 -0
  267. package/dist/hooks/learned-skills/validator.d.ts.map +1 -0
  268. package/dist/hooks/learned-skills/validator.js +87 -0
  269. package/dist/hooks/learned-skills/validator.js.map +1 -0
  270. package/dist/hooks/learned-skills/writer.d.ts +27 -0
  271. package/dist/hooks/learned-skills/writer.d.ts.map +1 -0
  272. package/dist/hooks/learned-skills/writer.js +126 -0
  273. package/dist/hooks/learned-skills/writer.js.map +1 -0
  274. package/dist/hooks/mnemosyne/config.d.ts +53 -0
  275. package/dist/hooks/mnemosyne/config.d.ts.map +1 -0
  276. package/dist/hooks/mnemosyne/config.js +103 -0
  277. package/dist/hooks/mnemosyne/config.js.map +1 -0
  278. package/dist/hooks/mnemosyne/constants.d.ts +24 -0
  279. package/dist/hooks/mnemosyne/constants.d.ts.map +1 -0
  280. package/dist/hooks/mnemosyne/constants.js +26 -0
  281. package/dist/hooks/mnemosyne/constants.js.map +1 -0
  282. package/dist/hooks/mnemosyne/detection-hook.d.ts +39 -0
  283. package/dist/hooks/mnemosyne/detection-hook.d.ts.map +1 -0
  284. package/dist/hooks/mnemosyne/detection-hook.js +83 -0
  285. package/dist/hooks/mnemosyne/detection-hook.js.map +1 -0
  286. package/dist/hooks/mnemosyne/detector.d.ts +30 -0
  287. package/dist/hooks/mnemosyne/detector.d.ts.map +1 -0
  288. package/dist/hooks/mnemosyne/detector.js +150 -0
  289. package/dist/hooks/mnemosyne/detector.js.map +1 -0
  290. package/dist/hooks/mnemosyne/finder.d.ts +21 -0
  291. package/dist/hooks/mnemosyne/finder.d.ts.map +1 -0
  292. package/dist/hooks/mnemosyne/finder.js +117 -0
  293. package/dist/hooks/mnemosyne/finder.js.map +1 -0
  294. package/dist/hooks/mnemosyne/index.d.ts +62 -0
  295. package/dist/hooks/mnemosyne/index.d.ts.map +1 -0
  296. package/dist/hooks/mnemosyne/index.js +137 -0
  297. package/dist/hooks/mnemosyne/index.js.map +1 -0
  298. package/dist/hooks/mnemosyne/loader.d.ts +20 -0
  299. package/dist/hooks/mnemosyne/loader.d.ts.map +1 -0
  300. package/dist/hooks/mnemosyne/loader.js +113 -0
  301. package/dist/hooks/mnemosyne/loader.js.map +1 -0
  302. package/dist/hooks/mnemosyne/parser.d.ts +21 -0
  303. package/dist/hooks/mnemosyne/parser.d.ts.map +1 -0
  304. package/dist/hooks/mnemosyne/parser.js +190 -0
  305. package/dist/hooks/mnemosyne/parser.js.map +1 -0
  306. package/dist/hooks/mnemosyne/promotion.d.ts +29 -0
  307. package/dist/hooks/mnemosyne/promotion.d.ts.map +1 -0
  308. package/dist/hooks/mnemosyne/promotion.js +87 -0
  309. package/dist/hooks/mnemosyne/promotion.js.map +1 -0
  310. package/dist/hooks/mnemosyne/types.d.ts +109 -0
  311. package/dist/hooks/mnemosyne/types.d.ts.map +1 -0
  312. package/dist/hooks/mnemosyne/types.js +8 -0
  313. package/dist/hooks/mnemosyne/types.js.map +1 -0
  314. package/dist/hooks/mnemosyne/validator.d.ts +15 -0
  315. package/dist/hooks/mnemosyne/validator.d.ts.map +1 -0
  316. package/dist/hooks/mnemosyne/validator.js +87 -0
  317. package/dist/hooks/mnemosyne/validator.js.map +1 -0
  318. package/dist/hooks/mnemosyne/writer.d.ts +27 -0
  319. package/dist/hooks/mnemosyne/writer.d.ts.map +1 -0
  320. package/dist/hooks/mnemosyne/writer.js +126 -0
  321. package/dist/hooks/mnemosyne/writer.js.map +1 -0
  322. package/dist/hooks/pre-compact/index.d.ts +2 -4
  323. package/dist/hooks/pre-compact/index.d.ts.map +1 -1
  324. package/dist/hooks/pre-compact/index.js +3 -4
  325. package/dist/hooks/pre-compact/index.js.map +1 -1
  326. package/dist/hooks/ralph-loop/index.d.ts +116 -0
  327. package/dist/hooks/ralph-loop/index.d.ts.map +1 -0
  328. package/dist/hooks/ralph-loop/index.js +322 -0
  329. package/dist/hooks/ralph-loop/index.js.map +1 -0
  330. package/dist/hooks/ralph-prd/index.d.ts +130 -0
  331. package/dist/hooks/ralph-prd/index.d.ts.map +1 -0
  332. package/dist/hooks/ralph-prd/index.js +310 -0
  333. package/dist/hooks/ralph-prd/index.js.map +1 -0
  334. package/dist/hooks/ralph-progress/index.d.ts +102 -0
  335. package/dist/hooks/ralph-progress/index.d.ts.map +1 -0
  336. package/dist/hooks/ralph-progress/index.js +408 -0
  337. package/dist/hooks/ralph-progress/index.js.map +1 -0
  338. package/dist/hooks/ralph-verifier/index.d.ts +72 -0
  339. package/dist/hooks/ralph-verifier/index.d.ts.map +1 -0
  340. package/dist/hooks/ralph-verifier/index.js +223 -0
  341. package/dist/hooks/ralph-verifier/index.js.map +1 -0
  342. package/dist/hooks/session-recovery/constants.d.ts +56 -0
  343. package/dist/hooks/session-recovery/constants.d.ts.map +1 -0
  344. package/dist/hooks/session-recovery/constants.js +78 -0
  345. package/dist/hooks/session-recovery/constants.js.map +1 -0
  346. package/dist/hooks/session-recovery/index.d.ts +53 -0
  347. package/dist/hooks/session-recovery/index.d.ts.map +1 -0
  348. package/dist/hooks/session-recovery/index.js +321 -0
  349. package/dist/hooks/session-recovery/index.js.map +1 -0
  350. package/dist/hooks/session-recovery/storage.d.ts +76 -0
  351. package/dist/hooks/session-recovery/storage.d.ts.map +1 -0
  352. package/dist/hooks/session-recovery/storage.js +383 -0
  353. package/dist/hooks/session-recovery/storage.js.map +1 -0
  354. package/dist/hooks/session-recovery/types.d.ts +145 -0
  355. package/dist/hooks/session-recovery/types.d.ts.map +1 -0
  356. package/dist/hooks/session-recovery/types.js +8 -0
  357. package/dist/hooks/session-recovery/types.js.map +1 -0
  358. package/dist/hooks/sisyphus-orchestrator/constants.d.ts +23 -0
  359. package/dist/hooks/sisyphus-orchestrator/constants.d.ts.map +1 -0
  360. package/dist/hooks/sisyphus-orchestrator/constants.js +142 -0
  361. package/dist/hooks/sisyphus-orchestrator/constants.js.map +1 -0
  362. package/dist/hooks/sisyphus-orchestrator/index.d.ts +113 -0
  363. package/dist/hooks/sisyphus-orchestrator/index.d.ts.map +1 -0
  364. package/dist/hooks/sisyphus-orchestrator/index.js +309 -0
  365. package/dist/hooks/sisyphus-orchestrator/index.js.map +1 -0
  366. package/dist/hooks/ultraqa-loop/index.d.ts +94 -0
  367. package/dist/hooks/ultraqa-loop/index.d.ts.map +1 -0
  368. package/dist/hooks/ultraqa-loop/index.js +216 -0
  369. package/dist/hooks/ultraqa-loop/index.js.map +1 -0
  370. package/dist/hooks/ultrawork-state/index.d.ts +62 -0
  371. package/dist/hooks/ultrawork-state/index.d.ts.map +1 -0
  372. package/dist/hooks/ultrawork-state/index.js +208 -0
  373. package/dist/hooks/ultrawork-state/index.js.map +1 -0
  374. package/dist/hud/analytics-display.d.ts.map +1 -1
  375. package/dist/hud/analytics-display.js +0 -1
  376. package/dist/hud/analytics-display.js.map +1 -1
  377. package/dist/hud/index.js +52 -3
  378. package/dist/hud/index.js.map +1 -1
  379. package/dist/hud/sisyphus-state.d.ts +31 -0
  380. package/dist/hud/sisyphus-state.d.ts.map +1 -0
  381. package/dist/hud/sisyphus-state.js +163 -0
  382. package/dist/hud/sisyphus-state.js.map +1 -0
  383. package/dist/installer/index.d.ts +1 -1
  384. package/dist/installer/index.js +1 -1
  385. package/package.json +1 -1
  386. package/scripts/github-webhook-server.ts +141 -0
  387. package/skills/hud/SKILL.md +3 -1
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Context Window Limit Error Parser
3
+ *
4
+ * Parses error responses to detect token/context limit errors.
5
+ *
6
+ * Adapted from oh-my-opencode's anthropic-context-window-limit-recovery hook.
7
+ */
8
+ /**
9
+ * Patterns to extract token counts from error messages
10
+ */
11
+ const TOKEN_LIMIT_PATTERNS = [
12
+ /(\d+)\s*tokens?\s*>\s*(\d+)\s*maximum/i,
13
+ /prompt.*?(\d+).*?tokens.*?exceeds.*?(\d+)/i,
14
+ /(\d+).*?tokens.*?limit.*?(\d+)/i,
15
+ /context.*?length.*?(\d+).*?maximum.*?(\d+)/i,
16
+ /max.*?context.*?(\d+).*?but.*?(\d+)/i,
17
+ ];
18
+ /**
19
+ * Keywords indicating token limit errors
20
+ */
21
+ const TOKEN_LIMIT_KEYWORDS = [
22
+ 'prompt is too long',
23
+ 'is too long',
24
+ 'context_length_exceeded',
25
+ 'max_tokens',
26
+ 'token limit',
27
+ 'context length',
28
+ 'too many tokens',
29
+ 'non-empty content',
30
+ ];
31
+ /**
32
+ * Patterns indicating thinking block structure errors (NOT token limit)
33
+ * These should be handled differently
34
+ */
35
+ const THINKING_BLOCK_ERROR_PATTERNS = [
36
+ /thinking.*first block/i,
37
+ /first block.*thinking/i,
38
+ /must.*start.*thinking/i,
39
+ /thinking.*redacted_thinking/i,
40
+ /expected.*thinking.*found/i,
41
+ /thinking.*disabled.*cannot.*contain/i,
42
+ ];
43
+ /**
44
+ * Pattern to extract message index from error
45
+ */
46
+ const MESSAGE_INDEX_PATTERN = /messages\.(\d+)/;
47
+ /**
48
+ * Check if error is a thinking block structure error
49
+ */
50
+ function isThinkingBlockError(text) {
51
+ return THINKING_BLOCK_ERROR_PATTERNS.some((pattern) => pattern.test(text));
52
+ }
53
+ /**
54
+ * Extract token counts from error message
55
+ */
56
+ function extractTokensFromMessage(message) {
57
+ for (const pattern of TOKEN_LIMIT_PATTERNS) {
58
+ const match = message.match(pattern);
59
+ if (match) {
60
+ const num1 = parseInt(match[1], 10);
61
+ const num2 = parseInt(match[2], 10);
62
+ return num1 > num2
63
+ ? { current: num1, max: num2 }
64
+ : { current: num2, max: num1 };
65
+ }
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * Extract message index from error text
71
+ */
72
+ function extractMessageIndex(text) {
73
+ const match = text.match(MESSAGE_INDEX_PATTERN);
74
+ if (match) {
75
+ return parseInt(match[1], 10);
76
+ }
77
+ return undefined;
78
+ }
79
+ /**
80
+ * Check if text indicates a token limit error
81
+ */
82
+ function isTokenLimitError(text) {
83
+ if (isThinkingBlockError(text)) {
84
+ return false;
85
+ }
86
+ const lower = text.toLowerCase();
87
+ return TOKEN_LIMIT_KEYWORDS.some((kw) => lower.includes(kw.toLowerCase()));
88
+ }
89
+ /**
90
+ * Parse an error to detect if it's a token limit error
91
+ */
92
+ export function parseTokenLimitError(err) {
93
+ // Handle string errors
94
+ if (typeof err === 'string') {
95
+ if (err.toLowerCase().includes('non-empty content')) {
96
+ return {
97
+ currentTokens: 0,
98
+ maxTokens: 0,
99
+ errorType: 'non-empty content',
100
+ messageIndex: extractMessageIndex(err),
101
+ };
102
+ }
103
+ if (isTokenLimitError(err)) {
104
+ const tokens = extractTokensFromMessage(err);
105
+ return {
106
+ currentTokens: tokens?.current ?? 0,
107
+ maxTokens: tokens?.max ?? 0,
108
+ errorType: 'token_limit_exceeded_string',
109
+ };
110
+ }
111
+ return null;
112
+ }
113
+ // Handle non-object errors
114
+ if (!err || typeof err !== 'object')
115
+ return null;
116
+ const errObj = err;
117
+ // Collect all text sources from the error object
118
+ const textSources = [];
119
+ const dataObj = errObj.data;
120
+ const responseBody = dataObj?.responseBody;
121
+ const errorMessage = errObj.message;
122
+ const errorData = errObj.error;
123
+ const nestedError = errorData?.error;
124
+ if (typeof responseBody === 'string')
125
+ textSources.push(responseBody);
126
+ if (typeof errorMessage === 'string')
127
+ textSources.push(errorMessage);
128
+ if (typeof errorData?.message === 'string')
129
+ textSources.push(errorData.message);
130
+ if (typeof errObj.body === 'string')
131
+ textSources.push(errObj.body);
132
+ if (typeof errObj.details === 'string')
133
+ textSources.push(errObj.details);
134
+ if (typeof errObj.reason === 'string')
135
+ textSources.push(errObj.reason);
136
+ if (typeof errObj.description === 'string')
137
+ textSources.push(errObj.description);
138
+ if (typeof nestedError?.message === 'string')
139
+ textSources.push(nestedError.message);
140
+ if (typeof dataObj?.message === 'string')
141
+ textSources.push(dataObj.message);
142
+ if (typeof dataObj?.error === 'string')
143
+ textSources.push(dataObj.error);
144
+ // Try JSON stringification if no text sources found
145
+ if (textSources.length === 0) {
146
+ try {
147
+ const jsonStr = JSON.stringify(errObj);
148
+ if (isTokenLimitError(jsonStr)) {
149
+ textSources.push(jsonStr);
150
+ }
151
+ }
152
+ catch {
153
+ // Ignore JSON errors
154
+ }
155
+ }
156
+ const combinedText = textSources.join(' ');
157
+ if (!isTokenLimitError(combinedText))
158
+ return null;
159
+ // Try to parse structured response body
160
+ if (typeof responseBody === 'string') {
161
+ try {
162
+ const jsonPatterns = [
163
+ /data:\s*(\{[\s\S]*\})\s*$/m,
164
+ /(\{"type"\s*:\s*"error"[\s\S]*\})/,
165
+ /(\{[\s\S]*"error"[\s\S]*\})/,
166
+ ];
167
+ for (const pattern of jsonPatterns) {
168
+ const dataMatch = responseBody.match(pattern);
169
+ if (dataMatch) {
170
+ try {
171
+ const jsonData = JSON.parse(dataMatch[1]);
172
+ const message = jsonData.error?.message || '';
173
+ const tokens = extractTokensFromMessage(message);
174
+ if (tokens) {
175
+ return {
176
+ currentTokens: tokens.current,
177
+ maxTokens: tokens.max,
178
+ requestId: jsonData.request_id,
179
+ errorType: jsonData.error?.type || 'token_limit_exceeded',
180
+ };
181
+ }
182
+ }
183
+ catch {
184
+ // Ignore parse errors
185
+ }
186
+ }
187
+ }
188
+ // Check for Bedrock-style errors
189
+ const bedrockJson = JSON.parse(responseBody);
190
+ if (typeof bedrockJson.message === 'string' &&
191
+ isTokenLimitError(bedrockJson.message)) {
192
+ return {
193
+ currentTokens: 0,
194
+ maxTokens: 0,
195
+ errorType: 'bedrock_input_too_long',
196
+ };
197
+ }
198
+ }
199
+ catch {
200
+ // Ignore parse errors
201
+ }
202
+ }
203
+ // Extract tokens from any text source
204
+ for (const text of textSources) {
205
+ const tokens = extractTokensFromMessage(text);
206
+ if (tokens) {
207
+ return {
208
+ currentTokens: tokens.current,
209
+ maxTokens: tokens.max,
210
+ errorType: 'token_limit_exceeded',
211
+ };
212
+ }
213
+ }
214
+ // Check for non-empty content error
215
+ if (combinedText.toLowerCase().includes('non-empty content')) {
216
+ return {
217
+ currentTokens: 0,
218
+ maxTokens: 0,
219
+ errorType: 'non-empty content',
220
+ messageIndex: extractMessageIndex(combinedText),
221
+ };
222
+ }
223
+ // Generic token limit error
224
+ if (isTokenLimitError(combinedText)) {
225
+ return {
226
+ currentTokens: 0,
227
+ maxTokens: 0,
228
+ errorType: 'token_limit_exceeded_unknown',
229
+ };
230
+ }
231
+ return null;
232
+ }
233
+ /**
234
+ * Check if a string contains a token limit error indication
235
+ */
236
+ export function containsTokenLimitError(text) {
237
+ return isTokenLimitError(text);
238
+ }
239
+ // Re-export patterns for testing
240
+ export { TOKEN_LIMIT_PATTERNS, TOKEN_LIMIT_KEYWORDS, THINKING_BLOCK_ERROR_PATTERNS, };
241
+ //# sourceMappingURL=parser.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../src/hooks/context-window-limit-recovery/parser.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,wCAAwC;IACxC,4CAA4C;IAC5C,iCAAiC;IACjC,6CAA6C;IAC7C,sCAAsC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,oBAAoB;IACpB,aAAa;IACb,yBAAyB;IACzB,YAAY;IACZ,aAAa;IACb,gBAAgB;IAChB,iBAAiB;IACjB,mBAAmB;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,6BAA6B,GAAG;IACpC,wBAAwB;IACxB,wBAAwB;IACxB,wBAAwB;IACxB,8BAA8B;IAC9B,4BAA4B;IAC5B,sCAAsC;CACvC,CAAC;AAEF;;GAEG;AACH,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;AAEhD;;GAEG;AACH,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,6BAA6B,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;AAC7E,CAAC;AAED;;GAEG;AACH,SAAS,wBAAwB,CAC/B,OAAe;IAEf,KAAK,MAAM,OAAO,I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ACJ,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,sBAAsB;QACxB,CAAC;IACH,CAAC;IAED,sCAAsC;IACtC,KAAK,MAAM,IAAI,IAAI,WAAW,EAAE,CAAC;QAC/B,MAAM,MAAM,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;QAC9C,IAAI,MAAM,EAAE,CAAC;YACX,OAAO;gBACL,aAAa,EAAE,MAAM,CAAC,OAAO;gBAC7B,SAAS,EAAE,MAAM,CAAC,GAAG;gBACrB,SAAS,EAAE,sBAAsB;aAClC,CAAC;QACJ,CAAC;IACH,CAAC;IAED,oCAAoC;IACpC,IAAI,YAAY,CAAC,WAAW,EAAE,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC;QAC7D,OAAO;YACL,aAAa,EAAE,CAAC;YAChB,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,mBAAmB;YAC9B,YAAY,EAAE,mBAAmB,CAAC,YAAY,CAAC;SAChD,CAAC;IACJ,CAAC;IAED,4BAA4B;IAC5B,IAAI,iBAAiB,CAAC,YAAY,CAAC,EAAE,CAAC;QACpC,OAAO;YACL,aAAa,EAAE,CAAC;YAChB,SAAS,EAAE,CAAC;YACZ,SAAS,EAAE,8BAA8B;SAC1C,CAAC;IACJ,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,IAAY;IAClD,OAAO,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,iCAAiC;AACjC,OAAO,EACL,oBAAoB,EACpB,oBAAoB,EACpB,6BAA6B,GAC9B,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Context Window Limit Recovery Types
3
+ *
4
+ * Type definitions for detecting and recovering from context window limit errors.
5
+ *
6
+ * Adapted from oh-my-opencode's anthropic-context-window-limit-recovery hook.
7
+ */
8
+ /**
9
+ * Parsed token limit error information
10
+ */
11
+ export interface ParsedTokenLimitError {
12
+ /** Current number of tokens in the conversation */
13
+ currentTokens: number;
14
+ /** Maximum allowed tokens */
15
+ maxTokens: number;
16
+ /** Request ID from the API response */
17
+ requestId?: string;
18
+ /** Type of error detected */
19
+ errorType: string;
20
+ /** Provider ID (e.g., 'anthropic') */
21
+ providerID?: string;
22
+ /** Model ID (e.g., 'claude-3-opus-20240229') */
23
+ modelID?: string;
24
+ /** Index of the problematic message */
25
+ messageIndex?: number;
26
+ }
27
+ /**
28
+ * Retry state for recovery attempts
29
+ */
30
+ export interface RetryState {
31
+ /** Number of retry attempts made */
32
+ attempt: number;
33
+ /** Timestamp of last retry attempt */
34
+ lastAttemptTime: number;
35
+ }
36
+ /**
37
+ * Truncation state for progressive truncation
38
+ */
39
+ export interface TruncateState {
40
+ /** Number of truncation attempts made */
41
+ truncateAttempt: number;
42
+ /** ID of the last truncated part */
43
+ lastTruncatedPartId?: string;
44
+ }
45
+ /**
46
+ * Recovery result
47
+ */
48
+ export interface RecoveryResult {
49
+ /** Whether recovery was attempted */
50
+ attempted: boolean;
51
+ /** Whether recovery was successful */
52
+ success: boolean;
53
+ /** Recovery message to inject */
54
+ message?: string;
55
+ /** Error type detected */
56
+ errorType?: string;
57
+ }
58
+ /**
59
+ * Configuration for retry behavior
60
+ */
61
+ export declare const RETRY_CONFIG: {
62
+ /** Maximum retry attempts */
63
+ readonly maxAttempts: 2;
64
+ /** Initial delay between retries in ms */
65
+ readonly initialDelayMs: 2000;
66
+ /** Backoff factor for exponential backoff */
67
+ readonly backoffFactor: 2;
68
+ /** Maximum delay between retries in ms */
69
+ readonly maxDelayMs: 30000;
70
+ };
71
+ /**
72
+ * Configuration for truncation behavior
73
+ */
74
+ export declare const TRUNCATE_CONFIG: {
75
+ /** Maximum truncation attempts */
76
+ readonly maxTruncateAttempts: 20;
77
+ /** Minimum output size (chars) to attempt truncation */
78
+ readonly minOutputSizeToTruncate: 500;
79
+ /** Target token ratio after truncation */
80
+ readonly targetTokenRatio: 0.5;
81
+ /** Average characters per token estimate */
82
+ readonly charsPerToken: 4;
83
+ };
84
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/context-window-limit-recovery/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,mDAAmD;IACnD,aAAa,EAAE,MAAM,CAAC;IACtB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,uCAAuC;IACvC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gDAAgD;IAChD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uCAAuC;IACvC,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,oCAAoC;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,yCAAyC;IACzC,eAAe,EAAE,MAAM,CAAC;IACxB,oCAAoC;IACpC,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,qCAAqC;IACrC,SAAS,EAAE,OAAO,CAAC;IACnB,sCAAsC;IACtC,OAAO,EAAE,OAAO,CAAC;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,YAAY;IACvB,6BAA6B;;IAE7B,0CAA0C;;IAE1C,6CAA6C;;IAE7C,0CAA0C;;CAElC,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,eAAe;IAC1B,kCAAkC;;IAElC,wDAAwD;;IAExD,0CAA0C;;IAE1C,4CAA4C;;CAEpC,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Context Window Limit Recovery Types
3
+ *
4
+ * Type definitions for detecting and recovering from context window limit errors.
5
+ *
6
+ * Adapted from oh-my-opencode's anthropic-context-window-limit-recovery hook.
7
+ */
8
+ /**
9
+ * Configuration for retry behavior
10
+ */
11
+ export const RETRY_CONFIG = {
12
+ /** Maximum retry attempts */
13
+ maxAttempts: 2,
14
+ /** Initial delay between retries in ms */
15
+ initialDelayMs: 2000,
16
+ /** Backoff factor for exponential backoff */
17
+ backoffFactor: 2,
18
+ /** Maximum delay between retries in ms */
19
+ maxDelayMs: 30000,
20
+ };
21
+ /**
22
+ * Configuration for truncation behavior
23
+ */
24
+ export const TRUNCATE_CONFIG = {
25
+ /** Maximum truncation attempts */
26
+ maxTruncateAttempts: 20,
27
+ /** Minimum output size (chars) to attempt truncation */
28
+ minOutputSizeToTruncate: 500,
29
+ /** Target token ratio after truncation */
30
+ targetTokenRatio: 0.5,
31
+ /** Average characters per token estimate */
32
+ charsPerToken: 4,
33
+ };
34
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/hooks/context-window-limit-recovery/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwDH;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,6BAA6B;IAC7B,WAAW,EAAE,CAAC;IACd,0CAA0C;IAC1C,cAAc,EAAE,IAAI;IACpB,6CAA6C;IAC7C,aAAa,EAAE,CAAC;IAChB,0CAA0C;IAC1C,UAAU,EAAE,KAAK;CACT,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG;IAC7B,kCAAkC;IAClC,mBAAmB,EAAE,EAAE;IACvB,wDAAwD;IACxD,uBAAuB,EAAE,GAAG;IAC5B,0CAA0C;IAC1C,gBAAgB,EAAE,GAAG;IACrB,4CAA4C;IAC5C,aAAa,EAAE,CAAC;CACR,CAAC"}
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Edit Error Recovery Hook
3
+ *
4
+ * Detects Edit tool errors caused by AI mistakes and injects
5
+ * a recovery reminder to guide corrective action.
6
+ *
7
+ * Common Edit tool failures:
8
+ * - oldString and newString must be different (trying to "edit" to same content)
9
+ * - oldString not found (wrong assumption about file content)
10
+ * - oldString found multiple times (ambiguous match, need more context)
11
+ *
12
+ * Ported from oh-my-opencode's edit-error-recovery hook.
13
+ */
14
+ /**
15
+ * Known Edit tool error patterns that indicate the AI made a mistake
16
+ */
17
+ export declare const EDIT_ERROR_PATTERNS: readonly ["oldString and newString must be different", "oldString not found", "oldString found multiple times", "old_string not found", "old_string and new_string must be different"];
18
+ /**
19
+ * System reminder injected when Edit tool fails due to AI mistake
20
+ * Short, direct, and commanding - forces immediate corrective action
21
+ */
22
+ export declare const EDIT_ERROR_REMINDER = "\n[EDIT ERROR - IMMEDIATE ACTION REQUIRED]\n\nYou made an Edit mistake. STOP and do this NOW:\n\n1. READ the file immediately to see its ACTUAL current state\n2. VERIFY what the content really looks like (your assumption was wrong)\n3. APOLOGIZE briefly to the user for the error\n4. CONTINUE with corrected action based on the real file content\n\nDO NOT attempt another edit until you've read and verified the file state.\n";
23
+ /**
24
+ * Check if an output contains an edit error pattern
25
+ */
26
+ export declare function detectEditError(output: string): boolean;
27
+ /**
28
+ * Inject the edit error recovery reminder into the output
29
+ */
30
+ export declare function injectEditErrorRecovery(output: string): string;
31
+ /**
32
+ * Hook input interface for tool execution
33
+ */
34
+ export interface ToolExecuteInput {
35
+ tool: string;
36
+ sessionId: string;
37
+ callId: string;
38
+ }
39
+ /**
40
+ * Hook output interface for tool execution
41
+ */
42
+ export interface ToolExecuteOutput {
43
+ title: string;
44
+ output: string;
45
+ metadata?: unknown;
46
+ }
47
+ /**
48
+ * Creates the edit error recovery hook for Claude Code.
49
+ * This is the main export for hook registration.
50
+ */
51
+ export declare function createEditErrorRecoveryHook(): {
52
+ /**
53
+ * After tool execution, check for Edit errors and inject recovery reminder.
54
+ */
55
+ afterToolExecute: (input: ToolExecuteInput, output: ToolExecuteOutput) => ToolExecuteOutput;
56
+ };
57
+ /**
58
+ * Process edit tool output and inject recovery if needed.
59
+ * Simplified function for direct use without hook context.
60
+ */
61
+ export declare function processEditOutput(toolName: string, output: string): string;
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/edit-error-recovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,eAAO,MAAM,mBAAmB,wLAMtB,CAAC;AAEX;;;GAGG;AACH,eAAO,MAAM,mBAAmB,8aAW/B,CAAC;AAEF;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAKvD;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAK9D;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,2BAA2B;IAEvC;;OAEG;8BAEM,gBAAgB,UACf,iBAAiB,KACxB,iBAAiB;EAevB;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAK1E"}
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Edit Error Recovery Hook
3
+ *
4
+ * Detects Edit tool errors caused by AI mistakes and injects
5
+ * a recovery reminder to guide corrective action.
6
+ *
7
+ * Common Edit tool failures:
8
+ * - oldString and newString must be different (trying to "edit" to same content)
9
+ * - oldString not found (wrong assumption about file content)
10
+ * - oldString found multiple times (ambiguous match, need more context)
11
+ *
12
+ * Ported from oh-my-opencode's edit-error-recovery hook.
13
+ */
14
+ /**
15
+ * Known Edit tool error patterns that indicate the AI made a mistake
16
+ */
17
+ export const EDIT_ERROR_PATTERNS = [
18
+ 'oldString and newString must be different',
19
+ 'oldString not found',
20
+ 'oldString found multiple times',
21
+ 'old_string not found',
22
+ 'old_string and new_string must be different',
23
+ ];
24
+ /**
25
+ * System reminder injected when Edit tool fails due to AI mistake
26
+ * Short, direct, and commanding - forces immediate corrective action
27
+ */
28
+ export const EDIT_ERROR_REMINDER = `
29
+ [EDIT ERROR - IMMEDIATE ACTION REQUIRED]
30
+
31
+ You made an Edit mistake. STOP and do this NOW:
32
+
33
+ 1. READ the file immediately to see its ACTUAL current state
34
+ 2. VERIFY what the content really looks like (your assumption was wrong)
35
+ 3. APOLOGIZE briefly to the user for the error
36
+ 4. CONTINUE with corrected action based on the real file content
37
+
38
+ DO NOT attempt another edit until you've read and verified the file state.
39
+ `;
40
+ /**
41
+ * Check if an output contains an edit error pattern
42
+ */
43
+ export function detectEditError(output) {
44
+ const outputLower = output.toLowerCase();
45
+ return EDIT_ERROR_PATTERNS.some((pattern) => outputLower.includes(pattern.toLowerCase()));
46
+ }
47
+ /**
48
+ * Inject the edit error recovery reminder into the output
49
+ */
50
+ export function injectEditErrorRecovery(output) {
51
+ if (detectEditError(output)) {
52
+ return output + EDIT_ERROR_REMINDER;
53
+ }
54
+ return output;
55
+ }
56
+ /**
57
+ * Creates the edit error recovery hook for Claude Code.
58
+ * This is the main export for hook registration.
59
+ */
60
+ export function createEditErrorRecoveryHook() {
61
+ return {
62
+ /**
63
+ * After tool execution, check for Edit errors and inject recovery reminder.
64
+ */
65
+ afterToolExecute: (input, output) => {
66
+ if (input.tool.toLowerCase() !== 'edit') {
67
+ return output;
68
+ }
69
+ if (detectEditError(output.output)) {
70
+ return {
71
+ ...output,
72
+ output: output.output + EDIT_ERROR_REMINDER,
73
+ };
74
+ }
75
+ return output;
76
+ },
77
+ };
78
+ }
79
+ /**
80
+ * Process edit tool output and inject recovery if needed.
81
+ * Simplified function for direct use without hook context.
82
+ */
83
+ export function processEditOutput(toolName, output) {
84
+ if (toolName.toLowerCase() !== 'edit') {
85
+ return output;
86
+ }
87
+ return injectEditErrorRecovery(output);
88
+ }
89
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/hooks/edit-error-recovery/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,2CAA2C;IAC3C,qBAAqB;IACrB,gCAAgC;IAChC,sBAAsB;IACtB,6CAA6C;CACrC,CAAC;AAEX;;;GAGG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;;;;;;;;;;;CAWlC,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,MAAc;IAC5C,MAAM,WAAW,GAAG,MAAM,CAAC,WAAW,EAAE,CAAC;IACzC,OAAO,mBAAmB,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAC1C,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAC5C,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE,CAAC;QAC5B,OAAO,MAAM,GAAG,mBAAmB,CAAC;IACtC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAoBD;;;GAGG;AACH,MAAM,UAAU,2BAA2B;IACzC,OAAO;QACL;;WAEG;QACH,gBAAgB,EAAE,CAChB,KAAuB,EACvB,MAAyB,EACN,EAAE;YACrB,IAAI,KAAK,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;gBACxC,OAAO,MAAM,CAAC;YAChB,CAAC;YAED,IAAI,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBACnC,OAAO;oBACL,GAAG,MAAM;oBACT,MAAM,EAAE,MAAM,CAAC,MAAM,GAAG,mBAAmB;iBAC5C,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;KACF,CAAC;AACJ,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAgB,EAAE,MAAc;IAChE,IAAI,QAAQ,CAAC,WAAW,EAAE,KAAK,MAAM,EAAE,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IACD,OAAO,uBAAuB,CAAC,MAAM,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * GitHub Event Classifier
3
+ *
4
+ * Classifies GitHub issues and PRs into response categories based on labels and keywords.
5
+ */
6
+ import type { ResponseCategory, WebhookPayload, GitHubLabel } from './types.js';
7
+ /**
8
+ * Classification result with category, confidence, and reasoning
9
+ */
10
+ export interface ClassificationResult {
11
+ /** Classified response category */
12
+ category: ResponseCategory;
13
+ /** Confidence score (0-1) */
14
+ confidence: number;
15
+ /** Reasoning for classification */
16
+ reason: string;
17
+ }
18
+ /**
19
+ * Classifies based on GitHub labels
20
+ *
21
+ * @param labels - Array of GitHub labels
22
+ * @returns Classification result with high confidence (0.9) if label found, null otherwise
23
+ */
24
+ export declare function classifyByLabel(labels: GitHubLabel[]): ClassificationResult | null;
25
+ /**
26
+ * Classifies based on keyword matching in title and body
27
+ *
28
+ * @param title - Issue/PR title
29
+ * @param body - Issue/PR body (may be null)
30
+ * @returns Classification result with confidence based on keyword matches
31
+ */
32
+ export declare function classifyByKeywords(title: string, body: string | null): ClassificationResult;
33
+ /**
34
+ * Classifies a GitHub webhook payload into a response category
35
+ *
36
+ * Uses label-based classification first (high confidence), then falls back
37
+ * to keyword-based classification. Pull requests are always classified as 'pr'.
38
+ *
39
+ * @param payload - GitHub webhook payload
40
+ * @returns Classification result with category, confidence, and reasoning
41
+ */
42
+ export declare function classify(payload: WebhookPayload): ClassificationResult;
43
+ //# sourceMappingURL=classifier.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"classifier.d.ts","sourceRoot":"","sources":["../../../src/hooks/github-auto-responder/classifier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EAGd,WAAW,EACZ,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,mCAAmC;IACnC,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,6BAA6B;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,mCAAmC;IACnC,MAAM,EAAE,MAAM,CAAC;CAChB;AA8CD;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,WAAW,EAAE,GACpB,oBAAoB,GAAG,IAAI,CA+B7B;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,GAAG,IAAI,GAClB,oBAAoB,CAgDtB;AAED;;;;;;;;GAQG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,cAAc,GAAG,oBAAoB,CAoBtE"}