tensorlake 0.5.2 → 0.5.4

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.
@@ -12,16 +12,25 @@ declare enum SnapshotStatus {
12
12
  FAILED = "failed"
13
13
  }
14
14
  /**
15
- * Content mode for snapshot creation.
15
+ * Snapshot type for sandbox snapshot creation.
16
16
  *
17
- * - `"full"`: Full VM snapshot (memory + filesystem state). Sandboxes
18
- * restored from this snapshot warm-restore VM memory.
19
- * - `"filesystem_only"`: Filesystem-only snapshot. Sandboxes restored from
17
+ * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
18
+ * from this snapshot warm-restore VM memory.
19
+ * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
20
20
  * this snapshot cold-boot from the snapshot tarball instead of warm-
21
21
  * restoring VM state. Use this for sandbox image builds so that the
22
22
  * restored sandbox bypasses Firecracker's overlay-path constraints.
23
23
  */
24
- type SnapshotContentMode = "full" | "filesystem_only";
24
+ type SnapshotType = "memory" | "filesystem";
25
+ /**
26
+ * Checkpoint type for {@link Sandbox.checkpoint}.
27
+ *
28
+ * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
29
+ * from this checkpoint warm-restore VM memory and running processes.
30
+ * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
31
+ * this checkpoint cold-boot from the snapshot tarball.
32
+ */
33
+ type CheckpointType = "memory" | "filesystem";
25
34
  declare enum ProcessStatus {
26
35
  RUNNING = "running",
27
36
  EXITED = "exited",
@@ -120,6 +129,7 @@ interface SnapshotInfo {
120
129
  sandboxId: string;
121
130
  baseImage: string;
122
131
  status: SnapshotStatus;
132
+ snapshotType?: SnapshotType;
123
133
  error?: string;
124
134
  snapshotUri?: string;
125
135
  sizeBytes?: number;
@@ -128,11 +138,11 @@ interface SnapshotInfo {
128
138
  }
129
139
  interface SnapshotOptions {
130
140
  /**
131
- * Optional content mode for the snapshot. When omitted the server picks
132
- * its default. Use `"filesystem_only"` for snapshots intended for sandbox
133
- * image builds so that restored sandboxes cold-boot.
141
+ * Optional snapshot type. When omitted the server picks its default. Use
142
+ * `"filesystem"` for snapshots intended for sandbox image builds so that
143
+ * restored sandboxes cold-boot.
134
144
  */
135
- contentMode?: SnapshotContentMode;
145
+ snapshotType?: SnapshotType;
136
146
  }
137
147
  interface SnapshotAndWaitOptions extends SnapshotOptions {
138
148
  timeout?: number;
@@ -292,7 +302,7 @@ interface SuspendResumeOptions {
292
302
  pollInterval?: number;
293
303
  }
294
304
  interface CheckpointOptions extends SuspendResumeOptions {
295
- contentMode?: SnapshotContentMode;
305
+ checkpointType?: CheckpointType;
296
306
  }
297
307
  interface ConnectOptions {
298
308
  sandboxId: string;
@@ -413,7 +423,7 @@ interface BuildClient {
413
423
  snapshotAndWait(sandboxId: string, options?: {
414
424
  timeout?: number;
415
425
  pollInterval?: number;
416
- contentMode?: SnapshotContentMode;
426
+ snapshotType?: SnapshotType;
417
427
  }): Promise<SnapshotInfo>;
418
428
  close(): void;
419
429
  }
@@ -433,4 +443,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
433
443
  declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
434
444
  declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
435
445
 
436
- export { loadDockerfilePlan as $, type DirectoryEntry as A, type DockerfileBuildPlan as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileInstruction as E, type ImageBuildOperation as F, ImageBuildOperationType as G, type HealthResponse as H, Image as I, type ImageOptions as J, OutputMode as K, type ListDirectoryResponse as L, type PoolContainerInfo as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, ProcessStatus as Q, type RunOptions as R, type SandboxOptions as S, type SandboxImageSource as T, type UpdateSandboxOptions as U, type SnapshotContentMode as V, SnapshotStatus as W, StdinMode as X, createSandboxImage as Y, dockerfileContent as Z, defaultRegisteredName as _, type CreateAndConnectOptions as a, loadImagePlan as a0, logicalDockerfileLines as a1, runCreateSandboxImageCli as a2, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type ContainerResourcesInfo as x, ContainerState as y, type CreateSandboxImageOptions as z };
446
+ export { defaultRegisteredName as $, type CreateSandboxImageOptions as A, type DirectoryEntry as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileBuildPlan as E, type DockerfileInstruction as F, type ImageBuildOperation as G, type HealthResponse as H, Image as I, ImageBuildOperationType as J, type ImageOptions as K, type ListDirectoryResponse as L, OutputMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, type PoolContainerInfo as Q, type RunOptions as R, type SandboxOptions as S, ProcessStatus as T, type UpdateSandboxOptions as U, type SandboxImageSource as V, SnapshotStatus as W, type SnapshotType as X, StdinMode as Y, createSandboxImage as Z, dockerfileContent as _, type CreateAndConnectOptions as a, loadDockerfilePlan as a0, loadImagePlan as a1, logicalDockerfileLines as a2, runCreateSandboxImageCli as a3, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type CheckpointType as x, type ContainerResourcesInfo as y, ContainerState as z };
@@ -12,16 +12,25 @@ declare enum SnapshotStatus {
12
12
  FAILED = "failed"
13
13
  }
14
14
  /**
15
- * Content mode for snapshot creation.
15
+ * Snapshot type for sandbox snapshot creation.
16
16
  *
17
- * - `"full"`: Full VM snapshot (memory + filesystem state). Sandboxes
18
- * restored from this snapshot warm-restore VM memory.
19
- * - `"filesystem_only"`: Filesystem-only snapshot. Sandboxes restored from
17
+ * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
18
+ * from this snapshot warm-restore VM memory.
19
+ * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
20
20
  * this snapshot cold-boot from the snapshot tarball instead of warm-
21
21
  * restoring VM state. Use this for sandbox image builds so that the
22
22
  * restored sandbox bypasses Firecracker's overlay-path constraints.
23
23
  */
24
- type SnapshotContentMode = "full" | "filesystem_only";
24
+ type SnapshotType = "memory" | "filesystem";
25
+ /**
26
+ * Checkpoint type for {@link Sandbox.checkpoint}.
27
+ *
28
+ * - `"memory"`: Capture VM memory + filesystem state. Sandboxes restored
29
+ * from this checkpoint warm-restore VM memory and running processes.
30
+ * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
31
+ * this checkpoint cold-boot from the snapshot tarball.
32
+ */
33
+ type CheckpointType = "memory" | "filesystem";
25
34
  declare enum ProcessStatus {
26
35
  RUNNING = "running",
27
36
  EXITED = "exited",
@@ -120,6 +129,7 @@ interface SnapshotInfo {
120
129
  sandboxId: string;
121
130
  baseImage: string;
122
131
  status: SnapshotStatus;
132
+ snapshotType?: SnapshotType;
123
133
  error?: string;
124
134
  snapshotUri?: string;
125
135
  sizeBytes?: number;
@@ -128,11 +138,11 @@ interface SnapshotInfo {
128
138
  }
129
139
  interface SnapshotOptions {
130
140
  /**
131
- * Optional content mode for the snapshot. When omitted the server picks
132
- * its default. Use `"filesystem_only"` for snapshots intended for sandbox
133
- * image builds so that restored sandboxes cold-boot.
141
+ * Optional snapshot type. When omitted the server picks its default. Use
142
+ * `"filesystem"` for snapshots intended for sandbox image builds so that
143
+ * restored sandboxes cold-boot.
134
144
  */
135
- contentMode?: SnapshotContentMode;
145
+ snapshotType?: SnapshotType;
136
146
  }
137
147
  interface SnapshotAndWaitOptions extends SnapshotOptions {
138
148
  timeout?: number;
@@ -292,7 +302,7 @@ interface SuspendResumeOptions {
292
302
  pollInterval?: number;
293
303
  }
294
304
  interface CheckpointOptions extends SuspendResumeOptions {
295
- contentMode?: SnapshotContentMode;
305
+ checkpointType?: CheckpointType;
296
306
  }
297
307
  interface ConnectOptions {
298
308
  sandboxId: string;
@@ -413,7 +423,7 @@ interface BuildClient {
413
423
  snapshotAndWait(sandboxId: string, options?: {
414
424
  timeout?: number;
415
425
  pollInterval?: number;
416
- contentMode?: SnapshotContentMode;
426
+ snapshotType?: SnapshotType;
417
427
  }): Promise<SnapshotInfo>;
418
428
  close(): void;
419
429
  }
@@ -433,4 +443,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
433
443
  declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
434
444
  declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
435
445
 
436
- export { loadDockerfilePlan as $, type DirectoryEntry as A, type DockerfileBuildPlan as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileInstruction as E, type ImageBuildOperation as F, ImageBuildOperationType as G, type HealthResponse as H, Image as I, type ImageOptions as J, OutputMode as K, type ListDirectoryResponse as L, type PoolContainerInfo as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, ProcessStatus as Q, type RunOptions as R, type SandboxOptions as S, type SandboxImageSource as T, type UpdateSandboxOptions as U, type SnapshotContentMode as V, SnapshotStatus as W, StdinMode as X, createSandboxImage as Y, dockerfileContent as Z, defaultRegisteredName as _, type CreateAndConnectOptions as a, loadImagePlan as a0, logicalDockerfileLines as a1, runCreateSandboxImageCli as a2, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type ContainerResourcesInfo as x, ContainerState as y, type CreateSandboxImageOptions as z };
446
+ export { defaultRegisteredName as $, type CreateSandboxImageOptions as A, type DirectoryEntry as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileBuildPlan as E, type DockerfileInstruction as F, type ImageBuildOperation as G, type HealthResponse as H, Image as I, ImageBuildOperationType as J, type ImageOptions as K, type ListDirectoryResponse as L, OutputMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, type PoolContainerInfo as Q, type RunOptions as R, type SandboxOptions as S, ProcessStatus as T, type UpdateSandboxOptions as U, type SandboxImageSource as V, SnapshotStatus as W, type SnapshotType as X, StdinMode as Y, createSandboxImage as Z, dockerfileContent as _, type CreateAndConnectOptions as a, loadDockerfilePlan as a0, loadImagePlan as a1, logicalDockerfileLines as a2, runCreateSandboxImageCli as a3, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type CheckpointType as x, type ContainerResourcesInfo as y, ContainerState as z };
@@ -3297,13 +3297,13 @@ var init_sandbox = __esm({
3297
3297
  async checkpoint(options) {
3298
3298
  const client = this.requireLifecycleClient("checkpoint");
3299
3299
  if (options?.wait === false) {
3300
- await client.snapshot(this.lifecycleIdentifier, { contentMode: options.contentMode });
3300
+ await client.snapshot(this.lifecycleIdentifier, { snapshotType: options.checkpointType });
3301
3301
  return void 0;
3302
3302
  }
3303
3303
  return client.snapshotAndWait(this.lifecycleIdentifier, {
3304
3304
  timeout: options?.timeout,
3305
3305
  pollInterval: options?.pollInterval,
3306
- contentMode: options?.contentMode
3306
+ snapshotType: options?.checkpointType
3307
3307
  });
3308
3308
  }
3309
3309
  /**
@@ -3962,11 +3962,11 @@ var init_client = __esm({
3962
3962
  * status — the snapshot is created asynchronously. Poll `getSnapshot()` until
3963
3963
  * `completed` or `failed`, or use `snapshotAndWait()` to block automatically.
3964
3964
  *
3965
- * @param options.contentMode - `"filesystem_only"` for cold-boot snapshots (e.g. image builds).
3966
- * Omit to use the server default (full VM snapshot).
3965
+ * @param options.snapshotType - `"filesystem"` for cold-boot snapshots (e.g. image builds).
3966
+ * Omit to use the server default (`filesystem`).
3967
3967
  */
3968
3968
  async snapshot(sandboxId, options) {
3969
- const requestOptions = options?.contentMode != null ? { body: { snapshot_content_mode: options.contentMode } } : void 0;
3969
+ const requestOptions = options?.snapshotType != null ? { body: { snapshot_type: options.snapshotType } } : void 0;
3970
3970
  const raw = await this.http.requestJson(
3971
3971
  "POST",
3972
3972
  this.path(`sandboxes/${sandboxId}/snapshot`),
@@ -4010,14 +4010,14 @@ var init_client = __esm({
4010
4010
  * @param sandboxId - ID of the running sandbox to snapshot.
4011
4011
  * @param options.timeout - Max seconds to wait (default 300).
4012
4012
  * @param options.pollInterval - Seconds between status polls (default 1).
4013
- * @param options.contentMode - Content mode passed through to `snapshot()`.
4013
+ * @param options.snapshotType - Snapshot type passed through to `snapshot()`.
4014
4014
  * @throws {SandboxError} If the snapshot fails or `timeout` elapses.
4015
4015
  */
4016
4016
  async snapshotAndWait(sandboxId, options) {
4017
4017
  const timeout = options?.timeout ?? 300;
4018
4018
  const pollInterval = options?.pollInterval ?? 1;
4019
4019
  const result = await this.snapshot(sandboxId, {
4020
- contentMode: options?.contentMode
4020
+ snapshotType: options?.snapshotType
4021
4021
  });
4022
4022
  const deadline = Date.now() + timeout * 1e3;
4023
4023
  while (Date.now() < deadline) {
@@ -4916,7 +4916,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
4916
4916
  await executeDockerfilePlan(sandbox, plan, emit, sleep3);
4917
4917
  emit({ type: "status", message: "Creating snapshot..." });
4918
4918
  const snapshot = await client.snapshotAndWait(sandbox.sandboxId, {
4919
- contentMode: "filesystem_only"
4919
+ snapshotType: "filesystem"
4920
4920
  });
4921
4921
  emit({
4922
4922
  type: "snapshot_created",
@@ -4977,25 +4977,25 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
4977
4977
  name: { type: "string", short: "n" },
4978
4978
  cpus: { type: "string" },
4979
4979
  memory: { type: "string" },
4980
- disk: { type: "string" },
4980
+ disk_mb: { type: "string" },
4981
4981
  public: { type: "boolean", default: false }
4982
4982
  }
4983
4983
  });
4984
4984
  const dockerfilePath = parsed.positionals[0];
4985
4985
  if (!dockerfilePath) {
4986
- throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk GB] [--public]");
4986
+ throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk_mb MB] [--public]");
4987
4987
  }
4988
4988
  const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
4989
4989
  const memoryMb = parsed.values.memory != null ? Number(parsed.values.memory) : void 0;
4990
- const diskGb = parsed.values.disk != null ? Number(parsed.values.disk) : void 0;
4990
+ const diskMb = parsed.values.disk_mb != null ? Number(parsed.values.disk_mb) : void 0;
4991
4991
  if (cpus != null && !Number.isFinite(cpus)) {
4992
4992
  throw new Error(`Invalid --cpus value: ${parsed.values.cpus}`);
4993
4993
  }
4994
4994
  if (memoryMb != null && !Number.isInteger(memoryMb)) {
4995
4995
  throw new Error(`Invalid --memory value: ${parsed.values.memory}`);
4996
4996
  }
4997
- if (diskGb != null && !Number.isInteger(diskGb)) {
4998
- throw new Error(`Invalid --disk value: ${parsed.values.disk}`);
4997
+ if (diskMb != null && !Number.isInteger(diskMb)) {
4998
+ throw new Error(`Invalid --disk_mb value: ${parsed.values.disk_mb}`);
4999
4999
  }
5000
5000
  await createSandboxImage(
5001
5001
  dockerfilePath,
@@ -5003,7 +5003,7 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
5003
5003
  registeredName: parsed.values.name,
5004
5004
  cpus,
5005
5005
  memoryMb,
5006
- diskMb: diskGb != null ? diskGb * 1024 : void 0,
5006
+ diskMb,
5007
5007
  isPublic: parsed.values.public
5008
5008
  },
5009
5009
  { emit: ndjsonStdoutEmit }