withruntime 0.17.2 → 0.21.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/COMPATIBILITY.md +32 -1
- package/README.md +19 -0
- package/README.src.md +19 -0
- package/dist/agents/index.d.ts +11 -0
- package/dist/agents/index.js +12 -0
- package/dist/agents-cli.d.ts +10 -0
- package/dist/agents-cli.js +362 -0
- package/dist/apps-cli.d.ts +14 -0
- package/dist/apps-cli.js +737 -0
- package/dist/builds/index.d.ts +10 -0
- package/dist/builds/index.js +11 -0
- package/dist/cli-words.js +11 -0
- package/dist/cli.d.ts +4 -0
- package/dist/cli.js +104 -6
- package/dist/client.d.ts +19 -0
- package/dist/client.js +20 -0
- package/dist/cloudflare/errors.d.ts +23 -0
- package/dist/cloudflare/errors.js +16 -0
- package/dist/cloudflare/index.d.ts +82 -9
- package/dist/cloudflare/index.js +162 -38
- package/dist/cloudflare/interpreter.js +14 -5
- package/dist/cloudflare/mime.d.ts +1 -0
- package/dist/cloudflare/mime.js +66 -0
- package/dist/cloudflare/streams.d.ts +8 -0
- package/dist/cloudflare/streams.js +30 -0
- package/dist/cloudflare/types.d.ts +338 -0
- package/dist/cloudflare/types.js +80 -0
- package/dist/cloudflare/worker.d.ts +297 -10
- package/dist/cloudflare/worker.js +203 -17
- package/dist/containers/index.d.ts +10 -0
- package/dist/containers/index.js +11 -0
- package/dist/daytona/sandbox.d.ts +2 -1
- package/dist/daytona/sandbox.js +2 -1
- package/dist/identity.js +18 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +1 -0
- package/dist/product-names.js +3 -0
- package/dist/products/agents.d.ts +272 -0
- package/dist/products/agents.js +251 -0
- package/dist/products/builds.d.ts +11 -1
- package/dist/products/builds.js +7 -0
- package/dist/products/containers.d.ts +71 -0
- package/dist/products/containers.js +6 -0
- package/dist/products/index.d.ts +6 -0
- package/dist/products/index.js +7 -0
- package/dist/sandbox.d.ts +4 -0
- package/dist/transport.d.ts +2 -2
- package/dist/transport.js +1 -1
- package/dist/tunnel.js +1 -1
- package/dist/types.d.ts +11 -0
- package/dist/vercel/errors.d.ts +1 -1
- package/package.json +16 -1
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
/** Workers conditional entry
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
|
|
1
|
+
/** Workers conditional entry: what a Worker imports as `withruntime/cloudflare`.
|
|
2
|
+
* `Sandbox` is the Durable Object class the Worker exports and binds, as with
|
|
3
|
+
* @cloudflare/sandbox; it keeps the sandbox's name and preview tokens, and
|
|
4
|
+
* Runtime runs the sandbox. The Wrangler config drops its `containers` block. */
|
|
5
|
+
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
5
6
|
import type { DurableObjectState, DurableObjectNamespace, Request as WorkerRequest, Response as WorkerResponse } from "@cloudflare/workers-types/index.ts";
|
|
6
|
-
import {
|
|
7
|
+
import { type RefusedAsync } from "../compat/core.js";
|
|
8
|
+
import { Sandbox as RuntimeSandbox, type CheckChangesOptions, type GitCheckoutOptions, type MountBucketOptions, type SandboxOptions, type SessionOptions, type ExecOptions, type ProcessOptions, type ReadFileResult, type ReadFileStreamResult, type StreamOptions, type WaitForPortOptions, type WatchOptions } from "./index.js";
|
|
9
|
+
import type { CreateContextOptions, RunCodeOptions } from "./interpreter.js";
|
|
7
10
|
export * from "./index.js";
|
|
11
|
+
/** The bindings a Worker passes to proxyToSandbox, as Cloudflare names them. */
|
|
12
|
+
export interface SandboxEnv<T extends Sandbox = Sandbox> {
|
|
13
|
+
Sandbox: DurableObjectNamespace<T>;
|
|
14
|
+
}
|
|
15
|
+
/** Cloudflare's egress entrypoint for outbound interception, which Runtime
|
|
16
|
+
* does with network rules and secrets instead. */
|
|
17
|
+
export declare class ContainerProxy extends WorkerEntrypoint {
|
|
18
|
+
fetch(): Promise<WorkerResponse>;
|
|
19
|
+
}
|
|
8
20
|
export interface RuntimeWorkerEnv {
|
|
9
21
|
RUNTIME_API_KEY: string;
|
|
10
22
|
RUNTIME_API_URL?: string;
|
|
@@ -19,6 +31,14 @@ type Configuration = {
|
|
|
19
31
|
keepAlive?: boolean;
|
|
20
32
|
};
|
|
21
33
|
export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> extends DurableObject<Env> {
|
|
34
|
+
readonly callTunnels: RefusedAsync;
|
|
35
|
+
readonly setContainerTimeouts: RefusedAsync;
|
|
36
|
+
readonly setTransport: RefusedAsync;
|
|
37
|
+
readonly containerFetch: RefusedAsync;
|
|
38
|
+
readonly getContainerPlacementId: RefusedAsync;
|
|
39
|
+
readonly createBackup: RefusedAsync;
|
|
40
|
+
readonly restoreBackup: RefusedAsync;
|
|
41
|
+
readonly terminal: RefusedAsync;
|
|
22
42
|
private configuration;
|
|
23
43
|
private configurationIntent?;
|
|
24
44
|
private facade?;
|
|
@@ -37,6 +57,7 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
37
57
|
execStream(command: string, options?: ExecOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
38
58
|
startProcess(command: string, options?: ProcessOptions): Promise<{
|
|
39
59
|
id: string;
|
|
60
|
+
pid: undefined;
|
|
40
61
|
command: string;
|
|
41
62
|
status: string;
|
|
42
63
|
startTime: Date;
|
|
@@ -54,12 +75,17 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
54
75
|
exitCode: number;
|
|
55
76
|
}>;
|
|
56
77
|
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
57
|
-
match?: true | RegExpMatchArray | undefined;
|
|
58
78
|
line: string;
|
|
79
|
+
match?: undefined;
|
|
80
|
+
} | {
|
|
81
|
+
line: string;
|
|
82
|
+
match: RegExpMatchArray;
|
|
59
83
|
}>;
|
|
84
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
60
85
|
}>;
|
|
61
86
|
listProcesses(): Promise<{
|
|
62
87
|
id: string;
|
|
88
|
+
pid: undefined;
|
|
63
89
|
command: string;
|
|
64
90
|
status: string;
|
|
65
91
|
startTime: Date;
|
|
@@ -77,12 +103,17 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
77
103
|
exitCode: number;
|
|
78
104
|
}>;
|
|
79
105
|
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
80
|
-
match?: true | RegExpMatchArray | undefined;
|
|
81
106
|
line: string;
|
|
107
|
+
match?: undefined;
|
|
108
|
+
} | {
|
|
109
|
+
line: string;
|
|
110
|
+
match: RegExpMatchArray;
|
|
82
111
|
}>;
|
|
112
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
83
113
|
}[]>;
|
|
84
114
|
getProcess(id: string): Promise<{
|
|
85
115
|
id: string;
|
|
116
|
+
pid: undefined;
|
|
86
117
|
command: string;
|
|
87
118
|
status: string;
|
|
88
119
|
startTime: Date;
|
|
@@ -100,9 +131,13 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
100
131
|
exitCode: number;
|
|
101
132
|
}>;
|
|
102
133
|
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
103
|
-
match?: true | RegExpMatchArray | undefined;
|
|
104
134
|
line: string;
|
|
135
|
+
match?: undefined;
|
|
136
|
+
} | {
|
|
137
|
+
line: string;
|
|
138
|
+
match: RegExpMatchArray;
|
|
105
139
|
}>;
|
|
140
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
106
141
|
} | null>;
|
|
107
142
|
getProcessLogs(id: string): Promise<{
|
|
108
143
|
stdout: string;
|
|
@@ -117,6 +152,35 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
117
152
|
execStream: (command: string, options?: ExecOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
118
153
|
startProcess: (command: string, options?: ProcessOptions) => Promise<{
|
|
119
154
|
id: string;
|
|
155
|
+
pid: undefined;
|
|
156
|
+
command: string;
|
|
157
|
+
status: string;
|
|
158
|
+
startTime: Date;
|
|
159
|
+
endTime: Date | undefined;
|
|
160
|
+
exitCode: number | undefined;
|
|
161
|
+
sessionId: string | undefined;
|
|
162
|
+
kill: (signal?: string) => Promise<void>;
|
|
163
|
+
getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
|
|
164
|
+
getLogs: () => Promise<{
|
|
165
|
+
stdout: string;
|
|
166
|
+
stderr: string;
|
|
167
|
+
processId: string;
|
|
168
|
+
}>;
|
|
169
|
+
waitForExit: (timeout?: number) => Promise<{
|
|
170
|
+
exitCode: number;
|
|
171
|
+
}>;
|
|
172
|
+
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
173
|
+
line: string;
|
|
174
|
+
match?: undefined;
|
|
175
|
+
} | {
|
|
176
|
+
line: string;
|
|
177
|
+
match: RegExpMatchArray;
|
|
178
|
+
}>;
|
|
179
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
180
|
+
}>;
|
|
181
|
+
listProcesses: () => Promise<{
|
|
182
|
+
id: string;
|
|
183
|
+
pid: undefined;
|
|
120
184
|
command: string;
|
|
121
185
|
status: string;
|
|
122
186
|
startTime: Date;
|
|
@@ -134,10 +198,51 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
134
198
|
exitCode: number;
|
|
135
199
|
}>;
|
|
136
200
|
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
137
|
-
match?: true | RegExpMatchArray | undefined;
|
|
138
201
|
line: string;
|
|
202
|
+
match?: undefined;
|
|
203
|
+
} | {
|
|
204
|
+
line: string;
|
|
205
|
+
match: RegExpMatchArray;
|
|
139
206
|
}>;
|
|
207
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
208
|
+
}[]>;
|
|
209
|
+
getProcess: (id: string) => Promise<{
|
|
210
|
+
id: string;
|
|
211
|
+
pid: undefined;
|
|
212
|
+
command: string;
|
|
213
|
+
status: string;
|
|
214
|
+
startTime: Date;
|
|
215
|
+
endTime: Date | undefined;
|
|
216
|
+
exitCode: number | undefined;
|
|
217
|
+
sessionId: string | undefined;
|
|
218
|
+
kill: (signal?: string) => Promise<void>;
|
|
219
|
+
getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
|
|
220
|
+
getLogs: () => Promise<{
|
|
221
|
+
stdout: string;
|
|
222
|
+
stderr: string;
|
|
223
|
+
processId: string;
|
|
224
|
+
}>;
|
|
225
|
+
waitForExit: (timeout?: number) => Promise<{
|
|
226
|
+
exitCode: number;
|
|
227
|
+
}>;
|
|
228
|
+
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
229
|
+
line: string;
|
|
230
|
+
match?: undefined;
|
|
231
|
+
} | {
|
|
232
|
+
line: string;
|
|
233
|
+
match: RegExpMatchArray;
|
|
234
|
+
}>;
|
|
235
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
236
|
+
} | null>;
|
|
237
|
+
killProcess: (id: string, signal?: string) => Promise<void>;
|
|
238
|
+
killAllProcesses: () => Promise<number>;
|
|
239
|
+
cleanupCompletedProcesses: () => Promise<number>;
|
|
240
|
+
getProcessLogs: (id: string) => Promise<{
|
|
241
|
+
stdout: string;
|
|
242
|
+
stderr: string;
|
|
243
|
+
processId: string;
|
|
140
244
|
}>;
|
|
245
|
+
streamProcessLogs: (id: string) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
141
246
|
writeFile: (path: string, content: string | ReadableStream<Uint8Array<ArrayBufferLike>>, options?: {
|
|
142
247
|
encoding?: string;
|
|
143
248
|
} | undefined) => Promise<{
|
|
@@ -154,6 +259,7 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
154
259
|
encoding?: "utf8" | "utf-8" | "base64";
|
|
155
260
|
}): Promise<ReadFileResult>;
|
|
156
261
|
};
|
|
262
|
+
readFileStream: (path: string) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
157
263
|
mkdir: (path: string, options?: {
|
|
158
264
|
recursive?: boolean;
|
|
159
265
|
} | undefined) => Promise<{
|
|
@@ -213,7 +319,39 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
213
319
|
count: number;
|
|
214
320
|
timestamp: string;
|
|
215
321
|
}>;
|
|
322
|
+
gitCheckout: (repoUrl: string, options?: Omit<GitCheckoutOptions, "sessionId">) => Promise<import("./index.js").GitCheckoutResult>;
|
|
323
|
+
watch: (path: string, options?: Omit<WatchOptions, "sessionId">) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
324
|
+
checkChanges: (path: string, options?: Omit<CheckChangesOptions, "sessionId">) => Promise<import("./index.js").CheckChangesResult>;
|
|
216
325
|
setEnvVars: (env: Record<string, string | undefined>) => Promise<void>;
|
|
326
|
+
createCodeContext: (options?: CreateContextOptions) => Promise<import("./interpreter.js").CodeContext>;
|
|
327
|
+
runCode: (code: string, options?: RunCodeOptions) => Promise<{
|
|
328
|
+
code: string;
|
|
329
|
+
logs: {
|
|
330
|
+
stdout: string[];
|
|
331
|
+
stderr: string[];
|
|
332
|
+
};
|
|
333
|
+
error: import("./interpreter.js").ExecutionError | undefined;
|
|
334
|
+
executionCount: number | undefined;
|
|
335
|
+
results: {
|
|
336
|
+
text: string | undefined;
|
|
337
|
+
html: string | undefined;
|
|
338
|
+
png: string | undefined;
|
|
339
|
+
jpeg: string | undefined;
|
|
340
|
+
svg: string | undefined;
|
|
341
|
+
latex: string | undefined;
|
|
342
|
+
markdown: string | undefined;
|
|
343
|
+
javascript: string | undefined;
|
|
344
|
+
json: unknown;
|
|
345
|
+
chart: undefined;
|
|
346
|
+
data: Record<string, unknown> | undefined;
|
|
347
|
+
}[];
|
|
348
|
+
}>;
|
|
349
|
+
runCodeStream: (code: string, options?: RunCodeOptions) => Promise<ReadableStream<any>>;
|
|
350
|
+
listCodeContexts: () => Promise<import("./interpreter.js").CodeContext[]>;
|
|
351
|
+
deleteCodeContext: (id: string) => Promise<void>;
|
|
352
|
+
mountBucket: (bucket: string, path: string, options: MountBucketOptions) => Promise<void>;
|
|
353
|
+
unmountBucket: (path: string) => Promise<void>;
|
|
354
|
+
terminal: () => Promise<never>;
|
|
217
355
|
}>;
|
|
218
356
|
getSession(id: string): Promise<{
|
|
219
357
|
id: string;
|
|
@@ -221,6 +359,63 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
221
359
|
execStream: (command: string, options?: ExecOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
222
360
|
startProcess: (command: string, options?: ProcessOptions) => Promise<{
|
|
223
361
|
id: string;
|
|
362
|
+
pid: undefined;
|
|
363
|
+
command: string;
|
|
364
|
+
status: string;
|
|
365
|
+
startTime: Date;
|
|
366
|
+
endTime: Date | undefined;
|
|
367
|
+
exitCode: number | undefined;
|
|
368
|
+
sessionId: string | undefined;
|
|
369
|
+
kill: (signal?: string) => Promise<void>;
|
|
370
|
+
getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
|
|
371
|
+
getLogs: () => Promise<{
|
|
372
|
+
stdout: string;
|
|
373
|
+
stderr: string;
|
|
374
|
+
processId: string;
|
|
375
|
+
}>;
|
|
376
|
+
waitForExit: (timeout?: number) => Promise<{
|
|
377
|
+
exitCode: number;
|
|
378
|
+
}>;
|
|
379
|
+
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
380
|
+
line: string;
|
|
381
|
+
match?: undefined;
|
|
382
|
+
} | {
|
|
383
|
+
line: string;
|
|
384
|
+
match: RegExpMatchArray;
|
|
385
|
+
}>;
|
|
386
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
387
|
+
}>;
|
|
388
|
+
listProcesses: () => Promise<{
|
|
389
|
+
id: string;
|
|
390
|
+
pid: undefined;
|
|
391
|
+
command: string;
|
|
392
|
+
status: string;
|
|
393
|
+
startTime: Date;
|
|
394
|
+
endTime: Date | undefined;
|
|
395
|
+
exitCode: number | undefined;
|
|
396
|
+
sessionId: string | undefined;
|
|
397
|
+
kill: (signal?: string) => Promise<void>;
|
|
398
|
+
getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
|
|
399
|
+
getLogs: () => Promise<{
|
|
400
|
+
stdout: string;
|
|
401
|
+
stderr: string;
|
|
402
|
+
processId: string;
|
|
403
|
+
}>;
|
|
404
|
+
waitForExit: (timeout?: number) => Promise<{
|
|
405
|
+
exitCode: number;
|
|
406
|
+
}>;
|
|
407
|
+
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
408
|
+
line: string;
|
|
409
|
+
match?: undefined;
|
|
410
|
+
} | {
|
|
411
|
+
line: string;
|
|
412
|
+
match: RegExpMatchArray;
|
|
413
|
+
}>;
|
|
414
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
415
|
+
}[]>;
|
|
416
|
+
getProcess: (id: string) => Promise<{
|
|
417
|
+
id: string;
|
|
418
|
+
pid: undefined;
|
|
224
419
|
command: string;
|
|
225
420
|
status: string;
|
|
226
421
|
startTime: Date;
|
|
@@ -238,10 +433,23 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
238
433
|
exitCode: number;
|
|
239
434
|
}>;
|
|
240
435
|
waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
|
|
241
|
-
match?: true | RegExpMatchArray | undefined;
|
|
242
436
|
line: string;
|
|
437
|
+
match?: undefined;
|
|
438
|
+
} | {
|
|
439
|
+
line: string;
|
|
440
|
+
match: RegExpMatchArray;
|
|
243
441
|
}>;
|
|
442
|
+
waitForPort: (port: number, options?: WaitForPortOptions) => Promise<void>;
|
|
443
|
+
} | null>;
|
|
444
|
+
killProcess: (id: string, signal?: string) => Promise<void>;
|
|
445
|
+
killAllProcesses: () => Promise<number>;
|
|
446
|
+
cleanupCompletedProcesses: () => Promise<number>;
|
|
447
|
+
getProcessLogs: (id: string) => Promise<{
|
|
448
|
+
stdout: string;
|
|
449
|
+
stderr: string;
|
|
450
|
+
processId: string;
|
|
244
451
|
}>;
|
|
452
|
+
streamProcessLogs: (id: string) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
245
453
|
writeFile: (path: string, content: string | ReadableStream<Uint8Array<ArrayBufferLike>>, options?: {
|
|
246
454
|
encoding?: string;
|
|
247
455
|
} | undefined) => Promise<{
|
|
@@ -258,6 +466,7 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
258
466
|
encoding?: "utf8" | "utf-8" | "base64";
|
|
259
467
|
}): Promise<ReadFileResult>;
|
|
260
468
|
};
|
|
469
|
+
readFileStream: (path: string) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
261
470
|
mkdir: (path: string, options?: {
|
|
262
471
|
recursive?: boolean;
|
|
263
472
|
} | undefined) => Promise<{
|
|
@@ -317,7 +526,39 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
317
526
|
count: number;
|
|
318
527
|
timestamp: string;
|
|
319
528
|
}>;
|
|
529
|
+
gitCheckout: (repoUrl: string, options?: Omit<GitCheckoutOptions, "sessionId">) => Promise<import("./index.js").GitCheckoutResult>;
|
|
530
|
+
watch: (path: string, options?: Omit<WatchOptions, "sessionId">) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
531
|
+
checkChanges: (path: string, options?: Omit<CheckChangesOptions, "sessionId">) => Promise<import("./index.js").CheckChangesResult>;
|
|
320
532
|
setEnvVars: (env: Record<string, string | undefined>) => Promise<void>;
|
|
533
|
+
createCodeContext: (options?: CreateContextOptions) => Promise<import("./interpreter.js").CodeContext>;
|
|
534
|
+
runCode: (code: string, options?: RunCodeOptions) => Promise<{
|
|
535
|
+
code: string;
|
|
536
|
+
logs: {
|
|
537
|
+
stdout: string[];
|
|
538
|
+
stderr: string[];
|
|
539
|
+
};
|
|
540
|
+
error: import("./interpreter.js").ExecutionError | undefined;
|
|
541
|
+
executionCount: number | undefined;
|
|
542
|
+
results: {
|
|
543
|
+
text: string | undefined;
|
|
544
|
+
html: string | undefined;
|
|
545
|
+
png: string | undefined;
|
|
546
|
+
jpeg: string | undefined;
|
|
547
|
+
svg: string | undefined;
|
|
548
|
+
latex: string | undefined;
|
|
549
|
+
markdown: string | undefined;
|
|
550
|
+
javascript: string | undefined;
|
|
551
|
+
json: unknown;
|
|
552
|
+
chart: undefined;
|
|
553
|
+
data: Record<string, unknown> | undefined;
|
|
554
|
+
}[];
|
|
555
|
+
}>;
|
|
556
|
+
runCodeStream: (code: string, options?: RunCodeOptions) => Promise<ReadableStream<any>>;
|
|
557
|
+
listCodeContexts: () => Promise<import("./interpreter.js").CodeContext[]>;
|
|
558
|
+
deleteCodeContext: (id: string) => Promise<void>;
|
|
559
|
+
mountBucket: (bucket: string, path: string, options: MountBucketOptions) => Promise<void>;
|
|
560
|
+
unmountBucket: (path: string) => Promise<void>;
|
|
561
|
+
terminal: () => Promise<never>;
|
|
321
562
|
}>;
|
|
322
563
|
deleteSession(id: string): Promise<{
|
|
323
564
|
success: boolean;
|
|
@@ -391,6 +632,52 @@ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> ex
|
|
|
391
632
|
timestamp: string;
|
|
392
633
|
}>;
|
|
393
634
|
setEnvVars(...args: Parameters<RuntimeSandbox["setEnvVars"]>): Promise<void>;
|
|
635
|
+
setLabels(labels: Record<string, string>): Promise<void>;
|
|
636
|
+
execWithSessionToken(command: string, sessionId: string, options?: ExecOptions): Promise<import("./index.js").ExecResult>;
|
|
637
|
+
execStreamWithSessionToken(command: string, sessionId: string, options?: StreamOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
638
|
+
streamProcessLogs(processId: string, options?: {
|
|
639
|
+
signal?: AbortSignal;
|
|
640
|
+
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
641
|
+
cleanupCompletedProcesses(sessionId?: string): Promise<number>;
|
|
642
|
+
readFileStream(path: string, options?: {
|
|
643
|
+
sessionId?: string;
|
|
644
|
+
}): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
645
|
+
gitCheckout(repoUrl: string, options?: GitCheckoutOptions): Promise<import("./index.js").GitCheckoutResult>;
|
|
646
|
+
watch(path: string, options?: WatchOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
|
|
647
|
+
checkChanges(path: string, options?: CheckChangesOptions): Promise<import("./index.js").CheckChangesResult>;
|
|
648
|
+
mountBucket(bucket: string, mountPath: string, options: MountBucketOptions): Promise<void>;
|
|
649
|
+
unmountBucket(mountPath: string): Promise<void>;
|
|
650
|
+
createCodeContext(options?: CreateContextOptions): Promise<import("./interpreter.js").CodeContext>;
|
|
651
|
+
runCode(code: string, options?: RunCodeOptions): Promise<{
|
|
652
|
+
code: string;
|
|
653
|
+
logs: {
|
|
654
|
+
stdout: string[];
|
|
655
|
+
stderr: string[];
|
|
656
|
+
};
|
|
657
|
+
error: import("./interpreter.js").ExecutionError | undefined;
|
|
658
|
+
executionCount: number | undefined;
|
|
659
|
+
results: {
|
|
660
|
+
text: string | undefined;
|
|
661
|
+
html: string | undefined;
|
|
662
|
+
png: string | undefined;
|
|
663
|
+
jpeg: string | undefined;
|
|
664
|
+
svg: string | undefined;
|
|
665
|
+
latex: string | undefined;
|
|
666
|
+
markdown: string | undefined;
|
|
667
|
+
javascript: string | undefined;
|
|
668
|
+
json: unknown;
|
|
669
|
+
chart: undefined;
|
|
670
|
+
data: Record<string, unknown> | undefined;
|
|
671
|
+
}[];
|
|
672
|
+
}>;
|
|
673
|
+
runCodeStream(code: string, options?: RunCodeOptions): Promise<ReadableStream<any>>;
|
|
674
|
+
listCodeContexts(): Promise<import("./interpreter.js").CodeContext[]>;
|
|
675
|
+
deleteCodeContext(contextId: string): Promise<void>;
|
|
676
|
+
/** Stops the sandbox; its files stay, and the next call starts it again. */
|
|
677
|
+
stop(signal?: unknown): Promise<void>;
|
|
678
|
+
/** A subclass's Cloudflare-only hooks and outbound settings would do
|
|
679
|
+
* nothing here, so the first call refuses them by name. */
|
|
680
|
+
private refuseSubclassSettings;
|
|
394
681
|
exposePort(port: number, options: {
|
|
395
682
|
name?: string;
|
|
396
683
|
hostname: string;
|