> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sailresearch.com/llms.txt
> Use this file to discover all available pages before exploring further.

# TypeScript SDK reference

> Complete API reference for the Sail TypeScript SDK.

## Classes

<a id="apierror" />

### ApiError

A transient, retryable server-side API failure.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor" />

##### Constructor

> **new ApiError**(`message`): [`ApiError`](#apierror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`ApiError`](#apierror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property               | Modifier   | Type     | Description                                              | Inherited from                               |
| ---------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="app" />

### App

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

#### Properties

| Property                         | Modifier   | Type     | Description    |
| -------------------------------- | ---------- | -------- | -------------- |
| <a id="createdat" /> `createdAt` | `readonly` | `Date`   | Creation time. |
| <a id="id" /> `id`               | `readonly` | `string` | Stable app id. |
| <a id="name" /> `name`           | `readonly` | `string` | App name.      |

#### Methods

<a id="find" />

##### find()

> `static` **find**(`name`, `options?`): `Promise`\<[`App`](#app)>

Find an app by name, optionally minting it if missing.

###### Parameters

| Parameter | Type                                         |
| --------- | -------------------------------------------- |
| `name`    | `string`                                     |
| `options` | [`ClientOptions`](#clientoptions) & `object` |

###### Returns

`Promise`\<[`App`](#app)>

<a id="list" />

##### list()

> `static` **list**(`options?`): `Promise`\<[`App`](#app)\[]>

Every app the current org owns, newest first.

###### Parameters

| Parameter | Type                              |
| --------- | --------------------------------- |
| `options` | [`ClientOptions`](#clientoptions) |

###### Returns

`Promise`\<[`App`](#app)\[]>

***

<a id="brokenpipeerror" />

### BrokenPipeError

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

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-1" />

##### Constructor

> **new BrokenPipeError**(`message`): [`BrokenPipeError`](#brokenpipeerror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`BrokenPipeError`](#brokenpipeerror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-1" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="client" />

### Client

A configured Sail client: the low-level surface over the native core (one
config snapshot; env vars are read at construction). Every client
operation is here. The object-model API ([Sailbox](#sailbox), [App](#app),
[Volume](#volume)) is built on top of it.

Construct with [Client.fromEnv](#fromenv) or [Client.fromConfig](#fromconfig).

#### Methods

<a id="buildimagedefinition" />

##### buildImageDefinition()

> **buildImageDefinition**(`def`, `timeoutSeconds`): `Promise`\<[`ImageSpec`](#imagespec)>

Resolve an image definition and build it to ready, returning the
content-addressed [ImageSpec](#imagespec) to create sailboxes from. A bare
builtin base skips the build; `timeoutSeconds` bounds the whole pipeline
(hashing, uploads, and the build).

###### Parameters

| Parameter        | Type                                  |
| ---------------- | ------------------------------------- |
| `def`            | [`ImageDefinition`](#imagedefinition) |
| `timeoutSeconds` | `number`                              |

###### Returns

`Promise`\<[`ImageSpec`](#imagespec)>

<a id="buildspectoready" />

##### buildSpecToReady()

> **buildSpecToReady**(`spec`, `timeoutSeconds`): `Promise`\<[`ImageBuild`](#imagebuild-1)>

Build an already-resolved spec to ready (submit + poll), bounded by
`timeoutSeconds`.

###### Parameters

| Parameter        | Type                      |
| ---------------- | ------------------------- |
| `spec`           | [`ImageSpec`](#imagespec) |
| `timeoutSeconds` | `number`                  |

###### Returns

`Promise`\<[`ImageBuild`](#imagebuild-1)>

<a id="checkpointsailbox" />

##### checkpointSailbox()

> **checkpointSailbox**(`sailboxId`, `options?`): `Promise`\<[`SailboxCheckpoint`](#sailboxcheckpoint-1)>

Take a checkpoint of a sailbox. `name` sets the handle's display name;
`ttlSeconds`, when given, overrides the server's default retention
window.

###### Parameters

| Parameter   | Type                                      |
| ----------- | ----------------------------------------- |
| `sailboxId` | `string`                                  |
| `options`   | [`CheckpointOptions`](#checkpointoptions) |

###### Returns

`Promise`\<[`SailboxCheckpoint`](#sailboxcheckpoint-1)>

<a id="createfromcheckpoint" />

##### createFromCheckpoint()

> **createFromCheckpoint**(`params`): `Promise`\<[`SailboxHandle`](#sailboxhandle)>

Create a new sailbox from a checkpoint.

###### Parameters

| Parameter | Type                                              |
| --------- | ------------------------------------------------- |
| `params`  | [`FromCheckpointRequest`](#fromcheckpointrequest) |

###### Returns

`Promise`\<[`SailboxHandle`](#sailboxhandle)>

<a id="createsailbox" />

##### createSailbox()

> **createSailbox**(`req`, `timeoutSeconds?`): `Promise`\<[`SailboxHandle`](#sailboxhandle)>

Create a sailbox. `timeoutSeconds` bounds each create attempt (default
600s); pass `0` for no client-side timeout. Timed-out attempts are retried,
reattaching to the same box, so when the overall budget is exhausted the
box may still be coming up server-side: find or terminate it by `name`.
`image` defaults to a plain Debian base.

###### Parameters

| Parameter        | Type                                            | Default value |
| ---------------- | ----------------------------------------------- | ------------- |
| `req`            | [`CreateSailboxRequest`](#createsailboxrequest) | `undefined`   |
| `timeoutSeconds` | `number`                                        | `600`         |

###### Returns

`Promise`\<[`SailboxHandle`](#sailboxhandle)>

<a id="deletevolume" />

##### deleteVolume()

> **deleteVolume**(`volumeId`, `allowMissing?`): `Promise`\<[`VolumeInfo`](#volumeinfo) | `null`>

Delete a volume by id. Resolves `null` when `allowMissing` and it's gone.

###### Parameters

| Parameter      | Type      | Default value |
| -------------- | --------- | ------------- |
| `volumeId`     | `string`  | `undefined`   |
| `allowMissing` | `boolean` | `false`       |

###### Returns

`Promise`\<[`VolumeInfo`](#volumeinfo) | `null`>

<a id="enablessh" />

##### enableSsh()

> **enableSsh**(`sailboxId`, `options?`): `Promise`\<[`SshEndpoint`](#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 CIDRs, replacing any
existing restriction. With `wait` (the default), polls until the endpoint
is reachable and returns it, throwing [TimeoutError](#timeouterror) if it is not
within `timeoutSeconds`; with `wait: false`, skips the probe and resolves
`null`.

###### Parameters

| Parameter   | Type                                    |
| ----------- | --------------------------------------- |
| `sailboxId` | `string`                                |
| `options`   | [`EnableSshOptions`](#enablesshoptions) |

###### Returns

`Promise`\<[`SshEndpoint`](#sshendpoint) | `null`>

<a id="exec" />

##### exec()

> **exec**(`sailboxId`, `command`, `options?`): `Promise`\<[`ExecProcess`](#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.
`cwd`/`background` apply to string commands (see [ExecOptions](#execoptions)).

###### Parameters

| Parameter   | Type                          |
| ----------- | ----------------------------- |
| `sailboxId` | `string`                      |
| `command`   | `string` \| `string`\[]       |
| `options`   | [`ExecOptions`](#execoptions) |

###### Returns

`Promise`\<[`ExecProcess`](#execprocess)>

<a id="exposelistener" />

##### exposeListener()

> **exposeListener**(`sailboxId`, `guestPort`, `protocol?`, `allowlist?`): `Promise`\<[`Listener`](#listener-1)>

Expose a guest port at runtime (route status starts "unspecified"; the
response confirms configuration, not reachability).

###### Parameters

| Parameter   | Type                                  | Default value |
| ----------- | ------------------------------------- | ------------- |
| `sailboxId` | `string`                              | `undefined`   |
| `guestPort` | `number`                              | `undefined`   |
| `protocol`  | [`IngressProtocol`](#ingressprotocol) | `"http"`      |
| `allowlist` | `string`\[]                           | `[]`          |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="findapp" />

##### findApp()

> **findApp**(`name`, `mintIfMissing?`): `Promise`\<[`AppInfo`](#appinfo)>

Find an app by name, optionally minting it.

###### Parameters

| Parameter       | Type      | Default value |
| --------------- | --------- | ------------- |
| `name`          | `string`  | `undefined`   |
| `mintIfMissing` | `boolean` | `false`       |

###### Returns

`Promise`\<[`AppInfo`](#appinfo)>

<a id="getlistener" />

##### getListener()

> **getListener**(`sailboxId`, `guestPort`): `Promise`\<[`Listener`](#listener-1)>

Fetch one listener by guest port without waking the box.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |
| `guestPort` | `number` |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="getsailbox" />

##### getSailbox()

> **getSailbox**(`sailboxId`): `Promise`\<[`SailboxInfo`](#sailboxinfo)>

Fetch one sailbox by id.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<[`SailboxInfo`](#sailboxinfo)>

<a id="getvolume" />

##### getVolume()

> **getVolume**(`name`, `mintIfMissing?`): `Promise`\<[`VolumeInfo`](#volumeinfo)>

Look up (optionally minting) an NFS volume by name.

###### Parameters

| Parameter       | Type      | Default value |
| --------------- | --------- | ------------- |
| `name`          | `string`  | `undefined`   |
| `mintIfMissing` | `boolean` | `false`       |

###### Returns

`Promise`\<[`VolumeInfo`](#volumeinfo)>

<a id="ingressauthheaders" />

##### ingressAuthHeaders()

> **ingressAuthHeaders**(`sailboxId`): `Promise`\<`Record`\<`string`, `string`>>

Ingress-identity headers for this sailbox, as a name→value map.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<`Record`\<`string`, `string`>>

<a id="isbuiltinbasespec" />

##### isBuiltinBaseSpec()

> **isBuiltinBaseSpec**(`spec`): `boolean`

Whether a spec is a bare builtin base the backend ships prebuilt (no
build needed).

###### Parameters

| Parameter | Type                      |
| --------- | ------------------------- |
| `spec`    | [`ImageSpec`](#imagespec) |

###### Returns

`boolean`

<a id="listapps" />

##### listApps()

> **listApps**(): `Promise`\<[`AppInfo`](#appinfo)\[]>

Every app the current org owns, newest first.

###### Returns

`Promise`\<[`AppInfo`](#appinfo)\[]>

<a id="listlisteners" />

##### listListeners()

> **listListeners**(`sailboxId`): `Promise`\<[`Listener`](#listener-1)\[]>

List a sailbox's listeners without waking it.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<[`Listener`](#listener-1)\[]>

<a id="listsailboxes" />

##### listSailboxes()

> **listSailboxes**(`params?`): `Promise`\<[`SailboxInfoPage`](#sailboxinfopage)>

List one page of sailboxes in the current org.

###### Parameters

| Parameter | Type                                        |
| --------- | ------------------------------------------- |
| `params`  | [`ListSailboxesQuery`](#listsailboxesquery) |

###### Returns

`Promise`\<[`SailboxInfoPage`](#sailboxinfopage)>

<a id="listvolumes" />

##### listVolumes()

> **listVolumes**(`maxObjects?`): `Promise`\<[`VolumeInfo`](#volumeinfo)\[]>

List NFS volumes in the current org.

###### Parameters

| Parameter     | Type     |
| ------------- | -------- |
| `maxObjects?` | `number` |

###### Returns

`Promise`\<[`VolumeInfo`](#volumeinfo)\[]>

<a id="orgsshcapublickey" />

##### orgSshCaPublicKey()

> **orgSshCaPublicKey**(): `Promise`\<`string`>

Fetch (creating on first use) the org SSH certificate authority public key.
Used to preflight SSH before a box is provisioned.

###### Returns

`Promise`\<`string`>

<a id="pausesailbox" />

##### pauseSailbox()

> **pauseSailbox**(`sailboxId`): `Promise`\<`void`>

Pause a sailbox in memory.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<`void`>

<a id="readstream" />

##### readStream()

> **readStream**(`sailboxId`, `path`): `Promise`\<[`FileStream`](#filestream)>

Open a streaming read of a guest file.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |
| `path`      | `string` |

###### Returns

`Promise`\<[`FileStream`](#filestream)>

<a id="resolveimage" />

##### resolveImage()

> **resolveImage**(`def`): `Promise`\<[`ImageSpec`](#imagespec)>

Resolve an image definition into a content-addressed [ImageSpec](#imagespec):
the core walks local directories (gitignore-style `ignore`), hashes every
file, and uploads content the server does not already have.

###### Parameters

| Parameter | Type                                  |
| --------- | ------------------------------------- |
| `def`     | [`ImageDefinition`](#imagedefinition) |

###### Returns

`Promise`\<[`ImageSpec`](#imagespec)>

<a id="resumesailbox" />

##### resumeSailbox()

> **resumeSailbox**(`sailboxId`): `Promise`\<[`SailboxHandle`](#sailboxhandle)>

Resume a paused or sleeping sailbox.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<[`SailboxHandle`](#sailboxhandle)>

<a id="shell" />

##### 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).

###### Parameters

| Parameter   | Type                            |
| ----------- | ------------------------------- |
| `sailboxId` | `string`                        |
| `command?`  | `string`                        |
| `options?`  | [`ShellOptions`](#shelloptions) |

###### Returns

`Promise`\<`number`>

<a id="sleepsailbox" />

##### sleepSailbox()

> **sleepSailbox**(`sailboxId`): `Promise`\<`void`>

Sleep a sailbox to disk (wakes on traffic).

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<`void`>

<a id="terminatesailbox" />

##### terminateSailbox()

> **terminateSailbox**(`sailboxId`): `Promise`\<`void`>

Terminate a sailbox (idempotent).

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<`void`>

<a id="unexposelistener" />

##### unexposeListener()

> **unexposeListener**(`sailboxId`, `guestPort`): `Promise`\<`void`>

Remove a runtime ingress port.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |
| `guestPort` | `number` |

###### Returns

`Promise`\<`void`>

<a id="upgradesailbox" />

##### upgradeSailbox()

> **upgradeSailbox**(`sailboxId`): `Promise`\<[`UpgradeResult`](#upgraderesult)>

Upgrade a sailbox's in-guest agent (now if running, else at next wake).

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `sailboxId` | `string` |

###### Returns

`Promise`\<[`UpgradeResult`](#upgraderesult)>

<a id="waitforlistener" />

##### waitForListener()

> **waitForListener**(`sailboxId`, `guestPort`, `timeoutSeconds`, `pollIntervalSeconds`): `Promise`\<[`Listener`](#listener-1)>

Block until the listener on `guestPort` is reachable end to end and
return it, throwing [TimeoutError](#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 connectivity check, not
an application health check.

###### Parameters

| Parameter             | Type     |
| --------------------- | -------- |
| `sailboxId`           | `string` |
| `guestPort`           | `number` |
| `timeoutSeconds`      | `number` |
| `pollIntervalSeconds` | `number` |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="writestream" />

##### writeStream()

> **writeStream**(`sailboxId`, `path`, `options?`): `Promise`\<[`FileWriter`](#filewriter)>

Open a streaming upload to a guest file.

###### Parameters

| Parameter   | Type                            |
| ----------- | ------------------------------- |
| `sailboxId` | `string`                        |
| `path`      | `string`                        |
| `options`   | [`WriteOptions`](#writeoptions) |

###### Returns

`Promise`\<[`FileWriter`](#filewriter)>

<a id="fromconfig" />

##### fromConfig()

> `static` **fromConfig**(`config`): [`Client`](#client)

Build a client from an explicit [ClientConfig](#clientconfig).

###### Parameters

| Parameter | Type                            |
| --------- | ------------------------------- |
| `config`  | [`ClientConfig`](#clientconfig) |

###### Returns

[`Client`](#client)

<a id="fromenv" />

##### fromEnv()

> `static` **fromEnv**(): [`Client`](#client)

Build a client from the environment (`SAIL_API_KEY`, ...).

###### Returns

[`Client`](#client)

***

<a id="execprocess" />

### ExecProcess

A live command running in a sailbox. Stream [stdout](#stdout)/[stderr](#stderr),
write to [writeStdin](#writestdin), and [wait](#wait) for the result. Not killed on GC;
call [close](#close) to detach, or [cancel](#cancel) to stop the command.

#### Example

```ts theme={null}
const proc = await box.exec(["bash", "-lc", "echo hi"]);
for await (const line of proc.stdout) process.stdout.write(line);
const result = await proc.wait();
console.log(result.exitCode);
```

#### Properties

| Property                   | Modifier   | Type                        | Description                                    |
| -------------------------- | ---------- | --------------------------- | ---------------------------------------------- |
| <a id="stderr" /> `stderr` | `readonly` | [`ExecStream`](#execstream) | Stderr as an async iterable of decoded chunks. |
| <a id="stdout" /> `stdout` | `readonly` | [`ExecStream`](#execstream) | Stdout as an async iterable of decoded chunks. |

#### Accessors

<a id="execrequestid" />

##### execRequestId

###### Get Signature

> **get** **execRequestId**(): `string`

The durable exec request id.

###### Returns

`string`

<a id="idempotencykey" />

##### idempotencyKey

###### Get Signature

> **get** **idempotencyKey**(): `string`

The idempotency key used to launch the command.

###### Returns

`string`

<a id="output" />

##### output

###### Get Signature

> **get** **output**(): [`ExecStream`](#execstream)

Alias for [stdout](#stdout): under a pty the two output streams merge onto
stdout, and `output` names that merged terminal stream.

###### Returns

[`ExecStream`](#execstream)

#### Methods

<a id="asyncdispose" />

##### \[asyncDispose]\()

> **\[asyncDispose]**(): `Promise`\<`void`>

`await using` support: detaches on scope exit.

###### Returns

`Promise`\<`void`>

<a id="dispose" />

##### \[dispose]\()

> **\[dispose]**(): `void`

`using` support: detaches on scope exit.

###### Returns

`void`

<a id="cancel" />

##### cancel()

> **cancel**(`options?`): `Promise`\<`void`>

Cancel the command (SIGINT by default, SIGKILL with `force`).

###### Parameters

| Parameter | Type                              |
| --------- | --------------------------------- |
| `options` | [`CancelOptions`](#canceloptions) |

###### Returns

`Promise`\<`void`>

<a id="close" />

##### close()

> **close**(): `void`

Stop the output pump and detach (does not kill the command). Call this on
early exit from streaming a long-running command so the stream is not held
until GC.

###### Returns

`void`

<a id="closestdin" />

##### closeStdin()

> **closeStdin**(): `Promise`\<`void`>

Close the command's stdin (send EOF).

###### Returns

`Promise`\<`void`>

<a id="poll" />

##### poll()

> **poll**(): `number` | `null`

The exit code if the exit frame has arrived on the stream, else `null`.
Throws for a worker-lost exec (no real exit code), as [wait](#wait) does.

###### Returns

`number` | `null`

<a id="resize" />

##### resize()

> **resize**(`cols`, `rows`): `Promise`\<`void`>

Resize the pty (no-op without one).

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `cols`    | `number` |
| `rows`    | `number` |

###### Returns

`Promise`\<`void`>

<a id="wait" />

##### wait()

> **wait**(): `Promise`\<[`ExecResult`](#execresult)>

Await the authoritative result (exit code, buffered output, flags).

###### Returns

`Promise`\<[`ExecResult`](#execresult)>

<a id="waitstreamended" />

##### waitStreamEnded()

> **waitStreamEnded**(`timeoutSeconds`): `Promise`\<`boolean`>

Wait up to `timeoutSeconds` for the streams to end; returns whether they
did. `Infinity` waits indefinitely.

###### Parameters

| Parameter        | Type     |
| ---------------- | -------- |
| `timeoutSeconds` | `number` |

###### Returns

`Promise`\<`boolean`>

<a id="writestdin" />

##### writeStdin()

> **writeStdin**(`data`): `Promise`\<`void`>

Write to the command's stdin (requires `openStdin`).

###### Parameters

| Parameter | Type                                                                         |
| --------- | ---------------------------------------------------------------------------- |
| `data`    | `string` \| `Buffer`\<`ArrayBufferLike`> \| `Uint8Array`\<`ArrayBufferLike`> |

###### Returns

`Promise`\<`void`>

***

<a id="execstream" />

### ExecStream

An async-iterable view of one exec stream (stdout or stderr). Chunks are
decoded UTF-8 strings; iteration ends at end of stream.

#### Example

```ts theme={null}
for await (const chunk of proc.stdout) process.stdout.write(chunk);
```

#### Implements

* `AsyncIterable`\<`string`>

#### Methods

<a id="asynciterator" />

##### \[asyncIterator]\()

> **\[asyncIterator]**(): `AsyncIterator`\<`string`>

###### Returns

`AsyncIterator`\<`string`>

###### Implementation of

`AsyncIterable.[asyncIterator]`

<a id="text" />

##### text()

> **text**(): `Promise`\<`string`>

Collect the whole stream into a single string.

###### Returns

`Promise`\<`string`>

<a id="toreadable" />

##### toReadable()

> **toReadable**(): `Readable`

Adapt to a Node `Readable` (e.g. to `.pipe()` it somewhere).

###### Returns

`Readable`

***

<a id="filenotfounderror" />

### FileNotFoundError

A remote file path does not exist.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-2" />

##### Constructor

> **new FileNotFoundError**(`message`): [`FileNotFoundError`](#filenotfounderror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`FileNotFoundError`](#filenotfounderror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-2" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="filestream" />

### FileStream

An async-iterable download of a guest file. Chunks are `Buffer`s; 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](#close-1).

#### Implements

* `AsyncIterable`\<`Buffer`>

#### Methods

<a id="asyncdispose-1" />

##### \[asyncDispose]\()

> **\[asyncDispose]**(): `Promise`\<`void`>

`await using` support.

###### Returns

`Promise`\<`void`>

<a id="asynciterator-1" />

##### \[asyncIterator]\()

> **\[asyncIterator]**(): `AsyncIterator`\<`Buffer`\<`ArrayBufferLike`>>

###### Returns

`AsyncIterator`\<`Buffer`\<`ArrayBufferLike`>>

###### Implementation of

`AsyncIterable.[asyncIterator]`

<a id="bytes" />

##### bytes()

> **bytes**(): `Promise`\<`Buffer`\<`ArrayBufferLike`>>

Collect the whole file into a single `Buffer`.

###### Returns

`Promise`\<`Buffer`\<`ArrayBufferLike`>>

<a id="close-1" />

##### close()

> **close**(): `Promise`\<`void`>

Release the underlying download stream (idempotent).

###### Returns

`Promise`\<`void`>

<a id="toreadable-1" />

##### toReadable()

> **toReadable**(): `Readable`

Adapt to a Node `Readable`.

###### Returns

`Readable`

***

<a id="filewriter" />

### FileWriter

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

#### Methods

<a id="abort" />

##### abort()

> **abort**(): `void`

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

###### Returns

`void`

<a id="finish" />

##### finish()

> **finish**(): `Promise`\<`void`>

Confirm the write, creating an empty file if nothing was written.

###### Returns

`Promise`\<`void`>

<a id="write" />

##### write()

> **write**(`data`): `Promise`\<`void`>

Write bytes (a `string` is encoded as UTF-8). The core splits them into
transport-sized chunks.

###### Parameters

| Parameter | Type                                                                         |
| --------- | ---------------------------------------------------------------------------- |
| `data`    | `string` \| `Buffer`\<`ArrayBufferLike`> \| `Uint8Array`\<`ArrayBufferLike`> |

###### Returns

`Promise`\<`void`>

***

<a id="image" />

### Image

A custom image definition. Immutable and fluent: each method returns a new
`Image`. Local files/dirs are recorded here and hashed + uploaded by the
core when the image is resolved to a spec (at [Sailbox.create](#create), or via
[toSpec](#tospec)), so chaining stays synchronous.

#### Example

```ts theme={null}
const image = Image.debian("arm64")
  .aptInstall("git")
  .pipInstall("numpy")
  .addLocalDir("./app", "/app", { ignore: ["*.pyc", "__pycache__/"] })
  .runCommand("pip install -e /app");
const box = await Sailbox.create({ app, name: "w", image });
```

#### Methods

<a id="addlocaldir" />

##### addLocalDir()

> **addLocalDir**(`localPath`, `remotePath`, `options?`): [`Image`](#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

| Parameter    | Type                                        |
| ------------ | ------------------------------------------- |
| `localPath`  | `string`                                    |
| `remotePath` | `string`                                    |
| `options`    | [`AddLocalDirOptions`](#addlocaldiroptions) |

###### Returns

[`Image`](#image)

<a id="addlocalfile" />

##### addLocalFile()

> **addLocalFile**(`localPath`, `remotePath`, `options?`): [`Image`](#image)

Bake one local file into the image at `path` (absolute POSIX path;
a trailing `/` appends the source basename). Hashed + uploaded at resolve.

###### Parameters

| Parameter    | Type                                          |
| ------------ | --------------------------------------------- |
| `localPath`  | `string`                                      |
| `remotePath` | `string`                                      |
| `options`    | [`AddLocalFileOptions`](#addlocalfileoptions) |

###### Returns

[`Image`](#image)

<a id="aptinstall" />

##### aptInstall()

> **aptInstall**(...`packages`): [`Image`](#image)

Install system packages with apt.

###### Parameters

| Parameter     | Type        |
| ------------- | ----------- |
| ...`packages` | `string`\[] |

###### Returns

[`Image`](#image)

<a id="build" />

##### build()

> **build**(`options?`): `Promise`\<[`ImageSpec`](#imagespec)>

Upload any local files and build the image, waiting until it is ready.
Returns the resolved [ImageSpec](#imagespec). [Sailbox.create](#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.

###### Parameters

| Parameter                 | Type                                                              |
| ------------------------- | ----------------------------------------------------------------- |
| `options`                 | \{ `client?`: [`Client`](#client); `timeoutSeconds?`: `number`; } |
| `options.client?`         | [`Client`](#client)                                               |
| `options.timeoutSeconds?` | `number`                                                          |

###### Returns

`Promise`\<[`ImageSpec`](#imagespec)>

<a id="env" />

##### env()

> **env**(`env`): [`Image`](#image)

Bake environment variables into the image (keys are trimmed).

###### Parameters

| Parameter | Type                          |
| --------- | ----------------------------- |
| `env`     | `Record`\<`string`, `string`> |

###### Returns

[`Image`](#image)

<a id="pipinstall" />

##### pipInstall()

> **pipInstall**(...`packages`): [`Image`](#image)

Install Python packages with pip.

###### Parameters

| Parameter     | Type        |
| ------------- | ----------- |
| ...`packages` | `string`\[] |

###### Returns

[`Image`](#image)

<a id="runcommand" />

##### runCommand()

> **runCommand**(`command`): [`Image`](#image)

Run a shell command during the build.

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `command` | `string` |

###### Returns

[`Image`](#image)

<a id="tospec" />

##### toSpec()

> **toSpec**(`client?`): `Promise`\<[`ImageSpec`](#imagespec)>

Resolve to an [ImageSpec](#imagespec): walks local files/dirs (honoring
gitignore), hashes them, and uploads their content via `client` (defaults
to the env client). [Sailbox.create](#create) calls this for you; use it
directly only if you need the raw spec.

###### Parameters

| Parameter | Type                |
| --------- | ------------------- |
| `client?` | [`Client`](#client) |

###### Returns

`Promise`\<[`ImageSpec`](#imagespec)>

<a id="debian" />

##### debian()

> `static` **debian**(`architecture?`): [`Image`](#image)

A Debian base image (defaults to arm64).

###### Parameters

| Parameter      | Type                                      | Default value |
| -------------- | ----------------------------------------- | ------------- |
| `architecture` | [`ImageArchitecture`](#imagearchitecture) | `"arm64"`     |

###### Returns

[`Image`](#image)

<a id="devbox" />

##### devbox()

> `static` **devbox**(`architecture?`): [`Image`](#image)

The devbox base image (defaults to arm64): a prebuilt Debian base with a
baked development layer. Prebuilt-only, so it does not support build
steps or env; start from [Image.debian](#debian) to customize.

###### Parameters

| Parameter      | Type                                      | Default value |
| -------------- | ----------------------------------------- | ------------- |
| `architecture` | [`ImageArchitecture`](#imagearchitecture) | `"arm64"`     |

###### Returns

[`Image`](#image)

***

<a id="imagebuilderror" />

### ImageBuildError

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

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-3" />

##### Constructor

> **new ImageBuildError**(`message`): [`ImageBuildError`](#imagebuilderror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`ImageBuildError`](#imagebuilderror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-3" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="internalerror" />

### InternalError

An unexpected internal SDK/core failure.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-4" />

##### Constructor

> **new InternalError**(`message`): [`InternalError`](#internalerror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`InternalError`](#internalerror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-4" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="invalidargumenterror" />

### InvalidArgumentError

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

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-5" />

##### Constructor

> **new InvalidArgumentError**(`message`): [`InvalidArgumentError`](#invalidargumenterror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`InvalidArgumentError`](#invalidargumenterror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-5" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="notfounderror" />

### NotFoundError

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

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-6" />

##### Constructor

> **new NotFoundError**(`message`): [`NotFoundError`](#notfounderror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`NotFoundError`](#notfounderror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-6" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="permissiondeniederror" />

### PermissionDeniedError

The credential is not permitted to perform the operation.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-7" />

##### Constructor

> **new PermissionDeniedError**(`message`): [`PermissionDeniedError`](#permissiondeniederror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`PermissionDeniedError`](#permissiondeniederror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-7" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="sailbox" />

### Sailbox

A sandbox (sailbox): the primary object agent harnesses work with. Create one
with [Sailbox.create](#create), run commands with [exec](#exec-1), move files with
[writeStream](#writestream-1)/[readStream](#readstream-1), expose ports with [expose](#expose), and
manage its lifecycle. The statics use a default env-configured client unless
you pass one.

#### Example

```ts theme={null}
import { App, Sailbox } from "@sailresearch/sdk";

const app = await App.find("example-app", { mintIfMissing: true });
const box = await Sailbox.create({ app, name: "worker-1" });
const proc = await box.exec(["bash", "-lc", "echo hello"]);
console.log(await proc.stdout.text());
await box.terminate();
```

#### Accessors

<a id="appid-1" />

##### appId

###### Get Signature

> **get** **appId**(): `string` | `undefined`

Identifier of the owning app.

###### Returns

`string` | `undefined`

<a id="appname-1" />

##### appName

###### Get Signature

> **get** **appName**(): `string` | `undefined`

Name of the owning app.

###### Returns

`string` | `undefined`

<a id="architecture" />

##### architecture

###### Get Signature

> **get** **architecture**(): `string` | `undefined`

CPU architecture (for example `arm64`).

###### Returns

`string` | `undefined`

<a id="checkpointgeneration" />

##### checkpointGeneration

###### Get Signature

> **get** **checkpointGeneration**(): `number` | `undefined`

Checkpoint generation counter as of the snapshot.

###### Returns

`number` | `undefined`

<a id="client-1" />

##### client

###### Get Signature

> **get** **client**(): [`Client`](#client)

The underlying [Client](#client).

###### Returns

[`Client`](#client)

<a id="cpurequestedvcpu" />

##### cpuRequestedVcpu

###### Get Signature

> **get** **cpuRequestedVcpu**(): `number` | `undefined`

Requested CPU, in vCPUs.

###### Returns

`number` | `undefined`

<a id="cpuusedvcpu" />

##### cpuUsedVcpu

###### Get Signature

> **get** **cpuUsedVcpu**(): `number` | `undefined`

Current CPU usage, in vCPUs, as of the snapshot.

###### Returns

`number` | `undefined`

<a id="createdat-1" />

##### createdAt

###### Get Signature

> **get** **createdAt**(): `Date` | `undefined`

When the sailbox was created.

###### Returns

`Date` | `undefined`

<a id="diskrequestedbytes" />

##### diskRequestedBytes

###### Get Signature

> **get** **diskRequestedBytes**(): `number` | `undefined`

Requested disk, in bytes.

###### Returns

`number` | `undefined`

<a id="diskusedbytes" />

##### diskUsedBytes

###### Get Signature

> **get** **diskUsedBytes**(): `number` | `undefined`

Current disk usage, in bytes, as of the snapshot.

###### Returns

`number` | `undefined`

<a id="errormessage" />

##### errorMessage

###### Get Signature

> **get** **errorMessage**(): `string` | `undefined`

Failure detail when the status is `failed`.

###### Returns

`string` | `undefined`

<a id="guestschemaversion" />

##### guestSchemaVersion

###### Get Signature

> **get** **guestSchemaVersion**(): `number` | `undefined`

In-guest agent schema version the sailbox last booted with.

###### Returns

`number` | `undefined`

<a id="imageid" />

##### imageId

###### Get Signature

> **get** **imageId**(): `string` | `undefined`

Identifier of the image the sailbox was created from.

###### Returns

`string` | `undefined`

<a id="lastcheckpointedat" />

##### lastCheckpointedAt

###### Get Signature

> **get** **lastCheckpointedAt**(): `Date` | `undefined`

When the most recent checkpoint was taken.

###### Returns

`Date` | `undefined`

<a id="memorymib" />

##### memoryMib

###### Get Signature

> **get** **memoryMib**(): `number` | `undefined`

Configured memory, in MiB.

###### Returns

`number` | `undefined`

<a id="memoryrequestedbytes" />

##### memoryRequestedBytes

###### Get Signature

> **get** **memoryRequestedBytes**(): `number` | `undefined`

Requested memory, in bytes.

###### Returns

`number` | `undefined`

<a id="memoryusedbytes" />

##### memoryUsedBytes

###### Get Signature

> **get** **memoryUsedBytes**(): `number` | `undefined`

Current memory usage, in bytes, as of the snapshot.

###### Returns

`number` | `undefined`

<a id="name-1" />

##### name

###### Get Signature

> **get** **name**(): `string`

The sailbox name.

###### Returns

`string`

<a id="sailboxid" />

##### sailboxId

###### Get Signature

> **get** **sailboxId**(): `string`

The sailbox's stable identifier.

###### Returns

`string`

<a id="startedat" />

##### startedAt

###### Get Signature

> **get** **startedAt**(): `Date` | `undefined`

When the current boot started (RFC 3339).

###### Returns

`Date` | `undefined`

<a id="statedisksizegib" />

##### stateDiskSizeGib

###### Get Signature

> **get** **stateDiskSizeGib**(): `number` | `undefined`

Configured state-disk size, in GiB.

###### Returns

`number` | `undefined`

<a id="status" />

##### status

###### Get Signature

> **get** **status**(): [`SailboxStatus`](#sailboxstatus-1)

The lifecycle status as of the call that produced this handle (updated
by lifecycle calls on this instance). Use [Sailbox.get](#get) for a fresh
snapshot.

###### Returns

[`SailboxStatus`](#sailboxstatus-1)

<a id="updatedat" />

##### updatedAt

###### Get Signature

> **get** **updatedAt**(): `Date` | `undefined`

When the sailbox last changed.

###### Returns

`Date` | `undefined`

<a id="vcpucount" />

##### vcpuCount

###### Get Signature

> **get** **vcpuCount**(): `number` | `undefined`

Configured number of vCPUs.

###### Returns

`number` | `undefined`

#### Methods

<a id="checkpoint" />

##### checkpoint()

> **checkpoint**(`options?`): `Promise`\<[`SailboxCheckpoint`](#sailboxcheckpoint-1)>

Take a checkpoint of this sailbox. The returned handle carries
`expiresAt`, when it becomes eligible for garbage collection.

###### Parameters

| Parameter | Type                                      |
| --------- | ----------------------------------------- |
| `options` | [`CheckpointOptions`](#checkpointoptions) |

###### Returns

`Promise`\<[`SailboxCheckpoint`](#sailboxcheckpoint-1)>

<a id="enablessh-1" />

##### enableSsh()

> **enableSsh**(`options?`): `Promise`\<[`SshEndpoint`](#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). Safe to re-run. With `wait` (the default), polls until the endpoint
is reachable and returns it, throwing [TimeoutError](#timeouterror) if it is not
within `timeoutSeconds`; with `wait: false`, skips the probe and resolves
`null`.

###### Parameters

| Parameter | Type                                    |
| --------- | --------------------------------------- |
| `options` | [`EnableSshOptions`](#enablesshoptions) |

###### Returns

`Promise`\<[`SshEndpoint`](#sshendpoint) | `null`>

<a id="exec-1" />

##### exec()

> **exec**(`command`, `options?`): `Promise`\<[`ExecProcess`](#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. `options` can set
a working directory or detach the command (see [ExecOptions](#execoptions)).

###### Parameters

| Parameter  | Type                          |
| ---------- | ----------------------------- |
| `command`  | `string` \| `string`\[]       |
| `options?` | [`ExecOptions`](#execoptions) |

###### Returns

`Promise`\<[`ExecProcess`](#execprocess)>

<a id="expose" />

##### expose()

> **expose**(`guestPort`, `protocol?`, `allowlist?`): `Promise`\<[`Listener`](#listener-1)>

Expose a guest port at runtime. The returned listener carries the
resolved endpoint but an `"unspecified"` route status: the response
confirms configuration, not reachability; [waitForListener](#waitforlistener-1)
confirms the route is live.

###### Parameters

| Parameter   | Type                                  | Default value |
| ----------- | ------------------------------------- | ------------- |
| `guestPort` | `number`                              | `undefined`   |
| `protocol`  | [`IngressProtocol`](#ingressprotocol) | `"http"`      |
| `allowlist` | `string`\[]                           | `[]`          |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="ingressauthheaders-1" />

##### ingressAuthHeaders()

> **ingressAuthHeaders**(): `Promise`\<`Record`\<`string`, `string`>>

Ingress-identity headers for this sailbox, as a name→value map.

###### Returns

`Promise`\<`Record`\<`string`, `string`>>

<a id="listener" />

##### listener()

> **listener**(`guestPort`): `Promise`\<[`Listener`](#listener-1)>

Fetch one listener by guest port without waking the box.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `guestPort` | `number` |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="listeners" />

##### listeners()

> **listeners**(): `Promise`\<[`Listener`](#listener-1)\[]>

List this sailbox's listeners without waking it.

###### Returns

`Promise`\<[`Listener`](#listener-1)\[]>

<a id="pause" />

##### pause()

> **pause**(): `Promise`\<`void`>

Pause this sailbox in memory.

###### Returns

`Promise`\<`void`>

<a id="read" />

##### read()

> **read**(`path`): `Promise`\<`Buffer`\<`ArrayBufferLike`>>

Read a guest file fully into memory (convenience over [readStream](#readstream-1)).

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `path`    | `string` |

###### Returns

`Promise`\<`Buffer`\<`ArrayBufferLike`>>

<a id="readstream-1" />

##### readStream()

> **readStream**(`path`): `Promise`\<[`FileStream`](#filestream)>

Open a streaming read of a guest file.

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `path`    | `string` |

###### Returns

`Promise`\<[`FileStream`](#filestream)>

<a id="resume" />

##### resume()

> **resume**(): `Promise`\<`void`>

Resume this sailbox (updates [status](#status)).

###### Returns

`Promise`\<`void`>

<a id="shell-1" />

##### 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).

###### Parameters

| Parameter  | Type                            |
| ---------- | ------------------------------- |
| `command?` | `string`                        |
| `options?` | [`ShellOptions`](#shelloptions) |

###### Returns

`Promise`\<`number`>

<a id="sleep" />

##### sleep()

> **sleep**(): `Promise`\<`void`>

Sleep this sailbox to disk (wakes on traffic).

###### Returns

`Promise`\<`void`>

<a id="terminate" />

##### terminate()

> **terminate**(): `Promise`\<`void`>

Terminate (delete) this sailbox (updates [status](#status)).

###### Returns

`Promise`\<`void`>

<a id="unexpose" />

##### unexpose()

> **unexpose**(`guestPort`): `Promise`\<`void`>

Remove a runtime ingress port.

###### Parameters

| Parameter   | Type     |
| ----------- | -------- |
| `guestPort` | `number` |

###### Returns

`Promise`\<`void`>

<a id="upgrade" />

##### upgrade()

> **upgrade**(): `Promise`\<[`UpgradeResult`](#upgraderesult)>

Upgrade this sailbox's in-guest agent.

###### Returns

`Promise`\<[`UpgradeResult`](#upgraderesult)>

<a id="waitforlistener-1" />

##### waitForListener()

> **waitForListener**(`guestPort`, `options?`): `Promise`\<[`Listener`](#listener-1)>

Block until the listener on `guestPort` is reachable end to end and
return it, or throw [TimeoutError](#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 connectivity check, not
an application health check.

###### Parameters

| Parameter   | Type                                                |
| ----------- | --------------------------------------------------- |
| `guestPort` | `number`                                            |
| `options`   | [`WaitForListenerOptions`](#waitforlisteneroptions) |

###### Returns

`Promise`\<[`Listener`](#listener-1)>

<a id="write-1" />

##### write()

> **write**(`path`, `data`, `options?`): `Promise`\<`void`>

Write bytes (a `string` is encoded as UTF-8) to a guest file, creating it
and any missing parent directories (convenience over [writeStream](#writestream-1);
pass `createParents: false` to opt out).

###### Parameters

| Parameter  | Type                                                                         |
| ---------- | ---------------------------------------------------------------------------- |
| `path`     | `string`                                                                     |
| `data`     | `string` \| `Buffer`\<`ArrayBufferLike`> \| `Uint8Array`\<`ArrayBufferLike`> |
| `options?` | [`WriteOptions`](#writeoptions)                                              |

###### Returns

`Promise`\<`void`>

<a id="writestream-1" />

##### writeStream()

> **writeStream**(`path`, `options?`): `Promise`\<[`FileWriter`](#filewriter)>

Open a streaming upload to a guest file.

###### Parameters

| Parameter  | Type                            |
| ---------- | ------------------------------- |
| `path`     | `string`                        |
| `options?` | [`WriteOptions`](#writeoptions) |

###### Returns

`Promise`\<[`FileWriter`](#filewriter)>

<a id="create" />

##### create()

> `static` **create**(`options`): `Promise`\<[`Sailbox`](#sailbox)>

Create a new sailbox.

###### Parameters

| Parameter | Type                                            |
| --------- | ----------------------------------------------- |
| `options` | [`CreateSailboxOptions`](#createsailboxoptions) |

###### Returns

`Promise`\<[`Sailbox`](#sailbox)>

<a id="fromcheckpoint" />

##### fromCheckpoint()

> `static` **fromCheckpoint**(`options`): `Promise`\<[`Sailbox`](#sailbox)>

Create a new sailbox from a checkpoint.

###### Parameters

| Parameter | Type                                              |
| --------- | ------------------------------------------------- |
| `options` | [`FromCheckpointOptions`](#fromcheckpointoptions) |

###### Returns

`Promise`\<[`Sailbox`](#sailbox)>

<a id="get" />

##### get()

> `static` **get**(`sailboxId`, `options?`): `Promise`\<[`Sailbox`](#sailbox)>

Fetch an existing sailbox by id.

###### Parameters

| Parameter   | Type                              |
| ----------- | --------------------------------- |
| `sailboxId` | `string`                          |
| `options`   | [`ClientOptions`](#clientoptions) |

###### Returns

`Promise`\<[`Sailbox`](#sailbox)>

<a id="list-1" />

##### list()

> `static` **list**(`params?`, `options?`): `Promise`\<[`Sailbox`](#sailbox)\[]>

List one page of sailboxes as [Sailbox](#sailbox) instances.

###### Parameters

| Parameter | Type                                        |
| --------- | ------------------------------------------- |
| `params`  | [`ListSailboxesQuery`](#listsailboxesquery) |
| `options` | [`ClientOptions`](#clientoptions)           |

###### Returns

`Promise`\<[`Sailbox`](#sailbox)\[]>

<a id="listpage" />

##### listPage()

> `static` **listPage**(`params?`, `options?`): `Promise`\<[`SailboxPage`](#sailboxpage)>

Like [list](#list-1) but also returns the pagination envelope
(`total`/`hasMore`) for paging through large result sets.

###### Parameters

| Parameter | Type                                        |
| --------- | ------------------------------------------- |
| `params`  | [`ListSailboxesQuery`](#listsailboxesquery) |
| `options` | [`ClientOptions`](#clientoptions)           |

###### Returns

`Promise`\<[`SailboxPage`](#sailboxpage)>

***

<a id="sailboxcreationerror" />

### SailboxCreationError

A sailbox could not be created (provisioning failed).

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-8" />

##### Constructor

> **new SailboxCreationError**(`message`): [`SailboxCreationError`](#sailboxcreationerror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`SailboxCreationError`](#sailboxcreationerror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-8" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="sailboxexecrequestnotfounderror" />

### SailboxExecRequestNotFoundError

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

#### Extends

* [`SailboxExecutionError`](#sailboxexecutionerror)

#### Constructors

<a id="constructor-9" />

##### Constructor

> **new SailboxExecRequestNotFoundError**(`message`): [`SailboxExecRequestNotFoundError`](#sailboxexecrequestnotfounderror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`SailboxExecRequestNotFoundError`](#sailboxexecrequestnotfounderror)

###### Overrides

[`SailboxExecutionError`](#sailboxexecutionerror).[`constructor`](#constructor-10)

#### Properties

| Property                 | Modifier   | Type     | Description                                              | Inherited from                                                       |
| ------------------------ | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------------------------------- |
| <a id="code-9" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailboxExecutionError`](#sailboxexecutionerror).[`code`](#code-10) |

***

<a id="sailboxexecutionerror" />

### SailboxExecutionError

Base class for failures during an exec.

#### Extends

* [`SailError`](#sailerror)

#### Extended by

* [`SailboxTerminatedError`](#sailboxterminatederror)
* [`SailboxExecRequestNotFoundError`](#sailboxexecrequestnotfounderror)
* [`SailboxWorkerLostError`](#sailboxworkerlosterror)

#### Constructors

<a id="constructor-10" />

##### Constructor

> **new SailboxExecutionError**(`message`, `code?`): [`SailboxExecutionError`](#sailboxexecutionerror)

###### Parameters

| Parameter | Type     | Default value             |
| --------- | -------- | ------------------------- |
| `message` | `string` | `undefined`               |
| `code`    | `string` | `"SailboxExecutionError"` |

###### Returns

[`SailboxExecutionError`](#sailboxexecutionerror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                  | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-10" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="sailboxterminatederror" />

### SailboxTerminatedError

The sailbox was terminated while an exec was in flight.

#### Extends

* [`SailboxExecutionError`](#sailboxexecutionerror)

#### Constructors

<a id="constructor-11" />

##### Constructor

> **new SailboxTerminatedError**(`message`): [`SailboxTerminatedError`](#sailboxterminatederror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`SailboxTerminatedError`](#sailboxterminatederror)

###### Overrides

[`SailboxExecutionError`](#sailboxexecutionerror).[`constructor`](#constructor-10)

#### Properties

| Property                  | Modifier   | Type     | Description                                              | Inherited from                                                       |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------------------------------- |
| <a id="code-11" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailboxExecutionError`](#sailboxexecutionerror).[`code`](#code-10) |

***

<a id="sailboxworkerlosterror" />

### SailboxWorkerLostError

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

#### Extends

* [`SailboxExecutionError`](#sailboxexecutionerror)

#### Constructors

<a id="constructor-12" />

##### Constructor

> **new SailboxWorkerLostError**(`message`): [`SailboxWorkerLostError`](#sailboxworkerlosterror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`SailboxWorkerLostError`](#sailboxworkerlosterror)

###### Overrides

[`SailboxExecutionError`](#sailboxexecutionerror).[`constructor`](#constructor-10)

#### Properties

| Property                  | Modifier   | Type     | Description                                              | Inherited from                                                       |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------------------------------- |
| <a id="code-12" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailboxExecutionError`](#sailboxexecutionerror).[`code`](#code-10) |

***

<a id="sailerror" />

### SailError

Base class for every error surfaced by the SDK.

#### Extends

* `Error`

#### Extended by

* [`InvalidArgumentError`](#invalidargumenterror)
* [`InternalError`](#internalerror)
* [`NotFoundError`](#notfounderror)
* [`PermissionDeniedError`](#permissiondeniederror)
* [`FileNotFoundError`](#filenotfounderror)
* [`BrokenPipeError`](#brokenpipeerror)
* [`TimeoutError`](#timeouterror)
* [`TransportError`](#transporterror)
* [`ApiError`](#apierror)
* [`SailboxCreationError`](#sailboxcreationerror)
* [`ImageBuildError`](#imagebuilderror)
* [`SailboxExecutionError`](#sailboxexecutionerror)

#### Constructors

<a id="constructor-13" />

##### Constructor

> **new SailError**(`message`, `code?`): [`SailError`](#sailerror)

###### Parameters

| Parameter | Type     | Default value |
| --------- | -------- | ------------- |
| `message` | `string` | `undefined`   |
| `code`    | `string` | `"SailError"` |

###### Returns

[`SailError`](#sailerror)

###### Overrides

`Error.constructor`

#### Properties

| Property                  | Modifier   | Type     | Description                                              |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- |
| <a id="code-13" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). |

***

<a id="timeouterror" />

### TimeoutError

A request exceeded its timeout.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-14" />

##### Constructor

> **new TimeoutError**(`message`): [`TimeoutError`](#timeouterror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`TimeoutError`](#timeouterror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                  | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-14" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="transporterror" />

### TransportError

A network/connection transport failure.

#### Extends

* [`SailError`](#sailerror)

#### Constructors

<a id="constructor-15" />

##### Constructor

> **new TransportError**(`message`): [`TransportError`](#transporterror)

###### Parameters

| Parameter | Type     |
| --------- | -------- |
| `message` | `string` |

###### Returns

[`TransportError`](#transporterror)

###### Overrides

[`SailError`](#sailerror).[`constructor`](#constructor-13)

#### Properties

| Property                  | Modifier   | Type     | Description                                              | Inherited from                               |
| ------------------------- | ---------- | -------- | -------------------------------------------------------- | -------------------------------------------- |
| <a id="code-15" /> `code` | `readonly` | `string` | Stable, language-neutral error code (e.g. `"NotFound"`). | [`SailError`](#sailerror).[`code`](#code-13) |

***

<a id="volume" />

### Volume

A managed NFS volume that can be mounted into sailboxes. Look one up (or
mint it) with [Volume.find](#find-1), then pass it (or its [Volume.id](#id-1))
in a sailbox's `volumes` mapping.

#### Properties

| Property                           | Modifier   | Type               | Default value | Description                                                       |
| ---------------------------------- | ---------- | ------------------ | ------------- | ----------------------------------------------------------------- |
| <a id="backend" /> `backend`       | `readonly` | `string`           | `undefined`   | Storage backend serving the volume.                               |
| <a id="createdat-2" /> `createdAt` | `readonly` | `Date` \| `null`   | `undefined`   | Creation time, if reported.                                       |
| <a id="id-1" /> `id`               | `readonly` | `string`           | `undefined`   | Stable volume id.                                                 |
| <a id="mountpath" /> `mountPath`   | `readonly` | `string` \| `null` | `null`        | Guest mount path, when loaded via [Volume.fromMount](#frommount). |
| <a id="name-2" /> `name`           | `readonly` | `string`           | `undefined`   | Volume name.                                                      |
| <a id="status-1" /> `status`       | `readonly` | `string`           | `undefined`   | Lifecycle status.                                                 |
| <a id="updatedat-1" /> `updatedAt` | `readonly` | `Date` \| `null`   | `undefined`   | Last-update time, if reported.                                    |

#### Methods

<a id="delete" />

##### delete()

> **delete**(`options?`): `Promise`\<`boolean`>

Delete this volume. Resolves `true` if it was deleted, `false` if it was
already gone (only possible with `allowMissing`).

###### Parameters

| Parameter               | Type                             |
| ----------------------- | -------------------------------- |
| `options`               | \{ `allowMissing?`: `boolean`; } |
| `options.allowMissing?` | `boolean`                        |

###### Returns

`Promise`\<`boolean`>

<a id="find-1" />

##### find()

> `static` **find**(`name`, `options?`): `Promise`\<[`Volume`](#volume)>

Look up an NFS volume by name, optionally minting it if missing.

###### Parameters

| Parameter | Type                                         |
| --------- | -------------------------------------------- |
| `name`    | `string`                                     |
| `options` | [`ClientOptions`](#clientoptions) & `object` |

###### Returns

`Promise`\<[`Volume`](#volume)>

<a id="frommount" />

##### fromMount()

> `static` **fromMount**(`path`): [`Volume`](#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

| Parameter | Type     |
| --------- | -------- |
| `path`    | `string` |

###### Returns

[`Volume`](#volume)

<a id="list-2" />

##### list()

> `static` **list**(`options?`): `Promise`\<[`Volume`](#volume)\[]>

List NFS volumes in the current org.

###### Parameters

| Parameter | Type                                         |
| --------- | -------------------------------------------- |
| `options` | [`ClientOptions`](#clientoptions) & `object` |

###### Returns

`Promise`\<[`Volume`](#volume)\[]>

## Interfaces

<a id="addlocaldir-1" />

### AddLocalDir

A tree of local files copied into the image.

#### Properties

| Property                            | Type                                     | Description                                |
| ----------------------------------- | ---------------------------------------- | ------------------------------------------ |
| <a id="files" /> `files?`           | [`AddLocalDirFile`](#addlocaldirfile)\[] | The files to place under `remotePath`.     |
| <a id="remotepath" /> `remotePath?` | `string`                                 | Absolute guest path of the directory root. |

***

<a id="addlocaldirfile" />

### AddLocalDirFile

One file within an `addLocalDir` step.

#### Properties

| Property                                  | Type     | Description                                     |
| ----------------------------------------- | -------- | ----------------------------------------------- |
| <a id="contentsha256" /> `contentSha256?` | `string` | SHA-256 of the (already uploaded) file content. |
| <a id="mode" /> `mode?`                   | `number` | Permission bits (low 9).                        |
| <a id="relativepath" /> `relativePath?`   | `string` | Path relative to the directory root.            |

***

<a id="addlocaldiroptions" />

### AddLocalDirOptions

Options for [Image.addLocalDir](#addlocaldir).

#### Properties

| Property                            | Type        | Description                                                          |
| ----------------------------------- | ----------- | -------------------------------------------------------------------- |
| <a id="ignore" /> `ignore?`         | `string`\[] | Gitignore-style patterns to skip (e.g. `"*.pyc"`, `"__pycache__/"`). |
| <a id="ignorefile" /> `ignoreFile?` | `string`    | A gitignore-style file whose patterns to skip (e.g. `.gitignore`).   |

***

<a id="addlocalfile-1" />

### AddLocalFile

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

#### Properties

| Property                                    | Type     | Description                                                  |
| ------------------------------------------- | -------- | ------------------------------------------------------------ |
| <a id="contentsha256-1" /> `contentSha256?` | `string` | SHA-256 of the (already uploaded) file content.              |
| <a id="mode-1" /> `mode?`                   | `number` | Permission bits (low 9); 0 means the builder default (0644). |
| <a id="remotepath-1" /> `remotePath?`       | `string` | Absolute guest path to place the file at.                    |

***

<a id="addlocalfileoptions" />

### AddLocalFileOptions

Options for [Image.addLocalFile](#addlocalfile).

#### Properties

| Property                  | Type     | Description                                                      |
| ------------------------- | -------- | ---------------------------------------------------------------- |
| <a id="mode-2" /> `mode?` | `number` | Unix mode bits (low 9); omitted uses the builder default (0644). |

***

<a id="appinfo" />

### AppInfo

A Sail app.

#### Properties

| Property                           | Type     | Description               |
| ---------------------------------- | -------- | ------------------------- |
| <a id="createdat-3" /> `createdAt` | `string` | Creation time (RFC 3339). |
| <a id="id-2" /> `id`               | `string` | Stable app id.            |
| <a id="name-3" /> `name`           | `string` | App name.                 |

***

<a id="canceloptions" />

### CancelOptions

Options for cancelling an exec.

#### Properties

| Property                                              | Type      | Description                                                               |
| ----------------------------------------------------- | --------- | ------------------------------------------------------------------------- |
| <a id="force" /> `force?`                             | `boolean` | Send SIGKILL instead of SIGINT.                                           |
| <a id="retrytimeoutseconds" /> `retryTimeoutSeconds?` | `number`  | Budget in seconds for retrying the cancel against a waking/migrating box. |

***

<a id="checkpointoptions" />

### CheckpointOptions

Options for [Sailbox.checkpoint](#checkpoint).

#### Properties

| Property                            | Type     | Description                                                                                                                                                                                               |
| ----------------------------------- | -------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="name-4" /> `name?`           | `string` | Display name for the checkpoint handle.                                                                                                                                                                   |
| <a id="ttlseconds" /> `ttlSeconds?` | `number` | Retention override in whole seconds (must be positive). Set it when you keep a checkpoint to reuse as a template, so the handle does not expire while you still need it; omitted uses the server default. |

***

<a id="clientconfig" />

### ClientConfig

Explicit client configuration (an alternative to environment resolution).

#### Extends

* `Omit`\<`native.ClientConfig`, `"mode"`>

#### Properties

| Property                                      | Type     | Description                                                                                                                              | Inherited from         |
| --------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------- |
| <a id="apikey" /> `apiKey`                    | `string` | Bearer API key. Required.                                                                                                                | `Omit.apiKey`          |
| <a id="apiurl" /> `apiUrl?`                   | `string` | Override the Sail API URL.                                                                                                               | `Omit.apiUrl`          |
| <a id="imagebuilderurl" /> `imagebuilderUrl?` | `string` | Override the image-build endpoint (`host:port`).                                                                                         | `Omit.imagebuilderUrl` |
| <a id="ingressurl" /> `ingressUrl?`           | `string` | Override the listener ingress base URL (what `SAILBOX_INGRESS_URL` sets from the environment), for custom or self-hosted sailbox stacks. | `Omit.ingressUrl`      |
| <a id="sailboxapiurl" /> `sailboxApiUrl?`     | `string` | Override the sailbox-API URL.                                                                                                            | `Omit.sailboxApiUrl`   |

***

<a id="clientoptions" />

### ClientOptions

Options for statics that select which [Client](#client) to use.

#### Extended by

* [`CreateSailboxOptions`](#createsailboxoptions)
* [`FromCheckpointOptions`](#fromcheckpointoptions)

#### Properties

| Property                      | Type                | Description                                             |
| ----------------------------- | ------------------- | ------------------------------------------------------- |
| <a id="client-2" /> `client?` | [`Client`](#client) | Use a specific client instead of the default (env) one. |

***

<a id="createsailboxoptions" />

### CreateSailboxOptions

Options for [Sailbox.create](#create): the create request plus a per-attempt
timeout and an optional explicit client. `image` defaults to a Debian base.

#### Extends

* `Omit`\<[`CreateSailboxRequest`](#createsailboxrequest), `"image"` | `"appId"` | `"volumeMounts"` | `"ingressPorts"`>.[`ClientOptions`](#clientoptions)

#### Properties

| Property                                                        | Type                                                     | Description                                                                                                                                                                                                                                                                               | Overrides  | Inherited from                                                    |
| --------------------------------------------------------------- | -------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- | ----------------------------------------------------------------- |
| <a id="app-1" /> `app`                                          | `string` \| [`App`](#app)                                | The owning app, or its id.                                                                                                                                                                                                                                                                | -          | -                                                                 |
| <a id="autosleeptimeoutminutes" /> `autosleepTimeoutMinutes?`   | `number`                                                 | Idle minutes (1-1440) after which Sail may sleep the box.                                                                                                                                                                                                                                 | -          | `Omit.autosleepTimeoutMinutes`                                    |
| <a id="client-3" /> `client?`                                   | [`Client`](#client)                                      | Use a specific client instead of the default (env) one.                                                                                                                                                                                                                                   | -          | [`ClientOptions`](#clientoptions).[`client`](#client-2)           |
| <a id="diskgib" /> `diskGib?`                                   | `number`                                                 | Disk size in whole GiB within the size's range; the size's default when omitted.                                                                                                                                                                                                          | -          | `Omit.diskGib`                                                    |
| <a id="image-1" /> `image?`                                     | [`ImageSpec`](#imagespec) \| [`Image`](#image)           | Image spec, or an [Image](#image) builder (built and resolved at create). Defaults to a plain Debian base.                                                                                                                                                                                | -          | -                                                                 |
| <a id="imagebuildtimeoutseconds" /> `imageBuildTimeoutSeconds?` | `number`                                                 | Timeout in seconds for building a custom `Image` before create (1800).                                                                                                                                                                                                                    | -          | -                                                                 |
| <a id="ingressports" /> `ingressPorts?`                         | (`number` \| [`IngressPortInput`](#ingressportinput))\[] | Guest ports to expose: a bare number is HTTP shorthand.                                                                                                                                                                                                                                   | -          | -                                                                 |
| <a id="memorygib" /> `memoryGib?`                               | `number`                                                 | Memory limit in whole GiB within the size's range; the size's default when omitted.                                                                                                                                                                                                       | -          | `Omit.memoryGib`                                                  |
| <a id="name-5" /> `name`                                        | `string`                                                 | The sailbox name.                                                                                                                                                                                                                                                                         | -          | `Omit.name`                                                       |
| <a id="size" /> `size?`                                         | [`SailboxSize`](#sailboxsize)                            | Resource size; `"m"` when omitted.                                                                                                                                                                                                                                                        | -          | [`CreateSailboxRequest`](#createsailboxrequest).[`size`](#size-1) |
| <a id="ssh" /> `ssh?`                                           | `boolean`                                                | Enable SSH on the new sailbox after create: trust the org SSH CA, start `sshd`, and expose guest port 22 as TCP once the CA-only daemon owns it (an explicit port-22 ingress entry contributes just its allowlist). Equivalent to calling [Sailbox.enableSsh](#enablessh-1) after create. | `Omit.ssh` | -                                                                 |
| <a id="timeoutseconds" /> `timeoutSeconds?`                     | `number`                                                 | Bounds each create attempt (default 600s); pass `0` for no client-side timeout. Timed-out attempts are retried, reattaching to the same box, so when the overall budget is exhausted the box may still be coming up server-side: find or terminate it by `name`.                          | -          | -                                                                 |
| <a id="volumes" /> `volumes?`                                   | `Record`\<`string`, `string` \| [`Volume`](#volume)>     | Shared volumes to mount, mapping an absolute guest path to a [Volume](#volume) or volume id.                                                                                                                                                                                              | -          | -                                                                 |

***

<a id="createsailboxrequest" />

### CreateSailboxRequest

#### Extends

* `Omit`\<`native.CreateSailboxRequest`, `"image"` | `"ingressPorts"` | `"size"`>

#### Properties

| Property                                                        | Type                                       | Description                                                                                                                                                                                                         | Inherited from                 |
| --------------------------------------------------------------- | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------ |
| <a id="appid-2" /> `appId`                                      | `string`                                   | Identifier of the owning app.                                                                                                                                                                                       | `Omit.appId`                   |
| <a id="autosleeptimeoutminutes-1" /> `autosleepTimeoutMinutes?` | `number`                                   | Idle minutes (1-1440) after which Sail may sleep the box.                                                                                                                                                           | `Omit.autosleepTimeoutMinutes` |
| <a id="diskgib-1" /> `diskGib?`                                 | `number`                                   | Disk size in whole GiB within the size's range; the size's default when omitted.                                                                                                                                    | `Omit.diskGib`                 |
| <a id="image-2" /> `image?`                                     | [`ImageSpec`](#imagespec)                  | Image to boot; defaults to a plain Debian base when omitted.                                                                                                                                                        | -                              |
| <a id="ingressports-1" /> `ingressPorts?`                       | [`IngressPortInput`](#ingressportinput)\[] | Guest ports to reserve for ingress.                                                                                                                                                                                 | -                              |
| <a id="memorygib-1" /> `memoryGib?`                             | `number`                                   | Memory limit in whole GiB within the size's range; the size's default when omitted.                                                                                                                                 | `Omit.memoryGib`               |
| <a id="name-6" /> `name`                                        | `string`                                   | The sailbox name.                                                                                                                                                                                                   | `Omit.name`                    |
| <a id="size-1" /> `size?`                                       | [`SailboxSize`](#sailboxsize)              | Resource size; `"m"` when omitted.                                                                                                                                                                                  | -                              |
| <a id="ssh-1" /> `ssh?`                                         | `boolean`                                  | Enable SSH on the new sailbox after create: trust the org SSH CA, start `sshd`, and expose guest port 22 as TCP once the CA-only daemon owns it (an explicit port-22 ingress entry contributes just its allowlist). | `Omit.ssh`                     |
| <a id="volumemounts" /> `volumeMounts?`                         | [`VolumeMountInput`](#volumemountinput)\[] | NFS volumes to mount.                                                                                                                                                                                               | `Omit.volumeMounts`            |

***

<a id="enablesshoptions" />

### EnableSshOptions

Options for enabling SSH on a sailbox.

#### Properties

| Property                                      | Type        | Description                                                                                                                                                                                   |
| --------------------------------------------- | ----------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="allowlist" /> `allowlist?`             | `string`\[] | Source CIDRs allowed to reach port 22, replacing any existing restriction. Left empty, a first enable opens the port to any source, and a re-enable leaves an existing restriction unchanged. |
| <a id="timeoutseconds-1" /> `timeoutSeconds?` | `number`    | Give up waiting after this many seconds (default 60; `Infinity` waits indefinitely).                                                                                                          |
| <a id="wait-1" /> `wait?`                     | `boolean`   | Poll until the SSH route is ready (default true).                                                                                                                                             |

***

<a id="execoptions" />

### ExecOptions

Options for starting an exec.

#### Properties

| Property                                                | Type      | Description                                                                                                                                              |
| ------------------------------------------------------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="background" /> `background?`                     | `boolean` | Detach the command so it keeps running and the call returns immediately; output is discarded (shell commands only, incompatible with `openStdin`/`pty`). |
| <a id="cols" /> `cols?`                                 | `number`  | Initial pty width in columns.                                                                                                                            |
| <a id="cwd" /> `cwd?`                                   | `string`  | Working directory to run the command in (shell commands only).                                                                                           |
| <a id="idempotencykey-1" /> `idempotencyKey?`           | `string`  | Stable key so a reconnect reattaches to the same command.                                                                                                |
| <a id="openstdin" /> `openStdin?`                       | `boolean` | Leave stdin open for `writeStdin`.                                                                                                                       |
| <a id="pty" /> `pty?`                                   | `boolean` | Allocate a pseudo-terminal.                                                                                                                              |
| <a id="retrytimeoutseconds-1" /> `retryTimeoutSeconds?` | `number`  | Budget in seconds for retrying transient RPC failures.                                                                                                   |
| <a id="rows" /> `rows?`                                 | `number`  | Initial pty height in rows.                                                                                                                              |
| <a id="term" /> `term?`                                 | `string`  | TERM value for the pty.                                                                                                                                  |
| <a id="timeoutseconds-2" /> `timeoutSeconds?`           | `number`  | Wall-clock limit in seconds before the server kills the command.                                                                                         |

***

<a id="execresult" />

### ExecResult

The authoritative result of a finished exec.

The buffered `stdout`/`stderr` are a capped, drop-oldest tail (the server
keeps a bounded ring). To capture the complete output of a large-output
command, stream it live and consult the `*Truncated`/`*Complete` flags.

#### Properties

| Property                                     | Type      | Description                                                                                                                                                 |
| -------------------------------------------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <a id="exitcode" /> `exitCode`               | `number`  | The command's exit code.                                                                                                                                    |
| <a id="stderr-1" /> `stderr`                 | `string`  | Buffered stderr (a capped tail; see `stderrTruncated`/`stderrComplete`).                                                                                    |
| <a id="stderrcomplete" /> `stderrComplete`   | `boolean` | True if the live stream delivered stderr through to exit (see `stdoutComplete`).                                                                            |
| <a id="stderrtruncated" /> `stderrTruncated` | `boolean` | True if buffered `stderr` dropped its oldest bytes (ring overflow).                                                                                         |
| <a id="stdout-1" /> `stdout`                 | `string`  | Buffered stdout (a capped tail; see `stdoutTruncated`/`stdoutComplete`).                                                                                    |
| <a id="stdoutcomplete" /> `stdoutComplete`   | `boolean` | True if the live stream delivered stdout through to exit: a consumer that streamed live already has the complete stdout even if `stdout` here is truncated. |
| <a id="stdouttruncated" /> `stdoutTruncated` | `boolean` | True if buffered `stdout` dropped its oldest bytes (ring overflow).                                                                                         |
| <a id="timedout" /> `timedOut`               | `boolean` | Whether the command was killed for exceeding its timeout.                                                                                                   |

***

<a id="fromcheckpointoptions" />

### FromCheckpointOptions

Options for [Sailbox.fromCheckpoint](#fromcheckpoint).

#### Extends

* [`FromCheckpointRequest`](#fromcheckpointrequest).[`ClientOptions`](#clientoptions)

#### Properties

| Property                                      | Type                | Description                                                                   | Inherited from                                                                          |
| --------------------------------------------- | ------------------- | ----------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- |
| <a id="checkpointid" /> `checkpointId`        | `string`            | The checkpoint to restore from.                                               | [`FromCheckpointRequest`](#fromcheckpointrequest).[`checkpointId`](#checkpointid-1)     |
| <a id="client-4" /> `client?`                 | [`Client`](#client) | Use a specific client instead of the default (env) one.                       | [`ClientOptions`](#clientoptions).[`client`](#client-2)                                 |
| <a id="name-7" /> `name?`                     | `string`            | Name for the new sailbox; defaults to the source box's name.                  | [`FromCheckpointRequest`](#fromcheckpointrequest).[`name`](#name-8)                     |
| <a id="timeoutseconds-3" /> `timeoutSeconds?` | `number`            | Restore timeout in whole seconds (positive); omitted uses the server default. | [`FromCheckpointRequest`](#fromcheckpointrequest).[`timeoutSeconds`](#timeoutseconds-4) |

***

<a id="fromcheckpointrequest" />

### FromCheckpointRequest

The create-from-checkpoint request.

#### Extended by

* [`FromCheckpointOptions`](#fromcheckpointoptions)

#### Properties

| Property                                      | Type     | Description                                                                   |
| --------------------------------------------- | -------- | ----------------------------------------------------------------------------- |
| <a id="checkpointid-1" /> `checkpointId`      | `string` | The checkpoint to restore from.                                               |
| <a id="name-8" /> `name?`                     | `string` | Name for the new sailbox; defaults to the source box's name.                  |
| <a id="timeoutseconds-4" /> `timeoutSeconds?` | `number` | Restore timeout in whole seconds (positive); omitted uses the server default. |

***

<a id="httpendpoint" />

### HttpEndpoint

The routable HTTPS address of an `http` listener.

#### Properties

| Property               | Type     | Description                               |
| ---------------------- | -------- | ----------------------------------------- |
| <a id="kind" /> `kind` | `"http"` | -                                         |
| <a id="url" /> `url`   | `string` | The HTTPS URL to reach the guest service. |

***

<a id="imagebuild-1" />

### ImageBuild

The state of a custom image build.

#### Extends

* `Omit`\<`native.ImageBuild`, `"status"`>

#### Properties

| Property                                  | Type                                      | Description                                                       | Inherited from      |
| ----------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------- | ------------------- |
| <a id="errormessage-1" /> `errorMessage?` | `string`                                  | Human-readable failure detail; present when `status` is `failed`. | `Omit.errorMessage` |
| <a id="imageid-1" /> `imageId`            | `string`                                  | The content-addressed image id.                                   | `Omit.imageId`      |
| <a id="status-2" /> `status`              | [`ImageBuildStatus`](#imagebuildstatus-1) | -                                                                 | -                   |

***

<a id="imagedefinition" />

### ImageDefinition

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

#### Properties

| Property                                  | Type                                             | Description                                                                   |
| ----------------------------------------- | ------------------------------------------------ | ----------------------------------------------------------------------------- |
| <a id="architecture-1" /> `architecture?` | `string`                                         | Target CPU architecture: `amd64` or `arm64`; unset lets the backend choose.   |
| <a id="base" /> `base?`                   | `string`                                         | Base image to build on: `debian` or `devbox`.                                 |
| <a id="env-1" /> `env?`                   | `Record`\<`string`, `string`>                    | Environment variables baked into the image.                                   |
| <a id="pythonversion" /> `pythonVersion?` | `string`                                         | Exact Python version to install as `python3`; unset uses the builder default. |
| <a id="steps" /> `steps?`                 | [`ImageDefinitionStep`](#imagedefinitionstep)\[] | Ordered build steps.                                                          |

***

<a id="imagedefinitionstep" />

### ImageDefinitionStep

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

#### Properties

| Property                                  | Type                                | Description                                 |
| ----------------------------------------- | ----------------------------------- | ------------------------------------------- |
| <a id="addlocaldir-2" /> `addLocalDir?`   | [`LocalDirInput`](#localdirinput)   | Bake a local directory tree into the image. |
| <a id="addlocalfile-2" /> `addLocalFile?` | [`LocalFileInput`](#localfileinput) | Bake one local file into the image.         |
| <a id="aptinstall-1" /> `aptInstall?`     | `string`\[]                         | Install system packages with apt.           |
| <a id="pipinstall-1" /> `pipInstall?`     | `string`\[]                         | Install Python packages with pip.           |
| <a id="runcommand-1" /> `runCommand?`     | `string`                            | Run a shell command during the build.       |

***

<a id="imagespec" />

### ImageSpec

A sailbox image: a base image plus ordered build steps.

#### Extends

* `Omit`\<`native.ImageSpec`, `"base"` | `"buildSteps"` | `"architecture"`>

#### Properties

| Property                                    | Type                                      | Description                                                                   | Inherited from       |
| ------------------------------------------- | ----------------------------------------- | ----------------------------------------------------------------------------- | -------------------- |
| <a id="architecture-2" /> `architecture?`   | [`ImageArchitecture`](#imagearchitecture) | Target CPU architecture; unset lets the backend choose.                       | -                    |
| <a id="base-1" /> `base?`                   | [`BaseImage`](#baseimage)                 | Base image to build on.                                                       | -                    |
| <a id="buildsteps" /> `buildSteps?`         | [`ImageBuildStep`](#imagebuildstep)\[]    | Ordered build steps applied on top of the base image.                         | -                    |
| <a id="env-2" /> `env?`                     | `Record`\<`string`, `string`>             | Environment variables baked into the image.                                   | `Omit.env`           |
| <a id="pythonversion-1" /> `pythonVersion?` | `string`                                  | Exact Python version to install as `python3`; unset uses the builder default. | `Omit.pythonVersion` |

***

<a id="ingressportinput" />

### IngressPortInput

A guest port to reserve for ingress at create time.

#### Extends

* `Omit`\<`native.IngressPortInput`, `"protocol"`>

#### Properties

| Property                            | Type                                  | Description                                                   | Inherited from   |
| ----------------------------------- | ------------------------------------- | ------------------------------------------------------------- | ---------------- |
| <a id="allowlist-1" /> `allowlist?` | `string`\[]                           | Source addresses allowed to reach the port; empty allows all. | `Omit.allowlist` |
| <a id="guestport" /> `guestPort`    | `number`                              | The in-guest port to expose (1-65535).                        | `Omit.guestPort` |
| <a id="protocol" /> `protocol`      | [`IngressProtocol`](#ingressprotocol) | `http` or `tcp`.                                              | -                |

***

<a id="listener-1" />

### Listener

An exposed guest port and how to reach it.

#### Properties

| Property                             | Type                                            | Description                                                        |
| ------------------------------------ | ----------------------------------------------- | ------------------------------------------------------------------ |
| <a id="endpoint" /> `endpoint?`      | [`ListenerEndpoint`](#listenerendpoint-1)       | How to reach the port; `undefined` until the listener is routable. |
| <a id="guestport-1" /> `guestPort`   | `number`                                        | The in-guest port traffic is forwarded to.                         |
| <a id="protocol-1" /> `protocol`     | [`Protocol`](#protocol-2)                       | Wire protocol exposed.                                             |
| <a id="routestatus" /> `routeStatus` | [`ListenerRouteStatus`](#listenerroutestatus-1) | Status of the listener's ingress route.                            |

***

<a id="listsailboxesquery" />

### ListSailboxesQuery

Filters for listing sailboxes.

#### Extends

* `Omit`\<`native.ListSailboxesQuery`, `"status"`>

#### Properties

| Property                                                  | Type                                          | Description                                           | Inherited from               |
| --------------------------------------------------------- | --------------------------------------------- | ----------------------------------------------------- | ---------------------------- |
| <a id="appid-3" /> `appId?`                               | `string`                                      | Filter to one app by its id.                          | `Omit.appId`                 |
| <a id="limit" /> `limit?`                                 | `number`                                      | Page size.                                            | `Omit.limit`                 |
| <a id="maxguestschemaversion" /> `maxGuestSchemaVersion?` | `number`                                      | Only sailboxes at or below this guest schema version. | `Omit.maxGuestSchemaVersion` |
| <a id="offset" /> `offset?`                               | `number`                                      | Page offset.                                          | `Omit.offset`                |
| <a id="search" /> `search?`                               | `string`                                      | Substring filter on the sailbox name.                 | `Omit.search`                |
| <a id="status-3" /> `status?`                             | [`SailboxStatusFilter`](#sailboxstatusfilter) | Filter by lifecycle status.                           | -                            |

***

<a id="localdirinput" />

### LocalDirInput

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

#### Properties

| Property                              | Type        | Description                                                        |
| ------------------------------------- | ----------- | ------------------------------------------------------------------ |
| <a id="ignore-1" /> `ignore?`         | `string`\[] | Gitignore-style patterns to skip.                                  |
| <a id="ignorefile-1" /> `ignoreFile?` | `string`    | A gitignore-style file whose patterns to skip (e.g. `.gitignore`). |
| <a id="localpath" /> `localPath`      | `string`    | Path on this machine.                                              |
| <a id="remotepath-2" /> `remotePath`  | `string`    | Absolute POSIX path of the directory root inside the image.        |

***

<a id="localfileinput" />

### LocalFileInput

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

#### Properties

| Property                             | Type     | Description                                                                       |
| ------------------------------------ | -------- | --------------------------------------------------------------------------------- |
| <a id="localpath-1" /> `localPath`   | `string` | Path on this machine.                                                             |
| <a id="mode-3" /> `mode?`            | `number` | Permission bits (low 9); omitted uses the builder default (0644).                 |
| <a id="remotepath-3" /> `remotePath` | `string` | Absolute POSIX path inside the image; a trailing `/` appends the source basename. |

***

<a id="packageinstall" />

### PackageInstall

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

#### Properties

| Property                        | Type        | Description    |
| ------------------------------- | ----------- | -------------- |
| <a id="packages" /> `packages?` | `string`\[] | Package names. |

***

<a id="resolvedconfig" />

### ResolvedConfig

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

#### Extends

* `Omit`\<`native.ResolvedConfig`, `"ingressScheme"`>

#### Properties

| Property                                       | Type                                | Description                                           | Inherited from         |
| ---------------------------------------------- | ----------------------------------- | ----------------------------------------------------- | ---------------------- |
| <a id="apikey-1" /> `apiKey?`                  | `string`                            | The resolved API key; absent when none is configured. | `Omit.apiKey`          |
| <a id="apiurl-1" /> `apiUrl`                   | `string`                            | Sail API URL.                                         | `Omit.apiUrl`          |
| <a id="imagebuilderurl-1" /> `imagebuilderUrl` | `string`                            | Image-build endpoint (`host:port`).                   | `Omit.imagebuilderUrl` |
| <a id="ingressbase" /> `ingressBase`           | `string`                            | Base host/URL public listeners are addressed under.   | `Omit.ingressBase`     |
| <a id="ingressscheme" /> `ingressScheme`       | [`IngressScheme`](#ingressscheme-1) | -                                                     | -                      |
| <a id="sailboxapiurl-1" /> `sailboxApiUrl`     | `string`                            | Sailbox-API URL.                                      | `Omit.sailboxApiUrl`   |

***

<a id="runcommand-2" />

### RunCommand

A shell command to run during the build.

#### Properties

| Property                      | Type     | Description                               |
| ----------------------------- | -------- | ----------------------------------------- |
| <a id="command" /> `command?` | `string` | The command, run via the builder's shell. |

***

<a id="sailboxcheckpoint-1" />

### SailboxCheckpoint

A durable checkpoint handle.

#### Extends

* `Omit`\<`native.SailboxCheckpoint`, `"status"` | `"expiresAt"`>

#### Properties

| Property                                                 | Type                                | Description                                                          | Inherited from              |
| -------------------------------------------------------- | ----------------------------------- | -------------------------------------------------------------------- | --------------------------- |
| <a id="checkpointgeneration-1" /> `checkpointGeneration` | `number`                            | Checkpoint generation captured by this checkpoint.                   | `Omit.checkpointGeneration` |
| <a id="checkpointid-2" /> `checkpointId`                 | `string`                            | The checkpoint id.                                                   | `Omit.checkpointId`         |
| <a id="expiresat" /> `expiresAt?`                        | `Date`                              | When the handle becomes eligible for garbage collection, if bounded. | -                           |
| <a id="sailboxid-1" /> `sailboxId`                       | `string`                            | The sailbox the checkpoint was taken from.                           | `Omit.sailboxId`            |
| <a id="status-4" /> `status`                             | [`SailboxStatus`](#sailboxstatus-1) | -                                                                    | -                           |

***

<a id="sailboxhandle" />

### SailboxHandle

Returned by create / resume / fromCheckpoint: the sailbox's identity and
lifecycle status.

#### Extends

* `Omit`\<`native.SailboxHandle`, `"status"`>

#### Properties

| Property                           | Type                                | Description       | Inherited from   |
| ---------------------------------- | ----------------------------------- | ----------------- | ---------------- |
| <a id="name-9" /> `name`           | `string`                            | The sailbox name. | `Omit.name`      |
| <a id="sailboxid-2" /> `sailboxId` | `string`                            | The sailbox id.   | `Omit.sailboxId` |
| <a id="status-5" /> `status`       | [`SailboxStatus`](#sailboxstatus-1) | -                 | -                |

***

<a id="sailboxinfo" />

### SailboxInfo

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

#### Extends

* `Omit`\<`native.SailboxInfo`, `"status"`>

#### Properties

| Property                                                 | Type                                | Description                                                                                                   | Inherited from              |
| -------------------------------------------------------- | ----------------------------------- | ------------------------------------------------------------------------------------------------------------- | --------------------------- |
| <a id="appid-4" /> `appId`                               | `string`                            | Identifier of the owning app.                                                                                 | `Omit.appId`                |
| <a id="appname-2" /> `appName`                           | `string`                            | Name of the owning app.                                                                                       | `Omit.appName`              |
| <a id="architecture-3" /> `architecture`                 | `string`                            | CPU architecture (for example `arm64`).                                                                       | `Omit.architecture`         |
| <a id="checkpointgeneration-2" /> `checkpointGeneration` | `number`                            | Monotonic checkpoint generation counter.                                                                      | `Omit.checkpointGeneration` |
| <a id="cpurequestedvcpu-1" /> `cpuRequestedVcpu`         | `number`                            | Requested CPU, in vCPUs.                                                                                      | `Omit.cpuRequestedVcpu`     |
| <a id="cpuusedvcpu-1" /> `cpuUsedVcpu`                   | `number`                            | Current CPU usage, in vCPUs.                                                                                  | `Omit.cpuUsedVcpu`          |
| <a id="createdat-4" /> `createdAt`                       | `string`                            | When the sailbox was created (RFC 3339).                                                                      | `Omit.createdAt`            |
| <a id="diskrequestedbytes-1" /> `diskRequestedBytes`     | `number`                            | Requested disk, in bytes.                                                                                     | `Omit.diskRequestedBytes`   |
| <a id="diskusedbytes-1" /> `diskUsedBytes`               | `number`                            | Current disk usage, in bytes.                                                                                 | `Omit.diskUsedBytes`        |
| <a id="errormessage-2" /> `errorMessage?`                | `string`                            | Human-readable error detail when the box is in an error state.                                                | `Omit.errorMessage`         |
| <a id="guestschemaversion-1" /> `guestSchemaVersion?`    | `number`                            | Guest schema version; absent for boxes created before it was recorded (treat as the oldest possible version). | `Omit.guestSchemaVersion`   |
| <a id="imageid-2" /> `imageId`                           | `string`                            | Identifier of the image the sailbox was created from.                                                         | `Omit.imageId`              |
| <a id="lastcheckpointedat-1" /> `lastCheckpointedAt?`    | `string`                            | When the most recent checkpoint was taken, if any (RFC 3339).                                                 | `Omit.lastCheckpointedAt`   |
| <a id="memorymib-1" /> `memoryMib`                       | `number`                            | Configured memory, in MiB.                                                                                    | `Omit.memoryMib`            |
| <a id="memoryrequestedbytes-1" /> `memoryRequestedBytes` | `number`                            | Requested memory, in bytes.                                                                                   | `Omit.memoryRequestedBytes` |
| <a id="memoryusedbytes-1" /> `memoryUsedBytes`           | `number`                            | Current memory usage, in bytes.                                                                               | `Omit.memoryUsedBytes`      |
| <a id="name-10" /> `name`                                | `string`                            | The sailbox name.                                                                                             | `Omit.name`                 |
| <a id="sailboxid-3" /> `sailboxId`                       | `string`                            | The sailbox id.                                                                                               | `Omit.sailboxId`            |
| <a id="startedat-1" /> `startedAt?`                      | `string`                            | When the box last started, if it ever has (RFC 3339).                                                         | `Omit.startedAt`            |
| <a id="statedisksizegib-1" /> `stateDiskSizeGib`         | `number`                            | Configured state-disk size, in GiB.                                                                           | `Omit.stateDiskSizeGib`     |
| <a id="status-6" /> `status`                             | [`SailboxStatus`](#sailboxstatus-1) | -                                                                                                             | -                           |
| <a id="updatedat-2" /> `updatedAt`                       | `string`                            | When the sailbox was last updated (RFC 3339).                                                                 | `Omit.updatedAt`            |
| <a id="vcpucount-1" /> `vcpuCount`                       | `number`                            | Configured number of vCPUs.                                                                                   | `Omit.vcpuCount`            |

***

<a id="sailboxinfopage" />

### SailboxInfoPage

One page of list results plus the pagination envelope.

#### Extends

* `Omit`\<`native.SailboxInfoPage`, `"items"`>

#### Properties

| Property                     | Type                             | Description                                | Inherited from |
| ---------------------------- | -------------------------------- | ------------------------------------------ | -------------- |
| <a id="hasmore" /> `hasMore` | `boolean`                        | Whether more results exist past this page. | `Omit.hasMore` |
| <a id="items" /> `items`     | [`SailboxInfo`](#sailboxinfo)\[] | -                                          | -              |
| <a id="limit-1" /> `limit`   | `number`                         | The page size that was applied.            | `Omit.limit`   |
| <a id="offset-1" /> `offset` | `number`                         | The offset that was applied.               | `Omit.offset`  |
| <a id="total" /> `total`     | `number`                         | Total matching sailboxes across all pages. | `Omit.total`   |

***

<a id="sailboxpage" />

### SailboxPage

One page of [Sailbox](#sailbox) instances plus the pagination envelope.

#### Extends

* `Omit`\<[`SailboxInfoPage`](#sailboxinfopage), `"items"`>

#### Properties

| Property                       | Type                     | Description                                | Inherited from |
| ------------------------------ | ------------------------ | ------------------------------------------ | -------------- |
| <a id="hasmore-1" /> `hasMore` | `boolean`                | Whether more results exist past this page. | `Omit.hasMore` |
| <a id="items-1" /> `items`     | [`Sailbox`](#sailbox)\[] | -                                          | -              |
| <a id="limit-2" /> `limit`     | `number`                 | The page size that was applied.            | `Omit.limit`   |
| <a id="offset-2" /> `offset`   | `number`                 | The offset that was applied.               | `Omit.offset`  |
| <a id="total-1" /> `total`     | `number`                 | Total matching sailboxes across all pages. | `Omit.total`   |

***

<a id="shelloptions" />

### ShellOptions

Options for [Sailbox.shell](#shell-1).

#### Properties

| Property                                      | Type     | Description                                                                                                                     |
| --------------------------------------------- | -------- | ------------------------------------------------------------------------------------------------------------------------------- |
| <a id="cwd-1" /> `cwd?`                       | `string` | Working directory for the session.                                                                                              |
| <a id="shell-2" /> `shell?`                   | `string` | Login shell to run when no command is given (default: the guest's `$SHELL`, else `/bin/bash`). Ignored when a command is given. |
| <a id="term-1" /> `term?`                     | `string` | `$TERM` for the remote pty (default: the local `$TERM`).                                                                        |
| <a id="timeoutseconds-5" /> `timeoutSeconds?` | `number` | Wall-clock limit for the session in seconds; omit for no limit.                                                                 |

***

<a id="sshendpoint" />

### SshEndpoint

The public TCP endpoint a sailbox's SSH listener is reachable at.

#### Properties

| Property               | Type     | Description       |
| ---------------------- | -------- | ----------------- |
| <a id="host" /> `host` | `string` | Hostname to dial. |
| <a id="port" /> `port` | `number` | Port to dial.     |

***

<a id="tcpendpoint" />

### TcpEndpoint

The address to dial for a `tcp` listener.

#### Properties

| Property                 | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| <a id="host-1" /> `host` | `string` | Hostname to dial. |
| <a id="kind-1" /> `kind` | `"tcp"`  | -                 |
| <a id="port-1" /> `port` | `number` | Port to dial.     |

***

<a id="upgraderesult" />

### UpgradeResult

The outcome of an in-guest agent upgrade.

#### Extends

* `Omit`\<`native.UpgradeResult`, `"status"`>

#### Properties

| Property                     | Type                                | Description                                                                        | Inherited from |
| ---------------------------- | ----------------------------------- | ---------------------------------------------------------------------------------- | -------------- |
| <a id="applied" /> `applied` | `boolean`                           | True when applied immediately (running box); false when deferred to the next wake. | `Omit.applied` |
| <a id="status-7" /> `status` | [`SailboxStatus`](#sailboxstatus-1) | -                                                                                  | -              |

***

<a id="volumeinfo" />

### VolumeInfo

A managed NFS volume. Timestamps are RFC 3339 strings.

#### Properties

| Property                            | Type     | Description                               |
| ----------------------------------- | -------- | ----------------------------------------- |
| <a id="backend-1" /> `backend`      | `string` | Storage backend serving the volume.       |
| <a id="createdat-5" /> `createdAt?` | `string` | Creation time (RFC 3339), if reported.    |
| <a id="name-11" /> `name`           | `string` | The volume name.                          |
| <a id="status-8" /> `status`        | `string` | Lifecycle status.                         |
| <a id="updatedat-3" /> `updatedAt?` | `string` | Last-update time (RFC 3339), if reported. |
| <a id="volumeid-1" /> `volumeId`    | `string` | The volume id.                            |

***

<a id="volumemountinput" />

### VolumeMountInput

An NFS volume to mount at create time.

#### Properties

| Property                           | Type     | Description                                     |
| ---------------------------------- | -------- | ----------------------------------------------- |
| <a id="mountpath-1" /> `mountPath` | `string` | Absolute guest path to mount at.                |
| <a id="volumeid-2" /> `volumeId`   | `string` | The volume id (from `getVolume`/`listVolumes`). |

***

<a id="waitforlisteneroptions" />

### WaitForListenerOptions

Options for [Sailbox.waitForListener](#waitforlistener-1).

#### Properties

| Property                                              | Type     | Description                                                                          |
| ----------------------------------------------------- | -------- | ------------------------------------------------------------------------------------ |
| <a id="pollintervalseconds" /> `pollIntervalSeconds?` | `number` | Re-check cadence in seconds (default 1).                                             |
| <a id="timeoutseconds-6" /> `timeoutSeconds?`         | `number` | Give up waiting after this many seconds (default 60; `Infinity` waits indefinitely). |

***

<a id="writeoptions" />

### WriteOptions

Options for uploading a file.

#### Properties

| Property                                  | Type      | Description                          |
| ----------------------------------------- | --------- | ------------------------------------ |
| <a id="createparents" /> `createParents?` | `boolean` | Create missing parent directories.   |
| <a id="mode-4" /> `mode?`                 | `number`  | Unix mode bits for the written file. |

## Type Aliases

<a id="baseimage" />

### BaseImage

> **BaseImage** = `"debian"` | `"devbox"`

***

<a id="imagearchitecture" />

### ImageArchitecture

> **ImageArchitecture** = `"amd64"` | `"arm64"`

***

<a id="imagebuildstatus-1" />

### ImageBuildStatus

> **ImageBuildStatus** = `"unspecified"` | `"queued"` | `"building"` | `"ready"` | `"failed"`

The status of a custom image build.

***

<a id="imagebuildstep" />

### ImageBuildStep

> **ImageBuildStep** = \{ `aptInstall`: [`PackageInstall`](#packageinstall); } | \{ `pipInstall`: [`PackageInstall`](#packageinstall); } | \{ `runCommand`: [`RunCommand`](#runcommand-2); } | \{ `addLocalFile`: [`AddLocalFile`](#addlocalfile-1); } | \{ `addLocalDir`: [`AddLocalDir`](#addlocaldir-1); }

One build step: exactly one operation.

***

<a id="ingressprotocol" />

### IngressProtocol

> **IngressProtocol** = `"tcp"` | `"http"`

The protocol you request when exposing a port.

***

<a id="ingressscheme-1" />

### IngressScheme

> **IngressScheme** = `"path"` | `"subdomain"`

How a listener's URL is addressed under `ingressBase`.

***

<a id="listenerendpoint-1" />

### ListenerEndpoint

> **ListenerEndpoint** = [`HttpEndpoint`](#httpendpoint) | [`TcpEndpoint`](#tcpendpoint)

How to reach an exposed listener; discriminate on `kind`.

***

<a id="listenerroutestatus-1" />

### ListenerRouteStatus

> **ListenerRouteStatus** = `"unspecified"` | `"pending"` | `"active"` | `"restoring"` | `"unavailable"` | `string` & `object`

Status of a listener's ingress route (open: tolerates unknown values).

***

<a id="protocol-2" />

### Protocol

> **Protocol** = `"tcp"` | `"http"` | `string` & `object`

The protocol reported on a listener (open: tolerates unknown values).

***

<a id="sailboxsize" />

### SailboxSize

> **SailboxSize** = `"s"` | `"m"`

Named resource size; each sets the vCPU count plus default memory/disk.

***

<a id="sailboxstatus-1" />

### SailboxStatus

> **SailboxStatus** = `"running"` | `"paused"` | `"sleeping"` | `"failed"` | `"terminated"` | `string` & `object`

Lifecycle status of a sailbox. Open: tolerates values added server-side.

***

<a id="sailboxstatusfilter" />

### SailboxStatusFilter

> **SailboxStatusFilter** = `"running"` | `"paused"` | `"sleeping"` | `"failed"` | `"terminated"`

The closed set of statuses accepted as a list filter.

## Functions

<a id="defaultclient" />

### defaultClient()

> **defaultClient**(): [`Client`](#client)

The process-wide client used by the object-model statics ([Sailbox](#sailbox),
[App](#app), [Volume](#volume)) when no explicit `client` is passed. Created
lazily from the environment on first use.

#### Returns

[`Client`](#client)

***

<a id="ingressauthheaders-2" />

### ingressAuthHeaders()

> **ingressAuthHeaders**(): `Record`\<`string`, `string`>

Guest-side: headers that authenticate this sailbox as an ingress
allowlist source (only available inside a sailbox guest).

#### Returns

`Record`\<`string`, `string`>

***

<a id="resolveconfig" />

### resolveConfig()

> **resolveConfig**(): [`ResolvedConfig`](#resolvedconfig)

Resolve the SDK config from the environment (`SAIL_API_KEY`, `SAIL_API_URL`,
`SAILBOX_API_URL`, ...) and `~/.sail`, without requiring an API key. The core
is the single source of truth for endpoint resolution.

#### Returns

[`ResolvedConfig`](#resolvedconfig)

***

<a id="setdefaultclient" />

### 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

| Parameter | Type                               |
| --------- | ---------------------------------- |
| `client`  | [`Client`](#client) \| `undefined` |

#### Returns

`void`
