@agent-compose/sdk 0.8.5 → 0.8.7

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 (100) 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 +6 -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 +119 -54
  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 +771 -204
  13. package/dist/request-context/request-context.d.ts +1 -1
  14. package/dist/runtimes/_cli-agent.d.ts +185 -68
  15. package/dist/runtimes/_reported-model.d.ts +16 -0
  16. package/dist/runtimes/claude-code.d.ts +60 -1
  17. package/dist/runtimes/claude.d.ts +1 -1
  18. package/dist/runtimes/codex.d.ts +94 -6
  19. package/dist/runtimes/codex.mid-turn-hook.test.d.ts +10 -0
  20. package/dist/runtimes/model-report.test.d.ts +14 -0
  21. package/dist/runtimes/openai-desktop.js +741 -200
  22. package/dist/runtimes/opencode.d.ts +48 -11
  23. package/dist/runtimes/opencode.test.d.ts +14 -0
  24. package/dist/sandbox/baked-clis.d.ts +75 -0
  25. package/dist/sandbox/exec-stream.d.ts +1 -2
  26. package/dist/sandbox/network-policy.d.ts +23 -5
  27. package/dist/sandbox.d.ts +4 -2
  28. package/dist/step-invocation/protocol.d.ts +3 -4
  29. package/dist/step-invocation/server.d.ts +2 -2
  30. package/dist/step-invocation/types.d.ts +1 -1
  31. package/dist/types/api-conversations.d.ts +442 -29
  32. package/dist/types/api-factory.d.ts +99 -10
  33. package/dist/types/api-projects.d.ts +521 -0
  34. package/dist/types/api-runs.d.ts +83 -0
  35. package/dist/types/api-scopes.d.ts +32 -3
  36. package/dist/types/conversation-stream.d.ts +5 -0
  37. package/dist/types/execution-context.d.ts +1 -1
  38. package/dist/types/protocol.d.ts +86 -2
  39. package/dist/types/runtime.d.ts +9 -2
  40. package/dist/types/workflow-metadata.d.ts +2 -4
  41. package/dist/types/workflow-plan.d.ts +1 -3
  42. package/dist/utils/bundler.d.ts +23 -0
  43. package/dist/workflow-steps/observability.d.ts +2 -3
  44. package/dist/workflow-steps/runner.d.ts +5 -8
  45. package/dist/workflow-steps/types.d.ts +8 -10
  46. package/dist/workflow-steps/workflow.d.ts +2 -1
  47. package/dist/workflows/engine.d.ts +3 -5
  48. package/dist/workflows/invoke-child.d.ts +2 -2
  49. package/package.json +2 -2
  50. package/src/agent/agent-context.ts +168 -125
  51. package/src/agent/agent-loop.ts +7 -6
  52. package/src/agent/perf-sampler.ts +54 -3
  53. package/src/agent/run-agent.ts +1 -1
  54. package/src/client.ts +226 -71
  55. package/src/directives.ts +3 -3
  56. package/src/display.ts +12 -0
  57. package/src/errors.ts +1 -0
  58. package/src/generated/agentc-commands.ts +571 -0
  59. package/src/index.ts +57 -21
  60. package/src/pause/pause-core.ts +2 -1
  61. package/src/request-context/request-context.ts +1 -1
  62. package/src/runtimes/_cli-agent.ts +318 -122
  63. package/src/runtimes/_reported-model.ts +24 -0
  64. package/src/runtimes/claude-code.ts +195 -12
  65. package/src/runtimes/claude.ts +9 -2
  66. package/src/runtimes/codex.ts +188 -19
  67. package/src/runtimes/opencode.ts +195 -26
  68. package/src/sandbox/baked-clis.ts +86 -0
  69. package/src/sandbox/exec-stream.ts +1 -2
  70. package/src/sandbox/network-policy.ts +51 -7
  71. package/src/sandbox/providers/e2b.ts +3 -3
  72. package/src/sandbox/providers/vercel.ts +6 -6
  73. package/src/sandbox.ts +8 -2
  74. package/src/step-invocation/invoker.ts +2 -6
  75. package/src/step-invocation/protocol.ts +3 -4
  76. package/src/step-invocation/server.ts +2 -2
  77. package/src/types/api-conversations.ts +366 -23
  78. package/src/types/api-factory.ts +95 -10
  79. package/src/types/api-projects.ts +477 -0
  80. package/src/types/api-runs.ts +73 -0
  81. package/src/types/api-scopes.ts +32 -3
  82. package/src/types/conversation-stream.ts +5 -0
  83. package/src/types/execution-context.ts +1 -1
  84. package/src/types/protocol.ts +91 -2
  85. package/src/types/runtime.ts +8 -2
  86. package/src/types/sandbox-environment.ts +1 -2
  87. package/src/types/workflow-metadata.ts +2 -4
  88. package/src/types/workflow-plan.ts +1 -3
  89. package/src/utils/bundler.ts +88 -19
  90. package/src/workflow-steps/observability.ts +2 -3
  91. package/src/workflow-steps/runner.ts +5 -8
  92. package/src/workflow-steps/types.ts +8 -10
  93. package/src/workflow-steps/workflow.ts +2 -1
  94. package/src/workflows/engine.ts +3 -5
  95. package/src/workflows/invoke-child.ts +2 -2
  96. package/dist/generated/verb-synopsis.d.ts +0 -34
  97. package/dist/pause/__tests__/errors.test.d.ts +0 -1
  98. package/dist/pause/__tests__/wrappers.test.d.ts +0 -1
  99. package/dist/step-invocation/__tests__/protocol.test.d.ts +0 -1
  100. package/src/generated/verb-synopsis.ts +0 -544
@@ -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,28 @@ 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
+ /** The harness's OWN report of the model it is running — never the
340
+ * platform's configuration (owner 2026-10-06: "It's very difficult to
341
+ * tell which model did this work"). claude-code names it twice: once on
342
+ * `system`/`init` (`model`, the session's resolved model) and on every
343
+ * top-level `assistant` event (`message.model`, the id the API answered
344
+ * with — the truth after a `/model` switch or a fallback; `<synthetic>`
345
+ * is the harness's own voice and names none; a subagent's events name the
346
+ * subagent's model, not the worker's, and are left out). The normaliser
347
+ * emits one report per naming, so a consumer that stamps the turn's
348
+ * models dedupes in order of first appearance and keeps every distinct
349
+ * id (a mid-turn switch records both). codex's `exec --json` events and
350
+ * opencode's `run --format json` lines carry no model at all (verified
351
+ * against both sources, 2026-10-06): those harnesses emit none, and the
352
+ * record stays honestly empty. Additive kind: existing producers never
353
+ * emit it. */
354
+ export interface AgentMessageModelReport extends AgentMessageBase {
355
+ type: "model_report";
356
+ /** The model id as the harness reports it, minus claude-code's
357
+ * `[1m]`-style context-window marker (runtimes/_reported-model.ts). */
358
+ model: string;
359
+ }
360
+ export type AgentMessage = AgentMessageInit | AgentMessageText | AgentMessageTextDelta | AgentMessageThinking | AgentMessageToolUse | AgentMessageToolResult | AgentMessageDone | AgentMessageError | AgentMessageUsage | AgentMessageUsageDelta | AgentMessagePlanLimits | AgentMessagePlan | AgentMessageTaskNotification | AgentMessageTaskProgress | AgentMessageHarnessNotice | AgentMessageCompaction | AgentMessageSubagentUserMessage | AgentMessageModelReport;
277
361
  /** Status block the agent emits to signal iteration completion or blockers. */
278
362
  export interface AgentStatus {
279
363
  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.7",
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"