coding-agents-sdk 0.10.0 → 0.12.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.
Files changed (84) hide show
  1. package/README.md +12 -9
  2. package/dist/Agent-4TZ8JK66.mjs +4 -0
  3. package/dist/{SdkAgent-DQfLwPwY.mjs → SdkAgent-p0nJ6dWV.mjs} +1 -1
  4. package/dist/adapters/claude-code-cli/index.d.mts +2 -2
  5. package/dist/adapters/claude-code-cli/index.mjs +1 -1
  6. package/dist/adapters/claude-code-cli-pty/index.d.mts +3 -0
  7. package/dist/adapters/claude-code-cli-pty/index.mjs +35 -0
  8. package/dist/adapters/claude-code-sdk/index.d.mts +2 -2
  9. package/dist/adapters/claude-code-sdk/index.mjs +4 -4
  10. package/dist/adapters/codex-cli/index.d.mts +2 -2
  11. package/dist/adapters/codex-cli/index.mjs +2 -2
  12. package/dist/adapters/codex-sdk/index.d.mts +2 -2
  13. package/dist/adapters/codex-sdk/index.mjs +1 -1
  14. package/dist/adapters/cursor-cli/index.d.mts +2 -2
  15. package/dist/adapters/cursor-cli/index.mjs +1 -1
  16. package/dist/adapters/cursor-sdk/index.d.mts +2 -2
  17. package/dist/adapters/cursor-sdk/index.mjs +1 -1
  18. package/dist/adapters/gemini-cli/index.d.mts +2 -2
  19. package/dist/adapters/gemini-cli/index.mjs +1 -1
  20. package/dist/adapters/opencode-cli/index.d.mts +2 -2
  21. package/dist/adapters/opencode-cli/index.mjs +1 -1
  22. package/dist/adapters/pi-cli/index.d.mts +2 -2
  23. package/dist/adapters/pi-cli/index.mjs +1 -1
  24. package/dist/{classify-error-BcWmNftw.mjs → classify-error-BPQtzEVV.mjs} +4 -4
  25. package/dist/container/index.d.mts +2 -2
  26. package/dist/container/index.mjs +1 -1
  27. package/dist/{container-D31bbA4L.mjs → container-46QA1d3v.mjs} +1 -1
  28. package/dist/container-DBXaA-Iv.mjs +1 -0
  29. package/dist/container-DRj7xq5x.mjs +1 -0
  30. package/dist/{container-BhXUiAiK.mjs → container-Dg68bfte.mjs} +1 -1
  31. package/dist/{container-TizHce_7.mjs → container-gJ8B-Z5B.mjs} +1 -1
  32. package/dist/diff-BJWXJsjx.mjs +1 -0
  33. package/dist/{events-Dd9r9luo.d.mts → events-B0BpIsW2.d.mts} +143 -4
  34. package/dist/execution-target-CdlYXh6Z.mjs +1 -0
  35. package/dist/index-5bx9TIY_.d.mts +60 -0
  36. package/dist/index-B5NFoNlS.d.mts +195 -0
  37. package/dist/index-B9ze9hTN.d.mts +97 -0
  38. package/dist/{index-DZDlHIep.d.mts → index-BKK-3gye.d.mts} +44 -13
  39. package/dist/{index-J7V9dJTb.d.mts → index-BQ8cUo2i.d.mts} +50 -19
  40. package/dist/index-C9XD71QR.d.mts +429 -0
  41. package/dist/{index-B-rto_J2.d.mts → index-CG2m7pFJ.d.mts} +77 -1
  42. package/dist/index-CG5DS_NB.d.mts +58 -0
  43. package/dist/index-DPP4zoiJ.d.mts +68 -0
  44. package/dist/{index-BNeL0BbU.d.mts → index-DdyD2ji1.d.mts} +68 -2
  45. package/dist/index-DzFF15zC.d.mts +104 -0
  46. package/dist/index-XWqpUSBc.d.mts +69 -0
  47. package/dist/index.d.mts +69 -16
  48. package/dist/index.mjs +1 -1
  49. package/dist/oci-DmEG3Ia3.mjs +1 -0
  50. package/dist/{parser-BBJPNGZ2.mjs → parser-Dz239_vv.mjs} +2 -2
  51. package/dist/sandbox/index.d.mts +2 -2
  52. package/dist/sandbox/index.mjs +1 -1
  53. package/dist/sandbox-C5vzNxZR.mjs +4 -0
  54. package/dist/schemas/index.d.mts +1 -1
  55. package/dist/schemas/index.mjs +1 -1
  56. package/dist/spawner-BB6W3FVi.mjs +1 -0
  57. package/dist/types-CGzSzwfB.d.mts +476 -0
  58. package/dist/util-DcPzh_0u.mjs +1 -0
  59. package/package.json +24 -24
  60. package/dist/Agent-BD2xHVi0.mjs +0 -4
  61. package/dist/adapters/claude-cli-pty/index.d.mts +0 -3
  62. package/dist/adapters/claude-cli-pty/index.mjs +0 -7
  63. package/dist/container-BurV5WG9.mjs +0 -1
  64. package/dist/diff-DWM1ciiV.mjs +0 -1
  65. package/dist/errors-CeKI_bYK.mjs +0 -1
  66. package/dist/execution-target-CGTSqVEP.mjs +0 -1
  67. package/dist/index-B4RAMnx_.d.mts +0 -46
  68. package/dist/index-BdDz7C4J.d.mts +0 -39
  69. package/dist/index-BiWkGgnz.d.mts +0 -46
  70. package/dist/index-BllemWbi.d.mts +0 -42
  71. package/dist/index-C7J_hmQs.d.mts +0 -67
  72. package/dist/index-CaUzD36R.d.mts +0 -42
  73. package/dist/index-D-8EmRnQ.d.mts +0 -85
  74. package/dist/index-lGZ1lQkG.d.mts +0 -246
  75. package/dist/oci-tjdSZfTm.mjs +0 -1
  76. package/dist/sandbox-_As0qZWn.mjs +0 -4
  77. package/dist/spawner-BJesLc8I.mjs +0 -1
  78. package/dist/types-D6kxBNzj.d.mts +0 -195
  79. package/dist/util-CGg8cK92.mjs +0 -1
  80. /package/dist/{env-DIXTVzTs.mjs → env-Cb8MIvH7.mjs} +0 -0
  81. /package/dist/{schemas-mNF2Xlg_.mjs → schemas-CkdQXAep.mjs} +0 -0
  82. /package/dist/{shell-Dewbmt9R.mjs → shell-DvWFuFKb.mjs} +0 -0
  83. /package/dist/{structured-output-nPFh_ZoY.mjs → structured-output-cpLrrrTN.mjs} +0 -0
  84. /package/dist/{types-CwvWHEpy.mjs → types-B72tDMEZ.mjs} +0 -0
@@ -0,0 +1,195 @@
1
+ import { A as ProcessSpawner } from "./types-CGzSzwfB.mjs";
2
+ import { X as VolumeMount } from "./index-C9XD71QR.mjs";
3
+
4
+ //#region src/sandbox/types.d.ts
5
+ /** Which sandbox binary backs the policy. The binary must be installed on the host. */
6
+ type SandboxType = "bubblewrap" | "firejail" | "nsjail";
7
+ /** Lifecycle state of a sandbox. */
8
+ type SandboxStatus = "created" | "disposed" | "running" | "stopped";
9
+ /** Fields shared by every sandbox config. */
10
+ interface SandboxConfigBase<TType extends SandboxType> {
11
+ type: TType;
12
+ /** Working directory the wrapped agent process operates against. */
13
+ workdir: string;
14
+ }
15
+ /** Identity facet of a sandbox. */
16
+ interface SandboxIdentity<TType extends SandboxType, TConfig extends SandboxConfigBase<TType>> {
17
+ readonly type: TType;
18
+ readonly config: TConfig;
19
+ readonly status: SandboxStatus;
20
+ readonly workdir: string;
21
+ }
22
+ /** Lifecycle facet of a sandbox. Unlike containers, sandboxes typically have nothing to "start" — `dispose` releases any temp resources. */
23
+ interface SandboxLifecycle {
24
+ /** No-op for most backends; reserved for backends that need to materialize state. */
25
+ start: () => Promise<void>;
26
+ /** No-op for most backends; reserved for backends that need to release resources. */
27
+ stop: () => Promise<void>;
28
+ /** Release any temporary files, mounts, or seccomp rules associated with this sandbox. Idempotent. */
29
+ dispose: () => Promise<void>;
30
+ [Symbol.asyncDispose]: () => Promise<void>;
31
+ }
32
+ /** Execution facet — exposes the spawner the adapter wires into the wrapped agent. */
33
+ interface SandboxExecution {
34
+ /** Process spawner that runs subprocesses inside the sandbox. */
35
+ readonly spawner: ProcessSpawner;
36
+ }
37
+ /** Composed shape of every concrete sandbox instance. */
38
+ interface SandboxBase<TType extends SandboxType, TConfig extends SandboxConfigBase<TType>> extends SandboxExecution, SandboxIdentity<TType, TConfig>, SandboxLifecycle {}
39
+ /**
40
+ * Bubblewrap-backed sandbox. Lightweight, namespace-based, no setuid required
41
+ * on modern kernels. Good default for most use cases.
42
+ */
43
+ interface BubblewrapSandboxConfig extends SandboxConfigBase<"bubblewrap"> {
44
+ /** Override the path to the `bwrap` binary. Defaults to looking up `bwrap` on `PATH`. */
45
+ binary?: string;
46
+ /** Mounts to bind into the sandbox. Use `readonly: true` for read-only mounts. */
47
+ binds?: VolumeMount[];
48
+ /** Start from an empty environment, ignoring the host's `process.env`. */
49
+ clearEnv?: boolean;
50
+ /** Environment variables to set inside the sandbox. */
51
+ setEnv?: Record<string, string>;
52
+ /** Environment variable names to delete inside the sandbox. */
53
+ unsetEnv?: string[];
54
+ /** Unshare all namespaces (PID, IPC, mount, network, UTS, user). */
55
+ unshareAll?: boolean;
56
+ /** When `unshareAll` is set, keep the host network namespace. */
57
+ shareNetwork?: boolean;
58
+ /** Hostname inside the sandbox. */
59
+ hostname?: string;
60
+ /** Inside-sandbox UID. */
61
+ uid?: number;
62
+ /** Inside-sandbox GID. */
63
+ gid?: number;
64
+ /** Paths to mount as tmpfs inside the sandbox. */
65
+ tmpfs?: string[];
66
+ /** Paths to remount read-only. */
67
+ remountReadonly?: string[];
68
+ /** Where to mount `/proc`. `false` disables; defaults to `/proc`. */
69
+ proc?: false | string;
70
+ /** Where to mount `/dev`. `false` disables; defaults to `/dev`. */
71
+ dev?: false | string;
72
+ /** Extra `bwrap` flags appended verbatim. */
73
+ args?: string[];
74
+ }
75
+ /** Bubblewrap sandbox instance. */
76
+ interface BubblewrapSandbox extends SandboxBase<"bubblewrap", BubblewrapSandboxConfig> {}
77
+ /**
78
+ * Firejail-backed sandbox. Higher-level than bubblewrap; uses seccomp profiles
79
+ * and a curated `whitelist`/`blacklist` model.
80
+ */
81
+ interface FirejailSandboxConfig extends SandboxConfigBase<"firejail"> {
82
+ /** Override the path to the `firejail` binary. */
83
+ binary?: string;
84
+ /** Start from an empty environment, ignoring the host's `process.env`. */
85
+ clearEnv?: boolean;
86
+ /** Environment variables to set inside the sandbox. */
87
+ setEnv?: Record<string, string>;
88
+ /** Environment variable names to delete inside the sandbox. */
89
+ unsetEnv?: string[];
90
+ /** Allow network access. Disabled by default. */
91
+ shareNetwork?: boolean;
92
+ /** Paths visible to the sandboxed process; everything else is hidden. */
93
+ whitelist?: string[];
94
+ /** Paths hidden from the sandboxed process. */
95
+ blacklist?: string[];
96
+ /** Paths exposed read-only. */
97
+ readOnly?: string[];
98
+ /** Paths exposed read-write. */
99
+ readWrite?: string[];
100
+ /** Use a private tmpfs `/tmp`. */
101
+ privateTmp?: boolean;
102
+ /** Extra `firejail` flags appended verbatim. */
103
+ args?: string[];
104
+ }
105
+ /** Firejail sandbox instance. */
106
+ interface FirejailSandbox extends SandboxBase<"firejail", FirejailSandboxConfig> {}
107
+ /**
108
+ * nsjail-backed sandbox. Most flexible (full namespace and rlimit control,
109
+ * custom seccomp policies), most complex to configure.
110
+ */
111
+ interface NsjailSandboxConfig extends SandboxConfigBase<"nsjail"> {
112
+ /** Override the path to the `nsjail` binary. */
113
+ binary?: string;
114
+ /** Mounts to bind into the sandbox. */
115
+ binds?: VolumeMount[];
116
+ /** Paths exposed read-only. */
117
+ readOnly?: string[];
118
+ /** Start from an empty environment, ignoring the host's `process.env`. */
119
+ clearEnv?: boolean;
120
+ /** Environment variables to set inside the sandbox. */
121
+ setEnv?: Record<string, string>;
122
+ /** Environment variable names to delete inside the sandbox. */
123
+ unsetEnv?: string[];
124
+ /** Allow network access. Disabled by default. */
125
+ shareNetwork?: boolean;
126
+ /** Inside-sandbox UID. Host IDs are mapped from the current process. */
127
+ uid?: number;
128
+ /** Inside-sandbox GID. Host IDs are mapped from the current process. */
129
+ gid?: number;
130
+ hostname?: string;
131
+ /** Paths to mount as tmpfs. */
132
+ tmpfs?: string[];
133
+ /** Wall-clock time limit for jailed processes, in seconds. */
134
+ timeLimitSec?: number;
135
+ /** Disable nsjail's default rlimits. */
136
+ disableRlimits?: boolean;
137
+ /** Custom seccomp BPF program as a string (advanced). */
138
+ seccompString?: string;
139
+ /** Extra `nsjail` flags appended verbatim. */
140
+ args?: string[];
141
+ }
142
+ /** nsjail sandbox instance. */
143
+ interface NsjailSandbox extends SandboxBase<"nsjail", NsjailSandboxConfig> {}
144
+ /** Union of all sandbox configs accepted by `createSandbox(...)`. */
145
+ type SandboxConfig = BubblewrapSandboxConfig | FirejailSandboxConfig | NsjailSandboxConfig;
146
+ /** Union of all sandbox instance types. */
147
+ type Sandbox = BubblewrapSandbox | FirejailSandbox | NsjailSandbox;
148
+ //#endregion
149
+ //#region src/sandbox/index.d.ts
150
+ /**
151
+ * Thrown by `createSandbox(...)` when the configuration is invalid — e.g.
152
+ * `config.type` is not one of the supported sandbox kinds.
153
+ */
154
+ declare class SandboxCreateError extends Error {
155
+ constructor(message: string);
156
+ }
157
+ /**
158
+ * Create a Linux-only process sandbox for confined agent execution.
159
+ *
160
+ * Unlike `createContainer`, sandboxes don't isolate the filesystem in a new
161
+ * mount namespace by default — they wrap subprocess invocation with a sandbox
162
+ * binary (`bubblewrap`, `firejail`, or `nsjail`) that enforces a configured
163
+ * policy: which paths are readable, writable, executable, and which syscalls
164
+ * or network operations are allowed.
165
+ *
166
+ * The `type` field selects which sandbox binary is used; the binary must be
167
+ * installed on the host. Bubblewrap is the most common; firejail and nsjail
168
+ * suit stricter syscall-filtering policies.
169
+ *
170
+ * Pass the resulting sandbox to a cli-adapter's `sandbox` option to wrap the
171
+ * agent's subprocess. Container and sandbox are mutually exclusive — use one
172
+ * or the other.
173
+ *
174
+ * ```ts
175
+ * const sandbox = await createSandbox({
176
+ * type: "bubblewrap",
177
+ * workdir: process.cwd(),
178
+ * binds: [
179
+ * { source: "/usr", target: "/usr", readonly: true },
180
+ * { source: process.cwd(), target: process.cwd() },
181
+ * ],
182
+ * shareNetwork: false,
183
+ * });
184
+ * await using agent = await createAgent("claude-code-cli", { sandbox });
185
+ * ```
186
+ *
187
+ * @param config Sandbox configuration. Required: `type`. Optional: binds, env, network policy.
188
+ * @returns A promise that resolves to a sandbox handle whose `spawner` is wired into the chosen agent adapter.
189
+ * @throws {SandboxCreateError} If `config.type` is not one of the supported sandbox kinds.
190
+ */
191
+ declare function createSandbox(config: BubblewrapSandboxConfig): Promise<BubblewrapSandbox>;
192
+ declare function createSandbox(config: FirejailSandboxConfig): Promise<FirejailSandbox>;
193
+ declare function createSandbox(config: NsjailSandboxConfig): Promise<NsjailSandbox>;
194
+ //#endregion
195
+ export { SandboxType as _, FirejailSandbox as a, NsjailSandboxConfig as c, SandboxConfig as d, SandboxConfigBase as f, SandboxStatus as g, SandboxLifecycle as h, BubblewrapSandboxConfig as i, Sandbox as l, SandboxIdentity as m, createSandbox as n, FirejailSandboxConfig as o, SandboxExecution as p, BubblewrapSandbox as r, NsjailSandbox as s, SandboxCreateError as t, SandboxBase as u };
@@ -0,0 +1,97 @@
1
+ import { S as McpServerConfig } from "./events-B0BpIsW2.mjs";
2
+ import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-CGzSzwfB.mjs";
3
+ //#region src/adapters/claude-code-sdk/types.d.ts
4
+ /**
5
+ * How Claude Code handles tool-permission prompts.
6
+ * - `"default"`: stop and ask via the permission handler.
7
+ * - `"acceptEdits"`: auto-accept file edits, still ask for shell commands.
8
+ * - `"auto"`: a model classifier decides per-call whether to approve.
9
+ * - `"dontAsk"`: don't prompt; deny anything not pre-approved.
10
+ * - `"bypassPermissions"`: disable the permission system entirely (dangerous).
11
+ * - `"plan"`: read-only planning mode; no edits, no shell.
12
+ */
13
+ type ClaudeCodeSdkPermissionMode = "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan";
14
+ /** Which runtime to use when spawning the Claude Code SDK subprocess. */
15
+ type ClaudeCodeSdkExecutable = "bun" | "deno" | "node";
16
+ /** Which Claude Code settings layers to load from the local filesystem. */
17
+ type ClaudeCodeSdkSettingSource = "local" | "project" | "user";
18
+ /** Inline settings object, or a path to a JSON settings file. */
19
+ type ClaudeCodeSdkSettings = Record<string, unknown> | string;
20
+ /** Per-run options for the `claude-code-sdk` adapter. */
21
+ interface ClaudeCodeSdkRunOptions {
22
+ /** Allowlist of tool names. When set, all other tools are denied. */
23
+ allowedTools?: string[];
24
+ /** Denylist of tool names. Applied after `allowedTools`. */
25
+ disallowedTools?: string[];
26
+ /** Text appended to Claude Code's default system prompt. */
27
+ appendSystemPrompt?: string;
28
+ /** Tool-permission strategy for this run. See {@link ClaudeCodeSdkPermissionMode}. */
29
+ permissionMode?: ClaudeCodeSdkPermissionMode;
30
+ /** Per-run MCP server overrides. Replaces the agent-level set if provided. */
31
+ mcpServers?: Record<string, McpServerConfig>;
32
+ /** Start a new branch off the current session rather than continuing it. */
33
+ forkSession?: boolean;
34
+ /** Hard cap on assistant turns for this run. */
35
+ maxTurns?: number;
36
+ }
37
+ /** Constructor options for `createAgent("claude-code-sdk", ...)`. */
38
+ interface ClaudeCodeSdkAgentOptions extends ClaudeCodeSdkRunOptions {
39
+ /** Override the path to the Claude Code CLI binary. */
40
+ command?: string;
41
+ /** Environment variables for the SDK subprocess; `undefined` values delete the key. */
42
+ env?: Record<string, string | undefined>;
43
+ /**
44
+ * Default `true`: `process.env` is inherited and `env` overlays it. Set
45
+ * `false` to suppress host-env propagation and use only `env`.
46
+ */
47
+ propagateEnv?: boolean;
48
+ /** Which JS runtime executes the SDK. Defaults to `node`. */
49
+ executable?: ClaudeCodeSdkExecutable;
50
+ /** Extra arguments passed to the runtime (e.g. Bun/Deno flags). */
51
+ executableArgs?: string[];
52
+ /** Inline settings object or path to a settings file. */
53
+ settings?: ClaudeCodeSdkSettings;
54
+ /** Which settings layers to load (`"local"`, `"project"`, `"user"`). */
55
+ settingSources?: ClaudeCodeSdkSettingSource[];
56
+ /** Not supported — claude-code-sdk runs in-process; use `claude-code-cli` for container wrapping. */
57
+ container?: never;
58
+ /** Not supported — claude-code-sdk runs in-process; use `claude-code-cli` for sandbox wrapping. */
59
+ sandbox?: never;
60
+ /** Working directory the agent operates against. */
61
+ cwd?: string;
62
+ /** Existing Claude Code session ID to resume. */
63
+ sessionId?: string;
64
+ /** Model identifier (e.g. `"claude-sonnet-4-6"`). */
65
+ model?: string;
66
+ /** Replaces Claude Code's system prompt entirely. Use `appendSystemPrompt` to add to it instead. */
67
+ systemPrompt?: string;
68
+ /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
69
+ onEvent?: AgentEventHandler;
70
+ }
71
+ /** Agent instance returned by `createAgent("claude-code-sdk", ...)`. */
72
+ interface ClaudeCodeSdkAgent extends BaseAgent<EnsureDisjoint<ClaudeCodeSdkRunOptions>> {
73
+ readonly type: "claude-code-sdk";
74
+ /**
75
+ * Create a sibling agent that shares the same session lineage. Both agents
76
+ * can be run independently; useful for parallel exploration branches.
77
+ *
78
+ * Throws {@link AgentValidationError} when called before this agent has
79
+ * acquired a session ID — run at least one prompt first.
80
+ */
81
+ fork: () => ClaudeCodeSdkAgent;
82
+ }
83
+ /**
84
+ * Permissive raw-event shape for the Claude Code SDK. Provides at minimum
85
+ * `type` (discriminator) and `session_id`; all other fields vary by event
86
+ * type.
87
+ */
88
+ interface ClaudeCodeSdkEvent {
89
+ type: string;
90
+ session_id?: string;
91
+ [key: string]: unknown;
92
+ }
93
+ //#endregion
94
+ //#region src/adapters/claude-code-sdk/adapter.d.ts
95
+ declare const createClaudeCodeSdkAgent: (options?: ClaudeCodeSdkAgentOptions) => ClaudeCodeSdkAgent;
96
+ //#endregion
97
+ export { ClaudeCodeSdkExecutable as a, ClaudeCodeSdkSettingSource as c, ClaudeCodeSdkEvent as i, ClaudeCodeSdkSettings as l, ClaudeCodeSdkAgent as n, ClaudeCodeSdkPermissionMode as o, ClaudeCodeSdkAgentOptions as r, ClaudeCodeSdkRunOptions as s, createClaudeCodeSdkAgent as t };
@@ -1,10 +1,17 @@
1
- import { S as McpServerConfig } from "./events-Dd9r9luo.mjs";
2
- import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-D6kxBNzj.mjs";
3
- import { t as Container } from "./index-lGZ1lQkG.mjs";
4
- import { c as Sandbox } from "./index-D-8EmRnQ.mjs";
1
+ import { S as McpServerConfig } from "./events-B0BpIsW2.mjs";
2
+ import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-CGzSzwfB.mjs";
3
+ import { t as Container } from "./index-C9XD71QR.mjs";
4
+ import { l as Sandbox } from "./index-B5NFoNlS.mjs";
5
5
  import { z } from "zod/v4";
6
6
 
7
7
  //#region src/adapters/codex-cli/events/schemas.d.ts
8
+ /**
9
+ * Permissive shape for any raw event Codex CLI emits — `{ type: string }`
10
+ * plus arbitrary additional fields. Narrow on `event.type` against the
11
+ * specific exported event types (`CodexThreadStartedEvent`,
12
+ * `CodexTurnCompletedEvent`, `CodexItemStartedEvent`, etc.) when you need
13
+ * field-level access.
14
+ */
8
15
  declare const codexEventSchema: z.ZodObject<{
9
16
  type: z.ZodString;
10
17
  }, z.core.$loose>;
@@ -76,30 +83,54 @@ declare const codexErrorEventSchema: z.ZodObject<{
76
83
  type CodexErrorEvent = z.infer<typeof codexErrorEventSchema>;
77
84
  //#endregion
78
85
  //#region src/adapters/codex-cli/types.d.ts
86
+ /**
87
+ * Filesystem sandbox policy for Codex CLI.
88
+ * - `"read-only"`: tools cannot write.
89
+ * - `"workspace-write"`: writes allowed inside `cwd` only.
90
+ * - `"danger-full-access"`: no filesystem restrictions.
91
+ */
79
92
  type CodexCliSandboxMode = "danger-full-access" | "read-only" | "workspace-write";
93
+ /**
94
+ * How Codex CLI handles approval prompts.
95
+ * - `"default"`: leave Codex CLI's own default approval behavior in place (this adapter does not bridge approvals to a permission handler).
96
+ * - `"auto-approve"`: pass `--auto-approve` to Codex CLI; accept all approval prompts.
97
+ * - `"bypass-sandbox"`: pass `--dangerously-bypass-approvals-and-sandbox`; bypasses both approvals AND the sandbox.
98
+ */
80
99
  type CodexCliPermissionMode = "auto-approve" | "bypass-sandbox" | "default";
100
+ /** Per-run options for the `codex-cli` adapter. */
81
101
  interface CodexCliRunOptions {
82
- codexSandboxMode?: CodexCliSandboxMode;
102
+ /** Filesystem sandbox policy. See {@link CodexCliSandboxMode}. */
103
+ sandboxMode?: CodexCliSandboxMode;
104
+ /** Extra directories outside `cwd` writable under `workspace-write`. */
83
105
  additionalDirectories?: string[];
106
+ /** Suppress Codex's "not a git repo" confirmation prompt (`--skip-git-repo-check`). */
84
107
  skipGitRepoCheck?: boolean;
108
+ /** Approval prompt strategy. */
85
109
  permissionMode?: CodexCliPermissionMode;
110
+ /** When `true`, Codex does not persist this run's history. */
86
111
  ephemeral?: boolean;
112
+ /** Path to an MCP config file passed via `--mcp-config`. */
87
113
  mcpConfig?: string;
114
+ /** Inline MCP server config map. */
88
115
  mcpServers?: Record<string, McpServerConfig>;
116
+ /** Extra CLI flags appended verbatim. */
89
117
  extraArgs?: string[];
118
+ /** Not supported — Codex manages its own system prompt. */
90
119
  systemPrompt?: never;
91
120
  }
121
+ /** Constructor options for `createAgent("codex-cli", ...)`. */
92
122
  type CodexCliAgentOptions = CodexCliRunOptions & ExclusiveExecutionTargetOptions<Container, Sandbox> & {
93
- command?: string[] | string;
94
- cwd?: string;
95
- env?: Record<string, string>;
96
- propagateEnv?: boolean;
97
- sessionId?: string;
98
- model?: string;
99
- logPath?: string;
100
- spawner?: ProcessSpawner;
123
+ /** Path or argv to the `codex` binary. */command?: string[] | string; /** Working directory the agent operates against. */
124
+ cwd?: string; /** Environment variables for the subprocess. Layered on top of host env when `propagateEnv` is `true` (default). */
125
+ env?: Record<string, string>; /** Default `true`: `process.env` is inherited and `env` overlays it. Set `false` to suppress host-env propagation. */
126
+ propagateEnv?: boolean; /** Existing Codex thread ID to resume via `codex resume`. */
127
+ sessionId?: string; /** Codex model identifier. */
128
+ model?: string; /** File path to write the raw CLI log to (useful for debugging). */
129
+ logPath?: string; /** Custom process spawner; set by `createContainer`/`createSandbox`, rarely needed manually. */
130
+ spawner?: ProcessSpawner; /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
101
131
  onEvent?: AgentEventHandler;
102
132
  };
133
+ /** Agent instance returned by `createAgent("codex-cli", ...)`. */
103
134
  interface CodexCliAgent extends BaseAgent<EnsureDisjoint<CodexCliRunOptions>> {
104
135
  readonly type: "codex-cli";
105
136
  }
@@ -1,7 +1,7 @@
1
- import { S as McpServerConfig } from "./events-Dd9r9luo.mjs";
2
- import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-D6kxBNzj.mjs";
3
- import { t as Container } from "./index-lGZ1lQkG.mjs";
4
- import { c as Sandbox } from "./index-D-8EmRnQ.mjs";
1
+ import { S as McpServerConfig } from "./events-B0BpIsW2.mjs";
2
+ import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-CGzSzwfB.mjs";
3
+ import { t as Container } from "./index-C9XD71QR.mjs";
4
+ import { l as Sandbox } from "./index-B5NFoNlS.mjs";
5
5
  import { z } from "zod/v4";
6
6
 
7
7
  //#region src/adapters/claude-code-cli/events/schemas.d.ts
@@ -21,10 +21,10 @@ declare const claudeSystemEventSchema: z.ZodObject<{
21
21
  mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
22
22
  name: z.ZodString;
23
23
  status: z.ZodEnum<{
24
- error: "error";
25
- failed: "failed";
26
24
  connected: "connected";
27
25
  disconnected: "disconnected";
26
+ error: "error";
27
+ failed: "failed";
28
28
  }>;
29
29
  }, z.core.$strip>>>;
30
30
  model: z.ZodOptional<z.ZodString>;
@@ -145,6 +145,12 @@ declare const claudeRateLimitEventSchema: z.ZodObject<{
145
145
  }, z.core.$strip>;
146
146
  }, z.core.$strip>;
147
147
  type ClaudeRateLimitEvent = z.infer<typeof claudeRateLimitEventSchema>;
148
+ /**
149
+ * Discriminated union of the raw stream-JSON events Claude Code CLI emits
150
+ * before this adapter normalizes them. Surfaced for callers that want
151
+ * provider-specific fidelity (rate-limit signals, init metadata, etc.) that
152
+ * the normalized `AgentEvent` shape drops. Narrow on `event.type`.
153
+ */
148
154
  declare const claudeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
149
155
  type: z.ZodLiteral<"system">;
150
156
  session_id: z.ZodString;
@@ -161,10 +167,10 @@ declare const claudeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
161
167
  mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
168
  name: z.ZodString;
163
169
  status: z.ZodEnum<{
164
- error: "error";
165
- failed: "failed";
166
170
  connected: "connected";
167
171
  disconnected: "disconnected";
172
+ error: "error";
173
+ failed: "failed";
168
174
  }>;
169
175
  }, z.core.$strip>>>;
170
176
  model: z.ZodOptional<z.ZodString>;
@@ -279,34 +285,59 @@ declare const claudeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
279
285
  type ClaudeEvent = z.infer<typeof claudeEventSchema>;
280
286
  //#endregion
281
287
  //#region src/adapters/claude-code-cli/types.d.ts
288
+ /**
289
+ * How Claude Code CLI handles tool-permission prompts.
290
+ * - `"default"`: stop and ask via the permission handler.
291
+ * - `"acceptEdits"`: auto-accept file edits, still ask for shell commands.
292
+ * - `"auto"`: a model classifier decides per-call whether to approve.
293
+ * - `"dontAsk"`: don't prompt; deny anything not pre-approved.
294
+ * - `"bypassPermissions"`: disable the permission system entirely (dangerous).
295
+ * - `"plan"`: read-only planning mode; no edits, no shell.
296
+ */
282
297
  type ClaudeCodeCliPermissionMode = "acceptEdits" | "auto" | "bypassPermissions" | "default" | "dontAsk" | "plan";
298
+ /** Per-run options for the `claude-code-cli` adapter. */
283
299
  interface ClaudeCodeCliRunOptions {
300
+ /** Allowlist of tool names. */
284
301
  allowedTools?: string[];
302
+ /** Denylist of tool names. */
285
303
  disallowedTools?: string[];
304
+ /** Text appended to Claude Code's default system prompt. */
286
305
  appendSystemPrompt?: string;
306
+ /** Permission strategy for this run. */
287
307
  permissionMode?: ClaudeCodeCliPermissionMode;
308
+ /** Path(s) to MCP server config files passed via `--mcp-config`. */
288
309
  mcpConfig?: string[] | string;
310
+ /** Inline MCP server config map. Merged with `mcpConfig` file contents. */
289
311
  mcpServers?: Record<string, McpServerConfig>;
312
+ /** Start a fresh fork off the current session rather than continuing it. */
290
313
  forkSession?: boolean;
314
+ /** Extra CLI flags appended verbatim. Use sparingly — the adapter sets most flags. */
291
315
  extraArgs?: string[];
292
316
  }
317
+ /** Constructor options for `createAgent("claude-code-cli", ...)`. */
293
318
  type ClaudeCodeCliAgentOptions = ClaudeCodeCliRunOptions & ExclusiveExecutionTargetOptions<Container, Sandbox> & {
294
- command?: string[] | string;
295
- cwd?: string;
296
- env?: Record<string, string>;
297
- propagateEnv?: boolean;
298
- sessionId?: string;
299
- model?: string;
300
- systemPrompt?: string;
301
- logPath?: string;
302
- ci?: boolean;
303
- spawner?: ProcessSpawner;
319
+ /** Path or argv to the `claude` binary. Defaults to looking up `claude` on `PATH`. */command?: string[] | string; /** Working directory the agent operates against. */
320
+ cwd?: string; /** Environment variables for the subprocess. */
321
+ env?: Record<string, string>; /** Inherit `process.env` and overlay `env` on top, instead of replacing. */
322
+ propagateEnv?: boolean; /** Existing session ID to resume via `--resume`. */
323
+ sessionId?: string; /** Model identifier (e.g. `"claude-sonnet-4-6"`). */
324
+ model?: string; /** Replaces the default system prompt entirely. */
325
+ systemPrompt?: string; /** File path to write the raw CLI log to (useful for debugging). */
326
+ logPath?: string; /** Sets `CI=true` in the subprocess env unless explicitly `false`. Default: `true`. Does not change Claude Code's output formatting on its own. */
327
+ ci?: boolean; /** Custom process spawner; set by `createContainer`/`createSandbox`, rarely needed manually. */
328
+ spawner?: ProcessSpawner; /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
304
329
  onEvent?: AgentEventHandler;
305
330
  };
331
+ /** Agent instance returned by `createAgent("claude-code-cli", ...)`. */
306
332
  interface ClaudeCodeCliAgent extends BaseAgent<EnsureDisjoint<ClaudeCodeCliRunOptions>> {
307
333
  readonly type: "claude-code-cli";
334
+ /**
335
+ * Branch a sibling agent from the current session.
336
+ *
337
+ * Throws `AgentValidationError` when called before this agent has
338
+ * acquired a session ID — run at least one prompt first.
339
+ */
308
340
  fork: () => ClaudeCodeCliAgent;
309
- dispose: () => Promise<void>;
310
341
  }
311
342
  //#endregion
312
343
  //#region src/adapters/claude-code-cli/adapter.d.ts