@sailresearch/sdk 0.2.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +126 -0
  3. package/dist/app.d.ts +23 -0
  4. package/dist/app.d.ts.map +1 -0
  5. package/dist/app.js +40 -0
  6. package/dist/app.js.map +1 -0
  7. package/dist/client.d.ts +119 -0
  8. package/dist/client.d.ts.map +1 -0
  9. package/dist/client.js +291 -0
  10. package/dist/client.js.map +1 -0
  11. package/dist/config.d.ts +8 -0
  12. package/dist/config.d.ts.map +1 -0
  13. package/dist/config.js +15 -0
  14. package/dist/config.js.map +1 -0
  15. package/dist/default-client.d.ts +13 -0
  16. package/dist/default-client.d.ts.map +1 -0
  17. package/dist/default-client.js +22 -0
  18. package/dist/default-client.js.map +1 -0
  19. package/dist/errors.d.ts +88 -0
  20. package/dist/errors.d.ts.map +1 -0
  21. package/dist/errors.js +201 -0
  22. package/dist/errors.js.map +1 -0
  23. package/dist/exec-process.d.ts +56 -0
  24. package/dist/exec-process.d.ts.map +1 -0
  25. package/dist/exec-process.js +105 -0
  26. package/dist/exec-process.js.map +1 -0
  27. package/dist/exec-stream.d.ts +21 -0
  28. package/dist/exec-stream.d.ts.map +1 -0
  29. package/dist/exec-stream.js +47 -0
  30. package/dist/exec-stream.js.map +1 -0
  31. package/dist/file-stream.d.ts +41 -0
  32. package/dist/file-stream.d.ts.map +1 -0
  33. package/dist/file-stream.js +86 -0
  34. package/dist/file-stream.js.map +1 -0
  35. package/dist/image.d.ts +90 -0
  36. package/dist/image.d.ts.map +1 -0
  37. package/dist/image.js +193 -0
  38. package/dist/image.js.map +1 -0
  39. package/dist/index.d.ts +31 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +55 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/native.d.ts +10 -0
  44. package/dist/native.d.ts.map +1 -0
  45. package/dist/native.js +24 -0
  46. package/dist/native.js.map +1 -0
  47. package/dist/sailbox.d.ts +210 -0
  48. package/dist/sailbox.d.ts.map +1 -0
  49. package/dist/sailbox.js +339 -0
  50. package/dist/sailbox.js.map +1 -0
  51. package/dist/ssh.d.ts +16 -0
  52. package/dist/ssh.d.ts.map +1 -0
  53. package/dist/ssh.js +3 -0
  54. package/dist/ssh.js.map +1 -0
  55. package/dist/types/config.d.ts +21 -0
  56. package/dist/types/config.d.ts.map +1 -0
  57. package/dist/types/config.js +4 -0
  58. package/dist/types/config.js.map +1 -0
  59. package/dist/types/exec.d.ts +41 -0
  60. package/dist/types/exec.d.ts.map +1 -0
  61. package/dist/types/exec.js +4 -0
  62. package/dist/types/exec.js.map +1 -0
  63. package/dist/types/image.d.ts +50 -0
  64. package/dist/types/image.d.ts.map +1 -0
  65. package/dist/types/image.js +12 -0
  66. package/dist/types/image.js.map +1 -0
  67. package/dist/types/listener.d.ts +38 -0
  68. package/dist/types/listener.d.ts.map +1 -0
  69. package/dist/types/listener.js +21 -0
  70. package/dist/types/listener.js.map +1 -0
  71. package/dist/types/sailbox.d.ts +62 -0
  72. package/dist/types/sailbox.d.ts.map +1 -0
  73. package/dist/types/sailbox.js +19 -0
  74. package/dist/types/sailbox.js.map +1 -0
  75. package/dist/util.d.ts +3 -0
  76. package/dist/util.d.ts.map +1 -0
  77. package/dist/util.js +10 -0
  78. package/dist/util.js.map +1 -0
  79. package/dist/validate.d.ts +35 -0
  80. package/dist/validate.d.ts.map +1 -0
  81. package/dist/validate.js +87 -0
  82. package/dist/validate.js.map +1 -0
  83. package/dist/volume.d.ts +42 -0
  84. package/dist/volume.d.ts.map +1 -0
  85. package/dist/volume.js +72 -0
  86. package/dist/volume.js.map +1 -0
  87. package/native/index.d.ts +733 -0
  88. package/native/index.js +601 -0
  89. package/package.json +77 -0
@@ -0,0 +1,733 @@
1
+ /* auto-generated by NAPI-RS */
2
+ /* eslint-disable */
3
+ /**
4
+ * A pull-based reader over an exec stream. `next` returns the next decoded
5
+ * chunk, or `null` at end of stream.
6
+ */
7
+ export declare class AsyncStreamReaderHandle {
8
+ /** The next decoded chunk, or `null` at EOF. */
9
+ next(): Promise<string | null>
10
+ }
11
+
12
+ /**
13
+ * One native client per config snapshot: env vars are read at construction, so
14
+ * callers reconstruct it to pick up env changes.
15
+ */
16
+ export declare class CoreClient {
17
+ /** Build a client from the environment (`SAIL_API_KEY`, `SAIL_MODE`, ...). */
18
+ static fromEnv(): CoreClient
19
+ /** Build a client from an explicit configuration (`apiKey` required). */
20
+ static fromConfig(config: ClientConfig): CoreClient
21
+ /**
22
+ * Create a sailbox. `timeoutSecs <= 0` means no client-side create
23
+ * timeout.
24
+ */
25
+ createSailbox(req: CreateSailboxRequest, timeoutSecs: number): Promise<SailboxHandle>
26
+ /** Fetch one sailbox by id. */
27
+ getSailbox(sailboxId: string): Promise<SailboxInfo>
28
+ /** List one page of sailboxes. */
29
+ listSailboxes(query: ListSailboxesQuery): Promise<SailboxInfoPage>
30
+ /** Terminate a sailbox (idempotent). */
31
+ terminateSailbox(sailboxId: string): Promise<void>
32
+ /** Pause a sailbox in memory. */
33
+ pauseSailbox(sailboxId: string): Promise<void>
34
+ /** Sleep a sailbox to disk. */
35
+ sleepSailbox(sailboxId: string): Promise<void>
36
+ /** Resume a paused/sleeping sailbox. */
37
+ resumeSailbox(sailboxId: string): Promise<SailboxHandle>
38
+ /**
39
+ * Checkpoint a running sailbox. `name` sets the handle's display name;
40
+ * `ttlSeconds`, when given, must be positive and overrides the server's
41
+ * default retention window.
42
+ */
43
+ checkpointSailbox(sailboxId: string, name?: string | undefined | null, ttlSeconds?: number | undefined | null): Promise<SailboxCheckpoint>
44
+ /** Create a sailbox from a checkpoint. */
45
+ createFromCheckpoint(req: FromCheckpointRequest): Promise<SailboxHandle>
46
+ /** Upgrade the in-guest agent. */
47
+ upgradeSailbox(sailboxId: string): Promise<UpgradeResult>
48
+ /** Expose a guest port at runtime. */
49
+ exposeListener(sailboxId: string, guestPort: number, protocol: string, allowlist: Array<string>): Promise<Listener>
50
+ /** Remove a runtime ingress port. */
51
+ unexposeListener(sailboxId: string, guestPort: number): Promise<void>
52
+ /** List a sailbox's listeners without waking it. */
53
+ listListeners(sailboxId: string): Promise<Array<Listener>>
54
+ /** Fetch one listener by guest port without waking the box. */
55
+ getListener(sailboxId: string, guestPort: number): Promise<Listener>
56
+ /**
57
+ * Block until the listener on `guestPort` is reachable end to end (route
58
+ * ACTIVE and the endpoint accepting) and return it, or reject with a
59
+ * Timeout error after `timeoutSecs`. Polls every `pollIntervalSecs`.
60
+ */
61
+ waitForListener(sailboxId: string, guestPort: number, timeoutSecs: number, pollIntervalSecs: number): Promise<Listener>
62
+ /** Ingress-identity headers for this sailbox, as a name -> value map. */
63
+ ingressAuthHeaders(sailboxId: string): Promise<Record<string, string>>
64
+ /** Look up (optionally minting) an NFS volume by name. */
65
+ getVolume(name: string, mintIfMissing: boolean): Promise<VolumeInfo>
66
+ /** List NFS volumes. */
67
+ listVolumes(maxObjects?: number | undefined | null): Promise<Array<VolumeInfo>>
68
+ /**
69
+ * Delete a volume by id. Resolves `null` when `allowMissing` and it was
70
+ * already gone.
71
+ */
72
+ deleteVolume(volumeId: string, allowMissing: boolean): Promise<VolumeInfo | null>
73
+ /** Find an app by name, optionally minting it. */
74
+ findApp(name: string, mintIfMissing: boolean): Promise<AppInfo>
75
+ /** Every app the org owns, newest first. */
76
+ listApps(): Promise<Array<AppInfo>>
77
+ /** Run a command in a sailbox. Returns a live process handle. */
78
+ exec(sailboxId: string, argv: Array<string>, options: ExecStartOptions): Promise<ExecProcessHandle>
79
+ /**
80
+ * Interactive pty session bridged to the local terminal: raw keystrokes
81
+ * forward to the remote pty, output renders locally, resizes propagate.
82
+ * Resolves with the remote process's exit code when it ends. Requires an
83
+ * interactive terminal (stdin and stdout TTYs).
84
+ */
85
+ shell(sailboxId: string, command?: string | undefined | null, shell?: string | undefined | null, term?: string | undefined | null, cwd?: string | undefined | null, timeoutSeconds?: number | undefined | null): Promise<number>
86
+ /**
87
+ * Run a shell command in a sailbox via `/bin/sh -lc`, honoring the
88
+ * `cwd`/`background` conveniences. Returns a live process handle.
89
+ */
90
+ execShell(sailboxId: string, command: string, options: ExecStartOptions): Promise<ExecProcessHandle>
91
+ /** Open a streaming read of a guest file. Returns a reader handle. */
92
+ readStream(sailboxId: string, remotePath: string): Promise<FileReaderHandle>
93
+ /**
94
+ * Whether a spec is a bare builtin base the backend ships prebuilt (no
95
+ * build needed).
96
+ */
97
+ isBuiltinBaseSpec(spec: ImageSpec): boolean
98
+ /**
99
+ * Resolve an image definition into a content-addressed spec: walk local
100
+ * directories (gitignore-style `ignore`), hash every file, and upload
101
+ * content the server does not already have.
102
+ */
103
+ resolveImageDefinition(def: ImageDefinition): Promise<ImageSpec>
104
+ /**
105
+ * Resolve an image definition and build it to ready, returning the
106
+ * content-addressed spec to create sailboxes from. A bare builtin base
107
+ * skips the build. `timeoutSecs` bounds the whole pipeline (hashing,
108
+ * uploads, and the build).
109
+ */
110
+ buildImageDefinition(def: ImageDefinition, timeoutSecs: number): Promise<ImageSpec>
111
+ /**
112
+ * Build an already-resolved spec to ready (submit + poll). A deadline of
113
+ * `timeoutSecs` bounds the poll loop.
114
+ */
115
+ buildSpecToReady(spec: ImageSpec, timeoutSecs: number): Promise<ImageBuild>
116
+ /**
117
+ * Enable SSH on a sailbox: trust the org's SSH certificate authority,
118
+ * (re)start `sshd`, and expose guest port 22 as TCP once the CA-only
119
+ * daemon verifiably owns it. A non-empty `allowlist` restricts port 22 to
120
+ * those source CIDRs, replacing any existing restriction; empty leaves an
121
+ * existing restriction unchanged. With `wait` the call polls until the
122
+ * endpoint is reachable and returns it (a Timeout error if it is not
123
+ * within `timeoutSecs`); without `wait` it skips the probe and resolves
124
+ * `null`.
125
+ */
126
+ enableSsh(sailboxId: string, allowlist: Array<string>, wait: boolean, timeoutSecs: number): Promise<SshEndpoint | null>
127
+ /**
128
+ * Fetch (creating on first use) the org's SSH certificate authority public
129
+ * key. Called before `create({ ssh: true })` provisions a box so a CA
130
+ * outage fails before the VM exists.
131
+ */
132
+ orgSshCaPublicKey(): Promise<string>
133
+ /** Open a streaming write to a guest file. Returns a writer handle. */
134
+ writeStream(sailboxId: string, remotePath: string, createParents: boolean, mode?: number | undefined | null): Promise<FileWriterHandle>
135
+ }
136
+
137
+ /** A handle to a live server-side command. Dropping it detaches (does not kill). */
138
+ export declare class ExecProcessHandle {
139
+ /** The durable exec request id (identifies the exec for wait/cancel/reattach). */
140
+ get execRequestId(): string
141
+ /** The idempotency key used to launch (empty means one was minted). */
142
+ get idempotencyKey(): string
143
+ /** A reader over stdout; drives the live stream, yielding decoded chunks. */
144
+ stdoutReader(): AsyncStreamReaderHandle
145
+ /** A reader over stderr. */
146
+ stderrReader(): AsyncStreamReaderHandle
147
+ /** Await the authoritative result. */
148
+ wait(): Promise<ExecResult>
149
+ /** Wait up to `timeoutSecs` for the streams to end; returns whether they did. */
150
+ waitStreamEnded(timeoutSecs: number): Promise<boolean>
151
+ /** Cancel the command: `force` sends SIGKILL, else SIGINT. */
152
+ cancel(force: boolean, retryTimeoutSecs: number): Promise<void>
153
+ /** Resize the pty (best effort; no-op without a pty). */
154
+ resize(cols: number, rows: number): Promise<void>
155
+ /** Write to the command's stdin. */
156
+ writeStdin(data: Buffer): Promise<void>
157
+ /** Close the command's stdin (send EOF). */
158
+ closeStdin(): Promise<void>
159
+ /**
160
+ * The exit code if the exit frame has arrived on the stream, else `null`.
161
+ * Errors for a worker-lost exec (no real exit code).
162
+ */
163
+ poll(): number | null
164
+ /** Stop the output pump and detach (also runs on drop). */
165
+ close(): void
166
+ }
167
+
168
+ /**
169
+ * A pull-based reader over a downloading guest file. `next` returns the next
170
+ * chunk of bytes, or `null` at end of file.
171
+ */
172
+ export declare class FileReaderHandle {
173
+ /** The next chunk of bytes, or `null` at EOF (or after `close`). */
174
+ next(): Promise<Buffer | null>
175
+ /**
176
+ * Stop the download and release the underlying stream. Idempotent; safe to
177
+ * call when a consumer abandons the stream early.
178
+ */
179
+ close(): Promise<void>
180
+ }
181
+
182
+ /**
183
+ * A streaming writer to a guest file. Feed it with `write` and end with
184
+ * `finish` (which also creates an empty file if nothing was written).
185
+ */
186
+ export declare class FileWriterHandle {
187
+ /**
188
+ * Write bytes to the file (the core splits them into transport-sized
189
+ * chunks). Rejects if the upload was already finished.
190
+ */
191
+ write(data: Buffer): Promise<void>
192
+ /**
193
+ * Abort the write: cancel the RPC so the server does not commit it.
194
+ * Idempotent; a no-op after `finish`.
195
+ */
196
+ abort(): void
197
+ /** Finish the write, flushing and closing the file. Idempotent. */
198
+ finish(): Promise<void>
199
+ }
200
+
201
+ /** A tree of local files copied into the image. */
202
+ export interface AddLocalDir {
203
+ /** Absolute guest path of the directory root. */
204
+ remotePath?: string
205
+ /** The files to place under `remotePath`. */
206
+ files?: Array<AddLocalDirFile>
207
+ }
208
+
209
+ /** One file within an `addLocalDir` step. */
210
+ export interface AddLocalDirFile {
211
+ /** Path relative to the directory root. */
212
+ relativePath?: string
213
+ /** SHA-256 of the (already uploaded) file content. */
214
+ contentSha256?: string
215
+ /** Permission bits (low 9). */
216
+ mode?: number
217
+ }
218
+
219
+ /** One local file copied into the image, referenced by content hash. */
220
+ export interface AddLocalFile {
221
+ /** SHA-256 of the (already uploaded) file content. */
222
+ contentSha256?: string
223
+ /** Absolute guest path to place the file at. */
224
+ remotePath?: string
225
+ /** Permission bits (low 9); 0 means the builder default (0644). */
226
+ mode?: number
227
+ }
228
+
229
+ /** An app on the central API. */
230
+ export interface AppInfo {
231
+ /** Stable app id. */
232
+ id: string
233
+ /** App name. */
234
+ name: string
235
+ /** Creation time (RFC 3339). */
236
+ createdAt: string
237
+ }
238
+
239
+ /** Explicit client configuration (an alternative to environment resolution). */
240
+ export interface ClientConfig {
241
+ /** Bearer API key. Required. */
242
+ apiKey: string
243
+ /** Named environment selecting endpoint defaults (for example `prod`). */
244
+ mode?: string
245
+ /** Override the central public-API URL. */
246
+ apiUrl?: string
247
+ /** Override the sailbox-API URL. */
248
+ sailboxApiUrl?: string
249
+ /** Override the imagebuilder dispatcher URL. */
250
+ imagebuilderUrl?: string
251
+ /**
252
+ * Override the listener ingress base URL (what `SAILBOX_INGRESS_URL`
253
+ * sets from the environment), for custom or local sailbox stacks.
254
+ */
255
+ ingressUrl?: string
256
+ }
257
+
258
+ /** The create-sailbox request. */
259
+ export interface CreateSailboxRequest {
260
+ /** Identifier of the owning app. */
261
+ appId: string
262
+ /** The sailbox name. */
263
+ name: string
264
+ /** Image to boot; defaults to a plain Debian base when omitted. */
265
+ image?: ImageSpec
266
+ /** Guest ports to reserve for ingress. */
267
+ ingressPorts?: Array<IngressPortInput>
268
+ /** NFS volumes to mount. */
269
+ volumeMounts?: Array<VolumeMountInput>
270
+ /**
271
+ * Requested resource size (`"s"` or `"m"`); the platform default when
272
+ * omitted. A ceiling, not a reservation: billing follows observed usage.
273
+ */
274
+ size?: string
275
+ /**
276
+ * Memory limit in whole GiB within the size's range; the size's default
277
+ * when omitted.
278
+ */
279
+ memoryGib?: number
280
+ /**
281
+ * Disk size in whole GiB within the size's range; the size's default
282
+ * when omitted.
283
+ */
284
+ diskGib?: number
285
+ /** Idle minutes (1-1440) after which the platform may sleep the box. */
286
+ autosleepTimeoutMinutes?: number
287
+ /**
288
+ * Enable SSH on the new sailbox after create: trust the org SSH CA, start
289
+ * `sshd`, and expose guest port 22 as TCP once the CA-only daemon owns it
290
+ * (an explicit port-22 ingress entry contributes just its allowlist).
291
+ */
292
+ ssh?: boolean
293
+ }
294
+
295
+ /**
296
+ * The authoritative result of a finished exec.
297
+ *
298
+ * The buffered `stdout`/`stderr` are a capped, drop-oldest tail (the server
299
+ * keeps a bounded ring). To capture the complete output of a large-output
300
+ * command, stream it live and consult the `*Truncated`/`*Complete` flags.
301
+ */
302
+ export interface ExecResult {
303
+ /** Buffered stdout (a capped tail; see `stdoutTruncated`/`stdoutComplete`). */
304
+ stdout: string
305
+ /** Buffered stderr (a capped tail; see `stderrTruncated`/`stderrComplete`). */
306
+ stderr: string
307
+ /** The command's exit code. */
308
+ exitCode: number
309
+ /** Whether the command was killed for exceeding its timeout. */
310
+ timedOut: boolean
311
+ /** True if buffered `stdout` dropped its oldest bytes (ring overflow). */
312
+ stdoutTruncated: boolean
313
+ /** True if buffered `stderr` dropped its oldest bytes (ring overflow). */
314
+ stderrTruncated: boolean
315
+ /**
316
+ * True if the live stream delivered stdout through to exit: a consumer
317
+ * that streamed live already has the complete stdout even if `stdout` here
318
+ * is truncated.
319
+ */
320
+ stdoutComplete: boolean
321
+ /**
322
+ * True if the live stream delivered stderr through to exit (see
323
+ * `stdoutComplete`).
324
+ */
325
+ stderrComplete: boolean
326
+ }
327
+
328
+ /** Options for starting an exec. */
329
+ export interface ExecStartOptions {
330
+ /** Working directory to run the command in (shell commands only). */
331
+ cwd?: string
332
+ /**
333
+ * Detach the command so it keeps running and the call returns
334
+ * immediately; output is discarded (shell commands only, incompatible
335
+ * with `openStdin`/`pty`).
336
+ */
337
+ background?: boolean
338
+ /** Wall-clock limit in seconds before the server kills the command. */
339
+ timeoutSeconds?: number
340
+ /** Leave stdin open for `writeStdin`. */
341
+ openStdin?: boolean
342
+ /** Allocate a pseudo-terminal. */
343
+ pty?: boolean
344
+ /** TERM value for the pty. */
345
+ term?: string
346
+ /** Initial pty width in columns. */
347
+ cols?: number
348
+ /** Initial pty height in rows. */
349
+ rows?: number
350
+ /** Stable key so a reconnect reattaches to the same command. */
351
+ idempotencyKey?: string
352
+ /** Budget in seconds for retrying transient RPC failures. */
353
+ retryTimeoutSeconds?: number
354
+ }
355
+
356
+ /** The create-from-checkpoint request. */
357
+ export interface FromCheckpointRequest {
358
+ /** The checkpoint to restore from. */
359
+ checkpointId: string
360
+ /** Name for the new sailbox; defaults to the source box's name. */
361
+ name?: string
362
+ /**
363
+ * Restore timeout in whole seconds (positive); omitted uses the server
364
+ * default.
365
+ */
366
+ timeoutSeconds?: number
367
+ }
368
+
369
+ /** The state of a custom image build. */
370
+ export interface ImageBuild {
371
+ /** The content-addressed image id. */
372
+ imageId: string
373
+ /** Build status: `queued`, `building`, `ready`, `failed`, or `unspecified`. */
374
+ status: string
375
+ /** Human-readable failure detail; present when `status` is `failed`. */
376
+ errorMessage?: string
377
+ }
378
+
379
+ /** One build step. Exactly one of the fields must be set. */
380
+ export interface ImageBuildStep {
381
+ /** Install system packages with apt. */
382
+ aptInstall?: PackageInstall
383
+ /** Install Python packages with pip. */
384
+ pipInstall?: PackageInstall
385
+ /** Run a shell command. */
386
+ runCommand?: RunCommand
387
+ /** Copy one already-uploaded local file into the image. */
388
+ addLocalFile?: AddLocalFile
389
+ /** Copy a tree of already-uploaded local files into the image. */
390
+ addLocalDir?: AddLocalDir
391
+ }
392
+
393
+ /**
394
+ * A custom image definition: a base image plus ordered build steps, where
395
+ * local-file steps still reference paths on this machine.
396
+ */
397
+ export interface ImageDefinition {
398
+ /** Base image to build on: `debian` or `devbox`. */
399
+ base?: string
400
+ /**
401
+ * Target CPU architecture: `amd64` or `arm64`; unset lets the backend
402
+ * choose.
403
+ */
404
+ architecture?: string
405
+ /** Environment variables baked into the image. */
406
+ env?: Record<string, string>
407
+ /**
408
+ * Exact Python version to install as `python3`; unset uses the builder
409
+ * default.
410
+ */
411
+ pythonVersion?: string
412
+ /** Ordered build steps. */
413
+ steps?: Array<ImageDefinitionStep>
414
+ }
415
+
416
+ /** One image-definition step. Exactly one of the fields must be set. */
417
+ export interface ImageDefinitionStep {
418
+ /** Install system packages with apt. */
419
+ aptInstall?: Array<string>
420
+ /** Install Python packages with pip. */
421
+ pipInstall?: Array<string>
422
+ /** Run a shell command during the build. */
423
+ runCommand?: string
424
+ /** Bake one local file into the image. */
425
+ addLocalFile?: LocalFileInput
426
+ /** Bake a local directory tree into the image. */
427
+ addLocalDir?: LocalDirInput
428
+ }
429
+
430
+ /** A sailbox image: a base image plus ordered build steps. */
431
+ export interface ImageSpec {
432
+ /** Base image to build on: `debian` or `devbox`. */
433
+ base?: string
434
+ /** Ordered build steps applied on top of the base image. */
435
+ buildSteps?: Array<ImageBuildStep>
436
+ /** Environment variables baked into the image. */
437
+ env?: Record<string, string>
438
+ /**
439
+ * Target CPU architecture: `amd64` or `arm64`; unset lets the backend
440
+ * choose.
441
+ */
442
+ architecture?: string
443
+ /**
444
+ * Exact Python version to install as `python3`; unset uses the builder
445
+ * default.
446
+ */
447
+ pythonVersion?: string
448
+ }
449
+
450
+ /**
451
+ * Guest-side: headers that authenticate this sailbox as an ingress
452
+ * allowlist source (only available inside a sailbox guest).
453
+ */
454
+ export declare function ingressAuthHeaders(): Record<string, string>
455
+
456
+ /** A guest port to reserve for ingress at create time. */
457
+ export interface IngressPortInput {
458
+ /** The in-guest port to expose (1-65535). */
459
+ guestPort: number
460
+ /** `http` or `tcp`. */
461
+ protocol: string
462
+ /** Source addresses allowed to reach the port; empty allows all. */
463
+ allowlist?: Array<string>
464
+ }
465
+
466
+ /** An exposed guest port and how to reach it. */
467
+ export interface Listener {
468
+ /** The in-guest port traffic is forwarded to. */
469
+ guestPort: number
470
+ /** Wire protocol exposed (`tcp` or `http`). */
471
+ protocol: string
472
+ /** Status of the listener's ingress route. */
473
+ routeStatus: string
474
+ /** Publicly reachable URL, else "". */
475
+ publicUrl: string
476
+ /** Public hostname, else "". */
477
+ publicHost: string
478
+ /** Public port, else 0. */
479
+ publicPort: number
480
+ }
481
+
482
+ /** Filters for listing sailboxes. */
483
+ export interface ListSailboxesQuery {
484
+ /** Filter to one app by its id. */
485
+ appId?: string
486
+ /**
487
+ * Filter by lifecycle status (`running`, `paused`, `sleeping`, `failed`,
488
+ * or `terminated`).
489
+ */
490
+ status?: string
491
+ /** Substring filter on the sailbox name. */
492
+ search?: string
493
+ /** Only sailboxes at or below this guest schema version. */
494
+ maxGuestSchemaVersion?: number
495
+ /** Page size. */
496
+ limit?: number
497
+ /** Page offset. */
498
+ offset?: number
499
+ }
500
+
501
+ /**
502
+ * A local directory tree to bake into the image (walked, hashed, and
503
+ * uploaded at resolve; symlinks skipped, file modes preserved).
504
+ */
505
+ export interface LocalDirInput {
506
+ /** Path on this machine. */
507
+ localPath: string
508
+ /** Absolute POSIX path of the directory root inside the image. */
509
+ remotePath: string
510
+ /** Gitignore-style patterns to skip. */
511
+ ignore?: Array<string>
512
+ /** A gitignore-style file whose patterns to skip (e.g. `.gitignore`). */
513
+ ignoreFile?: string
514
+ }
515
+
516
+ /** One local file to bake into the image (hashed and uploaded at resolve). */
517
+ export interface LocalFileInput {
518
+ /** Path on this machine. */
519
+ localPath: string
520
+ /**
521
+ * Absolute POSIX path inside the image; a trailing `/` appends the
522
+ * source basename.
523
+ */
524
+ remotePath: string
525
+ /** Permission bits (low 9); omitted uses the builder default (0644). */
526
+ mode?: number
527
+ }
528
+
529
+ /** A set of packages to install (apt or pip). */
530
+ export interface PackageInstall {
531
+ /** Package names. */
532
+ packages?: Array<string>
533
+ }
534
+
535
+ /**
536
+ * Resolve the SDK config from the environment and `~/.sail` (without requiring
537
+ * an API key). The core is the single source of truth for endpoint and mode
538
+ * resolution.
539
+ */
540
+ export declare function resolvedConfig(): ResolvedConfig
541
+
542
+ /** The SDK configuration resolved from the environment and `~/.sail`. */
543
+ export interface ResolvedConfig {
544
+ /** The resolved API key; absent when none is configured. */
545
+ apiKey?: string
546
+ /** Central public-API URL. */
547
+ apiUrl: string
548
+ /** Sailbox-API URL. */
549
+ sailboxApiUrl: string
550
+ /** Imagebuilder dispatcher URL. */
551
+ imagebuilderUrl: string
552
+ /** Base host/URL public listeners are addressed under. */
553
+ ingressBase: string
554
+ /**
555
+ * How listener URLs are addressed under `ingressBase`: `path` or
556
+ * `subdomain`.
557
+ */
558
+ ingressScheme: string
559
+ }
560
+
561
+ /** A shell command to run during the build. */
562
+ export interface RunCommand {
563
+ /** The command, run via the builder's shell. */
564
+ command?: string
565
+ }
566
+
567
+ /** A durable checkpoint handle. */
568
+ export interface SailboxCheckpoint {
569
+ /** The checkpoint id. */
570
+ checkpointId: string
571
+ /** The sailbox the checkpoint was taken from. */
572
+ sailboxId: string
573
+ /** Checkpoint generation captured by this checkpoint. */
574
+ checkpointGeneration: number
575
+ /**
576
+ * When the handle expires and becomes eligible for garbage collection
577
+ * (RFC 3339); absent for a handle that carries no fresh retention bound
578
+ * (a paused or sleeping source).
579
+ */
580
+ expiresAt?: string
581
+ /** The source sailbox's status after checkpointing. */
582
+ status: string
583
+ }
584
+
585
+ /**
586
+ * Returned by create / resume / fromCheckpoint: identity plus the live
587
+ * endpoints of a running sailbox.
588
+ */
589
+ export interface SailboxHandle {
590
+ /** The sailbox id. */
591
+ sailboxId: string
592
+ /** The sailbox name. */
593
+ name: string
594
+ /** Lifecycle status (for example `running`). */
595
+ status: string
596
+ }
597
+
598
+ /** A read snapshot of a sailbox (get / list). Timestamps are RFC 3339 strings. */
599
+ export interface SailboxInfo {
600
+ /** The sailbox id. */
601
+ sailboxId: string
602
+ /** Identifier of the owning app. */
603
+ appId: string
604
+ /** Name of the owning app. */
605
+ appName: string
606
+ /** Identifier of the image the sailbox was created from. */
607
+ imageId: string
608
+ /** The sailbox name. */
609
+ name: string
610
+ /** Lifecycle status (for example `running`). */
611
+ status: string
612
+ /** Configured memory, in MiB. */
613
+ memoryMib: number
614
+ /** Configured number of vCPUs. */
615
+ vcpuCount: number
616
+ /** Configured state-disk size, in GiB. */
617
+ stateDiskSizeGib: number
618
+ /** Requested CPU, in vCPUs. */
619
+ cpuRequestedVcpu: number
620
+ /** Current CPU usage, in vCPUs. */
621
+ cpuUsedVcpu: number
622
+ /** Requested memory, in bytes. */
623
+ memoryRequestedBytes: number
624
+ /** Current memory usage, in bytes. */
625
+ memoryUsedBytes: number
626
+ /** Requested disk, in bytes. */
627
+ diskRequestedBytes: number
628
+ /** Current disk usage, in bytes. */
629
+ diskUsedBytes: number
630
+ /** CPU architecture (for example `arm64`). */
631
+ architecture: string
632
+ /**
633
+ * Guest schema version; absent for boxes created before it was recorded
634
+ * (treat as the oldest possible version).
635
+ */
636
+ guestSchemaVersion?: number
637
+ /** Human-readable error detail when the box is in an error state. */
638
+ errorMessage?: string
639
+ /** Monotonic checkpoint generation counter. */
640
+ checkpointGeneration: number
641
+ /** When the box last started, if it ever has (RFC 3339). */
642
+ startedAt?: string
643
+ /** When the most recent checkpoint was taken, if any (RFC 3339). */
644
+ lastCheckpointedAt?: string
645
+ /** When the sailbox was created (RFC 3339). */
646
+ createdAt: string
647
+ /** When the sailbox was last updated (RFC 3339). */
648
+ updatedAt: string
649
+ }
650
+
651
+ /** One page of list results plus the pagination envelope. */
652
+ export interface SailboxInfoPage {
653
+ /** The sailboxes on this page. */
654
+ items: Array<SailboxInfo>
655
+ /** The page size that was applied. */
656
+ limit: number
657
+ /** The offset that was applied. */
658
+ offset: number
659
+ /** Total matching sailboxes across all pages. */
660
+ total: number
661
+ /** Whether more results exist past this page. */
662
+ hasMore: boolean
663
+ }
664
+
665
+ /** The public TCP endpoint a sailbox's SSH listener is reachable at. */
666
+ export interface SshEndpoint {
667
+ /** Hostname to dial. */
668
+ host: string
669
+ /** Port to dial. */
670
+ port: number
671
+ }
672
+
673
+ /** The outcome of an in-guest agent upgrade. */
674
+ export interface UpgradeResult {
675
+ /**
676
+ * True when applied immediately (running box); false when deferred to the
677
+ * next wake.
678
+ */
679
+ applied: boolean
680
+ /** Lifecycle status of the sailbox after the upgrade call. */
681
+ status: string
682
+ }
683
+
684
+ /**
685
+ * Validate an autosleep timeout against the core's shared range (1..=1440
686
+ * minutes when set), so create fails fast before an image build.
687
+ */
688
+ export declare function validateAutosleepTimeout(minutes?: number | undefined | null): void
689
+
690
+ /**
691
+ * Validate ingress ports against the core's reserved/duplicate/protocol/
692
+ * allowlist rules, so a wrapper fails fast before an image build.
693
+ */
694
+ export declare function validateIngressPorts(ports: Array<IngressPortInput>): void
695
+
696
+ /**
697
+ * Validate optional memory/disk ceilings (whole GiB) against the size's
698
+ * range, so create fails fast before an image build.
699
+ */
700
+ export declare function validateSizeLimits(size?: string | undefined | null, memoryGib?: number | undefined | null, diskGib?: number | undefined | null): void
701
+
702
+ /** Validate volume mounts against the core's path/overlap rules. */
703
+ export declare function validateVolumeMounts(mounts: Array<VolumeMountInput>): void
704
+
705
+ /**
706
+ * Guest-side: load the volume metadata for a path mounted into this sailbox
707
+ * (only available inside a sailbox guest).
708
+ */
709
+ export declare function volumeFromMount(path: string): VolumeInfo
710
+
711
+ /** A managed NFS volume. Timestamps are RFC 3339 strings. */
712
+ export interface VolumeInfo {
713
+ /** The volume id. */
714
+ volumeId: string
715
+ /** The volume name. */
716
+ name: string
717
+ /** Storage backend serving the volume. */
718
+ backend: string
719
+ /** Lifecycle status. */
720
+ status: string
721
+ /** Creation time (RFC 3339), if reported. */
722
+ createdAt?: string
723
+ /** Last-update time (RFC 3339), if reported. */
724
+ updatedAt?: string
725
+ }
726
+
727
+ /** An NFS volume to mount at create time. */
728
+ export interface VolumeMountInput {
729
+ /** The volume id (from `getVolume`/`listVolumes`). */
730
+ volumeId: string
731
+ /** Absolute guest path to mount at. */
732
+ mountPath: string
733
+ }