tensorlake 0.5.0 → 0.5.1
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 +84 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +29 -8
- package/dist/index.d.ts +29 -8
- package/dist/index.js +84 -29
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-CMJ_FOOV.d.cts → sandbox-image-CEGsGg4V.d.cts} +6 -2
- package/dist/{sandbox-image-CMJ_FOOV.d.ts → sandbox-image-CEGsGg4V.d.ts} +6 -2
- package/dist/sandbox-image.cjs +84 -29
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.d.cts +1 -1
- package/dist/sandbox-image.d.ts +1 -1
- package/dist/sandbox-image.js +84 -29
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as SandboxStatus, U as UpdateSandboxOptions, f as SandboxInfo, g as SuspendResumeOptions, h as CheckpointOptions, R as RunOptions, i as CommandResult, j as StartProcessOptions, P as ProcessInfo, k as SendSignalResponse, O as OutputResponse, l as OutputEvent, L as ListDirectoryResponse, m as PtySessionInfo, H as HealthResponse, D as DaemonInfo, n as CreateSandboxOptions, o as CreateSandboxResponse, p as SandboxPortAccess, q as SnapshotOptions, r as CreateSnapshotResponse, s as SnapshotAndWaitOptions, t as CreatePoolOptions, u as CreateSandboxPoolResponse, v as SandboxPoolInfo, w as UpdatePoolOptions } from './sandbox-image-CEGsGg4V.cjs';
|
|
2
|
+
export { x as ContainerResourcesInfo, y as ContainerState, z as CreateSandboxImageOptions, A as DirectoryEntry, B as DockerfileBuildPlan, E as DockerfileInstruction, I as Image, F as ImageBuildOperation, G as ImageBuildOperationType, G as ImageBuildOperationTypeValue, J as ImageOptions, N as NetworkConfig, K as OutputMode, M as PoolContainerInfo, Q as ProcessStatus, T as SandboxImageSource, V as SnapshotContentMode, W as SnapshotStatus, X as StdinMode, Y as createSandboxImage, Z as dockerfileContent } from './sandbox-image-CEGsGg4V.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
|
@@ -171,7 +171,14 @@ declare class Sandbox {
|
|
|
171
171
|
private readonly wsHeaders;
|
|
172
172
|
private ownsSandbox;
|
|
173
173
|
private lifecycleClient;
|
|
174
|
+
private lifecycleIdentifier;
|
|
175
|
+
private sandboxName;
|
|
174
176
|
constructor(options: SandboxOptions);
|
|
177
|
+
get name(): string | null;
|
|
178
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
179
|
+
_setName(name: string | null): void;
|
|
180
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
181
|
+
_setLifecycleIdentifier(identifier: string): void;
|
|
175
182
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
176
183
|
_setOwner(client: SandboxClient): void;
|
|
177
184
|
/**
|
|
@@ -194,6 +201,20 @@ declare class Sandbox {
|
|
|
194
201
|
/** Delete a snapshot by ID. No sandbox handle needed. */
|
|
195
202
|
static deleteSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<void>;
|
|
196
203
|
private requireLifecycleClient;
|
|
204
|
+
/**
|
|
205
|
+
* Fetch the current sandbox status from the server.
|
|
206
|
+
*
|
|
207
|
+
* Always hits the network — the value is not cached locally because the
|
|
208
|
+
* status changes over the sandbox's lifecycle.
|
|
209
|
+
*/
|
|
210
|
+
status(): Promise<SandboxStatus>;
|
|
211
|
+
/**
|
|
212
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
213
|
+
*
|
|
214
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
215
|
+
* suspend/resume.
|
|
216
|
+
*/
|
|
217
|
+
update(options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
197
218
|
/**
|
|
198
219
|
* Suspend this sandbox.
|
|
199
220
|
*
|
|
@@ -220,7 +241,7 @@ declare class Sandbox {
|
|
|
220
241
|
/**
|
|
221
242
|
* List snapshots taken from this sandbox.
|
|
222
243
|
*/
|
|
223
|
-
listSnapshots(): Promise<SnapshotInfo[]
|
|
244
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
224
245
|
/** Close the HTTP client. The sandbox keeps running. */
|
|
225
246
|
close(): void;
|
|
226
247
|
/** Terminate the sandbox and release all resources. */
|
|
@@ -242,7 +263,7 @@ declare class Sandbox {
|
|
|
242
263
|
*/
|
|
243
264
|
startProcess(command: string, options?: StartProcessOptions): Promise<ProcessInfo>;
|
|
244
265
|
/** List all processes (running and exited) tracked by the sandbox daemon. */
|
|
245
|
-
listProcesses(): Promise<ProcessInfo[]
|
|
266
|
+
listProcesses(): Promise<Traced<ProcessInfo[]>>;
|
|
246
267
|
/** Get current status and metadata for a process by PID. */
|
|
247
268
|
getProcess(pid: number): Promise<ProcessInfo>;
|
|
248
269
|
/** Send SIGKILL to a process. */
|
|
@@ -331,7 +352,7 @@ declare class SandboxClient {
|
|
|
331
352
|
/** Get current state and metadata for a sandbox by ID. */
|
|
332
353
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
333
354
|
/** List all sandboxes in the namespace. */
|
|
334
|
-
list(): Promise<SandboxInfo[]
|
|
355
|
+
list(): Promise<Traced<SandboxInfo[]>>;
|
|
335
356
|
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
336
357
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
337
358
|
/** Get the current proxy port settings for a sandbox. */
|
|
@@ -389,7 +410,7 @@ declare class SandboxClient {
|
|
|
389
410
|
/** Get current status and metadata for a snapshot by ID. */
|
|
390
411
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
391
412
|
/** List all snapshots in the namespace. */
|
|
392
|
-
listSnapshots(): Promise<SnapshotInfo[]
|
|
413
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
393
414
|
/** Delete a snapshot by ID. */
|
|
394
415
|
deleteSnapshot(snapshotId: string): Promise<void>;
|
|
395
416
|
/**
|
|
@@ -411,7 +432,7 @@ declare class SandboxClient {
|
|
|
411
432
|
/** Get current state and metadata for a sandbox pool by ID. */
|
|
412
433
|
getPool(poolId: string): Promise<SandboxPoolInfo>;
|
|
413
434
|
/** List all sandbox pools in the namespace. */
|
|
414
|
-
listPools(): Promise<SandboxPoolInfo[]
|
|
435
|
+
listPools(): Promise<Traced<SandboxPoolInfo[]>>;
|
|
415
436
|
/** Replace the configuration of an existing sandbox pool. */
|
|
416
437
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
417
438
|
/** Delete a sandbox pool. Fails if the pool has active containers. */
|
|
@@ -675,4 +696,4 @@ declare class RequestExecutionError extends Error {
|
|
|
675
696
|
constructor(message: string, functionName?: string);
|
|
676
697
|
}
|
|
677
698
|
|
|
678
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
|
699
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as
|
|
2
|
-
export {
|
|
1
|
+
import { C as CreatePtySessionOptions, S as SandboxOptions, a as CreateAndConnectOptions, b as SandboxClientOptions, c as ConnectOptions, d as SnapshotInfo, e as SandboxStatus, U as UpdateSandboxOptions, f as SandboxInfo, g as SuspendResumeOptions, h as CheckpointOptions, R as RunOptions, i as CommandResult, j as StartProcessOptions, P as ProcessInfo, k as SendSignalResponse, O as OutputResponse, l as OutputEvent, L as ListDirectoryResponse, m as PtySessionInfo, H as HealthResponse, D as DaemonInfo, n as CreateSandboxOptions, o as CreateSandboxResponse, p as SandboxPortAccess, q as SnapshotOptions, r as CreateSnapshotResponse, s as SnapshotAndWaitOptions, t as CreatePoolOptions, u as CreateSandboxPoolResponse, v as SandboxPoolInfo, w as UpdatePoolOptions } from './sandbox-image-CEGsGg4V.js';
|
|
2
|
+
export { x as ContainerResourcesInfo, y as ContainerState, z as CreateSandboxImageOptions, A as DirectoryEntry, B as DockerfileBuildPlan, E as DockerfileInstruction, I as Image, F as ImageBuildOperation, G as ImageBuildOperationType, G as ImageBuildOperationTypeValue, J as ImageOptions, N as NetworkConfig, K as OutputMode, M as PoolContainerInfo, Q as ProcessStatus, T as SandboxImageSource, V as SnapshotContentMode, W as SnapshotStatus, X as StdinMode, Y as createSandboxImage, Z as dockerfileContent } from './sandbox-image-CEGsGg4V.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
|
@@ -171,7 +171,14 @@ declare class Sandbox {
|
|
|
171
171
|
private readonly wsHeaders;
|
|
172
172
|
private ownsSandbox;
|
|
173
173
|
private lifecycleClient;
|
|
174
|
+
private lifecycleIdentifier;
|
|
175
|
+
private sandboxName;
|
|
174
176
|
constructor(options: SandboxOptions);
|
|
177
|
+
get name(): string | null;
|
|
178
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
179
|
+
_setName(name: string | null): void;
|
|
180
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
181
|
+
_setLifecycleIdentifier(identifier: string): void;
|
|
175
182
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
176
183
|
_setOwner(client: SandboxClient): void;
|
|
177
184
|
/**
|
|
@@ -194,6 +201,20 @@ declare class Sandbox {
|
|
|
194
201
|
/** Delete a snapshot by ID. No sandbox handle needed. */
|
|
195
202
|
static deleteSnapshot(snapshotId: string, options?: Partial<SandboxClientOptions>): Promise<void>;
|
|
196
203
|
private requireLifecycleClient;
|
|
204
|
+
/**
|
|
205
|
+
* Fetch the current sandbox status from the server.
|
|
206
|
+
*
|
|
207
|
+
* Always hits the network — the value is not cached locally because the
|
|
208
|
+
* status changes over the sandbox's lifecycle.
|
|
209
|
+
*/
|
|
210
|
+
status(): Promise<SandboxStatus>;
|
|
211
|
+
/**
|
|
212
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
213
|
+
*
|
|
214
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
215
|
+
* suspend/resume.
|
|
216
|
+
*/
|
|
217
|
+
update(options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
197
218
|
/**
|
|
198
219
|
* Suspend this sandbox.
|
|
199
220
|
*
|
|
@@ -220,7 +241,7 @@ declare class Sandbox {
|
|
|
220
241
|
/**
|
|
221
242
|
* List snapshots taken from this sandbox.
|
|
222
243
|
*/
|
|
223
|
-
listSnapshots(): Promise<SnapshotInfo[]
|
|
244
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
224
245
|
/** Close the HTTP client. The sandbox keeps running. */
|
|
225
246
|
close(): void;
|
|
226
247
|
/** Terminate the sandbox and release all resources. */
|
|
@@ -242,7 +263,7 @@ declare class Sandbox {
|
|
|
242
263
|
*/
|
|
243
264
|
startProcess(command: string, options?: StartProcessOptions): Promise<ProcessInfo>;
|
|
244
265
|
/** List all processes (running and exited) tracked by the sandbox daemon. */
|
|
245
|
-
listProcesses(): Promise<ProcessInfo[]
|
|
266
|
+
listProcesses(): Promise<Traced<ProcessInfo[]>>;
|
|
246
267
|
/** Get current status and metadata for a process by PID. */
|
|
247
268
|
getProcess(pid: number): Promise<ProcessInfo>;
|
|
248
269
|
/** Send SIGKILL to a process. */
|
|
@@ -331,7 +352,7 @@ declare class SandboxClient {
|
|
|
331
352
|
/** Get current state and metadata for a sandbox by ID. */
|
|
332
353
|
get(sandboxId: string): Promise<SandboxInfo>;
|
|
333
354
|
/** List all sandboxes in the namespace. */
|
|
334
|
-
list(): Promise<SandboxInfo[]
|
|
355
|
+
list(): Promise<Traced<SandboxInfo[]>>;
|
|
335
356
|
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
336
357
|
update(sandboxId: string, options: UpdateSandboxOptions): Promise<SandboxInfo>;
|
|
337
358
|
/** Get the current proxy port settings for a sandbox. */
|
|
@@ -389,7 +410,7 @@ declare class SandboxClient {
|
|
|
389
410
|
/** Get current status and metadata for a snapshot by ID. */
|
|
390
411
|
getSnapshot(snapshotId: string): Promise<SnapshotInfo>;
|
|
391
412
|
/** List all snapshots in the namespace. */
|
|
392
|
-
listSnapshots(): Promise<SnapshotInfo[]
|
|
413
|
+
listSnapshots(): Promise<Traced<SnapshotInfo[]>>;
|
|
393
414
|
/** Delete a snapshot by ID. */
|
|
394
415
|
deleteSnapshot(snapshotId: string): Promise<void>;
|
|
395
416
|
/**
|
|
@@ -411,7 +432,7 @@ declare class SandboxClient {
|
|
|
411
432
|
/** Get current state and metadata for a sandbox pool by ID. */
|
|
412
433
|
getPool(poolId: string): Promise<SandboxPoolInfo>;
|
|
413
434
|
/** List all sandbox pools in the namespace. */
|
|
414
|
-
listPools(): Promise<SandboxPoolInfo[]
|
|
435
|
+
listPools(): Promise<Traced<SandboxPoolInfo[]>>;
|
|
415
436
|
/** Replace the configuration of an existing sandbox pool. */
|
|
416
437
|
updatePool(poolId: string, options: UpdatePoolOptions): Promise<SandboxPoolInfo>;
|
|
417
438
|
/** Delete a sandbox pool. Fails if the pool has active containers. */
|
|
@@ -675,4 +696,4 @@ declare class RequestExecutionError extends Error {
|
|
|
675
696
|
constructor(message: string, functionName?: string);
|
|
676
697
|
}
|
|
677
698
|
|
|
678
|
-
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
|
699
|
+
export { APIClient, type ApiKeyIntrospection, type ApplicationBuildContext, type ApplicationBuildImageResult, type ApplicationBuildResponse, type ApplicationManifest, type ApplicationSummary, type BinaryPayload, type BuildInfo, type BuildLogEntry, CheckpointOptions, CloudClient, type CloudClientOptions, CommandResult, type ConnectDesktopOptions, ConnectOptions, CreateAndConnectOptions, type CreateApplicationBuildImageRequest, type CreateApplicationBuildRequest, CreatePoolOptions, type CreatePtyOptions, CreatePtySessionOptions, CreateSandboxOptions, CreateSandboxPoolResponse, CreateSandboxResponse, CreateSnapshotResponse, type CreateTunnelOptions, DaemonInfo, Desktop, type DesktopDoubleClickOptions, type DesktopPointerOptions, HealthResponse, ListDirectoryResponse, type MouseButton, type NewSecret, OutputEvent, OutputResponse, PoolInUseError, PoolNotFoundError, ProcessInfo, Pty, type PtyConnectionOptions, type PtyDataHandler, type PtyExitHandler, PtySessionInfo, RemoteAPIError, type RequestErrorInfo, RequestExecutionError, RequestFailedError, type RequestInput, type RequestMetadata, RequestNotFinishedError, type RequestOutput, RunOptions, Sandbox, SandboxClient, SandboxClientOptions, SandboxConnectionError, SandboxError, SandboxException, SandboxInfo, SandboxNotFoundError, SandboxOptions, SandboxPoolInfo, SandboxPortAccess, SandboxStatus, type Secret, type SecretsList, type SecretsPagination, SendSignalResponse, SnapshotAndWaitOptions, SnapshotInfo, SnapshotOptions, type StartImageBuildRequest, StartProcessOptions, SuspendResumeOptions, TcpTunnel, type TunnelAddress, UpdatePoolOptions, type UpsertSecretResponse };
|
package/dist/index.js
CHANGED
|
@@ -3164,8 +3164,11 @@ var init_sandbox = __esm({
|
|
|
3164
3164
|
wsHeaders;
|
|
3165
3165
|
ownsSandbox = false;
|
|
3166
3166
|
lifecycleClient = null;
|
|
3167
|
+
lifecycleIdentifier;
|
|
3168
|
+
sandboxName = null;
|
|
3167
3169
|
constructor(options) {
|
|
3168
3170
|
this.sandboxId = options.sandboxId;
|
|
3171
|
+
this.lifecycleIdentifier = options.sandboxId;
|
|
3169
3172
|
const proxyUrl = options.proxyUrl ?? SANDBOX_PROXY_URL;
|
|
3170
3173
|
const { baseUrl, hostHeader } = resolveProxyTarget(proxyUrl, options.sandboxId);
|
|
3171
3174
|
this.baseUrl = baseUrl;
|
|
@@ -3191,6 +3194,17 @@ var init_sandbox = __esm({
|
|
|
3191
3194
|
routingHint: options.routingHint
|
|
3192
3195
|
});
|
|
3193
3196
|
}
|
|
3197
|
+
get name() {
|
|
3198
|
+
return this.sandboxName;
|
|
3199
|
+
}
|
|
3200
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
3201
|
+
_setName(name) {
|
|
3202
|
+
this.sandboxName = name;
|
|
3203
|
+
}
|
|
3204
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
3205
|
+
_setLifecycleIdentifier(identifier) {
|
|
3206
|
+
this.lifecycleIdentifier = identifier;
|
|
3207
|
+
}
|
|
3194
3208
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
3195
3209
|
_setOwner(client) {
|
|
3196
3210
|
this.ownsSandbox = true;
|
|
@@ -3228,9 +3242,15 @@ var init_sandbox = __esm({
|
|
|
3228
3242
|
/* _internal */
|
|
3229
3243
|
true
|
|
3230
3244
|
);
|
|
3231
|
-
await client.get(options.sandboxId);
|
|
3232
|
-
const sandbox = client.connect(
|
|
3245
|
+
const info = await client.get(options.sandboxId);
|
|
3246
|
+
const sandbox = client.connect(
|
|
3247
|
+
info.sandboxId,
|
|
3248
|
+
options.proxyUrl,
|
|
3249
|
+
options.routingHint ?? info.routingHint
|
|
3250
|
+
);
|
|
3233
3251
|
sandbox.lifecycleClient = client;
|
|
3252
|
+
sandbox._setLifecycleIdentifier(info.sandboxId);
|
|
3253
|
+
sandbox._setName(info.name ?? null);
|
|
3234
3254
|
return sandbox;
|
|
3235
3255
|
}
|
|
3236
3256
|
// --- Static snapshot management ---
|
|
@@ -3263,6 +3283,32 @@ var init_sandbox = __esm({
|
|
|
3263
3283
|
}
|
|
3264
3284
|
return this.lifecycleClient;
|
|
3265
3285
|
}
|
|
3286
|
+
/**
|
|
3287
|
+
* Fetch the current sandbox status from the server.
|
|
3288
|
+
*
|
|
3289
|
+
* Always hits the network — the value is not cached locally because the
|
|
3290
|
+
* status changes over the sandbox's lifecycle.
|
|
3291
|
+
*/
|
|
3292
|
+
async status() {
|
|
3293
|
+
const client = this.requireLifecycleClient("read_status");
|
|
3294
|
+
const info = await client.get(this.lifecycleIdentifier);
|
|
3295
|
+
this._setLifecycleIdentifier(info.sandboxId);
|
|
3296
|
+
this._setName(info.name ?? null);
|
|
3297
|
+
return info.status;
|
|
3298
|
+
}
|
|
3299
|
+
/**
|
|
3300
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
3301
|
+
*
|
|
3302
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
3303
|
+
* suspend/resume.
|
|
3304
|
+
*/
|
|
3305
|
+
async update(options) {
|
|
3306
|
+
const client = this.requireLifecycleClient("update");
|
|
3307
|
+
const info = await client.update(this.lifecycleIdentifier, options);
|
|
3308
|
+
this._setLifecycleIdentifier(info.sandboxId);
|
|
3309
|
+
this._setName(info.name ?? null);
|
|
3310
|
+
return info;
|
|
3311
|
+
}
|
|
3266
3312
|
/**
|
|
3267
3313
|
* Suspend this sandbox.
|
|
3268
3314
|
*
|
|
@@ -3271,7 +3317,7 @@ var init_sandbox = __esm({
|
|
|
3271
3317
|
*/
|
|
3272
3318
|
async suspend(options) {
|
|
3273
3319
|
const client = this.requireLifecycleClient("suspend");
|
|
3274
|
-
await client.suspend(this.
|
|
3320
|
+
await client.suspend(this.lifecycleIdentifier, options);
|
|
3275
3321
|
}
|
|
3276
3322
|
/**
|
|
3277
3323
|
* Resume this sandbox.
|
|
@@ -3281,7 +3327,7 @@ var init_sandbox = __esm({
|
|
|
3281
3327
|
*/
|
|
3282
3328
|
async resume(options) {
|
|
3283
3329
|
const client = this.requireLifecycleClient("resume");
|
|
3284
|
-
await client.resume(this.
|
|
3330
|
+
await client.resume(this.lifecycleIdentifier, options);
|
|
3285
3331
|
}
|
|
3286
3332
|
/**
|
|
3287
3333
|
* Create a snapshot of this sandbox's filesystem and wait for it to
|
|
@@ -3294,10 +3340,10 @@ var init_sandbox = __esm({
|
|
|
3294
3340
|
async checkpoint(options) {
|
|
3295
3341
|
const client = this.requireLifecycleClient("checkpoint");
|
|
3296
3342
|
if (options?.wait === false) {
|
|
3297
|
-
await client.snapshot(this.
|
|
3343
|
+
await client.snapshot(this.lifecycleIdentifier, { contentMode: options.contentMode });
|
|
3298
3344
|
return void 0;
|
|
3299
3345
|
}
|
|
3300
|
-
return client.snapshotAndWait(this.
|
|
3346
|
+
return client.snapshotAndWait(this.lifecycleIdentifier, {
|
|
3301
3347
|
timeout: options?.timeout,
|
|
3302
3348
|
pollInterval: options?.pollInterval,
|
|
3303
3349
|
contentMode: options?.contentMode
|
|
@@ -3309,7 +3355,8 @@ var init_sandbox = __esm({
|
|
|
3309
3355
|
async listSnapshots() {
|
|
3310
3356
|
const client = this.requireLifecycleClient("listSnapshots");
|
|
3311
3357
|
const all = await client.listSnapshots();
|
|
3312
|
-
|
|
3358
|
+
const filtered = all.filter((s) => s.sandboxId === this.lifecycleIdentifier);
|
|
3359
|
+
return Object.assign(filtered, { traceId: all.traceId });
|
|
3313
3360
|
}
|
|
3314
3361
|
/** Close the HTTP client. The sandbox keeps running. */
|
|
3315
3362
|
close() {
|
|
@@ -3322,7 +3369,7 @@ var init_sandbox = __esm({
|
|
|
3322
3369
|
this.lifecycleClient = null;
|
|
3323
3370
|
this.close();
|
|
3324
3371
|
if (client) {
|
|
3325
|
-
await client.delete(this.
|
|
3372
|
+
await client.delete(this.lifecycleIdentifier);
|
|
3326
3373
|
}
|
|
3327
3374
|
}
|
|
3328
3375
|
// --- High-level convenience ---
|
|
@@ -3403,7 +3450,8 @@ var init_sandbox = __esm({
|
|
|
3403
3450
|
"GET",
|
|
3404
3451
|
"/api/v1/processes"
|
|
3405
3452
|
);
|
|
3406
|
-
|
|
3453
|
+
const processes = (raw.processes ?? []).map((p) => fromSnakeKeys(p));
|
|
3454
|
+
return Object.assign(processes, { traceId: raw.traceId });
|
|
3407
3455
|
}
|
|
3408
3456
|
/** Get current status and metadata for a process by PID. */
|
|
3409
3457
|
async getProcess(pid) {
|
|
@@ -3740,7 +3788,7 @@ var init_client = __esm({
|
|
|
3740
3788
|
resources: {
|
|
3741
3789
|
cpus: options?.cpus ?? 1,
|
|
3742
3790
|
memory_mb: options?.memoryMb ?? 1024,
|
|
3743
|
-
|
|
3791
|
+
...options?.diskMb != null ? { disk_mb: options.diskMb } : {}
|
|
3744
3792
|
}
|
|
3745
3793
|
};
|
|
3746
3794
|
if (options?.image != null) body.image = options.image;
|
|
@@ -3778,9 +3826,10 @@ var init_client = __esm({
|
|
|
3778
3826
|
"GET",
|
|
3779
3827
|
this.path("sandboxes")
|
|
3780
3828
|
);
|
|
3781
|
-
|
|
3829
|
+
const sandboxes = (raw.sandboxes ?? []).map(
|
|
3782
3830
|
(s) => fromSnakeKeys(s, "sandboxId")
|
|
3783
3831
|
);
|
|
3832
|
+
return Object.assign(sandboxes, { traceId: raw.traceId });
|
|
3784
3833
|
}
|
|
3785
3834
|
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
3786
3835
|
async update(sandboxId, options) {
|
|
@@ -3950,9 +3999,10 @@ var init_client = __esm({
|
|
|
3950
3999
|
"GET",
|
|
3951
4000
|
this.path("snapshots")
|
|
3952
4001
|
);
|
|
3953
|
-
|
|
4002
|
+
const snapshots = (raw.snapshots ?? []).map(
|
|
3954
4003
|
(s) => fromSnakeKeys(s, "snapshotId")
|
|
3955
4004
|
);
|
|
4005
|
+
return Object.assign(snapshots, { traceId: raw.traceId });
|
|
3956
4006
|
}
|
|
3957
4007
|
/** Delete a snapshot by ID. */
|
|
3958
4008
|
async deleteSnapshot(snapshotId) {
|
|
@@ -4032,9 +4082,10 @@ var init_client = __esm({
|
|
|
4032
4082
|
"GET",
|
|
4033
4083
|
this.path("sandbox-pools")
|
|
4034
4084
|
);
|
|
4035
|
-
|
|
4085
|
+
const pools = (raw.pools ?? []).map(
|
|
4036
4086
|
(p) => fromSnakeKeys(p, "poolId")
|
|
4037
4087
|
);
|
|
4088
|
+
return Object.assign(pools, { traceId: raw.traceId });
|
|
4038
4089
|
}
|
|
4039
4090
|
/** Replace the configuration of an existing sandbox pool. */
|
|
4040
4091
|
async updatePool(poolId, options) {
|
|
@@ -4089,26 +4140,24 @@ var init_client = __esm({
|
|
|
4089
4140
|
*/
|
|
4090
4141
|
async createAndConnect(options) {
|
|
4091
4142
|
const startupTimeout = options?.startupTimeout ?? 60;
|
|
4092
|
-
|
|
4093
|
-
|
|
4094
|
-
|
|
4095
|
-
|
|
4096
|
-
result = await this.create(options);
|
|
4097
|
-
}
|
|
4098
|
-
if (result.status === "running" /* RUNNING */) {
|
|
4099
|
-
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
|
|
4143
|
+
const result = options?.poolId != null ? await this.claim(options.poolId) : await this.create(options);
|
|
4144
|
+
const requestedName = options?.poolId != null ? null : options?.name ?? null;
|
|
4145
|
+
const finishConnect = (routingHint, name) => {
|
|
4146
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, routingHint);
|
|
4100
4147
|
sandbox._setOwner(this);
|
|
4101
4148
|
sandbox.traceId = result.traceId;
|
|
4149
|
+
sandbox._setLifecycleIdentifier(result.sandboxId);
|
|
4150
|
+
sandbox._setName(name ?? requestedName);
|
|
4102
4151
|
return sandbox;
|
|
4152
|
+
};
|
|
4153
|
+
if (result.status === "running" /* RUNNING */) {
|
|
4154
|
+
return finishConnect(result.routingHint, result.name);
|
|
4103
4155
|
}
|
|
4104
4156
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
4105
4157
|
while (Date.now() < deadline) {
|
|
4106
4158
|
const info = await this.get(result.sandboxId);
|
|
4107
4159
|
if (info.status === "running" /* RUNNING */) {
|
|
4108
|
-
|
|
4109
|
-
sandbox._setOwner(this);
|
|
4110
|
-
sandbox.traceId = result.traceId;
|
|
4111
|
-
return sandbox;
|
|
4160
|
+
return finishConnect(info.routingHint, info.name);
|
|
4112
4161
|
}
|
|
4113
4162
|
if (info.status === "terminated" /* TERMINATED */) {
|
|
4114
4163
|
throw new SandboxError(
|
|
@@ -4950,7 +4999,8 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4950
4999
|
sandbox = await client.createAndConnect({
|
|
4951
5000
|
...plan.baseImage == null ? {} : { image: plan.baseImage },
|
|
4952
5001
|
cpus: options.cpus ?? 2,
|
|
4953
|
-
memoryMb: options.memoryMb ?? 4096
|
|
5002
|
+
memoryMb: options.memoryMb ?? 4096,
|
|
5003
|
+
...options.diskMb != null ? { diskMb: options.diskMb } : {}
|
|
4954
5004
|
});
|
|
4955
5005
|
emit({
|
|
4956
5006
|
type: "status",
|
|
@@ -4963,8 +5013,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4963
5013
|
});
|
|
4964
5014
|
emit({
|
|
4965
5015
|
type: "snapshot_created",
|
|
4966
|
-
snapshot_id: snapshot.snapshotId
|
|
4967
|
-
snapshot_uri: snapshot.snapshotUri ?? null
|
|
5016
|
+
snapshot_id: snapshot.snapshotId
|
|
4968
5017
|
});
|
|
4969
5018
|
if (!snapshot.snapshotUri) {
|
|
4970
5019
|
throw new Error(
|
|
@@ -5008,27 +5057,33 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
5008
5057
|
name: { type: "string", short: "n" },
|
|
5009
5058
|
cpus: { type: "string" },
|
|
5010
5059
|
memory: { type: "string" },
|
|
5060
|
+
disk: { type: "string" },
|
|
5011
5061
|
public: { type: "boolean", default: false }
|
|
5012
5062
|
}
|
|
5013
5063
|
});
|
|
5014
5064
|
const dockerfilePath = parsed.positionals[0];
|
|
5015
5065
|
if (!dockerfilePath) {
|
|
5016
|
-
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--public]");
|
|
5066
|
+
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk GB] [--public]");
|
|
5017
5067
|
}
|
|
5018
5068
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
5019
5069
|
const memoryMb = parsed.values.memory != null ? Number(parsed.values.memory) : void 0;
|
|
5070
|
+
const diskGb = parsed.values.disk != null ? Number(parsed.values.disk) : void 0;
|
|
5020
5071
|
if (cpus != null && !Number.isFinite(cpus)) {
|
|
5021
5072
|
throw new Error(`Invalid --cpus value: ${parsed.values.cpus}`);
|
|
5022
5073
|
}
|
|
5023
5074
|
if (memoryMb != null && !Number.isInteger(memoryMb)) {
|
|
5024
5075
|
throw new Error(`Invalid --memory value: ${parsed.values.memory}`);
|
|
5025
5076
|
}
|
|
5077
|
+
if (diskGb != null && !Number.isInteger(diskGb)) {
|
|
5078
|
+
throw new Error(`Invalid --disk value: ${parsed.values.disk}`);
|
|
5079
|
+
}
|
|
5026
5080
|
await createSandboxImage(
|
|
5027
5081
|
dockerfilePath,
|
|
5028
5082
|
{
|
|
5029
5083
|
registeredName: parsed.values.name,
|
|
5030
5084
|
cpus,
|
|
5031
5085
|
memoryMb,
|
|
5086
|
+
diskMb: diskGb != null ? diskGb * 1024 : void 0,
|
|
5032
5087
|
isPublic: parsed.values.public
|
|
5033
5088
|
},
|
|
5034
5089
|
{ emit: ndjsonStdoutEmit }
|