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.
@@ -120,7 +120,8 @@ var HttpClient = class {
120
120
  timeoutMs;
121
121
  abortController = null;
122
122
  constructor(options) {
123
- this.baseUrl = options.baseUrl.replace(/\/+$/, "");
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.replace(/\/+$/, ""),
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.replace(/\/+$/, "")}/${sandboxId}`,
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(sandboxId, proxyUrl) {
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,