Skip to main content

Import

sandbox.ts

Examples

sandbox.ts

API

Sandbox.create()

Create an isolated sandbox workspace. Returns: Promise<Sandbox>

Sandbox.get(id, )

Reconnect to an existing sandbox session. Returns: Promise<Sandbox>

Sandbox.attach(attachment)

Attach to an existing sandbox. Closing detaches; use delete() to remove it. Returns: Sandbox

Sandbox.capabilities()

Get sandbox capabilities, limits and defaults for the current caller. Returns: Promise<SandboxCapabilities>

sandbox.checkHealth()

Check runtime health without recording activity. Returns: Promise<SandboxRuntimeCheck>

sandbox.checkReadiness()

Check command readiness without recording activity. Returns: Promise<SandboxRuntimeCheck>

sandbox.getEnvironment()

Get environment variable names with redacted values. Returns: Promise<SandboxEnvironment>

sandbox.listFiles()

Read one directory page. Supply pageInfo.next as cursor for another page. Returns: Promise<SandboxFileListResult>

sandbox.updateLifetime(input)

Update cleanup policy without changing access or storage. Returns: Promise<SandboxDetails>

Sandbox.list()

List sandboxes with optional pagination. Returns: Promise<SandboxListResult>

Sandbox.createLazy()

Create a client that provisions its sandbox when first used. Returns: LazySandbox

sandbox.runCommand(command, options)

Execute a bash command in the sandbox and return buffered stdout/stderr plus the exit code. Returns: Promise<CommandResult>

sandbox.streamCommand(command, options)

Execute a bash command in the sandbox and stream newline-delimited JSON (NDJSON) output events as they arrive. Returns: AsyncGenerator<CommandStreamEvent>

sandbox.readFile(path)

Read a file from the sandbox workspace. Returns: Promise<string>

sandbox.writeFiles(files)

Write one or more files to the sandbox workspace. Returns: Promise<void>

sandbox.startBackgroundCommand(command, options)

Start an async background command in the sandbox. Returns: Promise<BackgroundCommand>

sandbox.getBackgroundCommand(commandId)

Get the status of an async background command. Returns: Promise<BackgroundCommand>

sandbox.getBackgroundCommandOutput(commandId)

Get the output of an async background command. Returns: Promise<BackgroundCommandOutput>

sandbox.listBackgroundCommands()

List all background commands in the sandbox. Returns: Promise<BackgroundCommand[]>

sandbox.cancelBackgroundCommand(commandId, )

Cancel an async background command. Returns: Promise<BackgroundCommand>

sandbox.heartbeat()

Record activity for idle cleanup. Fixed expiry does not change. Returns: Promise<void>

sandbox.close()

Close the client. Existing and persistent sandboxes remain; temporary sandboxes created by this client are deleted. Returns: Promise<void>

sandbox.delete()

Delete the sandbox and its workspace files. Returns: Promise<void>

sandbox.id

Get the sandbox ID. Returns: string

sandbox.url

Get the sandbox endpoint URL. Returns: string

Type Reference

SandboxOptions

Options for creating a sandbox.

CommandResult

Result of a command execution: stdout, stderr, and exit code.

CommandStreamEvent

Streaming event emitted during command execution.

Exports

Functions

Classes

Types

Constants