coding-agents-sdk 0.9.0 → 0.11.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 +9 -3
- package/dist/Agent-BD2xHVi0.mjs +4 -0
- package/dist/{SdkAgent-CxDlEycD.mjs → SdkAgent-DQfLwPwY.mjs} +1 -1
- package/dist/adapters/claude-code-cli/index.d.mts +1 -1
- package/dist/adapters/claude-code-cli/index.mjs +1 -2
- package/dist/adapters/claude-code-cli-pty/index.d.mts +3 -0
- package/dist/adapters/claude-code-cli-pty/index.mjs +35 -0
- package/dist/adapters/claude-code-sdk/index.d.mts +1 -1
- package/dist/adapters/claude-code-sdk/index.mjs +3 -3
- package/dist/adapters/codex-cli/index.d.mts +1 -1
- package/dist/adapters/codex-cli/index.mjs +2 -2
- package/dist/adapters/codex-sdk/index.d.mts +1 -1
- package/dist/adapters/codex-sdk/index.mjs +1 -1
- package/dist/adapters/cursor-cli/index.d.mts +1 -1
- package/dist/adapters/cursor-cli/index.mjs +1 -1
- package/dist/adapters/cursor-sdk/index.d.mts +1 -1
- package/dist/adapters/cursor-sdk/index.mjs +1 -1
- package/dist/adapters/gemini-cli/index.d.mts +1 -1
- package/dist/adapters/gemini-cli/index.mjs +1 -1
- package/dist/adapters/opencode-cli/index.d.mts +1 -1
- package/dist/adapters/opencode-cli/index.mjs +1 -1
- package/dist/adapters/pi-cli/index.d.mts +1 -1
- package/dist/adapters/pi-cli/index.mjs +1 -1
- package/dist/{classify-error-DoH0BqEA.mjs → classify-error-BcWmNftw.mjs} +1 -1
- package/dist/container/index.d.mts +2 -2
- package/dist/container/index.mjs +1 -1
- package/dist/container-BhXUiAiK.mjs +1 -0
- package/dist/{container-BuaAmhBf.mjs → container-BurV5WG9.mjs} +1 -1
- package/dist/container-D31bbA4L.mjs +1 -0
- package/dist/{container-RMYjapoN.mjs → container-TizHce_7.mjs} +1 -1
- package/dist/{diff-DkMPJCxL.mjs → diff-DWM1ciiV.mjs} +1 -1
- package/dist/errors-CeKI_bYK.mjs +1 -0
- package/dist/{events-BE9s04ko.d.mts → events-Bwfw__Q3.d.mts} +140 -0
- package/dist/execution-target-CGTSqVEP.mjs +1 -0
- package/dist/index-B0x76PaA.d.mts +104 -0
- package/dist/{index-BC_KQvvz.d.mts → index-BQNj8DHq.d.mts} +46 -15
- package/dist/index-B_MIEnNS.d.mts +60 -0
- package/dist/index-BeejNCvc.d.mts +429 -0
- package/dist/index-C8wbKjj3.d.mts +188 -0
- package/dist/index-CEHYyi4k.d.mts +68 -0
- package/dist/{index-DM6yXz_N.d.mts → index-ClURbAqF.d.mts} +67 -1
- package/dist/index-CyxdNK5W.d.mts +58 -0
- package/dist/{index-BTcDyVsX.d.mts → index-D5zrCo6s.d.mts} +43 -12
- package/dist/index-ILgtPW1P.d.mts +97 -0
- package/dist/index-dPV54_sZ.d.mts +69 -0
- package/dist/{index-nx85iU6i.d.mts → index-p8MJ49dZ.d.mts} +77 -1
- package/dist/index.d.mts +69 -17
- package/dist/index.mjs +1 -1
- package/dist/oci-tjdSZfTm.mjs +1 -0
- package/dist/parser-BBJPNGZ2.mjs +2 -0
- package/dist/sandbox/index.d.mts +1 -1
- package/dist/schemas/index.d.mts +1 -1
- package/dist/schemas/index.mjs +1 -1
- package/dist/schemas-mNF2Xlg_.mjs +1 -0
- package/dist/types-Bk-YpdbX.d.mts +476 -0
- package/package.json +25 -20
- package/dist/container--0TOW4sB.mjs +0 -1
- package/dist/container-C5h5Bdf_.mjs +0 -1
- package/dist/errors-XV0frS3r.mjs +0 -1
- package/dist/execution-target-Dr2SFmkz.mjs +0 -4
- package/dist/index-BsTS0n1I.d.mts +0 -46
- package/dist/index-BsWb681o.d.mts +0 -85
- package/dist/index-CK9BK1t2.d.mts +0 -42
- package/dist/index-CkX15fCQ.d.mts +0 -242
- package/dist/index-Cpz-hhM0.d.mts +0 -42
- package/dist/index-CzjmvgZI.d.mts +0 -39
- package/dist/index-l1U15W0k.d.mts +0 -46
- package/dist/oci-BVYPHn7b.mjs +0 -1
- package/dist/schemas-CXVWDOoT.mjs +0 -1
- package/dist/types-BnnsL3U5.d.mts +0 -162
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
2
|
+
import { t as Container } from "./index-BeejNCvc.mjs";
|
|
3
|
+
import { c as Sandbox } from "./index-C8wbKjj3.mjs";
|
|
4
|
+
import { z } from "zod/v4";
|
|
5
|
+
|
|
6
|
+
//#region src/adapters/pi-cli/events/schemas.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Permissive raw-event shape for Pi CLI: `{ type: string }` plus arbitrary
|
|
9
|
+
* additional fields the CLI may emit.
|
|
10
|
+
*/
|
|
11
|
+
declare const piEventSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodString;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
type PiEvent = z.infer<typeof piEventSchema>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/adapters/pi-cli/types.d.ts
|
|
17
|
+
/** How much hidden reasoning Pi should perform per turn. */
|
|
18
|
+
type PiCliThinkingLevel = "high" | "low" | "medium" | "minimal" | "off" | "xhigh";
|
|
19
|
+
/** Per-run options for the `pi-cli` adapter. */
|
|
20
|
+
interface PiCliRunOptions {
|
|
21
|
+
/** Backend provider override (`"anthropic"`, `"openai"`, etc.). */
|
|
22
|
+
provider?: string;
|
|
23
|
+
/** Thinking budget for the run. */
|
|
24
|
+
thinking?: PiCliThinkingLevel;
|
|
25
|
+
/** Text appended to Pi's default system prompt. */
|
|
26
|
+
appendSystemPrompt?: string;
|
|
27
|
+
/** Allowlist of tool names. */
|
|
28
|
+
tools?: string[];
|
|
29
|
+
/** Disable all tool use for this run. */
|
|
30
|
+
noTools?: boolean;
|
|
31
|
+
/** Run without persisting session history. */
|
|
32
|
+
noSession?: boolean;
|
|
33
|
+
/** Directory where session files are persisted. */
|
|
34
|
+
sessionDir?: string;
|
|
35
|
+
/** Branch a new session off the current one. */
|
|
36
|
+
forkSession?: boolean;
|
|
37
|
+
/** Extra CLI flags appended verbatim. */
|
|
38
|
+
extraArgs?: string[];
|
|
39
|
+
}
|
|
40
|
+
/** Constructor options for `createAgent("pi-cli", ...)`. */
|
|
41
|
+
type PiCliAgentOptions = ExclusiveExecutionTargetOptions<Container, Sandbox> & PiCliRunOptions & {
|
|
42
|
+
/** Path or argv to the `pi` binary. */command?: string[] | string; /** Working directory the agent operates against. */
|
|
43
|
+
cwd?: string; /** Environment variables for the subprocess. Layered on top of host env when `propagateEnv` is `true` (default). */
|
|
44
|
+
env?: Record<string, string>; /** Default `true`: `process.env` is inherited and `env` overlays it. Set `false` to suppress host-env propagation. */
|
|
45
|
+
propagateEnv?: boolean; /** Existing Pi session ID to resume. */
|
|
46
|
+
sessionId?: string; /** Pi model identifier (provider-dependent). */
|
|
47
|
+
model?: string; /** Replaces Pi's default system prompt entirely; use `appendSystemPrompt` to add to it. */
|
|
48
|
+
systemPrompt?: string; /** File path to write the raw CLI log to (useful for debugging). */
|
|
49
|
+
logPath?: string; /** Custom process spawner; set by `createContainer`/`createSandbox`, rarely needed manually. */
|
|
50
|
+
spawner?: ProcessSpawner; /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
|
|
51
|
+
onEvent?: AgentEventHandler;
|
|
52
|
+
};
|
|
53
|
+
/** Agent instance returned by `createAgent("pi-cli", ...)`. */
|
|
54
|
+
interface PiCliAgent extends BaseAgent<EnsureDisjoint<PiCliRunOptions>> {
|
|
55
|
+
readonly type: "pi-cli";
|
|
56
|
+
/**
|
|
57
|
+
* Branch a sibling agent from the current session.
|
|
58
|
+
*
|
|
59
|
+
* Throws `AgentValidationError` when called before this agent has
|
|
60
|
+
* acquired a session ID — run at least one prompt first.
|
|
61
|
+
*/
|
|
62
|
+
fork: () => PiCliAgent;
|
|
63
|
+
}
|
|
64
|
+
//#endregion
|
|
65
|
+
//#region src/adapters/pi-cli/adapter.d.ts
|
|
66
|
+
declare const createPiCliAgent: (options?: PiCliAgentOptions) => PiCliAgent;
|
|
67
|
+
//#endregion
|
|
68
|
+
export { PiCliThinkingLevel as a, PiCliRunOptions as i, PiCliAgent as n, PiEvent as o, PiCliAgentOptions as r, createPiCliAgent as t };
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-
|
|
1
|
+
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
2
2
|
//#region src/adapters/cursor-sdk/types.d.ts
|
|
3
|
+
/** OAuth-style credentials for HTTP/SSE MCP servers configured for the agent. */
|
|
3
4
|
interface CursorSdkMcpHttpAuth {
|
|
4
5
|
CLIENT_ID: string;
|
|
5
6
|
CLIENT_SECRET?: string;
|
|
6
7
|
scopes?: string[];
|
|
7
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* MCP server config accepted by the Cursor SDK. Either an HTTP/SSE endpoint
|
|
11
|
+
* or a stdio command spawned by the SDK runtime.
|
|
12
|
+
*/
|
|
8
13
|
type CursorSdkMcpServerConfig = {
|
|
9
14
|
type?: "http" | "sse";
|
|
10
15
|
url: string;
|
|
@@ -17,11 +22,21 @@ type CursorSdkMcpServerConfig = {
|
|
|
17
22
|
env?: Record<string, string>;
|
|
18
23
|
cwd?: string;
|
|
19
24
|
};
|
|
25
|
+
/**
|
|
26
|
+
* Which Cursor settings layers to load from the local filesystem. Forwarded
|
|
27
|
+
* as `local.settingSources` to `Agent.create`. `"all"` loads everything;
|
|
28
|
+
* `"project"`, `"user"`, `"team"`, `"plugins"`, `"mdm"` load only that layer.
|
|
29
|
+
*/
|
|
20
30
|
type CursorSdkSettingSource = "all" | "mdm" | "plugins" | "project" | "team" | "user";
|
|
31
|
+
/** One model parameter (e.g. reasoning effort) for {@link CursorSdkModelSelection}. */
|
|
21
32
|
interface CursorSdkModelParameterValue {
|
|
22
33
|
id: string;
|
|
23
34
|
value: string;
|
|
24
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Internal model selection shape used by the Cursor SDK. Most callers pass a
|
|
38
|
+
* plain model ID string and let the adapter wrap it.
|
|
39
|
+
*/
|
|
25
40
|
interface CursorSdkModelSelection {
|
|
26
41
|
id: string;
|
|
27
42
|
params?: CursorSdkModelParameterValue[];
|
|
@@ -103,20 +118,71 @@ interface CursorSdkTaskEvent {
|
|
|
103
118
|
status?: string;
|
|
104
119
|
text?: string;
|
|
105
120
|
}
|
|
121
|
+
/**
|
|
122
|
+
* Discriminated union of raw events the Cursor SDK emits before this adapter
|
|
123
|
+
* normalizes them. Narrow on `event.type`:
|
|
124
|
+
*
|
|
125
|
+
* - `"system"` — init metadata (model, tools).
|
|
126
|
+
* - `"user"` — echo of the user prompt for this run.
|
|
127
|
+
* - `"assistant"` — model text/tool-use chunk (may arrive in fragments).
|
|
128
|
+
* - `"thinking"` — reasoning content with duration.
|
|
129
|
+
* - `"tool_call"` — tool invocation lifecycle (`running` → `completed`/`error`).
|
|
130
|
+
* - `"status"` — run lifecycle (`RUNNING`, `FINISHED`, etc.).
|
|
131
|
+
* - `"task"` — task-level milestones.
|
|
132
|
+
* - `"request"` — Cursor is asking for user input/approval (unsupported by this adapter).
|
|
133
|
+
*/
|
|
106
134
|
type CursorSdkEvent = CursorSdkAssistantEvent | CursorSdkRequestEvent | CursorSdkStatusEvent | CursorSdkSystemEvent | CursorSdkTaskEvent | CursorSdkThinkingEvent | CursorSdkToolCallEvent | CursorSdkUserEvent;
|
|
135
|
+
/**
|
|
136
|
+
* Per-run options for the `cursor-sdk` adapter. Merge with {@link RunRequest}
|
|
137
|
+
* when calling `agent.run(...)`.
|
|
138
|
+
*/
|
|
107
139
|
interface CursorSdkRunOptions {
|
|
140
|
+
/**
|
|
141
|
+
* Recovery-only flag. Forwards to `local.force` on `Agent.send(...)`, which
|
|
142
|
+
* expires a stale persisted "active run" left by a crashed previous
|
|
143
|
+
* process. Set this only when a normal send errors with "agent busy" /
|
|
144
|
+
* "active run exists." Not a routine option.
|
|
145
|
+
*/
|
|
108
146
|
localForce?: boolean;
|
|
147
|
+
/**
|
|
148
|
+
* Per-run MCP server overrides. Replaces the agent-level set if provided.
|
|
149
|
+
*/
|
|
109
150
|
mcpServers?: Record<string, CursorSdkMcpServerConfig>;
|
|
151
|
+
/** Not supported by the Cursor SDK — cursor manages its own system prompt. */
|
|
110
152
|
systemPrompt?: never;
|
|
111
153
|
}
|
|
154
|
+
/**
|
|
155
|
+
* Constructor options for `createAgent("cursor-sdk", ...)`. Passed to
|
|
156
|
+
* `Agent.create` (or `Agent.resume` if `sessionId` is set) under the hood.
|
|
157
|
+
*/
|
|
112
158
|
interface CursorSdkAgentOptions extends CursorSdkRunOptions {
|
|
159
|
+
/**
|
|
160
|
+
* Cursor API key. Falls back to `process.env.CURSOR_API_KEY` for some
|
|
161
|
+
* surfaces but the local `send` path requires it to be set explicitly.
|
|
162
|
+
*/
|
|
113
163
|
apiKey?: string;
|
|
164
|
+
/** Working directory passed as `local.cwd`. Defaults to `process.cwd()`. */
|
|
114
165
|
cwd?: string;
|
|
166
|
+
/**
|
|
167
|
+
* Existing Cursor agent ID to resume. When set, the adapter calls
|
|
168
|
+
* `Agent.resume(sessionId, ...)` on the first run instead of
|
|
169
|
+
* `Agent.create(...)`. Required if you don't pass a `model`.
|
|
170
|
+
*/
|
|
115
171
|
sessionId?: string;
|
|
172
|
+
/**
|
|
173
|
+
* Cursor model identifier (e.g. `"composer-2.5"`, `"claude-sonnet-4-6"`).
|
|
174
|
+
* Use `Cursor.models.list()` to enumerate; required for new local agents.
|
|
175
|
+
*/
|
|
116
176
|
model?: string;
|
|
177
|
+
/**
|
|
178
|
+
* Cursor settings layers to load from the local filesystem (`"project"`,
|
|
179
|
+
* `"user"`, etc.). Defaults to nothing if omitted.
|
|
180
|
+
*/
|
|
117
181
|
settingSources?: CursorSdkSettingSource[];
|
|
182
|
+
/** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
|
|
118
183
|
onEvent?: AgentEventHandler;
|
|
119
184
|
}
|
|
185
|
+
/** Agent instance returned by `createAgent("cursor-sdk", ...)`. */
|
|
120
186
|
interface CursorSdkAgent extends BaseAgent<EnsureDisjoint<CursorSdkRunOptions>> {
|
|
121
187
|
readonly type: "cursor-sdk";
|
|
122
188
|
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
2
|
+
import { t as Container } from "./index-BeejNCvc.mjs";
|
|
3
|
+
import { c as Sandbox } from "./index-C8wbKjj3.mjs";
|
|
4
|
+
import { z } from "zod/v4";
|
|
5
|
+
|
|
6
|
+
//#region src/adapters/opencode-cli/events/schemas.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Permissive raw-event shape for OpenCode CLI: `{ type: string }` plus
|
|
9
|
+
* arbitrary additional fields the CLI may emit.
|
|
10
|
+
*/
|
|
11
|
+
declare const opencodeEventSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodString;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
type OpencodeEvent = z.infer<typeof opencodeEventSchema>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/adapters/opencode-cli/types.d.ts
|
|
17
|
+
/** Per-run options for the `opencode-cli` adapter. */
|
|
18
|
+
interface OpencodeCliRunOptions {
|
|
19
|
+
/** Named OpenCode agent profile (e.g. `"coding"`, `"reviewer"`). */
|
|
20
|
+
agent?: string;
|
|
21
|
+
/** Initial files to attach to the conversation context. */
|
|
22
|
+
files?: string[];
|
|
23
|
+
/** Branch a new session off the current one. */
|
|
24
|
+
forkSession?: boolean;
|
|
25
|
+
/** Make the session shareable via OpenCode's share-link feature. */
|
|
26
|
+
share?: boolean;
|
|
27
|
+
/** Enable extended thinking output for supported models. */
|
|
28
|
+
thinking?: boolean;
|
|
29
|
+
/** Human-readable title for the session. */
|
|
30
|
+
title?: string;
|
|
31
|
+
/** Named variant of the selected agent profile. */
|
|
32
|
+
variant?: string;
|
|
33
|
+
/** Extra CLI flags appended verbatim. */
|
|
34
|
+
extraArgs?: string[];
|
|
35
|
+
/** Not supported — OpenCode manages its own system prompt. */
|
|
36
|
+
systemPrompt?: never;
|
|
37
|
+
}
|
|
38
|
+
/** Constructor options for `createAgent("opencode-cli", ...)`. */
|
|
39
|
+
type OpencodeCliAgentOptions = ExclusiveExecutionTargetOptions<Container, Sandbox> & OpencodeCliRunOptions & {
|
|
40
|
+
/** Path or argv to the `opencode` binary. */command?: string[] | string; /** Working directory the agent operates against. */
|
|
41
|
+
cwd?: string; /** Environment variables for the subprocess. Layered on top of host env when `propagateEnv` is `true` (default). */
|
|
42
|
+
env?: Record<string, string>; /** Default `true`: `process.env` is inherited and `env` overlays it. Set `false` to suppress host-env propagation. */
|
|
43
|
+
propagateEnv?: boolean; /** Existing OpenCode session ID to resume. */
|
|
44
|
+
sessionId?: string; /** OpenCode model identifier. */
|
|
45
|
+
model?: string; /** File path to write the raw CLI log to (useful for debugging). */
|
|
46
|
+
logPath?: string; /** Custom process spawner; set by `createContainer`/`createSandbox`, rarely needed manually. */
|
|
47
|
+
spawner?: ProcessSpawner; /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
|
|
48
|
+
onEvent?: AgentEventHandler;
|
|
49
|
+
};
|
|
50
|
+
/** Agent instance returned by `createAgent("opencode-cli", ...)`. */
|
|
51
|
+
interface OpencodeCliAgent extends BaseAgent<EnsureDisjoint<OpencodeCliRunOptions>> {
|
|
52
|
+
readonly type: "opencode-cli";
|
|
53
|
+
}
|
|
54
|
+
//#endregion
|
|
55
|
+
//#region src/adapters/opencode-cli/adapter.d.ts
|
|
56
|
+
declare const createOpencodeCliAgent: (options?: OpencodeCliAgentOptions) => OpencodeCliAgent;
|
|
57
|
+
//#endregion
|
|
58
|
+
export { OpencodeEvent as a, OpencodeCliRunOptions as i, OpencodeCliAgent as n, OpencodeCliAgentOptions as r, createOpencodeCliAgent as t };
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
import { S as McpServerConfig } from "./events-
|
|
2
|
-
import {
|
|
3
|
-
import { t as Container } from "./index-
|
|
4
|
-
import { c as Sandbox } from "./index-
|
|
1
|
+
import { S as McpServerConfig } from "./events-Bwfw__Q3.mjs";
|
|
2
|
+
import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
3
|
+
import { t as Container } from "./index-BeejNCvc.mjs";
|
|
4
|
+
import { c as Sandbox } from "./index-C8wbKjj3.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 {
|
|
102
|
+
/** Filesystem sandbox policy. See {@link CodexCliSandboxMode}. */
|
|
82
103
|
codexSandboxMode?: 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
|
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { S as McpServerConfig } from "./events-Bwfw__Q3.mjs";
|
|
2
|
+
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-Bk-YpdbX.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 };
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { A as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
2
|
+
import { t as Container } from "./index-BeejNCvc.mjs";
|
|
3
|
+
import { c as Sandbox } from "./index-C8wbKjj3.mjs";
|
|
4
|
+
import { z } from "zod/v4";
|
|
5
|
+
|
|
6
|
+
//#region src/adapters/cursor-cli/events/schemas.d.ts
|
|
7
|
+
/**
|
|
8
|
+
* Permissive raw-event shape for Cursor CLI: `{ type: string }` plus
|
|
9
|
+
* arbitrary additional fields the CLI may emit.
|
|
10
|
+
*/
|
|
11
|
+
declare const cursorCliEventSchema: z.ZodObject<{
|
|
12
|
+
type: z.ZodString;
|
|
13
|
+
}, z.core.$loose>;
|
|
14
|
+
type CursorCliEvent = z.infer<typeof cursorCliEventSchema>;
|
|
15
|
+
//#endregion
|
|
16
|
+
//#region src/adapters/cursor-cli/types.d.ts
|
|
17
|
+
/**
|
|
18
|
+
* Cursor CLI run mode.
|
|
19
|
+
* - `"ask"`: interactive question-answering mode (default).
|
|
20
|
+
* - `"plan"`: read-only planning mode; the agent proposes changes but doesn't apply them.
|
|
21
|
+
*/
|
|
22
|
+
type CursorCliMode = "ask" | "plan";
|
|
23
|
+
/**
|
|
24
|
+
* Cursor CLI sandbox toggle. Cursor's CLI exposes a binary on/off knob; for
|
|
25
|
+
* granular policy, use the `sandbox` option from `createSandbox(...)`.
|
|
26
|
+
*/
|
|
27
|
+
type CursorCliSandboxMode = "disabled" | "enabled";
|
|
28
|
+
/** Per-run options for the `cursor-cli` adapter. */
|
|
29
|
+
interface CursorCliRunOptions {
|
|
30
|
+
/** Auto-approve MCP tool prompts that would otherwise wait for user confirmation. */
|
|
31
|
+
approveMcps?: boolean;
|
|
32
|
+
/** Extra CLI flags appended verbatim. */
|
|
33
|
+
extraArgs?: string[];
|
|
34
|
+
/**
|
|
35
|
+
* Recovery flag — expire a stale active run on the local agent before
|
|
36
|
+
* starting this one. See cursor-sdk's `localForce` for context. Routine
|
|
37
|
+
* sends should leave this unset.
|
|
38
|
+
*/
|
|
39
|
+
force?: boolean;
|
|
40
|
+
/** Run mode (`"ask"` or `"plan"`). */
|
|
41
|
+
mode?: CursorCliMode;
|
|
42
|
+
/** Sandbox toggle. See {@link CursorCliSandboxMode}. */
|
|
43
|
+
sandboxMode?: CursorCliSandboxMode;
|
|
44
|
+
/** Mark the working directory as trusted, bypassing first-run trust prompts. */
|
|
45
|
+
trust?: boolean;
|
|
46
|
+
/** Not supported — Cursor manages its own system prompt. */
|
|
47
|
+
systemPrompt?: never;
|
|
48
|
+
}
|
|
49
|
+
/** Constructor options for `createAgent("cursor-cli", ...)`. */
|
|
50
|
+
type CursorCliAgentOptions = CursorCliRunOptions & ExclusiveExecutionTargetOptions<Container, Sandbox> & {
|
|
51
|
+
/** Path or argv to the Cursor agent binary. Defaults to `"agent"` on `PATH`. */command?: string[] | string; /** Working directory the agent operates against. */
|
|
52
|
+
cwd?: string; /** Environment variables for the subprocess. Layered on top of host env when `propagateEnv` is `true` (default). */
|
|
53
|
+
env?: Record<string, string>; /** Default `true`: `process.env` is inherited and `env` overlays it. Set `false` to suppress host-env propagation. */
|
|
54
|
+
propagateEnv?: boolean; /** Existing Cursor agent ID to resume via `--resume`. */
|
|
55
|
+
sessionId?: string; /** Cursor model identifier. */
|
|
56
|
+
model?: string; /** File path to write the raw CLI log to (useful for debugging). */
|
|
57
|
+
logPath?: string; /** Custom process spawner; set by `createContainer`/`createSandbox`, rarely needed manually. */
|
|
58
|
+
spawner?: ProcessSpawner; /** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
|
|
59
|
+
onEvent?: AgentEventHandler;
|
|
60
|
+
};
|
|
61
|
+
/** Agent instance returned by `createAgent("cursor-cli", ...)`. */
|
|
62
|
+
interface CursorCliAgent extends BaseAgent<EnsureDisjoint<CursorCliRunOptions>> {
|
|
63
|
+
readonly type: "cursor-cli";
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
//#region src/adapters/cursor-cli/adapter.d.ts
|
|
67
|
+
declare const createCursorCliAgent: (options?: CursorCliAgentOptions) => CursorCliAgent;
|
|
68
|
+
//#endregion
|
|
69
|
+
export { CursorCliRunOptions as a, CursorCliMode as i, CursorCliAgent as n, CursorCliSandboxMode as o, CursorCliAgentOptions as r, CursorCliEvent as s, createCursorCliAgent as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-
|
|
1
|
+
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-Bk-YpdbX.mjs";
|
|
2
2
|
//#region src/adapters/codex-sdk/types.d.ts
|
|
3
3
|
type CodexSdkSandboxMode = "danger-full-access" | "read-only" | "workspace-write";
|
|
4
4
|
type CodexSdkModelReasoningEffort = "high" | "low" | "medium" | "minimal" | "xhigh";
|
|
@@ -7,6 +7,14 @@ type CodexSdkConfigValue = CodexSdkConfigObject | CodexSdkConfigValue[] | boolea
|
|
|
7
7
|
type CodexSdkConfigObject = {
|
|
8
8
|
[key: string]: CodexSdkConfigValue;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Forwarded to Codex's `approvalPolicy`. Codex handles prompts upstream; this
|
|
12
|
+
* adapter does not bridge approvals to a permission handler.
|
|
13
|
+
* - `"never"`: never prompt (auto-allow within the configured sandbox).
|
|
14
|
+
* - `"on-request"`: prompt when Codex requests approval.
|
|
15
|
+
* - `"on-failure"`: prompt only after a tool call fails.
|
|
16
|
+
* - `"untrusted"`: prompt for every potentially destructive action (most restrictive).
|
|
17
|
+
*/
|
|
10
18
|
type CodexSdkPermissionMode = "never" | "on-failure" | "on-request" | "untrusted";
|
|
11
19
|
interface CodexSdkUsage {
|
|
12
20
|
input_tokens: number;
|
|
@@ -109,35 +117,103 @@ interface CodexSdkThreadErrorEvent {
|
|
|
109
117
|
type: "error";
|
|
110
118
|
message: string;
|
|
111
119
|
}
|
|
120
|
+
/**
|
|
121
|
+
* Per-run options for the `codex-sdk` adapter. Forwarded to Codex's
|
|
122
|
+
* `ThreadOptions` and `TurnOptions`.
|
|
123
|
+
*/
|
|
112
124
|
interface CodexSdkRunOptions {
|
|
125
|
+
/**
|
|
126
|
+
* Codex `approvalPolicy` for this run. See {@link CodexSdkPermissionMode}
|
|
127
|
+
* for the four values. Handled upstream by Codex; not bridged to a
|
|
128
|
+
* permission handler in this adapter.
|
|
129
|
+
*/
|
|
113
130
|
permissionMode?: CodexSdkPermissionMode;
|
|
131
|
+
/**
|
|
132
|
+
* Filesystem sandbox policy for tool calls.
|
|
133
|
+
* - `"read-only"`: tools cannot write.
|
|
134
|
+
* - `"workspace-write"`: writes allowed inside `cwd` only.
|
|
135
|
+
* - `"danger-full-access"`: no filesystem restrictions.
|
|
136
|
+
*/
|
|
114
137
|
sandboxMode?: CodexSdkSandboxMode;
|
|
138
|
+
/** Suppress Codex's "not a git repo" confirmation prompt. */
|
|
115
139
|
skipGitRepoCheck?: boolean;
|
|
140
|
+
/** Model reasoning effort budget (`"minimal"` … `"xhigh"`). */
|
|
116
141
|
modelReasoningEffort?: CodexSdkModelReasoningEffort;
|
|
142
|
+
/** Allow tool calls that perform network access. Off by default for safety. */
|
|
117
143
|
networkAccessEnabled?: boolean;
|
|
144
|
+
/** `"disabled"` blocks web search, `"cached"` returns cached results only, `"live"` allows fresh fetches. */
|
|
118
145
|
webSearchMode?: CodexSdkWebSearchMode;
|
|
146
|
+
/** Convenience boolean toggle; combine with `webSearchMode` for finer control. */
|
|
119
147
|
webSearchEnabled?: boolean;
|
|
148
|
+
/** Extra directories outside `cwd` that Codex may read or write under `workspace-write`. */
|
|
120
149
|
additionalDirectories?: string[];
|
|
150
|
+
/** Not supported — Codex manages its own system prompt. */
|
|
121
151
|
systemPrompt?: never;
|
|
122
152
|
}
|
|
153
|
+
/** Constructor options for `createAgent("codex-sdk", ...)`. */
|
|
123
154
|
interface CodexSdkAgentOptions extends CodexSdkRunOptions {
|
|
155
|
+
/** Override the path to the bundled `codex` binary (rarely needed). */
|
|
124
156
|
command?: string;
|
|
157
|
+
/** Override the Codex API base URL. Use for self-hosted or proxy endpoints. */
|
|
125
158
|
baseUrl?: string;
|
|
159
|
+
/** OpenAI API key. Falls back to `OPENAI_API_KEY` from `env`. */
|
|
126
160
|
apiKey?: string;
|
|
161
|
+
/**
|
|
162
|
+
* Additional `--config key=value` overrides forwarded to the Codex CLI.
|
|
163
|
+
* Object is flattened into dotted paths and serialized as TOML literals.
|
|
164
|
+
*/
|
|
127
165
|
config?: CodexSdkConfigObject;
|
|
166
|
+
/** Environment variables for the Codex subprocess. Overrides `process.env` when set. */
|
|
128
167
|
env?: Record<string, string>;
|
|
168
|
+
/**
|
|
169
|
+
* Default `true`: `process.env` is inherited and `env` overlays it. Set
|
|
170
|
+
* `false` to suppress host-env propagation and use only `env`.
|
|
171
|
+
*/
|
|
129
172
|
propagateEnv?: boolean;
|
|
173
|
+
/** Not supported — codex-sdk runs in-process; use `codex-cli` to wrap in a container. */
|
|
130
174
|
container?: never;
|
|
175
|
+
/** Not supported — codex-sdk runs in-process; use `codex-cli` for sandbox wrapping. */
|
|
131
176
|
sandbox?: never;
|
|
177
|
+
/** Working directory the agent operates against. */
|
|
132
178
|
cwd?: string;
|
|
179
|
+
/**
|
|
180
|
+
* Existing Codex thread ID to resume. Threads persist in `~/.codex/sessions`.
|
|
181
|
+
* When set, the adapter calls `resumeThread` instead of `startThread`.
|
|
182
|
+
*/
|
|
133
183
|
sessionId?: string;
|
|
184
|
+
/** Codex model identifier. */
|
|
134
185
|
model?: string;
|
|
186
|
+
/** Convenience: equivalent to calling `agent.onEvent(handler)` post-construction. */
|
|
135
187
|
onEvent?: AgentEventHandler;
|
|
136
188
|
}
|
|
189
|
+
/** Agent instance returned by `createAgent("codex-sdk", ...)`. */
|
|
137
190
|
interface CodexSdkAgent extends BaseAgent<EnsureDisjoint<CodexSdkRunOptions>> {
|
|
138
191
|
readonly type: "codex-sdk";
|
|
139
192
|
}
|
|
193
|
+
/**
|
|
194
|
+
* Discriminated union of thread items Codex emits during a turn. Each item
|
|
195
|
+
* has a lifecycle (`started` → `updated`* → `completed`) carried by the
|
|
196
|
+
* surrounding {@link CodexSdkEvent} wrapper. Narrow on `item.type`:
|
|
197
|
+
*
|
|
198
|
+
* - `"agent_message"` — assistant text or structured-output JSON.
|
|
199
|
+
* - `"reasoning"` — reasoning/thinking summary.
|
|
200
|
+
* - `"command_execution"` — shell command lifecycle with aggregated output.
|
|
201
|
+
* - `"file_change"` — patch applied to the workspace.
|
|
202
|
+
* - `"mcp_tool_call"` — MCP tool invocation lifecycle.
|
|
203
|
+
* - `"web_search"` — web-search request.
|
|
204
|
+
* - `"todo_list"` — agent's running plan.
|
|
205
|
+
* - `"error"` — non-fatal error surfaced as an item.
|
|
206
|
+
*/
|
|
140
207
|
type CodexSdkItem = CodexSdkAgentMessageItem | CodexSdkCommandExecutionItem | CodexSdkErrorItem | CodexSdkFileChangeItem | CodexSdkMcpToolCallItem | CodexSdkReasoningItem | CodexSdkTodoListItem | CodexSdkWebSearchItem;
|
|
208
|
+
/**
|
|
209
|
+
* Discriminated union of top-level events the Codex SDK emits before this
|
|
210
|
+
* adapter normalizes them. Narrow on `event.type`:
|
|
211
|
+
*
|
|
212
|
+
* - `"thread.started"` — first event in a new thread; carries `thread_id`.
|
|
213
|
+
* - `"turn.started"` / `"turn.completed"` / `"turn.failed"` — turn boundary markers.
|
|
214
|
+
* - `"item.started"` / `"item.updated"` / `"item.completed"` — lifecycle of a {@link CodexSdkItem}.
|
|
215
|
+
* - `"error"` — fatal stream-level error.
|
|
216
|
+
*/
|
|
141
217
|
type CodexSdkEvent = CodexSdkItemCompletedEvent | CodexSdkItemStartedEvent | CodexSdkItemUpdatedEvent | CodexSdkThreadErrorEvent | CodexSdkThreadStartedEvent | CodexSdkTurnCompletedEvent | CodexSdkTurnFailedEvent | CodexSdkTurnStartedEvent;
|
|
142
218
|
//#endregion
|
|
143
219
|
//#region src/adapters/codex-sdk/adapter.d.ts
|