withruntime 0.33.3 → 0.35.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 (49) hide show
  1. package/E2B.md +7 -0
  2. package/dist/agents-cli.d.ts +1 -1
  3. package/dist/agents-cli.js +171 -7
  4. package/dist/agents-deploy.d.ts +13 -3
  5. package/dist/agents-deploy.js +68 -9
  6. package/dist/apps-cli.d.ts +1 -1
  7. package/dist/apps-cli.js +41 -9
  8. package/dist/browsers/index.d.ts +9 -0
  9. package/dist/browsers/index.js +10 -0
  10. package/dist/browsers-cli.d.ts +13 -0
  11. package/dist/browsers-cli.js +160 -0
  12. package/dist/ci-cli.d.ts +1 -1
  13. package/dist/ci-cli.js +16 -3
  14. package/dist/cli-words.js +1 -0
  15. package/dist/cli.d.ts +4 -0
  16. package/dist/cli.js +103 -12
  17. package/dist/desktops/index.d.ts +9 -0
  18. package/dist/desktops/index.js +10 -0
  19. package/dist/e2b/code-interpreter.d.ts +3 -12
  20. package/dist/e2b/code-interpreter.js +3 -6
  21. package/dist/e2b/index.d.ts +7 -1
  22. package/dist/e2b/index.js +9 -2
  23. package/dist/functions/index.d.ts +10 -0
  24. package/dist/functions/index.js +11 -0
  25. package/dist/index.d.ts +5 -3
  26. package/dist/products/agents.d.ts +162 -8
  27. package/dist/products/agents.js +108 -3
  28. package/dist/products/apps.d.ts +46 -5
  29. package/dist/products/browsers.d.ts +26 -0
  30. package/dist/products/browsers.js +11 -0
  31. package/dist/products/ci.d.ts +10 -4
  32. package/dist/products/ci.js +8 -0
  33. package/dist/products/desktops.d.ts +71 -0
  34. package/dist/products/desktops.js +27 -0
  35. package/dist/products/functions.d.ts +2 -0
  36. package/dist/products/functions.js +5 -0
  37. package/dist/products/index.d.ts +6 -0
  38. package/dist/products/index.js +8 -0
  39. package/dist/products/network.d.ts +4 -2
  40. package/dist/products/secrets.d.ts +10 -2
  41. package/dist/products/secrets.js +27 -7
  42. package/dist/products/uptime.d.ts +97 -0
  43. package/dist/products/uptime.js +42 -0
  44. package/dist/products/volumes.d.ts +41 -9
  45. package/dist/products/volumes.js +5 -2
  46. package/dist/transport.d.ts +4 -1
  47. package/dist/transport.js +2 -2
  48. package/dist/types.d.ts +15 -3
  49. package/package.json +17 -1
package/dist/cli.js CHANGED
@@ -69,7 +69,9 @@ Account
69
69
  (job create --secret NAME); with --host, both
70
70
  secrets scope <NAME> --only-label k=v... | --only-sandbox <id>... | --only-app <id>... | --all-sandboxes
71
71
  Change which sandboxes get it; no value needed
72
- secrets ls | get <NAME> Names, hosts, placeholders and jobs versions, never values
72
+ secrets ls [--limit N] [--after NAME] | get <NAME>
73
+ Names, hosts, placeholders and jobs versions, never values;
74
+ by name, a page of N after NAME
73
75
  secrets rotate <NAME> A new version of the jobs copy, from standard input
74
76
  secrets reveal <NAME> [--version N] Print the jobs copy's value. The sandboxes' copy is
75
77
  never readable, by anyone
@@ -136,6 +138,8 @@ Products
136
138
  builds A connected repository's commits built into what an App deploys (beta)
137
139
  ci CI/CD: each push and pull request of a repository checked in sandboxes (beta)
138
140
  containers One OCI image's process on its own microVM, at the sandbox rates (beta)
141
+ browsers Chromium on its own sandbox: a CDP address and screenshots (beta)
142
+ desktops A Linux desktop on its own sandbox: live view, computer use (beta)
139
143
  agents Claude Code, Codex, Gemini CLI or your own agent in a sandbox per session (beta)
140
144
  domains Your own hostname for a sandbox's port, with HTTPS
141
145
  ports A public TCP port to a sandbox: databases, game servers
@@ -164,6 +168,8 @@ const SANDBOX_HELP = `runtime sandboxes <command>
164
168
  [--image <name:tag|imageId> | --snapshot <snapshotId>] [--volume <volumeId>:/data[:snapshot]]...
165
169
  [--spread-from <id>]... [--secret NAME]... [--no-secrets]
166
170
  [--idle-pause <seconds>] [--no-auto-wake] [--persistent] [--get-or-create]
171
+ [--user root|sandbox] --user root: its commands, processes and
172
+ shells run as root unless one says otherwise
167
173
  Create one; prints its id
168
174
  ls [--all] [--label k=v]... [--state running] List (live ones unless --all)
169
175
  get <id> One sandbox, in full
@@ -198,7 +204,7 @@ const SANDBOX_HELP = `runtime sandboxes <command>
198
204
  resize <id> --disk 20480 Grow a running sandbox's disk live, programs running
199
205
  extend <id> <seconds> Move a time limit on (one with none needs nothing)
200
206
  update <id> [--name n] [--label k=v]... [--env K[=V]]... [--unset-env K]... [--idle-pause <seconds>] [--auto-wake on|off]
201
- [--persistent on|off] [--max-total-cost <usd>|none]
207
+ [--persistent on|off] [--max-total-cost <usd>|none] [--user root|sandbox]
202
208
  [--timeout <60-86400 from now>|0] [--on-timeout pause|stop|delete]
203
209
  Change its settings; persistent keeps it running until stopped;
204
210
  --env K alone sends K's value from your own environment,
@@ -476,6 +482,8 @@ const COMMANDS = [
476
482
  "builds",
477
483
  "ci",
478
484
  "containers",
485
+ "browsers",
486
+ "desktops",
479
487
  "agents",
480
488
  "domains",
481
489
  "ports",
@@ -500,6 +508,8 @@ const OWN_HELP = [
500
508
  "builds",
501
509
  "ci",
502
510
  "containers",
511
+ "browsers",
512
+ "desktops",
503
513
  "agents",
504
514
  "keys",
505
515
  "reservations",
@@ -643,6 +653,7 @@ function describe(info) {
643
653
  ...(info.endedAt ? [["ended", info.endedAt]] : []),
644
654
  ...(info.stopReason ? [["stop reason", info.stopReason]] : []),
645
655
  ["auto wake", info.autoWake === false ? "off" : "on"],
656
+ ["runs as", info.user === "root" ? "root" : "sandbox user"],
646
657
  [
647
658
  "idle pause",
648
659
  info.idlePauseSeconds
@@ -872,6 +883,8 @@ export async function run(argv, env = process.env, out = defaultOut(argv)) {
872
883
  const rt = await client(env);
873
884
  const cursors = new Set();
874
885
  let cursor;
886
+ // The export is final only as far as its earliest page's finalThrough.
887
+ let finalThrough;
875
888
  for (;;) {
876
889
  const page = await rt.usageExport({
877
890
  since,
@@ -891,8 +904,19 @@ export async function run(argv, env = process.env, out = defaultOut(argv)) {
891
904
  else if (page.csv)
892
905
  out.write(page.csv);
893
906
  await out.drain?.();
894
- if (page.nextCursor === null)
907
+ const at = page.finalThrough;
908
+ finalThrough =
909
+ finalThrough === undefined
910
+ ? at
911
+ : finalThrough === null || at === null
912
+ ? null
913
+ : at < finalThrough
914
+ ? at
915
+ : finalThrough;
916
+ if (page.nextCursor === null) {
917
+ out.error(finalLine({ until: page.until, finalThrough: finalThrough ?? null }));
895
918
  return 0;
919
+ }
896
920
  cursors.add(page.nextCursor);
897
921
  cursor = page.nextCursor;
898
922
  }
@@ -1351,6 +1375,10 @@ export async function run(argv, env = process.env, out = defaultOut(argv)) {
1351
1375
  product = "containers";
1352
1376
  return (await import("./apps-cli.js")).containersCommand(rest, env, out, () => client(env), kit);
1353
1377
  }
1378
+ if (["browser", "browsers", "desktop", "desktops"].includes(command)) {
1379
+ product = command.endsWith("s") ? command : `${command}s`;
1380
+ return (await import("./browsers-cli.js")).machineProductCommand(product, rest, out, () => client(env), kit);
1381
+ }
1354
1382
  if (command === "agent" || command === "agents") {
1355
1383
  product = "agents";
1356
1384
  return (await import("./agents-cli.js")).agentsCommand(rest, env, out, () => client(env), kit);
@@ -1365,6 +1393,15 @@ export async function run(argv, env = process.env, out = defaultOut(argv)) {
1365
1393
  }
1366
1394
  throw unknown("command", command, COMMANDS);
1367
1395
  }
1396
+ /** `usage export`'s last word, on stderr beside the CSV: how much of the
1397
+ * range can still change. */
1398
+ export function finalLine(page) {
1399
+ if (page.finalThrough === null)
1400
+ return "Charges in this range may still settle; export it again later for a final copy.";
1401
+ if (Date.parse(page.finalThrough) >= Date.parse(page.until))
1402
+ return "Final: no more charges will settle in this range.";
1403
+ return `Final up to ${page.finalThrough}; charges after that may still settle. Export again later for the rest.`;
1404
+ }
1368
1405
  /** `runtime usage` for a person: the balance, the free usage and what each kind
1369
1406
  * of resource was charged, in dollars. --json keeps every figure, and each
1370
1407
  * resource with its rates and CPU time. */
@@ -2184,6 +2221,7 @@ async function sandbox(argv, env, out) {
2184
2221
  "max-total-cost",
2185
2222
  "timeout",
2186
2223
  "on-timeout",
2224
+ "user",
2187
2225
  ]);
2188
2226
  const sbx = await get(args.positional[0]);
2189
2227
  const onOff = (name) => {
@@ -2213,6 +2251,7 @@ async function sandbox(argv, env, out) {
2213
2251
  : {}),
2214
2252
  ...(onOff("auto-wake") === undefined ? {} : { autoWake: onOff("auto-wake") }),
2215
2253
  ...(onOff("persistent") === undefined ? {} : { persistent: onOff("persistent") }),
2254
+ ...(flag(args, "user") ? { user: oneOf(args, "user", ["sandbox", "root"]) } : {}),
2216
2255
  ...(cost === undefined
2217
2256
  ? {}
2218
2257
  : {
@@ -2224,7 +2263,7 @@ async function sandbox(argv, env, out) {
2224
2263
  ...(onTimeout === undefined ? {} : { onTimeout }),
2225
2264
  };
2226
2265
  if (!Object.keys(settings).length)
2227
- throw usage("Say what to change: --name, --label, --env, --unset-env, --idle-pause, --auto-wake, --persistent, --max-total-cost, --timeout or --on-timeout.");
2266
+ throw usage("Say what to change: --name, --label, --env, --unset-env, --idle-pause, --auto-wake, --persistent, --user, --max-total-cost, --timeout or --on-timeout.");
2228
2267
  await sbx.update(settings);
2229
2268
  print(describe(sbx.info), sbx.info);
2230
2269
  return 0;
@@ -2689,6 +2728,8 @@ read = readSecret) {
2689
2728
  "only-app",
2690
2729
  "agent",
2691
2730
  "env",
2731
+ "limit",
2732
+ "after",
2692
2733
  ]);
2693
2734
  const print = (human, value) => out.write(out.json ? JSON.stringify(value) : human);
2694
2735
  const rows = (list) => list.length
@@ -2706,11 +2747,19 @@ read = readSecret) {
2706
2747
  ])
2707
2748
  : "No secrets.";
2708
2749
  if (verb === "ls" || verb === "list" || verb === undefined) {
2750
+ const limit = integer(args, "limit");
2751
+ if (limit !== undefined && (limit < 1 || limit > 100))
2752
+ throw usage("--limit takes 1 to 100 secrets a page.");
2753
+ const after = flag(args, "after");
2709
2754
  const runtime = await client(env);
2710
- const all = await runtime.secrets.all();
2755
+ // A page of both copies by name, as the API pages each: an organization
2756
+ // keeps at most 50 secrets for sandboxes, so both are read whole.
2757
+ const every = (await runtime.secrets.all()).filter((s) => after === undefined || s.name > after);
2758
+ const all = limit === undefined ? every : every.slice(0, limit);
2759
+ const more = all.length < every.length ? all.at(-1).name : undefined;
2711
2760
  // --json keeps the sandboxes' list it always printed; the jobs copies
2712
2761
  // are in `runtime secrets get <NAME> --json`.
2713
- print(rows(all), all.flatMap((s) => (s.sandboxes ? [s.sandboxes] : [])));
2762
+ print(more ? `${rows(all)}\nMore: ${me} secrets ls --limit ${limit} --after ${more}` : rows(all), all.flatMap((s) => (s.sandboxes ? [s.sandboxes] : [])));
2714
2763
  return 0;
2715
2764
  }
2716
2765
  const jobsOnly = "Only a secret's copy for jobs has versions and can be read back";
@@ -4377,10 +4426,39 @@ const VOLUME_HELP = `runtime volumes <command>
4377
4426
  backup-rm <backupId> Delete a backup
4378
4427
  backup-policy <id> [--daily on|off] [--retention-days N]
4379
4428
  Daily backups on or off, and how long each is kept
4429
+ backup-policy <id> --every <minutes> | --cron "<m h dom mon dow>" [--keep hourly=24,daily=7,...]
4430
+ Back up on a schedule of its own (UTC), keeping
4431
+ last, hourly, daily, weekly, monthly, yearly counts
4432
+ backup-policy <id> --no-schedule Back to daily backups
4380
4433
  Attach one: runtime sandboxes create --volume <id>:/data
4381
- Volumes are backed up off their host daily unless you turn it off.
4434
+ Volumes are backed up off their host daily, or on their own schedule, unless you turn it off.
4382
4435
  Shared commands work where shared disks are enabled.
4383
4436
  `;
4437
+ const KEEP_TIERS = ["last", "hourly", "daily", "weekly", "monthly", "yearly"];
4438
+ /** `hourly=24,daily=7` as keep counts; the server checks the numbers. */
4439
+ function keepCounts(text) {
4440
+ const counts = {};
4441
+ for (const part of text.split(",")) {
4442
+ const [name, value, extra] = part.trim().split("=");
4443
+ const tier = KEEP_TIERS.find((t) => t === name);
4444
+ if (!tier || value === undefined || extra !== undefined || !/^\d+$/.test(value))
4445
+ throw usage(`--keep takes name=count pairs such as hourly=24,daily=7; names: ${KEEP_TIERS.join(", ")}.`);
4446
+ counts[tier] = Number(value);
4447
+ }
4448
+ return counts;
4449
+ }
4450
+ /** "daily backups on, kept 7 days", or the schedule, its keep counts and next run. */
4451
+ function backupPolicyWords(b) {
4452
+ if (!b.schedule)
4453
+ return `daily backups ${b.daily ? "on" : "off"}, kept ${b.retentionDays} days`;
4454
+ const when = "everyMinutes" in b.schedule
4455
+ ? `every ${b.schedule.everyMinutes} minutes`
4456
+ : `on cron "${b.schedule.cron.trim()}" (UTC)`;
4457
+ const kept = KEEP_TIERS.filter((t) => (b.keep?.[t] ?? 0) > 0)
4458
+ .map((t) => `${t} ${b.keep[t]}`)
4459
+ .join(", ");
4460
+ return `backups ${when}${b.daily ? "" : " (off)"}, keeping ${kept}${b.daily && b.nextAt ? `; next ${b.nextAt}` : ""}`;
4461
+ }
4384
4462
  async function volume(argv, env, out) {
4385
4463
  const [verb, ...rest] = argv;
4386
4464
  const print = (human, value) => out.write(out.json ? JSON.stringify(value) : human);
@@ -4489,7 +4567,7 @@ async function volume(argv, env, out) {
4489
4567
  String(b.sizeMiB),
4490
4568
  b.storedBytes === null ? "-" : `${Math.ceil(b.storedBytes / 1048576)} MiB`,
4491
4569
  b.createdAt,
4492
- b.expiresAt,
4570
+ b.expiresAt ?? "by keep counts",
4493
4571
  ]),
4494
4572
  ])
4495
4573
  : "No backups yet.", all);
@@ -4510,19 +4588,30 @@ async function volume(argv, env, out) {
4510
4588
  return 0;
4511
4589
  }
4512
4590
  case "backup-policy": {
4513
- const args = parse(rest, [], ["daily", "retention-days"]);
4591
+ const args = parse(rest, ["no-schedule"], ["daily", "retention-days", "every", "cron", "keep"]);
4514
4592
  const id = need(args.positional[0], "a volume id");
4515
4593
  const daily = flag(args, "daily");
4516
4594
  if (daily !== undefined && !["on", "off", "true", "false"].includes(daily))
4517
4595
  throw usage("--daily takes on or off.");
4518
4596
  const days = integer(args, "retention-days");
4519
- if (daily === undefined && days === undefined)
4520
- throw usage("Give --daily on|off, --retention-days N or both.");
4597
+ const every = integer(args, "every");
4598
+ const cron = flag(args, "cron");
4599
+ const off = has(args, "no-schedule");
4600
+ if ([every !== undefined, cron !== undefined, off].filter(Boolean).length > 1)
4601
+ throw usage("Give one of --every, --cron and --no-schedule.");
4602
+ const keepText = flag(args, "keep");
4603
+ const keep = keepText === undefined ? undefined : keepCounts(keepText);
4604
+ if ([daily, days, every, cron, keep].every((x) => x === undefined) && !off)
4605
+ throw usage("Give --daily on|off, --retention-days N, --every, --cron, --keep or --no-schedule.");
4521
4606
  const updated = await api.setBackupPolicy(id, {
4522
4607
  ...(daily === undefined ? {} : { daily: daily === "on" || daily === "true" }),
4523
4608
  ...(days === undefined ? {} : { retentionDays: days }),
4609
+ ...(every === undefined ? {} : { schedule: { everyMinutes: every } }),
4610
+ ...(cron === undefined ? {} : { schedule: { cron } }),
4611
+ ...(off ? { schedule: null } : {}),
4612
+ ...(keep === undefined ? {} : { keep }),
4524
4613
  });
4525
- print(`${updated.id} daily backups ${updated.backups.daily ? "on" : "off"}, kept ${updated.backups.retentionDays} days`, updated);
4614
+ print(`${updated.id} ${backupPolicyWords(updated.backups)}`, updated);
4526
4615
  return 0;
4527
4616
  }
4528
4617
  }
@@ -4624,6 +4713,7 @@ const CREATE_VALUES = [
4624
4713
  "secret",
4625
4714
  "volume",
4626
4715
  "env",
4716
+ "user",
4627
4717
  ];
4628
4718
  /** Dollars from the command line as integer microdollars: 25, 2.50 or 0.000001. */
4629
4719
  function usdMicros(args, name) {
@@ -4720,6 +4810,7 @@ function createInput(args, env) {
4720
4810
  ? { idlePauseSeconds: integer(args, "idle-pause") }
4721
4811
  : {}),
4722
4812
  ...(has(args, "no-auto-wake") ? { autoWake: false } : {}),
4813
+ ...(flag(args, "user") ? { user: oneOf(args, "user", ["sandbox", "root"]) } : {}),
4723
4814
  ...(has(args, "persistent") ? { persistent: true } : {}),
4724
4815
  ...(has(args, "get-or-create") ? { getOrCreate: true } : {}),
4725
4816
  ...(has(args, "trial")
@@ -0,0 +1,9 @@
1
+ /** `withruntime/desktops`: Desktops alone. A Linux desktop on its own sandbox, with a live view and computer use, at the sandbox rates. In a private beta.
2
+ *
3
+ * import { desktops } from "withruntime/desktops";
4
+ * const client = desktops(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime, type RuntimeOptions } from "../client.js";
7
+ export type * from "../products/desktops.js";
8
+ /** `runtime.desktops` of a client made with `options`. */
9
+ export declare function desktops(options?: RuntimeOptions): Runtime["desktops"];
@@ -0,0 +1,10 @@
1
+ /** `withruntime/desktops`: Desktops alone. A Linux desktop on its own sandbox, with a live view and computer use, at the sandbox rates. In a private beta.
2
+ *
3
+ * import { desktops } from "withruntime/desktops";
4
+ * const client = desktops(); // RUNTIME_API_KEY, or this machine's saved connection
5
+ */
6
+ import { Runtime } from "../client.js";
7
+ /** `runtime.desktops` of a client made with `options`. */
8
+ export function desktops(options) {
9
+ return new Runtime(options).desktops;
10
+ }
@@ -1,11 +1,4 @@
1
- /** `@e2b/code-interpreter`, on Runtime. Change the import:
2
- *
3
- * import { Sandbox } from "withruntime/e2b/code-interpreter";
4
- *
5
- * runCode runs in Runtime's interpreter (sandbox.runtime.interpreter):
6
- * stateful contexts in every E2B interpreter language. */
7
- import type { Runtime } from "../client.js";
8
- import type { ConnectionOpts } from "./client.js";
1
+ import { E2B as BaseE2B } from "./index.js";
9
2
  import { Sandbox as BaseSandbox } from "./sandbox.js";
10
3
  export * from "./index.js";
11
4
  export type RunCodeLanguage = "python" | "javascript" | "typescript" | "r" | "java" | "bash" | (string & {});
@@ -135,9 +128,7 @@ export declare class Sandbox extends BaseSandbox {
135
128
  }
136
129
  export default Sandbox;
137
130
  /** E2B's client with bound options, for the code interpreter. */
138
- export declare class E2B {
131
+ export declare class E2B extends BaseE2B {
132
+ protected static readonly sandboxClass: typeof BaseSandbox;
139
133
  readonly Sandbox: typeof Sandbox;
140
- constructor(opts?: Omit<ConnectionOpts, "signal"> & {
141
- client?: Runtime;
142
- });
143
134
  }
@@ -1,5 +1,5 @@
1
1
  import { guard, NotSupportedError, SandboxError, TimeoutError } from "./errors.js";
2
- import { bind } from "./index.js";
2
+ import { E2B as BaseE2B } from "./index.js";
3
3
  import { Sandbox as BaseSandbox } from "./sandbox.js";
4
4
  export * from "./index.js";
5
5
  /** A line of output, as E2B's callbacks receive it. */
@@ -234,9 +234,6 @@ export class Sandbox extends BaseSandbox {
234
234
  }
235
235
  export default Sandbox;
236
236
  /** E2B's client with bound options, for the code interpreter. */
237
- export class E2B {
238
- Sandbox;
239
- constructor(opts = {}) {
240
- this.Sandbox = bind(Sandbox, opts);
241
- }
237
+ export class E2B extends BaseE2B {
238
+ static sandboxClass = Sandbox;
242
239
  }
@@ -15,9 +15,15 @@ export type { ConnectionOpts, HttpVersion, RuntimeOpts } from "./client.js";
15
15
  export { Pty, type PtyCreateOpts, type PtyConnectOpts } from "./pty.js";
16
16
  export { Template, TemplateBase, Volume, Secret, waitForPort, waitForURL, waitForProcess, waitForFile, waitForTimeout, SecretPaginator, Git, ReadyCmd, LogEntry, LogEntryStart, LogEntryEnd, defaultBuildLogger, ConnectionConfig, ApiClient, getSignature, ALL_TRAFFIC, VolumeFileType, } from "./unsupported.js";
17
17
  export default Sandbox;
18
- /** E2B's client with bound options: `new E2B({ apiKey }).Sandbox.create()`. */
18
+ /** E2B's client with bound options: `new E2B({ apiKey }).Sandbox.create()`.
19
+ * Its Secret, Template and Volume refuse, naming Runtime's alternative, as
20
+ * the top-level exports do. */
19
21
  export declare class E2B {
22
+ protected static readonly sandboxClass: typeof Sandbox;
20
23
  readonly Sandbox: typeof Sandbox;
24
+ readonly Secret: import("./unsupported.js").Unsupported;
25
+ readonly Template: import("./unsupported.js").Unsupported;
26
+ readonly Volume: import("./unsupported.js").Unsupported;
21
27
  constructor(opts?: Omit<ConnectionOpts, "signal"> & {
22
28
  client?: Runtime;
23
29
  });
package/dist/e2b/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { clientFor } from "./client.js";
2
2
  import { Sandbox } from "./sandbox.js";
3
+ import { Secret, Template, Volume } from "./unsupported.js";
3
4
  export { Sandbox, SandboxPaginator, DEFAULT_SHAPE, DEFAULT_TIMEOUT_MS, } from "./sandbox.js";
4
5
  export { Commands, CommandHandle, pidOf, } from "./commands.js";
5
6
  export { Filesystem, FileType, FilesystemEventType, } from "./filesystem.js";
@@ -7,11 +8,17 @@ export { SandboxError, TimeoutError, InvalidArgumentError, NotEnoughSpaceError,
7
8
  export { Pty } from "./pty.js";
8
9
  export { Template, TemplateBase, Volume, Secret, waitForPort, waitForURL, waitForProcess, waitForFile, waitForTimeout, SecretPaginator, Git, ReadyCmd, LogEntry, LogEntryStart, LogEntryEnd, defaultBuildLogger, ConnectionConfig, ApiClient, getSignature, ALL_TRAFFIC, VolumeFileType, } from "./unsupported.js";
9
10
  export default Sandbox;
10
- /** E2B's client with bound options: `new E2B({ apiKey }).Sandbox.create()`. */
11
+ /** E2B's client with bound options: `new E2B({ apiKey }).Sandbox.create()`.
12
+ * Its Secret, Template and Volume refuse, naming Runtime's alternative, as
13
+ * the top-level exports do. */
11
14
  export class E2B {
15
+ static sandboxClass = Sandbox;
12
16
  Sandbox;
17
+ Secret = Secret;
18
+ Template = Template;
19
+ Volume = Volume;
13
20
  constructor(opts = {}) {
14
- this.Sandbox = bind(Sandbox, opts);
21
+ this.Sandbox = bind(new.target.sandboxClass, opts);
15
22
  }
16
23
  }
17
24
  /** A subclass whose static calls use `opts`'s key or client unless a call
@@ -0,0 +1,10 @@
1
+ /** `withruntime/functions`: Functions alone. An HTTP handler on copies that
2
+ * start when calls come and sleep a second after the last. In a private beta.
3
+ *
4
+ * import { functions } from "withruntime/functions";
5
+ * const client = functions(); // RUNTIME_API_KEY, or this machine's saved connection
6
+ */
7
+ import { Runtime, type RuntimeOptions } from "../client.js";
8
+ export type * from "../products/functions.js";
9
+ /** `runtime.functions` of a client made with `options`. */
10
+ export declare function functions(options?: RuntimeOptions): Runtime["functions"];
@@ -0,0 +1,11 @@
1
+ /** `withruntime/functions`: Functions alone. An HTTP handler on copies that
2
+ * start when calls come and sleep a second after the last. In a private beta.
3
+ *
4
+ * import { functions } from "withruntime/functions";
5
+ * const client = functions(); // RUNTIME_API_KEY, or this machine's saved connection
6
+ */
7
+ import { Runtime } from "../client.js";
8
+ /** `runtime.functions` of a client made with `options`. */
9
+ export function functions(options) {
10
+ return new Runtime(options).functions;
11
+ }
package/dist/index.d.ts CHANGED
@@ -18,13 +18,13 @@ export type { BookRoom, RoomBooking, RoomBookingPage } from "./products/reservat
18
18
  export type { AuditEvent, AuditPage } from "./products/audit.js";
19
19
  export type { Plan, PlanAddOn, PlanChange, PlanIncluded, PlanLimit, PlanNow, Plans, } from "./products/plans.js";
20
20
  export type { UsageExportQuery, UsageExportRow, UsageExportPage, } from "./products/observability.js";
21
- export type { JobSecret, Secret, SecretApiPolicy, SecretGit, SecretGithubApp, SecretRule, SecretScope, SecretUse, SetSecret, } from "./products/secrets.js";
21
+ export type { JobSecret, Secret, SecretApiPolicy, SecretGit, SecretGithubApp, SecretRule, SecretScope, SecretUse, ListSecrets, SetSecret, } from "./products/secrets.js";
22
22
  export { SecretPartlyStoredError } from "./products/secrets.js";
23
23
  export type { McpCatalogEntry, McpGateway, McpServerRequest } from "./products/mcp.js";
24
24
  export type { FileEvent, FileEventType, WatchHandle, WatchNotice, WatchOptions, } from "./products/watch.js";
25
25
  export type { Mount, MountBucket } from "./products/mounts.js";
26
26
  export type { TailscaleJoin, TailscaleJoined, TailscaleNode, TailscaleStatus, } from "./products/tailscale.js";
27
- export type { Volume, VolumeBackup, CreateVolume, VolumeAttachment } from "./products/volumes.js";
27
+ export type { Volume, VolumeBackup, VolumeBackupKeep, VolumeBackupSchedule, CreateVolume, VolumeAttachment, } from "./products/volumes.js";
28
28
  export type { CreateJob, Job, JobAlert, JobAlertDelivery, JobCompute, JobDefinition, JobLogs, JobRun, JobRunState, JobSchedule, UpdateJob, } from "./products/jobs.js";
29
29
  export type { CheckedDomain, DnsRecord, Domain, EgressAddress, TcpPort, Tunnel as PrivateTunnel, TunnelPeer, TunnelPeerCreated, SetUpstreamProxy, UpstreamProxy, } from "./products/network-products.js";
30
30
  export type { PrivateNetwork } from "./products/private-network.js";
@@ -78,8 +78,10 @@ export { openWalletAccount, claimWalletAccount, rekeyWalletAccount, type OpenedW
78
78
  export type { Topup } from "./products/billing.js";
79
79
  export type { NewKey, LimitedKey, LimitedKeyAction, MadeKey, ListedKey, KeyUsage, } from "./products/api-keys.js";
80
80
  export type { SsoConnection, SsoStatus } from "./products/sso.js";
81
- export type { Agent, AgentDefinition, AgentEvent, AgentMemoryEntry, AgentMemoryFile, AgentMemoryHit, AgentMemoryPage, AgentMemoryUsage, AgentMemoryWritten, AgentSession, AgentSessionHandle, AgentSessionState, AgentTemplate, AgentTemplateKey, AgentTrigger, AgentTriggerKind, AgentUse, CreateAgent, CreateAgentTrigger, StartAgentSession, } from "./products/agents.js";
81
+ export type { Agent, AgentAsk, AgentAskState, AgentDefinition, AgentEvent, AgentHeldCall, AgentMemoryEntry, AgentMemoryFile, AgentMemoryHit, AgentMemoryPage, AgentMemoryUsage, AgentMemoryWritten, AgentSession, AgentSessionHandle, AgentSessionState, AgentTemplate, AgentTemplateKey, AgentTrigger, AgentTriggerCall, AgentTriggerCallOutcome, AgentTriggerKind, AgentTriggerRules, AgentUse, AnswerAgentAsk, CreateAgent, CreateAgentTrigger, ListAgentAsks, StartAgentSession, } from "./products/agents.js";
82
82
  export { AGENT_TEMPLATES, AGENT_USES } from "./products/agents.js";
83
83
  export type { AgentsDeployChange, AgentsDeployOptions, AgentsDeployResult, AgentsFile, AgentsFileAgent, AgentsFileTrigger, AgentsSource, } from "./agents-deploy.js";
84
84
  export type { Container, ContainerState, CreateContainer, UpdateContainer, } from "./products/containers.js";
85
+ export type { Browser, BrowserConnectOptions, BrowserInfo, BrowserScreenshot, BrowserScreenshotResult, CreateBrowser, UpdateBrowser, } from "./products/browsers.js";
86
+ export type { CreateDesktop, Desktop, DesktopAct, DesktopState, UpdateDesktop, } from "./products/desktops.js";
85
87
  export type { CiFlake, CiFlakeDetail, CiReleaseStep, CiRepository, CiTestResult, ConnectCiRepository, ListCiFlakes, ListCiReleaseSteps, ListCiRepositories, UpdateCiFlake, } from "./products/ci.js";