withruntime 0.8.4 → 0.10.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 (132) hide show
  1. package/BLAXEL.md +4 -4
  2. package/COMPATIBILITY.md +145 -0
  3. package/DAYTONA.md +13 -7
  4. package/E2B.md +34 -20
  5. package/README.md +22 -11
  6. package/README.src.md +22 -11
  7. package/VERCEL.md +13 -3
  8. package/compatibility-lock.json +357 -0
  9. package/dist/ai-harness/index.js +2 -2
  10. package/dist/api-defaults.d.ts +17 -0
  11. package/dist/api-defaults.js +22 -0
  12. package/dist/blaxel/errors.js +1 -1
  13. package/dist/blaxel/lookup.d.ts +3 -2
  14. package/dist/blaxel/lookup.js +3 -2
  15. package/dist/blaxel/pagination.d.ts +2 -2
  16. package/dist/blaxel/pagination.js +45 -17
  17. package/dist/blaxel/preview.d.ts +3 -2
  18. package/dist/blaxel/preview.js +16 -14
  19. package/dist/blaxel/process.d.ts +1 -1
  20. package/dist/blaxel/process.js +66 -11
  21. package/dist/blaxel/sandbox.d.ts +2 -0
  22. package/dist/blaxel/sandbox.js +2 -0
  23. package/dist/blaxel/snapshot.js +3 -5
  24. package/dist/cli-words.d.ts +27 -0
  25. package/dist/cli-words.js +135 -0
  26. package/dist/cli.d.ts +2 -0
  27. package/dist/cli.js +351 -85
  28. package/dist/client.d.ts +33 -4
  29. package/dist/client.js +47 -12
  30. package/dist/cloudflare/identity.d.ts +7 -0
  31. package/dist/cloudflare/identity.js +13 -0
  32. package/dist/cloudflare/index.d.ts +303 -0
  33. package/dist/cloudflare/index.js +592 -0
  34. package/dist/cloudflare/worker.d.ts +419 -0
  35. package/dist/cloudflare/worker.js +447 -0
  36. package/dist/codesandbox/guest-service.d.ts +31 -0
  37. package/dist/codesandbox/guest-service.js +490 -0
  38. package/dist/codesandbox/index.d.ts +386 -0
  39. package/dist/codesandbox/index.js +1347 -0
  40. package/dist/compat/core.d.ts +40 -0
  41. package/dist/compat/core.js +238 -0
  42. package/dist/compat/files.d.ts +26 -0
  43. package/dist/compat/files.js +133 -0
  44. package/dist/compat/shell.d.ts +4 -0
  45. package/dist/compat/shell.js +165 -0
  46. package/dist/credentials.d.ts +6 -1
  47. package/dist/credentials.js +107 -38
  48. package/dist/daytona/context.js +2 -1
  49. package/dist/daytona/daytona.js +11 -4
  50. package/dist/daytona/filesystem.d.ts +17 -4
  51. package/dist/daytona/filesystem.js +121 -38
  52. package/dist/daytona/index.d.ts +1 -1
  53. package/dist/daytona/process.d.ts +1 -1
  54. package/dist/daytona/process.js +27 -4
  55. package/dist/daytona/sandbox.d.ts +1 -1
  56. package/dist/daytona/sandbox.js +16 -7
  57. package/dist/e2b/client.js +1 -1
  58. package/dist/e2b/code-interpreter.d.ts +4 -5
  59. package/dist/e2b/code-interpreter.js +54 -56
  60. package/dist/e2b/commands.d.ts +35 -12
  61. package/dist/e2b/commands.js +169 -73
  62. package/dist/e2b/errors.js +1 -1
  63. package/dist/e2b/filesystem.d.ts +8 -6
  64. package/dist/e2b/filesystem.js +127 -28
  65. package/dist/e2b/index.d.ts +1 -0
  66. package/dist/e2b/index.js +1 -0
  67. package/dist/e2b/pty.d.ts +24 -0
  68. package/dist/e2b/pty.js +80 -0
  69. package/dist/e2b/sandbox.d.ts +6 -4
  70. package/dist/e2b/sandbox.js +59 -25
  71. package/dist/errors.d.ts +8 -0
  72. package/dist/errors.js +15 -2
  73. package/dist/file-source.d.ts +16 -0
  74. package/dist/file-source.js +162 -0
  75. package/dist/freestyle/index.d.ts +309 -0
  76. package/dist/freestyle/index.js +343 -0
  77. package/dist/index.d.ts +3 -1
  78. package/dist/login.js +16 -10
  79. package/dist/mcp.js +2 -2
  80. package/dist/modal/index.d.ts +205 -0
  81. package/dist/modal/index.js +486 -0
  82. package/dist/network-cli.js +112 -44
  83. package/dist/openai-agents/index.js +18 -71
  84. package/dist/page.d.ts +1 -1
  85. package/dist/page.js +2 -2
  86. package/dist/products/audit.d.ts +3 -0
  87. package/dist/products/index.d.ts +14 -0
  88. package/dist/products/index.js +12 -0
  89. package/dist/products/interpreter.d.ts +11 -4
  90. package/dist/products/interpreter.js +33 -9
  91. package/dist/products/jobs.js +3 -2
  92. package/dist/products/limits.d.ts +10 -0
  93. package/dist/products/observability.d.ts +44 -0
  94. package/dist/products/observability.js +6 -0
  95. package/dist/products/previews.d.ts +18 -4
  96. package/dist/products/previews.js +14 -5
  97. package/dist/products/tailscale.d.ts +57 -0
  98. package/dist/products/tailscale.js +17 -0
  99. package/dist/products/volumes.d.ts +42 -0
  100. package/dist/products/volumes.js +36 -0
  101. package/dist/products/watch.d.ts +25 -4
  102. package/dist/products/watch.js +132 -18
  103. package/dist/proxy.js +3 -1
  104. package/dist/runloop/index.d.ts +326 -0
  105. package/dist/runloop/index.js +535 -0
  106. package/dist/runloop/pagination.d.ts +46 -0
  107. package/dist/runloop/pagination.js +82 -0
  108. package/dist/runloop/snapshots.d.ts +52 -0
  109. package/dist/runloop/snapshots.js +244 -0
  110. package/dist/sandbox.d.ts +76 -16
  111. package/dist/sandbox.js +696 -135
  112. package/dist/snapshots.d.ts +20 -5
  113. package/dist/snapshots.js +11 -1
  114. package/dist/sprites/index.d.ts +251 -0
  115. package/dist/sprites/index.js +588 -0
  116. package/dist/tar.d.ts +10 -1
  117. package/dist/tar.js +311 -35
  118. package/dist/tools/index.js +2 -1
  119. package/dist/transport.d.ts +23 -8
  120. package/dist/transport.js +247 -127
  121. package/dist/types.d.ts +52 -3
  122. package/dist/vercel/command.d.ts +1 -1
  123. package/dist/vercel/command.js +15 -3
  124. package/dist/vercel/errors.d.ts +2 -2
  125. package/dist/vercel/errors.js +19 -2
  126. package/dist/vercel/filesystem.d.ts +21 -18
  127. package/dist/vercel/filesystem.js +95 -48
  128. package/dist/vercel/sandbox.d.ts +8 -8
  129. package/dist/vercel/sandbox.js +159 -64
  130. package/dist/vercel/snapshot.d.ts +3 -2
  131. package/dist/vercel/snapshot.js +9 -5
  132. package/package.json +46 -3
@@ -0,0 +1,419 @@
1
+ /** Workers conditional entry. The Durable Object coordinates requests and stores
2
+ * configuration; Runtime owns compute. Existing Container/Wrangler declarations
3
+ * still need removal during infrastructure migration. */
4
+ import { DurableObject } from "cloudflare:workers";
5
+ import type { DurableObjectState, DurableObjectNamespace, Request as WorkerRequest, Response as WorkerResponse } from "@cloudflare/workers-types/index.ts";
6
+ import { Sandbox as RuntimeSandbox, type SandboxOptions, type SessionOptions, type ExecOptions, type ProcessOptions, type ReadFileResult, type ReadFileStreamResult } from "./index.js";
7
+ export * from "./index.js";
8
+ export interface RuntimeWorkerEnv {
9
+ RUNTIME_API_KEY: string;
10
+ RUNTIME_API_URL?: string;
11
+ }
12
+ type Configuration = {
13
+ sandboxName?: {
14
+ name: string;
15
+ normalizeId?: boolean;
16
+ };
17
+ nativeSandboxId?: string;
18
+ sleepAfter?: string | number;
19
+ keepAlive?: boolean;
20
+ };
21
+ export declare class Sandbox<Env extends RuntimeWorkerEnv = RuntimeWorkerEnv> extends DurableObject<Env> {
22
+ private configuration;
23
+ private configurationIntent?;
24
+ private facade?;
25
+ private configurationTail;
26
+ private configurationOperation;
27
+ private previewTail;
28
+ private previewOperation;
29
+ private readonly initialized;
30
+ constructor(ctx: DurableObjectState, env: Env);
31
+ private sandbox;
32
+ configure(configuration: Configuration): Promise<void>;
33
+ setSandboxName(name: string, normalizeId?: boolean): Promise<void>;
34
+ setSleepAfter(sleepAfter: string | number): Promise<void>;
35
+ setKeepAlive(keepAlive: boolean): Promise<void>;
36
+ exec(command: string, options?: ExecOptions): Promise<import("./index.js").ExecResult>;
37
+ execStream(command: string, options?: ExecOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
38
+ startProcess(command: string, options?: ProcessOptions): Promise<{
39
+ id: string;
40
+ command: string;
41
+ status: string;
42
+ startTime: Date;
43
+ endTime: Date | undefined;
44
+ exitCode: number | undefined;
45
+ sessionId: string | undefined;
46
+ kill: (signal?: string) => Promise<void>;
47
+ getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
48
+ getLogs: () => Promise<{
49
+ stdout: string;
50
+ stderr: string;
51
+ processId: string;
52
+ }>;
53
+ waitForExit: (timeout?: number) => Promise<{
54
+ exitCode: number;
55
+ }>;
56
+ waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
57
+ match?: true | RegExpMatchArray | undefined;
58
+ line: string;
59
+ }>;
60
+ }>;
61
+ listProcesses(): Promise<{
62
+ id: string;
63
+ command: string;
64
+ status: string;
65
+ startTime: Date;
66
+ endTime: Date | undefined;
67
+ exitCode: number | undefined;
68
+ sessionId: string | undefined;
69
+ kill: (signal?: string) => Promise<void>;
70
+ getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
71
+ getLogs: () => Promise<{
72
+ stdout: string;
73
+ stderr: string;
74
+ processId: string;
75
+ }>;
76
+ waitForExit: (timeout?: number) => Promise<{
77
+ exitCode: number;
78
+ }>;
79
+ waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
80
+ match?: true | RegExpMatchArray | undefined;
81
+ line: string;
82
+ }>;
83
+ }[]>;
84
+ getProcess(id: string): Promise<{
85
+ id: string;
86
+ command: string;
87
+ status: string;
88
+ startTime: Date;
89
+ endTime: Date | undefined;
90
+ exitCode: number | undefined;
91
+ sessionId: string | undefined;
92
+ kill: (signal?: string) => Promise<void>;
93
+ getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
94
+ getLogs: () => Promise<{
95
+ stdout: string;
96
+ stderr: string;
97
+ processId: string;
98
+ }>;
99
+ waitForExit: (timeout?: number) => Promise<{
100
+ exitCode: number;
101
+ }>;
102
+ waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
103
+ match?: true | RegExpMatchArray | undefined;
104
+ line: string;
105
+ }>;
106
+ } | null>;
107
+ getProcessLogs(id: string): Promise<{
108
+ stdout: string;
109
+ stderr: string;
110
+ processId: string;
111
+ }>;
112
+ killProcess(id: string, signal?: string): Promise<void>;
113
+ killAllProcesses(): Promise<number>;
114
+ createSession(options?: SessionOptions): Promise<{
115
+ id: string;
116
+ exec: (command: string, options?: ExecOptions) => Promise<import("./index.js").ExecResult>;
117
+ execStream: (command: string, options?: ExecOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
118
+ startProcess: (command: string, options?: ProcessOptions) => Promise<{
119
+ id: string;
120
+ command: string;
121
+ status: string;
122
+ startTime: Date;
123
+ endTime: Date | undefined;
124
+ exitCode: number | undefined;
125
+ sessionId: string | undefined;
126
+ kill: (signal?: string) => Promise<void>;
127
+ getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
128
+ getLogs: () => Promise<{
129
+ stdout: string;
130
+ stderr: string;
131
+ processId: string;
132
+ }>;
133
+ waitForExit: (timeout?: number) => Promise<{
134
+ exitCode: number;
135
+ }>;
136
+ waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
137
+ match?: true | RegExpMatchArray | undefined;
138
+ line: string;
139
+ }>;
140
+ }>;
141
+ writeFile: (path: string, content: string | ReadableStream<Uint8Array<ArrayBufferLike>>, options?: {
142
+ encoding?: string;
143
+ } | undefined) => Promise<{
144
+ success: boolean;
145
+ path: string;
146
+ bytesWritten: number;
147
+ timestamp: string;
148
+ }>;
149
+ readFile: {
150
+ (path: string, options: {
151
+ encoding: "none";
152
+ }): Promise<ReadFileStreamResult>;
153
+ (path: string, options?: {
154
+ encoding?: "utf8" | "utf-8" | "base64";
155
+ }): Promise<ReadFileResult>;
156
+ };
157
+ mkdir: (path: string, options?: {
158
+ recursive?: boolean;
159
+ } | undefined) => Promise<{
160
+ success: boolean;
161
+ path: string;
162
+ timestamp: string;
163
+ }>;
164
+ deleteFile: (path: string) => Promise<{
165
+ success: boolean;
166
+ path: string;
167
+ timestamp: string;
168
+ }>;
169
+ renameFile: (path: string, to: string) => Promise<{
170
+ success: boolean;
171
+ path: string;
172
+ newPath: string;
173
+ timestamp: string;
174
+ }>;
175
+ moveFile: (path: string, to: string) => Promise<{
176
+ success: boolean;
177
+ path: string;
178
+ newPath: string;
179
+ timestamp: string;
180
+ }>;
181
+ exists: (path: string) => Promise<{
182
+ success: boolean;
183
+ path: string;
184
+ exists: boolean;
185
+ timestamp: string;
186
+ }>;
187
+ listFiles: (path: string, options?: {
188
+ recursive?: boolean;
189
+ includeHidden?: boolean;
190
+ } | undefined) => Promise<{
191
+ success: boolean;
192
+ path: string;
193
+ files: {
194
+ absolutePath: string;
195
+ relativePath: string;
196
+ permissions: {
197
+ readable: boolean;
198
+ writable: boolean;
199
+ executable: boolean;
200
+ };
201
+ name: string;
202
+ path: string;
203
+ type: "file" | "directory" | "symlink" | "other";
204
+ size: number;
205
+ mode: string;
206
+ modifiedAt: string;
207
+ uid?: number;
208
+ gid?: number;
209
+ owner?: string;
210
+ group?: string;
211
+ symlinkTarget?: string;
212
+ }[];
213
+ count: number;
214
+ timestamp: string;
215
+ }>;
216
+ setEnvVars: (env: Record<string, string | undefined>) => Promise<void>;
217
+ }>;
218
+ getSession(id: string): Promise<{
219
+ id: string;
220
+ exec: (command: string, options?: ExecOptions) => Promise<import("./index.js").ExecResult>;
221
+ execStream: (command: string, options?: ExecOptions) => Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
222
+ startProcess: (command: string, options?: ProcessOptions) => Promise<{
223
+ id: string;
224
+ command: string;
225
+ status: string;
226
+ startTime: Date;
227
+ endTime: Date | undefined;
228
+ exitCode: number | undefined;
229
+ sessionId: string | undefined;
230
+ kill: (signal?: string) => Promise<void>;
231
+ getStatus: () => Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
232
+ getLogs: () => Promise<{
233
+ stdout: string;
234
+ stderr: string;
235
+ processId: string;
236
+ }>;
237
+ waitForExit: (timeout?: number) => Promise<{
238
+ exitCode: number;
239
+ }>;
240
+ waitForLog: (pattern: string | RegExp, timeout?: number) => Promise<{
241
+ match?: true | RegExpMatchArray | undefined;
242
+ line: string;
243
+ }>;
244
+ }>;
245
+ writeFile: (path: string, content: string | ReadableStream<Uint8Array<ArrayBufferLike>>, options?: {
246
+ encoding?: string;
247
+ } | undefined) => Promise<{
248
+ success: boolean;
249
+ path: string;
250
+ bytesWritten: number;
251
+ timestamp: string;
252
+ }>;
253
+ readFile: {
254
+ (path: string, options: {
255
+ encoding: "none";
256
+ }): Promise<ReadFileStreamResult>;
257
+ (path: string, options?: {
258
+ encoding?: "utf8" | "utf-8" | "base64";
259
+ }): Promise<ReadFileResult>;
260
+ };
261
+ mkdir: (path: string, options?: {
262
+ recursive?: boolean;
263
+ } | undefined) => Promise<{
264
+ success: boolean;
265
+ path: string;
266
+ timestamp: string;
267
+ }>;
268
+ deleteFile: (path: string) => Promise<{
269
+ success: boolean;
270
+ path: string;
271
+ timestamp: string;
272
+ }>;
273
+ renameFile: (path: string, to: string) => Promise<{
274
+ success: boolean;
275
+ path: string;
276
+ newPath: string;
277
+ timestamp: string;
278
+ }>;
279
+ moveFile: (path: string, to: string) => Promise<{
280
+ success: boolean;
281
+ path: string;
282
+ newPath: string;
283
+ timestamp: string;
284
+ }>;
285
+ exists: (path: string) => Promise<{
286
+ success: boolean;
287
+ path: string;
288
+ exists: boolean;
289
+ timestamp: string;
290
+ }>;
291
+ listFiles: (path: string, options?: {
292
+ recursive?: boolean;
293
+ includeHidden?: boolean;
294
+ } | undefined) => Promise<{
295
+ success: boolean;
296
+ path: string;
297
+ files: {
298
+ absolutePath: string;
299
+ relativePath: string;
300
+ permissions: {
301
+ readable: boolean;
302
+ writable: boolean;
303
+ executable: boolean;
304
+ };
305
+ name: string;
306
+ path: string;
307
+ type: "file" | "directory" | "symlink" | "other";
308
+ size: number;
309
+ mode: string;
310
+ modifiedAt: string;
311
+ uid?: number;
312
+ gid?: number;
313
+ owner?: string;
314
+ group?: string;
315
+ symlinkTarget?: string;
316
+ }[];
317
+ count: number;
318
+ timestamp: string;
319
+ }>;
320
+ setEnvVars: (env: Record<string, string | undefined>) => Promise<void>;
321
+ }>;
322
+ deleteSession(id: string): Promise<{
323
+ success: boolean;
324
+ sessionId: string;
325
+ timestamp: string;
326
+ }>;
327
+ writeFile(...args: Parameters<RuntimeSandbox["writeFile"]>): Promise<{
328
+ success: boolean;
329
+ path: string;
330
+ bytesWritten: number;
331
+ timestamp: string;
332
+ }>;
333
+ readFile(path: string, options: {
334
+ encoding: "none";
335
+ }): Promise<ReadFileStreamResult>;
336
+ readFile(path: string, options?: {
337
+ encoding?: "utf8" | "utf-8" | "base64";
338
+ }): Promise<ReadFileResult>;
339
+ mkdir(...args: Parameters<RuntimeSandbox["mkdir"]>): Promise<{
340
+ success: boolean;
341
+ path: string;
342
+ timestamp: string;
343
+ }>;
344
+ deleteFile(path: string): Promise<{
345
+ success: boolean;
346
+ path: string;
347
+ timestamp: string;
348
+ }>;
349
+ renameFile(path: string, to: string): Promise<{
350
+ success: boolean;
351
+ path: string;
352
+ newPath: string;
353
+ timestamp: string;
354
+ }>;
355
+ moveFile(path: string, to: string): Promise<{
356
+ success: boolean;
357
+ path: string;
358
+ newPath: string;
359
+ timestamp: string;
360
+ }>;
361
+ listFiles(...args: Parameters<RuntimeSandbox["listFiles"]>): Promise<{
362
+ success: boolean;
363
+ path: string;
364
+ files: {
365
+ absolutePath: string;
366
+ relativePath: string;
367
+ permissions: {
368
+ readable: boolean;
369
+ writable: boolean;
370
+ executable: boolean;
371
+ };
372
+ name: string;
373
+ path: string;
374
+ type: "file" | "directory" | "symlink" | "other";
375
+ size: number;
376
+ mode: string;
377
+ modifiedAt: string;
378
+ uid?: number;
379
+ gid?: number;
380
+ owner?: string;
381
+ group?: string;
382
+ symlinkTarget?: string;
383
+ }[];
384
+ count: number;
385
+ timestamp: string;
386
+ }>;
387
+ exists(path: string): Promise<{
388
+ success: boolean;
389
+ path: string;
390
+ exists: boolean;
391
+ timestamp: string;
392
+ }>;
393
+ setEnvVars(...args: Parameters<RuntimeSandbox["setEnvVars"]>): Promise<void>;
394
+ exposePort(port: number, options: {
395
+ name?: string;
396
+ hostname: string;
397
+ token?: string;
398
+ }): Promise<{
399
+ url: string;
400
+ port: number;
401
+ name: string | undefined;
402
+ }>;
403
+ private expose;
404
+ unexposePort(port: number): Promise<void>;
405
+ isPortExposed(port: number): Promise<boolean>;
406
+ validatePortToken(port: number, token: string): Promise<boolean>;
407
+ getExposedPorts(hostname: string): Promise<{
408
+ url: string;
409
+ port: number;
410
+ status: "active";
411
+ }[]>;
412
+ fetch(request: WorkerRequest): Promise<WorkerResponse>;
413
+ private forwardPreview;
414
+ destroy(): Promise<void>;
415
+ }
416
+ export declare function getSandbox<T extends Sandbox>(namespace: DurableObjectNamespace<T>, id: string, options?: SandboxOptions): T;
417
+ export declare function proxyToSandbox(request: Request, env: {
418
+ Sandbox: DurableObjectNamespace<Sandbox>;
419
+ }): Promise<Response | null>;