@agent-compose/sdk 0.7.0 → 0.8.1

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 (119) hide show
  1. package/README.md +66 -39
  2. package/dist/agent/__tests__/runtime-json-schema.test.d.ts +10 -0
  3. package/dist/agent/agent-context.d.ts +21 -1
  4. package/dist/agent/agent-loop.d.ts +32 -1
  5. package/dist/agent/run-agent.d.ts +4 -0
  6. package/dist/client.d.ts +382 -534
  7. package/dist/directives.d.ts +112 -0
  8. package/dist/display.d.ts +258 -0
  9. package/dist/errors.d.ts +24 -1
  10. package/dist/index.d.ts +26 -14
  11. package/dist/index.js +3774 -1679
  12. package/dist/pause/wrappers.d.ts +31 -9
  13. package/dist/runtimes/_acp-client.d.ts +46 -1
  14. package/dist/runtimes/_cli-agent.d.ts +51 -4
  15. package/dist/runtimes/_jsonl-guard.d.ts +103 -0
  16. package/dist/runtimes/amp.d.ts +2 -2
  17. package/dist/runtimes/claude-code.d.ts +61 -0
  18. package/dist/runtimes/claude-code.test.d.ts +14 -0
  19. package/dist/runtimes/claude.d.ts +16 -0
  20. package/dist/runtimes/claude.test.d.ts +8 -0
  21. package/dist/runtimes/codex.d.ts +12 -3
  22. package/dist/runtimes/cursor.d.ts +2 -2
  23. package/dist/runtimes/droid.d.ts +2 -2
  24. package/dist/runtimes/jsonl-guard.test.d.ts +19 -0
  25. package/dist/runtimes/openai-desktop.js +3718 -1680
  26. package/dist/runtimes/opencode.d.ts +2 -2
  27. package/dist/runtimes/vercel.js +12 -1
  28. package/dist/sandbox/devbox.d.ts +42 -0
  29. package/dist/sandbox/exec-stream.d.ts +14 -0
  30. package/dist/sandbox/network-policy.d.ts +100 -0
  31. package/dist/sandbox/provider-def.d.ts +79 -0
  32. package/dist/sandbox/providers/desktop.d.ts +10 -0
  33. package/dist/sandbox/providers/e2b.d.ts +17 -0
  34. package/dist/sandbox/providers/local.d.ts +11 -0
  35. package/dist/sandbox/providers/vercel.d.ts +18 -0
  36. package/dist/sandbox/registry.d.ts +45 -0
  37. package/dist/sandbox/sizes.d.ts +68 -0
  38. package/dist/sandbox.d.ts +24 -299
  39. package/dist/step-invocation/__tests__/foreground-recovery.test.d.ts +1 -0
  40. package/dist/step-invocation/invoker.d.ts +10 -0
  41. package/dist/step-invocation/protocol.d.ts +5 -0
  42. package/dist/types/api-compliance.d.ts +71 -0
  43. package/dist/types/api-conversations.d.ts +523 -0
  44. package/dist/types/api-factory.d.ts +334 -0
  45. package/dist/types/api-projects.d.ts +131 -0
  46. package/dist/types/api-runs.d.ts +422 -0
  47. package/dist/types/api-scopes.d.ts +102 -0
  48. package/dist/types/conversation-stream.d.ts +191 -0
  49. package/dist/types/execution-context.d.ts +12 -2
  50. package/dist/types/protocol.d.ts +38 -1
  51. package/dist/types/sandbox-environment.d.ts +8 -5
  52. package/dist/types/sandbox.d.ts +74 -4
  53. package/dist/types/workflow-metadata.d.ts +41 -8
  54. package/dist/types/workflow-plan.d.ts +10 -0
  55. package/dist/types/workflow.d.ts +18 -205
  56. package/dist/utils/bundler.d.ts +68 -1
  57. package/dist/workflow-steps/index.d.ts +1 -1
  58. package/dist/workflow-steps/observability.d.ts +8 -1
  59. package/dist/workflow-steps/runner.d.ts +3 -3
  60. package/dist/workflow-steps/step.d.ts +15 -1
  61. package/dist/workflow-steps/types.d.ts +19 -5
  62. package/dist/workflow-steps/workflow.d.ts +29 -1
  63. package/dist/workflows/engine.d.ts +3 -2
  64. package/dist/workflows/invoke-child.d.ts +20 -2
  65. package/dist/workflows/invoke-child.test.d.ts +9 -0
  66. package/package.json +2 -2
  67. package/src/agent/agent-context.ts +186 -3
  68. package/src/agent/agent-loop.ts +40 -2
  69. package/src/agent/run-agent.ts +5 -0
  70. package/src/client.ts +1048 -625
  71. package/src/directives.ts +184 -0
  72. package/src/display.ts +834 -0
  73. package/src/errors.ts +39 -0
  74. package/src/index.ts +114 -12
  75. package/src/pause/wrappers.ts +44 -9
  76. package/src/runtimes/_acp-client.ts +72 -3
  77. package/src/runtimes/_cli-agent.ts +161 -36
  78. package/src/runtimes/_jsonl-guard.ts +219 -0
  79. package/src/runtimes/claude-code.ts +256 -0
  80. package/src/runtimes/claude.ts +32 -2
  81. package/src/runtimes/codex.ts +63 -3
  82. package/src/runtimes/openai-desktop.ts +59 -14
  83. package/src/sandbox/devbox.ts +48 -0
  84. package/src/sandbox/exec-stream.ts +48 -0
  85. package/src/sandbox/network-policy.ts +181 -0
  86. package/src/sandbox/provider-def.ts +94 -0
  87. package/src/sandbox/providers/desktop.ts +57 -0
  88. package/src/sandbox/providers/e2b.ts +354 -0
  89. package/src/sandbox/providers/local.ts +106 -0
  90. package/src/sandbox/providers/vercel.ts +331 -0
  91. package/src/sandbox/registry.ts +198 -0
  92. package/src/sandbox/sizes.ts +95 -0
  93. package/src/sandbox.ts +59 -1275
  94. package/src/step-invocation/invoker.ts +151 -28
  95. package/src/step-invocation/protocol.ts +8 -0
  96. package/src/types/api-compliance.ts +79 -0
  97. package/src/types/api-conversations.ts +547 -0
  98. package/src/types/api-factory.ts +368 -0
  99. package/src/types/api-projects.ts +140 -0
  100. package/src/types/api-runs.ts +459 -0
  101. package/src/types/api-scopes.ts +102 -0
  102. package/src/types/conversation-stream.ts +231 -0
  103. package/src/types/execution-context.ts +10 -2
  104. package/src/types/protocol.ts +41 -0
  105. package/src/types/sandbox-environment.ts +28 -9
  106. package/src/types/sandbox.ts +73 -4
  107. package/src/types/workflow-metadata.ts +44 -8
  108. package/src/types/workflow-plan.ts +11 -0
  109. package/src/types/workflow.ts +25 -292
  110. package/src/utils/bundler.ts +245 -8
  111. package/src/utils/errors.ts +16 -1
  112. package/src/workflow-steps/index.ts +1 -0
  113. package/src/workflow-steps/observability.ts +19 -8
  114. package/src/workflow-steps/runner.ts +4 -4
  115. package/src/workflow-steps/step.ts +49 -1
  116. package/src/workflow-steps/types.ts +20 -5
  117. package/src/workflow-steps/workflow.ts +29 -1
  118. package/src/workflows/engine.ts +3 -2
  119. package/src/workflows/invoke-child.ts +49 -13
@@ -1,45 +1,33 @@
1
1
  /**
2
- * Workflow types — the context and function signature for authoring workflows.
2
+ * Workflow authoring types — `defineWorkflow` and the shared author-facing
3
+ * type surface.
3
4
  *
4
- * A workflow is `async (ctx, sandbox) => T`. Two positional args by design:
5
- *
6
- * - `ctx` carries facts + observability about THIS run (id, input,
7
- * setMetadata, step). Metadata bag.
8
- * - `sandbox` is a capability handed to you by the engine for doing work
9
- * (exec commands, write files). Pass it to `agent({ sandbox, ... })`
10
- * and to any helper that takes a SandboxProvider (git utilities, file
11
- * writers). Constructed once per run; reuse it.
5
+ * Workflows are STEP-FORM only: a builder of discrete, durable steps —
6
+ * `defineWorkflow({ id, input, output }).step(defineStep(...)).build()`.
7
+ * Every step is a replay checkpoint; pause/resume works at step
8
+ * granularity. The legacy run-form (`defineWorkflow({ run(ctx, sandbox)
9
+ * { … } })`) has been removed — passing a `run` key throws at
10
+ * definition time (i.e. at registration, loud and early).
12
11
  *
13
12
  * LLM agent loops live in `agent(opts)` (sdk/src/agent/run-agent.ts).
14
13
  * Invoking other workflows uses `AgentComposeClient.invoke[AndWait](...)`.
15
14
  */
16
15
 
17
- import { z } from "zod";
18
- import type { SandboxNetworkPolicy } from "../sandbox.js";
19
- import type { SandboxProvider } from "./sandbox.js";
20
16
  import type { AgentLifecycleEvent } from "../agent/agent-loop.js";
21
- import type { Processor } from "../processors/processor.js";
22
17
  import { createStepWorkflow } from "../workflow-steps/workflow.js";
23
- import type { StepWorkflowDefinition } from "../workflow-steps/workflow.js";
24
- import type { Step, Workflow } from "../workflow-steps/types.js";
25
- import { WORKFLOW_BRAND } from "../workflow-steps/types.js";
26
- import type { BaseExecutionContext, WorkflowRun } from "./execution-context.js";
27
- import { extractMetadata, type WorkflowMetadata, type ConnectorRequirements, type ConnectorOperationTag, type InvokePolicy } from "./workflow-metadata.js";
18
+ import type { StepWorkflowDefinition, WorkflowBuilder } from "../workflow-steps/workflow.js";
28
19
 
29
20
  export type { WorkflowRun, InvokeChild, BaseExecutionContext } from "./execution-context.js";
30
21
  // Re-export so consumers can keep importing `WorkflowMetadata` from
31
22
  // `@agent-compose/sdk` — the canonical definition lives in
32
23
  // `./workflow-metadata.js` to break a runtime import cycle with
33
24
  // `workflow-steps/workflow.ts`.
34
- export type { WorkflowMetadata } from "./workflow-metadata.js";
25
+ export type { WorkflowMetadata, SnapshotConfig, BootSnapshot, ReuseSnapshot, IOSchema, OutputSchema, SandboxResources } from "./workflow-metadata.js";
35
26
 
36
27
  export interface AgentEventSink {
37
28
  emit(event: AgentLifecycleEvent): void | Promise<void>;
38
29
  }
39
30
 
40
- import type { SnapshotConfig, BootSnapshot, ReuseSnapshot, IOSchema, OutputSchema, SandboxResources } from "./workflow-metadata.js";
41
- export type { SnapshotConfig, BootSnapshot, ReuseSnapshot, IOSchema, OutputSchema, SandboxResources };
42
-
43
31
  /** Turn/iteration budget for `agent(opts)`. Re-exported here so authors
44
32
  * can type per-invoke budget overrides they pass as workflow input. */
45
33
  export interface AgentBudget {
@@ -47,282 +35,27 @@ export interface AgentBudget {
47
35
  maxIterations: number;
48
36
  }
49
37
 
50
- /** Context passed to a workflow function — facts + observability for this run. */
51
- export interface WorkflowCtx<TInput extends Record<string, unknown> = Record<string, unknown>> extends Omit<BaseExecutionContext, "sandbox"> {
52
- input?: TInput;
53
- /** Persist key-value metadata on the run record (e.g. prUrl, planUrl). */
54
- setMetadata: (data: Record<string, unknown>) => Promise<void>;
55
- /**
56
- * Durable named step (ADR-0012). Runs `fn` once and memoises its result to
57
- * the sandbox state-dir; on a pause-resume re-entry the recorded value is
58
- * returned and `fn` is NOT re-run (a duration-0 "restored" sub-step). Also
59
- * emits substep_started / substep_completed / substep_failed lifecycle
60
- * events with duration — use for long phases you want both durable and
61
- * visible on the run's timeline (setup, external API calls, submit).
62
- *
63
- * Names must be unique within a step body (they key the memoise file).
64
- * A body that pauses is never memoised — the resume re-runs it. For
65
- * cross-process side effects (DB writes, emails) use `invokeChild`.
66
- */
67
- step<T>(name: string, fn: () => Promise<T>): Promise<T>;
68
- /** Pass to `agent({ events: ctx.agentEvents })` to stream agent lifecycle events. */
69
- agentEvents: AgentEventSink;
70
- /**
71
- * Workflow-level processors registered via `defineWorkflow({ processors })`.
72
- * Read-only here. Authors merge with agent-specific lists when calling
73
- * `agent({ processors: [...ctx.processors, mySpecific] })`.
74
- *
75
- * Empty array when the workflow declared no processors.
76
- */
77
- processors: readonly Processor[];
78
- }
79
-
80
- /** A workflow is `async (ctx, sandbox) => TOutput`. */
81
- export type WorkflowFn<
82
- TOutput = unknown,
83
- TInput extends Record<string, unknown> = Record<string, unknown>,
84
- > = (ctx: WorkflowCtx<TInput>, sandbox: SandboxProvider) => Promise<TOutput>;
85
-
86
- /**
87
- * Declare a workflow with server-side metadata.
88
- * Use `export default defineWorkflow({ run, networkPolicy, ... })` to attach
89
- * a runner network policy so the server brokers credentials for the workflow
90
- * sandbox.
91
- *
92
- * Without defineWorkflow, a plain `export default async (ctx) => {...}` still
93
- * works — the workflow just runs with secrets passed directly in env.
94
- */
95
- export interface WorkflowDefinition<
96
- TOutput = unknown,
97
- TInput extends Record<string, unknown> = Record<string, unknown>,
98
- > {
99
- /** One-line, human-readable description of what this workflow does.
100
- * Surfaced on the dashboard template tile + run page header. */
101
- description?: string;
102
- /** Zod schema for the workflow's `input`. When declared, the SDK
103
- * bundler captures it as JSON-Schema-shaped `inputSchema` in
104
- * template metadata, the dashboard playground renders a typed
105
- * form, and the engine validates dispatched payloads against it
106
- * at the step boundary. Omit to leave inputs as `unknown` (the
107
- * legacy default — playground falls back to a freeform JSON
108
- * textarea). */
109
- input?: z.ZodType<TInput>;
110
- /** Same as `input`, for the workflow's return value. Captured into
111
- * `outputSchema` metadata and rendered in the IO panel. */
112
- output?: z.ZodType<TOutput>;
113
- /**
114
- * @deprecated Legacy run-form. Prefer step-form — the
115
- * `.step(defineStep(...))` builder — for per-step durability/replay and
116
- * working pause. A run-form body compiles to one opaque step
117
- * (`compileRunForm`), so any failure/resume re-runs the whole body.
118
- */
119
- run: WorkflowFn<TOutput, TInput>;
120
- /**
121
- * All snapshot config — boot source plus capture mode.
122
- *
123
- * `snapshots.bootFrom`: the runner restores from this exact provider
124
- * snapshot id at run start. Omit to boot a fresh sandbox.
125
- *
126
- * `snapshots.saveLatest`: `true` captures one snapshot after each
127
- * successful step (latest-only — prior is freed).
128
- * `{ saveLatest: true, retainSteps: true }` keeps every step's
129
- * snapshot for fork / replay / time-travel.
130
- *
131
- * Snapshots are long-lived (never auto-expire). List + delete via
132
- * `agentc snapshot list/delete`. Per-invocation
133
- * `invoke({ snapshots })` overrides this default.
134
- */
135
- snapshots?: SnapshotConfig;
136
- /**
137
- * Sandbox resources — machine SKU (`size`, a `SandboxSize` vCPU string:
138
- * `2vcpu-4gb` | `4vcpu-8gb` | `8vcpu-16gb` | `32vcpu-64gb`) and `provider`
139
- * (`vercel` | `e2b`). `size` maps to provider machine specs at create
140
- * (Vercel: vCPUs, 2048 MB RAM per vCPU); E2B sizing is template-defined and
141
- * ignores it. Optional; omit → smallest SKU on the default provider.
142
- * Per-invocation `invoke({ size })` overrides the size.
143
- */
144
- resources?: SandboxResources;
145
- /**
146
- * Outbound network policy for the runner sandbox.
147
- * Use "*": [] to allow all traffic while still injecting headers for specific domains.
148
- * Secret values are referenced as $VARIABLE and resolved from GCP at dispatch time.
149
- * Vercel only — E2B ignores.
150
- *
151
- * @example
152
- * networkPolicy: {
153
- * allow: {
154
- * "*": [],
155
- * "api.github.com": [{ transform: [{ headers: { "Authorization": "basic:$GITHUB_TOKEN" } }] }],
156
- * }
157
- * }
158
- */
159
- networkPolicy?: SandboxNetworkPolicy;
160
- /**
161
- * Workflow-level processor chain — runs around every `agent(...)` loop the
162
- * workflow body launches, ahead of any agent-specific processors. Use for
163
- * org-wide gating (deny destructive tools, require scopes). Authors merge
164
- * with agent-specific lists via `[...ctx.processors, ...]`.
165
- */
166
- processors?: readonly Processor[];
167
- /**
168
- * Optional placeholder env var values for secrets referenced in the network policy.
169
- * By default, brokered secrets are removed from the runner env entirely — the real
170
- * values are only ever present inside the Vercel firewall config, never in the VM.
171
- * Only set this if a tool or SDK validates the env var format on startup before
172
- * making any requests (e.g. some CLIs check that ANTHROPIC_API_KEY looks like a
173
- * real key). The placeholder is a syntactically valid but non-functional stand-in.
174
- *
175
- * @example
176
- * placeholders: {
177
- * ANTHROPIC_API_KEY: `sk-ant-api03-${"a".repeat(95)}`,
178
- * }
179
- */
180
- placeholders?: Record<string, string>;
181
- /**
182
- * Connector requirements (ADR-0007). Declaring a provider makes the
183
- * server resolve an authorized OAuth grant for the calling principal at
184
- * dispatch time and inject a fresh access token at the network layer —
185
- * workflow code talks to the provider API with plain fetch/SDKs and
186
- * never holds the credential.
187
- *
188
- * @example
189
- * connectors: { github: { scopes: ["repo"] } }
190
- */
191
- connectors?: ConnectorRequirements;
192
- /**
193
- * Marks this workflow as a catalogue OPERATION of a connector — e.g.
194
- * the `create-issue` operation of the `github` connector. Pair with
195
- * `description` + `input`/`output` schemas so the operation is fully
196
- * self-describing (MCP-tool-like) to humans and agents browsing the
197
- * connector catalogue.
198
- *
199
- * @example
200
- * connectorOperation: { provider: "github", operation: "create-issue" }
201
- */
202
- connectorOperation?: ConnectorOperationTag;
203
- /**
204
- * Tier-1 invoke ACL (connector credential boundary). When this workflow
205
- * declares `connectors` (it brokers a credential) AND an `invokePolicy`,
206
- * the server evaluates the calling principal against the policy BEFORE
207
- * binding any grant — a caller matching no clause is refused with HTTP
208
- * 403. Has no effect on workflows that declare no connectors. Omit to
209
- * leave the workflow invokable by the whole team.
210
- *
211
- * @example
212
- * connectors: { github: { access: "read" } },
213
- * invokePolicy: { users: "owner", workflows: ["nightly-orchestrator"] }
214
- */
215
- invokePolicy?: InvokePolicy;
216
- /**
217
- * Internal — set by `defineSandboxEnvironment`, not by workflow authors.
218
- * Marks the workflow as an environment build (base-env / agent-env) so the
219
- * server skips mounting the shared factory drive for its runs (#13). See
220
- * `WorkflowMetadata.environmentBuild`.
221
- */
222
- environmentBuild?: boolean;
223
- }
224
-
225
38
  /**
226
- * Wrap a legacy `(ctx, sandbox) => T` workflow body as a single-step
227
- * `Workflow` so the engine has one shape to drive. The synthesised step
228
- * runs the user's `run` body inline; `ctx.setMetadata` / `ctx.step` /
229
- * `ctx.agentEvents` proxy directly to the underlying `StepContext` hooks,
230
- * which the engine flushes to the run timeline exactly as the legacy
231
- * full-mode runner did.
39
+ * Declare a workflow — the typed step builder. Multiple steps with
40
+ * explicit input/output schemas, durability + replay at every step
41
+ * boundary:
232
42
  *
233
- * Lifecycle granularity is workflow-level (one outer "run" step) — the
234
- * `ctx.step("name", fn)` calls inside the body become sub-step events
235
- * under that one step. Authors keep the same source; the dashboard sees
236
- * the same timeline shape.
237
- */
238
- // TODO: collapse run-form into pure sugar over step-form. Run-form
239
- // already compiles to step-form-with-one-step here, so maintaining two
240
- // authoring surfaces is API duplication that periodically drifts (see
241
- // the input/output thread-through bug fixed on 2026-05-20: step-form
242
- // preserved schemas, run-form silently stamped z.unknown()). Cleaner:
243
- // turn `defineWorkflow({ run })` into a thin wrapper that calls the
244
- // step builder with a synthesised `{name:"run", input, output, run}`
245
- // step, then delete this function. Runtime stays identical.
246
- function compileRunForm<TOutput, TInput extends Record<string, unknown>>(
247
- def: WorkflowDefinition<TOutput, TInput>,
248
- metadata: WorkflowMetadata,
249
- ): Workflow<TInput, TOutput> {
250
- const unknownSchema = z.unknown() as z.ZodType<unknown>;
251
- const inputSchema: z.ZodType<TInput> = def.input ?? (unknownSchema as z.ZodType<TInput>);
252
- const outputSchema: z.ZodType<TOutput> = def.output ?? (unknownSchema as z.ZodType<TOutput>);
253
- const step: Step<TInput, TOutput> = {
254
- name: "run",
255
- input: inputSchema,
256
- output: outputSchema,
257
- run: async (stepCtx) => {
258
- // Proxy the legacy WorkflowCtx hooks to the step's collector-backed
259
- // implementations. The engine harvests the snapshot after execute
260
- // returns; nothing here is a no-op.
261
- const workflowCtx: WorkflowCtx<TInput> = {
262
- input: stepCtx.input,
263
- run: stepCtx.run,
264
- requestContext: stepCtx.requestContext,
265
- invokeChild: stepCtx.invokeChild,
266
- setMetadata: stepCtx.setMetadata,
267
- step: stepCtx.step,
268
- agentEvents: stepCtx.agentEvents,
269
- pause: stepCtx.pause,
270
- sleep: stepCtx.sleep,
271
- waitForEvent: stepCtx.waitForEvent,
272
- processors: metadata.processors ?? [],
273
- };
274
- const sandbox = stepCtx.sandbox;
275
- if (!sandbox) throw new Error("legacy run-form workflow requires a sandbox in StepContext");
276
- return def.run(workflowCtx, sandbox);
277
- },
278
- };
279
- const workflow: Workflow<TInput, TOutput> = {
280
- id: "@run-form",
281
- input: inputSchema,
282
- output: outputSchema,
283
- steps: Object.freeze([step]),
284
- metadata,
285
- };
286
- // Brand BEFORE freezing — defineProperty is the only way to set a
287
- // non-enumerable key, and frozen objects refuse it.
288
- Object.defineProperty(workflow, WORKFLOW_BRAND, { value: true, enumerable: false });
289
- return Object.freeze(workflow);
290
- }
291
-
292
- /**
293
- * Declare a workflow. Two forms; both return a `Workflow` whose
294
- * `metadata` field carries the server-readable declarations.
43
+ * defineWorkflow({ id, input, output }).step(defineStep(...)).build()
295
44
  *
296
- * Run form — wraps the legacy `(ctx, sandbox) => T` body as a single
297
- * step internally. Lifecycle granularity is workflow-level (one step).
298
- *
299
- * Step form — the typed builder. Multiple steps with explicit input/
300
- * output schemas, durability + replay at every step boundary.
301
- *
302
- * Both forms produce the same downstream shape: the bundler reads
303
- * `workflow.metadata.networkPolicy` / `placeholders` / etc.; the server
304
- * stores the step plan; runner subprocesses execute one step at a time
305
- * via the StepInvocation seam.
306
- */
307
- /**
308
- * @deprecated Run-form is legacy. Use the step-form overload —
309
- * `defineWorkflow({ id, input, output }).step(defineStep(...)).build()` — for
310
- * durable, replayable steps and working pause. Run-form compiles to a single
311
- * opaque step (`compileRunForm`); there is no per-step replay.
45
+ * The bundler reads `workflow.metadata.networkPolicy` / `placeholders` /
46
+ * etc. off the built `Workflow`; the server stores the step plan; runner
47
+ * subprocesses execute one step at a time via the StepInvocation seam.
312
48
  */
313
- export function defineWorkflow<
314
- TOutput = unknown,
315
- TInput extends Record<string, unknown> = Record<string, unknown>,
316
- >(
317
- def: WorkflowDefinition<TOutput, TInput>,
318
- ): Workflow<TInput, TOutput>;
319
49
  export function defineWorkflow<TInput, TOutput>(
320
50
  def: StepWorkflowDefinition<TInput, TOutput>,
321
- ): import("../workflow-steps/workflow.js").WorkflowBuilder<TInput, TInput>;
322
- export function defineWorkflow<TOutput = unknown, TInput extends Record<string, unknown> = Record<string, unknown>>(
323
- def: WorkflowDefinition<TOutput, TInput> | StepWorkflowDefinition<unknown, unknown>,
324
- ): Workflow<TInput, TOutput> | import("../workflow-steps/workflow.js").WorkflowBuilder<unknown, unknown> {
325
- if ("run" in def) return compileRunForm(def, extractMetadata(def));
51
+ ): WorkflowBuilder<TInput, TInput> {
52
+ if ("run" in def) {
53
+ throw new Error(
54
+ "defineWorkflow: the legacy run-form (`defineWorkflow({ run(ctx, sandbox) { … } })`) has been removed. " +
55
+ "Author workflows in step-form — `defineWorkflow({ id, input, output }).step(defineStep(...)).build()` — " +
56
+ "or run /ac:generate-workflow to scaffold the current shape.",
57
+ );
58
+ }
326
59
  return createStepWorkflow(def);
327
60
  }
328
61