withruntime 0.11.2 → 0.14.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/BLAXEL.md +2 -2
- package/COMPATIBILITY.md +74 -9
- package/DAYTONA.md +33 -5
- package/E2B.md +85 -24
- package/README.md +11 -10
- package/README.src.md +10 -9
- package/VERCEL.md +43 -5
- package/compatibility-lock.json +58 -49
- package/dist/billing-cli.d.ts +1 -1
- package/dist/billing-cli.js +85 -5
- package/dist/blaxel/errors.d.ts +14 -0
- package/dist/blaxel/errors.js +29 -0
- package/dist/blaxel/index.d.ts +2 -2
- package/dist/blaxel/index.js +4 -4
- package/dist/blaxel/interpreter.d.ts +2 -5
- package/dist/blaxel/sandbox.d.ts +15 -6
- package/dist/blaxel/sandbox.js +64 -8
- package/dist/blaxel/snapshot.d.ts +4 -0
- package/dist/blaxel/snapshot.js +4 -0
- package/dist/cli/logs.d.ts +21 -0
- package/dist/cli/logs.js +188 -0
- package/dist/cli-extras.d.ts +3 -3
- package/dist/cli-extras.js +17 -12
- package/dist/cli-words.d.ts +10 -1
- package/dist/cli-words.js +18 -0
- package/dist/cli.d.ts +22 -3
- package/dist/cli.js +647 -273
- package/dist/client.d.ts +2 -4
- package/dist/client.js +27 -11
- package/dist/cloudflare/errors.d.ts +143 -0
- package/dist/cloudflare/errors.js +167 -0
- package/dist/cloudflare/index.d.ts +175 -6
- package/dist/cloudflare/index.js +416 -26
- package/dist/cloudflare/interpreter.d.ts +119 -0
- package/dist/cloudflare/interpreter.js +223 -0
- package/dist/cloudflare/streams.d.ts +38 -0
- package/dist/cloudflare/streams.js +145 -0
- package/dist/cloudflare/watch.d.ts +9 -0
- package/dist/cloudflare/watch.js +24 -0
- package/dist/codesandbox/index.d.ts +216 -28
- package/dist/codesandbox/index.js +478 -78
- package/dist/compat/core.d.ts +18 -0
- package/dist/compat/core.js +29 -0
- package/dist/compat/files.d.ts +1 -0
- package/dist/compat/files.js +25 -5
- package/dist/credentials.d.ts +3 -0
- package/dist/credentials.js +15 -0
- package/dist/daytona/computer-use.d.ts +13 -4
- package/dist/daytona/computer-use.js +66 -8
- package/dist/daytona/daytona.d.ts +7 -1
- package/dist/daytona/daytona.js +31 -4
- package/dist/daytona/errors.d.ts +11 -0
- package/dist/daytona/errors.js +18 -0
- package/dist/daytona/filesystem.js +2 -1
- package/dist/daytona/image.d.ts +13 -9
- package/dist/daytona/image.js +18 -12
- package/dist/daytona/index.d.ts +1 -1
- package/dist/daytona/sandbox.d.ts +8 -2
- package/dist/daytona/sandbox.js +16 -2
- package/dist/domains/index.d.ts +9 -0
- package/dist/domains/index.js +10 -0
- package/dist/e2b/commands.d.ts +1 -1
- package/dist/e2b/commands.js +6 -7
- package/dist/e2b/errors.d.ts +17 -0
- package/dist/e2b/errors.js +40 -1
- package/dist/e2b/index.d.ts +2 -2
- package/dist/e2b/index.js +1 -1
- package/dist/e2b/sandbox.d.ts +28 -22
- package/dist/e2b/sandbox.js +34 -8
- package/dist/e2b/unsupported.js +1 -1
- package/dist/errors.d.ts +11 -2
- package/dist/errors.js +17 -5
- package/dist/freestyle/index.d.ts +285 -37
- package/dist/freestyle/index.js +656 -144
- package/dist/identity.d.ts +3 -0
- package/dist/identity.js +27 -0
- package/dist/images/index.d.ts +9 -0
- package/dist/images/index.js +10 -0
- package/dist/index.d.ts +3 -1
- package/dist/ips/index.d.ts +9 -0
- package/dist/ips/index.js +10 -0
- package/dist/jobs/index.d.ts +9 -0
- package/dist/jobs/index.js +10 -0
- package/dist/keys.js +2 -0
- package/dist/login.js +2 -0
- package/dist/machine.d.ts +27 -4
- package/dist/machine.js +46 -14
- package/dist/mcp.js +144 -20
- package/dist/modal/index.d.ts +339 -61
- package/dist/modal/index.js +781 -121
- package/dist/network-cli.d.ts +3 -1
- package/dist/network-cli.js +78 -36
- package/dist/networks/index.d.ts +11 -0
- package/dist/networks/index.js +10 -0
- package/dist/ports/index.d.ts +9 -0
- package/dist/ports/index.js +10 -0
- package/dist/product-names.d.ts +52 -0
- package/dist/product-names.js +164 -0
- package/dist/product-renames.d.ts +103 -0
- package/dist/product-renames.js +189 -0
- package/dist/products/api-keys.d.ts +73 -0
- package/dist/products/api-keys.js +23 -0
- package/dist/products/apps.d.ts +157 -0
- package/dist/products/apps.js +60 -0
- package/dist/products/balancers.d.ts +87 -0
- package/dist/products/balancers.js +8 -0
- package/dist/products/billing.d.ts +41 -0
- package/dist/products/billing.js +13 -0
- package/dist/products/browser.d.ts +10 -0
- package/dist/products/browsers.d.ts +71 -0
- package/dist/products/browsers.js +102 -0
- package/dist/products/builds.d.ts +156 -0
- package/dist/products/builds.js +227 -0
- package/dist/products/index.d.ts +5 -16
- package/dist/products/index.js +5 -14
- package/dist/products/jobs.d.ts +19 -2
- package/dist/products/jobs.js +28 -11
- package/dist/products/logs.d.ts +245 -0
- package/dist/products/logs.js +274 -0
- package/dist/products/network-products.d.ts +38 -7
- package/dist/products/network-products.js +31 -18
- package/dist/products/observability.d.ts +8 -2
- package/dist/products/private-network.js +1 -1
- package/dist/products/queues.d.ts +149 -0
- package/dist/products/queues.js +213 -0
- package/dist/products/referrals.d.ts +21 -7
- package/dist/products/referrals.js +3 -3
- package/dist/products/resources.d.ts +54 -0
- package/dist/products/resources.js +122 -0
- package/dist/products/secrets.d.ts +29 -3
- package/dist/products/secrets.js +47 -18
- package/dist/products/signed-requests.d.ts +21 -0
- package/dist/products/signed-requests.js +11 -0
- package/dist/products/streams.d.ts +73 -0
- package/dist/products/streams.js +17 -0
- package/dist/products/switching.d.ts +35 -7
- package/dist/products/switching.js +4 -3
- package/dist/products/volumes.d.ts +6 -0
- package/dist/record-cli.d.ts +23 -0
- package/dist/record-cli.js +308 -0
- package/dist/renamed-products.d.ts +38 -0
- package/dist/renamed-products.js +34 -0
- package/dist/runloop/index.d.ts +9 -2
- package/dist/runloop/index.js +29 -8
- package/dist/runloop/sdk.d.ts +131 -0
- package/dist/runloop/sdk.js +167 -0
- package/dist/sandbox.d.ts +7 -2
- package/dist/sandbox.js +41 -11
- package/dist/sandboxes/index.d.ts +11 -0
- package/dist/sandboxes/index.js +12 -0
- package/dist/snapshots/index.d.ts +9 -0
- package/dist/snapshots/index.js +11 -0
- package/dist/snapshots.d.ts +7 -4
- package/dist/sprites/index.d.ts +343 -31
- package/dist/sprites/index.js +866 -84
- package/dist/ssh.d.ts +1 -1
- package/dist/ssh.js +11 -11
- package/dist/terminal.d.ts +24 -0
- package/dist/terminal.js +32 -0
- package/dist/transport.d.ts +18 -1
- package/dist/transport.js +80 -6
- package/dist/tunnel.js +1 -1
- package/dist/types.d.ts +71 -4
- package/dist/vercel/sandbox.d.ts +1 -1
- package/dist/vercel/sandbox.js +6 -4
- package/dist/vercel/snapshot.js +10 -2
- package/dist/volumes/index.d.ts +9 -0
- package/dist/volumes/index.js +10 -0
- package/dist/wallet.d.ts +4 -1
- package/dist/wallet.js +2 -1
- package/package.json +48 -14
package/dist/modal/index.d.ts
CHANGED
|
@@ -1,25 +1,262 @@
|
|
|
1
1
|
import type { Runtime } from "../client.js";
|
|
2
2
|
import type { Process, Sandbox as NativeSandbox } from "../sandbox.js";
|
|
3
|
-
import { CompatibilityError, type ClientOptions } from "../compat/core.js";
|
|
3
|
+
import { CompatibilityError, type ClientOptions, type Refused, type RefusedAsync } from "../compat/core.js";
|
|
4
4
|
export { CompatibilityError };
|
|
5
|
+
export declare class TimeoutError extends Error {
|
|
6
|
+
}
|
|
7
|
+
export declare class RemoteError extends Error {
|
|
8
|
+
}
|
|
9
|
+
export declare class ExecutionError extends Error {
|
|
10
|
+
}
|
|
11
|
+
export declare class InternalFailure extends Error {
|
|
12
|
+
}
|
|
5
13
|
export declare class NotFoundError extends Error {
|
|
6
14
|
}
|
|
7
|
-
export declare class
|
|
15
|
+
export declare class AlreadyExistsError extends Error {
|
|
16
|
+
}
|
|
17
|
+
export declare class ConflictError extends Error {
|
|
18
|
+
}
|
|
19
|
+
export declare class InvalidError extends Error {
|
|
20
|
+
}
|
|
21
|
+
export declare class ResourceExhaustedError extends Error {
|
|
8
22
|
}
|
|
9
23
|
export declare class SandboxTimeoutError extends TimeoutError {
|
|
10
24
|
}
|
|
25
|
+
export declare class SnapshotCreationError extends Error {
|
|
26
|
+
}
|
|
27
|
+
export declare class ClientClosedError extends Error {
|
|
28
|
+
}
|
|
29
|
+
export declare class SandboxFilesystemError extends Error {
|
|
30
|
+
}
|
|
31
|
+
export declare class SandboxFilesystemDirectoryNotEmptyError extends SandboxFilesystemError {
|
|
32
|
+
}
|
|
33
|
+
export declare class SandboxFilesystemFileTooLargeError extends SandboxFilesystemError {
|
|
34
|
+
}
|
|
35
|
+
export declare class SandboxFilesystemIsADirectoryError extends SandboxFilesystemError {
|
|
36
|
+
}
|
|
37
|
+
export declare class SandboxFilesystemNotADirectoryError extends SandboxFilesystemError {
|
|
38
|
+
}
|
|
39
|
+
export declare class SandboxFilesystemNotFoundError extends SandboxFilesystemError {
|
|
40
|
+
}
|
|
41
|
+
export declare class SandboxFilesystemPathAlreadyExistsError extends SandboxFilesystemError {
|
|
42
|
+
}
|
|
43
|
+
export declare class SandboxFilesystemPermissionError extends SandboxFilesystemError {
|
|
44
|
+
}
|
|
11
45
|
export declare class App {
|
|
12
46
|
readonly appId: string;
|
|
13
47
|
readonly name?: string | undefined;
|
|
14
48
|
readonly environmentName?: string | undefined;
|
|
15
49
|
constructor(appId: string, name?: string | undefined, environmentName?: string | undefined);
|
|
16
50
|
}
|
|
51
|
+
export declare class AppService {
|
|
52
|
+
private readonly client;
|
|
53
|
+
constructor(client: ModalClient);
|
|
54
|
+
fromName(name: string, params?: {
|
|
55
|
+
createIfMissing?: boolean;
|
|
56
|
+
environment?: string;
|
|
57
|
+
}): Promise<App>;
|
|
58
|
+
}
|
|
59
|
+
/** Values the sandbox receives as environment variables, from the caller. */
|
|
60
|
+
export declare class Secret {
|
|
61
|
+
readonly values: Record<string, string>;
|
|
62
|
+
readonly name?: string | undefined;
|
|
63
|
+
readonly secretId: string;
|
|
64
|
+
constructor(values: Record<string, string>, name?: string | undefined);
|
|
65
|
+
}
|
|
66
|
+
export declare class SecretService {
|
|
67
|
+
private readonly client;
|
|
68
|
+
constructor(client: ModalClient);
|
|
69
|
+
fromObject(entries: Record<string, string>, params?: {
|
|
70
|
+
environment?: string;
|
|
71
|
+
}): Promise<Secret>;
|
|
72
|
+
readonly fromName: RefusedAsync;
|
|
73
|
+
readonly delete: RefusedAsync;
|
|
74
|
+
}
|
|
75
|
+
export declare class Volume {
|
|
76
|
+
readonly volumeId: string;
|
|
77
|
+
readonly name?: string | undefined;
|
|
78
|
+
readonly readOnly: boolean;
|
|
79
|
+
constructor(volumeId: string, name?: string | undefined, readOnly?: boolean);
|
|
80
|
+
withMountOptions(params?: {
|
|
81
|
+
readOnly?: boolean;
|
|
82
|
+
subPath?: string;
|
|
83
|
+
}): Volume;
|
|
84
|
+
closeEphemeral(): void;
|
|
85
|
+
}
|
|
86
|
+
export declare class VolumeService {
|
|
87
|
+
private readonly client;
|
|
88
|
+
constructor(client: ModalClient);
|
|
89
|
+
private find;
|
|
90
|
+
fromName(name: string, params?: {
|
|
91
|
+
createIfMissing?: boolean;
|
|
92
|
+
environment?: string;
|
|
93
|
+
}): Promise<Volume>;
|
|
94
|
+
delete(name: string, params?: {
|
|
95
|
+
allowMissing?: boolean;
|
|
96
|
+
environment?: string;
|
|
97
|
+
}): Promise<void>;
|
|
98
|
+
readonly ephemeral: RefusedAsync;
|
|
99
|
+
}
|
|
100
|
+
export declare class CloudBucketMount {
|
|
101
|
+
readonly bucketName: string;
|
|
102
|
+
readonly readOnly: boolean;
|
|
103
|
+
readonly bucketEndpointUrl?: string | undefined;
|
|
104
|
+
readonly keyPrefix?: string | undefined;
|
|
105
|
+
/** Refused at creation: Runtime mounts public buckets here, keyed ones natively. */
|
|
106
|
+
readonly secret?: Secret;
|
|
107
|
+
readonly requesterPays = false;
|
|
108
|
+
readonly oidcAuthRoleArn?: string;
|
|
109
|
+
constructor(bucketName: string, readOnly?: boolean, bucketEndpointUrl?: string | undefined, keyPrefix?: string | undefined);
|
|
110
|
+
readonly toProto: Refused;
|
|
111
|
+
/** The native mount for `path`: the provider read from the endpoint's host. */
|
|
112
|
+
native(path: string): {
|
|
113
|
+
readOnly: boolean;
|
|
114
|
+
prefix?: string | undefined;
|
|
115
|
+
accountId: string | undefined;
|
|
116
|
+
provider: "s3" | "r2" | "gcs";
|
|
117
|
+
bucket: string;
|
|
118
|
+
path: string;
|
|
119
|
+
} | {
|
|
120
|
+
readOnly: boolean;
|
|
121
|
+
prefix?: string | undefined;
|
|
122
|
+
endpoint: string;
|
|
123
|
+
provider: "s3" | "r2" | "gcs";
|
|
124
|
+
bucket: string;
|
|
125
|
+
path: string;
|
|
126
|
+
} | {
|
|
127
|
+
readOnly: boolean;
|
|
128
|
+
prefix?: string | undefined;
|
|
129
|
+
provider: "s3" | "r2" | "gcs";
|
|
130
|
+
bucket: string;
|
|
131
|
+
path: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
export declare class CloudBucketMountService {
|
|
135
|
+
create(bucketName: string, params?: {
|
|
136
|
+
secret?: Secret;
|
|
137
|
+
readOnly?: boolean;
|
|
138
|
+
requesterPays?: boolean;
|
|
139
|
+
bucketEndpointUrl?: string;
|
|
140
|
+
keyPrefix?: string;
|
|
141
|
+
oidcAuthRoleArn?: string;
|
|
142
|
+
}): CloudBucketMount;
|
|
143
|
+
}
|
|
144
|
+
export declare class Proxy {
|
|
145
|
+
readonly proxyId: Refused;
|
|
146
|
+
}
|
|
147
|
+
export declare class ProxyService {
|
|
148
|
+
readonly fromName: RefusedAsync;
|
|
149
|
+
}
|
|
150
|
+
export declare class ExperimentalOutboundPolicy {
|
|
151
|
+
readonly withHeaderReplacement: Refused;
|
|
152
|
+
}
|
|
153
|
+
type ProbeSpec = {
|
|
154
|
+
tcpPort?: number;
|
|
155
|
+
execArgv?: string[];
|
|
156
|
+
intervalMs: number;
|
|
157
|
+
};
|
|
158
|
+
export declare class Probe {
|
|
159
|
+
readonly spec: ProbeSpec;
|
|
160
|
+
private constructor();
|
|
161
|
+
private static interval;
|
|
162
|
+
static withTcp(port: number, params?: {
|
|
163
|
+
intervalMs: number;
|
|
164
|
+
}): Probe;
|
|
165
|
+
static withExec(argv: string[], params?: {
|
|
166
|
+
intervalMs: number;
|
|
167
|
+
}): Probe;
|
|
168
|
+
readonly toProto: Refused;
|
|
169
|
+
}
|
|
170
|
+
export declare class Image {
|
|
171
|
+
/** Absent only for an Image that is already built. */
|
|
172
|
+
private readonly runtime;
|
|
173
|
+
private readonly tag?;
|
|
174
|
+
private readonly commands;
|
|
175
|
+
private readonly env;
|
|
176
|
+
private readonly cache;
|
|
177
|
+
/** The id is a native disk snapshot (snapshotFilesystem), not an image. */
|
|
178
|
+
readonly snapshot: boolean;
|
|
179
|
+
private built?;
|
|
180
|
+
constructor(
|
|
181
|
+
/** Absent only for an Image that is already built. */
|
|
182
|
+
runtime: Runtime | undefined, tag?: string | undefined, id?: string, commands?: string[], env?: Record<string, string>, cache?: boolean,
|
|
183
|
+
/** The id is a native disk snapshot (snapshotFilesystem), not an image. */
|
|
184
|
+
snapshot?: boolean);
|
|
185
|
+
get imageId(): string;
|
|
186
|
+
dockerfileCommands(commands: string[], params?: {
|
|
187
|
+
env?: Record<string, string>;
|
|
188
|
+
forceBuild?: boolean;
|
|
189
|
+
}): Image;
|
|
190
|
+
build(_app?: App): Promise<Image>;
|
|
191
|
+
readonly publish: RefusedAsync;
|
|
192
|
+
}
|
|
193
|
+
export declare class ImageService {
|
|
194
|
+
private readonly client;
|
|
195
|
+
constructor(client: ModalClient);
|
|
196
|
+
fromRegistry(tag: string, secret?: Secret): Image;
|
|
197
|
+
fromId(imageId: string): Promise<Image>;
|
|
198
|
+
fromName(name: string, params?: {
|
|
199
|
+
environment?: string;
|
|
200
|
+
}): Promise<Image>;
|
|
201
|
+
delete(imageId: string, _params?: Record<never, never>): Promise<void>;
|
|
202
|
+
readonly fromAwsEcr: Refused;
|
|
203
|
+
readonly fromGcpArtifactRegistry: Refused;
|
|
204
|
+
}
|
|
205
|
+
export declare class SandboxSnapshot {
|
|
206
|
+
readonly snapshotId: string;
|
|
207
|
+
constructor(snapshotId: string);
|
|
208
|
+
}
|
|
209
|
+
export declare class SandboxSnapshotService {
|
|
210
|
+
private readonly client;
|
|
211
|
+
constructor(client: ModalClient);
|
|
212
|
+
fromId(snapshotId: string): Promise<SandboxSnapshot>;
|
|
213
|
+
}
|
|
214
|
+
export type ModalClientParams = ClientOptions & {
|
|
215
|
+
tokenId?: string;
|
|
216
|
+
tokenSecret?: string;
|
|
217
|
+
environment?: string;
|
|
218
|
+
oauthRefreshToken?: string;
|
|
219
|
+
oauthClientId?: string;
|
|
220
|
+
oauthClientSecret?: string;
|
|
221
|
+
oauthJwtKey?: string;
|
|
222
|
+
endpoint?: string;
|
|
223
|
+
maxThrottleWaitSecs?: number;
|
|
224
|
+
logger?: unknown;
|
|
225
|
+
logLevel?: string;
|
|
226
|
+
grpcMiddleware?: unknown[];
|
|
227
|
+
cpClient?: unknown;
|
|
228
|
+
};
|
|
229
|
+
export declare class ModalClient {
|
|
230
|
+
#private;
|
|
231
|
+
readonly runtime: Runtime;
|
|
232
|
+
readonly apps: AppService;
|
|
233
|
+
readonly images: ImageService;
|
|
234
|
+
readonly sandboxes: SandboxService;
|
|
235
|
+
readonly secrets: SecretService;
|
|
236
|
+
readonly volumes: VolumeService;
|
|
237
|
+
readonly cloudBucketMounts: CloudBucketMountService;
|
|
238
|
+
readonly sandboxSnapshots: SandboxSnapshotService;
|
|
239
|
+
readonly proxies: ProxyService;
|
|
240
|
+
constructor(options?: ModalClientParams);
|
|
241
|
+
/** Throws once close() was called, as Modal's client does. */
|
|
242
|
+
open(): void;
|
|
243
|
+
environmentName(environment?: string): string;
|
|
244
|
+
/** The Modal SDK version whose interface this adapter implements. */
|
|
245
|
+
version(): string;
|
|
246
|
+
close(): void;
|
|
247
|
+
readonly cpClient: Refused;
|
|
248
|
+
readonly ipClient: Refused;
|
|
249
|
+
readonly profile: Refused;
|
|
250
|
+
readonly logger: Refused;
|
|
251
|
+
readonly getImageBuilderVersion: RefusedAsync;
|
|
252
|
+
}
|
|
17
253
|
export type SandboxCreateParams = {
|
|
18
254
|
name?: string;
|
|
19
255
|
cpu?: number;
|
|
20
256
|
cpuLimit?: number;
|
|
21
257
|
memoryMiB?: number;
|
|
22
258
|
memoryLimitMiB?: number;
|
|
259
|
+
runtime?: "gvisor" | "vm";
|
|
23
260
|
timeoutMs?: number;
|
|
24
261
|
workdir?: string;
|
|
25
262
|
command?: string[];
|
|
@@ -33,6 +270,9 @@ export type SandboxCreateParams = {
|
|
|
33
270
|
gpu?: string;
|
|
34
271
|
pty?: boolean;
|
|
35
272
|
secrets?: Secret[];
|
|
273
|
+
volumes?: Record<string, Volume>;
|
|
274
|
+
cloudBucketMounts?: Record<string, CloudBucketMount>;
|
|
275
|
+
readinessProbe?: Probe;
|
|
36
276
|
experimentalEnableSnapshot?: boolean;
|
|
37
277
|
};
|
|
38
278
|
export type SandboxExecParams = {
|
|
@@ -45,59 +285,33 @@ export type SandboxExecParams = {
|
|
|
45
285
|
pty?: boolean;
|
|
46
286
|
secrets?: Secret[];
|
|
47
287
|
};
|
|
48
|
-
export declare class Secret {
|
|
49
|
-
readonly values: Record<string, string>;
|
|
50
|
-
constructor(values: Record<string, string>);
|
|
51
|
-
}
|
|
52
|
-
export declare class ModalClient {
|
|
53
|
-
readonly runtime: Runtime;
|
|
54
|
-
readonly apps: {
|
|
55
|
-
fromName: (name: string, params?: {
|
|
56
|
-
createIfMissing?: boolean;
|
|
57
|
-
environment?: string;
|
|
58
|
-
}) => Promise<App>;
|
|
59
|
-
};
|
|
60
|
-
readonly images: {
|
|
61
|
-
fromRegistry: (tag: string, secret?: Secret) => Image;
|
|
62
|
-
fromId: (id: string) => Promise<Image>;
|
|
63
|
-
fromName: (name: string) => Promise<Image>;
|
|
64
|
-
delete: (id: string) => Promise<import("../products/images.js").Image>;
|
|
65
|
-
};
|
|
66
|
-
readonly sandboxes: SandboxService;
|
|
67
|
-
readonly secrets: {
|
|
68
|
-
fromObject: (values: Record<string, string>) => Secret;
|
|
69
|
-
};
|
|
70
|
-
constructor(options?: ClientOptions & {
|
|
71
|
-
tokenId?: string;
|
|
72
|
-
tokenSecret?: string;
|
|
73
|
-
environment?: string;
|
|
74
|
-
});
|
|
75
|
-
close(): void;
|
|
76
|
-
}
|
|
77
|
-
export declare class Image {
|
|
78
|
-
private readonly runtime;
|
|
79
|
-
private readonly tag?;
|
|
80
|
-
private readonly commands;
|
|
81
|
-
private readonly env;
|
|
82
|
-
private readonly cache;
|
|
83
|
-
private built?;
|
|
84
|
-
constructor(runtime: Runtime, tag?: string | undefined, id?: string, commands?: string[], env?: Record<string, string>, cache?: boolean);
|
|
85
|
-
get imageId(): string;
|
|
86
|
-
dockerfileCommands(commands: string[], params?: {
|
|
87
|
-
env?: Record<string, string>;
|
|
88
|
-
forceBuild?: boolean;
|
|
89
|
-
}): Image;
|
|
90
|
-
build(_app?: App): Promise<Image>;
|
|
91
|
-
}
|
|
92
288
|
export declare class SandboxService {
|
|
93
289
|
private readonly runtime;
|
|
94
|
-
|
|
290
|
+
private readonly client?;
|
|
291
|
+
constructor(runtime: Runtime, client?: ModalClient | undefined);
|
|
95
292
|
create(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
|
|
293
|
+
experimentalCreate(app: App, image: Image, params?: SandboxCreateParams): Promise<Sandbox>;
|
|
96
294
|
fromId(id: string): Promise<Sandbox>;
|
|
97
|
-
fromName(appName: string, name: string
|
|
295
|
+
fromName(appName: string, name: string, params?: {
|
|
296
|
+
environment?: string;
|
|
297
|
+
}): Promise<Sandbox>;
|
|
298
|
+
experimentalFromName(appName: string, name: string, params?: {
|
|
299
|
+
environment?: string;
|
|
300
|
+
}): Promise<Sandbox>;
|
|
301
|
+
/** A new sandbox continuing a memory snapshot: its files, memory and
|
|
302
|
+
* running entrypoint, under the snapshot's app and tags. */
|
|
303
|
+
experimentalFromSnapshot(snapshot: SandboxSnapshot, params?: {
|
|
304
|
+
name?: string | null;
|
|
305
|
+
}): Promise<Sandbox>;
|
|
98
306
|
list(params?: {
|
|
99
307
|
appId?: string;
|
|
100
308
|
tags?: Record<string, string>;
|
|
309
|
+
environment?: string;
|
|
310
|
+
}): AsyncGenerator<Sandbox, void, unknown>;
|
|
311
|
+
experimentalList(params?: {
|
|
312
|
+
appId?: string;
|
|
313
|
+
tags?: Record<string, string>;
|
|
314
|
+
environment?: string;
|
|
101
315
|
}): AsyncGenerator<Sandbox, void, unknown>;
|
|
102
316
|
}
|
|
103
317
|
export declare class ModalReadStream<R extends string | Uint8Array = string> extends ReadableStream<R> {
|
|
@@ -121,18 +335,57 @@ export declare class ContainerProcess<R extends string | Uint8Array = string> {
|
|
|
121
335
|
closeStdin(): Promise<void>;
|
|
122
336
|
_poll(): Promise<number | null>;
|
|
123
337
|
}
|
|
338
|
+
/** Host and port of a sandbox port's public HTTPS address. Runtime previews
|
|
339
|
+
* are HTTPS only, so there is no unencrypted address. */
|
|
340
|
+
export declare class Tunnel {
|
|
341
|
+
host: string;
|
|
342
|
+
port: number;
|
|
343
|
+
unencryptedHost?: string | undefined;
|
|
344
|
+
unencryptedPort?: number | undefined;
|
|
345
|
+
constructor(host: string, port: number, unencryptedHost?: string | undefined, unencryptedPort?: number | undefined);
|
|
346
|
+
get url(): string;
|
|
347
|
+
get tlsSocket(): [string, number];
|
|
348
|
+
get tcpSocket(): [string, number];
|
|
349
|
+
}
|
|
350
|
+
export declare class SandboxLogsManager {
|
|
351
|
+
readonly fetch: Refused;
|
|
352
|
+
readonly tail: Refused;
|
|
353
|
+
}
|
|
354
|
+
export declare class SidecarService {
|
|
355
|
+
readonly create: RefusedAsync;
|
|
356
|
+
readonly get: RefusedAsync;
|
|
357
|
+
readonly list: Refused;
|
|
358
|
+
}
|
|
359
|
+
export declare class SidecarContainer {
|
|
360
|
+
readonly containerId: Refused;
|
|
361
|
+
readonly containerName: Refused;
|
|
362
|
+
readonly filesystem: Refused;
|
|
363
|
+
readonly exec: RefusedAsync;
|
|
364
|
+
readonly mountImage: RefusedAsync;
|
|
365
|
+
readonly poll: RefusedAsync;
|
|
366
|
+
readonly reloadVolumes: RefusedAsync;
|
|
367
|
+
readonly snapshotDirectory: RefusedAsync;
|
|
368
|
+
readonly snapshotFilesystem: RefusedAsync;
|
|
369
|
+
readonly terminate: RefusedAsync;
|
|
370
|
+
readonly unmountImage: RefusedAsync;
|
|
371
|
+
readonly wait: RefusedAsync;
|
|
372
|
+
}
|
|
124
373
|
export declare class Sandbox {
|
|
125
374
|
readonly native: NativeSandbox;
|
|
126
375
|
private readonly primary;
|
|
376
|
+
private readonly client?;
|
|
127
377
|
readonly filesystem: SandboxFilesystem;
|
|
128
378
|
readonly stdin: ModalWriteStream<string>;
|
|
129
379
|
readonly stdout: ModalReadStream<string>;
|
|
130
380
|
readonly stderr: ModalReadStream<string>;
|
|
381
|
+
readonly logs: SandboxLogsManager;
|
|
382
|
+
readonly experimentalSidecars: SidecarService;
|
|
131
383
|
private detached;
|
|
132
384
|
private lifecycle?;
|
|
133
385
|
monitorEntrypoint(): void;
|
|
134
|
-
constructor(native: NativeSandbox, primary: ContainerProcess);
|
|
386
|
+
constructor(native: NativeSandbox, primary: ContainerProcess, client?: ModalClient | undefined);
|
|
135
387
|
get sandboxId(): string;
|
|
388
|
+
private attached;
|
|
136
389
|
exec(command: string[], params?: SandboxExecParams & {
|
|
137
390
|
mode?: "text";
|
|
138
391
|
}): Promise<ContainerProcess<string>>;
|
|
@@ -141,27 +394,43 @@ export declare class Sandbox {
|
|
|
141
394
|
}): Promise<ContainerProcess<Uint8Array>>;
|
|
142
395
|
setTags(tags: Record<string, string>): Promise<void>;
|
|
143
396
|
getTags(): Promise<Record<string, string>>;
|
|
397
|
+
/** Names the sandbox so sandboxes.fromName(app, name) finds it. */
|
|
398
|
+
experimentalSetName(name: string): Promise<void>;
|
|
144
399
|
terminate(params?: {
|
|
145
400
|
wait?: boolean;
|
|
146
401
|
}): Promise<number | undefined>;
|
|
147
402
|
detach(): void;
|
|
148
403
|
wait(): Promise<number>;
|
|
149
404
|
poll(): Promise<number | null>;
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
port: number;
|
|
154
|
-
url: string;
|
|
155
|
-
};
|
|
156
|
-
}>;
|
|
405
|
+
/** Runs the sandbox's readinessProbe until it passes. */
|
|
406
|
+
waitUntilReady(timeoutMs?: number): Promise<void>;
|
|
407
|
+
tunnels(timeoutMs?: number): Promise<Record<number, Tunnel>>;
|
|
157
408
|
updateNetworkPolicy(params: {
|
|
158
|
-
outboundCidrAllowlist
|
|
159
|
-
outboundDomainAllowlist
|
|
409
|
+
outboundCidrAllowlist?: string[];
|
|
410
|
+
outboundDomainAllowlist?: string[];
|
|
160
411
|
}): Promise<void>;
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
412
|
+
/** Runtime volumes are block devices with one writer: a read-write mount
|
|
413
|
+
* always shows the latest writes. A read-only mount is a copy taken at
|
|
414
|
+
* start, which cannot reload. */
|
|
415
|
+
reloadVolumes(params?: {
|
|
416
|
+
timeoutMs?: number;
|
|
417
|
+
}): Promise<void>;
|
|
418
|
+
/** The whole sandbox, memory and running processes included. */
|
|
419
|
+
experimentalSnapshot(): Promise<SandboxSnapshot>;
|
|
420
|
+
/** The sandbox's files as an Image new sandboxes start from. `ttlMs` is
|
|
421
|
+
* kept in whole days. */
|
|
422
|
+
snapshotFilesystem(params?: {
|
|
423
|
+
timeoutMs?: number;
|
|
424
|
+
ttlMs?: number | null;
|
|
425
|
+
}): Promise<Image>;
|
|
426
|
+
readonly createConnectToken: RefusedAsync;
|
|
427
|
+
readonly experimentalGetExitSnapshot: RefusedAsync;
|
|
428
|
+
readonly snapshotDirectory: RefusedAsync;
|
|
429
|
+
readonly mountImage: RefusedAsync;
|
|
430
|
+
readonly unmountImage: RefusedAsync;
|
|
431
|
+
readonly experimentalUpdateOutboundPolicy: RefusedAsync;
|
|
164
432
|
}
|
|
433
|
+
type FileWatchEventType = "Access" | "Create" | "Modify" | "Remove" | "Unknown";
|
|
165
434
|
export declare class SandboxFilesystem {
|
|
166
435
|
private readonly native;
|
|
167
436
|
private readonly files;
|
|
@@ -202,4 +471,13 @@ export declare class SandboxFilesystem {
|
|
|
202
471
|
modifiedTime: number;
|
|
203
472
|
symlinkTarget: string | null;
|
|
204
473
|
}>;
|
|
474
|
+
/** Changes under `remotePath` until `timeoutMs` passes or the loop stops. */
|
|
475
|
+
watch(remotePath: string, params?: {
|
|
476
|
+
filter?: FileWatchEventType[];
|
|
477
|
+
recursive?: boolean;
|
|
478
|
+
timeoutMs?: number;
|
|
479
|
+
}): AsyncIterable<{
|
|
480
|
+
eventType: FileWatchEventType;
|
|
481
|
+
paths: string[];
|
|
482
|
+
}>;
|
|
205
483
|
}
|