tensorlake 0.5.1 → 0.5.3
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 +69 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +69 -10
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-CEGsGg4V.d.cts → sandbox-image-B0WMhyoM.d.cts} +6 -1
- package/dist/{sandbox-image-CEGsGg4V.d.ts → sandbox-image-B0WMhyoM.d.ts} +6 -1
- package/dist/sandbox-image.cjs +69 -10
- 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 +69 -10
- 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 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-
|
|
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-
|
|
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-B0WMhyoM.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-B0WMhyoM.cjs';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
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 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-
|
|
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-
|
|
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-B0WMhyoM.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-B0WMhyoM.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* The return value of every SDK operation. Carries the W3C `trace_id` so callers
|
package/dist/index.js
CHANGED
|
@@ -3703,6 +3703,38 @@ __export(client_exports, {
|
|
|
3703
3703
|
function sleep2(ms) {
|
|
3704
3704
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3705
3705
|
}
|
|
3706
|
+
function formatStartupFailureMessage(sandboxId, status, options) {
|
|
3707
|
+
const prefix = status === "terminated" /* TERMINATED */ ? `Sandbox ${sandboxId} terminated during startup` : `Sandbox ${sandboxId} became ${status} during startup`;
|
|
3708
|
+
const detail = formatErrorDetails(options.errorDetails);
|
|
3709
|
+
if (detail) {
|
|
3710
|
+
return `${prefix}: ${detail}`;
|
|
3711
|
+
}
|
|
3712
|
+
if (options.terminationReason) {
|
|
3713
|
+
return `${prefix}: termination reason: ${options.terminationReason}`;
|
|
3714
|
+
}
|
|
3715
|
+
return prefix;
|
|
3716
|
+
}
|
|
3717
|
+
function formatErrorDetails(errorDetails) {
|
|
3718
|
+
if (errorDetails == null) return void 0;
|
|
3719
|
+
if (typeof errorDetails === "string") {
|
|
3720
|
+
const detail = errorDetails.trim();
|
|
3721
|
+
return detail || void 0;
|
|
3722
|
+
}
|
|
3723
|
+
if (Array.isArray(errorDetails)) {
|
|
3724
|
+
const parts = errorDetails.map((item) => formatErrorDetails(item)).filter((item) => Boolean(item));
|
|
3725
|
+
return parts.length > 0 ? parts.join("; ") : JSON.stringify(errorDetails);
|
|
3726
|
+
}
|
|
3727
|
+
if (typeof errorDetails === "object") {
|
|
3728
|
+
for (const key of ["message", "detail", "error", "reason"]) {
|
|
3729
|
+
const value = errorDetails[key];
|
|
3730
|
+
if (typeof value === "string" && value.trim()) {
|
|
3731
|
+
return value.trim();
|
|
3732
|
+
}
|
|
3733
|
+
}
|
|
3734
|
+
return JSON.stringify(errorDetails);
|
|
3735
|
+
}
|
|
3736
|
+
return String(errorDetails);
|
|
3737
|
+
}
|
|
3706
3738
|
function normalizeUserPorts(ports) {
|
|
3707
3739
|
return dedupeAndSortPorts(ports.map(validateUserPort));
|
|
3708
3740
|
}
|
|
@@ -4153,15 +4185,26 @@ var init_client = __esm({
|
|
|
4153
4185
|
if (result.status === "running" /* RUNNING */) {
|
|
4154
4186
|
return finishConnect(result.routingHint, result.name);
|
|
4155
4187
|
}
|
|
4188
|
+
if (result.status === "suspended" /* SUSPENDED */ || result.status === "terminated" /* TERMINATED */) {
|
|
4189
|
+
throw new SandboxError(
|
|
4190
|
+
formatStartupFailureMessage(result.sandboxId, result.status, {
|
|
4191
|
+
errorDetails: result.errorDetails,
|
|
4192
|
+
terminationReason: result.terminationReason
|
|
4193
|
+
})
|
|
4194
|
+
);
|
|
4195
|
+
}
|
|
4156
4196
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
4157
4197
|
while (Date.now() < deadline) {
|
|
4158
4198
|
const info = await this.get(result.sandboxId);
|
|
4159
4199
|
if (info.status === "running" /* RUNNING */) {
|
|
4160
4200
|
return finishConnect(info.routingHint, info.name);
|
|
4161
4201
|
}
|
|
4162
|
-
if (info.status === "terminated" /* TERMINATED */) {
|
|
4202
|
+
if (info.status === "suspended" /* SUSPENDED */ || info.status === "terminated" /* TERMINATED */) {
|
|
4163
4203
|
throw new SandboxError(
|
|
4164
|
-
|
|
4204
|
+
formatStartupFailureMessage(result.sandboxId, info.status, {
|
|
4205
|
+
errorDetails: info.errorDetails,
|
|
4206
|
+
terminationReason: info.terminationReason
|
|
4207
|
+
})
|
|
4165
4208
|
);
|
|
4166
4209
|
}
|
|
4167
4210
|
await sleep2(500);
|
|
@@ -4941,7 +4984,7 @@ async function executeDockerfilePlan(sandbox, plan, emit, sleep3) {
|
|
|
4941
4984
|
);
|
|
4942
4985
|
}
|
|
4943
4986
|
}
|
|
4944
|
-
async function registerImage(context, name, dockerfile, snapshotId, snapshotUri, isPublic) {
|
|
4987
|
+
async function registerImage(context, name, dockerfile, snapshotId, snapshotSandboxId, snapshotUri, snapshotSizeBytes, rootfsDiskBytes, isPublic) {
|
|
4945
4988
|
if (!context.organizationId || !context.projectId) {
|
|
4946
4989
|
throw new Error(
|
|
4947
4990
|
"Organization ID and Project ID are required. Run 'tl login' and 'tl init'."
|
|
@@ -4968,8 +5011,11 @@ async function registerImage(context, name, dockerfile, snapshotId, snapshotUri,
|
|
|
4968
5011
|
name,
|
|
4969
5012
|
dockerfile,
|
|
4970
5013
|
snapshotId,
|
|
5014
|
+
snapshotSandboxId,
|
|
4971
5015
|
snapshotUri,
|
|
4972
|
-
|
|
5016
|
+
snapshotSizeBytes,
|
|
5017
|
+
rootfsDiskBytes,
|
|
5018
|
+
public: isPublic
|
|
4973
5019
|
})
|
|
4974
5020
|
});
|
|
4975
5021
|
if (!response.ok) {
|
|
@@ -5020,6 +5066,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5020
5066
|
`Snapshot ${snapshot.snapshotId} is missing snapshotUri and cannot be registered as a sandbox image.`
|
|
5021
5067
|
);
|
|
5022
5068
|
}
|
|
5069
|
+
if (snapshot.sizeBytes == null) {
|
|
5070
|
+
throw new Error(
|
|
5071
|
+
`Snapshot ${snapshot.snapshotId} is missing sizeBytes and cannot be registered as a sandbox image.`
|
|
5072
|
+
);
|
|
5073
|
+
}
|
|
5074
|
+
if (snapshot.rootfsDiskBytes == null) {
|
|
5075
|
+
throw new Error(
|
|
5076
|
+
`Snapshot ${snapshot.snapshotId} is missing rootfsDiskBytes and cannot be registered as a sandbox image.`
|
|
5077
|
+
);
|
|
5078
|
+
}
|
|
5023
5079
|
emit({
|
|
5024
5080
|
type: "status",
|
|
5025
5081
|
message: `Registering image '${plan.registeredName}'...`
|
|
@@ -5029,7 +5085,10 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5029
5085
|
plan.registeredName,
|
|
5030
5086
|
plan.dockerfileText,
|
|
5031
5087
|
snapshot.snapshotId,
|
|
5088
|
+
snapshot.sandboxId,
|
|
5032
5089
|
snapshot.snapshotUri,
|
|
5090
|
+
snapshot.sizeBytes,
|
|
5091
|
+
snapshot.rootfsDiskBytes,
|
|
5033
5092
|
options.isPublic ?? false
|
|
5034
5093
|
);
|
|
5035
5094
|
emit({
|
|
@@ -5057,25 +5116,25 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
5057
5116
|
name: { type: "string", short: "n" },
|
|
5058
5117
|
cpus: { type: "string" },
|
|
5059
5118
|
memory: { type: "string" },
|
|
5060
|
-
|
|
5119
|
+
disk_mb: { type: "string" },
|
|
5061
5120
|
public: { type: "boolean", default: false }
|
|
5062
5121
|
}
|
|
5063
5122
|
});
|
|
5064
5123
|
const dockerfilePath = parsed.positionals[0];
|
|
5065
5124
|
if (!dockerfilePath) {
|
|
5066
|
-
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--
|
|
5125
|
+
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk_mb MB] [--public]");
|
|
5067
5126
|
}
|
|
5068
5127
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
5069
5128
|
const memoryMb = parsed.values.memory != null ? Number(parsed.values.memory) : void 0;
|
|
5070
|
-
const
|
|
5129
|
+
const diskMb = parsed.values.disk_mb != null ? Number(parsed.values.disk_mb) : void 0;
|
|
5071
5130
|
if (cpus != null && !Number.isFinite(cpus)) {
|
|
5072
5131
|
throw new Error(`Invalid --cpus value: ${parsed.values.cpus}`);
|
|
5073
5132
|
}
|
|
5074
5133
|
if (memoryMb != null && !Number.isInteger(memoryMb)) {
|
|
5075
5134
|
throw new Error(`Invalid --memory value: ${parsed.values.memory}`);
|
|
5076
5135
|
}
|
|
5077
|
-
if (
|
|
5078
|
-
throw new Error(`Invalid --
|
|
5136
|
+
if (diskMb != null && !Number.isInteger(diskMb)) {
|
|
5137
|
+
throw new Error(`Invalid --disk_mb value: ${parsed.values.disk_mb}`);
|
|
5079
5138
|
}
|
|
5080
5139
|
await createSandboxImage(
|
|
5081
5140
|
dockerfilePath,
|
|
@@ -5083,7 +5142,7 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
5083
5142
|
registeredName: parsed.values.name,
|
|
5084
5143
|
cpus,
|
|
5085
5144
|
memoryMb,
|
|
5086
|
-
diskMb
|
|
5145
|
+
diskMb,
|
|
5087
5146
|
isPublic: parsed.values.public
|
|
5088
5147
|
},
|
|
5089
5148
|
{ emit: ndjsonStdoutEmit }
|