@automatalabs/workflows 0.1.1 → 0.2.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 ADDED
@@ -0,0 +1,400 @@
1
+ # @automatalabs/workflows
2
+
3
+ The programmatic **SDK** for AgentPrism — run dynamic, multi-agent **workflow scripts**
4
+ (`agent()` / `parallel()` / `pipeline()` / …) over real coding-agent backends through the
5
+ [Agent Client Protocol](https://agentclientprotocol.com) (ACP).
6
+
7
+ You author a small JavaScript **script** (a string), the engine runs it in a deterministic,
8
+ journaled, resumable realm, and every `agent()` call inside it is fanned out to a pooled ACP
9
+ backend — **Claude** (`claude-agent-acp`) or **Codex** (`codex-acp`) — driving the actual agent
10
+ subprocess to completion.
11
+
12
+ This package is the **canonical SDK** that the stdio MCP server
13
+ [`@automatalabs/mcp-server`](https://www.npmjs.com/package/@automatalabs/mcp-server) is built on.
14
+ If you want to expose a `workflow` tool to an MCP host (Claude Code, Zed, …), use that package; if
15
+ you want to embed the runner in your own program, use this one.
16
+
17
+ It is a **pure library**: it pulls in neither `@modelcontextprotocol/sdk` nor `zod`. It is a thin
18
+ facade that re-exports the clean public surface of the engine + ACP packages and adds one
19
+ convenience helper, `runDynamicWorkflow`, which defaults the agent backend to ACP.
20
+
21
+ ---
22
+
23
+ ## Install
24
+
25
+ ```bash
26
+ pnpm add @automatalabs/workflows
27
+ ```
28
+
29
+ > The backend ACP servers ship as transitive dependencies and are spawned for you on demand; you
30
+ > do not install or start them separately.
31
+
32
+ ---
33
+
34
+ ## Requirements
35
+
36
+ - **Node.js ≥ 22.**
37
+ - **Backend auth** — the SDK spawns the ACP backend as a child process that inherits your
38
+ `process.env`, so it uses whatever credentials those agents already use:
39
+ - **Claude** — a logged-in Claude Code install (`~/.claude`) **or** `ANTHROPIC_API_KEY` in the
40
+ environment.
41
+ - **Codex** — a logged-in Codex install (`~/.codex`).
42
+
43
+ You only need auth for the backend(s) your scripts actually route to. The default backend is
44
+ Claude (override with `AGENTPRISM_DEFAULT_BACKEND`; see [Backend selection](#backend-selection)).
45
+
46
+ ---
47
+
48
+ ## Core API
49
+
50
+ ### a) `runDynamicWorkflow(script, opts?)` — run a script to a terminal result
51
+
52
+ The one-call entry point. It builds a one-off `WorkflowManager` whose agent backend defaults to
53
+ `createAcpRunner()` and runs the script to a **terminal** `WorkflowRunResult`. It never throws for
54
+ an ordinary pause/fail/abort — read `result.status` directly.
55
+
56
+ ```ts
57
+ import { runDynamicWorkflow } from "@automatalabs/workflows";
58
+
59
+ const script = `
60
+ export const meta = {
61
+ name: "repo-scan",
62
+ description: "describe a repo as JSON, two ways in parallel",
63
+ phases: [{ title: "Fan" }],
64
+ };
65
+
66
+ const SCHEMA = {
67
+ type: "object",
68
+ additionalProperties: false,
69
+ required: ["repo", "fileCount"],
70
+ properties: { repo: { type: "string" }, fileCount: { type: "number" } },
71
+ };
72
+
73
+ phase("Fan");
74
+ log("scanning " + args.repo);
75
+ return await parallel([
76
+ () => agent("Report this repo as JSON {repo, fileCount}.", { label: "a1", schema: SCHEMA }),
77
+ () => agent("Report this repo as JSON {repo, fileCount}.", { label: "a2", schema: SCHEMA }),
78
+ ]);
79
+ `;
80
+
81
+ const run = await runDynamicWorkflow(script, { args: { repo: "agentprism" } });
82
+
83
+ run.status; // "completed" | "paused" | "failed" | "aborted"
84
+ run.result; // [{ repo, fileCount }, …] — the script's return value (schema-validated)
85
+ run.tokenUsage; // { input, output, total, cost, … } | undefined
86
+ run.runId; // stable id; pass back to resume a paused run from its journal
87
+ ```
88
+
89
+ Options (`RunDynamicWorkflowOptions`):
90
+
91
+ | field | type | meaning |
92
+ |----------|----------------|---------|
93
+ | `args` | `unknown` | The value handed to the script's `args` global. |
94
+ | `runner` | `AgentRunner` | Swap the backend (or stub it in tests). Omitted ⇒ `createAcpRunner()`. |
95
+ | `exec` | `ExecOptions` | Per-run controls forwarded to the manager: `tokenBudget`, `agentTimeoutMs`, `concurrency`, `agentRetries`, `signal`, `onProgress`, `confirm`, … |
96
+
97
+ ```ts
98
+ const run = await runDynamicWorkflow(script, {
99
+ args: { repo: "agentprism" },
100
+ exec: {
101
+ tokenBudget: 200_000,
102
+ concurrency: 4,
103
+ onProgress: (snapshot) => console.error(snapshot.doneCount, "/", snapshot.agentCount),
104
+ },
105
+ });
106
+ ```
107
+
108
+ Every script **must** begin with `export const meta = { name, description, phases? }` as its first
109
+ statement, and must be **deterministic** — `Date.now()`, `Math.random()`, and `new Date()` are
110
+ unavailable inside the realm (they would break journal replay on resume).
111
+
112
+ ### b) `createAcpRunner().run(...)` — drive a single agent
113
+
114
+ Skip the script realm entirely and call one agent directly. The runner is the default ACP
115
+ `AgentRunner`. With a `schema`, `run()` returns the **validated object**; without one, it returns
116
+ the assistant's final **text**.
117
+
118
+ ```ts
119
+ import { createAcpRunner } from "@automatalabs/workflows";
120
+
121
+ const runner = createAcpRunner(); // optional: { size } pool option, default 1
122
+ try {
123
+ const data = await runner.run("Summarize this repo as JSON {summary}.", {
124
+ schema: {
125
+ type: "object", additionalProperties: false,
126
+ required: ["summary"], properties: { summary: { type: "string" } },
127
+ },
128
+ model: "opus", // routes to Claude; e.g. "gpt-5-codex" routes to Codex
129
+ cwd: process.cwd(), // absolute working dir for the agent's session
130
+ });
131
+ // data is the schema-validated object (not text)
132
+
133
+ const text = await runner.run("Name this repo in one word."); // no schema ⇒ string
134
+ } finally {
135
+ await runner.dispose(); // close the pooled backend processes when you're done
136
+ }
137
+ ```
138
+
139
+ `run(prompt, options?)` accepts the seam's `RunOptions`: `schema`, `model`, `tier`, `cwd`,
140
+ `instructions`, `label`, `toolNames` / `disallowedToolNames`, `signal`, `mcpServers`, and the
141
+ out-of-band telemetry callbacks `onUsage` / `onModelResolved` / `onModelFallback` / `onHistory`.
142
+ Token/cost usage is delivered via `onUsage` (it may never fire — ACP usage is experimental), never
143
+ via the return value.
144
+
145
+ > The ACP server **process** is pooled and reused across `run()` calls; each `run()` opens and
146
+ > closes one **session** on it. Call `dispose()` once at shutdown to tear the pool down. Pool size
147
+ > is `AcpPoolOptions.size` (default 1) or `AGENTPRISM_ACP_POOL_SIZE`.
148
+
149
+ ### c) `WorkflowManager` — stateful / resumable runs
150
+
151
+ `runDynamicWorkflow` is a thin wrapper over a fresh `WorkflowManager`. Construct one yourself to
152
+ keep run state across calls, persist journals, and **resume** a paused run.
153
+
154
+ ```ts
155
+ import { WorkflowManager, createAcpRunner } from "@automatalabs/workflows";
156
+
157
+ const manager = new WorkflowManager({ agent: createAcpRunner() });
158
+
159
+ const run = await manager.runSync(script, { repo: "agentprism" }, { tokenBudget: 200_000 });
160
+
161
+ if (run.status === "paused") {
162
+ // A pause carries a journal of every completed agent() call. Re-hydrate it and re-run the
163
+ // SAME script: the unchanged prefix is replayed from the journal, the rest runs live.
164
+ const persisted = manager.getPersistence().load(run.runId);
165
+ const resumeJournal = new Map(persisted?.journal?.map((e) => [e.index, e]) ?? []);
166
+ const finished = await manager.runSync(script, { repo: "agentprism" }, { resumeJournal });
167
+ console.log(finished.status); // "completed", typically
168
+ }
169
+ ```
170
+
171
+ `runSync(script, args?, exec?)` always resolves to a terminal `WorkflowRunResult`. A run **pauses**
172
+ (rather than fails) on a provider usage limit or a headless `checkpoint()`; both are resumable as
173
+ above. `WorkflowManagerOptions` lets you set a default `agent`, `concurrency`, `cwd`, a
174
+ `loadSavedWorkflow` resolver (enables nested `workflow('name')`), and per-agent timeout/retry
175
+ defaults.
176
+
177
+ ### d) Bring your own backend — implement the `AgentRunner` seam
178
+
179
+ `AgentRunner` is the single, frozen coupling point between the engine and any backend. Implement
180
+ its one method and inject it anywhere a runner is accepted (`runDynamicWorkflow({ runner })`,
181
+ `new WorkflowManager({ agent })`, or `runSync(script, args, { agent })`).
182
+
183
+ ```ts
184
+ import {
185
+ runDynamicWorkflow,
186
+ type AgentRunner,
187
+ type RunOptions,
188
+ type AgentResult,
189
+ } from "@automatalabs/workflows";
190
+ import type { TSchema } from "typebox";
191
+
192
+ const echoRunner: AgentRunner = {
193
+ async run<S extends TSchema | undefined>(prompt: string, options?: RunOptions<S>) {
194
+ // schema present ⇒ return the validated object; absent ⇒ return text.
195
+ options?.onUsage?.({ input: 0, output: 0, cacheRead: 0, cacheWrite: 0, total: 0, cost: 0 });
196
+ return `echo: ${prompt}` as AgentResult<S>;
197
+ },
198
+ };
199
+
200
+ const run = await runDynamicWorkflow(script, { runner: echoRunner });
201
+ ```
202
+
203
+ Seam contract (summarized): `run()` returns the **raw** value (schema ⇒ validated object, no schema
204
+ ⇒ string) — never an envelope; usage flows out-of-band via `options.onUsage`; on failure **throw**
205
+ (ideally a `WorkflowError` so `instanceof` holds across packages); honor `options.signal` but do
206
+ **not** implement your own timeout (the engine owns timeout/abort). This makes the SDK fully
207
+ testable without a live agent — pass a stub runner.
208
+
209
+ ---
210
+
211
+ ## Listening in on the live ACP stream (events)
212
+
213
+ `createAcpRunner()` returns an `AcpAgentRunner` with a **typed event bus**. Subscribe with
214
+ `runner.on(name, listener)` to observe the live ACP stream of every run on that runner — streaming
215
+ assistant text, tool calls, usage, permissions — without touching the `run()` return value or the
216
+ `AgentRunner` seam.
217
+
218
+ ```ts
219
+ import { createAcpRunner } from "@automatalabs/workflows";
220
+
221
+ const runner = createAcpRunner();
222
+
223
+ // ACP `sessionUpdate` discriminants are the event names; the listener payload is typed to each.
224
+ runner.on("agent_message_chunk", (e) => {
225
+ if (e.content.type === "text") process.stdout.write(e.content.text); // stream tokens as they land
226
+ });
227
+ runner.on("tool_call", (e) => console.error(`[${e.label}] tool: ${e.title}`));
228
+ runner.on("usage_update", (e) => console.error(`ctx ${e.used}/${e.size} tokens`));
229
+
230
+ // One catch-all for "everything": fires for EVERY session/update, carrying the raw update.
231
+ const off = runner.on("session_update", (e) => console.error(e.update.sessionUpdate));
232
+
233
+ await runner.run("Refactor this module and run the tests.", { label: "refactor", cwd });
234
+ off(); // on()/once() return an unsubscribe thunk; off(name, listener) and removeAllListeners() also exist
235
+ await runner.dispose();
236
+ ```
237
+
238
+ **Event names.** The ACP `sessionUpdate` discriminants verbatim — `user_message_chunk`,
239
+ `agent_message_chunk`, `agent_thought_chunk`, `tool_call`, `tool_call_update`, `plan`,
240
+ `plan_update`, `plan_removed`, `available_commands_update`, `current_mode_update`,
241
+ `config_option_update`, `session_info_update`, `usage_update` — plus a few cross-cutting events:
242
+
243
+ | event | payload |
244
+ |-------|---------|
245
+ | `session_update` | `{ update }` — catch-all for **every** update, regardless of kind |
246
+ | `permission_request` | `{ request, outcome }` — a tool permission the runner auto-answered |
247
+ | `raw_message` | `{ method, message }` — a vendor extension notification (e.g. Claude `_claude/sdkMessage`) |
248
+ | `session_open` / `session_close` | a session opened / was released on a pooled connection |
249
+ | `backend_error` | `{ backendId, error }` — a pooled backend process crashed |
250
+
251
+ **Context envelope.** A pooled runner multiplexes many concurrent runs over one process, so every
252
+ event (except `backend_error`) carries `{ sessionId, backendId, label?, runId? }` — filter by
253
+ `label`/`runId` (from the run's `RunOptions`) to attribute an event to a specific run.
254
+
255
+ **Best-effort.** Listeners are observers: a throwing listener is isolated and never breaks the run,
256
+ the update drain, or sibling listeners.
257
+
258
+ **With `runDynamicWorkflow` / `WorkflowManager`.** Construct the runner yourself, subscribe, then
259
+ inject it: `runDynamicWorkflow(script, { runner })` or `new WorkflowManager({ agent: runner })`.
260
+ Every `agent()` call in the script then streams through your listeners (filter by `label` to tell
261
+ agents apart).
262
+
263
+ ---
264
+
265
+ ## The in-script DSL
266
+
267
+ The orchestration primitives are **not importable symbols**. They are **globals injected into the
268
+ script's `vm` realm**, available only **inside** the script string you pass to
269
+ `runDynamicWorkflow` / `runSync`. There is nothing to import to obtain them. Their shapes are
270
+ documented for editor IntelliSense by the **ambient `dsl.d.ts`** shipped with this package (it
271
+ ships no runtime code).
272
+
273
+ | global | what it does |
274
+ |--------|--------------|
275
+ | `agent(prompt, options?)` | Run ONE subagent to completion; returns its result (text, or the validated object with `options.schema`). |
276
+ | `parallel(thunks)` | Run an array of **thunks** (`() => Promise`) concurrently; resolves in input order. |
277
+ | `pipeline(items, ...stages)` | Map `items` through sequential async stages, concurrently across items. |
278
+ | `workflow(nameOrScript, args?)` | Run a saved (or inline) workflow nested in this run, sharing its limiter/budget. |
279
+ | `verify(item, options?)` | Adversarial verification panel — N reviewers vote whether `item` is real/correct. |
280
+ | `judgePanel(attempts, options?)` | LLM-judge panel — score candidates against a rubric, return the best. |
281
+ | `loopUntilDry(options)` | Repeat a round, collecting deduped new items until it dries up. |
282
+ | `completenessCheck(args, results)` | Ask a critic what is still missing. |
283
+ | `retry(thunk, options?)` | Bounded retry until `until(result)` holds. |
284
+ | `gate(thunk, validator, options?)` | Validate-and-feed-back loop until it passes. |
285
+ | `checkpoint(text, options?)` | Deterministic, journaled human gate (headless takes a default). |
286
+ | `phase(title, options?)` | Open a named phase (optional soft token sub-budget). |
287
+ | `log(message)` | Append a line to the run log. |
288
+ | `args` | The input bag passed in via `{ args }`. |
289
+ | `budget` | Live token-budget view: `budget.total`, `budget.spent()`, `budget.remaining()`. |
290
+
291
+ (`console.log/info/warn/error` route to `log` too.) Pass these primitives **thunks**, not
292
+ promises — `parallel([() => agent("a"), () => agent("b")])`, not `parallel([agent("a"), …])`.
293
+
294
+ ---
295
+
296
+ ## Structured output
297
+
298
+ Pass a JSON Schema to `agent({ schema })` (in a script) or `runner.run(prompt, { schema })` (direct)
299
+ and the result is a **validated object** instead of text. The backend constrains output natively
300
+ (Claude `outputFormat`; Codex strict `outputSchema`), then the value is coerced and validated
301
+ client-side (typebox `Convert` → `Check`); on a miss the runner re-prompts a bounded number of
302
+ times before failing with a non-recoverable `SCHEMA_NONCOMPLIANCE`.
303
+
304
+ A **plain JSON Schema object literal** works everywhere (this is the only option inside a script —
305
+ no schema-builder is injected into the realm):
306
+
307
+ ```json
308
+ {
309
+ "type": "object",
310
+ "additionalProperties": false,
311
+ "required": ["title", "score"],
312
+ "properties": {
313
+ "title": { "type": "string" },
314
+ "score": { "type": "number" }
315
+ }
316
+ }
317
+ ```
318
+
319
+ In TypeScript you may instead build the schema with [typebox](https://github.com/sinclairzx81/typebox)
320
+ (`Type.Object({ … })`) for static result typing. Two helpers convert a typebox schema to the exact
321
+ wire JSON Schema each backend expects:
322
+
323
+ ```ts
324
+ import { toJsonSchema, toStrictJsonSchema } from "@automatalabs/workflows";
325
+ import { Type } from "typebox";
326
+
327
+ const schema = Type.Object({ title: Type.String(), score: Type.Number() });
328
+ toJsonSchema(schema); // plain JSON Schema (Claude outputFormat)
329
+ toStrictJsonSchema(schema); // OpenAI-strict-normalized (Codex outputSchema)
330
+ ```
331
+
332
+ ---
333
+
334
+ ## Backend selection
335
+
336
+ The backend for each agent is chosen from its `model` (preferred) or `tier` string:
337
+
338
+ - **Provider prefix** — `anthropic/…` or `claude/…` ⇒ Claude; `openai/…` or `codex/…` ⇒ Codex.
339
+ - **Bare id** — matched by pattern: `codex` / `gpt` / `openai` / `o<digit>` ⇒ Codex;
340
+ `claude` / `opus` / `sonnet` / `haiku` / `anthropic` ⇒ Claude.
341
+ - **No match / no spec** — the default backend: `AGENTPRISM_DEFAULT_BACKEND` (`claude` | `codex`,
342
+ default `claude`).
343
+
344
+ ```ts
345
+ import { selectBackend } from "@automatalabs/workflows";
346
+
347
+ selectBackend({ model: "opus" }).id; // "claude"
348
+ selectBackend({ model: "gpt-5-codex" }).id; // "codex"
349
+ selectBackend({ model: "anthropic/claude-sonnet" }).id; // "claude"
350
+ ```
351
+
352
+ Within a provider, the model spec selects the concrete model on the session (Claude `_meta` model /
353
+ Codex config). Per-backend pool size is `AGENTPRISM_ACP_POOL_SIZE` (or `AcpPoolOptions.size`).
354
+
355
+ ---
356
+
357
+ ## Exports
358
+
359
+ ```ts
360
+ // ── Run entry & helper ──
361
+ runDynamicWorkflow, // (script, { args?, runner?, exec? }) => Promise<WorkflowRunResult>
362
+ runWorkflow, // the bare engine run (no status trio)
363
+ parseWorkflowScript, // parse a script's meta + body
364
+ WorkflowManager, // stateful / resumable run manager
365
+
366
+ // ── ACP backend ──
367
+ createAcpRunner, // () => AcpAgentRunner (the default AgentRunner; has .on(...) events)
368
+ AcpAgentRunner, // class — implements AgentRunner over ACP
369
+ selectBackend, // pick Claude vs Codex from a model/tier spec
370
+ ClaudeBackend, CodexBackend, // the concrete backends
371
+ toJsonSchema, toStrictJsonSchema,
372
+ TypedEventEmitter, // the tiny typed emitter backing runner.on(...)
373
+
374
+ // ── Errors ──
375
+ WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit,
376
+
377
+ // ── Types ──
378
+ RunDynamicWorkflowOptions, WorkflowRunOptions, AgentOptions, ExecOptions,
379
+ WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowSnapshot,
380
+ AcpPoolOptions, AgentRunner, RunOptions, AgentResult, AgentUsage, JournalEntry,
381
+ // ACP events: the runner.on(...) surface
382
+ AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext,
383
+ AcpSessionUpdate, AcpUpdateKind, AcpPermissionEvent, AcpRawMessageEvent, AcpBackendErrorEvent,
384
+ ```
385
+
386
+ (The DSL globals — `agent`, `parallel`, `pipeline`, … — are **not** exported; they are realm
387
+ globals documented by the ambient `dsl.d.ts`.)
388
+
389
+ ---
390
+
391
+ ## See also
392
+
393
+ - **[`@automatalabs/mcp-server`](https://www.npmjs.com/package/@automatalabs/mcp-server)** — the
394
+ stdio MCP server built on this SDK. It wraps the same engine + ACP backend behind a single
395
+ `workflow` tool (bin: `agentprism-workflow`) for any MCP host. Use it when you want the
396
+ **MCP-tool route** instead of embedding the runner in code.
397
+
398
+ ## License
399
+
400
+ Apache-2.0
package/dist/index.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import type { ExecOptions } from "@automatalabs/workflow-engine";
2
2
  import type { AgentRunner, WorkflowRunResult } from "@automatalabs/shared-types";
3
3
  export { runWorkflow, parseWorkflowScript, WorkflowManager } from "@automatalabs/workflow-engine";
4
- export type { WorkflowRunOptions, AgentOptions, ExecOptions, WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, } from "@automatalabs/workflow-engine";
4
+ export type { WorkflowRunOptions, AgentOptions, ExecOptions, WorkflowManagerOptions, CheckpointOptions, WorkflowRunResult, WorkflowSnapshot, } from "@automatalabs/workflow-engine";
5
5
  export { WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit, } from "@automatalabs/workflow-engine";
6
6
  export { createAcpRunner, AcpAgentRunner, selectBackend, ClaudeBackend, CodexBackend, toJsonSchema, toStrictJsonSchema, } from "@automatalabs/acp-agents";
7
7
  export type { AcpPoolOptions } from "@automatalabs/acp-agents";
8
+ export { TypedEventEmitter } from "@automatalabs/acp-agents";
9
+ export type { AcpRunnerEventMap, AcpEventName, AcpEventListener, AcpEventContext, AcpSessionUpdate, AcpUpdateKind, AcpPermissionEvent, AcpRawMessageEvent, AcpBackendErrorEvent, } from "@automatalabs/acp-agents";
8
10
  export type { AgentRunner, RunOptions, AgentResult, AgentUsage } from "@automatalabs/shared-types";
11
+ export type { JournalEntry } from "@automatalabs/shared-types";
9
12
  /** Options for {@link runDynamicWorkflow}. */
10
13
  export interface RunDynamicWorkflowOptions {
11
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIjF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClG,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAI/D,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAEnG,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kGAAkG;IAClG,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAIjF,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,+BAA+B,CAAC;AAClG,YAAY,EACV,kBAAkB,EAClB,YAAY,EACZ,WAAW,EACX,sBAAsB,EACtB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,oBAAoB,GACrB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,EACL,eAAe,EACf,cAAc,EACd,aAAa,EACb,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,kBAAkB,GACnB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAM/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,YAAY,EACV,iBAAiB,EACjB,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,0BAA0B,CAAC;AAIlC,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACnG,YAAY,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAE/D,8CAA8C;AAC9C,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,+EAA+E;IAC/E,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,kGAAkG;IAClG,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,yBAA8B,GACnC,OAAO,CAAC,iBAAiB,CAAC,CAE5B"}
package/dist/index.js CHANGED
@@ -18,6 +18,11 @@ export { WorkflowError, WorkflowErrorCode, isWorkflowError, isProviderUsageLimit
18
18
  // ── ACP backend: the default AgentRunner implementation, backend selection, the
19
19
  // concrete backends, the pool options, and the JSON-Schema helpers. ──
20
20
  export { createAcpRunner, AcpAgentRunner, selectBackend, ClaudeBackend, CodexBackend, toJsonSchema, toStrictJsonSchema, } from "@automatalabs/acp-agents";
21
+ // ── Live ACP events: `createAcpRunner().on("tool_call", evt => …)` to listen in on the
22
+ // stream of a run. The event map keys are ACP `sessionUpdate` discriminants plus a few
23
+ // cross-cutting events; each payload carries a `{ sessionId, backendId, label?, runId? }`
24
+ // context envelope so a pooled runner's concurrent runs are disambiguable. ──
25
+ export { TypedEventEmitter } from "@automatalabs/acp-agents";
21
26
  /**
22
27
  * Run a dynamic workflow script to a TERMINAL result, with the AgentRunner seam
23
28
  * defaulted to the ACP backend.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automatalabs/workflows",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "license": "Apache-2.0",
5
5
  "repository": {
6
6
  "type": "git",
@@ -24,9 +24,9 @@
24
24
  "access": "public"
25
25
  },
26
26
  "dependencies": {
27
- "@automatalabs/shared-types": "0.1.1",
28
- "@automatalabs/workflow-engine": "0.1.1",
29
- "@automatalabs/acp-agents": "0.1.1"
27
+ "@automatalabs/workflow-engine": "0.1.2",
28
+ "@automatalabs/shared-types": "0.1.2",
29
+ "@automatalabs/acp-agents": "0.2.0"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsc -b",