Skip to content

ExecHandle

One exec, addressed by its caller-minted id.

The id is the idempotency key, so a handle survives a process restart: rebuild it through Session.exec(execId) and every method still addresses the same server-side exec.

get execId(): string;

string

ack(): Promise<ExecResult>;

Releases the buffered output and starts the TTL clock.

Promise<ExecResult>


closeStdin(): Promise<StdinAck>;

Sends EOF. Nothing else closes stdin: the daemon’s copy of the pipe outlives the child’s wait, so a child blocked reading stdin hangs until its timeout otherwise.

Promise<StdinAck>


kill(): Promise<boolean>;

Signals the whole process group. false means nothing was signalled because the child had already been reaped — which is the outcome a kill wanted.

Promise<boolean>


poll(): Promise<ExecResult>;

Reads current status and output. Read-only server-side; safe to spin on.

Promise<ExecResult>


stream(options?: StreamOptionsInput | null): ExecStream;

An async iterator over output as it arrives, reconnecting at the last good offset.

for await (const event of handle.stream()).

Parameter Type
options? StreamOptionsInput | null

ExecStream


wait(timeout?: number | null): Promise<ExecResult>;

Polls until the exec is done, or rejects with ERR_TIMEOUT.

A timeout has not touched the exec — polling is read-only and output lives until it is acked — so a caller that gives up can come back and poll again.

Parameter Type
timeout? number | null

Promise<ExecResult>


waitAndAck(timeout?: number | null): Promise<ExecResult>;

Wait, then ack, returning the result that carries the output.

Which result comes back matters: the ack response carries the released output and a poll issued after the ack reports acked with none, so returning the wrong one is a silent empty-output bug. The core sequences it.

Parameter Type
timeout? number | null

Promise<ExecResult>


writeStdin(data: Uint8Array, eof?: boolean | null): Promise<StdinAck>;

Writes to the child’s stdin. Requires the exec to have been started with stdin: true, or the daemon answers 409.

eof in the same call is the common case for feeding a prompt: two round trips would leave a window where the child has the bytes but not the EOF that says the input is complete.

Parameter Type
data Uint8Array
eof? boolean | null

Promise<StdinAck>

This page is generated from bindings/microvms-js/index.d.ts by TypeDoc 0.28.20 and typedoc-plugin-markdown 4.13.1, run from site/scripts/gen-reference.mjs on every pnpm run sync, so an edit made here is overwritten by the next run.

To change the page, change the doc comment in the binding’s Rust source, then regenerate the declarations with mise run dts. mise run dts:check fails when the committed file no longer matches the source.