tensorlake 0.4.47 → 0.4.48

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.
@@ -97,6 +97,7 @@ interface SandboxInfo {
97
97
  allowUnauthenticatedAccess?: boolean;
98
98
  exposedPorts?: number[];
99
99
  sandboxUrl?: string;
100
+ routingHint?: string;
100
101
  }
101
102
  interface SandboxPortAccess {
102
103
  allowUnauthenticatedAccess: boolean;
@@ -97,6 +97,7 @@ interface SandboxInfo {
97
97
  allowUnauthenticatedAccess?: boolean;
98
98
  exposedPorts?: number[];
99
99
  sandboxUrl?: string;
100
+ routingHint?: string;
100
101
  }
101
102
  interface SandboxPortAccess {
102
103
  allowUnauthenticatedAccess: boolean;
@@ -151,6 +151,13 @@ var RemoteAPIError = class extends SandboxError {
151
151
  };
152
152
 
153
153
  // src/http.ts
154
+ var import_undici = require("undici");
155
+ (0, import_undici.setGlobalDispatcher)(
156
+ new import_undici.Agent({
157
+ keepAliveTimeout: 6e4,
158
+ allowH2: true
159
+ })
160
+ );
154
161
  var HttpClient = class {
155
162
  baseUrl;
156
163
  headers;
@@ -202,31 +209,26 @@ var HttpClient = class {
202
209
  if (options?.contentType) {
203
210
  headers["Content-Type"] = options.contentType;
204
211
  }
205
- const response = await this.requestResponse(
206
- method,
207
- path2,
208
- {
209
- body: options?.body,
210
- headers,
211
- signal: options?.signal
212
- }
213
- );
212
+ const response = await this.requestResponse(method, path2, {
213
+ body: options?.body,
214
+ headers,
215
+ signal: options?.signal
216
+ });
214
217
  const buffer = await response.arrayBuffer();
215
218
  return new Uint8Array(buffer);
216
219
  }
217
220
  /** Make a request and return the response body as an SSE stream. */
218
221
  async requestStream(method, path2, options) {
219
- const response = await this.requestResponse(
220
- method,
221
- path2,
222
- {
223
- json: options?.json,
224
- headers: { Accept: "text/event-stream" },
225
- signal: options?.signal
226
- }
227
- );
222
+ const response = await this.requestResponse(method, path2, {
223
+ json: options?.json,
224
+ headers: { Accept: "text/event-stream" },
225
+ signal: options?.signal
226
+ });
228
227
  if (!response.body) {
229
- throw new RemoteAPIError(response.status, "No response body for SSE stream");
228
+ throw new RemoteAPIError(
229
+ response.status,
230
+ "No response body for SSE stream"
231
+ );
230
232
  }
231
233
  return response.body;
232
234
  }
@@ -265,7 +267,7 @@ var HttpClient = class {
265
267
  );
266
268
  const combinedSignal = signal ? anySignal([signal, this.abortController.signal]) : this.abortController.signal;
267
269
  try {
268
- const response = await fetch(url, {
270
+ const response = await (0, import_undici.fetch)(url, {
269
271
  method,
270
272
  headers,
271
273
  body,
@@ -3698,7 +3700,7 @@ var SandboxClient = class _SandboxClient {
3698
3700
  while (Date.now() < deadline) {
3699
3701
  const info = await this.get(result.sandboxId);
3700
3702
  if (info.status === "running" /* RUNNING */) {
3701
- const sandbox = this.connect(result.sandboxId, options?.proxyUrl);
3703
+ const sandbox = this.connect(result.sandboxId, options?.proxyUrl, info.routingHint);
3702
3704
  sandbox._setOwner(this);
3703
3705
  return sandbox;
3704
3706
  }