@tensorlakeai/tensorlake 0.5.145 → 0.5.148

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.cts CHANGED
@@ -189,7 +189,7 @@ declare enum SnapshotStatus {
189
189
  * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
190
190
  * this snapshot cold-boot from the snapshot tarball instead of warm-
191
191
  * restoring VM state. Use this for sandbox image builds so that the
192
- * restored sandbox bypasses Firecracker's overlay-path constraints.
192
+ * restored sandbox bypasses the overlay-path constraints of non-CAS sandboxes.
193
193
  */
194
194
  type SnapshotType = "memory" | "filesystem";
195
195
  /**
@@ -224,6 +224,8 @@ interface ContainerResourcesInfo {
224
224
  cpus: number;
225
225
  memoryMb: number;
226
226
  diskMb: number;
227
+ /** Reported GPU allocation. Include it in a pool update to retain the allocation. */
228
+ gpuConfigs?: GPUResources[];
227
229
  }
228
230
  /** GPU models supported by the sandbox scheduler. */
229
231
  type GpuModel = "A100-40GB" | "A100-80GB" | "H100" | "T4" | "A6000" | "RTX-PRO-6000" | "L40" | "A10";
@@ -310,7 +312,7 @@ interface CreateSandboxOptions {
310
312
  diskMb?: number;
311
313
  /** Number of GPUs to allocate. Defaults to A10 unless gpuModel is set. GPU sandboxes require a CAS image. */
312
314
  gpus?: number;
313
- /** GPU model to allocate. The string arm preserves compatibility with existing callers; values are validated at runtime. */
315
+ /** GPU model to allocate. Defaults to one GPU when gpus is omitted. The string arm preserves compatibility with existing callers; values are validated at runtime. */
314
316
  gpuModel?: GpuModel | (string & {});
315
317
  /** Typed GPU model and count request. Cannot be combined with gpus or gpuModel. */
316
318
  gpu?: GpuRequest;
@@ -595,6 +597,12 @@ interface CreatePoolOptions {
595
597
  memoryMb?: number;
596
598
  /** Root disk size in MiB. Omit to use the registered image's size. */
597
599
  diskMb?: number;
600
+ /** GPUs per container. Defaults to A10 unless gpuModel is set. GPU CAS pools require a CAS image. */
601
+ gpus?: number;
602
+ /** GPU model to allocate for each container. Defaults to one GPU when gpus is omitted. Validated at runtime. */
603
+ gpuModel?: GpuModel | (string & {});
604
+ /** Typed GPU allocation. Cannot be combined with gpus or gpuModel. */
605
+ gpu?: GpuRequest;
598
606
  timeoutSecs?: number;
599
607
  entrypoint?: string[];
600
608
  maxContainers?: number;
@@ -615,6 +623,12 @@ interface UpdatePoolOptions {
615
623
  memoryMb?: number;
616
624
  /** Root disk size in MiB. Omit to use the registered image's size. */
617
625
  diskMb?: number;
626
+ /** GPUs per container. Include on each update to keep a GPU CAS pool; omission configures a CPU-only CAS pool. Defaults to A10 unless gpuModel is set. */
627
+ gpus?: number;
628
+ /** GPU model to allocate for each container. Defaults to one GPU when gpus is omitted. Validated at runtime. */
629
+ gpuModel?: GpuModel | (string & {});
630
+ /** Typed GPU allocation. Cannot be combined with gpus or gpuModel. */
631
+ gpu?: GpuRequest;
618
632
  timeoutSecs?: number;
619
633
  entrypoint?: string[];
620
634
  maxContainers?: number;
@@ -753,10 +767,29 @@ interface RunOptions {
753
767
  timeout?: number;
754
768
  user?: ProcessUser;
755
769
  }
770
+ /** Why a command run with `Sandbox.run()` ended. */
771
+ declare enum CommandExitReason {
772
+ /** The process exited on its own; `exitCode` is its exit status. */
773
+ EXITED = "exited",
774
+ /** The process was killed by a signal; `exitCode` is `-signal`. */
775
+ SIGNALED = "signaled",
776
+ /** The kernel OOM killer terminated the process (`exitCode` is `-9`). */
777
+ OOM_KILLED = "oom_killed",
778
+ /** The run's `timeout` expired and the sandbox killed the process (`exitCode` is `-9`). */
779
+ TIMED_OUT = "timed_out"
780
+ }
756
781
  interface CommandResult {
757
782
  exitCode: number;
758
783
  stdout: string;
759
784
  stderr: string;
785
+ /**
786
+ * Why the command ended. `Sandbox.run()` always sets it; sandboxes that
787
+ * predate timeout reporting never report `TIMED_OUT`, so a timed-out run on
788
+ * them shows as `SIGNALED`.
789
+ */
790
+ reason?: CommandExitReason;
791
+ /** True when the run's `timeout` expired and the process was killed. */
792
+ timedOut?: boolean;
760
793
  }
761
794
  interface DirectoryEntry {
762
795
  name: string;
@@ -1182,6 +1215,9 @@ declare class Sandbox {
1182
1215
  *
1183
1216
  * Resource targets use create's cpus, memoryMb, and diskMb names. Resize
1184
1217
  * waits by default; wait=false returns admission. Timeout does not cancel it.
1218
+ * CPU-only CAS sandboxes support CPU, memory, and root-disk resize; GPU CAS sandboxes
1219
+ * support only root-disk growth and reject CPU and memory changes.
1220
+ * Non-CAS sandboxes do not support live resize.
1185
1221
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
1186
1222
  * A no-op returns current resources with absent or earlier resize metadata.
1187
1223
  *
@@ -1504,7 +1540,9 @@ declare class SandboxClient {
1504
1540
  /** List sandbox processes available as persisted-log filters. */
1505
1541
  listLogProcesses(sandboxId: string): Promise<Traced<SandboxProcessLogFiltersResponse>>;
1506
1542
  /**
1507
- * Update properties or resize a Running Cloud Hypervisor sandbox.
1543
+ * Update properties or resize a running sandbox. CPU-only CAS sandboxes support
1544
+ * CPU, memory, and root-disk resize; GPU CAS sandboxes support only root-disk
1545
+ * growth. Non-CAS sandboxes do not support live resize.
1508
1546
  * Resource names match create. Resize waits by default; wait=false returns
1509
1547
  * admission. Timeout leaves the resize running and reports its generation.
1510
1548
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
@@ -1605,9 +1643,9 @@ declare class SandboxClient {
1605
1643
  * network policy, set it to replace the policy, or pass `null` to remove the
1606
1644
  * policy entirely. On a change the service recycles the pool's unclaimed
1607
1645
  * warm containers onto the new policy, while containers already claimed by
1608
- * sandboxes keep the policy they booted with. CPU, memory, disk, image, and
1609
- * entrypoint changes likewise recycle unclaimed warm containers
1610
- * asynchronously. If suitable capacity is unavailable, stale warm
1646
+ * sandboxes keep the policy they booted with. CPU, memory, disk, GPU
1647
+ * allocation, image, and entrypoint changes likewise recycle unclaimed warm
1648
+ * containers asynchronously. If suitable capacity is unavailable, stale warm
1611
1649
  * containers are not used as a fallback.
1612
1650
  */
1613
1651
  updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
@@ -2428,4 +2466,4 @@ declare class RequestExecutionError extends Error {
2428
2466
  constructor(message: string, functionName?: string);
2429
2467
  }
2430
2468
 
2431
- export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint };
2469
+ export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint };
package/dist/index.d.ts CHANGED
@@ -189,7 +189,7 @@ declare enum SnapshotStatus {
189
189
  * - `"filesystem"`: Capture filesystem state only. Sandboxes restored from
190
190
  * this snapshot cold-boot from the snapshot tarball instead of warm-
191
191
  * restoring VM state. Use this for sandbox image builds so that the
192
- * restored sandbox bypasses Firecracker's overlay-path constraints.
192
+ * restored sandbox bypasses the overlay-path constraints of non-CAS sandboxes.
193
193
  */
194
194
  type SnapshotType = "memory" | "filesystem";
195
195
  /**
@@ -224,6 +224,8 @@ interface ContainerResourcesInfo {
224
224
  cpus: number;
225
225
  memoryMb: number;
226
226
  diskMb: number;
227
+ /** Reported GPU allocation. Include it in a pool update to retain the allocation. */
228
+ gpuConfigs?: GPUResources[];
227
229
  }
228
230
  /** GPU models supported by the sandbox scheduler. */
229
231
  type GpuModel = "A100-40GB" | "A100-80GB" | "H100" | "T4" | "A6000" | "RTX-PRO-6000" | "L40" | "A10";
@@ -310,7 +312,7 @@ interface CreateSandboxOptions {
310
312
  diskMb?: number;
311
313
  /** Number of GPUs to allocate. Defaults to A10 unless gpuModel is set. GPU sandboxes require a CAS image. */
312
314
  gpus?: number;
313
- /** GPU model to allocate. The string arm preserves compatibility with existing callers; values are validated at runtime. */
315
+ /** GPU model to allocate. Defaults to one GPU when gpus is omitted. The string arm preserves compatibility with existing callers; values are validated at runtime. */
314
316
  gpuModel?: GpuModel | (string & {});
315
317
  /** Typed GPU model and count request. Cannot be combined with gpus or gpuModel. */
316
318
  gpu?: GpuRequest;
@@ -595,6 +597,12 @@ interface CreatePoolOptions {
595
597
  memoryMb?: number;
596
598
  /** Root disk size in MiB. Omit to use the registered image's size. */
597
599
  diskMb?: number;
600
+ /** GPUs per container. Defaults to A10 unless gpuModel is set. GPU CAS pools require a CAS image. */
601
+ gpus?: number;
602
+ /** GPU model to allocate for each container. Defaults to one GPU when gpus is omitted. Validated at runtime. */
603
+ gpuModel?: GpuModel | (string & {});
604
+ /** Typed GPU allocation. Cannot be combined with gpus or gpuModel. */
605
+ gpu?: GpuRequest;
598
606
  timeoutSecs?: number;
599
607
  entrypoint?: string[];
600
608
  maxContainers?: number;
@@ -615,6 +623,12 @@ interface UpdatePoolOptions {
615
623
  memoryMb?: number;
616
624
  /** Root disk size in MiB. Omit to use the registered image's size. */
617
625
  diskMb?: number;
626
+ /** GPUs per container. Include on each update to keep a GPU CAS pool; omission configures a CPU-only CAS pool. Defaults to A10 unless gpuModel is set. */
627
+ gpus?: number;
628
+ /** GPU model to allocate for each container. Defaults to one GPU when gpus is omitted. Validated at runtime. */
629
+ gpuModel?: GpuModel | (string & {});
630
+ /** Typed GPU allocation. Cannot be combined with gpus or gpuModel. */
631
+ gpu?: GpuRequest;
618
632
  timeoutSecs?: number;
619
633
  entrypoint?: string[];
620
634
  maxContainers?: number;
@@ -753,10 +767,29 @@ interface RunOptions {
753
767
  timeout?: number;
754
768
  user?: ProcessUser;
755
769
  }
770
+ /** Why a command run with `Sandbox.run()` ended. */
771
+ declare enum CommandExitReason {
772
+ /** The process exited on its own; `exitCode` is its exit status. */
773
+ EXITED = "exited",
774
+ /** The process was killed by a signal; `exitCode` is `-signal`. */
775
+ SIGNALED = "signaled",
776
+ /** The kernel OOM killer terminated the process (`exitCode` is `-9`). */
777
+ OOM_KILLED = "oom_killed",
778
+ /** The run's `timeout` expired and the sandbox killed the process (`exitCode` is `-9`). */
779
+ TIMED_OUT = "timed_out"
780
+ }
756
781
  interface CommandResult {
757
782
  exitCode: number;
758
783
  stdout: string;
759
784
  stderr: string;
785
+ /**
786
+ * Why the command ended. `Sandbox.run()` always sets it; sandboxes that
787
+ * predate timeout reporting never report `TIMED_OUT`, so a timed-out run on
788
+ * them shows as `SIGNALED`.
789
+ */
790
+ reason?: CommandExitReason;
791
+ /** True when the run's `timeout` expired and the process was killed. */
792
+ timedOut?: boolean;
760
793
  }
761
794
  interface DirectoryEntry {
762
795
  name: string;
@@ -1182,6 +1215,9 @@ declare class Sandbox {
1182
1215
  *
1183
1216
  * Resource targets use create's cpus, memoryMb, and diskMb names. Resize
1184
1217
  * waits by default; wait=false returns admission. Timeout does not cancel it.
1218
+ * CPU-only CAS sandboxes support CPU, memory, and root-disk resize; GPU CAS sandboxes
1219
+ * support only root-disk growth and reject CPU and memory changes.
1220
+ * Non-CAS sandboxes do not support live resize.
1185
1221
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
1186
1222
  * A no-op returns current resources with absent or earlier resize metadata.
1187
1223
  *
@@ -1504,7 +1540,9 @@ declare class SandboxClient {
1504
1540
  /** List sandbox processes available as persisted-log filters. */
1505
1541
  listLogProcesses(sandboxId: string): Promise<Traced<SandboxProcessLogFiltersResponse>>;
1506
1542
  /**
1507
- * Update properties or resize a Running Cloud Hypervisor sandbox.
1543
+ * Update properties or resize a running sandbox. CPU-only CAS sandboxes support
1544
+ * CPU, memory, and root-disk resize; GPU CAS sandboxes support only root-disk
1545
+ * growth. Non-CAS sandboxes do not support live resize.
1508
1546
  * Resource names match create. Resize waits by default; wait=false returns
1509
1547
  * admission. Timeout leaves the resize running and reports its generation.
1510
1548
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
@@ -1605,9 +1643,9 @@ declare class SandboxClient {
1605
1643
  * network policy, set it to replace the policy, or pass `null` to remove the
1606
1644
  * policy entirely. On a change the service recycles the pool's unclaimed
1607
1645
  * warm containers onto the new policy, while containers already claimed by
1608
- * sandboxes keep the policy they booted with. CPU, memory, disk, image, and
1609
- * entrypoint changes likewise recycle unclaimed warm containers
1610
- * asynchronously. If suitable capacity is unavailable, stale warm
1646
+ * sandboxes keep the policy they booted with. CPU, memory, disk, GPU
1647
+ * allocation, image, and entrypoint changes likewise recycle unclaimed warm
1648
+ * containers asynchronously. If suitable capacity is unavailable, stale warm
1611
1649
  * containers are not used as a fallback.
1612
1650
  */
1613
1651
  updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
@@ -2428,4 +2466,4 @@ declare class RequestExecutionError extends Error {
2428
2466
  constructor(message: string, functionName?: string);
2429
2467
  }
2430
2468
 
2431
- export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint };
2469
+ export { ApplicationBuildContext, ApplicationBuildResponse, ApplicationManifest, ApplicationSummary, type ArchivedSandboxInfo, type AttachFileSystemOptions, BinaryPayload, type Branch, BuildInfo, BuildLogEntry, type CheckpointOptions, type CheckpointType, type ClaimSandboxOptions, CliNotFoundError, CloudClient, CloudClientOptions, CommandExitReason, type CommandResult, type CommitJobError, type CommitJobReadBack, type CommitJobStatus, type ConflictPath, type ConflictTerm, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, CreateApplicationBuildRequest, type CreatePoolOptions, type CreatePtyOptions, type CreatePtySessionOptions, type CreateSandboxOptions, type CreateSandboxPoolResponse, type CreateSandboxResponse, type CreateSnapshotResponse, type CreateTunnelOptions, type DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, type DirectoryEntry, type FileEntry, FileNotFoundInFilesystemError, FileSystem, type FileSystemMount, Filesystem, FilesystemAPIError, FilesystemClient, type FilesystemClientOptions, FilesystemError, type FilesystemFileRead, type FilesystemInfo, FilesystemMount, FilesystemNotFoundError, type FilesystemReadOptions, type FilesystemSnapshot, type FilesystemSnapshotInfo, type FilesystemStatus, type FilesystemVersion, type GPUResources, type GetOrCreateOptions, type GetOrCreateOutcome, type GetSandboxLogsOptions, type GitCredential, type GitRef, type GitRepository, type GpuModel, type GpuRequest, type HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type ManagedProcessExit, type ManagedProcessHealthStatus, type ManagedProcessInfo, type ManagedProcessStatus, type MergeConflict, type MergeConflictRecord, type MergeEntry, type MergeOptions, type MergeReport, type MergeStats, MountError, type MountStatus, type MouseButton, type NetworkConfig, NewSecret, type Operation, type OperationRef, type OutputEvent, OutputMode, type OutputResponse, PendingSandbox, type PendingSandboxRecord, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessHealthCheck, type ProcessHealthCheckType, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, type PushReport, type PushWorktreeOptions, ReadOnlyMountNotSupportedError, type ReadyOptions, RemoteAPIError, RepositoryClient, type RepositoryClientOptions, type RepositoryHandle, type RepositoryInfo, RepositoryMount, type RepositoryMountOptions, type RepositoryMountStatus, type RepositoryUnmountOptions, RequestExecutionError, RequestFailedError, RequestInput, RequestMetadata, RequestNotFinishedError, RequestOutput, ResizeErrorReason, ResizeStatus, type ResourceResizeWaitOptions, type RestartPolicy, type RestartPolicyConfig, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, type SandboxLogLevel, type SandboxLogSignal, type SandboxLogsResponse, SandboxNotFoundError, type SandboxOptions, SandboxPending, SandboxPendingReason, type SandboxPoolInfo, type SandboxPortAccess, type SandboxProcessLogFilter, type SandboxProcessLogFiltersResponse, SandboxResizeError, type SandboxResourceResizeInfo, SandboxStatus, SandboxTemplate, Secret, SecretsList, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TERMINATION_REASON_CANCELLED, TERMINATION_REASON_NO_CAPACITY, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpdateSandboxOptions, UpsertSecretResponse, createFileSystem, deleteFileSystem, isSandboxPending, listFileSystems, sandboxUrlFromIngressEndpoint };
package/dist/index.js CHANGED
@@ -46,7 +46,7 @@ var init_defaults = __esm({
46
46
  "src/defaults.ts"() {
47
47
  "use strict";
48
48
  init_esm_shims();
49
- SDK_VERSION = "0.5.145";
49
+ SDK_VERSION = "0.5.148";
50
50
  API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
51
51
  API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
52
52
  NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
@@ -490,7 +490,7 @@ var init_native_worker_client = __esm({
490
490
  }
491
491
  };
492
492
  runtimeKey = /* @__PURE__ */ Symbol.for(
493
- `tensorlake.native.worker.${false ? "source" : "0.5.145"}.v1`
493
+ `tensorlake.native.worker.${false ? "source" : "0.5.148"}.v1`
494
494
  );
495
495
  runtimes = globalThis;
496
496
  }
@@ -556,7 +556,7 @@ function fromSnakeKeys(obj, idField) {
556
556
  }
557
557
  return obj;
558
558
  }
559
- var SandboxStatus, SandboxPendingReason, TERMINATION_REASON_NO_CAPACITY, TERMINATION_REASON_CANCELLED, SnapshotStatus, ProcessStatus, StdinMode, OutputMode, ContainerState, ResizeStatus, ResizeErrorReason, CAMEL_TO_SNAKE_RE;
559
+ var SandboxStatus, SandboxPendingReason, TERMINATION_REASON_NO_CAPACITY, TERMINATION_REASON_CANCELLED, SnapshotStatus, ProcessStatus, StdinMode, OutputMode, ContainerState, ResizeStatus, ResizeErrorReason, CommandExitReason, CAMEL_TO_SNAKE_RE;
560
560
  var init_models = __esm({
561
561
  "src/models.ts"() {
562
562
  "use strict";
@@ -628,6 +628,13 @@ var init_models = __esm({
628
628
  ResizeErrorReason2["INCOMPATIBLE_RESPONSE"] = "incompatible_response";
629
629
  return ResizeErrorReason2;
630
630
  })(ResizeErrorReason || {});
631
+ CommandExitReason = /* @__PURE__ */ ((CommandExitReason2) => {
632
+ CommandExitReason2["EXITED"] = "exited";
633
+ CommandExitReason2["SIGNALED"] = "signaled";
634
+ CommandExitReason2["OOM_KILLED"] = "oom_killed";
635
+ CommandExitReason2["TIMED_OUT"] = "timed_out";
636
+ return CommandExitReason2;
637
+ })(CommandExitReason || {});
631
638
  CAMEL_TO_SNAKE_RE = /[A-Z]/g;
632
639
  }
633
640
  });
@@ -753,6 +760,7 @@ function assembleCommandResult(events) {
753
760
  const stdoutLines = [];
754
761
  const stderrLines = [];
755
762
  let exitCode = -1;
763
+ let reason;
756
764
  for (const eventJson of events) {
757
765
  const raw = JSON.parse(eventJson);
758
766
  if (typeof raw.line === "string") {
@@ -766,12 +774,23 @@ function assembleCommandResult(events) {
766
774
  exitCode = raw.exit_code;
767
775
  } else if (typeof raw.signal === "number") {
768
776
  exitCode = -raw.signal;
777
+ } else {
778
+ continue;
769
779
  }
780
+ reason = exitReason(raw);
770
781
  }
771
782
  }
772
- return { exitCode, stdout: stdoutLines.join("\n"), stderr: stderrLines.join("\n") };
783
+ return { exitCode, stdout: stdoutLines.join("\n"), stderr: stderrLines.join("\n"), reason };
773
784
  }
774
- var cachedBinding;
785
+ function exitReason(raw) {
786
+ if (typeof raw.reason === "string" && KNOWN_EXIT_REASONS.has(raw.reason)) {
787
+ return raw.reason;
788
+ }
789
+ if (raw.oom_killed === true) return "oom_killed" /* OOM_KILLED */;
790
+ if (typeof raw.exit_code === "number") return "exited" /* EXITED */;
791
+ return "signaled" /* SIGNALED */;
792
+ }
793
+ var cachedBinding, KNOWN_EXIT_REASONS;
775
794
  var init_native_sandbox = __esm({
776
795
  "src/native-sandbox.ts"() {
777
796
  "use strict";
@@ -780,6 +799,7 @@ var init_native_sandbox = __esm({
780
799
  init_errors();
781
800
  init_native_worker_client();
782
801
  init_native_worker_protocol();
802
+ KNOWN_EXIT_REASONS = new Set(Object.values(CommandExitReason));
783
803
  }
784
804
  });
785
805
 
@@ -4006,6 +4026,9 @@ var init_sandbox = __esm({
4006
4026
  *
4007
4027
  * Resource targets use create's cpus, memoryMb, and diskMb names. Resize
4008
4028
  * waits by default; wait=false returns admission. Timeout does not cancel it.
4029
+ * CPU-only CAS sandboxes support CPU, memory, and root-disk resize; GPU CAS sandboxes
4030
+ * support only root-disk growth and reject CPU and memory changes.
4031
+ * Non-CAS sandboxes do not support live resize.
4009
4032
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
4010
4033
  * A no-op returns current resources with absent or earlier resize metadata.
4011
4034
  *
@@ -4233,15 +4256,17 @@ var init_sandbox = __esm({
4233
4256
  () => proxy.runProcess(JSON.stringify(body)),
4234
4257
  { sandboxId: this.sandboxId }
4235
4258
  );
4236
- const { exitCode, stdout, stderr } = assembleCommandResult(events);
4259
+ const { exitCode, stdout, stderr, reason } = assembleCommandResult(events);
4237
4260
  logSdkTiming("sandbox.run", "complete", opStart, {
4238
4261
  sandbox_id: this.sandboxId,
4239
4262
  server_trace_id: traceId,
4240
4263
  command: sdkTimingPayloadsEnabled() ? command : void 0,
4241
4264
  command_length: command.length,
4242
- exit_code: exitCode
4265
+ exit_code: exitCode,
4266
+ exit_reason: reason
4243
4267
  });
4244
- return Object.assign({ exitCode, stdout, stderr }, { traceId });
4268
+ const timedOut = reason === "timed_out" /* TIMED_OUT */;
4269
+ return Object.assign({ exitCode, stdout, stderr, reason, timedOut }, { traceId });
4245
4270
  }
4246
4271
  // --- Process management ---
4247
4272
  /**
@@ -4636,7 +4661,10 @@ function gpuRequest(gpu, gpus, gpuModel) {
4636
4661
  gpus = gpu.count;
4637
4662
  gpuModel = gpu.model;
4638
4663
  }
4639
- if (gpus == null) return void 0;
4664
+ if (gpus == null) {
4665
+ if (gpuModel == null) return void 0;
4666
+ gpus = 1;
4667
+ }
4640
4668
  if (!Number.isInteger(gpus) || gpus < 1) {
4641
4669
  throw new SandboxError("gpus must be a positive integer");
4642
4670
  }
@@ -5106,7 +5134,9 @@ var init_client = __esm({
5106
5134
  });
5107
5135
  }
5108
5136
  /**
5109
- * Update properties or resize a Running Cloud Hypervisor sandbox.
5137
+ * Update properties or resize a running sandbox. CPU-only CAS sandboxes support
5138
+ * CPU, memory, and root-disk resize; GPU CAS sandboxes support only root-disk
5139
+ * growth. Non-CAS sandboxes do not support live resize.
5110
5140
  * Resource names match create. Resize waits by default; wait=false returns
5111
5141
  * admission. Timeout leaves the resize running and reports its generation.
5112
5142
  * Wait, timeout, and pollInterval are ignored on non-resource updates.
@@ -5434,12 +5464,14 @@ var init_client = __esm({
5434
5464
  // --- Pools ---
5435
5465
  /** Create a new sandbox pool with warm pre-booted containers. */
5436
5466
  async createPool(options) {
5467
+ const gpus = gpuRequest(options.gpu, options.gpus, options.gpuModel);
5437
5468
  const body = {
5438
5469
  image: options.image,
5439
5470
  resources: {
5440
5471
  cpus: options.cpus ?? 1,
5441
5472
  memory_mb: options.memoryMb ?? 1024,
5442
- ...options.diskMb != null ? { disk_mb: options.diskMb } : {}
5473
+ ...options.diskMb != null ? { disk_mb: options.diskMb } : {},
5474
+ ...gpus != null ? { gpus } : {}
5443
5475
  },
5444
5476
  timeout_secs: options.timeoutSecs ?? 0
5445
5477
  };
@@ -5476,18 +5508,20 @@ var init_client = __esm({
5476
5508
  * network policy, set it to replace the policy, or pass `null` to remove the
5477
5509
  * policy entirely. On a change the service recycles the pool's unclaimed
5478
5510
  * warm containers onto the new policy, while containers already claimed by
5479
- * sandboxes keep the policy they booted with. CPU, memory, disk, image, and
5480
- * entrypoint changes likewise recycle unclaimed warm containers
5481
- * asynchronously. If suitable capacity is unavailable, stale warm
5511
+ * sandboxes keep the policy they booted with. CPU, memory, disk, GPU
5512
+ * allocation, image, and entrypoint changes likewise recycle unclaimed warm
5513
+ * containers asynchronously. If suitable capacity is unavailable, stale warm
5482
5514
  * containers are not used as a fallback.
5483
5515
  */
5484
5516
  async updatePool(poolId, options) {
5517
+ const gpus = gpuRequest(options.gpu, options.gpus, options.gpuModel);
5485
5518
  const body = {
5486
5519
  image: options.image,
5487
5520
  resources: {
5488
5521
  cpus: options.cpus ?? 1,
5489
5522
  memory_mb: options.memoryMb ?? 1024,
5490
- ...options.diskMb != null ? { disk_mb: options.diskMb } : {}
5523
+ ...options.diskMb != null ? { disk_mb: options.diskMb } : {},
5524
+ ...gpus != null ? { gpus } : {}
5491
5525
  },
5492
5526
  timeout_secs: options.timeoutSecs ?? 0
5493
5527
  };
@@ -10039,6 +10073,7 @@ export {
10039
10073
  APIClient,
10040
10074
  CliNotFoundError,
10041
10075
  CloudClient,
10076
+ CommandExitReason,
10042
10077
  ContainerState,
10043
10078
  Desktop,
10044
10079
  File,