agentplane 0.3.8 → 0.3.10

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 (268) 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 +3 -0
  5. package/assets/policy/incidents.md +22 -11
  6. package/assets/policy/workflow.branch_pr.md +2 -0
  7. package/assets/policy/workflow.direct.md +3 -1
  8. package/dist/.build-manifest.json +323 -128
  9. package/dist/cli/bootstrap-guide.d.ts +1 -0
  10. package/dist/cli/bootstrap-guide.d.ts.map +1 -1
  11. package/dist/cli/bootstrap-guide.js +19 -1
  12. package/dist/cli/command-invocations.d.ts.map +1 -1
  13. package/dist/cli/command-invocations.js +2 -0
  14. package/dist/cli/command-snippets.d.ts +2 -0
  15. package/dist/cli/command-snippets.d.ts.map +1 -1
  16. package/dist/cli/command-snippets.js +2 -0
  17. package/dist/cli/run-cli/command-catalog/core.d.ts +1 -1
  18. package/dist/cli/run-cli/command-catalog/core.d.ts.map +1 -1
  19. package/dist/cli/run-cli/command-catalog/core.js +10 -0
  20. package/dist/cli/run-cli/command-catalog.d.ts +1 -1
  21. package/dist/cli/run-cli/command-catalog.d.ts.map +1 -1
  22. package/dist/cli/run-cli/commands/config.d.ts.map +1 -1
  23. package/dist/cli/run-cli/commands/config.js +13 -0
  24. package/dist/cli/run-cli.js +2 -2
  25. package/dist/cli/run-cli.test-helpers.d.ts.map +1 -1
  26. package/dist/cli/run-cli.test-helpers.js +34 -8
  27. package/dist/commands/backend.d.ts.map +1 -1
  28. package/dist/commands/backend.js +4 -0
  29. package/dist/commands/hooks/index.d.ts.map +1 -1
  30. package/dist/commands/hooks/index.js +8 -4
  31. package/dist/commands/incidents/advise.command.d.ts +15 -0
  32. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  33. package/dist/commands/incidents/advise.command.js +139 -0
  34. package/dist/commands/incidents/collect.command.d.ts +11 -0
  35. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  36. package/dist/commands/incidents/collect.command.js +67 -0
  37. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  38. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  39. package/dist/commands/incidents/incidents.command.js +21 -0
  40. package/dist/commands/incidents/shared.d.ts +42 -0
  41. package/dist/commands/incidents/shared.d.ts.map +1 -0
  42. package/dist/commands/incidents/shared.js +107 -0
  43. package/dist/commands/pr/check.d.ts.map +1 -1
  44. package/dist/commands/pr/check.js +73 -2
  45. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  46. package/dist/commands/pr/integrate/cmd.js +4 -0
  47. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  48. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  49. package/dist/commands/pr/integrate/internal/merge.js +23 -2
  50. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  51. package/dist/commands/pr/integrate/internal/prepare.js +26 -1
  52. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  53. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  54. package/dist/commands/pr/internal/note-store.js +66 -0
  55. package/dist/commands/pr/internal/pr-paths.d.ts +3 -0
  56. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  57. package/dist/commands/pr/internal/pr-paths.js +3 -0
  58. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  59. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  60. package/dist/commands/pr/internal/review-template.js +188 -33
  61. package/dist/commands/pr/internal/sync.d.ts +32 -0
  62. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  63. package/dist/commands/pr/internal/sync.js +258 -0
  64. package/dist/commands/pr/note.d.ts.map +1 -1
  65. package/dist/commands/pr/note.js +37 -4
  66. package/dist/commands/pr/open.d.ts.map +1 -1
  67. package/dist/commands/pr/open.js +7 -54
  68. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  69. package/dist/commands/pr/pr.command.js +6 -3
  70. package/dist/commands/pr/update.d.ts.map +1 -1
  71. package/dist/commands/pr/update.js +5 -79
  72. package/dist/commands/recipes/impl/apply.d.ts +1 -1
  73. package/dist/commands/recipes/impl/apply.d.ts.map +1 -1
  74. package/dist/commands/recipes/impl/apply.js +1 -1
  75. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  76. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  77. package/dist/commands/recipes/impl/commands/explain.js +1 -1
  78. package/dist/commands/recipes/impl/commands/install.d.ts.map +1 -1
  79. package/dist/commands/recipes/impl/commands/install.js +3 -2
  80. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  81. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  82. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  83. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  84. package/dist/commands/recipes/impl/installed-recipes.d.ts +1 -1
  85. package/dist/commands/recipes/impl/installed-recipes.d.ts.map +1 -1
  86. package/dist/commands/recipes/impl/installed-recipes.js +2 -1
  87. package/dist/commands/recipes/impl/project-installed-recipes.d.ts +1 -1
  88. package/dist/commands/recipes/impl/project-installed-recipes.d.ts.map +1 -1
  89. package/dist/commands/recipes/impl/project-installed-recipes.js +2 -1
  90. package/dist/commands/recipes/impl/resolver.d.ts +1 -1
  91. package/dist/commands/recipes/impl/resolver.d.ts.map +1 -1
  92. package/dist/commands/recipes/impl/resolver.js +1 -1
  93. package/dist/commands/recipes.d.ts +4 -4
  94. package/dist/commands/recipes.d.ts.map +1 -1
  95. package/dist/commands/recipes.js +3 -3
  96. package/dist/commands/release/apply.command.d.ts.map +1 -1
  97. package/dist/commands/release/apply.command.js +9 -0
  98. package/dist/commands/release.test-helpers.d.ts +14 -0
  99. package/dist/commands/release.test-helpers.d.ts.map +1 -1
  100. package/dist/commands/release.test-helpers.js +14 -3
  101. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  102. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  103. package/dist/commands/shared/approval-requirements.js +3 -73
  104. package/dist/commands/shared/network-approval.d.ts +2 -0
  105. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  106. package/dist/commands/shared/network-approval.js +1 -1
  107. package/dist/commands/shared/pr-meta.d.ts +9 -0
  108. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  109. package/dist/commands/shared/pr-meta.js +27 -3
  110. package/dist/commands/shared/task-backend.d.ts +2 -0
  111. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  112. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  113. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  114. package/dist/commands/shared/task-local-freshness.js +20 -0
  115. package/dist/commands/shared/task-mutation.d.ts +2 -0
  116. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  117. package/dist/commands/shared/task-mutation.js +7 -0
  118. package/dist/commands/task/block.d.ts.map +1 -1
  119. package/dist/commands/task/block.js +1 -0
  120. package/dist/commands/task/close-shared.d.ts.map +1 -1
  121. package/dist/commands/task/close-shared.js +1 -0
  122. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  123. package/dist/commands/task/finish-shared.js +5 -2
  124. package/dist/commands/task/finish.d.ts.map +1 -1
  125. package/dist/commands/task/finish.js +24 -0
  126. package/dist/commands/task/new.d.ts.map +1 -1
  127. package/dist/commands/task/new.js +69 -29
  128. package/dist/commands/task/set-status.d.ts.map +1 -1
  129. package/dist/commands/task/set-status.js +1 -0
  130. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  131. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  132. package/dist/commands/task/shared/transition-command.js +1 -0
  133. package/dist/commands/task/start-ready.d.ts.map +1 -1
  134. package/dist/commands/task/start-ready.js +12 -1
  135. package/dist/commands/task/start.d.ts.map +1 -1
  136. package/dist/commands/task/start.js +11 -0
  137. package/dist/commands/task/verify-record.d.ts.map +1 -1
  138. package/dist/commands/task/verify-record.js +27 -0
  139. package/dist/commands/upgrade.d.ts.map +1 -1
  140. package/dist/commands/upgrade.js +6 -1
  141. package/dist/policy/engine.d.ts +3 -1
  142. package/dist/policy/engine.d.ts.map +1 -1
  143. package/dist/policy/engine.js +5 -6
  144. package/dist/policy/taxonomy.d.ts +17 -0
  145. package/dist/policy/taxonomy.d.ts.map +1 -0
  146. package/dist/policy/taxonomy.js +302 -0
  147. package/dist/policy/types.d.ts +2 -1
  148. package/dist/policy/types.d.ts.map +1 -1
  149. package/dist/runner/artifacts.d.ts.map +1 -1
  150. package/dist/runner/artifacts.js +2 -0
  151. package/dist/runner/context/base-prompts.d.ts +25 -0
  152. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  153. package/dist/runner/context/base-prompts.js +182 -54
  154. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  155. package/dist/runner/context/recipe-context.js +5 -0
  156. package/dist/runner/types.d.ts +12 -0
  157. package/dist/runner/types.d.ts.map +1 -1
  158. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  159. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  160. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  161. package/dist/runner/usecases/task-run-inspect.js +9 -7
  162. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  163. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  164. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  165. package/dist/runner/usecases/task-run.js +59 -12
  166. package/dist/runtime/approvals/index.d.ts +3 -0
  167. package/dist/runtime/approvals/index.d.ts.map +1 -0
  168. package/dist/runtime/approvals/index.js +1 -0
  169. package/dist/runtime/approvals/runtime.d.ts +12 -0
  170. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  171. package/dist/runtime/approvals/runtime.js +154 -0
  172. package/dist/runtime/approvals/types.d.ts +31 -0
  173. package/dist/runtime/approvals/types.d.ts.map +1 -0
  174. package/dist/runtime/approvals/types.js +1 -0
  175. package/dist/runtime/behavior/index.d.ts +3 -0
  176. package/dist/runtime/behavior/index.d.ts.map +1 -0
  177. package/dist/runtime/behavior/index.js +1 -0
  178. package/dist/runtime/behavior/resolve.d.ts +7 -0
  179. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  180. package/dist/runtime/behavior/resolve.js +66 -0
  181. package/dist/runtime/behavior/types.d.ts +25 -0
  182. package/dist/runtime/behavior/types.d.ts.map +1 -0
  183. package/dist/runtime/behavior/types.js +1 -0
  184. package/dist/runtime/capabilities/backend.d.ts +7 -0
  185. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  186. package/dist/runtime/capabilities/backend.js +104 -0
  187. package/dist/runtime/capabilities/index.d.ts +6 -0
  188. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  189. package/dist/runtime/capabilities/index.js +4 -0
  190. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  191. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  192. package/dist/runtime/capabilities/recipe.js +123 -0
  193. package/dist/runtime/capabilities/registry.d.ts +6 -0
  194. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  195. package/dist/runtime/capabilities/registry.js +69 -0
  196. package/dist/runtime/capabilities/runner.d.ts +8 -0
  197. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  198. package/dist/runtime/capabilities/runner.js +73 -0
  199. package/dist/runtime/capabilities/types.d.ts +28 -0
  200. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  201. package/dist/runtime/capabilities/types.js +1 -0
  202. package/dist/runtime/execution-profile/index.d.ts +3 -0
  203. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  204. package/dist/runtime/execution-profile/index.js +1 -0
  205. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  206. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  207. package/dist/runtime/execution-profile/resolve.js +80 -0
  208. package/dist/runtime/execution-profile/types.d.ts +27 -0
  209. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  210. package/dist/runtime/execution-profile/types.js +1 -0
  211. package/dist/runtime/explain/index.d.ts +3 -0
  212. package/dist/runtime/explain/index.d.ts.map +1 -0
  213. package/dist/runtime/explain/index.js +1 -0
  214. package/dist/runtime/explain/resolve.d.ts +14 -0
  215. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  216. package/dist/runtime/explain/resolve.js +50 -0
  217. package/dist/runtime/explain/types.d.ts +28 -0
  218. package/dist/runtime/explain/types.d.ts.map +1 -0
  219. package/dist/runtime/explain/types.js +1 -0
  220. package/dist/runtime/harness/index.d.ts +4 -0
  221. package/dist/runtime/harness/index.d.ts.map +1 -0
  222. package/dist/runtime/harness/index.js +2 -0
  223. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  224. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  225. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  226. package/dist/runtime/harness/resolve.d.ts +13 -0
  227. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  228. package/dist/runtime/harness/resolve.js +146 -0
  229. package/dist/runtime/harness/types.d.ts +65 -0
  230. package/dist/runtime/harness/types.d.ts.map +1 -0
  231. package/dist/runtime/harness/types.js +1 -0
  232. package/dist/runtime/incidents/index.d.ts +3 -0
  233. package/dist/runtime/incidents/index.d.ts.map +1 -0
  234. package/dist/runtime/incidents/index.js +1 -0
  235. package/dist/runtime/incidents/resolve.d.ts +26 -0
  236. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  237. package/dist/runtime/incidents/resolve.js +437 -0
  238. package/dist/runtime/incidents/types.d.ts +72 -0
  239. package/dist/runtime/incidents/types.d.ts.map +1 -0
  240. package/dist/runtime/incidents/types.js +1 -0
  241. package/dist/runtime/protocol/index.d.ts +3 -0
  242. package/dist/runtime/protocol/index.d.ts.map +1 -0
  243. package/dist/runtime/protocol/index.js +2 -0
  244. package/dist/runtime/protocol/resolve.d.ts +16 -0
  245. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  246. package/dist/runtime/protocol/resolve.js +36 -0
  247. package/dist/runtime/protocol/types.d.ts +36 -0
  248. package/dist/runtime/protocol/types.d.ts.map +1 -0
  249. package/dist/runtime/protocol/types.js +1 -0
  250. package/dist/runtime/task-intake/index.d.ts +3 -0
  251. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  252. package/dist/runtime/task-intake/index.js +1 -0
  253. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  254. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  255. package/dist/runtime/task-intake/resolve.js +316 -0
  256. package/dist/runtime/task-intake/types.d.ts +117 -0
  257. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  258. package/dist/runtime/task-intake/types.js +1 -0
  259. package/dist/shared/protected-paths.d.ts +4 -0
  260. package/dist/shared/protected-paths.d.ts.map +1 -1
  261. package/dist/shared/protected-paths.js +4 -4
  262. package/dist/usecases/context/resolve-context.d.ts +55 -6
  263. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  264. package/dist/usecases/context/resolve-context.js +96 -6
  265. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  266. package/dist/usecases/task/task-list-usecase.js +8 -2
  267. package/dist/usecases/task/task-new-usecase.js +4 -4
  268. package/package.json +2 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,gBAAgB,EAChB,yBAAyB,GAC1B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oCAAoC,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,EAAE,+BAA+B,EAAE,MAAM,aAAa,CAAC;AAC9D,OAAO,EAAE,sCAAsC,EAAE,MAAM,aAAa,CAAC;AACrE,YAAY,EACV,gCAAgC,EAChC,yBAAyB,EACzB,0BAA0B,EAC1B,wBAAwB,EACxB,4BAA4B,EAC5B,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,4 @@
1
+ export { createCapabilityRegistry, getCapabilityEntries, listCapabilities, mergeCapabilityRegistries, } from "./registry.js";
2
+ export { resolveTaskBackendCapabilityRegistry } from "./backend.js";
3
+ export { resolveRecipeCapabilityRegistry } from "./recipe.js";
4
+ export { resolveRunnerAdapterCapabilityRegistry } from "./runner.js";
@@ -0,0 +1,10 @@
1
+ import type { InstalledRecipeEntry, ResolvedRecipeScenarioSelection } from "../../commands/recipes/impl/types.js";
2
+ import type { AgentplaneCapabilityRegistry } from "./types.js";
3
+ type RecipeSelection = Pick<ResolvedRecipeScenarioSelection, "scenario_id" | "agents_involved" | "skills_used" | "tools_used">;
4
+ type RecipeEntry = Pick<InstalledRecipeEntry, "id" | "version" | "manifest">;
5
+ export declare function resolveRecipeCapabilityRegistry(opts: {
6
+ entry: RecipeEntry;
7
+ selection?: RecipeSelection | null;
8
+ }): AgentplaneCapabilityRegistry;
9
+ export {};
10
+ //# sourceMappingURL=recipe.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,123 @@
1
+ import { createCapabilityRegistry } from "./registry.js";
2
+ function source(entry) {
3
+ return {
4
+ id: "recipe_manifest",
5
+ detail: `${entry.id}@${entry.version}`,
6
+ };
7
+ }
8
+ function scenarioCapabilityId(recipeId, scenarioId) {
9
+ return `recipe.${recipeId}.scenario.${scenarioId}`;
10
+ }
11
+ function agentCapabilityId(recipeId, agentId) {
12
+ return `recipe.${recipeId}.agent.${agentId}`;
13
+ }
14
+ function skillCapabilityId(recipeId, skillId) {
15
+ return `recipe.${recipeId}.skill.${skillId}`;
16
+ }
17
+ function toolCapabilityId(recipeId, toolId) {
18
+ return `recipe.${recipeId}.tool.${toolId}`;
19
+ }
20
+ function selectedAvailability(opts) {
21
+ if (opts.selected) {
22
+ return { availability: "available" };
23
+ }
24
+ if (!opts.gate) {
25
+ return { availability: "available" };
26
+ }
27
+ return {
28
+ availability: "blocked",
29
+ reason: opts.reason,
30
+ blocked_by: [opts.gate],
31
+ };
32
+ }
33
+ export function resolveRecipeCapabilityRegistry(opts) {
34
+ const gate = opts.selection
35
+ ? scenarioCapabilityId(opts.entry.id, opts.selection.scenario_id)
36
+ : null;
37
+ const entries = [];
38
+ for (const scenario of opts.entry.manifest.scenarios) {
39
+ const selected = opts.selection ? scenario.id === opts.selection.scenario_id : true;
40
+ entries.push({
41
+ id: scenarioCapabilityId(opts.entry.id, scenario.id),
42
+ kind: "scenario",
43
+ source: source(opts.entry),
44
+ summary: scenario.summary,
45
+ ...selectedAvailability({
46
+ selected,
47
+ gate,
48
+ reason: "The scenario is declared by the recipe but is not the active selection.",
49
+ }),
50
+ metadata: {
51
+ recipe_id: opts.entry.id,
52
+ recipe_version: opts.entry.version,
53
+ scenario_id: scenario.id,
54
+ scenario_name: scenario.name,
55
+ file: scenario.file,
56
+ },
57
+ });
58
+ }
59
+ for (const agent of opts.entry.manifest.agents ?? []) {
60
+ const selected = opts.selection ? opts.selection.agents_involved.includes(agent.id) : true;
61
+ entries.push({
62
+ id: agentCapabilityId(opts.entry.id, agent.id),
63
+ kind: "agent",
64
+ source: source(opts.entry),
65
+ summary: agent.summary,
66
+ ...selectedAvailability({
67
+ selected,
68
+ gate,
69
+ reason: "The agent is declared by the recipe but is not used by the selected scenario.",
70
+ }),
71
+ metadata: {
72
+ recipe_id: opts.entry.id,
73
+ recipe_version: opts.entry.version,
74
+ agent_id: agent.id,
75
+ role: agent.role,
76
+ file: agent.file,
77
+ },
78
+ });
79
+ }
80
+ for (const skill of opts.entry.manifest.skills ?? []) {
81
+ const selected = opts.selection ? opts.selection.skills_used.includes(skill.id) : true;
82
+ entries.push({
83
+ id: skillCapabilityId(opts.entry.id, skill.id),
84
+ kind: "skill",
85
+ source: source(opts.entry),
86
+ summary: skill.summary,
87
+ ...selectedAvailability({
88
+ selected,
89
+ gate,
90
+ reason: "The skill is declared by the recipe but is not used by the selected scenario.",
91
+ }),
92
+ metadata: {
93
+ recipe_id: opts.entry.id,
94
+ recipe_version: opts.entry.version,
95
+ skill_id: skill.id,
96
+ kind: skill.kind,
97
+ file: skill.file,
98
+ },
99
+ });
100
+ }
101
+ for (const tool of opts.entry.manifest.tools ?? []) {
102
+ const selected = opts.selection ? opts.selection.tools_used.includes(tool.id) : true;
103
+ entries.push({
104
+ id: toolCapabilityId(opts.entry.id, tool.id),
105
+ kind: "tool",
106
+ source: source(opts.entry),
107
+ summary: tool.summary,
108
+ ...selectedAvailability({
109
+ selected,
110
+ gate,
111
+ reason: "The tool is declared by the recipe but is not used by the selected scenario.",
112
+ }),
113
+ metadata: {
114
+ recipe_id: opts.entry.id,
115
+ recipe_version: opts.entry.version,
116
+ tool_id: tool.id,
117
+ runtime: tool.runtime,
118
+ entrypoint: tool.entrypoint,
119
+ },
120
+ });
121
+ }
122
+ return createCapabilityRegistry(entries);
123
+ }
@@ -0,0 +1,6 @@
1
+ import type { AgentplaneCapabilityEntry, AgentplaneCapabilityFilter, AgentplaneCapabilityRegistry } from "./types.js";
2
+ export declare function createCapabilityRegistry(entries?: readonly AgentplaneCapabilityEntry[]): AgentplaneCapabilityRegistry;
3
+ export declare function mergeCapabilityRegistries(...registries: readonly (AgentplaneCapabilityRegistry | null | undefined)[]): AgentplaneCapabilityRegistry;
4
+ export declare function listCapabilities(registry: AgentplaneCapabilityRegistry, filter?: AgentplaneCapabilityFilter): AgentplaneCapabilityEntry[];
5
+ export declare function getCapabilityEntries(registry: AgentplaneCapabilityRegistry, id: string): AgentplaneCapabilityEntry[];
6
+ //# sourceMappingURL=registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AA6CpB,wBAAgB,wBAAwB,CACtC,OAAO,GAAE,SAAS,yBAAyB,EAAO,GACjD,4BAA4B,CAc9B;AAED,wBAAgB,yBAAyB,CACvC,GAAG,UAAU,EAAE,SAAS,CAAC,4BAA4B,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAC1E,4BAA4B,CAE9B;AAED,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,4BAA4B,EACtC,MAAM,CAAC,EAAE,0BAA0B,GAClC,yBAAyB,EAAE,CAO7B;AAED,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,4BAA4B,EACtC,EAAE,EAAE,MAAM,GACT,yBAAyB,EAAE,CAE7B"}
@@ -0,0 +1,69 @@
1
+ function sortStrings(values) {
2
+ if (!values || values.length === 0)
3
+ return undefined;
4
+ return [...values].filter((value) => value.trim().length > 0).toSorted();
5
+ }
6
+ function normalizeEntry(entry) {
7
+ const id = entry.id.trim();
8
+ const supportedValues = sortStrings(entry.supported_values);
9
+ const blockedBy = sortStrings(entry.blocked_by);
10
+ if (!id) {
11
+ throw new Error("Capability entries require a non-empty id");
12
+ }
13
+ return {
14
+ id,
15
+ kind: entry.kind,
16
+ availability: entry.availability,
17
+ source: {
18
+ id: entry.source.id,
19
+ detail: entry.source.detail,
20
+ },
21
+ ...(entry.summary ? { summary: entry.summary } : {}),
22
+ ...(Object.hasOwn(entry, "value") ? { value: entry.value } : {}),
23
+ ...(supportedValues ? { supported_values: supportedValues } : {}),
24
+ ...(entry.reason ? { reason: entry.reason } : {}),
25
+ ...(blockedBy ? { blocked_by: blockedBy } : {}),
26
+ ...(entry.metadata ? { metadata: structuredClone(entry.metadata) } : {}),
27
+ };
28
+ }
29
+ function entrySignature(entry) {
30
+ return JSON.stringify(entry);
31
+ }
32
+ function compareEntries(left, right) {
33
+ return (left.id.localeCompare(right.id) ||
34
+ left.kind.localeCompare(right.kind) ||
35
+ left.availability.localeCompare(right.availability) ||
36
+ left.source.id.localeCompare(right.source.id) ||
37
+ left.source.detail.localeCompare(right.source.detail));
38
+ }
39
+ export function createCapabilityRegistry(entries = []) {
40
+ const seen = new Set();
41
+ const normalized = [];
42
+ for (const entry of entries) {
43
+ const candidate = normalizeEntry(entry);
44
+ const signature = entrySignature(candidate);
45
+ if (seen.has(signature))
46
+ continue;
47
+ seen.add(signature);
48
+ normalized.push(candidate);
49
+ }
50
+ normalized.sort(compareEntries);
51
+ return { entries: normalized };
52
+ }
53
+ export function mergeCapabilityRegistries(...registries) {
54
+ return createCapabilityRegistry(registries.flatMap((registry) => registry?.entries ?? []));
55
+ }
56
+ export function listCapabilities(registry, filter) {
57
+ return registry.entries.filter((entry) => {
58
+ if (filter?.availability && entry.availability !== filter.availability)
59
+ return false;
60
+ if (filter?.kind && entry.kind !== filter.kind)
61
+ return false;
62
+ if (filter?.source_id && entry.source.id !== filter.source_id)
63
+ return false;
64
+ return true;
65
+ });
66
+ }
67
+ export function getCapabilityEntries(registry, id) {
68
+ return registry.entries.filter((entry) => entry.id === id);
69
+ }
@@ -0,0 +1,8 @@
1
+ import type { RunnerAdapterCapabilities } from "../../runner/types.js";
2
+ import type { AgentplaneCapabilityRegistry } from "./types.js";
3
+ export declare function resolveRunnerAdapterCapabilityRegistry(opts: {
4
+ adapter_id: string;
5
+ capabilities: RunnerAdapterCapabilities | undefined;
6
+ requested?: Record<string, unknown>;
7
+ }): AgentplaneCapabilityRegistry;
8
+ //# sourceMappingURL=runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/runner.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAGvE,OAAO,KAAK,EAA6B,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAiB1F,wBAAgB,sCAAsC,CAAC,IAAI,EAAE;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,yBAAyB,GAAG,SAAS,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACrC,GAAG,4BAA4B,CAgE/B"}
@@ -0,0 +1,73 @@
1
+ import { createCapabilityRegistry } from "./registry.js";
2
+ function source(adapterId) {
3
+ return {
4
+ id: "runner_adapter",
5
+ detail: adapterId,
6
+ };
7
+ }
8
+ function adapterCapabilityId(adapterId) {
9
+ return `runner.adapter.${adapterId}`;
10
+ }
11
+ function policyFieldCapabilityId(adapterId, fieldName) {
12
+ return `runner.adapter.${adapterId}.policy_field.${fieldName}`;
13
+ }
14
+ export function resolveRunnerAdapterCapabilityRegistry(opts) {
15
+ const adapterId = opts.capabilities?.adapter_id ?? opts.adapter_id;
16
+ const requested = opts.requested ?? {};
17
+ const entries = [
18
+ {
19
+ id: adapterCapabilityId(adapterId),
20
+ kind: "runner_adapter",
21
+ availability: "available",
22
+ source: source(adapterId),
23
+ summary: `Runner adapter ${adapterId}`,
24
+ metadata: {
25
+ adapter_id: adapterId,
26
+ declared_fields: Object.keys(opts.capabilities?.fields ?? {}).toSorted(),
27
+ },
28
+ },
29
+ ];
30
+ for (const [fieldName, capability] of Object.entries(opts.capabilities?.fields ?? {})) {
31
+ const hasRequest = Object.hasOwn(requested, fieldName);
32
+ const requestedValue = hasRequest ? requested[fieldName] : undefined;
33
+ const supportedValues = capability.supported_values
34
+ ? [...capability.supported_values]
35
+ : undefined;
36
+ const stringRequest = typeof requestedValue === "string" ? requestedValue : null;
37
+ const availability = capability.level === "unsupported"
38
+ ? "unavailable"
39
+ : stringRequest &&
40
+ Array.isArray(supportedValues) &&
41
+ !supportedValues.includes(stringRequest)
42
+ ? "blocked"
43
+ : "available";
44
+ entries.push({
45
+ id: policyFieldCapabilityId(adapterId, fieldName),
46
+ kind: "runner_policy_field",
47
+ availability,
48
+ source: source(adapterId),
49
+ summary: `Runner policy field ${fieldName}`,
50
+ ...(hasRequest ? { value: requestedValue } : {}),
51
+ ...(supportedValues ? { supported_values: supportedValues } : {}),
52
+ ...(availability === "unavailable"
53
+ ? {
54
+ reason: "The adapter declares this policy field unsupported.",
55
+ }
56
+ : {}),
57
+ ...(availability === "blocked"
58
+ ? {
59
+ reason: "The requested policy value is outside the adapter-supported set.",
60
+ blocked_by: [adapterCapabilityId(adapterId)],
61
+ }
62
+ : {}),
63
+ metadata: {
64
+ adapter_id: adapterId,
65
+ field: fieldName,
66
+ level: capability.level,
67
+ channel: capability.channel,
68
+ ...(capability.note ? { note: capability.note } : {}),
69
+ },
70
+ });
71
+ }
72
+ return createCapabilityRegistry(entries);
73
+ }
@@ -0,0 +1,28 @@
1
+ export type AgentplaneCapabilityKind = "backend_field" | "command" | "scenario" | "skill" | "tool" | "agent" | "runner_adapter" | "runner_policy_field" | "policy";
2
+ export type AgentplaneCapabilityAvailability = "available" | "blocked" | "unavailable";
3
+ export type AgentplaneCapabilitySourceId = "backend" | "builtin" | "command_catalog" | "harness" | "policy" | "recipe_manifest" | "runner_adapter";
4
+ export type AgentplaneCapabilitySourceRef = {
5
+ id: AgentplaneCapabilitySourceId;
6
+ detail: string;
7
+ };
8
+ export type AgentplaneCapabilityEntry = {
9
+ id: string;
10
+ kind: AgentplaneCapabilityKind;
11
+ availability: AgentplaneCapabilityAvailability;
12
+ source: AgentplaneCapabilitySourceRef;
13
+ summary?: string;
14
+ value?: unknown;
15
+ supported_values?: string[];
16
+ reason?: string;
17
+ blocked_by?: string[];
18
+ metadata?: Record<string, unknown>;
19
+ };
20
+ export type AgentplaneCapabilityRegistry = {
21
+ entries: AgentplaneCapabilityEntry[];
22
+ };
23
+ export type AgentplaneCapabilityFilter = {
24
+ availability?: AgentplaneCapabilityAvailability;
25
+ kind?: AgentplaneCapabilityKind;
26
+ source_id?: AgentplaneCapabilitySourceId;
27
+ };
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/capabilities/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,wBAAwB,GAChC,eAAe,GACf,SAAS,GACT,UAAU,GACV,OAAO,GACP,MAAM,GACN,OAAO,GACP,gBAAgB,GAChB,qBAAqB,GACrB,QAAQ,CAAC;AAEb,MAAM,MAAM,gCAAgC,GAAG,WAAW,GAAG,SAAS,GAAG,aAAa,CAAC;AAEvF,MAAM,MAAM,4BAA4B,GACpC,SAAS,GACT,SAAS,GACT,iBAAiB,GACjB,SAAS,GACT,QAAQ,GACR,iBAAiB,GACjB,gBAAgB,CAAC;AAErB,MAAM,MAAM,6BAA6B,GAAG;IAC1C,EAAE,EAAE,4BAA4B,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,wBAAwB,CAAC;IAC/B,YAAY,EAAE,gCAAgC,CAAC;IAC/C,MAAM,EAAE,6BAA6B,CAAC;IACtC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,4BAA4B,GAAG;IACzC,OAAO,EAAE,yBAAyB,EAAE,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,YAAY,CAAC,EAAE,gCAAgC,CAAC;IAChD,IAAI,CAAC,EAAE,wBAAwB,CAAC;IAChC,SAAS,CAAC,EAAE,4BAA4B,CAAC;CAC1C,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export type { ExecutionBudgetCounter, ExecutionBudgetPhase, ResolvedExecutionProfileRuntime, } from "./types.js";
2
+ export { consumeExecutionProfileBudget, resolveExecutionProfileRuntime } from "./resolve.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/execution-profile/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,sBAAsB,EACtB,oBAAoB,EACpB,+BAA+B,GAChC,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,6BAA6B,EAAE,8BAA8B,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1 @@
1
+ export { consumeExecutionProfileBudget, resolveExecutionProfileRuntime } from "./resolve.js";
@@ -0,0 +1,9 @@
1
+ import { type AgentplaneConfig } from "@agentplaneorg/core";
2
+ import type { ExecutionBudgetPhase, ResolvedExecutionProfileRuntime } from "./types.js";
3
+ export declare function resolveExecutionProfileRuntime(config: Pick<AgentplaneConfig, "agents" | "execution" | "runner">): ResolvedExecutionProfileRuntime;
4
+ export declare function consumeExecutionProfileBudget(opts: {
5
+ runtime: ResolvedExecutionProfileRuntime;
6
+ phase: ExecutionBudgetPhase;
7
+ units?: number;
8
+ }): ResolvedExecutionProfileRuntime;
9
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/execution-profile/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAIvF,OAAO,KAAK,EAEV,oBAAoB,EACpB,+BAA+B,EAChC,MAAM,YAAY,CAAC;AAsCpB,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,QAAQ,GAAG,WAAW,GAAG,QAAQ,CAAC,GAChE,+BAA+B,CA8BjC;AAED,wBAAgB,6BAA6B,CAAC,IAAI,EAAE;IAClD,OAAO,EAAE,+BAA+B,CAAC;IACzC,KAAK,EAAE,oBAAoB,CAAC;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,+BAA+B,CAkBlC"}
@@ -0,0 +1,80 @@
1
+ import { applyExecutionToApprovals } from "@agentplaneorg/core";
2
+ import { resolveRunnerTimeoutPolicy, resolveRunnerTracePolicy } from "../../runner/config.js";
3
+ function toBudgetCounter(limit) {
4
+ return {
5
+ limit,
6
+ used: 0,
7
+ remaining: limit,
8
+ exhausted: limit <= 0,
9
+ };
10
+ }
11
+ function applyProfileToTracePolicy(config) {
12
+ const trace = resolveRunnerTracePolicy(config);
13
+ if (config.execution.profile === "conservative") {
14
+ return {
15
+ ...trace,
16
+ capture_stderr: true,
17
+ retention: "keep",
18
+ };
19
+ }
20
+ return trace;
21
+ }
22
+ function applyProfileToTimeoutPolicy(config) {
23
+ const timeout = resolveRunnerTimeoutPolicy(config);
24
+ if (config.execution.profile === "conservative") {
25
+ return {
26
+ ...timeout,
27
+ terminate_grace_ms: Math.max(timeout.terminate_grace_ms, 5000),
28
+ };
29
+ }
30
+ return timeout;
31
+ }
32
+ export function resolveExecutionProfileRuntime(config) {
33
+ const approvals = applyExecutionToApprovals({
34
+ execution: config.execution,
35
+ approvals: config.agents?.approvals ?? {
36
+ require_plan: false,
37
+ require_network: false,
38
+ require_verify: false,
39
+ require_force: false,
40
+ },
41
+ });
42
+ return {
43
+ profile: config.execution.profile,
44
+ reasoning_effort: config.execution.reasoning_effort,
45
+ budget: {
46
+ discovery: toBudgetCounter(config.execution.tool_budget.discovery),
47
+ implementation: toBudgetCounter(config.execution.tool_budget.implementation),
48
+ verification: toBudgetCounter(config.execution.tool_budget.verification),
49
+ },
50
+ stop_conditions: [...config.execution.stop_conditions],
51
+ handoff_conditions: [...config.execution.handoff_conditions],
52
+ unsafe_actions_requiring_explicit_user_ok: [
53
+ ...config.execution.unsafe_actions_requiring_explicit_user_ok,
54
+ ],
55
+ approvals,
56
+ runner: {
57
+ trace_policy: applyProfileToTracePolicy(config),
58
+ timeout_policy: applyProfileToTimeoutPolicy(config),
59
+ },
60
+ };
61
+ }
62
+ export function consumeExecutionProfileBudget(opts) {
63
+ const units = Math.max(0, Math.trunc(opts.units ?? 1));
64
+ const current = opts.runtime.budget[opts.phase];
65
+ const used = current.used + units;
66
+ const limit = current.limit;
67
+ const nextCounter = {
68
+ limit,
69
+ used,
70
+ remaining: Math.max(0, limit - used),
71
+ exhausted: used >= limit,
72
+ };
73
+ return {
74
+ ...opts.runtime,
75
+ budget: {
76
+ ...opts.runtime.budget,
77
+ [opts.phase]: nextCounter,
78
+ },
79
+ };
80
+ }
@@ -0,0 +1,27 @@
1
+ import type { AgentplaneConfig, RunnerTimeoutConfig, RunnerTraceConfig } from "@agentplaneorg/core";
2
+ export type ExecutionBudgetPhase = keyof AgentplaneConfig["execution"]["tool_budget"];
3
+ export type ExecutionBudgetCounter = {
4
+ limit: number;
5
+ used: number;
6
+ remaining: number;
7
+ exhausted: boolean;
8
+ };
9
+ export type ResolvedExecutionProfileRuntime = {
10
+ profile: AgentplaneConfig["execution"]["profile"];
11
+ reasoning_effort: AgentplaneConfig["execution"]["reasoning_effort"];
12
+ budget: Record<ExecutionBudgetPhase, ExecutionBudgetCounter>;
13
+ stop_conditions: string[];
14
+ handoff_conditions: string[];
15
+ unsafe_actions_requiring_explicit_user_ok: string[];
16
+ approvals: {
17
+ require_plan: boolean;
18
+ require_network: boolean;
19
+ require_verify: boolean;
20
+ require_force?: boolean;
21
+ };
22
+ runner: {
23
+ trace_policy: RunnerTraceConfig;
24
+ timeout_policy: RunnerTimeoutConfig;
25
+ };
26
+ };
27
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/execution-profile/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAEpG,MAAM,MAAM,oBAAoB,GAAG,MAAM,gBAAgB,CAAC,WAAW,CAAC,CAAC,aAAa,CAAC,CAAC;AAEtF,MAAM,MAAM,sBAAsB,GAAG;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,+BAA+B,GAAG;IAC5C,OAAO,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,CAAC;IAClD,gBAAgB,EAAE,gBAAgB,CAAC,WAAW,CAAC,CAAC,kBAAkB,CAAC,CAAC;IACpE,MAAM,EAAE,MAAM,CAAC,oBAAoB,EAAE,sBAAsB,CAAC,CAAC;IAC7D,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,yCAAyC,EAAE,MAAM,EAAE,CAAC;IACpD,SAAS,EAAE;QACT,YAAY,EAAE,OAAO,CAAC;QACtB,eAAe,EAAE,OAAO,CAAC;QACzB,cAAc,EAAE,OAAO,CAAC;QACxB,aAAa,CAAC,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,MAAM,EAAE;QACN,YAAY,EAAE,iBAAiB,CAAC;QAChC,cAAc,EAAE,mBAAmB,CAAC;KACrC,CAAC;CACH,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,3 @@
1
+ export { appendFrameworkExplainBehaviorInputs, buildFrameworkExplainPayload } from "./resolve.js";
2
+ export type { ExplainBehaviorInput, ExplainBehaviorInputCategory, FrameworkExplainPayload, } from "./types.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/explain/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oCAAoC,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAClG,YAAY,EACV,oBAAoB,EACpB,4BAA4B,EAC5B,uBAAuB,GACxB,MAAM,YAAY,CAAC"}
@@ -0,0 +1 @@
1
+ export { appendFrameworkExplainBehaviorInputs, buildFrameworkExplainPayload } from "./resolve.js";
@@ -0,0 +1,14 @@
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 { TaskIntakeRuntime } from "../task-intake/index.js";
5
+ import type { ExplainBehaviorInput, FrameworkExplainPayload } from "./types.js";
6
+ export declare function buildFrameworkExplainPayload(opts: {
7
+ harness: ResolvedHarnessContract;
8
+ capabilities: AgentplaneCapabilityRegistry;
9
+ execution_profile: ResolvedExecutionProfileRuntime;
10
+ task_intake: TaskIntakeRuntime;
11
+ behavior_inputs?: readonly ExplainBehaviorInput[];
12
+ }): FrameworkExplainPayload;
13
+ export declare function appendFrameworkExplainBehaviorInputs(payload: FrameworkExplainPayload, behavior_inputs: readonly ExplainBehaviorInput[]): FrameworkExplainPayload;
14
+ //# sourceMappingURL=resolve.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/runtime/explain/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,OAAO,KAAK,EAAE,oBAAoB,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AA4BhF,wBAAgB,4BAA4B,CAAC,IAAI,EAAE;IACjD,OAAO,EAAE,uBAAuB,CAAC;IACjC,YAAY,EAAE,4BAA4B,CAAC;IAC3C,iBAAiB,EAAE,+BAA+B,CAAC;IACnD,WAAW,EAAE,iBAAiB,CAAC;IAC/B,eAAe,CAAC,EAAE,SAAS,oBAAoB,EAAE,CAAC;CACnD,GAAG,uBAAuB,CAkB1B;AAED,wBAAgB,oCAAoC,CAClD,OAAO,EAAE,uBAAuB,EAChC,eAAe,EAAE,SAAS,oBAAoB,EAAE,GAC/C,uBAAuB,CAQzB"}
@@ -0,0 +1,50 @@
1
+ function normalizeBehaviorInputs(inputs) {
2
+ const seen = new Set();
3
+ const out = [];
4
+ for (const input of inputs) {
5
+ const id = input.id.trim();
6
+ if (!id)
7
+ throw new Error("Explain behavior inputs require a non-empty id.");
8
+ const signature = `${input.category}:${id}:${input.source ?? ""}:${input.resolution.key}`;
9
+ if (seen.has(signature))
10
+ continue;
11
+ seen.add(signature);
12
+ out.push({
13
+ id,
14
+ category: input.category,
15
+ ...(input.source?.trim() ? { source: input.source.trim() } : {}),
16
+ resolution: structuredClone(input.resolution),
17
+ });
18
+ }
19
+ return out.toSorted((left, right) => left.category.localeCompare(right.category) ||
20
+ left.id.localeCompare(right.id) ||
21
+ (left.source ?? "").localeCompare(right.source ?? ""));
22
+ }
23
+ export function buildFrameworkExplainPayload(opts) {
24
+ return {
25
+ schema_version: 1,
26
+ harness: structuredClone(opts.harness),
27
+ policy: {
28
+ approvals: structuredClone(opts.harness.policy.approvals),
29
+ protected_paths: structuredClone(opts.harness.policy.protected_paths),
30
+ unsafe_actions_requiring_explicit_user_ok: [
31
+ ...opts.harness.policy.unsafe_actions_requiring_explicit_user_ok,
32
+ ],
33
+ },
34
+ capabilities: structuredClone(opts.capabilities),
35
+ runtime: {
36
+ execution_profile: structuredClone(opts.execution_profile),
37
+ task_intake: structuredClone(opts.task_intake),
38
+ },
39
+ behavior_inputs: normalizeBehaviorInputs(opts.behavior_inputs ?? []),
40
+ };
41
+ }
42
+ export function appendFrameworkExplainBehaviorInputs(payload, behavior_inputs) {
43
+ return buildFrameworkExplainPayload({
44
+ harness: payload.harness,
45
+ capabilities: payload.capabilities,
46
+ execution_profile: payload.runtime.execution_profile,
47
+ task_intake: payload.runtime.task_intake,
48
+ behavior_inputs: [...payload.behavior_inputs, ...behavior_inputs],
49
+ });
50
+ }
@@ -0,0 +1,28 @@
1
+ import type { BehaviorResolutionTrace } from "../behavior/index.js";
2
+ import type { AgentplaneCapabilityRegistry } from "../capabilities/index.js";
3
+ import type { ResolvedExecutionProfileRuntime } from "../execution-profile/index.js";
4
+ import type { ResolvedHarnessContract } from "../harness/index.js";
5
+ import type { TaskIntakeRuntime } from "../task-intake/index.js";
6
+ export type ExplainBehaviorInputCategory = "prompt" | "behavior";
7
+ export type ExplainBehaviorInput = {
8
+ id: string;
9
+ category: ExplainBehaviorInputCategory;
10
+ source?: string;
11
+ resolution: BehaviorResolutionTrace<Record<string, unknown>>;
12
+ };
13
+ export type FrameworkExplainPayload = {
14
+ schema_version: 1;
15
+ harness: ResolvedHarnessContract;
16
+ policy: {
17
+ approvals: ResolvedHarnessContract["policy"]["approvals"];
18
+ protected_paths: ResolvedHarnessContract["policy"]["protected_paths"];
19
+ unsafe_actions_requiring_explicit_user_ok: string[];
20
+ };
21
+ capabilities: AgentplaneCapabilityRegistry;
22
+ runtime: {
23
+ execution_profile: ResolvedExecutionProfileRuntime;
24
+ task_intake: TaskIntakeRuntime;
25
+ };
26
+ behavior_inputs: ExplainBehaviorInput[];
27
+ };
28
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/explain/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AACrF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,MAAM,MAAM,4BAA4B,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEjE,MAAM,MAAM,oBAAoB,GAAG;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,4BAA4B,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,uBAAuB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,cAAc,EAAE,CAAC,CAAC;IAClB,OAAO,EAAE,uBAAuB,CAAC;IACjC,MAAM,EAAE;QACN,SAAS,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC,WAAW,CAAC,CAAC;QAC1D,eAAe,EAAE,uBAAuB,CAAC,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAAC;QACtE,yCAAyC,EAAE,MAAM,EAAE,CAAC;KACrD,CAAC;IACF,YAAY,EAAE,4BAA4B,CAAC;IAC3C,OAAO,EAAE;QACP,iBAAiB,EAAE,+BAA+B,CAAC;QACnD,WAAW,EAAE,iBAAiB,CAAC;KAChC,CAAC;IACF,eAAe,EAAE,oBAAoB,EAAE,CAAC;CACzC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export { resolveHarnessContract } from "./resolve.js";
2
+ export { resolveHarnessFromCommandContext } from "./resolve-from-command-context.js";
3
+ export type { HarnessSourceId, HarnessSourceRef, HarnessTraceField, ResolvedHarnessContract, ResolvedHarnessTrace, ResolvedProtectedPathGroups, } from "./types.js";
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/runtime/harness/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAE,gCAAgC,EAAE,MAAM,mCAAmC,CAAC;AACrF,YAAY,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACpB,2BAA2B,GAC5B,MAAM,YAAY,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { resolveHarnessContract } from "./resolve.js";
2
+ export { resolveHarnessFromCommandContext } from "./resolve-from-command-context.js";
@@ -0,0 +1,4 @@
1
+ import type { CommandContext } from "../../commands/shared/task-backend.js";
2
+ import type { ResolvedHarnessContract } from "./types.js";
3
+ export declare function resolveHarnessFromCommandContext(ctx: CommandContext): Promise<ResolvedHarnessContract>;
4
+ //# sourceMappingURL=resolve-from-command-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-from-command-context.d.ts","sourceRoot":"","sources":["../../../src/runtime/harness/resolve-from-command-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAG5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAE1D,wBAAsB,gCAAgC,CACpD,GAAG,EAAE,cAAc,GAClB,OAAO,CAAC,uBAAuB,CAAC,CASlC"}