agent-bober 0.12.0 → 0.15.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 (518) hide show
  1. package/CHANGELOG.md +213 -0
  2. package/README.md +112 -3
  3. package/agents/bober-architect.md +38 -0
  4. package/agents/bober-code-reviewer.md +236 -0
  5. package/agents/bober-curator.md +37 -0
  6. package/agents/bober-deployer.md +267 -0
  7. package/agents/bober-diagnoser.md +289 -0
  8. package/agents/bober-evaluator.md +89 -1
  9. package/agents/bober-generator.md +68 -3
  10. package/agents/bober-planner.md +39 -0
  11. package/agents/bober-postmortemer.md +185 -0
  12. package/agents/bober-researcher.md +38 -0
  13. package/dist/cli/commands/approve.d.ts +17 -0
  14. package/dist/cli/commands/approve.d.ts.map +1 -0
  15. package/dist/cli/commands/approve.js +64 -0
  16. package/dist/cli/commands/approve.js.map +1 -0
  17. package/dist/cli/commands/audit-show.d.ts +14 -0
  18. package/dist/cli/commands/audit-show.d.ts.map +1 -0
  19. package/dist/cli/commands/audit-show.js +85 -0
  20. package/dist/cli/commands/audit-show.js.map +1 -0
  21. package/dist/cli/commands/config.d.ts +10 -0
  22. package/dist/cli/commands/config.d.ts.map +1 -0
  23. package/dist/cli/commands/config.js +73 -0
  24. package/dist/cli/commands/config.js.map +1 -0
  25. package/dist/cli/commands/graph.d.ts +8 -0
  26. package/dist/cli/commands/graph.d.ts.map +1 -0
  27. package/dist/cli/commands/graph.js +219 -0
  28. package/dist/cli/commands/graph.js.map +1 -0
  29. package/dist/cli/commands/impact.d.ts +19 -0
  30. package/dist/cli/commands/impact.d.ts.map +1 -0
  31. package/dist/cli/commands/impact.js +191 -0
  32. package/dist/cli/commands/impact.js.map +1 -0
  33. package/dist/cli/commands/incident.d.ts +19 -0
  34. package/dist/cli/commands/incident.d.ts.map +1 -0
  35. package/dist/cli/commands/incident.js +324 -0
  36. package/dist/cli/commands/incident.js.map +1 -0
  37. package/dist/cli/commands/init.js +36 -1
  38. package/dist/cli/commands/init.js.map +1 -1
  39. package/dist/cli/commands/list-approvals.d.ts +16 -0
  40. package/dist/cli/commands/list-approvals.d.ts.map +1 -0
  41. package/dist/cli/commands/list-approvals.js +57 -0
  42. package/dist/cli/commands/list-approvals.js.map +1 -0
  43. package/dist/cli/commands/onboard.d.ts +3 -0
  44. package/dist/cli/commands/onboard.d.ts.map +1 -0
  45. package/dist/cli/commands/onboard.js +190 -0
  46. package/dist/cli/commands/onboard.js.map +1 -0
  47. package/dist/cli/commands/playbook.d.ts +17 -0
  48. package/dist/cli/commands/playbook.d.ts.map +1 -0
  49. package/dist/cli/commands/playbook.js +123 -0
  50. package/dist/cli/commands/playbook.js.map +1 -0
  51. package/dist/cli/commands/postmortem.d.ts +12 -0
  52. package/dist/cli/commands/postmortem.d.ts.map +1 -0
  53. package/dist/cli/commands/postmortem.js +67 -0
  54. package/dist/cli/commands/postmortem.js.map +1 -0
  55. package/dist/cli/commands/reject.d.ts +17 -0
  56. package/dist/cli/commands/reject.d.ts.map +1 -0
  57. package/dist/cli/commands/reject.js +52 -0
  58. package/dist/cli/commands/reject.js.map +1 -0
  59. package/dist/cli/commands/rollback.d.ts +21 -0
  60. package/dist/cli/commands/rollback.d.ts.map +1 -0
  61. package/dist/cli/commands/rollback.js +90 -0
  62. package/dist/cli/commands/rollback.js.map +1 -0
  63. package/dist/cli/commands/run.d.ts +9 -0
  64. package/dist/cli/commands/run.d.ts.map +1 -1
  65. package/dist/cli/commands/run.js +29 -0
  66. package/dist/cli/commands/run.js.map +1 -1
  67. package/dist/cli/commands/telemetry.d.ts +16 -0
  68. package/dist/cli/commands/telemetry.d.ts.map +1 -0
  69. package/dist/cli/commands/telemetry.js +152 -0
  70. package/dist/cli/commands/telemetry.js.map +1 -0
  71. package/dist/cli/commands/worktree.d.ts +12 -0
  72. package/dist/cli/commands/worktree.d.ts.map +1 -0
  73. package/dist/cli/commands/worktree.js +57 -0
  74. package/dist/cli/commands/worktree.js.map +1 -0
  75. package/dist/cli/index.js +50 -0
  76. package/dist/cli/index.js.map +1 -1
  77. package/dist/config/defaults.d.ts.map +1 -1
  78. package/dist/config/defaults.js +27 -0
  79. package/dist/config/defaults.js.map +1 -1
  80. package/dist/config/index.d.ts +1 -1
  81. package/dist/config/index.d.ts.map +1 -1
  82. package/dist/config/index.js +4 -0
  83. package/dist/config/index.js.map +1 -1
  84. package/dist/config/loader.d.ts.map +1 -1
  85. package/dist/config/loader.js +18 -1
  86. package/dist/config/loader.js.map +1 -1
  87. package/dist/config/schema.d.ts +976 -56
  88. package/dist/config/schema.d.ts.map +1 -1
  89. package/dist/config/schema.js +147 -0
  90. package/dist/config/schema.js.map +1 -1
  91. package/dist/graph/artifact-store.d.ts +14 -0
  92. package/dist/graph/artifact-store.d.ts.map +1 -0
  93. package/dist/graph/artifact-store.js +100 -0
  94. package/dist/graph/artifact-store.js.map +1 -0
  95. package/dist/graph/cli.d.ts +49 -0
  96. package/dist/graph/cli.d.ts.map +1 -0
  97. package/dist/graph/cli.js +140 -0
  98. package/dist/graph/cli.js.map +1 -0
  99. package/dist/graph/client.d.ts +64 -0
  100. package/dist/graph/client.d.ts.map +1 -0
  101. package/dist/graph/client.js +216 -0
  102. package/dist/graph/client.js.map +1 -0
  103. package/dist/graph/fallback.d.ts +13 -0
  104. package/dist/graph/fallback.d.ts.map +1 -0
  105. package/dist/graph/fallback.js +57 -0
  106. package/dist/graph/fallback.js.map +1 -0
  107. package/dist/graph/hook-handler.d.ts +50 -0
  108. package/dist/graph/hook-handler.d.ts.map +1 -0
  109. package/dist/graph/hook-handler.js +217 -0
  110. package/dist/graph/hook-handler.js.map +1 -0
  111. package/dist/graph/incidents.d.ts +59 -0
  112. package/dist/graph/incidents.d.ts.map +1 -0
  113. package/dist/graph/incidents.js +22 -0
  114. package/dist/graph/incidents.js.map +1 -0
  115. package/dist/graph/mcp-client.d.ts +51 -0
  116. package/dist/graph/mcp-client.d.ts.map +1 -0
  117. package/dist/graph/mcp-client.js +285 -0
  118. package/dist/graph/mcp-client.js.map +1 -0
  119. package/dist/graph/onboarding-composer.d.ts +30 -0
  120. package/dist/graph/onboarding-composer.d.ts.map +1 -0
  121. package/dist/graph/onboarding-composer.js +275 -0
  122. package/dist/graph/onboarding-composer.js.map +1 -0
  123. package/dist/graph/pipeline-lifecycle.d.ts +86 -0
  124. package/dist/graph/pipeline-lifecycle.d.ts.map +1 -0
  125. package/dist/graph/pipeline-lifecycle.js +329 -0
  126. package/dist/graph/pipeline-lifecycle.js.map +1 -0
  127. package/dist/graph/preflight-budgets.d.ts +52 -0
  128. package/dist/graph/preflight-budgets.d.ts.map +1 -0
  129. package/dist/graph/preflight-budgets.js +78 -0
  130. package/dist/graph/preflight-budgets.js.map +1 -0
  131. package/dist/graph/preflight-injector.d.ts +116 -0
  132. package/dist/graph/preflight-injector.d.ts.map +1 -0
  133. package/dist/graph/preflight-injector.js +538 -0
  134. package/dist/graph/preflight-injector.js.map +1 -0
  135. package/dist/graph/prereq.d.ts +12 -0
  136. package/dist/graph/prereq.d.ts.map +1 -0
  137. package/dist/graph/prereq.js +61 -0
  138. package/dist/graph/prereq.js.map +1 -0
  139. package/dist/graph/prompts.d.ts +42 -0
  140. package/dist/graph/prompts.d.ts.map +1 -0
  141. package/dist/graph/prompts.js +80 -0
  142. package/dist/graph/prompts.js.map +1 -0
  143. package/dist/graph/sandbox.d.ts +19 -0
  144. package/dist/graph/sandbox.d.ts.map +1 -0
  145. package/dist/graph/sandbox.js +25 -0
  146. package/dist/graph/sandbox.js.map +1 -0
  147. package/dist/graph/token-usage.d.ts +21 -0
  148. package/dist/graph/token-usage.d.ts.map +1 -0
  149. package/dist/graph/token-usage.js +22 -0
  150. package/dist/graph/token-usage.js.map +1 -0
  151. package/dist/graph/types.d.ts +129 -0
  152. package/dist/graph/types.d.ts.map +1 -0
  153. package/dist/graph/types.js +12 -0
  154. package/dist/graph/types.js.map +1 -0
  155. package/dist/incident/orchestrator.d.ts +168 -0
  156. package/dist/incident/orchestrator.d.ts.map +1 -0
  157. package/dist/incident/orchestrator.js +279 -0
  158. package/dist/incident/orchestrator.js.map +1 -0
  159. package/dist/incident/playbook-search.d.ts +67 -0
  160. package/dist/incident/playbook-search.d.ts.map +1 -0
  161. package/dist/incident/playbook-search.js +288 -0
  162. package/dist/incident/playbook-search.js.map +1 -0
  163. package/dist/incident/postmortem.d.ts +44 -0
  164. package/dist/incident/postmortem.d.ts.map +1 -0
  165. package/dist/incident/postmortem.js +486 -0
  166. package/dist/incident/postmortem.js.map +1 -0
  167. package/dist/incident/resolution-verify.d.ts +186 -0
  168. package/dist/incident/resolution-verify.d.ts.map +1 -0
  169. package/dist/incident/resolution-verify.js +210 -0
  170. package/dist/incident/resolution-verify.js.map +1 -0
  171. package/dist/incident/rollback.d.ts +137 -0
  172. package/dist/incident/rollback.d.ts.map +1 -0
  173. package/dist/incident/rollback.js +328 -0
  174. package/dist/incident/rollback.js.map +1 -0
  175. package/dist/incident/timeline.d.ts +147 -0
  176. package/dist/incident/timeline.d.ts.map +1 -0
  177. package/dist/incident/timeline.js +452 -0
  178. package/dist/incident/timeline.js.map +1 -0
  179. package/dist/incident/types.d.ts +335 -0
  180. package/dist/incident/types.d.ts.map +1 -0
  181. package/dist/incident/types.js +158 -0
  182. package/dist/incident/types.js.map +1 -0
  183. package/dist/index.d.ts +1 -1
  184. package/dist/index.d.ts.map +1 -1
  185. package/dist/index.js +1 -1
  186. package/dist/index.js.map +1 -1
  187. package/dist/mcp/event-stream.d.ts +46 -0
  188. package/dist/mcp/event-stream.d.ts.map +1 -0
  189. package/dist/mcp/event-stream.js +421 -0
  190. package/dist/mcp/event-stream.js.map +1 -0
  191. package/dist/mcp/external-client.d.ts +38 -0
  192. package/dist/mcp/external-client.d.ts.map +1 -0
  193. package/dist/mcp/external-client.js +121 -0
  194. package/dist/mcp/external-client.js.map +1 -0
  195. package/dist/mcp/run-manager.d.ts +74 -9
  196. package/dist/mcp/run-manager.d.ts.map +1 -1
  197. package/dist/mcp/run-manager.js +127 -31
  198. package/dist/mcp/run-manager.js.map +1 -1
  199. package/dist/mcp/server.d.ts.map +1 -1
  200. package/dist/mcp/server.js +56 -0
  201. package/dist/mcp/server.js.map +1 -1
  202. package/dist/mcp/tools/abort-run.d.ts +2 -0
  203. package/dist/mcp/tools/abort-run.d.ts.map +1 -0
  204. package/dist/mcp/tools/abort-run.js +62 -0
  205. package/dist/mcp/tools/abort-run.js.map +1 -0
  206. package/dist/mcp/tools/anchor.js +1 -1
  207. package/dist/mcp/tools/anchor.js.map +1 -1
  208. package/dist/mcp/tools/approve-checkpoint.d.ts +2 -0
  209. package/dist/mcp/tools/approve-checkpoint.d.ts.map +1 -0
  210. package/dist/mcp/tools/approve-checkpoint.js +70 -0
  211. package/dist/mcp/tools/approve-checkpoint.js.map +1 -0
  212. package/dist/mcp/tools/brownfield.js +1 -1
  213. package/dist/mcp/tools/brownfield.js.map +1 -1
  214. package/dist/mcp/tools/get-project-state.d.ts +2 -0
  215. package/dist/mcp/tools/get-project-state.d.ts.map +1 -0
  216. package/dist/mcp/tools/get-project-state.js +107 -0
  217. package/dist/mcp/tools/get-project-state.js.map +1 -0
  218. package/dist/mcp/tools/get-run-status.d.ts +2 -0
  219. package/dist/mcp/tools/get-run-status.d.ts.map +1 -0
  220. package/dist/mcp/tools/get-run-status.js +40 -0
  221. package/dist/mcp/tools/get-run-status.js.map +1 -0
  222. package/dist/mcp/tools/graph-schemas.d.ts +100 -0
  223. package/dist/mcp/tools/graph-schemas.d.ts.map +1 -0
  224. package/dist/mcp/tools/graph-schemas.js +39 -0
  225. package/dist/mcp/tools/graph-schemas.js.map +1 -0
  226. package/dist/mcp/tools/graph.d.ts +19 -0
  227. package/dist/mcp/tools/graph.d.ts.map +1 -0
  228. package/dist/mcp/tools/graph.js +263 -0
  229. package/dist/mcp/tools/graph.js.map +1 -0
  230. package/dist/mcp/tools/incident.d.ts +2 -0
  231. package/dist/mcp/tools/incident.d.ts.map +1 -0
  232. package/dist/mcp/tools/incident.js +246 -0
  233. package/dist/mcp/tools/incident.js.map +1 -0
  234. package/dist/mcp/tools/index.d.ts +38 -18
  235. package/dist/mcp/tools/index.d.ts.map +1 -1
  236. package/dist/mcp/tools/index.js +74 -18
  237. package/dist/mcp/tools/index.js.map +1 -1
  238. package/dist/mcp/tools/list-active-runs.d.ts +2 -0
  239. package/dist/mcp/tools/list-active-runs.d.ts.map +1 -0
  240. package/dist/mcp/tools/list-active-runs.js +35 -0
  241. package/dist/mcp/tools/list-active-runs.js.map +1 -0
  242. package/dist/mcp/tools/list-pending-approvals.d.ts +2 -0
  243. package/dist/mcp/tools/list-pending-approvals.d.ts.map +1 -0
  244. package/dist/mcp/tools/list-pending-approvals.js +40 -0
  245. package/dist/mcp/tools/list-pending-approvals.js.map +1 -0
  246. package/dist/mcp/tools/list-projects.d.ts +2 -0
  247. package/dist/mcp/tools/list-projects.d.ts.map +1 -0
  248. package/dist/mcp/tools/list-projects.js +101 -0
  249. package/dist/mcp/tools/list-projects.js.map +1 -0
  250. package/dist/mcp/tools/list-specs.d.ts +2 -0
  251. package/dist/mcp/tools/list-specs.d.ts.map +1 -0
  252. package/dist/mcp/tools/list-specs.js +48 -0
  253. package/dist/mcp/tools/list-specs.js.map +1 -0
  254. package/dist/mcp/tools/playbook.d.ts +2 -0
  255. package/dist/mcp/tools/playbook.d.ts.map +1 -0
  256. package/dist/mcp/tools/playbook.js +104 -0
  257. package/dist/mcp/tools/playbook.js.map +1 -0
  258. package/dist/mcp/tools/postmortem.d.ts +2 -0
  259. package/dist/mcp/tools/postmortem.d.ts.map +1 -0
  260. package/dist/mcp/tools/postmortem.js +75 -0
  261. package/dist/mcp/tools/postmortem.js.map +1 -0
  262. package/dist/mcp/tools/react.js +1 -1
  263. package/dist/mcp/tools/react.js.map +1 -1
  264. package/dist/mcp/tools/reject-checkpoint.d.ts +2 -0
  265. package/dist/mcp/tools/reject-checkpoint.d.ts.map +1 -0
  266. package/dist/mcp/tools/reject-checkpoint.js +79 -0
  267. package/dist/mcp/tools/reject-checkpoint.js.map +1 -0
  268. package/dist/mcp/tools/rollback.d.ts +2 -0
  269. package/dist/mcp/tools/rollback.d.ts.map +1 -0
  270. package/dist/mcp/tools/rollback.js +78 -0
  271. package/dist/mcp/tools/rollback.js.map +1 -0
  272. package/dist/mcp/tools/run-in-worktree.d.ts +2 -0
  273. package/dist/mcp/tools/run-in-worktree.d.ts.map +1 -0
  274. package/dist/mcp/tools/run-in-worktree.js +90 -0
  275. package/dist/mcp/tools/run-in-worktree.js.map +1 -0
  276. package/dist/mcp/tools/run.js +1 -1
  277. package/dist/mcp/tools/run.js.map +1 -1
  278. package/dist/mcp/tools/solidity.js +1 -1
  279. package/dist/mcp/tools/solidity.js.map +1 -1
  280. package/dist/mcp/tools/status.d.ts.map +1 -1
  281. package/dist/mcp/tools/status.js +11 -0
  282. package/dist/mcp/tools/status.js.map +1 -1
  283. package/dist/mcp/tools/subscribe-events.d.ts +2 -0
  284. package/dist/mcp/tools/subscribe-events.d.ts.map +1 -0
  285. package/dist/mcp/tools/subscribe-events.js +48 -0
  286. package/dist/mcp/tools/subscribe-events.js.map +1 -0
  287. package/dist/mcp/tools/unsubscribe-events.d.ts +2 -0
  288. package/dist/mcp/tools/unsubscribe-events.d.ts.map +1 -0
  289. package/dist/mcp/tools/unsubscribe-events.js +45 -0
  290. package/dist/mcp/tools/unsubscribe-events.js.map +1 -0
  291. package/dist/orchestrator/agent-loader.d.ts +16 -0
  292. package/dist/orchestrator/agent-loader.d.ts.map +1 -1
  293. package/dist/orchestrator/agent-loader.js +16 -0
  294. package/dist/orchestrator/agent-loader.js.map +1 -1
  295. package/dist/orchestrator/architect-agent.d.ts.map +1 -1
  296. package/dist/orchestrator/architect-agent.js +37 -8
  297. package/dist/orchestrator/architect-agent.js.map +1 -1
  298. package/dist/orchestrator/checkpoints/audit.d.ts +128 -0
  299. package/dist/orchestrator/checkpoints/audit.d.ts.map +1 -0
  300. package/dist/orchestrator/checkpoints/audit.js +272 -0
  301. package/dist/orchestrator/checkpoints/audit.js.map +1 -0
  302. package/dist/orchestrator/checkpoints/feedback-router.d.ts +213 -0
  303. package/dist/orchestrator/checkpoints/feedback-router.d.ts.map +1 -0
  304. package/dist/orchestrator/checkpoints/feedback-router.js +438 -0
  305. package/dist/orchestrator/checkpoints/feedback-router.js.map +1 -0
  306. package/dist/orchestrator/checkpoints/index.d.ts +11 -0
  307. package/dist/orchestrator/checkpoints/index.d.ts.map +1 -0
  308. package/dist/orchestrator/checkpoints/index.js +12 -0
  309. package/dist/orchestrator/checkpoints/index.js.map +1 -0
  310. package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts +35 -0
  311. package/dist/orchestrator/checkpoints/mechanisms/cli.d.ts.map +1 -0
  312. package/dist/orchestrator/checkpoints/mechanisms/cli.js +153 -0
  313. package/dist/orchestrator/checkpoints/mechanisms/cli.js.map +1 -0
  314. package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts +34 -0
  315. package/dist/orchestrator/checkpoints/mechanisms/disk.d.ts.map +1 -0
  316. package/dist/orchestrator/checkpoints/mechanisms/disk.js +139 -0
  317. package/dist/orchestrator/checkpoints/mechanisms/disk.js.map +1 -0
  318. package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts +141 -0
  319. package/dist/orchestrator/checkpoints/mechanisms/pr.d.ts.map +1 -0
  320. package/dist/orchestrator/checkpoints/mechanisms/pr.js +445 -0
  321. package/dist/orchestrator/checkpoints/mechanisms/pr.js.map +1 -0
  322. package/dist/orchestrator/checkpoints/noop.d.ts +12 -0
  323. package/dist/orchestrator/checkpoints/noop.d.ts.map +1 -0
  324. package/dist/orchestrator/checkpoints/noop.js +13 -0
  325. package/dist/orchestrator/checkpoints/noop.js.map +1 -0
  326. package/dist/orchestrator/checkpoints/registry.d.ts +48 -0
  327. package/dist/orchestrator/checkpoints/registry.d.ts.map +1 -0
  328. package/dist/orchestrator/checkpoints/registry.js +89 -0
  329. package/dist/orchestrator/checkpoints/registry.js.map +1 -0
  330. package/dist/orchestrator/checkpoints/renderers/_util.d.ts +50 -0
  331. package/dist/orchestrator/checkpoints/renderers/_util.d.ts.map +1 -0
  332. package/dist/orchestrator/checkpoints/renderers/_util.js +137 -0
  333. package/dist/orchestrator/checkpoints/renderers/_util.js.map +1 -0
  334. package/dist/orchestrator/checkpoints/renderers/code-review.d.ts +15 -0
  335. package/dist/orchestrator/checkpoints/renderers/code-review.d.ts.map +1 -0
  336. package/dist/orchestrator/checkpoints/renderers/code-review.js +66 -0
  337. package/dist/orchestrator/checkpoints/renderers/code-review.js.map +1 -0
  338. package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts +15 -0
  339. package/dist/orchestrator/checkpoints/renderers/curator-briefing.d.ts.map +1 -0
  340. package/dist/orchestrator/checkpoints/renderers/curator-briefing.js +40 -0
  341. package/dist/orchestrator/checkpoints/renderers/curator-briefing.js.map +1 -0
  342. package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts +15 -0
  343. package/dist/orchestrator/checkpoints/renderers/eval-result.d.ts.map +1 -0
  344. package/dist/orchestrator/checkpoints/renderers/eval-result.js +54 -0
  345. package/dist/orchestrator/checkpoints/renderers/eval-result.js.map +1 -0
  346. package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts +49 -0
  347. package/dist/orchestrator/checkpoints/renderers/generator-diff.d.ts.map +1 -0
  348. package/dist/orchestrator/checkpoints/renderers/generator-diff.js +154 -0
  349. package/dist/orchestrator/checkpoints/renderers/generator-diff.js.map +1 -0
  350. package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts +15 -0
  351. package/dist/orchestrator/checkpoints/renderers/pipeline-summary.d.ts.map +1 -0
  352. package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js +59 -0
  353. package/dist/orchestrator/checkpoints/renderers/pipeline-summary.js.map +1 -0
  354. package/dist/orchestrator/checkpoints/renderers/plan.d.ts +15 -0
  355. package/dist/orchestrator/checkpoints/renderers/plan.d.ts.map +1 -0
  356. package/dist/orchestrator/checkpoints/renderers/plan.js +34 -0
  357. package/dist/orchestrator/checkpoints/renderers/plan.js.map +1 -0
  358. package/dist/orchestrator/checkpoints/renderers/registry.d.ts +43 -0
  359. package/dist/orchestrator/checkpoints/renderers/registry.d.ts.map +1 -0
  360. package/dist/orchestrator/checkpoints/renderers/registry.js +83 -0
  361. package/dist/orchestrator/checkpoints/renderers/registry.js.map +1 -0
  362. package/dist/orchestrator/checkpoints/renderers/research.d.ts +15 -0
  363. package/dist/orchestrator/checkpoints/renderers/research.d.ts.map +1 -0
  364. package/dist/orchestrator/checkpoints/renderers/research.js +39 -0
  365. package/dist/orchestrator/checkpoints/renderers/research.js.map +1 -0
  366. package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts +20 -0
  367. package/dist/orchestrator/checkpoints/renderers/sprint-contract.d.ts.map +1 -0
  368. package/dist/orchestrator/checkpoints/renderers/sprint-contract.js +57 -0
  369. package/dist/orchestrator/checkpoints/renderers/sprint-contract.js.map +1 -0
  370. package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts +15 -0
  371. package/dist/orchestrator/checkpoints/renderers/sprint-summary.d.ts.map +1 -0
  372. package/dist/orchestrator/checkpoints/renderers/sprint-summary.js +38 -0
  373. package/dist/orchestrator/checkpoints/renderers/sprint-summary.js.map +1 -0
  374. package/dist/orchestrator/checkpoints/sites.d.ts +22 -0
  375. package/dist/orchestrator/checkpoints/sites.d.ts.map +1 -0
  376. package/dist/orchestrator/checkpoints/sites.js +57 -0
  377. package/dist/orchestrator/checkpoints/sites.js.map +1 -0
  378. package/dist/orchestrator/checkpoints/types.d.ts +51 -0
  379. package/dist/orchestrator/checkpoints/types.d.ts.map +1 -0
  380. package/dist/orchestrator/checkpoints/types.js +9 -0
  381. package/dist/orchestrator/checkpoints/types.js.map +1 -0
  382. package/dist/orchestrator/code-reviewer-agent.d.ts +50 -0
  383. package/dist/orchestrator/code-reviewer-agent.d.ts.map +1 -0
  384. package/dist/orchestrator/code-reviewer-agent.js +283 -0
  385. package/dist/orchestrator/code-reviewer-agent.js.map +1 -0
  386. package/dist/orchestrator/curator-agent.d.ts.map +1 -1
  387. package/dist/orchestrator/curator-agent.js +59 -8
  388. package/dist/orchestrator/curator-agent.js.map +1 -1
  389. package/dist/orchestrator/deploy/classify.d.ts +31 -0
  390. package/dist/orchestrator/deploy/classify.d.ts.map +1 -0
  391. package/dist/orchestrator/deploy/classify.js +109 -0
  392. package/dist/orchestrator/deploy/classify.js.map +1 -0
  393. package/dist/orchestrator/deploy/execute.d.ts +45 -0
  394. package/dist/orchestrator/deploy/execute.d.ts.map +1 -0
  395. package/dist/orchestrator/deploy/execute.js +146 -0
  396. package/dist/orchestrator/deploy/execute.js.map +1 -0
  397. package/dist/orchestrator/deploy/executor.d.ts +22 -0
  398. package/dist/orchestrator/deploy/executor.d.ts.map +1 -0
  399. package/dist/orchestrator/deploy/executor.js +31 -0
  400. package/dist/orchestrator/deploy/executor.js.map +1 -0
  401. package/dist/orchestrator/deploy/index.d.ts +21 -0
  402. package/dist/orchestrator/deploy/index.d.ts.map +1 -0
  403. package/dist/orchestrator/deploy/index.js +21 -0
  404. package/dist/orchestrator/deploy/index.js.map +1 -0
  405. package/dist/orchestrator/deploy/resolve.d.ts +51 -0
  406. package/dist/orchestrator/deploy/resolve.d.ts.map +1 -0
  407. package/dist/orchestrator/deploy/resolve.js +53 -0
  408. package/dist/orchestrator/deploy/resolve.js.map +1 -0
  409. package/dist/orchestrator/deploy/spawn.d.ts +60 -0
  410. package/dist/orchestrator/deploy/spawn.d.ts.map +1 -0
  411. package/dist/orchestrator/deploy/spawn.js +62 -0
  412. package/dist/orchestrator/deploy/spawn.js.map +1 -0
  413. package/dist/orchestrator/deploy/types.d.ts +98 -0
  414. package/dist/orchestrator/deploy/types.d.ts.map +1 -0
  415. package/dist/orchestrator/deploy/types.js +39 -0
  416. package/dist/orchestrator/deploy/types.js.map +1 -0
  417. package/dist/orchestrator/evaluator-agent.d.ts.map +1 -1
  418. package/dist/orchestrator/evaluator-agent.js +21 -8
  419. package/dist/orchestrator/evaluator-agent.js.map +1 -1
  420. package/dist/orchestrator/generator-agent.d.ts.map +1 -1
  421. package/dist/orchestrator/generator-agent.js +21 -8
  422. package/dist/orchestrator/generator-agent.js.map +1 -1
  423. package/dist/orchestrator/model-resolver.d.ts.map +1 -1
  424. package/dist/orchestrator/model-resolver.js +3 -1
  425. package/dist/orchestrator/model-resolver.js.map +1 -1
  426. package/dist/orchestrator/observability/index.d.ts +12 -0
  427. package/dist/orchestrator/observability/index.d.ts.map +1 -0
  428. package/dist/orchestrator/observability/index.js +12 -0
  429. package/dist/orchestrator/observability/index.js.map +1 -0
  430. package/dist/orchestrator/observability/merge.d.ts +73 -0
  431. package/dist/orchestrator/observability/merge.d.ts.map +1 -0
  432. package/dist/orchestrator/observability/merge.js +110 -0
  433. package/dist/orchestrator/observability/merge.js.map +1 -0
  434. package/dist/orchestrator/pipeline.d.ts +21 -0
  435. package/dist/orchestrator/pipeline.d.ts.map +1 -1
  436. package/dist/orchestrator/pipeline.js +156 -2
  437. package/dist/orchestrator/pipeline.js.map +1 -1
  438. package/dist/orchestrator/planner-agent.d.ts.map +1 -1
  439. package/dist/orchestrator/planner-agent.js +5 -4
  440. package/dist/orchestrator/planner-agent.js.map +1 -1
  441. package/dist/orchestrator/research-agent.d.ts.map +1 -1
  442. package/dist/orchestrator/research-agent.js +46 -9
  443. package/dist/orchestrator/research-agent.js.map +1 -1
  444. package/dist/orchestrator/tools/handlers.d.ts +2 -0
  445. package/dist/orchestrator/tools/handlers.d.ts.map +1 -1
  446. package/dist/orchestrator/tools/handlers.js +1 -1
  447. package/dist/orchestrator/tools/handlers.js.map +1 -1
  448. package/dist/orchestrator/tools/index.d.ts +84 -1
  449. package/dist/orchestrator/tools/index.d.ts.map +1 -1
  450. package/dist/orchestrator/tools/index.js +164 -1
  451. package/dist/orchestrator/tools/index.js.map +1 -1
  452. package/dist/orchestrator/worktree.d.ts +18 -0
  453. package/dist/orchestrator/worktree.d.ts.map +1 -0
  454. package/dist/orchestrator/worktree.js +129 -0
  455. package/dist/orchestrator/worktree.js.map +1 -0
  456. package/dist/providers/anthropic.d.ts +8 -1
  457. package/dist/providers/anthropic.d.ts.map +1 -1
  458. package/dist/providers/anthropic.js +86 -5
  459. package/dist/providers/anthropic.js.map +1 -1
  460. package/dist/providers/factory.d.ts.map +1 -1
  461. package/dist/providers/factory.js +35 -2
  462. package/dist/providers/factory.js.map +1 -1
  463. package/dist/providers/google.d.ts.map +1 -1
  464. package/dist/providers/google.js +5 -0
  465. package/dist/providers/google.js.map +1 -1
  466. package/dist/providers/index.d.ts +1 -1
  467. package/dist/providers/index.d.ts.map +1 -1
  468. package/dist/providers/index.js.map +1 -1
  469. package/dist/providers/openai.d.ts.map +1 -1
  470. package/dist/providers/openai.js +4 -0
  471. package/dist/providers/openai.js.map +1 -1
  472. package/dist/providers/types.d.ts +25 -2
  473. package/dist/providers/types.d.ts.map +1 -1
  474. package/dist/state/approval-state.d.ts +74 -0
  475. package/dist/state/approval-state.d.ts.map +1 -0
  476. package/dist/state/approval-state.js +127 -0
  477. package/dist/state/approval-state.js.map +1 -0
  478. package/dist/state/index.d.ts +3 -0
  479. package/dist/state/index.d.ts.map +1 -1
  480. package/dist/state/index.js +4 -1
  481. package/dist/state/index.js.map +1 -1
  482. package/dist/state/review-state.d.ts +15 -0
  483. package/dist/state/review-state.d.ts.map +1 -0
  484. package/dist/state/review-state.js +51 -0
  485. package/dist/state/review-state.js.map +1 -0
  486. package/dist/state/run-state.d.ts +39 -0
  487. package/dist/state/run-state.d.ts.map +1 -0
  488. package/dist/state/run-state.js +101 -0
  489. package/dist/state/run-state.js.map +1 -0
  490. package/dist/telemetry/emit.d.ts +41 -0
  491. package/dist/telemetry/emit.d.ts.map +1 -0
  492. package/dist/telemetry/emit.js +65 -0
  493. package/dist/telemetry/emit.js.map +1 -0
  494. package/dist/utils/git.d.ts +27 -0
  495. package/dist/utils/git.d.ts.map +1 -1
  496. package/dist/utils/git.js +50 -0
  497. package/dist/utils/git.js.map +1 -1
  498. package/hooks/hooks.json +17 -1
  499. package/hooks/session-start +42 -0
  500. package/package.json +5 -2
  501. package/scripts/check-prereqs.sh +12 -0
  502. package/scripts/e2e-graph-smoke.sh +167 -0
  503. package/scripts/graph-hook.mjs +151 -0
  504. package/scripts/run-kpi-gate.mjs +245 -0
  505. package/scripts/sync-skills.mjs +4 -1
  506. package/skills/bober.code-review/SKILL.md +186 -0
  507. package/skills/bober.debug/SKILL.md +300 -0
  508. package/skills/bober.deploy/SKILL.md +262 -0
  509. package/skills/bober.diagnose/SKILL.md +254 -0
  510. package/skills/bober.graph/SKILL.md +85 -0
  511. package/skills/bober.impact/SKILL.md +101 -0
  512. package/skills/bober.incident/SKILL.md +245 -0
  513. package/skills/bober.onboard/SKILL.md +84 -0
  514. package/skills/bober.plan/SKILL.md +10 -0
  515. package/skills/bober.postmortem/SKILL.md +231 -0
  516. package/skills/bober.runbook/SKILL.md +335 -0
  517. package/skills/bober.using-bober/SKILL.md +133 -0
  518. package/skills/bober.verify/SKILL.md +143 -0
@@ -15,33 +15,98 @@ export interface RunResult {
15
15
  export interface RunState {
16
16
  runId: string;
17
17
  task: string;
18
- status: "running" | "completed" | "failed";
18
+ status: "running" | "completed" | "failed" | "aborted";
19
19
  startedAt: string;
20
20
  completedAt?: string;
21
+ abortedAt?: string;
22
+ abortReason?: string;
21
23
  progress: RunProgress;
22
24
  result?: RunResult;
23
25
  error?: string;
26
+ projectRoot: string;
27
+ specId?: string;
28
+ /** Sprint 4: when this run was launched via runInWorktree(), the absolute
29
+ * path of the git worktree the pipeline executed in. Undefined for in-place
30
+ * runs (the existing bober_run path). */
31
+ worktreePath?: string;
32
+ /** Sprint 4: the git branch the worktree was created on. Undefined for
33
+ * in-place runs. */
34
+ branch?: string;
35
+ }
36
+ /**
37
+ * Optional parameters for startRun().
38
+ * All fields are optional for back-compatibility with existing 3-arg callers.
39
+ */
40
+ export interface StartRunOptions {
41
+ /** Pre-computed runId. When omitted, RunManager generates one with randomUUID(). */
42
+ runId?: string;
43
+ /** When the run is executed inside a git worktree, the absolute path of that worktree. */
44
+ worktreePath?: string;
45
+ /** Branch the worktree was created on. */
46
+ branch?: string;
24
47
  }
25
48
  export declare class RunManager {
26
- private activeRun;
49
+ private runs;
27
50
  /**
28
- * Check whether a pipeline is currently running.
51
+ * Check whether ANY pipeline run is currently in 'running' status.
52
+ *
53
+ * Back-compat: preserves the existing boolean contract used by
54
+ * bober_run and all other tool callers.
29
55
  */
30
56
  isRunning(): boolean;
31
57
  /**
32
- * Return the current RunState, or null if no run has ever been started.
58
+ * Return the most-recently-started run, or null if no runs exist.
59
+ *
60
+ * Back-compat: when only one run exists this is identical to the
61
+ * old `return this.activeRun` behavior. When multiple runs exist
62
+ * the most-recently-started one is returned (sorted by startedAt desc).
33
63
  */
34
64
  getStatus(): RunState | null;
65
+ /**
66
+ * Return the RunState for a specific runId, or null if not found.
67
+ */
68
+ getRun(runId: string): RunState | null;
69
+ /**
70
+ * Return all runs currently in 'running' status.
71
+ */
72
+ listActiveRuns(): RunState[];
73
+ /**
74
+ * Abort a run by setting its status to 'aborted' with the given reason.
75
+ * Persists the new state to disk (best-effort; logs on failure).
76
+ */
77
+ abortRun(runId: string, reason: string): void;
78
+ /**
79
+ * Return ALL known runs regardless of status.
80
+ * Used by bober_list_active_runs for status-filtered listing.
81
+ */
82
+ listAllRuns(): RunState[];
35
83
  /**
36
84
  * Start a new pipeline run as a fire-and-forget promise.
37
85
  *
38
- * Throws if a run is already active (callers should check isRunning first).
39
- * Returns the new runId immediately.
86
+ * Does NOT throw when another run is already in progress concurrent
87
+ * runs are now supported. Callers that want to enforce one-at-a-time
88
+ * behavior should check isRunning() themselves (bober_run tool does
89
+ * this to preserve existing UX).
90
+ *
91
+ * Writes the initial state.json synchronously (await) before returning
92
+ * so disk state is visible immediately after startRun() returns.
93
+ *
94
+ * Returns the new runId.
95
+ *
96
+ * The optional `pipelineFn` parameter exists for testing only.
97
+ */
98
+ startRun(task: string, projectRoot: string, config: BoberConfig, pipelineFn?: (task: string, projectRoot: string, config: BoberConfig) => Promise<PipelineResult>, opts?: StartRunOptions): Promise<string>;
99
+ /**
100
+ * Load all run state files from .bober/runs/ on startup.
101
+ *
102
+ * Populates the in-memory map from disk. Any run with status='running'
103
+ * is reconciled to status='failed' with error='orchestrator crashed
104
+ * before completion' — it cannot still be running if the process just
105
+ * started.
40
106
  *
41
- * The optional `pipelineFn` parameter exists for testing only. In production
42
- * it defaults to the real `runPipeline` function.
107
+ * Skips malformed state.json files with a warn log (does not throw).
43
108
  */
44
- startRun(task: string, projectRoot: string, config: BoberConfig, pipelineFn?: (task: string, projectRoot: string, config: BoberConfig) => Promise<PipelineResult>): string;
109
+ load(projectRoot: string): Promise<void>;
45
110
  }
46
111
  export declare const runManager: RunManager;
47
112
  //# sourceMappingURL=run-manager.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-manager.d.ts","sourceRoot":"","sources":["../../src/mcp/run-manager.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAIlE,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,OAAO,CAAC;IACjB,gBAAgB,EAAE,MAAM,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,QAAQ;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;IAC3C,SAAS,EAAE,MAAM,CAAC;IAClB,W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AAI,GAAE,eAAoB,GACzB,OAAO,CAAC,MAAM,CAAC;IAmElB;;;;;;;;;OASG;IACG,IAAI,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAoB/C;AAID,eAAO,MAAM,UAAU,YAAmB,CAAC"}
@@ -1,78 +1,174 @@
1
1
  // ── RunManager ───────────────────────────────────────────────────────
2
2
  //
3
- // Tracks the single active pipeline run in memory.
4
- // bober_run starts a fire-and-forget pipeline; bober_status queries state.
3
+ // Tracks active and historical pipeline runs in memory, backed by
4
+ // per-run state files at .bober/runs/<runId>/state.json.
5
+ //
6
+ // Back-compat: the singleton `runManager` export, isRunning(), and
7
+ // getStatus() preserve existing bober_run / bober_status behavior.
8
+ // New callers use keyed methods: getRun(), listActiveRuns(), abortRun(),
9
+ // load().
5
10
  import { randomUUID } from "node:crypto";
6
11
  import { runPipeline } from "../orchestrator/pipeline.js";
12
+ import { writeRunState, listRunStateFiles } from "../state/run-state.js";
13
+ import { logger } from "../utils/logger.js";
7
14
  // ── RunManager ───────────────────────────────────────────────────────
8
15
  export class RunManager {
9
- activeRun = null;
16
+ runs = new Map();
10
17
  /**
11
- * Check whether a pipeline is currently running.
18
+ * Check whether ANY pipeline run is currently in 'running' status.
19
+ *
20
+ * Back-compat: preserves the existing boolean contract used by
21
+ * bober_run and all other tool callers.
12
22
  */
13
23
  isRunning() {
14
- return this.activeRun !== null && this.activeRun.status === "running";
24
+ return Array.from(this.runs.values()).some((s) => s.status === "running");
15
25
  }
16
26
  /**
17
- * Return the current RunState, or null if no run has ever been started.
27
+ * Return the most-recently-started run, or null if no runs exist.
28
+ *
29
+ * Back-compat: when only one run exists this is identical to the
30
+ * old `return this.activeRun` behavior. When multiple runs exist
31
+ * the most-recently-started one is returned (sorted by startedAt desc).
18
32
  */
19
33
  getStatus() {
20
- return this.activeRun;
34
+ if (this.runs.size === 0)
35
+ return null;
36
+ let newest = null;
37
+ for (const s of this.runs.values()) {
38
+ if (!newest || s.startedAt > newest.startedAt) {
39
+ newest = s;
40
+ }
41
+ }
42
+ return newest;
43
+ }
44
+ /**
45
+ * Return the RunState for a specific runId, or null if not found.
46
+ */
47
+ getRun(runId) {
48
+ return this.runs.get(runId) ?? null;
49
+ }
50
+ /**
51
+ * Return all runs currently in 'running' status.
52
+ */
53
+ listActiveRuns() {
54
+ return Array.from(this.runs.values()).filter((s) => s.status === "running");
55
+ }
56
+ /**
57
+ * Abort a run by setting its status to 'aborted' with the given reason.
58
+ * Persists the new state to disk (best-effort; logs on failure).
59
+ */
60
+ abortRun(runId, reason) {
61
+ const state = this.runs.get(runId);
62
+ if (!state)
63
+ return;
64
+ state.status = "aborted";
65
+ state.abortedAt = new Date().toISOString();
66
+ state.abortReason = reason;
67
+ writeRunState(state.projectRoot, state).catch((err) => {
68
+ logger.warn(`[RunManager.abortRun] Failed to persist aborted state for ${runId}: ${err instanceof Error ? err.message : String(err)}`);
69
+ });
70
+ }
71
+ /**
72
+ * Return ALL known runs regardless of status.
73
+ * Used by bober_list_active_runs for status-filtered listing.
74
+ */
75
+ listAllRuns() {
76
+ return Array.from(this.runs.values());
21
77
  }
22
78
  /**
23
79
  * Start a new pipeline run as a fire-and-forget promise.
24
80
  *
25
- * Throws if a run is already active (callers should check isRunning first).
26
- * Returns the new runId immediately.
81
+ * Does NOT throw when another run is already in progress concurrent
82
+ * runs are now supported. Callers that want to enforce one-at-a-time
83
+ * behavior should check isRunning() themselves (bober_run tool does
84
+ * this to preserve existing UX).
27
85
  *
28
- * The optional `pipelineFn` parameter exists for testing only. In production
29
- * it defaults to the real `runPipeline` function.
86
+ * Writes the initial state.json synchronously (await) before returning
87
+ * so disk state is visible immediately after startRun() returns.
88
+ *
89
+ * Returns the new runId.
90
+ *
91
+ * The optional `pipelineFn` parameter exists for testing only.
30
92
  */
31
- startRun(task, projectRoot, config, pipelineFn = runPipeline) {
32
- if (this.isRunning()) {
33
- throw new Error(`A pipeline is already running (runId: ${this.activeRun.runId}). Use bober_status to check progress.`);
34
- }
35
- const runId = randomUUID();
93
+ async startRun(task, projectRoot, config, pipelineFn = runPipeline, opts = {}) {
94
+ const runId = opts.runId ?? randomUUID();
36
95
  const now = new Date().toISOString();
37
- this.activeRun = {
96
+ const state = {
38
97
  runId,
39
98
  task,
40
99
  status: "running",
41
100
  startedAt: now,
42
- progress: {
43
- completed: 0,
44
- total: 0,
45
- },
101
+ progress: { completed: 0, total: 0 },
102
+ projectRoot,
103
+ ...(opts.worktreePath ? { worktreePath: opts.worktreePath } : {}),
104
+ ...(opts.branch ? { branch: opts.branch } : {}),
46
105
  };
106
+ this.runs.set(runId, state);
107
+ // Persist initial state synchronously before returning (sc-1-2)
108
+ await writeRunState(projectRoot, state);
47
109
  // Fire-and-forget: do NOT await this promise
48
110
  const promise = pipelineFn(task, projectRoot, config);
49
111
  promise
50
112
  .then((result) => {
51
- if (this.activeRun && this.activeRun.runId === runId) {
52
- this.activeRun.status = "completed";
53
- this.activeRun.completedAt = new Date().toISOString();
54
- this.activeRun.result = {
113
+ const s = this.runs.get(runId);
114
+ if (s) {
115
+ s.status = "completed";
116
+ s.completedAt = new Date().toISOString();
117
+ s.result = {
55
118
  success: result.success,
56
119
  completedSprints: result.completedSprints.length,
57
120
  failedSprints: result.failedSprints.length,
58
121
  duration: result.duration,
59
122
  };
60
- this.activeRun.progress = {
123
+ s.progress = {
61
124
  completed: result.completedSprints.length,
62
125
  total: result.completedSprints.length + result.failedSprints.length,
63
126
  };
127
+ writeRunState(projectRoot, s).catch((err) => {
128
+ logger.warn(`[RunManager] Failed to persist completed state for ${runId}: ${err instanceof Error ? err.message : String(err)}`);
129
+ });
64
130
  }
65
131
  })
66
132
  .catch((err) => {
67
- if (this.activeRun && this.activeRun.runId === runId) {
68
- this.activeRun.status = "failed";
69
- this.activeRun.completedAt = new Date().toISOString();
70
- this.activeRun.error =
71
- err instanceof Error ? err.message : String(err);
133
+ const s = this.runs.get(runId);
134
+ if (s) {
135
+ s.status = "failed";
136
+ s.completedAt = new Date().toISOString();
137
+ s.error = err instanceof Error ? err.message : String(err);
138
+ writeRunState(projectRoot, s).catch((writeErr) => {
139
+ logger.warn(`[RunManager] Failed to persist failed state for ${runId}: ${writeErr instanceof Error ? writeErr.message : String(writeErr)}`);
140
+ });
72
141
  }
73
142
  });
74
143
  return runId;
75
144
  }
145
+ /**
146
+ * Load all run state files from .bober/runs/ on startup.
147
+ *
148
+ * Populates the in-memory map from disk. Any run with status='running'
149
+ * is reconciled to status='failed' with error='orchestrator crashed
150
+ * before completion' — it cannot still be running if the process just
151
+ * started.
152
+ *
153
+ * Skips malformed state.json files with a warn log (does not throw).
154
+ */
155
+ async load(projectRoot) {
156
+ const states = await listRunStateFiles(projectRoot);
157
+ for (const s of states) {
158
+ if (s.status === "running") {
159
+ s.status = "failed";
160
+ s.completedAt = new Date().toISOString();
161
+ s.error = "orchestrator crashed before completion";
162
+ try {
163
+ await writeRunState(projectRoot, s);
164
+ }
165
+ catch (err) {
166
+ logger.warn(`[RunManager.load] Failed to persist reconciled state for ${s.runId}: ${err instanceof Error ? err.message : String(err)}`);
167
+ }
168
+ }
169
+ this.runs.set(s.runId, s);
170
+ }
171
+ }
76
172
  }
77
173
  // ── Module-scoped singleton ──────────────────────────────────────────
78
174
  export const runManager = new RunManager();
@@ -1 +1 @@
1
- {"version":3,"file":"run-manager.js","sourceRoot":"","sources":["../../src/mcp/run-manager.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,mDAAmD;AACnD,2EAA2E;AAE3E,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AA8B1D,wEAAwE;AAExE,MAAM,OAAO,UAAU;IACb,SAAS,GAAoB,IAAI,CAAC;IAE1C;;OAEG;IACH,SAAS;QACP,OAAO,IAAI,CAAC,SAAS,KAAK,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,MAAM,KAAK,SAAS,CAAC;IACxE,CAAC;I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AA4D,CAAC,CAAC,KAAK,KACjE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CACjD,EAAE,CACH,CAAC;gBACJ,CAAC;YACH,CAAC;YACD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;QAC5B,CAAC;IACH,CAAC;CACF;AAED,wEAAwE;AAExE,MAAM,CAAC,MAAM,UAAU,GAAG,IAAI,UAAU,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AA6B1D;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CAqFjB"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAgC1D;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,CAAC,CA4JjB"}
@@ -12,6 +12,9 @@ import { Server } from "@modelcontextprotocol/sdk/server";
12
12
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
13
13
  import { ListToolsRequestSchema, CallToolRequestSchema, McpError, ErrorCode, } from "@modelcontextprotocol/sdk/types.js";
14
14
  import { registerAllTools, getAllTools, getTool } from "./tools/index.js";
15
+ import { configExists, loadConfig } from "../config/loader.js";
16
+ import { runManager } from "./run-manager.js";
17
+ import { initEventStream, getEventStream } from "./event-stream.js";
15
18
  // ── Package version loader ──────────────────────────────────────────
16
19
  const __dirname = dirname(fileURLToPath(import.meta.url));
17
20
  async function loadVersion() {
@@ -43,6 +46,40 @@ export async function createBoberMCPServer(projectRoot) {
43
46
  const version = await loadVersion();
44
47
  // ── Register all tools before creating the server ────────────────
45
48
  registerAllTools();
49
+ // ── Reconcile prior run state from disk (cockpit-integration sprint 1) ───
50
+ try {
51
+ await runManager.load(projectRoot);
52
+ }
53
+ catch (err) {
54
+ process.stderr.write(`[agent-bober mcp] runManager.load failed (continuing): ${err instanceof Error ? err.message : String(err)}\n`);
55
+ }
56
+ // ── Conditionally register graph_* tools ─────────────────────────
57
+ // Per sprint 4 spec: only when bober.config.json has
58
+ // graph.enabled === true AND graph.exposeOnExternalMcp === true.
59
+ // Failures here MUST NOT prevent server boot.
60
+ try {
61
+ if (await configExists(projectRoot)) {
62
+ const config = await loadConfig(projectRoot);
63
+ if (config.graph?.enabled && config.graph?.exposeOnExternalMcp !== false) {
64
+ const { GraphFallback } = await import("../graph/fallback.js");
65
+ const { GraphArtifactStore } = await import("../graph/artifact-store.js");
66
+ const { IncidentLog } = await import("../graph/incidents.js");
67
+ const { TokensaveMcpClient } = await import("../graph/mcp-client.js");
68
+ const { GraphClient } = await import("../graph/client.js");
69
+ const { registerGraphTools } = await import("./tools/graph.js");
70
+ const cfg = config.graph;
71
+ const store = new GraphArtifactStore(projectRoot);
72
+ const incidents = new IncidentLog(projectRoot);
73
+ const mcpClient = new TokensaveMcpClient(projectRoot, cfg, incidents, cfg.tokensavePath ?? "tokensave");
74
+ const graphFallback = new GraphFallback("dual");
75
+ const client = new GraphClient(projectRoot, mcpClient, store, graphFallback, incidents, cfg);
76
+ registerGraphTools({ client, fallback: graphFallback });
77
+ }
78
+ }
79
+ }
80
+ catch (err) {
81
+ process.stderr.write(`[agent-bober mcp] graph tool registration skipped: ${err instanceof Error ? err.message : String(err)}\n`);
82
+ }
46
83
  // ── Create the server ────────────────────────────────────────────
47
84
  const server = new Server({
48
85
  name: "agent-bober",
@@ -91,10 +128,29 @@ export async function createBoberMCPServer(projectRoot) {
91
128
  // ── Connect stdio transport ───────────────────────────────────────
92
129
  const transport = new StdioServerTransport();
93
130
  await server.connect(transport);
131
+ // ── Initialize event-stream subsystem (cockpit-integration sprint 3) ──
132
+ // Must run AFTER server.connect() so the transport is live for notifications.
133
+ {
134
+ let queueBound = 1000;
135
+ try {
136
+ if (await configExists(projectRoot)) {
137
+ const cfg = await loadConfig(projectRoot);
138
+ queueBound = cfg.pipeline.eventQueueBound ?? 1000;
139
+ }
140
+ }
141
+ catch {
142
+ // Config read failure is non-fatal — use default
143
+ }
144
+ initEventStream(server, projectRoot, queueBound);
145
+ }
94
146
  process.stderr.write(`[agent-bober mcp] Server v${version} started (project: ${projectRoot})\n`);
95
147
  // ── Graceful shutdown ────────────────────────────────────────────
96
148
  const shutdown = () => {
97
149
  process.stderr.write("[agent-bober mcp] Shutting down...\n");
150
+ try {
151
+ getEventStream().shutdown();
152
+ }
153
+ catch { /* not initialized — ignore */ }
98
154
  server.close().catch(() => {
99
155
  // Ignore close errors during shutdown
100
156
  });
@@ -1 +1 @@
1
- {"version":3,"file":"server.js","sourceRoot":"","sources":["../../src/mcp/server.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,0DAA0D;AAC1D,kDAAkD;AAClD,EAAE;AACF,oEAAoE;AACpE,mDAAmD;AAEnD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,kCAAkC,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EACL,sBAAsB,EACtB,qBAAqB,EACrB,QAAQ,EACR,SAAS,GACV,MAAM,oCAAoC,CAAC;AAE5C,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAE1E,uEA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ACH,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;IAEF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAEhC,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function registerAbortRunTool(): void;
2
+ //# sourceMappingURL=abort-run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-run.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/abort-run.ts"],"names":[],"mappings":"AAoBA,wBAAgB,oBAAoB,IAAI,IAAI,CAuD3C"}
@@ -0,0 +1,62 @@
1
+ // ── bober_abort_run tool ─────────────────────────────────────────────
2
+ //
3
+ // Aborts a running pipeline run by runId. Flips the run's status to
4
+ // 'aborted', persists { reason, abortedAt } to state.json, and returns
5
+ // { runId, status: 'aborted', abortedAt }.
6
+ //
7
+ // Soft errors (not found, not active) return JSON { error: '...' }.
8
+ // Hard errors (missing runId arg) throw McpError(InvalidRequest).
9
+ //
10
+ // Note: this sprint flips the in-memory and disk state only. Forceful
11
+ // in-flight subprocess termination (SIGTERM propagation) is deferred to
12
+ // a future hardening sprint.
13
+ import { McpError, ErrorCode } from "@modelcontextprotocol/sdk/types.js";
14
+ import { registerTool } from "./registry.js";
15
+ import { runManager } from "../run-manager.js";
16
+ // ── Registration ─────────────────────────────────────────────────────
17
+ export function registerAbortRunTool() {
18
+ registerTool({
19
+ name: "bober_abort_run",
20
+ description: "Abort a running pipeline run by runId. " +
21
+ "Flips the run's status to 'aborted' and persists the abort reason. " +
22
+ "Returns the runId, status, and abortedAt timestamp. " +
23
+ "Returns a soft-error JSON when the run is not found or not currently running.",
24
+ inputSchema: {
25
+ type: "object",
26
+ properties: {
27
+ runId: {
28
+ type: "string",
29
+ description: "The unique identifier of the run to abort.",
30
+ },
31
+ reason: {
32
+ type: "string",
33
+ description: "Optional reason for aborting the run. Defaults to 'Aborted by user'.",
34
+ },
35
+ },
36
+ required: ["runId"],
37
+ additionalProperties: false,
38
+ },
39
+ handler: async (args) => {
40
+ const runId = typeof args.runId === "string" ? args.runId.trim() : "";
41
+ if (!runId) {
42
+ throw new McpError(ErrorCode.InvalidRequest, "runId is required and must be a non-empty string.");
43
+ }
44
+ const reason = typeof args.reason === "string" ? args.reason : "Aborted by user";
45
+ const state = runManager.getRun(runId);
46
+ if (state === null) {
47
+ return JSON.stringify({ error: `Run not found: ${runId}` }, null, 2);
48
+ }
49
+ if (state.status !== "running") {
50
+ return JSON.stringify({ error: "Run is not active" }, null, 2);
51
+ }
52
+ runManager.abortRun(runId, reason);
53
+ const updated = runManager.getRun(runId);
54
+ return JSON.stringify({
55
+ runId: updated.runId,
56
+ status: updated.status,
57
+ abortedAt: updated.abortedAt,
58
+ }, null, 2);
59
+ },
60
+ });
61
+ }
62
+ //# sourceMappingURL=abort-run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"abort-run.js","sourceRoot":"","sources":["../../../src/mcp/tools/abort-run.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,EAAE;AACF,oEAAoE;AACpE,uEAAuE;AACvE,2CAA2C;AAC3C,EAAE;AACF,oEAAoE;AACpE,kEAAkE;AAClE,EAAE;AACF,sEAAsE;AACtE,wEAAwE;AACxE,6BAA6B;AAE7B,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wEAAwE;AAExE,MAAM,UAAU,oBAAoB;IAClC,YAAY,CAAC;QACX,IAAI,EAAE,iBAAiB;QACvB,WAAW,EACT,yCAAyC;YACzC,qEAAqE;YACrE,sDAAsD;YACtD,+EAA+E;QACjF,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;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AC1C,OAAO,IAAI,CAAC,SAAS,CACnB;gBACE,KAAK,EAAE,OAAO,CAAC,KAAK;gBACpB,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,SAAS,EAAE,OAAO,CAAC,SAAS;aAC7B,EACD,IAAI,EACJ,CAAC,CACF,CAAC;QACJ,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -50,7 +50,7 @@ export function registerAnchorTool() {
50
50
  }
51
51
  config.project.mode = "greenfield";
52
52
  config.project.preset = "anchor";
53
- const runId = runManager.startRun(task, projectRoot, config);
53
+ const runId = await runManager.startRun(task, projectRoot, config);
54
54
  return JSON.stringify({
55
55
  runId,
56
56
  status: "running",
@@ -1 +1 @@
1
- {"version":3,"file":"anchor.js","sourceRoot":"","sources":["../../../src/mcp/tools/anchor.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,EAAE;AACF,4EAA4E;AAE5E,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAEnC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,oCAAoC,CAAC;AAEzE,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,wEAAwE;AAExE,MAAM,UAAU,kBAAkB;IAChC,YAAY,CAAC;QACX,IAAI,EAAE,cAAc;QACpB,WAAW,EACT,8DAA8D;YAC9D,+DAA+D;YAC/D,mDAAmD;YACnD,mCAAmC;QACrC,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,IAAI,EAAE;oBACJ,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,6CAA6C;iBAC3D;aACF;YACD,QAAQ,EAAE,CAAC,MAAM,CAAC;YAClB,oBAAoB,EAAE,KAAK;SAC5B;QACD,OAAO,EAAE,KAAK,EAAE,IAA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ckpointTool(): void;
2
+ //# sourceMappingURL=approve-checkpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approve-checkpoint.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/approve-checkpoint.ts"],"names":[],"mappings":"AAyBA,wBAAgB,6BAA6B,IAAI,IAAI,CA0DpD"}
@@ -0,0 +1,70 @@
1
+ // ── bober_approve_checkpoint tool ────────────────────────────────────
2
+ //
3
+ // Approves a pending checkpoint by writing
4
+ // .bober/approvals/<id>.approved.json with the same payload shape as
5
+ // the `bober approve` CLI command. Guards with pendingExists before
6
+ // writing to prevent dangling approved markers.
7
+ //
8
+ // Returns { approvedAt, checkpointId } on success.
9
+ // Soft errors for: missing pending, relative projectPath.
10
+ //
11
+ // Sprint 5 (cockpit-integration)
12
+ import { cwd } from "node:process";
13
+ import { isAbsolute } from "node:path";
14
+ import { registerTool } from "./registry.js";
15
+ import { pendingExists, saveApproved, } from "../../state/approval-state.js";
16
+ import { resolveApprover } from "../../cli/commands/approve.js";
17
+ // ── Registration ─────────────────────────────────────────────────────
18
+ export function registerApproveCheckpointTool() {
19
+ registerTool({
20
+ name: "bober_approve_checkpoint",
21
+ description: "Approve a pending checkpoint by writing .bober/approvals/<id>.approved.json. " +
22
+ "Shares the marker-file shape with the `bober approve` CLI command. " +
23
+ "Returns { approvedAt, checkpointId } on success.",
24
+ inputSchema: {
25
+ type: "object",
26
+ properties: {
27
+ checkpointId: {
28
+ type: "string",
29
+ description: "Checkpoint to approve.",
30
+ },
31
+ projectPath: {
32
+ type: "string",
33
+ description: "Absolute project root (defaults to cwd).",
34
+ },
35
+ editDelta: {
36
+ description: "Optional override payload (any JSON-serializable value).",
37
+ },
38
+ },
39
+ required: ["checkpointId"],
40
+ additionalProperties: false,
41
+ },
42
+ handler: async (args) => {
43
+ const checkpointId = typeof args.checkpointId === "string" ? args.checkpointId.trim() : "";
44
+ if (!checkpointId) {
45
+ return JSON.stringify({
46
+ error: "checkpointId is required and must be a non-empty string.",
47
+ });
48
+ }
49
+ const projectPath = typeof args.projectPath === "string" ? args.projectPath : cwd();
50
+ if (typeof args.projectPath === "string" && !isAbsolute(args.projectPath)) {
51
+ return JSON.stringify({ error: "projectPath must be absolute" });
52
+ }
53
+ const exists = await pendingExists(projectPath, checkpointId);
54
+ if (!exists) {
55
+ return JSON.stringify({
56
+ error: `No pending checkpoint found: ${checkpointId}`,
57
+ });
58
+ }
59
+ const approvedAt = new Date().toISOString();
60
+ const marker = {
61
+ approvedAt,
62
+ approverId: resolveApprover(),
63
+ ...(args.editDelta !== undefined ? { editDelta: args.editDelta } : {}),
64
+ };
65
+ await saveApproved(projectPath, checkpointId, marker);
66
+ return JSON.stringify({ approvedAt, checkpointId }, null, 2);
67
+ },
68
+ });
69
+ }
70
+ //# sourceMappingURL=approve-checkpoint.js.map