withruntime 0.8.4 → 0.9.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 (91) hide show
  1. package/COMPATIBILITY.md +145 -0
  2. package/E2B.md +23 -13
  3. package/README.md +8 -5
  4. package/README.src.md +8 -5
  5. package/compatibility-lock.json +281 -0
  6. package/dist/ai-harness/index.js +2 -2
  7. package/dist/api-defaults.d.ts +17 -0
  8. package/dist/api-defaults.js +22 -0
  9. package/dist/blaxel/preview.d.ts +1 -1
  10. package/dist/blaxel/preview.js +1 -1
  11. package/dist/blaxel/process.d.ts +1 -1
  12. package/dist/blaxel/process.js +11 -2
  13. package/dist/cli-words.d.ts +27 -0
  14. package/dist/cli-words.js +135 -0
  15. package/dist/cli.js +162 -31
  16. package/dist/client.d.ts +4 -1
  17. package/dist/client.js +8 -2
  18. package/dist/cloudflare/index.d.ts +294 -0
  19. package/dist/cloudflare/index.js +554 -0
  20. package/dist/cloudflare/worker.d.ts +415 -0
  21. package/dist/cloudflare/worker.js +297 -0
  22. package/dist/codesandbox/guest-service.d.ts +31 -0
  23. package/dist/codesandbox/guest-service.js +453 -0
  24. package/dist/codesandbox/index.d.ts +386 -0
  25. package/dist/codesandbox/index.js +1313 -0
  26. package/dist/compat/core.d.ts +39 -0
  27. package/dist/compat/core.js +199 -0
  28. package/dist/compat/files.d.ts +26 -0
  29. package/dist/compat/files.js +115 -0
  30. package/dist/compat/shell.d.ts +4 -0
  31. package/dist/compat/shell.js +165 -0
  32. package/dist/daytona/context.js +2 -1
  33. package/dist/daytona/process.d.ts +1 -1
  34. package/dist/daytona/process.js +27 -4
  35. package/dist/e2b/code-interpreter.d.ts +4 -5
  36. package/dist/e2b/code-interpreter.js +54 -56
  37. package/dist/e2b/commands.d.ts +5 -4
  38. package/dist/e2b/commands.js +37 -29
  39. package/dist/e2b/errors.js +1 -1
  40. package/dist/e2b/filesystem.d.ts +8 -6
  41. package/dist/e2b/filesystem.js +127 -28
  42. package/dist/e2b/sandbox.d.ts +4 -3
  43. package/dist/e2b/sandbox.js +10 -10
  44. package/dist/errors.d.ts +8 -0
  45. package/dist/errors.js +15 -2
  46. package/dist/freestyle/index.d.ts +301 -0
  47. package/dist/freestyle/index.js +310 -0
  48. package/dist/index.d.ts +1 -0
  49. package/dist/mcp.js +2 -2
  50. package/dist/modal/index.d.ts +205 -0
  51. package/dist/modal/index.js +485 -0
  52. package/dist/network-cli.js +1 -1
  53. package/dist/openai-agents/index.js +9 -26
  54. package/dist/products/audit.d.ts +3 -0
  55. package/dist/products/index.d.ts +2 -0
  56. package/dist/products/index.js +2 -0
  57. package/dist/products/interpreter.d.ts +11 -4
  58. package/dist/products/interpreter.js +33 -9
  59. package/dist/products/jobs.js +3 -2
  60. package/dist/products/limits.d.ts +10 -0
  61. package/dist/products/previews.d.ts +10 -2
  62. package/dist/products/previews.js +3 -2
  63. package/dist/products/tailscale.d.ts +57 -0
  64. package/dist/products/tailscale.js +17 -0
  65. package/dist/products/watch.d.ts +25 -4
  66. package/dist/products/watch.js +75 -14
  67. package/dist/runloop/index.d.ts +340 -0
  68. package/dist/runloop/index.js +438 -0
  69. package/dist/runloop/pagination.d.ts +46 -0
  70. package/dist/runloop/pagination.js +82 -0
  71. package/dist/runloop/snapshots.d.ts +52 -0
  72. package/dist/runloop/snapshots.js +244 -0
  73. package/dist/sandbox.d.ts +40 -9
  74. package/dist/sandbox.js +273 -76
  75. package/dist/snapshots.d.ts +11 -1
  76. package/dist/snapshots.js +11 -1
  77. package/dist/sprites/index.d.ts +251 -0
  78. package/dist/sprites/index.js +552 -0
  79. package/dist/tar.d.ts +8 -1
  80. package/dist/tar.js +185 -35
  81. package/dist/tools/index.js +2 -1
  82. package/dist/transport.d.ts +20 -2
  83. package/dist/transport.js +48 -11
  84. package/dist/types.d.ts +52 -3
  85. package/dist/vercel/command.js +12 -1
  86. package/dist/vercel/errors.d.ts +2 -2
  87. package/dist/vercel/errors.js +12 -1
  88. package/dist/vercel/filesystem.d.ts +21 -18
  89. package/dist/vercel/filesystem.js +95 -48
  90. package/dist/vercel/sandbox.js +5 -5
  91. package/package.json +45 -3
@@ -0,0 +1,294 @@
1
+ import { Runtime } from "../client.js";
2
+ import type { Process as NativeProcess, Sandbox as NativeSandbox } from "../sandbox.js";
3
+ import { CompatibilityError, type ClientOptions } from "../compat/core.js";
4
+ export { CompatibilityError };
5
+ export declare class SandboxSecurityError extends Error {
6
+ readonly code: string;
7
+ constructor(message: string, code: string);
8
+ }
9
+ export declare function sanitizeSandboxId(id: string): string;
10
+ export interface SandboxOptions {
11
+ sleepAfter?: string | number;
12
+ keepAlive?: boolean;
13
+ normalizeId?: boolean;
14
+ runtime?: ClientOptions;
15
+ }
16
+ export interface ExecOptions {
17
+ timeout?: number;
18
+ env?: Record<string, string | undefined>;
19
+ cwd?: string;
20
+ encoding?: string;
21
+ stream?: boolean;
22
+ onOutput?: (stream: "stdout" | "stderr", data: string) => void;
23
+ onComplete?: (result: ExecResult) => void;
24
+ onError?: (error: Error) => void;
25
+ signal?: AbortSignal;
26
+ }
27
+ export interface ExecResult {
28
+ success: boolean;
29
+ exitCode: number;
30
+ stdout: string;
31
+ stderr: string;
32
+ command: string;
33
+ duration: number;
34
+ timestamp: string;
35
+ sessionId?: string;
36
+ }
37
+ export interface ReadFileResult {
38
+ success: boolean;
39
+ path: string;
40
+ content: string;
41
+ encoding: "utf-8" | "base64";
42
+ isBinary: boolean;
43
+ size: number;
44
+ timestamp: string;
45
+ }
46
+ export interface ReadFileStreamResult {
47
+ success: true;
48
+ path: string;
49
+ content: ReadableStream<Uint8Array>;
50
+ size: number;
51
+ mimeType: string;
52
+ timestamp: string;
53
+ }
54
+ export interface SessionOptions {
55
+ id?: string;
56
+ name?: string;
57
+ env?: Record<string, string | undefined>;
58
+ cwd?: string;
59
+ isolation?: boolean;
60
+ commandTimeoutMs?: number;
61
+ }
62
+ export interface ProcessOptions {
63
+ timeout?: number;
64
+ env?: Record<string, string | undefined>;
65
+ cwd?: string;
66
+ encoding?: string;
67
+ sessionId?: string;
68
+ onOutput?: (stream: "stdout" | "stderr", data: string) => void;
69
+ onExit?: (code: number | null) => void;
70
+ onStart?: (process: Process) => void;
71
+ onError?: (error: Error) => void;
72
+ }
73
+ /** Worker bindings are deliberately not inspected or invoked. Supply Runtime credentials
74
+ * through options.runtime in Workers; Node also supports RUNTIME_API_KEY/login. */
75
+ export declare function getSandbox(namespace: unknown, id: string, options?: SandboxOptions): Sandbox;
76
+ export declare class Sandbox {
77
+ readonly runtime: Runtime;
78
+ private readonly options;
79
+ private pending?;
80
+ readonly id: string;
81
+ constructor(runtime: Runtime, id: string, options?: SandboxOptions);
82
+ configure(options: Pick<SandboxOptions, "sleepAfter" | "keepAlive">): Promise<void>;
83
+ native(): Promise<NativeSandbox>;
84
+ private session;
85
+ exec(command: string, options?: ExecOptions): Promise<ExecResult>;
86
+ execStream(command: string, options?: ExecOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
87
+ startProcess(command: string, options?: ProcessOptions): Promise<Process>;
88
+ createSession(options?: SessionOptions): Promise<ExecutionSession>;
89
+ getSession(id: string): Promise<ExecutionSession>;
90
+ deleteSession(id: string): Promise<{
91
+ success: boolean;
92
+ sessionId: string;
93
+ timestamp: string;
94
+ }>;
95
+ destroy(): Promise<void>;
96
+ setEnvVars(env: Record<string, string | undefined>): Promise<void>;
97
+ writeFile(path: string, content: string | ReadableStream<Uint8Array>, options?: {
98
+ encoding?: string;
99
+ }): Promise<{
100
+ success: boolean;
101
+ path: string;
102
+ bytesWritten: number;
103
+ timestamp: string;
104
+ }>;
105
+ readFile(path: string, options: {
106
+ encoding: "none";
107
+ }): Promise<ReadFileStreamResult>;
108
+ readFile(path: string, options?: {
109
+ encoding?: "utf8" | "utf-8" | "base64";
110
+ }): Promise<ReadFileResult>;
111
+ mkdir(path: string, options?: {
112
+ recursive?: boolean;
113
+ }): Promise<{
114
+ success: boolean;
115
+ path: string;
116
+ timestamp: string;
117
+ }>;
118
+ deleteFile(path: string): Promise<{
119
+ success: boolean;
120
+ path: string;
121
+ timestamp: string;
122
+ }>;
123
+ renameFile(from: string, to: string): Promise<{
124
+ success: boolean;
125
+ path: string;
126
+ newPath: string;
127
+ timestamp: string;
128
+ }>;
129
+ moveFile(from: string, to: string): Promise<{
130
+ success: boolean;
131
+ path: string;
132
+ newPath: string;
133
+ timestamp: string;
134
+ }>;
135
+ listFiles(path: string, options?: {
136
+ recursive?: boolean;
137
+ includeHidden?: boolean;
138
+ }): Promise<{
139
+ success: boolean;
140
+ path: string;
141
+ files: {
142
+ absolutePath: string;
143
+ relativePath: string;
144
+ permissions: {
145
+ readable: boolean;
146
+ writable: boolean;
147
+ executable: boolean;
148
+ };
149
+ name: string;
150
+ path: string;
151
+ type: "file" | "directory" | "symlink" | "other";
152
+ size: number;
153
+ mode: string;
154
+ modifiedAt: string;
155
+ uid?: number;
156
+ gid?: number;
157
+ owner?: string;
158
+ group?: string;
159
+ symlinkTarget?: string;
160
+ }[];
161
+ count: number;
162
+ timestamp: string;
163
+ }>;
164
+ exists(path: string): Promise<{
165
+ success: boolean;
166
+ path: string;
167
+ exists: boolean;
168
+ timestamp: string;
169
+ }>;
170
+ listProcesses(): Promise<Process[]>;
171
+ getProcess(id: string): Promise<Process | null>;
172
+ killProcess(id: string, signal?: string): Promise<void>;
173
+ killAllProcesses(): Promise<number>;
174
+ getProcessLogs(id: string): Promise<{
175
+ stdout: string;
176
+ stderr: string;
177
+ processId: string;
178
+ }>;
179
+ exposePort(port: number, options: {
180
+ name?: string;
181
+ hostname: string;
182
+ token?: string;
183
+ }): Promise<{
184
+ url: string;
185
+ port: number;
186
+ name: string | undefined;
187
+ }>;
188
+ unexposePort(port: number): Promise<void>;
189
+ }
190
+ export declare class ExecutionSession {
191
+ private readonly sandbox;
192
+ readonly id: string;
193
+ private options;
194
+ constructor(sandbox: Sandbox, id: string, options: SessionOptions);
195
+ private context;
196
+ exec(command: string, options?: ExecOptions): Promise<ExecResult>;
197
+ execStream(command: string, options?: ExecOptions): Promise<ReadableStream<Uint8Array<ArrayBufferLike>>>;
198
+ startProcess(command: string, options?: ProcessOptions): Promise<Process>;
199
+ private path;
200
+ writeFile(path: string, content: string | ReadableStream<Uint8Array>, options?: {
201
+ encoding?: string;
202
+ }): Promise<{
203
+ success: boolean;
204
+ path: string;
205
+ bytesWritten: number;
206
+ timestamp: string;
207
+ }>;
208
+ readFile(path: string, options: {
209
+ encoding: "none";
210
+ }): Promise<ReadFileStreamResult>;
211
+ readFile(path: string, options?: {
212
+ encoding?: "utf8" | "utf-8" | "base64";
213
+ }): Promise<ReadFileResult>;
214
+ mkdir(path: string, options?: {
215
+ recursive?: boolean;
216
+ }): Promise<{
217
+ success: boolean;
218
+ path: string;
219
+ timestamp: string;
220
+ }>;
221
+ deleteFile(path: string): Promise<{
222
+ success: boolean;
223
+ path: string;
224
+ timestamp: string;
225
+ }>;
226
+ renameFile(path: string, newPath: string): Promise<{
227
+ success: boolean;
228
+ path: string;
229
+ newPath: string;
230
+ timestamp: string;
231
+ }>;
232
+ exists(path: string): Promise<{
233
+ success: boolean;
234
+ path: string;
235
+ exists: boolean;
236
+ timestamp: string;
237
+ }>;
238
+ listFiles(path: string, options?: {
239
+ recursive?: boolean;
240
+ includeHidden?: boolean;
241
+ }): Promise<{
242
+ success: boolean;
243
+ path: string;
244
+ files: {
245
+ absolutePath: string;
246
+ relativePath: string;
247
+ permissions: {
248
+ readable: boolean;
249
+ writable: boolean;
250
+ executable: boolean;
251
+ };
252
+ name: string;
253
+ path: string;
254
+ type: "file" | "directory" | "symlink" | "other";
255
+ size: number;
256
+ mode: string;
257
+ modifiedAt: string;
258
+ uid?: number;
259
+ gid?: number;
260
+ owner?: string;
261
+ group?: string;
262
+ symlinkTarget?: string;
263
+ }[];
264
+ count: number;
265
+ timestamp: string;
266
+ }>;
267
+ setEnvVars(env: Record<string, string | undefined>): Promise<void>;
268
+ }
269
+ export declare class Process {
270
+ private readonly sandbox;
271
+ private readonly native;
272
+ readonly sessionId?: string | undefined;
273
+ constructor(sandbox: Sandbox, native: NativeProcess, sessionId?: string | undefined);
274
+ get id(): string;
275
+ get command(): string;
276
+ get status(): "running" | "killed" | "unknown" | "failed" | "completed";
277
+ get startTime(): Date;
278
+ get endTime(): Date | undefined;
279
+ get exitCode(): number | undefined;
280
+ kill(signal?: string): Promise<void>;
281
+ getStatus(): Promise<"running" | "killed" | "unknown" | "failed" | "completed">;
282
+ getLogs(): Promise<{
283
+ stdout: string;
284
+ stderr: string;
285
+ processId: string;
286
+ }>;
287
+ waitForExit(timeout?: number): Promise<{
288
+ exitCode: number;
289
+ }>;
290
+ waitForLog(pattern: string | RegExp, timeout?: number): Promise<{
291
+ match?: true | RegExpMatchArray | undefined;
292
+ line: string;
293
+ }>;
294
+ }