tensorlake 0.5.31 → 0.5.33
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/bin/darwin-arm64/tensorlake +0 -0
- package/dist/bin/darwin-arm64/tl +0 -0
- package/dist/bin/linux-x64/tensorlake +0 -0
- package/dist/bin/linux-x64/tl +0 -0
- package/dist/bin/win32-x64/tensorlake.exe +0 -0
- package/dist/bin/win32-x64/tl.exe +0 -0
- package/dist/index.cjs +68 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +47 -8
- package/dist/index.d.ts +47 -8
- package/dist/index.js +68 -11
- package/dist/index.js.map +1 -1
- package/dist/native/darwin-arm64/tensorlake-node.node +0 -0
- package/dist/native/linux-x64/tensorlake-node.node +0 -0
- package/dist/native/win32-x64/tensorlake-node.node +0 -0
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -88,7 +88,6 @@ interface CreateSandboxOptions {
|
|
|
88
88
|
memoryMb?: number;
|
|
89
89
|
/** Root disk size in megabytes. When omitted, the server uses its default disk size. */
|
|
90
90
|
diskMb?: number;
|
|
91
|
-
secretNames?: string[];
|
|
92
91
|
timeoutSecs?: number;
|
|
93
92
|
entrypoint?: string[];
|
|
94
93
|
allowInternetAccess?: boolean;
|
|
@@ -109,12 +108,34 @@ interface UpdateSandboxOptions {
|
|
|
109
108
|
interface CreateSandboxResponse {
|
|
110
109
|
sandboxId: string;
|
|
111
110
|
status: SandboxStatus;
|
|
111
|
+
reason?: string;
|
|
112
112
|
routingHint?: string;
|
|
113
113
|
ingressEndpoint?: string;
|
|
114
114
|
name?: string | null;
|
|
115
115
|
terminationReason?: string;
|
|
116
116
|
errorDetails?: unknown;
|
|
117
117
|
}
|
|
118
|
+
interface CopySandboxOptions {
|
|
119
|
+
/** Number of running copies to create. Defaults to 1. */
|
|
120
|
+
times?: number;
|
|
121
|
+
/** Per-request timeout in seconds for the blocking live-copy request. */
|
|
122
|
+
requestTimeout?: number;
|
|
123
|
+
}
|
|
124
|
+
interface CopiedSandboxResponse {
|
|
125
|
+
sandboxId: string;
|
|
126
|
+
/** Raw server status. Partial copy responses can include statuses such as `"failed"`. */
|
|
127
|
+
status: string;
|
|
128
|
+
reason?: string;
|
|
129
|
+
routingHint?: string;
|
|
130
|
+
ingressEndpoint?: string;
|
|
131
|
+
name?: string | null;
|
|
132
|
+
terminationReason?: string;
|
|
133
|
+
errorDetails?: unknown;
|
|
134
|
+
}
|
|
135
|
+
interface CopySandboxResponse {
|
|
136
|
+
sourceSandboxId: string;
|
|
137
|
+
sandboxes: CopiedSandboxResponse[];
|
|
138
|
+
}
|
|
118
139
|
interface SandboxInfo {
|
|
119
140
|
sandboxId: string;
|
|
120
141
|
namespace: string;
|
|
@@ -122,7 +143,6 @@ interface SandboxInfo {
|
|
|
122
143
|
/** Resolved sandbox image name. */
|
|
123
144
|
image?: string;
|
|
124
145
|
resources: ContainerResourcesInfo;
|
|
125
|
-
secretNames: string[];
|
|
126
146
|
timeoutSecs?: number;
|
|
127
147
|
entrypoint?: string[];
|
|
128
148
|
network?: NetworkConfig;
|
|
@@ -200,7 +220,6 @@ interface CreatePoolOptions {
|
|
|
200
220
|
cpus?: number;
|
|
201
221
|
memoryMb?: number;
|
|
202
222
|
ephemeralDiskMb?: number;
|
|
203
|
-
secretNames?: string[];
|
|
204
223
|
timeoutSecs?: number;
|
|
205
224
|
entrypoint?: string[];
|
|
206
225
|
maxContainers?: number;
|
|
@@ -212,7 +231,6 @@ interface UpdatePoolOptions {
|
|
|
212
231
|
cpus?: number;
|
|
213
232
|
memoryMb?: number;
|
|
214
233
|
ephemeralDiskMb?: number;
|
|
215
|
-
secretNames?: string[];
|
|
216
234
|
timeoutSecs?: number;
|
|
217
235
|
entrypoint?: string[];
|
|
218
236
|
maxContainers?: number;
|
|
@@ -234,7 +252,6 @@ interface SandboxPoolInfo {
|
|
|
234
252
|
/** Sandbox image name backing the pool. */
|
|
235
253
|
image: string;
|
|
236
254
|
resources: ContainerResourcesInfo;
|
|
237
|
-
secretNames: string[];
|
|
238
255
|
timeoutSecs: number;
|
|
239
256
|
entrypoint?: string[];
|
|
240
257
|
maxContainers?: number;
|
|
@@ -599,6 +616,8 @@ declare class Sandbox {
|
|
|
599
616
|
* `{ wait: false }` for fire-and-return.
|
|
600
617
|
*/
|
|
601
618
|
resume(options?: SuspendResumeOptions): Promise<void>;
|
|
619
|
+
/** Live-copy this running sandbox. */
|
|
620
|
+
copy(options?: CopySandboxOptions): Promise<Traced<CopySandboxResponse>>;
|
|
602
621
|
/**
|
|
603
622
|
* Create a checkpoint of this sandbox and wait for it to be locally ready.
|
|
604
623
|
*
|
|
@@ -788,6 +807,14 @@ declare class SandboxClient {
|
|
|
788
807
|
resume(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
789
808
|
/** Claim a warm sandbox from a pool, creating one if no warm containers are available. */
|
|
790
809
|
claim(poolId: string): Promise<Traced<CreateSandboxResponse>>;
|
|
810
|
+
/**
|
|
811
|
+
* Live-copy a running sandbox.
|
|
812
|
+
*
|
|
813
|
+
* The server creates `times` running copies from the source sandbox. Partial
|
|
814
|
+
* responses can include failed copies; inspect each returned sandbox's
|
|
815
|
+
* `status` and `reason`.
|
|
816
|
+
*/
|
|
817
|
+
copy(sandboxId: string, options?: CopySandboxOptions): Promise<Traced<CopySandboxResponse>>;
|
|
791
818
|
/**
|
|
792
819
|
* Request a snapshot of a running sandbox's filesystem.
|
|
793
820
|
*
|
|
@@ -1061,9 +1088,21 @@ declare class SandboxException extends Error {
|
|
|
1061
1088
|
declare class SandboxError extends SandboxException {
|
|
1062
1089
|
constructor(message: string);
|
|
1063
1090
|
}
|
|
1064
|
-
/**
|
|
1091
|
+
/**
|
|
1092
|
+
* Raised when the client cannot complete a request against the API server.
|
|
1093
|
+
*
|
|
1094
|
+
* The original transport error (typically undici's `TypeError: fetch failed`,
|
|
1095
|
+
* whose real reason — `ECONNREFUSED`, `UND_ERR_CONNECT_TIMEOUT`, `EMFILE`, … —
|
|
1096
|
+
* lives in `.cause`) is preserved on this error's {@link cause} for programmatic
|
|
1097
|
+
* inspection, and its full chain is folded into the message so it survives
|
|
1098
|
+
* wrappers that only forward `error.message`. No interpretation of the failure
|
|
1099
|
+
* (client vs server) is applied — the raw inner error is surfaced as-is so the
|
|
1100
|
+
* reader can judge.
|
|
1101
|
+
*/
|
|
1065
1102
|
declare class SandboxConnectionError extends SandboxError {
|
|
1066
|
-
constructor(message: string
|
|
1103
|
+
constructor(message: string, options?: {
|
|
1104
|
+
cause?: unknown;
|
|
1105
|
+
});
|
|
1067
1106
|
}
|
|
1068
1107
|
/** Raised when a sandbox is not found. */
|
|
1069
1108
|
declare class SandboxNotFoundError extends SandboxError {
|
|
@@ -1101,4 +1140,4 @@ declare class RequestExecutionError extends Error {
|
|
|
1101
1140
|
constructor(message: string, functionName?: string);
|
|
1102
1141
|
}
|
|
1103
1142
|
|
|
1104
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type ArchivedSandboxInfo, type BinaryPayload, type BuildInfo, type BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, type CloudClientOptions, type CommandResult, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type 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 HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type MouseButton, type NetworkConfig, type NewSecret, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpsertSecretResponse, sandboxUrlFromIngressEndpoint };
|
|
1143
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type ArchivedSandboxInfo, type BinaryPayload, type BuildInfo, type BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, type CloudClientOptions, type CommandResult, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type 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 HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type MouseButton, type NetworkConfig, type NewSecret, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpsertSecretResponse, sandboxUrlFromIngressEndpoint };
|
package/dist/index.d.ts
CHANGED
|
@@ -88,7 +88,6 @@ interface CreateSandboxOptions {
|
|
|
88
88
|
memoryMb?: number;
|
|
89
89
|
/** Root disk size in megabytes. When omitted, the server uses its default disk size. */
|
|
90
90
|
diskMb?: number;
|
|
91
|
-
secretNames?: string[];
|
|
92
91
|
timeoutSecs?: number;
|
|
93
92
|
entrypoint?: string[];
|
|
94
93
|
allowInternetAccess?: boolean;
|
|
@@ -109,12 +108,34 @@ interface UpdateSandboxOptions {
|
|
|
109
108
|
interface CreateSandboxResponse {
|
|
110
109
|
sandboxId: string;
|
|
111
110
|
status: SandboxStatus;
|
|
111
|
+
reason?: string;
|
|
112
112
|
routingHint?: string;
|
|
113
113
|
ingressEndpoint?: string;
|
|
114
114
|
name?: string | null;
|
|
115
115
|
terminationReason?: string;
|
|
116
116
|
errorDetails?: unknown;
|
|
117
117
|
}
|
|
118
|
+
interface CopySandboxOptions {
|
|
119
|
+
/** Number of running copies to create. Defaults to 1. */
|
|
120
|
+
times?: number;
|
|
121
|
+
/** Per-request timeout in seconds for the blocking live-copy request. */
|
|
122
|
+
requestTimeout?: number;
|
|
123
|
+
}
|
|
124
|
+
interface CopiedSandboxResponse {
|
|
125
|
+
sandboxId: string;
|
|
126
|
+
/** Raw server status. Partial copy responses can include statuses such as `"failed"`. */
|
|
127
|
+
status: string;
|
|
128
|
+
reason?: string;
|
|
129
|
+
routingHint?: string;
|
|
130
|
+
ingressEndpoint?: string;
|
|
131
|
+
name?: string | null;
|
|
132
|
+
terminationReason?: string;
|
|
133
|
+
errorDetails?: unknown;
|
|
134
|
+
}
|
|
135
|
+
interface CopySandboxResponse {
|
|
136
|
+
sourceSandboxId: string;
|
|
137
|
+
sandboxes: CopiedSandboxResponse[];
|
|
138
|
+
}
|
|
118
139
|
interface SandboxInfo {
|
|
119
140
|
sandboxId: string;
|
|
120
141
|
namespace: string;
|
|
@@ -122,7 +143,6 @@ interface SandboxInfo {
|
|
|
122
143
|
/** Resolved sandbox image name. */
|
|
123
144
|
image?: string;
|
|
124
145
|
resources: ContainerResourcesInfo;
|
|
125
|
-
secretNames: string[];
|
|
126
146
|
timeoutSecs?: number;
|
|
127
147
|
entrypoint?: string[];
|
|
128
148
|
network?: NetworkConfig;
|
|
@@ -200,7 +220,6 @@ interface CreatePoolOptions {
|
|
|
200
220
|
cpus?: number;
|
|
201
221
|
memoryMb?: number;
|
|
202
222
|
ephemeralDiskMb?: number;
|
|
203
|
-
secretNames?: string[];
|
|
204
223
|
timeoutSecs?: number;
|
|
205
224
|
entrypoint?: string[];
|
|
206
225
|
maxContainers?: number;
|
|
@@ -212,7 +231,6 @@ interface UpdatePoolOptions {
|
|
|
212
231
|
cpus?: number;
|
|
213
232
|
memoryMb?: number;
|
|
214
233
|
ephemeralDiskMb?: number;
|
|
215
|
-
secretNames?: string[];
|
|
216
234
|
timeoutSecs?: number;
|
|
217
235
|
entrypoint?: string[];
|
|
218
236
|
maxContainers?: number;
|
|
@@ -234,7 +252,6 @@ interface SandboxPoolInfo {
|
|
|
234
252
|
/** Sandbox image name backing the pool. */
|
|
235
253
|
image: string;
|
|
236
254
|
resources: ContainerResourcesInfo;
|
|
237
|
-
secretNames: string[];
|
|
238
255
|
timeoutSecs: number;
|
|
239
256
|
entrypoint?: string[];
|
|
240
257
|
maxContainers?: number;
|
|
@@ -599,6 +616,8 @@ declare class Sandbox {
|
|
|
599
616
|
* `{ wait: false }` for fire-and-return.
|
|
600
617
|
*/
|
|
601
618
|
resume(options?: SuspendResumeOptions): Promise<void>;
|
|
619
|
+
/** Live-copy this running sandbox. */
|
|
620
|
+
copy(options?: CopySandboxOptions): Promise<Traced<CopySandboxResponse>>;
|
|
602
621
|
/**
|
|
603
622
|
* Create a checkpoint of this sandbox and wait for it to be locally ready.
|
|
604
623
|
*
|
|
@@ -788,6 +807,14 @@ declare class SandboxClient {
|
|
|
788
807
|
resume(sandboxId: string, options?: SuspendResumeOptions): Promise<void>;
|
|
789
808
|
/** Claim a warm sandbox from a pool, creating one if no warm containers are available. */
|
|
790
809
|
claim(poolId: string): Promise<Traced<CreateSandboxResponse>>;
|
|
810
|
+
/**
|
|
811
|
+
* Live-copy a running sandbox.
|
|
812
|
+
*
|
|
813
|
+
* The server creates `times` running copies from the source sandbox. Partial
|
|
814
|
+
* responses can include failed copies; inspect each returned sandbox's
|
|
815
|
+
* `status` and `reason`.
|
|
816
|
+
*/
|
|
817
|
+
copy(sandboxId: string, options?: CopySandboxOptions): Promise<Traced<CopySandboxResponse>>;
|
|
791
818
|
/**
|
|
792
819
|
* Request a snapshot of a running sandbox's filesystem.
|
|
793
820
|
*
|
|
@@ -1061,9 +1088,21 @@ declare class SandboxException extends Error {
|
|
|
1061
1088
|
declare class SandboxError extends SandboxException {
|
|
1062
1089
|
constructor(message: string);
|
|
1063
1090
|
}
|
|
1064
|
-
/**
|
|
1091
|
+
/**
|
|
1092
|
+
* Raised when the client cannot complete a request against the API server.
|
|
1093
|
+
*
|
|
1094
|
+
* The original transport error (typically undici's `TypeError: fetch failed`,
|
|
1095
|
+
* whose real reason — `ECONNREFUSED`, `UND_ERR_CONNECT_TIMEOUT`, `EMFILE`, … —
|
|
1096
|
+
* lives in `.cause`) is preserved on this error's {@link cause} for programmatic
|
|
1097
|
+
* inspection, and its full chain is folded into the message so it survives
|
|
1098
|
+
* wrappers that only forward `error.message`. No interpretation of the failure
|
|
1099
|
+
* (client vs server) is applied — the raw inner error is surfaced as-is so the
|
|
1100
|
+
* reader can judge.
|
|
1101
|
+
*/
|
|
1065
1102
|
declare class SandboxConnectionError extends SandboxError {
|
|
1066
|
-
constructor(message: string
|
|
1103
|
+
constructor(message: string, options?: {
|
|
1104
|
+
cause?: unknown;
|
|
1105
|
+
});
|
|
1067
1106
|
}
|
|
1068
1107
|
/** Raised when a sandbox is not found. */
|
|
1069
1108
|
declare class SandboxNotFoundError extends SandboxError {
|
|
@@ -1101,4 +1140,4 @@ declare class RequestExecutionError extends Error {
|
|
|
1101
1140
|
constructor(message: string, functionName?: string);
|
|
1102
1141
|
}
|
|
1103
1142
|
|
|
1104
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type ArchivedSandboxInfo, type BinaryPayload, type BuildInfo, type BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, type CloudClientOptions, type CommandResult, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type 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 HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type MouseButton, type NetworkConfig, type NewSecret, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpsertSecretResponse, sandboxUrlFromIngressEndpoint };
|
|
1143
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type ArchivedSandboxInfo, type BinaryPayload, type BuildInfo, type BuildLogEntry, type CheckpointOptions, type CheckpointType, CloudClient, type CloudClientOptions, type CommandResult, type ConnectDesktopOptions, type ConnectOptions, type ContainerResourcesInfo, ContainerState, type CopiedSandboxResponse, type CopySandboxOptions, type CopySandboxResponse, type CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type 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 HealthResponse, type ListArchivedSandboxesOptions, type ListArchivedSandboxesResponse, type ListDirectoryResponse, type MouseButton, type NetworkConfig, type NewSecret, type OutputEvent, OutputMode, type OutputResponse, type PoolContainerInfo, PoolInUseError, PoolNotFoundError, type ProcessInfo, ProcessStatus, type ProcessUser, type ProcessUserSpec, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, type PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, type RunOptions, Sandbox, SandboxClient, type SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, type SandboxInfo, SandboxNotFoundError, type SandboxOptions, type SandboxPoolInfo, type SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, type SendSignalResponse, type SnapshotAndWaitOptions, type SnapshotInfo, type SnapshotOptions, SnapshotStatus, type SnapshotType, type SnapshotWaitCondition, type StartImageBuildRequest, type StartProcessOptions, StdinMode, type SuspendResumeOptions, TcpTunnel, type TunnelAddress, type UpdatePoolOptions, type UpsertSecretResponse, sandboxUrlFromIngressEndpoint };
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var SDK_VERSION, API_URL, API_KEY, NAMESPACE, SANDBOX_PROXY_URL, DEFAULT_HTTP_TI
|
|
|
19
19
|
var init_defaults = __esm({
|
|
20
20
|
"src/defaults.ts"() {
|
|
21
21
|
"use strict";
|
|
22
|
-
SDK_VERSION = "0.5.
|
|
22
|
+
SDK_VERSION = "0.5.33";
|
|
23
23
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
24
24
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
25
25
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -32,6 +32,28 @@ var init_defaults = __esm({
|
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
// src/errors.ts
|
|
35
|
+
function describeError(err) {
|
|
36
|
+
const parts = [];
|
|
37
|
+
const seen = /* @__PURE__ */ new Set();
|
|
38
|
+
let current = err;
|
|
39
|
+
for (let depth = 0; depth < 6; depth++) {
|
|
40
|
+
if (current == null || typeof current !== "object" || seen.has(current)) {
|
|
41
|
+
break;
|
|
42
|
+
}
|
|
43
|
+
seen.add(current);
|
|
44
|
+
const e = current;
|
|
45
|
+
const message = typeof e.message === "string" ? e.message.trim() : "";
|
|
46
|
+
const code = typeof e.code === "string" ? e.code : void 0;
|
|
47
|
+
let segment = message;
|
|
48
|
+
if (code && (!message || !message.includes(code))) {
|
|
49
|
+
segment = segment ? `${segment} (${code})` : code;
|
|
50
|
+
}
|
|
51
|
+
if (segment && !parts.includes(segment)) parts.push(segment);
|
|
52
|
+
current = e.cause;
|
|
53
|
+
}
|
|
54
|
+
if (parts.length > 0) return parts.join(": ");
|
|
55
|
+
return err instanceof Error ? err.message : String(err);
|
|
56
|
+
}
|
|
35
57
|
var SandboxException, SandboxError, SandboxConnectionError, SandboxNotFoundError, PoolNotFoundError, PoolInUseError, RemoteAPIError, RequestNotFinishedError, RequestFailedError, RequestExecutionError;
|
|
36
58
|
var init_errors = __esm({
|
|
37
59
|
"src/errors.ts"() {
|
|
@@ -49,9 +71,10 @@ var init_errors = __esm({
|
|
|
49
71
|
}
|
|
50
72
|
};
|
|
51
73
|
SandboxConnectionError = class extends SandboxError {
|
|
52
|
-
constructor(message) {
|
|
74
|
+
constructor(message, options) {
|
|
53
75
|
super(`Connection error: ${message}`);
|
|
54
76
|
this.name = "SandboxConnectionError";
|
|
77
|
+
if (options?.cause !== void 0) this.cause = options.cause;
|
|
55
78
|
}
|
|
56
79
|
};
|
|
57
80
|
SandboxNotFoundError = class extends SandboxError {
|
|
@@ -322,7 +345,11 @@ var init_http = __esm({
|
|
|
322
345
|
await sleep(delay);
|
|
323
346
|
}
|
|
324
347
|
this.abortController = new AbortController();
|
|
325
|
-
|
|
348
|
+
let timedOut = false;
|
|
349
|
+
const timeoutId = this.timeoutMs == null ? null : setTimeout(() => {
|
|
350
|
+
timedOut = true;
|
|
351
|
+
this.abortController?.abort();
|
|
352
|
+
}, this.timeoutMs);
|
|
326
353
|
const combinedSignal = signal ? anySignal([signal, this.abortController.signal]) : this.abortController.signal;
|
|
327
354
|
try {
|
|
328
355
|
const response = await undiciFetch(url, {
|
|
@@ -350,16 +377,22 @@ var init_http = __esm({
|
|
|
350
377
|
if (err instanceof RemoteAPIError || err instanceof SandboxNotFoundError || err instanceof PoolNotFoundError || err instanceof PoolInUseError) {
|
|
351
378
|
throw err;
|
|
352
379
|
}
|
|
353
|
-
if (signal?.aborted) {
|
|
354
|
-
throw new SandboxConnectionError("
|
|
380
|
+
if (signal?.aborted && !timedOut) {
|
|
381
|
+
throw new SandboxConnectionError("request aborted by caller", {
|
|
382
|
+
cause: err
|
|
383
|
+
});
|
|
355
384
|
}
|
|
356
385
|
lastError = err instanceof Error ? err : new Error(String(err));
|
|
357
386
|
if (attempt >= this.maxRetries) {
|
|
358
|
-
|
|
387
|
+
const detail = timedOut ? `request timed out after ${this.timeoutMs}ms` : describeError(err);
|
|
388
|
+
throw new SandboxConnectionError(detail, { cause: err });
|
|
359
389
|
}
|
|
360
390
|
}
|
|
361
391
|
}
|
|
362
|
-
throw new SandboxConnectionError(
|
|
392
|
+
throw new SandboxConnectionError(
|
|
393
|
+
lastError ? describeError(lastError) : "request failed",
|
|
394
|
+
{ cause: lastError }
|
|
395
|
+
);
|
|
363
396
|
}
|
|
364
397
|
};
|
|
365
398
|
}
|
|
@@ -3489,6 +3522,11 @@ var init_sandbox = __esm({
|
|
|
3489
3522
|
const client = this.requireLifecycleClient("resume");
|
|
3490
3523
|
await client.resume(this.lifecycleIdentifier, options);
|
|
3491
3524
|
}
|
|
3525
|
+
/** Live-copy this running sandbox. */
|
|
3526
|
+
async copy(options) {
|
|
3527
|
+
const client = this.requireLifecycleClient("copy");
|
|
3528
|
+
return client.copy(this.lifecycleIdentifier, options);
|
|
3529
|
+
}
|
|
3492
3530
|
/**
|
|
3493
3531
|
* Create a checkpoint of this sandbox and wait for it to be locally ready.
|
|
3494
3532
|
*
|
|
@@ -3982,7 +4020,7 @@ function validateUserPort(port) {
|
|
|
3982
4020
|
function dedupeAndSortPorts(ports) {
|
|
3983
4021
|
return [...new Set(ports)].sort((a, b) => a - b);
|
|
3984
4022
|
}
|
|
3985
|
-
var CREATE_SANDBOX_RETRYABLE_STATUS_CODES, CREATE_SANDBOX_ALLOWED_ERROR_STATUS_CODES, SandboxClient, RESERVED_SANDBOX_MANAGEMENT_PORT;
|
|
4023
|
+
var CREATE_SANDBOX_RETRYABLE_STATUS_CODES, CREATE_SANDBOX_ALLOWED_ERROR_STATUS_CODES, COPY_SANDBOX_ALLOWED_ERROR_STATUS_CODES, SandboxClient, RESERVED_SANDBOX_MANAGEMENT_PORT;
|
|
3986
4024
|
var init_client = __esm({
|
|
3987
4025
|
"src/client.ts"() {
|
|
3988
4026
|
"use strict";
|
|
@@ -3994,6 +4032,7 @@ var init_client = __esm({
|
|
|
3994
4032
|
init_url();
|
|
3995
4033
|
CREATE_SANDBOX_RETRYABLE_STATUS_CODES = /* @__PURE__ */ new Set([502, 503]);
|
|
3996
4034
|
CREATE_SANDBOX_ALLOWED_ERROR_STATUS_CODES = /* @__PURE__ */ new Set([504]);
|
|
4035
|
+
COPY_SANDBOX_ALLOWED_ERROR_STATUS_CODES = /* @__PURE__ */ new Set([422, 504]);
|
|
3997
4036
|
SandboxClient = class _SandboxClient {
|
|
3998
4037
|
http;
|
|
3999
4038
|
apiUrl;
|
|
@@ -4092,7 +4131,6 @@ var init_client = __esm({
|
|
|
4092
4131
|
}
|
|
4093
4132
|
};
|
|
4094
4133
|
if (options?.image != null) body.image = options.image;
|
|
4095
|
-
if (options?.secretNames != null) body.secret_names = options.secretNames;
|
|
4096
4134
|
if (options?.timeoutSecs != null) body.timeout_secs = options.timeoutSecs;
|
|
4097
4135
|
if (options?.entrypoint != null) body.entrypoint = options.entrypoint;
|
|
4098
4136
|
if (options?.snapshotId != null) body.snapshot_id = options.snapshotId;
|
|
@@ -4314,6 +4352,27 @@ var init_client = __esm({
|
|
|
4314
4352
|
const result = fromSnakeKeys(raw, "sandboxId");
|
|
4315
4353
|
return Object.assign(result, { traceId: raw.traceId });
|
|
4316
4354
|
}
|
|
4355
|
+
/**
|
|
4356
|
+
* Live-copy a running sandbox.
|
|
4357
|
+
*
|
|
4358
|
+
* The server creates `times` running copies from the source sandbox. Partial
|
|
4359
|
+
* responses can include failed copies; inspect each returned sandbox's
|
|
4360
|
+
* `status` and `reason`.
|
|
4361
|
+
*/
|
|
4362
|
+
async copy(sandboxId, options) {
|
|
4363
|
+
const times = options?.times ?? 1;
|
|
4364
|
+
if (!Number.isInteger(times) || times < 1) {
|
|
4365
|
+
throw new SandboxError("times must be a positive integer");
|
|
4366
|
+
}
|
|
4367
|
+
const client = this.withRequestTimeout(options?.requestTimeout);
|
|
4368
|
+
const raw = await client.http.requestJson(
|
|
4369
|
+
"POST",
|
|
4370
|
+
client.path(`sandbox/${sandboxId}/copy?times=${encodeURIComponent(String(times))}`),
|
|
4371
|
+
{ allowedErrorStatusCodes: COPY_SANDBOX_ALLOWED_ERROR_STATUS_CODES }
|
|
4372
|
+
);
|
|
4373
|
+
const result = fromSnakeKeys(raw, "sandboxId");
|
|
4374
|
+
return Object.assign(result, { traceId: raw.traceId });
|
|
4375
|
+
}
|
|
4317
4376
|
// --- Snapshots ---
|
|
4318
4377
|
/**
|
|
4319
4378
|
* Request a snapshot of a running sandbox's filesystem.
|
|
@@ -4410,7 +4469,6 @@ var init_client = __esm({
|
|
|
4410
4469
|
},
|
|
4411
4470
|
timeout_secs: options.timeoutSecs ?? 0
|
|
4412
4471
|
};
|
|
4413
|
-
if (options.secretNames != null) body.secret_names = options.secretNames;
|
|
4414
4472
|
if (options.entrypoint != null) body.entrypoint = options.entrypoint;
|
|
4415
4473
|
if (options.maxContainers != null) body.max_containers = options.maxContainers;
|
|
4416
4474
|
if (options.warmContainers != null) body.warm_containers = options.warmContainers;
|
|
@@ -4451,7 +4509,6 @@ var init_client = __esm({
|
|
|
4451
4509
|
},
|
|
4452
4510
|
timeout_secs: options.timeoutSecs ?? 0
|
|
4453
4511
|
};
|
|
4454
|
-
if (options.secretNames != null) body.secret_names = options.secretNames;
|
|
4455
4512
|
if (options.entrypoint != null) body.entrypoint = options.entrypoint;
|
|
4456
4513
|
if (options.maxContainers != null) body.max_containers = options.maxContainers;
|
|
4457
4514
|
if (options.warmContainers != null) body.warm_containers = options.warmContainers;
|