verbolab 0.1.0-alpha.1

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 (493) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/dist/bin/verbo.d.ts +3 -0
  4. package/dist/bin/verbo.d.ts.map +1 -0
  5. package/dist/bin/verbo.js +1156 -0
  6. package/dist/bin/verbo.js.map +1 -0
  7. package/dist/relay/index.d.ts +2 -0
  8. package/dist/relay/index.d.ts.map +1 -0
  9. package/dist/relay/index.js +15 -0
  10. package/dist/relay/index.js.map +1 -0
  11. package/dist/src/agent/agent-launcher.d.ts +64 -0
  12. package/dist/src/agent/agent-launcher.d.ts.map +1 -0
  13. package/dist/src/agent/agent-launcher.js +326 -0
  14. package/dist/src/agent/agent-launcher.js.map +1 -0
  15. package/dist/src/agent/agent-monitor.d.ts +16 -0
  16. package/dist/src/agent/agent-monitor.d.ts.map +1 -0
  17. package/dist/src/agent/agent-monitor.js +41 -0
  18. package/dist/src/agent/agent-monitor.js.map +1 -0
  19. package/dist/src/agent/fun-names.d.ts +9 -0
  20. package/dist/src/agent/fun-names.d.ts.map +1 -0
  21. package/dist/src/agent/fun-names.js +118 -0
  22. package/dist/src/agent/fun-names.js.map +1 -0
  23. package/dist/src/agent/mcp-shim.d.ts +45 -0
  24. package/dist/src/agent/mcp-shim.d.ts.map +1 -0
  25. package/dist/src/agent/mcp-shim.js +192 -0
  26. package/dist/src/agent/mcp-shim.js.map +1 -0
  27. package/dist/src/agent/personas.d.ts +47 -0
  28. package/dist/src/agent/personas.d.ts.map +1 -0
  29. package/dist/src/agent/personas.js +86 -0
  30. package/dist/src/agent/personas.js.map +1 -0
  31. package/dist/src/agent/provider-detection.d.ts +21 -0
  32. package/dist/src/agent/provider-detection.d.ts.map +1 -0
  33. package/dist/src/agent/provider-detection.js +47 -0
  34. package/dist/src/agent/provider-detection.js.map +1 -0
  35. package/dist/src/agent/providers/claude-provider.d.ts +3 -0
  36. package/dist/src/agent/providers/claude-provider.d.ts.map +1 -0
  37. package/dist/src/agent/providers/claude-provider.js +119 -0
  38. package/dist/src/agent/providers/claude-provider.js.map +1 -0
  39. package/dist/src/agent/providers/gemini-provider.d.ts +13 -0
  40. package/dist/src/agent/providers/gemini-provider.d.ts.map +1 -0
  41. package/dist/src/agent/providers/gemini-provider.js +143 -0
  42. package/dist/src/agent/providers/gemini-provider.js.map +1 -0
  43. package/dist/src/agent/providers/openai-provider.d.ts +3 -0
  44. package/dist/src/agent/providers/openai-provider.d.ts.map +1 -0
  45. package/dist/src/agent/providers/openai-provider.js +127 -0
  46. package/dist/src/agent/providers/openai-provider.js.map +1 -0
  47. package/dist/src/agent/providers/registry.d.ts +19 -0
  48. package/dist/src/agent/providers/registry.d.ts.map +1 -0
  49. package/dist/src/agent/providers/registry.js +30 -0
  50. package/dist/src/agent/providers/registry.js.map +1 -0
  51. package/dist/src/agent/providers/types.d.ts +118 -0
  52. package/dist/src/agent/providers/types.d.ts.map +1 -0
  53. package/dist/src/agent/providers/types.js +2 -0
  54. package/dist/src/agent/providers/types.js.map +1 -0
  55. package/dist/src/approval/approval-server.d.ts +17 -0
  56. package/dist/src/approval/approval-server.d.ts.map +1 -0
  57. package/dist/src/approval/approval-server.js +90 -0
  58. package/dist/src/approval/approval-server.js.map +1 -0
  59. package/dist/src/approval/approval-store.d.ts +29 -0
  60. package/dist/src/approval/approval-store.d.ts.map +1 -0
  61. package/dist/src/approval/approval-store.js +94 -0
  62. package/dist/src/approval/approval-store.js.map +1 -0
  63. package/dist/src/auth/auth-store.d.ts +18 -0
  64. package/dist/src/auth/auth-store.d.ts.map +1 -0
  65. package/dist/src/auth/auth-store.js +34 -0
  66. package/dist/src/auth/auth-store.js.map +1 -0
  67. package/dist/src/auth/device-code-client.d.ts +32 -0
  68. package/dist/src/auth/device-code-client.d.ts.map +1 -0
  69. package/dist/src/auth/device-code-client.js +41 -0
  70. package/dist/src/auth/device-code-client.js.map +1 -0
  71. package/dist/src/auth/plan-enforcer.d.ts +8 -0
  72. package/dist/src/auth/plan-enforcer.d.ts.map +1 -0
  73. package/dist/src/auth/plan-enforcer.js +14 -0
  74. package/dist/src/auth/plan-enforcer.js.map +1 -0
  75. package/dist/src/commands/audit.d.ts +7 -0
  76. package/dist/src/commands/audit.d.ts.map +1 -0
  77. package/dist/src/commands/audit.js +92 -0
  78. package/dist/src/commands/audit.js.map +1 -0
  79. package/dist/src/commands/team.d.ts +48 -0
  80. package/dist/src/commands/team.d.ts.map +1 -0
  81. package/dist/src/commands/team.js +175 -0
  82. package/dist/src/commands/team.js.map +1 -0
  83. package/dist/src/config/verbo-config.d.ts +43 -0
  84. package/dist/src/config/verbo-config.d.ts.map +1 -0
  85. package/dist/src/config/verbo-config.js +111 -0
  86. package/dist/src/config/verbo-config.js.map +1 -0
  87. package/dist/src/core/agent-session-store.d.ts +69 -0
  88. package/dist/src/core/agent-session-store.d.ts.map +1 -0
  89. package/dist/src/core/agent-session-store.js +168 -0
  90. package/dist/src/core/agent-session-store.js.map +1 -0
  91. package/dist/src/core/audit-log-store.d.ts +33 -0
  92. package/dist/src/core/audit-log-store.d.ts.map +1 -0
  93. package/dist/src/core/audit-log-store.js +104 -0
  94. package/dist/src/core/audit-log-store.js.map +1 -0
  95. package/dist/src/core/compliance.d.ts +50 -0
  96. package/dist/src/core/compliance.d.ts.map +1 -0
  97. package/dist/src/core/compliance.js +59 -0
  98. package/dist/src/core/compliance.js.map +1 -0
  99. package/dist/src/core/conflict-detector.d.ts +19 -0
  100. package/dist/src/core/conflict-detector.d.ts.map +1 -0
  101. package/dist/src/core/conflict-detector.js +87 -0
  102. package/dist/src/core/conflict-detector.js.map +1 -0
  103. package/dist/src/core/conflict-enforcer.d.ts +37 -0
  104. package/dist/src/core/conflict-enforcer.d.ts.map +1 -0
  105. package/dist/src/core/conflict-enforcer.js +139 -0
  106. package/dist/src/core/conflict-enforcer.js.map +1 -0
  107. package/dist/src/core/cost-store.d.ts +55 -0
  108. package/dist/src/core/cost-store.d.ts.map +1 -0
  109. package/dist/src/core/cost-store.js +140 -0
  110. package/dist/src/core/cost-store.js.map +1 -0
  111. package/dist/src/core/hot-files.d.ts +19 -0
  112. package/dist/src/core/hot-files.d.ts.map +1 -0
  113. package/dist/src/core/hot-files.js +64 -0
  114. package/dist/src/core/hot-files.js.map +1 -0
  115. package/dist/src/core/human-action-store.d.ts +33 -0
  116. package/dist/src/core/human-action-store.d.ts.map +1 -0
  117. package/dist/src/core/human-action-store.js +92 -0
  118. package/dist/src/core/human-action-store.js.map +1 -0
  119. package/dist/src/core/learning-store.d.ts +32 -0
  120. package/dist/src/core/learning-store.d.ts.map +1 -0
  121. package/dist/src/core/learning-store.js +95 -0
  122. package/dist/src/core/learning-store.js.map +1 -0
  123. package/dist/src/core/merge-queue.d.ts +28 -0
  124. package/dist/src/core/merge-queue.d.ts.map +1 -0
  125. package/dist/src/core/merge-queue.js +92 -0
  126. package/dist/src/core/merge-queue.js.map +1 -0
  127. package/dist/src/core/notification-service.d.ts +13 -0
  128. package/dist/src/core/notification-service.d.ts.map +1 -0
  129. package/dist/src/core/notification-service.js +126 -0
  130. package/dist/src/core/notification-service.js.map +1 -0
  131. package/dist/src/core/notifications.d.ts +10 -0
  132. package/dist/src/core/notifications.d.ts.map +1 -0
  133. package/dist/src/core/notifications.js +33 -0
  134. package/dist/src/core/notifications.js.map +1 -0
  135. package/dist/src/core/orchestrator-store.d.ts +44 -0
  136. package/dist/src/core/orchestrator-store.d.ts.map +1 -0
  137. package/dist/src/core/orchestrator-store.js +69 -0
  138. package/dist/src/core/orchestrator-store.js.map +1 -0
  139. package/dist/src/core/parallelizer.d.ts +47 -0
  140. package/dist/src/core/parallelizer.d.ts.map +1 -0
  141. package/dist/src/core/parallelizer.js +224 -0
  142. package/dist/src/core/parallelizer.js.map +1 -0
  143. package/dist/src/core/pipeline-rollback.d.ts +29 -0
  144. package/dist/src/core/pipeline-rollback.d.ts.map +1 -0
  145. package/dist/src/core/pipeline-rollback.js +84 -0
  146. package/dist/src/core/pipeline-rollback.js.map +1 -0
  147. package/dist/src/core/pipeline-runner.d.ts +73 -0
  148. package/dist/src/core/pipeline-runner.d.ts.map +1 -0
  149. package/dist/src/core/pipeline-runner.js +165 -0
  150. package/dist/src/core/pipeline-runner.js.map +1 -0
  151. package/dist/src/core/pr-creator.d.ts +22 -0
  152. package/dist/src/core/pr-creator.d.ts.map +1 -0
  153. package/dist/src/core/pr-creator.js +55 -0
  154. package/dist/src/core/pr-creator.js.map +1 -0
  155. package/dist/src/core/rbac.d.ts +27 -0
  156. package/dist/src/core/rbac.d.ts.map +1 -0
  157. package/dist/src/core/rbac.js +76 -0
  158. package/dist/src/core/rbac.js.map +1 -0
  159. package/dist/src/core/startup-cleanup.d.ts +47 -0
  160. package/dist/src/core/startup-cleanup.d.ts.map +1 -0
  161. package/dist/src/core/startup-cleanup.js +150 -0
  162. package/dist/src/core/startup-cleanup.js.map +1 -0
  163. package/dist/src/core/task-store.d.ts +96 -0
  164. package/dist/src/core/task-store.d.ts.map +1 -0
  165. package/dist/src/core/task-store.js +309 -0
  166. package/dist/src/core/task-store.js.map +1 -0
  167. package/dist/src/core/verbo-config-editor.d.ts +44 -0
  168. package/dist/src/core/verbo-config-editor.d.ts.map +1 -0
  169. package/dist/src/core/verbo-config-editor.js +204 -0
  170. package/dist/src/core/verbo-config-editor.js.map +1 -0
  171. package/dist/src/core/verbo-config.d.ts +35 -0
  172. package/dist/src/core/verbo-config.d.ts.map +1 -0
  173. package/dist/src/core/verbo-config.js +55 -0
  174. package/dist/src/core/verbo-config.js.map +1 -0
  175. package/dist/src/core/verbo-md.d.ts +96 -0
  176. package/dist/src/core/verbo-md.d.ts.map +1 -0
  177. package/dist/src/core/verbo-md.js +410 -0
  178. package/dist/src/core/verbo-md.js.map +1 -0
  179. package/dist/src/db/database.d.ts +9 -0
  180. package/dist/src/db/database.d.ts.map +1 -0
  181. package/dist/src/db/database.js +37 -0
  182. package/dist/src/db/database.js.map +1 -0
  183. package/dist/src/db/migrations/001-personas-subtasks.d.ts +10 -0
  184. package/dist/src/db/migrations/001-personas-subtasks.d.ts.map +1 -0
  185. package/dist/src/db/migrations/001-personas-subtasks.js +32 -0
  186. package/dist/src/db/migrations/001-personas-subtasks.js.map +1 -0
  187. package/dist/src/db/migrations/002-rbac.d.ts +9 -0
  188. package/dist/src/db/migrations/002-rbac.d.ts.map +1 -0
  189. package/dist/src/db/migrations/002-rbac.js +31 -0
  190. package/dist/src/db/migrations/002-rbac.js.map +1 -0
  191. package/dist/src/db/migrations/003-provider-column.d.ts +8 -0
  192. package/dist/src/db/migrations/003-provider-column.d.ts.map +1 -0
  193. package/dist/src/db/migrations/003-provider-column.js +12 -0
  194. package/dist/src/db/migrations/003-provider-column.js.map +1 -0
  195. package/dist/src/db/migrations/004-pipeline-cost.d.ts +8 -0
  196. package/dist/src/db/migrations/004-pipeline-cost.d.ts.map +1 -0
  197. package/dist/src/db/migrations/004-pipeline-cost.js +23 -0
  198. package/dist/src/db/migrations/004-pipeline-cost.js.map +1 -0
  199. package/dist/src/db/migrations/005-audit-log-timestamp.d.ts +10 -0
  200. package/dist/src/db/migrations/005-audit-log-timestamp.d.ts.map +1 -0
  201. package/dist/src/db/migrations/005-audit-log-timestamp.js +39 -0
  202. package/dist/src/db/migrations/005-audit-log-timestamp.js.map +1 -0
  203. package/dist/src/db/migrations/006-human-action-type.d.ts +9 -0
  204. package/dist/src/db/migrations/006-human-action-type.d.ts.map +1 -0
  205. package/dist/src/db/migrations/006-human-action-type.js +16 -0
  206. package/dist/src/db/migrations/006-human-action-type.js.map +1 -0
  207. package/dist/src/db/schema.d.ts +6 -0
  208. package/dist/src/db/schema.d.ts.map +1 -0
  209. package/dist/src/db/schema.js +255 -0
  210. package/dist/src/db/schema.js.map +1 -0
  211. package/dist/src/deps/dependabot-generator.d.ts +22 -0
  212. package/dist/src/deps/dependabot-generator.d.ts.map +1 -0
  213. package/dist/src/deps/dependabot-generator.js +83 -0
  214. package/dist/src/deps/dependabot-generator.js.map +1 -0
  215. package/dist/src/deps/dependabot-monitor.d.ts +22 -0
  216. package/dist/src/deps/dependabot-monitor.d.ts.map +1 -0
  217. package/dist/src/deps/dependabot-monitor.js +28 -0
  218. package/dist/src/deps/dependabot-monitor.js.map +1 -0
  219. package/dist/src/deps/package-auditor.d.ts +24 -0
  220. package/dist/src/deps/package-auditor.d.ts.map +1 -0
  221. package/dist/src/deps/package-auditor.js +118 -0
  222. package/dist/src/deps/package-auditor.js.map +1 -0
  223. package/dist/src/init/ensure-init.d.ts +6 -0
  224. package/dist/src/init/ensure-init.d.ts.map +1 -0
  225. package/dist/src/init/ensure-init.js +27 -0
  226. package/dist/src/init/ensure-init.js.map +1 -0
  227. package/dist/src/init/project-detector.d.ts +11 -0
  228. package/dist/src/init/project-detector.d.ts.map +1 -0
  229. package/dist/src/init/project-detector.js +117 -0
  230. package/dist/src/init/project-detector.js.map +1 -0
  231. package/dist/src/init/questionnaire.d.ts +5 -0
  232. package/dist/src/init/questionnaire.d.ts.map +1 -0
  233. package/dist/src/init/questionnaire.js +112 -0
  234. package/dist/src/init/questionnaire.js.map +1 -0
  235. package/dist/src/init/template.d.ts +17 -0
  236. package/dist/src/init/template.d.ts.map +1 -0
  237. package/dist/src/init/template.js +46 -0
  238. package/dist/src/init/template.js.map +1 -0
  239. package/dist/src/intelligence/claude-client.d.ts +3 -0
  240. package/dist/src/intelligence/claude-client.d.ts.map +1 -0
  241. package/dist/src/intelligence/claude-client.js +12 -0
  242. package/dist/src/intelligence/claude-client.js.map +1 -0
  243. package/dist/src/intelligence/conflict-mediator.d.ts +17 -0
  244. package/dist/src/intelligence/conflict-mediator.d.ts.map +1 -0
  245. package/dist/src/intelligence/conflict-mediator.js +83 -0
  246. package/dist/src/intelligence/conflict-mediator.js.map +1 -0
  247. package/dist/src/intelligence/github-orchestrator.d.ts +30 -0
  248. package/dist/src/intelligence/github-orchestrator.d.ts.map +1 -0
  249. package/dist/src/intelligence/github-orchestrator.js +270 -0
  250. package/dist/src/intelligence/github-orchestrator.js.map +1 -0
  251. package/dist/src/intelligence/kill-switch.d.ts +10 -0
  252. package/dist/src/intelligence/kill-switch.d.ts.map +1 -0
  253. package/dist/src/intelligence/kill-switch.js +12 -0
  254. package/dist/src/intelligence/kill-switch.js.map +1 -0
  255. package/dist/src/intelligence/learnings-extractor.d.ts +13 -0
  256. package/dist/src/intelligence/learnings-extractor.d.ts.map +1 -0
  257. package/dist/src/intelligence/learnings-extractor.js +74 -0
  258. package/dist/src/intelligence/learnings-extractor.js.map +1 -0
  259. package/dist/src/intelligence/project-scanner.d.ts +2 -0
  260. package/dist/src/intelligence/project-scanner.d.ts.map +1 -0
  261. package/dist/src/intelligence/project-scanner.js +28 -0
  262. package/dist/src/intelligence/project-scanner.js.map +1 -0
  263. package/dist/src/intelligence/task-decomposer.d.ts +14 -0
  264. package/dist/src/intelligence/task-decomposer.d.ts.map +1 -0
  265. package/dist/src/intelligence/task-decomposer.js +97 -0
  266. package/dist/src/intelligence/task-decomposer.js.map +1 -0
  267. package/dist/src/intelligence/types.d.ts +14 -0
  268. package/dist/src/intelligence/types.d.ts.map +1 -0
  269. package/dist/src/intelligence/types.js +2 -0
  270. package/dist/src/intelligence/types.js.map +1 -0
  271. package/dist/src/mcp/server.d.ts +63 -0
  272. package/dist/src/mcp/server.d.ts.map +1 -0
  273. package/dist/src/mcp/server.js +537 -0
  274. package/dist/src/mcp/server.js.map +1 -0
  275. package/dist/src/mcp/stdio-entry.d.ts +2 -0
  276. package/dist/src/mcp/stdio-entry.d.ts.map +1 -0
  277. package/dist/src/mcp/stdio-entry.js +124 -0
  278. package/dist/src/mcp/stdio-entry.js.map +1 -0
  279. package/dist/src/mcp/subtask-handlers.d.ts +7 -0
  280. package/dist/src/mcp/subtask-handlers.d.ts.map +1 -0
  281. package/dist/src/mcp/subtask-handlers.js +50 -0
  282. package/dist/src/mcp/subtask-handlers.js.map +1 -0
  283. package/dist/src/security/network-proxy.d.ts +20 -0
  284. package/dist/src/security/network-proxy.d.ts.map +1 -0
  285. package/dist/src/security/network-proxy.js +125 -0
  286. package/dist/src/security/network-proxy.js.map +1 -0
  287. package/dist/src/security/network-sandbox.d.ts +19 -0
  288. package/dist/src/security/network-sandbox.d.ts.map +1 -0
  289. package/dist/src/security/network-sandbox.js +100 -0
  290. package/dist/src/security/network-sandbox.js.map +1 -0
  291. package/dist/src/security/sanitize.d.ts +13 -0
  292. package/dist/src/security/sanitize.d.ts.map +1 -0
  293. package/dist/src/security/sanitize.js +19 -0
  294. package/dist/src/security/sanitize.js.map +1 -0
  295. package/dist/src/security/secrets-patterns.d.ts +29 -0
  296. package/dist/src/security/secrets-patterns.d.ts.map +1 -0
  297. package/dist/src/security/secrets-patterns.js +430 -0
  298. package/dist/src/security/secrets-patterns.js.map +1 -0
  299. package/dist/src/security/secrets-scanner.d.ts +26 -0
  300. package/dist/src/security/secrets-scanner.d.ts.map +1 -0
  301. package/dist/src/security/secrets-scanner.js +62 -0
  302. package/dist/src/security/secrets-scanner.js.map +1 -0
  303. package/dist/src/skills/classifier.d.ts +9 -0
  304. package/dist/src/skills/classifier.d.ts.map +1 -0
  305. package/dist/src/skills/classifier.js +41 -0
  306. package/dist/src/skills/classifier.js.map +1 -0
  307. package/dist/src/skills/registry.d.ts +16 -0
  308. package/dist/src/skills/registry.d.ts.map +1 -0
  309. package/dist/src/skills/registry.js +61 -0
  310. package/dist/src/skills/registry.js.map +1 -0
  311. package/dist/src/sync/events.d.ts +9 -0
  312. package/dist/src/sync/events.d.ts.map +1 -0
  313. package/dist/src/sync/events.js +2 -0
  314. package/dist/src/sync/events.js.map +1 -0
  315. package/dist/src/sync/relay-server.d.ts +18 -0
  316. package/dist/src/sync/relay-server.d.ts.map +1 -0
  317. package/dist/src/sync/relay-server.js +131 -0
  318. package/dist/src/sync/relay-server.js.map +1 -0
  319. package/dist/src/sync/sync-client.d.ts +31 -0
  320. package/dist/src/sync/sync-client.d.ts.map +1 -0
  321. package/dist/src/sync/sync-client.js +314 -0
  322. package/dist/src/sync/sync-client.js.map +1 -0
  323. package/dist/src/tui/app.d.ts +35 -0
  324. package/dist/src/tui/app.d.ts.map +1 -0
  325. package/dist/src/tui/app.js +676 -0
  326. package/dist/src/tui/app.js.map +1 -0
  327. package/dist/src/tui/components/activity-feed.d.ts +12 -0
  328. package/dist/src/tui/components/activity-feed.d.ts.map +1 -0
  329. package/dist/src/tui/components/activity-feed.js +82 -0
  330. package/dist/src/tui/components/activity-feed.js.map +1 -0
  331. package/dist/src/tui/components/agent-list.d.ts +19 -0
  332. package/dist/src/tui/components/agent-list.d.ts.map +1 -0
  333. package/dist/src/tui/components/agent-list.js +33 -0
  334. package/dist/src/tui/components/agent-list.js.map +1 -0
  335. package/dist/src/tui/components/agent-row.d.ts +12 -0
  336. package/dist/src/tui/components/agent-row.d.ts.map +1 -0
  337. package/dist/src/tui/components/agent-row.js +37 -0
  338. package/dist/src/tui/components/agent-row.js.map +1 -0
  339. package/dist/src/tui/components/approval-terminal.d.ts +13 -0
  340. package/dist/src/tui/components/approval-terminal.d.ts.map +1 -0
  341. package/dist/src/tui/components/approval-terminal.js +34 -0
  342. package/dist/src/tui/components/approval-terminal.js.map +1 -0
  343. package/dist/src/tui/components/audit-viewer.d.ts +16 -0
  344. package/dist/src/tui/components/audit-viewer.d.ts.map +1 -0
  345. package/dist/src/tui/components/audit-viewer.js +46 -0
  346. package/dist/src/tui/components/audit-viewer.js.map +1 -0
  347. package/dist/src/tui/components/auth-gate.d.ts +9 -0
  348. package/dist/src/tui/components/auth-gate.d.ts.map +1 -0
  349. package/dist/src/tui/components/auth-gate.js +112 -0
  350. package/dist/src/tui/components/auth-gate.js.map +1 -0
  351. package/dist/src/tui/components/command-palette.d.ts +12 -0
  352. package/dist/src/tui/components/command-palette.d.ts.map +1 -0
  353. package/dist/src/tui/components/command-palette.js +51 -0
  354. package/dist/src/tui/components/command-palette.js.map +1 -0
  355. package/dist/src/tui/components/compliance-badge.d.ts +11 -0
  356. package/dist/src/tui/components/compliance-badge.d.ts.map +1 -0
  357. package/dist/src/tui/components/compliance-badge.js +12 -0
  358. package/dist/src/tui/components/compliance-badge.js.map +1 -0
  359. package/dist/src/tui/components/decomposition-review.d.ts +10 -0
  360. package/dist/src/tui/components/decomposition-review.d.ts.map +1 -0
  361. package/dist/src/tui/components/decomposition-review.js +19 -0
  362. package/dist/src/tui/components/decomposition-review.js.map +1 -0
  363. package/dist/src/tui/components/dependency-graph.d.ts +13 -0
  364. package/dist/src/tui/components/dependency-graph.d.ts.map +1 -0
  365. package/dist/src/tui/components/dependency-graph.js +143 -0
  366. package/dist/src/tui/components/dependency-graph.js.map +1 -0
  367. package/dist/src/tui/components/diff-viewer.d.ts +11 -0
  368. package/dist/src/tui/components/diff-viewer.d.ts.map +1 -0
  369. package/dist/src/tui/components/diff-viewer.js +82 -0
  370. package/dist/src/tui/components/diff-viewer.js.map +1 -0
  371. package/dist/src/tui/components/edit-task-input.d.ts +10 -0
  372. package/dist/src/tui/components/edit-task-input.d.ts.map +1 -0
  373. package/dist/src/tui/components/edit-task-input.js +20 -0
  374. package/dist/src/tui/components/edit-task-input.js.map +1 -0
  375. package/dist/src/tui/components/footer.d.ts +12 -0
  376. package/dist/src/tui/components/footer.d.ts.map +1 -0
  377. package/dist/src/tui/components/footer.js +41 -0
  378. package/dist/src/tui/components/footer.js.map +1 -0
  379. package/dist/src/tui/components/header.d.ts +8 -0
  380. package/dist/src/tui/components/header.d.ts.map +1 -0
  381. package/dist/src/tui/components/header.js +20 -0
  382. package/dist/src/tui/components/header.js.map +1 -0
  383. package/dist/src/tui/components/human-actions.d.ts +14 -0
  384. package/dist/src/tui/components/human-actions.d.ts.map +1 -0
  385. package/dist/src/tui/components/human-actions.js +43 -0
  386. package/dist/src/tui/components/human-actions.js.map +1 -0
  387. package/dist/src/tui/components/log-panel.d.ts +10 -0
  388. package/dist/src/tui/components/log-panel.d.ts.map +1 -0
  389. package/dist/src/tui/components/log-panel.js +38 -0
  390. package/dist/src/tui/components/log-panel.js.map +1 -0
  391. package/dist/src/tui/components/memory-viewer.d.ts +10 -0
  392. package/dist/src/tui/components/memory-viewer.d.ts.map +1 -0
  393. package/dist/src/tui/components/memory-viewer.js +44 -0
  394. package/dist/src/tui/components/memory-viewer.js.map +1 -0
  395. package/dist/src/tui/components/new-task-input.d.ts +9 -0
  396. package/dist/src/tui/components/new-task-input.d.ts.map +1 -0
  397. package/dist/src/tui/components/new-task-input.js +21 -0
  398. package/dist/src/tui/components/new-task-input.js.map +1 -0
  399. package/dist/src/tui/components/orchestrator-status.d.ts +9 -0
  400. package/dist/src/tui/components/orchestrator-status.d.ts.map +1 -0
  401. package/dist/src/tui/components/orchestrator-status.js +15 -0
  402. package/dist/src/tui/components/orchestrator-status.js.map +1 -0
  403. package/dist/src/tui/components/parallelize-banner.d.ts +8 -0
  404. package/dist/src/tui/components/parallelize-banner.d.ts.map +1 -0
  405. package/dist/src/tui/components/parallelize-banner.js +9 -0
  406. package/dist/src/tui/components/parallelize-banner.js.map +1 -0
  407. package/dist/src/tui/components/progress-bar.d.ts +9 -0
  408. package/dist/src/tui/components/progress-bar.d.ts.map +1 -0
  409. package/dist/src/tui/components/progress-bar.js +15 -0
  410. package/dist/src/tui/components/progress-bar.js.map +1 -0
  411. package/dist/src/tui/components/review-queue.d.ts +13 -0
  412. package/dist/src/tui/components/review-queue.d.ts.map +1 -0
  413. package/dist/src/tui/components/review-queue.js +78 -0
  414. package/dist/src/tui/components/review-queue.js.map +1 -0
  415. package/dist/src/tui/components/rich-header.d.ts +11 -0
  416. package/dist/src/tui/components/rich-header.d.ts.map +1 -0
  417. package/dist/src/tui/components/rich-header.js +25 -0
  418. package/dist/src/tui/components/rich-header.js.map +1 -0
  419. package/dist/src/tui/components/spinner.d.ts +7 -0
  420. package/dist/src/tui/components/spinner.d.ts.map +1 -0
  421. package/dist/src/tui/components/spinner.js +8 -0
  422. package/dist/src/tui/components/spinner.js.map +1 -0
  423. package/dist/src/tui/components/status-bar.d.ts +23 -0
  424. package/dist/src/tui/components/status-bar.d.ts.map +1 -0
  425. package/dist/src/tui/components/status-bar.js +28 -0
  426. package/dist/src/tui/components/status-bar.js.map +1 -0
  427. package/dist/src/tui/components/task-queue.d.ts +11 -0
  428. package/dist/src/tui/components/task-queue.d.ts.map +1 -0
  429. package/dist/src/tui/components/task-queue.js +30 -0
  430. package/dist/src/tui/components/task-queue.js.map +1 -0
  431. package/dist/src/tui/components/team-view.d.ts +13 -0
  432. package/dist/src/tui/components/team-view.d.ts.map +1 -0
  433. package/dist/src/tui/components/team-view.js +12 -0
  434. package/dist/src/tui/components/team-view.js.map +1 -0
  435. package/dist/src/tui/graph-renderer.d.ts +11 -0
  436. package/dist/src/tui/graph-renderer.d.ts.map +1 -0
  437. package/dist/src/tui/graph-renderer.js +296 -0
  438. package/dist/src/tui/graph-renderer.js.map +1 -0
  439. package/dist/src/tui/hooks/use-bell.d.ts +21 -0
  440. package/dist/src/tui/hooks/use-bell.d.ts.map +1 -0
  441. package/dist/src/tui/hooks/use-bell.js +38 -0
  442. package/dist/src/tui/hooks/use-bell.js.map +1 -0
  443. package/dist/src/tui/hooks/use-ci-status.d.ts +16 -0
  444. package/dist/src/tui/hooks/use-ci-status.d.ts.map +1 -0
  445. package/dist/src/tui/hooks/use-ci-status.js +97 -0
  446. package/dist/src/tui/hooks/use-ci-status.js.map +1 -0
  447. package/dist/src/tui/hooks/use-command-palette.d.ts +37 -0
  448. package/dist/src/tui/hooks/use-command-palette.d.ts.map +1 -0
  449. package/dist/src/tui/hooks/use-command-palette.js +108 -0
  450. package/dist/src/tui/hooks/use-command-palette.js.map +1 -0
  451. package/dist/src/tui/hooks/use-diff-view.d.ts +16 -0
  452. package/dist/src/tui/hooks/use-diff-view.d.ts.map +1 -0
  453. package/dist/src/tui/hooks/use-diff-view.js +75 -0
  454. package/dist/src/tui/hooks/use-diff-view.js.map +1 -0
  455. package/dist/src/tui/hooks/use-keyboard.d.ts +3 -0
  456. package/dist/src/tui/hooks/use-keyboard.d.ts.map +1 -0
  457. package/dist/src/tui/hooks/use-keyboard.js +70 -0
  458. package/dist/src/tui/hooks/use-keyboard.js.map +1 -0
  459. package/dist/src/tui/hooks/use-log-stream.d.ts +25 -0
  460. package/dist/src/tui/hooks/use-log-stream.d.ts.map +1 -0
  461. package/dist/src/tui/hooks/use-log-stream.js +83 -0
  462. package/dist/src/tui/hooks/use-log-stream.js.map +1 -0
  463. package/dist/src/tui/hooks/use-spinner.d.ts +3 -0
  464. package/dist/src/tui/hooks/use-spinner.d.ts.map +1 -0
  465. package/dist/src/tui/hooks/use-spinner.js +13 -0
  466. package/dist/src/tui/hooks/use-spinner.js.map +1 -0
  467. package/dist/src/tui/hooks/use-store.d.ts +33 -0
  468. package/dist/src/tui/hooks/use-store.d.ts.map +1 -0
  469. package/dist/src/tui/hooks/use-store.js +21 -0
  470. package/dist/src/tui/hooks/use-store.js.map +1 -0
  471. package/dist/src/tui/lib/diff-parser.d.ts +24 -0
  472. package/dist/src/tui/lib/diff-parser.d.ts.map +1 -0
  473. package/dist/src/tui/lib/diff-parser.js +115 -0
  474. package/dist/src/tui/lib/diff-parser.js.map +1 -0
  475. package/dist/src/tui/lib/palette-commands.d.ts +14 -0
  476. package/dist/src/tui/lib/palette-commands.d.ts.map +1 -0
  477. package/dist/src/tui/lib/palette-commands.js +101 -0
  478. package/dist/src/tui/lib/palette-commands.js.map +1 -0
  479. package/dist/src/tui/tui.d.ts +8 -0
  480. package/dist/src/tui/tui.d.ts.map +1 -0
  481. package/dist/src/tui/tui.js +8 -0
  482. package/dist/src/tui/tui.js.map +1 -0
  483. package/package.json +66 -0
  484. package/skills/api-design.md +84 -0
  485. package/skills/backend-typescript.md +76 -0
  486. package/skills/data-modeling.md +73 -0
  487. package/skills/devops-ci.md +82 -0
  488. package/skills/frontend-design.md +69 -0
  489. package/skills/observability.md +73 -0
  490. package/skills/react-nextjs.md +76 -0
  491. package/skills/refactoring.md +77 -0
  492. package/skills/security.md +75 -0
  493. package/skills/testing.md +69 -0
@@ -0,0 +1,29 @@
1
+ import type { SimpleGit } from 'simple-git';
2
+ export interface StepRun {
3
+ id: string;
4
+ commitHash?: string | null;
5
+ status: 'pending' | 'success' | 'failed' | 'rolled_back';
6
+ }
7
+ export interface PipelineRun {
8
+ id: string;
9
+ stepRuns: StepRun[];
10
+ }
11
+ export declare class UnreachableCommitError extends Error {
12
+ readonly commitHash: string;
13
+ constructor(commitHash: string);
14
+ }
15
+ export declare class RollbackConflictError extends Error {
16
+ readonly commitHash: string;
17
+ constructor(commitHash: string);
18
+ }
19
+ /**
20
+ * Rolls back a pipeline run by reverting each step's commit in reverse order.
21
+ *
22
+ * - Verifies all commits are reachable before starting.
23
+ * - Reverts commits with `git revert --no-commit` in reverse step order.
24
+ * - Handles conflicts by cleaning up and throwing `RollbackConflictError`.
25
+ * - Creates a single rollback commit: `chore(rollback): revert pipeline <run.id>`.
26
+ * - Returns the updated run with reverted step_runs marked `'rolled_back'`.
27
+ */
28
+ export declare function rollbackRun(run: PipelineRun, git: SimpleGit): Promise<PipelineRun>;
29
+ //# sourceMappingURL=pipeline-rollback.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-rollback.d.ts","sourceRoot":"","sources":["../../../src/core/pipeline-rollback.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAI5C,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,QAAQ,GAAG,aAAa,CAAC;CAC1D;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,OAAO,EAAE,CAAC;CACrB;AAID,qBAAa,sBAAuB,SAAQ,KAAK;aACnB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAED,qBAAa,qBAAsB,SAAQ,KAAK;aAClB,UAAU,EAAE,MAAM;gBAAlB,UAAU,EAAE,MAAM;CAI/C;AAoBD;;;;;;;;GAQG;AACH,wBAAsB,WAAW,CAAC,GAAG,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,GAAG,OAAO,CAAC,WAAW,CAAC,CAqDxF"}
@@ -0,0 +1,84 @@
1
+ // ---- Errors ----
2
+ export class UnreachableCommitError extends Error {
3
+ commitHash;
4
+ constructor(commitHash) {
5
+ super(`Commit ${commitHash} is not reachable in this repository`);
6
+ this.commitHash = commitHash;
7
+ this.name = 'UnreachableCommitError';
8
+ }
9
+ }
10
+ export class RollbackConflictError extends Error {
11
+ commitHash;
12
+ constructor(commitHash) {
13
+ super(`Conflict while reverting commit ${commitHash}`);
14
+ this.commitHash = commitHash;
15
+ this.name = 'RollbackConflictError';
16
+ }
17
+ }
18
+ // ---- Helpers ----
19
+ async function isCommitReachable(git, hash) {
20
+ try {
21
+ await git.raw(['cat-file', '-e', `${hash}^{commit}`]);
22
+ return true;
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ }
28
+ async function hasConflicts(git) {
29
+ const status = await git.status();
30
+ return status.conflicted.length > 0;
31
+ }
32
+ // ---- Core function ----
33
+ /**
34
+ * Rolls back a pipeline run by reverting each step's commit in reverse order.
35
+ *
36
+ * - Verifies all commits are reachable before starting.
37
+ * - Reverts commits with `git revert --no-commit` in reverse step order.
38
+ * - Handles conflicts by cleaning up and throwing `RollbackConflictError`.
39
+ * - Creates a single rollback commit: `chore(rollback): revert pipeline <run.id>`.
40
+ * - Returns the updated run with reverted step_runs marked `'rolled_back'`.
41
+ */
42
+ export async function rollbackRun(run, git) {
43
+ const stepsToRevert = run.stepRuns.filter((s) => typeof s.commitHash === 'string' && s.commitHash.length > 0);
44
+ if (stepsToRevert.length === 0) {
45
+ return run;
46
+ }
47
+ // Verify all commits are reachable before touching anything
48
+ for (const step of stepsToRevert) {
49
+ if (!(await isCommitReachable(git, step.commitHash))) {
50
+ throw new UnreachableCommitError(step.commitHash);
51
+ }
52
+ }
53
+ // Revert in reverse order so each undo applies cleanly on top of the previous
54
+ const reversed = [...stepsToRevert].reverse();
55
+ const revertedIds = new Set();
56
+ for (const step of reversed) {
57
+ try {
58
+ await git.raw(['revert', '--no-commit', step.commitHash]);
59
+ }
60
+ catch {
61
+ // Revert failed — check if conflicts are the cause
62
+ const conflicted = await hasConflicts(git);
63
+ // Clean up any partial staged/working-tree changes
64
+ await git.raw(['reset', '--hard', 'HEAD']).catch(() => { });
65
+ if (conflicted) {
66
+ throw new RollbackConflictError(step.commitHash);
67
+ }
68
+ throw new RollbackConflictError(step.commitHash);
69
+ }
70
+ // Paranoia: check for silent conflicts (exit 0 but unmerged files)
71
+ if (await hasConflicts(git)) {
72
+ await git.raw(['reset', '--hard', 'HEAD']).catch(() => { });
73
+ throw new RollbackConflictError(step.commitHash);
74
+ }
75
+ revertedIds.add(step.id);
76
+ }
77
+ // Commit all staged reversals as a single rollback commit
78
+ await git.commit(`chore(rollback): revert pipeline ${run.id}`);
79
+ return {
80
+ ...run,
81
+ stepRuns: run.stepRuns.map((s) => revertedIds.has(s.id) ? { ...s, status: 'rolled_back' } : s),
82
+ };
83
+ }
84
+ //# sourceMappingURL=pipeline-rollback.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-rollback.js","sourceRoot":"","sources":["../../../src/core/pipeline-rollback.ts"],"names":[],"mappings":"AAeA,mBAAmB;AAEnB,MAAM,OAAO,sBAAuB,SAAQ,KAAK;IACnB;IAA5B,YAA4B,UAAkB;QAC5C,KAAK,CAAC,UAAU,UAAU,sCAAsC,CAAC,CAAC;QADxC,eAAU,GAAV,UAAU,CAAQ;QAE5C,IAAI,CAAC,IAAI,GAAG,wBAAwB,CAAC;IACvC,CAAC;CACF;AAED,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAClB;IAA5B,YAA4B,UAAkB;QAC5C,KAAK,CAAC,mCAAmC,UAAU,EAAE,C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,CAAC,CAAC,EAAE,EAAE,CAC/B,WAAW,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,aAAsB,EAAE,CAAC,CAAC,CAAC,CAAC,CACrE;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,73 @@
1
+ import type { TaskStore } from './task-store.js';
2
+ export type OnFailureAction = 'stop' | 'rollback' | 'continue';
3
+ export type PipelineRunStatus = 'running' | 'paused_for_approval' | 'completed' | 'cancelled' | 'failed' | 'rolled_back';
4
+ export type StepRunStatus = 'pending' | 'running' | 'done' | 'failed' | 'skipped';
5
+ export interface PipelineStep {
6
+ id: string;
7
+ name: string;
8
+ /** ID of the Task in the TaskStore that represents this step's work. */
9
+ taskId: string;
10
+ /** What to do if the step's task ends in a non-done state. */
11
+ on_failure: OnFailureAction;
12
+ /** When true, the run pauses before this step starts and waits for human approval. */
13
+ requires_approval?: boolean;
14
+ }
15
+ export interface Pipeline {
16
+ id: string;
17
+ name: string;
18
+ steps: PipelineStep[];
19
+ }
20
+ export interface PipelineRunStep {
21
+ stepId: string;
22
+ taskId: string;
23
+ status: StepRunStatus;
24
+ startedAt?: string;
25
+ completedAt?: string;
26
+ }
27
+ export interface PipelineRun {
28
+ id: string;
29
+ pipelineId: string;
30
+ /** Snapshot of the pipeline definition at run creation time. */
31
+ pipeline: Pipeline;
32
+ status: PipelineRunStatus;
33
+ /** Index into pipeline.steps pointing at the active or most-recently-completed step. */
34
+ currentStepIndex: number;
35
+ steps: PipelineRunStep[];
36
+ createdAt: string;
37
+ updatedAt: string;
38
+ completedAt?: string;
39
+ }
40
+ export interface PipelineRunner {
41
+ /**
42
+ * Create and start a new pipeline run. The first step transitions to 'running'.
43
+ * Throws if the pipeline has no steps.
44
+ */
45
+ start(pipeline: Pipeline): PipelineRun;
46
+ /**
47
+ * Inspect the current step's task status and advance the state machine:
48
+ * - task done + last step → run 'completed'
49
+ * - task done + next step has requires_approval → run 'paused_for_approval'
50
+ * - task done + next step → currentStepIndex++, next step 'running'
51
+ * - task blocked → apply on_failure: stop/rollback/continue
52
+ * - task todo/in_progress → no-op (still running)
53
+ * No-ops if the run is not in 'running' status.
54
+ */
55
+ advance(runId: string): PipelineRun;
56
+ /**
57
+ * Resume (or reject) a run that is 'paused_for_approval'.
58
+ * - approved=true → start the pending step, status → 'running'
59
+ * - approved=false → status → 'cancelled'
60
+ * Throws if the run is not paused for approval.
61
+ */
62
+ handleApproval(runId: string, approved: boolean): PipelineRun;
63
+ /**
64
+ * Cancel a run that has not yet reached a terminal state.
65
+ * The currently-running step (if any) is marked 'failed'.
66
+ * No-ops if already completed or cancelled.
67
+ */
68
+ cancel(runId: string): PipelineRun;
69
+ /** Return the current state of a run, or null if not found. */
70
+ getRun(runId: string): PipelineRun | null;
71
+ }
72
+ export declare function createPipelineRunner(taskStore: TaskStore): PipelineRunner;
73
+ //# sourceMappingURL=pipeline-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-runner.d.ts","sourceRoot":"","sources":["../../../src/core/pipeline-runner.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,MAAM,eAAe,GAAG,MAAM,GAAG,UAAU,GAAG,UAAU,CAAC;AAE/D,MAAM,MAAM,iBAAiB,GACzB,SAAS,GACT,qBAAqB,GACrB,WAAW,GACX,WAAW,GACX,QAAQ,GACR,aAAa,CAAC;AAElB,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElF,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,UAAU,EAAE,eAAe,CAAC;IAC5B,sFAAsF;IACtF,iBAAiB,C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+ // ---- Internal helpers ----
3
+ const TERMINAL_STATUSES = [
4
+ 'completed',
5
+ 'cancelled',
6
+ 'failed',
7
+ 'rolled_back',
8
+ ];
9
+ function clone(value) {
10
+ return JSON.parse(JSON.stringify(value));
11
+ }
12
+ // ---- Factory ----
13
+ export function createPipelineRunner(taskStore) {
14
+ const runs = new Map();
15
+ function getRun(runId) {
16
+ const run = runs.get(runId);
17
+ return run ? clone(run) : null;
18
+ }
19
+ function start(pipeline) {
20
+ if (pipeline.steps.length === 0) {
21
+ throw new Error('Pipeline must have at least one step');
22
+ }
23
+ const now = new Date().toISOString();
24
+ const runSteps = pipeline.steps.map((step, i) => ({
25
+ stepId: step.id,
26
+ taskId: step.taskId,
27
+ status: i === 0 ? 'running' : 'pending',
28
+ startedAt: i === 0 ? now : undefined,
29
+ }));
30
+ const run = {
31
+ id: ulid(),
32
+ pipelineId: pipeline.id,
33
+ pipeline: clone(pipeline),
34
+ status: 'running',
35
+ currentStepIndex: 0,
36
+ steps: runSteps,
37
+ createdAt: now,
38
+ updatedAt: now,
39
+ };
40
+ runs.set(run.id, run);
41
+ return clone(run);
42
+ }
43
+ function advance(runId) {
44
+ const run = runs.get(runId);
45
+ if (!run)
46
+ throw new Error(`Pipeline run not found: ${runId}`);
47
+ if (run.status !== 'running')
48
+ return clone(run);
49
+ const currentStep = run.pipeline.steps[run.currentStepIndex];
50
+ const task = taskStore.get(currentStep.taskId);
51
+ if (!task)
52
+ throw new Error(`Task not found: ${currentStep.taskId}`);
53
+ const now = new Date().toISOString();
54
+ if (task.status === 'done') {
55
+ applyStepSuccess(run, now);
56
+ }
57
+ else if (task.status === 'blocked') {
58
+ applyStepFailure(run, currentStep, now);
59
+ }
60
+ // todo / in_progress → still running, no state change
61
+ run.updatedAt = now;
62
+ runs.set(runId, run);
63
+ return clone(run);
64
+ }
65
+ function applyStepSuccess(run, now) {
66
+ const idx = run.currentStepIndex;
67
+ run.steps[idx].status = 'done';
68
+ run.steps[idx].completedAt = now;
69
+ const isLastStep = idx === run.pipeline.steps.length - 1;
70
+ if (isLastStep) {
71
+ run.status = 'completed';
72
+ run.completedAt = now;
73
+ return;
74
+ }
75
+ const nextStep = run.pipeline.steps[idx + 1];
76
+ if (nextStep.requires_approval) {
77
+ // Advance index to the approval-gated step so handleApproval can start it.
78
+ run.currentStepIndex = idx + 1;
79
+ run.status = 'paused_for_approval';
80
+ }
81
+ else {
82
+ run.currentStepIndex = idx + 1;
83
+ run.steps[idx + 1].status = 'running';
84
+ run.steps[idx + 1].startedAt = now;
85
+ }
86
+ }
87
+ function applyStepFailure(run, step, now) {
88
+ const idx = run.currentStepIndex;
89
+ run.steps[idx].status = 'failed';
90
+ run.steps[idx].completedAt = now;
91
+ switch (step.on_failure) {
92
+ case 'stop':
93
+ run.status = 'failed';
94
+ run.completedAt = now;
95
+ break;
96
+ case 'rollback':
97
+ run.status = 'rolled_back';
98
+ run.completedAt = now;
99
+ break;
100
+ case 'continue': {
101
+ const nextIdx = idx + 1;
102
+ const isLastStep = nextIdx >= run.pipeline.steps.length;
103
+ if (isLastStep) {
104
+ run.status = 'completed';
105
+ run.completedAt = now;
106
+ }
107
+ else {
108
+ const nextStep = run.pipeline.steps[nextIdx];
109
+ if (nextStep.requires_approval) {
110
+ run.currentStepIndex = nextIdx;
111
+ run.status = 'paused_for_approval';
112
+ }
113
+ else {
114
+ run.currentStepIndex = nextIdx;
115
+ run.steps[nextIdx].status = 'running';
116
+ run.steps[nextIdx].startedAt = now;
117
+ }
118
+ }
119
+ break;
120
+ }
121
+ }
122
+ }
123
+ function handleApproval(runId, approved) {
124
+ const run = runs.get(runId);
125
+ if (!run)
126
+ throw new Error(`Pipeline run not found: ${runId}`);
127
+ if (run.status !== 'paused_for_approval') {
128
+ throw new Error(`Run ${runId} is not paused for approval (status: ${run.status})`);
129
+ }
130
+ const now = new Date().toISOString();
131
+ if (approved) {
132
+ // currentStepIndex already points at the step waiting for approval
133
+ run.steps[run.currentStepIndex].status = 'running';
134
+ run.steps[run.currentStepIndex].startedAt = now;
135
+ run.status = 'running';
136
+ }
137
+ else {
138
+ run.status = 'cancelled';
139
+ run.completedAt = now;
140
+ }
141
+ run.updatedAt = now;
142
+ runs.set(runId, run);
143
+ return clone(run);
144
+ }
145
+ function cancel(runId) {
146
+ const run = runs.get(runId);
147
+ if (!run)
148
+ throw new Error(`Pipeline run not found: ${runId}`);
149
+ if (TERMINAL_STATUSES.includes(run.status))
150
+ return clone(run);
151
+ const now = new Date().toISOString();
152
+ const currentStepRun = run.steps[run.currentStepIndex];
153
+ if (currentStepRun.status === 'running') {
154
+ currentStepRun.status = 'failed';
155
+ currentStepRun.completedAt = now;
156
+ }
157
+ run.status = 'cancelled';
158
+ run.completedAt = now;
159
+ run.updatedAt = now;
160
+ runs.set(runId, run);
161
+ return clone(run);
162
+ }
163
+ return { start, advance, handleApproval, cancel, getRun };
164
+ }
165
+ //# sourceMappingURL=pipeline-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pipeline-runner.js","sourceRoot":"","sources":["../../../src/core/pipeline-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AA6F5B,6BAA6B;AAE7B,MAAM,iBAAiB,GAAwB;IAC7C,WAAW;IACX,WAAW;IACX,QAAQ;IACR,aAAa;CACd,CAAC;AAEF,SAAS,KAAK,CAAI,KAAQ;IACxB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAM,CAAC;AAChD,CAAC;AAED,oBAAoB;AAEpB,MAAM,UAAU,oBAAoB,CAAC,SAAoB;IACvD,MAAM,IAAI,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE5C,SAAS,MAAM,CAAC,KAAa;QAC3B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;QAC5B,OAAO,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,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AK,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AAC5D,CAAC"}
@@ -0,0 +1,22 @@
1
+ export interface PrCreateOptions {
2
+ taskId: string;
3
+ taskTitle: string;
4
+ summary: string;
5
+ branch: string;
6
+ baseBranch: string;
7
+ worktreePath: string;
8
+ }
9
+ export interface PrCreateResult {
10
+ success: boolean;
11
+ prUrl?: string;
12
+ error?: string;
13
+ }
14
+ export declare function buildPrTitle(taskTitle: string, titleFormat: string): string;
15
+ export declare function buildPrBody(opts: {
16
+ taskId: string;
17
+ taskTitle: string;
18
+ summary: string;
19
+ branch: string;
20
+ }): string;
21
+ export declare function pushAndCreatePr(opts: PrCreateOptions): PrCreateResult;
22
+ //# sourceMappingURL=pr-creator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-creator.d.ts","sourceRoot":"","sources":["../../../src/core/pr-creator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAKD,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAW3E;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAUhH;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,cAAc,CAkCrE"}
@@ -0,0 +1,55 @@
1
+ import { execFileSync } from 'child_process';
2
+ const FIX_KEYWORDS = ['fix', 'bug', 'patch', 'resolve', 'correct', 'repair'];
3
+ const CHORE_KEYWORDS = ['update', 'upgrade', 'refactor', 'clean', 'remove', 'delete', 'chore', 'deps', 'dependency'];
4
+ export function buildPrTitle(taskTitle, titleFormat) {
5
+ const lower = taskTitle.toLowerCase();
6
+ let prefix = 'feat';
7
+ if (FIX_KEYWORDS.some((kw) => lower.includes(kw))) {
8
+ prefix = 'fix';
9
+ }
10
+ else if (CHORE_KEYWORDS.some((kw) => lower.includes(kw))) {
11
+ prefix = 'chore';
12
+ }
13
+ return `${prefix}: ${taskTitle}`;
14
+ }
15
+ export function buildPrBody(opts) {
16
+ return `## ${opts.taskTitle}
17
+
18
+ ${opts.summary}
19
+
20
+ ---
21
+ **Task ID:** \`${opts.taskId}\`
22
+ **Branch:** \`${opts.branch}\`
23
+ **Created by:** Verbo agent
24
+ `;
25
+ }
26
+ export function pushAndCreatePr(opts) {
27
+ try {
28
+ // Push the branch
29
+ execFileSync('git', ['push', 'origin', opts.branch], {
30
+ cwd: opts.worktreePath,
31
+ encoding: 'utf-8',
32
+ timeout: 60000,
33
+ stdio: ['ignore', 'pipe', 'pipe'],
34
+ });
35
+ // Create PR via gh CLI
36
+ const title = buildPrTitle(opts.taskTitle, 'feat|fix|chore: description');
37
+ const body = buildPrBody({
38
+ taskId: opts.taskId,
39
+ taskTitle: opts.taskTitle,
40
+ summary: opts.summary,
41
+ branch: opts.branch,
42
+ });
43
+ const prUrl = execFileSync('gh', ['pr', 'create', '--title', title, '--body', body, '--base', opts.baseBranch, '--head', opts.branch], {
44
+ cwd: opts.worktreePath,
45
+ encoding: 'utf-8',
46
+ timeout: 30000,
47
+ stdio: ['ignore', 'pipe', 'pipe'],
48
+ }).trim();
49
+ return { success: true, prUrl };
50
+ }
51
+ catch (err) {
52
+ return { success: false, error: err.message };
53
+ }
54
+ }
55
+ //# sourceMappingURL=pr-creator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"pr-creator.js","sourceRoot":"","sources":["../../../src/core/pr-creator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAiB7C,MAAM,YAAY,GAAG,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;AAC7E,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;AAErH,MAAM,UAAU,YAAY,CAAC,SAAiB,EAAE,WAAmB;IACjE,MAAM,KAAK,GAAG,SAAS,CAAC,WAAW,EAAE,CAAC;IAEtC,IAAI,MAAM,GAAG,MAAM,CAAC;IACpB,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QAClD,MAAM,GAAG,KAAK,CAAC;IACjB,CAAC;SAAM,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QAC3D,MAAM,GAAG,OAAO,CAAC;IACnB,CAAC;IAED,OAAO,GAAG,MAAM,KAAK,SAAS,EAAE,CAAC;AACnC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAA4E;IACtG,OAAO,MAAM,IAAI,CAAC,SAAS;;EAE3B,IAAI,CAAC,OAAO;;;iBAGG,IAAI,CAAC,MAAM;gBACZ,IAAI,CAAC,MAAM;;CAE1B,CAAC;AACF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,I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+ export type Role = 'owner' | 'lead' | 'developer' | 'viewer';
3
+ export type Action = 'list_tasks' | 'list_sessions' | 'create_task' | 'claim_task' | 'update_progress' | 'complete_task' | 'report_files' | 'get_conflicts' | 'unclaim_task' | 'flag_human_action' | 'list_human_actions' | 'resolve_human_action' | 'approve_tool' | 'change_role' | 'disable_sandbox';
4
+ export declare class RbacError extends Error {
5
+ readonly humanId: string;
6
+ readonly role: Role;
7
+ readonly action: Action;
8
+ constructor(humanId: string, role: Role, action: Action);
9
+ }
10
+ export interface RbacStore {
11
+ /** Returns the role for humanId; defaults to 'viewer' if not registered. */
12
+ getRole(humanId: string): Role;
13
+ /** Upserts a team member's role and records the change in role_change_log. */
14
+ setRole(targetId: string, newRole: Role, changedBy: string, reason?: string): void;
15
+ }
16
+ export declare function createRbacStore(db: Database.Database): RbacStore;
17
+ export interface RbacChecker {
18
+ /** Returns true if humanId's role permits action. */
19
+ can(humanId: string, action: Action): boolean;
20
+ /** Throws RbacError if humanId's role does not permit action. */
21
+ assert(humanId: string, action: Action): void;
22
+ /** Returns the effective role for humanId (defaults to 'viewer'). */
23
+ getRole(humanId: string): Role;
24
+ store: RbacStore;
25
+ }
26
+ export declare function createRbacChecker(store: RbacStore): RbacChecker;
27
+ //# sourceMappingURL=rbac.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.d.ts","sourceRoot":"","sources":["../../../src/core/rbac.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAK3C,MAAM,MAAM,IAAI,GAAG,OAAO,GAAG,MAAM,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE7D,MAAM,MAAM,MAAM,GACd,YAAY,GACZ,eAAe,GACf,aAAa,GACb,YAAY,GACZ,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,eAAe,GACf,cAAc,GACd,mBAAmB,GACnB,oBAAoB,GACpB,sBAAsB,GACtB,cAAc,GACd,aAAa,GACb,iBAAiB,CAAC;AAItB,qBAAa,SAAU,SAAQ,KAAK;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEZ,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM;CAOxD;AA6BD,MAAM,WAAW,SAAS;IACxB,4EAA4E;IAC5E,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,8EAA8E;IAC9E,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpF;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,CAAC,QAAQ,GAAG,SAAS,CAiChE;AAID,MAAM,WAAW,WAAW;IAC1B,qDAAqD;IACrD,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9C,iEAAiE;IACjE,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAC9C,qEAAqE;IACrE,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,SAAS,GAAG,WAAW,CAkB/D"}
@@ -0,0 +1,76 @@
1
+ import { ulid } from 'ulid';
2
+ // ---- Error ----
3
+ export class RbacError extends Error {
4
+ humanId;
5
+ role;
6
+ action;
7
+ constructor(humanId, role, action) {
8
+ super(`Forbidden: ${humanId} (${role}) cannot perform '${action}'`);
9
+ this.name = 'RbacError';
10
+ this.humanId = humanId;
11
+ this.role = role;
12
+ this.action = action;
13
+ }
14
+ }
15
+ // ---- Permission matrix ----
16
+ //
17
+ // owner — full access
18
+ // lead — all agent/task actions + resolve/approve/change-role/disable-sandbox
19
+ // developer — task lifecycle only (claim, update, complete, create, report, flag)
20
+ // viewer — read-only (list tasks, conflicts, human actions)
21
+ const PERMISSIONS = {
22
+ list_tasks: new Set(['owner', 'lead', 'developer', 'viewer']),
23
+ list_sessions: new Set(['owner', 'lead', 'developer', 'viewer']),
24
+ get_conflicts: new Set(['owner', 'lead', 'developer', 'viewer']),
25
+ list_human_actions: new Set(['owner', 'lead', 'developer', 'viewer']),
26
+ create_task: new Set(['owner', 'lead', 'developer']),
27
+ claim_task: new Set(['owner', 'lead', 'developer']),
28
+ update_progress: new Set(['owner', 'lead', 'developer']),
29
+ complete_task: new Set(['owner', 'lead', 'developer']),
30
+ report_files: new Set(['owner', 'lead', 'developer']),
31
+ unclaim_task: new Set(['owner', 'lead', 'developer']),
32
+ flag_human_action: new Set(['owner', 'lead', 'developer']),
33
+ resolve_human_action: new Set(['owner', 'lead']),
34
+ approve_tool: new Set(['owner', 'lead']),
35
+ change_role: new Set(['owner', 'lead']),
36
+ disable_sandbox: new Set(['owner', 'lead']),
37
+ };
38
+ export function createRbacStore(db) {
39
+ const stmtGetRole = db.prepare('SELECT role FROM team_members WHERE human_id = ?');
40
+ const stmtInsert = db.prepare('INSERT INTO team_members (human_id, role, created_at, updated_at) VALUES (?, ?, ?, ?)');
41
+ const stmtUpdate = db.prepare('UPDATE team_members SET role = ?, updated_at = ? WHERE human_id = ?');
42
+ const stmtLogChange = db.prepare('INSERT INTO role_change_log (id, target_human_id, changed_by, old_role, new_role, reason, created_at) VALUES (?, ?, ?, ?, ?, ?, ?)');
43
+ function getRole(humanId) {
44
+ return stmtGetRole.get(humanId)?.role ?? 'viewer';
45
+ }
46
+ function setRole(targetId, newRole, changedBy, reason) {
47
+ const now = new Date().toISOString();
48
+ const existing = stmtGetRole.get(targetId);
49
+ const oldRole = existing?.role ?? null;
50
+ if (existing) {
51
+ stmtUpdate.run(newRole, now, targetId);
52
+ }
53
+ else {
54
+ stmtInsert.run(targetId, newRole, now, now);
55
+ }
56
+ stmtLogChange.run(ulid(), targetId, changedBy, oldRole, newRole, reason ?? null, now);
57
+ }
58
+ return { getRole, setRole };
59
+ }
60
+ export function createRbacChecker(store) {
61
+ function can(humanId, action) {
62
+ const role = store.getRole(humanId);
63
+ return PERMISSIONS[action].has(role);
64
+ }
65
+ function assert(humanId, action) {
66
+ const role = store.getRole(humanId);
67
+ if (!PERMISSIONS[action].has(role)) {
68
+ throw new RbacError(humanId, role, action);
69
+ }
70
+ }
71
+ function getRole(humanId) {
72
+ return store.getRole(humanId);
73
+ }
74
+ return { can, assert, getRole, store };
75
+ }
76
+ //# sourceMappingURL=rbac.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rbac.js","sourceRoot":"","sources":["../../../src/core/rbac.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAuB5B,kBAAkB;AAElB,MAAM,OAAO,SAAU,SAAQ,KAAK;IACzB,OAAO,CAAS;IAChB,IAAI,CAAO;IACX,MAAM,CAAS;IAExB,YAAY,OAAe,EAAE,IAAU,EAAE,MAAc;QACrD,KAAK,CAAC,cAAc,OAAO,KAAK,IAAI,qBAAqB,MAAM,GAAG,CAAC,CAAC;QACpE,IAAI,CAAC,IAAI,GAAG,WAAW,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;CACF;AAED,8BAA8B;AAC9B,EAAE;AACF,0BAA0B;AAC1B,mFAAmF;AACnF,kFAAkF;AAClF,+DAA+D;AAE/D,MAAM,WAAW,GAA8B;IAC7C,UAAU,EAAY,IAAI,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC;IACvE,aAAa,EAAS,IAAI,GAAG,CAAC,C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,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IACvC,CAAC;IAED,SAAS,MAAM,CAAC,OAAe,EAAE,MAAc;QAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACnC,MAAM,IAAI,SAAS,CAAC,OAAO,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QAC7C,CAAC;IACH,CAAC;IAED,SAAS,OAAO,CAAC,OAAe;QAC9B,OAAO,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC;AACzC,CAAC"}
@@ -0,0 +1,47 @@
1
+ import type { TaskStore } from './task-store.js';
2
+ import type { AgentSessionStore } from './agent-session-store.js';
3
+ import type { ApprovalStore } from '../approval/approval-store.js';
4
+ import type { AgentLauncher } from '../agent/agent-launcher.js';
5
+ import type { PipelineRunner } from './pipeline-runner.js';
6
+ import type Database from 'better-sqlite3';
7
+ export interface CleanupDeps {
8
+ tasks: TaskStore;
9
+ sessions: AgentSessionStore;
10
+ approvals: ApprovalStore;
11
+ /** Optional — if provided, orphaned worktrees will be removed from disk. */
12
+ launcher?: AgentLauncher;
13
+ /** The project root directory — needed to scan .verbo/agents/. */
14
+ projectDir?: string;
15
+ /** Override for testing — defaults to checking process.kill(pid, 0). */
16
+ isPidAlive?: (pid: number) => boolean;
17
+ /**
18
+ * Optional pipeline runner — if provided and pipelineRunIds is given,
19
+ * active runs that belong to reset tasks will be cancelled at startup.
20
+ */
21
+ pipelineRunner?: PipelineRunner;
22
+ /** Set of pipeline run IDs to cancel when their tasks are reset on startup. */
23
+ pipelineRunIds?: Set<string>;
24
+ }
25
+ export interface CleanupResult {
26
+ pendingApprovalsDenied: number;
27
+ sessionsErrored: number;
28
+ tasksReset: number;
29
+ worktreesCleaned: number;
30
+ staleHooksCleaned: boolean;
31
+ }
32
+ /**
33
+ * Clean up stale state left over from a previous Verbo run.
34
+ * Called once at startup before the TUI or any command that launches agents.
35
+ *
36
+ * 1. Deny all pending approval requests (agents that asked are gone).
37
+ * 2. Mark orphaned sessions (starting/active/stalled with no live PID) as errored.
38
+ * 3. Reset in_progress tasks whose session has no live PID back to todo.
39
+ */
40
+ export declare function cleanStaleState(deps: CleanupDeps): Promise<CleanupResult>;
41
+ /**
42
+ * Delete audit_log rows older than `retainDays` (default 90).
43
+ * Called at startup to keep the audit table from growing unbounded.
44
+ * Returns the number of rows pruned.
45
+ */
46
+ export declare function pruneAuditLog(db: Database.Database, retainDays?: number): number;
47
+ //# sourceMappingURL=startup-cleanup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"startup-cleanup.d.ts","sourceRoot":"","sources":["../../../src/core/startup-cleanup.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAC;AAI3C,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,EAAE,aAAa,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wEAAwE;IACxE,UAAU,CAAC,EAAE,CAAC,GAAG,EAAE,MA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