coding-agents-sdk 0.0.1 → 0.2.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 +242 -0
- package/dist/Agent-D8WkUilj.mjs +262 -0
- package/dist/SdkAgent-B47mJiIE.mjs +38 -0
- package/dist/adapters/claude-code-cli/index.d.mts +2 -0
- package/dist/adapters/claude-code-cli/index.mjs +490 -0
- package/dist/adapters/claude-code-sdk/index.d.mts +2 -0
- package/dist/adapters/claude-code-sdk/index.mjs +483 -0
- package/dist/adapters/codex-cli/index.d.mts +2 -0
- package/dist/adapters/codex-cli/index.mjs +626 -0
- package/dist/adapters/codex-sdk/index.d.mts +2 -0
- package/dist/adapters/codex-sdk/index.mjs +286 -0
- package/dist/adapters/gemini-cli/index.d.mts +2 -0
- package/dist/adapters/gemini-cli/index.mjs +292 -0
- package/dist/classify-error-pL6jeu4T.mjs +456 -0
- package/dist/container/index.d.mts +2 -0
- package/dist/container/index.mjs +24 -0
- package/dist/container-2UmPZ0CI.mjs +22 -0
- package/dist/container-CHxKIonn.mjs +440 -0
- package/dist/container-D2Z0ITDJ.mjs +22 -0
- package/dist/diff-De8d3MVb.mjs +333 -0
- package/dist/errors-BAmHDQu8.mjs +45 -0
- package/dist/events-nxuRbYIu.d.mts +239 -0
- package/dist/index-B3YqrgIp.d.mts +45 -0
- package/dist/index-ByAOGMUM.d.mts +224 -0
- package/dist/index-C3ZxLAd0.d.mts +315 -0
- package/dist/index-CFpNOmdA.d.mts +145 -0
- package/dist/index-dRVpEAr8.d.mts +39 -0
- package/dist/index-nzo1sBiK.d.mts +110 -0
- package/dist/index.d.mts +16 -0
- package/dist/index.mjs +61 -0
- package/dist/oci-DMZZQZ47.mjs +438 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +2 -0
- package/dist/schemas-DwD4pwJB.mjs +96 -0
- package/dist/spawner-Bw9UBEGX.mjs +54 -0
- package/dist/structured-output-BHtr_zpz.mjs +19 -0
- package/dist/types-Cb_EXIEe.d.mts +177 -0
- package/dist/types-aNMD8h3x.mjs +19 -0
- package/dist/util-B4RQZkKr.mjs +77 -0
- package/package.json +86 -9
- package/index.js +0 -7
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
import { E as ProcessSpawner } from "./types-Cb_EXIEe.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/container/types.d.ts
|
|
4
|
+
type ContainerType = "docker" | "e2b" | "podman";
|
|
5
|
+
interface PortMapping {
|
|
6
|
+
container: number;
|
|
7
|
+
host?: number;
|
|
8
|
+
protocol?: "tcp" | "udp";
|
|
9
|
+
}
|
|
10
|
+
interface VolumeMount {
|
|
11
|
+
source: string;
|
|
12
|
+
target: string;
|
|
13
|
+
readonly?: boolean;
|
|
14
|
+
}
|
|
15
|
+
interface ContainerConfigBase<TType extends ContainerType> {
|
|
16
|
+
type: TType;
|
|
17
|
+
workdir: string;
|
|
18
|
+
name?: string;
|
|
19
|
+
env?: Record<string, string>;
|
|
20
|
+
}
|
|
21
|
+
interface ExecOptions {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
env?: Record<string, string>;
|
|
24
|
+
timeoutMs?: number;
|
|
25
|
+
signal?: AbortSignal;
|
|
26
|
+
}
|
|
27
|
+
interface ExecResult {
|
|
28
|
+
exitCode: number;
|
|
29
|
+
stdout: string;
|
|
30
|
+
stderr: string;
|
|
31
|
+
}
|
|
32
|
+
type ContainerStatus = "created" | "disposed" | "running" | "stopped";
|
|
33
|
+
type WorkdirChangeKind = "added" | "deleted" | "modified" | "renamed";
|
|
34
|
+
interface WorkdirSnapshotOptions {
|
|
35
|
+
cwd?: string;
|
|
36
|
+
}
|
|
37
|
+
interface WorkdirSnapshot {
|
|
38
|
+
readonly cwd: string;
|
|
39
|
+
readonly createdAt: Date;
|
|
40
|
+
}
|
|
41
|
+
interface WorkdirFileChange {
|
|
42
|
+
readonly path: string;
|
|
43
|
+
readonly previousPath?: string;
|
|
44
|
+
readonly kind: WorkdirChangeKind;
|
|
45
|
+
readonly beforeHash?: string;
|
|
46
|
+
readonly afterHash?: string;
|
|
47
|
+
readonly beforeSize?: number;
|
|
48
|
+
readonly afterSize?: number;
|
|
49
|
+
}
|
|
50
|
+
interface WorkdirDiffStats {
|
|
51
|
+
readonly durationMs: number;
|
|
52
|
+
readonly filesCompared: number;
|
|
53
|
+
}
|
|
54
|
+
interface WorkdirDiff {
|
|
55
|
+
readonly cwd: string;
|
|
56
|
+
readonly changedFiles: readonly string[];
|
|
57
|
+
readonly fileChanges: readonly WorkdirFileChange[];
|
|
58
|
+
readonly stats: WorkdirDiffStats;
|
|
59
|
+
}
|
|
60
|
+
interface ContainerIdentity<TType extends ContainerType, TConfig extends ContainerConfigBase<TType>> {
|
|
61
|
+
readonly type: TType;
|
|
62
|
+
readonly id: string;
|
|
63
|
+
readonly name: string;
|
|
64
|
+
readonly config: TConfig;
|
|
65
|
+
readonly status: ContainerStatus;
|
|
66
|
+
readonly workdir: string;
|
|
67
|
+
}
|
|
68
|
+
interface ContainerLifecycle {
|
|
69
|
+
start: () => Promise<void>;
|
|
70
|
+
stop: () => Promise<void>;
|
|
71
|
+
dispose: () => Promise<void>;
|
|
72
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
interface ContainerExecution {
|
|
75
|
+
exec: (command: string, args: string[], options?: ExecOptions) => Promise<ExecResult>;
|
|
76
|
+
execShell: (script: string, options?: ExecOptions) => Promise<ExecResult>;
|
|
77
|
+
readonly spawner: ProcessSpawner;
|
|
78
|
+
}
|
|
79
|
+
interface ContainerFileSystem {
|
|
80
|
+
copyTo: (hostPath: string, containerPath: string) => Promise<void>;
|
|
81
|
+
copyFrom: (containerPath: string, hostPath: string) => Promise<void>;
|
|
82
|
+
writeFile: (path: string, content: Uint8Array | string) => Promise<void>;
|
|
83
|
+
readFile: (path: string) => Promise<string>;
|
|
84
|
+
fileExists: (path: string) => Promise<boolean>;
|
|
85
|
+
mkdir: (path: string) => Promise<void>;
|
|
86
|
+
}
|
|
87
|
+
interface ContainerObservability {
|
|
88
|
+
logs: (options?: {
|
|
89
|
+
tail?: number;
|
|
90
|
+
}) => Promise<string>;
|
|
91
|
+
syncStatus: () => Promise<ContainerStatus>;
|
|
92
|
+
snapshotWorkdir: (options?: WorkdirSnapshotOptions) => Promise<WorkdirSnapshot>;
|
|
93
|
+
diffWorkdir: (snapshot: WorkdirSnapshot) => Promise<WorkdirDiff>;
|
|
94
|
+
releaseWorkdirSnapshot: (snapshot: WorkdirSnapshot) => Promise<void>;
|
|
95
|
+
}
|
|
96
|
+
interface ContainerBase<TType extends ContainerType, TConfig extends ContainerConfigBase<TType>> extends ContainerExecution, ContainerFileSystem, ContainerIdentity<TType, TConfig>, ContainerLifecycle, ContainerObservability {}
|
|
97
|
+
//#endregion
|
|
98
|
+
//#region src/container/oci.d.ts
|
|
99
|
+
interface OciBuildBase {
|
|
100
|
+
context?: string;
|
|
101
|
+
args?: Record<string, string>;
|
|
102
|
+
tag?: string;
|
|
103
|
+
}
|
|
104
|
+
type OciBuildConfig = OciBuildBase & ({
|
|
105
|
+
dockerfile: string;
|
|
106
|
+
content?: never;
|
|
107
|
+
} | {
|
|
108
|
+
dockerfile?: never;
|
|
109
|
+
content: string;
|
|
110
|
+
});
|
|
111
|
+
interface OciProviderBase {
|
|
112
|
+
ports?: PortMapping[];
|
|
113
|
+
mounts?: VolumeMount[];
|
|
114
|
+
user?: string;
|
|
115
|
+
binary?: string;
|
|
116
|
+
extraArgs?: string[];
|
|
117
|
+
network?: string;
|
|
118
|
+
platform?: string;
|
|
119
|
+
}
|
|
120
|
+
type OciProviderConfig = OciProviderBase & ({
|
|
121
|
+
image: string;
|
|
122
|
+
build?: never;
|
|
123
|
+
} | {
|
|
124
|
+
image?: never;
|
|
125
|
+
build: OciBuildConfig;
|
|
126
|
+
});
|
|
127
|
+
//#endregion
|
|
128
|
+
//#region src/container/docker/types.d.ts
|
|
129
|
+
type DockerBuildBase = OciBuildBase;
|
|
130
|
+
type DockerBuildConfig = OciBuildConfig;
|
|
131
|
+
type DockerContainerBase = OciProviderBase;
|
|
132
|
+
type DockerProviderConfig = OciProviderConfig;
|
|
133
|
+
type DockerContainerConfig = ContainerConfigBase<"docker"> & OciProviderConfig;
|
|
134
|
+
interface DockerContainer extends ContainerBase<"docker", DockerContainerConfig> {
|
|
135
|
+
getMappedPort: (containerPort: number) => number | undefined;
|
|
136
|
+
}
|
|
137
|
+
//#endregion
|
|
138
|
+
//#region src/container/e2b/types.d.ts
|
|
139
|
+
interface E2BSandboxNetworkOptions {
|
|
140
|
+
allowOut?: string[];
|
|
141
|
+
denyOut?: string[];
|
|
142
|
+
allowPublicTraffic?: boolean;
|
|
143
|
+
maskRequestHost?: string;
|
|
144
|
+
}
|
|
145
|
+
interface E2BSandboxLifecycleOptions {
|
|
146
|
+
onTimeout: "kill" | "pause";
|
|
147
|
+
autoResume?: boolean;
|
|
148
|
+
}
|
|
149
|
+
interface E2BConnectionConfig {
|
|
150
|
+
apiKey?: string;
|
|
151
|
+
accessToken?: string;
|
|
152
|
+
domain?: string;
|
|
153
|
+
requestTimeoutMs?: number;
|
|
154
|
+
headers?: Record<string, string>;
|
|
155
|
+
}
|
|
156
|
+
interface E2BContainerBase extends E2BConnectionConfig {
|
|
157
|
+
user?: string;
|
|
158
|
+
timeoutMs?: number;
|
|
159
|
+
}
|
|
160
|
+
interface E2BCreateConfig extends E2BContainerBase {
|
|
161
|
+
sandboxId?: never;
|
|
162
|
+
template?: string;
|
|
163
|
+
metadata?: Record<string, string>;
|
|
164
|
+
secure?: boolean;
|
|
165
|
+
allowInternetAccess?: boolean;
|
|
166
|
+
network?: E2BSandboxNetworkOptions;
|
|
167
|
+
lifecycle?: E2BSandboxLifecycleOptions;
|
|
168
|
+
}
|
|
169
|
+
interface E2BConnectConfig extends E2BContainerBase {
|
|
170
|
+
sandboxId: string;
|
|
171
|
+
template?: never;
|
|
172
|
+
metadata?: never;
|
|
173
|
+
secure?: never;
|
|
174
|
+
allowInternetAccess?: never;
|
|
175
|
+
network?: never;
|
|
176
|
+
lifecycle?: never;
|
|
177
|
+
}
|
|
178
|
+
type E2BProviderConfig = E2BConnectConfig | E2BCreateConfig;
|
|
179
|
+
type E2BContainerConfig = ContainerConfigBase<"e2b"> & E2BProviderConfig;
|
|
180
|
+
interface E2BContainer extends ContainerBase<"e2b", E2BContainerConfig> {
|
|
181
|
+
getHost: (port: number) => string;
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
//#region src/container/podman/types.d.ts
|
|
185
|
+
type PodmanBuildBase = OciBuildBase;
|
|
186
|
+
type PodmanBuildConfig = OciBuildConfig;
|
|
187
|
+
type PodmanContainerBase = OciProviderBase;
|
|
188
|
+
type PodmanProviderConfig = OciProviderConfig;
|
|
189
|
+
type PodmanContainerConfig = ContainerConfigBase<"podman"> & OciProviderConfig;
|
|
190
|
+
interface PodmanContainer extends ContainerBase<"podman", PodmanContainerConfig> {
|
|
191
|
+
getMappedPort: (containerPort: number) => number | undefined;
|
|
192
|
+
}
|
|
193
|
+
//#endregion
|
|
194
|
+
//#region src/container/errors.d.ts
|
|
195
|
+
declare class ContainerError extends Error {
|
|
196
|
+
constructor(message: string);
|
|
197
|
+
}
|
|
198
|
+
declare class ContainerCreateError extends ContainerError {
|
|
199
|
+
constructor(message: string);
|
|
200
|
+
}
|
|
201
|
+
declare class ContainerStartError extends ContainerError {
|
|
202
|
+
constructor(message: string);
|
|
203
|
+
}
|
|
204
|
+
declare class ContainerExecError extends ContainerError {
|
|
205
|
+
constructor(message: string);
|
|
206
|
+
}
|
|
207
|
+
declare class ContainerNotRunningError extends ContainerError {
|
|
208
|
+
constructor(message?: string);
|
|
209
|
+
}
|
|
210
|
+
declare class ContainerDisposedError extends ContainerError {
|
|
211
|
+
constructor(message?: string);
|
|
212
|
+
}
|
|
213
|
+
declare class ContainerDiffError extends ContainerError {
|
|
214
|
+
constructor(message: string);
|
|
215
|
+
}
|
|
216
|
+
//#endregion
|
|
217
|
+
//#region src/container/index.d.ts
|
|
218
|
+
type ContainerConfig = DockerContainerConfig | E2BContainerConfig | PodmanContainerConfig;
|
|
219
|
+
type Container = DockerContainer | E2BContainer | PodmanContainer;
|
|
220
|
+
declare function createContainer(config: DockerContainerConfig): Promise<DockerContainer>;
|
|
221
|
+
declare function createContainer(config: E2BContainerConfig): Promise<E2BContainer>;
|
|
222
|
+
declare function createContainer(config: PodmanContainerConfig): Promise<PodmanContainer>;
|
|
223
|
+
//#endregion
|
|
224
|
+
export { ContainerBase as A, ExecResult as B, E2BProviderConfig as C, DockerContainerBase as D, DockerContainer as E, ContainerLifecycle as F, WorkdirDiffStats as G, VolumeMount as H, ContainerObservability as I, WorkdirSnapshotOptions as J, WorkdirFileChange as K, ContainerStatus as L, ContainerExecution as M, ContainerFileSystem as N, DockerContainerConfig as O, ContainerIdentity as P, ContainerType as R, E2BCreateConfig as S, DockerBuildConfig as T, WorkdirChangeKind as U, PortMapping as V, WorkdirDiff as W, E2BConnectConfig as _, ContainerDiffError as a, E2BContainerBase as b, ContainerExecError as c, PodmanBuildBase as d, PodmanBuildConfig as f, PodmanProviderConfig as g, PodmanContainerConfig as h, ContainerCreateError as i, ContainerConfigBase as j, DockerProviderConfig as k, ContainerNotRunningError as l, PodmanContainerBase as m, ContainerConfig as n, ContainerDisposedError as o, PodmanContainer as p, WorkdirSnapshot as q, createContainer as r, ContainerError as s, Container as t, ContainerStartError as u, E2BConnectionConfig as v, DockerBuildBase as w, E2BContainerConfig as x, E2BContainer as y, ExecOptions as z };
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { S as McpServerConfig } from "./events-nxuRbYIu.mjs";
|
|
2
|
+
import { E as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-Cb_EXIEe.mjs";
|
|
3
|
+
import { t as Container } from "./index-ByAOGMUM.mjs";
|
|
4
|
+
import { z } from "zod/v4";
|
|
5
|
+
|
|
6
|
+
//#region src/adapters/claude-code-cli/events/schemas.d.ts
|
|
7
|
+
declare const claudeSystemEventSchema: z.ZodObject<{
|
|
8
|
+
type: z.ZodLiteral<"system">;
|
|
9
|
+
session_id: z.ZodString;
|
|
10
|
+
subtype: z.ZodEnum<{
|
|
11
|
+
init: "init";
|
|
12
|
+
hook_response: "hook_response";
|
|
13
|
+
hook_started: "hook_started";
|
|
14
|
+
hook_finished: "hook_finished";
|
|
15
|
+
hook_failed: "hook_failed";
|
|
16
|
+
hook_skipped: "hook_skipped";
|
|
17
|
+
}>;
|
|
18
|
+
uuid: z.ZodString;
|
|
19
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
20
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
status: z.ZodEnum<{
|
|
23
|
+
error: "error";
|
|
24
|
+
failed: "failed";
|
|
25
|
+
connected: "connected";
|
|
26
|
+
disconnected: "disconnected";
|
|
27
|
+
}>;
|
|
28
|
+
}, z.core.$strip>>>;
|
|
29
|
+
model: z.ZodOptional<z.ZodString>;
|
|
30
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
31
|
+
hook_name: z.ZodOptional<z.ZodString>;
|
|
32
|
+
hook_event: z.ZodOptional<z.ZodString>;
|
|
33
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
34
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
35
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
36
|
+
}, z.core.$strip>;
|
|
37
|
+
type ClaudeSystemEvent = z.infer<typeof claudeSystemEventSchema>;
|
|
38
|
+
declare const claudeAssistantEventSchema: z.ZodObject<{
|
|
39
|
+
type: z.ZodLiteral<"assistant">;
|
|
40
|
+
session_id: z.ZodString;
|
|
41
|
+
uuid: z.ZodString;
|
|
42
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
43
|
+
message: z.ZodObject<{
|
|
44
|
+
id: z.ZodString;
|
|
45
|
+
type: z.ZodLiteral<"message">;
|
|
46
|
+
role: z.ZodLiteral<"assistant">;
|
|
47
|
+
model: z.ZodString;
|
|
48
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
49
|
+
type: z.ZodLiteral<"text">;
|
|
50
|
+
text: z.ZodString;
|
|
51
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
52
|
+
type: z.ZodLiteral<"tool_use">;
|
|
53
|
+
id: z.ZodString;
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
56
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
57
|
+
type: z.ZodLiteral<"thinking">;
|
|
58
|
+
thinking: z.ZodString;
|
|
59
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
60
|
+
}, z.core.$strip>]>>;
|
|
61
|
+
stop_reason: z.ZodNullable<z.ZodEnum<{
|
|
62
|
+
tool_use: "tool_use";
|
|
63
|
+
end_turn: "end_turn";
|
|
64
|
+
max_tokens: "max_tokens";
|
|
65
|
+
stop_sequence: "stop_sequence";
|
|
66
|
+
}>>;
|
|
67
|
+
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
68
|
+
context_management: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
69
|
+
usage: z.ZodObject<{
|
|
70
|
+
input_tokens: z.ZodNumber;
|
|
71
|
+
output_tokens: z.ZodNumber;
|
|
72
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
75
|
+
premium: "premium";
|
|
76
|
+
standard: "standard";
|
|
77
|
+
}>>>;
|
|
78
|
+
}, z.core.$strip>;
|
|
79
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
80
|
+
}, z.core.$strip>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type ClaudeAssistantEvent = z.infer<typeof claudeAssistantEventSchema>;
|
|
83
|
+
declare const claudeUserEventSchema: z.ZodObject<{
|
|
84
|
+
type: z.ZodLiteral<"user">;
|
|
85
|
+
session_id: z.ZodString;
|
|
86
|
+
message: z.ZodObject<{
|
|
87
|
+
role: z.ZodLiteral<"user">;
|
|
88
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
89
|
+
type: z.ZodLiteral<"tool_result">;
|
|
90
|
+
tool_use_id: z.ZodString;
|
|
91
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
92
|
+
type: z.ZodLiteral<"text">;
|
|
93
|
+
text: z.ZodString;
|
|
94
|
+
}, z.core.$strip>>]>;
|
|
95
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
97
|
+
type: z.ZodLiteral<"text">;
|
|
98
|
+
text: z.ZodString;
|
|
99
|
+
}, z.core.$strip>]>>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
102
|
+
uuid: z.ZodString;
|
|
103
|
+
isSynthetic: z.ZodOptional<z.ZodBoolean>;
|
|
104
|
+
}, z.core.$strip>;
|
|
105
|
+
type ClaudeUserEvent = z.infer<typeof claudeUserEventSchema>;
|
|
106
|
+
declare const claudeResultEventSchema: z.ZodObject<{
|
|
107
|
+
type: z.ZodLiteral<"result">;
|
|
108
|
+
session_id: z.ZodString;
|
|
109
|
+
uuid: z.ZodString;
|
|
110
|
+
subtype: z.ZodEnum<{
|
|
111
|
+
success: "success";
|
|
112
|
+
error_max_turns: "error_max_turns";
|
|
113
|
+
error_during_execution: "error_during_execution";
|
|
114
|
+
}>;
|
|
115
|
+
duration_ms: z.ZodNumber;
|
|
116
|
+
duration_api_ms: z.ZodNumber;
|
|
117
|
+
is_error: z.ZodBoolean;
|
|
118
|
+
num_turns: z.ZodNumber;
|
|
119
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
120
|
+
structured_output: z.ZodOptional<z.ZodUnknown>;
|
|
121
|
+
total_cost_usd: z.ZodNumber;
|
|
122
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
123
|
+
input_tokens: z.ZodNumber;
|
|
124
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
125
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
output_tokens: z.ZodNumber;
|
|
127
|
+
server_tool_use: z.ZodOptional<z.ZodObject<{
|
|
128
|
+
web_search_requests: z.ZodNumber;
|
|
129
|
+
}, z.core.$strip>>;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
}, z.core.$strip>;
|
|
132
|
+
type ClaudeResultEvent = z.infer<typeof claudeResultEventSchema>;
|
|
133
|
+
declare const claudeRateLimitEventSchema: z.ZodObject<{
|
|
134
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
135
|
+
uuid: z.ZodString;
|
|
136
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
137
|
+
rate_limit_info: z.ZodObject<{
|
|
138
|
+
status: z.ZodString;
|
|
139
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
140
|
+
rateLimitType: z.ZodOptional<z.ZodString>;
|
|
141
|
+
overageStatus: z.ZodOptional<z.ZodString>;
|
|
142
|
+
overageDisabledReason: z.ZodOptional<z.ZodString>;
|
|
143
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
144
|
+
}, z.core.$strip>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
type ClaudeRateLimitEvent = z.infer<typeof claudeRateLimitEventSchema>;
|
|
147
|
+
declare const claudeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
148
|
+
type: z.ZodLiteral<"system">;
|
|
149
|
+
session_id: z.ZodString;
|
|
150
|
+
subtype: z.ZodEnum<{
|
|
151
|
+
init: "init";
|
|
152
|
+
hook_response: "hook_response";
|
|
153
|
+
hook_started: "hook_started";
|
|
154
|
+
hook_finished: "hook_finished";
|
|
155
|
+
hook_failed: "hook_failed";
|
|
156
|
+
hook_skipped: "hook_skipped";
|
|
157
|
+
}>;
|
|
158
|
+
uuid: z.ZodString;
|
|
159
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
160
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
161
|
+
name: z.ZodString;
|
|
162
|
+
status: z.ZodEnum<{
|
|
163
|
+
error: "error";
|
|
164
|
+
failed: "failed";
|
|
165
|
+
connected: "connected";
|
|
166
|
+
disconnected: "disconnected";
|
|
167
|
+
}>;
|
|
168
|
+
}, z.core.$strip>>>;
|
|
169
|
+
model: z.ZodOptional<z.ZodString>;
|
|
170
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
171
|
+
hook_name: z.ZodOptional<z.ZodString>;
|
|
172
|
+
hook_event: z.ZodOptional<z.ZodString>;
|
|
173
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
174
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
175
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
177
|
+
type: z.ZodLiteral<"assistant">;
|
|
178
|
+
session_id: z.ZodString;
|
|
179
|
+
uuid: z.ZodString;
|
|
180
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
181
|
+
message: z.ZodObject<{
|
|
182
|
+
id: z.ZodString;
|
|
183
|
+
type: z.ZodLiteral<"message">;
|
|
184
|
+
role: z.ZodLiteral<"assistant">;
|
|
185
|
+
model: z.ZodString;
|
|
186
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"text">;
|
|
188
|
+
text: z.ZodString;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"tool_use">;
|
|
191
|
+
id: z.ZodString;
|
|
192
|
+
name: z.ZodString;
|
|
193
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
194
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
195
|
+
type: z.ZodLiteral<"thinking">;
|
|
196
|
+
thinking: z.ZodString;
|
|
197
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
198
|
+
}, z.core.$strip>]>>;
|
|
199
|
+
stop_reason: z.ZodNullable<z.ZodEnum<{
|
|
200
|
+
tool_use: "tool_use";
|
|
201
|
+
end_turn: "end_turn";
|
|
202
|
+
max_tokens: "max_tokens";
|
|
203
|
+
stop_sequence: "stop_sequence";
|
|
204
|
+
}>>;
|
|
205
|
+
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
206
|
+
context_management: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
207
|
+
usage: z.ZodObject<{
|
|
208
|
+
input_tokens: z.ZodNumber;
|
|
209
|
+
output_tokens: z.ZodNumber;
|
|
210
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
211
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
213
|
+
premium: "premium";
|
|
214
|
+
standard: "standard";
|
|
215
|
+
}>>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
218
|
+
}, z.core.$strip>;
|
|
219
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
220
|
+
type: z.ZodLiteral<"user">;
|
|
221
|
+
session_id: z.ZodString;
|
|
222
|
+
message: z.ZodObject<{
|
|
223
|
+
role: z.ZodLiteral<"user">;
|
|
224
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
225
|
+
type: z.ZodLiteral<"tool_result">;
|
|
226
|
+
tool_use_id: z.ZodString;
|
|
227
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
228
|
+
type: z.ZodLiteral<"text">;
|
|
229
|
+
text: z.ZodString;
|
|
230
|
+
}, z.core.$strip>>]>;
|
|
231
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
232
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
233
|
+
type: z.ZodLiteral<"text">;
|
|
234
|
+
text: z.ZodString;
|
|
235
|
+
}, z.core.$strip>]>>;
|
|
236
|
+
}, z.core.$strip>;
|
|
237
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
238
|
+
uuid: z.ZodString;
|
|
239
|
+
isSynthetic: z.ZodOptional<z.ZodBoolean>;
|
|
240
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
241
|
+
type: z.ZodLiteral<"result">;
|
|
242
|
+
session_id: z.ZodString;
|
|
243
|
+
uuid: z.ZodString;
|
|
244
|
+
subtype: z.ZodEnum<{
|
|
245
|
+
success: "success";
|
|
246
|
+
error_max_turns: "error_max_turns";
|
|
247
|
+
error_during_execution: "error_during_execution";
|
|
248
|
+
}>;
|
|
249
|
+
duration_ms: z.ZodNumber;
|
|
250
|
+
duration_api_ms: z.ZodNumber;
|
|
251
|
+
is_error: z.ZodBoolean;
|
|
252
|
+
num_turns: z.ZodNumber;
|
|
253
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
254
|
+
structured_output: z.ZodOptional<z.ZodUnknown>;
|
|
255
|
+
total_cost_usd: z.ZodNumber;
|
|
256
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
257
|
+
input_tokens: z.ZodNumber;
|
|
258
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
259
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
output_tokens: z.ZodNumber;
|
|
261
|
+
server_tool_use: z.ZodOptional<z.ZodObject<{
|
|
262
|
+
web_search_requests: z.ZodNumber;
|
|
263
|
+
}, z.core.$strip>>;
|
|
264
|
+
}, z.core.$strip>>;
|
|
265
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
266
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
267
|
+
uuid: z.ZodString;
|
|
268
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
269
|
+
rate_limit_info: z.ZodObject<{
|
|
270
|
+
status: z.ZodString;
|
|
271
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
272
|
+
rateLimitType: z.ZodOptional<z.ZodString>;
|
|
273
|
+
overageStatus: z.ZodOptional<z.ZodString>;
|
|
274
|
+
overageDisabledReason: z.ZodOptional<z.ZodString>;
|
|
275
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
276
|
+
}, z.core.$strip>;
|
|
277
|
+
}, z.core.$strip>], "type">;
|
|
278
|
+
type ClaudeEvent = z.infer<typeof claudeEventSchema>;
|
|
279
|
+
//#endregion
|
|
280
|
+
//#region src/adapters/claude-code-cli/types.d.ts
|
|
281
|
+
type ClaudeCodeCliPermissionMode = "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "plan";
|
|
282
|
+
interface ClaudeCodeCliRunOptions {
|
|
283
|
+
allowedTools?: string[];
|
|
284
|
+
disallowedTools?: string[];
|
|
285
|
+
appendSystemPrompt?: string;
|
|
286
|
+
permissionMode?: ClaudeCodeCliPermissionMode;
|
|
287
|
+
mcpConfig?: string[] | string;
|
|
288
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
289
|
+
forkSession?: boolean;
|
|
290
|
+
extraArgs?: string[];
|
|
291
|
+
}
|
|
292
|
+
interface ClaudeCodeCliAgentOptions extends ClaudeCodeCliRunOptions {
|
|
293
|
+
command?: string[] | string;
|
|
294
|
+
cwd?: string;
|
|
295
|
+
env?: Record<string, string>;
|
|
296
|
+
propagateEnv?: boolean;
|
|
297
|
+
sessionId?: string;
|
|
298
|
+
model?: string;
|
|
299
|
+
systemPrompt?: string;
|
|
300
|
+
logPath?: string;
|
|
301
|
+
ci?: boolean;
|
|
302
|
+
container?: Container;
|
|
303
|
+
spawner?: ProcessSpawner;
|
|
304
|
+
onEvent?: AgentEventHandler;
|
|
305
|
+
}
|
|
306
|
+
interface ClaudeCodeCliAgent extends BaseAgent<EnsureDisjoint<ClaudeCodeCliRunOptions>> {
|
|
307
|
+
readonly type: "claude-code-cli";
|
|
308
|
+
fork: () => ClaudeCodeCliAgent;
|
|
309
|
+
dispose: () => Promise<void>;
|
|
310
|
+
}
|
|
311
|
+
//#endregion
|
|
312
|
+
//#region src/adapters/claude-code-cli/adapter.d.ts
|
|
313
|
+
declare const createClaudeCodeCliAgent: (options?: ClaudeCodeCliAgentOptions) => ClaudeCodeCliAgent;
|
|
314
|
+
//#endregion
|
|
315
|
+
export { ClaudeCodeCliRunOptions as a, ClaudeRateLimitEvent as c, ClaudeUserEvent as d, ClaudeCodeCliPermissionMode as i, ClaudeResultEvent as l, ClaudeCodeCliAgent as n, ClaudeAssistantEvent as o, ClaudeCodeCliAgentOptions as r, ClaudeEvent as s, createClaudeCodeCliAgent as t, ClaudeSystemEvent as u };
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-Cb_EXIEe.mjs";
|
|
2
|
+
//#region src/adapters/codex-sdk/types.d.ts
|
|
3
|
+
type CodexSdkSandboxMode = "danger-full-access" | "read-only" | "workspace-write";
|
|
4
|
+
type CodexSdkModelReasoningEffort = "high" | "low" | "medium" | "minimal" | "xhigh";
|
|
5
|
+
type CodexSdkWebSearchMode = "cached" | "disabled" | "live";
|
|
6
|
+
type CodexSdkConfigValue = CodexSdkConfigObject | CodexSdkConfigValue[] | boolean | number | string;
|
|
7
|
+
type CodexSdkConfigObject = {
|
|
8
|
+
[key: string]: CodexSdkConfigValue;
|
|
9
|
+
};
|
|
10
|
+
type CodexSdkPermissionMode = "never" | "on-failure" | "on-request" | "untrusted";
|
|
11
|
+
interface CodexSdkUsage {
|
|
12
|
+
input_tokens: number;
|
|
13
|
+
cached_input_tokens: number;
|
|
14
|
+
output_tokens: number;
|
|
15
|
+
}
|
|
16
|
+
interface CodexSdkCommandExecutionItem {
|
|
17
|
+
id: string;
|
|
18
|
+
type: "command_execution";
|
|
19
|
+
command: string;
|
|
20
|
+
aggregated_output: string;
|
|
21
|
+
exit_code?: number;
|
|
22
|
+
status: "completed" | "failed" | "in_progress";
|
|
23
|
+
}
|
|
24
|
+
interface CodexSdkFileUpdateChange {
|
|
25
|
+
path: string;
|
|
26
|
+
kind: "add" | "delete" | "update";
|
|
27
|
+
}
|
|
28
|
+
interface CodexSdkFileChangeItem {
|
|
29
|
+
id: string;
|
|
30
|
+
type: "file_change";
|
|
31
|
+
changes: CodexSdkFileUpdateChange[];
|
|
32
|
+
status: "completed" | "failed";
|
|
33
|
+
}
|
|
34
|
+
interface CodexSdkMcpToolCallItem {
|
|
35
|
+
id: string;
|
|
36
|
+
type: "mcp_tool_call";
|
|
37
|
+
server: string;
|
|
38
|
+
tool: string;
|
|
39
|
+
arguments: unknown;
|
|
40
|
+
result?: {
|
|
41
|
+
content: unknown[];
|
|
42
|
+
structured_content: unknown;
|
|
43
|
+
};
|
|
44
|
+
error?: {
|
|
45
|
+
message: string;
|
|
46
|
+
};
|
|
47
|
+
status: "completed" | "failed" | "in_progress";
|
|
48
|
+
}
|
|
49
|
+
interface CodexSdkAgentMessageItem {
|
|
50
|
+
id: string;
|
|
51
|
+
type: "agent_message";
|
|
52
|
+
text: string;
|
|
53
|
+
}
|
|
54
|
+
interface CodexSdkReasoningItem {
|
|
55
|
+
id: string;
|
|
56
|
+
type: "reasoning";
|
|
57
|
+
text: string;
|
|
58
|
+
}
|
|
59
|
+
interface CodexSdkWebSearchItem {
|
|
60
|
+
id: string;
|
|
61
|
+
type: "web_search";
|
|
62
|
+
query: string;
|
|
63
|
+
}
|
|
64
|
+
interface CodexSdkErrorItem {
|
|
65
|
+
id: string;
|
|
66
|
+
type: "error";
|
|
67
|
+
message: string;
|
|
68
|
+
}
|
|
69
|
+
interface CodexSdkTodoItem {
|
|
70
|
+
text: string;
|
|
71
|
+
completed: boolean;
|
|
72
|
+
}
|
|
73
|
+
interface CodexSdkTodoListItem {
|
|
74
|
+
id: string;
|
|
75
|
+
type: "todo_list";
|
|
76
|
+
items: CodexSdkTodoItem[];
|
|
77
|
+
}
|
|
78
|
+
interface CodexSdkThreadError {
|
|
79
|
+
message: string;
|
|
80
|
+
}
|
|
81
|
+
interface CodexSdkThreadStartedEvent {
|
|
82
|
+
type: "thread.started";
|
|
83
|
+
thread_id: string;
|
|
84
|
+
}
|
|
85
|
+
interface CodexSdkTurnStartedEvent {
|
|
86
|
+
type: "turn.started";
|
|
87
|
+
}
|
|
88
|
+
interface CodexSdkTurnCompletedEvent {
|
|
89
|
+
type: "turn.completed";
|
|
90
|
+
usage: CodexSdkUsage;
|
|
91
|
+
}
|
|
92
|
+
interface CodexSdkTurnFailedEvent {
|
|
93
|
+
type: "turn.failed";
|
|
94
|
+
error: CodexSdkThreadError;
|
|
95
|
+
}
|
|
96
|
+
interface CodexSdkItemStartedEvent {
|
|
97
|
+
type: "item.started";
|
|
98
|
+
item: CodexSdkItem;
|
|
99
|
+
}
|
|
100
|
+
interface CodexSdkItemUpdatedEvent {
|
|
101
|
+
type: "item.updated";
|
|
102
|
+
item: CodexSdkItem;
|
|
103
|
+
}
|
|
104
|
+
interface CodexSdkItemCompletedEvent {
|
|
105
|
+
type: "item.completed";
|
|
106
|
+
item: CodexSdkItem;
|
|
107
|
+
}
|
|
108
|
+
interface CodexSdkThreadErrorEvent {
|
|
109
|
+
type: "error";
|
|
110
|
+
message: string;
|
|
111
|
+
}
|
|
112
|
+
interface CodexSdkRunOptions {
|
|
113
|
+
permissionMode?: CodexSdkPermissionMode;
|
|
114
|
+
sandboxMode?: CodexSdkSandboxMode;
|
|
115
|
+
skipGitRepoCheck?: boolean;
|
|
116
|
+
modelReasoningEffort?: CodexSdkModelReasoningEffort;
|
|
117
|
+
networkAccessEnabled?: boolean;
|
|
118
|
+
webSearchMode?: CodexSdkWebSearchMode;
|
|
119
|
+
webSearchEnabled?: boolean;
|
|
120
|
+
additionalDirectories?: string[];
|
|
121
|
+
systemPrompt?: never;
|
|
122
|
+
}
|
|
123
|
+
interface CodexSdkAgentOptions extends CodexSdkRunOptions {
|
|
124
|
+
command?: string;
|
|
125
|
+
baseUrl?: string;
|
|
126
|
+
apiKey?: string;
|
|
127
|
+
config?: CodexSdkConfigObject;
|
|
128
|
+
env?: Record<string, string>;
|
|
129
|
+
propagateEnv?: boolean;
|
|
130
|
+
container?: never;
|
|
131
|
+
cwd?: string;
|
|
132
|
+
sessionId?: string;
|
|
133
|
+
model?: string;
|
|
134
|
+
onEvent?: AgentEventHandler;
|
|
135
|
+
}
|
|
136
|
+
interface CodexSdkAgent extends BaseAgent<EnsureDisjoint<CodexSdkRunOptions>> {
|
|
137
|
+
readonly type: "codex-sdk";
|
|
138
|
+
}
|
|
139
|
+
type CodexSdkItem = CodexSdkAgentMessageItem | CodexSdkCommandExecutionItem | CodexSdkErrorItem | CodexSdkFileChangeItem | CodexSdkMcpToolCallItem | CodexSdkReasoningItem | CodexSdkTodoListItem | CodexSdkWebSearchItem;
|
|
140
|
+
type CodexSdkEvent = CodexSdkItemCompletedEvent | CodexSdkItemStartedEvent | CodexSdkItemUpdatedEvent | CodexSdkThreadErrorEvent | CodexSdkThreadStartedEvent | CodexSdkTurnCompletedEvent | CodexSdkTurnFailedEvent | CodexSdkTurnStartedEvent;
|
|
141
|
+
//#endregion
|
|
142
|
+
//#region src/adapters/codex-sdk/adapter.d.ts
|
|
143
|
+
declare const createCodexSdkAgent: (options?: CodexSdkAgentOptions) => CodexSdkAgent;
|
|
144
|
+
//#endregion
|
|
145
|
+
export { CodexSdkItem as a, CodexSdkEvent as i, CodexSdkAgent as n, CodexSdkPermissionMode as o, CodexSdkAgentOptions as r, CodexSdkRunOptions as s, createCodexSdkAgent as t };
|