@agent-compose/sdk 0.2.3 → 0.2.4
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 +145 -33
- package/dist/agent/agent-loop.d.ts +83 -5
- package/dist/agent/run-agent.d.ts +34 -9
- package/dist/client.d.ts +247 -99
- package/dist/index.d.ts +26 -11
- package/dist/index.js +1967 -745
- package/dist/processors/builtins.d.ts +35 -0
- package/dist/processors/index.d.ts +4 -0
- package/dist/processors/processor.d.ts +91 -0
- package/dist/processors/processor.test.d.ts +1 -0
- package/dist/processors/runner.d.ts +19 -0
- package/dist/request-context/index.d.ts +2 -0
- package/dist/request-context/request-context.d.ts +159 -0
- package/dist/request-context/request-context.test.d.ts +1 -0
- package/dist/runtimes/claude.d.ts +27 -50
- package/dist/runtimes/openai-desktop.js +1918 -741
- package/dist/runtimes/vercel.d.ts +34 -0
- package/dist/runtimes/vercel.js +474 -0
- package/dist/sandbox.d.ts +29 -25
- package/dist/step-invocation/__tests__/invoker.test.d.ts +1 -0
- package/dist/step-invocation/__tests__/protocol.test.d.ts +1 -0
- package/dist/step-invocation/__tests__/server.test.d.ts +1 -0
- package/dist/step-invocation/index.d.ts +25 -0
- package/dist/step-invocation/invoker.d.ts +65 -0
- package/dist/step-invocation/protocol.d.ts +44 -0
- package/dist/step-invocation/server.d.ts +63 -0
- package/dist/step-invocation/types.d.ts +72 -0
- package/dist/tools/coding.d.ts +49 -0
- package/dist/tools/coding.test.d.ts +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/types/events.d.ts +36 -0
- package/dist/types/execution-context.d.ts +22 -0
- package/dist/types/runtime.d.ts +32 -0
- package/dist/types/sandbox-environment.d.ts +5 -2
- package/dist/types/sandbox.d.ts +14 -12
- package/dist/types/workflow-metadata.d.ts +51 -0
- package/dist/types/workflow-plan.d.ts +19 -0
- package/dist/types/workflow.d.ts +57 -17
- package/dist/utils/bundler.d.ts +62 -3
- package/dist/workflow-steps/__tests__/observability.test.d.ts +1 -0
- package/dist/workflow-steps/index.d.ts +10 -0
- package/dist/workflow-steps/observability.d.ts +58 -0
- package/dist/workflow-steps/runner.d.ts +96 -0
- package/dist/workflow-steps/step.d.ts +25 -0
- package/dist/workflow-steps/types.d.ts +135 -0
- package/dist/workflow-steps/workflow-steps.test.d.ts +1 -0
- package/dist/workflow-steps/workflow.d.ts +50 -0
- package/dist/workflows/engine.d.ts +27 -13
- package/dist/workflows/invoke-child.d.ts +10 -0
- package/package.json +25 -15
- package/src/agent/agent-loop.ts +197 -26
- package/src/agent/run-agent.ts +40 -15
- package/src/client.ts +326 -76
- package/src/index.ts +124 -10
- package/src/processors/builtins.ts +72 -0
- package/src/processors/index.ts +15 -0
- package/src/processors/processor.ts +103 -0
- package/src/processors/runner.ts +42 -0
- package/src/request-context/index.ts +17 -0
- package/src/request-context/request-context.ts +302 -0
- package/src/runtimes/claude.ts +123 -254
- package/src/runtimes/vercel.ts +180 -0
- package/src/sandbox.ts +53 -21
- package/src/step-invocation/index.ts +33 -0
- package/src/step-invocation/invoker.ts +204 -0
- package/src/step-invocation/protocol.ts +57 -0
- package/src/step-invocation/server.ts +184 -0
- package/src/step-invocation/types.ts +70 -0
- package/src/tools/coding.ts +126 -0
- package/src/tools/index.ts +8 -0
- package/src/types/events.ts +40 -0
- package/src/types/execution-context.ts +30 -0
- package/src/types/runtime.ts +24 -0
- package/src/types/sandbox-environment.ts +7 -5
- package/src/types/sandbox.ts +16 -12
- package/src/types/workflow-metadata.ts +84 -0
- package/src/types/workflow-plan.ts +24 -0
- package/src/types/workflow.ts +139 -25
- package/src/utils/bundler.ts +198 -18
- package/src/utils/source-loader.ts +2 -2
- package/src/workflow-steps/index.ts +30 -0
- package/src/workflow-steps/observability.ts +103 -0
- package/src/workflow-steps/runner.ts +244 -0
- package/src/workflow-steps/step.ts +38 -0
- package/src/workflow-steps/types.ts +134 -0
- package/src/workflow-steps/workflow.ts +95 -0
- package/src/workflows/engine.ts +69 -40
- package/src/workflows/invoke-child.ts +29 -0
package/dist/client.d.ts
CHANGED
|
@@ -10,22 +10,224 @@
|
|
|
10
10
|
* `register()` accepts pre-built sources — use the CLI (`agent-compose
|
|
11
11
|
* register`) or build sources yourself and pass them directly.
|
|
12
12
|
*/
|
|
13
|
-
import type { RunEvent } from "./types/events.js";
|
|
14
13
|
import type { SandboxNetworkPolicy } from "./sandbox.js";
|
|
14
|
+
import type { RunEvent } from "./types/events.js";
|
|
15
|
+
import type { WorkflowPlan } from "./types/workflow-plan.js";
|
|
16
|
+
import type { WorkflowManifest } from "./utils/bundler.js";
|
|
15
17
|
export interface RegisterResult {
|
|
16
18
|
id: string;
|
|
17
19
|
name: string;
|
|
18
20
|
version: string;
|
|
19
|
-
runtimes?:
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
runtimes?: RegisteredRuntime[];
|
|
22
|
+
}
|
|
23
|
+
export interface RegisteredRuntime {
|
|
24
|
+
id: string;
|
|
25
|
+
name: string;
|
|
26
|
+
version: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RuntimeSourceInput {
|
|
29
|
+
name: string;
|
|
30
|
+
source: string;
|
|
31
|
+
}
|
|
32
|
+
export interface RegisterWorkflowInput {
|
|
33
|
+
name: string;
|
|
34
|
+
source: string;
|
|
35
|
+
/** Structured attestation produced by `bundleWorkflow`. The server
|
|
36
|
+
* requires this on every registration; it proves the source was
|
|
37
|
+
* bundled by a `defineWorkflow`-aware toolchain. The server validates
|
|
38
|
+
* the manifest's shape and verifies `manifest.sourceHash` matches
|
|
39
|
+
* sha256(source) — the source bytes themselves are never parsed or
|
|
40
|
+
* executed on the server. */
|
|
41
|
+
manifest: WorkflowManifest;
|
|
42
|
+
version?: string;
|
|
43
|
+
schedule?: string;
|
|
44
|
+
runtimes?: RuntimeSourceInput[];
|
|
45
|
+
networkPolicy?: unknown;
|
|
46
|
+
placeholders?: Record<string, string>;
|
|
47
|
+
/** Reference to a snapshot the runner should boot from at run start. */
|
|
48
|
+
snapshot?: string;
|
|
49
|
+
/** If true, runs default to capturing a long-lived sandbox snapshot on success. */
|
|
50
|
+
saveSnapshot?: boolean;
|
|
51
|
+
/** Provider-neutral execution plan detected by the CLI bundler. */
|
|
52
|
+
workflowPlan?: WorkflowPlan;
|
|
53
|
+
/** Workflow Memory extraction config. Defaults to "default" when omitted. */
|
|
54
|
+
memory?: "default" | false | {
|
|
55
|
+
workflow: string;
|
|
56
|
+
};
|
|
57
|
+
/** Factory slug. Defaults to `"default"`. */
|
|
58
|
+
factorySlug?: string;
|
|
59
|
+
}
|
|
60
|
+
export type RunState = "running" | "success" | "failed" | "abandoned" | "canceled";
|
|
61
|
+
export interface InvokeWorkflowOptions {
|
|
62
|
+
/** Per-invocation snapshot override: run UUID, workflow name, or `name@version`. */
|
|
63
|
+
snapshot?: string;
|
|
64
|
+
/** Per-invocation snapshot capture override. */
|
|
65
|
+
saveSnapshot?: boolean;
|
|
66
|
+
/** Per-invocation network policy override. Replaces the template-level
|
|
67
|
+
* policy for this run only — registered metadata is not mutated. */
|
|
68
|
+
networkPolicy?: SandboxNetworkPolicy;
|
|
69
|
+
/** Per-invocation placeholder override. Maps secret names referenced in
|
|
70
|
+
* `networkPolicy` ($VAR) to the values the runner should see for env
|
|
71
|
+
* vars after brokering. Replaces the template-level placeholders for
|
|
72
|
+
* this run only — registered metadata is not mutated. */
|
|
73
|
+
placeholders?: Record<string, string>;
|
|
74
|
+
/** Explicit parent run id. Pass `null` to suppress ambient RUN_ID auto-detection. */
|
|
75
|
+
parentRunId?: string | null;
|
|
76
|
+
/** Agent loop inside the parent run that caused this invoke, when applicable. */
|
|
77
|
+
agentId?: string | null;
|
|
78
|
+
/** Factory slug. Defaults to `"default"`. */
|
|
79
|
+
factorySlug?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface InvokeAndWaitOptions extends InvokeWorkflowOptions {
|
|
82
|
+
timeoutMs?: number;
|
|
83
|
+
pollIntervalMs?: number;
|
|
84
|
+
}
|
|
85
|
+
export interface InvokeResult {
|
|
86
|
+
id: string;
|
|
87
|
+
}
|
|
88
|
+
export interface ListSnapshotsOptions {
|
|
89
|
+
workflow?: string;
|
|
90
|
+
limit?: number;
|
|
91
|
+
}
|
|
92
|
+
export interface TemplateRow {
|
|
93
|
+
name: string;
|
|
94
|
+
version: string;
|
|
95
|
+
factorySlug: string;
|
|
96
|
+
}
|
|
97
|
+
export interface ListTemplatesOptions {
|
|
98
|
+
factorySlug?: string;
|
|
99
|
+
}
|
|
100
|
+
export interface CreateFactoryInput {
|
|
101
|
+
slug: string;
|
|
102
|
+
name: string;
|
|
103
|
+
description?: string;
|
|
104
|
+
}
|
|
105
|
+
export interface UpdateFactoryInput {
|
|
106
|
+
name?: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
}
|
|
109
|
+
export interface SecretOptions {
|
|
110
|
+
factorySlug?: string;
|
|
111
|
+
}
|
|
112
|
+
export interface SetSecretResult {
|
|
113
|
+
key: string;
|
|
114
|
+
}
|
|
115
|
+
export interface SecretListEntry {
|
|
116
|
+
key: string;
|
|
117
|
+
createdAt: string;
|
|
118
|
+
updatedAt: string;
|
|
119
|
+
}
|
|
120
|
+
export interface CreateApiKeyInput {
|
|
121
|
+
name?: string;
|
|
122
|
+
scopes?: string[];
|
|
123
|
+
expiresAt?: string;
|
|
124
|
+
factorySlug?: string;
|
|
125
|
+
}
|
|
126
|
+
export interface StreamRunLogsOptions {
|
|
127
|
+
lastEventId?: number;
|
|
128
|
+
signal?: AbortSignal;
|
|
129
|
+
}
|
|
130
|
+
export interface RunStatus<TOutput = unknown> {
|
|
131
|
+
id: string;
|
|
132
|
+
status: RunState;
|
|
133
|
+
output?: TOutput;
|
|
134
|
+
}
|
|
135
|
+
export interface RunDetail<TOutput = unknown> {
|
|
136
|
+
runId: string;
|
|
137
|
+
title: string;
|
|
138
|
+
metadata: Record<string, unknown>;
|
|
139
|
+
outcome: string;
|
|
140
|
+
startedAt: string;
|
|
141
|
+
endedAt: string | null;
|
|
142
|
+
durationMs: number | null;
|
|
143
|
+
failureReason: string | null;
|
|
144
|
+
input: unknown;
|
|
145
|
+
output: TOutput | null;
|
|
146
|
+
lifecycleEvents: Array<{
|
|
147
|
+
at: string;
|
|
148
|
+
type: string;
|
|
149
|
+
payload: unknown;
|
|
23
150
|
}>;
|
|
151
|
+
children?: RunDetail[];
|
|
24
152
|
}
|
|
25
|
-
export interface
|
|
153
|
+
export interface TimelineEvent {
|
|
154
|
+
kind: string;
|
|
155
|
+
at: string;
|
|
156
|
+
seq: number;
|
|
157
|
+
type: string;
|
|
158
|
+
payload: Record<string, unknown>;
|
|
159
|
+
}
|
|
160
|
+
export type EventSubjectType = "run" | "agent" | "workflow" | "factory";
|
|
161
|
+
export interface EventRow {
|
|
26
162
|
id: string;
|
|
27
|
-
|
|
28
|
-
|
|
163
|
+
teamId: string;
|
|
164
|
+
subjectType: EventSubjectType | string;
|
|
165
|
+
subjectId: string;
|
|
166
|
+
runId: string | null;
|
|
167
|
+
agentId: string | null;
|
|
168
|
+
workflowId: string | null;
|
|
169
|
+
factoryId: string | null;
|
|
170
|
+
name: string;
|
|
171
|
+
body: unknown;
|
|
172
|
+
summary: string | null;
|
|
173
|
+
confidence: string | null;
|
|
174
|
+
timestamp: string;
|
|
175
|
+
attributes: Record<string, unknown>;
|
|
176
|
+
propagate: boolean;
|
|
177
|
+
idempotencyKey: string | null;
|
|
178
|
+
createdAt: string;
|
|
179
|
+
}
|
|
180
|
+
export interface ReportEventInput {
|
|
181
|
+
name: string;
|
|
182
|
+
body: unknown;
|
|
183
|
+
summary?: string;
|
|
184
|
+
confidence?: number;
|
|
185
|
+
timestamp?: string | Date;
|
|
186
|
+
attributes?: Record<string, unknown>;
|
|
187
|
+
propagate?: boolean;
|
|
188
|
+
idempotencyKey?: string;
|
|
189
|
+
}
|
|
190
|
+
export interface ListEventsOptions {
|
|
191
|
+
factorySlug?: string;
|
|
192
|
+
limit?: number;
|
|
193
|
+
/** Case-insensitive substring match. Server uses `ILIKE %name%`, so
|
|
194
|
+
* `"mem"` matches `memory.fact`, `memory.usage`, etc. Pass the
|
|
195
|
+
* full event name for an effectively-exact filter (any string is a
|
|
196
|
+
* substring of itself). */
|
|
197
|
+
name?: string;
|
|
198
|
+
/** Date-range lower bound: only include events at or after this
|
|
199
|
+
* timestamp. Used by the dashboard's range toggle (1h / 24h / 7d
|
|
200
|
+
* / 30d). Same semantics as `from` on the runs list endpoint. */
|
|
201
|
+
from?: string;
|
|
202
|
+
/** Timestamp cursor for "load older" pagination. Pass the
|
|
203
|
+
* `timestamp` of the last row from the previous page; the server
|
|
204
|
+
* returns rows strictly older than that. Distinct from `from`:
|
|
205
|
+
* `from` filters a date range, `before` walks the page boundary.
|
|
206
|
+
* Both can be supplied together for a paginated range-query. */
|
|
207
|
+
before?: string;
|
|
208
|
+
}
|
|
209
|
+
export interface ListEventsResult {
|
|
210
|
+
events: EventRow[];
|
|
211
|
+
has_more: boolean;
|
|
212
|
+
}
|
|
213
|
+
/** One captured stdout or stderr line from a run's sandbox subprocess.
|
|
214
|
+
* `id` is per-run monotonically increasing — pass the highest `id`
|
|
215
|
+
* you've seen as `afterId` to paginate forward. */
|
|
216
|
+
export interface RunLogLine {
|
|
217
|
+
id: number;
|
|
218
|
+
at: string;
|
|
219
|
+
stream: "stdout" | "stderr";
|
|
220
|
+
line: string;
|
|
221
|
+
}
|
|
222
|
+
export interface ListRunLogsOptions {
|
|
223
|
+
/** Return only lines with `id > afterId` (forward pagination). */
|
|
224
|
+
afterId?: number;
|
|
225
|
+
/** Max lines (server clamps to [1, 1000], defaults to 200). */
|
|
226
|
+
limit?: number;
|
|
227
|
+
/** Stream direction. `"asc"` (default) returns the oldest lines first
|
|
228
|
+
* — use with `afterId` to paginate forward. `"desc"` returns the newest
|
|
229
|
+
* lines first — use to fetch the last N lines of a finished run. */
|
|
230
|
+
direction?: "asc" | "desc";
|
|
29
231
|
}
|
|
30
232
|
/** Row shape returned by `GET /api-keys`. */
|
|
31
233
|
export interface ApiKey {
|
|
@@ -86,30 +288,7 @@ export declare class AgentComposeClient {
|
|
|
86
288
|
constructor(baseUrl: string, apiKey: string);
|
|
87
289
|
/** Register (or update) a workflow template inside a factory. Defaults to
|
|
88
290
|
* the team's `default` factory when `factorySlug` is omitted. */
|
|
89
|
-
register(payload:
|
|
90
|
-
name: string;
|
|
91
|
-
source: string;
|
|
92
|
-
version?: string;
|
|
93
|
-
schedule?: string;
|
|
94
|
-
runtimes?: Array<{
|
|
95
|
-
name: string;
|
|
96
|
-
source: string;
|
|
97
|
-
}>;
|
|
98
|
-
networkPolicy?: unknown;
|
|
99
|
-
placeholders?: Record<string, string>;
|
|
100
|
-
/** Reference to a snapshot the runner should boot from at run start.
|
|
101
|
-
* A run UUID, workflow name, or `name@version`. The referenced
|
|
102
|
-
* workflow must have been registered with `--build` (or any prior
|
|
103
|
-
* successful run with `saveSnapshot: true`). Per-invocation
|
|
104
|
-
* `invoke({ snapshot })` overrides this default. */
|
|
105
|
-
snapshot?: string;
|
|
106
|
-
/** If true, runs default to capturing a long-lived sandbox snapshot on
|
|
107
|
-
* success. Individual invocations can override via
|
|
108
|
-
* `invoke(..., { saveSnapshot })`. */
|
|
109
|
-
saveSnapshot?: boolean;
|
|
110
|
-
/** Factory slug. Defaults to `"default"`. */
|
|
111
|
-
factorySlug?: string;
|
|
112
|
-
}): Promise<RegisterResult>;
|
|
291
|
+
register(payload: RegisterWorkflowInput): Promise<RegisterResult>;
|
|
113
292
|
/** Invoke a workflow. Returns run ID immediately — workflow runs asynchronously.
|
|
114
293
|
*
|
|
115
294
|
* `snapshot`: per-invocation override of the template-level `snapshot`
|
|
@@ -132,16 +311,7 @@ export declare class AgentComposeClient {
|
|
|
132
311
|
* current run). Explicit non-null wins over auto-detection.
|
|
133
312
|
*
|
|
134
313
|
* `factorySlug`: defaults to `"default"`. */
|
|
135
|
-
invoke(name: string, input?: Record<string, unknown>, opts?:
|
|
136
|
-
snapshot?: string;
|
|
137
|
-
saveSnapshot?: boolean;
|
|
138
|
-
parentRunId?: string | null;
|
|
139
|
-
factorySlug?: string;
|
|
140
|
-
networkPolicy?: SandboxNetworkPolicy;
|
|
141
|
-
placeholders?: Record<string, string>;
|
|
142
|
-
}): Promise<{
|
|
143
|
-
id: string;
|
|
144
|
-
}>;
|
|
314
|
+
invoke(name: string, input?: Record<string, unknown>, opts?: InvokeWorkflowOptions): Promise<InvokeResult>;
|
|
145
315
|
/** Invoke a workflow and wait for it to settle (success / failed / abandoned).
|
|
146
316
|
* Polls `getStatus` on a fixed interval. Rejects with `AgentComposeError`
|
|
147
317
|
* if the run settles non-success, or a plain `Error` on timeout.
|
|
@@ -149,85 +319,66 @@ export declare class AgentComposeClient {
|
|
|
149
319
|
* Defaults: `timeoutMs = 30min`, `pollIntervalMs = 1000ms`. Tune down for
|
|
150
320
|
* tests, tune up for long-running workflows. The parent-child auto-
|
|
151
321
|
* detection from `invoke()` applies here too. */
|
|
152
|
-
invokeAndWait(name: string, input?: Record<string, unknown>, opts?:
|
|
153
|
-
snapshot?: string;
|
|
154
|
-
saveSnapshot?: boolean;
|
|
155
|
-
parentRunId?: string | null;
|
|
156
|
-
factorySlug?: string;
|
|
157
|
-
networkPolicy?: SandboxNetworkPolicy;
|
|
158
|
-
placeholders?: Record<string, string>;
|
|
159
|
-
timeoutMs?: number;
|
|
160
|
-
pollIntervalMs?: number;
|
|
161
|
-
}): Promise<RunStatus>;
|
|
322
|
+
invokeAndWait<TOutput = unknown>(name: string, input?: Record<string, unknown>, opts?: InvokeAndWaitOptions): Promise<RunStatus<TOutput>>;
|
|
162
323
|
/** List runs this account has captured snapshots for. */
|
|
163
|
-
listSnapshots(opts?:
|
|
164
|
-
workflow?: string;
|
|
165
|
-
limit?: number;
|
|
166
|
-
}): Promise<SnapshotListEntry[]>;
|
|
324
|
+
listSnapshots(opts?: ListSnapshotsOptions): Promise<SnapshotListEntry[]>;
|
|
167
325
|
/** Delete the snapshot captured by a specific run. Frees Vercel storage. */
|
|
168
326
|
deleteSnapshot(runId: string): Promise<void>;
|
|
169
327
|
/** Poll run status. */
|
|
170
|
-
getStatus(runId: string): Promise<RunStatus
|
|
328
|
+
getStatus<TOutput = unknown>(runId: string): Promise<RunStatus<TOutput>>;
|
|
329
|
+
/** Full run detail, including input/output and lifecycle events. */
|
|
330
|
+
getRun<TOutput = unknown>(runId: string): Promise<RunDetail<TOutput>>;
|
|
331
|
+
/** Ordered lifecycle timeline for one run. */
|
|
332
|
+
getRunTimeline(runId: string, opts?: {
|
|
333
|
+
limit?: number;
|
|
334
|
+
offset?: number;
|
|
335
|
+
}): Promise<TimelineEvent[]>;
|
|
336
|
+
/** Report a durable event against a run. Events are late-binding facts
|
|
337
|
+
* like quality.accepted, defect.regression, or intervention.override. */
|
|
338
|
+
reportEvent(runId: string, input: ReportEventInput): Promise<EventRow>;
|
|
339
|
+
listRunEvents(runId: string): Promise<EventRow[]>;
|
|
340
|
+
/** List events ingested into a factory, newest first. Supports
|
|
341
|
+
* case-insensitive substring filter (`name`) and timestamp-cursor
|
|
342
|
+
* pagination (`before`). Returns `{ events, has_more }` — the
|
|
343
|
+
* `has_more` flag is the signal to render a "load more" affordance
|
|
344
|
+
* or fire a follow-up request with `before = events.at(-1).timestamp`. */
|
|
345
|
+
listFactoryEvents(opts?: ListEventsOptions): Promise<ListEventsResult>;
|
|
346
|
+
/** Fetch captured stdout / stderr lines for a run, ordered by insertion
|
|
347
|
+
* sequence. Pass `afterId` (the highest `id` from a prior page) for
|
|
348
|
+
* forward pagination — useful for tail-style polling without
|
|
349
|
+
* re-fetching the whole stream. `limit` defaults to 200 server-side and
|
|
350
|
+
* is clamped to [1, 1000]. */
|
|
351
|
+
listRunLogs(runId: string, opts?: ListRunLogsOptions): Promise<RunLogLine[]>;
|
|
171
352
|
/** List registered workflow templates. When `factorySlug` is supplied,
|
|
172
353
|
* scopes to that factory; otherwise returns every template the team can
|
|
173
354
|
* see across every factory in one round trip — each row carries its
|
|
174
355
|
* `factorySlug` so callers can route per-template actions to the right
|
|
175
356
|
* factory. */
|
|
176
|
-
listTemplates(opts?:
|
|
177
|
-
factorySlug?: string;
|
|
178
|
-
}): Promise<Array<{
|
|
179
|
-
name: string;
|
|
180
|
-
version: string;
|
|
181
|
-
factorySlug: string;
|
|
182
|
-
}>>;
|
|
357
|
+
listTemplates(opts?: ListTemplatesOptions): Promise<TemplateRow[]>;
|
|
183
358
|
/** List factories for the caller's team. */
|
|
184
359
|
listFactories(): Promise<FactoryRow[]>;
|
|
185
360
|
/** Create a factory. `slug` must be lowercase kebab-case and unique
|
|
186
361
|
* within the team. */
|
|
187
|
-
createFactory(payload:
|
|
188
|
-
slug: string;
|
|
189
|
-
name: string;
|
|
190
|
-
description?: string;
|
|
191
|
-
}): Promise<FactoryRow>;
|
|
362
|
+
createFactory(payload: CreateFactoryInput): Promise<FactoryRow>;
|
|
192
363
|
/** Get a factory by slug. */
|
|
193
364
|
getFactory(slug: string): Promise<FactoryRow>;
|
|
194
365
|
/** Rename or describe a factory. */
|
|
195
|
-
updateFactory(slug: string, updates:
|
|
196
|
-
name?: string;
|
|
197
|
-
description?: string;
|
|
198
|
-
}): Promise<FactoryRow>;
|
|
366
|
+
updateFactory(slug: string, updates: UpdateFactoryInput): Promise<FactoryRow>;
|
|
199
367
|
/** Delete a factory. Refuses `default` and any factory still
|
|
200
368
|
* containing workflows. */
|
|
201
369
|
deleteFactory(slug: string): Promise<void>;
|
|
202
370
|
/** Create or update a workflow secret. Value is stored in GCP Secret Manager. */
|
|
203
|
-
setSecret(workflowName: string, key: string, value: string, opts?:
|
|
204
|
-
factorySlug?: string;
|
|
205
|
-
}): Promise<{
|
|
206
|
-
key: string;
|
|
207
|
-
}>;
|
|
371
|
+
setSecret(workflowName: string, key: string, value: string, opts?: SecretOptions): Promise<SetSecretResult>;
|
|
208
372
|
/** List secret keys registered for a workflow (metadata only — values are never returned). */
|
|
209
|
-
listSecrets(workflowName: string, opts?:
|
|
210
|
-
factorySlug?: string;
|
|
211
|
-
}): Promise<Array<{
|
|
212
|
-
key: string;
|
|
213
|
-
createdAt: string;
|
|
214
|
-
updatedAt: string;
|
|
215
|
-
}>>;
|
|
373
|
+
listSecrets(workflowName: string, opts?: SecretOptions): Promise<SecretListEntry[]>;
|
|
216
374
|
/** Delete a workflow secret. */
|
|
217
|
-
deleteSecret(workflowName: string, key: string, opts?:
|
|
218
|
-
factorySlug?: string;
|
|
219
|
-
}): Promise<void>;
|
|
375
|
+
deleteSecret(workflowName: string, key: string, opts?: SecretOptions): Promise<void>;
|
|
220
376
|
/** Create a new API key on the caller's team. The plaintext `key` is
|
|
221
377
|
* returned once — it cannot be retrieved later.
|
|
222
378
|
*
|
|
223
379
|
* When `factorySlug` is set, the new key is restricted to that factory.
|
|
224
380
|
* Factory-scoped keys can only mint other keys bound to the same factory. */
|
|
225
|
-
createApiKey(input:
|
|
226
|
-
name?: string;
|
|
227
|
-
scopes?: string[];
|
|
228
|
-
expiresAt?: string;
|
|
229
|
-
factorySlug?: string;
|
|
230
|
-
}): Promise<ApiKeyCreated>;
|
|
381
|
+
createApiKey(input: CreateApiKeyInput): Promise<ApiKeyCreated>;
|
|
231
382
|
/** List API keys on the caller's team (metadata only — plaintext keys are
|
|
232
383
|
* never returned). */
|
|
233
384
|
listApiKeys(): Promise<ApiKey[]>;
|
|
@@ -244,16 +395,13 @@ export declare class AgentComposeClient {
|
|
|
244
395
|
* `lastEventId` enables resume — pass the highest `seq` you've already
|
|
245
396
|
* processed to receive only events you missed.
|
|
246
397
|
*
|
|
247
|
-
* `
|
|
398
|
+
* `event` can be used to abort the stream from the caller side.
|
|
248
399
|
*
|
|
249
400
|
* Uses raw `fetch` (not ofetch) because SSE requires access to the
|
|
250
401
|
* response's `ReadableStream`, which ofetch consumes when parsing. Auth
|
|
251
402
|
* + base URL are still sourced from the same constructor inputs, and
|
|
252
403
|
* non-2xx responses throw the same `AgentComposeError`. */
|
|
253
|
-
streamRunLogs(runId: string, opts?:
|
|
254
|
-
lastEventId?: number;
|
|
255
|
-
signal?: AbortSignal;
|
|
256
|
-
}): AsyncGenerator<RunEvent>;
|
|
404
|
+
streamRunLogs(runId: string, opts?: StreamRunLogsOptions): AsyncGenerator<RunEvent>;
|
|
257
405
|
}
|
|
258
406
|
/** A factory: a project-level grouping of workflows inside a team. */
|
|
259
407
|
export interface FactoryRow {
|
package/dist/index.d.ts
CHANGED
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Tools for defining runtimes and workflows, registering/invoking them
|
|
5
5
|
* against an agent-compose server, and running LLM agent loops inside a
|
|
6
|
-
* workflow via `
|
|
6
|
+
* workflow via `agent(opts)`.
|
|
7
7
|
*
|
|
8
8
|
* @example
|
|
9
9
|
* ```typescript
|
|
10
|
-
* import { defineWorkflow,
|
|
10
|
+
* import { defineWorkflow, agent, AgentComposeClient } from "@agent-compose/sdk";
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export { defineRuntime } from "./types/runtime.js";
|
|
@@ -15,30 +15,45 @@ export { defineWorkflow } from "./types/workflow.js";
|
|
|
15
15
|
export type { WorkflowDefinition } from "./types/workflow.js";
|
|
16
16
|
export { defineSandboxEnvironment } from "./types/sandbox-environment.js";
|
|
17
17
|
export type { SandboxEnvironmentDefinition } from "./types/sandbox-environment.js";
|
|
18
|
-
export type { AgentRuntime, McpServerConfig, ModelExecutionContract, RuntimeOptions, } from "./types/runtime.js";
|
|
18
|
+
export type { AgentRuntime, McpServerConfig, ModelExecutionContract, ToolCallGateResult, RuntimeOptions, } from "./types/runtime.js";
|
|
19
19
|
export type { WorkflowFn, WorkflowCtx, WorkflowRun, AgentBudget, WorkflowHooks, } from "./types/workflow.js";
|
|
20
|
+
export type { WorkflowPlan, WorkflowStepPlan } from "./types/workflow-plan.js";
|
|
21
|
+
export type { BaseExecutionContext, InvokeChild } from "./types/execution-context.js";
|
|
22
|
+
export { RequestContext, ReservedKeyError, NonSerialisableValueError, AC_RESERVED_PREFIX, AC_TEAM_ID, AC_RUN_ID, AC_WORKFLOW_ID, AC_FACTORY_ID, AC_API_KEY_SCOPES, AC_PARENT_RUN_ID, AC_ABORT_SIGNAL, } from "./request-context/index.js";
|
|
23
|
+
export type { RequestContextReserved, RequestContextWire, } from "./request-context/index.js";
|
|
24
|
+
export { Verdict, runProcessorChain, denyTools, requireScope, redactPattern, } from "./processors/index.js";
|
|
25
|
+
export type { Processor, ProcessorContext, ProcessorVerdict, ToolCall, } from "./processors/index.js";
|
|
20
26
|
export type { AgentMessage, AgentMessageInit, AgentMessageText, AgentMessageThinking, AgentMessageToolUse, AgentMessageToolResult, AgentMessageDone, AgentMessageError, AgentMessageUsage, AgentStatus, } from "./types/protocol.js";
|
|
21
27
|
export type { SandboxProvider, DesktopSandboxProvider, } from "./types/sandbox.js";
|
|
22
28
|
export { AgentComposeClient } from "./client.js";
|
|
23
|
-
export type { RegisterResult, RunStatus, FactoryRow, SnapshotListEntry, ApiKey, ApiKeyCreated, UsageRollupRow, UsageResponse, CancelRunResponse, } from "./client.js";
|
|
29
|
+
export type { RegisterResult, RegisterWorkflowInput, RuntimeSourceInput, InvokeWorkflowOptions, InvokeAndWaitOptions, InvokeResult, ListSnapshotsOptions, TemplateRow, ListTemplatesOptions, CreateFactoryInput, UpdateFactoryInput, SecretOptions, SetSecretResult, SecretListEntry, CreateApiKeyInput, StreamRunLogsOptions, EventSubjectType, EventRow, ReportEventInput, ListEventsOptions, ListEventsResult, RunLogLine, ListRunLogsOptions, RegisteredRuntime, RunState, RunStatus, FactoryRow, SnapshotListEntry, ApiKey, ApiKeyCreated, UsageRollupRow, UsageResponse, CancelRunResponse, } from "./client.js";
|
|
24
30
|
export { parseSseStream } from "./sse.js";
|
|
25
31
|
export { AgentComposeError } from "./errors.js";
|
|
26
32
|
export { formatError } from "./utils/errors.js";
|
|
27
33
|
export { discoverRuntimeName } from "./utils/discovery.js";
|
|
28
|
-
export { bundleWorkflow } from "./utils/bundler.js";
|
|
29
|
-
export type { BundledWorkflow } from "./utils/bundler.js";
|
|
34
|
+
export { bundleWorkflow, BUNDLER_VERSION, WorkflowSourceValidationError, assertDefaultExportIsDefineWorkflow, } from "./utils/bundler.js";
|
|
35
|
+
export type { BundledWorkflow, WorkflowManifest } from "./utils/bundler.js";
|
|
30
36
|
export { AgentStatusSchema } from "./utils/schemas.js";
|
|
31
37
|
export { createClaudeRuntime, ClaudeRunner } from "./runtimes/claude.js";
|
|
32
38
|
export type { ClaudeRuntimeConfig } from "./runtimes/claude.js";
|
|
33
39
|
export { default as claudeRuntime } from "./runtimes/claude.js";
|
|
40
|
+
export { createVercelRuntime, VercelRunner } from "./runtimes/vercel.js";
|
|
41
|
+
export type { VercelRuntimeConfig } from "./runtimes/vercel.js";
|
|
42
|
+
export { bashTool, codingTools, editTool, readTool, writeTool } from "./tools/index.js";
|
|
43
|
+
export type { CodingTool } from "./tools/index.js";
|
|
34
44
|
export type { RunEvent } from "./types/events.js";
|
|
35
45
|
export { createSandbox, reconnectSandbox, killAllSandboxes, killSandboxById, getSandboxQuotas, listOwnedSandboxes, deleteSandboxSnapshot, makeSandboxProvider, makeDesktopSandboxProvider, parseSseExecStream, AGENT_COMPOSE_TAG } from "./sandbox.js";
|
|
36
|
-
export type { SandboxCreateOpts, SandboxNetworkPolicy, OwnedSandbox } from "./sandbox.js";
|
|
46
|
+
export type { SandboxCreateOpts, SandboxNetworkPolicy, SandboxNetworkHeaderTransform, SandboxNetworkAllowRule, SandboxNetworkSubnetPolicy, SandboxProviderName, SandboxQuotaResult, OwnedSandboxResult, OwnedSandbox, ParseSseExecStreamOptions, SandboxCommandRunOptions, SandboxCommandResult, } from "./sandbox.js";
|
|
37
47
|
export { runWorkflow, WorkflowError, EngineError, classifyError, parseNameVersion } from "./workflows/engine.js";
|
|
38
|
-
export type { WorkflowResult, EngineSubsystem } from "./workflows/engine.js";
|
|
48
|
+
export type { WorkflowResult, RunWorkflowOptions, EngineSubsystem } from "./workflows/engine.js";
|
|
49
|
+
export { buildInvokeChild } from "./workflows/invoke-child.js";
|
|
50
|
+
export { defineStep, isWorkflow, runWorkflowSteps, runWorkflowSingleStep, StepValidationError, WorkflowInputValidationError, WorkflowOutputValidationError, } from "./workflow-steps/index.js";
|
|
51
|
+
export type { Step, StepContext, StepRunResult, Workflow, DefineStepOpts, StepWorkflowDefinition, WorkflowBuilder, RunWorkflowStepsOpts, RunWorkflowStepsResult, RunWorkflowSingleStepOpts, RunWorkflowSingleStepResult, StepObservability, SubStepEvent, } from "./workflow-steps/index.js";
|
|
52
|
+
export { invokeStep, serveStep, parseStepResult, buildStepEnvs, StepExecutionError, STEP_RESULT_PREFIX, STEP_ENV, RUNNER_BUNDLE_PATH, RUNNER_COMMAND, stepInputPath, requestContextPath, } from "./step-invocation/index.js";
|
|
53
|
+
export type { StepRequest, StepResult, StepInvocationError, StepHandler, StepHandlerResult, ServeStepRequest, } from "./step-invocation/index.js";
|
|
39
54
|
export { agentLoop, parseAgentStatus, DEFAULT_CLAUDE_MODEL } from "./agent/agent-loop.js";
|
|
40
|
-
export type { AgentLoopResult } from "./agent/agent-loop.js";
|
|
41
|
-
export {
|
|
42
|
-
export type {
|
|
55
|
+
export type { AgentLifecycleEvent, AgentLoopOpts, AgentLoopResult } from "./agent/agent-loop.js";
|
|
56
|
+
export { agent } from "./agent/run-agent.js";
|
|
57
|
+
export type { AgentOpts } from "./agent/run-agent.js";
|
|
43
58
|
export { AgentMessageSchema, parseAgentResponse } from "./agent/protocol.js";
|
|
44
59
|
export { importSourceModule, TMP_DIR, LATEST_VERSION } from "./utils/source-loader.js";
|