tensorlake 0.5.7 → 0.5.10
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 +44 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -9
- package/dist/index.d.ts +11 -9
- package/dist/index.js +44 -26
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-BMDaNpZ2.d.cts → sandbox-image-CUEKMhZ1.d.cts} +11 -2
- package/dist/{sandbox-image-BMDaNpZ2.d.ts → sandbox-image-CUEKMhZ1.d.ts} +11 -2
- package/dist/sandbox-image.cjs +39 -21
- 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 +38 -21
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,6 +8,7 @@ declare enum SandboxStatus {
|
|
|
8
8
|
}
|
|
9
9
|
declare enum SnapshotStatus {
|
|
10
10
|
IN_PROGRESS = "in_progress",
|
|
11
|
+
LOCAL_READY = "local_ready",
|
|
11
12
|
COMPLETED = "completed",
|
|
12
13
|
FAILED = "failed"
|
|
13
14
|
}
|
|
@@ -31,6 +32,7 @@ type SnapshotType = "memory" | "filesystem";
|
|
|
31
32
|
* this checkpoint cold-boot from the snapshot tarball.
|
|
32
33
|
*/
|
|
33
34
|
type CheckpointType = "memory" | "filesystem";
|
|
35
|
+
type SnapshotWaitCondition = "local_ready" | "completed";
|
|
34
36
|
declare enum ProcessStatus {
|
|
35
37
|
RUNNING = "running",
|
|
36
38
|
EXITED = "exited",
|
|
@@ -132,6 +134,7 @@ interface SnapshotInfo {
|
|
|
132
134
|
snapshotType?: SnapshotType;
|
|
133
135
|
error?: string;
|
|
134
136
|
snapshotUri?: string;
|
|
137
|
+
snapshotFormatVersion?: string;
|
|
135
138
|
sizeBytes?: number;
|
|
136
139
|
rootfsDiskBytes?: number;
|
|
137
140
|
createdAt?: Date;
|
|
@@ -147,6 +150,8 @@ interface SnapshotOptions {
|
|
|
147
150
|
interface SnapshotAndWaitOptions extends SnapshotOptions {
|
|
148
151
|
timeout?: number;
|
|
149
152
|
pollInterval?: number;
|
|
153
|
+
/** Defaults to `"local_ready"`, which is enough to resume from a snapshot. */
|
|
154
|
+
waitUntil?: SnapshotWaitCondition;
|
|
150
155
|
}
|
|
151
156
|
interface CreatePoolOptions {
|
|
152
157
|
/** Sandbox image name, such as `tensorlake/ubuntu-minimal` or a registered Sandbox Image. */
|
|
@@ -303,6 +308,8 @@ interface SuspendResumeOptions {
|
|
|
303
308
|
}
|
|
304
309
|
interface CheckpointOptions extends SuspendResumeOptions {
|
|
305
310
|
checkpointType?: CheckpointType;
|
|
311
|
+
/** Defaults to `"local_ready"`, which is enough to resume from a checkpoint. */
|
|
312
|
+
waitUntil?: SnapshotWaitCondition;
|
|
306
313
|
}
|
|
307
314
|
interface ConnectOptions {
|
|
308
315
|
sandboxId: string;
|
|
@@ -424,13 +431,14 @@ interface BuildClient {
|
|
|
424
431
|
timeout?: number;
|
|
425
432
|
pollInterval?: number;
|
|
426
433
|
snapshotType?: SnapshotType;
|
|
434
|
+
waitUntil?: SnapshotWaitCondition;
|
|
427
435
|
}): Promise<SnapshotInfo>;
|
|
428
436
|
close(): void;
|
|
429
437
|
}
|
|
430
438
|
interface CreateSandboxImageDeps {
|
|
431
439
|
emit?: (event: Record<string, unknown>) => void;
|
|
432
440
|
createClient?: (context: BuildContext) => BuildClient;
|
|
433
|
-
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
441
|
+
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean, snapshotFormatVersion?: string) => Promise<Record<string, unknown>>;
|
|
434
442
|
sleep?: (ms: number) => Promise<void>;
|
|
435
443
|
}
|
|
436
444
|
declare function defaultRegisteredName(dockerfilePath: string): string;
|
|
@@ -440,7 +448,8 @@ declare function logicalDockerfileLines(dockerfileText: string): Array<{
|
|
|
440
448
|
}>;
|
|
441
449
|
declare function loadDockerfilePlan(dockerfilePath: string, registeredName?: string): Promise<DockerfileBuildPlan>;
|
|
442
450
|
declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOptions, "registeredName" | "contextDir">): DockerfileBuildPlan;
|
|
451
|
+
declare function registerImage(context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean, snapshotFormatVersion?: string): Promise<Record<string, unknown>>;
|
|
443
452
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
444
453
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
445
454
|
|
|
446
|
-
export {
|
|
455
|
+
export { dockerfileContent as $, type CreateSandboxImageOptions as A, type DirectoryEntry as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileBuildPlan as E, type DockerfileInstruction as F, type ImageBuildOperation as G, type HealthResponse as H, Image as I, ImageBuildOperationType as J, type ImageOptions as K, type ListDirectoryResponse as L, OutputMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, type PoolContainerInfo as Q, type RunOptions as R, type SandboxOptions as S, ProcessStatus as T, type UpdateSandboxOptions as U, type SandboxImageSource as V, SnapshotStatus as W, type SnapshotType as X, type SnapshotWaitCondition as Y, StdinMode as Z, createSandboxImage as _, type CreateAndConnectOptions as a, type BuildContext as a0, defaultRegisteredName as a1, loadDockerfilePlan as a2, loadImagePlan as a3, logicalDockerfileLines as a4, registerImage as a5, runCreateSandboxImageCli as a6, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, type SandboxInfo as e, SandboxStatus 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 CheckpointType as x, type ContainerResourcesInfo as y, ContainerState as z };
|
|
@@ -8,6 +8,7 @@ declare enum SandboxStatus {
|
|
|
8
8
|
}
|
|
9
9
|
declare enum SnapshotStatus {
|
|
10
10
|
IN_PROGRESS = "in_progress",
|
|
11
|
+
LOCAL_READY = "local_ready",
|
|
11
12
|
COMPLETED = "completed",
|
|
12
13
|
FAILED = "failed"
|
|
13
14
|
}
|
|
@@ -31,6 +32,7 @@ type SnapshotType = "memory" | "filesystem";
|
|
|
31
32
|
* this checkpoint cold-boot from the snapshot tarball.
|
|
32
33
|
*/
|
|
33
34
|
type CheckpointType = "memory" | "filesystem";
|
|
35
|
+
type SnapshotWaitCondition = "local_ready" | "completed";
|
|
34
36
|
declare enum ProcessStatus {
|
|
35
37
|
RUNNING = "running",
|
|
36
38
|
EXITED = "exited",
|
|
@@ -132,6 +134,7 @@ interface SnapshotInfo {
|
|
|
132
134
|
snapshotType?: SnapshotType;
|
|
133
135
|
error?: string;
|
|
134
136
|
snapshotUri?: string;
|
|
137
|
+
snapshotFormatVersion?: string;
|
|
135
138
|
sizeBytes?: number;
|
|
136
139
|
rootfsDiskBytes?: number;
|
|
137
140
|
createdAt?: Date;
|
|
@@ -147,6 +150,8 @@ interface SnapshotOptions {
|
|
|
147
150
|
interface SnapshotAndWaitOptions extends SnapshotOptions {
|
|
148
151
|
timeout?: number;
|
|
149
152
|
pollInterval?: number;
|
|
153
|
+
/** Defaults to `"local_ready"`, which is enough to resume from a snapshot. */
|
|
154
|
+
waitUntil?: SnapshotWaitCondition;
|
|
150
155
|
}
|
|
151
156
|
interface CreatePoolOptions {
|
|
152
157
|
/** Sandbox image name, such as `tensorlake/ubuntu-minimal` or a registered Sandbox Image. */
|
|
@@ -303,6 +308,8 @@ interface SuspendResumeOptions {
|
|
|
303
308
|
}
|
|
304
309
|
interface CheckpointOptions extends SuspendResumeOptions {
|
|
305
310
|
checkpointType?: CheckpointType;
|
|
311
|
+
/** Defaults to `"local_ready"`, which is enough to resume from a checkpoint. */
|
|
312
|
+
waitUntil?: SnapshotWaitCondition;
|
|
306
313
|
}
|
|
307
314
|
interface ConnectOptions {
|
|
308
315
|
sandboxId: string;
|
|
@@ -424,13 +431,14 @@ interface BuildClient {
|
|
|
424
431
|
timeout?: number;
|
|
425
432
|
pollInterval?: number;
|
|
426
433
|
snapshotType?: SnapshotType;
|
|
434
|
+
waitUntil?: SnapshotWaitCondition;
|
|
427
435
|
}): Promise<SnapshotInfo>;
|
|
428
436
|
close(): void;
|
|
429
437
|
}
|
|
430
438
|
interface CreateSandboxImageDeps {
|
|
431
439
|
emit?: (event: Record<string, unknown>) => void;
|
|
432
440
|
createClient?: (context: BuildContext) => BuildClient;
|
|
433
|
-
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean) => Promise<Record<string, unknown>>;
|
|
441
|
+
registerImage?: (context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean, snapshotFormatVersion?: string) => Promise<Record<string, unknown>>;
|
|
434
442
|
sleep?: (ms: number) => Promise<void>;
|
|
435
443
|
}
|
|
436
444
|
declare function defaultRegisteredName(dockerfilePath: string): string;
|
|
@@ -440,7 +448,8 @@ declare function logicalDockerfileLines(dockerfileText: string): Array<{
|
|
|
440
448
|
}>;
|
|
441
449
|
declare function loadDockerfilePlan(dockerfilePath: string, registeredName?: string): Promise<DockerfileBuildPlan>;
|
|
442
450
|
declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOptions, "registeredName" | "contextDir">): DockerfileBuildPlan;
|
|
451
|
+
declare function registerImage(context: BuildContext, name: string, dockerfile: string, snapshotId: string, snapshotSandboxId: string, snapshotUri: string, snapshotSizeBytes: number, rootfsDiskBytes: number, isPublic: boolean, snapshotFormatVersion?: string): Promise<Record<string, unknown>>;
|
|
443
452
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
444
453
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
445
454
|
|
|
446
|
-
export {
|
|
455
|
+
export { dockerfileContent as $, type CreateSandboxImageOptions as A, type DirectoryEntry as B, type CreatePtySessionOptions as C, type DaemonInfo as D, type DockerfileBuildPlan as E, type DockerfileInstruction as F, type ImageBuildOperation as G, type HealthResponse as H, Image as I, ImageBuildOperationType as J, type ImageOptions as K, type ListDirectoryResponse as L, OutputMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, type PoolContainerInfo as Q, type RunOptions as R, type SandboxOptions as S, ProcessStatus as T, type UpdateSandboxOptions as U, type SandboxImageSource as V, SnapshotStatus as W, type SnapshotType as X, type SnapshotWaitCondition as Y, StdinMode as Z, createSandboxImage as _, type CreateAndConnectOptions as a, type BuildContext as a0, defaultRegisteredName as a1, loadDockerfilePlan as a2, loadImagePlan as a3, logicalDockerfileLines as a4, registerImage as a5, runCreateSandboxImageCli as a6, type SandboxClientOptions as b, type ConnectOptions as c, type SnapshotInfo as d, type SandboxInfo as e, SandboxStatus 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 CheckpointType as x, type ContainerResourcesInfo as y, ContainerState as z };
|
package/dist/sandbox-image.cjs
CHANGED
|
@@ -83,7 +83,7 @@ var SDK_VERSION, API_URL, API_KEY, NAMESPACE, SANDBOX_PROXY_URL, DEFAULT_HTTP_TI
|
|
|
83
83
|
var init_defaults = __esm({
|
|
84
84
|
"src/defaults.ts"() {
|
|
85
85
|
"use strict";
|
|
86
|
-
SDK_VERSION = "0.5.
|
|
86
|
+
SDK_VERSION = "0.5.10";
|
|
87
87
|
API_URL = process.env.TENSORLAKE_API_URL ?? "https://api.tensorlake.ai";
|
|
88
88
|
API_KEY = process.env.TENSORLAKE_API_KEY ?? void 0;
|
|
89
89
|
NAMESPACE = process.env.INDEXIFY_NAMESPACE ?? "default";
|
|
@@ -3334,11 +3334,10 @@ var init_sandbox = __esm({
|
|
|
3334
3334
|
await client.resume(this.lifecycleIdentifier, options);
|
|
3335
3335
|
}
|
|
3336
3336
|
/**
|
|
3337
|
-
* Create a
|
|
3338
|
-
* be committed.
|
|
3337
|
+
* Create a checkpoint of this sandbox and wait for it to be locally ready.
|
|
3339
3338
|
*
|
|
3340
|
-
* By default blocks until the
|
|
3341
|
-
*
|
|
3339
|
+
* By default blocks until the checkpoint is resumable and returns
|
|
3340
|
+
* `SnapshotInfo`. Pass `{ wait: false }` to fire-and-return
|
|
3342
3341
|
* (returns `undefined`).
|
|
3343
3342
|
*/
|
|
3344
3343
|
async checkpoint(options) {
|
|
@@ -3350,7 +3349,8 @@ var init_sandbox = __esm({
|
|
|
3350
3349
|
return client.snapshotAndWait(this.lifecycleIdentifier, {
|
|
3351
3350
|
timeout: options?.timeout,
|
|
3352
3351
|
pollInterval: options?.pollInterval,
|
|
3353
|
-
snapshotType: options?.checkpointType
|
|
3352
|
+
snapshotType: options?.checkpointType,
|
|
3353
|
+
waitUntil: options?.waitUntil
|
|
3354
3354
|
});
|
|
3355
3355
|
}
|
|
3356
3356
|
/**
|
|
@@ -3745,6 +3745,12 @@ __export(client_exports, {
|
|
|
3745
3745
|
function sleep2(ms) {
|
|
3746
3746
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
3747
3747
|
}
|
|
3748
|
+
function snapshotStatusSatisfiesWaitCondition(status, waitUntil) {
|
|
3749
|
+
if (waitUntil === "local_ready") {
|
|
3750
|
+
return status === "local_ready" /* LOCAL_READY */ || status === "completed" /* COMPLETED */;
|
|
3751
|
+
}
|
|
3752
|
+
return status === "completed" /* COMPLETED */;
|
|
3753
|
+
}
|
|
3748
3754
|
function formatStartupFailureMessage(sandboxId, status, options) {
|
|
3749
3755
|
const prefix = status === "terminated" /* TERMINATED */ ? `Sandbox ${sandboxId} terminated during startup` : `Sandbox ${sandboxId} became ${status} during startup`;
|
|
3750
3756
|
const detail = formatErrorDetails(options.errorDetails);
|
|
@@ -4045,7 +4051,8 @@ var init_client = __esm({
|
|
|
4045
4051
|
*
|
|
4046
4052
|
* This call **returns immediately** with a `snapshotId` and `in_progress`
|
|
4047
4053
|
* status — the snapshot is created asynchronously. Poll `getSnapshot()` until
|
|
4048
|
-
* `completed
|
|
4054
|
+
* `local_ready`, `completed`, or `failed`, or use `snapshotAndWait()` to
|
|
4055
|
+
* block automatically.
|
|
4049
4056
|
*
|
|
4050
4057
|
* @param options.snapshotType - `"filesystem"` for cold-boot snapshots (e.g. image builds).
|
|
4051
4058
|
* Omit to use the server default (`filesystem`).
|
|
@@ -4086,9 +4093,11 @@ var init_client = __esm({
|
|
|
4086
4093
|
);
|
|
4087
4094
|
}
|
|
4088
4095
|
/**
|
|
4089
|
-
* Create a snapshot and block until it is
|
|
4096
|
+
* Create a snapshot and block until it is locally ready.
|
|
4090
4097
|
*
|
|
4091
|
-
* Combines `snapshot()` with polling `getSnapshot()` until `
|
|
4098
|
+
* Combines `snapshot()` with polling `getSnapshot()` until `local_ready`
|
|
4099
|
+
* or `completed`. Pass `{ waitUntil: "completed" }` when durable
|
|
4100
|
+
* `snapshotUri` metadata is required.
|
|
4092
4101
|
* Prefer `sandbox.checkpoint()` on a `Sandbox` handle for the same behavior
|
|
4093
4102
|
* without managing the client separately.
|
|
4094
4103
|
*
|
|
@@ -4101,13 +4110,14 @@ var init_client = __esm({
|
|
|
4101
4110
|
async snapshotAndWait(sandboxId, options) {
|
|
4102
4111
|
const timeout = options?.timeout ?? 300;
|
|
4103
4112
|
const pollInterval = options?.pollInterval ?? 1;
|
|
4113
|
+
const waitUntil = options?.waitUntil ?? "local_ready";
|
|
4104
4114
|
const result = await this.snapshot(sandboxId, {
|
|
4105
4115
|
snapshotType: options?.snapshotType
|
|
4106
4116
|
});
|
|
4107
4117
|
const deadline = Date.now() + timeout * 1e3;
|
|
4108
4118
|
while (Date.now() < deadline) {
|
|
4109
4119
|
const info = await this.getSnapshot(result.snapshotId);
|
|
4110
|
-
if (info.status
|
|
4120
|
+
if (snapshotStatusSatisfiesWaitCondition(info.status, waitUntil)) return info;
|
|
4111
4121
|
if (info.status === "failed" /* FAILED */) {
|
|
4112
4122
|
throw new SandboxError(
|
|
4113
4123
|
`Snapshot ${result.snapshotId} failed: ${info.error}`
|
|
@@ -4116,7 +4126,7 @@ var init_client = __esm({
|
|
|
4116
4126
|
await sleep2(pollInterval * 1e3);
|
|
4117
4127
|
}
|
|
4118
4128
|
throw new SandboxError(
|
|
4119
|
-
`Snapshot ${result.snapshotId} did not
|
|
4129
|
+
`Snapshot ${result.snapshotId} did not reach ${waitUntil} within ${timeout}s`
|
|
4120
4130
|
);
|
|
4121
4131
|
}
|
|
4122
4132
|
// --- Pools ---
|
|
@@ -4307,6 +4317,7 @@ __export(sandbox_image_exports, {
|
|
|
4307
4317
|
loadDockerfilePlan: () => loadDockerfilePlan,
|
|
4308
4318
|
loadImagePlan: () => loadImagePlan,
|
|
4309
4319
|
logicalDockerfileLines: () => logicalDockerfileLines,
|
|
4320
|
+
registerImage: () => registerImage,
|
|
4310
4321
|
runCreateSandboxImageCli: () => runCreateSandboxImageCli
|
|
4311
4322
|
});
|
|
4312
4323
|
module.exports = __toCommonJS(sandbox_image_exports);
|
|
@@ -4930,23 +4941,26 @@ async function executeDockerfilePlan(sandbox, plan, emit, sleep3) {
|
|
|
4930
4941
|
);
|
|
4931
4942
|
}
|
|
4932
4943
|
}
|
|
4933
|
-
async function registerImage(context, name, dockerfile, snapshotId, snapshotSandboxId, snapshotUri, snapshotSizeBytes, rootfsDiskBytes, isPublic) {
|
|
4934
|
-
if (!context.organizationId || !context.projectId) {
|
|
4935
|
-
throw new Error(
|
|
4936
|
-
"Organization ID and Project ID are required. Run 'tl login' and 'tl init'."
|
|
4937
|
-
);
|
|
4938
|
-
}
|
|
4944
|
+
async function registerImage(context, name, dockerfile, snapshotId, snapshotSandboxId, snapshotUri, snapshotSizeBytes, rootfsDiskBytes, isPublic, snapshotFormatVersion) {
|
|
4939
4945
|
const bearerToken = context.apiKey ?? context.personalAccessToken;
|
|
4940
4946
|
if (!bearerToken) {
|
|
4941
4947
|
throw new Error("Missing TENSORLAKE_API_KEY or TENSORLAKE_PAT.");
|
|
4942
4948
|
}
|
|
4943
4949
|
const baseUrl = context.apiUrl.replace(/\/+$/, "");
|
|
4944
|
-
const url = `${baseUrl}/platform/v1/organizations/${encodeURIComponent(context.organizationId)}/projects/${encodeURIComponent(context.projectId)}/sandbox-templates`;
|
|
4945
4950
|
const headers = {
|
|
4946
4951
|
Authorization: `Bearer ${bearerToken}`,
|
|
4947
4952
|
"Content-Type": "application/json"
|
|
4948
4953
|
};
|
|
4949
|
-
|
|
4954
|
+
let url;
|
|
4955
|
+
if (context.apiKey) {
|
|
4956
|
+
url = `${baseUrl}/platform/v1/sandbox-templates`;
|
|
4957
|
+
} else {
|
|
4958
|
+
if (!context.organizationId || !context.projectId) {
|
|
4959
|
+
throw new Error(
|
|
4960
|
+
"Personal Access Token authentication requires TENSORLAKE_ORGANIZATION_ID and TENSORLAKE_PROJECT_ID to be set (e.g. via 'tl login && tl init'). To skip this requirement, authenticate with TENSORLAKE_API_KEY instead \u2014 API keys are bound to a single project at creation."
|
|
4961
|
+
);
|
|
4962
|
+
}
|
|
4963
|
+
url = `${baseUrl}/platform/v1/organizations/${encodeURIComponent(context.organizationId)}/projects/${encodeURIComponent(context.projectId)}/sandbox-templates`;
|
|
4950
4964
|
headers["X-Forwarded-Organization-Id"] = context.organizationId;
|
|
4951
4965
|
headers["X-Forwarded-Project-Id"] = context.projectId;
|
|
4952
4966
|
}
|
|
@@ -4959,6 +4973,7 @@ async function registerImage(context, name, dockerfile, snapshotId, snapshotSand
|
|
|
4959
4973
|
snapshotId,
|
|
4960
4974
|
snapshotSandboxId,
|
|
4961
4975
|
snapshotUri,
|
|
4976
|
+
...snapshotFormatVersion ? { snapshotFormatVersion } : {},
|
|
4962
4977
|
snapshotSizeBytes,
|
|
4963
4978
|
rootfsDiskBytes,
|
|
4964
4979
|
public: isPublic
|
|
@@ -5001,7 +5016,8 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5001
5016
|
await executeDockerfilePlan(sandbox, plan, emit, sleep3);
|
|
5002
5017
|
emit({ type: "status", message: "Creating snapshot..." });
|
|
5003
5018
|
const snapshot = await client.snapshotAndWait(sandbox.sandboxId, {
|
|
5004
|
-
snapshotType: "filesystem"
|
|
5019
|
+
snapshotType: "filesystem",
|
|
5020
|
+
waitUntil: "completed"
|
|
5005
5021
|
});
|
|
5006
5022
|
emit({
|
|
5007
5023
|
type: "snapshot_created",
|
|
@@ -5035,7 +5051,8 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
5035
5051
|
snapshot.snapshotUri,
|
|
5036
5052
|
snapshot.sizeBytes,
|
|
5037
5053
|
snapshot.rootfsDiskBytes,
|
|
5038
|
-
options.isPublic ?? false
|
|
5054
|
+
options.isPublic ?? false,
|
|
5055
|
+
snapshot.snapshotFormatVersion
|
|
5039
5056
|
);
|
|
5040
5057
|
emit({
|
|
5041
5058
|
type: "image_registered",
|
|
@@ -5129,6 +5146,7 @@ init_sandbox_image();
|
|
|
5129
5146
|
loadDockerfilePlan,
|
|
5130
5147
|
loadImagePlan,
|
|
5131
5148
|
logicalDockerfileLines,
|
|
5149
|
+
registerImage,
|
|
5132
5150
|
runCreateSandboxImageCli
|
|
5133
5151
|
});
|
|
5134
5152
|
//# sourceMappingURL=sandbox-image.cjs.map
|