@automatalabs/workflows 0.37.0 → 0.38.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 +20 -9
- package/dist/cli.js +1 -1
- package/dist/config.d.ts +2 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/validate.d.ts +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The programmatic **SDK** for AgentPrism — run dynamic, multi-agent **workflow
|
|
|
6
6
|
|
|
7
7
|
You author a small JavaScript **script** (a string), the engine runs it in a deterministic,
|
|
8
8
|
journaled, resumable realm, and every `agent()` call inside it is fanned out to a pooled ACP
|
|
9
|
-
backend — **Claude** (`claude-agent-acp`), **Codex** (`codex-acp`), **OpenCode** (`opencode acp`),
|
|
9
|
+
backend — **Claude** (`claude-agent-acp`), **Codex** (`codex-acp`), **OpenCode** (`opencode acp`), **pi** (`pi-acp`),
|
|
10
10
|
or a registered custom ACP agent — driving the actual subprocess to completion.
|
|
11
11
|
|
|
12
12
|
This package is the **canonical SDK** that the stdio MCP server
|
|
@@ -28,7 +28,7 @@ through this SDK's workflow/runner APIs rather than MCP server schemas.
|
|
|
28
28
|
pnpm add @automatalabs/workflows
|
|
29
29
|
```
|
|
30
30
|
|
|
31
|
-
> The Claude and
|
|
31
|
+
> The Claude, Codex, and pi ACP servers ship as transitive dependencies and are spawned on demand.
|
|
32
32
|
> OpenCode is host-resolved: install `opencode-ai` or make `opencode` available on `PATH` before
|
|
33
33
|
> routing a call to it.
|
|
34
34
|
|
|
@@ -43,6 +43,7 @@ pnpm add @automatalabs/workflows
|
|
|
43
43
|
environment.
|
|
44
44
|
- **Codex** — a logged-in Codex install (`~/.codex`).
|
|
45
45
|
- **OpenCode** — credentials configured for the provider OpenCode will use.
|
|
46
|
+
- **pi** — a selected provider API key or credentials in `~/.pi/agent/auth.json`.
|
|
46
47
|
|
|
47
48
|
You only need auth for the backend(s) your scripts actually route to. The default backend is
|
|
48
49
|
Claude (override with `AGENTPRISM_DEFAULT_BACKEND`; see [Backend selection](#backend-selection)).
|
|
@@ -296,8 +297,15 @@ checkpoint unless the author opts in. `WorkflowManagerOptions` lets you set a de
|
|
|
296
297
|
`loadSavedWorkflow` resolver (enables nested `workflow('name')`), a custom `persistence`
|
|
297
298
|
implementation, and per-agent timeout/retry defaults.
|
|
298
299
|
|
|
299
|
-
|
|
300
|
-
|
|
300
|
+
Usage-limit and auth resumes are continuation-aware by default on both `resumeFromRunId` and
|
|
301
|
+
same-ID `resume()` / `resumeInBackground()`: when the interrupted root call's index, identity hash,
|
|
302
|
+
full execution-input fingerprint, backend identity, cwd, and reopen support still agree, the manager
|
|
303
|
+
reattaches its recorded ACP session and continues the unfinished turn. Worktree calls, changed or
|
|
304
|
+
legacy inputs, missing cwd, and every uncertain/rejected reopen run fresh. This is internal manager →
|
|
305
|
+
engine plumbing; the public SDK accepts no continuation option.
|
|
306
|
+
|
|
307
|
+
Every terminal result may also carry `fallbacks` (including `kind: "continuation"` notices that
|
|
308
|
+
record a reattached `resume`/`load` method or an exact skip reason) and `checkpointsTaken` (one
|
|
301
309
|
resolved checkpoint per call with the journaled decision and `live` / `headless-default` /
|
|
302
310
|
`journal-replay` / `injected` source). They are absent when empty, persist for cold reads, never
|
|
303
311
|
enter replay hashes, and are not part of `WorkflowRunStatus` inspection.
|
|
@@ -389,7 +397,9 @@ runner names.
|
|
|
389
397
|
Every live ACP-backed `agent()` call records a non-secret re-attach handle in
|
|
390
398
|
`run.agentSessions`. Set `agent(..., { keepSession: true })` to skip release-time `session/close`,
|
|
391
399
|
then use the runner's `loadSession()` or `resumeSession()` host API with that record. Session
|
|
392
|
-
handles are additive and are also preserved in journals;
|
|
400
|
+
handles are additive and are also preserved in journals; pause-class failures skip `session/close`
|
|
401
|
+
automatically, and eligible managed resumes consume the recorded handle internally. A continued
|
|
402
|
+
result carries a diagnostic journal marker, but neither the handle nor marker changes deterministic
|
|
393
403
|
resume identity.
|
|
394
404
|
|
|
395
405
|
### d) Bring your own backend — implement the `AgentRunner` seam
|
|
@@ -658,7 +668,7 @@ npx @automatalabs/workflows config codex opencode # only the named harnesses
|
|
|
658
668
|
npx @automatalabs/workflows config claude --json # machine-readable report
|
|
659
669
|
```
|
|
660
670
|
|
|
661
|
-
Harness names are the routing names: built-in `claude` / `codex` / `opencode` plus any custom
|
|
671
|
+
Harness names are the routing names: built-in `claude` / `codex` / `opencode` / `pi` plus any custom
|
|
662
672
|
backend registered via `AGENTPRISM_BACKENDS` (registered customs also join the no-argument
|
|
663
673
|
default set). Each harness opens one session without a prompt — zero tokens — and reports its
|
|
664
674
|
advertised config-option catalog verbatim: model ids (including bracket variants), effort
|
|
@@ -687,7 +697,7 @@ formatHarnessConfigReport(report); // the CLI's human table
|
|
|
687
697
|
|
|
688
698
|
Pass a JSON Schema to `agent({ schema })` (in a script) or `runner.run(prompt, { schema })` (direct)
|
|
689
699
|
and the result is a **validated object** instead of text. The backend constrains output natively
|
|
690
|
-
(Claude `outputFormat`; Codex strict `outputSchema`; prompt/tool-assisted JSON for OpenCode and
|
|
700
|
+
(Claude `outputFormat`; Codex strict `outputSchema`; pi native `_meta.outputSchema`; prompt/tool-assisted JSON for OpenCode and
|
|
691
701
|
custom agents), then the value is coerced and validated client-side (typebox `Convert` → `Check`); on a miss the runner re-prompts a bounded number of
|
|
692
702
|
times before failing with a non-recoverable `SCHEMA_NONCOMPLIANCE`.
|
|
693
703
|
|
|
@@ -725,7 +735,7 @@ toStrictJsonSchema(schema); // OpenAI-strict-normalized (Codex outputSchema)
|
|
|
725
735
|
|
|
726
736
|
The backend for each agent is chosen from its effective `model` (preferred) or `tier` string. Split
|
|
727
737
|
the string on its first `/`. If the first segment, ASCII-case-insensitively, is `claude`, `codex`,
|
|
728
|
-
`opencode`, or a registered custom backend name, it selects that harness and is stripped exactly
|
|
738
|
+
`opencode`, `pi`, or a registered custom backend name, it selects that harness and is stripped exactly
|
|
729
739
|
once; a custom registration wins on a built-in-name collision. A registered harness name alone is
|
|
730
740
|
backend-only and preserves that harness's configured default model. Any other first segment sends
|
|
731
741
|
the entire authored string unchanged to `AGENTPRISM_DEFAULT_BACKEND` (default `claude`). Omitting
|
|
@@ -737,6 +747,7 @@ import { selectBackend } from "@automatalabs/workflows";
|
|
|
737
747
|
selectBackend({ model: "claude/opus[1m]" }).id; // "claude"
|
|
738
748
|
selectBackend({ model: "codex/gpt-5.6-sol" }).id; // "codex"
|
|
739
749
|
selectBackend({ model: "opencode/zai/glm-5.2" }).id; // "opencode"
|
|
750
|
+
selectBackend({ model: "pi/openrouter/vendor/model" }).id; // "pi"
|
|
740
751
|
```
|
|
741
752
|
|
|
742
753
|
When an id remains after routing, it becomes the exact ACP `session/set_config_option` value
|
|
@@ -779,7 +790,7 @@ createAcpRunner, // () => AcpAgentRunner (the default AgentRunner;
|
|
|
779
790
|
AcpAgentRunner, // class — implements AgentRunner over ACP
|
|
780
791
|
InteractiveSession, // held-open multi-turn ACP session returned by openSession()
|
|
781
792
|
selectBackend, // pick a built-in/custom backend from a model/tier spec
|
|
782
|
-
ClaudeBackend, CodexBackend, CustomAcpBackend,
|
|
793
|
+
ClaudeBackend, CodexBackend, OpenCodeBackend, PiBackend, CustomAcpBackend,
|
|
783
794
|
resolveBackendRegistry, BACKENDS_ENV,
|
|
784
795
|
AGENT_METHODS, CLIENT_METHODS, ACP_AUTH_REQUIRED_ERROR_CODE,
|
|
785
796
|
clientCapabilitiesFor, adaptPromptContent,
|
package/dist/cli.js
CHANGED
|
@@ -75,7 +75,7 @@ and every other session option — by opening one no-prompt session per harness.
|
|
|
75
75
|
tokens. Run this BEFORE authoring a workflow so \`model\` / \`configOptions\` values come
|
|
76
76
|
from the live catalog instead of guesswork (or a throwaway probe workflow).
|
|
77
77
|
|
|
78
|
-
Harnesses: the built-in names (claude, codex, opencode) and any custom backend
|
|
78
|
+
Harnesses: the built-in names (claude, codex, opencode, pi) and any custom backend
|
|
79
79
|
registered via the AGENTPRISM_BACKENDS env var. Default: all of them. A harness that
|
|
80
80
|
cannot spawn or authenticate reports \`probed: false\` with the reason and never blocks
|
|
81
81
|
the others.
|
package/dist/config.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { CustomBackendConfig } from "@automatalabs/acp-agents";
|
|
2
2
|
import type { ValidateHarnessOptions } from "./validate.js";
|
|
3
3
|
export interface ProbeHarnessConfigOptions {
|
|
4
|
-
/** Harness names to probe (built-in `claude` / `codex` / `opencode` or a registered
|
|
4
|
+
/** Harness names to probe (built-in `claude` / `codex` / `opencode` / `pi` or a registered
|
|
5
5
|
* custom name; any model spec routes like an agent() call's). Default: every routable
|
|
6
|
-
* harness — the
|
|
6
|
+
* harness — the four built-ins plus each registered custom backend. */
|
|
7
7
|
harnesses?: string[];
|
|
8
8
|
/** Programmatic custom-backend registry, merged over the AGENTPRISM_BACKENDS env var
|
|
9
9
|
* exactly like `createAcpRunner({ backends })`. */
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,WAAW,yBAAyB;IACxC;;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAGpE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAE5D,MAAM,WAAW,yBAAyB;IACxC;;4EAEwE;IACxE,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB;wDACoD;IACpD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC/C;yEACqE;IACrE,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;+CAC2C;IAC3C,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,EAAE,EAAE,OAAO,CAAC;IACZ,qDAAqD;IACrD,QAAQ,EAAE,CAAC,GAAG,CAAC,CAAC;IAChB,2FAA2F;IAC3F,cAAc,EAAE,sBAAsB,EAAE,CAAC;CAC1C;AAKD;;;;;GAKG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,GAAE,yBAA8B,GACtC,OAAO,CAAC,mBAAmB,CAAC,CAoC9B;AAED,+FAA+F;AAC/F,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAU7E"}
|
package/dist/config.js
CHANGED
|
@@ -9,7 +9,7 @@ import { redactText } from "@automatalabs/workflow-engine";
|
|
|
9
9
|
import { resolveBackendRegistry } from "@automatalabs/acp-agents";
|
|
10
10
|
import { createValidateProbeRunner } from "./validate-internal.js";
|
|
11
11
|
import { renderHarnessOptionLines } from "./validate.js";
|
|
12
|
-
const BUILTIN_HARNESSES = ["claude", "codex", "opencode"];
|
|
12
|
+
const BUILTIN_HARNESSES = ["claude", "codex", "opencode", "pi"];
|
|
13
13
|
const DEFAULT_PROBE_TIMEOUT_MS = 60_000;
|
|
14
14
|
/**
|
|
15
15
|
* Probe each requested harness's advertised config-option catalog. A per-harness
|
package/dist/validate.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export interface ValidatedAgentCall {
|
|
|
67
67
|
mode?: string;
|
|
68
68
|
/** The verbatim session config options authored for this call. */
|
|
69
69
|
configOptions?: Record<string, string | boolean>;
|
|
70
|
-
/** Which concrete backend the spec routes to: "claude" | "codex" | "opencode" | a custom
|
|
70
|
+
/** Which concrete backend the spec routes to: "claude" | "codex" | "opencode" | "pi" | a custom
|
|
71
71
|
* backend name (suffixed " (script-declared)" when it comes from meta.backends). */
|
|
72
72
|
backend: string;
|
|
73
73
|
/** True when the call requested structured output. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@automatalabs/workflows",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.38.0",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=22"
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"typebox": "1.3.2",
|
|
34
|
-
"@automatalabs/shared-types": "0.
|
|
35
|
-
"@automatalabs/
|
|
36
|
-
"@automatalabs/
|
|
34
|
+
"@automatalabs/shared-types": "0.24.0",
|
|
35
|
+
"@automatalabs/workflow-engine": "0.26.0",
|
|
36
|
+
"@automatalabs/acp-agents": "0.30.0"
|
|
37
37
|
},
|
|
38
38
|
"scripts": {
|
|
39
39
|
"build": "tsc -b",
|