@agent-compose/sdk 0.5.5 → 0.5.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.
- package/README.md +4 -4
- package/dist/agent/agent-loop-contract.test.d.ts +1 -0
- package/dist/agent/agent-loop.d.ts +1 -1
- package/dist/client.d.ts +65 -23
- package/dist/index.d.ts +4 -2
- package/dist/index.js +389 -109
- package/dist/runtimes/_cli-agent.d.ts +25 -8
- package/dist/runtimes/amp.d.ts +7 -6
- package/dist/runtimes/claude.d.ts +9 -1
- package/dist/runtimes/cli-agent.test.d.ts +9 -0
- package/dist/runtimes/codex.d.ts +6 -5
- package/dist/runtimes/openai-desktop.js +387 -109
- package/dist/sandbox-errors.d.ts +49 -0
- package/dist/sandbox.d.ts +68 -13
- package/dist/step-invocation/protocol.d.ts +6 -0
- package/dist/types/sandbox-environment.d.ts +1 -10
- package/dist/types/sandbox.d.ts +27 -3
- package/dist/types/workflow-metadata.d.ts +88 -23
- package/dist/types/workflow.d.ts +38 -10
- package/dist/utils/bundler.d.ts +38 -9
- package/dist/workflow-steps/workflow.d.ts +1 -3
- package/package.json +2 -2
- package/src/agent/agent-loop.ts +56 -7
- package/src/client.ts +144 -25
- package/src/index.ts +4 -2
- package/src/runtimes/_cli-agent.ts +75 -42
- package/src/runtimes/amp.ts +11 -6
- package/src/runtimes/claude.ts +66 -8
- package/src/runtimes/codex.ts +10 -5
- package/src/sandbox-errors.ts +53 -0
- package/src/sandbox.ts +378 -56
- package/src/step-invocation/invoker.ts +66 -8
- package/src/step-invocation/protocol.ts +9 -0
- package/src/step-invocation/server.ts +27 -4
- package/src/types/sandbox-environment.ts +1 -11
- package/src/types/sandbox.ts +28 -3
- package/src/types/workflow-metadata.ts +97 -26
- package/src/types/workflow.ts +38 -11
- package/src/utils/bundler.ts +43 -13
- package/src/workflow-steps/workflow.ts +1 -3
|
@@ -12,14 +12,16 @@
|
|
|
12
12
|
* AsyncQueue bridge → init/usage/done/error lifecycle), parameterised per-CLI
|
|
13
13
|
* by a `CliAgentSpec`.
|
|
14
14
|
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
15
|
+
* Provisioning (per spec): the runtime installs the provider CLI on demand —
|
|
16
|
+
* `command -v <bin>` before the first turn, falling back to the spec's
|
|
17
|
+
* `install` command when it's absent — so it works on a bare sandbox with no
|
|
18
|
+
* manual setup or hardcoded snapshot id. Pair it with
|
|
19
|
+
* `snapshots: { bootFrom: "reuse" }` on the workflow and the install happens
|
|
20
|
+
* exactly once: the first run installs the CLI and captures a snapshot, and
|
|
21
|
+
* every run after boots from that snapshot with the CLI already present (the
|
|
22
|
+
* probe short-circuits). The provider's API key must be in the sandbox env
|
|
23
|
+
* (see each spec's `authEnv`); `commands.run` inherits the sandbox env, so
|
|
24
|
+
* values set via `agentc secrets set` are visible to the CLI.
|
|
23
25
|
*/
|
|
24
26
|
import type { AgentMessage, ModelExecutionContract, RuntimeOptions, SandboxProvider } from "../index.js";
|
|
25
27
|
/** Single-quote a value for safe interpolation into a `sh -c` command line. */
|
|
@@ -34,6 +36,15 @@ export interface CliAgentSpec {
|
|
|
34
36
|
authEnv: string;
|
|
35
37
|
/** Default model id when none is configured; omit to let the CLI choose. */
|
|
36
38
|
defaultModel?: string;
|
|
39
|
+
/** Binary the runtime spawns (`codex`, `amp`). Probed with `command -v`
|
|
40
|
+
* before the first turn; if absent, `install` provisions it. */
|
|
41
|
+
bin: string;
|
|
42
|
+
/** Shell command that installs `bin` when it's missing from the sandbox.
|
|
43
|
+
* Runs at most once per runner, and only when the probe fails — so booting
|
|
44
|
+
* from a snapshot that already has the CLI (the steady state under
|
|
45
|
+
* `snapshots: { bootFrom: "reuse" }`) skips it. Must leave `bin` resolvable
|
|
46
|
+
* on a non-login shell's PATH (the runtime spawns via `sh -c`). */
|
|
47
|
+
install: string;
|
|
37
48
|
/** Serialise the user prompt into the bytes written to the prompt file —
|
|
38
49
|
* plain text for a CLI that reads the prompt from stdin (codex `-`), or a
|
|
39
50
|
* JSONL user message for a `--stream-json-input` CLI (amp). */
|
|
@@ -62,6 +73,12 @@ export declare class CliAgentRunner implements ModelExecutionContract {
|
|
|
62
73
|
readonly kind: string;
|
|
63
74
|
constructor(sandbox: SandboxProvider, options: RuntimeOptions, spec: CliAgentSpec, configModel?: string | undefined);
|
|
64
75
|
get model(): string | undefined;
|
|
76
|
+
private installed;
|
|
77
|
+
/** Provision the CLI on demand. A no-op once `bin` is on PATH — the steady
|
|
78
|
+
* state under `snapshots: { bootFrom: "reuse" }`, where the first run's
|
|
79
|
+
* install is baked into the snapshot every later run boots from. So the
|
|
80
|
+
* install command runs exactly once: on the first run of a content hash. */
|
|
81
|
+
private ensureInstalled;
|
|
65
82
|
sendMessage(opts: {
|
|
66
83
|
prompt: string;
|
|
67
84
|
sessionId?: string;
|
package/dist/runtimes/amp.d.ts
CHANGED
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
* own loop + tools, so we only stream-parse what it prints.
|
|
6
6
|
*
|
|
7
7
|
* Auth: set `AMP_API_KEY` (`sgamp_…`) in the sandbox env via a workflow secret.
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* the
|
|
8
|
+
* The runtime installs the `amp` CLI (`@ampcode/cli`) on demand — no image
|
|
9
|
+
* baking needed; pair with `snapshots: { bootFrom: "reuse" }` to install once
|
|
10
|
+
* and boot from the captured snapshot on every run after. The model is chosen
|
|
11
|
+
* by the AMP_API_KEY account (e.g. a GPT-only token runs GPT); the runtime
|
|
12
|
+
* doesn't pin a model.
|
|
11
13
|
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* before production use.
|
|
14
|
+
* Verified against a live `amp -x --stream-json` run: the user-message stdin
|
|
15
|
+
* shape, assistant content blocks, and result usage below all round-trip.
|
|
15
16
|
*/
|
|
16
17
|
export interface AmpRuntimeConfig {
|
|
17
18
|
/** Amp uses its configured model; reserved for forward-compatibility. */
|
|
@@ -7,7 +7,11 @@ export interface ClaudeRuntimeConfig {
|
|
|
7
7
|
claudeMdContent?: string;
|
|
8
8
|
/** Env overrides for Agent SDK provider routing. */
|
|
9
9
|
env?: Record<string, string>;
|
|
10
|
-
/** Model to use.
|
|
10
|
+
/** Model to use. Accepts a caliber shorthand — "fable" (most capable),
|
|
11
|
+
* "opus", "sonnet", "haiku" (fastest/cheapest) — or an exact model id.
|
|
12
|
+
* Defaults to DEFAULT_CLAUDE_MODEL (Fable). Orchestrators pick a caliber
|
|
13
|
+
* per agent: fable/opus for planning + implementation, sonnet for focused
|
|
14
|
+
* single-responsibility work, haiku for mechanical tasks. */
|
|
11
15
|
model?: string;
|
|
12
16
|
/** MCP servers to configure for the Agent SDK. */
|
|
13
17
|
mcpServers?: Record<string, {
|
|
@@ -21,6 +25,10 @@ export interface ClaudeRuntimeConfig {
|
|
|
21
25
|
thinking?: ThinkingConfig;
|
|
22
26
|
/** Reasoning effort hint for models that support adaptive thinking. */
|
|
23
27
|
effort?: "low" | "medium" | "high" | "xhigh" | "max";
|
|
28
|
+
/** Skills to enable for the agent (the Agent SDK's `skills` option — also
|
|
29
|
+
* auto-adds the `Skill` tool). The agent-env bakes the `/ac:*` skills via
|
|
30
|
+
* `agentc init`; default `"all"` makes them usable. Pass `[]` to disable. */
|
|
31
|
+
skills?: string[] | "all";
|
|
24
32
|
}
|
|
25
33
|
export declare class ClaudeRunner implements ModelExecutionContract {
|
|
26
34
|
private readonly options;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CliAgentRunner self-provisioning — the runtime installs its CLI on demand
|
|
3
|
+
* (`command -v <bin>` → install if missing), runs the install at most once per
|
|
4
|
+
* runner, and surfaces an install failure as an `error` message rather than
|
|
5
|
+
* blowing up. This is what lets `createCodexRuntime()` work on a bare sandbox
|
|
6
|
+
* with no image baking, and lets `snapshots: { bootFrom: "reuse" }` collapse
|
|
7
|
+
* the install to a one-time cost.
|
|
8
|
+
*/
|
|
9
|
+
export {};
|
package/dist/runtimes/codex.d.ts
CHANGED
|
@@ -4,12 +4,13 @@
|
|
|
4
4
|
* Built on the shared CLI-agent base; Codex brings its own loop + tools, so we
|
|
5
5
|
* only stream-parse what it prints.
|
|
6
6
|
*
|
|
7
|
-
* Auth: set `
|
|
8
|
-
* workflow secret.
|
|
7
|
+
* Auth: set `OPENAI_API_KEY` (or `CODEX_API_KEY`) in the sandbox env via a
|
|
8
|
+
* workflow secret. The runtime installs the `codex` CLI (`@openai/codex`) on
|
|
9
|
+
* demand — no image baking needed; pair with `snapshots: { bootFrom: "reuse" }`
|
|
10
|
+
* to install once and boot from the captured snapshot on every run after.
|
|
9
11
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* (developers.openai.com/codex/noninteractive). Verify before production use.
|
|
12
|
+
* Verified against codex-cli 0.124.0: `codex exec --json` + resume-by-thread,
|
|
13
|
+
* with the command_execution / reasoning / agent_message item shapes below.
|
|
13
14
|
*/
|
|
14
15
|
export interface CodexRuntimeConfig {
|
|
15
16
|
/** Codex model id (`-m`). Omit to use the codex CLI's configured default. */
|