agentbox-sdk 0.1.0 → 0.1.3
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 +72 -18
- package/dist/{Sandbox-DTprxRZf.d.ts → Sandbox-CByFJI8X.d.ts} +102 -6
- package/dist/agents/index.d.ts +74 -5
- package/dist/agents/index.js +14 -5
- package/dist/chunk-4MBB6QHD.js +4658 -0
- package/dist/chunk-GOFJNFAD.js +18 -0
- package/dist/{chunk-HMBWQSVN.js → chunk-INMA52FV.js} +83 -23
- package/dist/{chunk-QRQFQTGH.js → chunk-LPKKT6YT.js} +742 -50
- package/dist/chunk-ZOWBRUQR.js +476 -0
- package/dist/cli.js +16 -8
- package/dist/enums.d.ts +25 -0
- package/dist/enums.js +8 -0
- package/dist/events/index.d.ts +86 -2
- package/dist/events/index.js +4 -1
- package/dist/index.d.ts +6 -3
- package/dist/index.js +18 -5
- package/dist/sandboxes/index.d.ts +58 -4
- package/dist/sandboxes/index.js +7 -3
- package/dist/{types-BwcoN0n-.d.ts → types-B3N-Qo2q.d.ts} +147 -6
- package/images/browser-agent.mjs +3 -3
- package/package.json +13 -3
- package/dist/chunk-7FLLQJ6J.js +0 -185
- package/dist/chunk-BW43ESRM.js +0 -4381
- /package/dist/{chunk-JFDP556Q.js → chunk-NSJM57Z4.js} +0 -0
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# AgentBox
|
|
2
2
|
|
|
3
|
+
[Live demo](https://agentbox-demo-175164121374.us-west1.run.app/)
|
|
4
|
+
|
|
3
5
|
Run coding agents inside sandboxes. One API, any provider.
|
|
4
6
|
|
|
5
7
|
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.
|
|
@@ -13,12 +15,14 @@ const sandbox = new Sandbox("local-docker", {
|
|
|
13
15
|
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
|
|
14
16
|
});
|
|
15
17
|
|
|
18
|
+
await sandbox.findOrProvision();
|
|
19
|
+
|
|
16
20
|
const run = new Agent("claude-code", {
|
|
17
21
|
sandbox,
|
|
18
22
|
cwd: "/workspace",
|
|
19
23
|
approvalMode: "auto",
|
|
20
24
|
}).stream({
|
|
21
|
-
model: "
|
|
25
|
+
model: "sonnet",
|
|
22
26
|
input: "Create a hello world Express server in /workspace/server.ts",
|
|
23
27
|
});
|
|
24
28
|
|
|
@@ -32,7 +36,7 @@ await sandbox.delete();
|
|
|
32
36
|
Providers are mix-and-match:
|
|
33
37
|
|
|
34
38
|
- **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)
|
|
39
|
+
- **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), [`vercel`](./src/sandboxes/providers/vercel.ts)
|
|
36
40
|
|
|
37
41
|
Swap either one and your app code stays the same.
|
|
38
42
|
|
|
@@ -71,6 +75,11 @@ const sandbox = new Sandbox("local-docker", {
|
|
|
71
75
|
env: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY! },
|
|
72
76
|
});
|
|
73
77
|
|
|
78
|
+
// Explicitly attach to / create the sandbox before running anything.
|
|
79
|
+
// Subsequent `sandbox.run`, `sandbox.gitClone`, agent runs, etc. all
|
|
80
|
+
// require this to have happened first.
|
|
81
|
+
await sandbox.findOrProvision();
|
|
82
|
+
|
|
74
83
|
const agent = new Agent("claude-code", {
|
|
75
84
|
sandbox,
|
|
76
85
|
cwd: "/workspace",
|
|
@@ -78,7 +87,7 @@ const agent = new Agent("claude-code", {
|
|
|
78
87
|
});
|
|
79
88
|
|
|
80
89
|
const result = await agent.run({
|
|
81
|
-
model: "
|
|
90
|
+
model: "sonnet",
|
|
82
91
|
input:
|
|
83
92
|
"Explain the project structure and write a summary to /workspace/OVERVIEW.md",
|
|
84
93
|
});
|
|
@@ -93,7 +102,7 @@ await sandbox.delete();
|
|
|
93
102
|
|
|
94
103
|
```ts
|
|
95
104
|
const run = agent.stream({
|
|
96
|
-
model: "
|
|
105
|
+
model: "sonnet",
|
|
97
106
|
input: "Write a fizzbuzz in Python",
|
|
98
107
|
});
|
|
99
108
|
|
|
@@ -112,28 +121,72 @@ Three agent providers are supported. Each wraps a CLI that runs inside the sandb
|
|
|
112
121
|
|
|
113
122
|
| Provider | CLI | Model format |
|
|
114
123
|
| ------------- | ---------- | ----------------------------------------------- |
|
|
115
|
-
| `claude-code` | `claude` | `
|
|
124
|
+
| `claude-code` | `claude` | `sonnet`, `opus`, `haiku` |
|
|
116
125
|
| `opencode` | `opencode` | `anthropic/claude-sonnet-4-6`, `openai/gpt-4.1` |
|
|
117
|
-
| `codex` | `codex` | `gpt-5-codex`
|
|
126
|
+
| `codex` | `codex` | `gpt-5.3-codex`, `gpt-5.4` |
|
|
118
127
|
|
|
119
128
|
```ts
|
|
120
129
|
new Agent("claude-code", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
121
|
-
new Agent("
|
|
130
|
+
new Agent("open-code", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
122
131
|
new Agent("codex", { sandbox, cwd: "/workspace", approvalMode: "auto" });
|
|
123
132
|
```
|
|
124
133
|
|
|
134
|
+
### Reasoning effort
|
|
135
|
+
|
|
136
|
+
Pass an optional `reasoning` level alongside `model` on any run. It maps to each provider's native reasoning control: Codex's `effort` on `turn/start`, Claude Code's `--effort` flag, and OpenCode's `reasoningEffort` agent variant.
|
|
137
|
+
|
|
138
|
+
```ts
|
|
139
|
+
await agent.run({
|
|
140
|
+
model: "sonnet",
|
|
141
|
+
reasoning: "high", // "low" | "medium" | "high" | "xhigh"
|
|
142
|
+
input: "Refactor this module and explain your reasoning.",
|
|
143
|
+
});
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
`xhigh` requires a model that supports it (e.g. Claude Opus 4.7+, Codex `gpt-5.4`).
|
|
147
|
+
|
|
125
148
|
## Sandboxes
|
|
126
149
|
|
|
127
|
-
|
|
150
|
+
Five sandbox providers are supported. Each gives you an isolated environment with the same interface:
|
|
151
|
+
|
|
152
|
+
| Provider | What it is | Auth |
|
|
153
|
+
| -------------- | ---------------------- | ------------------------------------------------------- |
|
|
154
|
+
| `local-docker` | Local Docker container | Docker daemon |
|
|
155
|
+
| `e2b` | Cloud micro-VM | `E2B_API_KEY` |
|
|
156
|
+
| `modal` | Cloud container | `MODAL_TOKEN_ID` + `MODAL_TOKEN_SECRET` |
|
|
157
|
+
| `daytona` | Cloud dev environment | `DAYTONA_API_KEY` |
|
|
158
|
+
| `vercel` | Ephemeral cloud VM | `VERCEL_TOKEN` + `VERCEL_TEAM_ID` + `VERCEL_PROJECT_ID` |
|
|
159
|
+
|
|
160
|
+
Every sandbox supports: `findOrProvision()`, `run()`, `runAsync()`, `gitClone()`, `uploadAndRun()`, `openPort()`, `getPreviewLink()`, `snapshot()`, `stop()`, `delete()`.
|
|
161
|
+
|
|
162
|
+
### Provisioning lifecycle
|
|
128
163
|
|
|
129
|
-
|
|
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` |
|
|
164
|
+
`new Sandbox(...)` only stores configuration — it does **not** create or attach to a real sandbox. Call `findOrProvision()` once when you're ready to start using it, and every subsequent operation (`run`, `gitClone`, `uploadAndRun`, agent runs, …) reuses that sandbox:
|
|
135
165
|
|
|
136
|
-
|
|
166
|
+
```ts
|
|
167
|
+
const sandbox = new Sandbox("modal", {
|
|
168
|
+
/* … */
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
await sandbox.findOrProvision(); // attach to existing tagged sandbox or create a fresh one
|
|
172
|
+
await sandbox.gitClone({ repoUrl: "…" });
|
|
173
|
+
const result = await sandbox.run("pnpm install");
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
Calling a method that needs a live sandbox before `findOrProvision()` throws a clear error. This makes the (potentially slow) attach / create step explicit and lets you control exactly when it happens.
|
|
177
|
+
|
|
178
|
+
Vercel sandboxes use runtime snapshots instead of pre-built images — call `sandbox.snapshot()` to capture state and pass the returned id via `provider.snapshotId` on the next run.
|
|
179
|
+
|
|
180
|
+
Vercel also requires ports to be declared at create time via `provider.ports` — `openPort()` is a no-op at runtime, so any port the agent (or your own code) will listen on must be listed up front:
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const sandbox = new Sandbox("vercel", {
|
|
184
|
+
provider: {
|
|
185
|
+
snapshotId: process.env.VERCEL_SNAPSHOT_ID!,
|
|
186
|
+
ports: [4096], // e.g. opencode; codex/claude-code use 43180
|
|
187
|
+
},
|
|
188
|
+
});
|
|
189
|
+
```
|
|
137
190
|
|
|
138
191
|
## Skills
|
|
139
192
|
|
|
@@ -218,7 +271,7 @@ const agent = new Agent("claude-code", {
|
|
|
218
271
|
Register slash commands the agent can use:
|
|
219
272
|
|
|
220
273
|
```ts
|
|
221
|
-
const agent = new Agent("
|
|
274
|
+
const agent = new Agent("open-code", {
|
|
222
275
|
sandbox,
|
|
223
276
|
cwd: "/workspace",
|
|
224
277
|
approvalMode: "auto",
|
|
@@ -241,7 +294,7 @@ Pass images and files alongside text:
|
|
|
241
294
|
import { pathToFileURL } from "node:url";
|
|
242
295
|
|
|
243
296
|
const result = await agent.run({
|
|
244
|
-
model: "
|
|
297
|
+
model: "sonnet",
|
|
245
298
|
input: [
|
|
246
299
|
{ type: "text", text: "Describe this mockup and suggest improvements." },
|
|
247
300
|
{ type: "image", image: pathToFileURL("/workspace/mockup.png") },
|
|
@@ -319,7 +372,7 @@ new Agent("codex", {
|
|
|
319
372
|
**OpenCode** — plugin-based hooks:
|
|
320
373
|
|
|
321
374
|
```ts
|
|
322
|
-
new Agent("
|
|
375
|
+
new Agent("open-code", {
|
|
323
376
|
sandbox,
|
|
324
377
|
cwd: "/workspace",
|
|
325
378
|
provider: {
|
|
@@ -348,6 +401,7 @@ The [`examples/`](./examples) directory has short, runnable scripts that each de
|
|
|
348
401
|
| [`multimodal.ts`](./examples/multimodal.ts) | Send images to the agent |
|
|
349
402
|
| [`custom-image.ts`](./examples/custom-image.ts) | Build a custom sandbox image |
|
|
350
403
|
| [`cloud-sandbox.ts`](./examples/cloud-sandbox.ts) | Use E2B, Modal, or Daytona |
|
|
404
|
+
| [`basic-vercel.ts`](./examples/basic-vercel.ts) | Use a Vercel sandbox |
|
|
351
405
|
| [`git-clone.ts`](./examples/git-clone.ts) | Clone a repo into the sandbox |
|
|
352
406
|
|
|
353
407
|
All examples import from `"agentbox-sdk"` like a normal dependency. Run them with:
|
|
@@ -1,20 +1,44 @@
|
|
|
1
1
|
import { Sandbox as Sandbox$1 } from 'e2b';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { Sandbox as Sandbox$2 } from '@vercel/sandbox';
|
|
3
|
+
import { Daytona, Sandbox as Sandbox$3, CreateSandboxFromSnapshotParams, CreateSandboxFromImageParams } from '@daytonaio/sdk';
|
|
4
|
+
import { ModalClient, Sandbox as Sandbox$4, SandboxCreateParams } from 'modal';
|
|
4
5
|
import Docker from 'dockerode';
|
|
6
|
+
import { SandboxProvider } from './enums.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tiny in-memory tarball builder used by `Sandbox.uploadAndRun`.
|
|
10
|
+
*
|
|
11
|
+
* Builds an uncompressed POSIX USTAR archive entirely in-memory, suitable
|
|
12
|
+
* for piping through a sandbox's stdin to be extracted by `tar -x`. We
|
|
13
|
+
* deliberately don't gzip on the host: setup tarballs are small (a few
|
|
14
|
+
* KB) and the sandbox's `tar` may not always have gzip when the image is
|
|
15
|
+
* stripped down, so plain tar keeps the contract simple.
|
|
16
|
+
*/
|
|
17
|
+
interface TarballEntry {
|
|
18
|
+
/** Absolute or relative path the file should be written to in the sandbox. */
|
|
19
|
+
path: string;
|
|
20
|
+
/** File contents. Strings are encoded as UTF-8. */
|
|
21
|
+
content: string | Buffer;
|
|
22
|
+
/** Optional file mode (default `0o644`). Pass `0o755` for executables. */
|
|
23
|
+
mode?: number;
|
|
24
|
+
}
|
|
5
25
|
|
|
6
26
|
type E2bRaw = {
|
|
7
27
|
sandbox?: Sandbox$1;
|
|
8
28
|
};
|
|
9
29
|
|
|
30
|
+
type VercelRaw = {
|
|
31
|
+
sandbox?: Sandbox$2;
|
|
32
|
+
};
|
|
33
|
+
|
|
10
34
|
type DaytonaRaw = {
|
|
11
35
|
client: Daytona;
|
|
12
|
-
sandbox?: Sandbox$
|
|
36
|
+
sandbox?: Sandbox$3;
|
|
13
37
|
};
|
|
14
38
|
|
|
15
39
|
type ModalRaw = {
|
|
16
40
|
client: ModalClient;
|
|
17
|
-
sandbox?: Sandbox$
|
|
41
|
+
sandbox?: Sandbox$4;
|
|
18
42
|
};
|
|
19
43
|
|
|
20
44
|
type DockerRaw = {
|
|
@@ -22,7 +46,7 @@ type DockerRaw = {
|
|
|
22
46
|
container?: Docker.Container;
|
|
23
47
|
};
|
|
24
48
|
|
|
25
|
-
type SandboxProviderName =
|
|
49
|
+
type SandboxProviderName = SandboxProvider;
|
|
26
50
|
interface CommandOptions {
|
|
27
51
|
cwd?: string;
|
|
28
52
|
env?: Record<string, string>;
|
|
@@ -101,6 +125,16 @@ interface ModalProviderOptions {
|
|
|
101
125
|
unencryptedPorts?: number[];
|
|
102
126
|
command?: string[];
|
|
103
127
|
verbose?: boolean;
|
|
128
|
+
/**
|
|
129
|
+
* Escape hatch: extra parameters spread into Modal's
|
|
130
|
+
* `client.sandboxes.create()` call. Lets callers use Modal-specific
|
|
131
|
+
* features that are not surfaced as typed fields here (e.g.
|
|
132
|
+
* `experimentalOptions`, `gpu`, `cloudBucketMounts`, `regions`).
|
|
133
|
+
*
|
|
134
|
+
* Typed fields on `ModalProviderOptions` and `SandboxOptionsBase` take
|
|
135
|
+
* precedence over keys provided via `createParams`.
|
|
136
|
+
*/
|
|
137
|
+
createParams?: Partial<SandboxCreateParams>;
|
|
104
138
|
}
|
|
105
139
|
interface DaytonaProviderOptions {
|
|
106
140
|
apiKey?: string;
|
|
@@ -112,6 +146,45 @@ interface DaytonaProviderOptions {
|
|
|
112
146
|
language?: string;
|
|
113
147
|
user?: string;
|
|
114
148
|
public?: boolean;
|
|
149
|
+
/**
|
|
150
|
+
* Escape hatch: extra parameters spread into Daytona's `client.create()`
|
|
151
|
+
* call. Lets callers use Daytona-specific features that are not surfaced
|
|
152
|
+
* as typed fields here (e.g. `volumes`, `networkBlockAll`,
|
|
153
|
+
* `networkAllowList`, `ephemeral`, `autoArchiveInterval`).
|
|
154
|
+
*
|
|
155
|
+
* Typed fields on `DaytonaProviderOptions` and `SandboxOptionsBase` take
|
|
156
|
+
* precedence over keys provided via `createParams`.
|
|
157
|
+
*/
|
|
158
|
+
createParams?: Partial<CreateSandboxFromSnapshotParams & CreateSandboxFromImageParams>;
|
|
159
|
+
}
|
|
160
|
+
interface VercelGitSource {
|
|
161
|
+
url: string;
|
|
162
|
+
depth?: number;
|
|
163
|
+
revision?: string;
|
|
164
|
+
username?: string;
|
|
165
|
+
password?: string;
|
|
166
|
+
}
|
|
167
|
+
interface VercelProviderOptions {
|
|
168
|
+
token?: string;
|
|
169
|
+
teamId?: string;
|
|
170
|
+
projectId?: string;
|
|
171
|
+
runtime?: string;
|
|
172
|
+
snapshotId?: string;
|
|
173
|
+
timeoutMs?: number;
|
|
174
|
+
gitSource?: VercelGitSource;
|
|
175
|
+
/**
|
|
176
|
+
* Ports to declare at sandbox creation time. The Vercel SDK requires ports
|
|
177
|
+
* to be known upfront; runtime-opened ports are not supported. Max 4.
|
|
178
|
+
*/
|
|
179
|
+
ports?: number[];
|
|
180
|
+
/**
|
|
181
|
+
* Vercel Deployment Protection bypass token. When set, every request the
|
|
182
|
+
* agent transports send through the sandbox preview URL will include
|
|
183
|
+
* `x-vercel-protection-bypass: <token>`. Required when the linked Vercel
|
|
184
|
+
* project has Deployment Protection enabled — without it, POST requests
|
|
185
|
+
* to sandbox-exposed ports come back 200 + empty body.
|
|
186
|
+
*/
|
|
187
|
+
protectionBypass?: string;
|
|
115
188
|
}
|
|
116
189
|
interface E2bProviderOptions {
|
|
117
190
|
apiKey?: string;
|
|
@@ -139,6 +212,9 @@ interface ModalSandboxOptions extends SandboxOptionsBase {
|
|
|
139
212
|
interface DaytonaSandboxOptions extends SandboxOptionsBase {
|
|
140
213
|
provider?: DaytonaProviderOptions;
|
|
141
214
|
}
|
|
215
|
+
interface VercelSandboxOptions extends SandboxOptionsBase {
|
|
216
|
+
provider?: VercelProviderOptions;
|
|
217
|
+
}
|
|
142
218
|
interface E2bSandboxOptions extends SandboxOptionsBase {
|
|
143
219
|
provider?: E2bProviderOptions;
|
|
144
220
|
}
|
|
@@ -146,6 +222,7 @@ type SandboxOptionsMap = {
|
|
|
146
222
|
"local-docker": LocalDockerSandboxOptions;
|
|
147
223
|
modal: ModalSandboxOptions;
|
|
148
224
|
daytona: DaytonaSandboxOptions;
|
|
225
|
+
vercel: VercelSandboxOptions;
|
|
149
226
|
e2b: E2bSandboxOptions;
|
|
150
227
|
};
|
|
151
228
|
type SandboxOptions<P extends SandboxProviderName = SandboxProviderName> = SandboxOptionsMap[P];
|
|
@@ -153,6 +230,7 @@ type SandboxRawMap = {
|
|
|
153
230
|
"local-docker": DockerRaw;
|
|
154
231
|
modal: ModalRaw;
|
|
155
232
|
daytona: DaytonaRaw;
|
|
233
|
+
vercel: VercelRaw;
|
|
156
234
|
e2b: E2bRaw;
|
|
157
235
|
};
|
|
158
236
|
type SandboxRaw<P extends SandboxProviderName = SandboxProviderName> = SandboxRawMap[P];
|
|
@@ -166,6 +244,20 @@ declare class Sandbox<P extends SandboxProviderName = SandboxProviderName> {
|
|
|
166
244
|
get optionsSnapshot(): SandboxOptions<P>;
|
|
167
245
|
get id(): string | undefined;
|
|
168
246
|
get raw(): SandboxRaw<P> | undefined;
|
|
247
|
+
/**
|
|
248
|
+
* Whether `findOrProvision()` warm-attached to a pre-existing tagged
|
|
249
|
+
* sandbox (`true`) or created a fresh one (`false`). Useful to skip
|
|
250
|
+
* idempotent setup that the previous run already performed (e.g.
|
|
251
|
+
* `agent.setup()`). Always `false` before `findOrProvision()` resolves.
|
|
252
|
+
*/
|
|
253
|
+
get wasFound(): boolean;
|
|
254
|
+
/**
|
|
255
|
+
* Attach to an existing tagged sandbox or create a new one. Must be
|
|
256
|
+
* called before `run`, `runAsync`, `gitClone`, `uploadAndRun`,
|
|
257
|
+
* `getPreviewLink`, etc. Repeated calls are cheap (the result is
|
|
258
|
+
* cached internally).
|
|
259
|
+
*/
|
|
260
|
+
findOrProvision(): Promise<this>;
|
|
169
261
|
openPort(port: number): Promise<this>;
|
|
170
262
|
setSecret(name: string, value: string): this;
|
|
171
263
|
setSecrets(values: Record<string, string>): this;
|
|
@@ -177,6 +269,10 @@ declare class Sandbox<P extends SandboxProviderName = SandboxProviderName> {
|
|
|
177
269
|
stop(): Promise<void>;
|
|
178
270
|
delete(): Promise<void>;
|
|
179
271
|
getPreviewLink(port: number): Promise<string>;
|
|
272
|
+
get previewHeaders(): Record<string, string>;
|
|
273
|
+
uploadFile(content: Buffer | string, targetPath: string): Promise<void>;
|
|
274
|
+
downloadFile(sourcePath: string): Promise<Buffer>;
|
|
275
|
+
uploadAndRun(files: TarballEntry[], command: string, options?: CommandOptions): Promise<CommandResult>;
|
|
180
276
|
}
|
|
181
277
|
|
|
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 };
|
|
278
|
+
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 TarballEntry as T, type VercelGitSource as V, 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, type VercelProviderOptions as p, type VercelSandboxOptions as q };
|
package/dist/agents/index.d.ts
CHANGED
|
@@ -1,19 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export { a as AgentApprovalMode,
|
|
3
|
-
import '../Sandbox-
|
|
1
|
+
import { o as AgentProviderName, h as AgentOptions, v as AgentSetupConfig, t as AgentRunConfig, s as AgentRun, r as AgentResult, a3 as RawAgentEvent, b as AgentAttachRequest, z as AttachedRun } from '../types-B3N-Qo2q.js';
|
|
2
|
+
export { a as AgentApprovalMode, c as AgentCommandConfig, d as AgentCostData, e as AgentExecutionRequest, f as AgentLocalMcpConfig, g as AgentMcpConfig, i as AgentOptionsBase, j as AgentOptionsMap, k as AgentPermissionDecision, l as AgentPermissionKind, m as AgentPermissionResponse, n as AgentProviderAdapter, p as AgentReasoningEffort, q as AgentRemoteMcpConfig, u as AgentRunSink, w as AgentSetupRequest, x as AgentSkillConfig, y as AgentSubAgentConfig, C as ClaudeCodeAgentOptions, B as ClaudeCodeHookConfig, D as ClaudeCodeHookEvent, E as ClaudeCodeHookHandler, F as ClaudeCodeHookMatcherGroup, G as ClaudeCodeHooksConfig, H as ClaudeCodeProviderOptions, I as CodexAgentOptions, J as CodexCommandHook, K as CodexHookEvent, L as CodexHookMatcherGroup, M as CodexHooksConfig, N as CodexProviderOptions, O as DataContent, P as EmbeddedSkillConfig, Q as FilePart, R as ImagePart, Y as OpenCodeAgentOptions, Z as OpenCodePluginConfig, _ as OpenCodePluginEvent, $ as OpenCodePluginHookConfig, a0 as OpenCodeProviderOptions, a5 as RepoSkillConfig, aa as TextPart, ae as UserContent, af as UserContentPart } from '../types-B3N-Qo2q.js';
|
|
3
|
+
import { S as Sandbox } from '../Sandbox-CByFJI8X.js';
|
|
4
|
+
export { AgentProvider } from '../enums.js';
|
|
4
5
|
import 'e2b';
|
|
6
|
+
import '@vercel/sandbox';
|
|
5
7
|
import '@daytonaio/sdk';
|
|
6
8
|
import 'modal';
|
|
7
9
|
import 'dockerode';
|
|
8
10
|
|
|
9
11
|
declare class Agent<P extends AgentProviderName = AgentProviderName> {
|
|
10
12
|
private readonly adapter;
|
|
11
|
-
|
|
13
|
+
readonly provider: P;
|
|
12
14
|
private readonly options;
|
|
15
|
+
private setupPromise?;
|
|
13
16
|
constructor(provider: P, options: AgentOptions<P>);
|
|
17
|
+
/**
|
|
18
|
+
* The sandbox the agent will run inside, if any was passed via
|
|
19
|
+
* `options.sandbox`. Returns `undefined` for host-mode runs (no sandbox).
|
|
20
|
+
*/
|
|
21
|
+
get sandbox(): Sandbox | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Prepare provider-specific runtime state on the configured sandbox
|
|
24
|
+
* (skill artifacts, MCP/hook/sub-agent config, app-server / relay boot, …).
|
|
25
|
+
*
|
|
26
|
+
* `setup()` is REQUIRED before {@link Agent.stream} or {@link Agent.run}
|
|
27
|
+
* for any sandbox-backed run. `stream` and the underlying
|
|
28
|
+
* `adapter.execute` deliberately do not trigger setup themselves so
|
|
29
|
+
* callers can run sandbox-side preparation in parallel with other
|
|
30
|
+
* long-running work (e.g. `git clone`).
|
|
31
|
+
*
|
|
32
|
+
* `execute` does not consume any setup output and does not re-do
|
|
33
|
+
* setup work. It assumes the relay/server boot performed here is
|
|
34
|
+
* already up. Skipping `setup()` against a remote sandbox is a
|
|
35
|
+
* programmer error and surfaces as a connect-retry timeout inside
|
|
36
|
+
* `execute`, not a silent fallback.
|
|
37
|
+
*
|
|
38
|
+
* Idempotent across repeated invocations: subsequent calls return the
|
|
39
|
+
* promise from the first call. The differential setup cache and the
|
|
40
|
+
* relay/server probes also make this cheap on warm sandboxes — the
|
|
41
|
+
* second `setup()` against the same sandbox does ~one round-trip of
|
|
42
|
+
* work.
|
|
43
|
+
*/
|
|
44
|
+
setup(config?: AgentSetupConfig): Promise<void>;
|
|
14
45
|
stream(runConfig: AgentRunConfig): AgentRun;
|
|
15
46
|
run(runConfig: AgentRunConfig): Promise<AgentResult>;
|
|
16
47
|
rawEvents(runConfig: AgentRunConfig): AsyncIterable<RawAgentEvent>;
|
|
48
|
+
/**
|
|
49
|
+
* Stateless control plane for an in-flight run.
|
|
50
|
+
*
|
|
51
|
+
* Returns an {@link AttachedRun} whose `abort()` / `sendMessage()` methods
|
|
52
|
+
* dial the in-sandbox provider server directly (codex app-server, opencode
|
|
53
|
+
* HTTP server, claude-code relay control endpoint) — there is no shared
|
|
54
|
+
* in-memory registry or Redis broker. Any process with the right `sandbox`
|
|
55
|
+
* + `runId` (+ optional provider-native `sessionId`) can issue commands
|
|
56
|
+
* against a run started on a different process.
|
|
57
|
+
*
|
|
58
|
+
* The originating process keeps owning the event stream that
|
|
59
|
+
* `agent.stream()` returned; commands attached here cause the in-sandbox
|
|
60
|
+
* server to emit the natural follow-up events (`turn/aborted`, message
|
|
61
|
+
* events, etc.), which the originating process ingests through its
|
|
62
|
+
* existing transport.
|
|
63
|
+
*
|
|
64
|
+
* The handle is short-lived: each method call opens a fresh connection,
|
|
65
|
+
* performs the operation with a timeout, and tears the connection down.
|
|
66
|
+
*/
|
|
67
|
+
static attach<P extends AgentProviderName>(request: AgentAttachRequest<P>): Promise<AttachedRun>;
|
|
17
68
|
}
|
|
18
69
|
|
|
19
|
-
|
|
70
|
+
/**
|
|
71
|
+
* Ports each agent harness needs exposed on its sandbox in order to reach
|
|
72
|
+
* its app-server (or equivalent local server). These are used to:
|
|
73
|
+
*
|
|
74
|
+
* 1. Drive `sandbox.openPort(...)` at `Agent` construction time so providers
|
|
75
|
+
* whose `openPort` only mutates options before provisioning (Modal) still
|
|
76
|
+
* include the port.
|
|
77
|
+
* 2. Pre-declare the ports on Modal sandboxes by default so that a Modal
|
|
78
|
+
* sandbox created without explicit `unencryptedPorts` still works when
|
|
79
|
+
* the caller later points an `Agent` at it.
|
|
80
|
+
*
|
|
81
|
+
* Exported so callers can forward the ports to sandbox creation options when
|
|
82
|
+
* they know in advance which harness will be used (e.g.
|
|
83
|
+
* `provider.unencryptedPorts: AGENT_RESERVED_PORTS.codex`).
|
|
84
|
+
*/
|
|
85
|
+
declare const AGENT_RESERVED_PORTS: Record<AgentProviderName, readonly number[]>;
|
|
86
|
+
declare function collectAllAgentReservedPorts(): number[];
|
|
87
|
+
|
|
88
|
+
export { AGENT_RESERVED_PORTS, Agent, AgentAttachRequest, AgentOptions, AgentProviderName, AgentResult, AgentRun, AgentRunConfig, AgentSetupConfig, AttachedRun, collectAllAgentReservedPorts };
|
package/dist/agents/index.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Agent
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
5
|
-
import
|
|
6
|
-
|
|
3
|
+
} from "../chunk-4MBB6QHD.js";
|
|
4
|
+
import "../chunk-ZOWBRUQR.js";
|
|
5
|
+
import {
|
|
6
|
+
AGENT_RESERVED_PORTS,
|
|
7
|
+
collectAllAgentReservedPorts
|
|
8
|
+
} from "../chunk-INMA52FV.js";
|
|
9
|
+
import "../chunk-NSJM57Z4.js";
|
|
10
|
+
import {
|
|
11
|
+
AgentProvider
|
|
12
|
+
} from "../chunk-GOFJNFAD.js";
|
|
7
13
|
export {
|
|
8
|
-
|
|
14
|
+
AGENT_RESERVED_PORTS,
|
|
15
|
+
Agent,
|
|
16
|
+
AgentProvider,
|
|
17
|
+
collectAllAgentReservedPorts
|
|
9
18
|
};
|