tensorlake 0.5.1 → 0.5.2
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 +63 -4
- 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 +63 -4
- 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 +63 -4
- 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 +63 -4
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
|
@@ -79,6 +79,8 @@ interface CreateSandboxResponse {
|
|
|
79
79
|
status: SandboxStatus;
|
|
80
80
|
routingHint?: string;
|
|
81
81
|
name?: string | null;
|
|
82
|
+
terminationReason?: string;
|
|
83
|
+
errorDetails?: unknown;
|
|
82
84
|
}
|
|
83
85
|
interface SandboxInfo {
|
|
84
86
|
sandboxId: string;
|
|
@@ -93,6 +95,8 @@ interface SandboxInfo {
|
|
|
93
95
|
network?: NetworkConfig;
|
|
94
96
|
poolId?: string;
|
|
95
97
|
outcome?: string;
|
|
98
|
+
terminationReason?: string;
|
|
99
|
+
errorDetails?: unknown;
|
|
96
100
|
createdAt?: Date;
|
|
97
101
|
terminatedAt?: Date;
|
|
98
102
|
name?: string;
|
|
@@ -119,6 +123,7 @@ interface SnapshotInfo {
|
|
|
119
123
|
error?: string;
|
|
120
124
|
snapshotUri?: string;
|
|
121
125
|
sizeBytes?: number;
|
|
126
|
+
rootfsDiskBytes?: number;
|
|
122
127
|
createdAt?: Date;
|
|
123
128
|
}
|
|
124
129
|
interface SnapshotOptions {
|
|
@@ -415,7 +420,7 @@ interface BuildClient {
|
|
|
415
420
|
interface CreateSandboxImageDeps {
|
|
416
421
|
emit?: (event: Record<string, unknown>) => void;
|
|
417
422
|
createClient?: (context: BuildContext) => BuildClient;
|
|
418
|
-
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotUri: string, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
423
|
+
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
419
424
|
sleep?: (ms: number) => Promise<void>;
|
|
420
425
|
}
|
|
421
426
|
declare function defaultRegisteredName(dockerfilePath: string): string;
|
|
@@ -79,6 +79,8 @@ interface CreateSandboxResponse {
|
|
|
79
79
|
status: SandboxStatus;
|
|
80
80
|
routingHint?: string;
|
|
81
81
|
name?: string | null;
|
|
82
|
+
terminationReason?: string;
|
|
83
|
+
errorDetails?: unknown;
|
|
82
84
|
}
|
|
83
85
|
interface SandboxInfo {
|
|
84
86
|
sandboxId: string;
|
|
@@ -93,6 +95,8 @@ interface SandboxInfo {
|
|
|
93
95
|
network?: NetworkConfig;
|
|
94
96
|
poolId?: string;
|
|
95
97
|
outcome?: string;
|
|
98
|
+
terminationReason?: string;
|
|
99
|
+
errorDetails?: unknown;
|
|
96
100
|
createdAt?: Date;
|
|
97
101
|
terminatedAt?: Date;
|
|
98
102
|
name?: string;
|
|
@@ -119,6 +123,7 @@ interface SnapshotInfo {
|
|
|
119
123
|
error?: string;
|
|
120
124
|
snapshotUri?: string;
|
|
121
125
|
sizeBytes?: number;
|
|
126
|
+
rootfsDiskBytes?: number;
|
|
122
127
|
createdAt?: Date;
|
|
123
128
|
}
|
|
124
129
|
interface SnapshotOptions {
|
|
@@ -415,7 +420,7 @@ interface BuildClient {
|
|
|
415
420
|
interface CreateSandboxImageDeps {
|
|
416
421
|
emit?: (event: Record<string, unknown>) => void;
|
|
417
422
|
createClient?: (context: BuildContext) => BuildClient;
|
|
418
|
-
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotUri: string, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
423
|
+
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
419
424
|
sleep?: (ms: number) => Promise<void>;
|
|
420
425
|
}
|
|
421
426
|
declare function defaultRegisteredName(dockerfilePath: string): string;
|
package/dist/sandbox-image.cjs
CHANGED
|
@@ -3660,6 +3660,38 @@ __export(client_exports, {
|
|
|
3660
3660
|
function sleep2(ms) {
|
|
3661
3661
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3662
3662
|
}
|
|
3663
|
+
function formatStartupFailureMessage(sandboxId, status, options) {
|
|
3664
|
+
const prefix = status === "terminated" /* TERMINATED */ ? `Sandbox ${sandboxId} terminated during startup` : `Sandbox ${sandboxId} became ${status} during startup`;
|
|
3665
|
+
const detail = formatErrorDetails(options.errorDetails);
|
|
3666
|
+
if (detail) {
|
|
3667
|
+
return `${prefix}: ${detail}`;
|
|
3668
|
+
}
|
|
3669
|
+
if (options.terminationReason) {
|
|
3670
|
+
return `${prefix}: termination reason: ${options.terminationReason}`;
|
|
3671
|
+
}
|
|
3672
|
+
return prefix;
|
|
3673
|
+
}
|
|
3674
|
+
function formatErrorDetails(errorDetails) {
|
|
3675
|
+
if (errorDetails == null) return void 0;
|
|
3676
|
+
if (typeof errorDetails === "string") {
|
|
3677
|
+
const detail = errorDetails.trim();
|
|
3678
|
+
return detail || void 0;
|
|
3679
|
+
}
|
|
3680
|
+
if (Array.isArray(errorDetails)) {
|
|
3681
|
+
const parts = errorDetails.map((item) => formatErrorDetails(item)).filter((item) => Boolean(item));
|
|
3682
|
+
return parts.length > 0 ? parts.join("; ") : JSON.stringify(errorDetails);
|
|
3683
|
+
}
|
|
3684
|
+
if (typeof errorDetails === "object") {
|
|
3685
|
+
for (const key of ["message", "detail", "error", "reason"]) {
|
|
3686
|
+
const value = errorDetails[key];
|
|
3687
|
+
if (typeof value === "string" && value.trim()) {
|
|
3688
|
+
return value.trim();
|
|
3689
|
+
}
|
|
3690
|
+
}
|
|
3691
|
+
return JSON.stringify(errorDetails);
|
|
3692
|
+
}
|
|
3693
|
+
return String(errorDetails);
|
|
3694
|
+
}
|
|
3663
3695
|
function normalizeUserPorts(ports) {
|
|
3664
3696
|
return dedupeAndSortPorts(ports.map(validateUserPort));
|
|
3665
3697
|
}
|
|
@@ -4110,15 +4142,26 @@ var init_client = __esm({
|
|
|
4110
4142
|
if (result.status === "running" /* RUNNING */) {
|
|
4111
4143
|
return finishConnect(result.routingHint, result.name);
|
|
4112
4144
|
}
|
|
4145
|
+
if (result.status === "suspended" /* SUSPENDED */ || result.status === "terminated" /* TERMINATED */) {
|
|
4146
|
+
throw new SandboxError(
|
|
4147
|
+
formatStartupFailureMessage(result.sandboxId, result.status, {
|
|
4148
|
+
errorDetails: result.errorDetails,
|
|
4149
|
+
terminationReason: result.terminationReason
|
|
4150
|
+
})
|
|
4151
|
+
);
|
|
4152
|
+
}
|
|
4113
4153
|
const deadline = Date.now() + startupTimeout * 1e3;
|
|
4114
4154
|
while (Date.now() < deadline) {
|
|
4115
4155
|
const info = await this.get(result.sandboxId);
|
|
4116
4156
|
if (info.status === "running" /* RUNNING */) {
|
|
4117
4157
|
return finishConnect(info.routingHint, info.name);
|
|
4118
4158
|
}
|
|
4119
|
-
if (info.status === "terminated" /* TERMINATED */) {
|
|
4159
|
+
if (info.status === "suspended" /* SUSPENDED */ || info.status === "terminated" /* TERMINATED */) {
|
|
4120
4160
|
throw new SandboxError(
|
|
4121
|
-
|
|
4161
|
+
formatStartupFailureMessage(result.sandboxId, info.status, {
|
|
4162
|
+
errorDetails: info.errorDetails,
|
|
4163
|
+
terminationReason: info.terminationReason
|
|
4164
|
+
})
|
|
4122
4165
|
);
|
|
4123
4166
|
}
|
|
4124
4167
|
await sleep2(500);
|
|
@@ -4802,7 +4845,7 @@ async function executeDockerfilePlan(sandbox, plan, emit, sleep3) {
|
|
|
4802
4845
|
);
|
|
4803
4846
|
}
|
|
4804
4847
|
}
|
|
4805
|
-
async function registerImage(context, name, dockerfile, snapshotId, snapshotUri, isPublic) {
|
|
4848
|
+
async function registerImage(context, name, dockerfile, snapshotId, snapshotSandboxId, snapshotUri, snapshotSizeBytes, rootfsDiskBytes, isPublic) {
|
|
4806
4849
|
if (!context.organizationId || !context.projectId) {
|
|
4807
4850
|
throw new Error(
|
|
4808
4851
|
"Organization ID and Project ID are required. Run 'tl login' and 'tl init'."
|
|
@@ -4829,8 +4872,11 @@ async function registerImage(context, name, dockerfile, snapshotId, snapshotUri,
|
|
|
4829
4872
|
name,
|
|
4830
4873
|
dockerfile,
|
|
4831
4874
|
snapshotId,
|
|
4875
|
+
snapshotSandboxId,
|
|
4832
4876
|
snapshotUri,
|
|
4833
|
-
|
|
4877
|
+
snapshotSizeBytes,
|
|
4878
|
+
rootfsDiskBytes,
|
|
4879
|
+
public: isPublic
|
|
4834
4880
|
})
|
|
4835
4881
|
});
|
|
4836
4882
|
if (!response.ok) {
|
|
@@ -4881,6 +4927,16 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4881
4927
|
`Snapshot ${snapshot.snapshotId} is missing snapshotUri and cannot be registered as a sandbox image.`
|
|
4882
4928
|
);
|
|
4883
4929
|
}
|
|
4930
|
+
if (snapshot.sizeBytes == null) {
|
|
4931
|
+
throw new Error(
|
|
4932
|
+
`Snapshot ${snapshot.snapshotId} is missing sizeBytes and cannot be registered as a sandbox image.`
|
|
4933
|
+
);
|
|
4934
|
+
}
|
|
4935
|
+
if (snapshot.rootfsDiskBytes == null) {
|
|
4936
|
+
throw new Error(
|
|
4937
|
+
`Snapshot ${snapshot.snapshotId} is missing rootfsDiskBytes and cannot be registered as a sandbox image.`
|
|
4938
|
+
);
|
|
4939
|
+
}
|
|
4884
4940
|
emit({
|
|
4885
4941
|
type: "status",
|
|
4886
4942
|
message: `Registering image '${plan.registeredName}'...`
|
|
@@ -4890,7 +4946,10 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
4890
4946
|
plan.registeredName,
|
|
4891
4947
|
plan.dockerfileText,
|
|
4892
4948
|
snapshot.snapshotId,
|
|
4949
|
+
snapshot.sandboxId,
|
|
4893
4950
|
snapshot.snapshotUri,
|
|
4951
|
+
snapshot.sizeBytes,
|
|
4952
|
+
snapshot.rootfsDiskBytes,
|
|
4894
4953
|
options.isPublic ?? false
|
|
4895
4954
|
);
|
|
4896
4955
|
emit({
|