Skip to main content
The Sail TypeScript SDK (@sailresearch/sdk on npm) runs on Node 22+ and Bun. Sail also provides Python and Rust SDKs.

Install

The SDK supports Linux x64/arm64 (glibc and musl), macOS x64/arm64, and Windows x64. The Sail API warns when your SDK version is nearing the end of its support window. The SDK prints that warning to stderr once per process. A version past the end of its support window is rejected with an upgrade error before any operation runs. Upgrade with npm install @sailresearch/sdk@latest.

Configure

Set SAIL_API_KEY in the environment; the SDK also reads the credential sail auth login stores under ~/.sail. The statics on Sailbox, App, and Volume use this configuration by default, or construct a Client explicitly with Client.fromConfig({ apiKey }). See Configuration.

Quickstart

Errors

Every failure the SDK recognizes extends SailError, so one catch (e) { if (e instanceof SailError) } handles them; a truly unexpected error is rethrown unchanged. Subclasses like NotFoundError and SailboxExecutionError match specific failures, every error carries an advisory retryable flag, and isSailError() is the realm-safe check. See Errors.

Reference

The docs below are auto-generated.

Sailbox

A sandbox (Sailbox): the primary object agent harnesses work with. Create one with Sailbox.create, run commands with exec, move files with fs, expose ports with expose, and manage its lifecycle. The statics use a default env-configured client unless you pass one.sailboxId is the stable identifier. Every other property is a snapshot of what Sailbox.get or Sailbox.list last returned. A lifecycle call on this object, such as pause, updates status, setAutoSleep and setEgressPolicy update their property, and setLimits updates vcpuCount, memoryMib, and stateDiskSizeGib. Nothing else changes on this object; Sailbox.get returns a fresh snapshot. The object create and fromCheckpoint return starts with only the id, name, and status.

Example

Accessors

appId

Get Signature
get appId(): string | undefined
Identifier of the owning app.
Returns
string | undefined

appName

Get Signature
get appName(): string | undefined
Name of the owning app.
Returns
string | undefined

architecture

Get Signature
get architecture(): string | undefined
CPU architecture (for example arm64).
Returns
string | undefined

autoSleep

Get Signature
get autoSleep(): AutoSleep | undefined
When Sail may sleep this Sailbox on its own; see AutoSleep.
Returns
AutoSleep | undefined

checkpointGeneration

Get Signature
get checkpointGeneration(): number | undefined
Checkpoint generation counter as of the snapshot.
Returns
number | undefined

client

Get Signature
get client(): Client
The underlying Client.
Returns
Client

cpuRequestedVcpu

Get Signature
get cpuRequestedVcpu(): number | undefined
Requested CPU, in vCPUs.
Returns
number | undefined

cpuUsedVcpu

Get Signature
get cpuUsedVcpu(): number | undefined
Current CPU usage, in vCPUs, as of the snapshot.
Returns
number | undefined

createdAt

Get Signature
get createdAt(): Date | undefined
When the Sailbox was created.
Returns
Date | undefined

createdByUserId

Get Signature
get createdByUserId(): string | undefined
The user whose credential created this Sailbox (for a restore, the user who ran it). undefined for service-key creates.
Returns
string | undefined

cron

Get Signature
get cron(): SailboxCron
Commands this Sailbox runs on a schedule.
Returns
SailboxCron

deprecation

Get Signature
get deprecation(): SailboxDeprecation | undefined
Actionable runtime deprecation notice, when an upgrade is needed.
Returns
SailboxDeprecation | undefined

diskRequestedBytes

Get Signature
get diskRequestedBytes(): number | undefined
Requested disk, in bytes.
Returns
number | undefined

diskUsedBytes

Get Signature
get diskUsedBytes(): number | undefined
Current disk usage, in bytes, as of the snapshot.
Returns
number | undefined

egressPolicy

Get Signature
get egressPolicy(): SailboxEgressPolicy | undefined
The egress policy the Sailbox is running under: its document and, when a saved policy was applied, that policy’s id and name.
Returns
SailboxEgressPolicy | undefined

env

Get Signature
get env(): Readonly<Record<string, string>> | undefined
The environment variables every command in the Sailbox starts with, before any exec env overrides. They come from the image, then the Sailbox’s create env, then its egress policy’s env, and when two set the same name the later one wins. An egress policy secret shows as the placeholder the Sailbox holds, not the real value. Variables Sail adds to every Sailbox, such as LANG and SAILBOX_ID, are left out. Empty when nothing is set, or when the Sailbox is private and you did not create it. Undefined for a handle without a fetched snapshot.
Returns
Readonly<Record<string, string>> | undefined

errorMessage

Get Signature
get errorMessage(): string | undefined
Failure detail when the status is failed.
Returns
string | undefined

expiresAt

Get Signature
get expiresAt(): Date | undefined
Termination deadline, checked periodically. Undefined means unlimited lifetime or a handle without a fetched snapshot; use Sailbox.get for fresh state.
Returns
Date | undefined

fs

Get Signature
get fs(): SailboxFs
Filesystem operations on this Sailbox’s guest: read and write files (buffered or streaming), and directory helpers.
Returns
SailboxFs

guestSchemaVersion

Get Signature
get guestSchemaVersion(): number | undefined
The Sailbox runtime schema version the Sailbox last booted with.
Returns
number | undefined

imageId

Get Signature
get imageId(): string | undefined
Identifier of the image the Sailbox was created from.
Returns
string | undefined

lastCheckpointedAt

Get Signature
get lastCheckpointedAt(): Date | undefined
When the most recent checkpoint was taken.
Returns
Date | undefined

limitsPending

Get Signature
get limitsPending(): boolean | undefined
True when this Sailbox is powered off with new limits recorded that take effect at its next wake. Always false on a running Sailbox.
Returns
boolean | undefined

memoryMib

Get Signature
get memoryMib(): number | undefined
Configured memory, in MiB.
Returns
number | undefined

memoryRequestedBytes

Get Signature
get memoryRequestedBytes(): number | undefined
Requested memory, in bytes.
Returns
number | undefined

memoryUsedBytes

Get Signature
get memoryUsedBytes(): number | undefined
Current memory usage, in bytes, as of the snapshot.
Returns
number | undefined

name

Get Signature
get name(): string
The Sailbox name.
Returns
string

networkRxBytesPerSecond

Get Signature
get networkRxBytesPerSecond(): number | undefined
Bytes per second received, as of the snapshot.
Returns
number | undefined

networkRxPacketsPerSecond

Get Signature
get networkRxPacketsPerSecond(): number | undefined
Packets per second received, as of the snapshot.
Returns
number | undefined

networkTxBytesPerSecond

Get Signature
get networkTxBytesPerSecond(): number | undefined
Bytes per second sent, as of the snapshot.
Returns
number | undefined

networkTxPacketsPerSecond

Get Signature
get networkTxPacketsPerSecond(): number | undefined
Packets per second sent, as of the snapshot.
Returns
number | undefined

region

Get Signature
get region(): string | undefined
Returns
string | undefined

sailboxId

Get Signature
get sailboxId(): string
The Sailbox’s stable identifier.
Returns
string

startedAt

Get Signature
get startedAt(): Date | undefined
When the Sailbox first started running. A resume does not rewrite it.
Returns
Date | undefined

stateDiskSizeGib

Get Signature
get stateDiskSizeGib(): number | undefined
Configured state-disk size, in GiB.
Returns
number | undefined

status

Get Signature
get status(): SailboxStatus
The lifecycle status (for example running).
Returns
SailboxStatus

updatedAt

Get Signature
get updatedAt(): Date | undefined
When the Sailbox last changed.
Returns
Date | undefined

vcpuCount

Get Signature
get vcpuCount(): number | undefined
Configured number of vCPUs.
Returns
number | undefined

visibility

Get Signature
get visibility(): string | undefined
"private" when access is restricted to the creator; undefined/"org" is the default org-wide access.
Returns
string | undefined

volumeMounts

Get Signature
get volumeMounts(): SailboxVolumeMount[] | undefined
Volumes attached to this Sailbox and the paths they are mounted at.
Returns
SailboxVolumeMount[] | undefined

Methods

checkpoint()

checkpoint(options?): Promise<SailboxCheckpoint>
Take a checkpoint of this Sailbox and prepare its clean start state. The returned handle carries expiresAt, after which starting a Sailbox from it fails. Volume attachments are recorded, not their contents; see checkpoints with volumes. Upgrade a Sailbox that uses an older guest payload before creating a checkpoint handle.
Parameters
Returns
Promise<SailboxCheckpoint>

clearEgressPolicy()

clearEgressPolicy(): Promise<SailboxEgressPolicy>
Remove this Sailbox’s egress policy, so it can reach every host and no rules apply: the empty policy {}. The same as Sailbox.setEgressPolicy with EgressPolicy.allowAll.
Returns
Promise<SailboxEgressPolicy>

composeUp()

composeUp(options?): Promise<ExecResult>
Start the Docker Compose project this Sailbox’s image was built from.The image, from Image.fromCompose, holds a copy of the project at /root/<its directory name> and the image Sail built for each service. composeUp runs docker compose up there. Calling it again on a running project restarts the services whose definition changed.Resolves once every service is running, and healthy where it declares a healthcheck. A start that fails, or outlasts timeoutSeconds (unlimited by default), rejects with CommandFailedError carrying Compose’s output.
Parameters
Returns
Promise<ExecResult>
Example

enableSsh()

enableSsh(options?): Promise<SshEndpoint | null>
Enable SSH on this Sailbox: trust the org SSH CA, start sshd, and expose guest port 22 as TCP once the CA-only daemon owns it. Org members connect with a short-lived certificate (fetched by the sail box ssh CLI); a private Sailbox accepts only its creator’s certificates. Safe to re-run. With wait (the default), polls until the endpoint is reachable and returns it, throwing TimeoutError if it is not within timeoutSeconds; with wait: false, skips the probe and resolves null. See SSH lifecycle for when SSH restarts on its own and when to enable it again.
Parameters
Returns
Promise<SshEndpoint | null>

exec()

exec(command, options?): Promise<ExecProcess>
Run a command and return a handle to the live process. A string command is run via /bin/sh -lc; a string[] is exec’d directly. By default a stream you are consuming pauses the command when you fall behind, so nothing is lost until a cancel or the exec timeout ends the pauses, and a stream you are not consuming keeps only its most recent 1 MiB; start consuming right after this call returns to get every byte. outputMode and outputBufferBytes in options change that (see ExecProcess). options can also set a working directory or detach the command (see ExecOptions). Stopping the command is the caller’s job via ExecProcess.cancel.
Parameters
Returns
Promise<ExecProcess>

expose()

expose(guestPort, options?): Promise<Listener>
Expose a guest port at runtime. Re-exposing a port under the same protocol sets its allowlist to what you pass, so pass the whole list every time; passing none clears the restriction and reopens the port. The returned listener carries the resolved endpoint but an "unknown" route status: the response confirms configuration, not reachability; waitForListener confirms the route is live.
Parameters
Returns
Promise<Listener>

listener()

listener(guestPort, options?): Promise<Listener>
Fetch one listener by guest port without waking the Sailbox: the port’s http or tcp listener, or options.protocol.
Parameters
Returns
Promise<Listener>

listeners()

listeners(): Promise<Listener[]>
List this Sailbox’s listeners without waking it.
Returns
Promise<Listener[]>

mount()

mount(volume, mountPath, options?): Promise<void>
Mount a volume at an empty absolute path without restarting this Sailbox. The Sailbox must be running. Older Sailboxes require an explicit upgrade. Resolves when the volume is mounted. Retrying with the same arguments is safe, including after a timeout. Existing mounts cannot be removed or replaced. A Sailbox can mount at most four volumes; one volume at several paths counts once. Existing containers need mount propagation to see it. The volume remains attached on pause and resume. See the volume guide.cacheSeconds (read-only mounts only, 0 to 3600) lets this mount show changes made through other mounts late, by up to about twice that many seconds, in exchange for faster repeated reads. Defaults to 0.
Parameters
Returns
Promise<void>

pause()

pause(): Promise<void>
Pause this Sailbox in memory.
Returns
Promise<void>

reboot()

reboot(): Promise<RebootResult>
Reboot this Sailbox on its current disk, as a machine reboot would.Files on the Sailbox’s disk and on mounted volumes are kept. Running processes and memory are not, so anything not yet written to disk is lost. A running Sailbox reboots now. A paused or sleeping Sailbox is not woken: the reboot is recorded and the Sailbox boots fresh at its next wake. The result’s applied is true when the Sailbox rebooted during the call and false when the reboot is recorded for the next wake.
Returns
Promise<RebootResult>

resume()

resume(): Promise<void>
Resume this Sailbox (updates status).
Returns
Promise<void>

run()

run(command, options?): Promise<ExecResult>
Run a command to completion and return its buffered result: a one-shot convenience over exec followed by ExecProcess.wait. A string command runs via /bin/sh -lc; a string[] is exec’d directly. Set env in options to add environment variables; cwd sets the working directory (like exec); signal force-cancels the command on abort (see RunOptions). The result’s stdout and stderr hold only outputBufferBytes of each stream (1 MiB by default, up to 64 MiB); outputMode picks which bytes: "tail", the default, the most recent, and "head" the first, with stdoutTruncated and stderrTruncated set when output was dropped. The command never pauses for unread output. While the first call is still running, a second call with the same idempotencyKey takes over its output stream, and the earlier call’s result may come back truncated. To get every byte, use exec and consume the stream (see ExecProcess). openStdin, pty, background, and the pausing output modes are excluded from RunOptions and rejected at runtime: run() waits for the command to finish and buffers its output, so an interactive command would hang, a backgrounded one would return the launcher’s result, not the command’s, and a mode that pauses for a consumer would pause forever with nobody consuming; use exec for those.
Parameters
Returns
Promise<ExecResult>

setAutoSleep()

setAutoSleep(autoSleep): Promise<void>
Replace when Sail may sleep this Sailbox on its own.Each call replaces the whole setting: switching to { automatic: false } clears any minimum wait set earlier, and switching back does not restore it. Calling Sailbox.sleep yourself is unaffected, and so are pause, resume, and scheduled wakes.
Parameters
Returns
Promise<void>

setEgressPolicy()

setEgressPolicy(policy): Promise<SailboxEgressPolicy>
Replace this Sailbox’s egress policy. Accepts a saved EgressPolicy (or its id or listing summary) or a document object such as EgressPolicy.allowOnly’s result. Returns the new policy.
The change applies to connections this Sailbox opens after the call. A document passed directly cannot reference secrets; save it as an EgressPolicy first. Fails with an ApiError (status 409) when the new document is EgressPolicy.noNetwork and the Sailbox has exposed ports or SSH.
Parameters
Returns
Promise<SailboxEgressPolicy>

setLimits()

setLimits(options): Promise<LimitsResult>
Set this Sailbox’s vCPU count, memory limit, or disk limit. Regardless of configured limits, you are only charged for the resources the Sailbox workload actually consumes at runtime.Set at least one option; the others keep their values. vcpuCount is 1 to 8 and applies in place on a running Sailbox. Memory goes up or down: a lowering stops one GiB above what the Sailbox is using and needs a running Sailbox. Disk only grows. A paused or sleeping Sailbox is not woken: the new limits are recorded and take effect at its next wake.Returns a LimitsResult; its applied is true when the Sailbox now runs with the limits in the result. Rejects with InvalidArgumentError when no option is given. The full rules, including what is refused and why, are in the set limits guide.
Parameters
Returns
Promise<LimitsResult>

setVisibility()

setVisibility(visibility): Promise<"org" | "private">
Change who may operate this Sailbox: "org" or "private".Its creator can change it, as can an org admin who sets SAIL_OWNER_OVERRIDE_REASON. Making it "private" is refused while SSH is enabled, because the running SSH server still lets everyone in your org log in. Call unexpose(22), change the visibility, then call Sailbox.enableSsh again. After making it "org", SSH stays limited to the creator until Sailbox.enableSsh runs again. Shells and commands already running are not interrupted. Resolves to the visibility now in effect.
Parameters
Returns
Promise<"org" | "private">

shell()

shell(command?, options?): Promise<number>
Open an interactive pty session on this Sailbox, bridged to the local terminal. With no command, runs a login shell; pass a command to run that under a pty instead (e.g. a REPL or an editor). Blocks until the remote process exits and resolves with its exit code. Requires an interactive terminal (stdin and stdout TTYs) on a Unix machine. A dropped connection does not end the session: the shell keeps reconnecting and redraws the screen once the Sailbox is reachable again. An idle session does not keep the Sailbox awake. If the Sailbox goes to sleep, the next key pressed wakes it and resumes the same session. If it has been manually paused rather than asleep, the shell says so when a key is pressed and sends the keys once the Sailbox is resumed. Pressing Ctrl-D while disconnected or paused leaves the session. Over a slow connection, what you type appears right away instead of after a round trip to the Sailbox, unless ShellOptions.noPredict is set. The session runs as the image’s USER when the image sets one, root otherwise; see ShellOptions.user. While the session is open, browser opens, localhost servers, paste, drag-and-drop, and clipboard are forwarded to your machine (the clipboard is two-way on devbox images); see ShellOptions.noForward.
Parameters
Returns
Promise<number>

sleep()

sleep(wakeAt?): Promise<Date | undefined>
Sleep this Sailbox to disk (wakes on traffic), optionally scheduling a wall-clock wake first. wakeAt, when given, records the wake before the sleep starts and the returned value is the effective wake time: the sooner of this request and any wake already scheduled. If the Sailbox is sleeping when that moment arrives, Sail restores it. The wake can fire a little after the time you set, so treat it as approximate. Sleeping an already-sleeping Sailbox succeeds and just updates the scheduled wake.
Parameters
Returns
Promise<Date | undefined>

terminate()

terminate(): Promise<void>
Terminate (delete) this Sailbox (updates status).
Returns
Promise<void>

unexpose()

unexpose(guestPort, options?): Promise<void>
Remove a runtime ingress port: every listener on it, or only options.protocol.
Parameters
Returns
Promise<void>

upgrade()

upgrade(): Promise<UpgradeResult>
Upgrade this Sailbox’s runtime.
Returns
Promise<UpgradeResult>

waitForListener()

waitForListener(guestPort, options?): Promise<Listener>
Block until the listener on guestPort is ready and return it, or throw TimeoutError after timeoutSeconds. An HTTP listener is ready once the guest server answers; a TCP listener once the guest sends bytes or holds the connection open; a UDP listener once its route is active, without contacting the guest. A connectivity check, not an application health check.
Parameters
Returns
Promise<Listener>

create()

static create(options): Promise<Sailbox>
Create a new Sailbox.A custom image definition passed as image is built first.Sail may sleep a fully idle Sailbox; it wakes transparently on traffic or the next operation.
Parameters
Returns
Promise<Sailbox>

fromCheckpoint()

static fromCheckpoint(options): Promise<Sailbox>
Create a new running Sailbox from a durable checkpoint handle. The new Sailbox restores the saved filesystem, memory, and background processes (filesystem-only checkpoints restore files without the source’s running processes). The new Sailbox runs independently. Commands started with Sailbox.exec stop, though their writes up to the checkpoint remain. Host-specific identity and network routes are removed before the checkpoint handle becomes ready. Recorded volumes are reattached; see checkpoints with volumes. The new Sailbox keeps the original’s egress policy and auto-sleep setting.
Parameters
Returns
Promise<Sailbox>

fromId()

static fromId(sailboxId, options?): Sailbox
Bind a handle to an existing Sailbox id without a network call.The returned handle carries no snapshot fields (its name and status are empty), just the operable surface. The id is not verified to exist: operations on an unknown or inaccessible id reject with NotFoundError. Use get to validate the id and fetch a fresh snapshot instead.
Parameters
Returns
Sailbox

get()

static get(sailboxId, options?): Promise<Sailbox>
Fetch an existing Sailbox by id.
Parameters
Returns
Promise<Sailbox>

list()

static list(params?): Promise<Sailbox[]>
List the Sailboxes that match the filters, fetching pages internally until every match (or limit of them) is collected; use listPage to page through results manually instead. limit caps the total returned, bounding the fetch for large orgs. A client can ride along in the query object.
Parameters
Returns
Promise<Sailbox[]>

listPage()

static listPage(params?): Promise<SailboxPage>
List one page of Sailboxes alongside the pagination envelope (total/hasMore). Takes the same filters as list, plus limit and offset to select the page.
Parameters
Returns
Promise<SailboxPage>

App

An app: the billing/ownership scope a Sailbox belongs to. Look one up (or mint it) with App.find, then pass it (or its App.id) to Sailbox.create.

Properties

Methods

find()

static find(name, options?): Promise<App>
Find an app by name, optionally minting it if missing.
Parameters
Returns
Promise<App>

list()

static list(options?): Promise<App[]>
Every app the current org owns, newest first.
Parameters
Returns
Promise<App[]>

Image

A Sailbox image: a base, registry, Dockerfile, or Compose image plus ordered build steps. Immutable and fluent: each method returns a new Image. Local files/dirs are recorded here and hashed and uploaded when the image is resolved to a spec (at Sailbox.create, or via toSpec), so chaining stays synchronous.

Example

Methods

addLocalDir()

addLocalDir(localPath, remotePath, options?): Image
Bake a local directory tree into the image at path. Each regular file is hashed + uploaded at resolve; symlinks are skipped and file modes preserved. ignore takes gitignore-style patterns.
Parameters
Returns
Image

addLocalFile()

addLocalFile(localPath, remotePath, options?): Image
Bake one local file into the image at path (absolute POSIX path; a trailing / appends the source basename). Hashed + uploaded at resolve.
Parameters
Returns
Image

aptInstall()

aptInstall(…packages): Image
Install system packages with apt.
Parameters
Returns
Image

build()

build(options?): Promise<ImageSpec>
Upload any local files and build the image, waiting until it is ready. Returns the resolved ImageSpec. Sailbox.create calls this for a custom image before creating the Sailbox (the backend serves the content-addressed built image); a bare base image skips the build. Local files are re-hashed on every call, so edits always reach the build, and rebuilding an unchanged, already-built image returns quickly. Creating Sailboxes from the returned spec needs no further build. For an image imported with Image.fromRegistry through a tag, the spec is also pinned to the exact version the build resolved the tag to, even if the tag later moves upstream. ImageBuildOptions.forceBuild looks the tag up again and moves the tag’s meaning for your whole organization. For an image built with Image.fromDockerfile or Image.fromCompose, the returned spec is likewise pinned to the versions the build resolved for its FROM and COPY --from images or the image of each service it pulls; ImageBuildOptions.forceBuild moves those pins for your whole organization, while specs built earlier keep their pinned versions. The image’s registry logins stay with the returned spec, so Sailbox.create can pull the image with them. They are not a field of the spec: a copy of the spec does not carry them.
Parameters
Returns
Promise<ImageSpec>

diskLimitGib()

diskLimitGib(limit): Image
Set the disk limit in GiB (8–1024), rounded up to a power of two.
Parameters
Returns
Image

env()

env(env): Image
Bake environment variables into the image (keys are trimmed).
Parameters
Returns
Image

memoryLimitGib()

memoryLimitGib(limit): Image
Set the memory limit in GiB (16–256), rounded up to a power of two.
Parameters
Returns
Image

numCpus()

numCpus(count): Image
Set the CPU limit (1–64), rounded up to a power of two.
Parameters
Returns
Image

pipInstall()

pipInstall(…packages): Image
Install Python packages with pip.
Parameters
Returns
Image

runCommand()

runCommand(command): Image
Run a shell command during the build.
Parameters
Returns
Image

toSpec()

toSpec(client?): Promise<ImageSpec>
Resolve to an ImageSpec: walks local files/dirs (honoring gitignore), hashes them, and uploads their content via client (defaults to the env client). Sailbox.create calls this for you; use it directly only if you need the raw spec. As with Image.build, the image’s registry logins stay with the returned spec but are not a field of it.
Parameters
Returns
Promise<ImageSpec>

withSystemd()

withSystemd(): Image
Run systemd as the init system in Sailboxes created from this image.The build installs systemd before the image’s build steps run, wherever in the chain this is called, so a runCommand step can enable a service with systemctl enable. Enabled services start when a Sailbox is created from the image, and one may still be starting when Sailbox.create returns.Images do not run systemd unless this is called, except the devbox base, which always does; calling this on it changes nothing. An image built with Image.fromCompose cannot use systemd.
Returns
Image
Example

debian()

static debian(architecture?): Image
A Debian base image (defaults to amd64).
Parameters
Returns
Image

devbox()

static devbox(architecture?): Image
The devbox base image (defaults to amd64): a prebuilt Debian base with a baked development layer. Sailboxes created from it run systemd, which starts Docker at boot, restarts it if it crashes, and runs any services you enable. Docker keeps running across sleeps. Prebuilt-only, so it does not support build steps or env; start from Image.debian to customize.
Parameters
Returns
Image

fromAwsEcr()

static fromAwsEcr(ref, options): Image
An image from a private Amazon ECR repository, such as 123456789012.dkr.ecr.us-east-1.amazonaws.com/app:1, pulled with the access key of an IAM identity that can pull it. The image otherwise behaves as one from Image.fromRegistry.
Parameters
Returns
Image
Example

fromCompose()

static fromCompose(projectDir, options?): Image
Build a Docker Compose project into a Sailbox image.projectDir is the directory you would run docker compose in. It is read and uploaded when the image is built, so edits up to that point reach the build. The image has Docker, every service image the project needs, and a copy of the directory at /root/<its directory name>, minus what its root .dockerignore excludes. Sailbox.composeUp starts the project from that copy. The project’s own .env, name:, and COMPOSE_FILE apply, as they do locally.Every service needs a build inside projectDir or an image to pull from a supported registry (see Image.fromRegistry). Pass registryLogins to pull private ones. A pulled image’s tag is pinned for your organization the first time a build uses it, like a Dockerfile FROM, unless it was pulled with a login; forceBuild on Image.build looks the tags up again. See the images guide for the compose features Sail supports.
Parameters
Returns
Image
Example

fromDockerfile()

static fromDockerfile(dockerfile, options?): Image
Build your own Dockerfile into a Sailbox image, with everything Sail needs layered on top. Pass the path to a Dockerfile on this machine, or its literal text wrapped as { contents }. The result behaves like any other image: build steps, env, and pip/apt installs work the same as on Image.debian.Pass contextDir to give the Dockerfile’s COPY and ADD instructions a build context; if omitted, the build runs without one. A .dockerignore in that directory is honored, and ignore patterns are applied after it, so they take precedence on conflict. A file named after the Dockerfile, like Dockerfile.dockerignore, sitting next to it is used instead of the context’s .dockerignore, as it is with Docker. The files the ignore rules keep are hashed and uploaded when the image is built, so edits up to that point reach the build. File modes, empty directories, and symbolic links are carried into the build.Every image a FROM (or COPY --from) instruction names must live on a supported registry (docker.io, ghcr.io, public.ecr.aws, quay.io, registry.gitlab.com, Amazon ECR, Google Artifact Registry, or Azure Container Registry). Pass registryLogins to pull private ones. A short name like python:3.12 means docker.io/library/python:3.12. Each named image is pinned to the version its tag pointed at the first time your organization used it, unless it was pulled with a login, and those pinned versions become part of the built image’s identity, so rebuilding the same spec reuses the same image even after a tag moves. Pass forceBuild to Image.build to look the tags up again and build what they point at now. The Dockerfile must produce a Debian- or Ubuntu-based filesystem.A # syntax= line can declare docker/dockerfile:1 or a release from 1.4 through 1.22.0. A file that declares anything else is rejected. The declared release does not change how the file is built.Multi-stage Dockerfiles work, and target names the stage to stop at, like docker build --target. A RUN --mount of type cache, secret, or ssh is rejected; tmpfs mounts work, and bind mounts work when they read from the build context or another build stage. Mount options must be literal text, and ONBUILD is not supported, in the Dockerfile or in an image a FROM names.The built image’s environment variables, working directory, and USER become the defaults for commands you run with Sailbox.exec or Sailbox.run; per-call env, cwd, and user override them (pass user: "0:0" to run as root on an image that sets USER). The image’s ENTRYPOINT and CMD are not run: a Sailbox manages its own processes, and your commands say what to execute. Build steps you chain onto the image (such as aptInstall) and SSH sessions still run as root.
Parameters
Returns
Image
Example

fromGcpArtifactRegistry()

static fromGcpArtifactRegistry(ref, options): Image
An image from a private Google Artifact Registry repository, such as us-docker.pkg.dev/my-project/repo/app:1, pulled with a service account’s JSON key. The image otherwise behaves as one from Image.fromRegistry.
Parameters
Returns
Image
Example

fromRegistry()

static fromRegistry(ref, options?): Image
Your own image as the Sailbox root filesystem, with everything Sail needs layered on top. The result behaves like any other image: build steps, env, and pip/apt installs work the same as on Image.debian.Reference an image on a supported registry (docker.io, ghcr.io, public.ecr.aws, quay.io, registry.gitlab.com, Amazon ECR, Google Artifact Registry, or Azure Container Registry), written as you would for docker pull: python:3.13 means docker.io/library/python:3.13 and acme/tool means docker.io/acme/tool; name the registry for the others, as in ghcr.io/acme/tool. You can pass a tag, a @sha256:... digest, or just the name, which means the latest tag. The image must be Debian- or Ubuntu-based.Your Sailbox runs on the CPU architecture the image was built for. An image published for both amd64 and arm64 runs on amd64. Pass architecture to require one instead, and building fails if the image was not built for it.For a private image, pass username and password. The password can be a stored organization secret, from Secret.named, or a value sent only with this request, from Secret.ephemeral. Docker Hub, GitHub, Quay, GitLab, and Azure accept a username with an access token. For Amazon ECR use Image.fromAwsEcr, and for Google Artifact Registry use Image.fromGcpArtifactRegistry. Sail uses the login only to pull the image. It is never stored in the image or written to build logs.A tag is pinned for your organization once an image has been built from it: later builds keep using that image even after the tag moves upstream. A tag pulled with a login is not pinned: each build looks it up again with that login. Call build({ forceBuild: true }) to look the tag up again and build the version it points at now for your whole organization; see ImageBuildOptions.forceBuild for how the switch propagates. A digest names exactly one image, so it never moves.The image’s environment variables, working directory, and USER become the defaults for commands you run with Sailbox.exec or Sailbox.run; per-call env, cwd, and user override them (pass user: "0:0" to run as root on an image that sets USER). The image’s ENTRYPOINT and CMD are not run: a Sailbox manages its own processes, and your commands say what to execute. Build steps you chain onto the image (such as aptInstall) and SSH sessions still run as root.
Parameters
Returns
Image
Example

ImageBuildInfo

One build of a Sailbox image.Builds belong to your organization. A build is queued while it waits to start, then building, and it ends as ready, failed, or cancelled. See the build queue guide for when a build waits and for your organization’s build limit.The fields describe the build as it was when the call returned. Call ImageBuildInfo.get again for its current state.

Properties

Methods

cancel()

cancel(): Promise<ImageBuildInfo>
Cancel this build and return its updated state.Cancelling a build that is queued or building stops it, and anything waiting on the build fails with “image build was cancelled”. Cancelling a build that is already cancelled returns it unchanged. A build that has already finished cannot be cancelled: the call fails with a 409 ApiError.
Returns
Promise<ImageBuildInfo>

get()

static get(buildId, options?): Promise<ImageBuildInfo>
Get one of your organization’s image builds by id. Rejects with NotFoundError if your organization has no build with that id.
Parameters
Returns
Promise<ImageBuildInfo>

list()

static list(options?): Promise<ImageBuildInfo[]>
List one page of your organization’s image builds, newest first. A page with fewer than limit builds is the last one.List calls are rate limited for your organization. If you call this repeatedly, wait a few seconds between calls.
Parameters
Returns
Promise<ImageBuildInfo[]>

ExecProcess

A live command running in a Sailbox. Stream stdout/stderr, write to writeStdin, and wait for the result. Not killed on GC; call close to detach, or cancel to stop the command.Each stream has a buffer, 1 MiB by default (outputBufferBytes), and the outputMode says what happens when it fills. With the default "auto": if you are not consuming a stream, the command never pauses and the stream keeps only its most recent bytes; if you are consuming a stream and fall behind, the command pauses when the buffer fills and resumes as you read, like a pipe. Consuming a stream is how you get every byte, and it slows the command when you cannot keep up. "pipe" holds both streams from the start, so a consumer that starts late still gets every byte; "tail" and "head" never pause the command for you, and keep each stream’s most recent bytes or its first. See OutputMode.With "auto", start consuming right after exec() returns to get every byte. You can consume stdout without holding stderr, or the reverse; the stream you are not holding keeps its most recent bytes and never pauses the command when it fills. If you hold both, consume them at the same time (Promise.all). The exit code is available from poll once the streams end and from wait.Accessing proc.stdout or proc.stderr claims nothing. A stream is claimed when you start iterating it (for await, ExecStream.raw, ExecStream.text, ExecStream.bytes) or call ExecStream.toReadable, and released when the iteration finishes or you leave it (break, return, a thrown error), when .text() or .bytes() reaches the end, or when the Readable is destroyed. Each stream can be claimed once; a second attempt rejects with InvalidArgumentError.wait returns each stream’s buffer, its most recent output (or its first with outputMode: "head"), with stdoutTruncated / stderrTruncated set when output was dropped. close, or your process exiting, releases both streams; the command keeps running, and wait() rejects after close() unless it already resolved a result. Sail may reattach after an interruption, but reattachment does not guarantee exact output replay. A pty command never pauses; resync requests a fresh screen.

Example

Accessors

execRequestId

Get Signature
get execRequestId(): string
The durable exec request id: the launch’s idempotency key as Sail recorded it (yours, or the one Sail generated when you did not supply one; read it here to learn the generated value). Reading it marks a generated identity as shareable: a second handle started with it takes over the stream, so from then on this handle no longer reclaims the stream after any interruption, a clean end or a dropped connection alike, and resolves from the recorded result instead. Reading back a key you supplied changes nothing.
Returns
string

output

Get Signature
get output(): ExecStream
Alias for stdout: under a pty the two output streams merge onto stdout, and output names that merged terminal stream.
Returns
ExecStream

stderr

Get Signature
get stderr(): ExecStream
The sole stderr stream: string iteration by default, .raw() for bytes. Claimed and released the same way as stdout.
Returns
ExecStream

stdout

Get Signature
get stdout(): ExecStream
The sole stdout stream: string iteration by default, .raw() for bytes. Accessing this property claims nothing; the stream is claimed when you start consuming it and released when the iteration finishes or you leave it (see ExecStream).
Returns
ExecStream

Methods

[asyncDispose]()

[asyncDispose](): Promise<void>
await using support: detaches on scope exit.
Returns
Promise<void>

[dispose]()

[dispose](): void
using support: detaches on scope exit.
Returns
void

cancel()

cancel(options?): Promise<void>
Cancel the command (SIGINT by default, SIGKILL with force). Transient failures are retried briefly, covering the window right after the command starts when the guest cannot accept signals for it yet.
Parameters
Returns
Promise<void>

close()

close(): void
Abandon the handle without killing the command. It releases both streams. The command keeps running and never pauses, and Sail keeps only the most recent output of each stream. Call cancel instead if the command should stop. wait rejects after close() unless it already resolved a result.
Returns
void

closeStdin()

closeStdin(): Promise<void>
Close the command’s stdin (send EOF).
Returns
Promise<void>

poll()

poll(): number | null
The exit code once the output stream has ended, else null. Never blocks and never drops output. If the connection was lost for good mid-command, the stream ends early with the outcome still unknown: poll() stays null and wait fetches the result Sail recorded. A host-lost exec (the machine running the Sailbox was lost mid-command) has no real exit code: wait always throws SailboxHostLostError for one, and poll() throws it when that loss is what ended the stream.
Returns
number | null

resize()

resize(cols, rows): Promise<void>
Resize the pty (no-op without one).
Parameters
Returns
Promise<void>

resync()

resync(): Promise<void>
Ask a pty exec to repaint its current screen (no-op without a pty). A command runs at full speed and never waits for a slow reader, so if you fall far behind the oldest output is dropped. Call this after that happens to receive the current screen instead of a broken, partial one. Advisory and best-effort.
Returns
Promise<void>

wait()

wait(): Promise<ExecResult>
Wait for the command to finish and return its result.stdout and stderr on the result hold each stream’s buffer, its most recent output (1 MiB by default), with stdoutTruncated / stderrTruncated set when older output was dropped; to get every byte, consume the stream (see ExecProcess). wait() itself never pauses the command and may run alongside an active consumer. With outputMode: "pipe", a stream nobody consumes pauses the command when its buffer fills, and wait() then waits for as long as the command stays paused. It rejects after close unless it already resolved a result.
Returns
Promise<ExecResult>

writeStdin()

writeStdin(data): Promise<void>
Write to the command’s stdin (requires openStdin).
Parameters
Returns
Promise<void>

ExecStream

An async-iterable view of one exec stream (stdout or stderr). Default iteration yields string chunks, incrementally decoded as UTF-8 (a multibyte character split across chunks is carried until complete); use raw for the unmodified byte stream. Iteration ends once the command finishes and its remaining output has been delivered; if the connection was lost for good mid-command, it ends early with the outcome still unknown, and ExecProcess.wait fetches the result Sail recorded.An ExecStream can be consumed once: string iteration, raw, toReadable, text, or bytes; a second consumer rejects with InvalidArgumentError. Accessing proc.stdout claims nothing. The stream is claimed when you start consuming it, and from then on nothing is lost: the command pauses when you fall behind. That does not hold for pty output, for outputMode: "tail" or "head", or after cancel() or the exec timeout has ended the pauses (see ExecProcess). It is released when the iteration finishes or you leave it (break, return, a thrown error), when text or bytes reaches the end, or when the Readable from toReadable is destroyed. While nobody is consuming, Sail keeps only the stream’s most recent bytes (1 MiB by default) unless the exec runs with outputMode: "pipe", so start consuming right after exec() returns when you need every byte. Pty output never pauses the command and keeps only its most recent bytes.

Example

Implements

  • AsyncIterable<string>

Methods

[asyncIterator]()

[asyncIterator](): AsyncIterator<string>
Returns
AsyncIterator<string>
Implementation of
AsyncIterable.[asyncIterator]

bytes()

bytes(): Promise<Buffer<ArrayBufferLike>>
Consume and collect the raw byte stream into a single Buffer.
Returns
Promise<Buffer<ArrayBufferLike>>

raw()

raw(): AsyncIterableIterator<Buffer<ArrayBufferLike>>
Iterate the raw byte stream, exactly as the command wrote it (escape sequences and binary payloads included). This consumes the stream.
Returns
AsyncIterableIterator<Buffer<ArrayBufferLike>>

text()

text(): Promise<string>
Consume and collect the stream into a single string.
Returns
Promise<string>

toReadable()

toReadable(): Readable
Consume this stream as a Node Readable of string chunks. Calling this claims the stream at once; destroying the Readable releases it at once, even while a read is waiting for output.
Returns
Readable

SailboxCron

Commands a Sailbox runs on a schedule, reached via Sailbox.cron.Sail wakes a sleeping Sailbox to start a run, so the Sailbox can sleep between runs. See Run a command on a schedule for how runs behave.

Methods

add()

add(schedule, command, options?): Promise<CronJob>
Add a job that runs command on schedule.schedule is a five-field cron expression: minute, hour, day of month, month, day of week. "0 9 * * 1-5" is 9:00 on weekdays, read in CronOptions.timezone.command is a shell command.
Parameters
Returns
Promise<CronJob>

list()

list(): Promise<CronJob[]>
List all of this Sailbox’s cron jobs, oldest first, without waking it.
Returns
Promise<CronJob[]>

CronJob

A command a Sailbox runs on a schedule.Returned by SailboxCron.add and SailboxCron.list. The fields describe the job as it was at that call.

Properties

Methods

remove()

remove(): Promise<void>
Remove this job. A run that is already due may still start, and one that started keeps going.
Returns
Promise<void>

SailboxFs

Filesystem operations on a Sailbox’s guest, reached via Sailbox.fs. File I/O streams bytes to/from the guest; the directory helpers create, remove, test, and transfer paths.Writes give what they create to the image’s USER by default (root when the image sets none), the same identity commands run as, so an uploaded file is usable by the code in the Sailbox. Reads and the directory helpers act as root by default, so they work on any path.Every operation except the reads and the directory download takes an optional user in Docker’s USER syntax (name, uid, name:group, or uid:gid; "0:0" is always root). The directory helpers other than the transfers run their command as that user, with its permissions enforced. Writes and the directory upload keep running as root but give that user what they create, like COPY --chown. Reads and the download take no user: a user only decides which paths an operation may touch and who owns what it creates. A read creates nothing in the Sailbox, and a download reads any path as root, the way the reads do. A user other than "0:0" requires a Sailbox whose guest honors requested users; on older Sailboxes these calls fail until Sailbox.upgrade is called.

Methods

downloadDir()

downloadDir(dirs): Promise<void>
Download a directory’s contents from the Sailbox into a local directory.guestDir’s entries land inside localDir, which is created if needed. Entries the download does not name are left in place; a same-named file is replaced. The transfer reads every file in the tree, so download directories of ordinary files: system trees like /proc or /sys hold files that cannot be read as plain data, and downloading them fails. A file that is being written while the download runs is captured as it is at that moment, the way copying a live file would; download after writers finish for a consistent copy. On Windows, a directory that contains symbolic links cannot be downloaded, since Windows restricts creating them. The Sailbox’s image must provide tar and gzip, which the transfer uses to ship the directory as one compressed archive; the default images do.
Parameters
Returns
Promise<void>

downloadFile()

downloadFile(files): Promise<void>
Copy a file from the Sailbox to localPath.Missing parent directories are created and an existing file is replaced. The copy keeps the guest file’s permission bits. The file appears at localPath only once it has arrived whole, so a failed download leaves no partial file behind. For a whole tree, downloadDir ships one archive instead of one request per file.
Parameters
Returns
Promise<void>

downloadUrl()

downloadUrl(path, options?): Promise<string>
Mint a URL that serves one file over HTTPS with no API key.Anyone who holds the URL can read path, and nothing else on the Sailbox, until it expires: expiresInSeconds after minting, one hour by default and seven days at most. Share a file by URL covers caching, rewrites, and sleeping or paused Sailboxes.
Parameters
Returns
Promise<string>

exists()

exists(path, options?): Promise<boolean>
Whether path exists in the guest. Follows symlinks (like test -e), so a dangling symlink reports false even though ls lists it. A user reports existence as observable by that user: a path the user lacks permission to reach also reports false.
Parameters
Returns
Promise<boolean>

ls()

ls(path, options?): Promise<DirEntry[]>
List a directory’s immediate entries as DirEntry records (no recursion). A missing path throws, as does a path that is not a directory and a listing too large for the exec output cap. An entry whose name is not valid UTF-8 fails the listing, since the path API cannot address it. A user runs the listing as that user, so a directory it may not read fails with a permission error.
Parameters
Returns
Promise<DirEntry[]>

mkdir()

mkdir(path, options?): Promise<void>
Create a directory and any missing parents (like mkdir -p); a no-op if it already exists. A user runs the mkdir as that user, so created directories are owned by it.
Parameters
Returns
Promise<void>

read()

read(path): Promise<Buffer<ArrayBufferLike>>
Read a guest file fully into memory (convenience over readStream).
Parameters
Returns
Promise<Buffer<ArrayBufferLike>>

readStream()

readStream(path): Promise<FileStream>
Open a streaming read of a guest file.
Parameters
Returns
Promise<FileStream>

remove()

remove(path, options?): Promise<void>
Remove a file or directory tree (like rm -rf); a no-op if it is already absent. A user runs the removal as that user, limiting it to what that user may delete.
Parameters
Returns
Promise<void>

uploadDir()

uploadDir(dirs): Promise<void>
Upload a local directory’s contents into a directory on the Sailbox.localDir’s entries land inside guestDir, which is created if needed. Entries the upload does not name are left in place; a same-named file is replaced. Uploaded files belong to the image’s USER, the same identity commands run as, so the code in the Sailbox can use them. When the image sets no USER, or that user cannot be resolved in the Sailbox, they belong to root. guestDir and any missing parents the upload creates get the same owner. Files keep their permission bits, except that the setuid, setgid, and sticky bits are cleared. A user (the same syntax the other operations take) gives the entries to that user instead, like COPY --chown; it must exist in the Sailbox, and like the other operations’ user it requires a Sailbox whose guest honors requested users. The Sailbox’s image must provide tar and gzip, which the transfer uses to ship the directory as one compressed archive; the default images do.
Parameters
Returns
Promise<void>

uploadFile()

uploadFile(files): Promise<void>
Copy a local file into the Sailbox at guestPath.Missing parent directories are created and an existing file is replaced. The file keeps its permission bits (0o644 on a local filesystem without them) and belongs to the image’s USER like a write, or to user when given. For a whole tree, uploadDir ships one archive instead of one request per file.
Parameters
Returns
Promise<void>

write()

write(path, data, options?): Promise<void>
Write data to a guest file: writeFiles with one entry. Strings use UTF-8. Missing parent directories are created unless createParents is false. Use writeStream to stream a large source.
Parameters
Returns
Promise<void>

writeFiles()

writeFiles(files, options?): Promise<void>
Write several complete files in one call. files maps each absolute guest path to its contents (strings use UTF-8). Each file is its own request, up to eight at a time, and every file gets the same options. A batch is not atomic across paths: the first failure stops the batch, files that already completed stay written, writes already in flight finish, and the error names the file that failed. A path may appear only once. Use writeStream to stream a large source.
Parameters
Returns
Promise<void>

writeStream()

writeStream(path, options?): Promise<FileWriter>
Open a streaming upload to a guest file.
Parameters
Returns
Promise<FileWriter>

FileWriter

A streaming write to a guest file. Push chunks with write, then confirm with finish; only finish commits the write. A writer that goes away without finishing (abort, an error path, or garbage collection) cancels the transfer instead; the guest file state is then unspecified.

Methods

[asyncDispose]()

[asyncDispose](): Promise<void>
await using support; same semantics as the synchronous form.
Returns
Promise<void>

[dispose]()

[dispose](): void
using support: aborts the write if it was never finished, so leaving scope on an error path cancels instead of committing a partial file. abort is synchronous, so the plain form suffices.
Returns
void

abort()

abort(): void
Abort the write: cancel the request so the server does not commit it. Idempotent. A later finish reports the abort instead of succeeding; the guest file state after an abort is unspecified.
Returns
void

finish()

finish(): Promise<void>
Confirm the write, creating an empty file if nothing was written.
Returns
Promise<void>

toWritable()

toWritable(): Writable
Adapt to a Node Writable: end() runs finish (only that commits the write), destroying the stream aborts it, and backpressure follows the underlying transfer since each chunk’s callback fires when its write resolves.
Returns
Writable

write()

write(data): Promise<void>
Write bytes (a string is encoded as UTF-8). The SDK splits them into transport-sized chunks.
Parameters
Returns
Promise<void>

FileStream

An async-iterable download of a guest file. Chunks are Buffers; iteration ends at end of file. The underlying stream is released when iteration finishes or is abandoned (via a generator finally), or explicitly via close.

Implements

  • AsyncIterable<Buffer>

Methods

[asyncDispose]()

[asyncDispose](): Promise<void>
await using support.
Returns
Promise<void>

[asyncIterator]()

[asyncIterator](): AsyncIterator<Buffer<ArrayBufferLike>>
Returns
AsyncIterator<Buffer<ArrayBufferLike>>
Implementation of
AsyncIterable.[asyncIterator]

bytes()

bytes(): Promise<Buffer<ArrayBufferLike>>
Collect the whole file into a single Buffer.
Returns
Promise<Buffer<ArrayBufferLike>>

close()

close(): Promise<void>
Release the underlying download stream (idempotent).
Returns
Promise<void>

toReadable()

toReadable(): Readable
Adapt to a Node Readable.
Returns
Readable

SailboxCheckpoint

A durable checkpoint handle that can be used to start new Sailboxes with Sailbox.fromCheckpoint. Take one with Sailbox.checkpoint.Checkpoints belong to your organization. A checkpoint stops being available when it expires or is deleted.

Properties

Methods

delete()

delete(): Promise<void>
Delete this checkpoint. Starting a Sailbox from it fails afterwards. Sailboxes already started from it are unaffected.
Returns
Promise<void>

get()

static get(checkpointId, options?): Promise<SailboxCheckpoint>
Get a checkpoint by id. Rejects with NotFoundError if the checkpoint does not exist, has expired, or was deleted.
Parameters
Returns
Promise<SailboxCheckpoint>

list()

static list(options?): Promise<SailboxCheckpoint[]>
List your organization’s checkpoints that a Sailbox can still be started from, newest first.
Parameters
Returns
Promise<SailboxCheckpoint[]>

Volume

A managed volume that can be mounted into Sailboxes. Look one up (or mint it) with Volume.find, then pass it (or its Volume.id) in a Sailbox’s volumes mapping.Only the owning organization can attach a volume. Code in a Sailbox can read and write an attached volume unless the mount is read-only. Use separate volumes for workloads that must not share files.Volumes are currently in Alpha. To pilot them, reach out in the Sail Slack: https://join.slack.com/t/sailresearchcrew/shared_invite/zt-41pdcym9j-UU0Ey~A~r6n2H0DQVQsQHQ.

Properties

Accessors

fs

Get Signature
get fs(): VolumeFs
File operations on this volume: read, write, list, and transfer its files without mounting it in a Sailbox.
Returns
VolumeFs

Methods

delete()

delete(options?): Promise<boolean>
Delete this volume. The volume becomes unavailable at once. Resolves true if it was deleted, false if it was already gone (only possible with allowMissing).
Parameters
Returns
Promise<boolean>

find()

static find(name, options?): Promise<Volume>
Look up a volume by name, optionally minting it if missing.
Parameters
Returns
Promise<Volume>

fromMount()

static fromMount(path): Volume
Guest-side: load the volume handle for a path mounted into this Sailbox (reads the mount’s metadata; only available inside a guest).
Parameters
Returns
Volume

list()

static list(options?): Promise<Volume[]>
List volumes in the current org.
Parameters
Returns
Promise<Volume[]>

VolumeFs

File operations on a volume, reached via Volume.fs.The volume does not have to be mounted anywhere, so it can be filled before any Sailbox uses it. A Sailbox that mounts the volume sees each change within a few seconds of the call that made it resolving.For concurrent access from mounted Sailboxes, see the direct file access guide.Paths are relative to the volume’s root, with or without a leading slash: skills/review.md and /skills/review.md name the same file, which a Sailbox mounting the volume at /mnt/shared sees as /mnt/shared/skills/review.md. A path may not contain a .. segment.The operations match SailboxFs, without its user option. Files and directories created here belong to root: a command running in a Sailbox as another user can read them, and needs root to change them.A path that does not exist throws FileNotFoundError, and a volume that does not exist throws NotFoundError.

Methods

downloadDir()

downloadDir(dirs): Promise<void>
Download a directory’s contents from the volume into a local directory.volumeDir’s entries land inside localDir, which is created if needed ("/" downloads the whole volume). Entries the download does not name are left in place; a same-named file is replaced. A file that changes while the download runs may be captured partway through the change or fail the download, so download after writers finish. On Windows, a directory that contains symbolic links cannot be downloaded, since Windows restricts creating them. The directory travels as one compressed archive.
Parameters
Returns
Promise<void>

exists()

exists(path): Promise<boolean>
Whether path exists on the volume. Follows symlinks (like test -e), so a dangling symlink reports false even though ls lists it.
Parameters
Returns
Promise<boolean>

ls()

ls(path?): Promise<DirEntry[]>
List a directory’s immediate entries as DirEntry records, sorted by name (no recursion). With no path it lists the volume’s root. A missing path throws, as does a path that is not a directory. An entry whose name is not valid UTF-8 fails the listing, since a path could not address it.
Parameters
Returns
Promise<DirEntry[]>

mkdir()

mkdir(path): Promise<void>
Create a directory and any missing parents (like mkdir -p); a no-op if it already exists.
Parameters
Returns
Promise<void>

mv()

mv(src, dst): Promise<void>
Atomically move src to dst, or inside dst if it is a directory, in this volume. See the move guide.
Parameters
Returns
Promise<void>

read()

read(path): Promise<Buffer<ArrayBufferLike>>
Read a file on the volume fully into memory (convenience over readStream).
Parameters
Returns
Promise<Buffer<ArrayBufferLike>>

readStream()

readStream(path): Promise<FileStream>
Open a streaming read of a file on the volume. Keep reading once you start: a stream left unread for 60 seconds may be closed early, and the next read then fails.
Parameters
Returns
Promise<FileStream>

remove()

remove(path): Promise<void>
Remove a file or directory tree (like rm -rf); a no-op if it is already absent. The volume’s root cannot be removed.
Parameters
Returns
Promise<void>

uploadDir()

uploadDir(dirs): Promise<void>
Upload a local directory’s contents into a directory on the volume.localDir’s entries land inside volumeDir, which is created if needed and defaults to the volume’s root. Entries the upload does not name are left in place; a same-named file is replaced atomically. Uploaded entries keep their permission bits (the setuid, setgid, and sticky bits are cleared) and modification times, and symlinks are stored as symlinks. The directory travels as one compressed archive. An upload is not atomic across files: after a failure, the files that already landed stay.
Parameters
Returns
Promise<void>

write()

write(path, data, options?): Promise<void>
Write data to a file on the volume: writeFiles with one entry. Strings use UTF-8. Missing parent directories are created unless createParents is false. An existing file is replaced atomically. Use writeStream to stream a large source.
Parameters
Returns
Promise<void>

writeFiles()

writeFiles(files, options?): Promise<void>
Write several complete files in one call. files maps each path to its contents (strings use UTF-8). Each file is its own request, up to eight at a time, and every file gets the same options. A batch is not atomic across paths: the first failure stops the batch, files that already completed stay written, writes already in flight finish, and the error names the file that failed. A path may appear only once. For a whole tree, uploadDir is faster: it sends one archive instead of one request per file.
Parameters
Returns
Promise<void>

writeStream()

writeStream(path, options?): Promise<FileWriter>
Open a streaming upload to a file on the volume. The file appears at path, replacing any existing file atomically, only when the writer’s finish succeeds; an aborted writer leaves path as it was. A writer that sends nothing for 60 seconds fails on its next write or finish, and also leaves path as it was.
Parameters
Returns
Promise<FileWriter>

Private registry images

See Private images for which login each registry takes.

RegistryLogin

A login for pulling private images whose references start with prefix: a registry host, optionally followed by a repository path, such as ghcr.io or ghcr.io/acme. A pull uses the login with the longest prefix that matches its reference, so a login for ghcr.io/acme applies before one for ghcr.io. A pull no login matches uses none.Pass logins to Image.fromDockerfile or Image.fromCompose as registryLogins. Image.fromRegistry, Image.fromAwsEcr, and Image.fromGcpArtifactRegistry take their login directly.Sail uses a login only to pull images. It is never stored in the image or written to build logs.

Example

Constructors

Constructor
new RegistryLogin(prefix, options): RegistryLogin
Parameters
Returns
RegistryLogin

Properties

Methods

awsEcr()
static awsEcr(host, options): RegistryLogin
A login for an Amazon ECR registry host, such as 123456789012.dkr.ecr.us-east-1.amazonaws.com, with the access key of an IAM identity that can pull from it.
Parameters
Returns
RegistryLogin
gcpArtifactRegistry()
static gcpArtifactRegistry(prefix, options): RegistryLogin
A login for a Google Artifact Registry prefix, such as us-docker.pkg.dev/my-project, with a service account’s JSON key.
Parameters
Returns
RegistryLogin

Guest identity

Identity of the Sailbox this code is running inside. These helpers read only local state and make no network call.

currentSailboxId()

currentSailboxId(): string
The id of the Sailbox this code is running inside. Only available inside a Sailbox; anywhere else it throws. Pass the result to Sailbox.get to get a handle to the Sailbox, which you can then read or Sailbox.sleep even without an API key.Prefer this over reading the SAILBOX_ID environment variable. When a Sailbox forks, a process carried across the fork keeps the environment it started with, so the variable can name the parent Sailbox. This function reads the identity Sail keeps for the running Sailbox, which Sail sets when the Sailbox starts and updates when it forks, so it names the Sailbox the code is actually running in.Code running in a container you start inside your Sailbox does not see this identity, so this throws there; acting on the Sailbox from such a container needs an API key.

Returns

string

isGuest()

isGuest(): boolean
Whether this code is running inside a Sailbox and can read its identity. Reads only local state and makes no network call. False from a container you start inside your Sailbox, where the Sailbox identity is not visible.

Returns

boolean

Egress policies

See Egress policy for what a policy controls, the document format, and examples. The entries below list the available TypeScript calls.

EgressPolicy

A saved egress policy: a named EgressPolicyDocument your organization can attach to any number of Sailboxes.An egress policy limits which hosts a Sailbox can connect to and can add credentials to the HTTPS requests it sends. Saving a policy gives the document a stable id that several Sailboxes can share. Only a saved policy can reference a Secret (${secrets.NAME}).
A policy’s document cannot be edited after it is created; create a new policy and switch each Sailbox to it. EgressPolicy.allowAll, EgressPolicy.allowOnly, EgressPolicy.noEgress, and EgressPolicy.noNetwork build the common documents without saving anything. The egress policy guide covers the document format in full.

Properties

Methods

delete()
delete(): Promise<void>
Delete the policy. Fails with EgressPolicyInUseError while a Sailbox that is not terminated still runs under it; switch those Sailboxes to another policy first.
Returns
Promise<void>
rename()
rename(name): Promise<EgressPolicy>
Give the policy a new name. Only the name changes; attachments and the document stay as they are. Returns the updated policy.
Parameters
Returns
Promise<EgressPolicy>
allowAll()
static allowAll(): EgressPolicyDocument
The document that lets a Sailbox reach every host: {}. A Sailbox created without a policy runs under it, and Sailbox.clearEgressPolicy puts one back to it.
Returns
EgressPolicyDocument
allowOnly()
static allowOnly(…hosts): EgressPolicyDocument
The document that lets a Sailbox reach only the given hosts: { allowlist: hosts }. Each host is a hostname such as pypi.org, a wildcard such as *.example.com, an IPv4 address, or an IPv4 range such as 203.0.113.0/24. *.example.com matches every host below it at any depth and never example.com itself. Use EgressPolicy.noEgress for no hosts at all.
Parameters
Returns
EgressPolicyDocument
create()
static create(name, document, options?): Promise<EgressPolicy>
Save document under name for your organization. The document cannot change afterwards. A ${secrets.NAME} reference in it must name a Secret that already exists. name need not be unique; its limits are in the reference.
Creating a policy is not retried on a network error, so a failed call may or may not have saved the policy; check EgressPolicy.list before calling again. The egress policy guide covers the document format.
Parameters
Returns
Promise<EgressPolicy>
get()
static get(policyId, options?): Promise<EgressPolicy>
Fetch a saved policy by id, including its document.
Parameters
Returns
Promise<EgressPolicy>
list()
static list(options?): Promise<EgressPolicySummary[]>
List your organization’s saved policies, newest first.Each row is an EgressPolicySummary: entry and rule counts, plus how many Sailboxes other than terminated ones run under the policy. A row carries no document; fetch one with EgressPolicy.get. Sail returns the list in pages, and this method keeps fetching until it has every policy or has reached limit.
Parameters
Returns
Promise<EgressPolicySummary[]>
noEgress()
static noEgress(): EgressPolicyDocument
The document that stops every outbound connection but Sail’s own API host: { allowlist: [] }. Other name lookups fail too. Inbound connections still work, so ingress ports and SSH do.
Returns
EgressPolicyDocument
noNetwork()
static noNetwork(): EgressPolicyDocument
The document that cuts a Sailbox off from the network entirely: { no_network: true }. No outbound connections, no name lookups, and no ingress ports or SSH. No other field may be set beside it.
Returns
EgressPolicyDocument

Secret

A value an egress policy rule can insert into matching HTTPS requests, or a RegistryLogin can log in to a registry with.Secrets belong to your organization. Sail never returns a stored value. Get and list calls return only the secret’s name and timestamps.

Properties

Methods

delete()
delete(): Promise<void>
Delete this secret.A secret cannot be deleted while an egress policy refers to it; throws SecretInUseError until every referencing policy is deleted. Summaries from EgressPolicy.list include the secret names they use.
Returns
Promise<void>
deleteByName()
static deleteByName(name, options?): Promise<void>
Delete the named secret. Same contract as Secret.delete.
Parameters
Returns
Promise<void>
ephemeral()
static ephemeral(value): EphemeralSecret
A value used only by the call it is passed to, such as a RegistryLogin for one image build. It has no name, is never listed, and nothing else in your organization can use it.
Parameters
Returns
EphemeralSecret
get()
static get(name, options?): Promise<Secret>
Fetch one secret’s name and timestamps. The value is never returned. Throws NotFoundError when no secret has that name.
Parameters
Returns
Promise<Secret>
list()
static list(options?): Promise<Secret[]>
List your organization’s secret names and timestamps, sorted by name.
Parameters
Returns
Promise<Secret[]>
named()
static named(name): SecretRef
A reference to the organization secret called name, for settings that read a stored secret, such as a RegistryLogin password. The secret does not have to exist yet when the reference is made.
Parameters
Returns
SecretRef
set()
static set(name, value, options?): Promise<Secret>
Set (create or update) the named secret’s value. An egress policy inserts it with ${secrets.NAME}.After this call succeeds, the next matching request from any Sailbox whose egress policy uses this secret gets the new value.Names start with a letter or number and use letters, numbers, underscores, and dashes (up to 128 characters). Values cannot be empty. They can be up to 64 KiB and may span lines, but cannot contain other ASCII control characters such as tabs.
Parameters
Returns
Promise<Secret>

EphemeralSecret

A secret value held only by this process and the call it is passed to. Create one with Secret.ephemeral. Its value never appears when the object is printed or serialized.

Client

A configured Sail client: the low-level, one-method-per-operation surface (one config snapshot; env vars are read at construction). Every client operation is here. The object-model API (Sailbox, App, Volume) is built on top of it.Construct with Client.fromEnv or Client.fromConfig.

Methods

addCronJob()

addCronJob(sailboxId, schedule, command, options?): Promise<CronJobInfo>
Add a job that runs a shell command in a Sailbox on a cron schedule. See SailboxCron.add.
Parameters
Returns
Promise<CronJobInfo>

buildImageDefinition()

buildImageDefinition(def, timeoutSeconds, options?): Promise<ImageSpec>
Resolve an image definition and build it to ready, returning the content-addressed ImageSpec to create Sailboxes from. A bare Debian or devbox base image skips the build; timeoutSeconds bounds the whole pipeline (hashing, uploads, and the build).By default, Sail may reuse an existing ready build for this definition. forceBuild builds it again and waits for the fresh build to become ready: new Sailboxes use the fresh image once it is ready, Sailboxes that already exist keep the filesystem they were created with, and a forced build that fails changes nothing. For an image imported with Image.fromRegistry through a tag, a forced build also asks the registry what the tag points at now and builds that version. The tag then means that version for your whole organization, while specs built earlier keep their pinned version. A forced build of an image built with Image.fromDockerfile looks up the tags its FROM and COPY --from instructions name and moves those pins for your whole organization, while specs built earlier keep the versions their build used. If forced builds overlap, the last-requested one that succeeds decides which image new Sailboxes use and, for a tag, what the tag means.
Parameters
Returns
Promise<ImageSpec>

buildSpecToReady()

buildSpecToReady(spec, timeoutSeconds, options?): Promise<ImageBuild>
Build an already-resolved spec to ready (submit + poll), bounded by timeoutSeconds. forceBuild builds the image again even if a build already exists; see Client.buildImageDefinition.
Parameters
Returns
Promise<ImageBuild>

cancelImageBuild()

cancelImageBuild(buildId): Promise<ImageBuildInfo>
Cancel an image build and return its updated state. Cancelling a build that is queued or building stops it, and anything waiting on the build fails with “image build was cancelled”. A build that has already finished cannot be cancelled: the call fails with a 409 ApiError.
Parameters
Returns
Promise<ImageBuildInfo>

checkpointSailbox()

checkpointSailbox(sailboxId, options?): Promise<SailboxCheckpoint>
Take a checkpoint of a Sailbox. name sets the handle’s display name; ttlSeconds, when given, overrides the server’s default retention window.
Parameters
Returns
Promise<SailboxCheckpoint>

createEgressPolicy()

createEgressPolicy(name, document): Promise<EgressPolicyInfo>
Save an egress policy from JSON-encoded document text. The document cannot change after creation. Most callers should use EgressPolicy.create, which accepts an object.
Parameters
Returns
Promise<EgressPolicyInfo>

createFromCheckpoint()

createFromCheckpoint(params): Promise<SailboxHandle>
Create a new Sailbox from a checkpoint.
Parameters
Returns
Promise<SailboxHandle>

createSailbox()

createSailbox(req): Promise<SailboxHandle>
Create a Sailbox. image defaults to a plain Debian base.
Parameters
Returns
Promise<SailboxHandle>

deleteCheckpoint()

deleteCheckpoint(checkpointId): Promise<void>
Delete a checkpoint. Starting a Sailbox from it fails afterwards; Sailboxes already started from it are unaffected.
Parameters
Returns
Promise<void>

deleteEgressPolicy()

deleteEgressPolicy(policyId): Promise<void>
Delete a saved egress policy by id. While the policy is attached to a Sailbox, the call fails with a 409 ApiError (EgressPolicy.delete maps that to EgressPolicyInUseError).
Parameters
Returns
Promise<void>

deleteSecret()

deleteSecret(name): Promise<void>
Delete a secret by name. While an egress policy refers to it, the call fails with a 409 ApiError (Secret.delete maps that to SecretInUseError).
Parameters
Returns
Promise<void>

deleteVolume()

deleteVolume(volumeId, allowMissing?): Promise<VolumeInfo | null>
Delete a volume by id. allowMissing tolerates an already-deleted volume, resolving null instead of throwing.
Parameters
Returns
Promise<VolumeInfo | null>

downloadDir()

downloadDir(sailboxId, dirs): Promise<void>
Download a guest directory’s contents into a local directory, named in dirs.
Parameters
Returns
Promise<void>

downloadFile()

downloadFile(sailboxId, files): Promise<void>
Copy a guest file to the local filesystem, named in files.
Parameters
Returns
Promise<void>

downloadUrl()

downloadUrl(sailboxId, path, options?): Promise<string>
Mint a signed URL that serves one file without an API key.
Parameters
Returns
Promise<string>

enableSsh()

enableSsh(sailboxId, options?): Promise<SshEndpoint | null>
Enable SSH on a Sailbox: trust the org SSH CA, start sshd, and expose guest port 22 as TCP once the CA-only daemon owns it. A non-empty allowlist restricts port 22 to those source addresses or ranges, replacing any existing restriction. With wait (the default), polls until the endpoint is reachable and returns it, throwing TimeoutError if it is not within timeoutSeconds; with wait: false, skips the probe and resolves null. See SSH lifecycle for when SSH restarts on its own and when to enable it again.
Parameters
Returns
Promise<SshEndpoint | null>

exec()

exec(sailboxId, command, options?): Promise<ExecProcess>
Run a command in a Sailbox and return a handle to the live process. A string command is run via /bin/sh -lc; a string[] is exec’d directly. By default (outputMode: "auto") a stream you are consuming pauses the command when you fall behind, so nothing is lost until a cancel or the exec timeout ends the pauses, and a stream you are not consuming keeps only its most recent 1 MiB. outputMode and outputBufferBytes change that (see ExecProcess and ExecOptions). cwd runs either form in a directory; background applies to string commands (see ExecOptions). Stopping the command is the caller’s job via ExecProcess.cancel.
Parameters
Returns
Promise<ExecProcess>

exposeListener()

exposeListener(sailboxId, guestPort, protocol?, allowlist?): Promise<Listener>
Expose a guest port at runtime. Re-exposing a port under the same protocol sets its allowlist to what you pass, so pass the whole list every time; an empty one clears the restriction and reopens the port. The route status starts “unknown”: the response confirms configuration, not reachability.
Parameters
Returns
Promise<Listener>

findApp()

findApp(name, mintIfMissing?): Promise<AppInfo>
Find an app by name; mintIfMissing creates it when absent.
Parameters
Returns
Promise<AppInfo>

getCheckpoint()

getCheckpoint(checkpointId): Promise<SailboxCheckpoint>
Fetch a checkpoint by id. A deleted or expired checkpoint is not found.
Parameters
Returns
Promise<SailboxCheckpoint>

getEgressPolicy()

getEgressPolicy(policyId): Promise<EgressPolicyInfo>
Fetch one saved egress policy by id, including its document.
Parameters
Returns
Promise<EgressPolicyInfo>

getImageBuild()

getImageBuild(buildId): Promise<ImageBuildInfo>
Fetch one of the organization’s image builds by id.
Parameters
Returns
Promise<ImageBuildInfo>

getListener()

getListener(sailboxId, guestPort, options?): Promise<Listener>
Fetch one listener by guest port without waking the Sailbox: the port’s http or tcp listener, or options.protocol.
Parameters
Returns
Promise<Listener>

getSailbox()

getSailbox(sailboxId): Promise<SailboxInfo>
Fetch one Sailbox by id.
Parameters
Returns
Promise<SailboxInfo>

getSecret()

getSecret(name): Promise<SecretInfo>
Fetch one secret’s name and timestamps, never its value.
Parameters
Returns
Promise<SecretInfo>

getVolume()

getVolume(name, mintIfMissing?): Promise<VolumeInfo>
Look up a volume by name; mintIfMissing creates it when absent.
Parameters
Returns
Promise<VolumeInfo>

listApps()

listApps(): Promise<AppInfo[]>
Every app the current org owns, newest first.
Returns
Promise<AppInfo[]>

listCheckpoints()

listCheckpoints(query?): Promise<SailboxCheckpoint[]>
List the organization’s checkpoints that a Sailbox can still be started from, newest first. A checkpoint must match every filter that is set.
Parameters
Returns
Promise<SailboxCheckpoint[]>

listCronJobs()

listCronJobs(sailboxId): Promise<CronJobInfo[]>
List all of a Sailbox’s cron jobs, oldest first, without waking it.
Parameters
Returns
Promise<CronJobInfo[]>

listDir()

listDir(sailboxId, path, user?): Promise<DirEntry[]>
List a directory’s immediate entries as structured records.
Parameters
Returns
Promise<DirEntry[]>

listEgressPolicies()

listEgressPolicies(params): Promise<EgressPolicyPage>
List saved egress policies with paging and an optional id or name search.
Parameters
Returns
Promise<EgressPolicyPage>

listImageBuilds()

listImageBuilds(query?): Promise<ImageBuildInfo[]>
List one page of the organization’s image builds, newest first. A page with fewer than limit builds is the last one. List calls are rate limited for the organization, so wait a few seconds between repeated calls.
Parameters
Returns
Promise<ImageBuildInfo[]>

listListeners()

listListeners(sailboxId): Promise<Listener[]>
List a Sailbox’s listeners without waking it.
Parameters
Returns
Promise<Listener[]>

listSailboxes()

listSailboxes(params?): Promise<SailboxInfoPage>
List one page of Sailboxes in the current org.
Parameters
Returns
Promise<SailboxInfoPage>

listSecrets()

listSecrets(): Promise<SecretInfo[]>
List the organization’s secret names and timestamps.
Returns
Promise<SecretInfo[]>

listVolumes()

listVolumes(maxObjects?): Promise<VolumeInfo[]>
List volumes in the current org.
Parameters
Returns
Promise<VolumeInfo[]>

makeDir()

makeDir(sailboxId, path, user?): Promise<void>
Create a directory and any missing parents (like mkdir -p); a no-op if it already exists.
Parameters
Returns
Promise<void>

mountVolume()

mountVolume(sailboxId, volumeId, mountPath, readOnly?, cacheSeconds?): Promise<void>
Add a volume to a running Sailbox. A Sailbox can mount at most four volumes; one volume at several paths counts once.
Parameters
Returns
Promise<void>

orgSshCaPublicKey()

orgSshCaPublicKey(): Promise<string>
Fetch (creating on first use) the org SSH certificate authority public key. Used to preflight SSH before a Sailbox is provisioned.
Returns
Promise<string>

pathExists()

pathExists(sailboxId, path, user?): Promise<boolean>
Whether path exists in the guest.
Parameters
Returns
Promise<boolean>

pauseSailbox()

pauseSailbox(sailboxId): Promise<void>
Pause a Sailbox in memory.
Parameters
Returns
Promise<void>

readStream()

readStream(sailboxId, path): Promise<FileStream>
Open a streaming read of a guest file.
Parameters
Returns
Promise<FileStream>

rebootSailbox()

rebootSailbox(sailboxId): Promise<RebootResult>
Reboot a Sailbox on its current disk (now if running, else at next wake).
Parameters
Returns
Promise<RebootResult>

removeCronJob()

removeCronJob(sailboxId, cronJobId): Promise<void>
Remove a cron job. A run that is already due may still start, and one that started keeps going.
Parameters
Returns
Promise<void>

removePath()

removePath(sailboxId, path, user?): Promise<void>
Remove a file or directory tree (like rm -rf); a no-op if it is already absent.
Parameters
Returns
Promise<void>

renameEgressPolicy()

renameEgressPolicy(policyId, name): Promise<EgressPolicyInfo>
Rename a saved egress policy. Its document stays unchanged. Names follow the same rules as EgressPolicy.create.
Parameters
Returns
Promise<EgressPolicyInfo>

resolveImage()

resolveImage(def): Promise<ImageSpec>
Resolve an image definition into a content-addressed ImageSpec: the SDK walks local directories (gitignore-style ignore), hashes every file, and uploads content the server does not already have.
Parameters
Returns
Promise<ImageSpec>

resumeSailbox()

resumeSailbox(sailboxId): Promise<SailboxHandle>
Resume a paused or sleeping Sailbox.
Parameters
Returns
Promise<SailboxHandle>

sailboxEgressPolicy()

sailboxEgressPolicy(sailboxId): Promise<SailboxEgressPolicy>
The egress policy Sail enforces on a Sailbox: the document, plus the saved policy’s id and name when one is attached.
Parameters
Returns
Promise<SailboxEgressPolicy>

setSailboxAutoSleep()

setSailboxAutoSleep(sailboxId, autoSleep): Promise<void>
Replace when Sail may sleep a Sailbox on its own. Each call replaces the whole setting: switching to { automatic: false } clears any minimum wait set earlier. Most callers use Sailbox.setAutoSleep.
Parameters
Returns
Promise<void>

setSailboxEgressPolicy()

setSailboxEgressPolicy(sailboxId, policy): Promise<SailboxEgressPolicy>
Replace a Sailbox’s egress policy with a saved policy (an EgressPolicy, a listing summary, or an id) or a document object. Returns the new policy, which applies to connections the Sailbox opens after the call. Fails with a 409 ApiError when the new document is EgressPolicy.noNetwork and the Sailbox has exposed ports or SSH.
Parameters
Returns
Promise<SailboxEgressPolicy>

setSailboxLimits()

setSailboxLimits(sailboxId, options): Promise<LimitsResult>
Set a Sailbox’s vCPU count, memory limit, or disk limit (now if running, else at next wake). Regardless of configured limits, you are only charged for the resources the Sailbox workload actually consumes at runtime. Rejects with InvalidArgumentError when no option is given.
Parameters
Returns
Promise<LimitsResult>

setSailboxVisibility()

setSailboxVisibility(sailboxId, visibility): Promise<"org" | "private">
Change who may operate a Sailbox and return the visibility now in effect. Most callers use Sailbox.setVisibility.
Parameters
Returns
Promise<"org" | "private">

setSecret()

setSecret(name, value): Promise<SecretInfo>
Set (create or update) an organization secret. Sail never returns the stored value. After this resolves, the next matching request from a Sailbox whose egress policy uses the secret gets the new value. Names and values follow the same rules as Secret.set.
Parameters
Returns
Promise<SecretInfo>

shell()

shell(sailboxId, command?, options?): Promise<number>
Open an interactive pty session on a Sailbox, bridged to the local terminal: raw keystrokes reach the remote process, output renders locally, and resizes propagate. Resolves with the remote process’s exit code. Requires an interactive terminal (stdin and stdout TTYs). The session reconnects after a dropped connection, does not keep an idle Sailbox awake, and wakes a sleeping Sailbox on the next key pressed.
Parameters
Returns
Promise<number>

sleepSailbox()

sleepSailbox(sailboxId, wakeAt?): Promise<string | null>
Sleep a Sailbox to disk (wakes on traffic), optionally scheduling a wall-clock wake first. wakeAt is an RFC 3339 timestamp; the returned value is the effective (sooner) wake time, or null when no wake was requested. Most callers use Sailbox.sleep, which takes and returns Date.
Parameters
Returns
Promise<string | null>

terminateSailbox()

terminateSailbox(sailboxId): Promise<void>
Terminate a Sailbox (idempotent).
Parameters
Returns
Promise<void>

unexposeListener()

unexposeListener(sailboxId, guestPort, options?): Promise<void>
Remove a runtime ingress port: every listener on it, or only options.protocol.
Parameters
Returns
Promise<void>

upgradeSailbox()

upgradeSailbox(sailboxId): Promise<UpgradeResult>
Upgrade a Sailbox’s runtime (now if running, else at next wake).
Parameters
Returns
Promise<UpgradeResult>

uploadDir()

uploadDir(sailboxId, dirs): Promise<void>
Upload a local directory’s contents into a guest directory, named in dirs. user gives the uploaded entries to that user instead of the image’s USER.
Parameters
Returns
Promise<void>

uploadFile()

uploadFile(sailboxId, files): Promise<void>
Copy a local file into the guest, named in files. user gives the file to that user instead of the image’s USER.
Parameters
Returns
Promise<void>

volumeDownloadDir()

volumeDownloadDir(volumeId, dirs): Promise<void>
Download a volume directory’s contents into a local directory, named in dirs.
Parameters
Returns
Promise<void>

volumeListDir()

volumeListDir(volumeId, path): Promise<DirEntry[]>
List a volume directory’s immediate entries as structured records.
Parameters
Returns
Promise<DirEntry[]>

volumeMakeDir()

volumeMakeDir(volumeId, path): Promise<void>
Create a directory on a volume and any missing parents; a no-op if it already exists.
Parameters
Returns
Promise<void>

volumeMovePath()

volumeMovePath(__namedParameters): Promise<void>
Atomically move a path to a destination or into an existing directory in the same volume.
Parameters
Returns
Promise<void>

volumePathExists()

volumePathExists(volumeId, path): Promise<boolean>
Whether path exists on a volume.
Parameters
Returns
Promise<boolean>

volumeReadStream()

volumeReadStream(volumeId, path): Promise<FileStream>
Open a streaming read of a file on a volume.
Parameters
Returns
Promise<FileStream>

volumeRemovePath()

volumeRemovePath(volumeId, path): Promise<void>
Remove a file or directory tree from a volume; a no-op if it is already absent.
Parameters
Returns
Promise<void>

volumeUploadDir()

volumeUploadDir(volumeId, dirs): Promise<void>
Upload a local directory’s contents into a directory on a volume, named in dirs.
Parameters
Returns
Promise<void>

volumeWriteFiles()

volumeWriteFiles(volumeId, files, options?): Promise<void>
Write several complete files to a volume in one call, up to eight at a time, stopping at the first failure.
Parameters
Returns
Promise<void>

volumeWriteStream()

volumeWriteStream(volumeId, path, options?): Promise<FileWriter>
Open a streaming upload to a file on a volume.
Parameters
Returns
Promise<FileWriter>

waitForListener()

waitForListener(sailboxId, guestPort, timeoutSeconds, options?): Promise<Listener>
Block until the listener on guestPort is ready and return it, throwing TimeoutError after timeoutSeconds. An HTTP listener is ready once the guest server answers; a TCP listener once the guest sends bytes or holds the connection open; a UDP listener once its route is active, without contacting the guest. A connectivity check, not an application health check. options.protocol picks the listener as in getListener.
Parameters
Returns
Promise<Listener>

writeFiles()

writeFiles(sailboxId, files, options?): Promise<void>
Write several complete files in one call, up to eight at a time, stopping at the first failure.
Parameters
Returns
Promise<void>

writeStream()

writeStream(sailboxId, path, options?): Promise<FileWriter>
Open a streaming upload to a guest file.
Parameters
Returns
Promise<FileWriter>

fromConfig()

static fromConfig(config): Client
Build a client from an explicit ClientConfig.
Parameters
Returns
Client

fromEnv()

static fromEnv(): Client
Build a client from the environment (SAIL_API_KEY, …).
Returns
Client

defaultClient()

defaultClient(): Client
The process-wide client used by the object-model statics (Sailbox, App, Volume) when no explicit client is passed. Created lazily from the environment on first use.

Returns

Client

setDefaultClient()

setDefaultClient(client): void
Override (or clear, with undefined) the process-wide default client. Useful for tests or to point the object-model API at an explicitly configured client.

Parameters

Returns

void

resolveConfig()

resolveConfig(): ResolvedConfig
Resolve the SDK config from the environment (SAIL_API_KEY, SAIL_API_URL, SAILBOX_API_URL, …) and ~/.sail, without requiring an API key. This is the same resolution a client performs at construction.

Returns

ResolvedConfig

isSailError()

isSailError(err): err is SailError
Whether err is a SailError, matched on the stable shape (code string plus retryable boolean) rather than the prototype chain. Use it where instanceof can lie: across realms (worker threads, vm contexts) or when two copies of the SDK are loaded. It does not survive structuredClone or postMessage serialization, which strip an Error’s custom fields; send { name, message, code, retryable } yourself when an error must cross a serialization boundary.

Parameters

Returns

err is SailError

Types

Plain data types accepted by and returned from the calls above.

AddLocalDir

A tree of local files copied into the image.

Properties


AddLocalDirFile

One file within an addLocalDir step.

Properties


AddLocalDirOptions

Options for Image.addLocalDir.

Properties


AddLocalFile

One local file copied into the image, referenced by content hash.

Properties


AddLocalFileOptions

Options for Image.addLocalFile.

Properties


AppInfo

A Sail app.

Properties


AutoSleep

AutoSleep = AutomaticSleep | NeverSleep
When Sail may put a Sailbox to sleep on its own.Sail sleeps idle Sailboxes and wakes them when needed. Waking takes a few seconds, so the first request or command after a sleep is slower than usual.Sail sleeps a Sailbox once it has been truly idle for a minimum time, 30 seconds by default. minSecondsBeforeSleep sets your own minimum. See Autosleep. Calling sleep() yourself is unaffected, and so are pause, resume, and scheduled wakes.The two forms are alternatives, so minSecondsBeforeSleep cannot be combined with turning automatic sleep off.

AutomaticSleep

Let Sail decide when to sleep a Sailbox, optionally after a minimum wait.

Properties


BaseImage

BaseImage = "debian" | "devbox"

CancelOptions

Options for cancelling an exec.

Properties


CheckpointOptions

Options for Sailbox.checkpoint.

Properties


ClientConfig

Explicit client configuration (an alternative to environment resolution).

Extends

  • Omit<native.ClientConfig, "mode">

Properties


ClientOptions

Options for statics that select which Client to use.

Extended by

Properties


ComposeFile

One compose file of a project.

Properties


ComposeProject

A Docker Compose project built into an image: the manifest of the uploaded project directory and the text of its compose files.

Properties


ComposeSourceInput

A Docker Compose project to build into the image.

Properties


ComposeUpOptions

Options for Sailbox.composeUp.

Properties


CreateSailboxOptions

Options for Sailbox.create, with an optional explicit client. image defaults to the prebuilt Debian base.

Extends

Properties


CreateSailboxRequest

The request Client.createSailbox accepts.

Properties


CronJobInfo

A command a Sailbox runs on a schedule. Timestamps are RFC 3339 strings.

Properties


CronOptions

Optional settings for SailboxCron.add.

Properties


DeleteVolumeOptions

Options for Volume.delete.

Properties


DirEntry

One entry in a directory listing from Sailbox.fs.ls or Volume.fs.ls, with type narrowed to DirEntryType.

Extends

  • Omit<native.DirEntry, "type">

Properties


DirEntryType

DirEntryType = "file" | "directory" | "symlink" | "other"
The kind of a directory entry, reported for the entry itself: a symlink is "symlink" regardless of what it points at.

DockerfileContextDir

One directory of a Dockerfile build context.

Properties


One symbolic link of a Dockerfile build context.

Properties


DockerfileFromResolution

What one external image reference in a Dockerfile resolved to when an image was built.

Properties


DockerfileImage

Your own Dockerfile built into an image, with its resolved build context. A RUN --mount of type cache, secret, or ssh, a bind mount reading from another image, mount options that are not literal text, and ONBUILD instructions are rejected.

Properties


DockerfileSourceInput

A Dockerfile to build into the image, with its local build context. A RUN --mount of type cache, secret, or ssh, a bind mount reading from another image, mount options that are not literal text, and ONBUILD instructions are rejected.

Properties


DownloadUrlOptions

Options for SailboxFs.downloadUrl.

Properties


EgressPolicyCloudIdentity

EgressPolicyCloudIdentity = { role_arn: string; type: "aws"; } | { access_key_id: string; secret_access_key: string; type: "sigv4"; }
A cloud account identity Sail signs requests as, so the Sailbox holds no key for it.aws is an IAM role Sail assumes with the Sailbox’s identity token. sigv4 is a stored access key pair, for AWS or a store that accepts AWS signatures; secret_access_key is ${secrets.NAME}, the secret holding the secret access key.

EgressPolicyDocument

An egress policy document: which hosts a Sailbox may connect to (allowlist and blocked), what happens to the HTTPS requests it sends (rules), or no network at all (no_network). Every field is optional; the empty document {} allows every host.
Sail validates the document when it is used and names any field that needs to be fixed. The egress policy guide describes every field.Sail’s own API host stays reachable under any allowlist, [] included, and cannot be blocked, so a Sailbox can always call Sail about itself. Only no_network removes it.

Properties


EgressPolicyForward

Send the request to a different HTTPS host.

Properties


EgressPolicyInfo

A saved policy as Client.createEgressPolicy, Client.getEgressPolicy, and Client.renameEgressPolicy return it; EgressPolicy wraps the same fields with methods.

Properties


EgressPolicyLike

EgressPolicyLike = EgressPolicy | EgressPolicySummary | string | EgressPolicyDocument
What Sailbox.create and Sailbox.setEgressPolicy accept as a policy: a saved EgressPolicy, a listing summary, a policy id, or a document object such as { allowlist: ["pypi.org"] }.

EgressPolicyMatcher

EgressPolicyMatcher = string | { equals: string; } | { prefix: string; } | { one_of: readonly string[]; }
Match one exact string, a prefix, or one string from a list. A plain string is an exact match.

EgressPolicyNameValueMatcher

EgressPolicyNameValueMatcher = { name?: EgressPolicyMatcher; present?: true; value?: EgressPolicyMatcher; } | { name: EgressPolicyMatcher; present: false; value?: never; }
Match a header or query parameter. The request must carry an entry whose name and value meet the conditions given, or, with present: false, carry no entry of that name.

EgressPolicyPage

One page returned by Client.listEgressPolicies.

Properties


EgressPolicyRequestChange

Change the request before it is sent. At least one of set, add, remove, replace, or cloud_identity is required, and each of the first four names at least one field.set.headers, set.query, set.json, and set.form are templates: ${secrets.NAME} inserts a secret, and a literal dollar sign is written $$. No other field may reference a secret.

Properties


EgressPolicyRequestMatch

The conditions a request must meet for a rule to apply. Every condition given must hold, and at least one is required.

Properties


EgressPolicyResponse

Answer the request in place of the destination. The request is not sent on.

Properties


EgressPolicyRule

EgressPolicyRule = { forward?: never; match?: EgressPolicyRequestMatch; request?: never; respond: EgressPolicyResponse; } | { forward?: EgressPolicyForward; match?: EgressPolicyRequestMatch; request?: EgressPolicyRequestChange; respond?: never; }
One rule. match narrows which requests it covers; omitting it matches every request, which is only allowed on the last rule. The first matching rule decides the outcome, so order matters.A rule either answers the request itself (respond) or sends it on: to another HTTPS host (forward), changed first (request), both, or as it is.

EgressPolicySummary

A policy as returned by EgressPolicy.list, with usage counts but without the document. Fetch the full policy with EgressPolicy.get.

Properties


EgressPolicyTLSConfig

How Sail connects to one host. At least one of trusted_cas or client_certificate is required.

Properties


EgressPolicyValueMap

Header or query parameter names, each with one or more values.

Indexable

[name: string]: string | readonly string[]

EnableSshOptions

Options for enabling SSH on a Sailbox.

Properties


ExecOptions

Extends

  • Omit<native.ExecStartOptions, "env" | "outputMode" | "pty" | "term" | "cols" | "rows">

Properties


ExecResult

The result of a finished exec.stdout and stderr hold only each stream’s buffer, its most recent output (outputBufferBytes, 1 MiB by default). To get every byte, consume the live stream right after exec() returns; see ExecProcess for how consuming a stream affects the command.

Properties


ExposeOptions

Options for Sailbox.expose.

Properties


FindAppOptions

Options for App.find.

Extends

Properties


FindVolumeOptions

Options for Volume.find.

Extends

Properties


FromAwsEcrOptions

Options for Image.fromAwsEcr.

Properties


FromCheckpointOptions

Options for Sailbox.fromCheckpoint.

Extends

Properties


FromCheckpointRequest

The create-from-checkpoint request.

Extended by

Properties


FromComposeOptions

Options for Image.fromCompose.

Properties


FromDockerfileOptions

Options for Image.fromDockerfile.

Properties


FromGcpArtifactRegistryOptions

Options for Image.fromGcpArtifactRegistry.

Properties


FromRegistryOptions

Options for Image.fromRegistry.

Properties


FsOptions

Options for the directory helpers (SailboxFs.mkdir, SailboxFs.remove, SailboxFs.exists, SailboxFs.ls).

Properties


HttpEndpoint

The routable HTTPS address of an http listener.

Properties


ImageArchitecture

ImageArchitecture = "amd64" | "arm64"

ImageBuild

The state of a custom image build.

Extends

  • Omit<native.ImageBuild, "status">

Properties


ImageBuildInfoStatus

ImageBuildInfoStatus = "queued" | "building" | "ready" | "failed" | "cancelled" | string & object
Status of an image build. Sail can add statuses later, so handle a value you do not recognize.

ImageBuildOptions

Options for Image.build.

Properties


ImageBuildStatus

ImageBuildStatus = "unknown" | "queued" | "building" | "ready" | "failed"
The status of a custom image build.

ImageBuildStatusFilter

ImageBuildStatusFilter = "queued" | "building" | "ready" | "failed" | "cancelled"
The statuses you can filter an image build list by.

ImageBuildStep

ImageBuildStep = { addLocalDir?: never; addLocalFile?: never; aptInstall: PackageInstall; composeProject?: never; pipInstall?: never; runCommand?: never; } | { addLocalDir?: never; addLocalFile?: never; aptInstall?: never; composeProject?: never; pipInstall: PackageInstall; runCommand?: never; } | { addLocalDir?: never; addLocalFile?: never; aptInstall?: never; composeProject?: never; pipInstall?: never; runCommand: RunCommand; } | { addLocalDir?: never; addLocalFile: AddLocalFile; aptInstall?: never; composeProject?: never; pipInstall?: never; runCommand?: never; } | { addLocalDir: AddLocalDir; addLocalFile?: never; aptInstall?: never; composeProject?: never; pipInstall?: never; runCommand?: never; } | { addLocalDir?: never; addLocalFile?: never; aptInstall?: never; composeProject: ComposeProject; pipInstall?: never; runCommand?: never; }
One build step: exactly one operation. Each union member never-types the other operations, so a step that sets two of them is a compile error (a bare union of the operations would accept it).

ImageDefinition

A custom image definition: a base, registry, Dockerfile, or Compose image plus ordered build steps, where local-file steps still reference paths on this machine.

Properties


ImageDefinitionStep

One image-definition step. Exactly one of the fields must be set.

Properties


ImageSpec

A Sailbox image: a base, registry, Dockerfile, or Compose image plus ordered build steps.

Extends

  • Omit<native.ImageSpec, "base" | "buildSteps" | "architecture" | "filesystem">

Properties


IngressPortInput

A guest port to reserve for ingress at create time.

Extends

  • Omit<native.IngressPortInput, "protocol" | "allowlist">

Properties


IngressProtocol

IngressProtocol = "tcp" | "http" | "udp"
The protocol you request when exposing a port.

IngressScheme

IngressScheme = "path" | "subdomain"
How a listener’s URL is addressed under ingressBase.

LimitsResult

The limits a Sailbox has after a set-limits call, or will have at its next wake.

Extends

  • Omit<native.LimitsResult, "status" | "size">

Properties


ListCheckpointsOptions

Options for SailboxCheckpoint.list. A checkpoint must match every filter that is set.

Extends

Properties


ListCheckpointsQuery

Filters for listing checkpoints. A checkpoint must match every filter that is set.

Properties


ListEgressPoliciesOptions

Options for EgressPolicy.list.

Extends

Properties


ListImageBuildsOptions

Options for ImageBuildInfo.list.

Extends

Properties


ListImageBuildsQuery

Filters and paging for listing image builds.

Extended by

Properties


ListSailboxesOptions

Options for Sailbox.list: the server-side filters, a total-cap limit, and an optional client.

Extends

Properties


ListSailboxesPageOptions

Options for Sailbox.listPage: the same filters as ListSailboxesOptions, plus limit/offset page selection and an optional client.

Extends

Properties


ListSailboxesQuery

Filters for listing Sailboxes.

Extends

  • Omit<native.ListSailboxesQuery, "status" | "statuses" | "excludeStatuses" | "order">

Extended by

Properties


ListVolumesOptions

Options for Volume.list.

Extends

Properties


Listener

An exposed guest port and how to reach it.

Properties


ListenerEndpoint

ListenerEndpoint = HttpEndpoint | TcpEndpoint | UdpEndpoint
How to reach an exposed listener; discriminate on kind.

ListenerOptions

Options for Sailbox.listener.

Properties


ListenerRouteStatus

ListenerRouteStatus = "unknown" | "pending" | "active" | "restoring" | "unavailable" | string & object
Status of a listener’s ingress route (open: tolerates unknown values).

LocalDirInput

A local directory tree to bake into the image (walked, hashed, and uploaded at resolve; symlinks skipped, file modes preserved).

Properties


LocalFileInput

One local file to bake into the image (hashed and uploaded at resolve).

Properties


NeverSleep

Stop Sail sleeping a Sailbox on its own. minSecondsBeforeSleep belongs to AutomaticSleep, so it cannot be combined with this.

Properties


OutputMode

OutputMode = "auto" | "pipe" | "tail" | "head"
What happens when a stream’s output buffer fills. Each stream has its own buffer, 1 MiB by default (outputBufferBytes in ExecOptions). Sending cancel() ends every pause: from then on each stream keeps only its most recent bytes, so a consumer more than a buffer behind skips. A command that ignores the cancel signal keeps running that way; cancel({ force: true }) stops it. close() releases the pauses at once. The exec timeout ends the streams instead, paused or not (see timeoutSeconds in ExecOptions).
  • "auto", the default: a stream you are consuming pauses the command when its buffer fills and resumes as you read, like a pipe; a stream you are not consuming never pauses the command and keeps only its most recent bytes.
  • "pipe": both streams pause the command when their buffer fills, until you consume them, so nothing is lost while you are late to start. Consume both streams, or the command stays paused on the one you ignore. Once a stream is released, it goes back to keeping only its most recent bytes. Not available with pty.
  • "tail": the command never pauses for you. Each stream keeps only its most recent bytes, even while you are consuming it, so a slow consumer skips output without notice; stdoutTruncated and stderrTruncated say only that the result holds less than the command wrote. A pty command always behaves this way.
  • "head": the command never pauses for you. Each stream keeps its first bytes, up to the buffer size, and drops everything after them, so the result is the start of what the command wrote and stdoutTruncated and stderrTruncated report the drop. A consumer gets those first bytes and nothing after them. The stream ends when the command does. Not available with pty.

PackageInstall

A set of packages to install (apt or pip).

Properties


Protocol

Protocol = "tcp" | "http" | "udp" | string & object
The protocol reported on a listener (open: tolerates unknown values).

PtyConfig

The pseudo-terminal a pty exec runs under. Every field has a default, so {} (or pty: true) is a usable terminal.

Properties


RebootResult

The outcome of a Sailbox reboot.

Extends

  • Omit<native.RebootResult, "status">

Properties


RegistryLoginInput

A login for pulling images from a private container registry.

Properties


RegistryLoginKind

RegistryLoginKind = "basic" | "aws_access_key" | "gcp_service_account"
How a RegistryLogin authenticates.

RegistryLoginOptions

Options for RegistryLogin.

Properties


RegistryLoginSecret

RegistryLoginSecret = SecretRef | EphemeralSecret
The password of a RegistryLogin: a stored organization secret from Secret.named, or a value sent only with this request from Secret.ephemeral.

ResolvedConfig

The config resolved from the environment and ~/.sail.

Extends

  • Omit<native.ResolvedConfig, "ingressScheme" | "mode">

Properties


RunCommand

A shell command to run during the build.

Properties


RunOptions

Options for Sailbox.run: the subset of ExecOptions that fits a buffered, run-to-completion command.

Extends

  • Pick<ExecOptions, "timeoutSeconds" | "cwd" | "env" | "user" | "idempotencyKey" | "outputBufferBytes">

Properties


SailboxDeprecation

SailboxDeprecation = native.SailboxDeprecation
Actionable notice that a Sailbox’s runtime should be upgraded: a deadline date and a message with upgrade instructions.

SailboxEgressPolicy

A Sailbox’s egress policy as Sail enforces it, read from Sailbox.egressPolicy.document is always present: a Sailbox created without a policy has the empty document {}, so every host is reachable and no rules apply. policyId and name identify the saved EgressPolicy when one is attached and are absent when the Sailbox was given a document directly.The object is frozen.

Properties


SailboxHandle

Returned by create / resume / fromCheckpoint: the Sailbox’s identity and lifecycle status.

Properties


SailboxInfo

A read snapshot of a Sailbox (get / list). Timestamps are RFC 3339 strings.

Extends

  • Omit<native.SailboxInfo, "status" | "autoSleep" | "egressPolicy" | "size">

Properties


SailboxInfoPage

One page of list results plus the pagination envelope.

Extends

  • Omit<native.SailboxInfoPage, "items">

Properties


SailboxListOrder

SailboxListOrder = "newest_active" | "newest_created"
Result ordering for a Sailbox list: most recently active first, or newest created first.

SailboxPage

One page of Sailbox instances plus the pagination envelope.

Extends

Properties


SailboxStatus

SailboxStatus = "running" | "paused" | "sleeping" | "failed" | "terminated" | string & object
Lifecycle status of a Sailbox. Open: tolerates values added server-side.

SailboxStatusFilter

SailboxStatusFilter = "creating" | "running" | "paused" | "sleeping" | "failed" | "terminating" | "terminated"
The closed set of statuses accepted as a list filter.

SecretInfo

A secret’s name and timestamps. Sail never returns the stored value, so no value field exists. Timestamps are RFC 3339 strings.

Properties


SecretRef

A stored organization secret, referred to by name. A Secret returned by Secret.get or Secret.list is one too.

Properties


SetLimitsOptions

The limits to set on a Sailbox: its vCPU count, memory limit, and disk limit. Regardless of configured limits, a Sailbox is only charged for the resources its workload actually consumes at runtime; limits are for finer grained control over its allowable resource consumption. Give at least one option; the others keep their values.

Properties


ShellOptions

Options for Sailbox.shell.

Properties


SshEndpoint

The public TCP endpoint a Sailbox’s SSH listener is reachable at.

Properties


TcpEndpoint

The address to dial for a tcp listener.

Properties


UdpEndpoint

The address to send datagrams to for a udp listener.

Properties


UnexposeOptions

Options for Sailbox.unexpose.

Properties


UpgradeResult

The outcome of a Sailbox runtime upgrade.

Extends

  • Omit<native.UpgradeResult, "status">

Properties


VolumeInfo

A managed volume. Timestamps are RFC 3339 strings.

Properties


VolumeMountInput

A volume to mount at create time.

Properties


VolumeWriteOptions

Options for writing a file to a volume (VolumeFs.write, VolumeFs.writeFiles, VolumeFs.writeStream).

Properties


WaitForListenerOptions

Options for Sailbox.waitForListener.

Properties


WriteOptions

Options for uploading a file.

Properties

Errors

Errors thrown by this SDK surface. All of them extend SailError, so an instanceof SailError check matches everything below.

SailError

Base class for every error surfaced by the SDK.

Extends

  • Error

Extended by

Constructors

Constructor
new SailError(message, code?, details?): SailError
Parameters
Returns
SailError
Overrides
Error.constructor

Properties


ApiError

A non-2xx API response.

Extends

Extended by

Constructors

Constructor
new ApiError(message, details?): ApiError
Parameters
Returns
ApiError
Overrides
SailError.constructor

Properties


BrokenPipeError

A stream (e.g. exec stdin) was closed and can no longer be written.

Extends

Constructors

Constructor
new BrokenPipeError(message, details?): BrokenPipeError
Parameters
Returns
BrokenPipeError
Overrides
SailError.constructor

Properties


CommandFailedError

Thrown by Sailbox.run with check when the command exits nonzero or times out. Carries the completed result as result.

Extends

Constructors

Constructor
new CommandFailedError(message, result): CommandFailedError
Parameters
Returns
CommandFailedError
Overrides
SailboxExecutionError.constructor

Properties


EgressPolicyInUseError

Deleting an egress policy that a Sailbox still runs under; terminated Sailboxes do not count. Switch those Sailboxes to another policy first.

Extends

Constructors

Constructor
new EgressPolicyInUseError(message, details?): EgressPolicyInUseError
Parameters
Returns
EgressPolicyInUseError
Inherited from
ApiError.constructor

Properties


FileNotFoundError

A remote file path does not exist.

Extends

Constructors

Constructor
new FileNotFoundError(message, details?): FileNotFoundError
Parameters
Returns
FileNotFoundError
Overrides
SailError.constructor

Properties


ImageBuildError

A custom image could not be built or its local content could not be uploaded.

Extends

Constructors

Constructor
new ImageBuildError(message, details?): ImageBuildError
Parameters
Returns
ImageBuildError
Overrides
SailError.constructor

Properties


InternalError

An unexpected internal SDK failure.

Extends

Constructors

Constructor
new InternalError(message, details?): InternalError
Parameters
Returns
InternalError
Overrides
SailError.constructor

Properties


InvalidArgumentError

Invalid arguments or configuration (bad request, missing/invalid API key).

Extends

Constructors

Constructor
new InvalidArgumentError(message, details?): InvalidArgumentError
Parameters
Returns
InvalidArgumentError
Overrides
SailError.constructor

Properties


NotFoundError

The Sailbox, volume, or other resource does not exist (or is another org’s).

Extends

Constructors

Constructor
new NotFoundError(message, details?): NotFoundError
Parameters
Returns
NotFoundError
Overrides
SailError.constructor

Properties


PermissionDeniedError

The credential is not permitted to perform the operation.

Extends

Constructors

Constructor
new PermissionDeniedError(message, details?): PermissionDeniedError
Parameters
Returns
PermissionDeniedError
Overrides
SailError.constructor

Properties


SailboxCreationError

A Sailbox could not be created (provisioning failed).

Extends

Constructors

Constructor
new SailboxCreationError(message, details?): SailboxCreationError
Parameters
Returns
SailboxCreationError
Overrides
SailError.constructor

Properties


SailboxExecRequestNotFoundError

The exec request could not be found (for example after the Sailbox moved machines).

Extends

Constructors

Constructor
new SailboxExecRequestNotFoundError(message, details?): SailboxExecRequestNotFoundError
Parameters
Returns
SailboxExecRequestNotFoundError
Overrides
SailboxExecutionError.constructor

Properties


SailboxExecutionError

Base class for failures during an exec.

Extends

Extended by

Constructors

Constructor
new SailboxExecutionError(message, code?, details?): SailboxExecutionError
Parameters
Returns
SailboxExecutionError
Overrides
SailError.constructor

Properties


SailboxHostLostError

The machine hosting the Sailbox was lost while an exec was in flight.

Extends

Constructors

Constructor
new SailboxHostLostError(message, details?): SailboxHostLostError
Parameters
Returns
SailboxHostLostError
Overrides
SailboxExecutionError.constructor

Properties


SailboxTerminatedError

The Sailbox was terminated while an exec was in flight.

Extends

Constructors

Constructor
new SailboxTerminatedError(message, details?): SailboxTerminatedError
Parameters
Returns
SailboxTerminatedError
Overrides
SailboxExecutionError.constructor

Properties


SecretInUseError

Deleting a secret that egress policies still refer to. Delete those policies first, then delete the secret.

Extends

Constructors

Constructor
new SecretInUseError(message, details?): SecretInUseError
Parameters
Returns
SecretInUseError
Inherited from
ApiError.constructor

Properties


TimeoutError

A request exceeded its timeout.

Extends

Constructors

Constructor
new TimeoutError(message, details?): TimeoutError
Parameters
Returns
TimeoutError
Overrides
SailError.constructor

Properties


TransportError

A network/connection transport failure.

Extends

Constructors

Constructor
new TransportError(message, details?): TransportError
Parameters
Returns
TransportError
Overrides
SailError.constructor

Properties