agent-neckbeard 1.1.15 → 1.1.17
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 -23
- package/dist/index.cjs +10 -32
- package/dist/index.d.cts +23 -9
- package/dist/index.d.ts +23 -9
- package/dist/index.js +10 -32
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -8,6 +8,12 @@ The intent is simple: your production process should not run the agent. The sand
|
|
|
8
8
|
|
|
9
9
|
This is designed to work from short-lived request handlers and long-running workers, including Vercel Functions, Hatchet workers, and Trigger.dev tasks. See `docs/CONSUMER_ENVIRONMENTS.md` before changing lifecycle, timeout, streaming, or cleanup behavior for those environments.
|
|
10
10
|
|
|
11
|
+
The three primary usage patterns:
|
|
12
|
+
|
|
13
|
+
- Workflows: a run-output agent runs once per background task and returns one validated output (Run-Output Agents below).
|
|
14
|
+
- Streaming: a persistent sandbox server emits typed progress frames while work runs (Streaming Agents below).
|
|
15
|
+
- Direct sandbox access: `SandboxClient` wraps E2B and Daytona behind one filesystem/command API, no agent required (Direct Sandbox Access below).
|
|
16
|
+
|
|
11
17
|
## What This Does
|
|
12
18
|
|
|
13
19
|
You write an agent:
|
|
@@ -61,6 +67,8 @@ new Agent({
|
|
|
61
67
|
});
|
|
62
68
|
```
|
|
63
69
|
|
|
70
|
+
When the right path differs between environments (for example a monorepo dev server versus a deployed worker), `resolveAgentSourceFile(candidates, { errorMessage })` returns the first candidate path that exists and falls back to the bundled agent module when running inside the sandbox.
|
|
71
|
+
|
|
64
72
|
For Next.js/Vercel-style deployments, keep `agent-neckbeard` external to the server bundle and make sure the referenced source file is included in the production artifact:
|
|
65
73
|
|
|
66
74
|
```typescript
|
|
@@ -77,7 +85,7 @@ const nextConfig = withNeckbeardNextConfig({
|
|
|
77
85
|
export default nextConfig;
|
|
78
86
|
```
|
|
79
87
|
|
|
80
|
-
The helper traces files imported by those source entries by default, including package entry metadata that `deploy()` needs when it rebundles the agent at runtime.
|
|
88
|
+
The helper traces files imported by those source entries by default, including package entry metadata that `deploy()` needs when it rebundles the agent at runtime. Set `outputFileTracingRoot` when the agent source is outside the app root.
|
|
81
89
|
|
|
82
90
|
This repo tests that shape locally with `npm run test:compat:next`, which builds and runs a Dockerized Next App Router fixture without pushing to Vercel. The fixture also checks the runtime env contract, Node major, and traced standalone files so source-level tests do not mask deployment artifact problems.
|
|
83
91
|
|
|
@@ -95,6 +103,21 @@ export ANTHROPIC_API_KEY=your-key
|
|
|
95
103
|
|
|
96
104
|
Pick the sandbox backend explicitly with `sandbox.provider`. The public `sandbox.template` field maps to an E2B template or a Daytona snapshot.
|
|
97
105
|
|
|
106
|
+
Daytona sandboxes can also receive network policy options supported by the Daytona SDK. Use `domainAllowList` for domains and wildcard domains, or `networkAllowList` for comma-separated CIDR ranges:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
new Agent({
|
|
110
|
+
sandbox: {
|
|
111
|
+
provider: 'daytona',
|
|
112
|
+
template: 'daytona-small',
|
|
113
|
+
domainAllowList: '*.example.com',
|
|
114
|
+
},
|
|
115
|
+
// ...
|
|
116
|
+
});
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Set `networkBlockAll: true` only when you want to block all outbound network access. Daytona rejects `networkBlockAll: true` combined with non-empty allow lists.
|
|
120
|
+
|
|
98
121
|
## Run-Output Agents
|
|
99
122
|
|
|
100
123
|
Use `run` when each invocation should produce one validated output:
|
|
@@ -126,9 +149,25 @@ run: async (input, ctx) => {
|
|
|
126
149
|
|
|
127
150
|
Use `ctx.sandbox.homeDir` and `ctx.sandbox.agentDir` instead of hardcoding `/home/user` if you want the same agent code to work on both providers.
|
|
128
151
|
|
|
152
|
+
Run-output agents fit background workflows (Hatchet tasks, Trigger.dev jobs, queue workers). The usual shape is one sandbox per task:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
const sandboxId = await agent.deploy({ fresh: true });
|
|
156
|
+
|
|
157
|
+
try {
|
|
158
|
+
const result = await agent.run(input, { sandboxId });
|
|
159
|
+
if (!result.ok) throw result.error;
|
|
160
|
+
return result.output;
|
|
161
|
+
} finally {
|
|
162
|
+
await agent.kill(sandboxId);
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
`deploy({ fresh: true })` keeps concurrent tasks from sharing one cached sandbox; see Reusing Sandboxes for the caching behavior.
|
|
167
|
+
|
|
129
168
|
## Streaming Agents
|
|
130
169
|
|
|
131
|
-
Use `server.handler` when you want progress frames while the sandbox work is still running:
|
|
170
|
+
Use `server.handler` when you want progress frames while the sandbox work is still running, such as relaying tool calls and assistant text to a UI or event log:
|
|
132
171
|
|
|
133
172
|
```typescript
|
|
134
173
|
const agent = new Agent({
|
|
@@ -157,7 +196,7 @@ for await (const frame of agent.invoke({ prompt: 'hi' }, { sandboxId })) {
|
|
|
157
196
|
}
|
|
158
197
|
```
|
|
159
198
|
|
|
160
|
-
Internally, streaming uses Server-Sent Events from the sandbox `/invoke` endpoint. Neckbeard wraps user frames in harness events so errors, completion, and run-output results are handled consistently.
|
|
199
|
+
Internally, streaming uses Server-Sent Events from the sandbox `/invoke` endpoint. Neckbeard wraps user frames in harness events so errors, completion, and run-output results are handled consistently. `invoke()` also accepts an abort signal for host-side cancellation: `agent.invoke(input, { sandboxId, signal })`.
|
|
161
200
|
|
|
162
201
|
## Reusing Sandboxes
|
|
163
202
|
|
|
@@ -174,6 +213,8 @@ const result = await agent.run({ topic: 'hello' }, { sandboxId: savedSandboxId }
|
|
|
174
213
|
|
|
175
214
|
Neckbeard rehydrates the sandbox endpoint and provider traffic token from the sandbox ID using the configured provider SDK. E2B traffic tokens are sent as the `e2b-traffic-access-token` header. Daytona preview tokens are sent as the `DAYTONA_SANDBOX_AUTH_KEY` query parameter. Consumers only need to store the sandbox ID and configure the same provider/API key in the process that reconnects.
|
|
176
215
|
|
|
216
|
+
`deploy()` caches the sandbox on the agent instance and returns the cached ID on later calls. Use `deploy({ fresh: true })` to provision a new sandbox without touching the instance cache, which is useful when one agent instance serves concurrent runs that each need their own sandbox. The caller owns the returned sandbox ID: pass it to `run()`/`invoke()` and `kill()` it explicitly.
|
|
217
|
+
|
|
177
218
|
### Environment Changes with Reused Sandboxes
|
|
178
219
|
|
|
179
220
|
`envs` are applied when Neckbeard creates the sandbox and starts the sandbox server. If the host app was missing a required value such as `ANTHROPIC_API_KEY` when the sandbox was created, the sandbox can remain healthy but unauthenticated even after you fix the host environment and redeploy the app.
|
|
@@ -182,26 +223,30 @@ Updating Vercel, Render, or 1Password environment variables does not mutate alre
|
|
|
182
223
|
|
|
183
224
|
## Direct Sandbox Access
|
|
184
225
|
|
|
185
|
-
Use `SandboxClient` when host code needs provider-neutral filesystem or command access without running an agent invocation:
|
|
226
|
+
Use `SandboxClient` when host code needs provider-neutral filesystem or command access without running an agent invocation, such as staging documents into a sandbox before an agent runs or pulling artifacts out afterward:
|
|
186
227
|
|
|
187
228
|
```typescript
|
|
188
229
|
import { SandboxClient } from 'agent-neckbeard';
|
|
189
230
|
|
|
190
|
-
const sandbox = await SandboxClient.
|
|
191
|
-
provider: '
|
|
192
|
-
|
|
193
|
-
|
|
231
|
+
const sandbox = await SandboxClient.create({
|
|
232
|
+
provider: 'daytona',
|
|
233
|
+
template: 'daytona-small',
|
|
234
|
+
domainAllowList: '*.example.com',
|
|
235
|
+
autoDeleteInterval: 30,
|
|
194
236
|
});
|
|
195
237
|
|
|
196
|
-
|
|
197
|
-
await sandbox.
|
|
238
|
+
const documentsDir = `${sandbox.paths.homeDir}/documents`;
|
|
239
|
+
await sandbox.makeDir(documentsDir);
|
|
240
|
+
await sandbox.writeFile(`${documentsDir}/input.txt`, 'hello');
|
|
198
241
|
const result = await sandbox.runCommand('ls documents', {
|
|
199
|
-
cwd:
|
|
242
|
+
cwd: sandbox.paths.homeDir,
|
|
200
243
|
timeoutMs: 60_000,
|
|
201
244
|
});
|
|
245
|
+
const bytes = await sandbox.readFileBytes(`${documentsDir}/input.txt`);
|
|
246
|
+
await sandbox.kill();
|
|
202
247
|
```
|
|
203
248
|
|
|
204
|
-
`SandboxClient.create()`
|
|
249
|
+
Reconnect to an existing sandbox with `SandboxClient.connect({ provider, sandboxId })`. `create()` accepts provider-specific lifetime options: `timeoutMs` on E2B and `autoDeleteInterval` in minutes on Daytona (`-1`, the default, disables auto-delete). `sandbox.paths` exposes the same provider-neutral paths agents receive as `ctx.sandbox`. E2B supports `setTimeout()` for sandbox lifetime extension; providers without that lifecycle primitive throw a `ConfigurationError`.
|
|
205
250
|
|
|
206
251
|
## Configuration
|
|
207
252
|
|
|
@@ -210,6 +255,10 @@ new Agent({
|
|
|
210
255
|
sandbox: {
|
|
211
256
|
provider: 'e2b' | 'daytona',
|
|
212
257
|
template: string,
|
|
258
|
+
// Daytona only:
|
|
259
|
+
networkBlockAll?: boolean,
|
|
260
|
+
networkAllowList?: string,
|
|
261
|
+
domainAllowList?: string,
|
|
213
262
|
},
|
|
214
263
|
inputSchema: ZodSchema,
|
|
215
264
|
maxDuration?: number,
|
|
@@ -220,6 +269,10 @@ new Agent({
|
|
|
220
269
|
files?: [{ url, path }],
|
|
221
270
|
claudeDir?: string,
|
|
222
271
|
envs?: Record<string, string | undefined>,
|
|
272
|
+
build?: {
|
|
273
|
+
external?: string[],
|
|
274
|
+
autoDetectExternal?: boolean,
|
|
275
|
+
},
|
|
223
276
|
// Run-output agents require:
|
|
224
277
|
outputSchema: ZodSchema,
|
|
225
278
|
run: (input, ctx) => Promise<output>,
|
|
@@ -232,7 +285,7 @@ new Agent({
|
|
|
232
285
|
});
|
|
233
286
|
```
|
|
234
287
|
|
|
235
|
-
The `files` option downloads files into the sandbox before the server starts. Relative paths resolve from the sandbox home directory: `/home/user` on E2B and `/home/daytona` on
|
|
288
|
+
The `files` option downloads files into the sandbox before the server starts. Relative paths resolve from the sandbox home directory: `/home/user` on E2B and the sandbox user's home on Daytona (`/home/daytona` on default snapshots).
|
|
236
289
|
|
|
237
290
|
The `claudeDir` option uploads a local `.claude/` directory to the sandbox, enabling Claude Agent SDK skills. Point it at a directory containing `.claude/skills/*/SKILL.md` files.
|
|
238
291
|
|
|
@@ -252,21 +305,17 @@ const agent = new Agent({
|
|
|
252
305
|
});
|
|
253
306
|
```
|
|
254
307
|
|
|
255
|
-
Some packages cannot be bundled because they spawn child processes or have native modules. The Claude Agent SDK is like this. These packages are automatically marked external and installed with npm in the sandbox.
|
|
308
|
+
Some packages cannot be bundled because they spawn child processes or have native modules. The Claude Agent SDK is like this. These packages are automatically marked external and installed with npm in the sandbox. The `build` option tunes this: `build.external` adds package globs to mark external, and `build.autoDetectExternal: false` disables the native-module auto-detection.
|
|
256
309
|
|
|
257
310
|
## Cleanup
|
|
258
311
|
|
|
259
|
-
|
|
260
|
-
const sandboxId = await agent.deploy();
|
|
312
|
+
Neckbeard never kills a sandbox on its own; sandboxes run until you kill them or the provider's lifetime settings expire them. Kill every sandbox you deploy, as in the workflow example above. `kill()` accepts a sandbox ID. If omitted, it kills the sandbox cached on the agent instance.
|
|
261
313
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
await agent.kill(sandboxId);
|
|
266
|
-
}
|
|
267
|
-
```
|
|
314
|
+
## Errors
|
|
315
|
+
|
|
316
|
+
All errors extend `NeckbeardError`. `ConfigurationError` covers invalid agent config, missing provider API keys, and provider features a sandbox does not support. `DeploymentError` covers sandbox creation, dependency install, and runtime server startup failures, and includes captured server logs when the health check fails. `ValidationError` wraps input/output schema failures with the parser error as `cause`. `ExecutionError` represents agent handler failures.
|
|
268
317
|
|
|
269
|
-
`
|
|
318
|
+
`run()` never throws; it returns `{ ok: false, error }`. `invoke()` throws.
|
|
270
319
|
|
|
271
320
|
## Testing
|
|
272
321
|
|
package/dist/index.cjs
CHANGED
|
@@ -327,35 +327,6 @@ function withNeckbeardNextConfig(nextConfig, options) {
|
|
|
327
327
|
sourceFiles,
|
|
328
328
|
traceSourceDependencies
|
|
329
329
|
);
|
|
330
|
-
const experimental = asRecord(nextConfig.experimental);
|
|
331
|
-
const useLegacyExperimental = options.legacyExperimental ?? ("serverComponentsExternalPackages" in experimental || "outputFileTracingIncludes" in experimental || "outputFileTracingRoot" in experimental);
|
|
332
|
-
if (useLegacyExperimental) {
|
|
333
|
-
const nextExperimental = {
|
|
334
|
-
...experimental,
|
|
335
|
-
serverComponentsExternalPackages: mergeStringArray(
|
|
336
|
-
experimental.serverComponentsExternalPackages,
|
|
337
|
-
[NECKBEARD_PACKAGE_NAME]
|
|
338
|
-
),
|
|
339
|
-
outputFileTracingIncludes: mergeTracingIncludes(
|
|
340
|
-
experimental.outputFileTracingIncludes,
|
|
341
|
-
routeGlobs,
|
|
342
|
-
traceIncludeFiles
|
|
343
|
-
)
|
|
344
|
-
};
|
|
345
|
-
if (options.outputFileTracingRoot !== void 0) {
|
|
346
|
-
nextExperimental.outputFileTracingRoot = options.outputFileTracingRoot;
|
|
347
|
-
}
|
|
348
|
-
return {
|
|
349
|
-
...nextConfig,
|
|
350
|
-
experimental: nextExperimental,
|
|
351
|
-
webpack: withNextTraceIncludeWebpack(
|
|
352
|
-
nextConfig.webpack,
|
|
353
|
-
sourceFiles,
|
|
354
|
-
routeGlobs,
|
|
355
|
-
traceSourceDependencies
|
|
356
|
-
)
|
|
357
|
-
};
|
|
358
|
-
}
|
|
359
330
|
const result = {
|
|
360
331
|
...nextConfig,
|
|
361
332
|
serverExternalPackages: mergeStringArray(nextConfig.serverExternalPackages, [
|
|
@@ -1151,8 +1122,8 @@ var E2bSandboxHandle = class {
|
|
|
1151
1122
|
trafficToken: this.sandbox.trafficAccessToken
|
|
1152
1123
|
};
|
|
1153
1124
|
}
|
|
1154
|
-
destroy() {
|
|
1155
|
-
|
|
1125
|
+
async destroy() {
|
|
1126
|
+
await this.sandbox.kill();
|
|
1156
1127
|
}
|
|
1157
1128
|
};
|
|
1158
1129
|
var DaytonaSandboxHandle = class _DaytonaSandboxHandle {
|
|
@@ -1253,6 +1224,9 @@ async function createProviderSandboxHandle(options) {
|
|
|
1253
1224
|
const sandbox2 = await daytona.create(
|
|
1254
1225
|
{
|
|
1255
1226
|
...options.template ? { snapshot: options.template } : {},
|
|
1227
|
+
...options.networkBlockAll === void 0 ? {} : { networkBlockAll: options.networkBlockAll },
|
|
1228
|
+
...options.networkAllowList === void 0 ? {} : { networkAllowList: options.networkAllowList },
|
|
1229
|
+
...options.domainAllowList === void 0 ? {} : { domainAllowList: options.domainAllowList },
|
|
1256
1230
|
envVars: filterDefinedEnvs(options.envs ?? {}),
|
|
1257
1231
|
autoDeleteInterval: options.autoDeleteInterval ?? -1
|
|
1258
1232
|
},
|
|
@@ -1498,10 +1472,14 @@ var Agent = class {
|
|
|
1498
1472
|
allowPublicTraffic: false
|
|
1499
1473
|
});
|
|
1500
1474
|
}
|
|
1475
|
+
const sandbox = this.sandbox;
|
|
1501
1476
|
return createProviderSandboxHandle({
|
|
1502
1477
|
provider: "daytona",
|
|
1503
1478
|
template: this.template,
|
|
1504
|
-
envs: this.sandboxEnv
|
|
1479
|
+
envs: this.sandboxEnv,
|
|
1480
|
+
networkBlockAll: sandbox.networkBlockAll,
|
|
1481
|
+
networkAllowList: sandbox.networkAllowList,
|
|
1482
|
+
domainAllowList: sandbox.domainAllowList
|
|
1505
1483
|
});
|
|
1506
1484
|
}
|
|
1507
1485
|
async connectSandboxHandle(sandboxId) {
|
package/dist/index.d.cts
CHANGED
|
@@ -114,13 +114,6 @@ interface NeckbeardNextConfigOptions {
|
|
|
114
114
|
* live outside the app directory.
|
|
115
115
|
*/
|
|
116
116
|
outputFileTracingRoot?: string;
|
|
117
|
-
/**
|
|
118
|
-
* Force the older Next.js experimental config placement used by Next 13.
|
|
119
|
-
*
|
|
120
|
-
* By default this is inferred when the provided config already uses
|
|
121
|
-
* `experimental.serverComponentsExternalPackages` or experimental tracing.
|
|
122
|
-
*/
|
|
123
|
-
legacyExperimental?: boolean;
|
|
124
117
|
}
|
|
125
118
|
interface ResolveAgentSourceFileOptions {
|
|
126
119
|
/** Custom error prefix when no source file candidate exists outside the sandbox runtime. */
|
|
@@ -134,7 +127,6 @@ interface ResolveAgentSourceFileOptions {
|
|
|
134
127
|
}
|
|
135
128
|
declare function resolveAgentSourceFile(candidates: string[], options?: ResolveAgentSourceFileOptions): string;
|
|
136
129
|
type NextConfigObject = {
|
|
137
|
-
experimental?: Record<string, unknown>;
|
|
138
130
|
outputFileTracingIncludes?: Record<string, unknown>;
|
|
139
131
|
outputFileTracingRoot?: string;
|
|
140
132
|
serverExternalPackages?: string[];
|
|
@@ -182,7 +174,7 @@ interface AgentSharedConfig<TInput> {
|
|
|
182
174
|
* Next.js route handler running from `.next/server/chunks/*.js`.
|
|
183
175
|
*/
|
|
184
176
|
sourceFile?: string;
|
|
185
|
-
/** OS-level dependencies to install in the sandbox. Defaults to
|
|
177
|
+
/** OS-level dependencies to install in the sandbox. Defaults to none. */
|
|
186
178
|
dependencies?: OsDependencies;
|
|
187
179
|
/**
|
|
188
180
|
* Files to download and initialize in the sandbox filesystem.
|
|
@@ -280,6 +272,25 @@ interface DaytonaSandboxConfig {
|
|
|
280
272
|
* This is the Daytona equivalent of choosing a base sandbox environment.
|
|
281
273
|
*/
|
|
282
274
|
template: string;
|
|
275
|
+
/**
|
|
276
|
+
* Whether Daytona should block all sandbox network access by default.
|
|
277
|
+
*
|
|
278
|
+
* Daytona does not allow this to be combined with non-empty allow lists.
|
|
279
|
+
*/
|
|
280
|
+
networkBlockAll?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Comma-separated CIDR network allow list for Daytona sandbox egress.
|
|
283
|
+
*
|
|
284
|
+
* Example: '203.0.113.0/24,198.51.100.10/32'
|
|
285
|
+
*/
|
|
286
|
+
networkAllowList?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Comma-separated DNS domain allow list for Daytona sandbox egress.
|
|
289
|
+
*
|
|
290
|
+
* Wildcards are supported with a leading `*.`.
|
|
291
|
+
* Example: '*.example.com,api.openai.com'
|
|
292
|
+
*/
|
|
293
|
+
domainAllowList?: string;
|
|
283
294
|
}
|
|
284
295
|
type SandboxConfig = E2BSandboxConfig | DaytonaSandboxConfig;
|
|
285
296
|
/**
|
|
@@ -320,6 +331,9 @@ type SandboxClientCreateOptions = {
|
|
|
320
331
|
envs?: Record<string, string | undefined>;
|
|
321
332
|
createTimeoutSec?: number;
|
|
322
333
|
autoDeleteInterval?: number;
|
|
334
|
+
networkBlockAll?: boolean;
|
|
335
|
+
networkAllowList?: string;
|
|
336
|
+
domainAllowList?: string;
|
|
323
337
|
};
|
|
324
338
|
type SandboxClientConnectOptions = {
|
|
325
339
|
provider: 'e2b';
|
package/dist/index.d.ts
CHANGED
|
@@ -114,13 +114,6 @@ interface NeckbeardNextConfigOptions {
|
|
|
114
114
|
* live outside the app directory.
|
|
115
115
|
*/
|
|
116
116
|
outputFileTracingRoot?: string;
|
|
117
|
-
/**
|
|
118
|
-
* Force the older Next.js experimental config placement used by Next 13.
|
|
119
|
-
*
|
|
120
|
-
* By default this is inferred when the provided config already uses
|
|
121
|
-
* `experimental.serverComponentsExternalPackages` or experimental tracing.
|
|
122
|
-
*/
|
|
123
|
-
legacyExperimental?: boolean;
|
|
124
117
|
}
|
|
125
118
|
interface ResolveAgentSourceFileOptions {
|
|
126
119
|
/** Custom error prefix when no source file candidate exists outside the sandbox runtime. */
|
|
@@ -134,7 +127,6 @@ interface ResolveAgentSourceFileOptions {
|
|
|
134
127
|
}
|
|
135
128
|
declare function resolveAgentSourceFile(candidates: string[], options?: ResolveAgentSourceFileOptions): string;
|
|
136
129
|
type NextConfigObject = {
|
|
137
|
-
experimental?: Record<string, unknown>;
|
|
138
130
|
outputFileTracingIncludes?: Record<string, unknown>;
|
|
139
131
|
outputFileTracingRoot?: string;
|
|
140
132
|
serverExternalPackages?: string[];
|
|
@@ -182,7 +174,7 @@ interface AgentSharedConfig<TInput> {
|
|
|
182
174
|
* Next.js route handler running from `.next/server/chunks/*.js`.
|
|
183
175
|
*/
|
|
184
176
|
sourceFile?: string;
|
|
185
|
-
/** OS-level dependencies to install in the sandbox. Defaults to
|
|
177
|
+
/** OS-level dependencies to install in the sandbox. Defaults to none. */
|
|
186
178
|
dependencies?: OsDependencies;
|
|
187
179
|
/**
|
|
188
180
|
* Files to download and initialize in the sandbox filesystem.
|
|
@@ -280,6 +272,25 @@ interface DaytonaSandboxConfig {
|
|
|
280
272
|
* This is the Daytona equivalent of choosing a base sandbox environment.
|
|
281
273
|
*/
|
|
282
274
|
template: string;
|
|
275
|
+
/**
|
|
276
|
+
* Whether Daytona should block all sandbox network access by default.
|
|
277
|
+
*
|
|
278
|
+
* Daytona does not allow this to be combined with non-empty allow lists.
|
|
279
|
+
*/
|
|
280
|
+
networkBlockAll?: boolean;
|
|
281
|
+
/**
|
|
282
|
+
* Comma-separated CIDR network allow list for Daytona sandbox egress.
|
|
283
|
+
*
|
|
284
|
+
* Example: '203.0.113.0/24,198.51.100.10/32'
|
|
285
|
+
*/
|
|
286
|
+
networkAllowList?: string;
|
|
287
|
+
/**
|
|
288
|
+
* Comma-separated DNS domain allow list for Daytona sandbox egress.
|
|
289
|
+
*
|
|
290
|
+
* Wildcards are supported with a leading `*.`.
|
|
291
|
+
* Example: '*.example.com,api.openai.com'
|
|
292
|
+
*/
|
|
293
|
+
domainAllowList?: string;
|
|
283
294
|
}
|
|
284
295
|
type SandboxConfig = E2BSandboxConfig | DaytonaSandboxConfig;
|
|
285
296
|
/**
|
|
@@ -320,6 +331,9 @@ type SandboxClientCreateOptions = {
|
|
|
320
331
|
envs?: Record<string, string | undefined>;
|
|
321
332
|
createTimeoutSec?: number;
|
|
322
333
|
autoDeleteInterval?: number;
|
|
334
|
+
networkBlockAll?: boolean;
|
|
335
|
+
networkAllowList?: string;
|
|
336
|
+
domainAllowList?: string;
|
|
323
337
|
};
|
|
324
338
|
type SandboxClientConnectOptions = {
|
|
325
339
|
provider: 'e2b';
|
package/dist/index.js
CHANGED
|
@@ -93,35 +93,6 @@ function withNeckbeardNextConfig(nextConfig, options) {
|
|
|
93
93
|
sourceFiles,
|
|
94
94
|
traceSourceDependencies
|
|
95
95
|
);
|
|
96
|
-
const experimental = asRecord(nextConfig.experimental);
|
|
97
|
-
const useLegacyExperimental = options.legacyExperimental ?? ("serverComponentsExternalPackages" in experimental || "outputFileTracingIncludes" in experimental || "outputFileTracingRoot" in experimental);
|
|
98
|
-
if (useLegacyExperimental) {
|
|
99
|
-
const nextExperimental = {
|
|
100
|
-
...experimental,
|
|
101
|
-
serverComponentsExternalPackages: mergeStringArray(
|
|
102
|
-
experimental.serverComponentsExternalPackages,
|
|
103
|
-
[NECKBEARD_PACKAGE_NAME]
|
|
104
|
-
),
|
|
105
|
-
outputFileTracingIncludes: mergeTracingIncludes(
|
|
106
|
-
experimental.outputFileTracingIncludes,
|
|
107
|
-
routeGlobs,
|
|
108
|
-
traceIncludeFiles
|
|
109
|
-
)
|
|
110
|
-
};
|
|
111
|
-
if (options.outputFileTracingRoot !== void 0) {
|
|
112
|
-
nextExperimental.outputFileTracingRoot = options.outputFileTracingRoot;
|
|
113
|
-
}
|
|
114
|
-
return {
|
|
115
|
-
...nextConfig,
|
|
116
|
-
experimental: nextExperimental,
|
|
117
|
-
webpack: withNextTraceIncludeWebpack(
|
|
118
|
-
nextConfig.webpack,
|
|
119
|
-
sourceFiles,
|
|
120
|
-
routeGlobs,
|
|
121
|
-
traceSourceDependencies
|
|
122
|
-
)
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
96
|
const result = {
|
|
126
97
|
...nextConfig,
|
|
127
98
|
serverExternalPackages: mergeStringArray(nextConfig.serverExternalPackages, [
|
|
@@ -917,8 +888,8 @@ var E2bSandboxHandle = class {
|
|
|
917
888
|
trafficToken: this.sandbox.trafficAccessToken
|
|
918
889
|
};
|
|
919
890
|
}
|
|
920
|
-
destroy() {
|
|
921
|
-
|
|
891
|
+
async destroy() {
|
|
892
|
+
await this.sandbox.kill();
|
|
922
893
|
}
|
|
923
894
|
};
|
|
924
895
|
var DaytonaSandboxHandle = class _DaytonaSandboxHandle {
|
|
@@ -1019,6 +990,9 @@ async function createProviderSandboxHandle(options) {
|
|
|
1019
990
|
const sandbox2 = await daytona.create(
|
|
1020
991
|
{
|
|
1021
992
|
...options.template ? { snapshot: options.template } : {},
|
|
993
|
+
...options.networkBlockAll === void 0 ? {} : { networkBlockAll: options.networkBlockAll },
|
|
994
|
+
...options.networkAllowList === void 0 ? {} : { networkAllowList: options.networkAllowList },
|
|
995
|
+
...options.domainAllowList === void 0 ? {} : { domainAllowList: options.domainAllowList },
|
|
1022
996
|
envVars: filterDefinedEnvs(options.envs ?? {}),
|
|
1023
997
|
autoDeleteInterval: options.autoDeleteInterval ?? -1
|
|
1024
998
|
},
|
|
@@ -1264,10 +1238,14 @@ var Agent = class {
|
|
|
1264
1238
|
allowPublicTraffic: false
|
|
1265
1239
|
});
|
|
1266
1240
|
}
|
|
1241
|
+
const sandbox = this.sandbox;
|
|
1267
1242
|
return createProviderSandboxHandle({
|
|
1268
1243
|
provider: "daytona",
|
|
1269
1244
|
template: this.template,
|
|
1270
|
-
envs: this.sandboxEnv
|
|
1245
|
+
envs: this.sandboxEnv,
|
|
1246
|
+
networkBlockAll: sandbox.networkBlockAll,
|
|
1247
|
+
networkAllowList: sandbox.networkAllowList,
|
|
1248
|
+
domainAllowList: sandbox.domainAllowList
|
|
1271
1249
|
});
|
|
1272
1250
|
}
|
|
1273
1251
|
async connectSandboxHandle(sandboxId) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-neckbeard",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.17",
|
|
4
4
|
"description": "Deploy AI agents to E2B and Daytona sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"prepare": "npm run build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@daytona/sdk": "^0.
|
|
48
|
+
"@daytona/sdk": "^0.192.0",
|
|
49
49
|
"e2b": "^2.2.0",
|
|
50
50
|
"esbuild": "^0.24.0"
|
|
51
51
|
},
|