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,251 @@
1
+ import { EventEmitter } from "node:events";
2
+ import { PassThrough, Writable } from "node:stream";
3
+ import type { Runtime } from "../client.js";
4
+ import type { Sandbox } from "../sandbox.js";
5
+ import { CompatibilityError, type ClientOptions as RuntimeClientOptions } from "../compat/core.js";
6
+ export { CompatibilityError };
7
+ export interface ClientOptions extends RuntimeClientOptions {
8
+ baseURL?: string;
9
+ timeout?: number;
10
+ controlMode?: boolean;
11
+ }
12
+ export interface SpriteConfig {
13
+ ramMB?: number;
14
+ cpus?: number;
15
+ region?: string;
16
+ storageGB?: number;
17
+ }
18
+ export interface CreateSpriteOptions {
19
+ config?: SpriteConfig;
20
+ environment?: Record<string, string>;
21
+ labels?: string[];
22
+ urlSettings?: {
23
+ auth?: string;
24
+ privateAccess?: string;
25
+ };
26
+ runtime?: "default" | "dev";
27
+ waitForCapacity?: boolean;
28
+ }
29
+ export interface SpawnOptions {
30
+ cwd?: string;
31
+ env?: Record<string, string>;
32
+ tty?: boolean;
33
+ rows?: number;
34
+ cols?: number;
35
+ detachable?: boolean;
36
+ sessionId?: string;
37
+ controlMode?: boolean;
38
+ }
39
+ export interface ExecOptions extends SpawnOptions {
40
+ encoding?: BufferEncoding;
41
+ maxBuffer?: number;
42
+ signal?: AbortSignal;
43
+ timeout?: number;
44
+ }
45
+ export interface ExecResult {
46
+ stdout: string | Buffer;
47
+ stderr: string | Buffer;
48
+ exitCode: number;
49
+ }
50
+ export type FilesystemErrorCode = "ENOENT" | "EEXIST" | "ENOTDIR" | "EISDIR" | "EACCES" | "EPERM" | "ENOTEMPTY" | "EINVAL" | "EIO" | "UNKNOWN";
51
+ export declare class FilesystemError extends Error {
52
+ readonly code: FilesystemErrorCode;
53
+ readonly path: string;
54
+ readonly syscall?: string | undefined;
55
+ constructor(message: string, code: FilesystemErrorCode, path: string, syscall?: string | undefined);
56
+ }
57
+ export interface Dirent {
58
+ name: string;
59
+ parentPath: string;
60
+ isDirectory(): boolean;
61
+ isFile(): boolean;
62
+ isSymbolicLink(): boolean;
63
+ }
64
+ export interface ReaddirOptions {
65
+ withFileTypes?: boolean;
66
+ recursive?: boolean;
67
+ pattern?: string;
68
+ encoding?: BufferEncoding;
69
+ }
70
+ export declare class ExecError extends Error {
71
+ readonly exitCode: number;
72
+ readonly stdout: string | Buffer;
73
+ readonly stderr: string | Buffer;
74
+ constructor(message: string, exitCode: number, stdout: string | Buffer, stderr: string | Buffer);
75
+ }
76
+ export declare class SpritesClient {
77
+ readonly runtime: Runtime;
78
+ constructor(token?: string, options?: ClientOptions);
79
+ sprite(name: string): Sprite;
80
+ createSprite(name: string, input?: SpriteConfig | CreateSpriteOptions, extra?: Omit<CreateSpriteOptions, "config">): Promise<Sprite>;
81
+ getSprite(name: string): Promise<Sprite>;
82
+ deleteSprite(name: string): Promise<void>;
83
+ listSprites(options?: {
84
+ prefix?: string;
85
+ maxResults?: number;
86
+ continuationToken?: string;
87
+ bulkLoad?: boolean;
88
+ }): Promise<{
89
+ sprites: {
90
+ id: string;
91
+ name: string;
92
+ status: "paused" | "stopped" | "stopping" | "starting" | "running" | "pausing" | "resuming";
93
+ createdAt: Date;
94
+ updatedAt: Date;
95
+ config: {
96
+ cpus: number;
97
+ ramMB: number;
98
+ storageGB: number;
99
+ region: string;
100
+ };
101
+ }[];
102
+ hasMore: boolean;
103
+ nextContinuationToken: string | undefined;
104
+ }>;
105
+ listAllSprites(prefix?: string): Promise<Sprite[]>;
106
+ restartSprite(name: string): Promise<{
107
+ spriteName: string;
108
+ machineId: string;
109
+ message: string;
110
+ }>;
111
+ updateURLSettings(name: string, settings: {
112
+ auth?: string;
113
+ privateAccess?: string;
114
+ }): Promise<void>;
115
+ }
116
+ export declare class Sprite {
117
+ readonly name: string;
118
+ readonly client: SpritesClient;
119
+ id?: string;
120
+ status?: string;
121
+ config?: SpriteConfig;
122
+ createdAt?: Date;
123
+ updatedAt?: Date;
124
+ url?: string;
125
+ labels: string[];
126
+ constructor(name: string, client: SpritesClient);
127
+ hydrate(s: Sandbox): void;
128
+ native(): Promise<Sandbox>;
129
+ spawn(command: string, args?: string[], options?: SpawnOptions): SpriteCommand;
130
+ exec(command: string, options?: ExecOptions): Promise<ExecResult>;
131
+ execFile(file: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
132
+ execFileHTTP(file: string, args?: string[], options?: ExecOptions): Promise<ExecResult>;
133
+ createSession(command: string, args?: string[], options?: SpawnOptions): SpriteCommand;
134
+ attachSession(sessionId: string, options?: SpawnOptions): SpriteCommand;
135
+ listSessions(): Promise<{
136
+ id: string;
137
+ command: string;
138
+ created: Date;
139
+ workdir: string;
140
+ isActive: boolean;
141
+ tty: boolean;
142
+ }[]>;
143
+ delete(): Promise<void>;
144
+ destroy(): Promise<void>;
145
+ restart(): Promise<{
146
+ spriteName: string;
147
+ machineId: string;
148
+ message: string;
149
+ }>;
150
+ filesystem(workingDir?: string): SpriteFilesystem;
151
+ createCheckpoint(_comment?: string): Promise<never>;
152
+ listCheckpoints(): Promise<never>;
153
+ getCheckpoint(_id: string): Promise<never>;
154
+ updateURLSettings(settings: {
155
+ auth?: string;
156
+ privateAccess?: string;
157
+ }): Promise<void>;
158
+ update(options: {
159
+ labels?: string[];
160
+ urlSettings?: {
161
+ auth?: string;
162
+ privateAccess?: string;
163
+ };
164
+ }): Promise<this>;
165
+ }
166
+ export declare class SpriteCommand extends EventEmitter {
167
+ readonly stdout: PassThrough;
168
+ readonly stderr: PassThrough;
169
+ readonly stdin: Writable;
170
+ private readonly process;
171
+ private readonly completion;
172
+ private code;
173
+ private readonly controller;
174
+ constructor(sprite: Sprite, command: string, args?: string[], options?: SpawnOptions);
175
+ private follow;
176
+ start(): Promise<void>;
177
+ wait(): Promise<number>;
178
+ kill(signal?: string): void;
179
+ signal(signal: string): void;
180
+ resize(cols: number, rows: number): void;
181
+ close(): void;
182
+ exitCode(): number;
183
+ }
184
+ export declare class SpriteFilesystem {
185
+ private readonly get;
186
+ private readonly files;
187
+ constructor(get: () => Promise<Sandbox>, cwd?: string);
188
+ readFile(path: string, encoding: "utf8"): Promise<string>;
189
+ readFile(path: string, encoding?: null): Promise<Buffer>;
190
+ writeFile(path: string, data: string | Uint8Array, options?: {
191
+ mode?: number;
192
+ }): Promise<void>;
193
+ readdir(path: string, options?: ReaddirOptions & {
194
+ withFileTypes?: false;
195
+ }): Promise<string[]>;
196
+ readdir(path: string, options: ReaddirOptions & {
197
+ withFileTypes: true;
198
+ }): Promise<Dirent[]>;
199
+ mkdir(path: string, options?: {
200
+ recursive?: boolean;
201
+ mode?: number;
202
+ }): Promise<void>;
203
+ rm(path: string, options?: {
204
+ recursive?: boolean;
205
+ force?: boolean;
206
+ }): Promise<void>;
207
+ stat(path: string): Promise<{
208
+ size: number;
209
+ mode: number;
210
+ mtime: Date;
211
+ atime: Date;
212
+ birthtime: Date;
213
+ isDirectory: () => boolean;
214
+ isFile: () => boolean;
215
+ isSymbolicLink: () => boolean;
216
+ }>;
217
+ rename(from: string, to: string): Promise<void>;
218
+ copyFile(from: string, to: string, options?: {
219
+ recursive?: boolean;
220
+ }): Promise<void>;
221
+ chmod(path: string, mode: number, options?: {
222
+ recursive?: boolean;
223
+ }): Promise<void>;
224
+ exists(path: string): Promise<boolean>;
225
+ appendFile(path: string, data: string | Uint8Array): Promise<void>;
226
+ readJSON<T = unknown>(path: string): Promise<T>;
227
+ writeJSON(path: string, data: unknown, options?: {
228
+ spaces?: number;
229
+ }): Promise<void>;
230
+ }
231
+ export declare class CheckpointStream {
232
+ private readonly messages;
233
+ private index;
234
+ constructor(messages: {
235
+ type: "complete" | "error" | "info";
236
+ data?: string;
237
+ error?: string;
238
+ }[]);
239
+ next(): Promise<{
240
+ type: "complete" | "error" | "info";
241
+ data?: string;
242
+ error?: string;
243
+ } | null>;
244
+ processAll(handler: (message: (typeof this.messages)[number]) => void | Promise<void>): Promise<void>;
245
+ close(): void;
246
+ [Symbol.asyncIterator](): AsyncGenerator<{
247
+ type: "complete" | "error" | "info";
248
+ data?: string;
249
+ error?: string;
250
+ }, void, unknown>;
251
+ }