@vercel/sandbox 1.8.0 → 2.0.0-beta.1
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/dist/api-client/api-client.d.ts +319 -4
- package/dist/api-client/api-client.js +68 -1
- package/dist/api-client/api-client.js.map +1 -1
- package/dist/api-client/validators.d.ts +1271 -0
- package/dist/api-client/validators.js +37 -1
- package/dist/api-client/validators.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/sandbox.d.ts +277 -126
- package/dist/sandbox.js +262 -217
- package/dist/sandbox.js.map +1 -1
- package/dist/session.d.ts +369 -0
- package/dist/session.js +486 -0
- package/dist/session.js.map +1 -0
- 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
package/dist/sandbox.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"sandbox.js","sourceRoot":"","sources":["../src/sandbox.ts"],"names":[],"mappings":";;;AACA,6CAAyC;AACzC,sDAAkD;AAClD,6DAA2E;AAC3E,yCAAmE;AAGnE,uCAA2D;AAO3D,2DAA8D;AAC9D,mDAAkD;AA2GlD,SAAS,qBAAqB,CAAC,GAAY;IACzC,OAAO,GAAG,YAAY,oBAAQ,IAAI,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG,CAAC;AAChE,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAY;IAC1C,OAAO,CACL,GAAG,YAAY,oBAAQ;QACvB,GAAG,CAAC,QAAQ,CAAC,MAAM,KAAK,GAAG;QAC1B,GAAG,CAAC,IAAY,EAAE,KAAK,EAAE,IAAI,KAAK,kBAAkB,CACtD,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAa,OAAO;IAclB;;O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
2
|
+
import type { Writable } from "stream";
|
|
3
|
+
import type { APIClient } from "./api-client";
|
|
4
|
+
import { Command, CommandFinished } from "./command";
|
|
5
|
+
import { Snapshot } from "./snapshot";
|
|
6
|
+
import type { NetworkPolicy, NetworkPolicyRule, NetworkTransformer } from "./network-policy";
|
|
7
|
+
import { type ConvertedSandbox } from "./utils/convert-sandbox";
|
|
8
|
+
export type { NetworkPolicy, NetworkPolicyRule, NetworkTransformer };
|
|
9
|
+
/** @inline */
|
|
10
|
+
export interface RunCommandParams {
|
|
11
|
+
/**
|
|
12
|
+
* The command to execute
|
|
13
|
+
*/
|
|
14
|
+
cmd: string;
|
|
15
|
+
/**
|
|
16
|
+
* Arguments to pass to the command
|
|
17
|
+
*/
|
|
18
|
+
args?: string[];
|
|
19
|
+
/**
|
|
20
|
+
* Working directory to execute the command in
|
|
21
|
+
*/
|
|
22
|
+
cwd?: string;
|
|
23
|
+
/**
|
|
24
|
+
* Environment variables to set for this command
|
|
25
|
+
*/
|
|
26
|
+
env?: Record<string, string>;
|
|
27
|
+
/**
|
|
28
|
+
* If true, execute this command with root privileges. Defaults to false.
|
|
29
|
+
*/
|
|
30
|
+
sudo?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* If true, the command will return without waiting for `exitCode`
|
|
33
|
+
*/
|
|
34
|
+
detached?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* A `Writable` stream where `stdout` from the command will be piped
|
|
37
|
+
*/
|
|
38
|
+
stdout?: Writable;
|
|
39
|
+
/**
|
|
40
|
+
* A `Writable` stream where `stderr` from the command will be piped
|
|
41
|
+
*/
|
|
42
|
+
stderr?: Writable;
|
|
43
|
+
/**
|
|
44
|
+
* An AbortSignal to cancel the command execution
|
|
45
|
+
*/
|
|
46
|
+
signal?: AbortSignal;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A Session represents a running VM instance within a named {@link Sandbox}.
|
|
50
|
+
*
|
|
51
|
+
* Obtain a session via {@link Sandbox.currentSession}.
|
|
52
|
+
*/
|
|
53
|
+
export declare class Session {
|
|
54
|
+
private readonly client;
|
|
55
|
+
/**
|
|
56
|
+
* Routes from ports to subdomains.
|
|
57
|
+
* @hidden
|
|
58
|
+
*/
|
|
59
|
+
readonly routes: SandboxRouteData[];
|
|
60
|
+
/**
|
|
61
|
+
* Internal metadata about the current session.
|
|
62
|
+
*/
|
|
63
|
+
private session;
|
|
64
|
+
/**
|
|
65
|
+
* Unique ID of this session.
|
|
66
|
+
*/
|
|
67
|
+
get sessionId(): string;
|
|
68
|
+
get interactivePort(): number | undefined;
|
|
69
|
+
/**
|
|
70
|
+
* The status of this session.
|
|
71
|
+
*/
|
|
72
|
+
get status(): SandboxMetaData["status"];
|
|
73
|
+
/**
|
|
74
|
+
* The creation date of this session.
|
|
75
|
+
*/
|
|
76
|
+
get createdAt(): Date;
|
|
77
|
+
/**
|
|
78
|
+
* The timeout of this session in milliseconds.
|
|
79
|
+
*/
|
|
80
|
+
get timeout(): number;
|
|
81
|
+
/**
|
|
82
|
+
* The network policy of this session.
|
|
83
|
+
*/
|
|
84
|
+
get networkPolicy(): NetworkPolicy | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* If the session was created from a snapshot, the ID of that snapshot.
|
|
87
|
+
*/
|
|
88
|
+
get sourceSnapshotId(): string | undefined;
|
|
89
|
+
/**
|
|
90
|
+
* Memory allocated to this session in MB.
|
|
91
|
+
*/
|
|
92
|
+
get memory(): number;
|
|
93
|
+
/**
|
|
94
|
+
* Number of vCPUs allocated to this session.
|
|
95
|
+
*/
|
|
96
|
+
get vcpus(): number;
|
|
97
|
+
/**
|
|
98
|
+
* The region where this session is hosted.
|
|
99
|
+
*/
|
|
100
|
+
get region(): string;
|
|
101
|
+
/**
|
|
102
|
+
* Runtime identifier (e.g. "node24", "python3.13").
|
|
103
|
+
*/
|
|
104
|
+
get runtime(): string;
|
|
105
|
+
/**
|
|
106
|
+
* The working directory of this session.
|
|
107
|
+
*/
|
|
108
|
+
get cwd(): string;
|
|
109
|
+
/**
|
|
110
|
+
* When this session was requested.
|
|
111
|
+
*/
|
|
112
|
+
get requestedAt(): Date;
|
|
113
|
+
/**
|
|
114
|
+
* When this session started running.
|
|
115
|
+
*/
|
|
116
|
+
get startedAt(): Date | undefined;
|
|
117
|
+
/**
|
|
118
|
+
* When this session was requested to stop.
|
|
119
|
+
*/
|
|
120
|
+
get requestedStopAt(): Date | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* When this session was stopped.
|
|
123
|
+
*/
|
|
124
|
+
get stoppedAt(): Date | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* When this session was aborted.
|
|
127
|
+
*/
|
|
128
|
+
get abortedAt(): Date | undefined;
|
|
129
|
+
/**
|
|
130
|
+
* The wall-clock duration of this session in milliseconds.
|
|
131
|
+
*/
|
|
132
|
+
get duration(): number | undefined;
|
|
133
|
+
/**
|
|
134
|
+
* When a snapshot was requested for this session.
|
|
135
|
+
*/
|
|
136
|
+
get snapshottedAt(): Date | undefined;
|
|
137
|
+
/**
|
|
138
|
+
* When this session was last updated.
|
|
139
|
+
*/
|
|
140
|
+
get updatedAt(): Date;
|
|
141
|
+
/**
|
|
142
|
+
* The amount of active CPU used by the session. Only reported once the VM is
|
|
143
|
+
* stopped.
|
|
144
|
+
*/
|
|
145
|
+
get activeCpuUsageMs(): number | undefined;
|
|
146
|
+
/**
|
|
147
|
+
* The amount of network data used by the session. Only reported once the VM
|
|
148
|
+
* is stopped.
|
|
149
|
+
*/
|
|
150
|
+
get networkTransfer(): {
|
|
151
|
+
ingress: number;
|
|
152
|
+
egress: number;
|
|
153
|
+
} | undefined;
|
|
154
|
+
constructor({ client, routes, session, }: {
|
|
155
|
+
client: APIClient;
|
|
156
|
+
routes: SandboxRouteData[];
|
|
157
|
+
session: SandboxMetaData;
|
|
158
|
+
});
|
|
159
|
+
/**
|
|
160
|
+
* Get a previously run command by its ID.
|
|
161
|
+
*
|
|
162
|
+
* @param cmdId - ID of the command to retrieve
|
|
163
|
+
* @param opts - Optional parameters.
|
|
164
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
165
|
+
* @returns A {@link Command} instance representing the command
|
|
166
|
+
*/
|
|
167
|
+
getCommand(cmdId: string, opts?: {
|
|
168
|
+
signal?: AbortSignal;
|
|
169
|
+
}): Promise<Command>;
|
|
170
|
+
/**
|
|
171
|
+
* Start executing a command in this session.
|
|
172
|
+
*
|
|
173
|
+
* @param command - The command to execute.
|
|
174
|
+
* @param args - Arguments to pass to the command.
|
|
175
|
+
* @param opts - Optional parameters.
|
|
176
|
+
* @param opts.signal - An AbortSignal to cancel the command execution.
|
|
177
|
+
* @returns A {@link CommandFinished} result once execution is done.
|
|
178
|
+
*/
|
|
179
|
+
runCommand(command: string, args?: string[], opts?: {
|
|
180
|
+
signal?: AbortSignal;
|
|
181
|
+
}): Promise<CommandFinished>;
|
|
182
|
+
/**
|
|
183
|
+
* Start executing a command in detached mode.
|
|
184
|
+
*
|
|
185
|
+
* @param params - The command parameters.
|
|
186
|
+
* @returns A {@link Command} instance for the running command.
|
|
187
|
+
*/
|
|
188
|
+
runCommand(params: RunCommandParams & {
|
|
189
|
+
detached: true;
|
|
190
|
+
}): Promise<Command>;
|
|
191
|
+
/**
|
|
192
|
+
* Start executing a command in this session.
|
|
193
|
+
*
|
|
194
|
+
* @param params - The command parameters.
|
|
195
|
+
* @returns A {@link CommandFinished} result once execution is done.
|
|
196
|
+
*/
|
|
197
|
+
runCommand(params: RunCommandParams): Promise<CommandFinished>;
|
|
198
|
+
/**
|
|
199
|
+
* Internal helper to start a command in the session.
|
|
200
|
+
*
|
|
201
|
+
* @param params - Command execution parameters.
|
|
202
|
+
* @returns A {@link Command} or {@link CommandFinished}, depending on `detached`.
|
|
203
|
+
* @internal
|
|
204
|
+
*/
|
|
205
|
+
_runCommand(params: RunCommandParams): Promise<Command>;
|
|
206
|
+
/**
|
|
207
|
+
* Create a directory in the filesystem of this session.
|
|
208
|
+
*
|
|
209
|
+
* @param path - Path of the directory to create
|
|
210
|
+
* @param opts - Optional parameters.
|
|
211
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
212
|
+
*/
|
|
213
|
+
mkDir(path: string, opts?: {
|
|
214
|
+
signal?: AbortSignal;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
/**
|
|
217
|
+
* Read a file from the filesystem of this session as a stream.
|
|
218
|
+
*
|
|
219
|
+
* @param file - File to read, with path and optional cwd
|
|
220
|
+
* @param opts - Optional parameters.
|
|
221
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
222
|
+
* @returns A promise that resolves to a ReadableStream containing the file contents, or null if file not found
|
|
223
|
+
*/
|
|
224
|
+
readFile(file: {
|
|
225
|
+
path: string;
|
|
226
|
+
cwd?: string;
|
|
227
|
+
}, opts?: {
|
|
228
|
+
signal?: AbortSignal;
|
|
229
|
+
}): Promise<NodeJS.ReadableStream | null>;
|
|
230
|
+
/**
|
|
231
|
+
* Read a file from the filesystem of this session as a Buffer.
|
|
232
|
+
*
|
|
233
|
+
* @param file - File to read, with path and optional cwd
|
|
234
|
+
* @param opts - Optional parameters.
|
|
235
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
236
|
+
* @returns A promise that resolves to the file contents as a Buffer, or null if file not found
|
|
237
|
+
*/
|
|
238
|
+
readFileToBuffer(file: {
|
|
239
|
+
path: string;
|
|
240
|
+
cwd?: string;
|
|
241
|
+
}, opts?: {
|
|
242
|
+
signal?: AbortSignal;
|
|
243
|
+
}): Promise<Buffer | null>;
|
|
244
|
+
/**
|
|
245
|
+
* Download a file from the session to the local filesystem.
|
|
246
|
+
*
|
|
247
|
+
* @param src - Source file on the session, with path and optional cwd
|
|
248
|
+
* @param dst - Destination file on the local machine, with path and optional cwd
|
|
249
|
+
* @param opts - Optional parameters.
|
|
250
|
+
* @param opts.mkdirRecursive - If true, create parent directories for the destination if they don't exist.
|
|
251
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
252
|
+
* @returns The absolute path to the written file, or null if the source file was not found
|
|
253
|
+
*/
|
|
254
|
+
downloadFile(src: {
|
|
255
|
+
path: string;
|
|
256
|
+
cwd?: string;
|
|
257
|
+
}, dst: {
|
|
258
|
+
path: string;
|
|
259
|
+
cwd?: string;
|
|
260
|
+
}, opts?: {
|
|
261
|
+
mkdirRecursive?: boolean;
|
|
262
|
+
signal?: AbortSignal;
|
|
263
|
+
}): Promise<string | null>;
|
|
264
|
+
/**
|
|
265
|
+
* Write files to the filesystem of this session.
|
|
266
|
+
* Defaults to writing to /vercel/sandbox unless an absolute path is specified.
|
|
267
|
+
* Writes files using the `vercel-sandbox` user.
|
|
268
|
+
*
|
|
269
|
+
* @param files - Array of files with path and stream/buffer contents
|
|
270
|
+
* @param opts - Optional parameters.
|
|
271
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
272
|
+
* @returns A promise that resolves when the files are written
|
|
273
|
+
*/
|
|
274
|
+
writeFiles(files: {
|
|
275
|
+
path: string;
|
|
276
|
+
content: Buffer;
|
|
277
|
+
}[], opts?: {
|
|
278
|
+
signal?: AbortSignal;
|
|
279
|
+
}): Promise<void>;
|
|
280
|
+
/**
|
|
281
|
+
* Get the public domain of a port of this session.
|
|
282
|
+
*
|
|
283
|
+
* @param p - Port number to resolve
|
|
284
|
+
* @returns A full domain (e.g. `https://subdomain.vercel.run`)
|
|
285
|
+
* @throws If the port has no associated route
|
|
286
|
+
*/
|
|
287
|
+
domain(p: number): string;
|
|
288
|
+
/**
|
|
289
|
+
* Stop this session.
|
|
290
|
+
*
|
|
291
|
+
* @param opts - Optional parameters.
|
|
292
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
293
|
+
* @param opts.blocking - If true, poll until the session has fully stopped and return the final state.
|
|
294
|
+
* @returns The session metadata at the time the stop was acknowledged, or after fully stopped if `blocking` is true.
|
|
295
|
+
*/
|
|
296
|
+
stop(opts?: {
|
|
297
|
+
signal?: AbortSignal;
|
|
298
|
+
blocking?: boolean;
|
|
299
|
+
}): Promise<ConvertedSandbox>;
|
|
300
|
+
/**
|
|
301
|
+
* Update the network policy for this session.
|
|
302
|
+
*
|
|
303
|
+
* @param networkPolicy - The new network policy to apply.
|
|
304
|
+
* @param opts - Optional parameters.
|
|
305
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
306
|
+
* @returns A promise that resolves when the network policy is updated.
|
|
307
|
+
*
|
|
308
|
+
* @example
|
|
309
|
+
* // Restrict to specific domains
|
|
310
|
+
* await session.updateNetworkPolicy({
|
|
311
|
+
* allow: ["*.npmjs.org", "github.com"],
|
|
312
|
+
* });
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* // Inject credentials with per-domain transformers
|
|
316
|
+
* await session.updateNetworkPolicy({
|
|
317
|
+
* allow: {
|
|
318
|
+
* "ai-gateway.vercel.sh": [{
|
|
319
|
+
* transform: [{
|
|
320
|
+
* headers: { authorization: "Bearer ..." }
|
|
321
|
+
* }]
|
|
322
|
+
* }],
|
|
323
|
+
* "*": []
|
|
324
|
+
* }
|
|
325
|
+
* });
|
|
326
|
+
*
|
|
327
|
+
* @example
|
|
328
|
+
* // Deny all network access
|
|
329
|
+
* await session.updateNetworkPolicy("deny-all");
|
|
330
|
+
*/
|
|
331
|
+
updateNetworkPolicy(networkPolicy: NetworkPolicy, opts?: {
|
|
332
|
+
signal?: AbortSignal;
|
|
333
|
+
}): Promise<NetworkPolicy>;
|
|
334
|
+
/**
|
|
335
|
+
* Extend the timeout of the session by the specified duration.
|
|
336
|
+
*
|
|
337
|
+
* This allows you to extend the lifetime of a session up until the maximum
|
|
338
|
+
* execution timeout for your plan.
|
|
339
|
+
*
|
|
340
|
+
* @param duration - The duration in milliseconds to extend the timeout by
|
|
341
|
+
* @param opts - Optional parameters.
|
|
342
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
343
|
+
* @returns A promise that resolves when the timeout is extended
|
|
344
|
+
*
|
|
345
|
+
* @example
|
|
346
|
+
* const sandbox = await Sandbox.create({ timeout: ms('10m') });
|
|
347
|
+
* const session = sandbox.currentSession();
|
|
348
|
+
* // Extends timeout by 5 minutes, to a total of 15 minutes.
|
|
349
|
+
* await session.extendTimeout(ms('5m'));
|
|
350
|
+
*/
|
|
351
|
+
extendTimeout(duration: number, opts?: {
|
|
352
|
+
signal?: AbortSignal;
|
|
353
|
+
}): Promise<void>;
|
|
354
|
+
/**
|
|
355
|
+
* Create a snapshot from this currently running session. New sandboxes can
|
|
356
|
+
* then be created from this snapshot using {@link Sandbox.create}.
|
|
357
|
+
*
|
|
358
|
+
* Note: this session will be stopped as part of the snapshot creation process.
|
|
359
|
+
*
|
|
360
|
+
* @param opts - Optional parameters.
|
|
361
|
+
* @param opts.expiration - Optional expiration time in milliseconds. Use 0 for no expiration at all.
|
|
362
|
+
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
363
|
+
* @returns A promise that resolves to the Snapshot instance
|
|
364
|
+
*/
|
|
365
|
+
snapshot(opts?: {
|
|
366
|
+
expiration?: number;
|
|
367
|
+
signal?: AbortSignal;
|
|
368
|
+
}): Promise<Snapshot>;
|
|
369
|
+
}
|