@aerol-ai/aerolvm-sdk 0.2.1 → 0.2.3

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.
package/dist/index.d.ts CHANGED
@@ -2,4 +2,4 @@ export { MicroVM } from "./MicroVM.js";
2
2
  export { Sandbox } from "./Sandbox.js";
3
3
  export { Image } from "./Image.js";
4
4
  export type { MicroVMConfig } from "./MicroVM.js";
5
- export type { BinaryLike, BuildImageOptions, BuildImagePushOptions, BuildImageResult, CreateOptions, CreateSessionOptions, ExecRequest, ExecResult, ExecExitInfo, ExposedPort, ExposePortOptions, ExposeProtocol, ExposeResult, HealthStatus, Lifecycle, MountSpec, MountSpecRedacted, MountType, RegisterSnapshotOptions, RegistryAuth, ResizeOptions, Sandbox as SandboxData, SandboxSnapshot, SandboxStatus, Session, SessionAttachHandle, SessionAttachOptions, SessionStatus, UpdateLifecycleOptions, } from "./types.js";
5
+ export type { BinaryLike, BuildImageOptions, BuildImagePushOptions, BuildImageResult, CreateOptions, CreateSessionOptions, ExecRequest, ExecResult, ExecExitInfo, ExposedPort, ExposePortOptions, ExposeProtocol, ExposeResult, Failover, FailoverPolicy, HealthStatus, Lifecycle, MountSpec, MountSpecRedacted, MountType, RegisterSnapshotOptions, RegistryAuth, ResizeOptions, Sandbox as SandboxData, SandboxSnapshot, SandboxStatus, Session, SessionAttachHandle, SessionAttachOptions, SessionStatus, UpdateLifecycleOptions, } from "./types.js";
@@ -1,5 +1,5 @@
1
1
  import { Image } from "../Image.js";
2
- import type { BinaryLike, BuildImageOptions, BuildImageResult, CreateOptions, CreateSessionOptions, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, HealthStatus, Lifecycle, ListOptions, MountSpecRedacted, NetworkUsage, RegisterSnapshotOptions, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions } from "../types.js";
2
+ import type { BinaryLike, BuildImageOptions, BuildImageResult, CreateOptions, CreateSessionOptions, ExecRequest, ExecResult, ExecStreamHandle, ExecStreamOptions, ExposedPort, ExposePortOptions, ExposeResult, Failover, HealthStatus, Lifecycle, ListOptions, MountSpecRedacted, NetworkUsage, RegisterSnapshotOptions, SetNetworkLimitsOptions, ResizeOptions, Sandbox, SandboxSnapshot, Session, SessionAttachHandle, SessionAttachOptions } from "../types.js";
3
3
  type FetchLike = typeof fetch;
4
4
  /**
5
5
  * Wire version of the v1-style sandbox endpoints (`/v1/sandboxes`, etc.) this
@@ -126,6 +126,7 @@ export declare class SandboxResource implements Sandbox {
126
126
  lastError?: string;
127
127
  containerCommand?: string[];
128
128
  lifecycle: Lifecycle;
129
+ failover?: Failover;
129
130
  runtime: Sandbox["runtime"];
130
131
  protected readonly client: APIClient;
131
132
  constructor(client: APIClient, sandbox: Sandbox);
@@ -388,6 +388,7 @@ function toApiCreateOptions(options) {
388
388
  container_command: options.containerCommand,
389
389
  mounts: options.mounts?.map(toApiMountSpec),
390
390
  lifecycle: options.lifecycle ? toApiLifecycle(options.lifecycle) : undefined,
391
+ failover: options.failover ? toApiFailover(options.failover) : undefined,
391
392
  runtime: options.runtime,
392
393
  };
393
394
  }
@@ -438,6 +439,12 @@ function toApiLifecycle(lifecycle) {
438
439
  destroy_if_idle_for: lifecycle.destroyIfIdleFor,
439
440
  stop_at_age: lifecycle.stopAtAge,
440
441
  destroy_at_age: lifecycle.destroyAtAge,
442
+ serverless: lifecycle.serverless,
443
+ };
444
+ }
445
+ function toApiFailover(failover) {
446
+ return {
447
+ policy: failover.policy,
441
448
  };
442
449
  }
443
450
  function fromApiSandbox(sandbox) {
@@ -463,6 +470,7 @@ function fromApiSandbox(sandbox) {
463
470
  lastError: sandbox.last_error,
464
471
  containerCommand: sandbox.container_command,
465
472
  lifecycle: fromApiLifecycle(sandbox.lifecycle),
473
+ failover: fromApiFailover(sandbox.failover),
466
474
  runtime: normalizeRuntime(sandbox.runtime),
467
475
  };
468
476
  }
@@ -607,8 +615,18 @@ function fromApiLifecycle(lifecycle) {
607
615
  if (lifecycle?.destroy_at_age !== undefined) {
608
616
  result.destroyAtAge = lifecycle.destroy_at_age;
609
617
  }
618
+ if (lifecycle?.serverless) {
619
+ result.serverless = true;
620
+ }
610
621
  return result;
611
622
  }
623
+ function fromApiFailover(failover) {
624
+ const policy = failover?.policy;
625
+ if (policy !== "recreate" && policy !== "none") {
626
+ return undefined;
627
+ }
628
+ return { policy };
629
+ }
612
630
  // buildTagQuery renders ListOptions.tags as the server's wire format. The
613
631
  // `tag.` prefix is literal — the server's parseTagFilter does a prefix check
614
632
  // on the *decoded* query key, so only the user-supplied key and value get
@@ -631,6 +649,7 @@ function cloneSandbox(sandbox) {
631
649
  exposedPorts: sandbox.exposedPorts?.map((port) => ({ ...port })),
632
650
  containerCommand: sandbox.containerCommand ? [...sandbox.containerCommand] : undefined,
633
651
  lifecycle: { ...sandbox.lifecycle },
652
+ failover: sandbox.failover ? { ...sandbox.failover } : undefined,
634
653
  };
635
654
  }
636
655
  function toBlob(data) {
package/dist/types.d.ts CHANGED
@@ -73,8 +73,23 @@ export interface Lifecycle {
73
73
  stopAtAge?: number;
74
74
  /** Duration in integer nanoseconds. */
75
75
  destroyAtAge?: number;
76
+ /**
77
+ * Opt the sandbox into HTTP wake-on-request: auto-stop when idle,
78
+ * resume on the next inbound HTTP request. Requires `stopIfIdleFor`
79
+ * to be set explicitly — the server rejects `serverless: true`
80
+ * without an idle window. TCP and TLS exposures stay always-on.
81
+ */
82
+ serverless?: boolean;
76
83
  }
77
84
  export type UpdateLifecycleOptions = Lifecycle;
85
+ export type FailoverPolicy = "none" | "recreate";
86
+ export interface Failover {
87
+ /**
88
+ * "none" (default) returns 410 Gone after owner-node death. "recreate"
89
+ * opts into best-effort cluster recreation from the replicated create spec.
90
+ */
91
+ policy: FailoverPolicy;
92
+ }
78
93
  export type GPUVendor = "nvidia" | "amd" | "apple";
79
94
  export interface GPUOptions {
80
95
  /**
@@ -138,6 +153,7 @@ export interface CreateOptions {
138
153
  containerCommand?: string[];
139
154
  mounts?: MountSpec[];
140
155
  lifecycle?: Lifecycle;
156
+ failover?: Failover;
141
157
  /**
142
158
  * Container runtime to use for this sandbox. Omit to inherit the host
143
159
  * default (`SB_CONTAINER_RUNTIME`). Use `"gvisor"` for runsc-backed
@@ -268,6 +284,7 @@ export interface Sandbox {
268
284
  lastError?: string;
269
285
  containerCommand?: string[];
270
286
  lifecycle: Lifecycle;
287
+ failover?: Failover;
271
288
  /**
272
289
  * Container runtime this sandbox is running under. Empty string indicates
273
290
  * a pre-migration row that resolves to the host default at start time.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aerol-ai/aerolvm-sdk",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -21,8 +21,8 @@
21
21
  "test": "tsc -p tsconfig.test.json --outDir dist-test && node --test dist-test/*.test.js dist-test/internal/*.test.js"
22
22
  },
23
23
  "devDependencies": {
24
- "@types/node": "^25.6.2",
24
+ "@types/node": "^25.8.0",
25
25
  "typescript": "^6.0.3",
26
- "tsx": "^4.21.0"
26
+ "tsx": "^4.22.3"
27
27
  }
28
28
  }