tensorlake 0.4.41 → 0.4.43
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 +28 -18
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +28 -18
- package/dist/index.js.map +1 -1
- package/dist/{sandbox-image-DKPhc4Lv.d.cts → sandbox-image-Dr9SQaCc.d.cts} +22 -2
- package/dist/{sandbox-image-DKPhc4Lv.d.ts → sandbox-image-Dr9SQaCc.d.ts} +22 -2
- package/dist/sandbox-image.cjs +19 -9
- 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 +19 -9
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,17 @@ declare enum SnapshotStatus {
|
|
|
11
11
|
COMPLETED = "completed",
|
|
12
12
|
FAILED = "failed"
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Content mode for snapshot creation.
|
|
16
|
+
*
|
|
17
|
+
* - `"full"`: Full VM snapshot (memory + filesystem state). Sandboxes
|
|
18
|
+
* restored from this snapshot warm-restore VM memory.
|
|
19
|
+
* - `"filesystem_only"`: Filesystem-only snapshot. Sandboxes restored from
|
|
20
|
+
* this snapshot cold-boot from the snapshot tarball instead of warm-
|
|
21
|
+
* restoring VM state. Use this for sandbox image builds so that the
|
|
22
|
+
* restored sandbox bypasses Firecracker's overlay-path constraints.
|
|
23
|
+
*/
|
|
24
|
+
type SnapshotContentMode = "full" | "filesystem_only";
|
|
14
25
|
declare enum ProcessStatus {
|
|
15
26
|
RUNNING = "running",
|
|
16
27
|
EXITED = "exited",
|
|
@@ -106,7 +117,15 @@ interface SnapshotInfo {
|
|
|
106
117
|
sizeBytes?: number;
|
|
107
118
|
createdAt?: Date;
|
|
108
119
|
}
|
|
109
|
-
interface
|
|
120
|
+
interface SnapshotOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Optional content mode for the snapshot. When omitted the server picks
|
|
123
|
+
* its default. Use `"filesystem_only"` for snapshots intended for sandbox
|
|
124
|
+
* image builds so that restored sandboxes cold-boot.
|
|
125
|
+
*/
|
|
126
|
+
contentMode?: SnapshotContentMode;
|
|
127
|
+
}
|
|
128
|
+
interface SnapshotAndWaitOptions extends SnapshotOptions {
|
|
110
129
|
timeout?: number;
|
|
111
130
|
pollInterval?: number;
|
|
112
131
|
}
|
|
@@ -353,6 +372,7 @@ interface BuildClient {
|
|
|
353
372
|
snapshotAndWait(sandboxId: string, options?: {
|
|
354
373
|
timeout?: number;
|
|
355
374
|
pollInterval?: number;
|
|
375
|
+
contentMode?: SnapshotContentMode;
|
|
356
376
|
}): Promise<SnapshotInfo>;
|
|
357
377
|
close(): void;
|
|
358
378
|
}
|
|
@@ -372,4 +392,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
|
|
|
372
392
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
373
393
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
374
394
|
|
|
375
|
-
export {
|
|
395
|
+
export { runCreateSandboxImageCli as $, ImageBuildOperationType as A, type ImageOptions as B, type CreatePtySessionOptions as C, type DaemonInfo as D, OutputMode as E, type PoolContainerInfo as F, ProcessStatus as G, type HealthResponse as H, Image as I, type SandboxImageSource as J, SandboxStatus as K, type ListDirectoryResponse as L, type SnapshotContentMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, SnapshotStatus as Q, type RunOptions as R, type SandboxOptions as S, StdinMode as T, type UpdateSandboxOptions as U, createSandboxImage as V, dockerfileContent as W, defaultRegisteredName as X, loadDockerfilePlan as Y, loadImagePlan as Z, logicalDockerfileLines as _, type CommandResult as a, type StartProcessOptions as b, type SendSignalResponse as c, type OutputEvent as d, type PtySessionInfo as e, type SandboxClientOptions as f, type CreateSandboxOptions as g, type CreateSandboxResponse as h, type SandboxInfo as i, type SandboxPortAccess as j, type SnapshotOptions as k, type CreateSnapshotResponse as l, type SnapshotInfo as m, type SnapshotAndWaitOptions as n, type CreatePoolOptions as o, type CreateSandboxPoolResponse as p, type SandboxPoolInfo as q, type UpdatePoolOptions as r, type CreateAndConnectOptions as s, type ContainerResourcesInfo as t, ContainerState as u, type CreateSandboxImageOptions as v, type DirectoryEntry as w, type DockerfileBuildPlan as x, type DockerfileInstruction as y, type ImageBuildOperation as z };
|
|
@@ -11,6 +11,17 @@ declare enum SnapshotStatus {
|
|
|
11
11
|
COMPLETED = "completed",
|
|
12
12
|
FAILED = "failed"
|
|
13
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Content mode for snapshot creation.
|
|
16
|
+
*
|
|
17
|
+
* - `"full"`: Full VM snapshot (memory + filesystem state). Sandboxes
|
|
18
|
+
* restored from this snapshot warm-restore VM memory.
|
|
19
|
+
* - `"filesystem_only"`: Filesystem-only snapshot. Sandboxes restored from
|
|
20
|
+
* this snapshot cold-boot from the snapshot tarball instead of warm-
|
|
21
|
+
* restoring VM state. Use this for sandbox image builds so that the
|
|
22
|
+
* restored sandbox bypasses Firecracker's overlay-path constraints.
|
|
23
|
+
*/
|
|
24
|
+
type SnapshotContentMode = "full" | "filesystem_only";
|
|
14
25
|
declare enum ProcessStatus {
|
|
15
26
|
RUNNING = "running",
|
|
16
27
|
EXITED = "exited",
|
|
@@ -106,7 +117,15 @@ interface SnapshotInfo {
|
|
|
106
117
|
sizeBytes?: number;
|
|
107
118
|
createdAt?: Date;
|
|
108
119
|
}
|
|
109
|
-
interface
|
|
120
|
+
interface SnapshotOptions {
|
|
121
|
+
/**
|
|
122
|
+
* Optional content mode for the snapshot. When omitted the server picks
|
|
123
|
+
* its default. Use `"filesystem_only"` for snapshots intended for sandbox
|
|
124
|
+
* image builds so that restored sandboxes cold-boot.
|
|
125
|
+
*/
|
|
126
|
+
contentMode?: SnapshotContentMode;
|
|
127
|
+
}
|
|
128
|
+
interface SnapshotAndWaitOptions extends SnapshotOptions {
|
|
110
129
|
timeout?: number;
|
|
111
130
|
pollInterval?: number;
|
|
112
131
|
}
|
|
@@ -353,6 +372,7 @@ interface BuildClient {
|
|
|
353
372
|
snapshotAndWait(sandboxId: string, options?: {
|
|
354
373
|
timeout?: number;
|
|
355
374
|
pollInterval?: number;
|
|
375
|
+
contentMode?: SnapshotContentMode;
|
|
356
376
|
}): Promise<SnapshotInfo>;
|
|
357
377
|
close(): void;
|
|
358
378
|
}
|
|
@@ -372,4 +392,4 @@ declare function loadImagePlan(image: Image, options?: Pick<CreateSandboxImageOp
|
|
|
372
392
|
declare function createSandboxImage(source: SandboxImageSource, options?: CreateSandboxImageOptions, deps?: CreateSandboxImageDeps): Promise<Record<string, unknown>>;
|
|
373
393
|
declare function runCreateSandboxImageCli(argv?: string[]): Promise<void>;
|
|
374
394
|
|
|
375
|
-
export {
|
|
395
|
+
export { runCreateSandboxImageCli as $, ImageBuildOperationType as A, type ImageOptions as B, type CreatePtySessionOptions as C, type DaemonInfo as D, OutputMode as E, type PoolContainerInfo as F, ProcessStatus as G, type HealthResponse as H, Image as I, type SandboxImageSource as J, SandboxStatus as K, type ListDirectoryResponse as L, type SnapshotContentMode as M, type NetworkConfig as N, type OutputResponse as O, type ProcessInfo as P, SnapshotStatus as Q, type RunOptions as R, type SandboxOptions as S, StdinMode as T, type UpdateSandboxOptions as U, createSandboxImage as V, dockerfileContent as W, defaultRegisteredName as X, loadDockerfilePlan as Y, loadImagePlan as Z, logicalDockerfileLines as _, type CommandResult as a, type StartProcessOptions as b, type SendSignalResponse as c, type OutputEvent as d, type PtySessionInfo as e, type SandboxClientOptions as f, type CreateSandboxOptions as g, type CreateSandboxResponse as h, type SandboxInfo as i, type SandboxPortAccess as j, type SnapshotOptions as k, type CreateSnapshotResponse as l, type SnapshotInfo as m, type SnapshotAndWaitOptions as n, type CreatePoolOptions as o, type CreateSandboxPoolResponse as p, type SandboxPoolInfo as q, type UpdatePoolOptions as r, type CreateAndConnectOptions as s, type ContainerResourcesInfo as t, ContainerState as u, type CreateSandboxImageOptions as v, type DirectoryEntry as w, type DockerfileBuildPlan as x, type DockerfileInstruction as y, type ImageBuildOperation as z };
|
package/dist/sandbox-image.cjs
CHANGED
|
@@ -159,7 +159,8 @@ var HttpClient = class {
|
|
|
159
159
|
timeoutMs;
|
|
160
160
|
abortController = null;
|
|
161
161
|
constructor(options) {
|
|
162
|
-
|
|
162
|
+
const url = options.baseUrl;
|
|
163
|
+
this.baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
163
164
|
this.maxRetries = options.maxRetries ?? MAX_RETRIES;
|
|
164
165
|
this.retryBackoffMs = options.retryBackoffMs ?? RETRY_BACKOFF_MS;
|
|
165
166
|
this.timeoutMs = options.timeoutMs ?? DEFAULT_HTTP_TIMEOUT_MS;
|
|
@@ -408,6 +409,9 @@ async function* parseSSEStream(stream, signal) {
|
|
|
408
409
|
}
|
|
409
410
|
|
|
410
411
|
// src/url.ts
|
|
412
|
+
function trimTrailingSlashes(url) {
|
|
413
|
+
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
414
|
+
}
|
|
411
415
|
function isLocalhost(apiUrl) {
|
|
412
416
|
try {
|
|
413
417
|
const parsed = new URL(apiUrl);
|
|
@@ -437,7 +441,7 @@ function resolveProxyTarget(proxyUrl, sandboxId) {
|
|
|
437
441
|
const host = parsed.hostname;
|
|
438
442
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
439
443
|
return {
|
|
440
|
-
baseUrl: proxyUrl
|
|
444
|
+
baseUrl: trimTrailingSlashes(proxyUrl),
|
|
441
445
|
hostHeader: `${sandboxId}.local`
|
|
442
446
|
};
|
|
443
447
|
}
|
|
@@ -448,7 +452,7 @@ function resolveProxyTarget(proxyUrl, sandboxId) {
|
|
|
448
452
|
};
|
|
449
453
|
} catch {
|
|
450
454
|
return {
|
|
451
|
-
baseUrl: `${proxyUrl
|
|
455
|
+
baseUrl: `${trimTrailingSlashes(proxyUrl)}/${sandboxId}`,
|
|
452
456
|
hostHeader: void 0
|
|
453
457
|
};
|
|
454
458
|
}
|
|
@@ -1129,10 +1133,12 @@ var SandboxClient = class _SandboxClient {
|
|
|
1129
1133
|
return fromSnakeKeys(raw, "sandboxId");
|
|
1130
1134
|
}
|
|
1131
1135
|
// --- Snapshots ---
|
|
1132
|
-
async snapshot(sandboxId) {
|
|
1136
|
+
async snapshot(sandboxId, options) {
|
|
1137
|
+
const requestOptions = options?.contentMode != null ? { body: { snapshot_content_mode: options.contentMode } } : void 0;
|
|
1133
1138
|
const raw = await this.http.requestJson(
|
|
1134
1139
|
"POST",
|
|
1135
|
-
this.path(`sandboxes/${sandboxId}/snapshot`)
|
|
1140
|
+
this.path(`sandboxes/${sandboxId}/snapshot`),
|
|
1141
|
+
requestOptions
|
|
1136
1142
|
);
|
|
1137
1143
|
return fromSnakeKeys(raw, "snapshotId");
|
|
1138
1144
|
}
|
|
@@ -1161,7 +1167,9 @@ var SandboxClient = class _SandboxClient {
|
|
|
1161
1167
|
async snapshotAndWait(sandboxId, options) {
|
|
1162
1168
|
const timeout = options?.timeout ?? 300;
|
|
1163
1169
|
const pollInterval = options?.pollInterval ?? 1;
|
|
1164
|
-
const result = await this.snapshot(sandboxId
|
|
1170
|
+
const result = await this.snapshot(sandboxId, {
|
|
1171
|
+
contentMode: options?.contentMode
|
|
1172
|
+
});
|
|
1165
1173
|
const deadline = Date.now() + timeout * 1e3;
|
|
1166
1174
|
while (Date.now() < deadline) {
|
|
1167
1175
|
const info = await this.getSnapshot(result.snapshotId);
|
|
@@ -1243,10 +1251,10 @@ var SandboxClient = class _SandboxClient {
|
|
|
1243
1251
|
);
|
|
1244
1252
|
}
|
|
1245
1253
|
// --- Connect ---
|
|
1246
|
-
connect(
|
|
1254
|
+
connect(identifier, proxyUrl) {
|
|
1247
1255
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
1248
1256
|
return new Sandbox({
|
|
1249
|
-
sandboxId,
|
|
1257
|
+
sandboxId: identifier,
|
|
1250
1258
|
proxyUrl: resolvedProxy,
|
|
1251
1259
|
apiKey: this.apiKey,
|
|
1252
1260
|
organizationId: this.organizationId,
|
|
@@ -2023,7 +2031,9 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
2023
2031
|
});
|
|
2024
2032
|
await executeDockerfilePlan(sandbox, plan, emit, sleep4);
|
|
2025
2033
|
emit({ type: "status", message: "Creating snapshot..." });
|
|
2026
|
-
const snapshot = await client.snapshotAndWait(sandbox.sandboxId
|
|
2034
|
+
const snapshot = await client.snapshotAndWait(sandbox.sandboxId, {
|
|
2035
|
+
contentMode: "filesystem_only"
|
|
2036
|
+
});
|
|
2027
2037
|
emit({
|
|
2028
2038
|
type: "snapshot_created",
|
|
2029
2039
|
snapshot_id: snapshot.snapshotId,
|