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

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 (107) hide show
  1. package/README.md +251 -46
  2. package/box/Dockerfile +3 -1
  3. package/box/agentrun-archil +59 -7
  4. package/box/build-daytona.py +20 -4
  5. package/dist/browser.d.ts +73 -23
  6. package/dist/browser.js +141 -17
  7. package/dist/browserbase.d.ts +48 -25
  8. package/dist/browserbase.js +176 -29
  9. package/dist/chrome.d.ts +3 -4
  10. package/dist/chrome.js +6 -11
  11. package/dist/computerd-linux-amd64 +0 -0
  12. package/dist/computerd-linux-arm64 +0 -0
  13. package/dist/conformance/browserbase.js +1 -1
  14. package/dist/conformance/cases/provider.js +78 -3
  15. package/dist/conformance/daytona.d.ts +4 -0
  16. package/dist/conformance/daytona.js +7 -1
  17. package/dist/conformance/e2b.js +2 -1
  18. package/dist/conformance/fixture.js +24 -2
  19. package/dist/conformance/kernel.js +1 -1
  20. package/dist/conformance/kind.js +2 -1
  21. package/dist/conformance/{local.d.ts → local-chrome.d.ts} +7 -7
  22. package/dist/conformance/{local.js → local-chrome.js} +11 -11
  23. package/dist/conformance/orgo.d.ts +11 -5
  24. package/dist/conformance/orgo.js +37 -8
  25. package/dist/conformance/phone-harness.js +2 -1
  26. package/dist/conformance/report.js +3 -2
  27. package/dist/conformance/runner.js +25 -7
  28. package/dist/conformance/types.d.ts +21 -8
  29. package/dist/conformance/types.js +10 -0
  30. package/dist/conformance/windows-fixture.d.ts +1 -0
  31. package/dist/conformance/windows-fixture.js +37 -0
  32. package/dist/daytona.d.ts +16 -35
  33. package/dist/daytona.js +87 -95
  34. package/dist/descriptor.d.ts +116 -0
  35. package/dist/descriptor.js +92 -0
  36. package/dist/descriptors/browserbase.d.ts +25 -0
  37. package/dist/descriptors/browserbase.js +20 -0
  38. package/dist/descriptors/daytona.d.ts +83 -0
  39. package/dist/descriptors/daytona.js +81 -0
  40. package/dist/descriptors/docker.d.ts +12 -0
  41. package/dist/descriptors/docker.js +17 -0
  42. package/dist/descriptors/e2b.d.ts +22 -0
  43. package/dist/descriptors/e2b.js +19 -0
  44. package/dist/descriptors/index.d.ts +256 -0
  45. package/dist/descriptors/index.js +19 -0
  46. package/dist/descriptors/kernel.d.ts +21 -0
  47. package/dist/descriptors/kernel.js +17 -0
  48. package/dist/descriptors/local-chrome.d.ts +17 -0
  49. package/dist/descriptors/local-chrome.js +21 -0
  50. package/dist/descriptors/modal.d.ts +54 -0
  51. package/dist/descriptors/modal.js +48 -0
  52. package/dist/descriptors/orgo.d.ts +99 -0
  53. package/dist/descriptors/orgo.js +49 -0
  54. package/dist/descriptors/phone-harness.d.ts +33 -0
  55. package/dist/descriptors/phone-harness.js +23 -0
  56. package/dist/descriptors/shared.d.ts +7 -0
  57. package/dist/descriptors/shared.js +6 -0
  58. package/dist/desktop.d.ts +4 -4
  59. package/dist/desktop.js +4 -4
  60. package/dist/docker/egress.d.ts +5 -4
  61. package/dist/docker/egress.js +7 -6
  62. package/dist/docker/image.js +17 -15
  63. package/dist/docker/inspect.d.ts +147 -0
  64. package/dist/docker/inspect.js +335 -0
  65. package/dist/docker.d.ts +6 -6
  66. package/dist/docker.js +53 -47
  67. package/dist/drift.d.ts +3 -145
  68. package/dist/drift.js +5 -334
  69. package/dist/e2b.d.ts +2 -8
  70. package/dist/e2b.js +17 -23
  71. package/dist/index.d.ts +9 -12
  72. package/dist/index.js +14 -12
  73. package/dist/isolation.js +2 -2
  74. package/dist/janitor.d.ts +20 -2
  75. package/dist/janitor.js +67 -19
  76. package/dist/kernel.d.ts +19 -29
  77. package/dist/kernel.js +110 -32
  78. package/dist/kinds.d.ts +59 -34
  79. package/dist/kinds.js +19 -117
  80. package/dist/labels.d.ts +20 -0
  81. package/dist/labels.js +62 -1
  82. package/dist/{local.d.ts → local-chrome.d.ts} +8 -9
  83. package/dist/{local.js → local-chrome.js} +26 -19
  84. package/dist/local-supervisor.d.ts +3 -3
  85. package/dist/local-supervisor.js +3 -3
  86. package/dist/modal.d.ts +6 -25
  87. package/dist/modal.js +86 -88
  88. package/dist/mount-archil.d.ts +25 -3
  89. package/dist/mount-archil.js +43 -12
  90. package/dist/orgo-channel.js +16 -13
  91. package/dist/orgo-desktop.d.ts +162 -0
  92. package/dist/orgo-desktop.js +1856 -0
  93. package/dist/orgo-names.d.ts +178 -0
  94. package/dist/orgo-names.js +287 -0
  95. package/dist/orgo.d.ts +34 -20
  96. package/dist/orgo.js +424 -173
  97. package/dist/phone-harness.d.ts +7 -12
  98. package/dist/phone-harness.js +70 -54
  99. package/dist/protocol.d.ts +5 -0
  100. package/dist/provider.d.ts +153 -10
  101. package/dist/provider.js +48 -1
  102. package/dist/providers.d.ts +23 -24
  103. package/dist/providers.js +14 -17
  104. package/dist/result.d.ts +11 -1
  105. package/dist/result.js +11 -0
  106. package/dist/test-connection.js +2 -2
  107. package/package.json +42 -2
@@ -0,0 +1,116 @@
1
+ import type { ComputerSettingKind, KindCapabilities } from "./kinds.js";
2
+ import type { MountKind } from "./mount.js";
3
+ import type { NetworkForm } from "./provider.js";
4
+ import type { ProviderModule } from "./providers.js";
5
+ /** One key a provider takes in Settings: its serve-side name, the create() option it fills, and whether it is needed. */
6
+ export interface DescriptorKey {
7
+ /** The name Settings stores it under and shows (DAYTONA_API_KEY); never a value. */
8
+ readonly name: string;
9
+ /** The create() option it fills (apiKey). */
10
+ readonly option: string;
11
+ readonly required: boolean;
12
+ }
13
+ /** A setting that is no key but fills a create() option, with the value used when the server names none. */
14
+ export interface DescriptorSetting {
15
+ /** Its name in the server's settings (modalApp). */
16
+ readonly name: string;
17
+ /** The create() option it fills (app). */
18
+ readonly option: string;
19
+ /** The value when the server's settings name none. */
20
+ readonly default?: string;
21
+ }
22
+ /**
23
+ * A configuration its module builds but the provider does not offer yet: its kind, groups, image and create() options,
24
+ * as an offered one's, and why it is parked, in words. The conformance suite holds a built one to it as to an offered one.
25
+ */
26
+ export type ParkedConfiguration = KindCapabilities & {
27
+ readonly image: string;
28
+ readonly why: string;
29
+ };
30
+ /** A program a provider runs on the server's own machine: the command it looks for on PATH, and what installs it. */
31
+ export interface HostCommand {
32
+ readonly command: string;
33
+ /** What gives the command, in words a person installs it by: "Android platform-tools". */
34
+ readonly from: string;
35
+ /**
36
+ * The machines it is built for, as Node names them (`${process.platform}-${process.arch}`: "linux-x64"). A server on
37
+ * any other cannot install it, and says so. Absent: every machine.
38
+ */
39
+ readonly builds?: readonly string[];
40
+ }
41
+ /**
42
+ * A provider, declared once. Every field is data but load(), which imports the provider module only when called:
43
+ * reading a descriptor loads no provider and no vendor SDK.
44
+ */
45
+ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModule> {
46
+ /** Its id, in the provider registry and in Settings: lowercase letters, digits and hyphens. */
47
+ readonly id: string;
48
+ /** Its name in words, as Settings shows it. */
49
+ readonly label: string;
50
+ /** The keys Settings takes for it, by name, and the option each fills; [] for none (Docker's host is local). */
51
+ readonly keys: readonly DescriptorKey[];
52
+ /** Settings that are no key but go to its options (Modal's app). */
53
+ readonly settings?: readonly DescriptorSetting[];
54
+ /** The vendor bills by time; prices are the vendor's page, not ours. */
55
+ readonly metered: boolean;
56
+ /** The mount kinds its computers take, as its providers' capabilities().mount declare them; [] for none. */
57
+ readonly mounts: readonly MountKind[];
58
+ /**
59
+ * The network forms its computers make, as its providers' capabilities().network declare them: ["none"], a remote
60
+ * computer whose programs run in a network of their own; ["open"], the vendor's own network, which no allowlist of
61
+ * this server reaches; Docker's makes all three. A provider of several configurations declares every form they make.
62
+ */
63
+ readonly network: readonly NetworkForm[];
64
+ /**
65
+ * The machine kind and groups of each configuration it offers, as each built provider's capabilities() declare them;
66
+ * where it offers more than one image of a kind, each one's image (the name a setting selects it by) and the create()
67
+ * options that build it (KindCapabilities).
68
+ */
69
+ readonly capabilities: readonly KindCapabilities[];
70
+ /**
71
+ * The image a computer of each setting kind starts from when its setting names none. A kind with no entry has no
72
+ * default, and the caller refuses the setting in words (Docker's sandbox: the server builds its image, prepareImage).
73
+ */
74
+ readonly defaultImage?: Partial<Record<ComputerSettingKind, string>>;
75
+ /** Its built providers have prepareImage(): the image a computer starts from is made or pulled before the first create. */
76
+ readonly prepareImage?: boolean;
77
+ /**
78
+ * The server's environment variable that, when its operator sets it, names the image every computer of this provider
79
+ * starts from in place of defaultImage (Daytona's snapshot of box/Dockerfile, which an Archil mount needs). The
80
+ * provider's own check() still judges the image. Absent: its images are its defaultImage alone.
81
+ */
82
+ readonly imageEnv?: string;
83
+ /** Its computers run on this machine's container engine: a server passes it its local host options (volume, host addresses). */
84
+ readonly local?: boolean;
85
+ /** create() takes a ledger the server keeps for it, as `options[ledger.option]` (the phone harness's sessions). */
86
+ readonly ledger?: {
87
+ readonly option: string;
88
+ };
89
+ /**
90
+ * The server's own environment variables its provider reads on this machine, by name (Local Chrome's, where it finds
91
+ * Chrome; a cloud browser's, the gateway a server reaches its API through): a server passes their values, and no other
92
+ * variable of its own, as `options.env`. The provider itself reads no environment.
93
+ */
94
+ readonly hostEnv?: readonly string[];
95
+ /**
96
+ * A program its computers need on the server's own machine, found on PATH (the phone's adb): a server looks for it at
97
+ * its start and, when it is missing, says from this alone that the provider can't run there and why.
98
+ */
99
+ readonly hostCommand?: HostCommand;
100
+ /**
101
+ * Configurations its module builds but does not offer yet (Orgo's Windows and macOS desktops), each by the image a
102
+ * setting would name and why: a setting naming one is refused in its words, saying it is parked, never as an unknown
103
+ * image. No setting kind lists one, and Settings never offers one.
104
+ */
105
+ readonly parked?: readonly ParkedConfiguration[];
106
+ /** The provider module, loaded on demand: its create(), its conformance module. */
107
+ load(): Promise<Module>;
108
+ }
109
+ /**
110
+ * A descriptor, checked: its id's shape, its keys' and settings' names and options unique and non-empty, and one
111
+ * configuration at least. Throws in words naming what is wrong, so a bad descriptor never reaches a registry. The const
112
+ * type parameter keeps its literal id and its module's type, so ProviderOptions can read a create()'s options from it.
113
+ */
114
+ export declare function defineProvider<const Descriptor extends ProviderDescriptor>(descriptor: Descriptor): Descriptor;
115
+ /** What is wrong with a value offered as a descriptor, in words; none when it is one. */
116
+ export declare function descriptorProblems(value: unknown): string[];
@@ -0,0 +1,92 @@
1
+ const ID = /^[a-z0-9][a-z0-9-]*$/;
2
+ /**
3
+ * A descriptor, checked: its id's shape, its keys' and settings' names and options unique and non-empty, and one
4
+ * configuration at least. Throws in words naming what is wrong, so a bad descriptor never reaches a registry. The const
5
+ * type parameter keeps its literal id and its module's type, so ProviderOptions can read a create()'s options from it.
6
+ */
7
+ export function defineProvider(descriptor) {
8
+ const problems = descriptorProblems(descriptor);
9
+ if (problems.length > 0)
10
+ throw new Error(`the provider descriptor ${JSON.stringify(descriptor?.id)}: ${problems.join("; ")}`);
11
+ return descriptor;
12
+ }
13
+ /** What is wrong with a value offered as a descriptor, in words; none when it is one. */
14
+ export function descriptorProblems(value) {
15
+ if (typeof value !== "object" || value === null)
16
+ return ["it is not an object"];
17
+ const d = value;
18
+ const problems = [];
19
+ if (typeof d.id !== "string" || !ID.test(d.id))
20
+ problems.push(`id ${JSON.stringify(d.id)} is not lowercase letters, digits and hyphens`);
21
+ if (typeof d.label !== "string" || d.label.trim() === "")
22
+ problems.push("label is not a name in words");
23
+ if (typeof d.metered !== "boolean")
24
+ problems.push("metered is not true or false");
25
+ if (typeof d.load !== "function")
26
+ problems.push("load is not a function that imports the provider module");
27
+ if (!Array.isArray(d.mounts) || d.mounts.some((kind) => kind !== "bind" && kind !== "archil"))
28
+ problems.push("mounts is not a list of mount kinds (bind, archil)");
29
+ if (!Array.isArray(d.network) || d.network.length === 0 || d.network.some((form) => form !== "none" && form !== "open" && form !== "allow"))
30
+ problems.push("network is not a list of the network forms its computers make (none, open, allow)");
31
+ if (!Array.isArray(d.capabilities) || d.capabilities.length === 0)
32
+ problems.push("capabilities is not a list of one configuration or more");
33
+ else if (d.capabilities.some((one) => typeof one?.kind !== "string" || !Array.isArray(one.groups)))
34
+ problems.push("each configuration is a machine kind and its groups");
35
+ else {
36
+ const images = new Set();
37
+ for (const one of d.capabilities) {
38
+ if (one.image !== undefined && (typeof one.image !== "string" || one.image.trim() === "" || one.image !== one.image.trim()))
39
+ problems.push(`a configuration's image ${JSON.stringify(one.image)} is not a name`);
40
+ else if (one.image !== undefined && images.has(`${one.kind} ${one.image}`))
41
+ problems.push(`two ${one.kind} configurations have the image ${one.image}`);
42
+ else if (one.image !== undefined)
43
+ images.add(`${one.kind} ${one.image}`);
44
+ if (one.options !== undefined && (typeof one.options !== "object" || one.options === null || Array.isArray(one.options)))
45
+ problems.push("a configuration's options are an object, as create() takes them");
46
+ }
47
+ }
48
+ const named = (list, what) => {
49
+ if (list === undefined)
50
+ return;
51
+ if (!Array.isArray(list))
52
+ return void problems.push(`${what} is not a list`);
53
+ const names = new Set();
54
+ const options = new Set();
55
+ for (const one of list) {
56
+ if (typeof one?.name !== "string" || one.name === "" || typeof one.option !== "string" || one.option === "")
57
+ problems.push(`each of ${what} has a name and the option it fills`);
58
+ else if (names.has(one.name) || options.has(one.option))
59
+ problems.push(`${what} names ${one.name} or fills ${one.option} twice`);
60
+ else
61
+ names.add(one.name), options.add(one.option);
62
+ }
63
+ };
64
+ if (d.keys === undefined)
65
+ problems.push("keys is not a list");
66
+ named(d.keys, "keys");
67
+ named(d.settings, "settings");
68
+ if (Array.isArray(d.keys) && d.keys.some((key) => typeof key?.required !== "boolean"))
69
+ problems.push("each key says whether it is required");
70
+ if (d.ledger !== undefined && (typeof d.ledger?.option !== "string" || d.ledger.option === ""))
71
+ problems.push("ledger names the option it fills");
72
+ if (d.imageEnv !== undefined && (typeof d.imageEnv !== "string" || !/^[A-Z][A-Z0-9_]*$/.test(d.imageEnv)))
73
+ problems.push("imageEnv is an environment variable name (capital letters, digits and underscores)");
74
+ if (d.hostEnv !== undefined && (!Array.isArray(d.hostEnv) || d.hostEnv.some((name) => typeof name !== "string" || name === "")))
75
+ problems.push("hostEnv is a list of environment variable names");
76
+ if (d.hostCommand !== undefined) {
77
+ const { command, from, builds } = (d.hostCommand ?? {});
78
+ if (typeof command !== "string" || !/^[A-Za-z0-9._-]+$/.test(command))
79
+ problems.push("hostCommand's command is a program's name, with no path");
80
+ if (typeof from !== "string" || from.trim() === "")
81
+ problems.push("hostCommand says in words what installs it (from)");
82
+ if (builds !== undefined && (!Array.isArray(builds) || builds.length === 0 || builds.some((one) => typeof one !== "string" || !/^[a-z0-9]+-[a-z0-9]+$/.test(one))))
83
+ problems.push("hostCommand's builds are machines as Node names them (linux-x64)");
84
+ }
85
+ if (d.parked !== undefined) {
86
+ if (!Array.isArray(d.parked) || d.parked.some((one) => typeof one?.image !== "string" || one.image === "" || typeof one.why !== "string" || one.why === "" || typeof one.kind !== "string" || !Array.isArray(one.groups)))
87
+ problems.push("parked is a list of configurations, each with its image and why it is parked");
88
+ else if (Array.isArray(d.capabilities) && d.parked.some((one) => d.capabilities.some((offered) => offered?.image === one.image)))
89
+ problems.push("a parked image is also offered");
90
+ }
91
+ return problems;
92
+ }
@@ -0,0 +1,25 @@
1
+ export declare const BROWSERBASE: {
2
+ readonly id: "browserbase";
3
+ readonly label: "Browserbase";
4
+ readonly keys: readonly [{
5
+ readonly name: "BROWSERBASE_API_KEY";
6
+ readonly option: "apiKey";
7
+ readonly required: true;
8
+ }, {
9
+ readonly name: "BROWSERBASE_PROJECT_ID";
10
+ readonly option: "projectId";
11
+ readonly required: true;
12
+ }];
13
+ readonly metered: true;
14
+ readonly mounts: readonly [];
15
+ readonly network: readonly ["open"];
16
+ readonly hostEnv: readonly ["BROWSERBASE_BASE_URL", "BROWSERBASE_CONNECT_BASE_URL"];
17
+ readonly capabilities: readonly [{
18
+ readonly kind: "browser";
19
+ readonly groups: ["cdp", "stream"];
20
+ }];
21
+ readonly defaultImage: {
22
+ readonly browser: "chromium";
23
+ };
24
+ readonly load: () => Promise<typeof import("../browserbase.js")>;
25
+ };
@@ -0,0 +1,20 @@
1
+ // Browserbase's descriptor: a cloud Chromium over CDP, with its live view.
2
+ import { defineProvider } from "../descriptor.js";
3
+ import { BROWSER_IMAGE } from "./shared.js";
4
+ export const BROWSERBASE = defineProvider({
5
+ id: "browserbase",
6
+ label: "Browserbase",
7
+ keys: [
8
+ { name: "BROWSERBASE_API_KEY", option: "apiKey", required: true },
9
+ { name: "BROWSERBASE_PROJECT_ID", option: "projectId", required: true },
10
+ ],
11
+ metered: true,
12
+ mounts: [],
13
+ // Browserbase's own network, open: it cannot be closed or narrowed.
14
+ network: ["open"],
15
+ // A server behind a gateway that fronts Browserbase's API or its sessions' sockets names it here.
16
+ hostEnv: ["BROWSERBASE_BASE_URL", "BROWSERBASE_CONNECT_BASE_URL"],
17
+ capabilities: [{ kind: "browser", groups: ["cdp", "stream"] }],
18
+ defaultImage: { browser: BROWSER_IMAGE },
19
+ load: () => import("../browserbase.js"),
20
+ });
@@ -0,0 +1,83 @@
1
+ import type { GpuCapability } from "../provider.js";
2
+ /** The image a Daytona computer starts from when its spec names "default": Daytona's own default snapshot. */
3
+ export declare const DAYTONA_DEFAULT_SNAPSHOT = "default";
4
+ /** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
5
+ export declare const DAYTONA_GPU_REGION = "earth";
6
+ /**
7
+ * The snapshot every GPU sandbox is made from: Daytona's general GPU snapshot, its default sandbox image (user daytona,
8
+ * passwordless sudo) with the CUDA toolkit, as Daytona's dashboard makes one (GET /snapshots/daytona-gpu, 11-11). A GPU
9
+ * spec names it, or "default"; no other snapshot is proven to give a GPU computer, so check() refuses one.
10
+ */
11
+ export declare const DAYTONA_GPU_SNAPSHOT = "daytona-gpu";
12
+ /**
13
+ * The GPU a snapshot gives every sandbox made from it. A Daytona snapshot carries its own resources, GPUs among them: a
14
+ * create that names a snapshot sends none (Daytona answers 400 "Cannot specify Sandbox resources when using a
15
+ * snapshot", live 11-11), so a GPU computer's type and count are its snapshot's, and the read-back is held to them.
16
+ */
17
+ export interface DaytonaSnapshotGpu {
18
+ type: string;
19
+ count: number;
20
+ }
21
+ /** daytona-gpu's GPU, as GET /snapshots/daytona-gpu declares it (gpu 1, gpuType H100; 11-11). */
22
+ export declare const DAYTONA_GPU_SNAPSHOT_GPU: Readonly<DaytonaSnapshotGpu>;
23
+ /**
24
+ * The GPUs Daytona offers, as capabilities().gpu and its configuration declare them: the GPU of its GPU snapshot,
25
+ * daytona-gpu, alone (another type needs a snapshot of its own), with its limits on a GPU sandbox: its stop deletes it
26
+ * (no pause, no snapshot: nothing is kept), it runs in region earth, it has the snapshot's 16 vCPUs, 100 GiB of memory
27
+ * and 400 GiB of disk, it may be preempted (daytona.io/pricing lists its GPUs as "Preemptible GPU prices", 11-10), and
28
+ * it takes no mount: Daytona's GPU host gives no /dev/fuse, even to root (live 11-11), and the archil client mounts
29
+ * through FUSE, so an Archil mount is refused in words.
30
+ */
31
+ export declare const DAYTONA_GPU: Readonly<GpuCapability>;
32
+ /** The snapshot a provider makes its GPU computers from, and its GPU. */
33
+ export interface DaytonaGpuSnapshot extends DaytonaSnapshotGpu {
34
+ snapshot: string;
35
+ }
36
+ /**
37
+ * The GPU snapshot a provider with the gpuSnapshot option (or none) makes its GPU computers from: daytona-gpu when none
38
+ * is given; else ours, with the GPU its name says. Throws in words for a name that is not one of ours
39
+ * (box/build-daytona.py --gpu prints it).
40
+ */
41
+ export declare function daytonaGpuSnapshot(gpuSnapshot?: string): DaytonaGpuSnapshot;
42
+ /** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and no mount, the snapshot's GPU): a copy. */
43
+ export declare function daytonaGpu(gpuSnapshot?: string): GpuCapability;
44
+ export declare const DAYTONA: {
45
+ readonly id: "daytona";
46
+ readonly label: "Daytona";
47
+ readonly keys: readonly [{
48
+ readonly name: "DAYTONA_API_KEY";
49
+ readonly option: "apiKey";
50
+ readonly required: true;
51
+ }, {
52
+ readonly name: "DAYTONA_API_URL";
53
+ readonly option: "apiUrl";
54
+ readonly required: false;
55
+ }, {
56
+ readonly name: "DAYTONA_TARGET";
57
+ readonly option: "target";
58
+ readonly required: false;
59
+ }, {
60
+ readonly name: "DAYTONA_ARCHIL_EGRESS";
61
+ readonly option: "archilEgress";
62
+ readonly required: false;
63
+ }];
64
+ readonly metered: true;
65
+ readonly mounts: readonly ["archil"];
66
+ readonly network: readonly ["none"];
67
+ readonly capabilities: readonly [{
68
+ readonly gpu: Readonly<GpuCapability>;
69
+ readonly kind: import("../protocol.js").ComputerKind;
70
+ readonly groups: import("../protocol.js").Group[];
71
+ readonly persistence?: {
72
+ keepsState: true;
73
+ resume: boolean;
74
+ };
75
+ readonly image?: string;
76
+ readonly options?: Readonly<Record<string, unknown>>;
77
+ }];
78
+ readonly defaultImage: {
79
+ readonly sandbox: "default";
80
+ };
81
+ readonly imageEnv: "AGENTRUN_DAYTONA_SNAPSHOT";
82
+ readonly load: () => Promise<typeof import("../daytona.js")>;
83
+ };
@@ -0,0 +1,81 @@
1
+ // Daytona's descriptor: a sandbox on Daytona's cloud, the run's folder on an Archil disk, with GPUs when asked.
2
+ import { defineProvider } from "../descriptor.js";
3
+ import { SANDBOX } from "./shared.js";
4
+ /** The image a Daytona computer starts from when its spec names "default": Daytona's own default snapshot. */
5
+ export const DAYTONA_DEFAULT_SNAPSHOT = "default";
6
+ /** The one region Daytona runs a GPU sandbox in, whatever the provider's target. */
7
+ export const DAYTONA_GPU_REGION = "earth";
8
+ /**
9
+ * The snapshot every GPU sandbox is made from: Daytona's general GPU snapshot, its default sandbox image (user daytona,
10
+ * passwordless sudo) with the CUDA toolkit, as Daytona's dashboard makes one (GET /snapshots/daytona-gpu, 11-11). A GPU
11
+ * spec names it, or "default"; no other snapshot is proven to give a GPU computer, so check() refuses one.
12
+ */
13
+ export const DAYTONA_GPU_SNAPSHOT = "daytona-gpu";
14
+ /** daytona-gpu's GPU, as GET /snapshots/daytona-gpu declares it (gpu 1, gpuType H100; 11-11). */
15
+ export const DAYTONA_GPU_SNAPSHOT_GPU = Object.freeze({ type: "H100", count: 1 });
16
+ /**
17
+ * The GPUs Daytona offers, as capabilities().gpu and its configuration declare them: the GPU of its GPU snapshot,
18
+ * daytona-gpu, alone (another type needs a snapshot of its own), with its limits on a GPU sandbox: its stop deletes it
19
+ * (no pause, no snapshot: nothing is kept), it runs in region earth, it has the snapshot's 16 vCPUs, 100 GiB of memory
20
+ * and 400 GiB of disk, it may be preempted (daytona.io/pricing lists its GPUs as "Preemptible GPU prices", 11-10), and
21
+ * it takes no mount: Daytona's GPU host gives no /dev/fuse, even to root (live 11-11), and the archil client mounts
22
+ * through FUSE, so an Archil mount is refused in words.
23
+ */
24
+ export const DAYTONA_GPU = Object.freeze({
25
+ types: [DAYTONA_GPU_SNAPSHOT_GPU.type],
26
+ max: DAYTONA_GPU_SNAPSHOT_GPU.count,
27
+ preemptible: true,
28
+ stopDeletes: true,
29
+ region: DAYTONA_GPU_REGION,
30
+ perGpu: { cpus: 16, memoryMb: 100 * 1024, diskMb: 400 * 1024 },
31
+ mounts: [],
32
+ unmounted: Object.freeze({ why: "Daytona's GPU runtime gives it no /dev/fuse", yet: false }),
33
+ });
34
+ /**
35
+ * Our GPU snapshots: box/Dockerfile built with a GPU (box/build-daytona.py --gpu <type>), named
36
+ * agentrun-archil-gpu-<type>-<the recipe's hash>. Their user is root and they carry the Archil client and our helper,
37
+ * but their GPU computers take no mount either: Daytona's GPU host gives no /dev/fuse. The name says the GPU: one of
38
+ * the type it names (the build's resources).
39
+ */
40
+ const ARCHIL_GPU_SNAPSHOT = /^agentrun-archil-gpu-(h100)-[0-9a-f]{12}$/;
41
+ const ARCHIL_GPU_TYPES = { h100: "H100" };
42
+ /**
43
+ * The GPU snapshot a provider with the gpuSnapshot option (or none) makes its GPU computers from: daytona-gpu when none
44
+ * is given; else ours, with the GPU its name says. Throws in words for a name that is not one of ours
45
+ * (box/build-daytona.py --gpu prints it).
46
+ */
47
+ export function daytonaGpuSnapshot(gpuSnapshot) {
48
+ if (gpuSnapshot === undefined)
49
+ return { snapshot: DAYTONA_GPU_SNAPSHOT, ...DAYTONA_GPU_SNAPSHOT_GPU };
50
+ const named = ARCHIL_GPU_SNAPSHOT.exec(gpuSnapshot);
51
+ const type = named === null ? undefined : ARCHIL_GPU_TYPES[named[1]];
52
+ if (type === undefined)
53
+ throw new Error(`gpuSnapshot ${JSON.stringify(gpuSnapshot)} is not a GPU snapshot of box/Dockerfile: box/build-daytona.py --gpu H100 prints its name, agentrun-archil-gpu-h100-<12 hex digits>`);
54
+ return { snapshot: gpuSnapshot, type, count: 1 };
55
+ }
56
+ /** The GPUs a provider declares for its GPU snapshot (DAYTONA_GPU's limits and no mount, the snapshot's GPU): a copy. */
57
+ export function daytonaGpu(gpuSnapshot) {
58
+ const { type, count } = daytonaGpuSnapshot(gpuSnapshot);
59
+ return { ...DAYTONA_GPU, types: [type], max: count, perGpu: { ...DAYTONA_GPU.perGpu }, mounts: [] };
60
+ }
61
+ export const DAYTONA = defineProvider({
62
+ id: "daytona",
63
+ label: "Daytona",
64
+ keys: [
65
+ { name: "DAYTONA_API_KEY", option: "apiKey", required: true },
66
+ { name: "DAYTONA_API_URL", option: "apiUrl", required: false },
67
+ { name: "DAYTONA_TARGET", option: "target", required: false },
68
+ { name: "DAYTONA_ARCHIL_EGRESS", option: "archilEgress", required: false },
69
+ ],
70
+ metered: true,
71
+ mounts: ["archil"],
72
+ // None: its programs run in a network of their own (isolation.ts OWN_NETWORK_ONLY).
73
+ network: ["none"],
74
+ // A linux computer, with GPUs when asked.
75
+ capabilities: [{ ...SANDBOX, gpu: DAYTONA_GPU }],
76
+ defaultImage: { sandbox: DAYTONA_DEFAULT_SNAPSHOT },
77
+ // A Daytona computer that mounts the run's folder from Archil needs a snapshot of box/Dockerfile (build-daytona.py
78
+ // builds one and prints its name): the operator names it here, and the default snapshot stands while unset.
79
+ imageEnv: "AGENTRUN_DAYTONA_SNAPSHOT",
80
+ load: () => import("../daytona.js"),
81
+ });
@@ -0,0 +1,12 @@
1
+ export declare const DOCKER: {
2
+ readonly id: "docker";
3
+ readonly label: "Docker";
4
+ readonly keys: readonly [];
5
+ readonly metered: false;
6
+ readonly mounts: readonly ["bind"];
7
+ readonly network: readonly ["none", "open", "allow"];
8
+ readonly capabilities: readonly [import("../kinds.js").KindCapabilities, import("../kinds.js").KindCapabilities];
9
+ readonly prepareImage: true;
10
+ readonly local: true;
11
+ readonly load: () => Promise<typeof import("../docker.js")>;
12
+ };
@@ -0,0 +1,17 @@
1
+ // Docker's descriptor: computers on this machine's Docker, a sandbox or a desktop; no key, no meter.
2
+ import { defineProvider } from "../descriptor.js";
3
+ import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
4
+ export const DOCKER = defineProvider({
5
+ id: "docker",
6
+ label: "Docker",
7
+ keys: [],
8
+ metered: false,
9
+ mounts: ["bind"],
10
+ // None, open, or an allowlist through the server's egress proxy.
11
+ network: ["none", "open", "allow"],
12
+ capabilities: [SANDBOX, LINUX_DESKTOP],
13
+ // No default image: the server makes one from the provider's recipe (prepareImage) before the first create.
14
+ prepareImage: true,
15
+ local: true,
16
+ load: () => import("../docker.js"),
17
+ });
@@ -0,0 +1,22 @@
1
+ /** E2B Desktop's template: a desktop computer when its setting names no image. */
2
+ export declare const E2B_DESKTOP_TEMPLATE = "desktop";
3
+ /** E2B's base template: a sandbox when its setting names no image. */
4
+ export declare const E2B_BASE_TEMPLATE = "base";
5
+ export declare const E2B: {
6
+ readonly id: "e2b";
7
+ readonly label: "E2B";
8
+ readonly keys: readonly [{
9
+ readonly name: "E2B_API_KEY";
10
+ readonly option: "apiKey";
11
+ readonly required: true;
12
+ }];
13
+ readonly metered: true;
14
+ readonly mounts: readonly ["archil"];
15
+ readonly network: readonly ["none"];
16
+ readonly capabilities: readonly [import("../kinds.js").KindCapabilities, import("../kinds.js").KindCapabilities];
17
+ readonly defaultImage: {
18
+ readonly sandbox: "base";
19
+ readonly desktop: "desktop";
20
+ };
21
+ readonly load: () => Promise<typeof import("../e2b.js")>;
22
+ };
@@ -0,0 +1,19 @@
1
+ // E2B's descriptor: a sandbox (the base template) or a desktop (E2B Desktop), the run's folder on an Archil disk.
2
+ import { defineProvider } from "../descriptor.js";
3
+ import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
4
+ /** E2B Desktop's template: a desktop computer when its setting names no image. */
5
+ export const E2B_DESKTOP_TEMPLATE = "desktop";
6
+ /** E2B's base template: a sandbox when its setting names no image. */
7
+ export const E2B_BASE_TEMPLATE = "base";
8
+ export const E2B = defineProvider({
9
+ id: "e2b",
10
+ label: "E2B",
11
+ keys: [{ name: "E2B_API_KEY", option: "apiKey", required: true }],
12
+ metered: true,
13
+ mounts: ["archil"],
14
+ // None: its programs run in a network of their own (isolation.ts OWN_NETWORK_ONLY).
15
+ network: ["none"],
16
+ capabilities: [SANDBOX, LINUX_DESKTOP],
17
+ defaultImage: { sandbox: E2B_BASE_TEMPLATE, desktop: E2B_DESKTOP_TEMPLATE },
18
+ load: () => import("../e2b.js"),
19
+ });