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.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
|
}
|
|
@@ -1243,10 +1247,10 @@ var SandboxClient = class _SandboxClient {
|
|
|
1243
1247
|
);
|
|
1244
1248
|
}
|
|
1245
1249
|
// --- Connect ---
|
|
1246
|
-
connect(
|
|
1250
|
+
connect(identifier, proxyUrl) {
|
|
1247
1251
|
const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
|
|
1248
1252
|
return new Sandbox({
|
|
1249
|
-
sandboxId,
|
|
1253
|
+
sandboxId: identifier,
|
|
1250
1254
|
proxyUrl: resolvedProxy,
|
|
1251
1255
|
apiKey: this.apiKey,
|
|
1252
1256
|
organizationId: this.organizationId,
|