withruntime 0.11.2 → 0.14.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 (171) hide show
  1. package/BLAXEL.md +2 -2
  2. package/COMPATIBILITY.md +74 -9
  3. package/DAYTONA.md +33 -5
  4. package/E2B.md +85 -24
  5. package/README.md +11 -10
  6. package/README.src.md +10 -9
  7. package/VERCEL.md +43 -5
  8. package/compatibility-lock.json +58 -49
  9. package/dist/billing-cli.d.ts +1 -1
  10. package/dist/billing-cli.js +85 -5
  11. package/dist/blaxel/errors.d.ts +14 -0
  12. package/dist/blaxel/errors.js +29 -0
  13. package/dist/blaxel/index.d.ts +2 -2
  14. package/dist/blaxel/index.js +4 -4
  15. package/dist/blaxel/interpreter.d.ts +2 -5
  16. package/dist/blaxel/sandbox.d.ts +15 -6
  17. package/dist/blaxel/sandbox.js +64 -8
  18. package/dist/blaxel/snapshot.d.ts +4 -0
  19. package/dist/blaxel/snapshot.js +4 -0
  20. package/dist/cli/logs.d.ts +21 -0
  21. package/dist/cli/logs.js +188 -0
  22. package/dist/cli-extras.d.ts +3 -3
  23. package/dist/cli-extras.js +17 -12
  24. package/dist/cli-words.d.ts +10 -1
  25. package/dist/cli-words.js +18 -0
  26. package/dist/cli.d.ts +22 -3
  27. package/dist/cli.js +647 -273
  28. package/dist/client.d.ts +2 -4
  29. package/dist/client.js +27 -11
  30. package/dist/cloudflare/errors.d.ts +143 -0
  31. package/dist/cloudflare/errors.js +167 -0
  32. package/dist/cloudflare/index.d.ts +175 -6
  33. package/dist/cloudflare/index.js +416 -26
  34. package/dist/cloudflare/interpreter.d.ts +119 -0
  35. package/dist/cloudflare/interpreter.js +223 -0
  36. package/dist/cloudflare/streams.d.ts +38 -0
  37. package/dist/cloudflare/streams.js +145 -0
  38. package/dist/cloudflare/watch.d.ts +9 -0
  39. package/dist/cloudflare/watch.js +24 -0
  40. package/dist/codesandbox/index.d.ts +216 -28
  41. package/dist/codesandbox/index.js +478 -78
  42. package/dist/compat/core.d.ts +18 -0
  43. package/dist/compat/core.js +29 -0
  44. package/dist/compat/files.d.ts +1 -0
  45. package/dist/compat/files.js +25 -5
  46. package/dist/credentials.d.ts +3 -0
  47. package/dist/credentials.js +15 -0
  48. package/dist/daytona/computer-use.d.ts +13 -4
  49. package/dist/daytona/computer-use.js +66 -8
  50. package/dist/daytona/daytona.d.ts +7 -1
  51. package/dist/daytona/daytona.js +31 -4
  52. package/dist/daytona/errors.d.ts +11 -0
  53. package/dist/daytona/errors.js +18 -0
  54. package/dist/daytona/filesystem.js +2 -1
  55. package/dist/daytona/image.d.ts +13 -9
  56. package/dist/daytona/image.js +18 -12
  57. package/dist/daytona/index.d.ts +1 -1
  58. package/dist/daytona/sandbox.d.ts +8 -2
  59. package/dist/daytona/sandbox.js +16 -2
  60. package/dist/domains/index.d.ts +9 -0
  61. package/dist/domains/index.js +10 -0
  62. package/dist/e2b/commands.d.ts +1 -1
  63. package/dist/e2b/commands.js +6 -7
  64. package/dist/e2b/errors.d.ts +17 -0
  65. package/dist/e2b/errors.js +40 -1
  66. package/dist/e2b/index.d.ts +2 -2
  67. package/dist/e2b/index.js +1 -1
  68. package/dist/e2b/sandbox.d.ts +28 -22
  69. package/dist/e2b/sandbox.js +34 -8
  70. package/dist/e2b/unsupported.js +1 -1
  71. package/dist/errors.d.ts +11 -2
  72. package/dist/errors.js +17 -5
  73. package/dist/freestyle/index.d.ts +285 -37
  74. package/dist/freestyle/index.js +656 -144
  75. package/dist/identity.d.ts +3 -0
  76. package/dist/identity.js +27 -0
  77. package/dist/images/index.d.ts +9 -0
  78. package/dist/images/index.js +10 -0
  79. package/dist/index.d.ts +3 -1
  80. package/dist/ips/index.d.ts +9 -0
  81. package/dist/ips/index.js +10 -0
  82. package/dist/jobs/index.d.ts +9 -0
  83. package/dist/jobs/index.js +10 -0
  84. package/dist/keys.js +2 -0
  85. package/dist/login.js +2 -0
  86. package/dist/machine.d.ts +27 -4
  87. package/dist/machine.js +46 -14
  88. package/dist/mcp.js +144 -20
  89. package/dist/modal/index.d.ts +339 -61
  90. package/dist/modal/index.js +781 -121
  91. package/dist/network-cli.d.ts +3 -1
  92. package/dist/network-cli.js +78 -36
  93. package/dist/networks/index.d.ts +11 -0
  94. package/dist/networks/index.js +10 -0
  95. package/dist/ports/index.d.ts +9 -0
  96. package/dist/ports/index.js +10 -0
  97. package/dist/product-names.d.ts +52 -0
  98. package/dist/product-names.js +164 -0
  99. package/dist/product-renames.d.ts +103 -0
  100. package/dist/product-renames.js +189 -0
  101. package/dist/products/api-keys.d.ts +73 -0
  102. package/dist/products/api-keys.js +23 -0
  103. package/dist/products/apps.d.ts +157 -0
  104. package/dist/products/apps.js +60 -0
  105. package/dist/products/balancers.d.ts +87 -0
  106. package/dist/products/balancers.js +8 -0
  107. package/dist/products/billing.d.ts +41 -0
  108. package/dist/products/billing.js +13 -0
  109. package/dist/products/browser.d.ts +10 -0
  110. package/dist/products/browsers.d.ts +71 -0
  111. package/dist/products/browsers.js +102 -0
  112. package/dist/products/builds.d.ts +156 -0
  113. package/dist/products/builds.js +227 -0
  114. package/dist/products/index.d.ts +5 -16
  115. package/dist/products/index.js +5 -14
  116. package/dist/products/jobs.d.ts +19 -2
  117. package/dist/products/jobs.js +28 -11
  118. package/dist/products/logs.d.ts +245 -0
  119. package/dist/products/logs.js +274 -0
  120. package/dist/products/network-products.d.ts +38 -7
  121. package/dist/products/network-products.js +31 -18
  122. package/dist/products/observability.d.ts +8 -2
  123. package/dist/products/private-network.js +1 -1
  124. package/dist/products/queues.d.ts +149 -0
  125. package/dist/products/queues.js +213 -0
  126. package/dist/products/referrals.d.ts +21 -7
  127. package/dist/products/referrals.js +3 -3
  128. package/dist/products/resources.d.ts +54 -0
  129. package/dist/products/resources.js +122 -0
  130. package/dist/products/secrets.d.ts +29 -3
  131. package/dist/products/secrets.js +47 -18
  132. package/dist/products/signed-requests.d.ts +21 -0
  133. package/dist/products/signed-requests.js +11 -0
  134. package/dist/products/streams.d.ts +73 -0
  135. package/dist/products/streams.js +17 -0
  136. package/dist/products/switching.d.ts +35 -7
  137. package/dist/products/switching.js +4 -3
  138. package/dist/products/volumes.d.ts +6 -0
  139. package/dist/record-cli.d.ts +23 -0
  140. package/dist/record-cli.js +308 -0
  141. package/dist/renamed-products.d.ts +38 -0
  142. package/dist/renamed-products.js +34 -0
  143. package/dist/runloop/index.d.ts +9 -2
  144. package/dist/runloop/index.js +29 -8
  145. package/dist/runloop/sdk.d.ts +131 -0
  146. package/dist/runloop/sdk.js +167 -0
  147. package/dist/sandbox.d.ts +7 -2
  148. package/dist/sandbox.js +41 -11
  149. package/dist/sandboxes/index.d.ts +11 -0
  150. package/dist/sandboxes/index.js +12 -0
  151. package/dist/snapshots/index.d.ts +9 -0
  152. package/dist/snapshots/index.js +11 -0
  153. package/dist/snapshots.d.ts +7 -4
  154. package/dist/sprites/index.d.ts +343 -31
  155. package/dist/sprites/index.js +866 -84
  156. package/dist/ssh.d.ts +1 -1
  157. package/dist/ssh.js +11 -11
  158. package/dist/terminal.d.ts +24 -0
  159. package/dist/terminal.js +32 -0
  160. package/dist/transport.d.ts +18 -1
  161. package/dist/transport.js +80 -6
  162. package/dist/tunnel.js +1 -1
  163. package/dist/types.d.ts +71 -4
  164. package/dist/vercel/sandbox.d.ts +1 -1
  165. package/dist/vercel/sandbox.js +6 -4
  166. package/dist/vercel/snapshot.js +10 -2
  167. package/dist/volumes/index.d.ts +9 -0
  168. package/dist/volumes/index.js +10 -0
  169. package/dist/wallet.d.ts +4 -1
  170. package/dist/wallet.js +2 -1
  171. package/package.json +48 -14
@@ -0,0 +1,167 @@
1
+ import { Runloop, } from "./index.js";
2
+ import { only } from "../compat/core.js";
3
+ export class RunloopError extends Error {
4
+ constructor(message) {
5
+ super(message);
6
+ this.name = "RunloopError";
7
+ }
8
+ }
9
+ /** The high-level command handles share the low-level adapter's validation,
10
+ * cancellation and process input path; they never send a provider request. */
11
+ export class RunloopSDK {
12
+ api;
13
+ devbox;
14
+ constructor(options = {}) {
15
+ this.api = new Runloop(options);
16
+ this.devbox = {
17
+ fromId: (id) => new Devbox(this.api, id),
18
+ create: async (params = {}, request) => {
19
+ const info = await this.api.devboxes.createAndAwaitRunning(params, request);
20
+ return new Devbox(this.api, info.id);
21
+ },
22
+ };
23
+ }
24
+ get secret() {
25
+ return this.api.secrets;
26
+ }
27
+ get storageObject() {
28
+ return this.api.objects;
29
+ }
30
+ get axon() {
31
+ return this.api.axons;
32
+ }
33
+ get gatewayConfig() {
34
+ return this.api.gatewayConfigs;
35
+ }
36
+ get mcpConfig() {
37
+ return this.api.mcpConfigs;
38
+ }
39
+ get networkPolicy() {
40
+ return this.api.networkPolicies;
41
+ }
42
+ }
43
+ export class Devbox {
44
+ client;
45
+ id;
46
+ cmd;
47
+ constructor(client, id) {
48
+ this.client = client;
49
+ this.id = id;
50
+ const start = async (command, params = {}, options) => {
51
+ only("Runloop command; use devboxes.executions streams for output callbacks", params, [
52
+ "shell_name",
53
+ "attach_stdin",
54
+ ]);
55
+ const initial = await client.devboxes.executeAsync(id, { command, ...params }, options);
56
+ return new Execution(client, id, initial.execution_id, initial);
57
+ };
58
+ this.cmd = {
59
+ execAsync: start,
60
+ exec: async (command, params = {}, options) => {
61
+ if (params.attach_stdin)
62
+ throw new TypeError("attach_stdin requires cmd.execAsync");
63
+ return (await start(command, params, options)).result(options);
64
+ },
65
+ };
66
+ }
67
+ getInfo(options) {
68
+ return this.client.devboxes.retrieve(this.id, options);
69
+ }
70
+ shutdown(options) {
71
+ return this.client.devboxes.shutdown(this.id, {}, options);
72
+ }
73
+ suspend(options) {
74
+ return this.client.devboxes.suspend(this.id, options);
75
+ }
76
+ resume(options) {
77
+ return this.client.devboxes.resume(this.id, options);
78
+ }
79
+ }
80
+ export class Execution {
81
+ client;
82
+ devboxId;
83
+ executionId;
84
+ streamingPromise;
85
+ constructor(client, devboxId, executionId, _initialResult, streamingPromise) {
86
+ this.client = client;
87
+ this.devboxId = devboxId;
88
+ this.executionId = executionId;
89
+ this.streamingPromise = streamingPromise;
90
+ }
91
+ async sendStdIn(input, options) {
92
+ await this.input({ text: input }, options);
93
+ }
94
+ async closeStdIn(options) {
95
+ await this.input({ signal: "EOF" }, options);
96
+ }
97
+ async input(body, options) {
98
+ const response = await this.client.devboxes.executions.sendStdIn(this.devboxId, this.executionId, body, options);
99
+ if (!response.success)
100
+ throw new RunloopError(`Failed to send stdin to execution ${this.executionId}`);
101
+ }
102
+ getState(options) {
103
+ return this.client.devboxes.executions.retrieve(this.devboxId, this.executionId, {}, options);
104
+ }
105
+ async kill(options) {
106
+ await this.client.devboxes.executions.kill(this.devboxId, this.executionId, {}, options);
107
+ }
108
+ async result(options = {}) {
109
+ only("Runloop execution result; use Runtime process waits for other wait options", options, [
110
+ "signal",
111
+ "timeout",
112
+ "idempotencyKey",
113
+ ]);
114
+ const [command] = await Promise.allSettled([
115
+ this.client.devboxes.executions.awaitCompleted(this.devboxId, this.executionId, options),
116
+ this.streamingPromise,
117
+ ]);
118
+ if (command.status === "rejected")
119
+ throw command.reason;
120
+ return new ExecutionResult(this.client, this.devboxId, this.executionId, command.value);
121
+ }
122
+ }
123
+ export class ExecutionResult {
124
+ client;
125
+ devboxId;
126
+ executionId;
127
+ result;
128
+ constructor(client, devboxId, executionId, result) {
129
+ this.client = client;
130
+ this.devboxId = devboxId;
131
+ this.executionId = executionId;
132
+ this.result = result;
133
+ }
134
+ get exitCode() {
135
+ return this.result.exit_status ?? null;
136
+ }
137
+ get success() {
138
+ return this.exitCode === 0;
139
+ }
140
+ get failed() {
141
+ return this.exitCode !== null && this.exitCode !== 0;
142
+ }
143
+ stdout(numLines) {
144
+ return this.output("stdout", numLines);
145
+ }
146
+ stderr(numLines) {
147
+ return this.output("stderr", numLines);
148
+ }
149
+ async output(channel, numLines) {
150
+ let output = this.result[channel] ?? "";
151
+ if (this.result[`${channel}_truncated`] &&
152
+ (numLines === undefined || output.split("\n").filter(Boolean).length < numLines)) {
153
+ output = "";
154
+ const executions = this.client.devboxes.executions;
155
+ const stream = channel === "stdout"
156
+ ? executions.streamStdoutUpdates(this.devboxId, this.executionId)
157
+ : executions.streamStderrUpdates(this.devboxId, this.executionId);
158
+ for await (const chunk of stream)
159
+ output += chunk.output;
160
+ }
161
+ if (numLines === undefined)
162
+ return output;
163
+ if (numLines <= 0)
164
+ return "";
165
+ return output.replace(/\n+$/, "").split("\n").slice(-numLines).join("\n");
166
+ }
167
+ }
package/dist/sandbox.d.ts CHANGED
@@ -8,9 +8,14 @@ import type { StreamUploadSource } from "./file-source.js";
8
8
  import { Machine, type MachineProduct } from "./machine.js";
9
9
  /** Sandboxes, as a product of the machine engine (machine.ts). */
10
10
  export declare const SANDBOXES: MachineProduct;
11
+ /** How long past its timeoutMs a streamed exec waits for an exit that never came. */
12
+ export declare const EXEC_EXIT_GRACE: {
13
+ ms: number;
14
+ };
11
15
  /** A running (or stopped) sandbox. Every method is one API call or a short
12
- * sequence of them; `await using sbx = await Sandbox.create()` stops it for
13
- * you at the end of the block. */
16
+ * sequence of them; `await using sbx = await Sandbox.create()` deletes it at
17
+ * the end of the block, or stops it, keeping its disk, if created with
18
+ * `keep: true`. */
14
19
  export interface Sandbox extends SandboxExtensions {
15
20
  }
16
21
  export declare class Sandbox extends Machine<SandboxInfo, SandboxSettings, DeletedSandbox> {
package/dist/sandbox.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { STREAMED_EXEC_TIMEOUT_MS } from "./api-defaults.js";
2
2
  import { CommandError, ConnectionError, DELIBERATE, errorFor, NotFoundError, RateLimitError, RuntimeError, ServiceUnavailableError, } from "./errors.js";
3
3
  import { sandboxWatches, watchDirectory, } from "./products/watch.js";
4
- import { Transport } from "./transport.js";
4
+ import { Transport, timeoutSignal } from "./transport.js";
5
5
  import { sandboxFactories } from "./products/index.js";
6
6
  import { Tunnel } from "./tunnel.js";
7
7
  import { pause } from "./wait.js";
@@ -20,7 +20,7 @@ const enc = (id) => encodeURIComponent(id);
20
20
  function requestScope(options) {
21
21
  const deadline = options.timeoutMs === undefined || options.timeoutMs === 0
22
22
  ? undefined
23
- : AbortSignal.timeout(options.timeoutMs);
23
+ : timeoutSignal(options.timeoutMs);
24
24
  const signal = deadline && options.signal
25
25
  ? AbortSignal.any([deadline, options.signal])
26
26
  : (deadline ?? options.signal);
@@ -87,6 +87,8 @@ function commandBody(command, options) {
87
87
  ...(options.timeoutMs === undefined ? {} : { timeoutMs: options.timeoutMs }),
88
88
  };
89
89
  }
90
+ /** How long past its timeoutMs a streamed exec waits for an exit that never came. */
91
+ export const EXEC_EXIT_GRACE = { ms: 120_000 };
90
92
  // eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
91
93
  export class Sandbox extends Machine {
92
94
  #t;
@@ -147,8 +149,22 @@ export class Sandbox extends Machine {
147
149
  let exit;
148
150
  let processId;
149
151
  let dropped = false;
152
+ // A command with a time limit ends by it, the server killing it if need
153
+ // be; an exit that never comes after (a follow that resumes forever)
154
+ // ends the wait past the limit and EXEC_EXIT_GRACE.ms, as a timeout,
155
+ // its process named and sent SIGTERM. The hub's release train waited
156
+ // 29 min on a 10 min command (15 October 2026).
157
+ // A timer cleared when the call ends, so none outlives the exec.
158
+ const deadline = options.timeoutMs === undefined ? undefined : new AbortController();
159
+ const timer = deadline
160
+ ? setTimeout(() => deadline.abort(), options.timeoutMs + EXEC_EXIT_GRACE.ms)
161
+ : undefined;
162
+ timer?.unref?.();
163
+ const signal = deadline && options.signal
164
+ ? AbortSignal.any([options.signal, deadline.signal])
165
+ : (deadline?.signal ?? options.signal);
150
166
  try {
151
- for await (const event of this.execStream(command, options)) {
167
+ for await (const event of this.execStream(command, { ...options, signal })) {
152
168
  if (event.type === "start")
153
169
  processId = event.processId;
154
170
  else if (event.type === "stdout" || event.type === "stderr") {
@@ -162,7 +178,16 @@ export class Sandbox extends Machine {
162
178
  }
163
179
  }
164
180
  catch (error) {
165
- throw await this.#unfinished(error, processId, options.signal);
181
+ if (!deadline?.signal.aborted || options.signal?.aborted)
182
+ throw await this.#unfinished(error, processId, signal);
183
+ if (processId)
184
+ await new Process(this.#t, this.id, { id: processId })
185
+ .kill("SIGTERM")
186
+ .catch(() => { });
187
+ exit = { type: "exit", exitCode: null, timedOut: true };
188
+ }
189
+ finally {
190
+ clearTimeout(timer);
166
191
  }
167
192
  result = {
168
193
  exitCode: exit?.exitCode ?? null,
@@ -171,6 +196,7 @@ export class Sandbox extends Machine {
171
196
  ...truncation(dropped),
172
197
  ...(exit?.durationMs === undefined ? {} : { durationMs: exit.durationMs }),
173
198
  ...(processId ? { processId } : {}),
199
+ ...(exit?.outOfMemory ? { outOfMemory: exit.outOfMemory } : {}),
174
200
  };
175
201
  }
176
202
  if (options.check && (result.exitCode !== 0 || result.timedOut))
@@ -196,8 +222,8 @@ export class Sandbox extends Machine {
196
222
  code: "cancelled",
197
223
  status: 0,
198
224
  hint: stopped
199
- ? `See what it printed: runtime sandbox logs ${id}`
200
- : `Stop it: runtime sandbox kill ${id}, or sandbox.processes.get("${processId}") and kill().`,
225
+ ? `See what it printed: runtime sandboxes logs ${id}`
226
+ : `Stop it: runtime sandboxes kill ${id}, or sandbox.processes.get("${processId}") and kill().`,
201
227
  details: { sandboxId: this.id, processId, stopped },
202
228
  cause: error,
203
229
  });
@@ -208,7 +234,7 @@ export class Sandbox extends Machine {
208
234
  message: `Lost the output of process ${processId}; the command may still be running.`,
209
235
  code: "connection_error",
210
236
  status: 0,
211
- hint: `Follow it: runtime sandbox logs ${id} -f (sandbox.processes.get("${processId}")), or stop it: runtime sandbox kill ${id}.`,
237
+ hint: `Follow it: runtime sandboxes logs ${id} -f (sandbox.processes.get("${processId}")), or stop it: runtime sandboxes kill ${id}.`,
212
238
  details: { sandboxId: this.id, processId },
213
239
  cause: error,
214
240
  });
@@ -544,7 +570,7 @@ export class Processes {
544
570
  message: `Lost the output stream of process ${processId} for ${FOLLOW_OUTAGE_MS / 60_000} minutes; the command may still be running.`,
545
571
  code: "connection_error",
546
572
  status: 0,
547
- hint: `Follow it again: runtime sandbox logs ${this.sandboxId} ${processId} -f`,
573
+ hint: `Follow it again: runtime sandboxes logs ${this.sandboxId} ${processId} -f`,
548
574
  details: { sandboxId: this.sandboxId, processId },
549
575
  cause: failure,
550
576
  });
@@ -555,7 +581,7 @@ export class Processes {
555
581
  message: `The output stream of process ${processId} keeps closing before it ends.`,
556
582
  code: "connection_error",
557
583
  status: 0,
558
- hint: `Read what it printed so far: runtime sandbox logs ${this.sandboxId} ${processId}`,
584
+ hint: `Read what it printed so far: runtime sandboxes logs ${this.sandboxId} ${processId}`,
559
585
  details: { sandboxId: this.sandboxId, processId },
560
586
  });
561
587
  }
@@ -647,6 +673,7 @@ export class Process {
647
673
  ...this.info,
648
674
  state: exit.state,
649
675
  exitCode: exit.exitCode,
676
+ ...(exit.outOfMemory ? { outOfMemory: exit.outOfMemory } : {}),
650
677
  };
651
678
  return {
652
679
  exitCode: exit?.exitCode ?? null,
@@ -654,6 +681,7 @@ export class Process {
654
681
  timedOut: exit?.timedOut ?? false,
655
682
  ...truncation(dropped),
656
683
  processId: this.id,
684
+ ...(exit?.outOfMemory ? { outOfMemory: exit.outOfMemory } : {}),
657
685
  };
658
686
  }
659
687
  /** Sends input. Offsets protect transport retries; signal and timeoutMs cover
@@ -1268,9 +1296,11 @@ export class Files {
1268
1296
  const data = await readFile(localPath);
1269
1297
  const mode = info.mode & 0o777;
1270
1298
  await this.write(remotePath, data, { mode }).catch(async (error) => {
1271
- // A missing parent is made, as a directory upload makes its own.
1299
+ // Make a missing parent, but keep errors about the sandbox or upload.
1272
1300
  const parent = remotePath.slice(0, remotePath.lastIndexOf("/"));
1273
- if (!(error instanceof NotFoundError) || !parent)
1301
+ if (!(error instanceof NotFoundError) ||
1302
+ (error.code !== "file_not_found" && error.code !== "path_not_found") ||
1303
+ !parent)
1274
1304
  throw error;
1275
1305
  await this.mkdir(parent, { parents: true });
1276
1306
  await this.write(remotePath, data, { mode });
@@ -0,0 +1,11 @@
1
+ /** `withruntime/sandboxes`: Sandboxes alone. Linux microVMs: create, find and list sandboxes.
2
+ *
3
+ * import { sandboxes } from "withruntime/sandboxes";
4
+ * const client = sandboxes(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime, type RuntimeOptions } from "../client.js";
7
+ export { Sandbox } from "../index.js";
8
+ export { Sandboxes } from "../client.js";
9
+ export type * from "../types.js";
10
+ /** `runtime.sandboxes` of a client made with `options`. */
11
+ export declare function sandboxes(options?: RuntimeOptions): Runtime["sandboxes"];
@@ -0,0 +1,12 @@
1
+ /** `withruntime/sandboxes`: Sandboxes alone. Linux microVMs: create, find and list sandboxes.
2
+ *
3
+ * import { sandboxes } from "withruntime/sandboxes";
4
+ * const client = sandboxes(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime } from "../client.js";
7
+ export { Sandbox } from "../index.js";
8
+ export { Sandboxes } from "../client.js";
9
+ /** `runtime.sandboxes` of a client made with `options`. */
10
+ export function sandboxes(options) {
11
+ return new Runtime(options).sandboxes;
12
+ }
@@ -0,0 +1,9 @@
1
+ /** `withruntime/snapshots`: Snapshots alone. Saved sandboxes, disk and memory, to start or fork from.
2
+ *
3
+ * import { snapshots } from "withruntime/snapshots";
4
+ * const client = snapshots(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime, type RuntimeOptions } from "../client.js";
7
+ export { Snapshots, type Snapshot, type SnapshotOptions } from "../snapshots.js";
8
+ /** `runtime.snapshots` of a client made with `options`. */
9
+ export declare function snapshots(options?: RuntimeOptions): Runtime["snapshots"];
@@ -0,0 +1,11 @@
1
+ /** `withruntime/snapshots`: Snapshots alone. Saved sandboxes, disk and memory, to start or fork from.
2
+ *
3
+ * import { snapshots } from "withruntime/snapshots";
4
+ * const client = snapshots(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime } from "../client.js";
7
+ export { Snapshots } from "../snapshots.js";
8
+ /** `runtime.snapshots` of a client made with `options`. */
9
+ export function snapshots(options) {
10
+ return new Runtime(options).snapshots;
11
+ }
@@ -17,7 +17,8 @@ export type Snapshot = {
17
17
  diskMiB: number;
18
18
  memoryGuarantee: string;
19
19
  };
20
- retentionDays: number;
20
+ /** Null: kept while your account has credit, up to a year from when it was taken. */
21
+ retentionDays: number | null;
21
22
  /** True while raw fork memory awaits verified compression. The snapshot
22
23
  * remains ready for starts on its current host, with no storage charge or
23
24
  * off-host copy until final publication. Absent on older servers. */
@@ -39,7 +40,8 @@ export type Snapshot = {
39
40
  error: string | null;
40
41
  createdAt: string;
41
42
  readyAt: string | null;
42
- expiresAt: string;
43
+ /** Null while it is kept as long as your account has credit. */
44
+ expiresAt: string | null;
43
45
  [key: string]: unknown;
44
46
  };
45
47
  export type SnapshotOptions = {
@@ -47,7 +49,8 @@ export type SnapshotOptions = {
47
49
  mode?: "memory" | "disk";
48
50
  name?: string;
49
51
  labels?: Record<string, string>;
50
- retentionDays?: number;
52
+ /** Days, or null to keep it while your account has credit. */
53
+ retentionDays?: number | null;
51
54
  };
52
55
  /** `runtime.snapshots`. Take one with `sbx.snapshot()`, start from one with
53
56
  * `runtime.sandboxes.create({ snapshot: id })`, or do both with `sbx.fork()`. */
@@ -71,5 +74,5 @@ export declare class Snapshots {
71
74
  ifLabels?: Record<string, string>;
72
75
  }, options?: RequestOptions): Promise<Snapshot>;
73
76
  delete(id: string, options?: RequestOptions): Promise<void>;
74
- extend(id: string, retentionDays: number, options?: RequestOptions): Promise<Snapshot>;
77
+ extend(id: string, retentionDays: number | null, options?: RequestOptions): Promise<Snapshot>;
75
78
  }