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
@@ -39,18 +39,38 @@ export function resolveBehavior(opts) {
39
39
  throw new Error(`Behavior resolution requires at least one candidate: ${key}`);
40
40
  }
41
41
  const ranked = rankCandidates(opts.candidates).toSorted(compareCandidates);
42
- const winner = ranked[0];
43
- if (!winner) {
44
- throw new Error(`Behavior resolution lost its winner unexpectedly: ${key}`);
42
+ const mergeMode = opts.merge_mode ?? "pick_one";
43
+ if (mergeMode === "pick_one") {
44
+ const winner = ranked[0];
45
+ if (!winner) {
46
+ throw new Error(`Behavior resolution lost its winner unexpectedly: ${key}`);
47
+ }
48
+ const trace = ranked.map((candidate, index) => toTraceEntry(candidate, index === 0));
49
+ const [winnerTrace, ...conflicts] = trace;
50
+ if (!winnerTrace) {
51
+ throw new Error(`Behavior resolution trace is unexpectedly empty: ${key}`);
52
+ }
53
+ return {
54
+ key,
55
+ value: winner.value,
56
+ winner: winnerTrace,
57
+ conflicts,
58
+ trace,
59
+ };
45
60
  }
46
- const trace = ranked.map((candidate, index) => toTraceEntry(candidate, index === 0));
61
+ const trace = ranked.map((candidate) => toTraceEntry(candidate, true));
47
62
  const [winnerTrace, ...conflicts] = trace;
48
63
  if (!winnerTrace) {
49
64
  throw new Error(`Behavior resolution trace is unexpectedly empty: ${key}`);
50
65
  }
66
+ const mergedValue = mergeMode === "union"
67
+ ? [
68
+ ...new Set(new Set(ranked.flatMap((candidate) => Array.isArray(candidate.value) ? candidate.value : [candidate.value]))),
69
+ ]
70
+ : ranked.map((candidate) => candidate.value);
51
71
  return {
52
72
  key,
53
- value: winner.value,
73
+ value: mergedValue,
54
74
  winner: winnerTrace,
55
75
  conflicts,
56
76
  trace,
@@ -6,6 +6,7 @@ export type BehaviorCandidate<TValue, TMetadata = Record<string, unknown>> = {
6
6
  order?: number;
7
7
  metadata?: TMetadata;
8
8
  };
9
+ export type BehaviorMergeMode = "pick_one" | "stack" | "union";
9
10
  export type BehaviorResolutionEntry<TMetadata = Record<string, unknown>> = {
10
11
  layer: BehaviorLayer;
11
12
  source: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/behavior/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3E,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC3C,SAAS,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;IAChD,KAAK,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,MAAM,EACN,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACjC,uBAAuB,CAAC,SAAS,CAAC,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/behavior/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,MAAM,GAAG,SAAS,CAAC;AAEzE,MAAM,MAAM,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC3E,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,UAAU,GAAG,OAAO,GAAG,OAAO,CAAC;AAE/D,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,KAAK,EAAE,aAAa,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IACzE,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC3C,SAAS,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;IAChD,KAAK,EAAE,uBAAuB,CAAC,SAAS,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAC1B,MAAM,EACN,SAAS,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IACjC,uBAAuB,CAAC,SAAS,CAAC,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
@@ -1,9 +1,10 @@
1
- import type { InstalledRecipeEntry, ResolvedRecipeScenarioSelection } from "../../commands/recipes/impl/types.js";
1
+ import type { CompiledRecipeAssetEntry, InstalledRecipeEntry, ResolvedRecipeScenarioSelection } from "@agentplaneorg/recipes";
2
2
  import type { AgentplaneCapabilityRegistry } from "./types.js";
3
3
  type RecipeSelection = Pick<ResolvedRecipeScenarioSelection, "scenario_id" | "agents_involved" | "skills_used" | "tools_used">;
4
4
  type RecipeEntry = Pick<InstalledRecipeEntry, "id" | "version" | "manifest">;
5
5
  export declare function resolveRecipeCapabilityRegistry(opts: {
6
6
  entry: RecipeEntry;
7
+ assets?: CompiledRecipeAssetEntry[];
7
8
  selection?: RecipeSelection | null;
8
9
  }): AgentplaneCapabilityRegistry;
9
10
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAA6B,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAE1F,KAAK,eAAe,GAAG,IAAI,CACzB,+BAA+B,EAC/B,aAAa,GAAG,iBAAiB,GAAG,aAAa,GAAG,YAAY,CACjE,CAAC;AAEF,KAAK,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AA2C7E,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,WAAW,CAAC;IACnB,SAAS,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACpC,GAAG,4BAA4B,CA+F/B"}
1
+ {"version":3,"file":"recipe.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/recipe.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,wBAAwB,EACxB,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,wBAAwB,CAAC;AAGhC,OAAO,KAAK,EAA6B,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAE1F,KAAK,eAAe,GAAG,IAAI,CACzB,+BAA+B,EAC/B,aAAa,GAAG,iBAAiB,GAAG,aAAa,GAAG,YAAY,CACjE,CAAC;AAEF,KAAK,WAAW,GAAG,IAAI,CAAC,oBAAoB,EAAE,IAAI,GAAG,SAAS,GAAG,UAAU,CAAC,CAAC;AAsG7E,wBAAgB,+BAA+B,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,CAAC,EAAE,wBAAwB,EAAE,CAAC;IACpC,SAAS,CAAC,EAAE,eAAe,GAAG,IAAI,CAAC;CACpC,GAAG,4BAA4B,CAiG/B"}
@@ -6,16 +6,74 @@ function source(entry) {
6
6
  };
7
7
  }
8
8
  function scenarioCapabilityId(recipeId, scenarioId) {
9
- return `recipe.${recipeId}.scenario.${scenarioId}`;
9
+ return `recipe:${recipeId}/scenario:${scenarioId}`;
10
10
  }
11
11
  function agentCapabilityId(recipeId, agentId) {
12
- return `recipe.${recipeId}.agent.${agentId}`;
12
+ return `recipe:${recipeId}/agent:${agentId}`;
13
13
  }
14
14
  function skillCapabilityId(recipeId, skillId) {
15
- return `recipe.${recipeId}.skill.${skillId}`;
15
+ return `recipe:${recipeId}/skill:${skillId}`;
16
16
  }
17
17
  function toolCapabilityId(recipeId, toolId) {
18
- return `recipe.${recipeId}.tool.${toolId}`;
18
+ return `recipe:${recipeId}/tool:${toolId}`;
19
+ }
20
+ function toFallbackAssets(entry) {
21
+ const assets = [];
22
+ for (const scenario of entry.manifest.scenarios ?? []) {
23
+ assets.push({
24
+ id: scenarioCapabilityId(entry.id, scenario.id),
25
+ kind: "scenario",
26
+ recipe_id: entry.id,
27
+ recipe_version: entry.version,
28
+ recipe_name: entry.manifest.name,
29
+ asset_id: scenario.id,
30
+ source: scenario.file,
31
+ summary: scenario.summary,
32
+ definition: scenario,
33
+ });
34
+ }
35
+ for (const agent of entry.manifest.agents ?? []) {
36
+ assets.push({
37
+ id: agentCapabilityId(entry.id, agent.id),
38
+ kind: "agent",
39
+ recipe_id: entry.id,
40
+ recipe_version: entry.version,
41
+ recipe_name: entry.manifest.name,
42
+ asset_id: agent.id,
43
+ source: agent.file,
44
+ summary: agent.summary,
45
+ definition: agent,
46
+ content: "",
47
+ });
48
+ }
49
+ for (const skill of entry.manifest.skills ?? []) {
50
+ assets.push({
51
+ id: skillCapabilityId(entry.id, skill.id),
52
+ kind: "skill",
53
+ recipe_id: entry.id,
54
+ recipe_version: entry.version,
55
+ recipe_name: entry.manifest.name,
56
+ asset_id: skill.id,
57
+ source: skill.file,
58
+ summary: skill.summary,
59
+ definition: skill,
60
+ content: "",
61
+ });
62
+ }
63
+ for (const tool of entry.manifest.tools ?? []) {
64
+ assets.push({
65
+ id: toolCapabilityId(entry.id, tool.id),
66
+ kind: "tool",
67
+ recipe_id: entry.id,
68
+ recipe_version: entry.version,
69
+ recipe_name: entry.manifest.name,
70
+ asset_id: tool.id,
71
+ source: tool.entrypoint,
72
+ summary: tool.summary,
73
+ definition: tool,
74
+ });
75
+ }
76
+ return assets;
19
77
  }
20
78
  function selectedAvailability(opts) {
21
79
  if (opts.selected) {
@@ -31,14 +89,15 @@ function selectedAvailability(opts) {
31
89
  };
32
90
  }
33
91
  export function resolveRecipeCapabilityRegistry(opts) {
92
+ const assets = opts.assets ?? toFallbackAssets(opts.entry);
34
93
  const gate = opts.selection
35
94
  ? scenarioCapabilityId(opts.entry.id, opts.selection.scenario_id)
36
95
  : null;
37
96
  const entries = [];
38
- for (const scenario of opts.entry.manifest.scenarios) {
39
- const selected = opts.selection ? scenario.id === opts.selection.scenario_id : true;
97
+ for (const scenario of assets.filter((asset) => asset.kind === "scenario")) {
98
+ const selected = opts.selection ? scenario.asset_id === opts.selection.scenario_id : true;
40
99
  entries.push({
41
- id: scenarioCapabilityId(opts.entry.id, scenario.id),
100
+ id: scenario.id,
42
101
  kind: "scenario",
43
102
  source: source(opts.entry),
44
103
  summary: scenario.summary,
@@ -50,16 +109,18 @@ export function resolveRecipeCapabilityRegistry(opts) {
50
109
  metadata: {
51
110
  recipe_id: opts.entry.id,
52
111
  recipe_version: opts.entry.version,
53
- scenario_id: scenario.id,
54
- scenario_name: scenario.name,
55
- file: scenario.file,
112
+ scenario_id: scenario.asset_id,
113
+ scenario_name: scenario.definition.name,
114
+ file: scenario.definition.file,
56
115
  },
57
116
  });
58
117
  }
59
- for (const agent of opts.entry.manifest.agents ?? []) {
60
- const selected = opts.selection ? opts.selection.agents_involved.includes(agent.id) : true;
118
+ for (const agent of assets.filter((asset) => asset.kind === "agent")) {
119
+ const selected = opts.selection
120
+ ? opts.selection.agents_involved.includes(agent.asset_id)
121
+ : true;
61
122
  entries.push({
62
- id: agentCapabilityId(opts.entry.id, agent.id),
123
+ id: agent.id,
63
124
  kind: "agent",
64
125
  source: source(opts.entry),
65
126
  summary: agent.summary,
@@ -71,16 +132,16 @@ export function resolveRecipeCapabilityRegistry(opts) {
71
132
  metadata: {
72
133
  recipe_id: opts.entry.id,
73
134
  recipe_version: opts.entry.version,
74
- agent_id: agent.id,
75
- role: agent.role,
76
- file: agent.file,
135
+ agent_id: agent.asset_id,
136
+ role: agent.definition.role,
137
+ file: agent.definition.file,
77
138
  },
78
139
  });
79
140
  }
80
- for (const skill of opts.entry.manifest.skills ?? []) {
81
- const selected = opts.selection ? opts.selection.skills_used.includes(skill.id) : true;
141
+ for (const skill of assets.filter((asset) => asset.kind === "skill")) {
142
+ const selected = opts.selection ? opts.selection.skills_used.includes(skill.asset_id) : true;
82
143
  entries.push({
83
- id: skillCapabilityId(opts.entry.id, skill.id),
144
+ id: skill.id,
84
145
  kind: "skill",
85
146
  source: source(opts.entry),
86
147
  summary: skill.summary,
@@ -92,16 +153,15 @@ export function resolveRecipeCapabilityRegistry(opts) {
92
153
  metadata: {
93
154
  recipe_id: opts.entry.id,
94
155
  recipe_version: opts.entry.version,
95
- skill_id: skill.id,
96
- kind: skill.kind,
97
- file: skill.file,
156
+ skill_id: skill.asset_id,
157
+ file: skill.definition.file,
98
158
  },
99
159
  });
100
160
  }
101
- for (const tool of opts.entry.manifest.tools ?? []) {
102
- const selected = opts.selection ? opts.selection.tools_used.includes(tool.id) : true;
161
+ for (const tool of assets.filter((asset) => asset.kind === "tool")) {
162
+ const selected = opts.selection ? opts.selection.tools_used.includes(tool.asset_id) : true;
103
163
  entries.push({
104
- id: toolCapabilityId(opts.entry.id, tool.id),
164
+ id: tool.id,
105
165
  kind: "tool",
106
166
  source: source(opts.entry),
107
167
  summary: tool.summary,
@@ -113,9 +173,9 @@ export function resolveRecipeCapabilityRegistry(opts) {
113
173
  metadata: {
114
174
  recipe_id: opts.entry.id,
115
175
  recipe_version: opts.entry.version,
116
- tool_id: tool.id,
117
- runtime: tool.runtime,
118
- entrypoint: tool.entrypoint,
176
+ tool_id: tool.asset_id,
177
+ runtime: tool.definition.runtime,
178
+ entrypoint: tool.definition.entrypoint,
119
179
  },
120
180
  });
121
181
  }
@@ -0,0 +1,63 @@
1
+ import type { AgentplaneConfig, ResolvedProject } from "@agentplaneorg/core";
2
+ import type { Adapters } from "../adapters/index.js";
3
+ import { type CommandContext } from "../commands/shared/task-backend.js";
4
+ import { PolicyEngine } from "../policy/engine.js";
5
+ import { type ApprovalRuntime } from "./approvals/index.js";
6
+ import { type AgentplaneCapabilityRegistry } from "./capabilities/index.js";
7
+ import { type ResolvedExecutionProfileRuntime } from "./execution-profile/index.js";
8
+ import { type FrameworkExplainPayload } from "./explain/index.js";
9
+ import { type ResolvedHarnessContract } from "./harness/index.js";
10
+ import { type FrameworkProtocolSurface } from "./protocol/index.js";
11
+ import { type TaskIntakeRuntime } from "./task-intake/index.js";
12
+ export type AgentplaneRepositoryContext = {
13
+ git_root: string;
14
+ agentplane_dir: string;
15
+ workflow_dir: string;
16
+ };
17
+ export type AgentplaneBackendContext = {
18
+ id: string;
19
+ config_path: string;
20
+ capabilities: CommandContext["taskBackend"]["capabilities"] | null;
21
+ task_backend: CommandContext["taskBackend"];
22
+ };
23
+ export type ReadOnlyExecutionContext = {
24
+ command: CommandContext;
25
+ project: CommandContext["resolvedProject"];
26
+ repo: AgentplaneRepositoryContext;
27
+ config: CommandContext["config"];
28
+ backend: AgentplaneBackendContext;
29
+ harness: ResolvedHarnessContract;
30
+ capabilities: AgentplaneCapabilityRegistry;
31
+ execution: ResolvedHarnessContract["execution"];
32
+ executionProfile: ResolvedExecutionProfileRuntime;
33
+ taskIntake: TaskIntakeRuntime;
34
+ frameworkExplain: FrameworkExplainPayload;
35
+ frameworkProtocol: FrameworkProtocolSurface;
36
+ approvals: ResolvedHarnessContract["policy"]["approvals"];
37
+ policy: PolicyEngine;
38
+ approvalRuntime: ApprovalRuntime;
39
+ };
40
+ export type ExecutionContext = ReadOnlyExecutionContext & {
41
+ adapters: Adapters;
42
+ };
43
+ export declare function resolveCommandContext(opts: {
44
+ cwd: string;
45
+ rootOverride?: string | null;
46
+ resolvedProject?: ResolvedProject;
47
+ config?: AgentplaneConfig;
48
+ }): Promise<CommandContext>;
49
+ export declare function resolveReadOnlyExecutionContext(opts: {
50
+ cwd: string;
51
+ rootOverride?: string | null;
52
+ resolvedProject?: ResolvedProject;
53
+ config?: AgentplaneConfig;
54
+ }): Promise<ReadOnlyExecutionContext>;
55
+ export declare function resolveExecutionContext(opts: {
56
+ cwd: string;
57
+ rootOverride?: string | null;
58
+ resolvedProject?: ResolvedProject;
59
+ config?: AgentplaneConfig;
60
+ }): Promise<ExecutionContext>;
61
+ export declare function makeReadOnlyExecutionContext(command: CommandContext): Promise<ReadOnlyExecutionContext>;
62
+ export declare function makeExecutionContext(command: CommandContext): Promise<ExecutionContext>;
63
+ //# sourceMappingURL=execution-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"execution-context.d.ts","sourceRoot":"","sources":["../../src/runtime/execution-context.ts"],"names":[],"mappings":"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"}
@@ -1,15 +1,15 @@
1
- import { buildAdapters } from "../../adapters/index.js";
2
- import { loadCommandContext } from "../../commands/shared/task-backend.js";
3
- import { PolicyEngine } from "../../policy/engine.js";
4
- import { createApprovalRuntime } from "../../runtime/approvals/index.js";
5
- import { resolveTaskBackendCapabilityRegistry, } from "../../runtime/capabilities/index.js";
6
- import { resolveExecutionProfileRuntime, } from "../../runtime/execution-profile/index.js";
7
- import { buildFrameworkExplainPayload, } from "../../runtime/explain/index.js";
8
- import { resolveHarnessFromCommandContext, } from "../../runtime/harness/index.js";
9
- import { buildFrameworkProtocolSurface, } from "../../runtime/protocol/index.js";
10
- import { createTaskIntakeRuntime, } from "../../runtime/task-intake/index.js";
1
+ import { buildAdapters } from "../adapters/index.js";
2
+ import { loadCommandContext } from "../commands/shared/task-backend.js";
3
+ import { PolicyEngine } from "../policy/engine.js";
4
+ import { createApprovalRuntime } from "./approvals/index.js";
5
+ import { resolveTaskBackendCapabilityRegistry, } from "./capabilities/index.js";
6
+ import { resolveExecutionProfileRuntime, } from "./execution-profile/index.js";
7
+ import { buildFrameworkExplainPayload } from "./explain/index.js";
8
+ import { resolveHarnessFromCommandContext } from "./harness/index.js";
9
+ import { buildFrameworkProtocolSurface } from "./protocol/index.js";
10
+ import { createTaskIntakeRuntime } from "./task-intake/index.js";
11
11
  const READ_ONLY_CONTEXT_CACHE = new WeakMap();
12
- const USECASE_CONTEXT_CACHE = new WeakMap();
12
+ const CONTEXT_CACHE = new WeakMap();
13
13
  export async function resolveCommandContext(opts) {
14
14
  return await loadCommandContext({
15
15
  cwd: opts.cwd,
@@ -18,34 +18,31 @@ export async function resolveCommandContext(opts) {
18
18
  config: opts.config,
19
19
  });
20
20
  }
21
- export async function resolveContext(opts) {
21
+ export async function resolveReadOnlyExecutionContext(opts) {
22
22
  const command = await resolveCommandContext(opts);
23
- return await makeReadOnlyUsecaseContext(command);
23
+ return await makeReadOnlyExecutionContext(command);
24
24
  }
25
- export const resolveReadOnlyExecutionContext = resolveContext;
26
25
  export async function resolveExecutionContext(opts) {
27
26
  const command = await resolveCommandContext(opts);
28
- return await makeUsecaseContext(command);
27
+ return await makeExecutionContext(command);
29
28
  }
30
- export async function makeReadOnlyUsecaseContext(command) {
29
+ export async function makeReadOnlyExecutionContext(command) {
31
30
  let cached = READ_ONLY_CONTEXT_CACHE.get(command);
32
31
  if (!cached) {
33
- cached = buildReadOnlyUsecaseContext(command);
32
+ cached = buildReadOnlyExecutionContext(command);
34
33
  READ_ONLY_CONTEXT_CACHE.set(command, cached);
35
34
  }
36
35
  return await cached;
37
36
  }
38
- export async function makeUsecaseContext(command) {
39
- let cached = USECASE_CONTEXT_CACHE.get(command);
37
+ export async function makeExecutionContext(command) {
38
+ let cached = CONTEXT_CACHE.get(command);
40
39
  if (!cached) {
41
- cached = buildUsecaseContext(command);
42
- USECASE_CONTEXT_CACHE.set(command, cached);
40
+ cached = buildExecutionContext(command);
41
+ CONTEXT_CACHE.set(command, cached);
43
42
  }
44
43
  return await cached;
45
44
  }
46
- export const makeReadOnlyExecutionContext = makeReadOnlyUsecaseContext;
47
- export const makeExecutionContext = makeUsecaseContext;
48
- async function buildReadOnlyUsecaseContext(command) {
45
+ async function buildReadOnlyExecutionContext(command) {
49
46
  const harness = await resolveHarnessFromCommandContext(command);
50
47
  const policy = new PolicyEngine();
51
48
  const executionProfile = resolveExecutionProfileRuntime(command.config);
@@ -103,9 +100,9 @@ async function buildReadOnlyUsecaseContext(command) {
103
100
  approvalRuntime: createApprovalRuntime({ config: command.config, policy }),
104
101
  };
105
102
  }
106
- async function buildUsecaseContext(command) {
103
+ async function buildExecutionContext(command) {
107
104
  return {
108
- ...(await makeReadOnlyUsecaseContext(command)),
105
+ ...(await makeReadOnlyExecutionContext(command)),
109
106
  adapters: buildAdapters(command),
110
107
  };
111
108
  }
@@ -0,0 +1,15 @@
1
+ import type { IncidentAdviceMatch, IncidentAdviceQuery, IncidentRegistry } from "./types.js";
2
+ export declare function buildIncidentAdviceQueryFromTask(opts: {
3
+ taskId: string;
4
+ title: string;
5
+ description: string;
6
+ scope?: string | null;
7
+ tags: readonly string[];
8
+ }): IncidentAdviceQuery;
9
+ export declare function resolveIncidentAdviceMatches(opts: {
10
+ query: IncidentAdviceQuery;
11
+ registry: IncidentRegistry;
12
+ limit?: number;
13
+ }): IncidentAdviceMatch[];
14
+ export declare function renderIncidentAdvice(matches: readonly IncidentAdviceMatch[]): string;
15
+ //# sourceMappingURL=advice-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"advice-strategy.d.ts","sourceRoot":"","sources":["../../../src/runtime/incidents/advice-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAS7F,wBAAgB,gCAAgC,CAAC,IAAI,EAAE;IACrD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;CACzB,GAAG,mBAAmB,CAQtB;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,KAAK,EAAE,mBAAmB,CAAC;IAC3B,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,mBAAmB,EAAE,CA8BxB;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,GAAG,MAAM,CAcpF"}
@@ -0,0 +1,54 @@
1
+ import { buildIncidentSignature, compareIncidentAdviceMatch, dedupeCaseInsensitive, normalizeSearchText, tokenize, } from "./shared.js";
2
+ export function buildIncidentAdviceQueryFromTask(opts) {
3
+ return {
4
+ taskId: opts.taskId,
5
+ title: opts.title,
6
+ description: opts.description,
7
+ scope: opts.scope ?? null,
8
+ tags: dedupeCaseInsensitive(opts.tags),
9
+ };
10
+ }
11
+ export function resolveIncidentAdviceMatches(opts) {
12
+ const limit = Math.max(1, opts.limit ?? 5);
13
+ const tagSet = new Set(opts.query.tags.map((tag) => tag.trim().toLowerCase()).filter(Boolean));
14
+ const haystack = [opts.query.title, opts.query.description, opts.query.scope ?? ""].join(" ");
15
+ const normalizedHaystack = normalizeSearchText(haystack);
16
+ const queryTokens = new Set([...tokenize(haystack), ...tagSet]);
17
+ const matchesBySignature = new Map();
18
+ for (const entry of opts.registry.entries) {
19
+ const matchedTags = entry.tags.filter((tag) => tagSet.has(tag.trim().toLowerCase()));
20
+ const matchedTerms = entry.match.filter((term) => queryTokens.has(term.trim().toLowerCase()) ||
21
+ normalizedHaystack.includes(normalizeSearchText(term)));
22
+ const normalizedScope = normalizeSearchText(entry.scope);
23
+ const scopeMatched = normalizedScope.length > 0 && normalizedHaystack.includes(normalizedScope);
24
+ const score = matchedTags.length * 5 + matchedTerms.length * 2 + (scopeMatched ? 3 : 0);
25
+ if (score <= 0)
26
+ continue;
27
+ const match = { entry, score, matchedTags, matchedTerms, scopeMatched };
28
+ const signature = buildIncidentSignature(entry);
29
+ const existing = matchesBySignature.get(signature);
30
+ if (!existing || compareIncidentAdviceMatch(match, existing) < 0) {
31
+ matchesBySignature.set(signature, match);
32
+ }
33
+ }
34
+ const matches = [...matchesBySignature.values()];
35
+ matches.sort((left, right) => compareIncidentAdviceMatch(left, right));
36
+ return matches.slice(0, limit);
37
+ }
38
+ export function renderIncidentAdvice(matches) {
39
+ if (matches.length === 0)
40
+ return "No matching incident advice.";
41
+ return matches
42
+ .map((match) => {
43
+ const lines = [
44
+ `- ${match.entry.id} | scope: ${match.entry.scope}`,
45
+ ` failure: ${match.entry.failure}`,
46
+ ` advice: ${match.entry.advice ?? match.entry.rule}`,
47
+ ` rule: ${match.entry.rule}`,
48
+ ];
49
+ if (match.entry.evidence)
50
+ lines.push(` evidence: ${match.entry.evidence}`);
51
+ return lines.join("\n");
52
+ })
53
+ .join("\n");
54
+ }
@@ -0,0 +1,9 @@
1
+ import type { IncidentCollectionPlan, IncidentFindingCandidate, IncidentPromotionTaskContext, IncidentRegistry } from "./types.js";
2
+ export declare function extractIncidentCandidatesFromFindings(findings: string): IncidentFindingCandidate[];
3
+ export declare function planIncidentCollection(opts: {
4
+ task: IncidentPromotionTaskContext;
5
+ findings: string;
6
+ registry: IncidentRegistry;
7
+ now?: Date;
8
+ }): IncidentCollectionPlan;
9
+ //# sourceMappingURL=plan-strategy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plan-strategy.d.ts","sourceRoot":"","sources":["../../../src/runtime/incidents/plan-strategy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sBAAsB,EACtB,wBAAwB,EAGxB,4BAA4B,EAC5B,gBAAgB,EAGjB,MAAM,YAAY,CAAC;AAqBpB,wBAAgB,qCAAqC,CACnD,QAAQ,EAAE,MAAM,GACf,wBAAwB,EAAE,CAI5B;AAwKD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE;IAC3C,IAAI,EAAE,4BAA4B,CAAC;IACnC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,GAAG,CAAC,EAAE,IAAI,CAAC;CACZ,GAAG,sBAAsB,CAyDzB"}