agent-neckbeard 1.1.27 → 1.1.29
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/CHANGELOG.md +16 -0
- package/README.md +53 -461
- package/dist/build.cjs +5715 -0
- package/dist/build.d.cts +80 -0
- package/dist/build.d.ts +80 -0
- package/dist/build.js +17 -0
- package/dist/chunk-BPXEIXPM.js +4363 -0
- package/dist/chunk-FSBTLBB5.js +346 -0
- package/dist/chunk-KG6SJM74.js +97 -0
- package/dist/chunk-YFG4EKZM.js +508 -0
- package/dist/cli.cjs +5761 -0
- package/dist/cli.d.cts +1 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +75 -0
- package/dist/index.cjs +1599 -146
- package/dist/index.d.cts +321 -6
- package/dist/index.d.ts +321 -6
- package/dist/index.js +36 -3397
- package/dist/{invoke-client-YKWOTQWG.js → invoke-client-P2CPBYTF.js} +2 -41
- package/dist/serve-Du2NCz9_.d.cts +111 -0
- package/dist/serve-Du2NCz9_.d.ts +111 -0
- package/dist/serve.cjs +467 -0
- package/dist/serve.d.cts +1 -0
- package/dist/serve.d.ts +1 -0
- package/dist/serve.js +8 -0
- package/docs/AGENT.md +205 -0
- package/docs/DAYTONA.md +56 -0
- package/docs/DOCKER.md +7 -7
- package/docs/E2B.md +11 -0
- package/docs/LEGACY.md +335 -0
- package/docs/MODAL.md +14 -12
- package/docs/SUPERVISOR.md +2 -2
- package/package.json +43 -3
- package/dist/chunk-6GCQOKYI.js +0 -48
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Buffer } from 'node:buffer';
|
|
2
2
|
import { S as SandboxFileContent$1, a as SandboxCommandOptions, b as SandboxCommandResult, c as SandboxDetachedCommandOptions, d as SandboxDetachedCommand } from './sandbox-capabilities-CFjnZ_kB.cjs';
|
|
3
|
+
import { S as StartTurnRequest, T as TurnRecord, a as SteerTurnRequest, b as TurnHealth, c as ServedSession, d as ServeHandle } from './serve-Du2NCz9_.cjs';
|
|
4
|
+
export { P as PiTurnResult, e as TURN_PROTOCOL_VERSION, f as TurnOutcome, g as getPiTurnResult } from './serve-Du2NCz9_.cjs';
|
|
3
5
|
|
|
4
6
|
/** Sandbox providers supported by the public and in-sandbox runtimes. */
|
|
5
7
|
type SandboxProvider = 'e2b' | 'daytona' | 'modal' | 'docker';
|
|
@@ -89,12 +91,294 @@ interface ModalClientCredentials {
|
|
|
89
91
|
}
|
|
90
92
|
type ModalSandboxCreateOptions = ModalSandboxConfig & ModalClientCredentials & {
|
|
91
93
|
envs?: Record<string, string | undefined>;
|
|
94
|
+
/**
|
|
95
|
+
* Runs as the sandbox's main process, with `template` used as-is: no setup layer and no
|
|
96
|
+
* working directory override. For images that already contain everything, as `Agent` uses.
|
|
97
|
+
*/
|
|
98
|
+
command?: string[];
|
|
99
|
+
/** Name of a Modal Secret with `REGISTRY_USERNAME` and `REGISTRY_PASSWORD`, to pull a private `template`. */
|
|
100
|
+
registrySecret?: string;
|
|
92
101
|
};
|
|
93
102
|
type ModalSandboxConnectOptions = ModalClientCredentials & {
|
|
94
103
|
provider: 'modal';
|
|
95
104
|
sandboxId: string;
|
|
96
105
|
};
|
|
97
106
|
|
|
107
|
+
type DaytonaCreateOptions = Extract<SandboxClientCreateOptions, {
|
|
108
|
+
provider: 'daytona';
|
|
109
|
+
}>;
|
|
110
|
+
type E2bCreateOptions = Extract<SandboxClientCreateOptions, {
|
|
111
|
+
provider: 'e2b';
|
|
112
|
+
}>;
|
|
113
|
+
/** The Modal sandbox options `Agent` passes through; the image is its `template`. */
|
|
114
|
+
interface ModalAgentSandbox extends Pick<ModalSandboxCreateOptions, 'provider' | 'appName' | 'environment' | 'timeoutMs' | 'cpu' | 'memoryMiB' | 'regions' | 'networkBlockAll' | 'networkAllowList' | 'domainAllowList' | 'registrySecret'> {
|
|
115
|
+
}
|
|
116
|
+
interface DaytonaAgentSandbox extends Pick<DaytonaSandboxConfig, 'provider' | 'networkBlockAll' | 'networkAllowList' | 'domainAllowList' | 'autoStopInterval' | 'autoDeleteInterval'>, Pick<DaytonaCreateOptions, 'apiKey'> {
|
|
117
|
+
/** Snapshot resources: vCPUs, and memory and disk in GiB. */
|
|
118
|
+
resources?: {
|
|
119
|
+
cpu?: number;
|
|
120
|
+
memory?: number;
|
|
121
|
+
disk?: number;
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
interface E2bAgentSandbox extends Pick<E2bCreateOptions, 'provider' | 'apiKey' | 'timeoutMs'> {
|
|
125
|
+
/** Template resources. */
|
|
126
|
+
cpuCount?: number;
|
|
127
|
+
memoryMB?: number;
|
|
128
|
+
/** Credentials E2B uses to pull a private image when it builds the template. */
|
|
129
|
+
registry?: {
|
|
130
|
+
username: string;
|
|
131
|
+
password: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
type AgentSandbox = ModalAgentSandbox | DaytonaAgentSandbox | E2bAgentSandbox;
|
|
135
|
+
interface AgentOptions {
|
|
136
|
+
/** Names this agent's Daytona snapshots and E2B templates; lowercase letters, digits, and dashes. */
|
|
137
|
+
name: string;
|
|
138
|
+
/** Registry image with the agent and `serve()`, such as `ghcr.io/acme/agent:<commit>`. */
|
|
139
|
+
image: string;
|
|
140
|
+
sandbox: AgentSandbox;
|
|
141
|
+
/** Starts the runtime in the image. Defaults to `node /app/agent.mjs`. */
|
|
142
|
+
command?: string[];
|
|
143
|
+
/** Port `serve()` listens on, passed to it as `NECKBEARD_PORT`. Defaults to 8080. */
|
|
144
|
+
port?: number;
|
|
145
|
+
/** Environment of every sandbox. Secrets go here or in `start()`, never in the image. */
|
|
146
|
+
envs?: Record<string, string | undefined>;
|
|
147
|
+
/** How long `start()` waits for the runtime to answer. Defaults to two minutes. */
|
|
148
|
+
startTimeoutMs?: number;
|
|
149
|
+
/** How long `prepare()` waits for a Daytona snapshot or E2B template build. Defaults to 30 minutes. */
|
|
150
|
+
prepareTimeoutMs?: number;
|
|
151
|
+
}
|
|
152
|
+
interface StartOptions {
|
|
153
|
+
envs?: Record<string, string | undefined>;
|
|
154
|
+
/** Names the conversation a persisted Pi session keeps, given to the runtime as `NECKBEARD_SESSION_ID`. */
|
|
155
|
+
sessionId?: string;
|
|
156
|
+
signal?: AbortSignal;
|
|
157
|
+
}
|
|
158
|
+
interface RunOptions<TEvent> extends Omit<TurnStreamOptions, 'after'> {
|
|
159
|
+
/** Receives each record as it streams, for example to store or show it, keyed by `seq`. */
|
|
160
|
+
onRecord?: (record: TurnRecord<TEvent>) => void | Promise<void>;
|
|
161
|
+
}
|
|
162
|
+
interface TurnStreamOptions {
|
|
163
|
+
/** Stops reading the stream; the turn keeps running. Use `abort()` to stop the turn. */
|
|
164
|
+
signal?: AbortSignal;
|
|
165
|
+
/** Resume after this record's `seq`. Defaults to -1, the start of the turn. */
|
|
166
|
+
after?: number;
|
|
167
|
+
/**
|
|
168
|
+
* How long to keep reconnecting without a healthy connection. Defaults to two minutes. A
|
|
169
|
+
* connection that sends nothing, not even the runtime's heartbeat every 15 seconds, for this long
|
|
170
|
+
* is abandoned, so keep it above 15 seconds.
|
|
171
|
+
*/
|
|
172
|
+
reconnectTimeoutMs?: number;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Runs a Pi agent from a prebuilt image whose main process is `serve()` from
|
|
176
|
+
* `agent-neckbeard/serve`. Every method takes the sandbox ID, so any host process can drive a
|
|
177
|
+
* sandbox another one started.
|
|
178
|
+
*/
|
|
179
|
+
declare class Agent<TEvent = unknown> {
|
|
180
|
+
private readonly options;
|
|
181
|
+
readonly name: string;
|
|
182
|
+
readonly image: string;
|
|
183
|
+
readonly command: string[];
|
|
184
|
+
readonly port: number;
|
|
185
|
+
private readonly endpoints;
|
|
186
|
+
private preparing?;
|
|
187
|
+
constructor(options: AgentOptions);
|
|
188
|
+
get provider(): AgentSandbox['provider'];
|
|
189
|
+
/**
|
|
190
|
+
* Name of the Daytona snapshot or E2B template for this image, command, and resources. Equal
|
|
191
|
+
* inputs share one, so preparing again is a lookup.
|
|
192
|
+
*/
|
|
193
|
+
get artifactName(): string;
|
|
194
|
+
/**
|
|
195
|
+
* Creates the Daytona snapshot or E2B template for the image if it is missing and waits until
|
|
196
|
+
* it can start sandboxes. Run it from CI after pushing the image so no sandbox waits on a
|
|
197
|
+
* build. Modal pulls the image directly, so this does nothing there. `refresh` builds it again
|
|
198
|
+
* even when it exists, as after pushing new contents under a tag it was built from, since its
|
|
199
|
+
* name comes from the image's reference, not its contents.
|
|
200
|
+
*/
|
|
201
|
+
prepare(options?: {
|
|
202
|
+
signal?: AbortSignal;
|
|
203
|
+
onLog?: (line: string) => void;
|
|
204
|
+
refresh?: boolean;
|
|
205
|
+
}): Promise<void>;
|
|
206
|
+
/** Starts a sandbox from the image and waits for its runtime. Returns the sandbox ID. */
|
|
207
|
+
start(options?: StartOptions): Promise<string>;
|
|
208
|
+
/**
|
|
209
|
+
* Starts a turn and streams its records until its `end` record. Starting a turn whose
|
|
210
|
+
* `turnId` the runtime already has resumes it instead of running it again.
|
|
211
|
+
*/
|
|
212
|
+
prompt(sandboxId: string, turn: StartTurnRequest, options?: TurnStreamOptions): AsyncGenerator<TurnRecord<TEvent>>;
|
|
213
|
+
/**
|
|
214
|
+
* Runs a Pi turn to its end and returns its final assistant text, or null when it had none.
|
|
215
|
+
* Throws `ExecutionError` when the turn did not complete or its model did not stop on its own.
|
|
216
|
+
* Running a turn again with the same `turnId` replays its records from the start.
|
|
217
|
+
*/
|
|
218
|
+
run(sandboxId: string, turn: StartTurnRequest, options?: RunOptions<TEvent>): Promise<string | null>;
|
|
219
|
+
/**
|
|
220
|
+
* Streams a turn's records after `options.after` until its `end` record, reconnecting when
|
|
221
|
+
* the connection drops. Throws `TurnLostError` when the runtime no longer has the turn.
|
|
222
|
+
*/
|
|
223
|
+
events(sandboxId: string, turnId: string, options?: TurnStreamOptions): AsyncGenerator<TurnRecord<TEvent>>;
|
|
224
|
+
/** Asks the runtime to stop the turn; its stream then ends with an `aborted` record. */
|
|
225
|
+
abort(sandboxId: string, turnId: string, signal?: AbortSignal): Promise<void>;
|
|
226
|
+
/**
|
|
227
|
+
* Queues a message for a running turn, which Pi takes after its current tool calls. Resolves to
|
|
228
|
+
* true once the session has queued it: it is then delivered into the turn, or named in the end
|
|
229
|
+
* record's `undeliveredSteerIds`. Resolves to false when the turn can no longer take it, or the
|
|
230
|
+
* runtime no longer has it, so the caller can send the message as a turn of its own. Throws when
|
|
231
|
+
* queueing failed or the request did; calling again with the same `steerId` never queues it twice.
|
|
232
|
+
*/
|
|
233
|
+
steer(sandboxId: string, turnId: string, steer: SteerTurnRequest, signal?: AbortSignal): Promise<boolean>;
|
|
234
|
+
health(sandboxId: string, signal?: AbortSignal): Promise<TurnHealth>;
|
|
235
|
+
/** Waits until no turn runs, for example before reading files a turn writes. */
|
|
236
|
+
waitForIdle(sandboxId: string, options?: {
|
|
237
|
+
timeoutMs?: number;
|
|
238
|
+
signal?: AbortSignal;
|
|
239
|
+
}): Promise<void>;
|
|
240
|
+
/**
|
|
241
|
+
* Deletes the sandbox without starting it. One that is already gone counts as deleted; any other
|
|
242
|
+
* failure throws, so cleanup can be retried, since a Daytona sandbox need not expire on its own.
|
|
243
|
+
*/
|
|
244
|
+
kill(sandboxId: string): Promise<void>;
|
|
245
|
+
/** File and command access to a sandbox, for staging inputs and reading results. */
|
|
246
|
+
sandbox(sandboxId: string): Promise<SandboxClient>;
|
|
247
|
+
/**
|
|
248
|
+
* Deletes this agent's Daytona snapshots or E2B templates except the newest `keep` and the
|
|
249
|
+
* current one. Returns the names it deleted.
|
|
250
|
+
*/
|
|
251
|
+
gc(options?: {
|
|
252
|
+
keep?: number;
|
|
253
|
+
alsoKeep?: string[];
|
|
254
|
+
}): Promise<string[]>;
|
|
255
|
+
private createSandbox;
|
|
256
|
+
private startE2bRuntime;
|
|
257
|
+
private waitForRuntime;
|
|
258
|
+
private endpoint;
|
|
259
|
+
private request;
|
|
260
|
+
private prepareDaytonaSnapshot;
|
|
261
|
+
private prepareE2bTemplate;
|
|
262
|
+
private listDaytonaSnapshots;
|
|
263
|
+
private e2bTemplates;
|
|
264
|
+
private listE2bTemplates;
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/** Where `neckbeard build` installs an agent's skills in its image. */
|
|
268
|
+
declare const SKILLS_DIR = "/app/.agents/skills";
|
|
269
|
+
/**
|
|
270
|
+
* The image tag a host should run: `NECKBEARD_IMAGE_TAG`, else the commit its platform deployed,
|
|
271
|
+
* which is the commit CI tagged the image with.
|
|
272
|
+
*/
|
|
273
|
+
declare function resolveImageTag(env?: NodeJS.ProcessEnv): string | undefined;
|
|
274
|
+
type ThinkingLevel = 'off' | 'minimal' | 'low' | 'medium' | 'high' | 'xhigh';
|
|
275
|
+
/** A Pi session for `defineAgent()` to create in the sandbox. */
|
|
276
|
+
interface PiSessionConfig {
|
|
277
|
+
/** `provider/model`, such as `openai/gpt-6.1-sol`. */
|
|
278
|
+
model: string;
|
|
279
|
+
thinkingLevel?: ThinkingLevel;
|
|
280
|
+
/** Pi's built-in tools to enable, such as `read` and `bash`. */
|
|
281
|
+
tools?: string[];
|
|
282
|
+
systemPrompt: string;
|
|
283
|
+
/**
|
|
284
|
+
* The working directory, relative to the sandbox user's home unless absolute. Created before the
|
|
285
|
+
* session, and exported to the agent's commands as `NECKBEARD_CWD`. Defaults to `workspace`.
|
|
286
|
+
*/
|
|
287
|
+
cwd?: string;
|
|
288
|
+
/**
|
|
289
|
+
* Keeps the conversation in a file named for the `sessionId` passed to `start()`, so a restarted
|
|
290
|
+
* runtime, or a sandbox restored from a copy of the file, continues it. See `sessionFilePath()`.
|
|
291
|
+
* Otherwise the conversation lives in memory for the sandbox's life.
|
|
292
|
+
*/
|
|
293
|
+
persist?: boolean;
|
|
294
|
+
}
|
|
295
|
+
/** An agent: its image, sandbox, and either a Pi session config or its own session factory. */
|
|
296
|
+
interface AgentDefinition {
|
|
297
|
+
/** Names the image and the provider's snapshots or templates; lowercase letters, digits, and dashes. */
|
|
298
|
+
name: string;
|
|
299
|
+
/** Registry the image lives under, such as `ghcr.io/acme`; the image is `<registry>/<name>:<tag>`. */
|
|
300
|
+
registry?: string;
|
|
301
|
+
/** A full image reference instead of `registry`, such as one built elsewhere. */
|
|
302
|
+
image?: string;
|
|
303
|
+
/** The sandbox, or a function returning it, read only on the host. */
|
|
304
|
+
sandbox: AgentSandbox | (() => AgentSandbox);
|
|
305
|
+
/**
|
|
306
|
+
* Environment of every sandbox, or a function returning it, read only on the host, so the image
|
|
307
|
+
* needs none of the host's configuration. Never secrets in the image. A `pi` agent is traced in
|
|
308
|
+
* Braintrust when this has BRAINTRUST_API_KEY and BRAINTRUST_PROJECT_NAME; see docs/AGENT.md#tracing.
|
|
309
|
+
*/
|
|
310
|
+
envs?: Record<string, string | undefined> | (() => Record<string, string | undefined>);
|
|
311
|
+
/** The image's main process. Defaults to `node /app/agent.mjs`, the entry point `neckbeard build` writes. */
|
|
312
|
+
command?: string[];
|
|
313
|
+
/** The port the runtime listens on, given to it as NECKBEARD_PORT. Defaults to 8080. */
|
|
314
|
+
port?: number;
|
|
315
|
+
/** How long `start()` waits for the runtime to answer. Defaults to two minutes. */
|
|
316
|
+
startTimeoutMs?: number;
|
|
317
|
+
/** How long `prepare()` may take to create a Daytona snapshot or E2B template. Defaults to 30 minutes. */
|
|
318
|
+
prepareTimeoutMs?: number;
|
|
319
|
+
/** Ends a turn that runs longer as failed. */
|
|
320
|
+
maxTurnDurationMs?: number;
|
|
321
|
+
/** See `ServeOptions.abortGraceMs`. */
|
|
322
|
+
abortGraceMs?: number;
|
|
323
|
+
/** The agent's Pi session. */
|
|
324
|
+
pi?: PiSessionConfig;
|
|
325
|
+
/** Creates the session instead of `pi`, for one that config can't express. */
|
|
326
|
+
createSession?: () => Promise<ServedSession>;
|
|
327
|
+
build?: {
|
|
328
|
+
/** Packages the image installs instead of bundling; Pi's always are, and for a `pi` agent Braintrust when its package depends on it. */
|
|
329
|
+
external?: string[];
|
|
330
|
+
/** The Dockerfile `neckbeard push` builds the image with, relative to the package. Defaults to `sandbox/Dockerfile`. */
|
|
331
|
+
dockerfile?: string;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
declare const definedAgentMarker: unique symbol;
|
|
335
|
+
/**
|
|
336
|
+
* An agent defined once for both sides. On the host it starts sandboxes and runs turns, building
|
|
337
|
+
* its `Agent` the first time one is needed, so importing it in the image requires no image tag or
|
|
338
|
+
* host configuration. In the image, `serve()` serves its session.
|
|
339
|
+
*/
|
|
340
|
+
declare class DefinedAgent<TEvent = unknown> {
|
|
341
|
+
readonly definition: AgentDefinition;
|
|
342
|
+
readonly [definedAgentMarker] = true;
|
|
343
|
+
private client?;
|
|
344
|
+
private braintrustChecked;
|
|
345
|
+
constructor(definition: AgentDefinition);
|
|
346
|
+
get name(): string;
|
|
347
|
+
/** The image this host runs: `image`, else `<registry>/<name>:<tag>` with the tag `resolveImageTag()` finds. */
|
|
348
|
+
imageRef(tag?: string | undefined): string;
|
|
349
|
+
/** The `Agent` for an image, by default the one this host runs. */
|
|
350
|
+
forImage(image?: string): Agent<TEvent>;
|
|
351
|
+
private get agent();
|
|
352
|
+
get artifactName(): string;
|
|
353
|
+
prepare(options?: Parameters<Agent<TEvent>['prepare']>[0]): Promise<void>;
|
|
354
|
+
start(options?: StartOptions): Promise<string>;
|
|
355
|
+
prompt(sandboxId: string, turn: StartTurnRequest, options?: TurnStreamOptions): AsyncGenerator<TurnRecord<TEvent>>;
|
|
356
|
+
run(sandboxId: string, turn: StartTurnRequest, options?: RunOptions<TEvent>): Promise<string | null>;
|
|
357
|
+
events(sandboxId: string, turnId: string, options?: TurnStreamOptions): AsyncGenerator<TurnRecord<TEvent>>;
|
|
358
|
+
abort(sandboxId: string, turnId: string, signal?: AbortSignal): Promise<void>;
|
|
359
|
+
steer(sandboxId: string, turnId: string, steer: SteerTurnRequest, signal?: AbortSignal): Promise<boolean>;
|
|
360
|
+
health(sandboxId: string, signal?: AbortSignal): Promise<TurnHealth>;
|
|
361
|
+
waitForIdle(sandboxId: string, options?: {
|
|
362
|
+
timeoutMs?: number;
|
|
363
|
+
signal?: AbortSignal;
|
|
364
|
+
}): Promise<void>;
|
|
365
|
+
kill(sandboxId: string): Promise<void>;
|
|
366
|
+
sandbox(sandboxId: string): ReturnType<Agent<TEvent>['sandbox']>;
|
|
367
|
+
gc(options?: {
|
|
368
|
+
keep?: number;
|
|
369
|
+
alsoKeep?: string[];
|
|
370
|
+
}): Promise<string[]>;
|
|
371
|
+
/** Where a persisted session's file is in a sandbox whose home is `homeDir`, as for copying it out and back. */
|
|
372
|
+
sessionFilePath(homeDir: string, sessionId: string): string;
|
|
373
|
+
/** Serves the agent's session; the image's entry point, which `neckbeard build` generates, calls it. */
|
|
374
|
+
serve(options?: {
|
|
375
|
+
port?: number;
|
|
376
|
+
host?: string;
|
|
377
|
+
}): Promise<ServeHandle>;
|
|
378
|
+
}
|
|
379
|
+
declare function defineAgent<TEvent = unknown>(definition: AgentDefinition): DefinedAgent<TEvent>;
|
|
380
|
+
declare function isDefinedAgent(value: unknown): value is DefinedAgent<unknown>;
|
|
381
|
+
|
|
98
382
|
interface DockerSandboxConfig {
|
|
99
383
|
provider: 'docker';
|
|
100
384
|
/** Debian-compatible image with Node.js/npm for `Agent`; defaults to node:22-bookworm. */
|
|
@@ -137,7 +421,9 @@ declare class NeckbeardError extends Error {
|
|
|
137
421
|
*/
|
|
138
422
|
declare class DeploymentError extends NeckbeardError {
|
|
139
423
|
readonly cause?: Error | undefined;
|
|
140
|
-
|
|
424
|
+
readonly sandboxId?: string | undefined;
|
|
425
|
+
/** A sandbox the failure left behind, for `kill()`. */
|
|
426
|
+
constructor(message: string, cause?: Error | undefined, sandboxId?: string | undefined);
|
|
141
427
|
}
|
|
142
428
|
/**
|
|
143
429
|
* Error thrown when input or output schema validation fails.
|
|
@@ -160,6 +446,13 @@ declare class ExecutionError extends NeckbeardError {
|
|
|
160
446
|
declare class RuntimeBusyError extends ExecutionError {
|
|
161
447
|
constructor(message: string);
|
|
162
448
|
}
|
|
449
|
+
/**
|
|
450
|
+
* Thrown when a sandbox's runtime no longer knows a turn, because the sandbox restarted or was
|
|
451
|
+
* replaced. The turn's outcome is unknown.
|
|
452
|
+
*/
|
|
453
|
+
declare class TurnLostError extends ExecutionError {
|
|
454
|
+
constructor(message: string);
|
|
455
|
+
}
|
|
163
456
|
/**
|
|
164
457
|
* Error thrown when required environment variables are missing.
|
|
165
458
|
*/
|
|
@@ -247,6 +540,9 @@ interface ResolveAgentSourceFileOptions {
|
|
|
247
540
|
*/
|
|
248
541
|
sandboxSourceFile?: string;
|
|
249
542
|
}
|
|
543
|
+
/**
|
|
544
|
+
* @deprecated Only `LegacyBundledAgent` needs it; `Agent` runs a prebuilt image.
|
|
545
|
+
*/
|
|
250
546
|
declare function resolveAgentSourceFile(candidates: string[], options?: ResolveAgentSourceFileOptions): string;
|
|
251
547
|
type NextConfigObject = {
|
|
252
548
|
outputFileTracingIncludes?: Record<string, unknown>;
|
|
@@ -265,6 +561,9 @@ type NextWebpackContext = Record<string, unknown> & {
|
|
|
265
561
|
isServer?: boolean;
|
|
266
562
|
};
|
|
267
563
|
type NextWebpackFunction = (config: NextWebpackConfig, context: NextWebpackContext) => NextWebpackConfig;
|
|
564
|
+
/**
|
|
565
|
+
* @deprecated Only `LegacyBundledAgent` needs it; `Agent` runs a prebuilt image.
|
|
566
|
+
*/
|
|
268
567
|
declare function withNeckbeardNextConfig<TConfig extends NextConfigObject>(nextConfig: TConfig, options: NeckbeardNextConfigOptions): TConfig & NextConfigObject;
|
|
269
568
|
/**
|
|
270
569
|
* Configuration for downloading a file into the sandbox filesystem.
|
|
@@ -394,7 +693,7 @@ interface AgentSessionHandler<TInput, TFrame> {
|
|
|
394
693
|
}
|
|
395
694
|
/**
|
|
396
695
|
* Attached-session agent config. The sandbox runtime emits typed events for
|
|
397
|
-
* sequential caller-owned turns created with `
|
|
696
|
+
* sequential caller-owned turns created with `LegacyBundledAgent.createSession()`.
|
|
398
697
|
*/
|
|
399
698
|
interface SessionAgentConfig<TInput, TFrame> extends AgentSharedConfig<TInput> {
|
|
400
699
|
session: AgentSessionHandler<TInput, TFrame>;
|
|
@@ -465,10 +764,12 @@ interface DaytonaSandboxConfig {
|
|
|
465
764
|
}
|
|
466
765
|
type SandboxConfig = E2BSandboxConfig | DaytonaSandboxConfig | ModalSandboxConfig | DockerSandboxConfig;
|
|
467
766
|
/**
|
|
468
|
-
* Agent config accepted by `new
|
|
767
|
+
* Agent config accepted by `new LegacyBundledAgent(config)`. Can be either a structured task
|
|
469
768
|
* (`run`) or an attached-session handler (`session.handler`). Both run behind
|
|
470
769
|
* the same persistent in-sandbox HTTP server.
|
|
471
770
|
* The deprecated `server.handler` spelling remains accepted.
|
|
771
|
+
*
|
|
772
|
+
* @deprecated Use `Agent` with a prebuilt image and its `AgentOptions`.
|
|
472
773
|
*/
|
|
473
774
|
type AgentConfig<TInput, TOutput, TFrame = unknown> = RunAgentConfig<TInput, TOutput> | SessionAgentConfig<TInput, TFrame> | ServerAgentConfig<TInput, TFrame>;
|
|
474
775
|
type SandboxClientCreateOptions = ModalSandboxCreateOptions | DockerSandboxCreateOptions | {
|
|
@@ -503,6 +804,11 @@ type SandboxClientConnectOptions = ModalSandboxConnectOptions | DockerSandboxCon
|
|
|
503
804
|
apiKey?: string;
|
|
504
805
|
createTimeoutSec?: number;
|
|
505
806
|
};
|
|
807
|
+
interface SandboxServerEndpoint {
|
|
808
|
+
url: string;
|
|
809
|
+
headers: Record<string, string>;
|
|
810
|
+
query: Record<string, string>;
|
|
811
|
+
}
|
|
506
812
|
declare class SandboxClient {
|
|
507
813
|
private readonly handle;
|
|
508
814
|
private constructor();
|
|
@@ -584,6 +890,11 @@ declare class SandboxClient {
|
|
|
584
890
|
*/
|
|
585
891
|
disposeSessionArtifacts(command: SandboxDetachedCommand): Promise<void>;
|
|
586
892
|
setTimeout(timeoutMs: number): Promise<void>;
|
|
893
|
+
/**
|
|
894
|
+
* Where to reach an HTTP server the sandbox runs on `port`, with the provider's auth: send
|
|
895
|
+
* `headers` with every request and add `query` to every URL.
|
|
896
|
+
*/
|
|
897
|
+
getServerEndpoint(port: number): Promise<SandboxServerEndpoint>;
|
|
587
898
|
kill(): Promise<void>;
|
|
588
899
|
destroy(): Promise<void>;
|
|
589
900
|
}
|
|
@@ -592,7 +903,11 @@ type AgentMode = 'run' | 'stream';
|
|
|
592
903
|
type AgentKind = 'task' | 'session';
|
|
593
904
|
/** @deprecated Durable sessions use the separate, deprecated supervisor deployment API. */
|
|
594
905
|
type SessionDurability = 'attached' | 'durable';
|
|
595
|
-
|
|
906
|
+
/**
|
|
907
|
+
* @deprecated Bundles the agent's code on the host and uploads it, its dependencies, and its
|
|
908
|
+
* local directories at every deploy. Use `Agent` with a prebuilt image instead.
|
|
909
|
+
*/
|
|
910
|
+
declare class LegacyBundledAgent<TInput, TOutput = unknown, TFrame = unknown> {
|
|
596
911
|
readonly sandbox: SandboxConfig;
|
|
597
912
|
readonly provider: SandboxProvider;
|
|
598
913
|
readonly template: string;
|
|
@@ -661,7 +976,7 @@ declare class Agent<TInput, TOutput = unknown, TFrame = unknown> {
|
|
|
661
976
|
*
|
|
662
977
|
* @example
|
|
663
978
|
* ```typescript
|
|
664
|
-
* const agent = new
|
|
979
|
+
* const agent = new LegacyBundledAgent({ ... });
|
|
665
980
|
* const sandboxId = await agent.deploy();
|
|
666
981
|
* console.log(`Deployed to sandbox: ${sandboxId}`);
|
|
667
982
|
*
|
|
@@ -729,4 +1044,4 @@ declare class Agent<TInput, TOutput = unknown, TFrame = unknown> {
|
|
|
729
1044
|
}): AsyncGenerator<TFrame>;
|
|
730
1045
|
}
|
|
731
1046
|
|
|
732
|
-
export { Agent, type AgentConfig, type AgentKind, type AgentMode, type AgentRunContext, type AgentRunResult, type AgentSandboxContext, type AgentSessionHandler, type AttachedAgentSession, type BuildOptions, ConfigurationError, type CreateAttachedSessionOptions, DEFAULT_DEPENDENCIES, type DaytonaSandboxConfig, DeploymentError, type DockerSandboxConfig, type E2BSandboxConfig, ExecutionError, type FileDownload, type LocalDirectoryUpload, type ModalSandboxConfig, NeckbeardError, type NeckbeardNextConfigOptions, type OsDependencies, type ResolveAgentSourceFileOptions, type RunAgentConfig, RuntimeBusyError, SandboxClient, type SandboxClientConnectOptions, type SandboxClientCreateOptions, SandboxCommandOptions, SandboxCommandResult, type SandboxConfig, SandboxDetachedCommand, SandboxDetachedCommandOptions, type SandboxFileContent, type SandboxProvider, type ServerAgentConfig, type SessionAgentConfig, type SessionDurability, ValidationError, resolveAgentSourceFile, withNeckbeardNextConfig };
|
|
1047
|
+
export { Agent, type AgentConfig, type AgentDefinition, type AgentKind, type AgentMode, type AgentOptions, type AgentRunContext, type AgentRunResult, type AgentSandbox, type AgentSandboxContext, type AgentSessionHandler, type AttachedAgentSession, type BuildOptions, ConfigurationError, type CreateAttachedSessionOptions, DEFAULT_DEPENDENCIES, type DaytonaAgentSandbox, type DaytonaSandboxConfig, DefinedAgent, DeploymentError, type DockerSandboxConfig, type E2BSandboxConfig, type E2bAgentSandbox, ExecutionError, type FileDownload, LegacyBundledAgent, type LocalDirectoryUpload, type ModalAgentSandbox, type ModalSandboxConfig, NeckbeardError, type NeckbeardNextConfigOptions, type OsDependencies, type PiSessionConfig, type ResolveAgentSourceFileOptions, type RunAgentConfig, type RunOptions, RuntimeBusyError, SKILLS_DIR, SandboxClient, type SandboxClientConnectOptions, type SandboxClientCreateOptions, SandboxCommandOptions, SandboxCommandResult, type SandboxConfig, SandboxDetachedCommand, SandboxDetachedCommandOptions, type SandboxFileContent, type SandboxProvider, type SandboxServerEndpoint, type ServerAgentConfig, type SessionAgentConfig, type SessionDurability, type StartOptions, StartTurnRequest, SteerTurnRequest, TurnHealth, TurnLostError, TurnRecord, type TurnStreamOptions, ValidationError, defineAgent, isDefinedAgent, resolveAgentSourceFile, resolveImageTag, withNeckbeardNextConfig };
|