@vercel/sandbox 0.0.20 → 0.0.21

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @vercel/sandbox@0.0.20 build /home/runner/work/sandbox-sdk/sandbox-sdk/packages/sandbox
2
+ > @vercel/sandbox@0.0.21 build /home/runner/work/sandbox-sdk/sandbox-sdk/packages/sandbox
3
3
  > tsc
4
4
 
@@ -1,4 +1,4 @@
1
1
 
2
- > @vercel/sandbox@0.0.20 typecheck /home/runner/work/sandbox-sdk/sandbox-sdk/packages/sandbox
2
+ > @vercel/sandbox@0.0.21 typecheck /home/runner/work/sandbox-sdk/sandbox-sdk/packages/sandbox
3
3
  > tsc --noEmit
4
4
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @vercel/sandbox
2
2
 
3
+ ## 0.0.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Disable Undici body timeout ([#126](https://github.com/vercel/sandbox-sdk/pull/126))
8
+
3
9
  ## 0.0.20
4
10
 
5
11
  ### Patch Changes
@@ -19,14 +19,14 @@ export declare class APIClient extends BaseClient {
19
19
  sandbox: {
20
20
  region: string;
21
21
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
22
+ timeout: number;
23
+ cwd: string;
22
24
  id: string;
23
25
  memory: number;
24
26
  vcpus: number;
25
27
  runtime: string;
26
- timeout: number;
27
28
  requestedAt: number;
28
29
  createdAt: number;
29
- cwd: string;
30
30
  updatedAt: number;
31
31
  duration?: number | undefined;
32
32
  startedAt?: number | undefined;
@@ -35,8 +35,8 @@ export declare class APIClient extends BaseClient {
35
35
  };
36
36
  routes: {
37
37
  url: string;
38
- subdomain: string;
39
38
  port: number;
39
+ subdomain: string;
40
40
  }[];
41
41
  }>>;
42
42
  createSandbox(params: WithPrivate<{
@@ -62,14 +62,14 @@ export declare class APIClient extends BaseClient {
62
62
  sandbox: {
63
63
  region: string;
64
64
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
65
+ timeout: number;
66
+ cwd: string;
65
67
  id: string;
66
68
  memory: number;
67
69
  vcpus: number;
68
70
  runtime: string;
69
- timeout: number;
70
71
  requestedAt: number;
71
72
  createdAt: number;
72
- cwd: string;
73
73
  updatedAt: number;
74
74
  duration?: number | undefined;
75
75
  startedAt?: number | undefined;
@@ -78,8 +78,8 @@ export declare class APIClient extends BaseClient {
78
78
  };
79
79
  routes: {
80
80
  url: string;
81
- subdomain: string;
82
81
  port: number;
82
+ subdomain: string;
83
83
  }[];
84
84
  }>>;
85
85
  runCommand(params: {
@@ -93,9 +93,9 @@ export declare class APIClient extends BaseClient {
93
93
  command: {
94
94
  name: string;
95
95
  args: string[];
96
+ cwd: string;
96
97
  id: string;
97
98
  startedAt: number;
98
- cwd: string;
99
99
  sandboxId: string;
100
100
  exitCode: number | null;
101
101
  };
@@ -147,14 +147,14 @@ export declare class APIClient extends BaseClient {
147
147
  sandboxes: {
148
148
  region: string;
149
149
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
150
+ timeout: number;
151
+ cwd: string;
150
152
  id: string;
151
153
  memory: number;
152
154
  vcpus: number;
153
155
  runtime: string;
154
- timeout: number;
155
156
  requestedAt: number;
156
157
  createdAt: number;
157
- cwd: string;
158
158
  updatedAt: number;
159
159
  duration?: number | undefined;
160
160
  startedAt?: number | undefined;
@@ -189,9 +189,9 @@ export declare class APIClient extends BaseClient {
189
189
  command: {
190
190
  name: string;
191
191
  args: string[];
192
+ cwd: string;
192
193
  id: string;
193
194
  startedAt: number;
194
- cwd: string;
195
195
  sandboxId: string;
196
196
  exitCode: number | null;
197
197
  };
@@ -19,6 +19,7 @@ export declare class BaseClient {
19
19
  private fetch;
20
20
  private debug;
21
21
  private host;
22
+ private agent;
22
23
  constructor(params: {
23
24
  debug?: boolean;
24
25
  host: string;
@@ -6,6 +6,7 @@ exports.parseOrThrow = parseOrThrow;
6
6
  const api_error_1 = require("./api-error");
7
7
  const array_1 = require("../utils/array");
8
8
  const with_retry_1 = require("./with-retry");
9
+ const undici_1 = require("undici");
9
10
  /**
10
11
  * A base API client that provides a convenience wrapper for fetching where
11
12
  * we can pass query parameters as an object, support retries, debugging
@@ -17,6 +18,9 @@ class BaseClient {
17
18
  this.host = params.host;
18
19
  this.debug = params.debug ?? process.env.DEBUG_FETCH === "true";
19
20
  this.token = params.token;
21
+ this.agent = new undici_1.Agent({
22
+ bodyTimeout: 0, // disable body timeout to allow long logs streaming
23
+ });
20
24
  }
21
25
  async request(path, opts) {
22
26
  const url = new URL(path, this.host);
@@ -35,6 +39,8 @@ class BaseClient {
35
39
  headers: this.token
36
40
  ? { Authorization: `Bearer ${this.token}`, ...opts?.headers }
37
41
  : opts?.headers,
42
+ // @ts-expect-error Node.js' and undici's Agent have different types
43
+ dispatcher: this.agent,
38
44
  });
39
45
  if (this.debug) {
40
46
  const duration = Date.now() - start;
@@ -19,14 +19,14 @@ export declare const Sandbox: z.ZodObject<{
19
19
  }, "strip", z.ZodTypeAny, {
20
20
  region: string;
21
21
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
22
+ timeout: number;
23
+ cwd: string;
22
24
  id: string;
23
25
  memory: number;
24
26
  vcpus: number;
25
27
  runtime: string;
26
- timeout: number;
27
28
  requestedAt: number;
28
29
  createdAt: number;
29
- cwd: string;
30
30
  updatedAt: number;
31
31
  duration?: number | undefined;
32
32
  startedAt?: number | undefined;
@@ -35,14 +35,14 @@ export declare const Sandbox: z.ZodObject<{
35
35
  }, {
36
36
  region: string;
37
37
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
38
+ timeout: number;
39
+ cwd: string;
38
40
  id: string;
39
41
  memory: number;
40
42
  vcpus: number;
41
43
  runtime: string;
42
- timeout: number;
43
44
  requestedAt: number;
44
45
  createdAt: number;
45
- cwd: string;
46
46
  updatedAt: number;
47
47
  duration?: number | undefined;
48
48
  startedAt?: number | undefined;
@@ -56,12 +56,12 @@ export declare const SandboxRoute: z.ZodObject<{
56
56
  port: z.ZodNumber;
57
57
  }, "strip", z.ZodTypeAny, {
58
58
  url: string;
59
- subdomain: string;
60
59
  port: number;
60
+ subdomain: string;
61
61
  }, {
62
62
  url: string;
63
- subdomain: string;
64
63
  port: number;
64
+ subdomain: string;
65
65
  }>;
66
66
  export declare const Pagination: z.ZodObject<{
67
67
  /**
@@ -100,17 +100,17 @@ export declare const Command: z.ZodObject<{
100
100
  }, "strip", z.ZodTypeAny, {
101
101
  name: string;
102
102
  args: string[];
103
+ cwd: string;
103
104
  id: string;
104
105
  startedAt: number;
105
- cwd: string;
106
106
  sandboxId: string;
107
107
  exitCode: number | null;
108
108
  }, {
109
109
  name: string;
110
110
  args: string[];
111
+ cwd: string;
111
112
  id: string;
112
113
  startedAt: number;
113
- cwd: string;
114
114
  sandboxId: string;
115
115
  exitCode: number | null;
116
116
  }>;
@@ -134,14 +134,14 @@ export declare const SandboxResponse: z.ZodObject<{
134
134
  }, "strip", z.ZodTypeAny, {
135
135
  region: string;
136
136
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
137
+ timeout: number;
138
+ cwd: string;
137
139
  id: string;
138
140
  memory: number;
139
141
  vcpus: number;
140
142
  runtime: string;
141
- timeout: number;
142
143
  requestedAt: number;
143
144
  createdAt: number;
144
- cwd: string;
145
145
  updatedAt: number;
146
146
  duration?: number | undefined;
147
147
  startedAt?: number | undefined;
@@ -150,14 +150,14 @@ export declare const SandboxResponse: z.ZodObject<{
150
150
  }, {
151
151
  region: string;
152
152
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
153
+ timeout: number;
154
+ cwd: string;
153
155
  id: string;
154
156
  memory: number;
155
157
  vcpus: number;
156
158
  runtime: string;
157
- timeout: number;
158
159
  requestedAt: number;
159
160
  createdAt: number;
160
- cwd: string;
161
161
  updatedAt: number;
162
162
  duration?: number | undefined;
163
163
  startedAt?: number | undefined;
@@ -168,14 +168,14 @@ export declare const SandboxResponse: z.ZodObject<{
168
168
  sandbox: {
169
169
  region: string;
170
170
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
171
+ timeout: number;
172
+ cwd: string;
171
173
  id: string;
172
174
  memory: number;
173
175
  vcpus: number;
174
176
  runtime: string;
175
- timeout: number;
176
177
  requestedAt: number;
177
178
  createdAt: number;
178
- cwd: string;
179
179
  updatedAt: number;
180
180
  duration?: number | undefined;
181
181
  startedAt?: number | undefined;
@@ -186,14 +186,14 @@ export declare const SandboxResponse: z.ZodObject<{
186
186
  sandbox: {
187
187
  region: string;
188
188
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
189
+ timeout: number;
190
+ cwd: string;
189
191
  id: string;
190
192
  memory: number;
191
193
  vcpus: number;
192
194
  runtime: string;
193
- timeout: number;
194
195
  requestedAt: number;
195
196
  createdAt: number;
196
- cwd: string;
197
197
  updatedAt: number;
198
198
  duration?: number | undefined;
199
199
  startedAt?: number | undefined;
@@ -221,14 +221,14 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
221
221
  }, "strip", z.ZodTypeAny, {
222
222
  region: string;
223
223
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
224
+ timeout: number;
225
+ cwd: string;
224
226
  id: string;
225
227
  memory: number;
226
228
  vcpus: number;
227
229
  runtime: string;
228
- timeout: number;
229
230
  requestedAt: number;
230
231
  createdAt: number;
231
- cwd: string;
232
232
  updatedAt: number;
233
233
  duration?: number | undefined;
234
234
  startedAt?: number | undefined;
@@ -237,14 +237,14 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
237
237
  }, {
238
238
  region: string;
239
239
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
240
+ timeout: number;
241
+ cwd: string;
240
242
  id: string;
241
243
  memory: number;
242
244
  vcpus: number;
243
245
  runtime: string;
244
- timeout: number;
245
246
  requestedAt: number;
246
247
  createdAt: number;
247
- cwd: string;
248
248
  updatedAt: number;
249
249
  duration?: number | undefined;
250
250
  startedAt?: number | undefined;
@@ -258,25 +258,25 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
258
258
  port: z.ZodNumber;
259
259
  }, "strip", z.ZodTypeAny, {
260
260
  url: string;
261
- subdomain: string;
262
261
  port: number;
262
+ subdomain: string;
263
263
  }, {
264
264
  url: string;
265
- subdomain: string;
266
265
  port: number;
266
+ subdomain: string;
267
267
  }>, "many">;
268
268
  }, "strip", z.ZodTypeAny, {
269
269
  sandbox: {
270
270
  region: string;
271
271
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
272
+ timeout: number;
273
+ cwd: string;
272
274
  id: string;
273
275
  memory: number;
274
276
  vcpus: number;
275
277
  runtime: string;
276
- timeout: number;
277
278
  requestedAt: number;
278
279
  createdAt: number;
279
- cwd: string;
280
280
  updatedAt: number;
281
281
  duration?: number | undefined;
282
282
  startedAt?: number | undefined;
@@ -285,21 +285,21 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
285
285
  };
286
286
  routes: {
287
287
  url: string;
288
- subdomain: string;
289
288
  port: number;
289
+ subdomain: string;
290
290
  }[];
291
291
  }, {
292
292
  sandbox: {
293
293
  region: string;
294
294
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
295
+ timeout: number;
296
+ cwd: string;
295
297
  id: string;
296
298
  memory: number;
297
299
  vcpus: number;
298
300
  runtime: string;
299
- timeout: number;
300
301
  requestedAt: number;
301
302
  createdAt: number;
302
- cwd: string;
303
303
  updatedAt: number;
304
304
  duration?: number | undefined;
305
305
  startedAt?: number | undefined;
@@ -308,8 +308,8 @@ export declare const SandboxAndRoutesResponse: z.ZodObject<{
308
308
  };
309
309
  routes: {
310
310
  url: string;
311
- subdomain: string;
312
311
  port: number;
312
+ subdomain: string;
313
313
  }[];
314
314
  }>;
315
315
  export declare const CommandResponse: z.ZodObject<{
@@ -324,17 +324,17 @@ export declare const CommandResponse: z.ZodObject<{
324
324
  }, "strip", z.ZodTypeAny, {
325
325
  name: string;
326
326
  args: string[];
327
+ cwd: string;
327
328
  id: string;
328
329
  startedAt: number;
329
- cwd: string;
330
330
  sandboxId: string;
331
331
  exitCode: number | null;
332
332
  }, {
333
333
  name: string;
334
334
  args: string[];
335
+ cwd: string;
335
336
  id: string;
336
337
  startedAt: number;
337
- cwd: string;
338
338
  sandboxId: string;
339
339
  exitCode: number | null;
340
340
  }>;
@@ -342,9 +342,9 @@ export declare const CommandResponse: z.ZodObject<{
342
342
  command: {
343
343
  name: string;
344
344
  args: string[];
345
+ cwd: string;
345
346
  id: string;
346
347
  startedAt: number;
347
- cwd: string;
348
348
  sandboxId: string;
349
349
  exitCode: number | null;
350
350
  };
@@ -352,9 +352,9 @@ export declare const CommandResponse: z.ZodObject<{
352
352
  command: {
353
353
  name: string;
354
354
  args: string[];
355
+ cwd: string;
355
356
  id: string;
356
357
  startedAt: number;
357
- cwd: string;
358
358
  sandboxId: string;
359
359
  exitCode: number | null;
360
360
  };
@@ -372,17 +372,17 @@ export declare const CommandFinishedResponse: z.ZodObject<{
372
372
  }, "strip", z.ZodTypeAny, {
373
373
  name: string;
374
374
  args: string[];
375
+ cwd: string;
375
376
  id: string;
376
377
  startedAt: number;
377
- cwd: string;
378
378
  sandboxId: string;
379
379
  exitCode: number;
380
380
  }, {
381
381
  name: string;
382
382
  args: string[];
383
+ cwd: string;
383
384
  id: string;
384
385
  startedAt: number;
385
- cwd: string;
386
386
  sandboxId: string;
387
387
  exitCode: number;
388
388
  }>;
@@ -390,9 +390,9 @@ export declare const CommandFinishedResponse: z.ZodObject<{
390
390
  command: {
391
391
  name: string;
392
392
  args: string[];
393
+ cwd: string;
393
394
  id: string;
394
395
  startedAt: number;
395
- cwd: string;
396
396
  sandboxId: string;
397
397
  exitCode: number;
398
398
  };
@@ -400,9 +400,9 @@ export declare const CommandFinishedResponse: z.ZodObject<{
400
400
  command: {
401
401
  name: string;
402
402
  args: string[];
403
+ cwd: string;
403
404
  id: string;
404
405
  startedAt: number;
405
- cwd: string;
406
406
  sandboxId: string;
407
407
  exitCode: number;
408
408
  };
@@ -412,11 +412,11 @@ export declare const LogLine: z.ZodObject<{
412
412
  stream: z.ZodEnum<["stdout", "stderr"]>;
413
413
  data: z.ZodString;
414
414
  }, "strip", z.ZodTypeAny, {
415
- stream: "stdout" | "stderr";
416
415
  data: string;
417
- }, {
418
416
  stream: "stdout" | "stderr";
417
+ }, {
419
418
  data: string;
419
+ stream: "stdout" | "stderr";
420
420
  }>;
421
421
  export declare const SandboxesResponse: z.ZodObject<{
422
422
  sandboxes: z.ZodArray<z.ZodObject<{
@@ -438,14 +438,14 @@ export declare const SandboxesResponse: z.ZodObject<{
438
438
  }, "strip", z.ZodTypeAny, {
439
439
  region: string;
440
440
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
441
+ timeout: number;
442
+ cwd: string;
441
443
  id: string;
442
444
  memory: number;
443
445
  vcpus: number;
444
446
  runtime: string;
445
- timeout: number;
446
447
  requestedAt: number;
447
448
  createdAt: number;
448
- cwd: string;
449
449
  updatedAt: number;
450
450
  duration?: number | undefined;
451
451
  startedAt?: number | undefined;
@@ -454,14 +454,14 @@ export declare const SandboxesResponse: z.ZodObject<{
454
454
  }, {
455
455
  region: string;
456
456
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
457
+ timeout: number;
458
+ cwd: string;
457
459
  id: string;
458
460
  memory: number;
459
461
  vcpus: number;
460
462
  runtime: string;
461
- timeout: number;
462
463
  requestedAt: number;
463
464
  createdAt: number;
464
- cwd: string;
465
465
  updatedAt: number;
466
466
  duration?: number | undefined;
467
467
  startedAt?: number | undefined;
@@ -497,14 +497,14 @@ export declare const SandboxesResponse: z.ZodObject<{
497
497
  sandboxes: {
498
498
  region: string;
499
499
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
500
+ timeout: number;
501
+ cwd: string;
500
502
  id: string;
501
503
  memory: number;
502
504
  vcpus: number;
503
505
  runtime: string;
504
- timeout: number;
505
506
  requestedAt: number;
506
507
  createdAt: number;
507
- cwd: string;
508
508
  updatedAt: number;
509
509
  duration?: number | undefined;
510
510
  startedAt?: number | undefined;
@@ -520,14 +520,14 @@ export declare const SandboxesResponse: z.ZodObject<{
520
520
  sandboxes: {
521
521
  region: string;
522
522
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
523
+ timeout: number;
524
+ cwd: string;
523
525
  id: string;
524
526
  memory: number;
525
527
  vcpus: number;
526
528
  runtime: string;
527
- timeout: number;
528
529
  requestedAt: number;
529
530
  createdAt: number;
530
- cwd: string;
531
531
  updatedAt: number;
532
532
  duration?: number | undefined;
533
533
  startedAt?: number | undefined;
package/dist/command.d.ts CHANGED
@@ -68,8 +68,8 @@ export declare class Command {
68
68
  logs(opts?: {
69
69
  signal?: AbortSignal;
70
70
  }): AsyncGenerator<{
71
- stream: "stdout" | "stderr";
72
71
  data: string;
72
+ stream: "stdout" | "stderr";
73
73
  }, void, void> & Disposable & {
74
74
  close(): void;
75
75
  };
package/dist/sandbox.d.ts CHANGED
@@ -131,14 +131,14 @@ export declare class Sandbox {
131
131
  sandboxes: {
132
132
  region: string;
133
133
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
134
+ timeout: number;
135
+ cwd: string;
134
136
  id: string;
135
137
  memory: number;
136
138
  vcpus: number;
137
139
  runtime: string;
138
- timeout: number;
139
140
  requestedAt: number;
140
141
  createdAt: number;
141
- cwd: string;
142
142
  updatedAt: number;
143
143
  duration?: number | undefined;
144
144
  startedAt?: number | undefined;
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "0.0.20";
1
+ export declare const VERSION = "0.0.21";
package/dist/version.js CHANGED
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
4
  // Autogenerated by inject-version.ts
5
- exports.VERSION = "0.0.20";
5
+ exports.VERSION = "0.0.21";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vercel/sandbox",
3
- "version": "0.0.20",
3
+ "version": "0.0.21",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -14,6 +14,7 @@
14
14
  "jsonlines": "0.1.1",
15
15
  "ms": "2.1.3",
16
16
  "tar-stream": "3.1.7",
17
+ "undici": "^7.16.0",
17
18
  "zod": "3.24.4"
18
19
  },
19
20
  "devDependencies": {
@@ -3,6 +3,7 @@ import { APIError } from "./api-error";
3
3
  import { ZodType } from "zod";
4
4
  import { array } from "../utils/array";
5
5
  import { withRetry, type RequestOptions } from "./with-retry";
6
+ import { Agent } from "undici";
6
7
 
7
8
  export interface RequestParams extends RequestInit {
8
9
  headers?: Record<string, string>;
@@ -22,12 +23,16 @@ export class BaseClient {
22
23
  private fetch: ReturnType<typeof withRetry<RequestInit>>;
23
24
  private debug: boolean;
24
25
  private host: string;
26
+ private agent: Agent;
25
27
 
26
28
  constructor(params: { debug?: boolean; host: string; token?: string }) {
27
29
  this.fetch = withRetry(globalThis.fetch);
28
30
  this.host = params.host;
29
31
  this.debug = params.debug ?? process.env.DEBUG_FETCH === "true";
30
32
  this.token = params.token;
33
+ this.agent = new Agent({
34
+ bodyTimeout: 0, // disable body timeout to allow long logs streaming
35
+ });
31
36
  }
32
37
 
33
38
  protected async request(path: string, opts?: RequestParams) {
@@ -48,6 +53,8 @@ export class BaseClient {
48
53
  headers: this.token
49
54
  ? { Authorization: `Bearer ${this.token}`, ...opts?.headers }
50
55
  : opts?.headers,
56
+ // @ts-expect-error Node.js' and undici's Agent have different types
57
+ dispatcher: this.agent,
51
58
  });
52
59
 
53
60
  if (this.debug) {
package/src/version.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  // Autogenerated by inject-version.ts
2
- export const VERSION = "0.0.20";
2
+ export const VERSION = "0.0.21";