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
|
@@ -54,7 +54,8 @@ interface CreateSandboxOptions {
|
|
|
54
54
|
image?: string;
|
|
55
55
|
cpus?: number;
|
|
56
56
|
memoryMb?: number;
|
|
57
|
-
|
|
57
|
+
/** Root disk size in megabytes. When omitted, the server uses its default disk size. */
|
|
58
|
+
diskMb?: number;
|
|
58
59
|
secretNames?: string[];
|
|
59
60
|
timeoutSecs?: number;
|
|
60
61
|
entrypoint?: string[];
|
|
@@ -77,6 +78,7 @@ interface CreateSandboxResponse {
|
|
|
77
78
|
sandboxId: string;
|
|
78
79
|
status: SandboxStatus;
|
|
79
80
|
routingHint?: string;
|
|
81
|
+
name?: string | null;
|
|
80
82
|
}
|
|
81
83
|
interface SandboxInfo {
|
|
82
84
|
sandboxId: string;
|
|
@@ -357,6 +359,7 @@ interface CreateSandboxImageOptions {
|
|
|
357
359
|
registeredName?: string;
|
|
358
360
|
cpus?: number;
|
|
359
361
|
memoryMb?: number;
|
|
362
|
+
diskMb?: number;
|
|
360
363
|
isPublic?: boolean;
|
|
361
364
|
contextDir?: string;
|
|
362
365
|
/**
|
|
@@ -400,6 +403,7 @@ interface BuildClient {
|
|
|
400
403
|
image?: string;
|
|
401
404
|
cpus?: number;
|
|
402
405
|
memoryMb?: number;
|
|
406
|
+
diskMb?: number;
|
|
403
407
|
}): Promise<BuildSandbox>;
|
|
404
408
|
snapshotAndWait(sandboxId: string, options?: {
|
|
405
409
|
timeout?: number;
|
|
@@ -424,4 +428,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
|
|
|
424
428
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
425
429
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
426
430
|
|
|
427
|
-
export { loadDockerfilePlan as $, type
|
|
431
|
+
export { loadDockerfilePlan as $, type DirectoryEntry as A, type DockerfileBuildPlan as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileInstruction as E, type ImageBuildOperation as F, ImageBuildOperationType as G, type HealthResponse as H, Image as I, type ImageOptions as J, OutputMode as K, type ListDirectoryResponse as L, type PoolContainerInfo as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, ProcessStatus as Q, type RunOptions as R, type SandboxOptions as S, type SandboxImageSource as T, type UpdateSandboxOptions as U, type SnapshotContentMode as V, SnapshotStatus as W, StdinMode as X, createSandboxImage as Y, dockerfileContent as Z, defaultRegisteredName as _, type CreateAndConnectOptions as a, loadImagePlan as a0, logicalDockerfileLines as a1, runCreateSandboxImageCli as a2, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type ContainerResourcesInfo as x, ContainerState as y, type CreateSandboxImageOptions as z };
|
|
@@ -54,7 +54,8 @@ interface CreateSandboxOptions {
|
|
|
54
54
|
image?: string;
|
|
55
55
|
cpus?: number;
|
|
56
56
|
memoryMb?: number;
|
|
57
|
-
|
|
57
|
+
/** Root disk size in megabytes. When omitted, the server uses its default disk size. */
|
|
58
|
+
diskMb?: number;
|
|
58
59
|
secretNames?: string[];
|
|
59
60
|
timeoutSecs?: number;
|
|
60
61
|
entrypoint?: string[];
|
|
@@ -77,6 +78,7 @@ interface CreateSandboxResponse {
|
|
|
77
78
|
sandboxId: string;
|
|
78
79
|
status: SandboxStatus;
|
|
79
80
|
routingHint?: string;
|
|
81
|
+
name?: string | null;
|
|
80
82
|
}
|
|
81
83
|
interface SandboxInfo {
|
|
82
84
|
sandboxId: string;
|
|
@@ -357,6 +359,7 @@ interface CreateSandboxImageOptions {
|
|
|
357
359
|
registeredName?: string;
|
|
358
360
|
cpus?: number;
|
|
359
361
|
memoryMb?: number;
|
|
362
|
+
diskMb?: number;
|
|
360
363
|
isPublic?: boolean;
|
|
361
364
|
contextDir?: string;
|
|
362
365
|
/**
|
|
@@ -400,6 +403,7 @@ interface BuildClient {
|
|
|
400
403
|
image?: string;
|
|
401
404
|
cpus?: number;
|
|
402
405
|
memoryMb?: number;
|
|
406
|
+
diskMb?: number;
|
|
403
407
|
}): Promise<BuildSandbox>;
|
|
404
408
|
snapshotAndWait(sandboxId: string, options?: {
|
|
405
409
|
timeout?: number;
|
|
@@ -424,4 +428,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
|
|
|
424
428
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
425
429
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
426
430
|
|
|
427
|
-
export { loadDockerfilePlan as $, type
|
|
431
|
+
export { loadDockerfilePlan as $, type DirectoryEntry as A, type DockerfileBuildPlan as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileInstruction as E, type ImageBuildOperation as F, ImageBuildOperationType as G, type HealthResponse as H, Image as I, type ImageOptions as J, OutputMode as K, type ListDirectoryResponse as L, type PoolContainerInfo as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, ProcessStatus as Q, type RunOptions as R, type SandboxOptions as S, type SandboxImageSource as T, type UpdateSandboxOptions as U, type SnapshotContentMode as V, SnapshotStatus as W, StdinMode as X, createSandboxImage as Y, dockerfileContent as Z, defaultRegisteredName as _, type CreateAndConnectOptions as a, loadImagePlan as a0, logicalDockerfileLines as a1, runCreateSandboxImageCli as a2, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, SandboxStatus as e, type SandboxInfo as f, type SuspendResumeOptions as g, type CheckpointOptions as h, type CommandResult as i, type StartProcessOptions as j, type SendSignalResponse as k, type OutputEvent as l, type PtySessionInfo as m, type CreateSandboxOptions as n, type CreateSandboxResponse as o, type SandboxPortAccess as p, type SnapshotOptions as q, type CreateSnapshotResponse as r, type SnapshotAndWaitOptions as s, type CreatePoolOptions as t, type CreateSandboxPoolResponse as u, type SandboxPoolInfo as v, type UpdatePoolOptions as w, type ContainerResourcesInfo as x, ContainerState as y, type CreateSandboxImageOptions as z };
|
package/dist/sandbox-image.cjs
CHANGED
|
@@ -3121,8 +3121,11 @@ var init_sandbox = __esm({
|
|
|
3121
3121
|
wsHeaders;
|
|
3122
3122
|
ownsSandbox = false;
|
|
3123
3123
|
lifecycleClient = null;
|
|
3124
|
+
lifecycleIdentifier;
|
|
3125
|
+
sandboxName = null;
|
|
3124
3126
|
constructor(options) {
|
|
3125
3127
|
this.sandboxId = options.sandboxId;
|
|
3128
|
+
this.lifecycleIdentifier = options.sandboxId;
|
|
3126
3129
|
const proxyUrl = options.proxyUrl ?? SANDBOX_PROXY_URL;
|
|
3127
3130
|
const { baseUrl, hostHeader } = resolveProxyTarget(proxyUrl, options.sandboxId);
|
|
3128
3131
|
this.baseUrl = baseUrl;
|
|
@@ -3148,6 +3151,17 @@ var init_sandbox = __esm({
|
|
|
3148
3151
|
routingHint: options.routingHint
|
|
3149
3152
|
});
|
|
3150
3153
|
}
|
|
3154
|
+
get name() {
|
|
3155
|
+
return this.sandboxName;
|
|
3156
|
+
}
|
|
3157
|
+
/** @internal Used by client wiring to keep locally cached name in sync. */
|
|
3158
|
+
_setName(name) {
|
|
3159
|
+
this.sandboxName = name;
|
|
3160
|
+
}
|
|
3161
|
+
/** @internal Used by lifecycle operations to pin to canonical sandbox ID. */
|
|
3162
|
+
_setLifecycleIdentifier(identifier) {
|
|
3163
|
+
this.lifecycleIdentifier = identifier;
|
|
3164
|
+
}
|
|
3151
3165
|
/** @internal Used by SandboxClient.createAndConnect to set ownership. */
|
|
3152
3166
|
_setOwner(client) {
|
|
3153
3167
|
this.ownsSandbox = true;
|
|
@@ -3185,9 +3199,15 @@ var init_sandbox = __esm({
|
|
|
3185
3199
|
/* _internal */
|
|
3186
3200
|
true
|
|
3187
3201
|
);
|
|
3188
|
-
await client.get(options.sandboxId);
|
|
3189
|
-
const sandbox = client.connect(
|
|
3202
|
+
const info = await client.get(options.sandboxId);
|
|
3203
|
+
const sandbox = client.connect(
|
|
3204
|
+
info.sandboxId,
|
|
3205
|
+
options.proxyUrl,
|
|
3206
|
+
options.routingHint ?? info.routingHint
|
|
3207
|
+
);
|
|
3190
3208
|
sandbox.lifecycleClient = client;
|
|
3209
|
+
sandbox._setLifecycleIdentifier(info.sandboxId);
|
|
3210
|
+
sandbox._setName(info.name ?? null);
|
|
3191
3211
|
return sandbox;
|
|
3192
3212
|
}
|
|
3193
3213
|
// --- Static snapshot management ---
|
|
@@ -3220,6 +3240,32 @@ var init_sandbox = __esm({
|
|
|
3220
3240
|
}
|
|
3221
3241
|
return this.lifecycleClient;
|
|
3222
3242
|
}
|
|
3243
|
+
/**
|
|
3244
|
+
* Fetch the current sandbox status from the server.
|
|
3245
|
+
*
|
|
3246
|
+
* Always hits the network — the value is not cached locally because the
|
|
3247
|
+
* status changes over the sandbox's lifecycle.
|
|
3248
|
+
*/
|
|
3249
|
+
async status() {
|
|
3250
|
+
const client = this.requireLifecycleClient("read_status");
|
|
3251
|
+
const info = await client.get(this.lifecycleIdentifier);
|
|
3252
|
+
this._setLifecycleIdentifier(info.sandboxId);
|
|
3253
|
+
this._setName(info.name ?? null);
|
|
3254
|
+
return info.status;
|
|
3255
|
+
}
|
|
3256
|
+
/**
|
|
3257
|
+
* Update this sandbox's properties (name, exposed ports, proxy auth).
|
|
3258
|
+
*
|
|
3259
|
+
* Naming an ephemeral sandbox makes it non-ephemeral and enables
|
|
3260
|
+
* suspend/resume.
|
|
3261
|
+
*/
|
|
3262
|
+
async update(options) {
|
|
3263
|
+
const client = this.requireLifecycleClient("update");
|
|
3264
|
+
const info = await client.update(this.lifecycleIdentifier, options);
|
|
3265
|
+
this._setLifecycleIdentifier(info.sandboxId);
|
|
3266
|
+
this._setName(info.name ?? null);
|
|
3267
|
+
return info;
|
|
3268
|
+
}
|
|
3223
3269
|
/**
|
|
3224
3270
|
* Suspend this sandbox.
|
|
3225
3271
|
*
|
|
@@ -3228,7 +3274,7 @@ var init_sandbox = __esm({
|
|
|
3228
3274
|
*/
|
|
3229
3275
|
async suspend(options) {
|
|
3230
3276
|
const client = this.requireLifecycleClient("suspend");
|
|
3231
|
-
await client.suspend(this.
|
|
3277
|
+
await client.suspend(this.lifecycleIdentifier, options);
|
|
3232
3278
|
}
|
|
3233
3279
|
/**
|
|
3234
3280
|
* Resume this sandbox.
|
|
@@ -3238,7 +3284,7 @@ var init_sandbox = __esm({
|
|
|
3238
3284
|
*/
|
|
3239
3285
|
async resume(options) {
|
|
3240
3286
|
const client = this.requireLifecycleClient("resume");
|
|
3241
|
-
await client.resume(this.
|
|
3287
|
+
await client.resume(this.lifecycleIdentifier, options);
|
|
3242
3288
|
}
|
|
3243
3289
|
/**
|
|
3244
3290
|
* Create a snapshot of this sandbox's filesystem and wait for it to
|
|
@@ -3251,10 +3297,10 @@ var init_sandbox = __esm({
|
|
|
3251
3297
|
async checkpoint(options) {
|
|
3252
3298
|
const client = this.requireLifecycleClient("checkpoint");
|
|
3253
3299
|
if (options?.wait === false) {
|
|
3254
|
-
await client.snapshot(this.
|
|
3300
|
+
await client.snapshot(this.lifecycleIdentifier, { contentMode: options.contentMode });
|
|
3255
3301
|
return void 0;
|
|
3256
3302
|
}
|
|
3257
|
-
return client.snapshotAndWait(this.
|
|
3303
|
+
return client.snapshotAndWait(this.lifecycleIdentifier, {
|
|
3258
3304
|
timeout: options?.timeout,
|
|
3259
3305
|
pollInterval: options?.pollInterval,
|
|
3260
3306
|
contentMode: options?.contentMode
|
|
@@ -3266,7 +3312,8 @@ var init_sandbox = __esm({
|
|
|
3266
3312
|
async listSnapshots() {
|
|
3267
3313
|
const client = this.requireLifecycleClient("listSnapshots");
|
|
3268
3314
|
const all = await client.listSnapshots();
|
|
3269
|
-
|
|
3315
|
+
const filtered = all.filter((s) => s.sandboxId === this.lifecycleIdentifier);
|
|
3316
|
+
return Object.assign(filtered, { traceId: all.traceId });
|
|
3270
3317
|
}
|
|
3271
3318
|
/** Close the HTTP client. The sandbox keeps running. */
|
|
3272
3319
|
close() {
|
|
@@ -3279,7 +3326,7 @@ var init_sandbox = __esm({
|
|
|
3279
3326
|
this.lifecycleClient = null;
|
|
3280
3327
|
this.close();
|
|
3281
3328
|
if (client) {
|
|
3282
|
-
await client.delete(this.
|
|
3329
|
+
await client.delete(this.lifecycleIdentifier);
|
|
3283
3330
|
}
|
|
3284
3331
|
}
|
|
3285
3332
|
// --- High-level convenience ---
|
|
@@ -3360,7 +3407,8 @@ var init_sandbox = __esm({
|
|
|
3360
3407
|
"GET",
|
|
3361
3408
|
"/api/v1/processes"
|
|
3362
3409
|
);
|
|
3363
|
-
|
|
3410
|
+
const processes = (raw.processes ?? []).map((p) => fromSnakeKeys(p));
|
|
3411
|
+
return Object.assign(processes, { traceId: raw.traceId });
|
|
3364
3412
|
}
|
|
3365
3413
|
/** Get current status and metadata for a process by PID. */
|
|
3366
3414
|
async getProcess(pid) {
|
|
@@ -3697,7 +3745,7 @@ var init_client = __esm({
|
|
|
3697
3745
|
resources: {
|
|
3698
3746
|
cpus: options?.cpus ?? 1,
|
|
3699
3747
|
memory_mb: options?.memoryMb ?? 1024,
|
|
3700
|
-
|
|
3748
|
+
...options?.diskMb != null ? { disk_mb: options.diskMb } : {}
|
|
3701
3749
|
}
|
|
3702
3750
|
};
|
|
3703
3751
|
if (options?.image != null) body.image = options.image;
|
|
@@ -3735,9 +3783,10 @@ var init_client = __esm({
|
|
|
3735
3783
|
"GET",
|
|
3736
3784
|
this.path("sandboxes")
|
|
3737
3785
|
);
|
|
3738
|
-
|
|
3786
|
+
const sandboxes = (raw.sandboxes ?? []).map(
|
|
3739
3787
|
(s) => fromSnakeKeys(s, "sandboxId")
|
|
3740
3788
|
);
|
|
3789
|
+
return Object.assign(sandboxes, { traceId: raw.traceId });
|
|
3741
3790
|
}
|
|
3742
3791
|
/** Update sandbox properties such as name, exposed ports, and proxy auth settings. */
|
|
3743
3792
|
async update(sandboxId, options) {
|
|
@@ -3907,9 +3956,10 @@ var init_client = __esm({
|
|
|
3907
3956
|
"GET",
|
|
3908
3957
|
this.path("snapshots")
|
|
3909
3958
|
);
|
|
3910
|
-
|
|
3959
|
+
const snapshots = (raw.snapshots ?? []).map(
|
|
3911
3960
|
(s) => fromSnakeKeys(s, "snapshotId")
|
|
3912
3961
|
);
|
|
3962
|
+
return Object.assign(snapshots, { traceId: raw.traceId });
|
|
3913
3963
|
}
|
|
3914
3964
|
/** Delete a snapshot by ID. */
|
|
3915
3965
|
async deleteSnapshot(snapshotId) {
|
|
@@ -3989,9 +4039,10 @@ var init_client = __esm({
|
|
|
3989
4039
|
"GET",
|
|
3990
4040
|
this.path("sandbox-pools")
|
|
3991
4041
|
);
|
|
3992
|
-
|
|
4042
|
+
const pools = (raw.pools ?? []).map(
|
|
3993
4043
|
(p) => fromSnakeKeys(p, "poolId")
|
|
3994
4044
|
);
|
|
4045
|
+
return Object.assign(pools, { traceId: raw.traceId });
|
|
3995
4046
|
}
|
|
3996
4047
|
/** Replace the configuration of an existing sandbox pool. */
|
|
3997
4048
|
async updatePool(poolId, options) {
|
|
@@ -4046,26 +4097,24 @@ var init_client = __esm({
|
|
|
4046
4097
|
*/
|
|
4047
4098
|
async createAndConnect(options) {
|
|
4048
4099
|
const startupTimeout = options?.startupTimeout ?? 60;
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
result = await this.create(options);
|
|
4054
|
-
}
|
|
4055
|
-
if (result.status === "running" /* RUNNING */) {
|
|
4056
|
-
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
|
|
4100
|
+
const result = options?.poolId != null ? await this.claim(options.poolId) : await this.create(options);
|
|
4101
|
+
const requestedName = options?.poolId != null ? null : options?.name ?? null;
|
|
4102
|
+
const finishConnect = (routingHint, name) => {
|
|
4103
|
+
const sandbox = this.connect(result.sandboxId, options?.proxyUrl, routingHint);
|
|
4057
4104
|
sandbox._setOwner(this);
|
|
4058
4105
|
sandbox.traceId = result.traceId;
|
|
4106
|
+
sandbox._setLifecycleIdentifier(result.sandboxId);
|
|
4107
|
+
sandbox._setName(name ?? requestedName);
|
|
4059
4108
|
return sandbox;
|
|
4109
|
+
};
|
|
4110
|
+
if (result.status === "running" /* RUNNING */) {
|
|
4111
|
+
return finishConnect(result.routingHint, result.name);
|
|
4060
4112
|
}
|
|
4061
4113
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
4062
4114
|
while (Date.now() < deadline) {
|
|
4063
4115
|
const info = await this.get(result.sandboxId);
|
|
4064
4116
|
if (info.status === "running" /* RUNNING */) {
|
|
4065
|
-
|
|
4066
|
-
sandbox._setOwner(this);
|
|
4067
|
-
sandbox.traceId = result.traceId;
|
|
4068
|
-
return sandbox;
|
|
4117
|
+
return finishConnect(info.routingHint, info.name);
|
|
4069
4118
|
}
|
|
4070
4119
|
if (info.status === "terminated" /* TERMINATED */) {
|
|
4071
4120
|
throw new SandboxError(
|
|
@@ -4811,7 +4860,8 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4811
4860
|
sandbox = await client.createAndConnect({
|
|
4812
4861
|
...plan.baseImage == null ? {} : { image: plan.baseImage },
|
|
4813
4862
|
cpus: options.cpus ?? 2,
|
|
4814
|
-
memoryMb: options.memoryMb ?? 4096
|
|
4863
|
+
memoryMb: options.memoryMb ?? 4096,
|
|
4864
|
+
...options.diskMb != null ? { diskMb: options.diskMb } : {}
|
|
4815
4865
|
});
|
|
4816
4866
|
emit({
|
|
4817
4867
|
type: "status",
|
|
@@ -4824,8 +4874,7 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4824
4874
|
});
|
|
4825
4875
|
emit({
|
|
4826
4876
|
type: "snapshot_created",
|
|
4827
|
-
snapshot_id: snapshot.snapshotId
|
|
4828
|
-
snapshot_uri: snapshot.snapshotUri ?? null
|
|
4877
|
+
snapshot_id: snapshot.snapshotId
|
|
4829
4878
|
});
|
|
4830
4879
|
if (!snapshot.snapshotUri) {
|
|
4831
4880
|
throw new Error(
|
|
@@ -4869,27 +4918,33 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
4869
4918
|
name: { type: "string", short: "n" },
|
|
4870
4919
|
cpus: { type: "string" },
|
|
4871
4920
|
memory: { type: "string" },
|
|
4921
|
+
disk: { type: "string" },
|
|
4872
4922
|
public: { type: "boolean", default: false }
|
|
4873
4923
|
}
|
|
4874
4924
|
});
|
|
4875
4925
|
const dockerfilePath = parsed.positionals[0];
|
|
4876
4926
|
if (!dockerfilePath) {
|
|
4877
|
-
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--public]");
|
|
4927
|
+
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk GB] [--public]");
|
|
4878
4928
|
}
|
|
4879
4929
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
4880
4930
|
const memoryMb = parsed.values.memory != null ? Number(parsed.values.memory) : void 0;
|
|
4931
|
+
const diskGb = parsed.values.disk != null ? Number(parsed.values.disk) : void 0;
|
|
4881
4932
|
if (cpus != null && !Number.isFinite(cpus)) {
|
|
4882
4933
|
throw new Error(`Invalid --cpus value: ${parsed.values.cpus}`);
|
|
4883
4934
|
}
|
|
4884
4935
|
if (memoryMb != null && !Number.isInteger(memoryMb)) {
|
|
4885
4936
|
throw new Error(`Invalid --memory value: ${parsed.values.memory}`);
|
|
4886
4937
|
}
|
|
4938
|
+
if (diskGb != null && !Number.isInteger(diskGb)) {
|
|
4939
|
+
throw new Error(`Invalid --disk value: ${parsed.values.disk}`);
|
|
4940
|
+
}
|
|
4887
4941
|
await createSandboxImage(
|
|
4888
4942
|
dockerfilePath,
|
|
4889
4943
|
{
|
|
4890
4944
|
registeredName: parsed.values.name,
|
|
4891
4945
|
cpus,
|
|
4892
4946
|
memoryMb,
|
|
4947
|
+
diskMb: diskGb != null ? diskGb * 1024 : void 0,
|
|
4893
4948
|
isPublic: parsed.values.public
|
|
4894
4949
|
},
|
|
4895
4950
|
{ emit: ndjsonStdoutEmit }
|