tensorlake 0.4.46 → 0.4.47

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/dist/index.cjs CHANGED
@@ -176,6 +176,9 @@ var HttpClient = class {
176
176
  if (options.hostHeader) {
177
177
  this.headers["Host"] = options.hostHeader;
178
178
  }
179
+ if (options.routingHint) {
180
+ this.headers["X-Tensorlake-Route-Hint"] = options.routingHint;
181
+ }
179
182
  }
180
183
  close() {
181
184
  this.abortController?.abort();
@@ -3149,7 +3152,8 @@ var Sandbox = class {
3149
3152
  apiKey: options.apiKey,
3150
3153
  organizationId: options.organizationId,
3151
3154
  projectId: options.projectId,
3152
- hostHeader
3155
+ hostHeader,
3156
+ routingHint: options.routingHint
3153
3157
  });
3154
3158
  }
3155
3159
  /** @internal Used by SandboxClient.createAndConnect to set ownership. */
@@ -3744,14 +3748,15 @@ var SandboxClient = class _SandboxClient {
3744
3748
  );
3745
3749
  }
3746
3750
  // --- Connect ---
3747
- connect(identifier, proxyUrl) {
3751
+ connect(identifier, proxyUrl, routingHint) {
3748
3752
  const resolvedProxy = proxyUrl ?? resolveProxyUrl(this.apiUrl);
3749
3753
  return new Sandbox({
3750
3754
  sandboxId: identifier,
3751
3755
  proxyUrl: resolvedProxy,
3752
3756
  apiKey: this.apiKey,
3753
3757
  organizationId: this.organizationId,
3754
- projectId: this.projectId
3758
+ projectId: this.projectId,
3759
+ routingHint
3755
3760
  });
3756
3761
  }
3757
3762
  async createAndConnect(options) {
@@ -3762,6 +3767,11 @@ var SandboxClient = class _SandboxClient {
3762
3767
  } else {
3763
3768
  result = await this.create(options);
3764
3769
  }
3770
+ if (result.status === "running" /* RUNNING */) {
3771
+ const sandbox = this.connect(result.sandboxId, options?.proxyUrl, result.routingHint);
3772
+ sandbox._setOwner(this);
3773
+ return sandbox;
3774
+ }
3765
3775
  const deadline = Date.now() + startupTimeout * 1e3;
3766
3776
  while (Date.now() < deadline) {
3767
3777
  const info = await this.get(result.sandboxId);