Skip to main content
One instance owns a fleet. It holds the engine connection, the workspace root, and the housekeeping timer.

Constructor options

SandboxesOptions, all optional. It extends EngineOptions, which is where socketPath comes from.
runtime also reads NATIVESANDBOX_OCI_RUNTIME from the environment.

Properties

create

Returns Promise<Sandbox>. The sandbox by that name: the existing one if its shape still serves, otherwise a fresh one. See reuse.

SandboxSpec

check

Returns Promise<{ ok: boolean; engine?: string; problem?: string }>. Never throws. Whether this host can run a sandbox at all, and why not when it cannot. Worth calling at startup; the alternative is discovering it on a user’s first command.

ping

Returns Promise<string> — the engine’s version. Throws if it is not reachable. check() is the same question without the exception.

list

Returns Promise<SandboxInfo[]> — every sandbox this runtime owns, in any state. Scoped by label to containers created with this prefix.

workspaceDir

Returns string — the host directory mounted into that sandbox, whether or not it exists yet. Use it to stage files before the first create().

remove

Returns Promise<boolean> — whether there was one. Removes the container and its workspace. Removing something already gone is not an error.

removeAll

Returns Promise<number> — how many were removed.

stopIdle

Returns Promise<string[]> — the names stopped. Stops every sandbox past its idle timeout, never one with a command in flight. now is for testing.

retireExpired

Returns Promise<string[]> — the names retired. Removes the container and keeps the workspace for every sandbox past its maximum lifetime, never one with a command in flight.

sweep

Returns Promise<{ stopped: string[]; retired: string[] }>. Both passes. This is what the timer runs.

close

Stops the housekeeping timer. Sandboxes are left as they are. Call it at shutdown.