agentplane 0.3.12 → 0.3.14

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 (376) hide show
  1. package/assets/RUNNER.md +1 -1
  2. package/assets/agents/ORCHESTRATOR.json +1 -1
  3. package/assets/agents/SKILL_EXTRACTOR.json +31 -0
  4. package/assets/codex-plugin/assets/header.png +0 -0
  5. package/assets/codex-plugin/assets/icon.svg +1 -0
  6. package/assets/codex-plugin/assets/logo.svg +1 -0
  7. package/assets/codex-plugin/skills/agentplane/SKILL.md +35 -0
  8. package/assets/framework.manifest.json +7 -0
  9. package/assets/policy/governance.md +4 -2
  10. package/assets/policy/incidents.md +4 -19
  11. package/assets/policy/workflow.branch_pr.md +10 -5
  12. package/assets/policy/workflow.release.md +5 -2
  13. package/dist/.build-manifest.json +409 -219
  14. package/dist/cli/exit-codes.d.ts.map +1 -1
  15. package/dist/cli/exit-codes.js +1 -0
  16. package/dist/cli/output.d.ts +29 -0
  17. package/dist/cli/output.d.ts.map +1 -1
  18. package/dist/cli/output.js +33 -0
  19. package/dist/cli/reason-codes.d.ts +1 -1
  20. package/dist/cli/reason-codes.d.ts.map +1 -1
  21. package/dist/cli/reason-codes.js +12 -0
  22. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  23. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  24. package/dist/cli/run-cli/command-catalog/core.js +36 -78
  25. package/dist/cli/run-cli/command-catalog/lifecycle.d.ts.map +1 -1
  26. package/dist/cli/run-cli/command-catalog/lifecycle.js +4 -12
  27. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  28. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  29. package/dist/cli/run-cli/command-catalog/project.js +27 -31
  30. package/dist/cli/run-cli/command-catalog/shared.d.ts +9 -6
  31. package/dist/cli/run-cli/command-catalog/shared.d.ts.map +1 -1
  32. package/dist/cli/run-cli/command-catalog/shared.js +23 -6
  33. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  34. package/dist/cli/run-cli/command-catalog/task.js +6 -18
  35. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  36. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/codex.d.ts +14 -0
  38. package/dist/cli/run-cli/commands/codex.d.ts.map +1 -0
  39. package/dist/cli/run-cli/commands/codex.js +100 -0
  40. package/dist/cli/run-cli/commands/core.d.ts +1 -0
  41. package/dist/cli/run-cli/commands/core.d.ts.map +1 -1
  42. package/dist/cli/run-cli/commands/core.js +1 -0
  43. package/dist/cli/run-cli/commands/init/recipes.d.ts +9 -1
  44. package/dist/cli/run-cli/commands/init/recipes.d.ts.map +1 -1
  45. package/dist/cli/run-cli/commands/init/recipes.js +33 -22
  46. package/dist/cli/run-cli/commands/init.d.ts.map +1 -1
  47. package/dist/cli/run-cli/commands/init.js +26 -21
  48. package/dist/cli/run-cli/error-guidance.js +20 -0
  49. package/dist/cli/run-cli.js +1 -1
  50. package/dist/cli/run-cli.test-helpers.d.ts +1 -74
  51. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  52. package/dist/cli/run-cli.test-helpers.js +1 -766
  53. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  54. package/dist/commands/branch/cleanup-merged.js +5 -9
  55. package/dist/commands/branch/work-start.command.d.ts.map +1 -1
  56. package/dist/commands/branch/work-start.command.js +1 -0
  57. package/dist/commands/codex/plugin-install.d.ts +26 -0
  58. package/dist/commands/codex/plugin-install.d.ts.map +1 -0
  59. package/dist/commands/codex/plugin-install.js +209 -0
  60. package/dist/commands/commit.spec.d.ts.map +1 -1
  61. package/dist/commands/commit.spec.js +2 -0
  62. package/dist/commands/doctor/branch-pr.d.ts +1 -1
  63. package/dist/commands/doctor/branch-pr.d.ts.map +1 -1
  64. package/dist/commands/doctor/branch-pr.js +5 -2
  65. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  66. package/dist/commands/guard/impl/commands.js +4 -1
  67. package/dist/commands/guard/impl/comment-commit.d.ts.map +1 -1
  68. package/dist/commands/guard/impl/comment-commit.js +2 -1
  69. package/dist/commands/guard/impl/env.d.ts +6 -0
  70. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  71. package/dist/commands/guard/impl/env.js +41 -0
  72. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  73. package/dist/commands/pr/integrate/cmd.js +81 -5
  74. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  75. package/dist/commands/pr/integrate/internal/prepare.js +38 -7
  76. package/dist/commands/pr/internal/auto-commit.d.ts.map +1 -1
  77. package/dist/commands/pr/internal/auto-commit.js +13 -7
  78. package/dist/commands/pr/internal/sync-branch.d.ts +36 -0
  79. package/dist/commands/pr/internal/sync-branch.d.ts.map +1 -0
  80. package/dist/commands/pr/internal/sync-branch.js +113 -0
  81. package/dist/commands/pr/internal/sync-github.d.ts +28 -0
  82. package/dist/commands/pr/internal/sync-github.d.ts.map +1 -0
  83. package/dist/commands/pr/internal/sync-github.js +178 -0
  84. package/dist/commands/pr/internal/sync-model.d.ts +36 -0
  85. package/dist/commands/pr/internal/sync-model.d.ts.map +1 -0
  86. package/dist/commands/pr/internal/sync-model.js +1 -0
  87. package/dist/commands/pr/internal/sync-open-step.d.ts +10 -0
  88. package/dist/commands/pr/internal/sync-open-step.d.ts.map +1 -0
  89. package/dist/commands/pr/internal/sync-open-step.js +128 -0
  90. package/dist/commands/pr/internal/sync-support.d.ts +7 -0
  91. package/dist/commands/pr/internal/sync-support.d.ts.map +1 -0
  92. package/dist/commands/pr/internal/sync-support.js +29 -0
  93. package/dist/commands/pr/internal/sync-update-step.d.ts +6 -0
  94. package/dist/commands/pr/internal/sync-update-step.d.ts.map +1 -0
  95. package/dist/commands/pr/internal/sync-update-step.js +68 -0
  96. package/dist/commands/pr/internal/sync.d.ts +2 -6
  97. package/dist/commands/pr/internal/sync.d.ts.map +1 -1
  98. package/dist/commands/pr/internal/sync.js +83 -525
  99. package/dist/commands/pr/open.d.ts.map +1 -1
  100. package/dist/commands/pr/open.js +62 -7
  101. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  102. package/dist/commands/pr/pr.command.js +7 -2
  103. package/dist/commands/recipes/active.command.d.ts +7 -0
  104. package/dist/commands/recipes/active.command.d.ts.map +1 -0
  105. package/dist/commands/recipes/active.command.js +12 -0
  106. package/dist/commands/recipes/add.command.d.ts +8 -0
  107. package/dist/commands/recipes/add.command.d.ts.map +1 -0
  108. package/dist/commands/recipes/add.command.js +33 -0
  109. package/dist/commands/recipes/detach.command.d.ts +7 -0
  110. package/dist/commands/recipes/detach.command.d.ts.map +1 -0
  111. package/dist/commands/recipes/detach.command.js +19 -0
  112. package/dist/commands/recipes/disable.command.d.ts +7 -0
  113. package/dist/commands/recipes/disable.command.d.ts.map +1 -0
  114. package/dist/commands/recipes/disable.command.js +10 -0
  115. package/dist/commands/recipes/enable.command.d.ts +7 -0
  116. package/dist/commands/recipes/enable.command.d.ts.map +1 -0
  117. package/dist/commands/recipes/enable.command.js +10 -0
  118. package/dist/commands/recipes/explain-active.command.d.ts +5 -0
  119. package/dist/commands/recipes/explain-active.command.d.ts.map +1 -0
  120. package/dist/commands/recipes/explain-active.command.js +11 -0
  121. package/dist/commands/recipes/explain.command.d.ts.map +1 -1
  122. package/dist/commands/recipes/explain.command.js +4 -2
  123. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  124. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  125. package/dist/commands/recipes/impl/apply.js +34 -16
  126. package/dist/commands/recipes/impl/commands/active.d.ts +6 -0
  127. package/dist/commands/recipes/impl/commands/active.d.ts.map +1 -0
  128. package/dist/commands/recipes/impl/commands/active.js +47 -0
  129. package/dist/commands/recipes/impl/commands/add.d.ts +8 -0
  130. package/dist/commands/recipes/impl/commands/add.d.ts.map +1 -0
  131. package/dist/commands/recipes/impl/commands/add.js +105 -0
  132. package/dist/commands/recipes/impl/commands/detach.d.ts +6 -0
  133. package/dist/commands/recipes/impl/commands/detach.d.ts.map +1 -0
  134. package/dist/commands/recipes/impl/commands/detach.js +99 -0
  135. package/dist/commands/recipes/impl/commands/disable.d.ts +6 -0
  136. package/dist/commands/recipes/impl/commands/disable.d.ts.map +1 -0
  137. package/dist/commands/recipes/impl/commands/disable.js +23 -0
  138. package/dist/commands/recipes/impl/commands/enable.d.ts +6 -0
  139. package/dist/commands/recipes/impl/commands/enable.d.ts.map +1 -0
  140. package/dist/commands/recipes/impl/commands/enable.js +41 -0
  141. package/dist/commands/recipes/impl/commands/explain-active.d.ts +5 -0
  142. package/dist/commands/recipes/impl/commands/explain-active.d.ts.map +1 -0
  143. package/dist/commands/recipes/impl/commands/explain-active.js +20 -0
  144. package/dist/commands/recipes/impl/commands/explain.d.ts.map +1 -1
  145. package/dist/commands/recipes/impl/commands/explain.js +83 -36
  146. package/dist/commands/recipes/impl/commands/info.d.ts.map +1 -1
  147. package/dist/commands/recipes/impl/commands/info.js +39 -22
  148. package/dist/commands/recipes/impl/commands/install.d.ts +1 -1
  149. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  150. package/dist/commands/recipes/impl/commands/install.js +35 -42
  151. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  152. package/dist/commands/recipes/impl/commands/list-remote.js +2 -3
  153. package/dist/commands/recipes/impl/commands/list.d.ts.map +1 -1
  154. package/dist/commands/recipes/impl/commands/list.js +13 -12
  155. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  156. package/dist/commands/recipes/impl/commands/remove.js +12 -2
  157. package/dist/commands/recipes/impl/commands/update.d.ts +7 -0
  158. package/dist/commands/recipes/impl/commands/update.d.ts.map +1 -0
  159. package/dist/commands/recipes/impl/commands/update.js +107 -0
  160. package/dist/commands/recipes/impl/commands.d.ts +7 -0
  161. package/dist/commands/recipes/impl/commands.d.ts.map +1 -1
  162. package/dist/commands/recipes/impl/commands.js +7 -0
  163. package/dist/commands/recipes/impl/constants.d.ts +1 -14
  164. package/dist/commands/recipes/impl/constants.d.ts.map +1 -1
  165. package/dist/commands/recipes/impl/constants.js +1 -18
  166. package/dist/commands/recipes/impl/index.d.ts +1 -1
  167. package/dist/commands/recipes/impl/index.d.ts.map +1 -1
  168. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  169. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  170. package/dist/commands/recipes/impl/installed-recipes.js +1 -2
  171. package/dist/commands/recipes/impl/mutation-transaction.d.ts +7 -0
  172. package/dist/commands/recipes/impl/mutation-transaction.d.ts.map +1 -0
  173. package/dist/commands/recipes/impl/mutation-transaction.js +47 -0
  174. package/dist/commands/recipes/impl/overlay-project.d.ts +48 -0
  175. package/dist/commands/recipes/impl/overlay-project.d.ts.map +1 -0
  176. package/dist/commands/recipes/impl/overlay-project.js +320 -0
  177. package/dist/commands/recipes/impl/paths.d.ts +17 -2
  178. package/dist/commands/recipes/impl/paths.d.ts.map +1 -1
  179. package/dist/commands/recipes/impl/paths.js +20 -5
  180. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +5 -4
  181. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  182. package/dist/commands/recipes/impl/project-installed-recipes.js +34 -76
  183. package/dist/commands/recipes/impl/project-recipe-state.d.ts +18 -0
  184. package/dist/commands/recipes/impl/project-recipe-state.d.ts.map +1 -0
  185. package/dist/commands/recipes/impl/project-recipe-state.js +94 -0
  186. package/dist/commands/recipes/impl/project-registry.d.ts +24 -0
  187. package/dist/commands/recipes/impl/project-registry.d.ts.map +1 -0
  188. package/dist/commands/recipes/impl/project-registry.js +124 -0
  189. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  190. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  191. package/dist/commands/recipes/impl/resolver.js +6 -4
  192. package/dist/commands/recipes/impl/types.d.ts +1 -240
  193. package/dist/commands/recipes/impl/types.d.ts.map +1 -1
  194. package/dist/commands/recipes/impl/version.d.ts +5 -0
  195. package/dist/commands/recipes/impl/version.d.ts.map +1 -0
  196. package/dist/commands/recipes/impl/version.js +9 -0
  197. package/dist/commands/recipes/info.command.js +2 -2
  198. package/dist/commands/recipes/install.spec.js +4 -4
  199. package/dist/commands/recipes/list.command.js +4 -4
  200. package/dist/commands/recipes/remove.command.js +2 -2
  201. package/dist/commands/recipes/update.command.d.ts +8 -0
  202. package/dist/commands/recipes/update.command.d.ts.map +1 -0
  203. package/dist/commands/recipes/update.command.js +35 -0
  204. package/dist/commands/recipes.d.ts +10 -6
  205. package/dist/commands/recipes.d.ts.map +1 -1
  206. package/dist/commands/recipes.js +8 -5
  207. package/dist/commands/recipes.test-helpers.d.ts +3 -3
  208. package/dist/commands/recipes.test-helpers.d.ts.map +1 -1
  209. package/dist/commands/recipes.test-helpers.js +105 -15
  210. package/dist/commands/release/apply.command.d.ts +1 -1
  211. package/dist/commands/release/apply.command.d.ts.map +1 -1
  212. package/dist/commands/release/apply.command.js +15 -379
  213. package/dist/commands/release/apply.mutation.d.ts +1 -0
  214. package/dist/commands/release/apply.mutation.d.ts.map +1 -1
  215. package/dist/commands/release/apply.mutation.js +24 -1
  216. package/dist/commands/release/apply.pipeline.d.ts +22 -0
  217. package/dist/commands/release/apply.pipeline.d.ts.map +1 -0
  218. package/dist/commands/release/apply.pipeline.js +371 -0
  219. package/dist/commands/release/apply.preflight.d.ts +2 -0
  220. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  221. package/dist/commands/release/apply.preflight.js +13 -4
  222. package/dist/commands/release/apply.types.d.ts +27 -0
  223. package/dist/commands/release/apply.types.d.ts.map +1 -1
  224. package/dist/commands/release.test-helpers.d.ts +4 -0
  225. package/dist/commands/release.test-helpers.d.ts.map +1 -1
  226. package/dist/commands/release.test-helpers.js +7 -0
  227. package/dist/commands/scenario/execute.command.js +4 -4
  228. package/dist/commands/scenario/impl/commands.js +4 -4
  229. package/dist/commands/scenario/info.command.js +4 -4
  230. package/dist/commands/scenario/list.command.js +3 -3
  231. package/dist/commands/scenario/run.command.js +5 -5
  232. package/dist/commands/scenario/scenario.command.js +7 -7
  233. package/dist/commands/shared/reconcile-check.d.ts.map +1 -1
  234. package/dist/commands/shared/reconcile-check.js +2 -2
  235. package/dist/commands/shared/task-backend.d.ts +6 -1
  236. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  237. package/dist/commands/shared/task-backend.js +34 -2
  238. package/dist/commands/shared/task-handoff.d.ts +2 -1
  239. package/dist/commands/shared/task-handoff.d.ts.map +1 -1
  240. package/dist/commands/shared/task-handoff.js +15 -0
  241. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  242. package/dist/commands/shared/task-mutation.js +4 -4
  243. package/dist/commands/shared/task-store/intents.d.ts +34 -0
  244. package/dist/commands/shared/task-store/intents.d.ts.map +1 -0
  245. package/dist/commands/shared/task-store/intents.js +265 -0
  246. package/dist/commands/shared/task-store/readme.d.ts +28 -0
  247. package/dist/commands/shared/task-store/readme.d.ts.map +1 -0
  248. package/dist/commands/shared/task-store/readme.js +125 -0
  249. package/dist/commands/shared/task-store/store.d.ts +26 -0
  250. package/dist/commands/shared/task-store/store.d.ts.map +1 -0
  251. package/dist/commands/shared/task-store/store.js +105 -0
  252. package/dist/commands/shared/task-store/types.d.ts +94 -0
  253. package/dist/commands/shared/task-store/types.d.ts.map +1 -0
  254. package/dist/commands/shared/task-store/types.js +1 -0
  255. package/dist/commands/shared/task-store.d.ts +3 -109
  256. package/dist/commands/shared/task-store.d.ts.map +1 -1
  257. package/dist/commands/shared/task-store.js +2 -493
  258. package/dist/commands/task/block.d.ts.map +1 -1
  259. package/dist/commands/task/block.js +7 -2
  260. package/dist/commands/task/comment.d.ts.map +1 -1
  261. package/dist/commands/task/comment.js +7 -2
  262. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  263. package/dist/commands/task/finish-shared.js +3 -3
  264. package/dist/commands/task/finish.d.ts.map +1 -1
  265. package/dist/commands/task/finish.js +102 -15
  266. package/dist/commands/task/handoff-show.command.d.ts.map +1 -1
  267. package/dist/commands/task/handoff-show.command.js +24 -0
  268. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  269. package/dist/commands/task/hosted-merge-sync.js +9 -4
  270. package/dist/commands/task/list.run.d.ts.map +1 -1
  271. package/dist/commands/task/list.run.js +14 -4
  272. package/dist/commands/task/new.command.d.ts.map +1 -1
  273. package/dist/commands/task/new.command.js +16 -2
  274. package/dist/commands/task/new.js +2 -2
  275. package/dist/commands/task/show.d.ts.map +1 -1
  276. package/dist/commands/task/show.js +3 -3
  277. package/dist/commands/task/update.d.ts.map +1 -1
  278. package/dist/commands/task/update.js +11 -3
  279. package/dist/runner/adapters/codex.d.ts.map +1 -1
  280. package/dist/runner/adapters/codex.js +3 -33
  281. package/dist/runner/adapters/custom.d.ts.map +1 -1
  282. package/dist/runner/adapters/custom.js +3 -30
  283. package/dist/runner/adapters/runtime-shared.d.ts +14 -0
  284. package/dist/runner/adapters/runtime-shared.d.ts.map +1 -0
  285. package/dist/runner/adapters/runtime-shared.js +36 -0
  286. package/dist/runner/context/base-prompt-sources.d.ts +30 -0
  287. package/dist/runner/context/base-prompt-sources.d.ts.map +1 -0
  288. package/dist/runner/context/base-prompt-sources.js +144 -0
  289. package/dist/runner/context/base-prompts.d.ts +5 -23
  290. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  291. package/dist/runner/context/base-prompts.js +10 -358
  292. package/dist/runner/context/overlay-prompt-blocks.d.ts +7 -0
  293. package/dist/runner/context/overlay-prompt-blocks.d.ts.map +1 -0
  294. package/dist/runner/context/overlay-prompt-blocks.js +72 -0
  295. package/dist/runner/context/prompt-block-shared.d.ts +54 -0
  296. package/dist/runner/context/prompt-block-shared.d.ts.map +1 -0
  297. package/dist/runner/context/prompt-block-shared.js +106 -0
  298. package/dist/runner/context/recipe-context.d.ts +2 -1
  299. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  300. package/dist/runner/context/recipe-context.js +41 -8
  301. package/dist/runner/context/recipe-prompt-blocks.d.ts +6 -0
  302. package/dist/runner/context/recipe-prompt-blocks.d.ts.map +1 -0
  303. package/dist/runner/context/recipe-prompt-blocks.js +143 -0
  304. package/dist/runner/types.d.ts +4 -0
  305. package/dist/runner/types.d.ts.map +1 -1
  306. package/dist/runner/usecases/scenario-materialize-task.js +2 -2
  307. package/dist/runner/usecases/task-run-inspect.js +2 -2
  308. package/dist/runner/usecases/task-run-lifecycle-shared.js +2 -2
  309. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  310. package/dist/runner/usecases/task-run.js +6 -3
  311. package/dist/runtime/behavior/resolve.d.ts +2 -1
  312. package/dist/runtime/behavior/resolve.d.ts.map +1 -1
  313. package/dist/runtime/behavior/resolve.js +25 -5
  314. package/dist/runtime/behavior/types.d.ts +1 -0
  315. package/dist/runtime/behavior/types.d.ts.map +1 -1
  316. package/dist/runtime/capabilities/recipe.d.ts +2 -1
  317. package/dist/runtime/capabilities/recipe.d.ts.map +1 -1
  318. package/dist/runtime/capabilities/recipe.js +88 -28
  319. package/dist/runtime/execution-context.d.ts +63 -0
  320. package/dist/runtime/execution-context.d.ts.map +1 -0
  321. package/dist/{usecases/context/resolve-context.js → runtime/execution-context.js} +23 -26
  322. package/dist/runtime/incidents/advice-strategy.d.ts +15 -0
  323. package/dist/runtime/incidents/advice-strategy.d.ts.map +1 -0
  324. package/dist/runtime/incidents/advice-strategy.js +54 -0
  325. package/dist/runtime/incidents/plan-strategy.d.ts +9 -0
  326. package/dist/runtime/incidents/plan-strategy.d.ts.map +1 -0
  327. package/dist/runtime/incidents/plan-strategy.js +205 -0
  328. package/dist/runtime/incidents/registry-strategy.d.ts +6 -0
  329. package/dist/runtime/incidents/registry-strategy.d.ts.map +1 -0
  330. package/dist/runtime/incidents/registry-strategy.js +280 -0
  331. package/dist/runtime/incidents/resolve.d.ts +3 -25
  332. package/dist/runtime/incidents/resolve.d.ts.map +1 -1
  333. package/dist/runtime/incidents/resolve.js +3 -683
  334. package/dist/runtime/incidents/shared.d.ts +34 -0
  335. package/dist/runtime/incidents/shared.d.ts.map +1 -0
  336. package/dist/runtime/incidents/shared.js +171 -0
  337. package/dist/shared/errors.d.ts +1 -1
  338. package/dist/shared/errors.d.ts.map +1 -1
  339. package/dist/shared/runtime-source.d.ts.map +1 -1
  340. package/dist/shared/runtime-source.js +8 -3
  341. package/dist/testing/cli-harness/recipe-archives.d.ts +28 -0
  342. package/dist/testing/cli-harness/recipe-archives.d.ts.map +1 -0
  343. package/dist/testing/cli-harness/recipe-archives.js +374 -0
  344. package/dist/testing/cli-harness/stdio.d.ts +26 -0
  345. package/dist/testing/cli-harness/stdio.d.ts.map +1 -0
  346. package/dist/testing/cli-harness/stdio.js +84 -0
  347. package/dist/testing/cli-harness.d.ts +25 -0
  348. package/dist/testing/cli-harness.d.ts.map +1 -0
  349. package/dist/testing/cli-harness.js +313 -0
  350. package/dist/testing/index.d.ts +2 -0
  351. package/dist/testing/index.d.ts.map +1 -0
  352. package/dist/testing/index.js +1 -0
  353. package/package.json +7 -3
  354. package/dist/cli/recipes-bundled.d.ts +0 -10
  355. package/dist/cli/recipes-bundled.d.ts.map +0 -1
  356. package/dist/cli/recipes-bundled.js +0 -36
  357. package/dist/commands/recipes/impl/manifest.d.ts +0 -4
  358. package/dist/commands/recipes/impl/manifest.d.ts.map +0 -1
  359. package/dist/commands/recipes/impl/manifest.js +0 -229
  360. package/dist/commands/recipes/impl/normalize.d.ts +0 -8
  361. package/dist/commands/recipes/impl/normalize.d.ts.map +0 -1
  362. package/dist/commands/recipes/impl/normalize.js +0 -54
  363. package/dist/commands/recipes/impl/scenario.d.ts +0 -16
  364. package/dist/commands/recipes/impl/scenario.d.ts.map +0 -1
  365. package/dist/commands/recipes/impl/scenario.js +0 -262
  366. package/dist/recipes/bundled-recipes.d.ts +0 -17
  367. package/dist/recipes/bundled-recipes.d.ts.map +0 -1
  368. package/dist/recipes/bundled-recipes.js +0 -15
  369. package/dist/usecases/context/resolve-context.d.ts +0 -68
  370. package/dist/usecases/context/resolve-context.d.ts.map +0 -1
  371. package/dist/usecases/task/task-list-usecase.d.ts +0 -9
  372. package/dist/usecases/task/task-list-usecase.d.ts.map +0 -1
  373. package/dist/usecases/task/task-list-usecase.js +0 -17
  374. package/dist/usecases/task/task-new-usecase.d.ts +0 -9
  375. package/dist/usecases/task/task-new-usecase.d.ts.map +0 -1
  376. package/dist/usecases/task/task-new-usecase.js +0 -17
@@ -7,9 +7,10 @@ import { readFile, rm } from "node:fs/promises";
7
7
  import path from "node:path";
8
8
  import { ensureActionApproved } from "../shared/approval-requirements.js";
9
9
  import { ensureReconciledBeforeMutation } from "../shared/reconcile-check.js";
10
- import { gitCurrentBranch } from "../shared/git-ops.js";
11
- import { loadCommandContext } from "../shared/task-backend.js";
12
- import { backendIsLocalFileBackend, getTaskStore } from "../shared/task-store.js";
10
+ import { execFileAsync, gitEnv } from "../shared/git.js";
11
+ import { gitBranchExists, gitCurrentBranch } from "../shared/git-ops.js";
12
+ import { backendUsesLocalTaskStore, loadCommandContext, } from "../shared/task-backend.js";
13
+ import { getTaskStore } from "../shared/task-store.js";
13
14
  import { applyTaskMutation } from "../shared/task-mutation.js";
14
15
  import { collectTaskIncidents, renderIncidentCollectionPlanOutcome } from "../incidents/shared.js";
15
16
  import { createTaskCloseCommit, existingCommitInfo, loadTaskForFinish, writeFinishedTasks, } from "./finish-shared.js";
@@ -57,6 +58,68 @@ async function ensureFinishRunsOnBaseBranch(opts) {
57
58
  `(current: ${currentBranch}); integrate first or reconcile from the base checkout.`,
58
59
  });
59
60
  }
61
+ async function readHeadCommitHash(gitRoot) {
62
+ const { stdout } = await execFileAsync("git", ["rev-parse", "HEAD"], {
63
+ cwd: gitRoot,
64
+ env: gitEnv(),
65
+ });
66
+ const hash = stdout.trim();
67
+ if (!hash) {
68
+ throw new CliError({
69
+ exitCode: exitCodeForError("E_GIT"),
70
+ code: "E_GIT",
71
+ message: "Failed to resolve HEAD while preparing a branch_pr close tail.",
72
+ });
73
+ }
74
+ return hash;
75
+ }
76
+ function branchPrCloseBranchName(taskId, headCommitHash) {
77
+ return `task-close/${taskId}/${headCommitHash.slice(0, 12)}`;
78
+ }
79
+ async function materializeBranchPrCloseTail(opts) {
80
+ const gitRoot = opts.ctx.resolvedProject.gitRoot;
81
+ const baseBranch = await gitCurrentBranch(gitRoot);
82
+ const headCommitHash = await readHeadCommitHash(gitRoot);
83
+ const closeBranch = branchPrCloseBranchName(opts.taskId, headCommitHash);
84
+ const branchExists = await gitBranchExists(gitRoot, closeBranch);
85
+ await execFileAsync("git", branchExists ? ["checkout", closeBranch] : ["checkout", "-b", closeBranch], {
86
+ cwd: gitRoot,
87
+ env: gitEnv(),
88
+ });
89
+ let checkoutError = null;
90
+ try {
91
+ await createTaskCloseCommit({
92
+ ctx: opts.ctx,
93
+ cwd: opts.cwd,
94
+ rootOverride: opts.rootOverride,
95
+ taskId: opts.taskId,
96
+ baseBranchOverride: opts.baseBranchOverride,
97
+ quiet: opts.quiet,
98
+ closeUnstageOthers: opts.closeUnstageOthers,
99
+ allowPolicy: opts.allowPolicy,
100
+ });
101
+ }
102
+ finally {
103
+ try {
104
+ await execFileAsync("git", ["checkout", baseBranch], {
105
+ cwd: gitRoot,
106
+ env: gitEnv(),
107
+ });
108
+ }
109
+ catch (error) {
110
+ checkoutError = error;
111
+ }
112
+ }
113
+ if (checkoutError) {
114
+ throw new CliError({
115
+ exitCode: exitCodeForError("E_GIT"),
116
+ code: "E_GIT",
117
+ message: `Created ${closeBranch} but failed to return to ${baseBranch}; ` +
118
+ "inspect the local checkout before continuing.",
119
+ });
120
+ }
121
+ return closeBranch;
122
+ }
60
123
  async function appendFinishStructuredFinding(opts) {
61
124
  await applyTaskMutation({
62
125
  ctx: opts.ctx,
@@ -175,7 +238,7 @@ export async function cmdFinish(opts) {
175
238
  message: "--status-commit requires --status-commit-allow <path-prefix>",
176
239
  });
177
240
  }
178
- const useStore = backendIsLocalFileBackend(ctx);
241
+ const useStore = backendUsesLocalTaskStore(ctx);
179
242
  const store = useStore ? getTaskStore(ctx) : null;
180
243
  const backendWritesTaskReadmes = ctx.taskBackend.capabilities.writes_task_readmes === true;
181
244
  const defaultDirectCloseCommit = ctx.config.workflow_mode === "direct" &&
@@ -183,12 +246,18 @@ export async function cmdFinish(opts) {
183
246
  opts.taskIds.length === 1 &&
184
247
  !opts.commitFromComment &&
185
248
  !statusCommitRequested;
249
+ const defaultBranchPrCloseCommit = ctx.config.workflow_mode === "branch_pr" &&
250
+ backendWritesTaskReadmes &&
251
+ opts.taskIds.length === 1 &&
252
+ !opts.commitFromComment &&
253
+ !statusCommitRequested;
186
254
  const statusPathRequiresTrackedTaskCommit = backendWritesTaskReadmes &&
187
255
  opts.taskIds.length === 1 &&
188
256
  (opts.commitFromComment || statusCommitRequested);
189
257
  const shouldCloseCommit = opts.closeCommit === true ||
190
258
  statusPathRequiresTrackedTaskCommit ||
191
- (defaultDirectCloseCommit && opts.noCloseCommit !== true);
259
+ (defaultDirectCloseCommit && opts.noCloseCommit !== true) ||
260
+ (defaultBranchPrCloseCommit && opts.noCloseCommit !== true);
192
261
  const metaTaskId = opts.taskIds.length === 1 ? (opts.taskIds[0] ?? "") : "";
193
262
  const wantMeta = typeof opts.result === "string" || typeof opts.risk === "string" || opts.breaking === true;
194
263
  const resultProvided = typeof opts.result === "string";
@@ -397,16 +466,34 @@ export async function cmdFinish(opts) {
397
466
  if (!opts.quiet) {
398
467
  process.stdout.write(`${infoMessage("task marked DONE; creating deterministic close commit")}\n`);
399
468
  }
400
- await createTaskCloseCommit({
401
- ctx,
402
- cwd: opts.cwd,
403
- rootOverride: opts.rootOverride,
404
- taskId: primaryTaskId,
405
- baseBranchOverride: opts.baseBranchOverride,
406
- quiet: opts.quiet,
407
- closeUnstageOthers: opts.closeCommit === true && opts.closeUnstageOthers === true,
408
- allowPolicy: promotedIncidents > 0,
409
- });
469
+ const closeUnstageOthers = opts.closeCommit === true && opts.closeUnstageOthers === true;
470
+ if (ctx.config.workflow_mode === "branch_pr") {
471
+ const closeBranch = await materializeBranchPrCloseTail({
472
+ ctx,
473
+ cwd: opts.cwd,
474
+ rootOverride: opts.rootOverride,
475
+ taskId: primaryTaskId,
476
+ baseBranchOverride: opts.baseBranchOverride,
477
+ quiet: opts.quiet,
478
+ closeUnstageOthers,
479
+ allowPolicy: promotedIncidents > 0,
480
+ });
481
+ if (!opts.quiet) {
482
+ process.stdout.write(`${infoMessage(`branch_pr close tail ready on ${closeBranch}; push that branch and open it with task hosted-close-pr if hosted automation does not create the closure PR for you.`)}\n`);
483
+ }
484
+ }
485
+ else {
486
+ await createTaskCloseCommit({
487
+ ctx,
488
+ cwd: opts.cwd,
489
+ rootOverride: opts.rootOverride,
490
+ taskId: primaryTaskId,
491
+ baseBranchOverride: opts.baseBranchOverride,
492
+ quiet: opts.quiet,
493
+ closeUnstageOthers,
494
+ allowPolicy: promotedIncidents > 0,
495
+ });
496
+ }
410
497
  }
411
498
  if (ctx.config.workflow_mode === "direct") {
412
499
  await clearDirectWorkLockIfMatches({
@@ -1 +1 @@
1
- {"version":3,"file":"handoff-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/handoff-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOtE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAiBlE,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAU,KAAK,UAAU,EAAE,QAAQ,qBAAqB,oBAsDtF,CAAC"}
1
+ {"version":3,"file":"handoff-show.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/handoff-show.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAOtE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,OAAO,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAAW,CAAC,qBAAqB,CAiBlE,CAAC;AAIF,eAAO,MAAM,kBAAkB,GAAU,KAAK,UAAU,EAAE,QAAQ,qBAAqB,oBA2EtF,CAAC"}
@@ -52,6 +52,30 @@ export const runTaskHandoffShow = async (ctx, parsed) => {
52
52
  entries.push({ label: "head_sha", value: handoff.head_sha });
53
53
  if (handoff.pr_branch)
54
54
  entries.push({ label: "pr_branch", value: handoff.pr_branch });
55
+ if (handoff.route?.kind)
56
+ entries.push({ label: "route_kind", value: handoff.route.kind });
57
+ if (handoff.route?.status)
58
+ entries.push({ label: "route_status", value: handoff.route.status });
59
+ if (handoff.route?.local_mutation) {
60
+ entries.push({ label: "route_local_mutation", value: handoff.route.local_mutation });
61
+ }
62
+ if (handoff.route?.finalize_via) {
63
+ entries.push({ label: "route_finalize_via", value: handoff.route.finalize_via });
64
+ }
65
+ if (typeof handoff.route?.pr_number === "number") {
66
+ entries.push({ label: "route_pr_number", value: String(handoff.route.pr_number) });
67
+ }
68
+ if (handoff.route?.pr_url)
69
+ entries.push({ label: "route_pr_url", value: handoff.route.pr_url });
70
+ if (handoff.route?.handoff_show_command) {
71
+ entries.push({
72
+ label: "route_handoff_show_command",
73
+ value: handoff.route.handoff_show_command,
74
+ });
75
+ }
76
+ if (handoff.route?.base_pull_command) {
77
+ entries.push({ label: "route_base_pull_command", value: handoff.route.base_pull_command });
78
+ }
55
79
  if (handoff.runner?.run_id) {
56
80
  entries.push({ label: "run_id", value: handoff.runner.run_id }, { label: "runner_status", value: handoff.runner.status ?? "unknown" }, { label: "runner_next_action", value: handoff.runner.next_action ?? "none" });
57
81
  if (handoff.runner.next_command) {
@@ -1 +1 @@
1
- {"version":3,"file":"hosted-merge-sync.d.ts","sourceRoot":"","sources":["../../../src/commands/task/hos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BAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CA4BjC;AA6PD,wBAAsB,oBAAoB,CAAC,IAAI,EAAE;IAC/C,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,MAAM,EAAE,iBAAiB,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CAClC,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuDjC;AAED,wBAAsB,+BAA+B,CAAC,IAAI,EAAE;IAC1D,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,0BAA0B,EAAE,CAAC,CAuDxC;AAED,wBAAsB,wCAAwC,CAAC,IAAI,EAAE;IACnE,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,sBAAsB,EAAE,CAAC,CA0CpC;AAED,wBAAsB,+BAA+B,CAAC,IAAI,EAAE;IAC1D,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAoBjC;AAED,wBAAsB,qBAAqB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAqDjC"}
@@ -7,6 +7,7 @@ import { execFileAsync } from "../shared/git.js";
7
7
  import { withGhTransportRetry } from "../shared/gh-transport.js";
8
8
  import { parseTaskIdFromBranch } from "../shared/git-worktree.js";
9
9
  import { parsePrMeta } from "../shared/pr-meta.js";
10
+ import { backendUsesLocalTaskStore } from "../shared/task-backend.js";
10
11
  import { ghEnv } from "../pr/internal/gh-api.js";
11
12
  import { appendTaskEvent } from "./shared.js";
12
13
  function normalizeMergedPr(value) {
@@ -346,7 +347,7 @@ function needsHostedMergeSync(opts) {
346
347
  return false;
347
348
  }
348
349
  export async function syncHostedMergedTask(opts) {
349
- if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
350
+ if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
350
351
  return { tasks: opts.tasks, synced: 0 };
351
352
  }
352
353
  const task = opts.tasks.find((entry) => entry.id === opts.target.taskId);
@@ -393,7 +394,7 @@ export async function syncHostedMergedTask(opts) {
393
394
  };
394
395
  }
395
396
  export async function findLocallyShippedBranchPrTasks(opts) {
396
- if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
397
+ if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
397
398
  return [];
398
399
  }
399
400
  const matches = [];
@@ -446,7 +447,7 @@ export async function findLocallyShippedBranchPrTasks(opts) {
446
447
  return matches;
447
448
  }
448
449
  export async function findDoneBranchPrTasksWithOpenPrArtifacts(opts) {
449
- if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
450
+ if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
450
451
  return [];
451
452
  }
452
453
  const matches = [];
@@ -461,6 +462,10 @@ export async function findDoneBranchPrTasksWithOpenPrArtifacts(opts) {
461
462
  const branch = meta.branch?.trim() ?? "";
462
463
  if (!branch)
463
464
  continue;
465
+ const branchStillExists = (await gitRefExists({ cwd: opts.ctx.resolvedProject.gitRoot, ref: branch })) ||
466
+ (await gitRefExists({ cwd: opts.ctx.resolvedProject.gitRoot, ref: `origin/${branch}` }));
467
+ if (!branchStillExists)
468
+ continue;
464
469
  if (isStackedBranchAliasDoneTask({ task, branch }))
465
470
  continue;
466
471
  // Missing implementation commits are handled by a dedicated doctor check, and duplicate/no-op
@@ -504,7 +509,7 @@ export async function syncLocallyShippedBranchPrTasks(opts) {
504
509
  };
505
510
  }
506
511
  export async function syncHostedMergedTasks(opts) {
507
- if (opts.ctx.backendId !== "local" || opts.ctx.config.workflow_mode !== "branch_pr") {
512
+ if (!backendUsesLocalTaskStore(opts.ctx) || opts.ctx.config.workflow_mode !== "branch_pr") {
508
513
  return { tasks: opts.tasks, synced: 0 };
509
514
  }
510
515
  const nextTasks = [];
@@ -1 +1 @@
1
- {"version":3,"file":"list.run.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACvE,KAAK,UAAU,EAAE,GAAG,cAAc,KAAG,OAAO,CAAC,MAAM,CAAC,CAOnE"}
1
+ {"version":3,"file":"list.run.d.ts","sourceRoot":"","sources":["../../../src/commands/task/list.run.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,IACvE,KAAK,UAAU,EAAE,GAAG,cAAc,KAAG,OAAO,CAAC,MAAM,CAAC,CAiBnE"}
@@ -1,9 +1,19 @@
1
- import { taskListUsecase } from "../../usecases/task/task-list-usecase.js";
1
+ import { makeReadOnlyExecutionContext } from "../../runtime/execution-context.js";
2
+ import { cmdTaskList } from "./list.js";
2
3
  export function makeRunTaskListHandler(getCtx) {
3
4
  return async (ctx, p) => {
4
- return await taskListUsecase({
5
- cli: ctx,
6
- command: await getCtx("task list"),
5
+ const command = await getCtx("task list");
6
+ const execution = await makeReadOnlyExecutionContext(command);
7
+ void execution.policy.evaluate({
8
+ action: "task_list",
9
+ config: execution.config,
10
+ taskId: "",
11
+ git: { stagedPaths: [] },
12
+ });
13
+ return await cmdTaskList({
14
+ ctx: execution.command,
15
+ cwd: ctx.cwd,
16
+ rootOverride: ctx.rootOverride,
7
17
  filters: p.filters,
8
18
  });
9
19
  };
@@ -1 +1 @@
1
- {"version":3,"file":"new.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAC;AAEzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,aAAa,CAAC,CAI/B"}
1
+ {"version":3,"file":"new.command.d.ts","sourceRoot":"","sources":["../../../src/commands/task/new.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,wBAAwB,CAAC;AAGzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAGhE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,CAAC,sBAAsB,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,GAClE,cAAc,CAAC,aAAa,CAAC,CAkB/B"}
@@ -1,7 +1,21 @@
1
- import { taskNewUsecase } from "../../usecases/task/task-new-usecase.js";
1
+ import { makeExecutionContext } from "../../runtime/execution-context.js";
2
+ import { runTaskNewParsed } from "./new.js";
2
3
  export { taskNewSpec } from "./new.spec.js";
3
4
  export function makeRunTaskNewHandler(getCtx) {
4
5
  return async (ctx, p) => {
5
- return await taskNewUsecase({ cli: ctx, command: await getCtx("task new"), parsed: p });
6
+ const command = await getCtx("task new");
7
+ const execution = await makeExecutionContext(command);
8
+ void execution.policy.evaluate({
9
+ action: "task_new",
10
+ config: execution.config,
11
+ taskId: "",
12
+ git: { stagedPaths: [] },
13
+ });
14
+ return await runTaskNewParsed({
15
+ ctx: execution.command,
16
+ cwd: ctx.cwd,
17
+ rootOverride: ctx.rootOverride,
18
+ parsed: p,
19
+ });
6
20
  };
7
21
  }
@@ -2,9 +2,9 @@ import { setMarkdownSection } from "@agentplaneorg/core";
2
2
  import { mapBackendError } from "../../cli/error-map.js";
3
3
  import { backendNotSupportedMessage, warnMessage } from "../../cli/output.js";
4
4
  import { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, materializeTaskGraphDraft, } from "../../runtime/task-intake/index.js";
5
+ import { makeReadOnlyExecutionContext } from "../../runtime/execution-context.js";
5
6
  import { CliError } from "../../shared/errors.js";
6
7
  import { buildTaskDocState } from "../../shared/task-doc-state.js";
7
- import { makeReadOnlyUsecaseContext } from "../../usecases/context/resolve-context.js";
8
8
  import { loadCommandContext } from "../shared/task-backend.js";
9
9
  import { ensureTaskDependsOnGraphIsAcyclic, nowIso, requiresVerifyStepsByPrimary, resolvePrimaryTag, warnIfUnknownOwner, } from "./shared.js";
10
10
  import { buildDefaultVerifyStepsSection, defaultTaskDocV3, TASK_DOC_VERSION_V3, } from "./doc-template.js";
@@ -139,7 +139,7 @@ export async function runTaskNewParsed(opts) {
139
139
  });
140
140
  }
141
141
  const taskId = await ctx.taskBackend.generateTaskId({ length: suffixLength, attempts: 1000 });
142
- const executionContext = await makeReadOnlyUsecaseContext(ctx);
142
+ const executionContext = await makeReadOnlyExecutionContext(ctx);
143
143
  const createdAt = nowIso();
144
144
  const docState = buildTaskDocState({
145
145
  doc: defaultTaskDocV3({ title: p.title, description: p.description }),
@@ -1 +1 @@
1
- {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/task/show.ts"],"names":[],"mappings":"AAOA,OAAO,EAIL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AA4BnC,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClB"}
1
+ {"version":3,"file":"show.d.ts","sourceRoot":"","sources":["../../../src/commands/task/show.ts"],"names":[],"mappings":"AAOA,OAAO,EAKL,KAAK,cAAc,EACpB,MAAM,2BAA2B,CAAC;AA4BnC,wBAAsB,WAAW,CAAC,IAAI,EAAE;IACtC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsClB"}
@@ -3,9 +3,9 @@ import { readFile } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import { mapBackendError } from "../../cli/error-map.js";
5
5
  import { CliError } from "../../shared/errors.js";
6
- import { loadCommandContext, loadTaskFromContext, taskDataToFrontmatter, } from "../shared/task-backend.js";
6
+ import { backendSupportsTaskBranchSnapshots, loadCommandContext, loadTaskFromContext, taskDataToFrontmatter, } from "../shared/task-backend.js";
7
7
  async function detectLocalTaskMetadataErrors(ctx, taskId) {
8
- if (ctx.backendId !== "local")
8
+ if (!backendSupportsTaskBranchSnapshots(ctx))
9
9
  return null;
10
10
  const readmePath = taskReadmePath(path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.workflow_dir), taskId);
11
11
  try {
@@ -32,7 +32,7 @@ export async function cmdTaskShow(opts) {
32
32
  (await loadCommandContext({ cwd: opts.cwd, rootOverride: opts.rootOverride ?? null }));
33
33
  const task = await loadTaskFromContext({ ctx, taskId: opts.taskId });
34
34
  const frontmatter = taskDataToFrontmatter(task);
35
- if (ctx.backendId === "local") {
35
+ if (backendSupportsTaskBranchSnapshots(ctx)) {
36
36
  const metadataErrors = validateTaskDocMetadata(frontmatter);
37
37
  if (metadataErrors.length > 0) {
38
38
  throw new CliError({
@@ -1 +1 @@
1
- {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/task/update.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAWpF,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CA6ElB"}
1
+ {"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../../src/commands/task/update.ts"],"names":[],"mappings":"AAIA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAapF,wBAAsB,aAAa,CAAC,IAAI,EAAE;IACxC,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,aAAa,EAAE,OAAO,CAAC;IACvB,kBAAkB,CAAC,EAAE,OAAO,CAAC;CAC9B,GAAG,OAAO,CAAC,MAAM,CAAC,CAiFlB"}
@@ -1,8 +1,9 @@
1
1
  import { mapBackendError } from "../../cli/error-map.js";
2
- import { successMessage, unknownEntityMessage, warnMessage } from "../../cli/output.js";
2
+ import { createCliEmitter, emitCommandResult, unknownEntityMessage } from "../../cli/output.js";
3
3
  import { CliError } from "../../shared/errors.js";
4
4
  import { loadCommandContext } from "../shared/task-backend.js";
5
5
  import { dedupeStrings, ensureTaskDependsOnGraphIsAcyclic, requiresVerifyStepsByPrimary, readTaskTagPolicy, resolvePrimaryTag, toStringArray, warnIfUnknownOwner, } from "./shared.js";
6
+ const output = createCliEmitter();
6
7
  export async function cmdTaskUpdate(opts) {
7
8
  try {
8
9
  const ctx = opts.ctx ??
@@ -46,7 +47,10 @@ export async function cmdTaskUpdate(opts) {
46
47
  const hasSpike = mergedTags.some((tag) => tag.trim().toLowerCase() === spikeTag);
47
48
  const hasImplementationTags = requiresVerifyStepsByPrimary(mergedTags, ctx.config);
48
49
  if (hasSpike && hasImplementationTags) {
49
- process.stderr.write(`${warnMessage("spike is combined with a primary tag that requires verify steps; consider splitting spike vs implementation tasks")}\n`);
50
+ emitCommandResult(output, {
51
+ kind: "warn",
52
+ message: "spike is combined with a primary tag that requires verify steps; consider splitting spike vs implementation tasks",
53
+ });
50
54
  }
51
55
  const existingDepends = opts.replaceDependsOn
52
56
  ? []
@@ -62,7 +66,11 @@ export async function cmdTaskUpdate(opts) {
62
66
  const mergedVerify = dedupeStrings([...existingVerify, ...opts.verify]);
63
67
  next.verify = mergedVerify;
64
68
  await ctx.taskBackend.writeTask(next);
65
- process.stdout.write(`${successMessage("updated", opts.taskId)}\n`);
69
+ emitCommandResult(output, {
70
+ kind: "success",
71
+ action: "updated",
72
+ target: opts.taskId,
73
+ });
66
74
  return 0;
67
75
  }
68
76
  catch (err) {
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/runner/adapters/codex.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAkMrB,qBAAa,kBAAmB,YAAW,aAAa;IACtD,QAAQ,CAAC,EAAE,EAAG,OAAO,CAAU;IAE/B,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,yBAAyB;IAI7E,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiD/D,OAAO,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAkN7D"}
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../../src/runner/adapters/codex.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAmKrB,qBAAa,kBAAmB,YAAW,aAAa;IACtD,QAAQ,CAAC,EAAE,EAAG,OAAO,CAAU;IAE/B,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,yBAAyB;IAI7E,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAiD/D,OAAO,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAkN7D"}
@@ -3,7 +3,8 @@ import path from "node:path";
3
3
  import { exitCodeForError } from "../../cli/exit-codes.js";
4
4
  import { CliError } from "../../shared/errors.js";
5
5
  import { evolveRunnerRunState } from "../artifacts.js";
6
- import { runnerArtifactsFromSpecs, runnerAdapterCancelledResult, runnerAdapterFailureResult, runnerAdapterSuccessResult, } from "./shared.js";
6
+ import { runnerAdapterCancelledResult, runnerAdapterFailureResult, runnerAdapterSuccessResult, } from "./shared.js";
7
+ import { buildInvocationEventData, buildRunnerExecutionArtifacts, durationMs, } from "./runtime-shared.js";
7
8
  import { exitCodeForSignal, runSupervisedProcess, } from "../process-supervision.js";
8
9
  import { InvalidRunnerResultManifestError, applyRunnerResultManifest, manifestFromRunnerResult, preserveRunnerResultManifestSource, preserveInvalidRunnerResultManifest, readRunnerResultManifest, writeRunnerResultManifest, } from "../result-manifest.js";
9
10
  import { RunnerRunRepository } from "../run-repository.js";
@@ -31,26 +32,6 @@ const CODEX_RUN_PROFILE_CAPABILITIES = {
31
32
  function byteLength(text) {
32
33
  return Buffer.byteLength(text ?? "", "utf8");
33
34
  }
34
- function durationMs(startedAt, endedAt) {
35
- const started = Date.parse(startedAt);
36
- const ended = Date.parse(endedAt);
37
- if (Number.isNaN(started) || Number.isNaN(ended))
38
- return undefined;
39
- return Math.max(0, ended - started);
40
- }
41
- function buildInvocationEventData(invocation) {
42
- return {
43
- executable: invocation.argv[0] ?? null,
44
- argv_count: invocation.argv.length,
45
- cwd: invocation.run_dir,
46
- env_keys: Object.keys(invocation.env).toSorted(),
47
- trace_policy: invocation.trace_policy,
48
- timeout_policy: invocation.timeout_policy,
49
- has_bootstrap_path: typeof invocation.bootstrap_path === "string" && invocation.bootstrap_path.trim().length > 0,
50
- has_output_last_message_path: typeof invocation.output_last_message_path === "string" &&
51
- invocation.output_last_message_path.trim().length > 0,
52
- };
53
- }
54
35
  async function readOptionalText(filePath) {
55
36
  if (!filePath?.trim())
56
37
  return null;
@@ -62,18 +43,7 @@ async function readOptionalText(filePath) {
62
43
  }
63
44
  }
64
45
  function buildCodexArtifacts(opts) {
65
- return (runnerArtifactsFromSpecs([
66
- { path: opts.invocation.bundle_path, label: "bundle" },
67
- { path: opts.invocation.bootstrap_path, label: "bootstrap" },
68
- { path: opts.trace_artifact_path, label: "raw-trace" },
69
- { path: opts.trace_archive_path, label: "raw-trace-gzip" },
70
- { path: opts.stderr_artifact_path, label: "stderr-log" },
71
- { path: opts.stderr_archive_path, label: "stderr-log-gzip" },
72
- { path: opts.source_manifest_path, label: "source-result-manifest" },
73
- { path: opts.invocation.output_last_message_path, label: "assistant-last-message" },
74
- { path: opts.invalid_manifest_path, label: "invalid-result-manifest" },
75
- { path: opts.invocation.result_path, label: "result-manifest" },
76
- ]) ?? []);
46
+ return buildRunnerExecutionArtifacts({ ...opts, include_output_last_message: true });
77
47
  }
78
48
  function assertCodexBundle(bundle) {
79
49
  if (bundle.execution.adapter_id !== "codex") {
@@ -1 +1 @@
1
- {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../src/runner/adapters/custom.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,EAEhB,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAKL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AA+TrB,qBAAa,mBAAoB,YAAW,aAAa;IAG3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;gBAEH,MAAM,EAAE,kBAAkB,GAAG,SAAS;IAEnE,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,yBAAyB;IAI7E,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmD/D,OAAO,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAqN7D"}
1
+ {"version":3,"file":"custom.d.ts","sourceRoot":"","sources":["../../../src/runner/adapters/custom.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAI9D,OAAO,KAAK,EACV,yBAAyB,EACzB,mBAAmB,EACnB,gBAAgB,EAEhB,YAAY,EACb,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,aAAa,EACnB,MAAM,aAAa,CAAC;AAoSrB,qBAAa,mBAAoB,YAAW,aAAa;IAG3C,OAAO,CAAC,QAAQ,CAAC,MAAM;IAFnC,QAAQ,CAAC,EAAE,EAAG,QAAQ,CAAU;gBAEH,MAAM,EAAE,kBAAkB,GAAG,SAAS;IAEnE,oBAAoB,CAAC,OAAO,EAAE,mBAAmB,GAAG,yBAAyB;IAI7E,OAAO,CAAC,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAmD/D,OAAO,CAAC,UAAU,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,CAAC;CAqN7D"}
@@ -2,7 +2,8 @@ import { readFile } from "node:fs/promises";
2
2
  import { exitCodeForError } from "../../cli/exit-codes.js";
3
3
  import { CliError } from "../../shared/errors.js";
4
4
  import { evolveRunnerRunState } from "../artifacts.js";
5
- import { runnerArtifactsFromSpecs, runnerAdapterCancelledResult, runnerAdapterFailureResult, runnerAdapterSuccessResult, } from "./shared.js";
5
+ import { runnerAdapterCancelledResult, runnerAdapterFailureResult, runnerAdapterSuccessResult, } from "./shared.js";
6
+ import { buildInvocationEventData, buildRunnerExecutionArtifacts, durationMs, } from "./runtime-shared.js";
6
7
  import { exitCodeForSignal, runSupervisedProcess, } from "../process-supervision.js";
7
8
  import { InvalidRunnerResultManifestError, manifestFromRunnerResult, preserveRunnerResultManifestSource, preserveInvalidRunnerResultManifest, readRunnerResultManifest, writeRunnerResultManifest, } from "../result-manifest.js";
8
9
  import { RunnerRunRepository } from "../run-repository.js";
@@ -144,24 +145,6 @@ function buildCustomCommand(opts) {
144
145
  ...opts.command,
145
146
  ];
146
147
  }
147
- function durationMs(startedAt, endedAt) {
148
- const started = Date.parse(startedAt);
149
- const ended = Date.parse(endedAt);
150
- if (Number.isNaN(started) || Number.isNaN(ended))
151
- return undefined;
152
- return Math.max(0, ended - started);
153
- }
154
- function buildInvocationEventData(invocation) {
155
- return {
156
- executable: invocation.argv[0] ?? null,
157
- argv_count: invocation.argv.length,
158
- cwd: invocation.run_dir,
159
- env_keys: Object.keys(invocation.env).toSorted(),
160
- trace_policy: invocation.trace_policy,
161
- timeout_policy: invocation.timeout_policy,
162
- has_bootstrap_path: typeof invocation.bootstrap_path === "string" && invocation.bootstrap_path.trim().length > 0,
163
- };
164
- }
165
148
  function normalizeCustomCommand(value) {
166
149
  return Array.isArray(value)
167
150
  ? value.map((entry) => entry.trim()).filter((entry) => entry.length > 0)
@@ -179,17 +162,7 @@ function assertCustomBundle(bundle) {
179
162
  }
180
163
  }
181
164
  function buildCustomArtifacts(opts) {
182
- return (runnerArtifactsFromSpecs([
183
- { path: opts.invocation.bundle_path, label: "bundle" },
184
- { path: opts.invocation.bootstrap_path, label: "bootstrap" },
185
- { path: opts.trace_artifact_path, label: "raw-trace" },
186
- { path: opts.trace_archive_path, label: "raw-trace-gzip" },
187
- { path: opts.stderr_artifact_path, label: "stderr-log" },
188
- { path: opts.stderr_archive_path, label: "stderr-log-gzip" },
189
- { path: opts.source_manifest_path, label: "source-result-manifest" },
190
- { path: opts.invalid_manifest_path, label: "invalid-result-manifest" },
191
- { path: opts.invocation.result_path, label: "result-manifest" },
192
- ]) ?? []);
165
+ return buildRunnerExecutionArtifacts({ ...opts, include_output_last_message: false });
193
166
  }
194
167
  function mergeRunnerArtifacts(base, extra) {
195
168
  const merged = [];
@@ -0,0 +1,14 @@
1
+ import type { RunnerInvocation, RunnerResult } from "../types.js";
2
+ export declare function durationMs(startedAt: string, endedAt: string): number | undefined;
3
+ export declare function buildInvocationEventData(invocation: RunnerInvocation, extra?: Record<string, unknown>): Record<string, unknown>;
4
+ export declare function buildRunnerExecutionArtifacts(opts: {
5
+ invocation: RunnerInvocation;
6
+ trace_artifact_path?: string | null;
7
+ trace_archive_path?: string | null;
8
+ stderr_artifact_path?: string | null;
9
+ stderr_archive_path?: string | null;
10
+ source_manifest_path?: string | null;
11
+ invalid_manifest_path?: string | null;
12
+ include_output_last_message?: boolean;
13
+ }): NonNullable<RunnerResult["artifacts"]>;
14
+ //# sourceMappingURL=runtime-shared.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtime-shared.d.ts","sourceRoot":"","sources":["../../../src/runner/adapters/runtime-shared.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAGlE,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAKjF;AAED,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,gBAAgB,EAC5B,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAYzB;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,UAAU,EAAE,gBAAgB,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,mBAAmB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACrC,qBAAqB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC,GAAG,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAiBzC"}
@@ -0,0 +1,36 @@
1
+ import { runnerArtifactsFromSpecs } from "./shared.js";
2
+ export function durationMs(startedAt, endedAt) {
3
+ const started = Date.parse(startedAt);
4
+ const ended = Date.parse(endedAt);
5
+ if (Number.isNaN(started) || Number.isNaN(ended))
6
+ return undefined;
7
+ return Math.max(0, ended - started);
8
+ }
9
+ export function buildInvocationEventData(invocation, extra = {}) {
10
+ return {
11
+ executable: invocation.argv[0] ?? null,
12
+ argv_count: invocation.argv.length,
13
+ cwd: invocation.run_dir,
14
+ env_keys: Object.keys(invocation.env).toSorted(),
15
+ trace_policy: invocation.trace_policy,
16
+ timeout_policy: invocation.timeout_policy,
17
+ has_bootstrap_path: typeof invocation.bootstrap_path === "string" && invocation.bootstrap_path.trim().length > 0,
18
+ ...extra,
19
+ };
20
+ }
21
+ export function buildRunnerExecutionArtifacts(opts) {
22
+ return (runnerArtifactsFromSpecs([
23
+ { path: opts.invocation.bundle_path, label: "bundle" },
24
+ { path: opts.invocation.bootstrap_path, label: "bootstrap" },
25
+ { path: opts.trace_artifact_path, label: "raw-trace" },
26
+ { path: opts.trace_archive_path, label: "raw-trace-gzip" },
27
+ { path: opts.stderr_artifact_path, label: "stderr-log" },
28
+ { path: opts.stderr_archive_path, label: "stderr-log-gzip" },
29
+ { path: opts.source_manifest_path, label: "source-result-manifest" },
30
+ ...(opts.include_output_last_message
31
+ ? [{ path: opts.invocation.output_last_message_path, label: "assistant-last-message" }]
32
+ : []),
33
+ { path: opts.invalid_manifest_path, label: "invalid-result-manifest" },
34
+ { path: opts.invocation.result_path, label: "result-manifest" },
35
+ ]) ?? []);
36
+ }
@@ -0,0 +1,30 @@
1
+ import type { ResolvedExecutionProfileRuntime } from "../../runtime/execution-profile/index.js";
2
+ import type { ResolvedHarnessContract } from "../../runtime/harness/index.js";
3
+ import { type PolicyGatewayFlavor } from "../../shared/policy-gateway.js";
4
+ import type { RunnerPromptBlock } from "../types.js";
5
+ import { type ResolvedPromptSource } from "./prompt-block-shared.js";
6
+ export declare function resolveOwnerProfilePromptSource(opts: {
7
+ git_root: string;
8
+ agents_dir: string;
9
+ owner_id: string;
10
+ }): Promise<ResolvedPromptSource>;
11
+ export declare function loadOwnerProfilePrompt(opts: {
12
+ git_root: string;
13
+ agents_dir: string;
14
+ owner_id: string;
15
+ }): Promise<RunnerPromptBlock>;
16
+ export declare function resolvePolicyGatewayPromptSource(opts: {
17
+ git_root: string;
18
+ fallback_flavor: PolicyGatewayFlavor;
19
+ harness?: ResolvedHarnessContract;
20
+ }): Promise<ResolvedPromptSource>;
21
+ export declare function loadPolicyGatewayPrompt(opts: {
22
+ git_root: string;
23
+ fallback_flavor: PolicyGatewayFlavor;
24
+ harness?: ResolvedHarnessContract;
25
+ }): Promise<RunnerPromptBlock>;
26
+ export declare function loadExecutionProfilePrompt(opts: {
27
+ execution_profile?: ResolvedExecutionProfileRuntime;
28
+ }): RunnerPromptBlock | null;
29
+ export { loadFrameworkRunnerPrompt } from "./prompt-block-shared.js";
30
+ //# sourceMappingURL=base-prompt-sources.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-prompt-sources.d.ts","sourceRoot":"","sources":["../../../src/runner/context/base-prompt-sources.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAA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