Accessed viaDocumentation Index
Fetch the complete documentation index at: https://docs.opencomputer.dev/llms.txt
Use this file to discover all available pages before exploring further.
sandbox.exec.
sandbox.exec.run(command, opts?)
Run a command synchronously. HTTP API →
Shell command
Timeout in seconds
Environment variables
Working directory
Promise<ProcessResult>
sandbox.exec.start(command, opts?)
Start a long-running command with streaming. HTTP API →
Command
Arguments
Environment variables
Working directory
Timeout in seconds
Seconds to keep running after disconnect
Stdout callback
Stderr callback
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.
Initial working directory
Initial environment variables
Promise<Shell>
Shell
| Member | Type | Description |
|---|---|---|
sessionId | string | Underlying exec session ID |
run(cmd, opts?) | Promise<ProcessResult> | Run a command, blocking until it exits |
close() | Promise<void> | Write exit and wait for bash to terminate |
ShellRunOpts
| Parameter | Type | Description |
|---|---|---|
onStdout | (data: Uint8Array) => void | Per-call stdout callback |
onStderr | (data: Uint8Array) => void | Per-call stderr callback |
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.
Session ID
Stdout callback
Stderr callback
Exit callback
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
| Member | Type | Description |
|---|---|---|
sessionId | string | Session ID |
done | Promise<number> | Resolves with exit code |
sendStdin(data) | method | Send input (string or Uint8Array) |
kill(signal?) | Promise<void> | Kill process |
close() | method | Close WebSocket |
Types
ProcessResult
ProcessResult
ExecSessionInfo
ExecSessionInfo