sandbox.exec.
sandbox.exec.run(command, opts?)
Run a command synchronously. HTTP API →
string
required
Shell command
number
default:"60"
Timeout in seconds
Record<string, string>
Environment variables
string
Working directory
Promise<ProcessResult>
sandbox.exec.start(command, opts?)
Start a long-running command with streaming. HTTP API →
string
required
Command
string[]
Arguments
Record<string, string>
Environment variables
string
Working directory
number
Timeout in seconds
number
Seconds to keep running after disconnect
(data: Uint8Array) => void
Stdout callback
(data: Uint8Array) => void
Stderr callback
(exitCode: number) => void
Exit callback
Promise<ExecSession>
sandbox.exec.background(command, opts?)
Alias for start. Same options, same return type. Use when the intent is “run this in the background and observe it” — more discoverable than start for that case.
sandbox.exec.shell(opts?)
Open a stateful shell session. Subsequent .run() calls share the same bash process, so cwd, exported env vars, and shell functions persist — the ergonomics of a terminal tab.
Backed by a long-running bash --noprofile --norc session. Foreground-only: concurrent .run() rejects with ShellBusyError. Use background for fire-and-forget processes.
string
Initial working directory
Record<string, string>
Initial environment variables
Promise<Shell>
Shell
ShellRunOpts
Per-call
cwd, env, and timeout are intentionally not supported in v1. Use inline shell syntax (cd /x && cmd, FOO=bar cmd) — the shell state carries across calls. Timeouts will land once we have a “signal foreground job” primitive.ShellBusyError— anotherrun()is in flight (shell is foreground-only).ShellClosedError— bash has exited (explicitclose(), a command ranexit, or the session dropped).
sandbox.exec.attach(sessionId, opts?)
Reconnect to a running exec session.
string
required
Session ID
(data: Uint8Array) => void
Stdout callback
(data: Uint8Array) => void
Stderr callback
(exitCode: number) => void
Exit callback
() => void
Scrollback replay done
Promise<ExecSession>
sandbox.exec.list()
List all exec sessions. HTTP API →
Returns: Promise<ExecSessionInfo[]>
sandbox.exec.kill(sessionId, signal?)
Kill an exec session. Default signal: 9 (SIGKILL). HTTP API →
Returns: Promise<void>
ExecSession
Types
ProcessResult
ProcessResult
ExecSessionInfo
ExecSessionInfo