@vercel/sandbox 1.8.0 → 2.0.0-beta.0
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SnapshotResponse = exports.CreateSnapshotResponse = exports.UpdateNetworkPolicyResponse = exports.ExtendTimeoutResponse = exports.SnapshotsResponse = exports.SandboxesResponse = exports.LogLine = exports.LogError = exports.LogLineStderr = exports.LogLineStdout = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.Snapshot = exports.SandboxRoute = exports.Sandbox = exports.NetworkPolicyValidator = exports.InjectionRuleValidator = void 0;
|
|
3
|
+
exports.UpdateNamedSandboxResponse = exports.NamedSandboxesPaginationResponse = exports.CursorPagination = exports.NamedSandboxAndSessionResponse = exports.NamedSandbox = exports.SnapshotResponse = exports.CreateSnapshotResponse = exports.UpdateNetworkPolicyResponse = exports.ExtendTimeoutResponse = exports.SnapshotsResponse = exports.SandboxesResponse = exports.LogLine = exports.LogError = exports.LogLineStderr = exports.LogLineStdout = exports.EmptyResponse = exports.CommandFinishedResponse = exports.CommandResponse = exports.SandboxAndRoutesResponse = exports.SandboxResponse = exports.Command = exports.Pagination = exports.Snapshot = exports.SandboxRoute = exports.Sandbox = exports.NetworkPolicyValidator = exports.InjectionRuleValidator = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
exports.InjectionRuleValidator = zod_1.z.object({
|
|
6
6
|
domain: zod_1.z.string(),
|
|
@@ -154,4 +154,40 @@ exports.CreateSnapshotResponse = zod_1.z.object({
|
|
|
154
154
|
exports.SnapshotResponse = zod_1.z.object({
|
|
155
155
|
snapshot: exports.Snapshot,
|
|
156
156
|
});
|
|
157
|
+
exports.NamedSandbox = zod_1.z.object({
|
|
158
|
+
name: zod_1.z.string(),
|
|
159
|
+
snapshotOnShutdown: zod_1.z.boolean(),
|
|
160
|
+
region: zod_1.z.string(),
|
|
161
|
+
vcpus: zod_1.z.number(),
|
|
162
|
+
memory: zod_1.z.number(),
|
|
163
|
+
runtime: zod_1.z.string(),
|
|
164
|
+
timeout: zod_1.z.number(),
|
|
165
|
+
networkPolicy: exports.NetworkPolicyValidator.optional(),
|
|
166
|
+
totalEgressBytes: zod_1.z.number().optional(),
|
|
167
|
+
totalIngressBytes: zod_1.z.number().optional(),
|
|
168
|
+
totalActiveCpuDurationMs: zod_1.z.number().optional(),
|
|
169
|
+
totalDurationMs: zod_1.z.number().optional(),
|
|
170
|
+
createdAt: zod_1.z.number(),
|
|
171
|
+
updatedAt: zod_1.z.number(),
|
|
172
|
+
currentSandboxId: zod_1.z.string(),
|
|
173
|
+
currentSnapshotId: zod_1.z.string().optional(),
|
|
174
|
+
status: exports.Sandbox.shape.status,
|
|
175
|
+
});
|
|
176
|
+
exports.NamedSandboxAndSessionResponse = zod_1.z.object({
|
|
177
|
+
namedSandbox: exports.NamedSandbox,
|
|
178
|
+
sandbox: exports.Sandbox,
|
|
179
|
+
routes: zod_1.z.array(exports.SandboxRoute),
|
|
180
|
+
});
|
|
181
|
+
exports.CursorPagination = zod_1.z.object({
|
|
182
|
+
count: zod_1.z.number(),
|
|
183
|
+
next: zod_1.z.string().nullable(),
|
|
184
|
+
total: zod_1.z.number(),
|
|
185
|
+
});
|
|
186
|
+
exports.NamedSandboxesPaginationResponse = zod_1.z.object({
|
|
187
|
+
namedSandboxes: zod_1.z.array(exports.NamedSandbox),
|
|
188
|
+
pagination: exports.CursorPagination,
|
|
189
|
+
});
|
|
190
|
+
exports.UpdateNamedSandboxResponse = zod_1.z.object({
|
|
191
|
+
namedSandbox: exports.NamedSandbox,
|
|
192
|
+
});
|
|
157
193
|
//# sourceMappingURL=validators.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../../src/api-client/validators.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAIX,QAAA,sBAAsB,GAAG,OAAC,CAAC,MAAM,CAAC;IAC7C,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,oCAAoC;IACpC,OAAO,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IACxC,wCAAwC;IACxC,WAAW,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC5C,CAAC,CAAC;AAEU,QAAA,sBAAsB,GAAG,OAAC,CAAC,KAAK,CAAC;IAC5C,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;IACxD,OAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;IACvD,OAAC;SACE,MAAM,CAAC;QACN,IAAI,EAAE,OAAC,CAAC,OAAO,CAAC,QAAQ,CAAC;QACzB,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,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C;AAEU,QAAA,gCAAgC,GAAG,OAAC,CAAC,MAAM,CAAC;IACvD,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,oBAAY,CAAC;IACrC,UAAU,EAAE,wBAAgB;CAC7B,CAAC,CAAC;AAEU,QAAA,0BAA0B,GAAG,OAAC,CAAC,MAAM,CAAC;IACjD,YAAY,EAAE,oBAAY;CAC3B,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { type NetworkPolicy, Sandbox, } from "./sandbox";
|
|
2
|
+
export { Session, type NetworkPolicyRule, type NetworkTransformer, } from "./session";
|
|
2
3
|
export { Snapshot } from "./snapshot";
|
|
3
4
|
export { Command, CommandFinished } from "./command";
|
|
4
5
|
export { StreamError } from "./api-client/api-error";
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.APIError = exports.StreamError = exports.CommandFinished = exports.Command = exports.Snapshot = exports.Sandbox = void 0;
|
|
3
|
+
exports.APIError = exports.StreamError = exports.CommandFinished = exports.Command = exports.Snapshot = exports.Session = exports.Sandbox = void 0;
|
|
4
4
|
var sandbox_1 = require("./sandbox");
|
|
5
5
|
Object.defineProperty(exports, "Sandbox", { enumerable: true, get: function () { return sandbox_1.Sandbox; } });
|
|
6
|
+
var session_1 = require("./session");
|
|
7
|
+
Object.defineProperty(exports, "Session", { enumerable: true, get: function () { return session_1.Session; } });
|
|
6
8
|
var snapshot_1 = require("./snapshot");
|
|
7
9
|
Object.defineProperty(exports, "Snapshot", { enumerable: true, get: function () { return snapshot_1.Snapshot; } });
|
|
8
10
|
var command_1 = require("./command");
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qCAGmB;AADjB,kGAAA,OAAO,OAAA;AAET,qCAImB;AAHjB,kGAAA,OAAO,OAAA;AAIT,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AACjB,qCAAqD;AAA5C,kGAAA,OAAO,OAAA;AAAE,0GAAA,eAAe,OAAA;AACjC,oDAAqD;AAA5C,wGAAA,WAAW,OAAA;AACpB,oDAAkD;AAAzC,qGAAA,QAAQ,OAAA"}
|
package/dist/sandbox.d.ts
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
import type { SandboxMetaData, SandboxRouteData } from "./api-client";
|
|
2
|
-
import { type Writable } from "stream";
|
|
1
|
+
import type { SandboxMetaData, SandboxRouteData, NamedSandboxMetaData } from "./api-client";
|
|
3
2
|
import { APIClient } from "./api-client";
|
|
4
|
-
import { Command, CommandFinished } from "./command";
|
|
5
3
|
import { type Credentials } from "./utils/get-credentials";
|
|
6
|
-
import { WithPrivate } from "./utils/types";
|
|
7
|
-
import { WithFetchOptions } from "./api-client/api-client";
|
|
8
|
-
import { RUNTIMES } from "./constants";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
|
|
4
|
+
import { type WithPrivate } from "./utils/types";
|
|
5
|
+
import type { WithFetchOptions } from "./api-client/api-client";
|
|
6
|
+
import type { RUNTIMES } from "./constants";
|
|
7
|
+
import { Session, type RunCommandParams } from "./session";
|
|
8
|
+
import type { Command, CommandFinished } from "./command";
|
|
9
|
+
import type { Snapshot } from "./snapshot";
|
|
10
|
+
import type { ConvertedSandbox } from "./utils/convert-sandbox";
|
|
11
|
+
import type { NetworkPolicy } from "./network-policy";
|
|
12
|
+
export type { NetworkPolicy };
|
|
13
13
|
/** @inline */
|
|
14
14
|
export interface BaseCreateSandboxParams {
|
|
15
|
+
/**
|
|
16
|
+
* The name of the sandbox. If omitted, a random name will be generated.
|
|
17
|
+
*/
|
|
18
|
+
name?: string;
|
|
15
19
|
/**
|
|
16
20
|
* The source of the sandbox.
|
|
17
21
|
*
|
|
@@ -82,6 +86,10 @@ export interface BaseCreateSandboxParams {
|
|
|
82
86
|
* An AbortSignal to cancel sandbox creation.
|
|
83
87
|
*/
|
|
84
88
|
signal?: AbortSignal;
|
|
89
|
+
/**
|
|
90
|
+
* Whether to enable snapshots on shutdown. Defaults to true.
|
|
91
|
+
*/
|
|
92
|
+
snapshotOnShutdown?: boolean;
|
|
85
93
|
}
|
|
86
94
|
export type CreateSandboxParams = BaseCreateSandboxParams | (Omit<BaseCreateSandboxParams, "runtime" | "source"> & {
|
|
87
95
|
source: {
|
|
@@ -92,167 +100,177 @@ export type CreateSandboxParams = BaseCreateSandboxParams | (Omit<BaseCreateSand
|
|
|
92
100
|
/** @inline */
|
|
93
101
|
interface GetSandboxParams {
|
|
94
102
|
/**
|
|
95
|
-
*
|
|
103
|
+
* The name of the sandbox.
|
|
104
|
+
*/
|
|
105
|
+
name: string;
|
|
106
|
+
/**
|
|
107
|
+
* Whether to resume an existing session. Defaults to true.
|
|
96
108
|
*/
|
|
97
|
-
|
|
109
|
+
resume?: boolean;
|
|
98
110
|
/**
|
|
99
111
|
* An AbortSignal to cancel the operation.
|
|
100
112
|
*/
|
|
101
113
|
signal?: AbortSignal;
|
|
102
114
|
}
|
|
103
|
-
/**
|
|
104
|
-
|
|
115
|
+
/**
|
|
116
|
+
* A Sandbox is a persistent, isolated Linux MicroVMs to run commands in.
|
|
117
|
+
* Use {@link Sandbox.create} or {@link Sandbox.get} to construct.
|
|
118
|
+
* @hideconstructor
|
|
119
|
+
*/
|
|
120
|
+
export declare class Sandbox {
|
|
121
|
+
private readonly client;
|
|
122
|
+
private readonly projectId;
|
|
105
123
|
/**
|
|
106
|
-
*
|
|
124
|
+
* Internal Session instance for the current VM.
|
|
107
125
|
*/
|
|
108
|
-
|
|
126
|
+
private session;
|
|
109
127
|
/**
|
|
110
|
-
*
|
|
128
|
+
* Internal metadata about the named sandbox.
|
|
111
129
|
*/
|
|
112
|
-
|
|
130
|
+
private namedSandbox;
|
|
113
131
|
/**
|
|
114
|
-
*
|
|
132
|
+
* The name of this sandbox.
|
|
115
133
|
*/
|
|
116
|
-
|
|
134
|
+
get name(): string;
|
|
117
135
|
/**
|
|
118
|
-
*
|
|
136
|
+
* Routes from ports to subdomains.
|
|
137
|
+
* @hidden
|
|
119
138
|
*/
|
|
120
|
-
|
|
139
|
+
get routes(): SandboxRouteData[];
|
|
121
140
|
/**
|
|
122
|
-
*
|
|
141
|
+
* Whether this sandbox snapshots on shutdown.
|
|
123
142
|
*/
|
|
124
|
-
|
|
143
|
+
get snapshotOnShutdown(): boolean;
|
|
125
144
|
/**
|
|
126
|
-
*
|
|
145
|
+
* The region this sandbox runs in.
|
|
127
146
|
*/
|
|
128
|
-
|
|
147
|
+
get region(): string;
|
|
129
148
|
/**
|
|
130
|
-
*
|
|
149
|
+
* Number of virtual CPUs allocated.
|
|
131
150
|
*/
|
|
132
|
-
|
|
151
|
+
get vcpus(): number;
|
|
133
152
|
/**
|
|
134
|
-
*
|
|
153
|
+
* Memory allocated in MB.
|
|
135
154
|
*/
|
|
136
|
-
|
|
155
|
+
get memory(): number;
|
|
156
|
+
/** Runtime identifier (e.g. "node24", "python3.13"). */
|
|
157
|
+
get runtime(): string;
|
|
137
158
|
/**
|
|
138
|
-
*
|
|
159
|
+
* Cumulative egress bytes across all sessions.
|
|
139
160
|
*/
|
|
140
|
-
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* A Sandbox is an isolated Linux MicroVM to run commands in.
|
|
144
|
-
*
|
|
145
|
-
* Use {@link Sandbox.create} or {@link Sandbox.get} to construct.
|
|
146
|
-
* @hideconstructor
|
|
147
|
-
*/
|
|
148
|
-
export declare class Sandbox {
|
|
149
|
-
private readonly client;
|
|
161
|
+
get totalEgressBytes(): number | undefined;
|
|
150
162
|
/**
|
|
151
|
-
*
|
|
152
|
-
/* @hidden
|
|
163
|
+
* Cumulative ingress bytes across all sessions.
|
|
153
164
|
*/
|
|
154
|
-
|
|
165
|
+
get totalIngressBytes(): number | undefined;
|
|
155
166
|
/**
|
|
156
|
-
*
|
|
167
|
+
* Cumulative active CPU duration in milliseconds across all sessions.
|
|
157
168
|
*/
|
|
158
|
-
get
|
|
159
|
-
get interactivePort(): number | undefined;
|
|
169
|
+
get totalActiveCpuDurationMs(): number | undefined;
|
|
160
170
|
/**
|
|
161
|
-
*
|
|
171
|
+
* Cumulative wall-clock duration in milliseconds across all sessions.
|
|
162
172
|
*/
|
|
163
|
-
get
|
|
173
|
+
get totalDurationMs(): number | undefined;
|
|
174
|
+
/**
|
|
175
|
+
* When this sandbox was last updated.
|
|
176
|
+
*/
|
|
177
|
+
get updatedAt(): Date;
|
|
164
178
|
/**
|
|
165
|
-
*
|
|
179
|
+
* When this sandbox was created.
|
|
166
180
|
*/
|
|
167
181
|
get createdAt(): Date;
|
|
168
182
|
/**
|
|
169
|
-
*
|
|
183
|
+
* Interactive port.
|
|
184
|
+
*/
|
|
185
|
+
get interactivePort(): number | undefined;
|
|
186
|
+
/**
|
|
187
|
+
* The status of the current session.
|
|
188
|
+
*/
|
|
189
|
+
get status(): SandboxMetaData["status"];
|
|
190
|
+
/**
|
|
191
|
+
* The default timeout of this sandbox in milliseconds.
|
|
170
192
|
*/
|
|
171
193
|
get timeout(): number;
|
|
172
194
|
/**
|
|
173
|
-
* The network policy of
|
|
195
|
+
* The default network policy of this sandbox.
|
|
174
196
|
*/
|
|
175
197
|
get networkPolicy(): NetworkPolicy | undefined;
|
|
176
198
|
/**
|
|
177
|
-
* If the
|
|
199
|
+
* If the session was created from a snapshot, the ID of that snapshot.
|
|
178
200
|
*/
|
|
179
201
|
get sourceSnapshotId(): string | undefined;
|
|
180
202
|
/**
|
|
181
|
-
* The
|
|
203
|
+
* The current snapshot ID of this sandbox, if any.
|
|
204
|
+
*/
|
|
205
|
+
get currentSnapshotId(): string | undefined;
|
|
206
|
+
/**
|
|
207
|
+
* The amount of CPU used by the session. Only reported once the VM is stopped.
|
|
182
208
|
*/
|
|
183
209
|
get activeCpuUsageMs(): number | undefined;
|
|
184
210
|
/**
|
|
185
|
-
* The amount of network data used by the
|
|
211
|
+
* The amount of network data used by the session. Only reported once the VM is stopped.
|
|
186
212
|
*/
|
|
187
213
|
get networkTransfer(): {
|
|
188
214
|
ingress: number;
|
|
189
215
|
egress: number;
|
|
190
216
|
} | undefined;
|
|
191
|
-
/**
|
|
192
|
-
* Internal metadata about this sandbox.
|
|
193
|
-
*/
|
|
194
|
-
private sandbox;
|
|
195
217
|
/**
|
|
196
218
|
* Allow to get a list of sandboxes for a team narrowed to the given params.
|
|
197
219
|
* It returns both the sandboxes and the pagination metadata to allow getting
|
|
198
220
|
* the next page of results.
|
|
199
221
|
*/
|
|
200
|
-
static list(params?: Partial<Parameters<APIClient["
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
} | undefined;
|
|
249
|
-
}[];
|
|
250
|
-
pagination: {
|
|
251
|
-
count: number;
|
|
252
|
-
next: number | null;
|
|
253
|
-
prev: number | null;
|
|
222
|
+
static list(params?: Partial<Parameters<APIClient["listNamedSandboxes"]>[0]> & Partial<Credentials> & WithFetchOptions): Promise<{
|
|
223
|
+
json: {
|
|
224
|
+
sandboxes: {
|
|
225
|
+
memory: number;
|
|
226
|
+
vcpus: number;
|
|
227
|
+
region: string;
|
|
228
|
+
runtime: string;
|
|
229
|
+
timeout: number;
|
|
230
|
+
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
231
|
+
createdAt: number;
|
|
232
|
+
updatedAt: number;
|
|
233
|
+
name: string;
|
|
234
|
+
snapshotOnShutdown: boolean;
|
|
235
|
+
currentSandboxId: string;
|
|
236
|
+
networkPolicy?: import("zod").objectInputType<{
|
|
237
|
+
mode: import("zod").ZodLiteral<"allow-all">;
|
|
238
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
239
|
+
mode: import("zod").ZodLiteral<"deny-all">;
|
|
240
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
241
|
+
mode: import("zod").ZodLiteral<"custom">;
|
|
242
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
243
|
+
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
244
|
+
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
245
|
+
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
246
|
+
domain: import("zod").ZodString;
|
|
247
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
248
|
+
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
249
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
250
|
+
domain: string;
|
|
251
|
+
headers?: Record<string, string> | undefined;
|
|
252
|
+
headerNames?: string[] | undefined;
|
|
253
|
+
}, {
|
|
254
|
+
domain: string;
|
|
255
|
+
headers?: Record<string, string> | undefined;
|
|
256
|
+
headerNames?: string[] | undefined;
|
|
257
|
+
}>, "many">>;
|
|
258
|
+
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
259
|
+
totalEgressBytes?: number | undefined;
|
|
260
|
+
totalIngressBytes?: number | undefined;
|
|
261
|
+
totalActiveCpuDurationMs?: number | undefined;
|
|
262
|
+
totalDurationMs?: number | undefined;
|
|
263
|
+
currentSnapshotId?: string | undefined;
|
|
264
|
+
}[];
|
|
265
|
+
pagination: {
|
|
266
|
+
count: number;
|
|
267
|
+
next: string | null;
|
|
268
|
+
total: number;
|
|
269
|
+
};
|
|
254
270
|
};
|
|
255
|
-
|
|
271
|
+
response: Response;
|
|
272
|
+
text: string;
|
|
273
|
+
}>;
|
|
256
274
|
/**
|
|
257
275
|
* Create a new sandbox.
|
|
258
276
|
*
|
|
@@ -267,28 +285,37 @@ export declare class Sandbox {
|
|
|
267
285
|
*/
|
|
268
286
|
static create(params?: WithPrivate<CreateSandboxParams | (CreateSandboxParams & Credentials)> & WithFetchOptions): Promise<Sandbox & AsyncDisposable>;
|
|
269
287
|
/**
|
|
270
|
-
* Retrieve an existing sandbox.
|
|
288
|
+
* Retrieve an existing sandbox and resume its session.
|
|
271
289
|
*
|
|
272
290
|
* @param params - Get parameters and optional credentials.
|
|
273
291
|
* @returns A promise resolving to the {@link Sandbox}.
|
|
274
292
|
*/
|
|
275
293
|
static get(params: WithPrivate<GetSandboxParams | (GetSandboxParams & Credentials)> & WithFetchOptions): Promise<Sandbox>;
|
|
276
|
-
constructor({ client, routes,
|
|
294
|
+
constructor({ client, routes, session, namedSandbox, projectId, }: {
|
|
277
295
|
client: APIClient;
|
|
278
296
|
routes: SandboxRouteData[];
|
|
279
|
-
|
|
297
|
+
session: SandboxMetaData;
|
|
298
|
+
namedSandbox: NamedSandboxMetaData;
|
|
299
|
+
projectId: string;
|
|
280
300
|
});
|
|
281
301
|
/**
|
|
282
|
-
* Get
|
|
302
|
+
* Get the current session (the running VM) for this sandbox.
|
|
283
303
|
*
|
|
284
|
-
* @
|
|
285
|
-
* @param opts - Optional parameters.
|
|
286
|
-
* @param opts.signal - An AbortSignal to cancel the operation.
|
|
287
|
-
* @returns A {@link Command} instance representing the command
|
|
304
|
+
* @returns The {@link Session} instance.
|
|
288
305
|
*/
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
306
|
+
currentSession(): Session;
|
|
307
|
+
/**
|
|
308
|
+
* Resume this sandbox by creating a new session via `getNamedSandbox`.
|
|
309
|
+
*/
|
|
310
|
+
private resume;
|
|
311
|
+
/**
|
|
312
|
+
* Poll until the current session reaches a terminal state, then resume.
|
|
313
|
+
*/
|
|
314
|
+
private waitForStopAndResume;
|
|
315
|
+
/**
|
|
316
|
+
* Execute `fn`, and if the session is stopped/stopping, resume and retry.
|
|
317
|
+
*/
|
|
318
|
+
private withResume;
|
|
292
319
|
/**
|
|
293
320
|
* Start executing a command in this sandbox.
|
|
294
321
|
*
|
|
@@ -324,7 +351,9 @@ export declare class Sandbox {
|
|
|
324
351
|
* @returns A {@link Command} or {@link CommandFinished}, depending on `detached`.
|
|
325
352
|
* @internal
|
|
326
353
|
*/
|
|
327
|
-
|
|
354
|
+
getCommand(cmdId: string, opts?: {
|
|
355
|
+
signal?: AbortSignal;
|
|
356
|
+
}): Promise<Command>;
|
|
328
357
|
/**
|
|
329
358
|
* Create a directory in the filesystem of this sandbox.
|
|
330
359
|
*
|
|
@@ -487,4 +516,126 @@ export declare class Sandbox {
|
|
|
487
516
|
expiration?: number;
|
|
488
517
|
signal?: AbortSignal;
|
|
489
518
|
}): Promise<Snapshot>;
|
|
519
|
+
/**
|
|
520
|
+
* Update the named sandbox configuration. Only provided fields are modified.
|
|
521
|
+
*
|
|
522
|
+
* @param params - Fields to update.
|
|
523
|
+
* @param opts - Optional abort signal.
|
|
524
|
+
*/
|
|
525
|
+
update(params: {
|
|
526
|
+
resources?: {
|
|
527
|
+
vcpus?: number;
|
|
528
|
+
memory?: number;
|
|
529
|
+
};
|
|
530
|
+
runtime?: RUNTIMES | (string & {});
|
|
531
|
+
timeout?: number;
|
|
532
|
+
networkPolicy?: NetworkPolicy;
|
|
533
|
+
}, opts?: {
|
|
534
|
+
signal?: AbortSignal;
|
|
535
|
+
}): Promise<void>;
|
|
536
|
+
/**
|
|
537
|
+
* Delete this named sandbox.
|
|
538
|
+
*
|
|
539
|
+
* After deletion the instance becomes inert — all further API calls will
|
|
540
|
+
* throw immediately.
|
|
541
|
+
*/
|
|
542
|
+
delete(opts?: {
|
|
543
|
+
preserveSnapshots?: boolean;
|
|
544
|
+
signal?: AbortSignal;
|
|
545
|
+
}): Promise<void>;
|
|
546
|
+
/**
|
|
547
|
+
* List sessions (VMs) that have been created for this named sandbox.
|
|
548
|
+
*
|
|
549
|
+
* @param params - Optional pagination parameters.
|
|
550
|
+
* @returns The list of sessions and pagination metadata.
|
|
551
|
+
*/
|
|
552
|
+
listSessions(params?: {
|
|
553
|
+
limit?: number;
|
|
554
|
+
since?: number | Date;
|
|
555
|
+
until?: number | Date;
|
|
556
|
+
signal?: AbortSignal;
|
|
557
|
+
}): Promise<import("./api-client/base-client").Parsed<{
|
|
558
|
+
sandboxes: {
|
|
559
|
+
id: string;
|
|
560
|
+
memory: number;
|
|
561
|
+
vcpus: number;
|
|
562
|
+
region: string;
|
|
563
|
+
runtime: string;
|
|
564
|
+
timeout: number;
|
|
565
|
+
status: "aborted" | "pending" | "running" | "stopping" | "stopped" | "failed" | "snapshotting";
|
|
566
|
+
requestedAt: number;
|
|
567
|
+
createdAt: number;
|
|
568
|
+
cwd: string;
|
|
569
|
+
updatedAt: number;
|
|
570
|
+
startedAt?: number | undefined;
|
|
571
|
+
requestedStopAt?: number | undefined;
|
|
572
|
+
stoppedAt?: number | undefined;
|
|
573
|
+
abortedAt?: number | undefined;
|
|
574
|
+
duration?: number | undefined;
|
|
575
|
+
sourceSnapshotId?: string | undefined;
|
|
576
|
+
snapshottedAt?: number | undefined;
|
|
577
|
+
interactivePort?: number | undefined;
|
|
578
|
+
networkPolicy?: import("zod").objectInputType<{
|
|
579
|
+
mode: import("zod").ZodLiteral<"allow-all">;
|
|
580
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
581
|
+
mode: import("zod").ZodLiteral<"deny-all">;
|
|
582
|
+
}, import("zod").ZodTypeAny, "passthrough"> | import("zod").objectInputType<{
|
|
583
|
+
mode: import("zod").ZodLiteral<"custom">;
|
|
584
|
+
allowedDomains: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
585
|
+
allowedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
586
|
+
deniedCIDRs: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
587
|
+
injectionRules: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodObject<{
|
|
588
|
+
domain: import("zod").ZodString;
|
|
589
|
+
headers: import("zod").ZodOptional<import("zod").ZodRecord<import("zod").ZodString, import("zod").ZodString>>;
|
|
590
|
+
headerNames: import("zod").ZodOptional<import("zod").ZodArray<import("zod").ZodString, "many">>;
|
|
591
|
+
}, "strip", import("zod").ZodTypeAny, {
|
|
592
|
+
domain: string;
|
|
593
|
+
headers?: Record<string, string> | undefined;
|
|
594
|
+
headerNames?: string[] | undefined;
|
|
595
|
+
}, {
|
|
596
|
+
domain: string;
|
|
597
|
+
headers?: Record<string, string> | undefined;
|
|
598
|
+
headerNames?: string[] | undefined;
|
|
599
|
+
}>, "many">>;
|
|
600
|
+
}, import("zod").ZodTypeAny, "passthrough"> | undefined;
|
|
601
|
+
activeCpuDurationMs?: number | undefined;
|
|
602
|
+
networkTransfer?: {
|
|
603
|
+
ingress: number;
|
|
604
|
+
egress: number;
|
|
605
|
+
} | undefined;
|
|
606
|
+
}[];
|
|
607
|
+
pagination: {
|
|
608
|
+
count: number;
|
|
609
|
+
next: number | null;
|
|
610
|
+
prev: number | null;
|
|
611
|
+
};
|
|
612
|
+
}>>;
|
|
613
|
+
/**
|
|
614
|
+
* List snapshots that belong to this named sandbox.
|
|
615
|
+
*
|
|
616
|
+
* @param params - Optional pagination parameters.
|
|
617
|
+
* @returns The list of snapshots and pagination metadata.
|
|
618
|
+
*/
|
|
619
|
+
listSnapshots(params?: {
|
|
620
|
+
limit?: number;
|
|
621
|
+
since?: number | Date;
|
|
622
|
+
until?: number | Date;
|
|
623
|
+
signal?: AbortSignal;
|
|
624
|
+
}): Promise<import("./api-client/base-client").Parsed<{
|
|
625
|
+
pagination: {
|
|
626
|
+
count: number;
|
|
627
|
+
next: number | null;
|
|
628
|
+
prev: number | null;
|
|
629
|
+
};
|
|
630
|
+
snapshots: {
|
|
631
|
+
id: string;
|
|
632
|
+
region: string;
|
|
633
|
+
status: "failed" | "created" | "deleted";
|
|
634
|
+
createdAt: number;
|
|
635
|
+
updatedAt: number;
|
|
636
|
+
sourceSandboxId: string;
|
|
637
|
+
sizeBytes: number;
|
|
638
|
+
expiresAt?: number | undefined;
|
|
639
|
+
}[];
|
|
640
|
+
}>>;
|
|
490
641
|
}
|