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
@@ -0,0 +1,125 @@
1
+ import { readFile, stat } from "node:fs/promises";
2
+ import path from "node:path";
3
+ import { docChanged, extractTaskDoc, mergeTaskDoc, normalizeTaskDocVersion, parseTaskReadme, renderTaskReadme, } from "@agentplaneorg/core";
4
+ import { taskRecordToData } from "../../../backends/task-backend.js";
5
+ import { exitCodeForError } from "../../../cli/exit-codes.js";
6
+ import { CliError } from "../../../shared/errors.js";
7
+ import { writeTextIfChanged } from "../../../shared/write-if-changed.js";
8
+ import { resolveDocUpdatedBy, taskDataToFrontmatter } from "../task-backend.js";
9
+ function taskReadmePath(ctx, taskId) {
10
+ return path.join(ctx.resolvedProject.gitRoot, ctx.config.paths.workflow_dir, taskId, "README.md");
11
+ }
12
+ export function normalizeTaskRevision(value, fallback = 1) {
13
+ return Number.isInteger(value) && Number(value) > 0 ? Number(value) : fallback;
14
+ }
15
+ export function readStoredTaskRevision(value) {
16
+ return Number.isInteger(value) && Number(value) > 0 ? Number(value) : null;
17
+ }
18
+ export function isConcurrentReadmeChangeError(err) {
19
+ return (err instanceof CliError &&
20
+ err.code === "E_IO" &&
21
+ err.message.startsWith("Task README changed concurrently:"));
22
+ }
23
+ export function throwTaskRevisionConflict(opts) {
24
+ throw new CliError({
25
+ exitCode: exitCodeForError("E_VALIDATION"),
26
+ code: "E_VALIDATION",
27
+ message: `Task revision changed concurrently: ${opts.taskId} ` +
28
+ `(expected revision ${opts.expectedRevision}, current revision ${opts.currentRevision})`,
29
+ context: {
30
+ task_id: opts.taskId,
31
+ expected_revision: opts.expectedRevision,
32
+ current_revision: opts.currentRevision,
33
+ reason_code: "task_revision_conflict",
34
+ },
35
+ });
36
+ }
37
+ export async function readTaskReadmeCached(opts) {
38
+ const readmePath = taskReadmePath(opts.ctx, opts.taskId);
39
+ let text;
40
+ let st;
41
+ try {
42
+ st = await stat(readmePath);
43
+ text = await readFile(readmePath, "utf8");
44
+ }
45
+ catch (err) {
46
+ const code = err?.code;
47
+ if (code === "ENOENT") {
48
+ throw new CliError({
49
+ exitCode: 4,
50
+ code: "E_IO",
51
+ message: `ENOENT: no such file or directory, open '${readmePath}'`,
52
+ });
53
+ }
54
+ throw err;
55
+ }
56
+ const parsed = parseTaskReadme(text);
57
+ const task = taskRecordToData({
58
+ id: opts.taskId,
59
+ frontmatter: parsed.frontmatter,
60
+ body: parsed.body,
61
+ readmePath,
62
+ });
63
+ return { task, readmePath, mtimeMs: st.mtimeMs, parsed, rawText: text };
64
+ }
65
+ export async function ensureUnchangedOnDisk(opts) {
66
+ const st = await stat(opts.readmePath);
67
+ if (st.mtimeMs !== opts.expectedMtimeMs) {
68
+ throw new CliError({
69
+ exitCode: exitCodeForError("E_IO"),
70
+ code: "E_IO",
71
+ message: `Task README changed concurrently: ${opts.readmePath}`,
72
+ });
73
+ }
74
+ }
75
+ export async function didReadmeChangeOnDisk(opts) {
76
+ try {
77
+ const st = await stat(opts.readmePath);
78
+ return st.mtimeMs !== opts.expectedMtimeMs;
79
+ }
80
+ catch (err) {
81
+ const code = err?.code;
82
+ if (code === "ENOENT")
83
+ return true;
84
+ throw err;
85
+ }
86
+ }
87
+ export async function writeTaskReadme(opts) {
88
+ const { entry, next } = opts;
89
+ const frontmatter = { ...entry.parsed.frontmatter, ...taskDataToFrontmatter(next) };
90
+ let body = entry.parsed.body ?? "";
91
+ const existingDoc = extractTaskDoc(body);
92
+ const now = new Date().toISOString();
93
+ const currentDocVersion = normalizeTaskDocVersion(entry.parsed.frontmatter.doc_version);
94
+ const requestedDocVersion = normalizeTaskDocVersion(next.doc_version, currentDocVersion);
95
+ if (next.doc !== undefined) {
96
+ const nextDoc = String(next.doc ?? "");
97
+ body = mergeTaskDoc(body, nextDoc);
98
+ if (docChanged(existingDoc, nextDoc) || !frontmatter.doc_updated_at) {
99
+ frontmatter.doc_version = requestedDocVersion;
100
+ frontmatter.doc_updated_at = now;
101
+ frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
102
+ }
103
+ }
104
+ frontmatter.doc_version = normalizeTaskDocVersion(frontmatter.doc_version, requestedDocVersion);
105
+ if (typeof frontmatter.doc_updated_at !== "string" || frontmatter.doc_updated_at.trim() === "") {
106
+ frontmatter.doc_updated_at = now;
107
+ }
108
+ if (typeof frontmatter.doc_updated_by !== "string" || frontmatter.doc_updated_by.trim() === "") {
109
+ frontmatter.doc_updated_by = resolveDocUpdatedBy(next);
110
+ }
111
+ const storedRevision = readStoredTaskRevision(entry.parsed.frontmatter.revision);
112
+ frontmatter.revision = storedRevision ?? 1;
113
+ let nextText = renderTaskReadme(frontmatter, body);
114
+ nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
115
+ if (storedRevision !== null && nextText !== entry.rawText) {
116
+ frontmatter.revision = storedRevision + 1;
117
+ nextText = renderTaskReadme(frontmatter, body);
118
+ nextText = nextText.endsWith("\n") ? nextText : `${nextText}\n`;
119
+ }
120
+ await ensureUnchangedOnDisk({
121
+ readmePath: entry.readmePath,
122
+ expectedMtimeMs: entry.mtimeMs,
123
+ });
124
+ return await writeTextIfChanged(entry.readmePath, nextText);
125
+ }
@@ -0,0 +1,26 @@
1
+ import type { TaskData } from "../../../backends/task-backend.js";
2
+ import type { TaskStore as TaskStoreContract, TaskStoreContext, TaskStoreIntentResult, TaskStoreMutationOptions, TaskStorePatch } from "./types.js";
3
+ export declare class TaskStore implements TaskStoreContract {
4
+ private ctx;
5
+ private cache;
6
+ constructor(ctx: TaskStoreContext);
7
+ get(taskId: string): Promise<TaskData>;
8
+ update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
9
+ changed: boolean;
10
+ task: TaskData;
11
+ }>;
12
+ patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
13
+ changed: boolean;
14
+ task: TaskData;
15
+ }>;
16
+ mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
17
+ changed: boolean;
18
+ task: TaskData;
19
+ }>;
20
+ private getCached;
21
+ private runWithRetry;
22
+ private writeNextTask;
23
+ }
24
+ export declare function getTaskStore(ctx: TaskStoreContext): TaskStore;
25
+ export declare function backendIsLocalFileBackend(ctx: TaskStoreContext): boolean;
26
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../../../src/commands/shared/task-store/store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAiBlE,OAAO,KAAK,EAEV,SAAS,IAAI,iBAAiB,EAC9B,gBAAgB,EAChB,qBAAqB,EACrB,wBAAwB,EACxB,cAAc,EACf,MAAM,YAAY,CAAC;AAEpB,qBAAa,SAAU,YAAW,iBAAiB;IACjD,OAAO,CAAC,GAAG,CAAmB;IAC9B,OAAO,CAAC,KAAK,CAA0C;gBAE3C,GAAG,EAAE,gBAAgB;IAI3B,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAKtC,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,QAAQ,CAAC,GAAG,QAAQ,EAC5D,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IAM1C,KAAK,CACT,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CACP,OAAO,EAAE,QAAQ,KACd,OAAO,CAAC,cAAc,GAAG,IAAI,GAAG,SAAS,CAAC,GAAG,cAAc,GAAG,IAAI,GAAG,SAAS,EACnF,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;IAQ1C,MAAM,CACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,CAAC,OAAO,EAAE,QAAQ,KAAK,OAAO,CAAC,qBAAqB,CAAC,GAAG,qBAAqB,EACtF,IAAI,GAAE,wBAA6B,GAClC,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC;YAOlC,SAAS;YAmBT,YAAY;YAiDZ,aAAa;CAgB5B;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,gBAAgB,GAAG,SAAS,CAI7D;AAED,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,gBAAgB,GAAG,OAAO,CAExE"}
@@ -0,0 +1,105 @@
1
+ import { exitCodeForError } from "../../../cli/exit-codes.js";
2
+ import { CliError } from "../../../shared/errors.js";
3
+ import { backendUsesLocalTaskStore } from "../task-backend.js";
4
+ import { applyTaskStoreIntents, resolveTaskStoreIntents, resolveTaskStorePatch, } from "./intents.js";
5
+ import { didReadmeChangeOnDisk, isConcurrentReadmeChangeError, normalizeTaskRevision, readTaskReadmeCached, throwTaskRevisionConflict, writeTaskReadme, } from "./readme.js";
6
+ export class TaskStore {
7
+ ctx;
8
+ cache = new Map();
9
+ constructor(ctx) {
10
+ this.ctx = ctx;
11
+ }
12
+ async get(taskId) {
13
+ const entry = await this.getCached(taskId);
14
+ return entry.task;
15
+ }
16
+ async update(taskId, updater, opts = {}) {
17
+ return await this.runWithRetry(taskId, opts, async (entry) => {
18
+ return await updater({ ...entry.task });
19
+ });
20
+ }
21
+ async patch(taskId, builder, opts = {}) {
22
+ return await this.mutate(taskId, async (current) => resolveTaskStorePatch(await builder(current)), opts);
23
+ }
24
+ async mutate(taskId, builder, opts = {}) {
25
+ return await this.runWithRetry(taskId, opts, async (entry) => {
26
+ const intents = resolveTaskStoreIntents(await builder({ ...entry.task }));
27
+ return applyTaskStoreIntents(entry, intents);
28
+ });
29
+ }
30
+ async getCached(taskId) {
31
+ const key = taskId.trim();
32
+ if (!key) {
33
+ throw new CliError({
34
+ exitCode: exitCodeForError("E_USAGE"),
35
+ code: "E_USAGE",
36
+ message: "task id is required",
37
+ });
38
+ }
39
+ const existing = this.cache.get(key);
40
+ if (existing)
41
+ return await existing;
42
+ const load = (async () => {
43
+ return await readTaskReadmeCached({ ctx: this.ctx, taskId: key });
44
+ })();
45
+ this.cache.set(key, load);
46
+ return await load;
47
+ }
48
+ async runWithRetry(taskId, opts, computeNext) {
49
+ for (let attempt = 0; attempt < 2; attempt++) {
50
+ const entry = await this.getCached(taskId);
51
+ if (opts.expectedRevision !== undefined) {
52
+ const expectedRevision = normalizeTaskRevision(opts.expectedRevision);
53
+ const currentRevision = normalizeTaskRevision(entry.task.revision);
54
+ if (currentRevision !== expectedRevision) {
55
+ throwTaskRevisionConflict({ taskId, expectedRevision, currentRevision });
56
+ }
57
+ }
58
+ let next;
59
+ try {
60
+ next = await computeNext(entry);
61
+ }
62
+ catch (err) {
63
+ if (attempt === 0 &&
64
+ err instanceof CliError &&
65
+ err.code === "E_VALIDATION" &&
66
+ (await didReadmeChangeOnDisk({
67
+ readmePath: entry.readmePath,
68
+ expectedMtimeMs: entry.mtimeMs,
69
+ }))) {
70
+ this.cache.delete(taskId);
71
+ continue;
72
+ }
73
+ throw err;
74
+ }
75
+ try {
76
+ return await this.writeNextTask(taskId, entry, next);
77
+ }
78
+ catch (err) {
79
+ if (attempt === 0 && isConcurrentReadmeChangeError(err)) {
80
+ this.cache.delete(taskId);
81
+ continue;
82
+ }
83
+ throw err;
84
+ }
85
+ }
86
+ const task = await this.get(taskId);
87
+ return { changed: false, task };
88
+ }
89
+ async writeNextTask(taskId, entry, next) {
90
+ const changed = await writeTaskReadme({ entry, next });
91
+ this.cache.set(taskId, (async () => {
92
+ return await readTaskReadmeCached({ ctx: this.ctx, taskId });
93
+ })());
94
+ const updated = await this.get(taskId);
95
+ return { changed, task: updated };
96
+ }
97
+ }
98
+ export function getTaskStore(ctx) {
99
+ const memo = ctx.memo;
100
+ memo.taskStore ??= new TaskStore(ctx);
101
+ return memo.taskStore;
102
+ }
103
+ export function backendIsLocalFileBackend(ctx) {
104
+ return backendUsesLocalTaskStore(ctx);
105
+ }
@@ -0,0 +1,94 @@
1
+ import type { ParsedTaskReadme } from "@agentplaneorg/core";
2
+ import type { TaskData, TaskEvent } from "../../../backends/task-backend.js";
3
+ import type { CommandContext } from "../task-backend.js";
4
+ export type CachedTask = {
5
+ task: TaskData;
6
+ readmePath: string;
7
+ mtimeMs: number;
8
+ parsed: ParsedTaskReadme;
9
+ rawText: string;
10
+ };
11
+ export type TaskComment = NonNullable<TaskData["comments"]>[number];
12
+ export type TaskDocState = {
13
+ comments: TaskData["comments"] | null;
14
+ doc: string;
15
+ doc_updated_at?: string;
16
+ doc_updated_by?: string;
17
+ doc_version: 2 | 3;
18
+ owner: string;
19
+ sections?: TaskData["sections"] | null;
20
+ };
21
+ export type TaskStoreTaskPatch = Partial<Omit<TaskData, "doc" | "comments" | "events" | "doc_version" | "doc_updated_at" | "doc_updated_by">>;
22
+ export type TaskStoreDocPatch = {
23
+ kind: "replace-doc";
24
+ doc: string;
25
+ expectedCurrentDoc?: string | null;
26
+ } | {
27
+ kind: "set-section";
28
+ section: string;
29
+ text: string;
30
+ requiredSections: string[];
31
+ expectedCurrentText?: string | null;
32
+ };
33
+ export type TaskStorePatch = {
34
+ task?: TaskStoreTaskPatch;
35
+ appendComments?: TaskComment[];
36
+ appendEvents?: TaskEvent[];
37
+ doc?: TaskStoreDocPatch;
38
+ docMeta?: {
39
+ touch?: boolean;
40
+ updatedBy?: string;
41
+ version?: 2 | 3;
42
+ };
43
+ };
44
+ export type TaskStoreIntent = {
45
+ kind: "set-task-fields";
46
+ task: TaskStoreTaskPatch;
47
+ } | {
48
+ kind: "append-comments";
49
+ comments: TaskComment[];
50
+ } | {
51
+ kind: "append-events";
52
+ events: TaskEvent[];
53
+ } | {
54
+ kind: "replace-doc";
55
+ doc: string;
56
+ expectedCurrentDoc?: string | null;
57
+ } | {
58
+ kind: "set-section";
59
+ section: string;
60
+ text: string;
61
+ requiredSections: string[];
62
+ expectedCurrentText?: string | null;
63
+ } | {
64
+ kind: "touch-doc-meta";
65
+ updatedBy?: string;
66
+ version?: 2 | 3;
67
+ };
68
+ export type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
69
+ export type TaskStoreMutationOptions = {
70
+ expectedRevision?: number;
71
+ };
72
+ export type TaskStoreLike = Pick<TaskStore, "patch"> & {
73
+ mutate?: TaskStore["mutate"];
74
+ };
75
+ export type TaskStoreReader = {
76
+ get(taskId: string): Promise<TaskData>;
77
+ };
78
+ export interface TaskStore {
79
+ get(taskId: string): Promise<TaskData>;
80
+ update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
81
+ changed: boolean;
82
+ task: TaskData;
83
+ }>;
84
+ patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
85
+ changed: boolean;
86
+ task: TaskData;
87
+ }>;
88
+ mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
89
+ changed: boolean;
90
+ task: TaskData;
91
+ }>;
92
+ }
93
+ export type TaskStoreContext = CommandContext;
94
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/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E,OAAO,CAAC;QAAC,IAAI,EAAE,QAAQ,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,gBAAgB,GAAG,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,110 +1,4 @@
1
- import { type TaskData, type TaskEvent } from "../../backends/task-backend.js";
2
- import { type CommandContext } from "./task-backend.js";
3
- type TaskComment = NonNullable<TaskData["comments"]>[number];
4
- export type TaskStoreTaskPatch = Partial<Omit<TaskData, "doc" | "comments" | "events" | "doc_version" | "doc_updated_at" | "doc_updated_by">>;
5
- export type TaskStoreDocPatch = {
6
- kind: "replace-doc";
7
- doc: string;
8
- expectedCurrentDoc?: string | null;
9
- } | {
10
- kind: "set-section";
11
- section: string;
12
- text: string;
13
- requiredSections: string[];
14
- expectedCurrentText?: string | null;
15
- };
16
- export type TaskStorePatch = {
17
- task?: TaskStoreTaskPatch;
18
- appendComments?: TaskComment[];
19
- appendEvents?: TaskEvent[];
20
- doc?: TaskStoreDocPatch;
21
- docMeta?: {
22
- touch?: boolean;
23
- updatedBy?: string;
24
- version?: 2 | 3;
25
- };
26
- };
27
- export type TaskStoreIntent = {
28
- kind: "set-task-fields";
29
- task: TaskStoreTaskPatch;
30
- } | {
31
- kind: "append-comments";
32
- comments: TaskComment[];
33
- } | {
34
- kind: "append-events";
35
- events: TaskEvent[];
36
- } | {
37
- kind: "replace-doc";
38
- doc: string;
39
- expectedCurrentDoc?: string | null;
40
- } | {
41
- kind: "set-section";
42
- section: string;
43
- text: string;
44
- requiredSections: string[];
45
- expectedCurrentText?: string | null;
46
- } | {
47
- kind: "touch-doc-meta";
48
- updatedBy?: string;
49
- version?: 2 | 3;
50
- };
51
- export type TaskStoreIntentResult = TaskStoreIntent | readonly TaskStoreIntent[] | null | undefined;
52
- export type TaskStoreMutationOptions = {
53
- expectedRevision?: number;
54
- };
55
- export type TaskStoreLike = Pick<TaskStore, "patch"> & {
56
- mutate?: TaskStore["mutate"];
57
- };
58
- export declare function setTaskFieldsIntent(task: TaskStoreTaskPatch): TaskStoreIntent;
59
- export declare function appendTaskCommentsIntent(comments: TaskComment[]): TaskStoreIntent;
60
- export declare function appendTaskCommentIntent(comment: TaskComment): TaskStoreIntent;
61
- export declare function appendTaskEventsIntent(events: TaskEvent[]): TaskStoreIntent;
62
- export declare function appendTaskEventIntent(event: TaskEvent): TaskStoreIntent;
63
- export declare function replaceTaskDocIntent(opts: {
64
- doc: string;
65
- expectedCurrentDoc?: string | null;
66
- }): TaskStoreIntent;
67
- export declare function setTaskSectionIntent(opts: {
68
- section: string;
69
- text: string;
70
- requiredSections: string[];
71
- expectedCurrentText?: string | null;
72
- }): TaskStoreIntent;
73
- export declare function touchTaskDocMetaIntent(opts?: {
74
- updatedBy?: string;
75
- version?: 2 | 3;
76
- }): TaskStoreIntent;
77
- export declare function taskStorePatchFromIntents(intents: TaskStoreIntentResult): TaskStorePatch | null | undefined;
78
- export declare function mutateTaskStore(store: TaskStoreLike, taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
79
- changed: boolean;
80
- task: TaskData;
81
- }>;
82
- export declare function applyTaskStoreIntentsToTask(task: TaskData, intents: TaskStoreIntentResult, opts?: {
83
- currentDocVersion?: 2 | 3;
84
- docUpdatedAt?: string;
85
- }): TaskData;
86
- export declare class TaskStore {
87
- private ctx;
88
- private cache;
89
- constructor(ctx: CommandContext);
90
- get(taskId: string): Promise<TaskData>;
91
- private getCached;
92
- update(taskId: string, updater: (current: TaskData) => Promise<TaskData> | TaskData, opts?: TaskStoreMutationOptions): Promise<{
93
- changed: boolean;
94
- task: TaskData;
95
- }>;
96
- patch(taskId: string, builder: (current: TaskData) => Promise<TaskStorePatch | null | undefined> | TaskStorePatch | null | undefined, opts?: TaskStoreMutationOptions): Promise<{
97
- changed: boolean;
98
- task: TaskData;
99
- }>;
100
- mutate(taskId: string, builder: (current: TaskData) => Promise<TaskStoreIntentResult> | TaskStoreIntentResult, opts?: TaskStoreMutationOptions): Promise<{
101
- changed: boolean;
102
- task: TaskData;
103
- }>;
104
- private runWithRetry;
105
- private writeNextTask;
106
- }
107
- export declare function getTaskStore(ctx: CommandContext): TaskStore;
108
- export declare function backendIsLocalFileBackend(ctx: CommandContext): boolean;
109
- export {};
1
+ export type { TaskStoreDocPatch, TaskStoreIntent, TaskStoreIntentResult, TaskStoreLike, TaskStoreMutationOptions, TaskStorePatch, TaskStoreTaskPatch, } from "./task-store/types.js";
2
+ export { appendTaskCommentIntent, appendTaskCommentsIntent, appendTaskEventIntent, appendTaskEventsIntent, applyTaskStoreIntentsToTask, mutateTaskStore, replaceTaskDocIntent, setTaskFieldsIntent, setTaskSectionIntent, taskStorePatchFromIntents, touchTaskDocMetaIntent, } from "./task-store/intents.js";
3
+ export { TaskStore, backendIsLocalFileBackend, getTaskStore } from "./task-store/store.js";
110
4
  //# sourceMappingURL=task-store.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"task-store.d.ts","sourceRoot":"","sources":["../../../src/commands/shared/task-store.ts"],"names":[],"mappings":"AAeA,OAAO,EAEL,KAAK,QAAQ,EACb,KAAK,SAAS,EAEf,MAAM,gCAAgC,CAAC;AAQxC,OAAO,EAA8C,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAUpG,KAAK,WAAW,GAAG,WAAW,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;AAW7D,MAAM,MAAM,kBAAkB,GAAG,OAAO,CACtC,IAAI,CACF,QAAQ,EACR,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,aAAa,GAAG,gBAAgB,GAAG,gBAAgB,CACpF,CACF,CAAC;AAEF,MAAM,MAAM,iBAAiB,GACzB;IACE,IAAI,EAAE,aAAa,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;IACZ,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC,GACD;IACE,IAAI,EAAE,aA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