withruntime 0.11.2 → 0.12.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.
Files changed (164) hide show
  1. package/BLAXEL.md +2 -2
  2. package/COMPATIBILITY.md +74 -9
  3. package/DAYTONA.md +33 -5
  4. package/E2B.md +85 -24
  5. package/README.md +9 -8
  6. package/README.src.md +8 -7
  7. package/VERCEL.md +43 -5
  8. package/compatibility-lock.json +58 -49
  9. package/dist/billing-cli.d.ts +1 -1
  10. package/dist/billing-cli.js +77 -1
  11. package/dist/blaxel/errors.d.ts +14 -0
  12. package/dist/blaxel/errors.js +29 -0
  13. package/dist/blaxel/index.d.ts +2 -2
  14. package/dist/blaxel/index.js +4 -4
  15. package/dist/blaxel/interpreter.d.ts +2 -5
  16. package/dist/blaxel/sandbox.d.ts +14 -5
  17. package/dist/blaxel/sandbox.js +63 -7
  18. package/dist/blaxel/snapshot.d.ts +4 -0
  19. package/dist/blaxel/snapshot.js +4 -0
  20. package/dist/cli/logs.d.ts +21 -0
  21. package/dist/cli/logs.js +188 -0
  22. package/dist/cli/logs.test.d.ts +1 -0
  23. package/dist/cli/logs.test.js +272 -0
  24. package/dist/cli-extras.d.ts +3 -3
  25. package/dist/cli-extras.js +17 -12
  26. package/dist/cli-words.d.ts +10 -1
  27. package/dist/cli-words.js +18 -0
  28. package/dist/cli.d.ts +5 -1
  29. package/dist/cli.js +405 -204
  30. package/dist/client.d.ts +2 -4
  31. package/dist/client.js +27 -11
  32. package/dist/cloudflare/errors.d.ts +143 -0
  33. package/dist/cloudflare/errors.js +167 -0
  34. package/dist/cloudflare/index.d.ts +175 -6
  35. package/dist/cloudflare/index.js +416 -26
  36. package/dist/cloudflare/interpreter.d.ts +119 -0
  37. package/dist/cloudflare/interpreter.js +223 -0
  38. package/dist/cloudflare/streams.d.ts +38 -0
  39. package/dist/cloudflare/streams.js +145 -0
  40. package/dist/cloudflare/watch.d.ts +9 -0
  41. package/dist/cloudflare/watch.js +24 -0
  42. package/dist/codesandbox/index.d.ts +216 -28
  43. package/dist/codesandbox/index.js +478 -78
  44. package/dist/compat/core.d.ts +18 -0
  45. package/dist/compat/core.js +29 -0
  46. package/dist/compat/files.d.ts +1 -0
  47. package/dist/compat/files.js +25 -5
  48. package/dist/daytona/computer-use.d.ts +13 -4
  49. package/dist/daytona/computer-use.js +66 -8
  50. package/dist/daytona/daytona.d.ts +6 -0
  51. package/dist/daytona/daytona.js +30 -3
  52. package/dist/daytona/errors.d.ts +11 -0
  53. package/dist/daytona/errors.js +18 -0
  54. package/dist/daytona/filesystem.js +2 -1
  55. package/dist/daytona/image.d.ts +13 -9
  56. package/dist/daytona/image.js +18 -12
  57. package/dist/daytona/index.d.ts +1 -1
  58. package/dist/daytona/sandbox.d.ts +8 -2
  59. package/dist/daytona/sandbox.js +16 -2
  60. package/dist/domains/index.d.ts +9 -0
  61. package/dist/domains/index.js +10 -0
  62. package/dist/e2b/commands.d.ts +1 -1
  63. package/dist/e2b/commands.js +6 -7
  64. package/dist/e2b/errors.d.ts +17 -0
  65. package/dist/e2b/errors.js +40 -1
  66. package/dist/e2b/index.d.ts +2 -2
  67. package/dist/e2b/index.js +1 -1
  68. package/dist/e2b/sandbox.d.ts +27 -21
  69. package/dist/e2b/sandbox.js +34 -8
  70. package/dist/e2b/unsupported.js +1 -1
  71. package/dist/errors.d.ts +10 -1
  72. package/dist/errors.js +16 -4
  73. package/dist/freestyle/index.d.ts +285 -37
  74. package/dist/freestyle/index.js +656 -144
  75. package/dist/identity.d.ts +3 -0
  76. package/dist/identity.js +27 -0
  77. package/dist/images/index.d.ts +9 -0
  78. package/dist/images/index.js +10 -0
  79. package/dist/index.d.ts +1 -0
  80. package/dist/ips/index.d.ts +9 -0
  81. package/dist/ips/index.js +10 -0
  82. package/dist/jobs/index.d.ts +9 -0
  83. package/dist/jobs/index.js +10 -0
  84. package/dist/keys.js +2 -0
  85. package/dist/login.js +2 -0
  86. package/dist/machine.d.ts +12 -3
  87. package/dist/machine.js +20 -3
  88. package/dist/mcp.js +1 -1
  89. package/dist/modal/index.d.ts +339 -61
  90. package/dist/modal/index.js +781 -121
  91. package/dist/network-cli.d.ts +3 -1
  92. package/dist/network-cli.js +78 -36
  93. package/dist/networks/index.d.ts +11 -0
  94. package/dist/networks/index.js +10 -0
  95. package/dist/ports/index.d.ts +9 -0
  96. package/dist/ports/index.js +10 -0
  97. package/dist/product-names.d.ts +52 -0
  98. package/dist/product-names.js +164 -0
  99. package/dist/product-renames.d.ts +103 -0
  100. package/dist/product-renames.js +189 -0
  101. package/dist/products/apps.d.ts +176 -0
  102. package/dist/products/apps.js +165 -0
  103. package/dist/products/billing.d.ts +41 -0
  104. package/dist/products/billing.js +13 -0
  105. package/dist/products/browser.d.ts +10 -0
  106. package/dist/products/browsers.d.ts +71 -0
  107. package/dist/products/browsers.js +102 -0
  108. package/dist/products/builds.d.ts +126 -0
  109. package/dist/products/builds.js +221 -0
  110. package/dist/products/index.d.ts +3 -16
  111. package/dist/products/index.js +3 -14
  112. package/dist/products/jobs.d.ts +17 -0
  113. package/dist/products/jobs.js +27 -10
  114. package/dist/products/logs.d.ts +245 -0
  115. package/dist/products/logs.js +274 -0
  116. package/dist/products/logs.test.d.ts +1 -0
  117. package/dist/products/logs.test.js +343 -0
  118. package/dist/products/network-products.d.ts +38 -7
  119. package/dist/products/network-products.js +31 -18
  120. package/dist/products/observability.d.ts +3 -2
  121. package/dist/products/private-network.js +1 -1
  122. package/dist/products/queues.d.ts +149 -0
  123. package/dist/products/queues.js +213 -0
  124. package/dist/products/referrals.d.ts +21 -7
  125. package/dist/products/referrals.js +3 -3
  126. package/dist/products/secrets.d.ts +7 -3
  127. package/dist/products/secrets.js +39 -18
  128. package/dist/products/signed-requests.d.ts +21 -0
  129. package/dist/products/signed-requests.js +11 -0
  130. package/dist/products/streams.d.ts +73 -0
  131. package/dist/products/streams.js +17 -0
  132. package/dist/products/switching.d.ts +35 -7
  133. package/dist/products/switching.js +4 -3
  134. package/dist/products/volumes.d.ts +3 -0
  135. package/dist/record-cli.d.ts +23 -0
  136. package/dist/record-cli.js +308 -0
  137. package/dist/renamed-products.d.ts +38 -0
  138. package/dist/renamed-products.js +34 -0
  139. package/dist/runloop/index.d.ts +9 -2
  140. package/dist/runloop/index.js +29 -8
  141. package/dist/runloop/sdk.d.ts +131 -0
  142. package/dist/runloop/sdk.js +167 -0
  143. package/dist/sandbox.d.ts +3 -2
  144. package/dist/sandbox.js +14 -9
  145. package/dist/sandboxes/index.d.ts +11 -0
  146. package/dist/sandboxes/index.js +12 -0
  147. package/dist/snapshots/index.d.ts +9 -0
  148. package/dist/snapshots/index.js +11 -0
  149. package/dist/snapshots.d.ts +7 -4
  150. package/dist/sprites/index.d.ts +343 -31
  151. package/dist/sprites/index.js +866 -84
  152. package/dist/ssh.d.ts +1 -1
  153. package/dist/ssh.js +11 -11
  154. package/dist/terminal.d.ts +24 -0
  155. package/dist/terminal.js +32 -0
  156. package/dist/transport.d.ts +15 -1
  157. package/dist/transport.js +56 -3
  158. package/dist/tunnel.js +1 -1
  159. package/dist/types.d.ts +63 -0
  160. package/dist/vercel/sandbox.js +5 -3
  161. package/dist/vercel/snapshot.js +10 -2
  162. package/dist/volumes/index.d.ts +9 -0
  163. package/dist/volumes/index.js +10 -0
  164. package/package.json +48 -2
@@ -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 TimeoutError extends Error {
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
- constructor(runtime: Runtime);
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): Promise<Sandbox>;
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
- tunnels(): Promise<{
151
- [k: string]: {
152
- host: string;
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: string[];
159
- outboundDomainAllowlist: string[];
409
+ outboundCidrAllowlist?: string[];
410
+ outboundDomainAllowlist?: string[];
160
411
  }): Promise<void>;
161
- experimentalSnapshot(): Promise<{
162
- sandboxSnapshotId: string;
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
  }