opencastle 1.3.1 → 1.4.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 (486) hide show
  1. package/README.md +16 -10
  2. package/bin/cli.mjs +8 -9
  3. package/dist/cli/agent-roster.test.js +0 -48
  4. package/dist/cli/agent-roster.test.js.map +1 -1
  5. package/dist/cli/boundary.test.js +9 -7
  6. package/dist/cli/boundary.test.js.map +1 -1
  7. package/dist/cli/convoy/artifacts.d.ts +9 -2
  8. package/dist/cli/convoy/artifacts.d.ts.map +1 -1
  9. package/dist/cli/convoy/artifacts.js +13 -10
  10. package/dist/cli/convoy/artifacts.js.map +1 -1
  11. package/dist/cli/convoy/artifacts.test.js +4 -2
  12. package/dist/cli/convoy/artifacts.test.js.map +1 -1
  13. package/dist/cli/convoy/engine.d.ts +53 -23
  14. package/dist/cli/convoy/engine.d.ts.map +1 -1
  15. package/dist/cli/convoy/engine.git.test.d.ts +2 -0
  16. package/dist/cli/convoy/engine.git.test.d.ts.map +1 -0
  17. package/dist/cli/convoy/engine.git.test.js +435 -0
  18. package/dist/cli/convoy/engine.git.test.js.map +1 -0
  19. package/dist/cli/convoy/engine.js +1746 -2305
  20. package/dist/cli/convoy/engine.js.map +1 -1
  21. package/dist/cli/convoy/engine.test.js +698 -678
  22. package/dist/cli/convoy/engine.test.js.map +1 -1
  23. package/dist/cli/convoy/event-schemas.d.ts +2 -0
  24. package/dist/cli/convoy/event-schemas.d.ts.map +1 -1
  25. package/dist/cli/convoy/event-schemas.js +59 -57
  26. package/dist/cli/convoy/event-schemas.js.map +1 -1
  27. package/dist/cli/convoy/events.d.ts +4 -1
  28. package/dist/cli/convoy/events.d.ts.map +1 -1
  29. package/dist/cli/convoy/events.js +69 -84
  30. package/dist/cli/convoy/events.js.map +1 -1
  31. package/dist/cli/convoy/events.test.js +50 -9
  32. package/dist/cli/convoy/events.test.js.map +1 -1
  33. package/dist/cli/convoy/gates.d.ts +9 -4
  34. package/dist/cli/convoy/gates.d.ts.map +1 -1
  35. package/dist/cli/convoy/gates.js +29 -14
  36. package/dist/cli/convoy/gates.js.map +1 -1
  37. package/dist/cli/convoy/isolation.d.ts +32 -6
  38. package/dist/cli/convoy/isolation.d.ts.map +1 -1
  39. package/dist/cli/convoy/isolation.js +72 -34
  40. package/dist/cli/convoy/isolation.js.map +1 -1
  41. package/dist/cli/convoy/isolation.test.js +66 -42
  42. package/dist/cli/convoy/isolation.test.js.map +1 -1
  43. package/dist/cli/convoy/lock.d.ts.map +1 -1
  44. package/dist/cli/convoy/lock.js +25 -10
  45. package/dist/cli/convoy/lock.js.map +1 -1
  46. package/dist/cli/convoy/lock.test.js +12 -0
  47. package/dist/cli/convoy/lock.test.js.map +1 -1
  48. package/dist/cli/convoy/merge.d.ts +21 -4
  49. package/dist/cli/convoy/merge.d.ts.map +1 -1
  50. package/dist/cli/convoy/merge.js +69 -53
  51. package/dist/cli/convoy/merge.js.map +1 -1
  52. package/dist/cli/convoy/merge.test.js +23 -1
  53. package/dist/cli/convoy/merge.test.js.map +1 -1
  54. package/dist/cli/convoy/progress.d.ts +35 -0
  55. package/dist/cli/convoy/progress.d.ts.map +1 -0
  56. package/dist/cli/convoy/progress.js +103 -0
  57. package/dist/cli/convoy/progress.js.map +1 -0
  58. package/dist/cli/convoy/progress.test.d.ts +2 -0
  59. package/dist/cli/convoy/progress.test.d.ts.map +1 -0
  60. package/dist/cli/convoy/progress.test.js +53 -0
  61. package/dist/cli/convoy/progress.test.js.map +1 -0
  62. package/dist/cli/convoy/read-model.d.ts +468 -0
  63. package/dist/cli/convoy/read-model.d.ts.map +1 -0
  64. package/dist/cli/convoy/read-model.js +1132 -0
  65. package/dist/cli/convoy/read-model.js.map +1 -0
  66. package/dist/cli/convoy/read-model.test.d.ts +2 -0
  67. package/dist/cli/convoy/read-model.test.d.ts.map +1 -0
  68. package/dist/cli/convoy/read-model.test.js +609 -0
  69. package/dist/cli/convoy/read-model.test.js.map +1 -0
  70. package/dist/cli/convoy/redact.d.ts +34 -0
  71. package/dist/cli/convoy/redact.d.ts.map +1 -0
  72. package/dist/cli/convoy/redact.js +66 -0
  73. package/dist/cli/convoy/redact.js.map +1 -0
  74. package/dist/cli/convoy/redact.test.d.ts +2 -0
  75. package/dist/cli/convoy/redact.test.d.ts.map +1 -0
  76. package/dist/cli/convoy/redact.test.js +43 -0
  77. package/dist/cli/convoy/redact.test.js.map +1 -0
  78. package/dist/cli/convoy/reviewer.d.ts +65 -0
  79. package/dist/cli/convoy/reviewer.d.ts.map +1 -0
  80. package/dist/cli/convoy/reviewer.js +141 -0
  81. package/dist/cli/convoy/reviewer.js.map +1 -0
  82. package/dist/cli/convoy/reviewer.test.d.ts +2 -0
  83. package/dist/cli/convoy/reviewer.test.d.ts.map +1 -0
  84. package/dist/cli/convoy/reviewer.test.js +96 -0
  85. package/dist/cli/convoy/reviewer.test.js.map +1 -0
  86. package/dist/cli/convoy/schedule.d.ts +30 -0
  87. package/dist/cli/convoy/schedule.d.ts.map +1 -0
  88. package/dist/cli/convoy/schedule.js +111 -0
  89. package/dist/cli/convoy/schedule.js.map +1 -0
  90. package/dist/cli/convoy/schedule.test.d.ts +2 -0
  91. package/dist/cli/convoy/schedule.test.d.ts.map +1 -0
  92. package/dist/cli/convoy/schedule.test.js +45 -0
  93. package/dist/cli/convoy/schedule.test.js.map +1 -0
  94. package/dist/cli/convoy/spec-builder.d.ts +120 -30
  95. package/dist/cli/convoy/spec-builder.d.ts.map +1 -1
  96. package/dist/cli/convoy/spec-builder.js +438 -114
  97. package/dist/cli/convoy/spec-builder.js.map +1 -1
  98. package/dist/cli/convoy/spec-builder.test.js +419 -435
  99. package/dist/cli/convoy/spec-builder.test.js.map +1 -1
  100. package/dist/cli/convoy/spec-types.d.ts +46 -92
  101. package/dist/cli/convoy/spec-types.d.ts.map +1 -1
  102. package/dist/cli/convoy/store.d.ts +6 -1
  103. package/dist/cli/convoy/store.d.ts.map +1 -1
  104. package/dist/cli/convoy/store.js +111 -15
  105. package/dist/cli/convoy/store.js.map +1 -1
  106. package/dist/cli/convoy/store.test.js +59 -13
  107. package/dist/cli/convoy/store.test.js.map +1 -1
  108. package/dist/cli/convoy/types.d.ts +76 -113
  109. package/dist/cli/convoy/types.d.ts.map +1 -1
  110. package/dist/cli/convoy/types.js +6 -13
  111. package/dist/cli/convoy/types.js.map +1 -1
  112. package/dist/cli/convoy/worktree.d.ts +88 -3
  113. package/dist/cli/convoy/worktree.d.ts.map +1 -1
  114. package/dist/cli/convoy/worktree.js +282 -56
  115. package/dist/cli/convoy/worktree.js.map +1 -1
  116. package/dist/cli/convoy/worktree.test.js +132 -1
  117. package/dist/cli/convoy/worktree.test.js.map +1 -1
  118. package/dist/cli/convoy-args.test.js +9 -27
  119. package/dist/cli/convoy-args.test.js.map +1 -1
  120. package/dist/cli/convoy-cmd.d.ts +31 -6
  121. package/dist/cli/convoy-cmd.d.ts.map +1 -1
  122. package/dist/cli/convoy-cmd.js +150 -201
  123. package/dist/cli/convoy-cmd.js.map +1 -1
  124. package/dist/cli/convoy-cmd.test.d.ts +2 -0
  125. package/dist/cli/convoy-cmd.test.d.ts.map +1 -0
  126. package/dist/cli/convoy-cmd.test.js +144 -0
  127. package/dist/cli/convoy-cmd.test.js.map +1 -0
  128. package/dist/cli/dashboard.d.ts +24 -11
  129. package/dist/cli/dashboard.d.ts.map +1 -1
  130. package/dist/cli/dashboard.js +241 -303
  131. package/dist/cli/dashboard.js.map +1 -1
  132. package/dist/cli/dashboard.test.d.ts +2 -0
  133. package/dist/cli/dashboard.test.d.ts.map +1 -0
  134. package/dist/cli/dashboard.test.js +340 -0
  135. package/dist/cli/dashboard.test.js.map +1 -0
  136. package/dist/cli/dispatcher.test.js +35 -2
  137. package/dist/cli/dispatcher.test.js.map +1 -1
  138. package/dist/cli/docs-accuracy.test.js +3 -3
  139. package/dist/cli/docs-accuracy.test.js.map +1 -1
  140. package/dist/cli/log.d.ts +39 -0
  141. package/dist/cli/log.d.ts.map +1 -1
  142. package/dist/cli/log.js +267 -93
  143. package/dist/cli/log.js.map +1 -1
  144. package/dist/cli/log.test.d.ts +2 -0
  145. package/dist/cli/log.test.d.ts.map +1 -0
  146. package/dist/cli/log.test.js +208 -0
  147. package/dist/cli/log.test.js.map +1 -0
  148. package/dist/cli/nearest.d.ts +18 -0
  149. package/dist/cli/nearest.d.ts.map +1 -0
  150. package/dist/cli/nearest.js +38 -0
  151. package/dist/cli/nearest.js.map +1 -0
  152. package/dist/cli/nearest.test.d.ts +2 -0
  153. package/dist/cli/nearest.test.d.ts.map +1 -0
  154. package/dist/cli/nearest.test.js +24 -0
  155. package/dist/cli/nearest.test.js.map +1 -0
  156. package/dist/cli/pipeline.d.ts +61 -0
  157. package/dist/cli/pipeline.d.ts.map +1 -1
  158. package/dist/cli/pipeline.flow.test.d.ts +2 -0
  159. package/dist/cli/pipeline.flow.test.d.ts.map +1 -0
  160. package/dist/cli/pipeline.flow.test.js +524 -0
  161. package/dist/cli/pipeline.flow.test.js.map +1 -0
  162. package/dist/cli/pipeline.js +471 -690
  163. package/dist/cli/pipeline.js.map +1 -1
  164. package/dist/cli/plan.d.ts +82 -31
  165. package/dist/cli/plan.d.ts.map +1 -1
  166. package/dist/cli/plan.js +167 -507
  167. package/dist/cli/plan.js.map +1 -1
  168. package/dist/cli/plan.test.d.ts +2 -0
  169. package/dist/cli/plan.test.d.ts.map +1 -0
  170. package/dist/cli/plan.test.js +158 -0
  171. package/dist/cli/plan.test.js.map +1 -0
  172. package/dist/cli/run/adapters/agent-process.d.ts +82 -0
  173. package/dist/cli/run/adapters/agent-process.d.ts.map +1 -0
  174. package/dist/cli/run/adapters/agent-process.js +224 -0
  175. package/dist/cli/run/adapters/agent-process.js.map +1 -0
  176. package/dist/cli/run/adapters/agent-process.test.d.ts +2 -0
  177. package/dist/cli/run/adapters/agent-process.test.d.ts.map +1 -0
  178. package/dist/cli/run/adapters/agent-process.test.js +159 -0
  179. package/dist/cli/run/adapters/agent-process.test.js.map +1 -0
  180. package/dist/cli/run/adapters/claude.d.ts +53 -2
  181. package/dist/cli/run/adapters/claude.d.ts.map +1 -1
  182. package/dist/cli/run/adapters/claude.js +147 -171
  183. package/dist/cli/run/adapters/claude.js.map +1 -1
  184. package/dist/cli/run/adapters/claude.test.js +197 -254
  185. package/dist/cli/run/adapters/claude.test.js.map +1 -1
  186. package/dist/cli/run/adapters/codex.d.ts +25 -2
  187. package/dist/cli/run/adapters/codex.d.ts.map +1 -1
  188. package/dist/cli/run/adapters/codex.js +113 -81
  189. package/dist/cli/run/adapters/codex.js.map +1 -1
  190. package/dist/cli/run/adapters/codex.test.js +116 -95
  191. package/dist/cli/run/adapters/codex.test.js.map +1 -1
  192. package/dist/cli/run/adapters/copilot.d.ts +35 -1
  193. package/dist/cli/run/adapters/copilot.d.ts.map +1 -1
  194. package/dist/cli/run/adapters/copilot.js +104 -287
  195. package/dist/cli/run/adapters/copilot.js.map +1 -1
  196. package/dist/cli/run/adapters/copilot.test.js +122 -282
  197. package/dist/cli/run/adapters/copilot.test.js.map +1 -1
  198. package/dist/cli/run/adapters/cursor.d.ts +25 -7
  199. package/dist/cli/run/adapters/cursor.d.ts.map +1 -1
  200. package/dist/cli/run/adapters/cursor.js +103 -156
  201. package/dist/cli/run/adapters/cursor.js.map +1 -1
  202. package/dist/cli/run/adapters/cursor.test.js +106 -218
  203. package/dist/cli/run/adapters/cursor.test.js.map +1 -1
  204. package/dist/cli/run/adapters/index.d.ts +34 -5
  205. package/dist/cli/run/adapters/index.d.ts.map +1 -1
  206. package/dist/cli/run/adapters/index.js +147 -21
  207. package/dist/cli/run/adapters/index.js.map +1 -1
  208. package/dist/cli/run/adapters/index.test.d.ts +2 -0
  209. package/dist/cli/run/adapters/index.test.d.ts.map +1 -0
  210. package/dist/cli/run/adapters/index.test.js +129 -0
  211. package/dist/cli/run/adapters/index.test.js.map +1 -0
  212. package/dist/cli/run/adapters/opencode.d.ts +25 -9
  213. package/dist/cli/run/adapters/opencode.d.ts.map +1 -1
  214. package/dist/cli/run/adapters/opencode.js +136 -152
  215. package/dist/cli/run/adapters/opencode.js.map +1 -1
  216. package/dist/cli/run/adapters/opencode.test.js +99 -218
  217. package/dist/cli/run/adapters/opencode.test.js.map +1 -1
  218. package/dist/cli/run/adapters/permission-modes.d.ts +47 -4
  219. package/dist/cli/run/adapters/permission-modes.d.ts.map +1 -1
  220. package/dist/cli/run/adapters/permission-modes.js +113 -37
  221. package/dist/cli/run/adapters/permission-modes.js.map +1 -1
  222. package/dist/cli/run/adapters/permission-modes.test.js +55 -40
  223. package/dist/cli/run/adapters/permission-modes.test.js.map +1 -1
  224. package/dist/cli/run/adapters/stub-cli.test-helper.d.ts +22 -0
  225. package/dist/cli/run/adapters/stub-cli.test-helper.d.ts.map +1 -0
  226. package/dist/cli/run/adapters/stub-cli.test-helper.js +73 -0
  227. package/dist/cli/run/adapters/stub-cli.test-helper.js.map +1 -0
  228. package/dist/cli/run/platform.d.ts +52 -0
  229. package/dist/cli/run/platform.d.ts.map +1 -0
  230. package/dist/cli/run/platform.js +207 -0
  231. package/dist/cli/run/platform.js.map +1 -0
  232. package/dist/cli/run/platform.test.d.ts +2 -0
  233. package/dist/cli/run/platform.test.d.ts.map +1 -0
  234. package/dist/cli/run/platform.test.js +119 -0
  235. package/dist/cli/run/platform.test.js.map +1 -0
  236. package/dist/cli/run/schema.d.ts +6 -8
  237. package/dist/cli/run/schema.d.ts.map +1 -1
  238. package/dist/cli/run/schema.js +44 -68
  239. package/dist/cli/run/schema.js.map +1 -1
  240. package/dist/cli/run/schema.test.js +59 -279
  241. package/dist/cli/run/schema.test.js.map +1 -1
  242. package/dist/cli/run.d.ts +34 -56
  243. package/dist/cli/run.d.ts.map +1 -1
  244. package/dist/cli/run.js +379 -1132
  245. package/dist/cli/run.js.map +1 -1
  246. package/dist/cli/run.test.d.ts +2 -0
  247. package/dist/cli/run.test.d.ts.map +1 -0
  248. package/dist/cli/run.test.js +318 -0
  249. package/dist/cli/run.test.js.map +1 -0
  250. package/dist/cli/team-config.d.ts.map +1 -1
  251. package/dist/cli/team-config.js +2 -21
  252. package/dist/cli/team-config.js.map +1 -1
  253. package/dist/cli/tiers.test.js +4 -13
  254. package/dist/cli/tiers.test.js.map +1 -1
  255. package/package.json +3 -10
  256. package/src/cli/agent-roster.test.ts +0 -55
  257. package/src/cli/boundary.test.ts +9 -7
  258. package/src/cli/convoy/TELEMETRY.md +131 -125
  259. package/src/cli/convoy/artifacts.test.ts +4 -2
  260. package/src/cli/convoy/artifacts.ts +13 -12
  261. package/src/cli/convoy/engine.git.test.ts +462 -0
  262. package/src/cli/convoy/engine.test.ts +817 -850
  263. package/src/cli/convoy/engine.ts +1864 -2596
  264. package/src/cli/convoy/event-schemas.ts +63 -59
  265. package/src/cli/convoy/events.test.ts +58 -9
  266. package/src/cli/convoy/events.ts +69 -91
  267. package/src/cli/convoy/gates.ts +31 -12
  268. package/src/cli/convoy/isolation.test.ts +76 -43
  269. package/src/cli/convoy/isolation.ts +100 -38
  270. package/src/cli/convoy/lock.test.ts +16 -0
  271. package/src/cli/convoy/lock.ts +25 -8
  272. package/src/cli/convoy/merge.test.ts +25 -1
  273. package/src/cli/convoy/merge.ts +74 -61
  274. package/src/cli/convoy/progress.test.ts +59 -0
  275. package/src/cli/convoy/progress.ts +121 -0
  276. package/src/cli/convoy/read-model.test.ts +685 -0
  277. package/src/cli/convoy/read-model.ts +1469 -0
  278. package/src/cli/convoy/redact.test.ts +49 -0
  279. package/src/cli/convoy/redact.ts +73 -0
  280. package/src/cli/convoy/reviewer.test.ts +112 -0
  281. package/src/cli/convoy/reviewer.ts +196 -0
  282. package/src/cli/convoy/schedule.test.ts +56 -0
  283. package/src/cli/convoy/schedule.ts +109 -0
  284. package/src/cli/convoy/spec-builder.test.ts +460 -464
  285. package/src/cli/convoy/spec-builder.ts +460 -129
  286. package/src/cli/convoy/spec-types.ts +46 -108
  287. package/src/cli/convoy/store.test.ts +64 -13
  288. package/src/cli/convoy/store.ts +143 -33
  289. package/src/cli/convoy/types.ts +59 -71
  290. package/src/cli/convoy/worktree.test.ts +140 -1
  291. package/src/cli/convoy/worktree.ts +311 -61
  292. package/src/cli/convoy-args.test.ts +10 -30
  293. package/src/cli/convoy-cmd.test.ts +163 -0
  294. package/src/cli/convoy-cmd.ts +173 -216
  295. package/src/cli/dashboard/dashboard.css +2086 -0
  296. package/src/cli/dashboard/dashboard.js +1687 -0
  297. package/src/cli/dashboard/index.html +307 -0
  298. package/src/cli/dashboard.test.ts +382 -0
  299. package/src/cli/dashboard.ts +243 -339
  300. package/src/cli/dispatcher.test.ts +36 -2
  301. package/src/cli/docs-accuracy.test.ts +3 -3
  302. package/src/cli/log.test.ts +228 -0
  303. package/src/cli/log.ts +302 -83
  304. package/src/cli/nearest.test.ts +27 -0
  305. package/src/cli/nearest.ts +38 -0
  306. package/src/cli/pipeline.flow.test.ts +607 -0
  307. package/src/cli/pipeline.ts +544 -759
  308. package/src/cli/plan.test.ts +193 -0
  309. package/src/cli/plan.ts +209 -545
  310. package/src/cli/run/adapters/agent-process.test.ts +175 -0
  311. package/src/cli/run/adapters/agent-process.ts +252 -0
  312. package/src/cli/run/adapters/claude.test.ts +205 -260
  313. package/src/cli/run/adapters/claude.ts +151 -162
  314. package/src/cli/run/adapters/codex.test.ts +120 -100
  315. package/src/cli/run/adapters/codex.ts +115 -91
  316. package/src/cli/run/adapters/copilot.test.ts +135 -306
  317. package/src/cli/run/adapters/copilot.ts +105 -274
  318. package/src/cli/run/adapters/cursor.test.ts +111 -220
  319. package/src/cli/run/adapters/cursor.ts +105 -156
  320. package/src/cli/run/adapters/index.test.ts +148 -0
  321. package/src/cli/run/adapters/index.ts +168 -20
  322. package/src/cli/run/adapters/opencode.test.ts +106 -227
  323. package/src/cli/run/adapters/opencode.ts +139 -151
  324. package/src/cli/run/adapters/permission-modes.test.ts +63 -41
  325. package/src/cli/run/adapters/permission-modes.ts +118 -37
  326. package/src/cli/run/adapters/stub-cli.test-helper.ts +88 -0
  327. package/src/cli/run/platform.test.ts +128 -0
  328. package/src/cli/run/platform.ts +213 -0
  329. package/src/cli/run/schema.test.ts +62 -344
  330. package/src/cli/run/schema.ts +48 -78
  331. package/src/cli/run.test.ts +351 -0
  332. package/src/cli/run.ts +366 -1151
  333. package/src/cli/team-config.ts +2 -21
  334. package/src/cli/tiers.test.ts +4 -17
  335. package/src/orchestrator/agents/team-lead.agent.md +1 -1
  336. package/src/orchestrator/prompts/assess-complexity.prompt.md +43 -26
  337. package/src/orchestrator/prompts/brainstorm.prompt.md +1 -1
  338. package/src/orchestrator/prompts/bug-fix.prompt.md +2 -2
  339. package/src/orchestrator/prompts/fix-convoy.prompt.md +43 -29
  340. package/src/orchestrator/prompts/fix-prd.prompt.md +26 -22
  341. package/src/orchestrator/prompts/generate-convoy.prompt.md +139 -147
  342. package/src/orchestrator/prompts/generate-prd.prompt.md +75 -68
  343. package/src/orchestrator/prompts/implement-feature.prompt.md +2 -2
  344. package/src/orchestrator/prompts/validate-convoy.prompt.md +29 -28
  345. package/src/orchestrator/prompts/validate-prd.prompt.md +28 -21
  346. package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +3 -3
  347. package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
  348. package/src/orchestrator/skills/fast-review/SKILL.md +3 -1
  349. package/src/orchestrator/skills/orchestration-protocols/SKILL.md +7 -8
  350. package/dist/cli/convoy/dag-analysis.d.ts +0 -39
  351. package/dist/cli/convoy/dag-analysis.d.ts.map +0 -1
  352. package/dist/cli/convoy/dag-analysis.js +0 -279
  353. package/dist/cli/convoy/dag-analysis.js.map +0 -1
  354. package/dist/cli/convoy/dag-analysis.test.d.ts +0 -2
  355. package/dist/cli/convoy/dag-analysis.test.d.ts.map +0 -1
  356. package/dist/cli/convoy/dag-analysis.test.js +0 -289
  357. package/dist/cli/convoy/dag-analysis.test.js.map +0 -1
  358. package/dist/cli/convoy/formula.d.ts +0 -19
  359. package/dist/cli/convoy/formula.d.ts.map +0 -1
  360. package/dist/cli/convoy/formula.js +0 -142
  361. package/dist/cli/convoy/formula.js.map +0 -1
  362. package/dist/cli/convoy/formula.test.d.ts +0 -2
  363. package/dist/cli/convoy/formula.test.d.ts.map +0 -1
  364. package/dist/cli/convoy/formula.test.js +0 -342
  365. package/dist/cli/convoy/formula.test.js.map +0 -1
  366. package/dist/cli/convoy/health.d.ts +0 -34
  367. package/dist/cli/convoy/health.d.ts.map +0 -1
  368. package/dist/cli/convoy/health.js +0 -123
  369. package/dist/cli/convoy/health.js.map +0 -1
  370. package/dist/cli/convoy/health.test.d.ts +0 -2
  371. package/dist/cli/convoy/health.test.d.ts.map +0 -1
  372. package/dist/cli/convoy/health.test.js +0 -448
  373. package/dist/cli/convoy/health.test.js.map +0 -1
  374. package/dist/cli/convoy/last-run.d.ts +0 -53
  375. package/dist/cli/convoy/last-run.d.ts.map +0 -1
  376. package/dist/cli/convoy/last-run.js +0 -54
  377. package/dist/cli/convoy/last-run.js.map +0 -1
  378. package/dist/cli/convoy/last-run.test.d.ts +0 -2
  379. package/dist/cli/convoy/last-run.test.d.ts.map +0 -1
  380. package/dist/cli/convoy/last-run.test.js +0 -110
  381. package/dist/cli/convoy/last-run.test.js.map +0 -1
  382. package/dist/cli/convoy/pipeline.d.ts +0 -41
  383. package/dist/cli/convoy/pipeline.d.ts.map +0 -1
  384. package/dist/cli/convoy/pipeline.js +0 -414
  385. package/dist/cli/convoy/pipeline.js.map +0 -1
  386. package/dist/cli/convoy/pipeline.test.d.ts +0 -2
  387. package/dist/cli/convoy/pipeline.test.d.ts.map +0 -1
  388. package/dist/cli/convoy/pipeline.test.js +0 -837
  389. package/dist/cli/convoy/pipeline.test.js.map +0 -1
  390. package/dist/cli/convoy/review-stages.d.ts +0 -9
  391. package/dist/cli/convoy/review-stages.d.ts.map +0 -1
  392. package/dist/cli/convoy/review-stages.js +0 -134
  393. package/dist/cli/convoy/review-stages.js.map +0 -1
  394. package/dist/cli/convoy/review-stages.test.d.ts +0 -2
  395. package/dist/cli/convoy/review-stages.test.d.ts.map +0 -1
  396. package/dist/cli/convoy/review-stages.test.js +0 -197
  397. package/dist/cli/convoy/review-stages.test.js.map +0 -1
  398. package/dist/cli/run/executor.d.ts +0 -15
  399. package/dist/cli/run/executor.d.ts.map +0 -1
  400. package/dist/cli/run/executor.js +0 -249
  401. package/dist/cli/run/executor.js.map +0 -1
  402. package/dist/cli/run/executor.test.d.ts +0 -2
  403. package/dist/cli/run/executor.test.d.ts.map +0 -1
  404. package/dist/cli/run/executor.test.js +0 -297
  405. package/dist/cli/run/executor.test.js.map +0 -1
  406. package/dist/cli/run/reporter.d.ts +0 -10
  407. package/dist/cli/run/reporter.d.ts.map +0 -1
  408. package/dist/cli/run/reporter.js +0 -142
  409. package/dist/cli/run/reporter.js.map +0 -1
  410. package/dist/cli/run-dry-run.test.d.ts +0 -2
  411. package/dist/cli/run-dry-run.test.d.ts.map +0 -1
  412. package/dist/cli/run-dry-run.test.js +0 -83
  413. package/dist/cli/run-dry-run.test.js.map +0 -1
  414. package/dist/cli/run-executor-flags.test.d.ts +0 -2
  415. package/dist/cli/run-executor-flags.test.d.ts.map +0 -1
  416. package/dist/cli/run-executor-flags.test.js +0 -31
  417. package/dist/cli/run-executor-flags.test.js.map +0 -1
  418. package/dist/cli/run-finish.test.d.ts +0 -2
  419. package/dist/cli/run-finish.test.d.ts.map +0 -1
  420. package/dist/cli/run-finish.test.js +0 -77
  421. package/dist/cli/run-finish.test.js.map +0 -1
  422. package/dist/cli/watch.d.ts +0 -15
  423. package/dist/cli/watch.d.ts.map +0 -1
  424. package/dist/cli/watch.js +0 -277
  425. package/dist/cli/watch.js.map +0 -1
  426. package/dist/dashboard/scripts/etl.d.ts +0 -10
  427. package/dist/dashboard/scripts/etl.d.ts.map +0 -1
  428. package/dist/dashboard/scripts/etl.js +0 -141
  429. package/dist/dashboard/scripts/etl.js.map +0 -1
  430. package/src/cli/convoy/dag-analysis.test.ts +0 -349
  431. package/src/cli/convoy/dag-analysis.ts +0 -367
  432. package/src/cli/convoy/formula.test.ts +0 -404
  433. package/src/cli/convoy/formula.ts +0 -174
  434. package/src/cli/convoy/health.test.ts +0 -519
  435. package/src/cli/convoy/health.ts +0 -189
  436. package/src/cli/convoy/last-run.test.ts +0 -130
  437. package/src/cli/convoy/last-run.ts +0 -87
  438. package/src/cli/convoy/pipeline.test.ts +0 -999
  439. package/src/cli/convoy/pipeline.ts +0 -492
  440. package/src/cli/convoy/review-stages.test.ts +0 -235
  441. package/src/cli/convoy/review-stages.ts +0 -166
  442. package/src/cli/run/executor.test.ts +0 -338
  443. package/src/cli/run/executor.ts +0 -292
  444. package/src/cli/run/reporter.ts +0 -160
  445. package/src/cli/run-dry-run.test.ts +0 -97
  446. package/src/cli/run-executor-flags.test.ts +0 -38
  447. package/src/cli/run-finish.test.ts +0 -91
  448. package/src/cli/watch.ts +0 -295
  449. package/src/dashboard/astro.config.mjs +0 -6
  450. package/src/dashboard/dist/_astro/index.CADNhRPS.css +0 -1
  451. package/src/dashboard/dist/data/.gitkeep +0 -0
  452. package/src/dashboard/dist/data/convoy-list.json +0 -1
  453. package/src/dashboard/dist/data/overall-stats.json +0 -29
  454. package/src/dashboard/dist/index.html +0 -1963
  455. package/src/dashboard/node_modules/.vite/deps/_metadata.json +0 -31
  456. package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js +0 -6776
  457. package/src/dashboard/node_modules/.vite/deps/astro___aria-query.js.map +0 -7
  458. package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js +0 -3754
  459. package/src/dashboard/node_modules/.vite/deps/astro___axobject-query.js.map +0 -7
  460. package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js +0 -99
  461. package/src/dashboard/node_modules/.vite/deps/astro___cssesc.js.map +0 -7
  462. package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js +0 -8
  463. package/src/dashboard/node_modules/.vite/deps/chunk-BUSYA2B4.js.map +0 -7
  464. package/src/dashboard/node_modules/.vite/deps/package.json +0 -3
  465. package/src/dashboard/package-lock.json +0 -6
  466. package/src/dashboard/public/data/.gitkeep +0 -0
  467. package/src/dashboard/public/data/convoy-list.json +0 -1
  468. package/src/dashboard/public/data/overall-stats.json +0 -29
  469. package/src/dashboard/public/icon-192.png +0 -0
  470. package/src/dashboard/scripts/etl.test.ts +0 -166
  471. package/src/dashboard/scripts/etl.ts +0 -170
  472. package/src/dashboard/scripts/generate-demo-db.test.ts +0 -30
  473. package/src/dashboard/scripts/generate-demo-db.ts +0 -529
  474. package/src/dashboard/scripts/integration-test.ts +0 -504
  475. package/src/dashboard/scripts/verify-demo-data.sh +0 -51
  476. package/src/dashboard/seed-data/delegations.ndjson +0 -35
  477. package/src/dashboard/seed-data/events.ndjson +0 -104
  478. package/src/dashboard/seed-data/panels.ndjson +0 -13
  479. package/src/dashboard/seed-data/reviews.ndjson +0 -6
  480. package/src/dashboard/seed-data/sessions.ndjson +0 -50
  481. package/src/dashboard/src/env.d.ts +0 -1
  482. package/src/dashboard/src/layouts/Layout.astro +0 -25
  483. package/src/dashboard/src/pages/index.astro +0 -2313
  484. package/src/dashboard/src/styles/dashboard.css +0 -2943
  485. package/src/dashboard/tsconfig.json +0 -6
  486. /package/src/{dashboard/dist → cli/dashboard}/icon-192.png +0 -0
@@ -8,7 +8,7 @@
8
8
  import type { ChildProcess } from 'node:child_process';
9
9
  import type {
10
10
  BuiltInGatesConfig, BrowserTestConfig, GuardConfig, CircuitBreakerConfig,
11
- TaskStep, Hook, TaskOutput, TaskInput, WatchConfig, MCPServerConfig,
11
+ TaskStep, Hook, TaskOutput, TaskInput, MCPServerConfig,
12
12
  } from './types.js';
13
13
 
14
14
  /**
@@ -54,20 +54,16 @@ export interface TaskDefaults {
54
54
  escalate_to?: string;
55
55
  circuit_breaker?: CircuitBreakerConfig;
56
56
  review?: 'auto' | 'fast' | 'panel' | 'none';
57
- review_stages?: boolean;
58
57
  reviewer_model?: string;
59
58
  review_budget?: number;
60
59
  on_review_budget_exceeded?: 'skip' | 'downgrade' | 'stop';
61
60
  max_concurrent_reviews?: number;
62
61
  review_heuristics?: ReviewHeuristics;
63
- detect_drift?: boolean;
64
62
  on_dispute?: 'continue' | 'stop';
65
63
  /** Maximum concurrent tasks in swarm mode (default: 8). */
66
64
  max_swarm_concurrency?: number;
67
65
  /** MCP servers available to tasks (Phase 19.7). */
68
66
  mcp_servers?: MCPServerConfig[];
69
- /** Auto-approve all MCP tool calls without prompting (Phase 19.7). */
70
- mcp_approve_all?: boolean;
71
67
  /** Timeout in seconds for MCP server approval prompts (Phase 19.7). */
72
68
  mcp_server_approval_timeout?: number;
73
69
  /** Browser test gate configuration for default built-in gates. */
@@ -84,7 +80,7 @@ export interface TaskSpec {
84
80
  adapter: string;
85
81
  tasks?: Task[];
86
82
  _verbose?: boolean;
87
- /** Spec schema version (1 for Convoy Engine format, 2 for pipeline chaining). */
83
+ /** Spec schema version: always 1 once parsed. */
88
84
  version?: number;
89
85
  /** Worker defaults merged into each task (Convoy Engine). */
90
86
  defaults?: TaskDefaults;
@@ -94,14 +90,10 @@ export interface TaskSpec {
94
90
  gate_retries?: number;
95
91
  /** Git feature branch name. */
96
92
  branch?: string;
97
- /** Other convoy spec names to run before this one (version: 2 pipeline specs). */
98
- depends_on_convoy?: string[];
99
93
  /** Optional post-convoy guard configuration. */
100
94
  guard?: GuardConfig;
101
95
  /** Post-convoy lifecycle hooks. */
102
96
  hooks?: Hook[];
103
- /** Watch mode configuration (Phase 17.1). */
104
- watch?: WatchConfig;
105
97
  }
106
98
 
107
99
  /** A single task in the spec. */
@@ -128,8 +120,6 @@ export interface Task {
128
120
  review?: 'auto' | 'fast' | 'panel' | 'none';
129
121
  /** Lifecycle hooks for this task. */
130
122
  hooks?: Hook[];
131
- /** Opt-in drift detection (streaming adapters only). */
132
- detect_drift?: boolean;
133
123
  /** Outputs this task produces as named artifacts. */
134
124
  outputs?: TaskOutput[];
135
125
  /** Inputs this task consumes from upstream task artifacts. */
@@ -140,49 +130,29 @@ export interface Task {
140
130
  browser_test?: BrowserTestConfig;
141
131
  }
142
132
 
143
- /** Task execution status. */
144
- export type TaskStatus =
145
- | 'pending'
146
- | 'running'
147
- | 'done'
148
- | 'failed'
149
- | 'gate-failed'
150
- | 'skipped'
151
- | 'timed-out';
152
-
153
- /** Result of a single task execution. */
154
- export interface TaskResult {
155
- id: string;
156
- status: TaskStatus;
157
- duration: number;
158
- output: string;
159
- exitCode: number;
160
- }
161
-
162
- /** Final run report. */
163
- export interface RunReport {
164
- name: string;
165
- startedAt: string;
166
- completedAt: string;
167
- duration: string;
168
- summary: RunSummary;
169
- tasks: TaskResult[];
170
- }
171
-
172
- /** Summary counts of task statuses. */
173
- export interface RunSummary {
174
- total: number;
175
- done: number;
176
- failed: number;
177
- skipped: number;
178
- 'timed-out': number;
179
- }
180
-
181
133
  /** Agent runtime adapter for the run command. */
182
134
  export interface AgentAdapter {
183
135
  name: string;
184
136
  isAvailable(): Promise<boolean>;
137
+ /**
138
+ * The runtime's own names for a model of each capability tier, used when a
139
+ * spec names no model. Only aliases the runtime keeps current (Claude Code's
140
+ * `opus`, `sonnet`, `haiku`) — never a dated model id, which would go stale.
141
+ * Without it the runtime's default model runs everything, and the default is
142
+ * often the most expensive one: a 30-line change cost $2 on it.
143
+ */
144
+ tierModels?: Partial<Record<'premium' | 'standard' | 'economy', string>>;
145
+ /**
146
+ * Run the task's prompt in `options.cwd` and settle once the agent is done.
147
+ * It enforces `task.timeout` itself, and a run that timed out or was killed
148
+ * resolves with `success: false`.
149
+ */
185
150
  execute(_task: Task, _options?: ExecuteOptions): Promise<ExecuteResult>;
151
+ /**
152
+ * Stop whatever is running for this task id — including a step running under
153
+ * a copy of the task — and every process it started. Does nothing when
154
+ * nothing is running.
155
+ */
186
156
  kill?(_task: Task): void;
187
157
  /** Whether the adapter supports reusing sessions across multi-step task steps. Defaults to false. */
188
158
  supportsSessionContinuity?(): boolean;
@@ -204,17 +174,36 @@ export interface ExecuteOptions {
204
174
  * which adapter honours which.
205
175
  */
206
176
  permissionMode?: PermissionMode;
207
- /** MCP servers to make available during execution (Phase 19.7). */
177
+ /** A model name the runtime understands; omitted means the runtime's own default. */
178
+ model?: string;
179
+ /**
180
+ * @deprecated Ignored. Agents read the project's own MCP config, which
181
+ * `opencastle sync` compiles for every assistant; writing a second copy
182
+ * deleted a committed `mcp.json` and dropped its `env`.
183
+ */
208
184
  mcpServers?: MCPServerConfig[];
209
- /** Automatically approve all MCP permission requests. */
185
+ /** @deprecated Ignored, with `mcpServers`. */
210
186
  mcp_approve_all?: boolean;
211
187
  }
212
188
 
213
- /** Token usage data from adapter execution. */
189
+ /**
190
+ * Token usage data from adapter execution, as the runtime reported it. A field
191
+ * the runtime did not report is left unset rather than estimated.
192
+ */
214
193
  export interface TokenUsage {
194
+ /**
195
+ * Every input token, cached or not: cache reads and writes are included here
196
+ * and also given apart below. Claude Code, Cursor and OpenCode report them
197
+ * separately, so their adapters add them in; Codex already includes them.
198
+ */
215
199
  prompt_tokens?: number;
200
+ /** Output tokens, reasoning included. */
216
201
  completion_tokens?: number;
217
202
  total_tokens?: number;
203
+ /** Input tokens read from the runtime's prompt cache. */
204
+ cache_read_tokens?: number;
205
+ /** Input tokens written to the runtime's prompt cache. */
206
+ cache_write_tokens?: number;
218
207
  }
219
208
 
220
209
  /** Result from an agent adapter execution. */
@@ -226,49 +215,10 @@ export interface ExecuteResult {
226
215
  taskId?: string;
227
216
  /** Token usage data if available from the adapter. */
228
217
  usage?: TokenUsage;
229
- }
230
-
231
- /** Reporter interface for the run command. */
232
- export interface Reporter {
233
- onTaskStart(_task: Task): void;
234
- onTaskDone(_task: Task, _result: TaskResult): void;
235
- onTaskSkipped(_task: Task, _reason: string): void;
236
- onPhaseStart(_phase: number, _tasks: Task[]): void;
237
- onComplete(_report: RunReport): Promise<void>;
238
- }
239
-
240
- /** Reporter options. */
241
- export interface ReporterOptions {
242
- reportDir?: string;
243
- verbose?: boolean;
244
- }
245
-
246
- /** Parsed CLI args for the run command. */
247
- export interface RunOptions {
248
- file: string;
249
- dryRun: boolean;
250
- concurrency: number | null;
251
- adapter: string | null;
252
- reportDir: string | null;
253
- permissionMode: PermissionMode | null;
254
- verbose: boolean;
255
- help: boolean;
256
- resume: boolean;
257
- status: boolean;
258
- retryFailed: boolean;
259
- retryFailedTaskIds?: string[];
260
- dlqList: boolean;
261
- dlqResolve: boolean;
262
- dlqResolveId?: string;
263
- dlqResolveText?: string;
264
- dlqRetry: boolean;
265
- dlqRetryId?: string;
266
- dlqConvoyFilter?: string;
267
- formula: string | null;
268
- setVars: Record<string, string>;
269
- watch: boolean;
270
- watchConfig: string | null;
271
- clearScratchpad: boolean;
218
+ /** Cost as the runtime reported it. Undefined when it reports none — never guessed here. */
219
+ costUsd?: number;
220
+ /** The model the runtime actually used, when it says. */
221
+ model?: string;
272
222
  }
273
223
 
274
224
  /** Validation result. */
@@ -278,15 +228,3 @@ export interface ValidationResult {
278
228
  /** Accepted, but ignored — a retired key, or one this build does not honour. */
279
229
  warnings?: string[];
280
230
  }
281
-
282
- /** Timeout promise with cancel ability. */
283
- export interface TimeoutHandle {
284
- promise: Promise<ExecuteResult>;
285
- clear: () => void;
286
- }
287
-
288
- /** Executor returned by createExecutor. */
289
- export interface Executor {
290
- run(): Promise<RunReport>;
291
- getPhases(): Task[][];
292
- }
@@ -99,11 +99,11 @@ describe('DB creation', () => {
99
99
  expect(row.journal_mode).toBe('wal')
100
100
  })
101
101
 
102
- it('sets schema version to 13', () => {
102
+ it('sets schema version to 14', () => {
103
103
  const db = new DatabaseSync(dbPath)
104
104
  const row = db.prepare('PRAGMA user_version').get() as { user_version: number }
105
105
  db.close()
106
- expect(row.user_version).toBe(13)
106
+ expect(row.user_version).toBe(14)
107
107
  })
108
108
 
109
109
  it('creates all required tables', () => {
@@ -131,7 +131,7 @@ describe('DB creation', () => {
131
131
  store2.close()
132
132
  // Reassign so afterEach does not double-close
133
133
  store = createConvoyStore(dbPath)
134
- expect(row.user_version).toBe(13)
134
+ expect(row.user_version).toBe(14)
135
135
  })
136
136
  })
137
137
 
@@ -208,8 +208,8 @@ describe('schema migration', () => {
208
208
  verifyDb.close()
209
209
 
210
210
  expect(cols.map(c => c.name)).toContain('adapter')
211
- // v1 chains through v2→v3→v4→...→v10→v11→v12→v13 in one init, so final version is 13
212
- expect(version.user_version).toBe(13)
211
+ // v1 chains through v2→v3→v4→...→v12→v13→v14 in one init, so final version is 14
212
+ expect(version.user_version).toBe(14)
213
213
  })
214
214
 
215
215
  it('schema migration v2 to v3 adds cost columns', () => {
@@ -295,7 +295,7 @@ describe('schema migration', () => {
295
295
  expect(convoyColNames).toContain('total_tokens')
296
296
  expect(convoyColNames).toContain('total_cost_usd')
297
297
 
298
- expect(version.user_version).toBe(13)
298
+ expect(version.user_version).toBe(14)
299
299
  })
300
300
 
301
301
  it('schema migration v1 to v3 chains correctly in a single init', () => {
@@ -381,7 +381,7 @@ describe('schema migration', () => {
381
381
  expect(convoyColNames).toContain('total_tokens')
382
382
  expect(convoyColNames).toContain('total_cost_usd')
383
383
 
384
- expect(version.user_version).toBe(13)
384
+ expect(version.user_version).toBe(14)
385
385
  })
386
386
 
387
387
  it('schema migration v3 to v4 creates pipeline table and adds pipeline_id to convoy', () => {
@@ -464,7 +464,7 @@ describe('schema migration', () => {
464
464
 
465
465
  expect(convoyCols.map(c => c.name)).toContain('pipeline_id')
466
466
  expect(tables.map(t => t.name)).toContain('pipeline')
467
- expect(version.user_version).toBe(13)
467
+ expect(version.user_version).toBe(14)
468
468
  })
469
469
  })
470
470
 
@@ -1458,7 +1458,7 @@ describe('schema migration v5 → v6', () => {
1458
1458
  v5Verify.close()
1459
1459
  migratedStore.close()
1460
1460
 
1461
- expect(row.user_version).toBe(13)
1461
+ expect(row.user_version).toBe(14)
1462
1462
  expect(taskStepTable?.name).toBe('task_step')
1463
1463
  expect(convoy?.id).toBe('convoy-auto')
1464
1464
  expect(task?.id).toBe('task-auto')
@@ -1628,7 +1628,7 @@ describe('schema migration v6→v7 (drift detection columns)', () => {
1628
1628
 
1629
1629
  expect(cols.map(c => c.name)).toContain('drift_score')
1630
1630
  expect(cols.map(c => c.name)).toContain('drift_retried')
1631
- expect(version.user_version).toBe(13)
1631
+ expect(version.user_version).toBe(14)
1632
1632
  })
1633
1633
 
1634
1634
  it('new databases include drift_score and drift_retried in CREATE TABLE', () => {
@@ -1862,7 +1862,7 @@ describe('migration full chain v4→v10', () => {
1862
1862
  const verifyDb = new DatabaseSync(chainDbPath)
1863
1863
  verifyDb.exec('PRAGMA foreign_keys = 0')
1864
1864
  const version = (verifyDb.prepare('PRAGMA user_version').get() as { user_version: number }).user_version
1865
- expect(version).toBe(13)
1865
+ expect(version).toBe(14)
1866
1866
 
1867
1867
  // Verify all new tables exist
1868
1868
  const tables = (verifyDb.prepare("SELECT name FROM sqlite_master WHERE type='table'").all() as Array<{ name: string }>).map(t => t.name)
@@ -1959,7 +1959,7 @@ describe('migration v12 → v13', () => {
1959
1959
 
1960
1960
  expect(cols).not.toContain('compaction_count')
1961
1961
  expect(cols).not.toContain('discovered_issues')
1962
- expect(version).toBe(13)
1962
+ expect(version).toBe(14)
1963
1963
 
1964
1964
  // The rows, and the fields beside the dropped ones, survive the rewrite.
1965
1965
  expect(convoy?.name).toBe('Kept')
@@ -1983,6 +1983,57 @@ describe('migration v12 → v13', () => {
1983
1983
  })
1984
1984
  })
1985
1985
 
1986
+ describe('migration v13 → v14', () => {
1987
+ it('adds the spend, retry-note and kept-branch columns to a v13 database', () => {
1988
+ const path = join(tmpDir, 'v13-to-v14.db')
1989
+ const seeded = createConvoyStore(path)
1990
+ seeded.insertConvoy(makeConvoy({ id: 'c1' }))
1991
+ seeded.insertTask(makeTask({ id: 't1', convoy_id: 'c1' }))
1992
+ seeded.close()
1993
+
1994
+ // Take the new columns away again, as a v13 database would not have them.
1995
+ const raw = new DatabaseSync(path)
1996
+ for (const col of ['cache_read_tokens', 'cache_write_tokens', 'cost_estimated', 'retry_note', 'branch']) {
1997
+ raw.exec(`ALTER TABLE task DROP COLUMN ${col}`)
1998
+ }
1999
+ raw.exec('ALTER TABLE convoy DROP COLUMN base_ref')
2000
+ raw.exec('ALTER TABLE convoy DROP COLUMN cost_estimated')
2001
+ raw.exec('ALTER TABLE convoy DROP COLUMN adapter')
2002
+ raw.exec('PRAGMA user_version = 13')
2003
+ raw.close()
2004
+
2005
+ const migrated = createConvoyStore(path)
2006
+ migrated.updateTaskStatus('t1', 'c1', 'failed', {
2007
+ cache_read_tokens: 10,
2008
+ cache_write_tokens: 2,
2009
+ cost_estimated: 1,
2010
+ retry_note: 'gate failed',
2011
+ branch: 'convoy-abc-t1-1',
2012
+ })
2013
+ migrated.updateConvoyBranch('c1', 'convoy/x-abc123', 'main')
2014
+ const t1 = migrated.getTask('t1', 'c1')!
2015
+ const convoy = migrated.getConvoy('c1')!
2016
+ migrated.close()
2017
+
2018
+ expect(t1).toMatchObject({
2019
+ cache_read_tokens: 10,
2020
+ cache_write_tokens: 2,
2021
+ cost_estimated: 1,
2022
+ retry_note: 'gate failed',
2023
+ branch: 'convoy-abc-t1-1',
2024
+ })
2025
+ expect(convoy.branch).toBe('convoy/x-abc123')
2026
+ expect(convoy.base_ref).toBe('main')
2027
+ expect(convoy.cost_estimated).toBe(0)
2028
+ expect(convoy).toHaveProperty('adapter', null)
2029
+ })
2030
+
2031
+ it('records the runtime a run used', () => {
2032
+ store.insertConvoy({ ...makeConvoy({ id: 'c-adapter' }), adapter: 'codex' })
2033
+ expect(store.getConvoy('c-adapter')?.adapter).toBe('codex')
2034
+ })
2035
+ })
2036
+
1986
2037
  // ── Agent Identity ────────────────────────────────────────────────────────────
1987
2038
 
1988
2039
  describe('agent identity', () => {
@@ -2615,7 +2666,7 @@ describe('v9→v10 migration', () => {
2615
2666
  // Verify version = 11
2616
2667
  const verifyDb = new DatabaseSync(migDb)
2617
2668
  const version = (verifyDb.prepare('PRAGMA user_version').get() as { user_version: number }).user_version
2618
- expect(version).toBe(13)
2669
+ expect(version).toBe(14)
2619
2670
 
2620
2671
  // Verify new REAL columns exist
2621
2672
  const convoyCols = (verifyDb.prepare('PRAGMA table_info(convoy)').all() as Array<{ name: string }>).map(c => c.name)
@@ -17,7 +17,7 @@ import type {
17
17
  TaskStepRecord,
18
18
  } from './types.js'
19
19
 
20
- const SCHEMA_VERSION = 13
20
+ const SCHEMA_VERSION = 14
21
21
 
22
22
  // ── Size limits (bytes) ────────────────────────────────────────────────────────
23
23
  const LIMIT_SPEC_YAML = 256 * 1024 // 256 KB
@@ -58,6 +58,24 @@ export class ConvoyArtifactLimitError extends Error {
58
58
  }
59
59
  }
60
60
 
61
+ /** Columns a status change may set alongside the status. */
62
+ export type TaskStatusExtra = Partial<
63
+ Pick<
64
+ TaskRecord,
65
+ | 'worker_id' | 'worktree' | 'output' | 'exit_code' | 'started_at' | 'finished_at'
66
+ | 'retries' | 'prompt_tokens' | 'completion_tokens' | 'total_tokens' | 'cost_usd' | 'prompt'
67
+ | 'contract_result' | 'model' | 'cache_read_tokens' | 'cache_write_tokens' | 'cost_estimated'
68
+ | 'retry_note' | 'branch'
69
+ >
70
+ >
71
+
72
+ const TASK_EXTRA_FIELDS = [
73
+ 'worker_id', 'worktree', 'output', 'exit_code', 'started_at', 'finished_at',
74
+ 'retries', 'prompt_tokens', 'completion_tokens', 'total_tokens', 'cost_usd', 'prompt',
75
+ 'contract_result', 'model', 'cache_read_tokens', 'cache_write_tokens', 'cost_estimated',
76
+ 'retry_note', 'branch',
77
+ ] as const
78
+
61
79
  export interface ConvoyStore {
62
80
  insertConvoy(
63
81
  record: Omit<
@@ -73,8 +91,16 @@ export interface ConvoyStore {
73
91
  updateConvoyStatus(
74
92
  id: string,
75
93
  status: ConvoyStatus,
76
- extra?: { started_at?: string; finished_at?: string; total_tokens?: number | null; total_cost_usd?: number | null },
94
+ extra?: {
95
+ started_at?: string
96
+ finished_at?: string
97
+ total_tokens?: number | null
98
+ total_cost_usd?: number | null
99
+ cost_estimated?: boolean
100
+ },
77
101
  ): void
102
+ /** Record the branch a convoy works on, and what it was cut from. */
103
+ updateConvoyBranch(id: string, branch: string, baseRef: string | null): void
78
104
  updateConvoyReviewTokens(convoyId: string, tokens: number): void
79
105
  updateConvoyCircuitState(convoyId: string, state: string | null): void
80
106
  insertTask(
@@ -98,14 +124,7 @@ export interface ConvoyStore {
98
124
  id: string,
99
125
  convoyId: string,
100
126
  status: ConvoyTaskStatus,
101
- extra?: Partial<
102
- Pick<
103
- TaskRecord,
104
- | 'worker_id' | 'worktree' | 'output' | 'exit_code' | 'started_at' | 'finished_at'
105
- | 'retries' | 'prompt_tokens' | 'completion_tokens' | 'total_tokens' | 'cost_usd' | 'prompt'
106
- | 'contract_result' | 'model'
107
- >
108
- >,
127
+ extra?: TaskStatusExtra,
109
128
  ): void
110
129
  updateTaskReview(
111
130
  taskId: string,
@@ -205,7 +224,10 @@ class ConvoyStoreImpl implements ConvoyStore {
205
224
  pipeline_id TEXT,
206
225
  circuit_state TEXT,
207
226
  review_tokens_total INTEGER,
208
- review_budget INTEGER
227
+ review_budget INTEGER,
228
+ base_ref TEXT,
229
+ cost_estimated INTEGER NOT NULL DEFAULT 0,
230
+ adapter TEXT
209
231
  );
210
232
 
211
233
  CREATE TABLE IF NOT EXISTS pipeline (
@@ -266,6 +288,11 @@ class ConvoyStoreImpl implements ConvoyStore {
266
288
  outputs TEXT,
267
289
  inputs TEXT,
268
290
  contract_result TEXT,
291
+ cache_read_tokens INTEGER,
292
+ cache_write_tokens INTEGER,
293
+ cost_estimated INTEGER NOT NULL DEFAULT 0,
294
+ retry_note TEXT,
295
+ branch TEXT,
269
296
  PRIMARY KEY (id, convoy_id)
270
297
  );
271
298
 
@@ -433,6 +460,10 @@ class ConvoyStoreImpl implements ConvoyStore {
433
460
  migrateSchema(this.db, this.dbPath, 12, 13)
434
461
  version = 13
435
462
  }
463
+ if (version === 13) {
464
+ migrateSchema(this.db, this.dbPath, 13, 14)
465
+ version = 14
466
+ }
436
467
  }
437
468
 
438
469
  insertConvoy(
@@ -447,12 +478,29 @@ class ConvoyStoreImpl implements ConvoyStore {
447
478
  .prepare(
448
479
  `INSERT INTO convoy
449
480
  (id, name, spec_hash, status, branch, created_at, started_at, finished_at,
450
- spec_yaml, pipeline_id)
481
+ spec_yaml, pipeline_id, base_ref, adapter)
451
482
  VALUES
452
483
  (:id, :name, :spec_hash, :status, :branch, :created_at, NULL, NULL,
453
- :spec_yaml, :pipeline_id)`,
484
+ :spec_yaml, :pipeline_id, :base_ref, :adapter)`,
454
485
  )
455
- .run({ ...record, pipeline_id: record.pipeline_id ?? null })
486
+ .run({
487
+ id: record.id,
488
+ name: record.name,
489
+ spec_hash: record.spec_hash,
490
+ status: record.status,
491
+ branch: record.branch,
492
+ created_at: record.created_at,
493
+ spec_yaml: record.spec_yaml,
494
+ pipeline_id: record.pipeline_id ?? null,
495
+ base_ref: record.base_ref ?? null,
496
+ adapter: record.adapter ?? null,
497
+ })
498
+ }
499
+
500
+ updateConvoyBranch(id: string, branch: string, baseRef: string | null): void {
501
+ this.db
502
+ .prepare('UPDATE convoy SET branch = :branch, base_ref = :base_ref WHERE id = :id')
503
+ .run({ id, branch, base_ref: baseRef })
456
504
  }
457
505
 
458
506
  getConvoy(id: string): ConvoyRecord | undefined {
@@ -487,11 +535,22 @@ class ConvoyStoreImpl implements ConvoyStore {
487
535
  updateConvoyStatus(
488
536
  id: string,
489
537
  status: ConvoyStatus,
490
- extra?: { started_at?: string; finished_at?: string; total_tokens?: number | null; total_cost_usd?: number | null },
538
+ extra?: {
539
+ started_at?: string
540
+ finished_at?: string
541
+ total_tokens?: number | null
542
+ total_cost_usd?: number | null
543
+ cost_estimated?: boolean
544
+ },
491
545
  ): void {
492
546
  const sets = ['status = :status']
493
547
  const params: Record<string, string | number | null> = { id, status }
494
548
 
549
+ if (extra?.cost_estimated !== undefined) {
550
+ sets.push('cost_estimated = :cost_estimated')
551
+ params.cost_estimated = extra.cost_estimated ? 1 : 0
552
+ }
553
+
495
554
  if (extra?.started_at !== undefined) {
496
555
  sets.push('started_at = :started_at')
497
556
  params.started_at = extra.started_at
@@ -569,7 +628,7 @@ class ConvoyStoreImpl implements ConvoyStore {
569
628
  on_exhausted, injected, provenance, idempotency_key,
570
629
  current_step, total_steps, review_level, review_verdict,
571
630
  review_tokens, review_model, panel_attempts, dispute_id,
572
- drift_score, drift_retried, outputs, inputs, discovered_issues)
631
+ drift_score, drift_retried, outputs, inputs)
573
632
  VALUES
574
633
  (:id, :convoy_id, :phase, :prompt, :agent, :adapter, :model, :timeout_ms, :status,
575
634
  :worker_id, :worktree, :output, :exit_code, :started_at, :finished_at,
@@ -577,9 +636,49 @@ class ConvoyStoreImpl implements ConvoyStore {
577
636
  :on_exhausted, :injected, :provenance, :idempotency_key,
578
637
  :current_step, :total_steps, :review_level, :review_verdict,
579
638
  :review_tokens, :review_model, :panel_attempts, :dispute_id,
580
- :drift_score, :drift_retried, :outputs, :inputs, :discovered_issues)`,
639
+ :drift_score, :drift_retried, :outputs, :inputs)`,
581
640
  )
582
- .run(record as unknown as Record<string, string | number | null>)
641
+ // `discovered_issues` was in this list after migration 12 dropped the
642
+ // column, so every injected task failed to insert. Named parameters are
643
+ // passed explicitly now, so an extra key on the record cannot break it.
644
+ .run({
645
+ id: record.id,
646
+ convoy_id: record.convoy_id,
647
+ phase: record.phase,
648
+ prompt: record.prompt,
649
+ agent: record.agent,
650
+ adapter: record.adapter,
651
+ model: record.model,
652
+ timeout_ms: record.timeout_ms,
653
+ status: record.status,
654
+ worker_id: record.worker_id,
655
+ worktree: record.worktree,
656
+ output: record.output,
657
+ exit_code: record.exit_code,
658
+ started_at: record.started_at,
659
+ finished_at: record.finished_at,
660
+ retries: record.retries,
661
+ max_retries: record.max_retries,
662
+ files: record.files,
663
+ depends_on: record.depends_on,
664
+ gates: record.gates,
665
+ on_exhausted: record.on_exhausted,
666
+ injected: record.injected,
667
+ provenance: record.provenance,
668
+ idempotency_key: record.idempotency_key,
669
+ current_step: record.current_step,
670
+ total_steps: record.total_steps,
671
+ review_level: record.review_level,
672
+ review_verdict: record.review_verdict,
673
+ review_tokens: record.review_tokens,
674
+ review_model: record.review_model,
675
+ panel_attempts: record.panel_attempts,
676
+ dispute_id: record.dispute_id,
677
+ drift_score: record.drift_score,
678
+ drift_retried: record.drift_retried,
679
+ outputs: record.outputs ?? null,
680
+ inputs: record.inputs ?? null,
681
+ })
583
682
  }
584
683
 
585
684
  getTask(id: string, convoyId: string): TaskRecord | undefined {
@@ -621,28 +720,16 @@ class ConvoyStoreImpl implements ConvoyStore {
621
720
  id: string,
622
721
  convoyId: string,
623
722
  status: ConvoyTaskStatus,
624
- extra?: Partial<
625
- Pick<
626
- TaskRecord,
627
- | 'worker_id' | 'worktree' | 'output' | 'exit_code' | 'started_at' | 'finished_at'
628
- | 'retries' | 'prompt_tokens' | 'completion_tokens' | 'total_tokens' | 'cost_usd' | 'prompt'
629
- | 'contract_result' | 'model'
630
- >
631
- >,
723
+ extra?: TaskStatusExtra,
632
724
  ): void {
633
725
  if (extra?.output !== undefined) {
634
726
  extra = { ...extra, output: truncateOutput(extra.output) }
635
727
  }
636
728
  const sets = ['status = :status']
637
729
  const params: Record<string, string | number | null> = { id, convoy_id: convoyId, status }
638
- const extraFields = [
639
- 'worker_id', 'worktree', 'output', 'exit_code', 'started_at', 'finished_at',
640
- 'retries', 'prompt_tokens', 'completion_tokens', 'total_tokens', 'cost_usd', 'prompt',
641
- 'contract_result', 'model',
642
- ] as const
643
730
 
644
731
  if (extra) {
645
- for (const field of extraFields) {
732
+ for (const field of TASK_EXTRA_FIELDS) {
646
733
  if (field in extra && extra[field] !== undefined) {
647
734
  sets.push(`${field} = :${field}`)
648
735
  params[field] = extra[field] as string | number | null
@@ -1126,7 +1213,7 @@ class ConvoyStoreImpl implements ConvoyStore {
1126
1213
  SUM(CASE WHEN status IN ('failed', 'gate-failed', 'timed-out', 'hook-failed') THEN 1 ELSE 0 END) AS failed,
1127
1214
  SUM(CASE WHEN status = 'review-blocked' THEN 1 ELSE 0 END) AS review_blocked,
1128
1215
  SUM(CASE WHEN status = 'disputed' THEN 1 ELSE 0 END) AS disputed,
1129
- SUM(CASE WHEN review_verdict IS NOT NULL THEN 1 ELSE 0 END) AS reviewed,
1216
+ SUM(CASE WHEN review_verdict IN ('pass', 'block') AND review_level != 'auto-pass' THEN 1 ELSE 0 END) AS reviewed,
1130
1217
  SUM(CASE WHEN panel_attempts > 0 THEN 1 ELSE 0 END) AS panel_reviewed,
1131
1218
  SUM(CASE WHEN drift_score IS NOT NULL THEN 1 ELSE 0 END) AS tasks_with_drift,
1132
1219
  MAX(drift_score) AS max_drift_score,
@@ -1260,6 +1347,11 @@ class ConvoyStoreImpl implements ConvoyStore {
1260
1347
  }
1261
1348
  }
1262
1349
 
1350
+ function addColumnIfMissing(db: DatabaseSync, table: string, column: string, ddl: string): void {
1351
+ const cols = (db.prepare(`PRAGMA table_info(${table})`).all() as Array<{ name: string }>).map(c => c.name)
1352
+ if (!cols.includes(column)) db.exec(`ALTER TABLE ${table} ADD COLUMN ${column} ${ddl}`)
1353
+ }
1354
+
1263
1355
  export function migrateSchema(db: DatabaseSync, dbPath: string, fromVersion: number, toVersion: number): void {
1264
1356
  for (let v = fromVersion; v < toVersion; v++) {
1265
1357
  const backupPath = `${dbPath}.v${v}.bak`
@@ -1455,6 +1547,24 @@ export function migrateSchema(db: DatabaseSync, dbPath: string, fromVersion: num
1455
1547
  ALTER TABLE task DROP COLUMN discovered_issues;
1456
1548
  `)
1457
1549
  }
1550
+ if (v === 13) {
1551
+ // What a run actually spent, and what it could not merge.
1552
+ //
1553
+ // Cost used to be priced from the adapter's *name* and stored as if the
1554
+ // runtime had reported it; cache tokens were dropped. A retry rewrote the
1555
+ // task's prompt in place, so every attempt stacked another banner on the
1556
+ // last. And a merge failure deleted the branch holding the work.
1557
+ // Each column is added only if missing, so a database whose user_version
1558
+ // was wound back over a newer schema still migrates.
1559
+ addColumnIfMissing(db, 'task', 'cache_read_tokens', 'INTEGER')
1560
+ addColumnIfMissing(db, 'task', 'cache_write_tokens', 'INTEGER')
1561
+ addColumnIfMissing(db, 'task', 'cost_estimated', 'INTEGER NOT NULL DEFAULT 0')
1562
+ addColumnIfMissing(db, 'task', 'retry_note', 'TEXT')
1563
+ addColumnIfMissing(db, 'task', 'branch', 'TEXT')
1564
+ addColumnIfMissing(db, 'convoy', 'base_ref', 'TEXT')
1565
+ addColumnIfMissing(db, 'convoy', 'cost_estimated', 'INTEGER NOT NULL DEFAULT 0')
1566
+ addColumnIfMissing(db, 'convoy', 'adapter', 'TEXT')
1567
+ }
1458
1568
  db.exec('COMMIT')
1459
1569
  } catch (err) {
1460
1570
  try { db.exec('ROLLBACK') } catch { /* ignore */ }