tensorlake 0.4.41 → 0.4.42
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 +18 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +18 -14
- package/dist/index.js.map +1 -1
- package/dist/sandbox-image.cjs +9 -5
- package/dist/sandbox-image.cjs.map +1 -1
- package/dist/sandbox-image.js +9 -5
- package/dist/sandbox-image.js.map +1 -1
- package/package.json +1 -1
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
|
}
|
|
@@ -1204,10 +1208,10 @@ var SandboxClient = class _SandboxClient {
|
|
|
1204
1208
|
);
|
|
1205
1209
|
}
|
|
1206
1210
|
// --- Connect ---
|
|
1207
|
-
connect(
|
|
1211
|
+
connect(identifier, proxyUrl) {
|
|
1208
1212
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
1209
1213
|
return new Sandbox({
|
|
1210
|
-
sandboxId,
|
|
1214
|
+
sandboxId: identifier,
|
|
1211
1215
|
proxyUrl: resolvedProxy,
|
|
1212
1216
|
apiKey: this.apiKey,
|
|
1213
1217
|
organizationId: this.organizationId,
|