agentplane 0.3.9 → 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 (244) 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 +305 -110
  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/commands/backend.d.ts.map +1 -1
  26. package/dist/commands/backend.js +4 -0
  27. package/dist/commands/incidents/advise.command.d.ts +15 -0
  28. package/dist/commands/incidents/advise.command.d.ts.map +1 -0
  29. package/dist/commands/incidents/advise.command.js +139 -0
  30. package/dist/commands/incidents/collect.command.d.ts +11 -0
  31. package/dist/commands/incidents/collect.command.d.ts.map +1 -0
  32. package/dist/commands/incidents/collect.command.js +67 -0
  33. package/dist/commands/incidents/incidents.command.d.ts +5 -0
  34. package/dist/commands/incidents/incidents.command.d.ts.map +1 -0
  35. package/dist/commands/incidents/incidents.command.js +21 -0
  36. package/dist/commands/incidents/shared.d.ts +42 -0
  37. package/dist/commands/incidents/shared.d.ts.map +1 -0
  38. package/dist/commands/incidents/shared.js +107 -0
  39. package/dist/commands/pr/check.d.ts.map +1 -1
  40. package/dist/commands/pr/check.js +73 -2
  41. package/dist/commands/pr/integrate/cmd.d.ts.map +1 -1
  42. package/dist/commands/pr/integrate/cmd.js +4 -0
  43. package/dist/commands/pr/integrate/internal/merge.d.ts +4 -0
  44. package/dist/commands/pr/integrate/internal/merge.d.ts.map +1 -1
  45. package/dist/commands/pr/integrate/internal/merge.js +23 -2
  46. package/dist/commands/pr/integrate/internal/prepare.d.ts.map +1 -1
  47. package/dist/commands/pr/integrate/internal/prepare.js +26 -1
  48. package/dist/commands/pr/internal/note-store.d.ts +18 -0
  49. package/dist/commands/pr/internal/note-store.d.ts.map +1 -0
  50. package/dist/commands/pr/internal/note-store.js +66 -0
  51. package/dist/commands/pr/internal/pr-paths.d.ts +3 -0
  52. package/dist/commands/pr/internal/pr-paths.d.ts.map +1 -1
  53. package/dist/commands/pr/internal/pr-paths.js +3 -0
  54. package/dist/commands/pr/internal/review-template.d.ts +24 -4
  55. package/dist/commands/pr/internal/review-template.d.ts.map +1 -1
  56. package/dist/commands/pr/internal/review-template.js +188 -33
  57. package/dist/commands/pr/internal/sync.d.ts +32 -0
  58. package/dist/commands/pr/internal/sync.d.ts.map +1 -0
  59. package/dist/commands/pr/internal/sync.js +258 -0
  60. package/dist/commands/pr/note.d.ts.map +1 -1
  61. package/dist/commands/pr/note.js +37 -4
  62. package/dist/commands/pr/open.d.ts.map +1 -1
  63. package/dist/commands/pr/open.js +7 -54
  64. package/dist/commands/pr/pr.command.d.ts.map +1 -1
  65. package/dist/commands/pr/pr.command.js +6 -3
  66. package/dist/commands/pr/update.d.ts.map +1 -1
  67. package/dist/commands/pr/update.js +5 -79
  68. package/dist/commands/recipes/impl/commands/cache-prune.d.ts.map +1 -1
  69. package/dist/commands/recipes/impl/commands/cache-prune.js +14 -0
  70. package/dist/commands/recipes/impl/commands/install.js +1 -1
  71. package/dist/commands/recipes/impl/commands/list-remote.d.ts.map +1 -1
  72. package/dist/commands/recipes/impl/commands/list-remote.js +1 -0
  73. package/dist/commands/recipes/impl/commands/remove.d.ts.map +1 -1
  74. package/dist/commands/recipes/impl/commands/remove.js +9 -1
  75. package/dist/commands/release/apply.command.d.ts.map +1 -1
  76. package/dist/commands/release/apply.command.js +9 -0
  77. package/dist/commands/shared/approval-requirements.d.ts +5 -7
  78. package/dist/commands/shared/approval-requirements.d.ts.map +1 -1
  79. package/dist/commands/shared/approval-requirements.js +3 -73
  80. package/dist/commands/shared/network-approval.d.ts +2 -0
  81. package/dist/commands/shared/network-approval.d.ts.map +1 -1
  82. package/dist/commands/shared/network-approval.js +1 -1
  83. package/dist/commands/shared/pr-meta.d.ts +9 -0
  84. package/dist/commands/shared/pr-meta.d.ts.map +1 -1
  85. package/dist/commands/shared/pr-meta.js +27 -3
  86. package/dist/commands/shared/task-backend.d.ts +2 -0
  87. package/dist/commands/shared/task-backend.d.ts.map +1 -1
  88. package/dist/commands/shared/task-local-freshness.d.ts +13 -0
  89. package/dist/commands/shared/task-local-freshness.d.ts.map +1 -0
  90. package/dist/commands/shared/task-local-freshness.js +20 -0
  91. package/dist/commands/shared/task-mutation.d.ts +2 -0
  92. package/dist/commands/shared/task-mutation.d.ts.map +1 -1
  93. package/dist/commands/shared/task-mutation.js +7 -0
  94. package/dist/commands/task/block.d.ts.map +1 -1
  95. package/dist/commands/task/block.js +1 -0
  96. package/dist/commands/task/close-shared.d.ts.map +1 -1
  97. package/dist/commands/task/close-shared.js +1 -0
  98. package/dist/commands/task/finish-shared.d.ts.map +1 -1
  99. package/dist/commands/task/finish-shared.js +5 -2
  100. package/dist/commands/task/finish.d.ts.map +1 -1
  101. package/dist/commands/task/finish.js +24 -0
  102. package/dist/commands/task/new.d.ts.map +1 -1
  103. package/dist/commands/task/new.js +69 -29
  104. package/dist/commands/task/set-status.d.ts.map +1 -1
  105. package/dist/commands/task/set-status.js +1 -0
  106. package/dist/commands/task/shared/transition-command.d.ts +2 -0
  107. package/dist/commands/task/shared/transition-command.d.ts.map +1 -1
  108. package/dist/commands/task/shared/transition-command.js +1 -0
  109. package/dist/commands/task/start-ready.d.ts.map +1 -1
  110. package/dist/commands/task/start-ready.js +12 -1
  111. package/dist/commands/task/start.d.ts.map +1 -1
  112. package/dist/commands/task/start.js +11 -0
  113. package/dist/commands/task/verify-record.d.ts.map +1 -1
  114. package/dist/commands/task/verify-record.js +27 -0
  115. package/dist/commands/upgrade.d.ts.map +1 -1
  116. package/dist/commands/upgrade.js +6 -1
  117. package/dist/policy/engine.d.ts +3 -1
  118. package/dist/policy/engine.d.ts.map +1 -1
  119. package/dist/policy/engine.js +5 -6
  120. package/dist/policy/taxonomy.d.ts +17 -0
  121. package/dist/policy/taxonomy.d.ts.map +1 -0
  122. package/dist/policy/taxonomy.js +302 -0
  123. package/dist/policy/types.d.ts +2 -1
  124. package/dist/policy/types.d.ts.map +1 -1
  125. package/dist/runner/artifacts.d.ts.map +1 -1
  126. package/dist/runner/artifacts.js +2 -0
  127. package/dist/runner/context/base-prompts.d.ts +25 -0
  128. package/dist/runner/context/base-prompts.d.ts.map +1 -1
  129. package/dist/runner/context/base-prompts.js +182 -54
  130. package/dist/runner/context/recipe-context.d.ts.map +1 -1
  131. package/dist/runner/context/recipe-context.js +5 -0
  132. package/dist/runner/types.d.ts +12 -0
  133. package/dist/runner/types.d.ts.map +1 -1
  134. package/dist/runner/usecases/scenario-materialize-task.d.ts.map +1 -1
  135. package/dist/runner/usecases/scenario-materialize-task.js +81 -11
  136. package/dist/runner/usecases/task-run-inspect.d.ts.map +1 -1
  137. package/dist/runner/usecases/task-run-inspect.js +9 -7
  138. package/dist/runner/usecases/task-run-lifecycle-shared.d.ts.map +1 -1
  139. package/dist/runner/usecases/task-run-lifecycle-shared.js +8 -6
  140. package/dist/runner/usecases/task-run.d.ts.map +1 -1
  141. package/dist/runner/usecases/task-run.js +59 -12
  142. package/dist/runtime/approvals/index.d.ts +3 -0
  143. package/dist/runtime/approvals/index.d.ts.map +1 -0
  144. package/dist/runtime/approvals/index.js +1 -0
  145. package/dist/runtime/approvals/runtime.d.ts +12 -0
  146. package/dist/runtime/approvals/runtime.d.ts.map +1 -0
  147. package/dist/runtime/approvals/runtime.js +154 -0
  148. package/dist/runtime/approvals/types.d.ts +31 -0
  149. package/dist/runtime/approvals/types.d.ts.map +1 -0
  150. package/dist/runtime/approvals/types.js +1 -0
  151. package/dist/runtime/behavior/index.d.ts +3 -0
  152. package/dist/runtime/behavior/index.d.ts.map +1 -0
  153. package/dist/runtime/behavior/index.js +1 -0
  154. package/dist/runtime/behavior/resolve.d.ts +7 -0
  155. package/dist/runtime/behavior/resolve.d.ts.map +1 -0
  156. package/dist/runtime/behavior/resolve.js +66 -0
  157. package/dist/runtime/behavior/types.d.ts +25 -0
  158. package/dist/runtime/behavior/types.d.ts.map +1 -0
  159. package/dist/runtime/behavior/types.js +1 -0
  160. package/dist/runtime/capabilities/backend.d.ts +7 -0
  161. package/dist/runtime/capabilities/backend.d.ts.map +1 -0
  162. package/dist/runtime/capabilities/backend.js +104 -0
  163. package/dist/runtime/capabilities/index.d.ts +6 -0
  164. package/dist/runtime/capabilities/index.d.ts.map +1 -0
  165. package/dist/runtime/capabilities/index.js +4 -0
  166. package/dist/runtime/capabilities/recipe.d.ts +10 -0
  167. package/dist/runtime/capabilities/recipe.d.ts.map +1 -0
  168. package/dist/runtime/capabilities/recipe.js +123 -0
  169. package/dist/runtime/capabilities/registry.d.ts +6 -0
  170. package/dist/runtime/capabilities/registry.d.ts.map +1 -0
  171. package/dist/runtime/capabilities/registry.js +69 -0
  172. package/dist/runtime/capabilities/runner.d.ts +8 -0
  173. package/dist/runtime/capabilities/runner.d.ts.map +1 -0
  174. package/dist/runtime/capabilities/runner.js +73 -0
  175. package/dist/runtime/capabilities/types.d.ts +28 -0
  176. package/dist/runtime/capabilities/types.d.ts.map +1 -0
  177. package/dist/runtime/capabilities/types.js +1 -0
  178. package/dist/runtime/execution-profile/index.d.ts +3 -0
  179. package/dist/runtime/execution-profile/index.d.ts.map +1 -0
  180. package/dist/runtime/execution-profile/index.js +1 -0
  181. package/dist/runtime/execution-profile/resolve.d.ts +9 -0
  182. package/dist/runtime/execution-profile/resolve.d.ts.map +1 -0
  183. package/dist/runtime/execution-profile/resolve.js +80 -0
  184. package/dist/runtime/execution-profile/types.d.ts +27 -0
  185. package/dist/runtime/execution-profile/types.d.ts.map +1 -0
  186. package/dist/runtime/execution-profile/types.js +1 -0
  187. package/dist/runtime/explain/index.d.ts +3 -0
  188. package/dist/runtime/explain/index.d.ts.map +1 -0
  189. package/dist/runtime/explain/index.js +1 -0
  190. package/dist/runtime/explain/resolve.d.ts +14 -0
  191. package/dist/runtime/explain/resolve.d.ts.map +1 -0
  192. package/dist/runtime/explain/resolve.js +50 -0
  193. package/dist/runtime/explain/types.d.ts +28 -0
  194. package/dist/runtime/explain/types.d.ts.map +1 -0
  195. package/dist/runtime/explain/types.js +1 -0
  196. package/dist/runtime/harness/index.d.ts +4 -0
  197. package/dist/runtime/harness/index.d.ts.map +1 -0
  198. package/dist/runtime/harness/index.js +2 -0
  199. package/dist/runtime/harness/resolve-from-command-context.d.ts +4 -0
  200. package/dist/runtime/harness/resolve-from-command-context.d.ts.map +1 -0
  201. package/dist/runtime/harness/resolve-from-command-context.js +11 -0
  202. package/dist/runtime/harness/resolve.d.ts +13 -0
  203. package/dist/runtime/harness/resolve.d.ts.map +1 -0
  204. package/dist/runtime/harness/resolve.js +146 -0
  205. package/dist/runtime/harness/types.d.ts +65 -0
  206. package/dist/runtime/harness/types.d.ts.map +1 -0
  207. package/dist/runtime/harness/types.js +1 -0
  208. package/dist/runtime/incidents/index.d.ts +3 -0
  209. package/dist/runtime/incidents/index.d.ts.map +1 -0
  210. package/dist/runtime/incidents/index.js +1 -0
  211. package/dist/runtime/incidents/resolve.d.ts +26 -0
  212. package/dist/runtime/incidents/resolve.d.ts.map +1 -0
  213. package/dist/runtime/incidents/resolve.js +437 -0
  214. package/dist/runtime/incidents/types.d.ts +72 -0
  215. package/dist/runtime/incidents/types.d.ts.map +1 -0
  216. package/dist/runtime/incidents/types.js +1 -0
  217. package/dist/runtime/protocol/index.d.ts +3 -0
  218. package/dist/runtime/protocol/index.d.ts.map +1 -0
  219. package/dist/runtime/protocol/index.js +2 -0
  220. package/dist/runtime/protocol/resolve.d.ts +16 -0
  221. package/dist/runtime/protocol/resolve.d.ts.map +1 -0
  222. package/dist/runtime/protocol/resolve.js +36 -0
  223. package/dist/runtime/protocol/types.d.ts +36 -0
  224. package/dist/runtime/protocol/types.d.ts.map +1 -0
  225. package/dist/runtime/protocol/types.js +1 -0
  226. package/dist/runtime/task-intake/index.d.ts +3 -0
  227. package/dist/runtime/task-intake/index.d.ts.map +1 -0
  228. package/dist/runtime/task-intake/index.js +1 -0
  229. package/dist/runtime/task-intake/resolve.d.ts +48 -0
  230. package/dist/runtime/task-intake/resolve.d.ts.map +1 -0
  231. package/dist/runtime/task-intake/resolve.js +316 -0
  232. package/dist/runtime/task-intake/types.d.ts +117 -0
  233. package/dist/runtime/task-intake/types.d.ts.map +1 -0
  234. package/dist/runtime/task-intake/types.js +1 -0
  235. package/dist/shared/protected-paths.d.ts +4 -0
  236. package/dist/shared/protected-paths.d.ts.map +1 -1
  237. package/dist/shared/protected-paths.js +4 -4
  238. package/dist/usecases/context/resolve-context.d.ts +55 -6
  239. package/dist/usecases/context/resolve-context.d.ts.map +1 -1
  240. package/dist/usecases/context/resolve-context.js +96 -6
  241. package/dist/usecases/task/task-list-usecase.d.ts.map +1 -1
  242. package/dist/usecases/task/task-list-usecase.js +8 -2
  243. package/dist/usecases/task/task-new-usecase.js +4 -4
  244. package/package.json +2 -2
@@ -0,0 +1,48 @@
1
+ import type { AgentplaneCapabilityRegistry } from "../capabilities/index.js";
2
+ import type { ResolvedExecutionProfileRuntime } from "../execution-profile/index.js";
3
+ import type { ResolvedHarnessContract } from "../harness/index.js";
4
+ import type { ClarificationContract, ClarificationQuestion, TaskGraphDependency, TaskGraphDraft, TaskGraphDraftTask, TaskIntakeContext, TaskIntakeInput, TaskIntakeRuntime, TaskMaterializationPlan } from "./types.js";
5
+ export declare function createTaskIntakeRuntime(opts: {
6
+ repo: TaskIntakeRuntime["repo"];
7
+ backend: {
8
+ id: string;
9
+ config_path: string;
10
+ capabilities: TaskIntakeRuntime["backend"]["capabilities"];
11
+ supports_generate_task_id: boolean;
12
+ supports_bulk_write: boolean;
13
+ };
14
+ harness: Pick<ResolvedHarnessContract, "workflow" | "task" | "policy">;
15
+ execution_profile: ResolvedExecutionProfileRuntime;
16
+ capabilities: AgentplaneCapabilityRegistry;
17
+ }): TaskIntakeRuntime;
18
+ export declare function createTaskIntakeContext(opts: {
19
+ runtime: TaskIntakeRuntime;
20
+ source: TaskIntakeContext["source"];
21
+ requested_outcome: string;
22
+ requested_owner?: string;
23
+ requested_tags?: string[];
24
+ requested_verify?: string[];
25
+ requested_dependencies?: string[];
26
+ parent_task_id?: string;
27
+ inputs?: TaskIntakeInput[];
28
+ }): TaskIntakeContext;
29
+ export declare function createClarificationContract(opts: {
30
+ context: TaskIntakeContext;
31
+ assumptions?: string[];
32
+ questions?: ClarificationQuestion[];
33
+ }): ClarificationContract;
34
+ export declare function createTaskGraphDraft(opts: {
35
+ context: TaskIntakeContext;
36
+ clarification: ClarificationContract;
37
+ summary: string;
38
+ tasks: TaskGraphDraftTask[];
39
+ dependencies?: TaskGraphDependency[];
40
+ warnings?: string[];
41
+ }): TaskGraphDraft;
42
+ export declare function materializeTaskGraphDraft(opts: {
43
+ draft: TaskGraphDraft;
44
+ task_ids?: Record<string, string>;
45
+ allocateTaskId?: (task: TaskGraphDraftTask, index: number) => Promise<string>;
46
+ created_at?: string;
47
+ }): Promise<TaskMaterializationPlan>;
48
+ //# sourceMappingURL=resolve.d.ts.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IAC5B,sBAAsB,CAAC,EAAE,MAAM,EAAE,CAAC;IAClC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B,GAAG,iBAAiB,CAepB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,OAAO,EAAE,iBAAiB,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,SAAS,CAAC,EAAE,qBAAqB,EAAE,CAAC;CACrC,GAAG,qBAAqB,CAQxB;AAED,wBAAgB,oBAAoB,CAAC,IAAI,EAAE;IACzC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,aAAa,EAAE,qBAAqB,CAAC;IACrC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,kBAAkB,EAAE,CAAC;IAC5B,YAAY,CAAC,EAAE,mBAAmB,EAAE,CAAC;IACrC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACrB,GAAG,cAAc,CAUjB;AAED,wBAAsB,yBAAyB,CAAC,IAAI,EAAE;IACpD,KAAK,EAAE,cAAc,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,kBAAkB,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC9E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAyCnC"}
@@ -0,0 +1,316 @@
1
+ import path from "node:path";
2
+ import { buildTaskDocState } from "../../shared/task-doc-state.js";
3
+ const TASK_INTAKE_BEHAVIOR_ORDER = [
4
+ "harness",
5
+ "extension",
6
+ "user",
7
+ "builtin",
8
+ ];
9
+ function dedupeTrimmed(values) {
10
+ const seen = new Set();
11
+ const out = [];
12
+ for (const raw of values) {
13
+ const value = String(raw ?? "").trim();
14
+ if (!value || seen.has(value))
15
+ continue;
16
+ seen.add(value);
17
+ out.push(value);
18
+ }
19
+ return out;
20
+ }
21
+ function normalizeOutcome(value) {
22
+ const normalized = value.trim();
23
+ if (!normalized)
24
+ throw new Error("Task intake context requires a non-empty requested outcome.");
25
+ return normalized;
26
+ }
27
+ function normalizeSourceDetail(value) {
28
+ const normalized = value.trim();
29
+ if (!normalized)
30
+ throw new Error("Task intake source detail must be non-empty.");
31
+ return normalized;
32
+ }
33
+ function normalizeInputs(inputs) {
34
+ return inputs
35
+ .map((input) => ({
36
+ kind: input.kind,
37
+ ...(input.label?.trim() ? { label: input.label.trim() } : {}),
38
+ value: normalizeOutcome(input.value),
39
+ ...(input.required === true ? { required: true } : {}),
40
+ }))
41
+ .toSorted((left, right) => left.kind.localeCompare(right.kind) ||
42
+ (left.label ?? "").localeCompare(right.label ?? "") ||
43
+ left.value.localeCompare(right.value));
44
+ }
45
+ function normalizeQuestions(questions) {
46
+ const seen = new Set();
47
+ const out = [];
48
+ for (const raw of questions) {
49
+ const id = raw.id.trim();
50
+ const question = raw.question.trim();
51
+ const reason = raw.reason.trim();
52
+ if (!id)
53
+ throw new Error("Clarification questions require a non-empty id.");
54
+ if (!question)
55
+ throw new Error(`Clarification question ${id} requires question text.`);
56
+ if (!reason)
57
+ throw new Error(`Clarification question ${id} requires a reason.`);
58
+ if (seen.has(id))
59
+ throw new Error(`Clarification question ids must be unique: ${id}`);
60
+ seen.add(id);
61
+ out.push({
62
+ id,
63
+ question,
64
+ reason,
65
+ required: raw.required === true,
66
+ ...(raw.target_field?.trim() ? { target_field: raw.target_field.trim() } : {}),
67
+ ...(raw.accepted_values
68
+ ? { accepted_values: dedupeTrimmed(raw.accepted_values).toSorted() }
69
+ : {}),
70
+ });
71
+ }
72
+ return out.toSorted((left, right) => left.id.localeCompare(right.id));
73
+ }
74
+ function normalizeDraftTasks(tasks) {
75
+ if (tasks.length === 0)
76
+ throw new Error("Task graph draft requires at least one task.");
77
+ const seen = new Set();
78
+ return tasks.map((task) => {
79
+ const draft_id = task.draft_id.trim();
80
+ if (!draft_id)
81
+ throw new Error("Task graph draft tasks require a non-empty draft_id.");
82
+ if (seen.has(draft_id))
83
+ throw new Error(`Duplicate task graph draft id: ${draft_id}`);
84
+ seen.add(draft_id);
85
+ const title = task.title.trim();
86
+ if (!title)
87
+ throw new Error(`Task graph draft task ${draft_id} requires a title.`);
88
+ const description = task.description.trim();
89
+ if (!description) {
90
+ throw new Error(`Task graph draft task ${draft_id} requires a description.`);
91
+ }
92
+ const owner = task.owner.trim();
93
+ if (!owner)
94
+ throw new Error(`Task graph draft task ${draft_id} requires an owner.`);
95
+ const doc = task.doc.trim();
96
+ if (!doc)
97
+ throw new Error(`Task graph draft task ${draft_id} requires a task document.`);
98
+ return {
99
+ draft_id,
100
+ title,
101
+ description,
102
+ owner,
103
+ priority: task.priority,
104
+ ...(task.origin ? { origin: structuredClone(task.origin) } : {}),
105
+ tags: dedupeTrimmed(task.tags).toSorted(),
106
+ verify: dedupeTrimmed(task.verify).toSorted(),
107
+ depends_on: dedupeTrimmed(task.depends_on).toSorted(),
108
+ doc,
109
+ ...(task.doc_version ? { doc_version: task.doc_version } : {}),
110
+ ...(task.id_source?.trim() ? { id_source: task.id_source.trim() } : {}),
111
+ };
112
+ });
113
+ }
114
+ function normalizeDependencies(tasks, dependencies) {
115
+ const taskIds = new Set(tasks.map((task) => task.draft_id));
116
+ const seen = new Set();
117
+ const out = [];
118
+ for (const dependency of dependencies) {
119
+ if (!taskIds.has(dependency.from)) {
120
+ throw new Error(`Task graph dependency source is unknown: ${dependency.from}`);
121
+ }
122
+ if (!taskIds.has(dependency.to)) {
123
+ throw new Error(`Task graph dependency target is unknown: ${dependency.to}`);
124
+ }
125
+ const signature = `${dependency.from}:${dependency.kind}:${dependency.to}`;
126
+ if (seen.has(signature))
127
+ continue;
128
+ seen.add(signature);
129
+ out.push({
130
+ from: dependency.from,
131
+ to: dependency.to,
132
+ kind: "depends_on",
133
+ });
134
+ }
135
+ return out.toSorted((left, right) => left.from.localeCompare(right.from) ||
136
+ left.kind.localeCompare(right.kind) ||
137
+ left.to.localeCompare(right.to));
138
+ }
139
+ function resolveTaskIds(opts) {
140
+ const provided = new Map();
141
+ const taskIds = opts.task_ids ?? {};
142
+ for (const task of opts.tasks) {
143
+ const taskId = taskIds[task.draft_id]?.trim();
144
+ if (taskId)
145
+ provided.set(task.draft_id, taskId);
146
+ }
147
+ return (async () => {
148
+ if (provided.size === opts.tasks.length)
149
+ return provided;
150
+ if (!opts.allocateTaskId) {
151
+ throw new Error("Task graph materialization requires task_ids for every draft task or an allocateTaskId callback.");
152
+ }
153
+ for (const [index, task] of opts.tasks.entries()) {
154
+ if (provided.has(task.draft_id))
155
+ continue;
156
+ const allocatedTaskId = await opts.allocateTaskId(task, index);
157
+ const taskId = allocatedTaskId.trim();
158
+ if (!taskId) {
159
+ throw new Error(`Task id allocator returned an empty id for draft ${task.draft_id}.`);
160
+ }
161
+ provided.set(task.draft_id, taskId);
162
+ }
163
+ return provided;
164
+ })();
165
+ }
166
+ function buildMaterializedTask(opts) {
167
+ const normalizedDoc = buildTaskDocState({
168
+ doc: opts.draftTask.doc,
169
+ owner: opts.draftTask.owner,
170
+ updatedBy: opts.draftTask.owner,
171
+ version: opts.draftTask.doc_version ?? 3,
172
+ updatedAt: opts.created_at,
173
+ });
174
+ const task = {
175
+ id: opts.task_id,
176
+ title: opts.draftTask.title,
177
+ description: opts.draftTask.description,
178
+ status: "TODO",
179
+ priority: opts.draftTask.priority,
180
+ owner: opts.draftTask.owner,
181
+ revision: 1,
182
+ ...(opts.draftTask.origin ? { origin: structuredClone(opts.draftTask.origin) } : {}),
183
+ depends_on: dedupeTrimmed([
184
+ ...opts.draftTask.depends_on,
185
+ ...opts.internal_dependencies,
186
+ ]).toSorted(),
187
+ tags: [...opts.draftTask.tags],
188
+ verify: [...opts.draftTask.verify],
189
+ comments: [],
190
+ events: [],
191
+ doc_version: normalizedDoc.doc_version,
192
+ doc_updated_at: normalizedDoc.doc_updated_at,
193
+ doc_updated_by: normalizedDoc.doc_updated_by,
194
+ id_source: opts.draftTask.id_source ?? "generated",
195
+ doc: normalizedDoc.doc,
196
+ sections: normalizedDoc.sections,
197
+ };
198
+ return {
199
+ draft_id: opts.draftTask.draft_id,
200
+ task_id: opts.task_id,
201
+ task,
202
+ readme_path: path.join(opts.context.runtime.repo.git_root, opts.context.runtime.repo.workflow_dir, opts.task_id, "README.md"),
203
+ };
204
+ }
205
+ export function createTaskIntakeRuntime(opts) {
206
+ return {
207
+ repo: {
208
+ git_root: opts.repo.git_root,
209
+ agentplane_dir: opts.repo.agentplane_dir,
210
+ workflow_dir: opts.repo.workflow_dir,
211
+ },
212
+ workflow: {
213
+ mode: opts.harness.workflow.mode,
214
+ },
215
+ backend: {
216
+ id: opts.backend.id,
217
+ config_path: opts.backend.config_path,
218
+ capabilities: opts.backend.capabilities ? structuredClone(opts.backend.capabilities) : null,
219
+ supports_generate_task_id: opts.backend.supports_generate_task_id,
220
+ supports_bulk_write: opts.backend.supports_bulk_write,
221
+ },
222
+ task_contract: {
223
+ doc_sections: [...opts.harness.task.doc_sections],
224
+ required_doc_sections: [...opts.harness.task.required_doc_sections],
225
+ verify_required_tags: [...opts.harness.task.verify_required_tags],
226
+ },
227
+ policy: {
228
+ approvals: structuredClone(opts.harness.policy.approvals),
229
+ protected_paths: structuredClone(opts.harness.policy.protected_paths),
230
+ unsafe_actions_requiring_explicit_user_ok: [
231
+ ...opts.harness.policy.unsafe_actions_requiring_explicit_user_ok,
232
+ ],
233
+ },
234
+ execution_profile: structuredClone(opts.execution_profile),
235
+ capabilities: structuredClone(opts.capabilities),
236
+ precedence: {
237
+ behavior_order: [...TASK_INTAKE_BEHAVIOR_ORDER],
238
+ extension_layer: "recipes",
239
+ },
240
+ };
241
+ }
242
+ export function createTaskIntakeContext(opts) {
243
+ return {
244
+ runtime: structuredClone(opts.runtime),
245
+ source: {
246
+ id: opts.source.id,
247
+ detail: normalizeSourceDetail(opts.source.detail),
248
+ },
249
+ requested_outcome: normalizeOutcome(opts.requested_outcome),
250
+ ...(opts.requested_owner?.trim() ? { requested_owner: opts.requested_owner.trim() } : {}),
251
+ requested_tags: dedupeTrimmed(opts.requested_tags ?? []).toSorted(),
252
+ requested_verify: dedupeTrimmed(opts.requested_verify ?? []).toSorted(),
253
+ requested_dependencies: dedupeTrimmed(opts.requested_dependencies ?? []).toSorted(),
254
+ ...(opts.parent_task_id?.trim() ? { parent_task_id: opts.parent_task_id.trim() } : {}),
255
+ inputs: normalizeInputs(opts.inputs ?? []),
256
+ };
257
+ }
258
+ export function createClarificationContract(opts) {
259
+ const questions = normalizeQuestions(opts.questions ?? []);
260
+ return {
261
+ context: structuredClone(opts.context),
262
+ status: questions.some((question) => question.required) ? "needs_input" : "ready",
263
+ assumptions: dedupeTrimmed(opts.assumptions ?? []),
264
+ questions,
265
+ };
266
+ }
267
+ export function createTaskGraphDraft(opts) {
268
+ const tasks = normalizeDraftTasks(opts.tasks);
269
+ return {
270
+ context: structuredClone(opts.context),
271
+ clarification: structuredClone(opts.clarification),
272
+ summary: normalizeOutcome(opts.summary),
273
+ tasks,
274
+ dependencies: normalizeDependencies(tasks, opts.dependencies ?? []),
275
+ warnings: dedupeTrimmed(opts.warnings ?? []),
276
+ };
277
+ }
278
+ export async function materializeTaskGraphDraft(opts) {
279
+ if (opts.draft.clarification.status === "needs_input") {
280
+ throw new Error("Task graph materialization requires clarification.status=ready.");
281
+ }
282
+ const created_at = opts.created_at ?? new Date().toISOString();
283
+ const taskIds = await resolveTaskIds({
284
+ tasks: opts.draft.tasks,
285
+ task_ids: opts.task_ids,
286
+ allocateTaskId: opts.allocateTaskId,
287
+ });
288
+ const tasks = opts.draft.tasks.map((draftTask) => {
289
+ const task_id = taskIds.get(draftTask.draft_id);
290
+ if (!task_id) {
291
+ throw new Error(`Task id resolution lost draft task ${draftTask.draft_id}.`);
292
+ }
293
+ const internal_dependencies = opts.draft.dependencies
294
+ .filter((dependency) => dependency.from === draftTask.draft_id)
295
+ .map((dependency) => {
296
+ const resolved = taskIds.get(dependency.to);
297
+ if (!resolved) {
298
+ throw new Error(`Task id resolution lost dependency target ${dependency.to}.`);
299
+ }
300
+ return resolved;
301
+ });
302
+ return buildMaterializedTask({
303
+ context: opts.draft.context,
304
+ draftTask,
305
+ task_id,
306
+ internal_dependencies,
307
+ created_at,
308
+ });
309
+ });
310
+ return {
311
+ context: structuredClone(opts.draft.context),
312
+ summary: opts.draft.summary,
313
+ backend: structuredClone(opts.draft.context.runtime.backend),
314
+ tasks,
315
+ };
316
+ }
@@ -0,0 +1,117 @@
1
+ import type { ApprovalSettings, TaskDocVersion } from "@agentplaneorg/core";
2
+ import type { TaskBackendCapabilities, TaskData, TaskOrigin } from "../../backends/task-backend.js";
3
+ import type { BehaviorLayer } from "../behavior/index.js";
4
+ import type { AgentplaneCapabilityRegistry } from "../capabilities/index.js";
5
+ import type { ResolvedExecutionProfileRuntime } from "../execution-profile/index.js";
6
+ import type { ResolvedHarnessContract } from "../harness/index.js";
7
+ export type TaskIntakeSourceId = "task_new" | "task_create" | "recipe_scenario" | "import" | "system";
8
+ export type TaskIntakeSourceRef = {
9
+ id: TaskIntakeSourceId;
10
+ detail: string;
11
+ };
12
+ export type TaskIntakeInputKind = "text" | "constraint" | "task_reference" | "recipe_reference" | "output";
13
+ export type TaskIntakeInput = {
14
+ kind: TaskIntakeInputKind;
15
+ label?: string;
16
+ value: string;
17
+ required?: boolean;
18
+ };
19
+ export type TaskIntakePrecedence = {
20
+ behavior_order: BehaviorLayer[];
21
+ extension_layer: "recipes";
22
+ };
23
+ export type TaskIntakeRuntime = {
24
+ repo: {
25
+ git_root: string;
26
+ agentplane_dir: string;
27
+ workflow_dir: string;
28
+ };
29
+ workflow: {
30
+ mode: ResolvedHarnessContract["workflow"]["mode"];
31
+ };
32
+ backend: {
33
+ id: string;
34
+ config_path: string;
35
+ capabilities: TaskBackendCapabilities | null;
36
+ supports_generate_task_id: boolean;
37
+ supports_bulk_write: boolean;
38
+ };
39
+ task_contract: {
40
+ doc_sections: string[];
41
+ required_doc_sections: string[];
42
+ verify_required_tags: string[];
43
+ };
44
+ policy: {
45
+ approvals: Required<ApprovalSettings>;
46
+ protected_paths: ResolvedHarnessContract["policy"]["protected_paths"];
47
+ unsafe_actions_requiring_explicit_user_ok: string[];
48
+ };
49
+ execution_profile: ResolvedExecutionProfileRuntime;
50
+ capabilities: AgentplaneCapabilityRegistry;
51
+ precedence: TaskIntakePrecedence;
52
+ };
53
+ export type TaskIntakeContext = {
54
+ runtime: TaskIntakeRuntime;
55
+ source: TaskIntakeSourceRef;
56
+ requested_outcome: string;
57
+ requested_owner?: string;
58
+ requested_tags: string[];
59
+ requested_verify: string[];
60
+ requested_dependencies: string[];
61
+ parent_task_id?: string;
62
+ inputs: TaskIntakeInput[];
63
+ };
64
+ export type ClarificationQuestion = {
65
+ id: string;
66
+ question: string;
67
+ reason: string;
68
+ required: boolean;
69
+ target_field?: string;
70
+ accepted_values?: string[];
71
+ };
72
+ export type ClarificationContract = {
73
+ context: TaskIntakeContext;
74
+ status: "ready" | "needs_input";
75
+ assumptions: string[];
76
+ questions: ClarificationQuestion[];
77
+ };
78
+ export type TaskGraphDependency = {
79
+ from: string;
80
+ to: string;
81
+ kind: "depends_on";
82
+ };
83
+ export type TaskGraphDraftTask = {
84
+ draft_id: string;
85
+ title: string;
86
+ description: string;
87
+ owner: string;
88
+ priority: TaskData["priority"];
89
+ origin?: TaskOrigin | null;
90
+ tags: string[];
91
+ verify: string[];
92
+ depends_on: string[];
93
+ doc: string;
94
+ doc_version?: TaskDocVersion;
95
+ id_source?: string;
96
+ };
97
+ export type TaskGraphDraft = {
98
+ context: TaskIntakeContext;
99
+ clarification: ClarificationContract;
100
+ summary: string;
101
+ tasks: TaskGraphDraftTask[];
102
+ dependencies: TaskGraphDependency[];
103
+ warnings: string[];
104
+ };
105
+ export type TaskMaterializationEntry = {
106
+ draft_id: string;
107
+ task_id: string;
108
+ task: TaskData;
109
+ readme_path: string;
110
+ };
111
+ export type TaskMaterializationPlan = {
112
+ context: TaskIntakeContext;
113
+ summary: string;
114
+ backend: TaskIntakeRuntime["backend"];
115
+ tasks: TaskMaterializationEntry[];
116
+ };
117
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/runtime/task-intake/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,KAAK,EAAE,uBAAuB,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AACpG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,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;AAEnE,MAAM,MAAM,kBAAkB,GAC1B,UAAU,GACV,aAAa,GACb,iBAAiB,GACjB,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,kBAAkB,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN,YAAY,GACZ,gBAAgB,GAChB,kBAAkB,GAClB,QAAQ,CAAC;AAEb,MAAM,MAAM,eAAe,GAAG;IAC5B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,eAAe,EAAE,SAAS,CAAC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K,EAAE,kBAAkB,EAAE,CAAC;IAC5B,YAAY,EAAE,mBAAmB,EAAE,CAAC;IACpC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,wBAAwB,GAAG;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,QAAQ,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC,OAAO,EAAE,iBAAiB,CAAC;IAC3B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACtC,KAAK,EAAE,wBAAwB,EAAE,CAAC;CACnC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -9,6 +9,10 @@ export declare function taskArtifactPrefixes(opts: {
9
9
  workflowDir?: string;
10
10
  taskId?: string;
11
11
  }): string[];
12
+ export declare const POLICY_PATH_PREFIXES: readonly ["AGENTS.md", "CLAUDE.md", "packages/agentplane/assets/AGENTS.md", ".agentplane/agents"];
13
+ export declare const CONFIG_PATH_PREFIXES: readonly [".agentplane/config.json", ".agentplane/backends"];
14
+ export declare const HOOK_PATH_PREFIXES: readonly ["lefthook.yml"];
15
+ export declare const CI_PATH_PREFIXES: readonly [".github/workflows", ".github/actions"];
12
16
  export declare function protectedPathAllowPrefixes(opts: {
13
17
  tasksPath: string;
14
18
  workflowDir?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"protected-paths.d.ts","sourceRoot":"","sources":["../../src/shared/protected-paths.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,QAAQ,GAAG,QAAQ,GAAG,OAAO,GAAG,IAAI,CAAC;AAE/E,MAAM,MAAM,qBAAqB,GAAG;IAClC,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,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CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,MAAM,EAAE,CAOX;AAED,eAAO,MAAM,oBAAoB,mGAKvB,CAAC;AACX,eAAO,MAAM,oBAAoB,8DAA+D,CAAC;AACjG,eAAO,MAAM,kBAAkB,2BAA4B,CAAC;AAC5D,eAAO,MAAM,gBAAgB,mDAAoD,CAAC;AAElF,wBAAgB,0BAA0B,CAAC,IAAI,EAAE;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,GAAG,MAAM,EAAE,CAkBX;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,iBAAiB,GAAG,qBAAqB,CAkBvF;AAED,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,GAAG,iBAAiB,GAAG,IAAI,CAsC3B"}
@@ -16,15 +16,15 @@ export function taskArtifactPrefixes(opts) {
16
16
  out.add(workflowPrefix);
17
17
  return [...out].toSorted((a, b) => a.localeCompare(b));
18
18
  }
19
- const POLICY_PATH_PREFIXES = [
19
+ export const POLICY_PATH_PREFIXES = [
20
20
  "AGENTS.md",
21
21
  "CLAUDE.md",
22
22
  "packages/agentplane/assets/AGENTS.md",
23
23
  ".agentplane/agents",
24
24
  ];
25
- const CONFIG_PATH_PREFIXES = [".agentplane/config.json", ".agentplane/backends"];
26
- const HOOK_PATH_PREFIXES = ["lefthook.yml"];
27
- const CI_PATH_PREFIXES = [".github/workflows", ".github/actions"];
25
+ export const CONFIG_PATH_PREFIXES = [".agentplane/config.json", ".agentplane/backends"];
26
+ export const HOOK_PATH_PREFIXES = ["lefthook.yml"];
27
+ export const CI_PATH_PREFIXES = [".github/workflows", ".github/actions"];
28
28
  export function protectedPathAllowPrefixes(opts) {
29
29
  const out = new Set();
30
30
  if (opts.allowTasks) {
@@ -2,18 +2,67 @@ import type { AgentplaneConfig, ResolvedProject } from "@agentplaneorg/core";
2
2
  import type { Adapters } from "../../adapters/index.js";
3
3
  import { type CommandContext } from "../../commands/shared/task-backend.js";
4
4
  import { PolicyEngine } from "../../policy/engine.js";
5
- export type UsecaseContext = {
5
+ import { type ApprovalRuntime } from "../../runtime/approvals/index.js";
6
+ import { type AgentplaneCapabilityRegistry } from "../../runtime/capabilities/index.js";
7
+ import { type ResolvedExecutionProfileRuntime } from "../../runtime/execution-profile/index.js";
8
+ import { type FrameworkExplainPayload } from "../../runtime/explain/index.js";
9
+ import { type ResolvedHarnessContract } from "../../runtime/harness/index.js";
10
+ import { type FrameworkProtocolSurface } from "../../runtime/protocol/index.js";
11
+ import { type TaskIntakeRuntime } from "../../runtime/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 ReadOnlyUsecaseContext = {
6
24
  command: CommandContext;
7
- adapters: Adapters;
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"];
8
37
  policy: PolicyEngine;
38
+ approvalRuntime: ApprovalRuntime;
9
39
  };
10
- export type ReadOnlyUsecaseContext = Pick<UsecaseContext, "command">;
11
- export declare function resolveContext(opts: {
40
+ export type UsecaseContext = ReadOnlyUsecaseContext & {
41
+ adapters: Adapters;
42
+ };
43
+ export type AgentplaneReadOnlyExecutionContext = ReadOnlyUsecaseContext;
44
+ export type AgentplaneExecutionContext = UsecaseContext;
45
+ export declare function resolveCommandContext(opts: {
12
46
  cwd: string;
13
47
  rootOverride?: string | null;
14
48
  resolvedProject?: ResolvedProject;
15
49
  config?: AgentplaneConfig;
16
50
  }): Promise<CommandContext>;
17
- export declare function makeReadOnlyUsecaseContext(command: CommandContext): ReadOnlyUsecaseContext;
18
- export declare function makeUsecaseContext(command: CommandContext): UsecaseContext;
51
+ export declare function resolveContext(opts: {
52
+ cwd: string;
53
+ rootOverride?: string | null;
54
+ resolvedProject?: ResolvedProject;
55
+ config?: AgentplaneConfig;
56
+ }): Promise<ReadOnlyUsecaseContext>;
57
+ export declare const resolveReadOnlyExecutionContext: typeof resolveContext;
58
+ export declare function resolveExecutionContext(opts: {
59
+ cwd: string;
60
+ rootOverride?: string | null;
61
+ resolvedProject?: ResolvedProject;
62
+ config?: AgentplaneConfig;
63
+ }): Promise<AgentplaneExecutionContext>;
64
+ export declare function makeReadOnlyUsecaseContext(command: CommandContext): Promise<ReadOnlyUsecaseContext>;
65
+ export declare function makeUsecaseContext(command: CommandContext): Promise<UsecaseContext>;
66
+ export declare const makeReadOnlyExecutionContext: typeof makeReadOnlyUsecaseContext;
67
+ export declare const makeExecutionContext: typeof makeUsecaseContext;
19
68
  //# sourceMappingURL=resolve-context.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-context.d.ts","sourceRoot":"","sources":["../../../src/usecases/context/resolve-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEtD,MAAM,MAAM,cAAc,GAAG;IAC3B,OAAO,EAAE,cAAc,CAAC;IACxB,QAAQ,EAAE,QAAQ,CAAC;IACnB,MAAM,EAAE,YAAY,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG,IAAI,CAAC,cAAc,EAAE,SAAS,CAAC,CAAC;AAErE,wBAAsB,cAAc,CAAC,IAAI,EAAE;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B,GAAG,OAAO,CAAC,cAAc,CAAC,CAO1B;AAED,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,cAAc,GAAG,sBAAsB,CAE1F;AAED,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,cAAc,GAAG,cAAc,CAM1E"}
1
+ {"version":3,"file":"resolve-context.d.ts","sourceRoot":"","sources":["../../../src/usecases/context/resolve-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAC7E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,uCAAuC,CAAC;AAChG,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAyB,KAAK,eAAe,EA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