@vercel/sandbox 0.0.20 → 0.0.22

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.
@@ -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
  };
@@ -88,9 +88,13 @@ export declare class Command {
88
88
  * }
89
89
  * ```
90
90
  *
91
+ * @param params - Optional parameters.
92
+ * @param params.signal - An AbortSignal to cancel waiting.
91
93
  * @returns A {@link CommandFinished} instance with populated exit code.
92
94
  */
93
- wait(): Promise<CommandFinished>;
95
+ wait(params?: {
96
+ signal?: AbortSignal;
97
+ }): Promise<CommandFinished>;
94
98
  /**
95
99
  * Get the output of `stdout`, `stderr`, or both as a string.
96
100
  *
@@ -98,35 +102,50 @@ export declare class Command {
98
102
  * not output valid Unicode.
99
103
  *
100
104
  * @param stream - The output stream to read: "stdout", "stderr", or "both".
105
+ * @param opts - Optional parameters.
106
+ * @param opts.signal - An AbortSignal to cancel output streaming.
101
107
  * @returns The output of the specified stream(s) as a string.
102
108
  */
103
- output(stream?: "stdout" | "stderr" | "both"): Promise<string>;
109
+ output(stream?: "stdout" | "stderr" | "both", opts?: {
110
+ signal?: AbortSignal;
111
+ }): Promise<string>;
104
112
  /**
105
113
  * Get the output of `stdout` as a string.
106
114
  *
107
115
  * NOTE: This may throw string conversion errors if the command does
108
116
  * not output valid Unicode.
109
117
  *
118
+ * @param opts - Optional parameters.
119
+ * @param opts.signal - An AbortSignal to cancel output streaming.
110
120
  * @returns The standard output of the command.
111
121
  */
112
- stdout(): Promise<string>;
122
+ stdout(opts?: {
123
+ signal?: AbortSignal;
124
+ }): Promise<string>;
113
125
  /**
114
126
  * Get the output of `stderr` as a string.
115
127
  *
116
128
  * NOTE: This may throw string conversion errors if the command does
117
129
  * not output valid Unicode.
118
130
  *
131
+ * @param opts - Optional parameters.
132
+ * @param opts.signal - An AbortSignal to cancel output streaming.
119
133
  * @returns The standard error output of the command.
120
134
  */
121
- stderr(): Promise<string>;
135
+ stderr(opts?: {
136
+ signal?: AbortSignal;
137
+ }): Promise<string>;
122
138
  /**
123
139
  * Kill a running command in a sandbox.
124
140
  *
125
- * @param params - commandId and the signal to send the running process.
126
- * Defaults to SIGTERM.
141
+ * @param signal - The signal to send the running process. Defaults to SIGTERM.
142
+ * @param opts - Optional parameters.
143
+ * @param opts.abortSignal - An AbortSignal to cancel the kill operation.
127
144
  * @returns Promise<void>.
128
145
  */
129
- kill(signal?: Signal): Promise<void>;
146
+ kill(signal?: Signal, opts?: {
147
+ abortSignal?: AbortSignal;
148
+ }): Promise<void>;
130
149
  }
131
150
  /**
132
151
  * A command that has finished executing.
package/dist/command.js CHANGED
@@ -82,13 +82,17 @@ class Command {
82
82
  * }
83
83
  * ```
84
84
  *
85
+ * @param params - Optional parameters.
86
+ * @param params.signal - An AbortSignal to cancel waiting.
85
87
  * @returns A {@link CommandFinished} instance with populated exit code.
86
88
  */
87
- async wait() {
89
+ async wait(params) {
90
+ params?.signal?.throwIfAborted();
88
91
  const command = await this.client.getCommand({
89
92
  sandboxId: this.sandboxId,
90
93
  cmdId: this.cmd.id,
91
94
  wait: true,
95
+ signal: params?.signal,
92
96
  });
93
97
  return new CommandFinished({
94
98
  client: this.client,
@@ -104,11 +108,13 @@ class Command {
104
108
  * not output valid Unicode.
105
109
  *
106
110
  * @param stream - The output stream to read: "stdout", "stderr", or "both".
111
+ * @param opts - Optional parameters.
112
+ * @param opts.signal - An AbortSignal to cancel output streaming.
107
113
  * @returns The output of the specified stream(s) as a string.
108
114
  */
109
- async output(stream = "both") {
115
+ async output(stream = "both", opts) {
110
116
  let data = "";
111
- for await (const log of this.logs()) {
117
+ for await (const log of this.logs({ signal: opts?.signal })) {
112
118
  if (stream === "both" || log.stream === stream) {
113
119
  data += log.data;
114
120
  }
@@ -121,10 +127,12 @@ class Command {
121
127
  * NOTE: This may throw string conversion errors if the command does
122
128
  * not output valid Unicode.
123
129
  *
130
+ * @param opts - Optional parameters.
131
+ * @param opts.signal - An AbortSignal to cancel output streaming.
124
132
  * @returns The standard output of the command.
125
133
  */
126
- async stdout() {
127
- return this.output("stdout");
134
+ async stdout(opts) {
135
+ return this.output("stdout", opts);
128
136
  }
129
137
  /**
130
138
  * Get the output of `stderr` as a string.
@@ -132,23 +140,27 @@ class Command {
132
140
  * NOTE: This may throw string conversion errors if the command does
133
141
  * not output valid Unicode.
134
142
  *
143
+ * @param opts - Optional parameters.
144
+ * @param opts.signal - An AbortSignal to cancel output streaming.
135
145
  * @returns The standard error output of the command.
136
146
  */
137
- async stderr() {
138
- return this.output("stderr");
147
+ async stderr(opts) {
148
+ return this.output("stderr", opts);
139
149
  }
140
150
  /**
141
151
  * Kill a running command in a sandbox.
142
152
  *
143
- * @param params - commandId and the signal to send the running process.
144
- * Defaults to SIGTERM.
153
+ * @param signal - The signal to send the running process. Defaults to SIGTERM.
154
+ * @param opts - Optional parameters.
155
+ * @param opts.abortSignal - An AbortSignal to cancel the kill operation.
145
156
  * @returns Promise<void>.
146
157
  */
147
- async kill(signal) {
158
+ async kill(signal, opts) {
148
159
  await this.client.killCommand({
149
160
  sandboxId: this.sandboxId,
150
161
  commandId: this.cmd.id,
151
162
  signal: (0, resolveSignal_1.resolveSignal)(signal ?? "SIGTERM"),
163
+ abortSignal: opts?.abortSignal,
152
164
  });
153
165
  }
154
166
  }
package/dist/sandbox.d.ts CHANGED
@@ -54,6 +54,10 @@ export interface CreateSandboxParams {
54
54
  * If not specified, the default runtime `node22` will be used.
55
55
  */
56
56
  runtime?: "node22" | "python3.13" | (string & {});
57
+ /**
58
+ * An AbortSignal to cancel sandbox creation.
59
+ */
60
+ signal?: AbortSignal;
57
61
  }
58
62
  /** @inline */
59
63
  interface GetSandboxParams {
@@ -61,6 +65,10 @@ interface GetSandboxParams {
61
65
  * Unique identifier of the sandbox.
62
66
  */
63
67
  sandboxId: string;
68
+ /**
69
+ * An AbortSignal to cancel the operation.
70
+ */
71
+ signal?: AbortSignal;
64
72
  }
65
73
  /** @inline */
66
74
  interface RunCommandParams {
@@ -96,6 +104,10 @@ interface RunCommandParams {
96
104
  * A `Writable` stream where `stderr` from the command will be piped
97
105
  */
98
106
  stderr?: Writable;
107
+ /**
108
+ * An AbortSignal to cancel the command execution
109
+ */
110
+ signal?: AbortSignal;
99
111
  }
100
112
  /**
101
113
  * A Sandbox is an isolated Linux MicroVM to run commands in.
@@ -131,14 +143,14 @@ export declare class Sandbox {
131
143
  sandboxes: {
132
144
  region: string;
133
145
  status: "pending" | "running" | "stopping" | "stopped" | "failed";
146
+ timeout: number;
147
+ cwd: string;
134
148
  id: string;
135
149
  memory: number;
136
150
  vcpus: number;
137
151
  runtime: string;
138
- timeout: number;
139
152
  requestedAt: number;
140
153
  createdAt: number;
141
- cwd: string;
142
154
  updatedAt: number;
143
155
  duration?: number | undefined;
144
156
  startedAt?: number | undefined;
@@ -181,17 +193,25 @@ export declare class Sandbox {
181
193
  * Get a previously run command by its ID.
182
194
  *
183
195
  * @param cmdId - ID of the command to retrieve
196
+ * @param opts - Optional parameters.
197
+ * @param opts.signal - An AbortSignal to cancel the operation.
184
198
  * @returns A {@link Command} instance representing the command
185
199
  */
186
- getCommand(cmdId: string): Promise<Command>;
200
+ getCommand(cmdId: string, opts?: {
201
+ signal?: AbortSignal;
202
+ }): Promise<Command>;
187
203
  /**
188
204
  * Start executing a command in this sandbox.
189
205
  *
190
206
  * @param command - The command to execute.
191
207
  * @param args - Arguments to pass to the command.
208
+ * @param opts - Optional parameters.
209
+ * @param opts.signal - An AbortSignal to cancel the command execution.
192
210
  * @returns A {@link CommandFinished} result once execution is done.
193
211
  */
194
- runCommand(command: string, args?: string[]): Promise<CommandFinished>;
212
+ runCommand(command: string, args?: string[], opts?: {
213
+ signal?: AbortSignal;
214
+ }): Promise<CommandFinished>;
195
215
  /**
196
216
  * Start executing a command in detached mode.
197
217
  *
@@ -220,17 +240,25 @@ export declare class Sandbox {
220
240
  * Create a directory in the filesystem of this sandbox.
221
241
  *
222
242
  * @param path - Path of the directory to create
243
+ * @param opts - Optional parameters.
244
+ * @param opts.signal - An AbortSignal to cancel the operation.
223
245
  */
224
- mkDir(path: string): Promise<void>;
246
+ mkDir(path: string, opts?: {
247
+ signal?: AbortSignal;
248
+ }): Promise<void>;
225
249
  /**
226
250
  * Read a file from the filesystem of this sandbox.
227
251
  *
228
252
  * @param file - File to read, with path and optional cwd
253
+ * @param opts - Optional parameters.
254
+ * @param opts.signal - An AbortSignal to cancel the operation.
229
255
  * @returns A promise that resolves to a ReadableStream containing the file contents
230
256
  */
231
257
  readFile(file: {
232
258
  path: string;
233
259
  cwd?: string;
260
+ }, opts?: {
261
+ signal?: AbortSignal;
234
262
  }): Promise<NodeJS.ReadableStream | null>;
235
263
  /**
236
264
  * Write files to the filesystem of this sandbox.
@@ -238,12 +266,16 @@ export declare class Sandbox {
238
266
  * Writes files using the `vercel-sandbox` user.
239
267
  *
240
268
  * @param files - Array of files with path and stream/buffer contents
269
+ * @param opts - Optional parameters.
270
+ * @param opts.signal - An AbortSignal to cancel the operation.
241
271
  * @returns A promise that resolves when the files are written
242
272
  */
243
273
  writeFiles(files: {
244
274
  path: string;
245
275
  content: Buffer;
246
- }[]): Promise<void>;
276
+ }[], opts?: {
277
+ signal?: AbortSignal;
278
+ }): Promise<void>;
247
279
  /**
248
280
  * Get the public domain of a port of this sandbox.
249
281
  *
@@ -255,8 +287,12 @@ export declare class Sandbox {
255
287
  /**
256
288
  * Stop the sandbox.
257
289
  *
290
+ * @param opts - Optional parameters.
291
+ * @param opts.signal - An AbortSignal to cancel the operation.
258
292
  * @returns A promise that resolves when the sandbox is stopped
259
293
  */
260
- stop(): Promise<void>;
294
+ stop(opts?: {
295
+ signal?: AbortSignal;
296
+ }): Promise<void>;
261
297
  }
262
298
  export {};