withruntime 0.48.1 → 0.50.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.
@@ -6,7 +6,7 @@
6
6
  // is older. Nothing is asked on any other path, in CI, or when
7
7
  // RUNTIME_NO_UPDATE_CHECK is set.
8
8
  import { envFetch } from "./proxy.js";
9
- import { VERSION } from "./transport.js";
9
+ import { timeoutSignal, VERSION } from "./transport.js";
10
10
  export const LATEST_URL = "https://registry.npmjs.org/withruntime/latest";
11
11
  const ASK_MS = 1_500;
12
12
  const parts = (v) => /^(\d+)\.(\d+)\.(\d+)$/.exec(v.trim())?.slice(1).map(Number);
@@ -31,7 +31,7 @@ export async function outdatedLine(opts) {
31
31
  try {
32
32
  const response = await (opts.fetch ?? envFetch)(LATEST_URL, {
33
33
  headers: { accept: "application/json" },
34
- signal: AbortSignal.timeout(opts.timeoutMs ?? ASK_MS),
34
+ signal: timeoutSignal(opts.timeoutMs ?? ASK_MS),
35
35
  });
36
36
  if (!response.ok)
37
37
  return "";
package/dist/cli.js CHANGED
@@ -1400,8 +1400,11 @@ export async function run(argv, env = process.env, out = defaultOut(argv)) {
1400
1400
  return (await import("./apps-cli.js")).containersCommand(rest, env, out, () => client(env), kit);
1401
1401
  }
1402
1402
  if (["browser", "browsers", "desktop", "desktops"].includes(command)) {
1403
- product = command.endsWith("s") ? command : `${command}s`;
1404
- return (await import("./browsers-cli.js")).machineProductCommand(product, rest, out, () => client(env), kit);
1403
+ // Its own constant: `product` is the module's, and another run in the same
1404
+ // process can change it while the import is awaited.
1405
+ const which = (command.endsWith("s") ? command : `${command}s`);
1406
+ product = which;
1407
+ return (await import("./browsers-cli.js")).machineProductCommand(which, rest, out, () => client(env), kit);
1405
1408
  }
1406
1409
  if (command === "agent" || command === "agents") {
1407
1410
  product = "agents";
@@ -1576,6 +1579,8 @@ function usageSummary(u) {
1576
1579
  rows.push(["expired or taken back", dollars(micros(u.expired))]);
1577
1580
  if (u.trial)
1578
1581
  rows.push(["free time", trialLeft(u.trial)]);
1582
+ if (u.freeUsageHold)
1583
+ rows.push(["no free time", u.freeUsageHold.message]);
1579
1584
  if (u.allowances)
1580
1585
  rows.push(...allowanceRows(u.allowances));
1581
1586
  // Only a data property is an older server's answer. Do not invoke SDK
@@ -2302,7 +2307,7 @@ async function sandbox(argv, env, out) {
2302
2307
  case "never-park": {
2303
2308
  // Runtime's own operator only, so not in the help: the release path's
2304
2309
  // sandboxes (the release signer's, the agents' hub) are never parked to
2305
- // make room (Marc, 28 October 2026). The API refuses it for any other
2310
+ // make room (28 October 2026). The API refuses it for any other
2306
2311
  // organization, and for a key that is not an owner's, an admin's or
2307
2312
  // account-wide (20261028190617_cloud_never_park.sql).
2308
2313
  const args = parse(rest, [], []);
@@ -1,5 +1,5 @@
1
1
  import { RuntimeError } from "./errors.js";
2
- export declare const VERSION = "0.48.1";
2
+ export declare const VERSION = "0.50.0";
3
3
  export declare const DEFAULT_BASE_URL = "https://api.withruntime.com";
4
4
  /** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
5
5
  * own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
package/dist/transport.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ConnectionError, DELIBERATE, errorFor, NOTHING_RAN, RuntimeError, WAITS_FOR_ROOM, } from "./errors.js";
2
2
  import { describeRoute, envFetch, openWebSocket, untrustedCertificate } from "./proxy.js";
3
3
  import { warningText } from "./product-renames.js";
4
- export const VERSION = "0.48.1";
4
+ export const VERSION = "0.50.0";
5
5
  export const DEFAULT_BASE_URL = "https://api.withruntime.com";
6
6
  /** Runtime's API as code inside a Runtime sandbox reaches it: the sandbox's
7
7
  * own host sends each request on to DEFAULT_BASE_URL over HTTPS. The API runs
package/dist/types.d.ts CHANGED
@@ -38,6 +38,9 @@ export type SandboxInfo = {
38
38
  /** Runs until stopped while credit lasts, never paused for idleness or a
39
39
  * time limit, and its disk is kept after a stop. */
40
40
  persistent?: boolean;
41
+ /** Runtime may delete it once it has been paused or stopped for 15 minutes
42
+ * and its server needs the disk. Absent from APIs before 30 October 2026. */
43
+ evictable?: boolean;
41
44
  /** The last exec, file, terminal, desktop or preview request, to within a minute. */
42
45
  lastActiveAt?: string | null;
43
46
  /** What happens when its time limit, credit or a spending limit ends it. */
@@ -198,6 +201,11 @@ export type CreateSandbox = {
198
201
  * snapshot is kept, so a `snapshot` with `spreadFrom` naming its server also
199
202
  * answers `no_capacity`. */
200
203
  spreadFrom?: string[];
204
+ /** When true, Runtime may delete the sandbox once it has been paused or
205
+ * stopped for at least 15 minutes and its server needs the disk, the one
206
+ * idle longest first; a running one is never deleted for it. For work you
207
+ * can recreate, such as build caches and CI machines. Default false. */
208
+ evictable?: boolean;
201
209
  /** Up to four volumes: read-write ("rw", one sandbox at a time) or a
202
210
  * read-only "snapshot" copy. */
203
211
  volumes?: {
@@ -381,7 +389,9 @@ export type Usage = {
381
389
  * milliseconds, or null when it has none. `totalMs` and `usedMs` count free
382
390
  * hours given before 5 October 2026 (0 for an account given none);
383
391
  * `availableMs` is the larger of those hours left and this month's included
384
- * usage, as time at 2 vCPU and 4 GiB. The field keeps its older name. */
392
+ * usage, as time at 2 vCPU and 4 GiB, after what running sandboxes hold: a
393
+ * create without credit is refused exactly when it is 0. The field keeps
394
+ * its older name. */
385
395
  trial: {
386
396
  totalMs: number;
387
397
  usedMs: number;
@@ -395,6 +405,15 @@ export type Usage = {
395
405
  /** When the free usage renews: the 1st of next month, 00:00 UTC. */
396
406
  renewsAt?: string;
397
407
  } | null;
408
+ /** Why the account has no free machine time, or null: `reason` is
409
+ * `withheld`, `hosting` (opened from a data-center or VPN network),
410
+ * `region` (opened outside the listed countries), `card` (opened by email,
411
+ * no card saved yet), `no-source` or `unknown`, and `message` says it and
412
+ * what starts it. Absent from an API older than 30 October 2026. */
413
+ freeUsageHold?: {
414
+ reason: string;
415
+ message: string;
416
+ } | null;
398
417
  /** What the account uses free this calendar month (UTC), one row per
399
418
  * product, drawn before credit and never charged
400
419
  * (https://withruntime.com/docs/included-usage). */
@@ -525,6 +544,9 @@ export type SandboxSettings = {
525
544
  * seconds; null the default again. A running one is renewed by it within
526
545
  * seconds. */
527
546
  leaseSeconds?: number | null;
547
+ /** True lets Runtime delete it once it has been paused or stopped for 15
548
+ * minutes and its server needs the disk; false keeps it. */
549
+ evictable?: boolean;
528
550
  /** Keep it running until you stop it, while credit lasts, and keep its disk
529
551
  * after a stop. Paid only. */
530
552
  persistent?: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "withruntime",
3
- "version": "0.48.1",
3
+ "version": "0.50.0",
4
4
  "license": "Apache-2.0",
5
5
  "mcpName": "com.withruntime/runtime",
6
6
  "type": "module",