coding-agents-sdk 0.0.1 → 0.3.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 +274 -0
- package/dist/SdkAgent-a97nkDuR.mjs +1 -0
- package/dist/adapters/claude-code-cli/index.d.mts +2 -0
- package/dist/adapters/claude-code-cli/index.mjs +2 -0
- package/dist/adapters/claude-code-sdk/index.d.mts +2 -0
- package/dist/adapters/claude-code-sdk/index.mjs +4 -0
- package/dist/adapters/codex-cli/index.d.mts +2 -0
- package/dist/adapters/codex-cli/index.mjs +2 -0
- package/dist/adapters/codex-sdk/index.d.mts +2 -0
- package/dist/adapters/codex-sdk/index.mjs +1 -0
- package/dist/adapters/gemini-cli/index.d.mts +2 -0
- package/dist/adapters/gemini-cli/index.mjs +1 -0
- package/dist/classify-error-V6x6jP_R.mjs +8 -0
- package/dist/container/index.d.mts +2 -0
- package/dist/container/index.mjs +1 -0
- package/dist/container-BY7JDOGo.mjs +1 -0
- package/dist/container-DWTITDhL.mjs +1 -0
- package/dist/container-vkn5-3Xl.mjs +1 -0
- package/dist/diff-BCfLDXNN.mjs +1 -0
- package/dist/env-Dkd8Sgjf.mjs +1 -0
- package/dist/errors-XV0frS3r.mjs +1 -0
- package/dist/events-D31_b0sA.d.mts +239 -0
- package/dist/execution-target-BJ5mWjDM.mjs +4 -0
- package/dist/index-COHwWTg_.d.mts +315 -0
- package/dist/index-CzvanLE_.d.mts +46 -0
- package/dist/index-DCaZeLrI.d.mts +51 -0
- package/dist/index-DNyKelMh.d.mts +39 -0
- package/dist/index-DP4Jxoax.d.mts +110 -0
- package/dist/index-R77YR8ak.d.mts +224 -0
- package/dist/index-jUwKDQ34.d.mts +146 -0
- package/dist/index.d.mts +17 -0
- package/dist/index.mjs +1 -0
- package/dist/oci-C_S_FKHj.mjs +1 -0
- package/dist/sandbox/index.d.mts +2 -0
- package/dist/sandbox/index.mjs +1 -0
- package/dist/sandbox-DeKpyenZ.mjs +1 -0
- package/dist/schemas/index.d.mts +2 -0
- package/dist/schemas/index.mjs +1 -0
- package/dist/schemas-BM6qORw3.mjs +1 -0
- package/dist/spawner-BJesLc8I.mjs +1 -0
- package/dist/structured-output-DEkBQ-1Z.mjs +1 -0
- package/dist/types-COlDAzs5.d.mts +162 -0
- package/dist/types-CwvWHEpy.mjs +1 -0
- package/dist/util-CGg8cK92.mjs +1 -0
- package/package.json +90 -9
- package/index.js +0 -7
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
import { ZodType, z } from "zod/v4";
|
|
2
|
+
|
|
3
|
+
//#region src/schemas/agent.d.ts
|
|
4
|
+
declare const textContentPartSchema: z.ZodObject<{
|
|
5
|
+
type: z.ZodLiteral<"text">;
|
|
6
|
+
text: z.ZodString;
|
|
7
|
+
}, z.core.$strip>;
|
|
8
|
+
type TextContentPart = z.infer<typeof textContentPartSchema>;
|
|
9
|
+
declare const imageContentPartSchema: z.ZodObject<{
|
|
10
|
+
type: z.ZodLiteral<"image">;
|
|
11
|
+
path: z.ZodString;
|
|
12
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
type ImageContentPart = z.infer<typeof imageContentPartSchema>;
|
|
15
|
+
declare const contentPartSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
16
|
+
type: z.ZodLiteral<"text">;
|
|
17
|
+
text: z.ZodString;
|
|
18
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
+
type: z.ZodLiteral<"image">;
|
|
20
|
+
path: z.ZodString;
|
|
21
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
22
|
+
}, z.core.$strip>], "type">;
|
|
23
|
+
type ContentPart = z.infer<typeof contentPartSchema>;
|
|
24
|
+
declare const agentCapabilitiesSchema: z.ZodObject<{
|
|
25
|
+
structuredOutput: z.ZodBoolean;
|
|
26
|
+
sessionResume: z.ZodBoolean;
|
|
27
|
+
imageInput: z.ZodBoolean;
|
|
28
|
+
mcp: z.ZodBoolean;
|
|
29
|
+
eventStreaming: z.ZodBoolean;
|
|
30
|
+
sessionFork: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
}, z.core.$strip>;
|
|
32
|
+
type AgentCapabilities = z.infer<typeof agentCapabilitiesSchema>;
|
|
33
|
+
type JsonSchema = Record<string, unknown> | ReturnType<typeof z.toJSONSchema>;
|
|
34
|
+
type OutputSchema = JsonSchema | ZodType;
|
|
35
|
+
interface McpServerConfig {
|
|
36
|
+
command?: string;
|
|
37
|
+
args?: string[];
|
|
38
|
+
url?: string;
|
|
39
|
+
cwd?: string;
|
|
40
|
+
env?: Record<string, string>;
|
|
41
|
+
headers?: Record<string, string>;
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/schemas/events.d.ts
|
|
45
|
+
declare const baseEventSchema: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
runId: z.ZodString;
|
|
48
|
+
timestamp: z.ZodDate;
|
|
49
|
+
}, z.core.$strip>;
|
|
50
|
+
declare const sessionStartEventSchema: z.ZodObject<{
|
|
51
|
+
id: z.ZodString;
|
|
52
|
+
runId: z.ZodString;
|
|
53
|
+
timestamp: z.ZodDate;
|
|
54
|
+
type: z.ZodLiteral<"session-start">;
|
|
55
|
+
requestedSessionId: z.ZodOptional<z.ZodString>;
|
|
56
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
57
|
+
resumed: z.ZodBoolean;
|
|
58
|
+
}, z.core.$strip>;
|
|
59
|
+
type SessionStartEvent = z.infer<typeof sessionStartEventSchema>;
|
|
60
|
+
declare const messageEventSchema: z.ZodObject<{
|
|
61
|
+
id: z.ZodString;
|
|
62
|
+
runId: z.ZodString;
|
|
63
|
+
timestamp: z.ZodDate;
|
|
64
|
+
type: z.ZodLiteral<"message">;
|
|
65
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
66
|
+
model: z.ZodNullable<z.ZodString>;
|
|
67
|
+
role: z.ZodEnum<{
|
|
68
|
+
system: "system";
|
|
69
|
+
user: "user";
|
|
70
|
+
assistant: "assistant";
|
|
71
|
+
}>;
|
|
72
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
73
|
+
type: z.ZodLiteral<"text">;
|
|
74
|
+
text: z.ZodString;
|
|
75
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
76
|
+
type: z.ZodLiteral<"image">;
|
|
77
|
+
path: z.ZodString;
|
|
78
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
79
|
+
}, z.core.$strip>], "type">>;
|
|
80
|
+
text: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
type MessageEvent = z.infer<typeof messageEventSchema>;
|
|
83
|
+
declare const reasoningEventSchema: z.ZodObject<{
|
|
84
|
+
id: z.ZodString;
|
|
85
|
+
runId: z.ZodString;
|
|
86
|
+
timestamp: z.ZodDate;
|
|
87
|
+
type: z.ZodLiteral<"reasoning">;
|
|
88
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
89
|
+
model: z.ZodNullable<z.ZodString>;
|
|
90
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
91
|
+
type: z.ZodLiteral<"text">;
|
|
92
|
+
text: z.ZodString;
|
|
93
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
+
type: z.ZodLiteral<"image">;
|
|
95
|
+
path: z.ZodString;
|
|
96
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
97
|
+
}, z.core.$strip>], "type">>;
|
|
98
|
+
text: z.ZodOptional<z.ZodString>;
|
|
99
|
+
}, z.core.$strip>;
|
|
100
|
+
type ReasoningEvent = z.infer<typeof reasoningEventSchema>;
|
|
101
|
+
declare const toolCallEventSchema: z.ZodObject<{
|
|
102
|
+
id: z.ZodString;
|
|
103
|
+
runId: z.ZodString;
|
|
104
|
+
timestamp: z.ZodDate;
|
|
105
|
+
type: z.ZodLiteral<"tool-call">;
|
|
106
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
model: z.ZodNullable<z.ZodString>;
|
|
108
|
+
toolCallId: z.ZodString;
|
|
109
|
+
toolName: z.ZodString;
|
|
110
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
111
|
+
}, z.core.$strip>;
|
|
112
|
+
type ToolCallEvent = z.infer<typeof toolCallEventSchema>;
|
|
113
|
+
declare const toolResultEventSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodString;
|
|
115
|
+
runId: z.ZodString;
|
|
116
|
+
timestamp: z.ZodDate;
|
|
117
|
+
type: z.ZodLiteral<"tool-result">;
|
|
118
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
119
|
+
toolCallId: z.ZodString;
|
|
120
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
121
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
122
|
+
output: z.ZodUnknown;
|
|
123
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
124
|
+
error: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>;
|
|
126
|
+
type ToolResultEvent = z.infer<typeof toolResultEventSchema>;
|
|
127
|
+
declare const stderrEventSchema: z.ZodObject<{
|
|
128
|
+
id: z.ZodString;
|
|
129
|
+
runId: z.ZodString;
|
|
130
|
+
timestamp: z.ZodDate;
|
|
131
|
+
type: z.ZodLiteral<"stderr">;
|
|
132
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
133
|
+
text: z.ZodString;
|
|
134
|
+
}, z.core.$strip>;
|
|
135
|
+
type StderrEvent = z.infer<typeof stderrEventSchema>;
|
|
136
|
+
declare const sessionEndEventSchema: z.ZodObject<{
|
|
137
|
+
id: z.ZodString;
|
|
138
|
+
runId: z.ZodString;
|
|
139
|
+
timestamp: z.ZodDate;
|
|
140
|
+
type: z.ZodLiteral<"session-end">;
|
|
141
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
142
|
+
status: z.ZodEnum<{
|
|
143
|
+
completed: "completed";
|
|
144
|
+
failed: "failed";
|
|
145
|
+
cancelled: "cancelled";
|
|
146
|
+
}>;
|
|
147
|
+
error: z.ZodOptional<z.ZodString>;
|
|
148
|
+
}, z.core.$strip>;
|
|
149
|
+
type SessionEndEvent = z.infer<typeof sessionEndEventSchema>;
|
|
150
|
+
declare const eventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
151
|
+
id: z.ZodString;
|
|
152
|
+
runId: z.ZodString;
|
|
153
|
+
timestamp: z.ZodDate;
|
|
154
|
+
type: z.ZodLiteral<"session-start">;
|
|
155
|
+
requestedSessionId: z.ZodOptional<z.ZodString>;
|
|
156
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
157
|
+
resumed: z.ZodBoolean;
|
|
158
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
+
id: z.ZodString;
|
|
160
|
+
runId: z.ZodString;
|
|
161
|
+
timestamp: z.ZodDate;
|
|
162
|
+
type: z.ZodLiteral<"message">;
|
|
163
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
164
|
+
model: z.ZodNullable<z.ZodString>;
|
|
165
|
+
role: z.ZodEnum<{
|
|
166
|
+
system: "system";
|
|
167
|
+
user: "user";
|
|
168
|
+
assistant: "assistant";
|
|
169
|
+
}>;
|
|
170
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
171
|
+
type: z.ZodLiteral<"text">;
|
|
172
|
+
text: z.ZodString;
|
|
173
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
174
|
+
type: z.ZodLiteral<"image">;
|
|
175
|
+
path: z.ZodString;
|
|
176
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
177
|
+
}, z.core.$strip>], "type">>;
|
|
178
|
+
text: z.ZodOptional<z.ZodString>;
|
|
179
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
180
|
+
id: z.ZodString;
|
|
181
|
+
runId: z.ZodString;
|
|
182
|
+
timestamp: z.ZodDate;
|
|
183
|
+
type: z.ZodLiteral<"reasoning">;
|
|
184
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
185
|
+
model: z.ZodNullable<z.ZodString>;
|
|
186
|
+
content: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
187
|
+
type: z.ZodLiteral<"text">;
|
|
188
|
+
text: z.ZodString;
|
|
189
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
190
|
+
type: z.ZodLiteral<"image">;
|
|
191
|
+
path: z.ZodString;
|
|
192
|
+
mediaType: z.ZodOptional<z.ZodString>;
|
|
193
|
+
}, z.core.$strip>], "type">>;
|
|
194
|
+
text: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
id: z.ZodString;
|
|
197
|
+
runId: z.ZodString;
|
|
198
|
+
timestamp: z.ZodDate;
|
|
199
|
+
type: z.ZodLiteral<"tool-call">;
|
|
200
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
201
|
+
model: z.ZodNullable<z.ZodString>;
|
|
202
|
+
toolCallId: z.ZodString;
|
|
203
|
+
toolName: z.ZodString;
|
|
204
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
205
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
206
|
+
id: z.ZodString;
|
|
207
|
+
runId: z.ZodString;
|
|
208
|
+
timestamp: z.ZodDate;
|
|
209
|
+
type: z.ZodLiteral<"tool-result">;
|
|
210
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
211
|
+
toolCallId: z.ZodString;
|
|
212
|
+
toolName: z.ZodOptional<z.ZodString>;
|
|
213
|
+
input: z.ZodOptional<z.ZodUnknown>;
|
|
214
|
+
output: z.ZodUnknown;
|
|
215
|
+
isError: z.ZodOptional<z.ZodBoolean>;
|
|
216
|
+
error: z.ZodOptional<z.ZodString>;
|
|
217
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
218
|
+
id: z.ZodString;
|
|
219
|
+
runId: z.ZodString;
|
|
220
|
+
timestamp: z.ZodDate;
|
|
221
|
+
type: z.ZodLiteral<"stderr">;
|
|
222
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
223
|
+
text: z.ZodString;
|
|
224
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
225
|
+
id: z.ZodString;
|
|
226
|
+
runId: z.ZodString;
|
|
227
|
+
timestamp: z.ZodDate;
|
|
228
|
+
type: z.ZodLiteral<"session-end">;
|
|
229
|
+
sessionId: z.ZodOptional<z.ZodString>;
|
|
230
|
+
status: z.ZodEnum<{
|
|
231
|
+
completed: "completed";
|
|
232
|
+
failed: "failed";
|
|
233
|
+
cancelled: "cancelled";
|
|
234
|
+
}>;
|
|
235
|
+
error: z.ZodOptional<z.ZodString>;
|
|
236
|
+
}, z.core.$strip>], "type">;
|
|
237
|
+
type AgentEvent = z.infer<typeof eventSchema>;
|
|
238
|
+
//#endregion
|
|
239
|
+
export { OutputSchema as C, imageContentPartSchema as D, contentPartSchema as E, textContentPartSchema as O, McpServerConfig as S, agentCapabilitiesSchema as T, toolResultEventSchema as _, SessionStartEvent as a, ImageContentPart as b, ToolResultEvent as c, messageEventSchema as d, reasoningEventSchema as f, toolCallEventSchema as g, stderrEventSchema as h, SessionEndEvent as i, baseEventSchema as l, sessionStartEventSchema as m, MessageEvent as n, StderrEvent as o, sessionEndEventSchema as p, ReasoningEvent as r, ToolCallEvent as s, AgentEvent as t, eventSchema as u, AgentCapabilities as v, TextContentPart as w, JsonSchema as x, ContentPart as y };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{n as e}from"./types-CwvWHEpy.mjs";import{t}from"./util-CGg8cK92.mjs";import{t as n}from"./env-Dkd8Sgjf.mjs";import{t as r}from"./spawner-BJesLc8I.mjs";import{a as i,i as a,n as o,t as s}from"./classify-error-V6x6jP_R.mjs";import{dirname as c}from"node:path";import{createWriteStream as l,mkdirSync as u}from"node:fs";async function*d(e){let t=new TextDecoder,n=``;for await(let r of e){let e=t.decode(r,{stream:!0});n+=e;let i=n.split(`
|
|
2
|
+
`);n=i.pop()??``;for(let e of i){let t=e.trim();t&&(yield t)}}let r=t.decode();r&&(n+=r);let i=n.trim();i&&(yield i)}const f=e=>e.status===`rejected`?t(e.reason):void 0,p=(e,t)=>{if(e.stopReason)return;let n=f(t.stdoutResult);if(n)return{kind:`process`,message:n};let r=f(t.stderrResult);if(r)return{kind:`process`,message:r};let i=f(t.processResult);if(i)return{kind:`spawn`,message:i};if(!e.status&&!e.error){let t=e.processResult,n=e.stderrLines.join(`
|
|
3
|
+
`);if(t&&t.exitCode!==null&&t.exitCode!==0)return{kind:`process`,message:n||`Process exited with code ${t.exitCode}.`};if(!a(e)&&e.stderrLines.length>0)return{kind:`process`,message:n}}},m=e=>{let t=s(e);return t.kind===`provider`?{kind:`process`,message:t.message}:t};var h=class extends o{spawner;defaults;executionTargetRef;autoStartExecutionTarget;autoStopExecutionTarget;executionTargetStopPromise;logStream;sigkillTimer;constructor(e){super({type:e.type,capabilities:e.capabilities,sessionId:e.defaults?.sessionId,onEvent:e.onEvent}),this.spawner=e.spawner??r,this.defaults=e.defaults??{},this.executionTargetRef=e.executionTarget,this.autoStartExecutionTarget=e.autoStartExecutionTarget??!0,this.autoStopExecutionTarget=e.autoStopExecutionTarget??!1,e.logPath&&this.initLogStream(e.logPath)}onParseError(e,n){this.appendRawLog(`[parse-error] ${t(n)} ${e.slice(0,200)}`)}buildDefaultEnv(e){let t=n({propagateEnv:e});return t.CI=t.CI??`true`,this.defaults.env&&Object.assign(t,this.defaults.env),t}async executeRunCore(e,n){let r=this.setupRunLifecycle(e);try{if(r.abortedBeforeStart)return this.buildResult(e,new Date);try{await this.onBeforeRun(e);let t={...n,...e.normalizedRequest},r=this.buildArgs(t,e),i=this.buildEnv(t,e),a=this.defaults.command?.[0]??`claude`,o=[...this.defaults.command?.slice(1)??[],...r];if(e.stopReason)return this.buildResult(e,new Date);this.emitSessionStart(e),e.process=this.spawner.spawn(a,o,{cwd:e.normalizedRequest.cwd,env:i,stdio:[`pipe`,`pipe`,`pipe`]}),e.process.stdin?.end();let[s,c,l]=await Promise.allSettled([this.watchStdout(e),this.watchStderr(e),e.process.wait()]);l.status===`fulfilled`&&(e.processResult=l.value);let u=p(e,{stdoutResult:s,stderrResult:c,processResult:l});u&&(e.error=u)}catch(t){!e.stopReason&&!e.error&&(e.error=m(t))}return this.buildResult(e,new Date)}finally{r.cleanup(),this.sigkillTimer&&=(clearTimeout(this.sigkillTimer),void 0);try{await this.onRunFinished(e)}catch(e){this.appendRawLog(`[cleanup-error] ${t(e)}`)}}}async watchStdout(e){let t=e.process?.stdout;if(t)for await(let n of d(t))this.appendLog(`stdout`,n),this.processLine(e,n)}async watchStderr(e){let t=e.process?.stderr;if(t)for await(let n of d(t))this.appendLog(`stderr`,n),e.stderrLines.push(n),this.emit(e,i(e.runId,`stderr`,{sessionId:e.sessionId,text:n}))}processLine(e,t){let n;try{n=JSON.parse(t)}catch(e){this.onParseError(t,e);return}let r;try{r=this.mapRawEvent(n,{runId:e.runId,requestedSessionId:e.requestedSessionId,sessionId:e.sessionId,schemaRequested:e.normalizedRequest.schema.kind!==`none`,toolCalls:e.toolCalls})}catch(e){this.onParseError(t,e);return}this.applyBatch(e,r)}get runRequestDefaults(){return this.defaults}onHandlerError(e){this.appendRawLog(`[handler-error] ${t(e)}`)}async onDispose(){let e=this.logStream;this.logStream=void 0,e&&await new Promise(t=>{e.end(t)})}onStopRequested(e){e.process?.kill(),this.sigkillTimer=setTimeout(()=>{e.process?.kill(`SIGKILL`)},5e3),this.sigkillTimer.unref?.()}onBeforeRun(e){return this.ensureExecutionTarget()}async onRunFinished(e){this.autoStopExecutionTarget&&this.executionTargetRef&&this.executionTargetRef.status===`running`&&(this.executionTargetStopPromise=this.executionTargetRef.stop().catch(e=>{this.appendRawLog(`[auto-stop-error] ${t(e)}`)}),await this.executionTargetStopPromise)}appendRawLog(e){if(!this.logStream)return;let t=typeof e==`string`?e:JSON.stringify(e);this.logStream.write(`${t}\n`)}initLogStream(e){try{u(c(e),{recursive:!0}),this.logStream=l(e,{flags:`a`}),this.logStream.write(`\n--- ${new Date().toISOString()} ---\n`)}catch{this.logStream=void 0}}appendLog(e,t){if(!this.logStream||!t)return;let n=e===`stderr`?`STDERR`:`STDOUT`,r=new Date().toISOString();for(let e of t.split(`
|
|
4
|
+
`))e&&this.logStream.write(`[${r}] ${n} ${e}\n`)}async ensureExecutionTarget(){this.executionTargetStopPromise&&=(await this.executionTargetStopPromise,void 0),this.autoStartExecutionTarget&&this.executionTargetRef&&this.executionTargetRef.status!==`running`&&await this.executionTargetRef.start()}};const g=t=>{if(t){if(t.container&&t.sandbox)throw new e(`Pass either "container" or "sandbox", not both.`);return t.container??t.sandbox}},_=e=>{let t=g(e);return!e||!t?{executionTarget:t,options:e}:{executionTarget:t,options:{...e,cwd:e.cwd??t.workdir,spawner:t.spawner}}};export{h as n,_ as t};
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import { S as McpServerConfig } from "./events-D31_b0sA.mjs";
|
|
2
|
+
import { D as ProcessSpawner, f as EnsureDisjoint, l as BaseAgent, p as ExclusiveExecutionTargetOptions, t as AgentEventHandler } from "./types-COlDAzs5.mjs";
|
|
3
|
+
import { t as Container } from "./index-R77YR8ak.mjs";
|
|
4
|
+
import { i as Sandbox } from "./index-DCaZeLrI.mjs";
|
|
5
|
+
import { z } from "zod/v4";
|
|
6
|
+
|
|
7
|
+
//#region src/adapters/claude-code-cli/events/schemas.d.ts
|
|
8
|
+
declare const claudeSystemEventSchema: z.ZodObject<{
|
|
9
|
+
type: z.ZodLiteral<"system">;
|
|
10
|
+
session_id: z.ZodString;
|
|
11
|
+
subtype: z.ZodEnum<{
|
|
12
|
+
init: "init";
|
|
13
|
+
hook_response: "hook_response";
|
|
14
|
+
hook_started: "hook_started";
|
|
15
|
+
hook_finished: "hook_finished";
|
|
16
|
+
hook_failed: "hook_failed";
|
|
17
|
+
hook_skipped: "hook_skipped";
|
|
18
|
+
}>;
|
|
19
|
+
uuid: z.ZodString;
|
|
20
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
22
|
+
name: z.ZodString;
|
|
23
|
+
status: z.ZodEnum<{
|
|
24
|
+
error: "error";
|
|
25
|
+
failed: "failed";
|
|
26
|
+
connected: "connected";
|
|
27
|
+
disconnected: "disconnected";
|
|
28
|
+
}>;
|
|
29
|
+
}, z.core.$strip>>>;
|
|
30
|
+
model: z.ZodOptional<z.ZodString>;
|
|
31
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
32
|
+
hook_name: z.ZodOptional<z.ZodString>;
|
|
33
|
+
hook_event: z.ZodOptional<z.ZodString>;
|
|
34
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
35
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
36
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
37
|
+
}, z.core.$strip>;
|
|
38
|
+
type ClaudeSystemEvent = z.infer<typeof claudeSystemEventSchema>;
|
|
39
|
+
declare const claudeAssistantEventSchema: z.ZodObject<{
|
|
40
|
+
type: z.ZodLiteral<"assistant">;
|
|
41
|
+
session_id: z.ZodString;
|
|
42
|
+
uuid: z.ZodString;
|
|
43
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
44
|
+
message: z.ZodObject<{
|
|
45
|
+
id: z.ZodString;
|
|
46
|
+
type: z.ZodLiteral<"message">;
|
|
47
|
+
role: z.ZodLiteral<"assistant">;
|
|
48
|
+
model: z.ZodString;
|
|
49
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
50
|
+
type: z.ZodLiteral<"text">;
|
|
51
|
+
text: z.ZodString;
|
|
52
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
53
|
+
type: z.ZodLiteral<"tool_use">;
|
|
54
|
+
id: z.ZodString;
|
|
55
|
+
name: z.ZodString;
|
|
56
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
57
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
58
|
+
type: z.ZodLiteral<"thinking">;
|
|
59
|
+
thinking: z.ZodString;
|
|
60
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, z.core.$strip>]>>;
|
|
62
|
+
stop_reason: z.ZodNullable<z.ZodEnum<{
|
|
63
|
+
tool_use: "tool_use";
|
|
64
|
+
end_turn: "end_turn";
|
|
65
|
+
max_tokens: "max_tokens";
|
|
66
|
+
stop_sequence: "stop_sequence";
|
|
67
|
+
}>>;
|
|
68
|
+
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
69
|
+
context_management: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
70
|
+
usage: z.ZodObject<{
|
|
71
|
+
input_tokens: z.ZodNumber;
|
|
72
|
+
output_tokens: z.ZodNumber;
|
|
73
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
74
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
75
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
76
|
+
premium: "premium";
|
|
77
|
+
standard: "standard";
|
|
78
|
+
}>>>;
|
|
79
|
+
}, z.core.$strip>;
|
|
80
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
|
+
}, z.core.$strip>;
|
|
83
|
+
type ClaudeAssistantEvent = z.infer<typeof claudeAssistantEventSchema>;
|
|
84
|
+
declare const claudeUserEventSchema: z.ZodObject<{
|
|
85
|
+
type: z.ZodLiteral<"user">;
|
|
86
|
+
session_id: z.ZodString;
|
|
87
|
+
message: z.ZodObject<{
|
|
88
|
+
role: z.ZodLiteral<"user">;
|
|
89
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
90
|
+
type: z.ZodLiteral<"tool_result">;
|
|
91
|
+
tool_use_id: z.ZodString;
|
|
92
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
93
|
+
type: z.ZodLiteral<"text">;
|
|
94
|
+
text: z.ZodString;
|
|
95
|
+
}, z.core.$strip>>]>;
|
|
96
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
98
|
+
type: z.ZodLiteral<"text">;
|
|
99
|
+
text: z.ZodString;
|
|
100
|
+
}, z.core.$strip>]>>;
|
|
101
|
+
}, z.core.$strip>;
|
|
102
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
103
|
+
uuid: z.ZodString;
|
|
104
|
+
isSynthetic: z.ZodOptional<z.ZodBoolean>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
|
+
type ClaudeUserEvent = z.infer<typeof claudeUserEventSchema>;
|
|
107
|
+
declare const claudeResultEventSchema: z.ZodObject<{
|
|
108
|
+
type: z.ZodLiteral<"result">;
|
|
109
|
+
session_id: z.ZodString;
|
|
110
|
+
uuid: z.ZodString;
|
|
111
|
+
subtype: z.ZodEnum<{
|
|
112
|
+
success: "success";
|
|
113
|
+
error_max_turns: "error_max_turns";
|
|
114
|
+
error_during_execution: "error_during_execution";
|
|
115
|
+
}>;
|
|
116
|
+
duration_ms: z.ZodNumber;
|
|
117
|
+
duration_api_ms: z.ZodNumber;
|
|
118
|
+
is_error: z.ZodBoolean;
|
|
119
|
+
num_turns: z.ZodNumber;
|
|
120
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
121
|
+
structured_output: z.ZodOptional<z.ZodUnknown>;
|
|
122
|
+
total_cost_usd: z.ZodNumber;
|
|
123
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
124
|
+
input_tokens: z.ZodNumber;
|
|
125
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
126
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
127
|
+
output_tokens: z.ZodNumber;
|
|
128
|
+
server_tool_use: z.ZodOptional<z.ZodObject<{
|
|
129
|
+
web_search_requests: z.ZodNumber;
|
|
130
|
+
}, z.core.$strip>>;
|
|
131
|
+
}, z.core.$strip>>;
|
|
132
|
+
}, z.core.$strip>;
|
|
133
|
+
type ClaudeResultEvent = z.infer<typeof claudeResultEventSchema>;
|
|
134
|
+
declare const claudeRateLimitEventSchema: z.ZodObject<{
|
|
135
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
136
|
+
uuid: z.ZodString;
|
|
137
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
138
|
+
rate_limit_info: z.ZodObject<{
|
|
139
|
+
status: z.ZodString;
|
|
140
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
rateLimitType: z.ZodOptional<z.ZodString>;
|
|
142
|
+
overageStatus: z.ZodOptional<z.ZodString>;
|
|
143
|
+
overageDisabledReason: z.ZodOptional<z.ZodString>;
|
|
144
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
145
|
+
}, z.core.$strip>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
type ClaudeRateLimitEvent = z.infer<typeof claudeRateLimitEventSchema>;
|
|
148
|
+
declare const claudeEventSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
149
|
+
type: z.ZodLiteral<"system">;
|
|
150
|
+
session_id: z.ZodString;
|
|
151
|
+
subtype: z.ZodEnum<{
|
|
152
|
+
init: "init";
|
|
153
|
+
hook_response: "hook_response";
|
|
154
|
+
hook_started: "hook_started";
|
|
155
|
+
hook_finished: "hook_finished";
|
|
156
|
+
hook_failed: "hook_failed";
|
|
157
|
+
hook_skipped: "hook_skipped";
|
|
158
|
+
}>;
|
|
159
|
+
uuid: z.ZodString;
|
|
160
|
+
tools: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
161
|
+
mcp_servers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
162
|
+
name: z.ZodString;
|
|
163
|
+
status: z.ZodEnum<{
|
|
164
|
+
error: "error";
|
|
165
|
+
failed: "failed";
|
|
166
|
+
connected: "connected";
|
|
167
|
+
disconnected: "disconnected";
|
|
168
|
+
}>;
|
|
169
|
+
}, z.core.$strip>>>;
|
|
170
|
+
model: z.ZodOptional<z.ZodString>;
|
|
171
|
+
cwd: z.ZodOptional<z.ZodString>;
|
|
172
|
+
hook_name: z.ZodOptional<z.ZodString>;
|
|
173
|
+
hook_event: z.ZodOptional<z.ZodString>;
|
|
174
|
+
stdout: z.ZodOptional<z.ZodString>;
|
|
175
|
+
stderr: z.ZodOptional<z.ZodString>;
|
|
176
|
+
exit_code: z.ZodOptional<z.ZodNumber>;
|
|
177
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
178
|
+
type: z.ZodLiteral<"assistant">;
|
|
179
|
+
session_id: z.ZodString;
|
|
180
|
+
uuid: z.ZodString;
|
|
181
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
182
|
+
message: z.ZodObject<{
|
|
183
|
+
id: z.ZodString;
|
|
184
|
+
type: z.ZodLiteral<"message">;
|
|
185
|
+
role: z.ZodLiteral<"assistant">;
|
|
186
|
+
model: z.ZodString;
|
|
187
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
188
|
+
type: z.ZodLiteral<"text">;
|
|
189
|
+
text: z.ZodString;
|
|
190
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
191
|
+
type: z.ZodLiteral<"tool_use">;
|
|
192
|
+
id: z.ZodString;
|
|
193
|
+
name: z.ZodString;
|
|
194
|
+
input: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
195
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
196
|
+
type: z.ZodLiteral<"thinking">;
|
|
197
|
+
thinking: z.ZodString;
|
|
198
|
+
signature: z.ZodOptional<z.ZodString>;
|
|
199
|
+
}, z.core.$strip>]>>;
|
|
200
|
+
stop_reason: z.ZodNullable<z.ZodEnum<{
|
|
201
|
+
tool_use: "tool_use";
|
|
202
|
+
end_turn: "end_turn";
|
|
203
|
+
max_tokens: "max_tokens";
|
|
204
|
+
stop_sequence: "stop_sequence";
|
|
205
|
+
}>>;
|
|
206
|
+
stop_sequence: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
207
|
+
context_management: z.ZodOptional<z.ZodNullable<z.ZodUnknown>>;
|
|
208
|
+
usage: z.ZodObject<{
|
|
209
|
+
input_tokens: z.ZodNumber;
|
|
210
|
+
output_tokens: z.ZodNumber;
|
|
211
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
212
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
213
|
+
service_tier: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
214
|
+
premium: "premium";
|
|
215
|
+
standard: "standard";
|
|
216
|
+
}>>>;
|
|
217
|
+
}, z.core.$strip>;
|
|
218
|
+
ttftMs: z.ZodOptional<z.ZodNumber>;
|
|
219
|
+
}, z.core.$strip>;
|
|
220
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
221
|
+
type: z.ZodLiteral<"user">;
|
|
222
|
+
session_id: z.ZodString;
|
|
223
|
+
message: z.ZodObject<{
|
|
224
|
+
role: z.ZodLiteral<"user">;
|
|
225
|
+
content: z.ZodArray<z.ZodUnion<readonly [z.ZodObject<{
|
|
226
|
+
type: z.ZodLiteral<"tool_result">;
|
|
227
|
+
tool_use_id: z.ZodString;
|
|
228
|
+
content: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodObject<{
|
|
229
|
+
type: z.ZodLiteral<"text">;
|
|
230
|
+
text: z.ZodString;
|
|
231
|
+
}, z.core.$strip>>]>;
|
|
232
|
+
is_error: z.ZodOptional<z.ZodBoolean>;
|
|
233
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
234
|
+
type: z.ZodLiteral<"text">;
|
|
235
|
+
text: z.ZodString;
|
|
236
|
+
}, z.core.$strip>]>>;
|
|
237
|
+
}, z.core.$strip>;
|
|
238
|
+
parent_tool_use_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
239
|
+
uuid: z.ZodString;
|
|
240
|
+
isSynthetic: z.ZodOptional<z.ZodBoolean>;
|
|
241
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
242
|
+
type: z.ZodLiteral<"result">;
|
|
243
|
+
session_id: z.ZodString;
|
|
244
|
+
uuid: z.ZodString;
|
|
245
|
+
subtype: z.ZodEnum<{
|
|
246
|
+
success: "success";
|
|
247
|
+
error_max_turns: "error_max_turns";
|
|
248
|
+
error_during_execution: "error_during_execution";
|
|
249
|
+
}>;
|
|
250
|
+
duration_ms: z.ZodNumber;
|
|
251
|
+
duration_api_ms: z.ZodNumber;
|
|
252
|
+
is_error: z.ZodBoolean;
|
|
253
|
+
num_turns: z.ZodNumber;
|
|
254
|
+
result: z.ZodOptional<z.ZodUnknown>;
|
|
255
|
+
structured_output: z.ZodOptional<z.ZodUnknown>;
|
|
256
|
+
total_cost_usd: z.ZodNumber;
|
|
257
|
+
usage: z.ZodOptional<z.ZodObject<{
|
|
258
|
+
input_tokens: z.ZodNumber;
|
|
259
|
+
cache_creation_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
260
|
+
cache_read_input_tokens: z.ZodOptional<z.ZodNumber>;
|
|
261
|
+
output_tokens: z.ZodNumber;
|
|
262
|
+
server_tool_use: z.ZodOptional<z.ZodObject<{
|
|
263
|
+
web_search_requests: z.ZodNumber;
|
|
264
|
+
}, z.core.$strip>>;
|
|
265
|
+
}, z.core.$strip>>;
|
|
266
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
267
|
+
type: z.ZodLiteral<"rate_limit_event">;
|
|
268
|
+
uuid: z.ZodString;
|
|
269
|
+
session_id: z.ZodOptional<z.ZodString>;
|
|
270
|
+
rate_limit_info: z.ZodObject<{
|
|
271
|
+
status: z.ZodString;
|
|
272
|
+
resetsAt: z.ZodOptional<z.ZodNumber>;
|
|
273
|
+
rateLimitType: z.ZodOptional<z.ZodString>;
|
|
274
|
+
overageStatus: z.ZodOptional<z.ZodString>;
|
|
275
|
+
overageDisabledReason: z.ZodOptional<z.ZodString>;
|
|
276
|
+
isUsingOverage: z.ZodOptional<z.ZodBoolean>;
|
|
277
|
+
}, z.core.$strip>;
|
|
278
|
+
}, z.core.$strip>], "type">;
|
|
279
|
+
type ClaudeEvent = z.infer<typeof claudeEventSchema>;
|
|
280
|
+
//#endregion
|
|
281
|
+
//#region src/adapters/claude-code-cli/types.d.ts
|
|
282
|
+
type ClaudeCodeCliPermissionMode = "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "plan";
|
|
283
|
+
interface ClaudeCodeCliRunOptions {
|
|
284
|
+
allowedTools?: string[];
|
|
285
|
+
disallowedTools?: string[];
|
|
286
|
+
appendSystemPrompt?: string;
|
|
287
|
+
permissionMode?: ClaudeCodeCliPermissionMode;
|
|
288
|
+
mcpConfig?: string[] | string;
|
|
289
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
290
|
+
forkSession?: boolean;
|
|
291
|
+
extraArgs?: string[];
|
|
292
|
+
}
|
|
293
|
+
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;
|
|
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,46 @@
|
|
|
1
|
+
import { S as McpServerConfig } from "./events-D31_b0sA.mjs";
|
|
2
|
+
import { f as EnsureDisjoint, l as BaseAgent, t as AgentEventHandler } from "./types-COlDAzs5.mjs";
|
|
3
|
+
//#region src/adapters/claude-code-sdk/types.d.ts
|
|
4
|
+
type ClaudeCodeSdkPermissionMode = "acceptEdits" | "bypassPermissions" | "default" | "dontAsk" | "plan";
|
|
5
|
+
type ClaudeCodeSdkExecutable = "bun" | "deno" | "node";
|
|
6
|
+
type ClaudeCodeSdkSettingSource = "local" | "project" | "user";
|
|
7
|
+
type ClaudeCodeSdkSettings = Record<string, unknown> | string;
|
|
8
|
+
interface ClaudeCodeSdkRunOptions {
|
|
9
|
+
allowedTools?: string[];
|
|
10
|
+
disallowedTools?: string[];
|
|
11
|
+
appendSystemPrompt?: string;
|
|
12
|
+
permissionMode?: ClaudeCodeSdkPermissionMode;
|
|
13
|
+
mcpServers?: Record<string, McpServerConfig>;
|
|
14
|
+
forkSession?: boolean;
|
|
15
|
+
maxTurns?: number;
|
|
16
|
+
}
|
|
17
|
+
interface ClaudeCodeSdkAgentOptions extends ClaudeCodeSdkRunOptions {
|
|
18
|
+
command?: string;
|
|
19
|
+
env?: Record<string, string | undefined>;
|
|
20
|
+
propagateEnv?: boolean;
|
|
21
|
+
executable?: ClaudeCodeSdkExecutable;
|
|
22
|
+
executableArgs?: string[];
|
|
23
|
+
settings?: ClaudeCodeSdkSettings;
|
|
24
|
+
settingSources?: ClaudeCodeSdkSettingSource[];
|
|
25
|
+
container?: never;
|
|
26
|
+
sandbox?: never;
|
|
27
|
+
cwd?: string;
|
|
28
|
+
sessionId?: string;
|
|
29
|
+
model?: string;
|
|
30
|
+
systemPrompt?: string;
|
|
31
|
+
onEvent?: AgentEventHandler;
|
|
32
|
+
}
|
|
33
|
+
interface ClaudeCodeSdkAgent extends BaseAgent<EnsureDisjoint<ClaudeCodeSdkRunOptions>> {
|
|
34
|
+
readonly type: "claude-code-sdk";
|
|
35
|
+
fork: () => ClaudeCodeSdkAgent;
|
|
36
|
+
}
|
|
37
|
+
interface ClaudeCodeSdkEvent {
|
|
38
|
+
type: string;
|
|
39
|
+
session_id?: string;
|
|
40
|
+
[key: string]: unknown;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
//#region src/adapters/claude-code-sdk/adapter.d.ts
|
|
44
|
+
declare const createClaudeCodeSdkAgent: (options?: ClaudeCodeSdkAgentOptions) => ClaudeCodeSdkAgent;
|
|
45
|
+
//#endregion
|
|
46
|
+
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,51 @@
|
|
|
1
|
+
import { D as ProcessSpawner } from "./types-COlDAzs5.mjs";
|
|
2
|
+
import { H as VolumeMount } from "./index-R77YR8ak.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/sandbox/types.d.ts
|
|
5
|
+
type SandboxType = "bubblewrap";
|
|
6
|
+
type SandboxStatus = "created" | "disposed" | "running" | "stopped";
|
|
7
|
+
interface SandboxConfigBase<TType extends SandboxType> {
|
|
8
|
+
type: TType;
|
|
9
|
+
workdir: string;
|
|
10
|
+
}
|
|
11
|
+
interface SandboxIdentity<TType extends SandboxType, TConfig extends SandboxConfigBase<TType>> {
|
|
12
|
+
readonly type: TType;
|
|
13
|
+
readonly config: TConfig;
|
|
14
|
+
readonly status: SandboxStatus;
|
|
15
|
+
readonly workdir: string;
|
|
16
|
+
}
|
|
17
|
+
interface SandboxLifecycle {
|
|
18
|
+
start: () => Promise<void>;
|
|
19
|
+
stop: () => Promise<void>;
|
|
20
|
+
dispose: () => Promise<void>;
|
|
21
|
+
[Symbol.asyncDispose]: () => Promise<void>;
|
|
22
|
+
}
|
|
23
|
+
interface SandboxExecution {
|
|
24
|
+
readonly spawner: ProcessSpawner;
|
|
25
|
+
}
|
|
26
|
+
interface SandboxBase<TType extends SandboxType, TConfig extends SandboxConfigBase<TType>> extends SandboxExecution, SandboxIdentity<TType, TConfig>, SandboxLifecycle {}
|
|
27
|
+
interface BubblewrapSandboxConfig extends SandboxConfigBase<"bubblewrap"> {
|
|
28
|
+
binary?: string;
|
|
29
|
+
binds?: VolumeMount[];
|
|
30
|
+
clearEnv?: boolean;
|
|
31
|
+
setEnv?: Record<string, string>;
|
|
32
|
+
unsetEnv?: string[];
|
|
33
|
+
unshareAll?: boolean;
|
|
34
|
+
shareNetwork?: boolean;
|
|
35
|
+
hostname?: string;
|
|
36
|
+
uid?: number;
|
|
37
|
+
gid?: number;
|
|
38
|
+
tmpfs?: string[];
|
|
39
|
+
remountReadonly?: string[];
|
|
40
|
+
proc?: false | string;
|
|
41
|
+
dev?: false | string;
|
|
42
|
+
args?: string[];
|
|
43
|
+
}
|
|
44
|
+
interface BubblewrapSandbox extends SandboxBase<"bubblewrap", BubblewrapSandboxConfig> {}
|
|
45
|
+
type SandboxConfig = BubblewrapSandboxConfig;
|
|
46
|
+
type Sandbox = BubblewrapSandbox;
|
|
47
|
+
//#endregion
|
|
48
|
+
//#region src/sandbox/index.d.ts
|
|
49
|
+
declare function createSandbox(config: BubblewrapSandboxConfig): Promise<BubblewrapSandbox>;
|
|
50
|
+
//#endregion
|
|
51
|
+
export { SandboxBase as a, SandboxExecution as c, SandboxStatus as d, SandboxType as f, Sandbox as i, SandboxIdentity as l, BubblewrapSandbox as n, SandboxConfig as o, BubblewrapSandboxConfig as r, SandboxConfigBase as s, createSandbox as t, SandboxLifecycle as u };
|