@agent-compose/sdk 0.6.0 → 0.8.0
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.
- package/README.md +66 -39
- package/dist/agent/__tests__/runtime-json-schema.test.d.ts +10 -0
- package/dist/agent/agent-context.d.ts +21 -1
- package/dist/agent/agent-loop.d.ts +24 -1
- package/dist/client.d.ts +338 -534
- package/dist/directives.d.ts +112 -0
- package/dist/display.d.ts +242 -0
- package/dist/errors.d.ts +24 -1
- package/dist/index.d.ts +34 -13
- package/dist/index.js +2984 -861
- package/dist/pause/wrappers.d.ts +31 -9
- package/dist/processors/ask-human.d.ts +30 -0
- package/dist/processors/ask-human.test.d.ts +1 -0
- package/dist/processors/index.d.ts +1 -0
- package/dist/runtimes/_acp-client.d.ts +46 -1
- package/dist/runtimes/_cli-agent.d.ts +58 -4
- package/dist/runtimes/_jsonl-guard.d.ts +103 -0
- package/dist/runtimes/amp.d.ts +2 -2
- package/dist/runtimes/claude-code.d.ts +59 -0
- package/dist/runtimes/claude-code.test.d.ts +14 -0
- package/dist/runtimes/claude.d.ts +16 -0
- package/dist/runtimes/claude.test.d.ts +8 -0
- package/dist/runtimes/codex.d.ts +9 -3
- package/dist/runtimes/cursor.d.ts +9 -0
- package/dist/runtimes/droid.d.ts +9 -0
- package/dist/runtimes/jsonl-guard.test.d.ts +19 -0
- package/dist/runtimes/openai-desktop.js +2922 -861
- package/dist/runtimes/opencode.d.ts +25 -0
- package/dist/runtimes/vercel.js +22 -1
- package/dist/sandbox/devbox.d.ts +42 -0
- package/dist/sandbox/exec-stream.d.ts +14 -0
- package/dist/sandbox/network-policy.d.ts +100 -0
- package/dist/sandbox/provider-def.d.ts +79 -0
- package/dist/sandbox/providers/desktop.d.ts +10 -0
- package/dist/sandbox/providers/e2b.d.ts +17 -0
- package/dist/sandbox/providers/local.d.ts +11 -0
- package/dist/sandbox/providers/vercel.d.ts +18 -0
- package/dist/sandbox/registry.d.ts +45 -0
- package/dist/sandbox/sizes.d.ts +68 -0
- package/dist/sandbox.d.ts +24 -299
- package/dist/step-invocation/__tests__/foreground-recovery.test.d.ts +1 -0
- package/dist/step-invocation/invoker.d.ts +24 -1
- package/dist/step-invocation/protocol.d.ts +13 -0
- package/dist/types/api-compliance.d.ts +71 -0
- package/dist/types/api-conversations.d.ts +492 -0
- package/dist/types/api-factory.d.ts +309 -0
- package/dist/types/api-projects.d.ts +131 -0
- package/dist/types/api-runs.d.ts +377 -0
- package/dist/types/api-scopes.d.ts +102 -0
- package/dist/types/conversation-stream.d.ts +191 -0
- package/dist/types/execution-context.d.ts +12 -2
- package/dist/types/protocol.d.ts +30 -1
- package/dist/types/sandbox-environment.d.ts +8 -5
- package/dist/types/sandbox.d.ts +79 -0
- package/dist/types/workflow-metadata.d.ts +33 -8
- package/dist/types/workflow-plan.d.ts +10 -0
- package/dist/types/workflow.d.ts +18 -193
- package/dist/utils/bundler.d.ts +12 -1
- package/dist/utils/errors.d.ts +9 -1
- package/dist/workflow-steps/index.d.ts +1 -1
- package/dist/workflow-steps/observability.d.ts +8 -1
- package/dist/workflow-steps/runner.d.ts +3 -3
- package/dist/workflow-steps/step.d.ts +15 -1
- package/dist/workflow-steps/types.d.ts +19 -5
- package/dist/workflow-steps/workflow.d.ts +22 -1
- package/dist/workflows/engine.d.ts +3 -2
- package/dist/workflows/invoke-child.d.ts +2 -2
- package/package.json +1 -1
- package/src/agent/agent-context.ts +206 -16
- package/src/agent/agent-loop.ts +40 -4
- package/src/agent/run-agent.ts +9 -1
- package/src/client.ts +909 -621
- package/src/directives.ts +184 -0
- package/src/display.ts +788 -0
- package/src/errors.ts +39 -0
- package/src/index.ts +117 -10
- package/src/pause/wrappers.ts +44 -9
- package/src/processors/ask-human.ts +136 -0
- package/src/processors/index.ts +5 -0
- package/src/runtimes/_acp-client.ts +72 -3
- package/src/runtimes/_cli-agent.ts +171 -38
- package/src/runtimes/_jsonl-guard.ts +219 -0
- package/src/runtimes/claude-code.ts +246 -0
- package/src/runtimes/claude.ts +32 -2
- package/src/runtimes/codex.ts +55 -3
- package/src/runtimes/cursor.ts +59 -0
- package/src/runtimes/droid.ts +63 -0
- package/src/runtimes/openai-desktop.ts +59 -14
- package/src/runtimes/opencode.ts +61 -0
- package/src/sandbox/devbox.ts +48 -0
- package/src/sandbox/exec-stream.ts +48 -0
- package/src/sandbox/network-policy.ts +181 -0
- package/src/sandbox/provider-def.ts +94 -0
- package/src/sandbox/providers/desktop.ts +57 -0
- package/src/sandbox/providers/e2b.ts +354 -0
- package/src/sandbox/providers/local.ts +106 -0
- package/src/sandbox/providers/vercel.ts +331 -0
- package/src/sandbox/registry.ts +198 -0
- package/src/sandbox/sizes.ts +95 -0
- package/src/sandbox.ts +59 -1263
- package/src/step-invocation/invoker.ts +319 -34
- package/src/step-invocation/protocol.ts +19 -0
- package/src/types/api-compliance.ts +79 -0
- package/src/types/api-conversations.ts +522 -0
- package/src/types/api-factory.ts +336 -0
- package/src/types/api-projects.ts +140 -0
- package/src/types/api-runs.ts +412 -0
- package/src/types/api-scopes.ts +102 -0
- package/src/types/conversation-stream.ts +231 -0
- package/src/types/execution-context.ts +10 -2
- package/src/types/protocol.ts +33 -0
- package/src/types/sandbox-environment.ts +28 -9
- package/src/types/sandbox.ts +78 -0
- package/src/types/workflow-metadata.ts +35 -8
- package/src/types/workflow-plan.ts +11 -0
- package/src/types/workflow.ts +25 -280
- package/src/utils/bundler.ts +32 -5
- package/src/utils/errors.ts +34 -2
- package/src/workflow-steps/index.ts +1 -0
- package/src/workflow-steps/observability.ts +19 -8
- package/src/workflow-steps/runner.ts +4 -4
- package/src/workflow-steps/step.ts +49 -1
- package/src/workflow-steps/types.ts +20 -5
- package/src/workflow-steps/workflow.ts +22 -1
- package/src/workflows/engine.ts +3 -2
- package/src/workflows/invoke-child.ts +2 -2
|
@@ -15,6 +15,7 @@ import type { z } from "zod";
|
|
|
15
15
|
import type { BaseExecutionContext } from "../types/execution-context.js";
|
|
16
16
|
import type { AgentEventSink } from "../types/workflow.js";
|
|
17
17
|
import type { WorkflowMetadata } from "../types/workflow-metadata.js";
|
|
18
|
+
import type { StepObservability } from "./observability.js";
|
|
18
19
|
|
|
19
20
|
/**
|
|
20
21
|
* Per-step execution context. Threaded into every step's `execute(...)` so
|
|
@@ -62,6 +63,15 @@ export interface StepContext<TInput = unknown> extends BaseExecutionContext {
|
|
|
62
63
|
agentEvents: AgentEventSink;
|
|
63
64
|
}
|
|
64
65
|
|
|
66
|
+
/** One artifact a step promises to produce. `path` is workspace/drive-relative
|
|
67
|
+
* (e.g. "out/report.html"); the dashboard derives the format tag from the
|
|
68
|
+
* extension client-side — no `format` field here. */
|
|
69
|
+
export interface StepDeliverable {
|
|
70
|
+
path: string;
|
|
71
|
+
/** Optional one-line description of the artifact. */
|
|
72
|
+
description?: string;
|
|
73
|
+
}
|
|
74
|
+
|
|
65
75
|
/**
|
|
66
76
|
* Step definition — a single typed unit of work in a workflow chain.
|
|
67
77
|
*
|
|
@@ -80,6 +90,11 @@ export interface Step<TInput, TOutput> {
|
|
|
80
90
|
readonly output: z.ZodType<TOutput>;
|
|
81
91
|
/** Step body. Receives a `StepContext<TInput>` and returns the typed output. */
|
|
82
92
|
run(ctx: StepContext<TInput>): TOutput | Promise<TOutput>;
|
|
93
|
+
/** One plain sentence of what the step actually does — rendered on the
|
|
94
|
+
* dashboard workflow graph. ≤200 chars, no newlines. */
|
|
95
|
+
readonly summary?: string;
|
|
96
|
+
/** Files the step promises to produce. ≤8 entries. */
|
|
97
|
+
readonly deliverables?: readonly StepDeliverable[];
|
|
83
98
|
}
|
|
84
99
|
|
|
85
100
|
/**
|
|
@@ -90,14 +105,14 @@ export interface Step<TInput, TOutput> {
|
|
|
90
105
|
* the step; undefined when no hooks were used.
|
|
91
106
|
*/
|
|
92
107
|
export type StepRunResult<TOutput = unknown> =
|
|
93
|
-
| { status: "completed"; output: TOutput; durationMs: number; observability?:
|
|
94
|
-
| { status: "failed"; error: string; durationMs: number; observability?:
|
|
108
|
+
| { status: "completed"; output: TOutput; durationMs: number; observability?: StepObservability }
|
|
109
|
+
| { status: "failed"; error: string; durationMs: number; observability?: StepObservability };
|
|
95
110
|
|
|
96
111
|
/**
|
|
97
112
|
* Workflow — a list of typed steps plus the workflow's input/output
|
|
98
|
-
* schemas plus its server-side metadata bag. Returned by
|
|
99
|
-
*
|
|
100
|
-
*
|
|
113
|
+
* schemas plus its server-side metadata bag. Returned by
|
|
114
|
+
* `defineWorkflow(...).step(...)...build()`. Engine adapters consume
|
|
115
|
+
* this shape.
|
|
101
116
|
*
|
|
102
117
|
* `input` validates the workflow input before the first step runs.
|
|
103
118
|
* `output` validates the final step's output before the workflow
|
|
@@ -23,7 +23,7 @@ import type { z } from "zod";
|
|
|
23
23
|
import type { Step, Workflow } from "./types.js";
|
|
24
24
|
import { WORKFLOW_BRAND } from "./types.js";
|
|
25
25
|
import { extractMetadata } from "../types/workflow-metadata.js";
|
|
26
|
-
import type { SnapshotConfig, SandboxResources } from "../types/workflow-metadata.js";
|
|
26
|
+
import type { SnapshotConfig, SandboxResources, ConnectorRequirements, ConnectorOperationTag, InvokePolicy, DriveMergePolicy } from "../types/workflow-metadata.js";
|
|
27
27
|
import type { SandboxNetworkPolicy } from "../sandbox.js";
|
|
28
28
|
import type { Processor } from "../processors/processor.js";
|
|
29
29
|
|
|
@@ -55,7 +55,28 @@ export interface StepWorkflowDefinition<TInput, TOutput> {
|
|
|
55
55
|
* and `provider` (`vercel` | `e2b`). Vercel maps `size` to vCPUs; E2B
|
|
56
56
|
* sizing is template-defined. Omit → smallest SKU on the default provider. */
|
|
57
57
|
resources?: SandboxResources;
|
|
58
|
+
/** What happens to this workflow's drive branch when a run ends:
|
|
59
|
+
* `"auto"` (the default when omitted — today's behaviour) folds it into
|
|
60
|
+
* `main`; `"manual"` proposes a merge approval at the same terminus
|
|
61
|
+
* instead, leaving the branch durable until a human clicks approve. A
|
|
62
|
+
* cancelled run neither merges nor proposes under either policy. */
|
|
63
|
+
mergePolicy?: DriveMergePolicy;
|
|
58
64
|
processors?: readonly Processor[];
|
|
65
|
+
/** Connector requirements (ADR-0007) — providers whose APIs this workflow
|
|
66
|
+
* calls. Dispatch resolves an authorized grant per provider and injects a
|
|
67
|
+
* fresh access token at the network layer. */
|
|
68
|
+
connectors?: ConnectorRequirements;
|
|
69
|
+
/** Marks this workflow as a catalogue OPERATION of a connector — e.g. the
|
|
70
|
+
* `create-issue` operation of the `github` connector. */
|
|
71
|
+
connectorOperation?: ConnectorOperationTag;
|
|
72
|
+
/** Tier-1 invoke ACL — who may dispatch this connector-brokering workflow.
|
|
73
|
+
* See `InvokePolicy`. */
|
|
74
|
+
invokePolicy?: InvokePolicy;
|
|
75
|
+
/** Internal — set by `defineSandboxEnvironment`, not by workflow authors.
|
|
76
|
+
* Marks the workflow as an environment build (base-env / agent-env) so the
|
|
77
|
+
* server skips mounting the shared factory drive for its runs (#13). See
|
|
78
|
+
* `WorkflowMetadata.environmentBuild`. */
|
|
79
|
+
environmentBuild?: boolean;
|
|
59
80
|
}
|
|
60
81
|
|
|
61
82
|
export function createStepWorkflow<TInput, TOutput>(
|
package/src/workflows/engine.ts
CHANGED
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
* (platform problem) for the runner harness to surface upstream.
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { WorkflowHooks
|
|
12
|
+
import type { WorkflowHooks } from "../types/workflow.js";
|
|
13
|
+
import type { InvokeChild } from "../types/execution-context.js";
|
|
13
14
|
import { makeLocalSandboxProvider } from "../sandbox.js";
|
|
14
15
|
import { formatError } from "../utils/errors.js";
|
|
15
16
|
import { RequestContext } from "../request-context/request-context.js";
|
|
@@ -94,7 +95,7 @@ export interface RunWorkflowOptions {
|
|
|
94
95
|
/** Provider-specific child workflow invocation. Temporal/Inngest providers
|
|
95
96
|
* inject their native child-workflow primitive; the LocalProvider injects
|
|
96
97
|
* the public Agent Compose API client. */
|
|
97
|
-
invokeChild?:
|
|
98
|
+
invokeChild?: InvokeChild;
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
export async function runWorkflow<TInput, TOutput>(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AgentComposeClient } from "../client.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { InvokeChild } from "../types/execution-context.js";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Build the public-API child workflow invoker used by legacy and sandboxed
|
|
@@ -9,7 +9,7 @@ import type { WorkflowCtx } from "../types/workflow.js";
|
|
|
9
9
|
export function buildInvokeChild(
|
|
10
10
|
runId: string,
|
|
11
11
|
opts: { fallbackBaseUrl?: string; defaultFactorySlug?: string } = {},
|
|
12
|
-
):
|
|
12
|
+
): InvokeChild {
|
|
13
13
|
let childClient: AgentComposeClient | null = null;
|
|
14
14
|
const getChildClient = (): AgentComposeClient => {
|
|
15
15
|
if (childClient) return childClient;
|