agentplane 0.3.9 → 0.3.11

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 (404) hide show
  1. package/assets/AGENTS.md +4 -2
  2. package/assets/agents/CODER.json +1 -1
  3. package/assets/policy/dod.core.md +1 -1
  4. package/assets/policy/governance.md +5 -3
  5. package/assets/policy/incidents.md +19 -77
  6. package/assets/policy/workflow.branch_pr.md +2 -0
  7. package/assets/policy/workflow.direct.md +3 -1
  8. package/bin/agentplane.js +56 -1
  9. package/bin/runtime-watch.js +1 -0
  10. package/bin/stale-dist-policy.d.ts +1 -1
  11. package/bin/stale-dist-policy.js +13 -0
  12. package/dist/.build-manifest.json +462 -202
  13. package/dist/cli/bootstrap-guide.d.ts +1 -0
  14. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  15. package/dist/cli/bootstrap-guide.js +20 -1
  16. package/dist/cli/command-guide.d.ts.map +1 -1
  17. package/dist/cli/command-guide.js +2 -1
  18. package/dist/cli/command-invocations.d.ts.map +1 -1
  19. package/dist/cli/command-invocations.js +6 -1
  20. package/dist/cli/command-snippets.d.ts +2 -0
  21. package/dist/cli/command-snippets.d.ts.map +1 -1
  22. package/dist/cli/command-snippets.js +2 -0
  23. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  24. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  25. package/dist/cli/run-cli/command-catalog/core.js +10 -0
  26. package/dist/cli/run-cli/command-catalog/project.d.ts +1 -1
  27. package/dist/cli/run-cli/command-catalog/project.d.ts.map +1 -1
  28. package/dist/cli/run-cli/command-catalog/project.js +3 -1
  29. package/dist/cli/run-cli/command-catalog/task.d.ts +1 -1
  30. package/dist/cli/run-cli/command-catalog/task.d.ts.map +1 -1
  31. package/dist/cli/run-cli/command-catalog/task.js +10 -0
  32. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  33. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  34. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  35. package/dist/cli/run-cli/commands/config.js +13 -0
  36. package/dist/cli/run-cli/commands/core/preflight.d.ts.map +1 -1
  37. package/dist/cli/run-cli/commands/core/preflight.js +44 -1
  38. package/dist/cli/run-cli.js +2 -2
  39. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  40. package/dist/cli/run-cli.test-helpers.js +12 -0
  41. package/dist/commands/backend.d.ts.map +1 -1
  42. package/dist/commands/backend.js +4 -0
  43. package/dist/commands/branch/cleanup-merged.d.ts +2 -0
  44. package/dist/commands/branch/cleanup-merged.d.ts.map +1 -1
  45. package/dist/commands/branch/cleanup-merged.js +132 -28
  46. package/dist/commands/branch/work-start.d.ts.map +1 -1
  47. package/dist/commands/branch/work-start.js +60 -1
  48. package/dist/commands/cleanup/merged.command.d.ts +2 -0
  49. package/dist/commands/cleanup/merged.command.d.ts.map +1 -1
  50. package/dist/commands/cleanup/merged.command.js +24 -0
  51. package/dist/commands/doctor/branch-pr.d.ts +4 -0
  52. package/dist/commands/doctor/branch-pr.d.ts.map +1 -0
  53. package/dist/commands/doctor/branch-pr.js +96 -0
  54. package/dist/commands/doctor/fixes.d.ts +5 -0
  55. package/dist/commands/doctor/fixes.d.ts.map +1 -1
  56. package/dist/commands/doctor/fixes.js +70 -0
  57. package/dist/commands/doctor.run.d.ts.map +1 -1
  58. package/dist/commands/doctor.run.js +6 -1
  59. package/dist/commands/finish.run.d.ts.map +1 -1
  60. package/dist/commands/finish.run.js +11 -0
  61. package/dist/commands/finish.spec.d.ts +11 -0
  62. package/dist/commands/finish.spec.d.ts.map +1 -1
  63. package/dist/commands/finish.spec.js +51 -0
  64. package/dist/commands/guard/impl/close-message.d.ts.map +1 -1
  65. package/dist/commands/guard/impl/close-message.js +23 -6
  66. package/dist/commands/guard/impl/commands.d.ts.map +1 -1
  67. package/dist/commands/guard/impl/commands.js +24 -2
  68. package/dist/commands/guard/impl/env.d.ts +1 -0
  69. package/dist/commands/guard/impl/env.d.ts.map +1 -1
  70. package/dist/commands/guard/impl/env.js +1 -0
  71. package/dist/commands/hooks/index.d.ts.map +1 -1
  72. package/dist/commands/hooks/index.js +98 -1
  73. package/dist/commands/incidents/advise.command.d.ts +15 -0
  74. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  75. package/dist/commands/incidents/advise.command.js +139 -0
  76. package/dist/commands/incidents/collect.command.d.ts +11 -0
  77. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  78. package/dist/commands/incidents/collect.command.js +72 -0
  79. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  80. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  81. package/dist/commands/incidents/incidents.command.js +21 -0
  82. package/dist/commands/incidents/shared.d.ts +76 -0
  83. package/dist/commands/incidents/shared.d.ts.map +1 -0
  84. package/dist/commands/incidents/shared.js +261 -0
  85. package/dist/commands/pr/check.d.ts.map +1 -1
  86. package/dist/commands/pr/check.js +249 -75
  87. package/dist/commands/pr/close-superseded.d.ts +9 -0
  88. package/dist/commands/pr/close-superseded.d.ts.map +1 -0
  89. package/dist/commands/pr/close-superseded.js +129 -0
  90. package/dist/commands/pr/close.d.ts +11 -0
  91. package/dist/commands/pr/close.d.ts.map +1 -0
  92. package/dist/commands/pr/close.js +116 -0
  93. package/dist/commands/pr/index.d.ts +2 -0
  94. package/dist/commands/pr/index.d.ts.map +1 -1
  95. package/dist/commands/pr/index.js +2 -0
  96. package/dist/commands/pr/integrate/artifacts.d.ts +7 -0
  97. package/dist/commands/pr/integrate/artifacts.d.ts.map +1 -1
  98. package/dist/commands/pr/integrate/artifacts.js +66 -1
  99. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  100. package/dist/commands/pr/integrate/cmd.js +20 -0
  101. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts +8 -0
  102. package/dist/commands/pr/integrate/internal/bootstrap-guidance.d.ts.map +1 -0
  103. package/dist/commands/pr/integrate/internal/bootstrap-guidance.js +59 -0
  104. package/dist/commands/pr/integrate/internal/finalize.d.ts.map +1 -1
  105. package/dist/commands/pr/integrate/internal/finalize.js +40 -12
  106. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  107. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  108. package/dist/commands/pr/integrate/internal/merge.js +59 -15
  109. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts +13 -0
  110. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.d.ts.map +1 -0
  111. package/dist/commands/pr/integrate/internal/post-integrate-bootstrap.js +25 -0
  112. package/dist/commands/pr/integrate/internal/prepare.d.ts +3 -2
  113. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  114. package/dist/commands/pr/integrate/internal/prepare.js +107 -19
  115. package/dist/commands/pr/internal/freshness.d.ts +20 -0
  116. package/dist/commands/pr/internal/freshness.d.ts.map +1 -0
  117. package/dist/commands/pr/internal/freshness.js +50 -0
  118. package/dist/commands/pr/internal/gh-api.d.ts +6 -0
  119. package/dist/commands/pr/internal/gh-api.d.ts.map +1 -0
  120. package/dist/commands/pr/internal/gh-api.js +80 -0
  121. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  122. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  123. package/dist/commands/pr/internal/note-store.js +66 -0
  124. package/dist/commands/pr/internal/pr-paths.d.ts +13 -0
  125. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  126. package/dist/commands/pr/internal/pr-paths.js +13 -0
  127. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  128. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  129. package/dist/commands/pr/internal/review-template.js +221 -33
  130. package/dist/commands/pr/internal/sync.d.ts +41 -0
  131. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  132. package/dist/commands/pr/internal/sync.js +598 -0
  133. package/dist/commands/pr/note.d.ts.map +1 -1
  134. package/dist/commands/pr/note.js +37 -4
  135. package/dist/commands/pr/open.d.ts +1 -0
  136. package/dist/commands/pr/open.d.ts.map +1 -1
  137. package/dist/commands/pr/open.js +18 -54
  138. package/dist/commands/pr/pr.command.d.ts +15 -0
  139. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  140. package/dist/commands/pr/pr.command.js +124 -5
  141. package/dist/commands/pr/update.d.ts.map +1 -1
  142. package/dist/commands/pr/update.js +58 -74
  143. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  144. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  145. package/dist/commands/recipes/impl/commands/install.js +1 -1
  146. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  147. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  148. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  149. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  150. package/dist/commands/release/apply.command.d.ts.map +1 -1
  151. package/dist/commands/release/apply.command.js +12 -17
  152. package/dist/commands/release/apply.preflight.d.ts.map +1 -1
  153. package/dist/commands/release/apply.preflight.js +1 -1
  154. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  155. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  156. package/dist/commands/shared/approval-requirements.js +3 -73
  157. package/dist/commands/shared/gh-transport.d.ts +16 -0
  158. package/dist/commands/shared/gh-transport.d.ts.map +1 -0
  159. package/dist/commands/shared/gh-transport.js +71 -0
  160. package/dist/commands/shared/git-diff.d.ts +3 -1
  161. package/dist/commands/shared/git-diff.d.ts.map +1 -1
  162. package/dist/commands/shared/git-diff.js +10 -2
  163. package/dist/commands/shared/git-ops.d.ts +1 -0
  164. package/dist/commands/shared/git-ops.d.ts.map +1 -1
  165. package/dist/commands/shared/git-ops.js +15 -0
  166. package/dist/commands/shared/git-worktree.d.ts +2 -0
  167. package/dist/commands/shared/git-worktree.d.ts.map +1 -1
  168. package/dist/commands/shared/git-worktree.js +22 -2
  169. package/dist/commands/shared/network-approval.d.ts +2 -0
  170. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  171. package/dist/commands/shared/network-approval.js +1 -1
  172. package/dist/commands/shared/post-commit-pr-artifacts.d.ts +9 -0
  173. package/dist/commands/shared/post-commit-pr-artifacts.d.ts.map +1 -0
  174. package/dist/commands/shared/post-commit-pr-artifacts.js +22 -0
  175. package/dist/commands/shared/pr-meta.d.ts +29 -0
  176. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  177. package/dist/commands/shared/pr-meta.js +152 -3
  178. package/dist/commands/shared/task-backend.d.ts +9 -0
  179. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  180. package/dist/commands/shared/task-backend.js +34 -22
  181. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  182. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  183. package/dist/commands/shared/task-local-freshness.js +20 -0
  184. package/dist/commands/shared/task-mutation.d.ts +2 -0
  185. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  186. package/dist/commands/shared/task-mutation.js +7 -0
  187. package/dist/commands/task/block.d.ts.map +1 -1
  188. package/dist/commands/task/block.js +1 -0
  189. package/dist/commands/task/close-duplicate.d.ts.map +1 -1
  190. package/dist/commands/task/close-duplicate.js +34 -1
  191. package/dist/commands/task/close-shared.d.ts.map +1 -1
  192. package/dist/commands/task/close-shared.js +1 -0
  193. package/dist/commands/task/derive.js +1 -1
  194. package/dist/commands/task/doc-template.d.ts.map +1 -1
  195. package/dist/commands/task/doc-template.js +7 -11
  196. package/dist/commands/task/findings-add.command.d.ts +20 -0
  197. package/dist/commands/task/findings-add.command.d.ts.map +1 -0
  198. package/dist/commands/task/findings-add.command.js +165 -0
  199. package/dist/commands/task/findings.command.d.ts +7 -0
  200. package/dist/commands/task/findings.command.d.ts.map +1 -0
  201. package/dist/commands/task/findings.command.js +20 -0
  202. package/dist/commands/task/findings.d.ts +63 -0
  203. package/dist/commands/task/findings.d.ts.map +1 -0
  204. package/dist/commands/task/findings.js +188 -0
  205. package/dist/commands/task/finish-shared.d.ts +1 -0
  206. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  207. package/dist/commands/task/finish-shared.js +60 -3
  208. package/dist/commands/task/finish.d.ts +10 -0
  209. package/dist/commands/task/finish.d.ts.map +1 -1
  210. package/dist/commands/task/finish.js +143 -0
  211. package/dist/commands/task/hosted-close-pr.command.d.ts +11 -0
  212. package/dist/commands/task/hosted-close-pr.command.d.ts.map +1 -0
  213. package/dist/commands/task/hosted-close-pr.command.js +414 -0
  214. package/dist/commands/task/hosted-close.command.d.ts.map +1 -1
  215. package/dist/commands/task/hosted-close.command.js +49 -1
  216. package/dist/commands/task/hosted-merge-sync.d.ts +38 -0
  217. package/dist/commands/task/hosted-merge-sync.d.ts.map +1 -1
  218. package/dist/commands/task/hosted-merge-sync.js +249 -17
  219. package/dist/commands/task/index.d.ts +1 -0
  220. package/dist/commands/task/index.d.ts.map +1 -1
  221. package/dist/commands/task/index.js +1 -0
  222. package/dist/commands/task/new.d.ts +1 -0
  223. package/dist/commands/task/new.d.ts.map +1 -1
  224. package/dist/commands/task/new.js +140 -30
  225. package/dist/commands/task/new.spec.d.ts.map +1 -1
  226. package/dist/commands/task/new.spec.js +7 -0
  227. package/dist/commands/task/normalize.command.d.ts +2 -0
  228. package/dist/commands/task/normalize.command.d.ts.map +1 -1
  229. package/dist/commands/task/normalize.command.js +45 -0
  230. package/dist/commands/task/normalize.d.ts +2 -0
  231. package/dist/commands/task/normalize.d.ts.map +1 -1
  232. package/dist/commands/task/normalize.js +85 -8
  233. package/dist/commands/task/plan.d.ts.map +1 -1
  234. package/dist/commands/task/plan.js +7 -10
  235. package/dist/commands/task/set-status.d.ts.map +1 -1
  236. package/dist/commands/task/set-status.js +1 -0
  237. package/dist/commands/task/shared/docs.d.ts +6 -0
  238. package/dist/commands/task/shared/docs.d.ts.map +1 -1
  239. package/dist/commands/task/shared/docs.js +14 -0
  240. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  241. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  242. package/dist/commands/task/shared/transition-command.js +1 -0
  243. package/dist/commands/task/shared/transitions.d.ts.map +1 -1
  244. package/dist/commands/task/shared/transitions.js +11 -1
  245. package/dist/commands/task/shared.d.ts +1 -1
  246. package/dist/commands/task/shared.d.ts.map +1 -1
  247. package/dist/commands/task/shared.js +1 -1
  248. package/dist/commands/task/start-ready.d.ts.map +1 -1
  249. package/dist/commands/task/start-ready.js +98 -1
  250. package/dist/commands/task/start.d.ts.map +1 -1
  251. package/dist/commands/task/start.js +18 -10
  252. package/dist/commands/task/task.command.d.ts.map +1 -1
  253. package/dist/commands/task/task.command.js +4 -0
  254. package/dist/commands/task/verify-command-shared.d.ts +19 -0
  255. package/dist/commands/task/verify-command-shared.d.ts.map +1 -1
  256. package/dist/commands/task/verify-command-shared.js +152 -1
  257. package/dist/commands/task/verify-ok.command.d.ts.map +1 -1
  258. package/dist/commands/task/verify-ok.command.js +15 -2
  259. package/dist/commands/task/verify-record.d.ts +36 -0
  260. package/dist/commands/task/verify-record.d.ts.map +1 -1
  261. package/dist/commands/task/verify-record.js +193 -11
  262. package/dist/commands/task/verify-rework.command.d.ts.map +1 -1
  263. package/dist/commands/task/verify-rework.command.js +15 -2
  264. package/dist/commands/task/verify-show.command.d.ts +1 -1
  265. package/dist/commands/task/verify-show.command.d.ts.map +1 -1
  266. package/dist/commands/task/verify-show.command.js +28 -1
  267. package/dist/commands/upgrade.d.ts.map +1 -1
  268. package/dist/commands/upgrade.js +6 -1
  269. package/dist/commands/verify.run.d.ts.map +1 -1
  270. package/dist/commands/verify.run.js +12 -0
  271. package/dist/commands/verify.spec.d.ts +2 -6
  272. package/dist/commands/verify.spec.d.ts.map +1 -1
  273. package/dist/commands/verify.spec.js +30 -3
  274. package/dist/policy/engine.d.ts +3 -1
  275. package/dist/policy/engine.d.ts.map +1 -1
  276. package/dist/policy/engine.js +5 -6
  277. package/dist/policy/taxonomy.d.ts +17 -0
  278. package/dist/policy/taxonomy.d.ts.map +1 -0
  279. package/dist/policy/taxonomy.js +302 -0
  280. package/dist/policy/types.d.ts +2 -1
  281. package/dist/policy/types.d.ts.map +1 -1
  282. package/dist/runner/artifacts.d.ts.map +1 -1
  283. package/dist/runner/artifacts.js +2 -0
  284. package/dist/runner/context/base-prompts.d.ts +25 -0
  285. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  286. package/dist/runner/context/base-prompts.js +182 -54
  287. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  288. package/dist/runner/context/recipe-context.js +5 -0
  289. package/dist/runner/types.d.ts +12 -0
  290. package/dist/runner/types.d.ts.map +1 -1
  291. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  292. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  293. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  294. package/dist/runner/usecases/task-run-inspect.js +9 -7
  295. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  296. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  297. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  298. package/dist/runner/usecases/task-run.js +59 -12
  299. package/dist/runtime/approvals/index.d.ts +3 -0
  300. package/dist/runtime/approvals/index.d.ts.map +1 -0
  301. package/dist/runtime/approvals/index.js +1 -0
  302. package/dist/runtime/approvals/runtime.d.ts +12 -0
  303. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  304. package/dist/runtime/approvals/runtime.js +154 -0
  305. package/dist/runtime/approvals/types.d.ts +31 -0
  306. package/dist/runtime/approvals/types.d.ts.map +1 -0
  307. package/dist/runtime/approvals/types.js +1 -0
  308. package/dist/runtime/behavior/index.d.ts +3 -0
  309. package/dist/runtime/behavior/index.d.ts.map +1 -0
  310. package/dist/runtime/behavior/index.js +1 -0
  311. package/dist/runtime/behavior/resolve.d.ts +7 -0
  312. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  313. package/dist/runtime/behavior/resolve.js +66 -0
  314. package/dist/runtime/behavior/types.d.ts +25 -0
  315. package/dist/runtime/behavior/types.d.ts.map +1 -0
  316. package/dist/runtime/behavior/types.js +1 -0
  317. package/dist/runtime/capabilities/backend.d.ts +7 -0
  318. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  319. package/dist/runtime/capabilities/backend.js +104 -0
  320. package/dist/runtime/capabilities/index.d.ts +6 -0
  321. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  322. package/dist/runtime/capabilities/index.js +4 -0
  323. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  324. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  325. package/dist/runtime/capabilities/recipe.js +123 -0
  326. package/dist/runtime/capabilities/registry.d.ts +6 -0
  327. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  328. package/dist/runtime/capabilities/registry.js +69 -0
  329. package/dist/runtime/capabilities/runner.d.ts +8 -0
  330. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  331. package/dist/runtime/capabilities/runner.js +73 -0
  332. package/dist/runtime/capabilities/types.d.ts +28 -0
  333. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  334. package/dist/runtime/capabilities/types.js +1 -0
  335. package/dist/runtime/execution-profile/index.d.ts +3 -0
  336. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  337. package/dist/runtime/execution-profile/index.js +1 -0
  338. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  339. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  340. package/dist/runtime/execution-profile/resolve.js +80 -0
  341. package/dist/runtime/execution-profile/types.d.ts +27 -0
  342. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  343. package/dist/runtime/execution-profile/types.js +1 -0
  344. package/dist/runtime/explain/index.d.ts +3 -0
  345. package/dist/runtime/explain/index.d.ts.map +1 -0
  346. package/dist/runtime/explain/index.js +1 -0
  347. package/dist/runtime/explain/resolve.d.ts +14 -0
  348. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  349. package/dist/runtime/explain/resolve.js +50 -0
  350. package/dist/runtime/explain/types.d.ts +28 -0
  351. package/dist/runtime/explain/types.d.ts.map +1 -0
  352. package/dist/runtime/explain/types.js +1 -0
  353. package/dist/runtime/harness/index.d.ts +4 -0
  354. package/dist/runtime/harness/index.d.ts.map +1 -0
  355. package/dist/runtime/harness/index.js +2 -0
  356. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  357. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  358. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  359. package/dist/runtime/harness/resolve.d.ts +13 -0
  360. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  361. package/dist/runtime/harness/resolve.js +146 -0
  362. package/dist/runtime/harness/types.d.ts +65 -0
  363. package/dist/runtime/harness/types.d.ts.map +1 -0
  364. package/dist/runtime/harness/types.js +1 -0
  365. package/dist/runtime/incidents/index.d.ts +3 -0
  366. package/dist/runtime/incidents/index.d.ts.map +1 -0
  367. package/dist/runtime/incidents/index.js +1 -0
  368. package/dist/runtime/incidents/resolve.d.ts +26 -0
  369. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  370. package/dist/runtime/incidents/resolve.js +683 -0
  371. package/dist/runtime/incidents/types.d.ts +84 -0
  372. package/dist/runtime/incidents/types.d.ts.map +1 -0
  373. package/dist/runtime/incidents/types.js +1 -0
  374. package/dist/runtime/protocol/index.d.ts +3 -0
  375. package/dist/runtime/protocol/index.d.ts.map +1 -0
  376. package/dist/runtime/protocol/index.js +2 -0
  377. package/dist/runtime/protocol/resolve.d.ts +16 -0
  378. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  379. package/dist/runtime/protocol/resolve.js +36 -0
  380. package/dist/runtime/protocol/types.d.ts +36 -0
  381. package/dist/runtime/protocol/types.d.ts.map +1 -0
  382. package/dist/runtime/protocol/types.js +1 -0
  383. package/dist/runtime/task-intake/index.d.ts +3 -0
  384. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  385. package/dist/runtime/task-intake/index.js +1 -0
  386. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  387. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  388. package/dist/runtime/task-intake/resolve.js +316 -0
  389. package/dist/runtime/task-intake/types.d.ts +117 -0
  390. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  391. package/dist/runtime/task-intake/types.js +1 -0
  392. package/dist/shared/env.d.ts +1 -0
  393. package/dist/shared/env.d.ts.map +1 -1
  394. package/dist/shared/env.js +22 -1
  395. package/dist/shared/protected-paths.d.ts +4 -0
  396. package/dist/shared/protected-paths.d.ts.map +1 -1
  397. package/dist/shared/protected-paths.js +8 -4
  398. package/dist/usecases/context/resolve-context.d.ts +55 -6
  399. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  400. package/dist/usecases/context/resolve-context.js +96 -6
  401. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  402. package/dist/usecases/task/task-list-usecase.js +8 -2
  403. package/dist/usecases/task/task-new-usecase.js +4 -4
  404. package/package.json +2 -2
@@ -0,0 +1,84 @@
1
+ export type IncidentRegistryEntryState = "open" | "stabilized" | "promoted";
2
+ export type IncidentRegistryEntry = {
3
+ id: string;
4
+ date: string;
5
+ scope: string;
6
+ failure: string;
7
+ rule: string;
8
+ evidence: string;
9
+ enforcement: string;
10
+ state: IncidentRegistryEntryState;
11
+ tags: string[];
12
+ match: string[];
13
+ advice: string | null;
14
+ sourceTask: string | null;
15
+ fixability: "external" | "repo-fixable" | null;
16
+ rawFields: Record<string, string>;
17
+ line: number;
18
+ };
19
+ export type IncidentRegistry = {
20
+ entries: IncidentRegistryEntry[];
21
+ };
22
+ export type IncidentFindingCandidate = {
23
+ observation: string;
24
+ impact: string | null;
25
+ resolution: string | null;
26
+ promotion: string | null;
27
+ incidentScope: string | null;
28
+ incidentRule: string | null;
29
+ incidentAdvice: string | null;
30
+ incidentTags: string[];
31
+ incidentMatch: string[];
32
+ incidentExternal: boolean;
33
+ incidentInternal: boolean;
34
+ fixability: "external" | "repo-fixable" | null;
35
+ line: number;
36
+ rawFields: Record<string, string>;
37
+ };
38
+ export type IncidentSkippedFinding = {
39
+ observation: string;
40
+ line: number;
41
+ reason: "not_marked_external_or_promotable";
42
+ rawFields: Record<string, string>;
43
+ };
44
+ export type IncidentPromotionTaskContext = {
45
+ id: string;
46
+ title: string;
47
+ description: string;
48
+ scope?: string | null;
49
+ tags: string[];
50
+ commitHash?: string | null;
51
+ };
52
+ export type IncidentPromotionDraft = {
53
+ candidate: IncidentFindingCandidate;
54
+ entry: IncidentRegistryEntry;
55
+ fingerprint: string;
56
+ };
57
+ export type IncidentPromotionIssue = {
58
+ candidate: IncidentFindingCandidate;
59
+ missingFields: string[];
60
+ };
61
+ export type IncidentCollectionPlan = {
62
+ candidates: IncidentFindingCandidate[];
63
+ skipped: IncidentSkippedFinding[];
64
+ promotable: IncidentPromotionDraft[];
65
+ duplicates: IncidentPromotionDraft[];
66
+ issues: IncidentPromotionIssue[];
67
+ findingsTextPresent: boolean;
68
+ structuredFindingCount: number;
69
+ };
70
+ export type IncidentAdviceQuery = {
71
+ taskId?: string;
72
+ title: string;
73
+ description: string;
74
+ scope?: string | null;
75
+ tags: string[];
76
+ };
77
+ export type IncidentAdviceMatch = {
78
+ entry: IncidentRegistryEntry;
79
+ score: number;
80
+ matchedTags: string[];
81
+ matchedTerms: string[];
82
+ scopeMatched: boolean;
83
+ };
84
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/incidents/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,YAAY,GAAG,UAAU,CAAC;AAE5E,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB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CAAC;IACd,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,YAAY,EAAE,OAAO,CAAC;CACvB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { AGENTPLANE_PROTOCOL_COMPATIBILITY, buildFrameworkExplainProtocolResult, buildFrameworkProtocolSurface, buildProtocolErrorResult, buildProtocolSuccessResult, } from "./resolve.js";
2
+ export { AGENTPLANE_PROTOCOL_SCHEMA_VERSION, type AgentplaneProtocolBase, type AgentplaneProtocolCompatibility, type AgentplaneProtocolError, type AgentplaneProtocolErrorResult, type AgentplaneProtocolKind, type AgentplaneProtocolResult, type AgentplaneProtocolSchemaVersion, type AgentplaneProtocolStatus, type AgentplaneProtocolSuccessResult, type FrameworkExplainProtocolResult, type FrameworkProtocolSurface, } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EACjC,mCAAmC,EACnC,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kCAAkC,EAClC,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,wBAAwB,EAC7B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,GAC9B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { AGENTPLANE_PROTOCOL_COMPATIBILITY, buildFrameworkExplainProtocolResult, buildFrameworkProtocolSurface, buildProtocolErrorResult, buildProtocolSuccessResult, } from "./resolve.js";
2
+ export { AGENTPLANE_PROTOCOL_SCHEMA_VERSION, } from "./types.js";
@@ -0,0 +1,16 @@
1
+ import type { FrameworkExplainPayload } from "../explain/index.js";
2
+ import { type AgentplaneProtocolCompatibility, type AgentplaneProtocolError, type AgentplaneProtocolErrorResult, type AgentplaneProtocolKind, type AgentplaneProtocolSuccessResult, type FrameworkExplainProtocolResult, type FrameworkProtocolSurface } from "./types.js";
3
+ export declare const AGENTPLANE_PROTOCOL_COMPATIBILITY: AgentplaneProtocolCompatibility;
4
+ export declare function buildProtocolSuccessResult<TKind extends AgentplaneProtocolKind, TData>(opts: {
5
+ kind: TKind;
6
+ data: TData;
7
+ }): AgentplaneProtocolSuccessResult<TKind, TData>;
8
+ export declare function buildProtocolErrorResult<TKind extends AgentplaneProtocolKind>(opts: {
9
+ kind: TKind;
10
+ error: AgentplaneProtocolError;
11
+ }): AgentplaneProtocolErrorResult<TKind>;
12
+ export declare function buildFrameworkExplainProtocolResult(explain: FrameworkExplainPayload): FrameworkExplainProtocolResult;
13
+ export declare function buildFrameworkProtocolSurface(opts: {
14
+ explain: FrameworkExplainPayload;
15
+ }): FrameworkProtocolSurface;
16
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,uBAAuB,EAC5B,KAAK,6BAA6B,EAClC,KAAK,sBAAsB,EAC3B,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,EAC9B,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,iCAAiC,EAAE,+BAK/C,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,KAAK,SAAS,sBAAsB,EAAE,KAAK,EAAE,IAAI,EAAE;IAC5F,IAAI,EAAE,KAAK,CAAC;IACZ,IAAI,EAAE,KAAK,CAAC;CACb,GAAG,+BAA+B,CAAC,KAAK,EAAE,KAAK,CAAC,CAQhD;AAED,wBAAgB,wBAAwB,CAAC,KAAK,SAAS,sBAAsB,EAAE,IAAI,EAAE;IACnF,IAAI,EAAE,KAAK,CAAC;IACZ,KAAK,EAAE,uBAAuB,CAAC;CAChC,GAAG,6BAA6B,CAAC,KAAK,CAAC,CAQvC;AAED,wBAAgB,mCAAmC,CACjD,OAAO,EAAE,uBAAuB,GAC/B,8BAA8B,CAKhC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,uBAAuB,CAAC;CAClC,GAAG,wBAAwB,CAI3B"}
@@ -0,0 +1,36 @@
1
+ import { AGENTPLANE_PROTOCOL_SCHEMA_VERSION, } from "./types.js";
2
+ export const AGENTPLANE_PROTOCOL_COMPATIBILITY = {
3
+ strategy: "additive",
4
+ breaking_changes_require_schema_version: true,
5
+ additive_fields_allowed: true,
6
+ new_result_kinds_allowed: true,
7
+ };
8
+ export function buildProtocolSuccessResult(opts) {
9
+ return {
10
+ schema_version: AGENTPLANE_PROTOCOL_SCHEMA_VERSION,
11
+ kind: opts.kind,
12
+ status: "ok",
13
+ compatibility: structuredClone(AGENTPLANE_PROTOCOL_COMPATIBILITY),
14
+ data: structuredClone(opts.data),
15
+ };
16
+ }
17
+ export function buildProtocolErrorResult(opts) {
18
+ return {
19
+ schema_version: AGENTPLANE_PROTOCOL_SCHEMA_VERSION,
20
+ kind: opts.kind,
21
+ status: "error",
22
+ compatibility: structuredClone(AGENTPLANE_PROTOCOL_COMPATIBILITY),
23
+ error: structuredClone(opts.error),
24
+ };
25
+ }
26
+ export function buildFrameworkExplainProtocolResult(explain) {
27
+ return buildProtocolSuccessResult({
28
+ kind: "framework.explain",
29
+ data: explain,
30
+ });
31
+ }
32
+ export function buildFrameworkProtocolSurface(opts) {
33
+ return {
34
+ explain: buildFrameworkExplainProtocolResult(opts.explain),
35
+ };
36
+ }
@@ -0,0 +1,36 @@
1
+ import type { FrameworkExplainPayload } from "../explain/index.js";
2
+ export declare const AGENTPLANE_PROTOCOL_SCHEMA_VERSION: 1;
3
+ export type AgentplaneProtocolSchemaVersion = typeof AGENTPLANE_PROTOCOL_SCHEMA_VERSION;
4
+ export type AgentplaneProtocolStatus = "ok" | "error";
5
+ export type AgentplaneProtocolKind = string;
6
+ export type AgentplaneProtocolCompatibility = {
7
+ strategy: "additive";
8
+ breaking_changes_require_schema_version: true;
9
+ additive_fields_allowed: true;
10
+ new_result_kinds_allowed: true;
11
+ };
12
+ export type AgentplaneProtocolBase<TKind extends AgentplaneProtocolKind> = {
13
+ schema_version: AgentplaneProtocolSchemaVersion;
14
+ kind: TKind;
15
+ compatibility: AgentplaneProtocolCompatibility;
16
+ };
17
+ export type AgentplaneProtocolSuccessResult<TKind extends AgentplaneProtocolKind, TData> = AgentplaneProtocolBase<TKind> & {
18
+ status: "ok";
19
+ data: TData;
20
+ };
21
+ export type AgentplaneProtocolError = {
22
+ code: string;
23
+ message: string;
24
+ retryable?: boolean;
25
+ details?: Record<string, unknown>;
26
+ };
27
+ export type AgentplaneProtocolErrorResult<TKind extends AgentplaneProtocolKind> = AgentplaneProtocolBase<TKind> & {
28
+ status: "error";
29
+ error: AgentplaneProtocolError;
30
+ };
31
+ export type AgentplaneProtocolResult<TKind extends AgentplaneProtocolKind, TData> = AgentplaneProtocolSuccessResult<TKind, TData> | AgentplaneProtocolErrorResult<TKind>;
32
+ export type FrameworkExplainProtocolResult = AgentplaneProtocolSuccessResult<"framework.explain", FrameworkExplainPayload>;
33
+ export type FrameworkProtocolSurface = {
34
+ explain: FrameworkExplainProtocolResult;
35
+ };
36
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/protocol/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAEnE,eAAO,MAA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C,MAAM,MAAM,8BAA8B,GAAG,+BAA+B,CAC1E,mBAAmB,EACnB,uBAAuB,CACxB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,OAAO,EAAE,8BAA8B,CAAC;CACzC,CAAC"}
@@ -0,0 +1 @@
1
+ export const AGENTPLANE_PROTOCOL_SCHEMA_VERSION = 1;
@@ -0,0 +1,3 @@
1
+ export { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, createTaskIntakeRuntime, materializeTaskGraphDraft, } from "./resolve.js";
2
+ export type { ClarificationContract, ClarificationQuestion, TaskGraphDependency, TaskGraphDraft, TaskGraphDraftTask, TaskIntakeContext, TaskIntakeInput, TaskIntakeInputKind, TaskIntakePrecedence, TaskIntakeRuntime, TaskIntakeSourceId, TaskIntakeSourceRef, TaskMaterializationEntry, TaskMaterializationPlan, } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/task-intake/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,oBAAoB,EACpB,uBAAuB,EACvB,uBAAuB,EACvB,yBAAyB,GAC1B,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,EACpB,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,EACxB,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export { createClarificationContract, createTaskGraphDraft, createTaskIntakeContext, createTaskIntakeRuntime, materializeTaskGraphDraft, } from "./resolve.js";
@@ -0,0 +1,48 @@
1
+ import type { AgentplaneCapabilityRegistry } from "../capabilities/index.js";
2
+ import type { ResolvedExecutionProfileRuntime } from "../execution-profile/index.js";
3
+ import type { ResolvedHarnessContract } from "../harness/index.js";
4
+ import type { ClarificationContract, ClarificationQuestion, TaskGraphDependency, TaskGraphDraft, TaskGraphDraftTask, TaskIntakeContext, TaskIntakeInput, TaskIntakeRuntime, TaskMaterializationPlan } from "./types.js";
5
+ export declare function createTaskIntakeRuntime(opts: {
6
+ repo: TaskIntakeRuntime["repo"];
7
+ backend: {
8
+ id: string;
9
+ config_path: string;
10
+ capabilities: TaskIntakeRuntime["backend"]["capabilities"];
11
+ supports_generate_task_id: boolean;
12
+ supports_bulk_write: boolean;
13
+ };
14
+ harness: Pick<ResolvedHarnessContract, "workflow" | "task" | "policy">;
15
+ execution_profile: ResolvedExecutionProfileRuntime;
16
+ capabilities: AgentplaneCapabilityRegistry;
17
+ }): TaskIntakeRuntime;
18
+ export declare function createTaskIntakeContext(opts: {
19
+ runtime: TaskIntakeRuntime;
20
+ source: TaskIntakeContext["source"];
21
+ requested_outcome: string;
22
+ requested_owner?: string;
23
+ requested_tags?: string[];
24
+ requested_verify?: string[];
25
+ requested_dependencies?: string[];
26
+ parent_task_id?: string;
27
+ inputs?: TaskIntakeInput[];
28
+ }): TaskIntakeContext;
29
+ export declare function createClarificationContract(opts: {
30
+ context: TaskIntakeContext;
31
+ assumptions?: string[];
32
+ questions?: ClarificationQuestion[];
33
+ }): ClarificationContract;
34
+ export declare function createTaskGraphDraft(opts: {
35
+ context: TaskIntakeContext;
36
+ clarification: ClarificationContract;
37
+ summary: string;
38
+ tasks: TaskGraphDraftTask[];
39
+ dependencies?: TaskGraphDependency[];
40
+ warnings?: string[];
41
+ }): TaskGraphDraft;
42
+ export declare function materializeTaskGraphDraft(opts: {
43
+ draft: TaskGraphDraft;
44
+ task_ids?: Record<string, string>;
45
+ allocateTaskId?: (task: TaskGraphDraftTask, index: number) => Promise<string>;
46
+ created_at?: string;
47
+ }): Promise<TaskMaterializationPlan>;
48
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"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,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B,GAAG,iBAAiB,CAepB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACrC,GAAG,qBAAqB,CAQxB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,cAAc,CAUjB;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyCnC"}
@@ -0,0 +1,316 @@
1
+ import path from "node:path";
2
+ import { buildTaskDocState } from "../../shared/task-doc-state.js";
3
+ const TASK_INTAKE_BEHAVIOR_ORDER = [
4
+ "harness",
5
+ "extension",
6
+ "user",
7
+ "builtin",
8
+ ];
9
+ function dedupeTrimmed(values) {
10
+ const seen = new Set();
11
+ const out = [];
12
+ for (const raw of values) {
13
+ const value = String(raw ?? "").trim();
14
+ if (!value || seen.has(value))
15
+ continue;
16
+ seen.add(value);
17
+ out.push(value);
18
+ }
19
+ return out;
20
+ }
21
+ function normalizeOutcome(value) {
22
+ const normalized = value.trim();
23
+ if (!normalized)
24
+ throw new Error("Task intake context requires a non-empty requested outcome.");
25
+ return normalized;
26
+ }
27
+ function normalizeSourceDetail(value) {
28
+ const normalized = value.trim();
29
+ if (!normalized)
30
+ throw new Error("Task intake source detail must be non-empty.");
31
+ return normalized;
32
+ }
33
+ function normalizeInputs(inputs) {
34
+ return inputs
35
+ .map((input) => ({
36
+ kind: input.kind,
37
+ ...(input.label?.trim() ? { label: input.label.trim() } : {}),
38
+ value: normalizeOutcome(input.value),
39
+ ...(input.required === true ? { required: true } : {}),
40
+ }))
41
+ .toSorted((left, right) => left.kind.localeCompare(right.kind) ||
42
+ (left.label ?? "").localeCompare(right.label ?? "") ||
43
+ left.value.localeCompare(right.value));
44
+ }
45
+ function normalizeQuestions(questions) {
46
+ const seen = new Set();
47
+ const out = [];
48
+ for (const raw of questions) {
49
+ const id = raw.id.trim();
50
+ const question = raw.question.trim();
51
+ const reason = raw.reason.trim();
52
+ if (!id)
53
+ throw new Error("Clarification questions require a non-empty id.");
54
+ if (!question)
55
+ throw new Error(`Clarification question ${id} requires question text.`);
56
+ if (!reason)
57
+ throw new Error(`Clarification question ${id} requires a reason.`);
58
+ if (seen.has(id))
59
+ throw new Error(`Clarification question ids must be unique: ${id}`);
60
+ seen.add(id);
61
+ out.push({
62
+ id,
63
+ question,
64
+ reason,
65
+ required: raw.required === true,
66
+ ...(raw.target_field?.trim() ? { target_field: raw.target_field.trim() } : {}),
67
+ ...(raw.accepted_values
68
+ ? { accepted_values: dedupeTrimmed(raw.accepted_values).toSorted() }
69
+ : {}),
70
+ });
71
+ }
72
+ return out.toSorted((left, right) => left.id.localeCompare(right.id));
73
+ }
74
+ function normalizeDraftTasks(tasks) {
75
+ if (tasks.length === 0)
76
+ throw new Error("Task graph draft requires at least one task.");
77
+ const seen = new Set();
78
+ return tasks.map((task) => {
79
+ const draft_id = task.draft_id.trim();
80
+ if (!draft_id)
81
+ throw new Error("Task graph draft tasks require a non-empty draft_id.");
82
+ if (seen.has(draft_id))
83
+ throw new Error(`Duplicate task graph draft id: ${draft_id}`);
84
+ seen.add(draft_id);
85
+ const title = task.title.trim();
86
+ if (!title)
87
+ throw new Error(`Task graph draft task ${draft_id} requires a title.`);
88
+ const description = task.description.trim();
89
+ if (!description) {
90
+ throw new Error(`Task graph draft task ${draft_id} requires a description.`);
91
+ }
92
+ const owner = task.owner.trim();
93
+ if (!owner)
94
+ throw new Error(`Task graph draft task ${draft_id} requires an owner.`);
95
+ const doc = task.doc.trim();
96
+ if (!doc)
97
+ throw new Error(`Task graph draft task ${draft_id} requires a task document.`);
98
+ return {
99
+ draft_id,
100
+ title,
101
+ description,
102
+ owner,
103
+ priority: task.priority,
104
+ ...(task.origin ? { origin: structuredClone(task.origin) } : {}),
105
+ tags: dedupeTrimmed(task.tags).toSorted(),
106
+ verify: dedupeTrimmed(task.verify).toSorted(),
107
+ depends_on: dedupeTrimmed(task.depends_on).toSorted(),
108
+ doc,
109
+ ...(task.doc_version ? { doc_version: task.doc_version } : {}),
110
+ ...(task.id_source?.trim() ? { id_source: task.id_source.trim() } : {}),
111
+ };
112
+ });
113
+ }
114
+ function normalizeDependencies(tasks, dependencies) {
115
+ const taskIds = new Set(tasks.map((task) => task.draft_id));
116
+ const seen = new Set();
117
+ const out = [];
118
+ for (const dependency of dependencies) {
119
+ if (!taskIds.has(dependency.from)) {
120
+ throw new Error(`Task graph dependency source is unknown: ${dependency.from}`);
121
+ }
122
+ if (!taskIds.has(dependency.to)) {
123
+ throw new Error(`Task graph dependency target is unknown: ${dependency.to}`);
124
+ }
125
+ const signature = `${dependency.from}:${dependency.kind}:${dependency.to}`;
126
+ if (seen.has(signature))
127
+ continue;
128
+ seen.add(signature);
129
+ out.push({
130
+ from: dependency.from,
131
+ to: dependency.to,
132
+ kind: "depends_on",
133
+ });
134
+ }
135
+ return out.toSorted((left, right) => left.from.localeCompare(right.from) ||
136
+ left.kind.localeCompare(right.kind) ||
137
+ left.to.localeCompare(right.to));
138
+ }
139
+ function resolveTaskIds(opts) {
140
+ const provided = new Map();
141
+ const taskIds = opts.task_ids ?? {};
142
+ for (const task of opts.tasks) {
143
+ const taskId = taskIds[task.draft_id]?.trim();
144
+ if (taskId)
145
+ provided.set(task.draft_id, taskId);
146
+ }
147
+ return (async () => {
148
+ if (provided.size === opts.tasks.length)
149
+ return provided;
150
+ if (!opts.allocateTaskId) {
151
+ throw new Error("Task graph materialization requires task_ids for every draft task or an allocateTaskId callback.");
152
+ }
153
+ for (const [index, task] of opts.tasks.entries()) {
154
+ if (provided.has(task.draft_id))
155
+ continue;
156
+ const allocatedTaskId = await opts.allocateTaskId(task, index);
157
+ const taskId = allocatedTaskId.trim();
158
+ if (!taskId) {
159
+ throw new Error(`Task id allocator returned an empty id for draft ${task.draft_id}.`);
160
+ }
161
+ provided.set(task.draft_id, taskId);
162
+ }
163
+ return provided;
164
+ })();
165
+ }
166
+ function buildMaterializedTask(opts) {
167
+ const normalizedDoc = buildTaskDocState({
168
+ doc: opts.draftTask.doc,
169
+ owner: opts.draftTask.owner,
170
+ updatedBy: opts.draftTask.owner,
171
+ version: opts.draftTask.doc_version ?? 3,
172
+ updatedAt: opts.created_at,
173
+ });
174
+ const task = {
175
+ id: opts.task_id,
176
+ title: opts.draftTask.title,
177
+ description: opts.draftTask.description,
178
+ status: "TODO",
179
+ priority: opts.draftTask.priority,
180
+ owner: opts.draftTask.owner,
181
+ revision: 1,
182
+ ...(opts.draftTask.origin ? { origin: structuredClone(opts.draftTask.origin) } : {}),
183
+ depends_on: dedupeTrimmed([
184
+ ...opts.draftTask.depends_on,
185
+ ...opts.internal_dependencies,
186
+ ]).toSorted(),
187
+ tags: [...opts.draftTask.tags],
188
+ verify: [...opts.draftTask.verify],
189
+ comments: [],
190
+ events: [],
191
+ doc_version: normalizedDoc.doc_version,
192
+ doc_updated_at: normalizedDoc.doc_updated_at,
193
+ doc_updated_by: normalizedDoc.doc_updated_by,
194
+ id_source: opts.draftTask.id_source ?? "generated",
195
+ doc: normalizedDoc.doc,
196
+ sections: normalizedDoc.sections,
197
+ };
198
+ return {
199
+ draft_id: opts.draftTask.draft_id,
200
+ task_id: opts.task_id,
201
+ task,
202
+ readme_path: path.join(opts.context.runtime.repo.git_root, opts.context.runtime.repo.workflow_dir, opts.task_id, "README.md"),
203
+ };
204
+ }
205
+ export function createTaskIntakeRuntime(opts) {
206
+ return {
207
+ repo: {
208
+ git_root: opts.repo.git_root,
209
+ agentplane_dir: opts.repo.agentplane_dir,
210
+ workflow_dir: opts.repo.workflow_dir,
211
+ },
212
+ workflow: {
213
+ mode: opts.harness.workflow.mode,
214
+ },
215
+ backend: {
216
+ id: opts.backend.id,
217
+ config_path: opts.backend.config_path,
218
+ capabilities: opts.backend.capabilities ? structuredClone(opts.backend.capabilities) : null,
219
+ supports_generate_task_id: opts.backend.supports_generate_task_id,
220
+ supports_bulk_write: opts.backend.supports_bulk_write,
221
+ },
222
+ task_contract: {
223
+ doc_sections: [...opts.harness.task.doc_sections],
224
+ required_doc_sections: [...opts.harness.task.required_doc_sections],
225
+ verify_required_tags: [...opts.harness.task.verify_required_tags],
226
+ },
227
+ policy: {
228
+ approvals: structuredClone(opts.harness.policy.approvals),
229
+ protected_paths: structuredClone(opts.harness.policy.protected_paths),
230
+ unsafe_actions_requiring_explicit_user_ok: [
231
+ ...opts.harness.policy.unsafe_actions_requiring_explicit_user_ok,
232
+ ],
233
+ },
234
+ execution_profile: structuredClone(opts.execution_profile),
235
+ capabilities: structuredClone(opts.capabilities),
236
+ precedence: {
237
+ behavior_order: [...TASK_INTAKE_BEHAVIOR_ORDER],
238
+ extension_layer: "recipes",
239
+ },
240
+ };
241
+ }
242
+ export function createTaskIntakeContext(opts) {
243
+ return {
244
+ runtime: structuredClone(opts.runtime),
245
+ source: {
246
+ id: opts.source.id,
247
+ detail: normalizeSourceDetail(opts.source.detail),
248
+ },
249
+ requested_outcome: normalizeOutcome(opts.requested_outcome),
250
+ ...(opts.requested_owner?.trim() ? { requested_owner: opts.requested_owner.trim() } : {}),
251
+ requested_tags: dedupeTrimmed(opts.requested_tags ?? []).toSorted(),
252
+ requested_verify: dedupeTrimmed(opts.requested_verify ?? []).toSorted(),
253
+ requested_dependencies: dedupeTrimmed(opts.requested_dependencies ?? []).toSorted(),
254
+ ...(opts.parent_task_id?.trim() ? { parent_task_id: opts.parent_task_id.trim() } : {}),
255
+ inputs: normalizeInputs(opts.inputs ?? []),
256
+ };
257
+ }
258
+ export function createClarificationContract(opts) {
259
+ const questions = normalizeQuestions(opts.questions ?? []);
260
+ return {
261
+ context: structuredClone(opts.context),
262
+ status: questions.some((question) => question.required) ? "needs_input" : "ready",
263
+ assumptions: dedupeTrimmed(opts.assumptions ?? []),
264
+ questions,
265
+ };
266
+ }
267
+ export function createTaskGraphDraft(opts) {
268
+ const tasks = normalizeDraftTasks(opts.tasks);
269
+ return {
270
+ context: structuredClone(opts.context),
271
+ clarification: structuredClone(opts.clarification),
272
+ summary: normalizeOutcome(opts.summary),
273
+ tasks,
274
+ dependencies: normalizeDependencies(tasks, opts.dependencies ?? []),
275
+ warnings: dedupeTrimmed(opts.warnings ?? []),
276
+ };
277
+ }
278
+ export async function materializeTaskGraphDraft(opts) {
279
+ if (opts.draft.clarification.status === "needs_input") {
280
+ throw new Error("Task graph materialization requires clarification.status=ready.");
281
+ }
282
+ const created_at = opts.created_at ?? new Date().toISOString();
283
+ const taskIds = await resolveTaskIds({
284
+ tasks: opts.draft.tasks,
285
+ task_ids: opts.task_ids,
286
+ allocateTaskId: opts.allocateTaskId,
287
+ });
288
+ const tasks = opts.draft.tasks.map((draftTask) => {
289
+ const task_id = taskIds.get(draftTask.draft_id);
290
+ if (!task_id) {
291
+ throw new Error(`Task id resolution lost draft task ${draftTask.draft_id}.`);
292
+ }
293
+ const internal_dependencies = opts.draft.dependencies
294
+ .filter((dependency) => dependency.from === draftTask.draft_id)
295
+ .map((dependency) => {
296
+ const resolved = taskIds.get(dependency.to);
297
+ if (!resolved) {
298
+ throw new Error(`Task id resolution lost dependency target ${dependency.to}.`);
299
+ }
300
+ return resolved;
301
+ });
302
+ return buildMaterializedTask({
303
+ context: opts.draft.context,
304
+ draftTask,
305
+ task_id,
306
+ internal_dependencies,
307
+ created_at,
308
+ });
309
+ });
310
+ return {
311
+ context: structuredClone(opts.draft.context),
312
+ summary: opts.draft.summary,
313
+ backend: structuredClone(opts.draft.context.runtime.backend),
314
+ tasks,
315
+ };
316
+ }