@agent-compose/sdk 0.8.0 → 0.8.2

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.
Files changed (44) hide show
  1. package/dist/agent/agent-context.d.ts +1 -1
  2. package/dist/agent/agent-loop.d.ts +8 -0
  3. package/dist/agent/run-agent.d.ts +4 -0
  4. package/dist/client.d.ts +77 -15
  5. package/dist/display.d.ts +16 -0
  6. package/dist/index.d.ts +6 -6
  7. package/dist/index.js +522 -123
  8. package/dist/runtimes/_cli-agent.d.ts +34 -7
  9. package/dist/runtimes/claude-code.d.ts +10 -8
  10. package/dist/runtimes/codex.buildcommand.test.d.ts +9 -0
  11. package/dist/runtimes/codex.d.ts +4 -1
  12. package/dist/runtimes/openai-desktop.js +507 -122
  13. package/dist/sandbox/sizes.d.ts +120 -30
  14. package/dist/sandbox.d.ts +1 -1
  15. package/dist/types/api-conversations.d.ts +198 -0
  16. package/dist/types/api-factory.d.ts +84 -7
  17. package/dist/types/api-runs.d.ts +48 -2
  18. package/dist/types/protocol.d.ts +8 -0
  19. package/dist/types/workflow-metadata.d.ts +14 -5
  20. package/dist/utils/bundler.d.ts +56 -0
  21. package/dist/workflow-steps/workflow.d.ts +7 -0
  22. package/dist/workflows/invoke-child.d.ts +18 -0
  23. package/dist/workflows/invoke-child.test.d.ts +9 -0
  24. package/package.json +2 -2
  25. package/src/agent/agent-context.ts +28 -17
  26. package/src/agent/agent-loop.ts +9 -0
  27. package/src/agent/run-agent.ts +5 -0
  28. package/src/client.ts +201 -30
  29. package/src/display.ts +61 -15
  30. package/src/index.ts +22 -9
  31. package/src/runtimes/_cli-agent.ts +302 -63
  32. package/src/runtimes/claude-code.ts +25 -15
  33. package/src/runtimes/codex.ts +19 -5
  34. package/src/sandbox/providers/e2b.ts +8 -4
  35. package/src/sandbox/sizes.ts +127 -44
  36. package/src/sandbox.ts +8 -0
  37. package/src/types/api-conversations.ts +180 -0
  38. package/src/types/api-factory.ts +89 -7
  39. package/src/types/api-runs.ts +50 -2
  40. package/src/types/protocol.ts +8 -0
  41. package/src/types/workflow-metadata.ts +15 -5
  42. package/src/utils/bundler.ts +213 -3
  43. package/src/workflow-steps/workflow.ts +7 -0
  44. package/src/workflows/invoke-child.ts +47 -11
@@ -25,6 +25,31 @@
25
25
  */
26
26
  import type { AgentMessage, ModelExecutionContract, RuntimeOptions, SandboxProvider, ToolCallGateResult } from "../index.js";
27
27
  import type { ProcessorContext, ToolCall } from "../processors/processor.js";
28
+ /** Backoff between tail re-attach attempts after a mid-turn stream fault
29
+ * (durable detached transport). Short: the runner is alive and producing,
30
+ * and each retry costs one exec; the executor's evidence machinery — not
31
+ * this loop — bounds a truly dead sandbox. Exported for tests. */
32
+ export declare const TAIL_REATTACH_DELAY_MS = 2000;
33
+ /** Provider deadline on the detached LAUNCH exec. The launch shell only
34
+ * truncates the durable files, forks the detached runner (stdio fully
35
+ * redirected — see the launch command), writes the pidfile, and echoes the
36
+ * pid — sub-second work, so 30s is generous headroom for a slow envd, not a
37
+ * budget the runner ever consumes. Exported for tests. */
38
+ export declare const LAUNCH_EXEC_TIMEOUT_MS = 30000;
39
+ /** How many times (and how spaced) a THROWN launch exec falls back to reading
40
+ * the durable pidfile before the fault is surfaced. A deadlined/canceled
41
+ * launch STREAM does not mean the launch failed — the detached tree may be
42
+ * up and working — so the pid is recovered over the envd HTTP file
43
+ * transport (immune to the command-stream fault) and the turn proceeds.
44
+ * Only "no pidfile after these attempts" is a real launch failure.
45
+ * Exported for tests. */
46
+ export declare const LAUNCH_PID_RECOVERY_ATTEMPTS = 3;
47
+ export declare const LAUNCH_PID_RECOVERY_DELAY_MS = 1000;
48
+ /** Explicit deadline on the `command -v` install probe. E2B's default command
49
+ * deadline (60s) throws the deadline_exceeded TimeoutError — every provider
50
+ * call in the turn path carries an explicit timeout so no SDK default can
51
+ * decide a turn's fate. Exported for tests. */
52
+ export declare const INSTALL_PROBE_TIMEOUT_MS = 30000;
28
53
  /** Single-quote a value for safe interpolation into a `sh -c` command line. */
29
54
  export declare function shellQuote(value: string): string;
30
55
  /**
@@ -69,13 +94,15 @@ export declare const ACP_TURN_IDLE_TIMEOUT_MS: number;
69
94
  * implements duplex) falls back to JSONL cleanly via the capability check in
70
95
  * `sendMessage`. */
71
96
  export declare const ACP_TRANSPORT_READY = true;
72
- /** Reasoning-effort level a CLI turn may carry (T2 session effort). The
73
- * per-CLI mapping lives in each spec's `buildCommand` — Claude Code takes a
74
- * thinking-token budget via `MAX_THINKING_TOKENS`, codex takes
75
- * `-c model_reasoning_effort=<level>`. Specs without a real knob
76
- * (opencode/droid/cursor) never receive one: the server hides + rejects
77
- * effort for those runtimes. */
78
- export type CliReasoningEffort = "low" | "medium" | "high";
97
+ /** Reasoning-effort level a CLI turn may carry (T2 session effort) — the
98
+ * UNION of what the effort-capable CLIs accept. The per-CLI mapping lives in
99
+ * each spec's `buildCommand` — Claude Code takes its own `--effort` flag
100
+ * (all five levels), codex takes `-c model_reasoning_effort=<level>`
101
+ * (low|medium|high|xhigh — no "max"; the spec clamps it). Specs without a
102
+ * real knob (opencode/droid/cursor) never receive one: the server hides +
103
+ * rejects effort for those runtimes, and rejects levels a runtime lacks
104
+ * (sessionEffortLockError). */
105
+ export type CliReasoningEffort = "low" | "medium" | "high" | "xhigh" | "max";
79
106
  /** Per-CLI behaviour. The base owns the lifecycle (init/done/error) and the
80
107
  * transport (spawn + JSONL parse); a spec owns the CLI-specific bits. */
81
108
  export interface CliAgentSpec {
@@ -40,18 +40,20 @@ import { type CliAgentSpec, type CliReasoningEffort } from "./_cli-agent.js";
40
40
  * bridge daemon (cli/src/bridge/acp.ts) imports this same pin so both
41
41
  * executors launch the identical adapter. Verified against 0.16.2. */
42
42
  export declare const CLAUDE_CODE_ACP_ADAPTER = "@zed-industries/claude-code-acp@0.16.2";
43
- /** Extended-thinking token budget per effort level — Claude Code's real knob
44
- * is the `MAX_THINKING_TOKENS` env var (its documented settings env), set
45
- * per invocation below. Values mirror the platform turn loop's
46
- * `EFFORT_BUDGET_TOKENS` (server model-client) so "high" means the same
47
- * thing in a channel and in a claude-code session. */
48
- export declare const CLAUDE_CODE_THINKING_TOKENS: Record<CliReasoningEffort, number>;
43
+ /** Claude Code's real reasoning knob is its own `--effort <level>` flag
44
+ * (low|medium|high|xhigh|max — verified against `claude -p --help`). The
45
+ * CliReasoningEffort union IS the CLI's vocabulary, so the level rides the
46
+ * flag verbatim; the CLI itself downgrades a level the selected model lacks
47
+ * (its documented behaviour, e.g. xhigh → high off Opus). The old
48
+ * `MAX_THINKING_TOKENS` env mapping is gone: the CLI deprecated it (treated
49
+ * as on/off on current models) and it could never express xhigh/max. */
50
+ export declare const CLAUDE_CODE_EFFORT_LEVELS: readonly CliReasoningEffort[];
49
51
  export declare const claudeCodeSpec: CliAgentSpec;
50
52
  export interface ClaudeCodeRuntimeConfig {
51
53
  /** Claude model id (`--model`). Omit to use the CLI's configured default. */
52
54
  model?: string;
53
- /** Extended-thinking effort (`MAX_THINKING_TOKENS`). Omit for the CLI's
54
- * default behaviour (no forced budget). */
55
+ /** Reasoning effort (`--effort <level>`; the CLI accepts all five levels).
56
+ * Omit for the CLI's default behaviour. */
55
57
  effort?: CliReasoningEffort;
56
58
  }
57
59
  export declare function createClaudeCodeRuntime(config?: ClaudeCodeRuntimeConfig): import("../index.js").AgentRuntime<import("../sandbox.js").SandboxProvider>;
@@ -0,0 +1,9 @@
1
+ /**
2
+ * codexSpec.buildCommand — the in-sandbox `codex exec --json` invocation for
3
+ * cloud codex sessions. Regression pin for the resume `-C` bug: the working
4
+ * directory rides a shell `cd` (like every other runtime), NOT codex's `-C`
5
+ * flag, because `-C` is accepted by `codex exec` but REJECTED by
6
+ * `codex exec resume` ("unexpected argument '-C'") — so a fresh turn worked
7
+ * and every follow-up died with exit code 2.
8
+ */
9
+ export {};
@@ -20,12 +20,15 @@ export declare function isCodexAdvisoryNoise(text: string): boolean;
20
20
  * `mapEvent` is the golden the ACP normaliser is asserted equal to. Not part
21
21
  * of the public runtime surface — `createCodexRuntime` stays the entry point. */
22
22
  export declare const codexSpec: CliAgentSpec;
23
+ /** The effort levels codex actually has (`model_reasoning_effort`):
24
+ * low|medium|high|xhigh — no "max" (that level is Claude Code's alone). */
25
+ export type CodexReasoningEffort = Exclude<CliReasoningEffort, "max">;
23
26
  export interface CodexRuntimeConfig {
24
27
  /** Codex model id (`-m`). Omit to use the codex CLI's configured default. */
25
28
  model?: string;
26
29
  /** Reasoning effort (`-c model_reasoning_effort=<level>`). Omit to use the
27
30
  * codex CLI's configured default. */
28
- effort?: CliReasoningEffort;
31
+ effort?: CodexReasoningEffort;
29
32
  }
30
33
  export declare function createCodexRuntime(config?: CodexRuntimeConfig): import("../index.js").AgentRuntime<import("../sandbox.js").SandboxProvider>;
31
34
  declare const _default: import("../index.js").AgentRuntime<import("../sandbox.js").SandboxProvider>;