tensorlake 0.4.50 → 0.5.1
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/dist/bin/darwin-arm64/tensorlake +0 -0
- package/dist/bin/darwin-arm64/tl +0 -0
- package/dist/bin/linux-x64/tensorlake +0 -0
- package/dist/bin/linux-x64/tl +0 -0
- package/dist/bin/win32-x64/tensorlake.exe +0 -0
- package/dist/bin/win32-x64/tl.exe +0 -0
- package/dist/index.cjs +388 -49
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +210 -12
- package/dist/index.d.ts +210 -12
- package/dist/index.js +388 -49
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-C79FXqQk.d.cts → sandbox-image-CEGsGg4V.d.cts} +22 -2
- package/dist/{sandbox-image-C79FXqQk.d.ts → sandbox-image-CEGsGg4V.d.ts} +22 -2
- package/dist/sandbox-image.cjs +375 -36
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.d.cts +1 -1
- package/dist/sandbox-image.d.ts +1 -1
- package/dist/sandbox-image.js +380 -36
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as SandboxStatus, U as UpdateSandboxOptions, f as SandboxInfo, g as SuspendResumeOptions, h as CheckpointOptions, R as RunOptions, i as CommandResult, j as StartProcessOptions, P as ProcessInfo, k as SendSignalResponse, O as OutputResponse, l as OutputEvent, L as ListDirectoryResponse, m as PtySessionInfo, H as HealthResponse, D as DaemonInfo, n as CreateSandboxOptions, o as CreateSandboxResponse, p as SandboxPortAccess, q as SnapshotOptions, r as CreateSnapshotResponse, s as SnapshotAndWaitOptions, t as CreatePoolOptions, u as CreateSandboxPoolResponse, v as SandboxPoolInfo, w as UpdatePoolOptions } from './sandbox-image-CEGsGg4V.cjs';
|
|
2
|
+
export { x as ContainerResourcesInfo, y as ContainerState, z as CreateSandboxImageOptions, A as DirectoryEntry, B as DockerfileBuildPlan, E as DockerfileInstruction, I as Image, F as ImageBuildOperation, G as ImageBuildOperationType, G as ImageBuildOperationTypeValue, J as ImageOptions, N as NetworkConfig, K as OutputMode, M as PoolContainerInfo, Q as ProcessStatus, T as SandboxImageSource, V as SnapshotContentMode, W as SnapshotStatus, X as StdinMode, Y as createSandboxImage, Z as dockerfileContent } from './sandbox-image-CEGsGg4V.cjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
|
6
|
+
* can correlate a specific request with its server-side spans in Datadog APM or
|
|
7
|
+
* any other OTEL-compatible backend.
|
|
8
|
+
*
|
|
9
|
+
* Because this is an intersection type, all properties of `T` are accessible
|
|
10
|
+
* directly — existing code that ignores `traceId` continues to compile and run
|
|
11
|
+
* unchanged.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const sandbox = await client.createSandbox(req);
|
|
15
|
+
* console.log(sandbox.id); // existing field — unchanged
|
|
16
|
+
* console.log(sandbox.traceId); // new: look this up in Datadog APM
|
|
17
|
+
*/
|
|
18
|
+
type Traced<T> = T & {
|
|
19
|
+
readonly traceId: string;
|
|
20
|
+
};
|
|
3
21
|
|
|
4
22
|
type MouseButton = "left" | "middle" | "right";
|
|
5
23
|
interface ConnectDesktopOptions {
|
|
@@ -147,15 +165,86 @@ declare class Pty {
|
|
|
147
165
|
*/
|
|
148
166
|
declare class Sandbox {
|
|
149
167
|
readonly sandboxId: string;
|
|
168
|
+
traceId: string | null;
|
|
150
169
|
private readonly http;
|
|
151
170
|
private readonly baseUrl;
|
|
152
171
|
private readonly wsHeaders;
|
|
153
172
|
private ownsSandbox;
|
|
154
173
|
private lifecycleClient;
|
|
174
|
+
private lifecycleIdentifier;
|
|
175
|
+
private sandboxName;
|
|
155
176
|
constructor(options: SandboxOptions);
|
|
177
|
+
get name(): string | null;
|
|
178
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
179
|
+
_setName(name: string | null): void;
|
|
180
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
181
|
+
_setLifecycleIdentifier(identifier: string): void;
|
|
156
182
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
157
183
|
_setOwner(client: SandboxClient): void;
|
|
184
|
+
/**
|
|
185
|
+
* Create a new sandbox and return a connected, running handle.
|
|
186
|
+
*
|
|
187
|
+
* Covers both fresh sandbox creation and restore-from-snapshot (set
|
|
188
|
+
* `snapshotId`). Blocks until the sandbox is `Running`.
|
|
189
|
+
*/
|
|
190
|
+
static create(options?: CreateAndConnectOptions & Partial<SandboxClientOptions>): Promise<Sandbox>;
|
|
191
|
+
/**
|
|
192
|
+
* Attach to an existing sandbox and return a connected handle.
|
|
193
|
+
*
|
|
194
|
+
* Verifies the sandbox exists via a server GET call, then returns a handle
|
|
195
|
+
* in whatever state the sandbox is in. Does **not** auto-resume a suspended
|
|
196
|
+
* sandbox — call `sandbox.resume()` explicitly.
|
|
197
|
+
*/
|
|
198
|
+
static connect(options: ConnectOptions & Partial<SandboxClientOptions>): Promise<Sandbox>;
|
|
199
|
+
/** Get information about a snapshot by ID. No sandbox handle needed. */
|
|
200
|
+
static getSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<SnapshotInfo>;
|
|
201
|
+
/** Delete a snapshot by ID. No sandbox handle needed. */
|
|
202
|
+
static deleteSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<void>;
|
|
203
|
+
private requireLifecycleClient;
|
|
204
|
+
/**
|
|
205
|
+
* Fetch the current sandbox status from the server.
|
|
206
|
+
*
|
|
207
|
+
* Always hits the network — the value is not cached locally because the
|
|
208
|
+
* status changes over the sandbox's lifecycle.
|
|
209
|
+
*/
|
|
210
|
+
status(): Promise<SandboxStatus>;
|
|
211
|
+
/**
|
|
212
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
213
|
+
*
|
|
214
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
215
|
+
* suspend/resume.
|
|
216
|
+
*/
|
|
217
|
+
update(options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
218
|
+
/**
|
|
219
|
+
* Suspend this sandbox.
|
|
220
|
+
*
|
|
221
|
+
* By default blocks until the sandbox is fully `Suspended`. Pass
|
|
222
|
+
* `{ wait: false }` for fire-and-return.
|
|
223
|
+
*/
|
|
224
|
+
suspend(options?: SuspendResumeOptions): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Resume this sandbox.
|
|
227
|
+
*
|
|
228
|
+
* By default blocks until the sandbox is `Running` and routable. Pass
|
|
229
|
+
* `{ wait: false }` for fire-and-return.
|
|
230
|
+
*/
|
|
231
|
+
resume(options?: SuspendResumeOptions): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Create a snapshot of this sandbox's filesystem and wait for it to
|
|
234
|
+
* be committed.
|
|
235
|
+
*
|
|
236
|
+
* By default blocks until the snapshot artifact is ready and returns
|
|
237
|
+
* the completed `SnapshotInfo`. Pass `{ wait: false }` to fire-and-return
|
|
238
|
+
* (returns `undefined`).
|
|
239
|
+
*/
|
|
240
|
+
checkpoint(options?: CheckpointOptions): Promise<SnapshotInfo | undefined>;
|
|
241
|
+
/**
|
|
242
|
+
* List snapshots taken from this sandbox.
|
|
243
|
+
*/
|
|
244
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
245
|
+
/** Close the HTTP client. The sandbox keeps running. */
|
|
158
246
|
close(): void;
|
|
247
|
+
/** Terminate the sandbox and release all resources. */
|
|
159
248
|
terminate(): Promise<void>;
|
|
160
249
|
/**
|
|
161
250
|
* Run a command to completion and return its output.
|
|
@@ -164,36 +253,67 @@ declare class Sandbox {
|
|
|
164
253
|
* the process, streams output, and delivers the exit code over one connection.
|
|
165
254
|
*/
|
|
166
255
|
run(command: string, options?: RunOptions): Promise<CommandResult>;
|
|
256
|
+
/**
|
|
257
|
+
* Start a process in the sandbox without waiting for it to exit.
|
|
258
|
+
*
|
|
259
|
+
* Returns a `ProcessInfo` with the assigned `pid`. Use `getProcess()` to
|
|
260
|
+
* poll status, or `followStdout()` / `followOutput()` to stream output
|
|
261
|
+
* until the process exits. Use `run()` instead to block until completion
|
|
262
|
+
* and get combined output in one call.
|
|
263
|
+
*/
|
|
167
264
|
startProcess(command: string, options?: StartProcessOptions): Promise<ProcessInfo>;
|
|
168
|
-
|
|
265
|
+
/** List all processes (running and exited) tracked by the sandbox daemon. */
|
|
266
|
+
listProcesses(): Promise<Traced<ProcessInfo[]>>;
|
|
267
|
+
/** Get current status and metadata for a process by PID. */
|
|
169
268
|
getProcess(pid: number): Promise<ProcessInfo>;
|
|
269
|
+
/** Send SIGKILL to a process. */
|
|
170
270
|
killProcess(pid: number): Promise<void>;
|
|
271
|
+
/** Send an arbitrary signal to a process (e.g. `15` for SIGTERM, `9` for SIGKILL). */
|
|
171
272
|
sendSignal(pid: number, signal: number): Promise<SendSignalResponse>;
|
|
273
|
+
/** Write bytes to a process's stdin. The process must have been started with `stdinMode: StdinMode.PIPE`. */
|
|
172
274
|
writeStdin(pid: number, data: Uint8Array): Promise<void>;
|
|
275
|
+
/** Close a process's stdin pipe, signalling EOF to the process. */
|
|
173
276
|
closeStdin(pid: number): Promise<void>;
|
|
277
|
+
/** Return all captured stdout lines produced so far by a process. */
|
|
174
278
|
getStdout(pid: number): Promise<OutputResponse>;
|
|
279
|
+
/** Return all captured stderr lines produced so far by a process. */
|
|
175
280
|
getStderr(pid: number): Promise<OutputResponse>;
|
|
281
|
+
/** Return all captured stdout+stderr lines produced so far by a process. */
|
|
176
282
|
getOutput(pid: number): Promise<OutputResponse>;
|
|
283
|
+
/** Stream stdout events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
177
284
|
followStdout(pid: number, options?: {
|
|
178
285
|
signal?: AbortSignal;
|
|
179
286
|
}): AsyncIterable<OutputEvent>;
|
|
287
|
+
/** Stream stderr events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
180
288
|
followStderr(pid: number, options?: {
|
|
181
289
|
signal?: AbortSignal;
|
|
182
290
|
}): AsyncIterable<OutputEvent>;
|
|
291
|
+
/** Stream combined stdout+stderr events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
183
292
|
followOutput(pid: number, options?: {
|
|
184
293
|
signal?: AbortSignal;
|
|
185
294
|
}): AsyncIterable<OutputEvent>;
|
|
295
|
+
/** Read a file from the sandbox and return its raw bytes. */
|
|
186
296
|
readFile(path: string): Promise<Uint8Array>;
|
|
297
|
+
/** Write raw bytes to a file in the sandbox, creating it if it does not exist. */
|
|
187
298
|
writeFile(path: string, content: Uint8Array): Promise<void>;
|
|
299
|
+
/** Delete a file from the sandbox. */
|
|
188
300
|
deleteFile(path: string): Promise<void>;
|
|
301
|
+
/** List the contents of a directory in the sandbox. */
|
|
189
302
|
listDirectory(path: string): Promise<ListDirectoryResponse>;
|
|
303
|
+
/** Create an interactive PTY session. Returns a `sessionId` and `token` for WebSocket connection via `connectPty()`. */
|
|
190
304
|
createPtySession(options: CreatePtySessionOptions): Promise<PtySessionInfo>;
|
|
305
|
+
/** Create a PTY session and connect to it immediately. Cleans up the session if the WebSocket connection fails. */
|
|
191
306
|
createPty(options: CreatePtyOptions): Promise<Pty>;
|
|
307
|
+
/** Attach to an existing PTY session by ID and token and return a connected `Pty` handle. */
|
|
192
308
|
connectPty(sessionId: string, token: string, options?: PtyConnectionOptions): Promise<Pty>;
|
|
309
|
+
/** Open a TCP tunnel to a port inside the sandbox and return the local listener. */
|
|
193
310
|
createTunnel(remotePort: number, options?: CreateTunnelOptions): Promise<TcpTunnel>;
|
|
311
|
+
/** Connect to a sandbox VNC session for programmatic desktop control. */
|
|
194
312
|
connectDesktop(options?: ConnectDesktopOptions): Promise<Desktop>;
|
|
195
313
|
ptyWsUrl(sessionId: string, token: string): string;
|
|
314
|
+
/** Check the sandbox daemon health. */
|
|
196
315
|
health(): Promise<HealthResponse>;
|
|
316
|
+
/** Get sandbox daemon info (version, uptime, process counts). */
|
|
197
317
|
info(): Promise<DaemonInfo>;
|
|
198
318
|
}
|
|
199
319
|
|
|
@@ -211,7 +331,8 @@ declare class SandboxClient {
|
|
|
211
331
|
private readonly projectId;
|
|
212
332
|
private readonly namespace;
|
|
213
333
|
private readonly local;
|
|
214
|
-
|
|
334
|
+
/** @internal Pass `true` to suppress the deprecation warning when used by `Sandbox.create()` / `Sandbox.connect()`. */
|
|
335
|
+
constructor(options?: SandboxClientOptions, _internal?: boolean);
|
|
215
336
|
/** Create a client for the TensorLake cloud platform. */
|
|
216
337
|
static forCloud(options?: {
|
|
217
338
|
apiKey?: string;
|
|
@@ -226,30 +347,107 @@ declare class SandboxClient {
|
|
|
226
347
|
}): SandboxClient;
|
|
227
348
|
close(): void;
|
|
228
349
|
private path;
|
|
229
|
-
|
|
350
|
+
/** Create a new sandbox. Returns immediately; the sandbox may still be starting. Use `createAndConnect()` for a blocking, ready-to-use handle. */
|
|
351
|
+
create(options?: CreateSandboxOptions): Promise<Traced<CreateSandboxResponse>>;
|
|
352
|
+
/** Get current state and metadata for a sandbox by ID. */
|
|
230
353
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
231
|
-
|
|
354
|
+
/** List all sandboxes in the namespace. */
|
|
355
|
+
list(): Promise<Traced<SandboxInfo[]>>;
|
|
356
|
+
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
232
357
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
358
|
+
/** Get the current proxy port settings for a sandbox. */
|
|
233
359
|
getPortAccess(sandboxId: string): Promise<SandboxPortAccess>;
|
|
360
|
+
/** Add one or more user ports to the sandbox proxy allowlist. */
|
|
234
361
|
exposePorts(sandboxId: string, ports: number[], options?: {
|
|
235
362
|
allowUnauthenticatedAccess?: boolean;
|
|
236
363
|
}): Promise<SandboxInfo>;
|
|
364
|
+
/** Remove one or more user ports from the sandbox proxy allowlist. */
|
|
237
365
|
unexposePorts(sandboxId: string, ports: number[]): Promise<SandboxInfo>;
|
|
366
|
+
/** Terminate and delete a sandbox. */
|
|
238
367
|
delete(sandboxId: string): Promise<void>;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Suspend a named sandbox, preserving its state for later resume.
|
|
370
|
+
*
|
|
371
|
+
* Only sandboxes created with a `name` can be suspended; ephemeral sandboxes
|
|
372
|
+
* cannot. By default blocks until the sandbox is fully `Suspended`. Pass
|
|
373
|
+
* `{ wait: false }` to return immediately after the request is sent
|
|
374
|
+
* (fire-and-return); the server processes the suspend asynchronously.
|
|
375
|
+
*
|
|
376
|
+
* @param sandboxId - ID or name of the sandbox.
|
|
377
|
+
* @param options.wait - If `true` (default), poll until `Suspended`. Pass `false` to fire-and-return.
|
|
378
|
+
* @param options.timeout - Max seconds to wait when `wait=true` (default 300).
|
|
379
|
+
* @param options.pollInterval - Seconds between status polls when `wait=true` (default 1).
|
|
380
|
+
* @throws {SandboxError} If `wait=true` and the sandbox does not reach `Suspended` within `timeout`.
|
|
381
|
+
*/
|
|
382
|
+
suspend(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Resume a suspended sandbox and bring it back to `Running`.
|
|
385
|
+
*
|
|
386
|
+
* By default blocks until the sandbox is `Running` and routable. Pass
|
|
387
|
+
* `{ wait: false }` to return immediately after the request is sent
|
|
388
|
+
* (fire-and-return); the server processes the resume asynchronously.
|
|
389
|
+
*
|
|
390
|
+
* @param sandboxId - ID or name of the sandbox.
|
|
391
|
+
* @param options.wait - If `true` (default), poll until `Running`. Pass `false` to fire-and-return.
|
|
392
|
+
* @param options.timeout - Max seconds to wait when `wait=true` (default 300).
|
|
393
|
+
* @param options.pollInterval - Seconds between status polls when `wait=true` (default 1).
|
|
394
|
+
* @throws {SandboxError} If `wait=true` and the sandbox does not reach `Running` within `timeout`.
|
|
395
|
+
*/
|
|
396
|
+
resume(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
397
|
+
/** Claim a warm sandbox from a pool, creating one if no warm containers are available. */
|
|
398
|
+
claim(poolId: string): Promise<Traced<CreateSandboxResponse>>;
|
|
399
|
+
/**
|
|
400
|
+
* Request a snapshot of a running sandbox's filesystem.
|
|
401
|
+
*
|
|
402
|
+
* This call **returns immediately** with a `snapshotId` and `in_progress`
|
|
403
|
+
* status — the snapshot is created asynchronously. Poll `getSnapshot()` until
|
|
404
|
+
* `completed` or `failed`, or use `snapshotAndWait()` to block automatically.
|
|
405
|
+
*
|
|
406
|
+
* @param options.contentMode - `"filesystem_only"` for cold-boot snapshots (e.g. image builds).
|
|
407
|
+
* Omit to use the server default (full VM snapshot).
|
|
408
|
+
*/
|
|
242
409
|
snapshot(sandboxId: string, options?: SnapshotOptions): Promise<CreateSnapshotResponse>;
|
|
410
|
+
/** Get current status and metadata for a snapshot by ID. */
|
|
243
411
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
244
|
-
|
|
412
|
+
/** List all snapshots in the namespace. */
|
|
413
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
414
|
+
/** Delete a snapshot by ID. */
|
|
245
415
|
deleteSnapshot(snapshotId: string): Promise<void>;
|
|
416
|
+
/**
|
|
417
|
+
* Create a snapshot and block until it is committed.
|
|
418
|
+
*
|
|
419
|
+
* Combines `snapshot()` with polling `getSnapshot()` until `completed`.
|
|
420
|
+
* Prefer `sandbox.checkpoint()` on a `Sandbox` handle for the same behavior
|
|
421
|
+
* without managing the client separately.
|
|
422
|
+
*
|
|
423
|
+
* @param sandboxId - ID of the running sandbox to snapshot.
|
|
424
|
+
* @param options.timeout - Max seconds to wait (default 300).
|
|
425
|
+
* @param options.pollInterval - Seconds between status polls (default 1).
|
|
426
|
+
* @param options.contentMode - Content mode passed through to `snapshot()`.
|
|
427
|
+
* @throws {SandboxError} If the snapshot fails or `timeout` elapses.
|
|
428
|
+
*/
|
|
246
429
|
snapshotAndWait(sandboxId: string, options?: SnapshotAndWaitOptions): Promise<SnapshotInfo>;
|
|
430
|
+
/** Create a new sandbox pool with warm pre-booted containers. */
|
|
247
431
|
createPool(options: CreatePoolOptions): Promise<CreateSandboxPoolResponse>;
|
|
432
|
+
/** Get current state and metadata for a sandbox pool by ID. */
|
|
248
433
|
getPool(poolId: string): Promise<SandboxPoolInfo>;
|
|
249
|
-
|
|
434
|
+
/** List all sandbox pools in the namespace. */
|
|
435
|
+
listPools(): Promise<Traced<SandboxPoolInfo[]>>;
|
|
436
|
+
/** Replace the configuration of an existing sandbox pool. */
|
|
250
437
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
438
|
+
/** Delete a sandbox pool. Fails if the pool has active containers. */
|
|
251
439
|
deletePool(poolId: string): Promise<void>;
|
|
440
|
+
/** Return a `Sandbox` handle for an existing running sandbox without verifying it exists. */
|
|
252
441
|
connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
|
|
442
|
+
/**
|
|
443
|
+
* Create a sandbox, wait for it to reach `Running`, and return a connected handle.
|
|
444
|
+
*
|
|
445
|
+
* Blocks until the sandbox is ready or `startupTimeout` elapses. The returned
|
|
446
|
+
* `Sandbox` auto-terminates when `terminate()` is called.
|
|
447
|
+
*
|
|
448
|
+
* @param options.startupTimeout - Max seconds to wait for `Running` status (default 60).
|
|
449
|
+
* @throws {SandboxError} If the sandbox terminates during startup or the timeout elapses.
|
|
450
|
+
*/
|
|
253
451
|
createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
|
|
254
452
|
}
|
|
255
453
|
|
|
@@ -498,4 +696,4 @@ declare class RequestExecutionError extends Error {
|
|
|
498
696
|
constructor(message: string, functionName?: string);
|
|
499
697
|
}
|
|
500
698
|
|
|
501
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
|
699
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions,
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as SandboxStatus, U as UpdateSandboxOptions, f as SandboxInfo, g as SuspendResumeOptions, h as CheckpointOptions, R as RunOptions, i as CommandResult, j as StartProcessOptions, P as ProcessInfo, k as SendSignalResponse, O as OutputResponse, l as OutputEvent, L as ListDirectoryResponse, m as PtySessionInfo, H as HealthResponse, D as DaemonInfo, n as CreateSandboxOptions, o as CreateSandboxResponse, p as SandboxPortAccess, q as SnapshotOptions, r as CreateSnapshotResponse, s as SnapshotAndWaitOptions, t as CreatePoolOptions, u as CreateSandboxPoolResponse, v as SandboxPoolInfo, w as UpdatePoolOptions } from './sandbox-image-CEGsGg4V.js';
|
|
2
|
+
export { x as ContainerResourcesInfo, y as ContainerState, z as CreateSandboxImageOptions, A as DirectoryEntry, B as DockerfileBuildPlan, E as DockerfileInstruction, I as Image, F as ImageBuildOperation, G as ImageBuildOperationType, G as ImageBuildOperationTypeValue, J as ImageOptions, N as NetworkConfig, K as OutputMode, M as PoolContainerInfo, Q as ProcessStatus, T as SandboxImageSource, V as SnapshotContentMode, W as SnapshotStatus, X as StdinMode, Y as createSandboxImage, Z as dockerfileContent } from './sandbox-image-CEGsGg4V.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
|
6
|
+
* can correlate a specific request with its server-side spans in Datadog APM or
|
|
7
|
+
* any other OTEL-compatible backend.
|
|
8
|
+
*
|
|
9
|
+
* Because this is an intersection type, all properties of `T` are accessible
|
|
10
|
+
* directly — existing code that ignores `traceId` continues to compile and run
|
|
11
|
+
* unchanged.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const sandbox = await client.createSandbox(req);
|
|
15
|
+
* console.log(sandbox.id); // existing field — unchanged
|
|
16
|
+
* console.log(sandbox.traceId); // new: look this up in Datadog APM
|
|
17
|
+
*/
|
|
18
|
+
type Traced<T> = T & {
|
|
19
|
+
readonly traceId: string;
|
|
20
|
+
};
|
|
3
21
|
|
|
4
22
|
type MouseButton = "left" | "middle" | "right";
|
|
5
23
|
interface ConnectDesktopOptions {
|
|
@@ -147,15 +165,86 @@ declare class Pty {
|
|
|
147
165
|
*/
|
|
148
166
|
declare class Sandbox {
|
|
149
167
|
readonly sandboxId: string;
|
|
168
|
+
traceId: string | null;
|
|
150
169
|
private readonly http;
|
|
151
170
|
private readonly baseUrl;
|
|
152
171
|
private readonly wsHeaders;
|
|
153
172
|
private ownsSandbox;
|
|
154
173
|
private lifecycleClient;
|
|
174
|
+
private lifecycleIdentifier;
|
|
175
|
+
private sandboxName;
|
|
155
176
|
constructor(options: SandboxOptions);
|
|
177
|
+
get name(): string | null;
|
|
178
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
179
|
+
_setName(name: string | null): void;
|
|
180
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
181
|
+
_setLifecycleIdentifier(identifier: string): void;
|
|
156
182
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
157
183
|
_setOwner(client: SandboxClient): void;
|
|
184
|
+
/**
|
|
185
|
+
* Create a new sandbox and return a connected, running handle.
|
|
186
|
+
*
|
|
187
|
+
* Covers both fresh sandbox creation and restore-from-snapshot (set
|
|
188
|
+
* `snapshotId`). Blocks until the sandbox is `Running`.
|
|
189
|
+
*/
|
|
190
|
+
static create(options?: CreateAndConnectOptions & Partial<SandboxClientOptions>): Promise<Sandbox>;
|
|
191
|
+
/**
|
|
192
|
+
* Attach to an existing sandbox and return a connected handle.
|
|
193
|
+
*
|
|
194
|
+
* Verifies the sandbox exists via a server GET call, then returns a handle
|
|
195
|
+
* in whatever state the sandbox is in. Does **not** auto-resume a suspended
|
|
196
|
+
* sandbox — call `sandbox.resume()` explicitly.
|
|
197
|
+
*/
|
|
198
|
+
static connect(options: ConnectOptions & Partial<SandboxClientOptions>): Promise<Sandbox>;
|
|
199
|
+
/** Get information about a snapshot by ID. No sandbox handle needed. */
|
|
200
|
+
static getSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<SnapshotInfo>;
|
|
201
|
+
/** Delete a snapshot by ID. No sandbox handle needed. */
|
|
202
|
+
static deleteSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<void>;
|
|
203
|
+
private requireLifecycleClient;
|
|
204
|
+
/**
|
|
205
|
+
* Fetch the current sandbox status from the server.
|
|
206
|
+
*
|
|
207
|
+
* Always hits the network — the value is not cached locally because the
|
|
208
|
+
* status changes over the sandbox's lifecycle.
|
|
209
|
+
*/
|
|
210
|
+
status(): Promise<SandboxStatus>;
|
|
211
|
+
/**
|
|
212
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
213
|
+
*
|
|
214
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
215
|
+
* suspend/resume.
|
|
216
|
+
*/
|
|
217
|
+
update(options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
218
|
+
/**
|
|
219
|
+
* Suspend this sandbox.
|
|
220
|
+
*
|
|
221
|
+
* By default blocks until the sandbox is fully `Suspended`. Pass
|
|
222
|
+
* `{ wait: false }` for fire-and-return.
|
|
223
|
+
*/
|
|
224
|
+
suspend(options?: SuspendResumeOptions): Promise<void>;
|
|
225
|
+
/**
|
|
226
|
+
* Resume this sandbox.
|
|
227
|
+
*
|
|
228
|
+
* By default blocks until the sandbox is `Running` and routable. Pass
|
|
229
|
+
* `{ wait: false }` for fire-and-return.
|
|
230
|
+
*/
|
|
231
|
+
resume(options?: SuspendResumeOptions): Promise<void>;
|
|
232
|
+
/**
|
|
233
|
+
* Create a snapshot of this sandbox's filesystem and wait for it to
|
|
234
|
+
* be committed.
|
|
235
|
+
*
|
|
236
|
+
* By default blocks until the snapshot artifact is ready and returns
|
|
237
|
+
* the completed `SnapshotInfo`. Pass `{ wait: false }` to fire-and-return
|
|
238
|
+
* (returns `undefined`).
|
|
239
|
+
*/
|
|
240
|
+
checkpoint(options?: CheckpointOptions): Promise<SnapshotInfo | undefined>;
|
|
241
|
+
/**
|
|
242
|
+
* List snapshots taken from this sandbox.
|
|
243
|
+
*/
|
|
244
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
245
|
+
/** Close the HTTP client. The sandbox keeps running. */
|
|
158
246
|
close(): void;
|
|
247
|
+
/** Terminate the sandbox and release all resources. */
|
|
159
248
|
terminate(): Promise<void>;
|
|
160
249
|
/**
|
|
161
250
|
* Run a command to completion and return its output.
|
|
@@ -164,36 +253,67 @@ declare class Sandbox {
|
|
|
164
253
|
* the process, streams output, and delivers the exit code over one connection.
|
|
165
254
|
*/
|
|
166
255
|
run(command: string, options?: RunOptions): Promise<CommandResult>;
|
|
256
|
+
/**
|
|
257
|
+
* Start a process in the sandbox without waiting for it to exit.
|
|
258
|
+
*
|
|
259
|
+
* Returns a `ProcessInfo` with the assigned `pid`. Use `getProcess()` to
|
|
260
|
+
* poll status, or `followStdout()` / `followOutput()` to stream output
|
|
261
|
+
* until the process exits. Use `run()` instead to block until completion
|
|
262
|
+
* and get combined output in one call.
|
|
263
|
+
*/
|
|
167
264
|
startProcess(command: string, options?: StartProcessOptions): Promise<ProcessInfo>;
|
|
168
|
-
|
|
265
|
+
/** List all processes (running and exited) tracked by the sandbox daemon. */
|
|
266
|
+
listProcesses(): Promise<Traced<ProcessInfo[]>>;
|
|
267
|
+
/** Get current status and metadata for a process by PID. */
|
|
169
268
|
getProcess(pid: number): Promise<ProcessInfo>;
|
|
269
|
+
/** Send SIGKILL to a process. */
|
|
170
270
|
killProcess(pid: number): Promise<void>;
|
|
271
|
+
/** Send an arbitrary signal to a process (e.g. `15` for SIGTERM, `9` for SIGKILL). */
|
|
171
272
|
sendSignal(pid: number, signal: number): Promise<SendSignalResponse>;
|
|
273
|
+
/** Write bytes to a process's stdin. The process must have been started with `stdinMode: StdinMode.PIPE`. */
|
|
172
274
|
writeStdin(pid: number, data: Uint8Array): Promise<void>;
|
|
275
|
+
/** Close a process's stdin pipe, signalling EOF to the process. */
|
|
173
276
|
closeStdin(pid: number): Promise<void>;
|
|
277
|
+
/** Return all captured stdout lines produced so far by a process. */
|
|
174
278
|
getStdout(pid: number): Promise<OutputResponse>;
|
|
279
|
+
/** Return all captured stderr lines produced so far by a process. */
|
|
175
280
|
getStderr(pid: number): Promise<OutputResponse>;
|
|
281
|
+
/** Return all captured stdout+stderr lines produced so far by a process. */
|
|
176
282
|
getOutput(pid: number): Promise<OutputResponse>;
|
|
283
|
+
/** Stream stdout events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
177
284
|
followStdout(pid: number, options?: {
|
|
178
285
|
signal?: AbortSignal;
|
|
179
286
|
}): AsyncIterable<OutputEvent>;
|
|
287
|
+
/** Stream stderr events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
180
288
|
followStderr(pid: number, options?: {
|
|
181
289
|
signal?: AbortSignal;
|
|
182
290
|
}): AsyncIterable<OutputEvent>;
|
|
291
|
+
/** Stream combined stdout+stderr events from a process until it exits. Yields one `OutputEvent` per line. */
|
|
183
292
|
followOutput(pid: number, options?: {
|
|
184
293
|
signal?: AbortSignal;
|
|
185
294
|
}): AsyncIterable<OutputEvent>;
|
|
295
|
+
/** Read a file from the sandbox and return its raw bytes. */
|
|
186
296
|
readFile(path: string): Promise<Uint8Array>;
|
|
297
|
+
/** Write raw bytes to a file in the sandbox, creating it if it does not exist. */
|
|
187
298
|
writeFile(path: string, content: Uint8Array): Promise<void>;
|
|
299
|
+
/** Delete a file from the sandbox. */
|
|
188
300
|
deleteFile(path: string): Promise<void>;
|
|
301
|
+
/** List the contents of a directory in the sandbox. */
|
|
189
302
|
listDirectory(path: string): Promise<ListDirectoryResponse>;
|
|
303
|
+
/** Create an interactive PTY session. Returns a `sessionId` and `token` for WebSocket connection via `connectPty()`. */
|
|
190
304
|
createPtySession(options: CreatePtySessionOptions): Promise<PtySessionInfo>;
|
|
305
|
+
/** Create a PTY session and connect to it immediately. Cleans up the session if the WebSocket connection fails. */
|
|
191
306
|
createPty(options: CreatePtyOptions): Promise<Pty>;
|
|
307
|
+
/** Attach to an existing PTY session by ID and token and return a connected `Pty` handle. */
|
|
192
308
|
connectPty(sessionId: string, token: string, options?: PtyConnectionOptions): Promise<Pty>;
|
|
309
|
+
/** Open a TCP tunnel to a port inside the sandbox and return the local listener. */
|
|
193
310
|
createTunnel(remotePort: number, options?: CreateTunnelOptions): Promise<TcpTunnel>;
|
|
311
|
+
/** Connect to a sandbox VNC session for programmatic desktop control. */
|
|
194
312
|
connectDesktop(options?: ConnectDesktopOptions): Promise<Desktop>;
|
|
195
313
|
ptyWsUrl(sessionId: string, token: string): string;
|
|
314
|
+
/** Check the sandbox daemon health. */
|
|
196
315
|
health(): Promise<HealthResponse>;
|
|
316
|
+
/** Get sandbox daemon info (version, uptime, process counts). */
|
|
197
317
|
info(): Promise<DaemonInfo>;
|
|
198
318
|
}
|
|
199
319
|
|
|
@@ -211,7 +331,8 @@ declare class SandboxClient {
|
|
|
211
331
|
private readonly projectId;
|
|
212
332
|
private readonly namespace;
|
|
213
333
|
private readonly local;
|
|
214
|
-
|
|
334
|
+
/** @internal Pass `true` to suppress the deprecation warning when used by `Sandbox.create()` / `Sandbox.connect()`. */
|
|
335
|
+
constructor(options?: SandboxClientOptions, _internal?: boolean);
|
|
215
336
|
/** Create a client for the TensorLake cloud platform. */
|
|
216
337
|
static forCloud(options?: {
|
|
217
338
|
apiKey?: string;
|
|
@@ -226,30 +347,107 @@ declare class SandboxClient {
|
|
|
226
347
|
}): SandboxClient;
|
|
227
348
|
close(): void;
|
|
228
349
|
private path;
|
|
229
|
-
|
|
350
|
+
/** Create a new sandbox. Returns immediately; the sandbox may still be starting. Use `createAndConnect()` for a blocking, ready-to-use handle. */
|
|
351
|
+
create(options?: CreateSandboxOptions): Promise<Traced<CreateSandboxResponse>>;
|
|
352
|
+
/** Get current state and metadata for a sandbox by ID. */
|
|
230
353
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
231
|
-
|
|
354
|
+
/** List all sandboxes in the namespace. */
|
|
355
|
+
list(): Promise<Traced<SandboxInfo[]>>;
|
|
356
|
+
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
232
357
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
358
|
+
/** Get the current proxy port settings for a sandbox. */
|
|
233
359
|
getPortAccess(sandboxId: string): Promise<SandboxPortAccess>;
|
|
360
|
+
/** Add one or more user ports to the sandbox proxy allowlist. */
|
|
234
361
|
exposePorts(sandboxId: string, ports: number[], options?: {
|
|
235
362
|
allowUnauthenticatedAccess?: boolean;
|
|
236
363
|
}): Promise<SandboxInfo>;
|
|
364
|
+
/** Remove one or more user ports from the sandbox proxy allowlist. */
|
|
237
365
|
unexposePorts(sandboxId: string, ports: number[]): Promise<SandboxInfo>;
|
|
366
|
+
/** Terminate and delete a sandbox. */
|
|
238
367
|
delete(sandboxId: string): Promise<void>;
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
368
|
+
/**
|
|
369
|
+
* Suspend a named sandbox, preserving its state for later resume.
|
|
370
|
+
*
|
|
371
|
+
* Only sandboxes created with a `name` can be suspended; ephemeral sandboxes
|
|
372
|
+
* cannot. By default blocks until the sandbox is fully `Suspended`. Pass
|
|
373
|
+
* `{ wait: false }` to return immediately after the request is sent
|
|
374
|
+
* (fire-and-return); the server processes the suspend asynchronously.
|
|
375
|
+
*
|
|
376
|
+
* @param sandboxId - ID or name of the sandbox.
|
|
377
|
+
* @param options.wait - If `true` (default), poll until `Suspended`. Pass `false` to fire-and-return.
|
|
378
|
+
* @param options.timeout - Max seconds to wait when `wait=true` (default 300).
|
|
379
|
+
* @param options.pollInterval - Seconds between status polls when `wait=true` (default 1).
|
|
380
|
+
* @throws {SandboxError} If `wait=true` and the sandbox does not reach `Suspended` within `timeout`.
|
|
381
|
+
*/
|
|
382
|
+
suspend(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
383
|
+
/**
|
|
384
|
+
* Resume a suspended sandbox and bring it back to `Running`.
|
|
385
|
+
*
|
|
386
|
+
* By default blocks until the sandbox is `Running` and routable. Pass
|
|
387
|
+
* `{ wait: false }` to return immediately after the request is sent
|
|
388
|
+
* (fire-and-return); the server processes the resume asynchronously.
|
|
389
|
+
*
|
|
390
|
+
* @param sandboxId - ID or name of the sandbox.
|
|
391
|
+
* @param options.wait - If `true` (default), poll until `Running`. Pass `false` to fire-and-return.
|
|
392
|
+
* @param options.timeout - Max seconds to wait when `wait=true` (default 300).
|
|
393
|
+
* @param options.pollInterval - Seconds between status polls when `wait=true` (default 1).
|
|
394
|
+
* @throws {SandboxError} If `wait=true` and the sandbox does not reach `Running` within `timeout`.
|
|
395
|
+
*/
|
|
396
|
+
resume(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
397
|
+
/** Claim a warm sandbox from a pool, creating one if no warm containers are available. */
|
|
398
|
+
claim(poolId: string): Promise<Traced<CreateSandboxResponse>>;
|
|
399
|
+
/**
|
|
400
|
+
* Request a snapshot of a running sandbox's filesystem.
|
|
401
|
+
*
|
|
402
|
+
* This call **returns immediately** with a `snapshotId` and `in_progress`
|
|
403
|
+
* status — the snapshot is created asynchronously. Poll `getSnapshot()` until
|
|
404
|
+
* `completed` or `failed`, or use `snapshotAndWait()` to block automatically.
|
|
405
|
+
*
|
|
406
|
+
* @param options.contentMode - `"filesystem_only"` for cold-boot snapshots (e.g. image builds).
|
|
407
|
+
* Omit to use the server default (full VM snapshot).
|
|
408
|
+
*/
|
|
242
409
|
snapshot(sandboxId: string, options?: SnapshotOptions): Promise<CreateSnapshotResponse>;
|
|
410
|
+
/** Get current status and metadata for a snapshot by ID. */
|
|
243
411
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
244
|
-
|
|
412
|
+
/** List all snapshots in the namespace. */
|
|
413
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
414
|
+
/** Delete a snapshot by ID. */
|
|
245
415
|
deleteSnapshot(snapshotId: string): Promise<void>;
|
|
416
|
+
/**
|
|
417
|
+
* Create a snapshot and block until it is committed.
|
|
418
|
+
*
|
|
419
|
+
* Combines `snapshot()` with polling `getSnapshot()` until `completed`.
|
|
420
|
+
* Prefer `sandbox.checkpoint()` on a `Sandbox` handle for the same behavior
|
|
421
|
+
* without managing the client separately.
|
|
422
|
+
*
|
|
423
|
+
* @param sandboxId - ID of the running sandbox to snapshot.
|
|
424
|
+
* @param options.timeout - Max seconds to wait (default 300).
|
|
425
|
+
* @param options.pollInterval - Seconds between status polls (default 1).
|
|
426
|
+
* @param options.contentMode - Content mode passed through to `snapshot()`.
|
|
427
|
+
* @throws {SandboxError} If the snapshot fails or `timeout` elapses.
|
|
428
|
+
*/
|
|
246
429
|
snapshotAndWait(sandboxId: string, options?: SnapshotAndWaitOptions): Promise<SnapshotInfo>;
|
|
430
|
+
/** Create a new sandbox pool with warm pre-booted containers. */
|
|
247
431
|
createPool(options: CreatePoolOptions): Promise<CreateSandboxPoolResponse>;
|
|
432
|
+
/** Get current state and metadata for a sandbox pool by ID. */
|
|
248
433
|
getPool(poolId: string): Promise<SandboxPoolInfo>;
|
|
249
|
-
|
|
434
|
+
/** List all sandbox pools in the namespace. */
|
|
435
|
+
listPools(): Promise<Traced<SandboxPoolInfo[]>>;
|
|
436
|
+
/** Replace the configuration of an existing sandbox pool. */
|
|
250
437
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
438
|
+
/** Delete a sandbox pool. Fails if the pool has active containers. */
|
|
251
439
|
deletePool(poolId: string): Promise<void>;
|
|
440
|
+
/** Return a `Sandbox` handle for an existing running sandbox without verifying it exists. */
|
|
252
441
|
connect(identifier: string, proxyUrl?: string, routingHint?: string): Sandbox;
|
|
442
|
+
/**
|
|
443
|
+
* Create a sandbox, wait for it to reach `Running`, and return a connected handle.
|
|
444
|
+
*
|
|
445
|
+
* Blocks until the sandbox is ready or `startupTimeout` elapses. The returned
|
|
446
|
+
* `Sandbox` auto-terminates when `terminate()` is called.
|
|
447
|
+
*
|
|
448
|
+
* @param options.startupTimeout - Max seconds to wait for `Running` status (default 60).
|
|
449
|
+
* @throws {SandboxError} If the sandbox terminates during startup or the timeout elapses.
|
|
450
|
+
*/
|
|
253
451
|
createAndConnect(options?: CreateAndConnectOptions): Promise<Sandbox>;
|
|
254
452
|
}
|
|
255
453
|
|
|
@@ -498,4 +696,4 @@ declare class RequestExecutionError extends Error {
|
|
|
498
696
|
constructor(message: string, functionName?: string);
|
|
499
697
|
}
|
|
500
698
|
|
|
501
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
|
699
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|