agentbox-sdk 0.0.0 → 0.1.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 +399 -0
- package/dist/Sandbox-DTprxRZf.d.ts +182 -0
- package/dist/agents/index.d.ts +19 -0
- package/dist/agents/index.js +9 -0
- package/dist/chunk-7FLLQJ6J.js +185 -0
- package/dist/chunk-BW43ESRM.js +4381 -0
- package/dist/chunk-HMBWQSVN.js +204 -0
- package/dist/chunk-JFDP556Q.js +18 -0
- package/dist/chunk-QRQFQTGH.js +1436 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +401 -0
- package/dist/events/index.d.ts +6 -0
- package/dist/events/index.js +12 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +26 -0
- package/dist/sandboxes/index.d.ts +38 -0
- package/dist/sandboxes/index.js +12 -0
- package/dist/types-BwcoN0n-.d.ts +386 -0
- package/images/browser-agent.mjs +55 -0
- package/images/computer-use.mjs +29 -0
- package/package.json +90 -4
- package/index.js +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
# AgentBox
|
|
2
|
+
|
|
3
|
+
Run coding agents inside sandboxes. One API, any provider.
|
|
4
|
+
|
|
5
|
+
Unlike wrappers that shell out to CLIs in non-interactive mode (e.g. `claude --print`), AgentBox launches each agent as a **server process** inside the sandbox and communicates over WebSocket or HTTP. This preserves the full interactive capabilities of each agent — approval flows, tool-use control, streaming events.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Agent, Sandbox } from "agentbox-sdk";
|
|
9
|
+
|
|
10
|
+
const sandbox = new Sandbox("local-docker", {
|
|
11
|
+
workingDir: "/workspace",
|
|
12
|
+
image: process.env.IMAGE_ID!,
|
|
13
|
+
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const run = new Agent("claude-code", {
|
|
17
|
+
sandbox,
|
|
18
|
+
cwd: "/workspace",
|
|
19
|
+
approvalMode: "auto",
|
|
20
|
+
}).stream({
|
|
21
|
+
model: "claude-sonnet-4-6",
|
|
22
|
+
input: "Create a hello world Express server in /workspace/server.ts",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
for await (const event of run) {
|
|
26
|
+
if (event.type === "text.delta") process.stdout.write(event.delta);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
await sandbox.delete();
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Providers are mix-and-match:
|
|
33
|
+
|
|
34
|
+
- **Agents** — [`claude-code`](./src/agents/providers/claude-code.ts), [`opencode`](./src/agents/providers/opencode.ts), [`codex`](./src/agents/providers/codex.ts)
|
|
35
|
+
- **Sandboxes** — [`local-docker`](./src/sandboxes/providers/local-docker.ts), [`e2b`](./src/sandboxes/providers/e2b.ts), [`modal`](./src/sandboxes/providers/modal.ts), [`daytona`](./src/sandboxes/providers/daytona.ts)
|
|
36
|
+
|
|
37
|
+
Swap either one and your app code stays the same.
|
|
38
|
+
|
|
39
|
+
## Install
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm install agentbox-sdk
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Requires Node >= 20. The agent CLI you want to use (`claude`, `opencode`, `codex`) should be installed inside your sandbox image.
|
|
46
|
+
|
|
47
|
+
## Getting started
|
|
48
|
+
|
|
49
|
+
### 1. Build a sandbox image
|
|
50
|
+
|
|
51
|
+
AgentBox ships with built-in image presets. Build one for your sandbox provider:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npx agentbox image build --provider local-docker --preset browser-agent
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
This prints an image reference (a Docker tag, Modal image ID, E2B template, or Daytona snapshot depending on the provider). Set it as `IMAGE_ID`:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
export IMAGE_ID=<printed value>
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Run an agent
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
import { Agent, Sandbox } from "agentbox-sdk";
|
|
67
|
+
|
|
68
|
+
const sandbox = new Sandbox("local-docker", {
|
|
69
|
+
workingDir: "/workspace",
|
|
70
|
+
image: process.env.IMAGE_ID!,
|
|
71
|
+
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const agent = new Agent("claude-code", {
|
|
75
|
+
sandbox,
|
|
76
|
+
cwd: "/workspace",
|
|
77
|
+
approvalMode: "auto",
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
const result = await agent.run({
|
|
81
|
+
model: "claude-sonnet-4-6",
|
|
82
|
+
input:
|
|
83
|
+
"Explain the project structure and write a summary to /workspace/OVERVIEW.md",
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
console.log(result.text);
|
|
87
|
+
await sandbox.delete();
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### 3. Stream events
|
|
91
|
+
|
|
92
|
+
`agent.stream()` returns an async iterable of normalized events:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const run = agent.stream({
|
|
96
|
+
model: "claude-sonnet-4-6",
|
|
97
|
+
input: "Write a fizzbuzz in Python",
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
for await (const event of run) {
|
|
101
|
+
if (event.type === "text.delta") {
|
|
102
|
+
process.stdout.write(event.delta);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const result = await run.finished;
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Agents
|
|
110
|
+
|
|
111
|
+
Three agent providers are supported. Each wraps a CLI that runs inside the sandbox:
|
|
112
|
+
|
|
113
|
+
| Provider | CLI | Model format |
|
|
114
|
+
| ------------- | ---------- | ----------------------------------------------- |
|
|
115
|
+
| `claude-code` | `claude` | `claude-sonnet-4-6` |
|
|
116
|
+
| `opencode` | `opencode` | `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1` |
|
|
117
|
+
| `codex` | `codex` | `gpt-5-codex` |
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
new Agent("claude-code", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
121
|
+
new Agent("opencode", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
122
|
+
new Agent("codex", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Sandboxes
|
|
126
|
+
|
|
127
|
+
Four sandbox providers are supported. Each gives you an isolated environment with the same interface:
|
|
128
|
+
|
|
129
|
+
| Provider | What it is | Auth |
|
|
130
|
+
| -------------- | ---------------------- | --------------------------------------- |
|
|
131
|
+
| `local-docker` | Local Docker container | Docker daemon |
|
|
132
|
+
| `e2b` | Cloud micro-VM | `E2B_API_KEY` |
|
|
133
|
+
| `modal` | Cloud container | `MODAL_TOKEN_ID` + `MODAL_TOKEN_SECRET` |
|
|
134
|
+
| `daytona` | Cloud dev environment | `DAYTONA_API_KEY` |
|
|
135
|
+
|
|
136
|
+
Every sandbox supports: `run()`, `runAsync()`, `gitClone()`, `openPort()`, `getPreviewLink()`, `snapshot()`, `stop()`, `delete()`.
|
|
137
|
+
|
|
138
|
+
## Skills
|
|
139
|
+
|
|
140
|
+
Attach GitHub repos as agent skills. They're cloned into the sandbox and surfaced to the agent:
|
|
141
|
+
|
|
142
|
+
```ts
|
|
143
|
+
const agent = new Agent("claude-code", {
|
|
144
|
+
sandbox,
|
|
145
|
+
cwd: "/workspace",
|
|
146
|
+
approvalMode: "auto",
|
|
147
|
+
skills: [
|
|
148
|
+
{
|
|
149
|
+
name: "agent-browser",
|
|
150
|
+
repo: "https://github.com/vercel-labs/agent-browser",
|
|
151
|
+
},
|
|
152
|
+
],
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
You can also embed skills inline:
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
skills: [
|
|
160
|
+
{
|
|
161
|
+
source: "embedded",
|
|
162
|
+
name: "lint-fix",
|
|
163
|
+
files: {
|
|
164
|
+
"SKILL.md": "Run `npm run lint:fix` and verify the output is clean.",
|
|
165
|
+
},
|
|
166
|
+
},
|
|
167
|
+
],
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## Sub-agents
|
|
171
|
+
|
|
172
|
+
Delegate tasks to specialized sub-agents:
|
|
173
|
+
|
|
174
|
+
```ts
|
|
175
|
+
const agent = new Agent("claude-code", {
|
|
176
|
+
sandbox,
|
|
177
|
+
cwd: "/workspace",
|
|
178
|
+
approvalMode: "auto",
|
|
179
|
+
subAgents: [
|
|
180
|
+
{
|
|
181
|
+
name: "reviewer",
|
|
182
|
+
description: "Reviews code for bugs and security issues",
|
|
183
|
+
instructions:
|
|
184
|
+
"Flag bugs, security issues, and missing edge cases. Be concise.",
|
|
185
|
+
tools: ["bash", "read"],
|
|
186
|
+
},
|
|
187
|
+
],
|
|
188
|
+
});
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## MCP servers
|
|
192
|
+
|
|
193
|
+
Connect MCP servers to give agents access to external tools:
|
|
194
|
+
|
|
195
|
+
```ts
|
|
196
|
+
const agent = new Agent("claude-code", {
|
|
197
|
+
sandbox,
|
|
198
|
+
cwd: "/workspace",
|
|
199
|
+
approvalMode: "auto",
|
|
200
|
+
mcps: [
|
|
201
|
+
{
|
|
202
|
+
name: "filesystem",
|
|
203
|
+
type: "local",
|
|
204
|
+
command: "npx",
|
|
205
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/workspace"],
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
name: "my-api",
|
|
209
|
+
type: "remote",
|
|
210
|
+
url: "https://mcp.example.com/sse",
|
|
211
|
+
},
|
|
212
|
+
],
|
|
213
|
+
});
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
## Custom commands
|
|
217
|
+
|
|
218
|
+
Register slash commands the agent can use:
|
|
219
|
+
|
|
220
|
+
```ts
|
|
221
|
+
const agent = new Agent("opencode", {
|
|
222
|
+
sandbox,
|
|
223
|
+
cwd: "/workspace",
|
|
224
|
+
approvalMode: "auto",
|
|
225
|
+
commands: [
|
|
226
|
+
{
|
|
227
|
+
name: "triage",
|
|
228
|
+
description: "Triage a bug report into root cause + fix plan",
|
|
229
|
+
template:
|
|
230
|
+
"Analyze the bug report. Return: root cause, files to change, and tests to add.",
|
|
231
|
+
},
|
|
232
|
+
],
|
|
233
|
+
});
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
## Multimodal input
|
|
237
|
+
|
|
238
|
+
Pass images and files alongside text:
|
|
239
|
+
|
|
240
|
+
```ts
|
|
241
|
+
import { pathToFileURL } from "node:url";
|
|
242
|
+
|
|
243
|
+
const result = await agent.run({
|
|
244
|
+
model: "claude-sonnet-4-6",
|
|
245
|
+
input: [
|
|
246
|
+
{ type: "text", text: "Describe this mockup and suggest improvements." },
|
|
247
|
+
{ type: "image", image: pathToFileURL("/workspace/mockup.png") },
|
|
248
|
+
],
|
|
249
|
+
});
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Provider support: `opencode` (text, images, files), `claude-code` (text, images, PDFs), `codex` (text, images).
|
|
253
|
+
|
|
254
|
+
## Custom sandbox images
|
|
255
|
+
|
|
256
|
+
Define your own image when the built-in presets don't cover your needs.
|
|
257
|
+
|
|
258
|
+
Create `my-image.mjs`:
|
|
259
|
+
|
|
260
|
+
```js
|
|
261
|
+
export default {
|
|
262
|
+
name: "playwright-sandbox",
|
|
263
|
+
base: "node:20-bookworm",
|
|
264
|
+
env: { PLAYWRIGHT_BROWSERS_PATH: "/ms-playwright" },
|
|
265
|
+
run: [
|
|
266
|
+
"apt-get update && apt-get install -y git python3 ca-certificates",
|
|
267
|
+
"npm install -g pnpm @anthropic-ai/claude-code",
|
|
268
|
+
"npx playwright install --with-deps chromium",
|
|
269
|
+
],
|
|
270
|
+
workdir: "/workspace",
|
|
271
|
+
cmd: ["sleep", "infinity"],
|
|
272
|
+
};
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
Build it:
|
|
276
|
+
|
|
277
|
+
```bash
|
|
278
|
+
npx agentbox image build --provider local-docker --file ./my-image.mjs
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
This works with all providers. For cloud providers, the printed value will be that provider's native image reference.
|
|
282
|
+
|
|
283
|
+
## Hooks
|
|
284
|
+
|
|
285
|
+
Hooks let you run code at specific points in the agent lifecycle. Each provider has its own hook format:
|
|
286
|
+
|
|
287
|
+
**Claude Code** — native hook settings:
|
|
288
|
+
|
|
289
|
+
```ts
|
|
290
|
+
new Agent("claude-code", {
|
|
291
|
+
sandbox,
|
|
292
|
+
cwd: "/workspace",
|
|
293
|
+
provider: {
|
|
294
|
+
hooks: {
|
|
295
|
+
PostToolUse: [
|
|
296
|
+
{ matcher: "Bash", hooks: [{ type: "command", command: "echo done" }] },
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
},
|
|
300
|
+
});
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
**Codex** — similar to Claude Code:
|
|
304
|
+
|
|
305
|
+
```ts
|
|
306
|
+
new Agent("codex", {
|
|
307
|
+
sandbox,
|
|
308
|
+
cwd: "/workspace",
|
|
309
|
+
provider: {
|
|
310
|
+
hooks: {
|
|
311
|
+
PostToolUse: [
|
|
312
|
+
{ matcher: "Bash", hooks: [{ type: "command", command: "echo done" }] },
|
|
313
|
+
],
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
**OpenCode** — plugin-based hooks:
|
|
320
|
+
|
|
321
|
+
```ts
|
|
322
|
+
new Agent("opencode", {
|
|
323
|
+
sandbox,
|
|
324
|
+
cwd: "/workspace",
|
|
325
|
+
provider: {
|
|
326
|
+
plugins: [
|
|
327
|
+
{
|
|
328
|
+
name: "session-notifier",
|
|
329
|
+
hooks: [{ event: "session.idle", body: 'return "session-idle";' }],
|
|
330
|
+
},
|
|
331
|
+
],
|
|
332
|
+
},
|
|
333
|
+
});
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
## Examples
|
|
337
|
+
|
|
338
|
+
The [`examples/`](./examples) directory has short, runnable scripts that each demonstrate one feature:
|
|
339
|
+
|
|
340
|
+
| Example | What it shows |
|
|
341
|
+
| --------------------------------------------------------------- | ----------------------------- |
|
|
342
|
+
| [`basic.ts`](./examples/basic.ts) | Minimal agent + sandbox |
|
|
343
|
+
| [`streaming.ts`](./examples/streaming.ts) | Stream and handle events |
|
|
344
|
+
| [`interactive-approval.ts`](./examples/interactive-approval.ts) | Approve tool calls from stdin |
|
|
345
|
+
| [`skills.ts`](./examples/skills.ts) | Attach a GitHub skill |
|
|
346
|
+
| [`sub-agents.ts`](./examples/sub-agents.ts) | Delegate to sub-agents |
|
|
347
|
+
| [`mcp-server.ts`](./examples/mcp-server.ts) | Connect an MCP server |
|
|
348
|
+
| [`multimodal.ts`](./examples/multimodal.ts) | Send images to the agent |
|
|
349
|
+
| [`custom-image.ts`](./examples/custom-image.ts) | Build a custom sandbox image |
|
|
350
|
+
| [`cloud-sandbox.ts`](./examples/cloud-sandbox.ts) | Use E2B, Modal, or Daytona |
|
|
351
|
+
| [`git-clone.ts`](./examples/git-clone.ts) | Clone a repo into the sandbox |
|
|
352
|
+
|
|
353
|
+
All examples import from `"agentbox-sdk"` like a normal dependency. Run them with:
|
|
354
|
+
|
|
355
|
+
```bash
|
|
356
|
+
npx tsx examples/basic.ts
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
## Package exports
|
|
360
|
+
|
|
361
|
+
```ts
|
|
362
|
+
import { Agent, Sandbox } from "agentbox-sdk"; // main entrypoint
|
|
363
|
+
import type { AgentRun } from "agentbox-sdk/agents"; // agent types
|
|
364
|
+
import type { CommandResult } from "agentbox-sdk/sandboxes"; // sandbox types
|
|
365
|
+
import type { NormalizedAgentEvent } from "agentbox-sdk/events"; // event types
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Contributing
|
|
369
|
+
|
|
370
|
+
```bash
|
|
371
|
+
npm install
|
|
372
|
+
npm run build
|
|
373
|
+
npm run typecheck
|
|
374
|
+
npm test
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
`npm run build` generates the `dist/` directory. You need to build before the examples or CLI work locally.
|
|
378
|
+
|
|
379
|
+
To test your local build from another project:
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
npm run build && npm pack
|
|
383
|
+
# then in your project:
|
|
384
|
+
npm install /path/to/agentbox-sdk-0.1.0.tgz
|
|
385
|
+
```
|
|
386
|
+
|
|
387
|
+
### Tests
|
|
388
|
+
|
|
389
|
+
```bash
|
|
390
|
+
npm test # fast, no real providers
|
|
391
|
+
AGENTBOX_RUN_SMOKE_TESTS=1 npm run test:smoke # live smoke tests
|
|
392
|
+
AGENTBOX_RUN_MATRIX_E2E=1 npm run test:e2e:matrix # provider matrix
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
Live test suites are opt-in because they provision real infrastructure.
|
|
396
|
+
|
|
397
|
+
## License
|
|
398
|
+
|
|
399
|
+
MIT
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { Sandbox as Sandbox$1 } from 'e2b';
|
|
2
|
+
import { Daytona, Sandbox as Sandbox$2 } from '@daytonaio/sdk';
|
|
3
|
+
import { ModalClient, Sandbox as Sandbox$3 } from 'modal';
|
|
4
|
+
import Docker from 'dockerode';
|
|
5
|
+
|
|
6
|
+
type E2bRaw = {
|
|
7
|
+
sandbox?: Sandbox$1;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
type DaytonaRaw = {
|
|
11
|
+
client: Daytona;
|
|
12
|
+
sandbox?: Sandbox$2;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type ModalRaw = {
|
|
16
|
+
client: ModalClient;
|
|
17
|
+
sandbox?: Sandbox$3;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
type DockerRaw = {
|
|
21
|
+
client: Docker;
|
|
22
|
+
container?: Docker.Container;
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
type SandboxProviderName = "local-docker" | "modal" | "daytona" | "e2b";
|
|
26
|
+
interface CommandOptions {
|
|
27
|
+
cwd?: string;
|
|
28
|
+
env?: Record<string, string>;
|
|
29
|
+
timeoutMs?: number;
|
|
30
|
+
pty?: boolean;
|
|
31
|
+
}
|
|
32
|
+
interface CommandResult {
|
|
33
|
+
exitCode: number;
|
|
34
|
+
stdout: string;
|
|
35
|
+
stderr: string;
|
|
36
|
+
combinedOutput: string;
|
|
37
|
+
raw?: unknown;
|
|
38
|
+
}
|
|
39
|
+
interface CommandEvent {
|
|
40
|
+
type: "stdout" | "stderr" | "exit";
|
|
41
|
+
chunk?: string;
|
|
42
|
+
exitCode?: number;
|
|
43
|
+
timestamp: string;
|
|
44
|
+
raw?: unknown;
|
|
45
|
+
}
|
|
46
|
+
interface AsyncCommandHandle extends AsyncIterable<CommandEvent> {
|
|
47
|
+
id: string;
|
|
48
|
+
raw?: unknown;
|
|
49
|
+
write?(input: string): Promise<void>;
|
|
50
|
+
wait(): Promise<CommandResult>;
|
|
51
|
+
kill(): Promise<void>;
|
|
52
|
+
}
|
|
53
|
+
interface GitCloneOptions {
|
|
54
|
+
repoUrl: string;
|
|
55
|
+
branch?: string;
|
|
56
|
+
targetDir?: string;
|
|
57
|
+
depth?: number;
|
|
58
|
+
token?: string;
|
|
59
|
+
headers?: Record<string, string>;
|
|
60
|
+
}
|
|
61
|
+
interface SandboxListOptions {
|
|
62
|
+
tags?: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface SandboxDescriptor {
|
|
65
|
+
provider: SandboxProviderName;
|
|
66
|
+
id: string;
|
|
67
|
+
state?: string;
|
|
68
|
+
tags: Record<string, string>;
|
|
69
|
+
createdAt?: string;
|
|
70
|
+
raw?: unknown;
|
|
71
|
+
}
|
|
72
|
+
interface SandboxOptionsBase {
|
|
73
|
+
tags?: Record<string, string>;
|
|
74
|
+
env?: Record<string, string>;
|
|
75
|
+
workingDir?: string;
|
|
76
|
+
idleTimeoutMs?: number;
|
|
77
|
+
autoStopMs?: number;
|
|
78
|
+
image?: string;
|
|
79
|
+
resources?: SandboxResourceSpec;
|
|
80
|
+
}
|
|
81
|
+
interface SandboxResourceSpec {
|
|
82
|
+
cpu?: number;
|
|
83
|
+
memoryMiB?: number;
|
|
84
|
+
}
|
|
85
|
+
interface LocalDockerProviderOptions {
|
|
86
|
+
name?: string;
|
|
87
|
+
command?: string[];
|
|
88
|
+
pull?: boolean;
|
|
89
|
+
autoRemove?: boolean;
|
|
90
|
+
binds?: string[];
|
|
91
|
+
networkMode?: string;
|
|
92
|
+
publishedPorts?: number[];
|
|
93
|
+
}
|
|
94
|
+
interface ModalProviderOptions {
|
|
95
|
+
appName?: string;
|
|
96
|
+
environment?: string;
|
|
97
|
+
endpoint?: string;
|
|
98
|
+
tokenId?: string;
|
|
99
|
+
tokenSecret?: string;
|
|
100
|
+
encryptedPorts?: number[];
|
|
101
|
+
unencryptedPorts?: number[];
|
|
102
|
+
command?: string[];
|
|
103
|
+
verbose?: boolean;
|
|
104
|
+
}
|
|
105
|
+
interface DaytonaProviderOptions {
|
|
106
|
+
apiKey?: string;
|
|
107
|
+
jwtToken?: string;
|
|
108
|
+
organizationId?: string;
|
|
109
|
+
apiUrl?: string;
|
|
110
|
+
target?: string;
|
|
111
|
+
name?: string;
|
|
112
|
+
language?: string;
|
|
113
|
+
user?: string;
|
|
114
|
+
public?: boolean;
|
|
115
|
+
}
|
|
116
|
+
interface E2bProviderOptions {
|
|
117
|
+
apiKey?: string;
|
|
118
|
+
accessToken?: string;
|
|
119
|
+
domain?: string;
|
|
120
|
+
apiUrl?: string;
|
|
121
|
+
sandboxUrl?: string;
|
|
122
|
+
debug?: boolean;
|
|
123
|
+
requestTimeoutMs?: number;
|
|
124
|
+
headers?: Record<string, string>;
|
|
125
|
+
timeoutMs?: number;
|
|
126
|
+
lifecycle?: {
|
|
127
|
+
onTimeout?: "pause" | "kill";
|
|
128
|
+
autoResume?: boolean;
|
|
129
|
+
};
|
|
130
|
+
secure?: boolean;
|
|
131
|
+
allowInternetAccess?: boolean;
|
|
132
|
+
}
|
|
133
|
+
interface LocalDockerSandboxOptions extends SandboxOptionsBase {
|
|
134
|
+
provider?: LocalDockerProviderOptions;
|
|
135
|
+
}
|
|
136
|
+
interface ModalSandboxOptions extends SandboxOptionsBase {
|
|
137
|
+
provider?: ModalProviderOptions;
|
|
138
|
+
}
|
|
139
|
+
interface DaytonaSandboxOptions extends SandboxOptionsBase {
|
|
140
|
+
provider?: DaytonaProviderOptions;
|
|
141
|
+
}
|
|
142
|
+
interface E2bSandboxOptions extends SandboxOptionsBase {
|
|
143
|
+
provider?: E2bProviderOptions;
|
|
144
|
+
}
|
|
145
|
+
type SandboxOptionsMap = {
|
|
146
|
+
"local-docker": LocalDockerSandboxOptions;
|
|
147
|
+
modal: ModalSandboxOptions;
|
|
148
|
+
daytona: DaytonaSandboxOptions;
|
|
149
|
+
e2b: E2bSandboxOptions;
|
|
150
|
+
};
|
|
151
|
+
type SandboxOptions<P extends SandboxProviderName = SandboxProviderName> = SandboxOptionsMap[P];
|
|
152
|
+
type SandboxRawMap = {
|
|
153
|
+
"local-docker": DockerRaw;
|
|
154
|
+
modal: ModalRaw;
|
|
155
|
+
daytona: DaytonaRaw;
|
|
156
|
+
e2b: E2bRaw;
|
|
157
|
+
};
|
|
158
|
+
type SandboxRaw<P extends SandboxProviderName = SandboxProviderName> = SandboxRawMap[P];
|
|
159
|
+
|
|
160
|
+
declare class Sandbox<P extends SandboxProviderName = SandboxProviderName> {
|
|
161
|
+
private readonly providerName;
|
|
162
|
+
private readonly options;
|
|
163
|
+
private readonly adapter;
|
|
164
|
+
constructor(providerName: P, options: SandboxOptions<P>);
|
|
165
|
+
get provider(): P;
|
|
166
|
+
get optionsSnapshot(): SandboxOptions<P>;
|
|
167
|
+
get id(): string | undefined;
|
|
168
|
+
get raw(): SandboxRaw<P> | undefined;
|
|
169
|
+
openPort(port: number): Promise<this>;
|
|
170
|
+
setSecret(name: string, value: string): this;
|
|
171
|
+
setSecrets(values: Record<string, string>): this;
|
|
172
|
+
gitClone(options: GitCloneOptions): Promise<CommandResult>;
|
|
173
|
+
run(command: string | string[], options?: CommandOptions): Promise<CommandResult>;
|
|
174
|
+
runAsync(command: string | string[], options?: CommandOptions): Promise<AsyncCommandHandle>;
|
|
175
|
+
list(options?: SandboxListOptions): Promise<SandboxDescriptor[]>;
|
|
176
|
+
snapshot(): Promise<string | null>;
|
|
177
|
+
stop(): Promise<void>;
|
|
178
|
+
delete(): Promise<void>;
|
|
179
|
+
getPreviewLink(port: number): Promise<string>;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
export { type AsyncCommandHandle as A, type CommandEvent as C, type DaytonaProviderOptions as D, type E2bProviderOptions as E, type GitCloneOptions as G, type LocalDockerProviderOptions as L, type ModalProviderOptions as M, Sandbox as S, type CommandOptions as a, type CommandResult as b, type DaytonaSandboxOptions as c, type E2bSandboxOptions as d, type LocalDockerSandboxOptions as e, type ModalSandboxOptions as f, type SandboxDescriptor as g, type SandboxListOptions as h, type SandboxOptions as i, type SandboxOptionsBase as j, type SandboxOptionsMap as k, type SandboxProviderName as l, type SandboxRaw as m, type SandboxRawMap as n, type SandboxResourceSpec as o };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { m as AgentProviderName, f as AgentOptions, q as AgentRunConfig, p as AgentRun, o as AgentResult, Z as RawAgentEvent } from '../types-BwcoN0n-.js';
|
|
2
|
+
export { a as AgentApprovalMode, b as AgentCommandConfig, c as AgentExecutionRequest, d as AgentLocalMcpConfig, e as AgentMcpConfig, g as AgentOptionsBase, h as AgentOptionsMap, i as AgentPermissionDecision, j as AgentPermissionKind, k as AgentPermissionResponse, l as AgentProviderAdapter, n as AgentRemoteMcpConfig, r as AgentRunSink, s as AgentSkillConfig, t as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, u as ClaudeCodeHookConfig, v as ClaudeCodeHookEvent, w as ClaudeCodeHookHandler, x as ClaudeCodeHookMatcherGroup, y as ClaudeCodeHooksConfig, z as ClaudeCodeProviderOptions, B as CodexAgentOptions, D as CodexCommandHook, E as CodexHookEvent, F as CodexHookMatcherGroup, G as CodexHooksConfig, H as CodexProviderOptions, I as DataContent, J as EmbeddedSkillConfig, K as FilePart, L as ImagePart, S as OpenCodeAgentOptions, T as OpenCodePluginConfig, U as OpenCodePluginEvent, V as OpenCodePluginHookConfig, W as OpenCodeProviderOptions, $ as RepoSkillConfig, a4 as TextPart, a8 as UserContent, a9 as UserContentPart } from '../types-BwcoN0n-.js';
|
|
3
|
+
import '../Sandbox-DTprxRZf.js';
|
|
4
|
+
import 'e2b';
|
|
5
|
+
import '@daytonaio/sdk';
|
|
6
|
+
import 'modal';
|
|
7
|
+
import 'dockerode';
|
|
8
|
+
|
|
9
|
+
declare class Agent<P extends AgentProviderName = AgentProviderName> {
|
|
10
|
+
private readonly adapter;
|
|
11
|
+
private readonly provider;
|
|
12
|
+
private readonly options;
|
|
13
|
+
constructor(provider: P, options: AgentOptions<P>);
|
|
14
|
+
stream(runConfig: AgentRunConfig): AgentRun;
|
|
15
|
+
run(runConfig: AgentRunConfig): Promise<AgentResult>;
|
|
16
|
+
rawEvents(runConfig: AgentRunConfig): AsyncIterable<RawAgentEvent>;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export { Agent, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig };
|