Commands and processes
Run commands, stream their output, drive PTYs and terminals, and manage background processes.
Every method shows the same operation in each SDK; pick a language once and every tab on the site follows it.
ProcessClient
Section titled “ProcessClient”An authenticated ProcessService connection. Close it when no longer needed.
connect()
Section titled “connect()”def connect(self, pid: int, *, from_start: bool=False) -> Iterator[pb.ProcessEvent]Events of a running process from now on, reattached from the offsets seen if the connection breaks.
With from_start=True the output the guest still holds (the last 256 KiB of each stream) is replayed first, so a process that wrote before this call (a shell prompt, the echo of a command) is not missed.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
from_start |
bool |
False |
Returns Iterator[pb.ProcessEvent]
sdk/python/svm/process.py:512async connect(pid: number, onStdout?: (chunk: string) => void, onStderr?: (chunk: string) => void, options: { fromStart?: boolean; onBytes?: (chunk: Uint8Array) => void } = {}): Promise<ProcessResult>| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
onStdout |
(chunk: string) => void |
optional |
onStderr |
(chunk: string) => void |
optional |
options |
{ fromStart?: boolean; onBytes?: (chunk: Uint8Array) => void } |
{} |
Returns Promise<ProcessResult>
sdk/typescript/src/process.ts:42func (p *ProcessClient) Connect(ctx context.Context, pid uint32, onStdout, onStderr func([]byte)) (ProcessResult, error)Connect streams output and completion for an existing process.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
onStdout |
func([]byte) |
|
onStderr |
func([]byte) |
Returns (ProcessResult, error)
sdk/go/process.go:322def connect(pid, from_start: false, on_stdout: nil, on_stderr: nil)Streams output and completion for an existing process; from_start replays what the guest still holds first.
| Parameter | Type | Default |
|---|---|---|
pid |
||
from_start |
false |
|
on_stdout |
nil |
|
on_stderr |
nil |
sdk/ruby/lib/svm/envd_clients.rb:78public ProcessResult connect(long pid)public ProcessResult connect(long pid, boolean fromStart, Consumer<byte[]> onStdout, Consumer<byte[]> onStderr)Streams output and completion for an existing process; fromStart replays what the guest still holds first.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
fromStart |
boolean |
optional |
onStdout |
Consumer<byte[]> |
optional |
onStderr |
Consumer<byte[]> |
optional |
Returns ProcessResult
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:150list()
Section titled “list()”def list(self) -> list[ProcessInfo]Returns list[ProcessInfo]
sdk/python/svm/process.py:438async list(): Promise<ProcessInfo[]>Returns Promise<ProcessInfo[]>
sdk/typescript/src/process.ts:31func (p *ProcessClient) List(ctx context.Context) ([]ProcessInfo, error)List returns running process metadata without output or environment values.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns ([]ProcessInfo, error)
sdk/go/process.go:305def listsdk/ruby/lib/svm/envd_clients.rb:71public List<ProcessInfo> list()Returns List<ProcessInfo>
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:139close()
Section titled “close()”def close(self) -> NoneClose the channel; a later call on this client opens a new one. A connect in flight ends (its iterator stops) and does not reconnect; a run in flight raises ProcessError.
Raises ProcessError
sdk/python/svm/process.py:272async close(): Promise<void>Close the gRPC channel. The client stays usable: the next call opens a new channel (the sandbox caches this client, so a closed channel kept here would break sandbox.commands and sandbox.pty for good).
sdk/typescript/src/process.ts:48func (p *ProcessClient) Close() errorClose releases the data-plane transport this client shares with the sandbox’s other clients; the next call on any of them opens a new one. It does not end any process.
Returns error
sdk/go/process.go:431def closeEnds this client’s calls in flight: a #run or #connect in another thread raises ProcessError CANCELLED promptly and does not reconnect. A later call opens a new connection.
Raises ProcessError
sdk/ruby/lib/svm/envd_clients.rb:66public void close()Releases the data-plane connections; a later call on this client opens new ones.
Source:sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:38close_stdin()
Section titled “close_stdin()”def close_stdin(self, pid: int) -> NoneSend EOF to a process’s stdin.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
sdk/python/svm/process.py:474async closeStdin(pid: number): Promise<void>| Parameter | Type | Default |
|---|---|---|
pid |
number |
sdk/typescript/src/process.ts:35func (p *ProcessClient) CloseStdin(ctx context.Context, pid uint32) errorCloseStdin sends EOF to a process.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
Returns error
sdk/go/process.go:399def close_stdin(pid)| Parameter | Type | Default |
|---|---|---|
pid |
sdk/ruby/lib/svm/envd_clients.rb:106public void closeStdin(long pid)| Parameter | Type | Default |
|---|---|---|
pid |
long |
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:187connect_from_start()
Section titled “connect_from_start()”Not in the Python SDK’s ProcessClient.
Not in the TypeScript SDK’s ProcessClient.
func (p *ProcessClient) ConnectFromStart(ctx context.Context, pid uint32, onStdout, onStderr func([]byte)) (ProcessResult, error)ConnectFromStart is Connect that first replays the output the guest still holds (the last 256 KiB of each stream), so a process that wrote before this call (a prompt, the echo of a command, all of a short program’s output) is not missed.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
onStdout |
func([]byte) |
|
onStderr |
func([]byte) |
Returns (ProcessResult, error)
sdk/go/process.go:328Not in the Ruby SDK’s ProcessClient.
Not in the Java SDK’s ProcessClient.
constructor()
Section titled “constructor()”Not in the Python SDK’s ProcessClient.
constructor(private readonly access: SandboxAccess | AccessHandle, private readonly allowInsecureHttp = false, private readonly retry?: RetryPolicy, private readonly guestOs: "linux" | "windows" = "linux")| Parameter | Type | Default |
|---|---|---|
access |
SandboxAccess | AccessHandle |
|
allowInsecureHttp |
boolean |
false |
retry |
RetryPolicy |
optional |
guestOs |
"linux" | "windows" |
"linux" |
sdk/typescript/src/process.ts:14Not in the Go SDK’s ProcessClient.
Not in the Ruby SDK’s ProcessClient.
Not in the Java SDK’s ProcessClient.
initialize()
Section titled “initialize()”Not in the Python SDK’s ProcessClient.
Not in the TypeScript SDK’s ProcessClient.
Not in the Go SDK’s ProcessClient.
def initialize(channel)| Parameter | Type | Default |
|---|---|---|
channel |
sdk/ruby/lib/svm/envd_clients.rb:11Not in the Java SDK’s ProcessClient.
kill()
Section titled “kill()”def kill(self, pid: int) -> boolSIGKILL a process; False when it was not found or had already exited.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
Returns bool
sdk/python/svm/process.py:452async kill(pid: number): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
pid |
number |
Returns Promise<boolean>
sdk/typescript/src/process.ts:32func (p *ProcessClient) Kill(ctx context.Context, pid uint32) (bool, error)Kill terminates a process with SIGKILL. It reports whether the process was found: false with a nil error is a process that was already gone.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
Returns (bool, error)
sdk/go/process.go:409def kill(pid)Sends SIGKILL; true when the process was running, false when it had already exited or is unknown (as Python’s).
| Parameter | Type | Default |
|---|---|---|
pid |
sdk/ruby/lib/svm/envd_clients.rb:112public boolean kill(long pid)Sends SIGKILL; true when the process was running, false (never an exception) when it had already exited or is unknown.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:190def run(self, command: str, *, background: bool=False, on_stdout: Callable[[str], None] | None=None, on_stderr: Callable[[str], None] | None=None, cwd: str | None=None, envs: dict[str, str] | None=None, user: str | None=None, timeout_seconds: int=0, tag: str | None=None, stdin: str | bytes | None=None, sandbox_profile: str | None=None) -> ProcessResult | CommandHandledef run(self, command: str, *, background: Literal[False]=False, on_stdout: Callable[[str], None] | None=None, on_stderr: Callable[[str], None] | None=None, cwd: str | None=None, envs: dict[str, str] | None=None, user: str | None=None, timeout_seconds: int=0, tag: str | None=None, stdin: str | bytes | None=None, sandbox_profile: str | None=None) -> ProcessResultdef run(self, command: str, *, background: Literal[True], on_stdout: Callable[[str], None] | None=None, on_stderr: Callable[[str], None] | None=None, cwd: str | None=None, envs: dict[str, str] | None=None, user: str | None=None, timeout_seconds: int=0, tag: str | None=None, stdin: str | bytes | None=None, sandbox_profile: str | None=None) -> CommandHandleRun command through the sandbox’s login shell and return its result, or (background=True) a CommandHandle on the started command: its pid, wait(), disconnect(), kill(), send_stdin, close_stdin and its output events by iteration. With on_stdout / on_stderr a background command’s output is fed to them from a background thread.
sandbox_profile confines the command and its children with Landlock inside the microVM: "read-only", "workspace-only" (read-write in cwd, read-only system paths) or "workspace-offline" (that, and no TCP connect or listen). A kernel that cannot enforce it refuses the command with an error; it never runs unconfined.
stdin feeds the process and, for a foreground command, closes its stdin; for a background one it is what the process reads first and its stdin stays open (stdin="" just opens it) for send_stdin, stream_input and close_stdin. Without stdin the process’s stdin is closed. timeout_seconds kills the process; the result then has timed_out.
| Parameter | Type | Default |
|---|---|---|
command |
str |
|
background |
bool |
False |
on_stdout |
Callable[[str], None] | None |
None |
on_stderr |
Callable[[str], None] | None |
None |
cwd |
str | None |
None |
envs |
dict[str, str] | None |
None |
user |
str | None |
None |
timeout_seconds |
int |
0 |
tag |
str | None |
None |
stdin |
str | bytes | None |
None |
sandbox_profile |
str | None |
None |
Returns ProcessResult \| CommandHandle
sdk/python/svm/process.py:344run(command: string, options: RunOptions & { background: true }): Promise<CommandHandle>run(command: string, options?: RunOptions & { background?: false }): Promise<ProcessResult>run(command: string, options?: RunOptions): Promise<ProcessResult | CommandHandle>Run command through the sandbox’s login shell and resolve to its result, or (background: true) to a CommandHandle on the started command: its pid, wait(), disconnect(), kill(), sendStdin, closeStdin and its events by for await.
| Parameter | Type | Default |
|---|---|---|
command |
string |
|
options |
RunOptions & { background: true } |
Returns Promise<CommandHandle>
sdk/typescript/src/process.ts:25func (p *ProcessClient) Run(ctx context.Context, command string, options RunOptions) (ProcessResult, error)Run executes a login-shell command and returns its result. With Background it returns at the start event, and the result’s Handle acts on the running command (Wait, Disconnect, Kill, SendStdin, CloseStdin, Events); OnStdout and OnStderr then get its output from a goroutine until it ends or the handle disconnects.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
command |
string |
|
options |
RunOptions |
Returns (ProcessResult, error)
sdk/go/process.go:160def run(command, background: false, cwd: nil, envs: nil, user: nil, sandbox_profile: nil, timeout_seconds: 0, tag: nil, stdin: nil, on_stdout: nil, on_stderr: nil)Runs a login-shell command and returns its ProcessResult, or (+background: true+) a CommandHandle on the started command: its pid, #wait, #disconnect, #kill, #send_stdin, #close_stdin and its events by #each. With on_stdout / on_stderr a background command’s output goes to them from a background thread.
| Parameter | Type | Default |
|---|---|---|
command |
||
background |
false |
|
cwd |
nil |
|
envs |
nil |
|
user |
nil |
|
sandbox_profile |
nil |
|
timeout_seconds |
0 |
|
tag |
nil |
|
stdin |
nil |
|
on_stdout |
nil |
|
on_stderr |
nil |
sdk/ruby/lib/svm/envd_clients.rb:18public ProcessResult run(String command)public ProcessResult run(String command, RunOptions o)Runs a login-shell command and returns its result. A background command returns at its start event with ProcessResult.handle acting on it (waitFor, disconnect, kill, sendStdin, closeStdin, iteration over its events); onStdout / onStderr then get its output from a background thread.
| Parameter | Type | Default |
|---|---|---|
command |
String |
|
o |
RunOptions |
optional |
Returns ProcessResult
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:40send_stdin()
Section titled “send_stdin()”def send_stdin(self, pid: int, data: str | bytes) -> None| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
data |
str | bytes |
sdk/python/svm/process.py:499async sendStdin(pid: number, data: string | Uint8Array): Promise<void>| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
data |
string | Uint8Array |
sdk/typescript/src/process.ts:39func (p *ProcessClient) SendStdin(ctx context.Context, pid uint32, data []byte) errorSendStdin writes one bounded stdin chunk.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
data |
[]byte |
Returns error
sdk/go/process.go:384def send_stdin(pid, data)| Parameter | Type | Default |
|---|---|---|
pid |
||
data |
sdk/ruby/lib/svm/envd_clients.rb:101public void sendStdin(long pid, byte[] data)| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
data |
byte[] |
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:183signal()
Section titled “signal()”def signal(self, pid: int, name: str | int='TERM') -> boolSend a signal ("TERM", "SIGTERM", "SIGNAL_SIGTERM" or "term"; also INT, HUP, USR1, USR2, STOP, CONT, KILL) to a process; False when it was not found or had already exited. kill is signal(pid, "KILL").
| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
name |
str | int |
'TERM' |
Returns bool
sdk/python/svm/process.py:456async signal(pid: number, signal: Parameters<NodeProcessClient["signal"]>[1]): Promise<boolean>Send a signal: SIGTERM asks a process to stop (kill is SIGKILL); false when it was not found or had already exited.
| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
signal |
Parameters<NodeProcessClient["signal"]>[1] |
Returns Promise<boolean>
sdk/typescript/src/process.ts:34func (p *ProcessClient) Signal(ctx context.Context, pid uint32, signal envdv1.Signal) errorSignal sends one of the envd signal values.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
signal |
envdv1.Signal |
Returns error
sdk/go/process.go:419def signal(pid, name)Sends a signal (TERM, SIGTERM, SIGNAL_SIGTERM, 15 …); true when the process was running, false when it had already exited or is unknown (as Python’s).
| Parameter | Type | Default |
|---|---|---|
pid |
||
name |
sdk/ruby/lib/svm/envd_clients.rb:133public boolean signal(long pid, String name)Sends a signal (TERM, SIGTERM, SIGNAL_SIGTERM …); false when the process had already exited or is unknown, as Python’s signal.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
name |
String |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:207stream_input()
Section titled “stream_input()”def stream_input(self, pid: int, chunks: 'Iterable[str | bytes]') -> NoneSend stdin as one client stream: each chunk is a message, and the stream ends when chunks does.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
chunks |
'Iterable[str | bytes]' |
sdk/python/svm/process.py:478async streamInput(pid: number, chunks: AsyncIterable<string | Uint8Array> | Iterable<string | Uint8Array>): Promise<void>| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
chunks |
AsyncIterable<string | Uint8Array> | Iterable<string | Uint8Array> |
sdk/typescript/src/process.ts:36func (p *ProcessClient) StreamInput(ctx context.Context, pid uint32, r io.Reader) errorStreamInput sends stdin as one client stream: everything r gives, in chunks of at most 1 MiB, then EOF on the stream.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
r |
io.Reader |
Returns error
sdk/go/envd_extra.go:207def stream_input(pid, source)Sends the chunks of an IO (or String) to a process’s stdin as one client stream.
| Parameter | Type | Default |
|---|---|---|
pid |
||
source |
sdk/ruby/lib/svm/envd_clients.rb:142public void streamInput(long pid, InputStream source) throws IOExceptionSends the bytes of a stream to a process’s stdin as one client stream.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
source |
InputStream |
Raises IOException
sdk/java/src/main/java/dev/svm/sandbox/ProcessClient.java:224CommandHandle
Section titled “CommandHandle”A background command started by run(..., background=True): its pid and the calls that act on it.
wait() follows the command to its end and returns its ProcessResult; iterating the handle yields its output events (both replay what the guest still holds from the start). disconnect() stops following without killing the command; a later wait() or iteration follows it again. kill(), send_stdin(data) and close_stdin() act on the command itself.
Properties
Section titled “Properties”Python exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
pid |
number |
| Property | Type | Description |
|---|---|---|
PID |
uint32 |
| Property | Type | Description |
|---|---|---|
pid |
| Property | Type | Description |
|---|---|---|
pid |
long |
The data plane’s handle of the process, as ProcessResult.pid. |
close_stdin()
Section titled “close_stdin()”def close_stdin(self) -> NoneSend EOF to the command’s stdin.
Source:sdk/python/svm/process.py:229closeStdin(): Promise<void>Send EOF to the command’s stdin.
Source:sdk/typescript/src/process-node.ts:118func (h *CommandHandle) CloseStdin(ctx context.Context) errorCloseStdin sends EOF to the command’s stdin.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns error
sdk/go/handle.go:130def close_stdinSends EOF to the command’s stdin.
Source:sdk/ruby/lib/svm/envd_clients.rb:323public void closeStdin()Sends EOF to the command’s stdin.
Source:sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:95disconnect()
Section titled “disconnect()”def disconnect(self) -> NoneStop following the command (its callbacks, a wait() and any iteration end) without killing it. A later wait() or iteration follows it again.
sdk/python/svm/process.py:212disconnect(): voidStop following the command (its callbacks, a wait() and any iteration end) without killing it.
sdk/typescript/src/process-node.ts:106func (h *CommandHandle) Disconnect()Disconnect stops following the command (its callbacks, a Wait and any Events loop end) without killing it.
Source:sdk/go/handle.go:108def disconnectStops following the command (its callbacks, a #wait and any #each end) without killing it.
Source:sdk/ruby/lib/svm/envd_clients.rb:303public void disconnect()Stops following the command (its callbacks, a waitFor and any iteration end) without killing it.
Source:sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:79each()
Section titled “each()”Not in the Python SDK’s CommandHandle.
Not in the TypeScript SDK’s CommandHandle.
Not in the Go SDK’s CommandHandle.
def eachYields the command’s events (Hashes with “start”, “data” or “end”) from the start until it ends; without a block, an Enumerator.
Source:sdk/ruby/lib/svm/envd_clients.rb:277Not in the Java SDK’s CommandHandle.
events()
Section titled “events()”Not in the Python SDK’s CommandHandle.
Not in the TypeScript SDK’s CommandHandle.
func (h *CommandHandle) Events(ctx context.Context) iter.Seq2[*envdv1.ProcessEvent, error]Events yields the command’s stream events from the start (its start event, output chunks, then its end) until it ends, the loop breaks, ctx is done or Disconnect is called. A failure is yielded once with a nil event.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns iter.Seq2[*envdv1.ProcessEvent, error]
sdk/go/handle.go:92Not in the Ruby SDK’s CommandHandle.
Not in the Java SDK’s CommandHandle.
initialize()
Section titled “initialize()”Not in the Python SDK’s CommandHandle.
Not in the TypeScript SDK’s CommandHandle.
Not in the Go SDK’s CommandHandle.
def initialize(process, pid, stream: nil, stream_result: nil, ended: nil)| Parameter | Type | Default |
|---|---|---|
process |
||
pid |
||
stream |
nil |
|
stream_result |
nil |
|
ended |
nil |
sdk/ruby/lib/svm/envd_clients.rb:245Not in the Java SDK’s CommandHandle.
iterator()
Section titled “iterator()”Not in the Python SDK’s CommandHandle.
Not in the TypeScript SDK’s CommandHandle.
Not in the Go SDK’s CommandHandle.
Not in the Ruby SDK’s CommandHandle.
public Iterator<Map<String, Object>> iterator()The command’s events (maps with “start”, “data” or “end”) from the start until it ends, read by a background thread. Stopping early needs disconnect, which also ends the iteration.
Returns Iterator<Map<String, Object>>
Raises SandboxException
sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:101kill()
Section titled “kill()”def kill(self) -> boolSIGKILL the command; False when it had already exited.
Returns bool
sdk/python/svm/process.py:221kill(): Promise<boolean>SIGKILL the command; false when it had already exited.
Returns Promise<boolean>
sdk/typescript/src/process-node.ts:112func (h *CommandHandle) Kill(ctx context.Context) (bool, error)Kill ends the command with SIGKILL; false with a nil error when it had already exited.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns (bool, error)
sdk/go/handle.go:122def killSends SIGKILL; true when the command was running, false when it had already exited.
Source:sdk/ruby/lib/svm/envd_clients.rb:313public boolean kill()Sends SIGKILL; true when the command was running, false when it had already exited.
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:89send_stdin()
Section titled “send_stdin()”def send_stdin(self, data: str | bytes) -> NoneWrite data to the command’s stdin (start it with stdin="" to keep stdin open).
| Parameter | Type | Default |
|---|---|---|
data |
str | bytes |
sdk/python/svm/process.py:225sendStdin(data: string | Uint8Array): Promise<void>Write data to the command’s stdin (start it with stdin: "" to keep stdin open).
| Parameter | Type | Default |
|---|---|---|
data |
string | Uint8Array |
sdk/typescript/src/process-node.ts:115func (h *CommandHandle) SendStdin(ctx context.Context, data []byte) errorSendStdin writes data to the command’s stdin (start it with a non-nil Stdin to keep stdin open).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
data |
[]byte |
Returns error
sdk/go/handle.go:125def send_stdin(data)Writes data to the command’s stdin (start it with +stdin: “”+ to keep stdin open).
| Parameter | Type | Default |
|---|---|---|
data |
sdk/ruby/lib/svm/envd_clients.rb:318public void sendStdin(byte[] data)Writes data to the command’s stdin (start it with stdin(new byte[0]) to keep stdin open).
| Parameter | Type | Default |
|---|---|---|
data |
byte[] |
sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:92wait()
Section titled “wait()”def wait(self) -> ProcessResultFollow the command until it ends and return its result: the output (replayed from the start, as far as the guest still holds it), exit code and signal. With callbacks this is what they were fed. A disconnect() while waiting returns what was seen so far, without an exit code.
Returns ProcessResult
sdk/python/svm/process.py:195async wait(): Promise<ProcessResult>Follow the command until it ends and resolve to its result: the output (from the start, as far as the guest still holds it), exit code and signal. With onStdout / onStderr this is what they were fed. A disconnect() while waiting resolves to what was seen so far, without an exit code.
Returns Promise<ProcessResult>
sdk/typescript/src/process-node.ts:90func (h *CommandHandle) Wait(ctx context.Context) (ProcessResult, error)Wait follows the command until it ends and returns its result: the output (from the start, as far as the guest still holds it), exit code and signal. With OnStdout or OnStderr this is what they were fed. A Disconnect while waiting returns what was seen so far, with Exited false and a nil error.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns (ProcessResult, error)
sdk/go/handle.go:64def waitFollows the command until it ends and returns its result: the output (from the start, as far as the guest still holds it), exit code and signal. With callbacks this is what they were fed. A #disconnect while waiting returns what was seen so far (exited false).
sdk/ruby/lib/svm/envd_clients.rb:259Not in the Java SDK’s CommandHandle.
wait_for()
Section titled “wait_for()”Not in the Python SDK’s CommandHandle.
Not in the TypeScript SDK’s CommandHandle.
Not in the Go SDK’s CommandHandle.
Not in the Ruby SDK’s CommandHandle.
public ProcessResult waitFor()Follows the command until it ends and returns its result: the output (from the start, as far as the guest still holds it), exit code and signal. With onStdout / onStderr this is what they were fed. A disconnect while waiting returns what was seen so far, with exited false.
Returns ProcessResult
sdk/java/src/main/java/dev/svm/sandbox/CommandHandle.java:54ProcessResult
Section titled “ProcessResult”The outcome of a command, or the start of a background command or PTY. pid is envd’s process handle (small numbers such as 1, 4, 6), the value kill, connect, send_stdin and the PTY calls take; it is not the guest kernel’s pid (run echo $$ in the command for that).
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
error |
str |
|
exit_code |
int | None |
|
output_dropped |
bool |
|
pid |
int |
|
signal |
str |
|
timed_out |
bool |
| Property | Type | Description |
|---|---|---|
error |
string |
What the server says about the end: “timeout” (killed for its time limit) or “output overrun: …” (bytes were dropped, so stdout and stderr are incomplete). Absent for an ordinary end. |
exitCode |
number |
|
pid |
number |
The envd process handle that kill, signal, sendStdin, connect and the PTY calls take: small numbers envd hands out (1, 4, 6 …), not the guest kernel’s pid of the process. |
signal |
string |
| Property | Type | Description |
|---|---|---|
Error |
string |
|
ExitCode |
int32 |
|
Exited |
bool |
|
Handle |
*CommandHandle |
Handle is the background command a Run with Background started (nil otherwise): Wait, Disconnect, Kill, SendStdin, CloseStdin and Events act on it. |
PID |
uint32 |
|
Signal |
string |
| Property | Type | Description |
|---|---|---|
error |
||
exited |
||
pid |
||
signal |
| Property | Type | Description |
|---|---|---|
error |
String |
|
exitCode |
int |
|
exited |
boolean |
|
handle |
CommandHandle |
The background command a run with background(true) started (null otherwise): CommandHandle.waitFor, disconnect, kill, sendStdin, closeStdin and its events by iteration act on it. |
pid |
long |
The data plane’s handle of the process (what connect, kill and sendStdin take), not the guest’s pid. |
signal |
String |
|
stderrBytes |
ByteArrayOutputStream |
|
stdoutBytes |
ByteArrayOutputStream |
stderr()
Section titled “stderr()”stderr: strProperty (read-only).
stderr: stringProperty.
Stderr: []byteProperty.
Not in the Ruby SDK’s ProcessResult.
public String stderr()Returns String
sdk/java/src/main/java/dev/svm/sandbox/ProcessResult.java:43stdout()
Section titled “stdout()”stdout: strProperty (read-only).
stdout: stringProperty.
Stdout: []byteProperty.
Not in the Ruby SDK’s ProcessResult.
public String stdout()Returns String
sdk/java/src/main/java/dev/svm/sandbox/ProcessResult.java:42success()
Section titled “success()”Not in the Python SDK’s ProcessResult.
Not in the TypeScript SDK’s ProcessResult.
Not in the Go SDK’s ProcessResult.
def success?ResultSource: sdk/ruby/lib/svm/sandbox.rb:328public boolean success()Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/ProcessResult.java:44ProcessInfo
Section titled “ProcessInfo”ProcessInfo is a running process returned by ProcessService.List.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
args |
tuple[str, ...] |
|
cmd |
str |
|
pid |
int |
|
tag |
str | None |
| Property | Type | Description |
|---|---|---|
args |
string[] |
|
cmd |
string |
|
pid |
number |
The envd process handle (see ProcessResult.pid), not the guest kernel’s pid. |
tag |
string |
| Property | Type | Description |
|---|---|---|
Args |
[]string |
|
Command |
string |
|
PID |
uint32 |
|
Tag |
string |
| Property | Type | Description |
|---|---|---|
args |
||
command |
||
pid |
||
tag |
| Property | Type | Description |
|---|---|---|
args |
List<String> |
|
command |
String |
|
pid |
long |
|
tag |
String |
ProcessError
Section titled “ProcessError”Typed envd failure; branch on code rather than the message. A SandboxError like every other error this package raises, so one except SandboxError covers a refused file write, a refused command and an API failure.
A data-plane failure is also the REST error of the same cause: a missing path or process is a NotFoundError (and error_kind says not_found), a refused one a PermissionDeniedError, and so on by its gRPC status.
Properties
Section titled “Properties”Python exposes these as methods; see below.
| Property | Type | Description |
|---|---|---|
code |
string |
|
status |
number |
| Property | Type | Description |
|---|---|---|
Code |
string |
|
Details |
map[string]string |
|
GRPCCode |
codes.Code |
|
Message |
string |
| Property | Type | Description |
|---|---|---|
code |
||
details |
||
grpc_code |
Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s ProcessError.
constructor(readonly code: string, message: string, readonly status: number, reason?: string)reason is what the server names in x-envd-reason (FILE_UPLOAD_FAILED: the file written is not the size sent; CON-005-0100).
| Parameter | Type | Default |
|---|---|---|
code |
string |
|
message |
string |
|
status |
number |
|
reason |
string |
optional |
sdk/typescript/src/process-error.ts:13Not in the Go SDK’s ProcessError.
Not in the Ruby SDK’s ProcessError.
Not in the Java SDK.
error()
Section titled “error()”Not in the Python SDK’s ProcessError.
Not in the TypeScript SDK’s ProcessError.
func (e *ProcessError) Error() stringReturns string
sdk/go/process.go:22Not in the Ruby SDK’s ProcessError.
Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s ProcessError.
Not in the TypeScript SDK’s ProcessError.
Not in the Go SDK’s ProcessError.
def initialize(code, message, grpc_code: code, details: nil)| Parameter | Type | Default |
|---|---|---|
code |
||
message |
||
grpc_code |
code |
|
details |
nil |
sdk/ruby/lib/svm/envd.rb:15Not in the Java SDK.
Not in the Python SDK’s ProcessError.
Not in the TypeScript SDK’s ProcessError.
func (e *ProcessError) Is(target error) boolIs makes errors.Is(err, svm.ErrNotFound) and its siblings match a data-plane failure by its gRPC status, as for the REST error of the same cause (a missing path or process is ErrNotFound, and ErrorKind says not_found). The ProcessError keeps the envd code and message. A missing path (ERROR_CODE_PATH_NOT_FOUND) is also ErrFileNotFound and a full disk (ERROR_CODE_DISK_FULL) ErrNotEnoughSpace and ErrQuotaExceeded. The server’s reason GUEST_UNRESPONSIVE makes it ErrGuestUnresponsive.
| Parameter | Type | Default |
|---|---|---|
target |
error |
Returns bool
Raises ErrFileNotFound, ErrGuestUnresponsive, ErrNotEnoughSpace, ErrNotFound, ErrQuotaExceeded, ProcessError
sdk/go/process.go:39Not in the Ruby SDK’s ProcessError.
Not in the Java SDK.
unwrap()
Section titled “unwrap()”Not in the Python SDK’s ProcessError.
Not in the TypeScript SDK’s ProcessError.
func (e *ProcessError) Unwrap() errorUnwrap lets errors.Is match the context errors a gRPC deadline or cancellation stands for.
Returns error
sdk/go/process.go:25Not in the Ruby SDK’s ProcessError.
Not in the Java SDK.
PtyClient
Section titled “PtyClient”PTY surface sharing an authenticated ProcessService client.
connect()
Section titled “connect()”def connect(self, pid: int, *, from_start: bool=False) -> Iterator[pb.ProcessEvent]Events of the terminal from now on; from_start=True replays the output the guest still holds first.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
from_start |
bool |
False |
Returns Iterator[pb.ProcessEvent]
sdk/python/svm/pty_client.py:47connect(pid: number, onData?: (chunk: string) => void, options: { fromStart?: boolean; onBytes?: (chunk: Uint8Array) => void } = {}): Promise<ProcessResult>Follow the terminal until it ends. fromStart replays the output the guest still holds; onBytes gets the raw output bytes.
| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
onData |
(chunk: string) => void |
optional |
options |
{ fromStart?: boolean; onBytes?: (chunk: Uint8Array) => void } |
{} |
Returns Promise<ProcessResult>
sdk/typescript/src/process.ts:74func (t *PtyClient) Connect(ctx context.Context, pid uint32, onData func([]byte)) (ProcessResult, error)Connect streams a terminal’s output to onData until it ends.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
onData |
func([]byte) |
Returns (ProcessResult, error)
sdk/go/pty.go:25def connect(pid, from_start: false, on_data: nil)Follows the terminal until its process ends and returns the ProcessResult (its output and exit code); on_data gets each chunk as it arrives. from_start replays the output the guest still holds first.
| Parameter | Type | Default |
|---|---|---|
pid |
||
from_start |
false |
|
on_data |
nil |
sdk/ruby/lib/svm/envd_clients.rb:755public ProcessResult connect(long pid, boolean fromStart, Consumer<byte[]> onData)Streams the terminal’s output to onData until the shell ends; fromStart replays what the guest still holds first.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
fromStart |
boolean |
|
onData |
Consumer<byte[]> |
Returns ProcessResult
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:82create()
Section titled “create()”def create(self, command: str | None=None, *, cols: int=80, rows: int=24, args: list[str] | None=None, cwd: str | None=None, envs: dict[str, str] | None=None, user: str | None=None, on_data: Callable[[str], None] | None=None, sandbox_profile: str | None=None) -> 'ProcessResult'Start command (the guest’s shell by default) in a cols x rows terminal and return once the process has started: the result carries the pid (the envd process handle) and no output or exit code, since a terminal runs until it is ended. Output arrives through on_data (called from a background thread) or connect(pid); send keys with send_input and end it with kill. Without on_data the output written before you connect is replayed by connect(pid, from_start=True).
| Parameter | Type | Default |
|---|---|---|
command |
str | None |
None |
cols |
int |
80 |
rows |
int |
24 |
args |
list[str] | None |
None |
cwd |
str | None |
None |
envs |
dict[str, str] | None |
None |
user |
str | None |
None |
on_data |
Callable[[str], None] | None |
None |
sandbox_profile |
str | None |
None |
Returns 'ProcessResult'
sdk/python/svm/pty_client.py:22async create(options: PtyOptions = {}): Promise<ProcessResult>Start a terminal (a login shell unless command says otherwise); resolves to it with its pid once it has started.
| Parameter | Type | Default |
|---|---|---|
options |
PtyOptions |
{} |
Returns Promise<ProcessResult>
sdk/typescript/src/process.ts:59func (t *PtyClient) Create(ctx context.Context, options PTYOptions) (ProcessResult, error)Create starts options.Command (/bin/bash by default) in a Cols x Rows terminal (80 x 24 by default) and returns as soon as it runs, with its PID; use Connect for its output and SendInput to type into it.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
options |
PTYOptions |
Returns (ProcessResult, error)
sdk/go/pty.go:58def create(command = "/bin/bash", cols: 80, rows: 24, args: nil, cwd: nil, envs: nil, user: nil, sandbox_profile: nil, tag: nil, on_data: nil)Starts command (a login shell by default) on a cols x rows terminal and returns a ProcessResult with its pid at once. With on_data the terminal’s output goes to it (a UTF-8 String per chunk) from a background thread; otherwise read it with #connect.
| Parameter | Type | Default |
|---|---|---|
command |
"/bin/bash" |
|
cols |
80 |
|
rows |
24 |
|
args |
nil |
|
cwd |
nil |
|
envs |
nil |
|
user |
nil |
|
sandbox_profile |
nil |
|
tag |
nil |
|
on_data |
nil |
Raises SandboxError
sdk/ruby/lib/svm/envd_clients.rb:706public ProcessResult create(int cols, int rows, Consumer<byte[]> onData)public ProcessResult create(int cols, int rows, String cwd, Map<String, String> envs, String user, Consumer<byte[]> onData)create(int, int, String, Map, Consumer) with the default directory and environment.
| Parameter | Type | Default |
|---|---|---|
cols |
int |
|
rows |
int |
|
cwd |
String |
|
envs |
Map<String, String> |
optional |
user |
String |
optional |
onData |
Consumer<byte[]> |
optional |
Returns ProcessResult
Raises SandboxException
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:23close()
Section titled “close()”def close(self) -> Nonesdk/python/svm/pty_client.py:51close(): Promise<void>sdk/typescript/src/process.ts:77func (t *PtyClient) Close() errorClose releases the data-plane transport (see ProcessClient.Close).
Returns error
sdk/go/pty.go:41def closeEnds this client’s calls in flight (an output follower included); a later call opens a new connection.
Source:sdk/ruby/lib/svm/envd_clients.rb:781public void close()Releases the data-plane connections; a later call opens new ones.
Source:sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:100connect_from_start()
Section titled “connect_from_start()”Not in the Python SDK’s PtyClient.
Not in the TypeScript SDK’s PtyClient.
func (t *PtyClient) ConnectFromStart(ctx context.Context, pid uint32, onData func([]byte)) (ProcessResult, error)ConnectFromStart is Connect that first replays the output the guest still holds (the last 256 KiB), so the prompt and anything written before this call is not missed.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
onData |
func([]byte) |
Returns (ProcessResult, error)
sdk/go/pty.go:31Not in the Ruby SDK’s PtyClient.
Not in the Java SDK’s PtyClient.
constructor()
Section titled “constructor()”Not in the Python SDK’s PtyClient.
constructor(private readonly process: ProcessClient)| Parameter | Type | Default |
|---|---|---|
process |
ProcessClient |
sdk/typescript/src/process.ts:57Not in the Go SDK’s PtyClient.
Not in the Ruby SDK’s PtyClient.
Not in the Java SDK’s PtyClient.
initialize()
Section titled “initialize()”Not in the Python SDK’s PtyClient.
Not in the TypeScript SDK’s PtyClient.
Not in the Go SDK’s PtyClient.
def initialize(channel)| Parameter | Type | Default |
|---|---|---|
channel |
sdk/ruby/lib/svm/envd_clients.rb:699Not in the Java SDK’s PtyClient.
kill()
Section titled “kill()”def kill(self, pid: int) -> bool| Parameter | Type | Default |
|---|---|---|
pid |
int |
Returns bool
sdk/python/svm/pty_client.py:44async kill(pid: number): Promise<boolean>Kill the terminal; false when it was not found or had already exited.
| Parameter | Type | Default |
|---|---|---|
pid |
number |
Returns Promise<boolean>
sdk/typescript/src/process.ts:72func (t *PtyClient) Kill(ctx context.Context, pid uint32) (bool, error)Kill ends a terminal’s process with SIGKILL and reports whether it was found.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
Returns (bool, error)
sdk/go/pty.go:36def kill(pid)Sends SIGKILL; true when the process was running, false when it had already exited or is unknown.
| Parameter | Type | Default |
|---|---|---|
pid |
sdk/ruby/lib/svm/envd_clients.rb:776public boolean kill(long pid)| Parameter | Type | Default |
|---|---|---|
pid |
long |
Returns boolean
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:97resize()
Section titled “resize()”def resize(self, pid: int, *, cols: int, rows: int) -> None| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
cols |
int |
|
rows |
int |
sdk/python/svm/pty_client.py:33async resize(pid: number, cols: number, rows: number): Promise<void>| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
cols |
number |
|
rows |
number |
sdk/typescript/src/process.ts:60func (t *PtyClient) Resize(ctx context.Context, pid, cols, rows uint32) errorResize changes the terminal dimensions.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
cols |
uint32 |
|
rows |
uint32 |
Returns error
sdk/go/pty.go:108def resize(pid, cols:, rows:)| Parameter | Type | Default |
|---|---|---|
pid |
||
cols |
||
rows |
sdk/ruby/lib/svm/envd_clients.rb:769public void resize(long pid, int cols, int rows)| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
cols |
int |
|
rows |
int |
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:88send_input()
Section titled “send_input()”def send_input(self, pid: int, data: str | bytes) -> None| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
data |
str | bytes |
sdk/python/svm/pty_client.py:36async sendInput(pid: number, data: string | Uint8Array): Promise<void>| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
data |
string | Uint8Array |
sdk/typescript/src/process.ts:63func (t *PtyClient) SendInput(ctx context.Context, pid uint32, data []byte) errorSendInput writes input to the terminal.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
data |
[]byte |
Returns error
sdk/go/pty.go:121def send_input(pid, data)| Parameter | Type | Default |
|---|---|---|
pid |
||
data |
sdk/ruby/lib/svm/envd_clients.rb:759public void sendInput(long pid, byte[] data)| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
data |
byte[] |
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:84stream_input()
Section titled “stream_input()”def stream_input(self, pid: int, source: 'Iterable[str | bytes]') -> NoneSend keys to the terminal as one client stream: each chunk of source is a message, and the stream ends when it does. The bytes go to the terminal’s input (ProcessInput.pty), as send_input sends them.
| Parameter | Type | Default |
|---|---|---|
pid |
int |
|
source |
'Iterable[str | bytes]' |
sdk/python/svm/pty_client.py:39async streamInput(pid: number, source: AsyncIterable<string | Uint8Array> | Iterable<string | Uint8Array>): Promise<void>Send keys to the terminal as one client stream: each chunk of source is a message, and the stream ends when it does. The bytes go to the terminal’s input (ProcessInput.pty), as sendInput sends them.
| Parameter | Type | Default |
|---|---|---|
pid |
number |
|
source |
AsyncIterable<string | Uint8Array> | Iterable<string | Uint8Array> |
sdk/typescript/src/process.ts:68func (t *PtyClient) StreamInput(ctx context.Context, pid uint32, r io.Reader) errorStreamInput sends keys to the terminal as one client stream: everything r gives, in chunks of at most 1 MiB, to the terminal’s input (ProcessInput.pty, as SendInput sends it), then EOF on the stream.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
pid |
uint32 |
|
r |
io.Reader |
Returns error
sdk/go/pty.go:138def stream_input(pid, source)Sends the chunks of an IO (or String) to the terminal’s input (ProcessInput.pty, as #send_input sends it) as one client stream.
| Parameter | Type | Default |
|---|---|---|
pid |
||
source |
sdk/ruby/lib/svm/envd_clients.rb:765public void streamInput(long pid, java.io.InputStream source) throws java.io.IOExceptionSends the bytes of a stream to the terminal’s input (ProcessInput.pty, as sendInput sends them) as one client stream.
| Parameter | Type | Default |
|---|---|---|
pid |
long |
|
source |
java.io.InputStream |
Raises IOException
sdk/java/src/main/java/dev/svm/sandbox/PtyClient.java:95Terminals
Section titled “Terminals”Terminals are long-lived tmux sessions an agent can start, type into, read the screen of and wait on; they keep running when the client disconnects.
list()
Section titled “list()”def list(self) -> list[str]Returns list[str]
sdk/python/svm/terminals.py:86async list(): Promise<string[]>Returns Promise<string[]>
sdk/typescript/src/terminals.ts:80func (t *Terminals) List(ctx context.Context) ([]string, error)| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns ([]string, error)
sdk/go/guest_terminals.go:171def listsdk/ruby/lib/svm/guest_tools.rb:135Not in the Java SDK.
alive()
Section titled “alive()”Not in the Python SDK’s Terminals.
Not in the TypeScript SDK’s Terminals.
Not in the Go SDK’s Terminals.
def alive?(name)| Parameter | Type | Default |
|---|---|---|
name |
sdk/ruby/lib/svm/guest_tools.rb:139Not in the Java SDK.
attach_command()
Section titled “attach_command()”def attach_command(self, name: str) -> strThe command to run in sandbox.pty to attach interactively; detaching leaves the terminal running.
| Parameter | Type | Default |
|---|---|---|
name |
str |
Returns str
sdk/python/svm/terminals.py:96attachCommand(name: string): stringThe command to run in sandbox.pty to attach interactively; detaching leaves the terminal running.
| Parameter | Type | Default |
|---|---|---|
name |
string |
Returns string
sdk/typescript/src/terminals.ts:89func (t *Terminals) AttachCommand(name string) (string, error)AttachCommand is the command to run in a PTY to attach interactively; detaching leaves the terminal running.
| Parameter | Type | Default |
|---|---|---|
name |
string |
Returns (string, error)
sdk/go/guest_terminals.go:201def attach_command(name)The command to run in a PTY to attach interactively; detaching leaves the terminal running.
| Parameter | Type | Default |
|---|---|---|
name |
sdk/ruby/lib/svm/guest_tools.rb:148Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s Terminals.
constructor(private readonly sandbox: GuestSandbox)| Parameter | Type | Default |
|---|---|---|
sandbox |
GuestSandbox |
sdk/typescript/src/terminals.ts:21Not in the Go SDK’s Terminals.
Not in the Ruby SDK’s Terminals.
Not in the Java SDK.
ensure()
Section titled “ensure()”def ensure(self, *, timeout_seconds: int=300) -> NoneInstall tmux if it is missing.
| Parameter | Type | Default |
|---|---|---|
timeout_seconds |
int |
300 |
sdk/python/svm/terminals.py:40async ensure(timeoutSeconds = 300): Promise<void>Install tmux if the template lacks it (as root; needs internet egress).
| Parameter | Type | Default |
|---|---|---|
timeoutSeconds |
number |
300 |
sdk/typescript/src/terminals.ts:33func (t *Terminals) Ensure(ctx context.Context) errorEnsure installs tmux if the template lacks it (as root; needs internet egress).
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns error
sdk/go/guest_terminals.go:65def ensureInstalls tmux if the template lacks it (as root; needs internet egress).
Raises SandboxError
sdk/ruby/lib/svm/guest_tools.rb:85Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s Terminals.
Not in the TypeScript SDK’s Terminals.
Not in the Go SDK’s Terminals.
def initialize(box)| Parameter | Type | Default |
|---|---|---|
box |
sdk/ruby/lib/svm/guest_tools.rb:80Not in the Java SDK.
is_alive()
Section titled “is_alive()”def is_alive(self, name: str) -> bool| Parameter | Type | Default |
|---|---|---|
name |
str |
Returns bool
sdk/python/svm/terminals.py:90async isAlive(name: string): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
name |
string |
Returns Promise<boolean>
sdk/typescript/src/terminals.ts:85func (t *Terminals) IsAlive(ctx context.Context, name string) (bool, error)| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns (bool, error)
sdk/go/guest_terminals.go:182Not in the Ruby SDK’s Terminals.
Not in the Java SDK.
kill()
Section titled “kill()”def kill(self, name: str) -> bool| Parameter | Type | Default |
|---|---|---|
name |
str |
Returns bool
sdk/python/svm/terminals.py:93async kill(name: string): Promise<boolean>| Parameter | Type | Default |
|---|---|---|
name |
string |
Returns Promise<boolean>
sdk/typescript/src/terminals.ts:86func (t *Terminals) Kill(ctx context.Context, name string) (bool, error)| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns (bool, error)
sdk/go/guest_terminals.go:191def kill(name)| Parameter | Type | Default |
|---|---|---|
name |
sdk/ruby/lib/svm/guest_tools.rb:143Not in the Java SDK.
screen()
Section titled “screen()”def screen(self, name: str, *, scrollback: int=0) -> strThe visible screen, plus up to scrollback earlier lines.
| Parameter | Type | Default |
|---|---|---|
name |
str |
|
scrollback |
int |
0 |
Returns str
sdk/python/svm/terminals.py:70async screen(name: string, scrollback = 0): Promise<string>The visible screen, plus up to scrollback earlier lines.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
scrollback |
number |
0 |
Returns Promise<string>
sdk/typescript/src/terminals.ts:62func (t *Terminals) Screen(ctx context.Context, name string, scrollback int) (string, error)Screen returns the visible screen plus up to scrollback earlier lines.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
scrollback |
int |
Returns (string, error)
sdk/go/guest_terminals.go:136def screen(name, scrollback: 0)The visible screen plus up to scrollback earlier lines.
| Parameter | Type | Default |
|---|---|---|
name |
||
scrollback |
0 |
sdk/ruby/lib/svm/guest_tools.rb:118Not in the Java SDK.
send_keys()
Section titled “send_keys()”def send_keys(self, name: str, *keys: str) -> NonePress named keys such as Enter, C-c, Up or Escape.
| Parameter | Type | Default |
|---|---|---|
name |
str |
|
keys |
str |
optional |
sdk/python/svm/terminals.py:64async sendKeys(name: string, ...keys: string[]): Promise<void>Press named keys such as Enter, C-c, Up or Escape.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
keys |
string[] |
optional |
sdk/typescript/src/terminals.ts:56func (t *Terminals) SendKeys(ctx context.Context, name string, keys ...string) errorSendKeys presses named keys such as Enter, C-c, Up or Escape.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
keys |
...string |
optional |
Returns error
sdk/go/guest_terminals.go:118def send_keys(name, *keys)Presses named keys such as Enter, C-c, Up or Escape.
| Parameter | Type | Default |
|---|---|---|
name |
||
*keys |
optional |
sdk/ruby/lib/svm/guest_tools.rb:110Not in the Java SDK.
send_text()
Section titled “send_text()”def send_text(self, name: str, text: str, *, enter: bool=True) -> NoneType text literally; enter then presses Enter.
| Parameter | Type | Default |
|---|---|---|
name |
str |
|
text |
str |
|
enter |
bool |
True |
sdk/python/svm/terminals.py:58async sendText(name: string, text: string, enter = true): Promise<void>Type text literally; enter then presses Enter.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
text |
string |
|
enter |
boolean |
true |
sdk/typescript/src/terminals.ts:50func (t *Terminals) SendText(ctx context.Context, name, text string, enter bool) errorSendText types text literally; enter then presses Enter.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
text |
string |
|
enter |
bool |
Returns error
sdk/go/guest_terminals.go:103def send_text(name, text, enter: false)Types text literally; enter then presses Enter.
| Parameter | Type | Default |
|---|---|---|
name |
||
text |
||
enter |
false |
sdk/ruby/lib/svm/guest_tools.rb:103Not in the Java SDK.
start()
Section titled “start()”def start(self, name: str, command: str | None=None, *, cols: int=200, rows: int=50, cwd: str | None=None) -> str| Parameter | Type | Default |
|---|---|---|
name |
str |
|
command |
str | None |
None |
cols |
int |
200 |
rows |
int |
50 |
cwd |
str | None |
None |
Returns str
sdk/python/svm/terminals.py:47async start(name: string, command?: string, options: { cols?: number; rows?: number; cwd?: string } = {}): Promise<string>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
command |
string |
optional |
options |
{ cols?: number; rows?: number; cwd?: string } |
{} |
Returns Promise<string>
sdk/typescript/src/terminals.ts:39func (t *Terminals) Start(ctx context.Context, name, command string, cols, rows int, cwd string) errorStart creates a terminal; command may be empty (a login shell). Zero cols and rows mean 200 by 50.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
command |
string |
|
cols |
int |
|
rows |
int |
|
cwd |
string |
Returns error
sdk/go/guest_terminals.go:77def start(name, command: nil, cols: 200, rows: 50, cwd: nil)Creates a terminal; command may be nil (a login shell).
| Parameter | Type | Default |
|---|---|---|
name |
||
command |
nil |
|
cols |
200 |
|
rows |
50 |
|
cwd |
nil |
sdk/ruby/lib/svm/guest_tools.rb:92Not in the Java SDK.
wait_for()
Section titled “wait_for()”def wait_for(self, name: str, pattern: str, *, timeout: float=60.0, interval: float=0.5, scrollback: int=200) -> strPoll the screen until pattern (a regular expression) appears; returns the screen. TimeoutError otherwise.
| Parameter | Type | Default |
|---|---|---|
name |
str |
|
pattern |
str |
|
timeout |
float |
60.0 |
interval |
float |
0.5 |
scrollback |
int |
200 |
Returns str
Raises TimeoutError
sdk/python/svm/terminals.py:75async waitFor(name: string, pattern: RegExp, options: { timeoutMs?: number; intervalMs?: number; scrollback?: number } = {}): Promise<string>Poll the screen until pattern appears; resolves to the screen, rejects on timeout.
| Parameter | Type | Default |
|---|---|---|
name |
string |
|
pattern |
RegExp |
|
options |
{ timeoutMs?: number; intervalMs?: number; scrollback?: number } |
{} |
Returns Promise<string>
Raises TimeoutError
sdk/typescript/src/terminals.ts:69func (t *Terminals) WaitFor(ctx context.Context, name string, pattern *regexp.Regexp, timeout, interval time.Duration) (string, error)WaitFor polls the screen until pattern appears and returns it; it fails when ctx ends or timeout passes.
| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
pattern |
*regexp.Regexp |
|
timeout |
time.Duration |
|
interval |
time.Duration |
Returns (string, error)
sdk/go/guest_terminals.go:150def wait_for(name, pattern, timeout: 30, interval: 0.25)Polls the screen until pattern (a Regexp) appears and returns it; raises after timeout seconds.
| Parameter | Type | Default |
|---|---|---|
name |
||
pattern |
||
timeout |
30 |
|
interval |
0.25 |
Raises TimeoutError
sdk/ruby/lib/svm/guest_tools.rb:125Not in the Java SDK.
Sessions
Section titled “Sessions”Sessions are named shells whose state lives in the sandbox (~/.fcap/sessions, owner-only), so it survives pause and resume.
create()
Section titled “create()”def create(self, name: str, *, cwd: str | None=None, envs: dict[str, str] | None=None) -> str| Parameter | Type | Default |
|---|---|---|
name |
str |
|
cwd |
str | None |
None |
envs |
dict[str, str] | None |
None |
Returns str
sdk/python/svm/sessions.py:53async create(name: string, options: { cwd?: string; envs?: Record<string, string> } = {}): Promise<string>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
options |
{ cwd?: string; envs?: Record<string, string> } |
{} |
Returns Promise<string>
sdk/typescript/src/sessions.ts:42func (s *Sessions) Create(ctx context.Context, name, cwd string, envs map[string]string) error| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
cwd |
string |
|
envs |
map[string]string |
Returns error
sdk/go/guest_tools.go:114def create(name, cwd: nil, envs: nil)| Parameter | Type | Default |
|---|---|---|
name |
||
cwd |
nil |
|
envs |
nil |
Raises SandboxError
sdk/ruby/lib/svm/guest_tools.rb:54Not in the Java SDK.
list()
Section titled “list()”def list(self) -> list[str]Returns list[str]
sdk/python/svm/sessions.py:62async list(): Promise<string[]>Returns Promise<string[]>
sdk/typescript/src/sessions.ts:52func (s *Sessions) List(ctx context.Context) ([]string, error)| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
Returns ([]string, error)
sdk/go/guest_tools.go:137def listsdk/ruby/lib/svm/guest_tools.rb:64Not in the Java SDK.
close()
Section titled “close()”def close(self, name: str) -> None| Parameter | Type | Default |
|---|---|---|
name |
str |
sdk/python/svm/sessions.py:66async close(name: string): Promise<void>| Parameter | Type | Default |
|---|---|---|
name |
string |
sdk/typescript/src/sessions.ts:57func (s *Sessions) Close(ctx context.Context, name string) error| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
Returns error
sdk/go/guest_tools.go:142def close(name)| Parameter | Type | Default |
|---|---|---|
name |
sdk/ruby/lib/svm/guest_tools.rb:68Not in the Java SDK.
constructor()
Section titled “constructor()”Not in the Python SDK’s Sessions.
constructor(private readonly sandbox: GuestSandbox)| Parameter | Type | Default |
|---|---|---|
sandbox |
GuestSandbox |
sdk/typescript/src/sessions.ts:40Not in the Go SDK’s Sessions.
Not in the Ruby SDK’s Sessions.
Not in the Java SDK.
initialize()
Section titled “initialize()”Not in the Python SDK’s Sessions.
Not in the TypeScript SDK’s Sessions.
Not in the Go SDK’s Sessions.
def initialize(box)| Parameter | Type | Default |
|---|---|---|
box |
sdk/ruby/lib/svm/guest_tools.rb:50Not in the Java SDK.
def run(self, name: str, command: str, *, timeout_seconds: int=0, **options: object) -> ProcessResult| Parameter | Type | Default |
|---|---|---|
name |
str |
|
command |
str |
|
timeout_seconds |
int |
0 |
options |
object |
optional |
Returns ProcessResult
sdk/python/svm/sessions.py:59run(name: string, command: string, options: Omit<RunOptions, "background"> = {}): Promise<ProcessResult>| Parameter | Type | Default |
|---|---|---|
name |
string |
|
command |
string |
|
options |
Omit<RunOptions, "background"> |
{} |
Returns Promise<ProcessResult>
sdk/typescript/src/sessions.ts:48func (s *Sessions) Run(ctx context.Context, name, command string, options RunOptions) (ProcessResult, error)| Parameter | Type | Default |
|---|---|---|
ctx |
context.Context |
|
name |
string |
|
command |
string |
|
options |
RunOptions |
Returns (ProcessResult, error)
sdk/go/guest_tools.go:129def run(name, command, **options)| Parameter | Type | Default |
|---|---|---|
name |
||
command |
||
**options |
optional |
sdk/ruby/lib/svm/guest_tools.rb:60Not in the Java SDK.
Follow
Section titled “Follow”The responses of a process stream, continuing across breaks until the process ends.
open_stream(pid, offsets) opens Start while pid is None and Connect after, from offsets (stdout, stderr) or from now when they are None; lookup() finds the pid of a process whose start event was never seen, or None. Every stream’s start event says where it begins, which is where a break resumes.
Properties
Section titled “Properties”| Property | Type | Description |
|---|---|---|
cancelled |
bool |
Not in the TypeScript SDK.
Not in the Go SDK.
Not in the Ruby SDK.
Not in the Java SDK.
cancel()
Section titled “cancel()”def cancel(self) -> Nonesdk/python/svm/resume.py:65Not in the TypeScript SDK.
Not in the Go SDK.
Not in the Ruby SDK.
Not in the Java SDK.