@vercel/sandbox 2.0.0-beta.1 → 2.0.0-beta.11
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.
- package/README.md +40 -1
- package/dist/api-client/api-client.d.ts +232 -161
- package/dist/api-client/api-client.js +69 -68
- package/dist/api-client/api-client.js.map +1 -1
- package/dist/api-client/api-error.d.ts +6 -4
- package/dist/api-client/api-error.js +4 -3
- package/dist/api-client/api-error.js.map +1 -1
- package/dist/api-client/base-client.js +24 -9
- package/dist/api-client/base-client.js.map +1 -1
- package/dist/api-client/file-writer.d.ts +10 -0
- package/dist/api-client/file-writer.js +2 -2
- package/dist/api-client/file-writer.js.map +1 -1
- package/dist/api-client/validators.d.ts +1273 -1246
- package/dist/api-client/validators.js +33 -53
- package/dist/api-client/validators.js.map +1 -1
- package/dist/command.d.ts +9 -9
- package/dist/command.js +10 -10
- package/dist/sandbox.d.ts +201 -117
- package/dist/sandbox.js +134 -58
- package/dist/sandbox.js.map +1 -1
- package/dist/session.d.ts +29 -23
- package/dist/session.js +93 -72
- package/dist/session.js.map +1 -1
- package/dist/snapshot.d.ts +6 -7
- package/dist/snapshot.js +5 -4
- package/dist/snapshot.js.map +1 -1
- package/dist/utils/convert-sandbox.d.ts +3 -3
- package/dist/utils/convert-sandbox.js +3 -3
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/dist/version.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient, type Parsed, type RequestParams } from "./base-client";
|
|
2
|
-
import { type CommandFinishedData,
|
|
2
|
+
import { type CommandFinishedData, SessionResponse, CommandResponse, CommandFinishedResponse, type LogLineStdout, type LogLineStderr, SnapshotResponse, CreateSnapshotResponse, type CommandData } from "./validators";
|
|
3
3
|
import { FileWriter } from "./file-writer";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
import { Readable } from "stream";
|
|
@@ -21,11 +21,11 @@ export declare class APIClient extends BaseClient {
|
|
|
21
21
|
});
|
|
22
22
|
private ensureValidToken;
|
|
23
23
|
protected request(path: string, params?: RequestParams): Promise<Response>;
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
getSession(params: WithPrivate<{
|
|
25
|
+
sessionId: string;
|
|
26
26
|
signal?: AbortSignal;
|
|
27
27
|
}>): Promise<Parsed<{
|
|
28
|
-
|
|
28
|
+
session: {
|
|
29
29
|
id: string;
|
|
30
30
|
memory: number;
|
|
31
31
|
vcpus: number;
|
|
@@ -73,6 +73,8 @@ export declare class APIClient extends BaseClient {
|
|
|
73
73
|
ingress: number;
|
|
74
74
|
egress: number;
|
|
75
75
|
} | undefined;
|
|
76
|
+
} & {
|
|
77
|
+
[k: string]: unknown;
|
|
76
78
|
};
|
|
77
79
|
routes: {
|
|
78
80
|
url: string;
|
|
@@ -106,9 +108,11 @@ export declare class APIClient extends BaseClient {
|
|
|
106
108
|
runtime?: RUNTIMES | (string & {});
|
|
107
109
|
networkPolicy?: NetworkPolicy;
|
|
108
110
|
env?: Record<string, string>;
|
|
111
|
+
tags?: Record<string, string>;
|
|
112
|
+
snapshotExpiration?: number;
|
|
109
113
|
signal?: AbortSignal;
|
|
110
114
|
}>): Promise<Parsed<{
|
|
111
|
-
|
|
115
|
+
session: {
|
|
112
116
|
id: string;
|
|
113
117
|
memory: number;
|
|
114
118
|
vcpus: number;
|
|
@@ -156,24 +160,27 @@ export declare class APIClient extends BaseClient {
|
|
|
156
160
|
ingress: number;
|
|
157
161
|
egress: number;
|
|
158
162
|
} | undefined;
|
|
163
|
+
} & {
|
|
164
|
+
[k: string]: unknown;
|
|
159
165
|
};
|
|
160
166
|
routes: {
|
|
161
167
|
url: string;
|
|
162
168
|
subdomain: string;
|
|
163
169
|
port: number;
|
|
164
170
|
}[];
|
|
165
|
-
|
|
166
|
-
memory: number;
|
|
167
|
-
vcpus: number;
|
|
168
|
-
region: string;
|
|
169
|
-
runtime: string;
|
|
170
|
-
timeout: number;
|
|
171
|
+
sandbox: {
|
|
171
172
|
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
172
173
|
createdAt: number;
|
|
173
174
|
updatedAt: number;
|
|
174
175
|
name: string;
|
|
175
176
|
persistent: boolean;
|
|
176
|
-
|
|
177
|
+
currentSessionId: string;
|
|
178
|
+
memory?: number | undefined;
|
|
179
|
+
vcpus?: number | undefined;
|
|
180
|
+
region?: string | undefined;
|
|
181
|
+
runtime?: string | undefined;
|
|
182
|
+
timeout?: number | undefined;
|
|
183
|
+
cwd?: string | undefined;
|
|
177
184
|
networkPolicy?: z.objectInputType<{
|
|
178
185
|
mode: z.ZodLiteral<"allow-all">;
|
|
179
186
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
@@ -202,10 +209,13 @@ export declare class APIClient extends BaseClient {
|
|
|
202
209
|
totalActiveCpuDurationMs?: number | undefined;
|
|
203
210
|
totalDurationMs?: number | undefined;
|
|
204
211
|
currentSnapshotId?: string | undefined;
|
|
212
|
+
statusUpdatedAt?: number | undefined;
|
|
213
|
+
tags?: Record<string, string> | undefined;
|
|
214
|
+
snapshotExpiration?: number | undefined;
|
|
205
215
|
};
|
|
206
216
|
}>>;
|
|
207
217
|
runCommand(params: {
|
|
208
|
-
|
|
218
|
+
sessionId: string;
|
|
209
219
|
cwd?: string;
|
|
210
220
|
command: string;
|
|
211
221
|
args: string[];
|
|
@@ -218,7 +228,7 @@ export declare class APIClient extends BaseClient {
|
|
|
218
228
|
finished: Promise<CommandFinishedData>;
|
|
219
229
|
}>;
|
|
220
230
|
runCommand(params: {
|
|
221
|
-
|
|
231
|
+
sessionId: string;
|
|
222
232
|
cwd?: string;
|
|
223
233
|
command: string;
|
|
224
234
|
args: string[];
|
|
@@ -228,83 +238,89 @@ export declare class APIClient extends BaseClient {
|
|
|
228
238
|
signal?: AbortSignal;
|
|
229
239
|
}): Promise<Parsed<z.infer<typeof CommandResponse>>>;
|
|
230
240
|
getCommand(params: {
|
|
231
|
-
|
|
241
|
+
sessionId: string;
|
|
232
242
|
cmdId: string;
|
|
233
243
|
wait: true;
|
|
234
244
|
signal?: AbortSignal;
|
|
235
245
|
}): Promise<Parsed<z.infer<typeof CommandFinishedResponse>>>;
|
|
236
246
|
getCommand(params: {
|
|
237
|
-
|
|
247
|
+
sessionId: string;
|
|
238
248
|
cmdId: string;
|
|
239
249
|
wait?: boolean;
|
|
240
250
|
signal?: AbortSignal;
|
|
241
251
|
}): Promise<Parsed<z.infer<typeof CommandResponse>>>;
|
|
242
252
|
mkDir(params: {
|
|
243
|
-
|
|
253
|
+
sessionId: string;
|
|
244
254
|
path: string;
|
|
245
255
|
cwd?: string;
|
|
246
256
|
signal?: AbortSignal;
|
|
247
257
|
}): Promise<Parsed<{}>>;
|
|
248
258
|
getFileWriter(params: {
|
|
249
|
-
|
|
259
|
+
sessionId: string;
|
|
250
260
|
extractDir: string;
|
|
251
261
|
signal?: AbortSignal;
|
|
252
262
|
}): {
|
|
253
263
|
response: Promise<Response>;
|
|
254
264
|
writer: FileWriter;
|
|
255
265
|
};
|
|
256
|
-
|
|
266
|
+
listSessions(params: {
|
|
257
267
|
/**
|
|
258
|
-
* The ID or name of the project to which the
|
|
268
|
+
* The ID or name of the project to which the sessions belong.
|
|
259
269
|
* @example "my-project"
|
|
260
270
|
*/
|
|
261
271
|
projectId: string;
|
|
262
272
|
/**
|
|
263
|
-
* Filter
|
|
273
|
+
* Filter sessions by sandbox name.
|
|
264
274
|
*/
|
|
265
275
|
name?: string;
|
|
266
276
|
/**
|
|
267
|
-
* Maximum number of
|
|
277
|
+
* Maximum number of sessions to list from a request.
|
|
268
278
|
* @example 10
|
|
269
279
|
*/
|
|
270
280
|
limit?: number;
|
|
271
281
|
/**
|
|
272
|
-
*
|
|
273
|
-
* @example 1540095775941
|
|
282
|
+
* Cursor for pagination.
|
|
274
283
|
*/
|
|
275
|
-
|
|
284
|
+
cursor?: string;
|
|
276
285
|
/**
|
|
277
|
-
*
|
|
278
|
-
* @example 1540095775951
|
|
286
|
+
* Sort order for results.
|
|
279
287
|
*/
|
|
280
|
-
|
|
288
|
+
sortOrder?: "asc" | "desc";
|
|
281
289
|
signal?: AbortSignal;
|
|
282
290
|
}): Promise<Parsed<{
|
|
283
|
-
|
|
284
|
-
id:
|
|
285
|
-
memory:
|
|
286
|
-
vcpus:
|
|
287
|
-
region:
|
|
288
|
-
runtime:
|
|
289
|
-
timeout:
|
|
290
|
-
status: "
|
|
291
|
-
requestedAt:
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
interactivePort
|
|
303
|
-
networkPolicy
|
|
291
|
+
sessions: z.objectInputType<{
|
|
292
|
+
id: z.ZodString;
|
|
293
|
+
memory: z.ZodNumber;
|
|
294
|
+
vcpus: z.ZodNumber;
|
|
295
|
+
region: z.ZodString;
|
|
296
|
+
runtime: z.ZodString;
|
|
297
|
+
timeout: z.ZodNumber;
|
|
298
|
+
status: z.ZodEnum<["pending", "running", "stopping", "stopped", "failed", "aborted", "snapshotting"]>;
|
|
299
|
+
requestedAt: z.ZodNumber;
|
|
300
|
+
startedAt: z.ZodOptional<z.ZodNumber>;
|
|
301
|
+
requestedStopAt: z.ZodOptional<z.ZodNumber>;
|
|
302
|
+
stoppedAt: z.ZodOptional<z.ZodNumber>;
|
|
303
|
+
abortedAt: z.ZodOptional<z.ZodNumber>;
|
|
304
|
+
duration: z.ZodOptional<z.ZodNumber>;
|
|
305
|
+
sourceSnapshotId: z.ZodOptional<z.ZodString>;
|
|
306
|
+
snapshottedAt: z.ZodOptional<z.ZodNumber>;
|
|
307
|
+
createdAt: z.ZodNumber;
|
|
308
|
+
cwd: z.ZodString;
|
|
309
|
+
updatedAt: z.ZodNumber;
|
|
310
|
+
interactivePort: z.ZodOptional<z.ZodNumber>;
|
|
311
|
+
networkPolicy: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
|
|
304
312
|
mode: z.ZodLiteral<"allow-all">;
|
|
305
|
-
}, z.ZodTypeAny,
|
|
313
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
314
|
+
mode: z.ZodLiteral<"allow-all">;
|
|
315
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
316
|
+
mode: z.ZodLiteral<"allow-all">;
|
|
317
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
306
318
|
mode: z.ZodLiteral<"deny-all">;
|
|
307
|
-
}, z.ZodTypeAny,
|
|
319
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
320
|
+
mode: z.ZodLiteral<"deny-all">;
|
|
321
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
322
|
+
mode: z.ZodLiteral<"deny-all">;
|
|
323
|
+
}, z.ZodTypeAny, "passthrough">>, z.ZodObject<{
|
|
308
324
|
mode: z.ZodLiteral<"custom">;
|
|
309
325
|
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
310
326
|
allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
@@ -322,17 +338,58 @@ export declare class APIClient extends BaseClient {
|
|
|
322
338
|
headers?: Record<string, string> | undefined;
|
|
323
339
|
headerNames?: string[] | undefined;
|
|
324
340
|
}>, "many">>;
|
|
325
|
-
}, z.ZodTypeAny,
|
|
326
|
-
|
|
327
|
-
|
|
341
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
342
|
+
mode: z.ZodLiteral<"custom">;
|
|
343
|
+
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
344
|
+
allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
345
|
+
deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
346
|
+
injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
347
|
+
domain: z.ZodString;
|
|
348
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
349
|
+
headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
350
|
+
}, "strip", z.ZodTypeAny, {
|
|
351
|
+
domain: string;
|
|
352
|
+
headers?: Record<string, string> | undefined;
|
|
353
|
+
headerNames?: string[] | undefined;
|
|
354
|
+
}, {
|
|
355
|
+
domain: string;
|
|
356
|
+
headers?: Record<string, string> | undefined;
|
|
357
|
+
headerNames?: string[] | undefined;
|
|
358
|
+
}>, "many">>;
|
|
359
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
360
|
+
mode: z.ZodLiteral<"custom">;
|
|
361
|
+
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
362
|
+
allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
363
|
+
deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
364
|
+
injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
365
|
+
domain: z.ZodString;
|
|
366
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
367
|
+
headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
368
|
+
}, "strip", z.ZodTypeAny, {
|
|
369
|
+
domain: string;
|
|
370
|
+
headers?: Record<string, string> | undefined;
|
|
371
|
+
headerNames?: string[] | undefined;
|
|
372
|
+
}, {
|
|
373
|
+
domain: string;
|
|
374
|
+
headers?: Record<string, string> | undefined;
|
|
375
|
+
headerNames?: string[] | undefined;
|
|
376
|
+
}>, "many">>;
|
|
377
|
+
}, z.ZodTypeAny, "passthrough">>]>>;
|
|
378
|
+
activeCpuDurationMs: z.ZodOptional<z.ZodNumber>;
|
|
379
|
+
networkTransfer: z.ZodOptional<z.ZodObject<{
|
|
380
|
+
ingress: z.ZodNumber;
|
|
381
|
+
egress: z.ZodNumber;
|
|
382
|
+
}, "strip", z.ZodTypeAny, {
|
|
328
383
|
ingress: number;
|
|
329
384
|
egress: number;
|
|
330
|
-
}
|
|
331
|
-
|
|
385
|
+
}, {
|
|
386
|
+
ingress: number;
|
|
387
|
+
egress: number;
|
|
388
|
+
}>>;
|
|
389
|
+
}, z.ZodTypeAny, "passthrough">[];
|
|
332
390
|
pagination: {
|
|
333
391
|
count: number;
|
|
334
|
-
next:
|
|
335
|
-
prev: number | null;
|
|
392
|
+
next: string | null;
|
|
336
393
|
};
|
|
337
394
|
}>>;
|
|
338
395
|
listSnapshots(params: {
|
|
@@ -342,7 +399,7 @@ export declare class APIClient extends BaseClient {
|
|
|
342
399
|
*/
|
|
343
400
|
projectId: string;
|
|
344
401
|
/**
|
|
345
|
-
* Filter snapshots by
|
|
402
|
+
* Filter snapshots by sandbox name.
|
|
346
403
|
*/
|
|
347
404
|
name?: string;
|
|
348
405
|
/**
|
|
@@ -351,21 +408,18 @@ export declare class APIClient extends BaseClient {
|
|
|
351
408
|
*/
|
|
352
409
|
limit?: number;
|
|
353
410
|
/**
|
|
354
|
-
*
|
|
355
|
-
* @example 1540095775941
|
|
411
|
+
* Cursor for pagination.
|
|
356
412
|
*/
|
|
357
|
-
|
|
413
|
+
cursor?: string;
|
|
358
414
|
/**
|
|
359
|
-
*
|
|
360
|
-
* @example 1540095775951
|
|
415
|
+
* Sort order for results.
|
|
361
416
|
*/
|
|
362
|
-
|
|
417
|
+
sortOrder?: "asc" | "desc";
|
|
363
418
|
signal?: AbortSignal;
|
|
364
419
|
}): Promise<Parsed<{
|
|
365
420
|
pagination: {
|
|
366
421
|
count: number;
|
|
367
|
-
next:
|
|
368
|
-
prev: number | null;
|
|
422
|
+
next: string | null;
|
|
369
423
|
};
|
|
370
424
|
snapshots: {
|
|
371
425
|
id: string;
|
|
@@ -373,35 +427,36 @@ export declare class APIClient extends BaseClient {
|
|
|
373
427
|
status: "failed" | "created" | "deleted";
|
|
374
428
|
createdAt: number;
|
|
375
429
|
updatedAt: number;
|
|
376
|
-
|
|
430
|
+
sourceSessionId: string;
|
|
377
431
|
sizeBytes: number;
|
|
378
432
|
expiresAt?: number | undefined;
|
|
379
433
|
}[];
|
|
380
434
|
}>>;
|
|
381
435
|
writeFiles(params: {
|
|
382
|
-
|
|
436
|
+
sessionId: string;
|
|
383
437
|
cwd: string;
|
|
384
438
|
files: {
|
|
385
439
|
path: string;
|
|
386
440
|
content: Buffer;
|
|
441
|
+
mode?: number;
|
|
387
442
|
}[];
|
|
388
443
|
extractDir: string;
|
|
389
444
|
signal?: AbortSignal;
|
|
390
445
|
}): Promise<void>;
|
|
391
446
|
readFile(params: {
|
|
392
|
-
|
|
447
|
+
sessionId: string;
|
|
393
448
|
path: string;
|
|
394
449
|
cwd?: string;
|
|
395
450
|
signal?: AbortSignal;
|
|
396
451
|
}): Promise<Readable | null>;
|
|
397
452
|
killCommand(params: {
|
|
398
|
-
|
|
453
|
+
sessionId: string;
|
|
399
454
|
commandId: string;
|
|
400
455
|
signal: number;
|
|
401
456
|
abortSignal?: AbortSignal;
|
|
402
457
|
}): Promise<Parsed<{
|
|
403
458
|
command: {
|
|
404
|
-
|
|
459
|
+
sessionId: string;
|
|
405
460
|
id: string;
|
|
406
461
|
startedAt: number;
|
|
407
462
|
cwd: string;
|
|
@@ -411,29 +466,29 @@ export declare class APIClient extends BaseClient {
|
|
|
411
466
|
};
|
|
412
467
|
}>>;
|
|
413
468
|
getLogs(params: {
|
|
414
|
-
|
|
469
|
+
sessionId: string;
|
|
415
470
|
cmdId: string;
|
|
416
471
|
signal?: AbortSignal;
|
|
417
472
|
}): AsyncGenerator<z.infer<typeof LogLineStdout> | z.infer<typeof LogLineStderr>, void, void> & Disposable & {
|
|
418
473
|
close(): void;
|
|
419
474
|
};
|
|
420
|
-
|
|
421
|
-
|
|
475
|
+
stopSession(params: {
|
|
476
|
+
sessionId: string;
|
|
422
477
|
signal?: AbortSignal;
|
|
423
478
|
blocking?: boolean;
|
|
424
|
-
}): Promise<Parsed<z.infer<typeof
|
|
479
|
+
}): Promise<Parsed<z.infer<typeof SessionResponse>>>;
|
|
425
480
|
updateNetworkPolicy(params: {
|
|
426
|
-
|
|
481
|
+
sessionId: string;
|
|
427
482
|
networkPolicy: NetworkPolicy;
|
|
428
483
|
signal?: AbortSignal;
|
|
429
|
-
}): Promise<Parsed<z.infer<typeof
|
|
484
|
+
}): Promise<Parsed<z.infer<typeof SessionResponse>>>;
|
|
430
485
|
extendTimeout(params: {
|
|
431
|
-
|
|
486
|
+
sessionId: string;
|
|
432
487
|
duration: number;
|
|
433
488
|
signal?: AbortSignal;
|
|
434
|
-
}): Promise<Parsed<z.infer<typeof
|
|
489
|
+
}): Promise<Parsed<z.infer<typeof SessionResponse>>>;
|
|
435
490
|
createSnapshot(params: {
|
|
436
|
-
|
|
491
|
+
sessionId: string;
|
|
437
492
|
expiration?: number;
|
|
438
493
|
signal?: AbortSignal;
|
|
439
494
|
}): Promise<Parsed<z.infer<typeof CreateSnapshotResponse>>>;
|
|
@@ -445,13 +500,13 @@ export declare class APIClient extends BaseClient {
|
|
|
445
500
|
snapshotId: string;
|
|
446
501
|
signal?: AbortSignal;
|
|
447
502
|
}): Promise<Parsed<z.infer<typeof SnapshotResponse>>>;
|
|
448
|
-
|
|
503
|
+
getSandbox(params: WithPrivate<{
|
|
449
504
|
name: string;
|
|
450
505
|
projectId: string;
|
|
451
506
|
resume?: boolean;
|
|
452
507
|
signal?: AbortSignal;
|
|
453
|
-
}): Promise<Parsed<{
|
|
454
|
-
|
|
508
|
+
}>): Promise<Parsed<{
|
|
509
|
+
session: {
|
|
455
510
|
id: string;
|
|
456
511
|
memory: number;
|
|
457
512
|
vcpus: number;
|
|
@@ -499,24 +554,27 @@ export declare class APIClient extends BaseClient {
|
|
|
499
554
|
ingress: number;
|
|
500
555
|
egress: number;
|
|
501
556
|
} | undefined;
|
|
557
|
+
} & {
|
|
558
|
+
[k: string]: unknown;
|
|
502
559
|
};
|
|
503
560
|
routes: {
|
|
504
561
|
url: string;
|
|
505
562
|
subdomain: string;
|
|
506
563
|
port: number;
|
|
507
564
|
}[];
|
|
508
|
-
|
|
509
|
-
memory: number;
|
|
510
|
-
vcpus: number;
|
|
511
|
-
region: string;
|
|
512
|
-
runtime: string;
|
|
513
|
-
timeout: number;
|
|
565
|
+
sandbox: {
|
|
514
566
|
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
515
567
|
createdAt: number;
|
|
516
568
|
updatedAt: number;
|
|
517
569
|
name: string;
|
|
518
570
|
persistent: boolean;
|
|
519
|
-
|
|
571
|
+
currentSessionId: string;
|
|
572
|
+
memory?: number | undefined;
|
|
573
|
+
vcpus?: number | undefined;
|
|
574
|
+
region?: string | undefined;
|
|
575
|
+
runtime?: string | undefined;
|
|
576
|
+
timeout?: number | undefined;
|
|
577
|
+
cwd?: string | undefined;
|
|
520
578
|
networkPolicy?: z.objectInputType<{
|
|
521
579
|
mode: z.ZodLiteral<"allow-all">;
|
|
522
580
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
@@ -545,68 +603,72 @@ export declare class APIClient extends BaseClient {
|
|
|
545
603
|
totalActiveCpuDurationMs?: number | undefined;
|
|
546
604
|
totalDurationMs?: number | undefined;
|
|
547
605
|
currentSnapshotId?: string | undefined;
|
|
606
|
+
statusUpdatedAt?: number | undefined;
|
|
607
|
+
tags?: Record<string, string> | undefined;
|
|
608
|
+
snapshotExpiration?: number | undefined;
|
|
548
609
|
};
|
|
549
610
|
}>>;
|
|
550
|
-
|
|
611
|
+
listSandboxes(params: {
|
|
551
612
|
projectId: string;
|
|
552
613
|
limit?: number;
|
|
553
|
-
sortBy?: "createdAt" | "name";
|
|
614
|
+
sortBy?: "createdAt" | "name" | "statusUpdatedAt";
|
|
615
|
+
sortOrder?: "asc" | "desc";
|
|
554
616
|
namePrefix?: string;
|
|
555
617
|
cursor?: string;
|
|
618
|
+
tags?: Record<string, string>;
|
|
556
619
|
signal?: AbortSignal;
|
|
557
|
-
}): Promise<{
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
vcpus: number;
|
|
562
|
-
region: string;
|
|
563
|
-
runtime: string;
|
|
564
|
-
timeout: number;
|
|
565
|
-
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
566
|
-
createdAt: number;
|
|
567
|
-
updatedAt: number;
|
|
568
|
-
name: string;
|
|
569
|
-
persistent: boolean;
|
|
570
|
-
currentSandboxId: string;
|
|
571
|
-
networkPolicy?: z.objectInputType<{
|
|
572
|
-
mode: z.ZodLiteral<"allow-all">;
|
|
573
|
-
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
574
|
-
mode: z.ZodLiteral<"deny-all">;
|
|
575
|
-
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
576
|
-
mode: z.ZodLiteral<"custom">;
|
|
577
|
-
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
578
|
-
allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
579
|
-
deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
580
|
-
injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
581
|
-
domain: z.ZodString;
|
|
582
|
-
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
583
|
-
headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
584
|
-
}, "strip", z.ZodTypeAny, {
|
|
585
|
-
domain: string;
|
|
586
|
-
headers?: Record<string, string> | undefined;
|
|
587
|
-
headerNames?: string[] | undefined;
|
|
588
|
-
}, {
|
|
589
|
-
domain: string;
|
|
590
|
-
headers?: Record<string, string> | undefined;
|
|
591
|
-
headerNames?: string[] | undefined;
|
|
592
|
-
}>, "many">>;
|
|
593
|
-
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
594
|
-
totalEgressBytes?: number | undefined;
|
|
595
|
-
totalIngressBytes?: number | undefined;
|
|
596
|
-
totalActiveCpuDurationMs?: number | undefined;
|
|
597
|
-
totalDurationMs?: number | undefined;
|
|
598
|
-
currentSnapshotId?: string | undefined;
|
|
599
|
-
}[];
|
|
600
|
-
pagination: {
|
|
601
|
-
count: number;
|
|
602
|
-
next: string | null;
|
|
603
|
-
total: number;
|
|
604
|
-
};
|
|
620
|
+
}): Promise<Parsed<{
|
|
621
|
+
pagination: {
|
|
622
|
+
count: number;
|
|
623
|
+
next: string | null;
|
|
605
624
|
};
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
625
|
+
sandboxes: {
|
|
626
|
+
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
627
|
+
createdAt: number;
|
|
628
|
+
updatedAt: number;
|
|
629
|
+
name: string;
|
|
630
|
+
persistent: boolean;
|
|
631
|
+
currentSessionId: string;
|
|
632
|
+
memory?: number | undefined;
|
|
633
|
+
vcpus?: number | undefined;
|
|
634
|
+
region?: string | undefined;
|
|
635
|
+
runtime?: string | undefined;
|
|
636
|
+
timeout?: number | undefined;
|
|
637
|
+
cwd?: string | undefined;
|
|
638
|
+
networkPolicy?: z.objectInputType<{
|
|
639
|
+
mode: z.ZodLiteral<"allow-all">;
|
|
640
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
641
|
+
mode: z.ZodLiteral<"deny-all">;
|
|
642
|
+
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
643
|
+
mode: z.ZodLiteral<"custom">;
|
|
644
|
+
allowedDomains: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
645
|
+
allowedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
646
|
+
deniedCIDRs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
647
|
+
injectionRules: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
648
|
+
domain: z.ZodString;
|
|
649
|
+
headers: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
650
|
+
headerNames: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
651
|
+
}, "strip", z.ZodTypeAny, {
|
|
652
|
+
domain: string;
|
|
653
|
+
headers?: Record<string, string> | undefined;
|
|
654
|
+
headerNames?: string[] | undefined;
|
|
655
|
+
}, {
|
|
656
|
+
domain: string;
|
|
657
|
+
headers?: Record<string, string> | undefined;
|
|
658
|
+
headerNames?: string[] | undefined;
|
|
659
|
+
}>, "many">>;
|
|
660
|
+
}, z.ZodTypeAny, "passthrough"> | undefined;
|
|
661
|
+
totalEgressBytes?: number | undefined;
|
|
662
|
+
totalIngressBytes?: number | undefined;
|
|
663
|
+
totalActiveCpuDurationMs?: number | undefined;
|
|
664
|
+
totalDurationMs?: number | undefined;
|
|
665
|
+
currentSnapshotId?: string | undefined;
|
|
666
|
+
statusUpdatedAt?: number | undefined;
|
|
667
|
+
tags?: Record<string, string> | undefined;
|
|
668
|
+
snapshotExpiration?: number | undefined;
|
|
669
|
+
}[];
|
|
670
|
+
}>>;
|
|
671
|
+
updateSandbox(params: {
|
|
610
672
|
name: string;
|
|
611
673
|
projectId: string;
|
|
612
674
|
persistent?: boolean;
|
|
@@ -617,20 +679,23 @@ export declare class APIClient extends BaseClient {
|
|
|
617
679
|
runtime?: RUNTIMES | (string & {});
|
|
618
680
|
timeout?: number;
|
|
619
681
|
networkPolicy?: NetworkPolicy;
|
|
682
|
+
tags?: Record<string, string>;
|
|
683
|
+
snapshotExpiration?: number;
|
|
620
684
|
signal?: AbortSignal;
|
|
621
685
|
}): Promise<Parsed<{
|
|
622
|
-
|
|
623
|
-
memory: number;
|
|
624
|
-
vcpus: number;
|
|
625
|
-
region: string;
|
|
626
|
-
runtime: string;
|
|
627
|
-
timeout: number;
|
|
686
|
+
sandbox: {
|
|
628
687
|
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
629
688
|
createdAt: number;
|
|
630
689
|
updatedAt: number;
|
|
631
690
|
name: string;
|
|
632
691
|
persistent: boolean;
|
|
633
|
-
|
|
692
|
+
currentSessionId: string;
|
|
693
|
+
memory?: number | undefined;
|
|
694
|
+
vcpus?: number | undefined;
|
|
695
|
+
region?: string | undefined;
|
|
696
|
+
runtime?: string | undefined;
|
|
697
|
+
timeout?: number | undefined;
|
|
698
|
+
cwd?: string | undefined;
|
|
634
699
|
networkPolicy?: z.objectInputType<{
|
|
635
700
|
mode: z.ZodLiteral<"allow-all">;
|
|
636
701
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
@@ -659,26 +724,29 @@ export declare class APIClient extends BaseClient {
|
|
|
659
724
|
totalActiveCpuDurationMs?: number | undefined;
|
|
660
725
|
totalDurationMs?: number | undefined;
|
|
661
726
|
currentSnapshotId?: string | undefined;
|
|
727
|
+
statusUpdatedAt?: number | undefined;
|
|
728
|
+
tags?: Record<string, string> | undefined;
|
|
729
|
+
snapshotExpiration?: number | undefined;
|
|
662
730
|
};
|
|
663
731
|
}>>;
|
|
664
|
-
|
|
732
|
+
deleteSandbox(params: {
|
|
665
733
|
name: string;
|
|
666
734
|
projectId: string;
|
|
667
|
-
preserveSnapshots?: boolean;
|
|
668
735
|
signal?: AbortSignal;
|
|
669
736
|
}): Promise<Parsed<{
|
|
670
|
-
|
|
671
|
-
memory: number;
|
|
672
|
-
vcpus: number;
|
|
673
|
-
region: string;
|
|
674
|
-
runtime: string;
|
|
675
|
-
timeout: number;
|
|
737
|
+
sandbox: {
|
|
676
738
|
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
677
739
|
createdAt: number;
|
|
678
740
|
updatedAt: number;
|
|
679
741
|
name: string;
|
|
680
742
|
persistent: boolean;
|
|
681
|
-
|
|
743
|
+
currentSessionId: string;
|
|
744
|
+
memory?: number | undefined;
|
|
745
|
+
vcpus?: number | undefined;
|
|
746
|
+
region?: string | undefined;
|
|
747
|
+
runtime?: string | undefined;
|
|
748
|
+
timeout?: number | undefined;
|
|
749
|
+
cwd?: string | undefined;
|
|
682
750
|
networkPolicy?: z.objectInputType<{
|
|
683
751
|
mode: z.ZodLiteral<"allow-all">;
|
|
684
752
|
}, z.ZodTypeAny, "passthrough"> | z.objectInputType<{
|
|
@@ -707,6 +775,9 @@ export declare class APIClient extends BaseClient {
|
|
|
707
775
|
totalActiveCpuDurationMs?: number | undefined;
|
|
708
776
|
totalDurationMs?: number | undefined;
|
|
709
777
|
currentSnapshotId?: string | undefined;
|
|
778
|
+
statusUpdatedAt?: number | undefined;
|
|
779
|
+
tags?: Record<string, string> | undefined;
|
|
780
|
+
snapshotExpiration?: number | undefined;
|
|
710
781
|
};
|
|
711
782
|
}>>;
|
|
712
783
|
}
|