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
|
Binary file
|
package/dist/bin/darwin-arm64/tl
CHANGED
|
Binary file
|
|
Binary file
|
package/dist/bin/linux-x64/tl
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -3721,6 +3721,38 @@ __export(client_exports, {
|
|
|
3721
3721
|
function sleep2(ms) {
|
|
3722
3722
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3723
3723
|
}
|
|
3724
|
+
function formatStartupFailureMessage(sandboxId, status, options) {
|
|
3725
|
+
const prefix = status === "terminated" /* TERMINATED */ ? `Sandbox ${sandboxId} terminated during startup` : `Sandbox ${sandboxId} became ${status} during startup`;
|
|
3726
|
+
const detail = formatErrorDetails(options.errorDetails);
|
|
3727
|
+
if (detail) {
|
|
3728
|
+
return `${prefix}: ${detail}`;
|
|
3729
|
+
}
|
|
3730
|
+
if (options.terminationReason) {
|
|
3731
|
+
return `${prefix}: termination reason: ${options.terminationReason}`;
|
|
3732
|
+
}
|
|
3733
|
+
return prefix;
|
|
3734
|
+
}
|
|
3735
|
+
function formatErrorDetails(errorDetails) {
|
|
3736
|
+
if (errorDetails == null) return void 0;
|
|
3737
|
+
if (typeof errorDetails === "string") {
|
|
3738
|
+
const detail = errorDetails.trim();
|
|
3739
|
+
return detail || void 0;
|
|
3740
|
+
}
|
|
3741
|
+
if (Array.isArray(errorDetails)) {
|
|
3742
|
+
const parts = errorDetails.map((item) => formatErrorDetails(item)).filter((item) => Boolean(item));
|
|
3743
|
+
return parts.length > 0 ? parts.join("; ") : JSON.stringify(errorDetails);
|
|
3744
|
+
}
|
|
3745
|
+
if (typeof errorDetails === "object") {
|
|
3746
|
+
for (const key of ["message", "detail", "error", "reason"]) {
|
|
3747
|
+
const value = errorDetails[key];
|
|
3748
|
+
if (typeof value === "string" && value.trim()) {
|
|
3749
|
+
return value.trim();
|
|
3750
|
+
}
|
|
3751
|
+
}
|
|
3752
|
+
return JSON.stringify(errorDetails);
|
|
3753
|
+
}
|
|
3754
|
+
return String(errorDetails);
|
|
3755
|
+
}
|
|
3724
3756
|
function normalizeUserPorts(ports) {
|
|
3725
3757
|
return dedupeAndSortPorts(ports.map(validateUserPort));
|
|
3726
3758
|
}
|
|
@@ -4171,15 +4203,26 @@ var init_client = __esm({
|
|
|
4171
4203
|
if (result.status === "running" /* RUNNING */) {
|
|
4172
4204
|
return finishConnect(result.routingHint, result.name);
|
|
4173
4205
|
}
|
|
4206
|
+
if (result.status === "suspended" /* SUSPENDED */ || result.status === "terminated" /* TERMINATED */) {
|
|
4207
|
+
throw new SandboxError(
|
|
4208
|
+
formatStartupFailureMessage(result.sandboxId, result.status, {
|
|
4209
|
+
errorDetails: result.errorDetails,
|
|
4210
|
+
terminationReason: result.terminationReason
|
|
4211
|
+
})
|
|
4212
|
+
);
|
|
4213
|
+
}
|
|
4174
4214
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
4175
4215
|
while (Date.now() < deadline) {
|
|
4176
4216
|
const info = await this.get(result.sandboxId);
|
|
4177
4217
|
if (info.status === "running" /* RUNNING */) {
|
|
4178
4218
|
return finishConnect(info.routingHint, info.name);
|
|
4179
4219
|
}
|
|
4180
|
-
if (info.status === "terminated" /* TERMINATED */) {
|
|
4220
|
+
if (info.status === "suspended" /* SUSPENDED */ || info.status === "terminated" /* TERMINATED */) {
|
|
4181
4221
|
throw new SandboxError(
|
|
4182
|
-
|
|
4222
|
+
formatStartupFailureMessage(result.sandboxId, info.status, {
|
|
4223
|
+
errorDetails: info.errorDetails,
|
|
4224
|
+
terminationReason: info.terminationReason
|
|
4225
|
+
})
|
|
4183
4226
|
);
|
|
4184
4227
|
}
|
|
4185
4228
|
await sleep2(500);
|
|
@@ -4956,7 +4999,7 @@ async function executeDockerfilePlan(sandbox, plan, emit, sleep3) {
|
|
|
4956
4999
|
);
|
|
4957
5000
|
}
|
|
4958
5001
|
}
|
|
4959
|
-
async function registerImage(context, name, dockerfile, snapshotId, snapshotUri, isPublic) {
|
|
5002
|
+
async function registerImage(context, name, dockerfile, snapshotId, snapshotSandboxId, snapshotUri, snapshotSizeBytes, rootfsDiskBytes, isPublic) {
|
|
4960
5003
|
if (!context.organizationId || !context.projectId) {
|
|
4961
5004
|
throw new Error(
|
|
4962
5005
|
"Organization ID and Project ID are required. Run 'tl login' and 'tl init'."
|
|
@@ -4983,8 +5026,11 @@ async function registerImage(context, name, dockerfile, snapshotId, snapshotUri,
|
|
|
4983
5026
|
name,
|
|
4984
5027
|
dockerfile,
|
|
4985
5028
|
snapshotId,
|
|
5029
|
+
snapshotSandboxId,
|
|
4986
5030
|
snapshotUri,
|
|
4987
|
-
|
|
5031
|
+
snapshotSizeBytes,
|
|
5032
|
+
rootfsDiskBytes,
|
|
5033
|
+
public: isPublic
|
|
4988
5034
|
})
|
|
4989
5035
|
});
|
|
4990
5036
|
if (!response.ok) {
|
|
@@ -5035,6 +5081,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5035
5081
|
`Snapshot ${snapshot.snapshotId} is missing snapshotUri and cannot be registered as a sandbox image.`
|
|
5036
5082
|
);
|
|
5037
5083
|
}
|
|
5084
|
+
if (snapshot.sizeBytes == null) {
|
|
5085
|
+
throw new Error(
|
|
5086
|
+
`Snapshot ${snapshot.snapshotId} is missing sizeBytes and cannot be registered as a sandbox image.`
|
|
5087
|
+
);
|
|
5088
|
+
}
|
|
5089
|
+
if (snapshot.rootfsDiskBytes == null) {
|
|
5090
|
+
throw new Error(
|
|
5091
|
+
`Snapshot ${snapshot.snapshotId} is missing rootfsDiskBytes and cannot be registered as a sandbox image.`
|
|
5092
|
+
);
|
|
5093
|
+
}
|
|
5038
5094
|
emit({
|
|
5039
5095
|
type: "status",
|
|
5040
5096
|
message: `Registering image '${plan.registeredName}'...`
|
|
@@ -5044,7 +5100,10 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5044
5100
|
plan.registeredName,
|
|
5045
5101
|
plan.dockerfileText,
|
|
5046
5102
|
snapshot.snapshotId,
|
|
5103
|
+
snapshot.sandboxId,
|
|
5047
5104
|
snapshot.snapshotUri,
|
|
5105
|
+
snapshot.sizeBytes,
|
|
5106
|
+
snapshot.rootfsDiskBytes,
|
|
5048
5107
|
options.isPublic ?? false
|
|
5049
5108
|
);
|
|
5050
5109
|
emit({
|
|
@@ -5072,25 +5131,25 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
5072
5131
|
name: { type: "string", short: "n" },
|
|
5073
5132
|
cpus: { type: "string" },
|
|
5074
5133
|
memory: { type: "string" },
|
|
5075
|
-
|
|
5134
|
+
disk_mb: { type: "string" },
|
|
5076
5135
|
public: { type: "boolean", default: false }
|
|
5077
5136
|
}
|
|
5078
5137
|
});
|
|
5079
5138
|
const dockerfilePath = parsed.positionals[0];
|
|
5080
5139
|
if (!dockerfilePath) {
|
|
5081
|
-
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--
|
|
5140
|
+
throw new Error("Usage: tensorlake-create-sandbox-image <dockerfile_path> [--name NAME] [--cpus N] [--memory MB] [--disk_mb MB] [--public]");
|
|
5082
5141
|
}
|
|
5083
5142
|
const cpus = parsed.values.cpus != null ? Number(parsed.values.cpus) : void 0;
|
|
5084
5143
|
const memoryMb = parsed.values.memory != null ? Number(parsed.values.memory) : void 0;
|
|
5085
|
-
const
|
|
5144
|
+
const diskMb = parsed.values.disk_mb != null ? Number(parsed.values.disk_mb) : void 0;
|
|
5086
5145
|
if (cpus != null && !Number.isFinite(cpus)) {
|
|
5087
5146
|
throw new Error(`Invalid --cpus value: ${parsed.values.cpus}`);
|
|
5088
5147
|
}
|
|
5089
5148
|
if (memoryMb != null && !Number.isInteger(memoryMb)) {
|
|
5090
5149
|
throw new Error(`Invalid --memory value: ${parsed.values.memory}`);
|
|
5091
5150
|
}
|
|
5092
|
-
if (
|
|
5093
|
-
throw new Error(`Invalid --
|
|
5151
|
+
if (diskMb != null && !Number.isInteger(diskMb)) {
|
|
5152
|
+
throw new Error(`Invalid --disk_mb value: ${parsed.values.disk_mb}`);
|
|
5094
5153
|
}
|
|
5095
5154
|
await createSandboxImage(
|
|
5096
5155
|
dockerfilePath,
|
|
@@ -5098,7 +5157,7 @@ async function runCreateSandboxImageCli(argv = process.argv.slice(2)) {
|
|
|
5098
5157
|
registeredName: parsed.values.name,
|
|
5099
5158
|
cpus,
|
|
5100
5159
|
memoryMb,
|
|
5101
|
-
diskMb
|
|
5160
|
+
diskMb,
|
|
5102
5161
|
isPublic: parsed.values.public
|
|
5103
5162
|
},
|
|
5104
5163
|
{ emit: ndjsonStdoutEmit }
|