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
package/dist/sandbox-image.d.cts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-Dr9SQaCc.cjs';
|
package/dist/sandbox-image.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { v as CreateSandboxImageOptions, x as DockerfileBuildPlan, y as DockerfileInstruction, J as SandboxImageSource, V as createSandboxImage, X as defaultRegisteredName, Y as loadDockerfilePlan, Z as loadImagePlan, _ as logicalDockerfileLines, $ as runCreateSandboxImageCli } from './sandbox-image-Dr9SQaCc.js';
|
package/dist/sandbox-image.js
CHANGED
|
@@ -120,7 +120,8 @@ var HttpClient = class {
|
|
|
120
120
|
timeoutMs;
|
|
121
121
|
abortController = null;
|
|
122
122
|
constructor(options) {
|
|
123
|
-
|
|
123
|
+
const url = options.baseUrl;
|
|
124
|
+
this.baseUrl = url.endsWith("/") ? url.slice(0, -1) : url;
|
|
124
125
|
this.maxRetries = options.maxRetries ?? MAX_RETRIES;
|
|
125
126
|
this.retryBackoffMs = options.retryBackoffMs ?? RETRY_BACKOFF_MS;
|
|
126
127
|
this.timeoutMs = options.timeoutMs ?? DEFAULT_HTTP_TIMEOUT_MS;
|
|
@@ -369,6 +370,9 @@ async function* parseSSEStream(stream, signal) {
|
|
|
369
370
|
}
|
|
370
371
|
|
|
371
372
|
// src/url.ts
|
|
373
|
+
function trimTrailingSlashes(url) {
|
|
374
|
+
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
375
|
+
}
|
|
372
376
|
function isLocalhost(apiUrl) {
|
|
373
377
|
try {
|
|
374
378
|
const parsed = new URL(apiUrl);
|
|
@@ -398,7 +402,7 @@ function resolveProxyTarget(proxyUrl, sandboxId) {
|
|
|
398
402
|
const host = parsed.hostname;
|
|
399
403
|
if (host === "localhost" || host === "127.0.0.1") {
|
|
400
404
|
return {
|
|
401
|
-
baseUrl: proxyUrl
|
|
405
|
+
baseUrl: trimTrailingSlashes(proxyUrl),
|
|
402
406
|
hostHeader: `${sandboxId}.local`
|
|
403
407
|
};
|
|
404
408
|
}
|
|
@@ -409,7 +413,7 @@ function resolveProxyTarget(proxyUrl, sandboxId) {
|
|
|
409
413
|
};
|
|
410
414
|
} catch {
|
|
411
415
|
return {
|
|
412
|
-
baseUrl: `${proxyUrl
|
|
416
|
+
baseUrl: `${trimTrailingSlashes(proxyUrl)}/${sandboxId}`,
|
|
413
417
|
hostHeader: void 0
|
|
414
418
|
};
|
|
415
419
|
}
|
|
@@ -1090,10 +1094,12 @@ var SandboxClient = class _SandboxClient {
|
|
|
1090
1094
|
return fromSnakeKeys(raw, "sandboxId");
|
|
1091
1095
|
}
|
|
1092
1096
|
// --- Snapshots ---
|
|
1093
|
-
async snapshot(sandboxId) {
|
|
1097
|
+
async snapshot(sandboxId, options) {
|
|
1098
|
+
const requestOptions = options?.contentMode != null ? { body: { snapshot_content_mode: options.contentMode } } : void 0;
|
|
1094
1099
|
const raw = await this.http.requestJson(
|
|
1095
1100
|
"POST",
|
|
1096
|
-
this.path(`sandboxes/${sandboxId}/snapshot`)
|
|
1101
|
+
this.path(`sandboxes/${sandboxId}/snapshot`),
|
|
1102
|
+
requestOptions
|
|
1097
1103
|
);
|
|
1098
1104
|
return fromSnakeKeys(raw, "snapshotId");
|
|
1099
1105
|
}
|
|
@@ -1122,7 +1128,9 @@ var SandboxClient = class _SandboxClient {
|
|
|
1122
1128
|
async snapshotAndWait(sandboxId, options) {
|
|
1123
1129
|
const timeout = options?.timeout ?? 300;
|
|
1124
1130
|
const pollInterval = options?.pollInterval ?? 1;
|
|
1125
|
-
const result = await this.snapshot(sandboxId
|
|
1131
|
+
const result = await this.snapshot(sandboxId, {
|
|
1132
|
+
contentMode: options?.contentMode
|
|
1133
|
+
});
|
|
1126
1134
|
const deadline = Date.now() + timeout * 1e3;
|
|
1127
1135
|
while (Date.now() < deadline) {
|
|
1128
1136
|
const info = await this.getSnapshot(result.snapshotId);
|
|
@@ -1204,10 +1212,10 @@ var SandboxClient = class _SandboxClient {
|
|
|
1204
1212
|
);
|
|
1205
1213
|
}
|
|
1206
1214
|
// --- Connect ---
|
|
1207
|
-
connect(
|
|
1215
|
+
connect(identifier, proxyUrl) {
|
|
1208
1216
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
1209
1217
|
return new Sandbox({
|
|
1210
|
-
sandboxId,
|
|
1218
|
+
sandboxId: identifier,
|
|
1211
1219
|
proxyUrl: resolvedProxy,
|
|
1212
1220
|
apiKey: this.apiKey,
|
|
1213
1221
|
organizationId: this.organizationId,
|
|
@@ -1984,7 +1992,9 @@ async function createSandboxImage(source, options = {}, deps = {}) {
|
|
|
1984
1992
|
});
|
|
1985
1993
|
await executeDockerfilePlan(sandbox, plan, emit, sleep4);
|
|
1986
1994
|
emit({ type: "status", message: "Creating snapshot..." });
|
|
1987
|
-
const snapshot = await client.snapshotAndWait(sandbox.sandboxId
|
|
1995
|
+
const snapshot = await client.snapshotAndWait(sandbox.sandboxId, {
|
|
1996
|
+
contentMode: "filesystem_only"
|
|
1997
|
+
});
|
|
1988
1998
|
emit({
|
|
1989
1999
|
type: "snapshot_created",
|
|
1990
2000
|
snapshot_id: snapshot.snapshotId,
|