withruntime 0.21.0 → 0.33.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 (79) hide show
  1. package/COMPATIBILITY.md +64 -3
  2. package/E2B.md +1 -1
  3. package/README.md +36 -2
  4. package/README.src.md +35 -1
  5. package/compatibility-lock.json +3 -3
  6. package/dist/agents/browser.d.ts +12 -0
  7. package/dist/agents/browser.js +12 -0
  8. package/dist/agents/index.d.ts +7 -7
  9. package/dist/agents/index.js +7 -8
  10. package/dist/agents-cli.d.ts +1 -1
  11. package/dist/agents-cli.js +250 -3
  12. package/dist/agents-deploy.d.ts +186 -0
  13. package/dist/agents-deploy.js +752 -0
  14. package/dist/agents-file.d.ts +19 -0
  15. package/dist/agents-file.js +135 -0
  16. package/dist/apps/index.d.ts +10 -0
  17. package/dist/apps/index.js +11 -0
  18. package/dist/apps-cli.d.ts +3 -1
  19. package/dist/apps-cli.js +285 -38
  20. package/dist/blaxel/errors.js +2 -1
  21. package/dist/ci/index.d.ts +10 -0
  22. package/dist/ci/index.js +11 -0
  23. package/dist/ci-cli.d.ts +10 -0
  24. package/dist/ci-cli.js +343 -0
  25. package/dist/cli.d.ts +18 -7
  26. package/dist/cli.js +862 -99
  27. package/dist/daytona/errors.js +2 -1
  28. package/dist/e2b/errors.js +2 -1
  29. package/dist/e2b/filesystem.d.ts +1 -0
  30. package/dist/e2b/filesystem.js +1 -1
  31. package/dist/e2b/sandbox.d.ts +11 -2
  32. package/dist/e2b/sandbox.js +22 -6
  33. package/dist/errors.d.ts +11 -4
  34. package/dist/errors.js +27 -4
  35. package/dist/fly/index.d.ts +102 -0
  36. package/dist/fly/index.js +930 -0
  37. package/dist/index.d.ts +7 -3
  38. package/dist/keys.d.ts +6 -0
  39. package/dist/keys.js +10 -1
  40. package/dist/machine.d.ts +10 -6
  41. package/dist/machine.js +14 -6
  42. package/dist/modal/index.d.ts +34 -0
  43. package/dist/modal/index.js +128 -22
  44. package/dist/product-names.js +7 -0
  45. package/dist/products/agents.d.ts +101 -3
  46. package/dist/products/agents.js +49 -0
  47. package/dist/products/apps.d.ts +206 -10
  48. package/dist/products/apps.js +172 -1
  49. package/dist/products/ci.d.ts +332 -0
  50. package/dist/products/ci.js +101 -0
  51. package/dist/products/index.d.ts +8 -0
  52. package/dist/products/index.js +15 -0
  53. package/dist/products/jobs.d.ts +105 -5
  54. package/dist/products/jobs.js +47 -3
  55. package/dist/products/network.d.ts +13 -0
  56. package/dist/products/observability.d.ts +1 -1
  57. package/dist/products/plans.d.ts +131 -0
  58. package/dist/products/plans.js +24 -0
  59. package/dist/products/reservations.d.ts +108 -0
  60. package/dist/products/reservations.js +41 -0
  61. package/dist/products/resources.d.ts +2 -1
  62. package/dist/products/secrets.d.ts +109 -6
  63. package/dist/products/secrets.js +38 -2
  64. package/dist/proxy.d.ts +3 -3
  65. package/dist/proxy.js +20 -0
  66. package/dist/sandbox.d.ts +29 -1
  67. package/dist/sandbox.js +56 -3
  68. package/dist/snapshots.d.ts +1 -1
  69. package/dist/switched-off.d.ts +5 -0
  70. package/dist/switched-off.js +8 -0
  71. package/dist/tar.d.ts +1 -1
  72. package/dist/tar.js +19 -1
  73. package/dist/transport.d.ts +1 -1
  74. package/dist/transport.js +48 -9
  75. package/dist/types.d.ts +35 -4
  76. package/dist/vercel/errors.d.ts +1 -1
  77. package/dist/vercel/errors.js +2 -1
  78. package/dist/vercel/snapshot.js +4 -2
  79. package/package.json +23 -6
package/dist/types.d.ts CHANGED
@@ -133,8 +133,9 @@ export type CreateSandbox = {
133
133
  onLeaseEnd?: "pause" | "stop" | "delete";
134
134
  /** Pause after this many seconds in which nothing happens in it: no
135
135
  * request, no command or terminal running, no open connection, no network
136
- * traffic and no CPU use. Default 60 unless persistent; 0 never;
137
- * otherwise 10 to 86400. A request wakes it again. */
136
+ * traffic and no CPU use. Default 300 unless persistent; 0 never;
137
+ * otherwise 60 to 86400 (a shorter time is raised to 60). A request wakes
138
+ * it again. */
138
139
  idlePauseSeconds?: number;
139
140
  /** A request to a paused sandbox wakes it. Default true. */
140
141
  autoWake?: boolean;
@@ -165,7 +166,7 @@ export type CreateSandbox = {
165
166
  snapshot?: string;
166
167
  /** One to 16 ids of your own sandboxes or snapshots. The new sandbox starts
167
168
  * on a server none of them is on, and stays apart if its start is moved.
168
- * With no other server that has room, the create answers 409 `no_capacity`
169
+ * With no other server that has room, the create answers 503 `no_capacity`
169
170
  * and nothing is made or charged. A copy of a snapshot starts only where that
170
171
  * snapshot is kept, so a `snapshot` with `spreadFrom` naming its server also
171
172
  * answers `no_capacity`. */
@@ -197,6 +198,16 @@ export type OutOfMemory = {
197
198
  /** What to do: a larger memoryMiB, or a program that uses less. */
198
199
  hint: string;
199
200
  };
201
+ /** What a command run with `traceFiles` opened and wrote, until it exited. */
202
+ export type TracedFiles = {
203
+ /** Every file and directory it, or anything it started, opened: sorted
204
+ * absolute paths, links resolved; a directory (a listing) ends in "/". */
205
+ read: string[];
206
+ /** Every file it wrote. */
207
+ written: string[];
208
+ /** Some paths are missing: the lists are not the whole story. */
209
+ truncated: boolean;
210
+ };
200
211
  export type CommandResult = {
201
212
  exitCode: number | null;
202
213
  stdout: string;
@@ -208,6 +219,8 @@ export type CommandResult = {
208
219
  processId?: string;
209
220
  replayed?: boolean;
210
221
  outOfMemory?: OutOfMemory;
222
+ /** With `traceFiles` only. */
223
+ files?: TracedFiles;
211
224
  };
212
225
  export type ExecOptions = {
213
226
  cwd?: string;
@@ -226,6 +239,9 @@ export type ExecOptions = {
226
239
  onStderr?: (text: string) => unknown;
227
240
  /** Throw CommandError when the exit code is not 0. */
228
241
  check?: boolean;
242
+ /** Answer `files`: what the command read and wrote, for keying a cache by
243
+ * what a test really read. */
244
+ traceFiles?: boolean;
229
245
  signal?: AbortSignal;
230
246
  idempotencyKey?: string;
231
247
  };
@@ -265,6 +281,8 @@ export type OutputEvent = {
265
281
  timedOut: boolean;
266
282
  durationMs?: number;
267
283
  outOfMemory?: OutOfMemory;
284
+ /** An exec with `traceFiles`. */
285
+ files?: TracedFiles;
268
286
  } | {
269
287
  type: "truncated";
270
288
  droppedBytes: number;
@@ -302,6 +320,19 @@ export type FileEntry = {
302
320
  group?: string;
303
321
  symlinkTarget?: string;
304
322
  };
323
+ /** A signed link to one file of a sandbox (POST .../files:link): `url` opens
324
+ * with no API key, GET to download (Range works) or PUT to upload, until
325
+ * `expiresAt`. */
326
+ export type FileLink = {
327
+ url: string;
328
+ method: "GET" | "PUT";
329
+ path: string;
330
+ sandboxId: string;
331
+ expiresAt: string;
332
+ filename?: string;
333
+ maxBytes?: number;
334
+ archive?: boolean;
335
+ };
305
336
  /** GET /v1/usage. Money is integer microdollars in strings (1,000,000 = $1),
306
337
  * exact past 2^53: available = credited - spent - expired - held. */
307
338
  export type Usage = {
@@ -457,7 +488,7 @@ export type SandboxSettings = {
457
488
  /** A request to a paused sandbox wakes it. */
458
489
  autoWake?: boolean;
459
490
  /** Pause after this many seconds with no activity, counted from now; 0
460
- * never, otherwise 10 to 86400. */
491
+ * never, otherwise 60 to 86400 (a shorter time is raised to 60). */
461
492
  idlePauseSeconds?: number;
462
493
  /** Keep it running until you stop it, while credit lasts, and keep its disk
463
494
  * after a stop. Paid only. */
@@ -45,7 +45,7 @@ export declare function translate(error: unknown, sandboxName?: string): unknown
45
45
  export declare function guard<T>(work: () => Promise<T>, sandboxName?: string): Promise<T>;
46
46
  /** A node:fs-style error, as Vercel's `sandbox.fs` throws. */
47
47
  export declare function fsError(code: "ENOENT" | "EEXIST" | "EISDIR" | "ENOTDIR" | "EACCES" | "ENOTEMPTY" | "EINVAL", syscall: string, path: string): Error & {
48
- code: "ENOENT" | "EEXIST" | "ENOTDIR" | "EISDIR" | "EACCES" | "ENOTEMPTY" | "EINVAL";
48
+ code: "ENOENT" | "ENOTDIR" | "EEXIST" | "EISDIR" | "EACCES" | "ENOTEMPTY" | "EINVAL";
49
49
  errno: number;
50
50
  syscall: string;
51
51
  path: string;
@@ -1,4 +1,5 @@
1
1
  import { RuntimeError } from "../errors.js";
2
+ import { productSwitchedOff } from "../switched-off.js";
2
3
  /** An error answer from the API. `response.status` is the HTTP status, and
3
4
  * `json` is `{ error: { code, message } }` as Vercel's is. */
4
5
  export class APIError extends Error {
@@ -69,7 +70,7 @@ export function translate(error, sandboxName) {
69
70
  ]
70
71
  .filter(Boolean)
71
72
  .join("\n");
72
- if (error.status === 503 && error.code.endsWith("_unavailable"))
73
+ if (productSwitchedOff(error))
73
74
  return new NotSupportedError(error.code.replace(/_unavailable$/, ""), error.hint ?? "", message);
74
75
  if (error.status < 200 || error.status > 599)
75
76
  return error;
@@ -9,10 +9,12 @@ function statusOf(state) {
9
9
  }
10
10
  /** Vercel's snapshots always expire. Runtime's has no end date while it is kept
11
11
  * for as long as the account has credit; it is then taken at the longest a
12
- * snapshot is kept, a year from when it was made. */
12
+ * snapshot can be kept from now, a year, which the server moves on with it.
13
+ * Until 19 October 2026 this said a year from when it was made, a date that
14
+ * would have passed while the snapshot was still kept. */
13
15
  function expiresAtOf(snapshot) {
14
16
  return snapshot.expiresAt === null
15
- ? Date.parse(snapshot.createdAt) + 365 * 86_400_000
17
+ ? Math.max(Date.parse(snapshot.createdAt), Date.now()) + 365 * 86_400_000
16
18
  : Date.parse(snapshot.expiresAt);
17
19
  }
18
20
  function metadataOf(snapshot) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "withruntime",
3
- "version": "0.21.0",
3
+ "version": "0.33.0",
4
4
  "license": "Apache-2.0",
5
5
  "mcpName": "com.withruntime/runtime",
6
6
  "type": "module",
@@ -57,6 +57,7 @@
57
57
  },
58
58
  "./agents": {
59
59
  "types": "./dist/agents/index.d.ts",
60
+ "browser": "./dist/agents/browser.js",
60
61
  "import": "./dist/agents/index.js",
61
62
  "default": "./dist/agents/index.js"
62
63
  },
@@ -70,6 +71,16 @@
70
71
  "import": "./dist/builds/index.js",
71
72
  "default": "./dist/builds/index.js"
72
73
  },
74
+ "./ci": {
75
+ "types": "./dist/ci/index.d.ts",
76
+ "import": "./dist/ci/index.js",
77
+ "default": "./dist/ci/index.js"
78
+ },
79
+ "./apps": {
80
+ "types": "./dist/apps/index.d.ts",
81
+ "import": "./dist/apps/index.js",
82
+ "default": "./dist/apps/index.js"
83
+ },
73
84
  "./e2b": {
74
85
  "types": "./dist/e2b/index.d.ts",
75
86
  "import": "./dist/e2b/index.js",
@@ -135,6 +146,11 @@
135
146
  "import": "./dist/sprites/index.js",
136
147
  "default": "./dist/sprites/index.js"
137
148
  },
149
+ "./fly": {
150
+ "types": "./dist/fly/index.d.ts",
151
+ "import": "./dist/fly/index.js",
152
+ "default": "./dist/fly/index.js"
153
+ },
138
154
  "./freestyle": {
139
155
  "types": "./dist/freestyle/index.d.ts",
140
156
  "import": "./dist/freestyle/index.js",
@@ -180,9 +196,9 @@
180
196
  "node": ">=22.12"
181
197
  },
182
198
  "scripts": {
183
- "build": "tsc -p tsconfig.build.json",
184
- "check-types": "tsc --noEmit",
185
- "lint": "eslint",
199
+ "build": "node ../typescript-config/tsc5.mjs -p tsconfig.build.json",
200
+ "check-types": "tsgo --noEmit",
201
+ "lint": "oxlint -c ../eslint-config/oxlint.json --ignore-pattern 'dist/**' --ignore-pattern 'tests/fixtures/modal/**'",
186
202
  "test": "bun test"
187
203
  },
188
204
  "devDependencies": {
@@ -202,7 +218,6 @@
202
218
  "@types/bun": "^1.4.0",
203
219
  "@types/node": "^20",
204
220
  "ai": "7.0.87",
205
- "eslint": "^9",
206
221
  "groq-sdk": "1.6.0",
207
222
  "openai": "7.23.0",
208
223
  "together-ai": "0.55.0",
@@ -227,6 +242,7 @@
227
242
  "./dist/tar.js": "./dist/browser-stub.js",
228
243
  "./dist/image-context.js": "./dist/browser-stub.js",
229
244
  "./dist/credentials.js": "./dist/browser-stub.js",
245
+ "./dist/agents-file.js": "./dist/browser-stub.js",
230
246
  "undici": false
231
247
  },
232
248
  "keywords": [
@@ -242,7 +258,8 @@
242
258
  "llm"
243
259
  ],
244
260
  "dependencies": {
245
- "undici": "^7.29.1"
261
+ "undici": "^7.29.1",
262
+ "yaml": "^2.8.1"
246
263
  },
247
264
  "peerDependencies": {
248
265
  "@ai-sdk/harness": "^1.0.0",