@agent-compose/sdk 0.8.5 → 0.8.6

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 (97) hide show
  1. package/README.md +213 -189
  2. package/dist/agent/agent-context.d.ts +3 -3
  3. package/dist/agent/agent-loop.d.ts +4 -5
  4. package/dist/agent/perf-sampler.d.ts +27 -2
  5. package/dist/agent/run-agent.d.ts +1 -1
  6. package/dist/client.d.ts +105 -52
  7. package/dist/directives.d.ts +3 -3
  8. package/dist/display.d.ts +7 -0
  9. package/dist/errors.d.ts +1 -1
  10. package/dist/generated/agentc-commands.d.ts +34 -0
  11. package/dist/index.d.ts +12 -12
  12. package/dist/index.js +716 -203
  13. package/dist/request-context/request-context.d.ts +1 -1
  14. package/dist/runtimes/_cli-agent.d.ts +182 -68
  15. package/dist/runtimes/claude-code.d.ts +60 -1
  16. package/dist/runtimes/claude.d.ts +1 -1
  17. package/dist/runtimes/codex.d.ts +94 -6
  18. package/dist/runtimes/codex.mid-turn-hook.test.d.ts +10 -0
  19. package/dist/runtimes/openai-desktop.js +686 -199
  20. package/dist/runtimes/opencode.d.ts +48 -11
  21. package/dist/runtimes/opencode.test.d.ts +14 -0
  22. package/dist/sandbox/baked-clis.d.ts +75 -0
  23. package/dist/sandbox/exec-stream.d.ts +1 -2
  24. package/dist/sandbox/network-policy.d.ts +23 -5
  25. package/dist/sandbox.d.ts +4 -2
  26. package/dist/step-invocation/protocol.d.ts +3 -4
  27. package/dist/step-invocation/server.d.ts +2 -2
  28. package/dist/step-invocation/types.d.ts +1 -1
  29. package/dist/types/api-conversations.d.ts +442 -29
  30. package/dist/types/api-factory.d.ts +78 -8
  31. package/dist/types/api-projects.d.ts +480 -0
  32. package/dist/types/api-runs.d.ts +8 -0
  33. package/dist/types/api-scopes.d.ts +32 -3
  34. package/dist/types/conversation-stream.d.ts +5 -0
  35. package/dist/types/execution-context.d.ts +1 -1
  36. package/dist/types/protocol.d.ts +65 -2
  37. package/dist/types/runtime.d.ts +9 -2
  38. package/dist/types/workflow-metadata.d.ts +2 -4
  39. package/dist/types/workflow-plan.d.ts +1 -3
  40. package/dist/utils/bundler.d.ts +23 -0
  41. package/dist/workflow-steps/observability.d.ts +2 -3
  42. package/dist/workflow-steps/runner.d.ts +5 -8
  43. package/dist/workflow-steps/types.d.ts +8 -10
  44. package/dist/workflow-steps/workflow.d.ts +2 -1
  45. package/dist/workflows/engine.d.ts +3 -5
  46. package/dist/workflows/invoke-child.d.ts +2 -2
  47. package/package.json +2 -2
  48. package/src/agent/agent-context.ts +168 -125
  49. package/src/agent/agent-loop.ts +5 -4
  50. package/src/agent/perf-sampler.ts +54 -3
  51. package/src/agent/run-agent.ts +1 -1
  52. package/src/client.ts +191 -71
  53. package/src/directives.ts +3 -3
  54. package/src/display.ts +12 -0
  55. package/src/errors.ts +1 -0
  56. package/src/generated/agentc-commands.ts +571 -0
  57. package/src/index.ts +54 -21
  58. package/src/pause/pause-core.ts +2 -1
  59. package/src/request-context/request-context.ts +1 -1
  60. package/src/runtimes/_cli-agent.ts +306 -122
  61. package/src/runtimes/claude-code.ts +179 -9
  62. package/src/runtimes/claude.ts +1 -1
  63. package/src/runtimes/codex.ts +188 -19
  64. package/src/runtimes/opencode.ts +195 -26
  65. package/src/sandbox/baked-clis.ts +86 -0
  66. package/src/sandbox/exec-stream.ts +1 -2
  67. package/src/sandbox/network-policy.ts +51 -7
  68. package/src/sandbox/providers/e2b.ts +3 -3
  69. package/src/sandbox/providers/vercel.ts +6 -6
  70. package/src/sandbox.ts +8 -2
  71. package/src/step-invocation/invoker.ts +2 -6
  72. package/src/step-invocation/protocol.ts +3 -4
  73. package/src/step-invocation/server.ts +2 -2
  74. package/src/types/api-conversations.ts +366 -23
  75. package/src/types/api-factory.ts +74 -8
  76. package/src/types/api-projects.ts +443 -0
  77. package/src/types/api-runs.ts +5 -0
  78. package/src/types/api-scopes.ts +32 -3
  79. package/src/types/conversation-stream.ts +5 -0
  80. package/src/types/execution-context.ts +1 -1
  81. package/src/types/protocol.ts +67 -1
  82. package/src/types/runtime.ts +8 -2
  83. package/src/types/sandbox-environment.ts +1 -2
  84. package/src/types/workflow-metadata.ts +2 -4
  85. package/src/types/workflow-plan.ts +1 -3
  86. package/src/utils/bundler.ts +88 -19
  87. package/src/workflow-steps/observability.ts +2 -3
  88. package/src/workflow-steps/runner.ts +5 -8
  89. package/src/workflow-steps/types.ts +8 -10
  90. package/src/workflow-steps/workflow.ts +2 -1
  91. package/src/workflows/engine.ts +3 -5
  92. package/src/workflows/invoke-child.ts +2 -2
  93. package/dist/generated/verb-synopsis.d.ts +0 -34
  94. package/dist/pause/__tests__/errors.test.d.ts +0 -1
  95. package/dist/pause/__tests__/wrappers.test.d.ts +0 -1
  96. package/dist/step-invocation/__tests__/protocol.test.d.ts +0 -1
  97. package/src/generated/verb-synopsis.ts +0 -544
@@ -32,9 +32,10 @@ export type DocumentCapability = "read" | "write";
32
32
  * regardless of call context — read-only, never act. */
33
33
  export type TemplateCapability = "read" | "write" | "invoke" | "see_runs";
34
34
  /** One grant on an artifact scope. `team`/`user` are the editable tiers
35
- * carried on a PUT (full-replace); `session`/`project` are DERIVED,
36
- * read-only arms that appear only on READ payloads (the routes that manage
37
- * them own their mutation — a scope PUT rejects them, 400 `invalid_principal`).
35
+ * carried on a PUT (full-replace); `session`/`project`/`conversation`/
36
+ * `worker` are DERIVED, read-only arms that appear only on READ payloads
37
+ * (the routes that manage them own their mutation — a scope PUT rejects
38
+ * them, 400 `invalid_principal`).
38
39
  *
39
40
  * Session and project grants carry FIXED capabilities `['read','write']`:
40
41
  * the fs-gateway is concealment-only (no read/write dimension at the mount),
@@ -62,6 +63,30 @@ export type ScopeGrant = {
62
63
  * being a project member (share implies unshare). Null only for
63
64
  * transitional/legacy rows. */
64
65
  projectObjectId: string | null;
66
+ /** The people in the project: the row's reach. */
67
+ memberCount: number;
68
+ capabilities: string[];
69
+ }
70
+ /** A chat's grant (scope-at-birth, documents): reach derives LIVE from the
71
+ * chat's tier and member rows. `memberCount` is null for a public channel,
72
+ * whose audience is the whole team rather than its member rows. */
73
+ | {
74
+ principal: "conversation";
75
+ conversationId: string;
76
+ conversationTitle: string | null;
77
+ memberCount: number | null;
78
+ capabilities: string[];
79
+ }
80
+ /** The grant a chat's WORKER session holds on what it wrote: not a group
81
+ * of people. The readers of the chat it works for (`chatId`) reach the
82
+ * file through it while the worker's project boundary holds. `title` is
83
+ * the work's (the session's) title. */
84
+ | {
85
+ principal: "worker";
86
+ conversationId: string;
87
+ title: string | null;
88
+ chatId: string;
89
+ chatTitle: string | null;
65
90
  capabilities: string[];
66
91
  };
67
92
  /** An artifact's share scope (documents and templates — one model).
@@ -74,6 +99,10 @@ export interface ArtifactScope {
74
99
  /** Templates only — the owning conversation binding (a grant source:
75
100
  * members of that conversation reach the template via their role). */
76
101
  conversationId?: string | null;
102
+ /** Documents only — born of a shared chat's work (Ivy's publish, a
103
+ * worker's output for a chat). Such a document is shared by the people
104
+ * who can edit it, whoever its owner is; so is one with no owner. */
105
+ bornOfChatWork?: boolean;
77
106
  grants: ScopeGrant[];
78
107
  }
79
108
  /** The call context stamped on a run at dispatch (ADR-0045 §3) — the
@@ -119,6 +119,11 @@ export interface ConversationTurnStateEvent {
119
119
  pendingCount: number;
120
120
  at: number;
121
121
  partial: true;
122
+ /** The running turn is WRITING words that will be sent — the typing
123
+ * indicator's one signal (a running turn that thinks, calls tools,
124
+ * reacts or notes is not writing). Absent when the emitter cannot know;
125
+ * consumers inherit their previous frame's value, and `idle` resets it. */
126
+ writing?: boolean;
122
127
  /** When the open turn started (ms) — carried by the connect-time
123
128
  * snapshot frame only; absent on live transition frames. */
124
129
  startedAt?: number | null;
@@ -1,4 +1,4 @@
1
- /** Shared execution context capabilities for workflow functions and steps. */
1
+ /** Shared execution context capabilities for workflow steps. */
2
2
  import type { InvokeAndWaitOptions, RunStatus } from "./api-runs.js";
3
3
  import type { RequestContext } from "../request-context/request-context.js";
4
4
  import type { PauseRequest } from "../pause/pause-core.js";
@@ -71,6 +71,21 @@ export interface AgentMessageError extends AgentMessageBase {
71
71
  type: "error";
72
72
  text: string;
73
73
  }
74
+ /** One model's share of a harness's turn-end report (claude-code
75
+ * `result.modelUsage[<model>]`): the same four token classes as the turn
76
+ * totals, plus what the harness reports beside them. `costUsd` is the
77
+ * harness's OWN estimate at its price table — never a bill. Fields the
78
+ * harness did not report are absent, never zeroed. */
79
+ export interface AgentMessageModelUsage {
80
+ inputTokens: number;
81
+ outputTokens: number;
82
+ cacheReadTokens: number;
83
+ cacheCreationTokens: number;
84
+ /** Thinking tokens, already counted inside `outputTokens`. */
85
+ thinkingTokens?: number;
86
+ webSearchRequests?: number;
87
+ costUsd?: number;
88
+ }
74
89
  export interface AgentMessageUsage extends AgentMessageBase {
75
90
  type: "usage";
76
91
  inputTokens: number;
@@ -79,6 +94,53 @@ export interface AgentMessageUsage extends AgentMessageBase {
79
94
  cacheCreationTokens: number;
80
95
  durationMs: number;
81
96
  numTurns: number;
97
+ /** Reasoning tokens, already counted inside `outputTokens` (codex
98
+ * `turn.completed.usage.reasoning_output_tokens`). Absent when the
99
+ * harness reports no such class. */
100
+ reasoningOutputTokens?: number;
101
+ /** Per-model totals the harness reported beside the turn totals
102
+ * (claude-code `result.modelUsage`): every model the query pipeline
103
+ * called — main loop, subagents, compaction. As the CLI reports them:
104
+ * CUMULATIVE for the guest session (a streaming-input or resumed
105
+ * session carries its earlier turns), so a per-turn share is the
106
+ * difference from the previous report of the same session. Absent when
107
+ * the harness reports none. */
108
+ byModel?: Record<string, AgentMessageModelUsage>;
109
+ /** The harness's own cost estimate for the same scope as `byModel`
110
+ * (claude-code `result.total_cost_usd`): list-price arithmetic, an
111
+ * estimate and never a billing statement. */
112
+ costUsd?: number;
113
+ }
114
+ /** The harness's reading of the account's PLAN LIMITS (claude-code
115
+ * `rate_limit_event`, emitted whenever its rate-limit information changes
116
+ * — subscription-funded sessions only; the headers it reads exist for
117
+ * claude.ai plans). `status` is the verdict for the request just made:
118
+ * `rejected` means the plan's wall, with `resetsAt` the authoritative
119
+ * reset. `window` names which window the verdict speaks for (the CLI's
120
+ * `rateLimitType`: five_hour, seven_day, seven_day_opus, …). `utilization`
121
+ * is carried only once a window crosses a warning threshold (the CLI omits
122
+ * it while plainly allowed), as the CLI reports it — a 0..1 fraction of
123
+ * the window. Everything the event did not carry is absent; nothing is
124
+ * invented. Additive kind: existing producers never emit it. */
125
+ export interface AgentMessagePlanLimits extends AgentMessageBase {
126
+ type: "plan_limits";
127
+ status: "allowed" | "allowed_warning" | "rejected";
128
+ window?: string;
129
+ /** ISO time the named window resets. */
130
+ resetsAt?: string;
131
+ utilization?: number;
132
+ /** The warning threshold the window crossed (as the CLI reports it). */
133
+ surpassedThreshold?: number;
134
+ /** The plan's extra-usage (overage) lane, when the event spoke of it. */
135
+ overage?: {
136
+ status?: "allowed" | "allowed_warning" | "rejected";
137
+ resetsAt?: string;
138
+ disabledReason?: string;
139
+ inUse?: boolean;
140
+ };
141
+ /** Which spend limit blocked the request when not the member's own cap. */
142
+ limitScope?: string;
143
+ errorCode?: string;
82
144
  }
83
145
  /** LIVE-ONLY incremental usage off the harness's raw provider stream — the
84
146
  * `text_delta` of token counts. claude-code's `--include-partial-messages`
@@ -109,7 +171,8 @@ export interface AgentMessagePlan extends AgentMessageBase {
109
171
  type: "plan";
110
172
  entries: {
111
173
  content: string;
112
- priority: "high" | "medium" | "low";
174
+ /** ACP names one; codex's `--json` plan names none. */
175
+ priority?: "high" | "medium" | "low";
113
176
  status: "pending" | "in_progress" | "completed";
114
177
  }[];
115
178
  }
@@ -273,7 +336,7 @@ export interface AgentMessageSubagentUserMessage extends AgentMessageBase {
273
336
  text: string;
274
337
  parentToolUseId: string;
275
338
  }
276
- export type AgentMessage = AgentMessageInit | AgentMessageText | AgentMessageTextDelta | AgentMessageThinking | AgentMessageToolUse | AgentMessageToolResult | AgentMessageDone | AgentMessageError | AgentMessageUsage | AgentMessageUsageDelta | AgentMessagePlan | AgentMessageTaskNotification | AgentMessageTaskProgress | AgentMessageHarnessNotice | AgentMessageCompaction | AgentMessageSubagentUserMessage;
339
+ export type AgentMessage = AgentMessageInit | AgentMessageText | AgentMessageTextDelta | AgentMessageThinking | AgentMessageToolUse | AgentMessageToolResult | AgentMessageDone | AgentMessageError | AgentMessageUsage | AgentMessageUsageDelta | AgentMessagePlanLimits | AgentMessagePlan | AgentMessageTaskNotification | AgentMessageTaskProgress | AgentMessageHarnessNotice | AgentMessageCompaction | AgentMessageSubagentUserMessage;
277
340
  /** Status block the agent emits to signal iteration completion or blockers. */
278
341
  export interface AgentStatus {
279
342
  summary: string;
@@ -266,7 +266,14 @@ export interface ModelExecutionContract {
266
266
  * phase, a spec/transport without stream input, ACP path).
267
267
  * Calls are serialized per turn; never throws.
268
268
  */
269
- injectUserMessage?(text: string): Promise<"delivered" | "pending" | "closed" | "unsupported">;
269
+ injectUserMessage?(text: string,
270
+ /** Who the message speaks for when it is not the session user
271
+ * (MidTurnEnvelopeOptions): a relayed person, named, or the thread
272
+ * agent that owns this worker. */
273
+ opts?: {
274
+ relayedFrom?: string | null;
275
+ fromOwnerAgent?: boolean;
276
+ }): Promise<"delivered" | "pending" | "closed" | "unsupported">;
270
277
  /**
271
278
  * Request an in-band STEP INTERRUPT of the currently running turn — the
272
279
  * ESC equivalent. Where `injectUserMessage` queues content for the turn
@@ -328,7 +335,7 @@ export interface ModelExecutionContract {
328
335
  * The sandbox provider (e.g. "vercel", "e2b") is an infrastructure concern
329
336
  * configured via SANDBOX_PROVIDER — not part of the runtime definition.
330
337
  * For non-sandbox agents (API calls, etc.) make the call directly in the workflow;
331
- * spawnAgent is a sandbox concept.
338
+ * `agent()` is a sandbox concept.
332
339
  */
333
340
  export interface AgentRuntime<S extends SandboxProvider = SandboxProvider> {
334
341
  create(sandbox: S, opts: RuntimeOptions): ModelExecutionContract;
@@ -224,10 +224,8 @@ export interface WorkflowMetadata {
224
224
  * BUILD — a setup-only workflow whose job is to leave its VM configured and
225
225
  * snapshot it (base-env / agent-env). Environment builds build a platform
226
226
  * IMAGE and never use the shared factory drive, so the server SKIPS mounting
227
- * /factory for them: a live Archil mount baked into the captured snapshot
228
- * fails the NEXT boot's re-mount ("an older Archil process is still running
229
- * for this mountpoint"), degrading /factory for every workflow booting from
230
- * that snapshot. Absent on ordinary workflows — which mount /factory exactly
227
+ * /factory for them and no live drive mount bakes into the captured
228
+ * snapshot. Absent on ordinary workflows — which mount /factory exactly
231
229
  * as before. Optional + additive: an ABSENT flag contributes nothing to the
232
230
  * canonical metadata hash (frozen-metadata rule), so existing workflows are
233
231
  * not forced to re-register. */
@@ -5,9 +5,7 @@
5
5
  * dispatch time. The CLI/bundler inspects the bundled module in the user's
6
6
  * environment and sends this compact plan as metadata.
7
7
  *
8
- * Every workflow has a step plan. Legacy `defineWorkflow({ run })`
9
- * workflows are wrapped at the SDK boundary as a single-step compiled
10
- * workflow (step name = "run"); the bundler sees the same shape regardless.
8
+ * Every workflow has a step plan.
11
9
  */
12
10
  /** One artifact a step promises to produce — mirrors `StepDeliverable`,
13
11
  * restated here so the plan stays a self-contained wire shape. */
@@ -147,6 +147,29 @@ export declare const SDK_SPECIFIER_ALIASES: readonly string[];
147
147
  * null. The single authority: the plugin's regex filter is only a fast
148
148
  * pre-filter, and this decides. */
149
149
  export declare function resolveSdkAlias(specifier: string): string | null;
150
+ /**
151
+ * The packages the PLATFORM provides to every workflow source — the SDK and
152
+ * its zod peer — which therefore resolve from the platform's own install
153
+ * roots when the source file's directory has no node_modules of its own.
154
+ * The live incident (2026-09-20, a claude-code session at the drive root):
155
+ * `agentc invoke --source /factory/files/wf.ts` died with `Could not
156
+ * resolve "@agent-compose/sdk", "zod"` because Bun walked up from
157
+ * /factory/files and found nothing, while the baked SDK sat in
158
+ * /workspace/node_modules the whole time (infra/e2b-template/template.ts —
159
+ * "SDK into /workspace/node_modules so any script written under /workspace
160
+ * can import it"). A workflow's OWN third-party deps still have to be
161
+ * installed beside the source; only these two are platform-resolved.
162
+ */
163
+ export declare const PLATFORM_RESOLVED_PACKAGES: readonly string[];
164
+ /** Env override for the fallback roots (colon-separated, tried first) — the
165
+ * test seam, and an ops knob for a sandbox image that plants the SDK
166
+ * elsewhere. */
167
+ export declare const SDK_FALLBACK_ROOTS_ENV = "AGENT_COMPOSE_SDK_FALLBACK_ROOTS";
168
+ /** Where the platform SDK lives when the source's own walk-up finds nothing:
169
+ * the env override's roots, the sandbox's baked /workspace install, then
170
+ * the bundling process's cwd (the CLI's own resolution context). Exported
171
+ * for the unit test. */
172
+ export declare function sdkFallbackRoots(env?: Record<string, string | undefined>): string[];
150
173
  /**
151
174
  * The SELF-CORRECTING layer. Turns a Bun bundle failure into a message that
152
175
  * names the real fix instead of leaking Bun's internals.
@@ -68,9 +68,8 @@ export interface StepObservability {
68
68
  * this instance. After the step finishes, the engine calls `snapshot()`
69
69
  * to extract the bundle for transport.
70
70
  *
71
- * Metadata writes merge (later keys win) — matches the legacy
72
- * `mergeRunMetadata` semantics so authors don't see a behaviour change
73
- * across migrations.
71
+ * Metadata writes merge (later keys win), as the server's run-metadata
72
+ * merge does.
74
73
  */
75
74
  export declare class StepObservabilityCollector {
76
75
  private metadata;
@@ -6,7 +6,6 @@
6
6
  * 2. For each step:
7
7
  * a. Optionally check `getCachedOutput(stepIndex, step.name)` — if a
8
8
  * previous run completed this step, skip and reuse its output.
9
- * (Phase 1b uses this for crash recovery.)
10
9
  * b. Validate current input against `step.input`.
11
10
  * c. Call `step.run({ input, ... })`.
12
11
  * d. Validate return value against `step.output`.
@@ -17,9 +16,10 @@
17
16
  * Errors during any step bubble through `onStepFailed` and re-throw so the
18
17
  * caller can decide whether to mark the run failed.
19
18
  *
20
- * The cache + completion hooks are injection points — a sandbox engine
21
- * adapter (Phase 1c) wires them to `workflow_step_runs` rows. The default
22
- * is an in-process map for tests.
19
+ * The cache + completion hooks are injection points; without a cache every
20
+ * step runs. The platform's sandbox path does not walk the chain here: the
21
+ * Temporal `executeStep` activity runs one step per runner subprocess via
22
+ * `runWorkflowSingleStep` below.
23
23
  */
24
24
  import { z } from "zod";
25
25
  import type { Workflow, StepRunResult } from "./types.js";
@@ -54,13 +54,10 @@ export interface RunWorkflowStepsOpts<TInput, TOutput> {
54
54
  /**
55
55
  * Crash-recovery hook. Called before a step executes. Return the cached
56
56
  * output to skip execution; return undefined to run the step.
57
- *
58
- * Phase 1b implementations will look up `workflow_step_runs` rows for
59
- * (runId, stepIndex, stepName) and return completed step outputs here.
60
57
  * Default: always undefined (no caching).
61
58
  */
62
59
  getCachedOutput?(stepIndex: number, stepName: string): unknown | undefined | Promise<unknown | undefined>;
63
- /** Fire after a step's `execute` and output validation succeed. */
60
+ /** Fire after a step's `run` and output validation succeed. */
64
61
  onStepCompleted?(stepIndex: number, stepName: string, output: unknown, durationMs: number): void | Promise<void>;
65
62
  /** Fire when a step throws or fails validation. The error is re-thrown after this returns. */
66
63
  onStepFailed?(stepIndex: number, stepName: string, error: Error, durationMs: number): void | Promise<void>;
@@ -6,9 +6,8 @@
6
6
  *
7
7
  * Why: durable suspend/resume requires step boundaries to be addressable as
8
8
  * data, not opaque async-function bodies. Each step's input + output is
9
- * serialisable JSON so engine adapters (in-process, sandbox, future
10
- * Inngest/Temporal) can record completion and replay from the last
11
- * completed step.
9
+ * serialisable JSON so the durable engine (Temporal, one activity per step)
10
+ * can record completion and replay from the last completed step.
12
11
  */
13
12
  import type { z } from "zod";
14
13
  import type { BaseExecutionContext } from "../types/execution-context.js";
@@ -16,7 +15,7 @@ import type { AgentEventSink } from "../types/workflow.js";
16
15
  import type { WorkflowMetadata } from "../types/workflow-metadata.js";
17
16
  import type { StepObservability } from "./observability.js";
18
17
  /**
19
- * Per-step execution context. Threaded into every step's `execute(...)` so
18
+ * Per-step execution context. Threaded into every step's `run(...)` so
20
19
  * the step can read tenant identity and run identity, log progress, and
21
20
  * invoke sandbox commands.
22
21
  *
@@ -31,9 +30,9 @@ export interface StepContext<TInput = unknown> extends BaseExecutionContext {
31
30
  abortSignal: AbortSignal;
32
31
  /**
33
32
  * Merge key-value metadata onto the run record. Buffered during the
34
- * step and flushed when the step completes; the durable engine writes
35
- * it via the same `mergeRunMetadata` path the legacy runner used, so
36
- * the dashboard sees the same shape. Later keys win.
33
+ * step and flushed when the step completes; the durable engine merges
34
+ * it into the run's metadata (`persistStepObservability`). Later keys
35
+ * win.
37
36
  */
38
37
  setMetadata(data: Record<string, unknown>): Promise<void>;
39
38
  /**
@@ -93,9 +92,8 @@ export interface Step<TInput, TOutput> {
93
92
  readonly deliverables?: readonly StepDeliverable[];
94
93
  }
95
94
  /**
96
- * The result of running one step. Engine adapters persist these into the
97
- * `workflow_step_runs` table (Phase 1b) so subsequent runs can skip
98
- * completed steps. `observability` carries the snapshot of
95
+ * The result of running one step, as `runWorkflowSteps` reports it per
96
+ * step. `observability` carries the snapshot of
99
97
  * `ctx.setMetadata` / `ctx.step` / `ctx.agentEvents` recorded during
100
98
  * the step; undefined when no hooks were used.
101
99
  */
@@ -16,7 +16,8 @@
16
16
  * matches the final step's `output` schema.
17
17
  *
18
18
  * Workflows-as-data — the result is consumable by any engine adapter
19
- * (in-process today; sandbox + Inngest/Temporal in future PRs).
19
+ * (in-process `runWorkflow`; the sandbox runner one step at a time under
20
+ * Temporal).
20
21
  */
21
22
  import type { z } from "zod";
22
23
  import type { Step, Workflow } from "./types.js";
@@ -6,7 +6,7 @@
6
6
  * runner.
7
7
  *
8
8
  * Errors classified into `WorkflowError` (user code threw) vs `EngineError`
9
- * (platform problem) for the runner harness to surface upstream.
9
+ * (platform problem).
10
10
  */
11
11
  import type { WorkflowHooks } from "../types/workflow.js";
12
12
  import type { InvokeChild } from "../types/execution-context.js";
@@ -35,7 +35,7 @@ export declare class EngineError extends Error {
35
35
  readonly subsystem: EngineSubsystem;
36
36
  constructor(message: string, subsystem?: EngineSubsystem, options?: ErrorOptions);
37
37
  }
38
- /** Classify any thrown value into the wire-level `kind` expected by `/fail`. */
38
+ /** Classify any thrown value as a `workflow` or an `engine` failure. */
39
39
  export declare function classifyError(err: unknown): "workflow" | "engine";
40
40
  export declare function parseNameVersion(ref: string): {
41
41
  name: string;
@@ -52,9 +52,7 @@ export interface RunWorkflowOptions {
52
52
  onStepStarted?: RunWorkflowStepsOpts<unknown, unknown>["onStepStarted"];
53
53
  onStepCompleted?: RunWorkflowStepsOpts<unknown, unknown>["onStepCompleted"];
54
54
  onStepFailed?: RunWorkflowStepsOpts<unknown, unknown>["onStepFailed"];
55
- /** Provider-specific child workflow invocation. Temporal/Inngest providers
56
- * inject their native child-workflow primitive; the LocalProvider injects
57
- * the public Agent Compose API client. */
55
+ /** Child workflow invocation. Unset, a step's `invokeChild` throws. */
58
56
  invokeChild?: InvokeChild;
59
57
  }
60
58
  export declare function runWorkflow<TInput, TOutput>(wf: Workflow<TInput, TOutput>, ctx: {
@@ -18,8 +18,8 @@ import type { InvokeChild } from "../types/execution-context.js";
18
18
  */
19
19
  export declare function deriveInvokeChildIdempotencyKey(parentRunId: string, childName: string): string | null;
20
20
  /**
21
- * Build the public-API child workflow invoker used by legacy and sandboxed
22
- * workflow execution. Provider-backed engines may inject a different
21
+ * Build the public-API child workflow invoker used by sandboxed workflow
22
+ * execution (the step runner). Provider-backed engines may inject a different
23
23
  * implementation (Temporal child workflow, Inngest invoke, etc.).
24
24
  */
25
25
  export declare function buildInvokeChild(runId: string, opts?: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agent-compose/sdk",
3
- "version": "0.8.5",
3
+ "version": "0.8.6",
4
4
  "description": "Client library for agent-compose — define agents, runtimes, and workflows, and invoke them against an agent-compose server.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -71,7 +71,7 @@
71
71
  "ofetch": "^1.5.1",
72
72
  "openai": "^6.33.0",
73
73
  "p-retry": "^6.2.0",
74
- "sharp": "^0.34.5"
74
+ "sharp": "0.35.4"
75
75
  },
76
76
  "publishConfig": {
77
77
  "access": "public"