@parcha/agentrun-computer 0.1.0-beta.33 → 0.1.0-beta.34

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 (59) hide show
  1. package/README.md +169 -15
  2. package/dist/browser.d.ts +1 -1
  3. package/dist/browser.js +6 -3
  4. package/dist/browserbase.d.ts +3 -1
  5. package/dist/browserbase.js +3 -1
  6. package/dist/child.d.ts +2 -0
  7. package/dist/child.js +13 -2
  8. package/dist/chrome.d.ts +73 -0
  9. package/dist/chrome.js +224 -0
  10. package/dist/computerd-linux-amd64 +0 -0
  11. package/dist/computerd-linux-arm64 +0 -0
  12. package/dist/conformance/cases/gpu.d.ts +2 -0
  13. package/dist/conformance/cases/gpu.js +108 -0
  14. package/dist/conformance/cases/health.js +83 -3
  15. package/dist/conformance/cases/index.js +2 -0
  16. package/dist/conformance/cases/mount.d.ts +8 -1
  17. package/dist/conformance/cases/mount.js +4 -3
  18. package/dist/conformance/cases/provider.js +14 -0
  19. package/dist/conformance/cli.js +46 -7
  20. package/dist/conformance/local.d.ts +30 -0
  21. package/dist/conformance/local.js +36 -0
  22. package/dist/conformance/report.js +10 -5
  23. package/dist/conformance/runner.js +45 -13
  24. package/dist/conformance/types.d.ts +63 -16
  25. package/dist/daytona.d.ts +32 -3
  26. package/dist/daytona.js +96 -24
  27. package/dist/docker.d.ts +3 -1
  28. package/dist/docker.js +11 -3
  29. package/dist/drift.d.ts +3 -1
  30. package/dist/drift.js +9 -0
  31. package/dist/e2b.d.ts +3 -1
  32. package/dist/e2b.js +7 -4
  33. package/dist/index.d.ts +4 -2
  34. package/dist/index.js +4 -2
  35. package/dist/isolation.d.ts +0 -2
  36. package/dist/isolation.js +0 -16
  37. package/dist/kernel.d.ts +3 -1
  38. package/dist/kernel.js +3 -1
  39. package/dist/kinds.d.ts +10 -4
  40. package/dist/kinds.js +26 -6
  41. package/dist/labels.d.ts +6 -0
  42. package/dist/labels.js +26 -1
  43. package/dist/local-supervisor.d.ts +51 -0
  44. package/dist/local-supervisor.js +221 -0
  45. package/dist/local.d.ts +89 -0
  46. package/dist/local.js +472 -0
  47. package/dist/modal.d.ts +31 -4
  48. package/dist/modal.js +90 -30
  49. package/dist/orgo.d.ts +3 -1
  50. package/dist/orgo.js +14 -27
  51. package/dist/phone-harness.d.ts +3 -1
  52. package/dist/phone-harness.js +7 -4
  53. package/dist/protocol.d.ts +20 -0
  54. package/dist/protocol.js +9 -0
  55. package/dist/provider.d.ts +63 -3
  56. package/dist/provider.js +28 -0
  57. package/dist/providers.d.ts +7 -1
  58. package/dist/providers.js +1 -0
  59. package/package.json +1 -1
package/dist/daytona.js CHANGED
@@ -7,7 +7,7 @@ import { readFileSync } from "node:fs";
7
7
  import { resolve } from "node:path";
8
8
  import { PassThrough, Writable } from "node:stream";
9
9
  import { fileURLToPath } from "node:url";
10
- import { childCommands, daemonDrift, shellCommand } from "./child.js";
10
+ import { childCommands, daemonDrift, installerOf, shellCommand } from "./child.js";
11
11
  import { OWN_NETWORK_ONLY, readOwnNetwork, TOOL_USER } from "./isolation.js";
12
12
  import { DaemonClient } from "./client.js";
13
13
  import { COMPUTER_LABEL, DEADLINE_LABEL, helloDrift, WORK } from "./drift.js";
@@ -16,7 +16,7 @@ import { epochOf, RUN_LABEL } from "./labels.js";
16
16
  import { checkMount, readBackOf } from "./mount.js";
17
17
  import { ARCHIL_MOUNT_LABEL, ARCHIL_TOOL_UID, archilLabels, archilMount, archilRefusals, archilRelease, mountDrift, readArchilMount, recordedMount, syncingClient, } from "./mount-archil.js";
18
18
  import { MAX_LINE_BYTES } from "./protocol.js";
19
- import { checkLifetime, } from "./provider.js";
19
+ import { checkGpu, checkLifetime, } from "./provider.js";
20
20
  import { fail, ok } from "./result.js";
21
21
  import { daemonWatch } from "./screen-watch.js";
22
22
  import { countTested } from "./test-connection.js";
@@ -26,8 +26,43 @@ import { waitUntil } from "./wait.js";
26
26
  * the toolbox, from a snapshot of box/Dockerfile, with the daemon user agentrun-tool (daemonUser "2510:2510").
27
27
  */
28
28
  export const MOUNT = ["archil"];
29
- /** The machine kind and groups of its one configuration: a linux computer. */
30
- export const CAPABILITIES = [{ kind: "linux", groups: ["exec", "files", "processes"] }];
29
+ /** The network a Daytona computer's programs get: none, a network of their own (isolation.ts OWN_NETWORK_ONLY). */
30
+ export const NETWORK = ["none"];
31
+ /** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
32
+ export const DAYTONA_GPU_REGION = "earth";
33
+ /**
34
+ * The snapshot every GPU sandbox is made from: Daytona's general GPU snapshot, its default sandbox image (user daytona,
35
+ * passwordless sudo) with the CUDA toolkit, as Daytona's dashboard makes one (GET /snapshots/daytona-gpu, 11-11). A GPU
36
+ * spec names it, or "default"; no other snapshot is proven to give a GPU computer, so check() refuses one.
37
+ */
38
+ export const DAYTONA_GPU_SNAPSHOT = "daytona-gpu";
39
+ /** daytona-gpu's GPU, as GET /snapshots/daytona-gpu declares it (gpu 1, gpuType H100; 11-11). */
40
+ export const DAYTONA_GPU_SNAPSHOT_GPU = Object.freeze({ type: "H100", count: 1 });
41
+ /**
42
+ * The GPUs Daytona offers, as capabilities().gpu and CAPABILITIES declare them: the GPU of its GPU snapshot, daytona-gpu,
43
+ * alone (another type needs a snapshot of its own), with its limits on a GPU sandbox: its stop deletes it (no pause, no
44
+ * snapshot: nothing is kept), it runs in region earth, it has the snapshot's 16 vCPUs, 100 GiB of memory and 400 GiB of
45
+ * disk, it may be preempted (daytona.io/pricing lists its GPUs as "Preemptible GPU prices", 11-10), and it takes no
46
+ * mount: daytona-gpu's user is daytona, not root, and it has no Archil client, so an Archil mount is refused in words.
47
+ */
48
+ export const DAYTONA_GPU = Object.freeze({
49
+ types: [DAYTONA_GPU_SNAPSHOT_GPU.type],
50
+ max: DAYTONA_GPU_SNAPSHOT_GPU.count,
51
+ preemptible: true,
52
+ stopDeletes: true,
53
+ region: DAYTONA_GPU_REGION,
54
+ perGpu: { cpus: 16, memoryMb: 100 * 1024, diskMb: 400 * 1024 },
55
+ mounts: [],
56
+ });
57
+ /** A copy of DAYTONA_GPU, so no caller can change the provider's own. */
58
+ const daytonaGpuCapability = () => ({
59
+ ...DAYTONA_GPU,
60
+ types: [...DAYTONA_GPU.types],
61
+ perGpu: { ...DAYTONA_GPU.perGpu },
62
+ mounts: [],
63
+ });
64
+ /** The machine kind, groups and GPUs of its one configuration: a linux computer, with GPUs when asked. */
65
+ export const CAPABILITIES = [{ kind: "linux", groups: ["exec", "files", "processes"], gpu: daytonaGpuCapability() }];
31
66
  /**
32
67
  * A DaytonaProvider from its options alone; it reads no environment, so the key, the API URL (default Daytona's own) and
33
68
  * the target are the caller's: serve passes its DAYTONA_API_KEY, DAYTONA_API_URL and DAYTONA_TARGET, the conformance
@@ -88,7 +123,7 @@ const MAX_CIDRS = 10;
88
123
  const TOOLBOX_PORT = 2280;
89
124
  const INIT_SESSION = "agentrun-computerd";
90
125
  const STAGING = "/tmp/agentrun-computerd-";
91
- const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "mount"]);
126
+ const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "mount", "gpu"]);
92
127
  /** The provider's root channel: argv run as root in a session of its own; the image's user is root, never sudo. */
93
128
  const ROOT_RUN = [
94
129
  "# agentrun-computer: root",
@@ -386,8 +421,13 @@ class Rest {
386
421
  function sandboxDrift(spec, sb, expected) {
387
422
  const found = [];
388
423
  const mismatch = (field, declared, actual) => found.push(`${field}: declared ${show(declared)}, read back ${show(actual)}`);
389
- // Daytona's default snapshot is whichever it names: a computer made from it is not held to a name.
390
- if (spec.image !== DAYTONA_DEFAULT_SNAPSHOT && sb.snapshot !== spec.image)
424
+ // A GPU computer is made from daytona-gpu, whatever image named it. Daytona's default snapshot is whichever it names: a
425
+ // computer made from it is not held to a name.
426
+ if (spec.gpu !== undefined) {
427
+ if (sb.snapshot !== DAYTONA_GPU_SNAPSHOT)
428
+ mismatch("snapshot", DAYTONA_GPU_SNAPSHOT, sb.snapshot);
429
+ }
430
+ else if (spec.image !== DAYTONA_DEFAULT_SNAPSHOT && sb.snapshot !== spec.image)
391
431
  mismatch("snapshot", spec.image, sb.snapshot);
392
432
  const network = networkOf(sb);
393
433
  if (!samePolicy(network, spec.network))
@@ -417,8 +457,12 @@ function sandboxDrift(spec, sb, expected) {
417
457
  mismatch("public", false, sb.public);
418
458
  if (sb.kvm === true)
419
459
  mismatch("kvm", false, sb.kvm);
420
- if (sb.gpu !== undefined && sb.gpu !== 0)
421
- mismatch("gpu", 0, sb.gpu);
460
+ // The GPUs read back, held to the snapshot's own (a create sends none): daytona-gpu's for a GPU computer, none else.
461
+ const gpus = spec.gpu === undefined ? 0 : DAYTONA_GPU_SNAPSHOT_GPU.count;
462
+ if ((sb.gpu ?? 0) !== gpus)
463
+ mismatch("gpu", gpus, sb.gpu);
464
+ if (spec.gpu !== undefined && sb.gpuType !== DAYTONA_GPU_SNAPSHOT_GPU.type)
465
+ mismatch("gpuType", DAYTONA_GPU_SNAPSHOT_GPU.type, sb.gpuType);
422
466
  if (Array.isArray(sb.volumes) ? sb.volumes.length > 0 : sb.volumes !== undefined && sb.volumes !== null)
423
467
  mismatch("volumes", [], sb.volumes);
424
468
  if (typeof sb.linkedSandboxId === "string" && sb.linkedSandboxId !== "")
@@ -571,7 +615,7 @@ export class DaytonaProvider {
571
615
  return {
572
616
  kind: "linux",
573
617
  lifetime: "vendor",
574
- network: ["none"],
618
+ network: [...NETWORK],
575
619
  isolation: this.#class === "linux-vm" ? "vm" : "container",
576
620
  os: "linux",
577
621
  daemon: "child",
@@ -582,6 +626,8 @@ export class DaytonaProvider {
582
626
  stopDeletes: this.#autoDelete === 0,
583
627
  mount: [...MOUNT],
584
628
  vendorAgentPorts: [TOOLBOX_PORT],
629
+ // A GPU sandbox's limits are stated in gpu: its stop deletes it, it runs in region earth, its size is per GPU.
630
+ gpu: daytonaGpuCapability(),
585
631
  };
586
632
  }
587
633
  check(spec) {
@@ -613,6 +659,13 @@ export class DaytonaProvider {
613
659
  refuse("mount", `an Archil mount's tools run as agentrun-tool, ${tool}:${tool}, and this provider's daemon user is ${this.#uid}:${this.#gid}: give it daemonUser "${tool}:${tool}"`);
614
660
  }
615
661
  }
662
+ // The GPU is the snapshot's (a create sends none): daytona-gpu's type and count alone, and no mount (DAYTONA_GPU).
663
+ const gpuRefused = checkGpu(given.gpu, this.capabilities(), given.mount);
664
+ refusals.push(...gpuRefused);
665
+ // A GPU computer is made from daytona-gpu: a spec names it, or Daytona's default, never another snapshot.
666
+ if (given.gpu !== undefined && gpuRefused.length === 0 && typeof image === "string" && image !== DAYTONA_DEFAULT_SNAPSHOT && image !== DAYTONA_GPU_SNAPSHOT) {
667
+ refuse("image", `a Daytona GPU computer is made from Daytona's GPU snapshot ${DAYTONA_GPU_SNAPSHOT} alone, not ${JSON.stringify(image)}: give "${DAYTONA_GPU_SNAPSHOT}" or "${DAYTONA_DEFAULT_SNAPSHOT}"; no other snapshot is proven to give a GPU computer`);
668
+ }
616
669
  for (const [field, value] of Object.entries(given)) {
617
670
  if (SPEC_FIELDS.has(field) || value === undefined)
618
671
  continue;
@@ -646,19 +699,26 @@ export class DaytonaProvider {
646
699
  const archil = archilOf(spec);
647
700
  const body = {
648
701
  name,
649
- // "default" sends no snapshot, and Daytona makes the sandbox from its default snapshot.
650
- ...(spec.image === DAYTONA_DEFAULT_SNAPSHOT ? {} : { snapshot: spec.image }),
702
+ // A GPU sandbox is made from daytona-gpu (check() took "default" or that name). Otherwise "default" sends no
703
+ // snapshot, and Daytona makes the sandbox from its default snapshot.
704
+ ...(spec.gpu !== undefined ? { snapshot: DAYTONA_GPU_SNAPSHOT } : spec.image === DAYTONA_DEFAULT_SNAPSHOT ? {} : { snapshot: spec.image }),
651
705
  // An Archil computer carries its mount as a label: kind and source, never the token.
652
706
  labels: { ...spec.labels, ...(archil ? archilLabels(archil) : {}), [COMPUTER_LABEL]: "1", [DEADLINE_LABEL]: deadline, [IMAGE_LABEL]: spec.image },
653
707
  env: {},
654
708
  public: false,
655
- ...(this.#target === undefined ? {} : { target: this.#target }),
709
+ // A GPU sandbox runs in region earth alone, whatever the provider's target.
710
+ ...(spec.gpu !== undefined ? { target: DAYTONA_GPU_REGION } : this.#target === undefined ? {} : { target: this.#target }),
656
711
  ttlMinutes: Math.max(1, Math.ceil(spec.lifetimeMs / 60_000)),
657
712
  autoStopInterval: this.#autoStop,
658
- autoDeleteInterval: this.#autoDelete,
713
+ // A GPU sandbox's stop deletes it (no pause, no snapshot), so it is asked for and read back as deleted at stop:
714
+ // autoDeleteInterval 0 is Daytona's ephemeral (its SDK's ephemeral sets it; CreateSandbox has no ephemeral field).
715
+ autoDeleteInterval: this.#autoDeleteFor(spec.gpu !== undefined),
659
716
  // An Archil computer's root reaches Archil: Daytona's network is open, and init's own namespace (loopback alone)
660
717
  // holds the tools to none.
661
718
  ...(networkBody(archil ? "open" : spec.network) ?? { networkBlockAll: true }),
719
+ // No resource field (cpu, gpu, gpuType, memory, disk): a snapshot carries its own, and Daytona refuses a create that
720
+ // names a snapshot and sends any (400 "Cannot specify Sandbox resources when using a snapshot"). A GPU computer's
721
+ // GPU is daytona-gpu's, held in the read-back.
662
722
  };
663
723
  const posted = await this.#rest.json("POST", this.#rest.sandbox(), { json: body, timeoutMs: this.#timeouts.createMs }, signal);
664
724
  const made = posted.ok ? posted.value : undefined;
@@ -678,7 +738,7 @@ export class DaytonaProvider {
678
738
  if (signal?.aborted)
679
739
  return this.#abandon(ref, { code: "aborted", message: "create was aborted" }, signal);
680
740
  if (prepared.ok)
681
- return ok(ref);
741
+ return ok(prepared.value.length > 0 ? { ...ref, notes: prepared.value } : ref);
682
742
  return this.#abandon(ref, prepared.error, signal);
683
743
  }
684
744
  async #abandon(ref, error, signal) {
@@ -701,7 +761,7 @@ export class DaytonaProvider {
701
761
  const sb = started.value;
702
762
  const archil = archilOf(spec);
703
763
  // An Archil computer's network at Daytona is open for root; init's own namespace holds the tools to the spec's none.
704
- const vendor = sandboxDrift(archil ? { ...spec, network: "open" } : spec, sb, this.#sandboxExpected(deadline));
764
+ const vendor = sandboxDrift(archil ? { ...spec, network: "open" } : spec, sb, this.#sandboxExpected(deadline, spec.gpu !== undefined));
705
765
  if (vendor.length > 0)
706
766
  return fail("refused", `it did not match its spec: ${vendor.join("; ")}`);
707
767
  const toolbox = await this.#toolbox(sb, signal);
@@ -725,6 +785,8 @@ export class DaytonaProvider {
725
785
  const read = /^sha256 ([0-9a-f]{64})$/m.exec(install.value.result)?.[1];
726
786
  if (read !== sha256)
727
787
  return fail("refused", `it did not match its spec: daemon: uploaded sha256 ${sha256}, the installed binary reads back ${show(read)}`);
788
+ // Who installed it, for the create's notes: root, or the snapshot's user through passwordless sudo (daytona-gpu's).
789
+ const installer = installerOf(install.value.result);
728
790
  // The run's folder, mounted before init starts, so no tool program runs before it is there.
729
791
  let epoch;
730
792
  if (archil) {
@@ -772,7 +834,8 @@ export class DaytonaProvider {
772
834
  return fail("refused", `it did not match its spec: mount: declared ${show(want)}, read back ${show(mountRead.value ?? "nothing")}`);
773
835
  }
774
836
  }
775
- return this.#waitListed(ref.id, signal);
837
+ const listed = await this.#waitListed(ref.id, signal);
838
+ return listed.ok ? ok(installer === undefined ? [] : [installer]) : listed;
776
839
  }
777
840
  /**
778
841
  * What an Archil computer mounts at /workspace, read back through its computerd: the mount table, and whether the
@@ -833,8 +896,12 @@ export class DaytonaProvider {
833
896
  },
834
897
  };
835
898
  }
836
- #sandboxExpected(deadline) {
837
- return { deadline, sandboxClass: this.#class, autoStopInterval: this.#autoStop, autoDeleteInterval: this.#autoDelete };
899
+ #sandboxExpected(deadline, gpu = false) {
900
+ return { deadline, sandboxClass: this.#class, autoStopInterval: this.#autoStop, autoDeleteInterval: this.#autoDeleteFor(gpu) };
901
+ }
902
+ /** The autoDeleteInterval a sandbox is made and read back with: 0 for a GPU sandbox, which a stop deletes; else the option's. */
903
+ #autoDeleteFor(gpu) {
904
+ return gpu ? 0 : this.#autoDelete;
838
905
  }
839
906
  #daemonExpected() {
840
907
  const { kind, groups } = this.capabilities();
@@ -1036,7 +1103,7 @@ export class DaytonaProvider {
1036
1103
  if (!opened.ok)
1037
1104
  return opened;
1038
1105
  const { kind, groups } = this.capabilities();
1039
- const drifted = helloDrift(opened.value.hello, { version: VERSION, kind, groups, arch: this.#arch });
1106
+ const drifted = helloDrift(opened.value.hello, { version: VERSION, kind, groups, arch: this.#arch, fence: true });
1040
1107
  // An Archil computer's client syncs the run's folder after every call that may change it, before it answers.
1041
1108
  if (drifted.length === 0)
1042
1109
  return recordedMount(found.value.labels) ? ok({ ...opened.value, client: syncingClient(opened.value.client) }) : opened;
@@ -1103,9 +1170,11 @@ export class DaytonaProvider {
1103
1170
  // The image create was asked for, from its label; a computer made before the label was written reports its snapshot.
1104
1171
  const asked = sb.labels?.[IMAGE_LABEL];
1105
1172
  const specNetwork = archilComputer || (typeof network === "object" && "other" in network) ? "none" : network;
1106
- const spec = { image: asked ?? sb.snapshot, lifetimeMs: 1, network: specNetwork, labels };
1173
+ // The GPUs Daytona reports, held to what check() allows: a type this provider declares, a count up to its max.
1174
+ const gpu = isWhole(sb.gpu) && sb.gpu > 0 ? { type: String(sb.gpuType), count: sb.gpu } : undefined;
1175
+ const spec = { image: asked ?? sb.snapshot, lifetimeMs: 1, network: specNetwork, labels, ...(gpu === undefined ? {} : { gpu }) };
1107
1176
  found.push(...this.check(spec).map(({ field, message }) => `${field}: ${message}, read back from the computer`));
1108
- const vendor = sandboxDrift(spec, sb, this.#sandboxExpected(sb.labels?.[DEADLINE_LABEL] ?? ""));
1177
+ const vendor = sandboxDrift(spec, sb, this.#sandboxExpected(sb.labels?.[DEADLINE_LABEL] ?? "", gpu !== undefined));
1109
1178
  found.push(...vendor.filter((line) => !line.startsWith("network:") &&
1110
1179
  !line.startsWith(`label ${DEADLINE_LABEL}`) &&
1111
1180
  !(asked === undefined && line.startsWith(`label ${IMAGE_LABEL}`)) &&
@@ -1158,6 +1227,7 @@ export class DaytonaProvider {
1158
1227
  ...(workdir === undefined ? {} : { workdir }),
1159
1228
  ...(deadline === undefined ? {} : { deadline }),
1160
1229
  ...(kind === undefined ? {} : { kind }),
1230
+ ...(gpu === undefined ? {} : { gpu }),
1161
1231
  },
1162
1232
  });
1163
1233
  }
@@ -1410,8 +1480,10 @@ export class DaytonaProvider {
1410
1480
  if (!stopped.ok && stopped.error.code !== "invalid" && stopped.error.code !== "not_found")
1411
1481
  return stopped;
1412
1482
  }
1413
- // With autoDeleteInterval 0, Daytona deletes a sandbox as it stops: such a stop is done once the computer is gone.
1414
- return this.#settle(ref, this.#autoDelete === 0 ? "gone" : "stopped", "stop", signal);
1483
+ // With autoDeleteInterval 0, Daytona deletes a sandbox as it stops: such a stop is done once the computer is gone. A
1484
+ // GPU sandbox is one of those whatever the option (its stop deletes it).
1485
+ const deletes = this.#autoDeleteFor(isWhole(sb.gpu) && sb.gpu > 0) === 0;
1486
+ return this.#settle(ref, deletes ? "gone" : "stopped", "stop", signal);
1415
1487
  }
1416
1488
  /**
1417
1489
  * Waits, through waitUntil, until Daytona reads the sandbox as wanted, twice running, by its own read and by the
package/dist/docker.d.ts CHANGED
@@ -3,7 +3,7 @@ import { type DockerHost } from "./drift.js";
3
3
  import { type EnsureImageOptions, type ImageSource } from "./docker/image.js";
4
4
  import type { KindCapabilities } from "./kinds.js";
5
5
  import { type MountKind } from "./mount.js";
6
- import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type NetworkPolicy, type NetworkSpec, type Refusal } from "./provider.js";
6
+ import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type NetworkForm, type NetworkPolicy, type NetworkSpec, type Refusal } from "./provider.js";
7
7
  import { type Result } from "./result.js";
8
8
  import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
9
9
  /**
@@ -70,6 +70,8 @@ export interface DockerProviderOptions {
70
70
  }
71
71
  /** The mount kinds a Docker computer takes, as capabilities().mount declares them: a bind of a folder on this host. */
72
72
  export declare const MOUNT: readonly MountKind[];
73
+ /** The networks a Docker computer takes: none, open, or an allowlist through the server's egress proxy. */
74
+ export declare const NETWORK: readonly NetworkForm[];
73
75
  /** The machine kind and groups of each configuration: a linux computer, and one made with the desktop option. */
74
76
  export declare const CAPABILITIES: readonly KindCapabilities[];
75
77
  /** What create() takes: the provider's options, the daemon optional. */
package/dist/docker.js CHANGED
@@ -17,12 +17,14 @@ import { EGRESS_READY } from "./docker/egress-proxy.js";
17
17
  import { OLD_ENGINE, outsideWords, subpathOf, VOLUME_SUBPATH_ENGINE, volumeMount, volumeOf } from "./docker/volume.js";
18
18
  import { addressBytes } from "./docker/egress-table.js";
19
19
  import { checkMount, WORKSPACE } from "./mount.js";
20
- import { checkLifetime, } from "./provider.js";
20
+ import { checkGpu, checkLifetime, } from "./provider.js";
21
21
  import { fail, ok } from "./result.js";
22
22
  import { daemonWatch } from "./screen-watch.js";
23
23
  import { countTested } from "./test-connection.js";
24
24
  /** The mount kinds a Docker computer takes, as capabilities().mount declares them: a bind of a folder on this host. */
25
25
  export const MOUNT = ["bind"];
26
+ /** The networks a Docker computer takes: none, open, or an allowlist through the server's egress proxy. */
27
+ export const NETWORK = ["none", "open", "allow"];
26
28
  /** The machine kind and groups of each configuration: a linux computer, and one made with the desktop option. */
27
29
  export const CAPABILITIES = [
28
30
  { kind: "linux", groups: ["exec", "files", "processes"] },
@@ -73,6 +75,8 @@ const USER_FORM = "a uid or uid:gid in numbers, such as 1000:1000; a name is ref
73
75
  const MAX_PIDS = 4_194_304;
74
76
  /** Docker's least --memory. */
75
77
  const MIN_MEMORY_MB = 6;
78
+ /** The most CPUs whose quota (CPU_PERIOD_US each) is still a whole number Docker takes. */
79
+ const MAX_CPUS = Math.floor(Number.MAX_SAFE_INTEGER / CPU_PERIOD_US);
76
80
  const HELLO_TIMEOUT_MS = 30_000;
77
81
  /** Ids a list() inspect takes at once, so its argv and output stay bounded however many computers match. */
78
82
  const INSPECT_BATCH = 50;
@@ -84,7 +88,7 @@ const LIST_FORMAT = '{"Id":{{json .Id}},"Name":{{json .Name}},"State":{"Running"
84
88
  /** The longest lifetime: 30 days. A computer meant to live longer is asked for again. No extend(): the deadline is a
85
89
  * container label, and a label cannot change after create. */
86
90
  const MAX_LIFETIME_MS = 30 * 24 * 60 * 60 * 1000;
87
- const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "cpus", "memoryMb", "pids", "labels", "workdir", "user", "mount"]);
91
+ const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "cpus", "memoryMb", "pids", "labels", "workdir", "user", "mount", "gpu"]);
88
92
  const NUL = "a NUL byte cannot be passed to docker run";
89
93
  /** What --mount's comma-separated fields cannot hold in a source path. */
90
94
  const MOUNT_UNSAFE = /[,"\r\n]/;
@@ -189,7 +193,7 @@ export class DockerProvider {
189
193
  return {
190
194
  kind: this.#desktop ? "desktop" : "linux",
191
195
  lifetime: "janitor",
192
- network: ["none", "open", "allow"],
196
+ network: [...NETWORK],
193
197
  allow: { domains: { max: MAX_ALLOW, ports: [...ALLOW_PORTS] }, cidrs: { max: MAX_ALLOW, ports: [...ALLOW_PORTS] }, mixed: true },
194
198
  networkReadBack: true,
195
199
  isolation: "container",
@@ -259,6 +263,9 @@ export class DockerProvider {
259
263
  refuse("network", NETWORKS);
260
264
  if (cpus !== undefined && !(isNumber(cpus) && cpus >= 0.01))
261
265
  refuse("cpus", "cpus must be a number of CPUs of at least 0.01");
266
+ // Its CFS quota is a whole number of microseconds per period: a count too large for one is no quota Docker takes.
267
+ else if (cpus !== undefined && !Number.isSafeInteger(Math.round(cpus * CPU_PERIOD_US)))
268
+ refuse("cpus", `cpus must be at most ${MAX_CPUS}`);
262
269
  if (memoryMb !== undefined && !(isWhole(memoryMb) && memoryMb >= MIN_MEMORY_MB)) {
263
270
  refuse("memoryMb", `memoryMb must be a whole number of MiB, at least ${MIN_MEMORY_MB}`);
264
271
  }
@@ -284,6 +291,7 @@ export class DockerProvider {
284
291
  if (mounts.length === 0 && typeof path === "string" && MOUNT_UNSAFE.test(path)) {
285
292
  refuse("mount", `mount.path ${JSON.stringify(path)}: a Docker mount cannot hold a comma, a double quote or a line break in its path`);
286
293
  }
294
+ refusals.push(...checkGpu(given.gpu, this.capabilities()));
287
295
  for (const [field, value] of Object.entries(given)) {
288
296
  if (!SPEC_FIELDS.has(field) && value !== undefined)
289
297
  refuse(field, `a Docker computer does not support ${field}`);
package/dist/drift.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type EgressCode } from "./docker/egress.js";
2
2
  import { type DockerVolume } from "./docker/volume.js";
3
3
  import { type MountReadBack } from "./mount.js";
4
- import type { ComputerKind, Group, HelloResult } from "./protocol.js";
4
+ import { type ComputerKind, type Group, type HelloResult } from "./protocol.js";
5
5
  import type { ComputerSpec, NetworkPolicy, NetworkSpec } from "./provider.js";
6
6
  /** Where the daemon is mounted in each computer, read-only. */
7
7
  export declare const DAEMON_IN_COMPUTER = "/opt/agentrun/computerd";
@@ -117,6 +117,8 @@ export interface HelloExpected {
117
117
  groups: Group[];
118
118
  /** Go's name (amd64, arm64); not checked when absent. */
119
119
  arch?: string;
120
+ /** The daemon was started with --own-network: hello must say which fence holds its programs (NETWORK_FENCES). */
121
+ fence?: true;
120
122
  }
121
123
  export interface DriftExpected extends HelloExpected {
122
124
  /** The daemon file on the host the computer binds, as it was mounted: for DockerProvider, its copy of the daemon. */
package/dist/drift.js CHANGED
@@ -4,6 +4,7 @@ import { join } from "node:path";
4
4
  import { EGRESS_MOUNT, EGRESS_SOCKET, egressNameOf, egressOf, policyWords, RELAY_FLAG, sameAllow } from "./docker/egress.js";
5
5
  import { engineOf, subpathOf } from "./docker/volume.js";
6
6
  import { WORKSPACE } from "./mount.js";
7
+ import { NETWORK_FENCES, PROTOCOL_VERSION } from "./protocol.js";
7
8
  /** Where the daemon is mounted in each computer, read-only. */
8
9
  export const DAEMON_IN_COMPUTER = "/opt/agentrun/computerd";
9
10
  /** With the Docker provider's volume option, where the daemon's staged directory is mounted read-only: its computerd is
@@ -235,6 +236,11 @@ export function mountOf(inspected, volume) {
235
236
  /** Every way hello differs from what the provider expects. */
236
237
  export function helloDrift(hello, expected) {
237
238
  const found = [];
239
+ // Another protocol version is another wire. A hello with none is a daemon from before the protocol was versioned,
240
+ // which the version check below already refuses as another daemon.
241
+ if (hello?.protocol !== undefined && hello.protocol !== PROTOCOL_VERSION) {
242
+ found.push(`hello: the daemon speaks protocol ${text(hello.protocol)}, expected ${PROTOCOL_VERSION}`);
243
+ }
238
244
  if (hello?.version !== expected.version)
239
245
  found.push(`hello: the daemon reports version ${text(hello?.version)}, expected ${expected.version}`);
240
246
  if (hello?.os !== "linux")
@@ -244,6 +250,9 @@ export function helloDrift(hello, expected) {
244
250
  }
245
251
  if (hello?.kind !== expected.kind)
246
252
  found.push(`hello: the daemon reports kind ${text(hello?.kind)}, expected ${expected.kind}`);
253
+ if (expected.fence && !NETWORK_FENCES.includes(hello?.fence)) {
254
+ found.push(`hello: the daemon reports fence ${text(hello?.fence)}: init was started with --own-network, so its programs must be held behind one, ${NETWORK_FENCES.join(" or ")}`);
255
+ }
247
256
  const offered = hello?.groups;
248
257
  if (!Array.isArray(offered)) {
249
258
  found.push(`hello: the daemon reports groups ${show(offered)}, not a list; expected ${expected.groups.join(", ")}`);
package/dist/e2b.d.ts CHANGED
@@ -2,7 +2,7 @@ import { type DesktopOptions } from "./desktop.js";
2
2
  import type { KindCapabilities } from "./kinds.js";
3
3
  import { type MountKind } from "./mount.js";
4
4
  import { type ProviderNote } from "./mount-archil.js";
5
- import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal } from "./provider.js";
5
+ import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreatedComputer, type NetworkForm, type NetworkPolicy, type NetworkSpec, type Refusal } from "./provider.js";
6
6
  import { type ComputerErrorCode, type Result } from "./result.js";
7
7
  import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
8
8
  /** What every SDK call is given: the key, the domain and the API URL explicitly, and debug false (index.mjs:1126-1152). */
@@ -214,6 +214,8 @@ export declare const E2B_DESKTOP_TEMPLATE = "desktop";
214
214
  export declare const E2B_BASE_TEMPLATE = "base";
215
215
  /** The mount kinds an E2B computer takes, as capabilities().mount declares them: the run's folder on an Archil disk. */
216
216
  export declare const MOUNT: readonly MountKind[];
217
+ /** The network an E2B computer's programs get: none, a network of their own (isolation.ts OWN_NETWORK_ONLY). */
218
+ export declare const NETWORK: readonly NetworkForm[];
217
219
  /** The machine kind and groups of each configuration: kind linux (the plain template), and kind desktop (the default). */
218
220
  export declare const CAPABILITIES: readonly KindCapabilities[];
219
221
  /** The E2B timeout of the diagnostic's sandbox: E2B ends it at 10 minutes whatever happens to the run. */
package/dist/e2b.js CHANGED
@@ -18,7 +18,7 @@ import { releaseOlder } from "./janitor.js";
18
18
  import { RUN_LABEL } from "./labels.js";
19
19
  import { checkMount, readBackOf } from "./mount.js";
20
20
  import { ARCHIL_HELPER, ARCHIL_MOUNT_LABEL, ARCHIL_TOOL_UID, archilLabels, archilMount, archilRefusals, archilRelease, claimEpoch, mountDrift, readArchilMount, recordedArchil as recordedArchilOf, recordedMount, syncingClient, } from "./mount-archil.js";
21
- import { checkLifetime, } from "./provider.js";
21
+ import { checkGpu, checkLifetime, } from "./provider.js";
22
22
  import { fail, ok } from "./result.js";
23
23
  import { daemonWatch } from "./screen-watch.js";
24
24
  import { countTested } from "./test-connection.js";
@@ -100,6 +100,8 @@ const DEFAULTS = {
100
100
  };
101
101
  /** The mount kinds an E2B computer takes, as capabilities().mount declares them: the run's folder on an Archil disk. */
102
102
  export const MOUNT = ["archil"];
103
+ /** The network an E2B computer's programs get: none, a network of their own (isolation.ts OWN_NETWORK_ONLY). */
104
+ export const NETWORK = ["none"];
103
105
  /** The user an Archil computer's tools run as: the image's agentrun-tool, with no sudo and no capability. */
104
106
  const ARCHIL_USER = `${ARCHIL_TOOL_UID}:${ARCHIL_TOOL_UID}`;
105
107
  /** The machine kind and groups of each configuration: kind linux (the plain template), and kind desktop (the default). */
@@ -132,7 +134,7 @@ const STAGING = "/tmp/agentrun-computerd-";
132
134
  const DEFAULT_PROBE_TARGETS = ["1.1.1.1:443", "8.8.8.8:443", "[2606:4700:4700::1111]:443", "1.1.1.1:53/udp", "[2606:4700:4700::1111]:53/udp"];
133
135
  /** A probe target: host:port, over TCP, or host:port/udp, a DNS query over UDP. */
134
136
  const TARGET = /^(?:\[[0-9A-Fa-f:.]+\]|[A-Za-z0-9.-]+):[0-9]{1,5}(?:\/udp)?$/;
135
- const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "mount"]);
137
+ const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "labels", "mount", "gpu"]);
136
138
  const NUL = "a NUL byte cannot be sent to E2B";
137
139
  const FIXED = "an E2B computer's network is fixed at create: create a new computer";
138
140
  const PUBLIC = "publicStream is no longer an option: an E2B computer never takes public traffic, which would open every port in it to anyone with its address, and its screen is streamed through agentrun, never a vendor URL";
@@ -406,7 +408,7 @@ export class E2BProvider {
406
408
  return {
407
409
  kind: this.#kind,
408
410
  lifetime: "vendor",
409
- network: ["none"],
411
+ network: [...NETWORK],
410
412
  networkReadBack: true,
411
413
  isolation: "microvm",
412
414
  os: "linux",
@@ -441,6 +443,7 @@ export class E2BProvider {
441
443
  if (bad)
442
444
  refuse("labels", bad);
443
445
  }
446
+ refusals.push(...checkGpu(given.gpu, this.capabilities()));
444
447
  for (const [field, value] of Object.entries(given)) {
445
448
  if (SPEC_FIELDS.has(field) || value === undefined)
446
449
  continue;
@@ -1040,7 +1043,7 @@ export class E2BProvider {
1040
1043
  if (!opened.ok)
1041
1044
  return opened;
1042
1045
  const { kind, groups } = this.capabilities();
1043
- const drifted = helloDrift(opened.value.hello, { version: VERSION, kind, groups, arch: ARCH });
1046
+ const drifted = helloDrift(opened.value.hello, { version: VERSION, kind, groups, arch: ARCH, fence: true });
1044
1047
  // An Archil computer's client syncs the run's folder after every call that may change it, before it answers.
1045
1048
  if (drifted.length === 0)
1046
1049
  return recordedArchil(found.value.metadata) === undefined ? opened : ok({ ...opened.value, client: syncingClient(opened.value.client) });
package/dist/index.d.ts CHANGED
@@ -11,15 +11,17 @@ export { type DockerDesktopOptions, type DockerEgressOptions, DockerProvider, ty
11
11
  export { type DockerVolume, VOLUME_SUBPATH_ENGINE } from "./docker/volume.js";
12
12
  export { DEFAULT_DOCKER_IMAGE, DOCKER_BASE, DOCKER_RECIPE, DOCKER_RECIPE_HAS, ensureImage, type EnsureImageOptions, IMAGE_REPOSITORY, IMAGE_TIMEOUT_MS, type ImageSource, imageSourceProblem, type Making, RECIPE_LABEL, recipeHash, recipeTag, } from "./docker/image.js";
13
13
  export { EGRESS_IMAGE, EGRESS_LABEL, EGRESS_MOUNT, EGRESS_SOCKET } from "./docker/egress.js";
14
- export { DAYTONA_DEFAULT_SNAPSHOT, DaytonaProvider, type DaytonaProviderOptions, type DaytonaTimeouts, type WebSocketFactory, type WebSocketLike } from "./daytona.js";
14
+ export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DaytonaProvider, type DaytonaProviderOptions, type DaytonaTimeouts, type WebSocketFactory, type WebSocketLike } from "./daytona.js";
15
15
  export { ModalProvider, type ModalApp, type ModalByteSink, type ModalCreateParams, type ModalImage, type ModalProcess, type ModalProviderOptions, type ModalSandbox, type ModalSdk, type ModalTimeouts, } from "./modal.js";
16
16
  export { ARCHIL_HELPER, ARCHIL_MOUNT_LABEL, ARCHIL_SYNC_SOCKET, ARCHIL_TOOL_UID, ARCHIL_TOOL_USER, ARCHIL_VERSION, type ArchilMount, type ArchilMountOptions, type ArchilRoot, type ProviderNote, archilLabels, archilMount, archilReadBack, archilRefusals, archilRelease, claimEpoch, helperSha256, mountDrift, mountWords, type RecordedArchil, readArchilMount, recordedArchil, recordedMount, syncingClient, } from "./mount-archil.js";
17
17
  export { BROWSER_IMAGE, type BrowserStream, BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, type ReleaseConfirm, type RestReply, type UrlStore, } from "./browser.js";
18
18
  export { BROWSERBASE_API_URL, BROWSERBASE_MAX_LIFETIME_MS, type BrowserbaseApi, type BrowserbaseDebug, BrowserbaseProvider, type BrowserbaseProviderOptions, type BrowserbaseSession, type BrowserbaseSessionSettings, browserbaseRest, } from "./browserbase.js";
19
19
  export { KERNEL_API_URL, KERNEL_MAX_LIFETIME_MS, type KernelBrowserSettings, KernelProvider, type KernelProviderOptions, type KernelRequest, kernelRest } from "./kernel.js";
20
+ export { LOCAL_MAX_LIFETIME_MS, LocalBrowserProvider, type LocalBrowserOptions } from "./local.js";
21
+ export { CHROME_ENV, CHROME_FLAGS, checkChrome, chromeFence, findChrome, killTree, NO_CHROME } from "./chrome.js";
20
22
  export { DAEMON_IN_COMPUTER, drift, helloDrift, hostOf, inspectDrift, mountOf, networkOf, type DockerHost, type DockerInfo, type DockerInspect, type DriftExpected, type HelloExpected } from "./drift.js";
21
23
  export { type ReleasedOlder, releaseOlder, sweep, type SweepOptions, type Swept } from "./janitor.js";
22
- export { EPOCH_LABEL, epochOf, epochProblem, RUN_LABEL, runLabels, runProblem } from "./labels.js";
24
+ export { EPOCH_LABEL, epochOf, epochProblem, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
23
25
  export { waitUntil, type WaitOptions } from "./wait.js";
24
26
  export { type ConformanceModule, isProviderId, type ProviderEnv, providerFor, type ProviderId, providerIds, type ProviderModule, providerModule, type ProviderOptions, providers, } from "./providers.js";
25
27
  export type { PhoneLedger, PhoneLedgerEntry } from "./phone-harness.js";
package/dist/index.js CHANGED
@@ -11,15 +11,17 @@ export { DockerProvider } from "./docker.js";
11
11
  export { VOLUME_SUBPATH_ENGINE } from "./docker/volume.js";
12
12
  export { DEFAULT_DOCKER_IMAGE, DOCKER_BASE, DOCKER_RECIPE, DOCKER_RECIPE_HAS, ensureImage, IMAGE_REPOSITORY, IMAGE_TIMEOUT_MS, imageSourceProblem, RECIPE_LABEL, recipeHash, recipeTag, } from "./docker/image.js";
13
13
  export { EGRESS_IMAGE, EGRESS_LABEL, EGRESS_MOUNT, EGRESS_SOCKET } from "./docker/egress.js";
14
- export { DAYTONA_DEFAULT_SNAPSHOT, DaytonaProvider } from "./daytona.js";
14
+ export { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DaytonaProvider } from "./daytona.js";
15
15
  export { ModalProvider, } from "./modal.js";
16
16
  export { ARCHIL_HELPER, ARCHIL_MOUNT_LABEL, ARCHIL_SYNC_SOCKET, ARCHIL_TOOL_UID, ARCHIL_TOOL_USER, ARCHIL_VERSION, archilLabels, archilMount, archilReadBack, archilRefusals, archilRelease, claimEpoch, helperSha256, mountDrift, mountWords, readArchilMount, recordedArchil, recordedMount, syncingClient, } from "./mount-archil.js";
17
17
  export { BROWSER_IMAGE, BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, } from "./browser.js";
18
18
  export { BROWSERBASE_API_URL, BROWSERBASE_MAX_LIFETIME_MS, BrowserbaseProvider, browserbaseRest, } from "./browserbase.js";
19
19
  export { KERNEL_API_URL, KERNEL_MAX_LIFETIME_MS, KernelProvider, kernelRest } from "./kernel.js";
20
+ export { LOCAL_MAX_LIFETIME_MS, LocalBrowserProvider } from "./local.js";
21
+ export { CHROME_ENV, CHROME_FLAGS, checkChrome, chromeFence, findChrome, killTree, NO_CHROME } from "./chrome.js";
20
22
  export { DAEMON_IN_COMPUTER, drift, helloDrift, hostOf, inspectDrift, mountOf, networkOf } from "./drift.js";
21
23
  export { releaseOlder, sweep } from "./janitor.js";
22
- export { EPOCH_LABEL, epochOf, epochProblem, RUN_LABEL, runLabels, runProblem } from "./labels.js";
24
+ export { EPOCH_LABEL, epochOf, epochProblem, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
23
25
  export { waitUntil } from "./wait.js";
24
26
  export { isProviderId, providerFor, providerIds, providerModule, providers, } from "./providers.js";
25
27
  export { kindOf, PROVIDERS, SETTING_KIND_NAMES, SETTING_KINDS, serves, servingRefusals, } from "./kinds.js";
@@ -4,8 +4,6 @@ import { type Result } from "./result.js";
4
4
  export declare const TOOL_USER = "2510:2510";
5
5
  /** Why a remote provider refuses network open or an allowlist, in words. */
6
6
  export declare const OWN_NETWORK_ONLY = "a remote computer takes network \"none\" only: its programs run in a network of their own, their loopback alone, so the vendor's agent in it (which runs commands as root) is out of their reach; open and allowlists wait for a proxy out of that network";
7
- /** The interfaces /proc/<pid>/net/dev lists, in its order; undefined when the text is not that file. */
8
- export declare function netDevInterfaces(text: string): string[] | undefined;
9
7
  /**
10
8
  * The drift of a computer's programs' network from their own loopback alone, in words: none when the live interfaces
11
9
  * (up or addressed) of the daemon's network namespace are `lo` alone, else what they are (or that they could not be read).
package/dist/isolation.js CHANGED
@@ -12,22 +12,6 @@ import { fail, ok } from "./result.js";
12
12
  export const TOOL_USER = "2510:2510";
13
13
  /** Why a remote provider refuses network open or an allowlist, in words. */
14
14
  export const OWN_NETWORK_ONLY = 'a remote computer takes network "none" only: its programs run in a network of their own, their loopback alone, so the vendor\'s agent in it (which runs commands as root) is out of their reach; open and allowlists wait for a proxy out of that network';
15
- /** The interfaces /proc/<pid>/net/dev lists, in its order; undefined when the text is not that file. */
16
- export function netDevInterfaces(text) {
17
- const lines = text.split("\n");
18
- if (!lines[0]?.startsWith("Inter-|") || !lines[1]?.includes("face |"))
19
- return undefined;
20
- const names = [];
21
- for (const line of lines.slice(2)) {
22
- if (line.trim() === "")
23
- continue;
24
- const at = line.indexOf(":");
25
- if (at < 0)
26
- return undefined;
27
- names.push(line.slice(0, at).trim());
28
- }
29
- return names;
30
- }
31
15
  /**
32
16
  * The drift of a computer's programs' network from their own loopback alone, in words: none when the live interfaces
33
17
  * (up or addressed) of the daemon's network namespace are `lo` alone, else what they are (or that they could not be read).
package/dist/kernel.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { type BrowserStream, type ReleaseConfirm, type RestReply, type UrlStore } from "./browser.js";
2
2
  import type { KindCapabilities } from "./kinds.js";
3
3
  import type { MountKind } from "./mount.js";
4
- import type { AttachedComputer, CallContext, ComputerCapabilities, ComputerConnection, ComputerInfo, ComputerProvider, ComputerRef, ComputerSpec, CreatedComputer, NetworkPolicy, NetworkSpec, Refusal } from "./provider.js";
4
+ import type { AttachedComputer, CallContext, ComputerCapabilities, ComputerConnection, ComputerInfo, ComputerProvider, ComputerRef, ComputerSpec, CreatedComputer, NetworkForm, NetworkPolicy, NetworkSpec, Refusal } from "./provider.js";
5
5
  import { type Result } from "./result.js";
6
6
  export declare const KERNEL_API_URL = "https://api.onkernel.com";
7
7
  /** The domain a Kernel CDP URL is on (wss://<host>.kernel.sh:8443, read live 11-08; its API is onkernel.com): cdpUrlProblem holds it there. */
@@ -11,6 +11,8 @@ export declare const KERNEL_MIN_LIFETIME_MS = 10000;
11
11
  export declare const KERNEL_MAX_LIFETIME_MS = 259200000;
12
12
  /** A browser takes no mount. */
13
13
  export declare const MOUNT: readonly MountKind[];
14
+ /** The network a Kernel browser runs on: Kernel's own, open; it cannot be closed or narrowed. */
15
+ export declare const NETWORK: readonly NetworkForm[];
14
16
  /** The one configuration it offers, the kind registry's entry (kinds.ts): a browser with a CDP target and a live view. */
15
17
  export declare const CAPABILITIES: readonly KindCapabilities[];
16
18
  /** A browser as Kernel answers it; only what the provider reads. */
package/dist/kernel.js CHANGED
@@ -28,6 +28,8 @@ export const KERNEL_MAX_LIFETIME_MS = 259_200_000;
28
28
  const MAX_PAGES = 100;
29
29
  /** A browser takes no mount. */
30
30
  export const MOUNT = [];
31
+ /** The network a Kernel browser runs on: Kernel's own, open; it cannot be closed or narrowed. */
32
+ export const NETWORK = ["open"];
31
33
  /** The one configuration it offers, the kind registry's entry (kinds.ts): a browser with a CDP target and a live view. */
32
34
  export const CAPABILITIES = [{ kind: "browser", groups: ["cdp", "stream"] }];
33
35
  /** Kernel's REST API over fetch: the default request. */
@@ -66,7 +68,7 @@ export class KernelProvider {
66
68
  return {
67
69
  kind: "browser",
68
70
  lifetime: "vendor",
69
- network: ["open"],
71
+ network: [...NETWORK],
70
72
  isolation: "vm",
71
73
  os: "linux",
72
74
  daemon: "none",
package/dist/kinds.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import type { MountKind } from "./mount.js";
2
2
  import type { ComputerKind, Group } from "./protocol.js";
3
- import type { ComputerCapabilities } from "./provider.js";
3
+ import type { ComputerCapabilities, NetworkForm } from "./provider.js";
4
4
  import type { Result } from "./result.js";
5
5
  /**
6
6
  * What an agent is given. none: the run's folder only, no computer. sandbox: a Linux shell with files and processes.
@@ -20,8 +20,8 @@ export interface SettingKindSpec {
20
20
  export declare const SETTING_KINDS: Readonly<Record<ComputerSettingKind, SettingKindSpec>>;
21
21
  /** Every setting kind, in the table's order. */
22
22
  export declare const SETTING_KIND_NAMES: ComputerSettingKind[];
23
- /** The capabilities serves() and kindOf() read. */
24
- export type KindCapabilities = Pick<ComputerCapabilities, "kind" | "groups">;
23
+ /** The capabilities serves() and kindOf() read, and the GPUs a configuration offers (Settings' GPU choice). */
24
+ export type KindCapabilities = Pick<ComputerCapabilities, "kind" | "groups" | "gpu">;
25
25
  /** Why capabilities do not serve a setting kind, in words; none when they do. */
26
26
  export declare function servingRefusals(capabilities: KindCapabilities, kind: ComputerSettingKind): string[];
27
27
  /** Whether a provider with these capabilities serves the kind: its machine kind is one of the kind's, and it declares every required group. */
@@ -44,6 +44,12 @@ export interface ProviderEntry {
44
44
  keys: readonly ProviderKey[];
45
45
  /** The mount kinds its computers take; [] cannot mount the run's folder. Its module's MOUNT, once its file lands. */
46
46
  mounts: readonly MountKind[];
47
+ /**
48
+ * The network forms its computers make: its module's NETWORK, which its capabilities().network returns. ["none"]: a
49
+ * remote computer whose programs run in a network of their own; ["open"]: the vendor's own network, which no
50
+ * allowlist of this server reaches; Docker's makes all three.
51
+ */
52
+ network: readonly NetworkForm[];
47
53
  /** The vendor bills by time; prices are the vendor's page, not ours. */
48
54
  metered: boolean;
49
55
  /**
@@ -60,7 +66,7 @@ export interface ProviderEntry {
60
66
  }
61
67
  /**
62
68
  * Every provider Settings offers, each with its provider file in the registry;
63
- * a unit test then holds each to its module (CAPABILITIES, MOUNT). daytona, modal and e2b take archil mounts.
69
+ * a unit test then holds each to its module (CAPABILITIES, MOUNT, NETWORK). daytona, modal and e2b take archil mounts.
64
70
  */
65
71
  export declare const PROVIDERS: readonly ProviderEntry[];
66
72
  /** What testConnection is given: the provider's keys by their serve-side names, and the caller's signal. */