@parcha/agentrun-computer 0.1.0-beta.32 → 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.
- package/README.md +190 -26
- package/dist/browser.d.ts +1 -1
- package/dist/browser.js +6 -3
- package/dist/browserbase.d.ts +3 -1
- package/dist/browserbase.js +3 -1
- package/dist/child.d.ts +2 -0
- package/dist/child.js +13 -2
- package/dist/chrome.d.ts +73 -0
- package/dist/chrome.js +224 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/conformance/cases/gpu.d.ts +2 -0
- package/dist/conformance/cases/gpu.js +108 -0
- package/dist/conformance/cases/health.js +83 -3
- package/dist/conformance/cases/index.js +2 -0
- package/dist/conformance/cases/isolation.js +6 -0
- package/dist/conformance/cases/mount.d.ts +8 -1
- package/dist/conformance/cases/mount.js +4 -3
- package/dist/conformance/cases/provider.js +14 -0
- package/dist/conformance/cli.js +46 -7
- package/dist/conformance/daytona-sweep.js +17 -9
- package/dist/conformance/e2b-sweep.js +17 -10
- package/dist/conformance/local.d.ts +30 -0
- package/dist/conformance/local.js +36 -0
- package/dist/conformance/modal-sweep.js +32 -9
- package/dist/conformance/report.js +10 -5
- package/dist/conformance/runner.js +45 -13
- package/dist/conformance/types.d.ts +63 -16
- package/dist/daytona.d.ts +35 -4
- package/dist/daytona.js +113 -27
- package/dist/docker.d.ts +9 -1
- package/dist/docker.js +92 -7
- package/dist/drift.d.ts +3 -1
- package/dist/drift.js +9 -0
- package/dist/e2b.d.ts +6 -2
- package/dist/e2b.js +10 -6
- package/dist/index.d.ts +4 -2
- package/dist/index.js +4 -2
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +0 -16
- package/dist/kernel.d.ts +3 -1
- package/dist/kernel.js +3 -1
- package/dist/kinds.d.ts +10 -4
- package/dist/kinds.js +26 -6
- package/dist/labels.d.ts +6 -0
- package/dist/labels.js +26 -1
- package/dist/local-supervisor.d.ts +51 -0
- package/dist/local-supervisor.js +221 -0
- package/dist/local.d.ts +89 -0
- package/dist/local.js +472 -0
- package/dist/modal.d.ts +31 -4
- package/dist/modal.js +90 -30
- package/dist/orgo.d.ts +3 -1
- package/dist/orgo.js +14 -27
- package/dist/phone-harness.d.ts +3 -1
- package/dist/phone-harness.js +7 -4
- package/dist/protocol.d.ts +20 -0
- package/dist/protocol.js +9 -0
- package/dist/provider.d.ts +63 -3
- package/dist/provider.js +28 -0
- package/dist/providers.d.ts +7 -1
- package/dist/providers.js +1 -0
- package/package.json +1 -1
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]/;
|
|
@@ -94,6 +98,22 @@ const FIXED = "a Docker computer's network is fixed at create; create a new comp
|
|
|
94
98
|
const NETWORKS = 'network is required: "none", "open" or { allow: [names or CIDRs] }';
|
|
95
99
|
/** How often create asks whether the egress proxy is ready. */
|
|
96
100
|
const EGRESS_POLL_MS = 100;
|
|
101
|
+
/** After a docker run cut off before its own exit: how long, at most, the leftovers are removed and looked for again,
|
|
102
|
+
* how often, and for how long in a row the looks must find none of them before they count as gone (#settle). */
|
|
103
|
+
const SETTLE_MS = 10_000;
|
|
104
|
+
const SETTLE_EVERY_MS = 500;
|
|
105
|
+
const SETTLE_QUIET_MS = 3_000;
|
|
106
|
+
/**
|
|
107
|
+
* Why #settle could not show its leftovers gone within SETTLE_MS, in words that always name them: `there`, what its
|
|
108
|
+
* last look still found; or, when the last look found none but the quiet window was not complete, every name it
|
|
109
|
+
* checked (`checked`), which could not be confirmed gone. Exported for its test.
|
|
110
|
+
*/
|
|
111
|
+
export function settleWords(checked, there) {
|
|
112
|
+
if (there.length > 0)
|
|
113
|
+
return `${there.join(" and ")} ${there.length === 1 ? "was" : "were"} still there ${SETTLE_MS / 1000} s after docker run was cut off`;
|
|
114
|
+
const named = checked.length > 0 ? checked.join(" and ") : "what docker run may have made";
|
|
115
|
+
return `${named} could not be confirmed gone within ${SETTLE_MS / 1000} s after docker run was cut off: the last look found none, but not for ${SETTLE_QUIET_MS / 1000} s in a row`;
|
|
116
|
+
}
|
|
97
117
|
/** Only the fields hostOf reads, as JSON. */
|
|
98
118
|
const INFO_FORMAT = '{"Architecture":{{json .Architecture}},"SecurityOptions":{{json .SecurityOptions}},"MemoryLimit":{{json .MemoryLimit}},' +
|
|
99
119
|
'"SwapLimit":{{json .SwapLimit}},"PidsLimit":{{json .PidsLimit}},"CPUCfsQuota":{{json .CPUCfsQuota}},"CPUCfsPeriod":{{json .CPUCfsPeriod}},' +
|
|
@@ -173,7 +193,7 @@ export class DockerProvider {
|
|
|
173
193
|
return {
|
|
174
194
|
kind: this.#desktop ? "desktop" : "linux",
|
|
175
195
|
lifetime: "janitor",
|
|
176
|
-
network: [
|
|
196
|
+
network: [...NETWORK],
|
|
177
197
|
allow: { domains: { max: MAX_ALLOW, ports: [...ALLOW_PORTS] }, cidrs: { max: MAX_ALLOW, ports: [...ALLOW_PORTS] }, mixed: true },
|
|
178
198
|
networkReadBack: true,
|
|
179
199
|
isolation: "container",
|
|
@@ -243,6 +263,9 @@ export class DockerProvider {
|
|
|
243
263
|
refuse("network", NETWORKS);
|
|
244
264
|
if (cpus !== undefined && !(isNumber(cpus) && cpus >= 0.01))
|
|
245
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}`);
|
|
246
269
|
if (memoryMb !== undefined && !(isWhole(memoryMb) && memoryMb >= MIN_MEMORY_MB)) {
|
|
247
270
|
refuse("memoryMb", `memoryMb must be a whole number of MiB, at least ${MIN_MEMORY_MB}`);
|
|
248
271
|
}
|
|
@@ -268,6 +291,7 @@ export class DockerProvider {
|
|
|
268
291
|
if (mounts.length === 0 && typeof path === "string" && MOUNT_UNSAFE.test(path)) {
|
|
269
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`);
|
|
270
293
|
}
|
|
294
|
+
refusals.push(...checkGpu(given.gpu, this.capabilities()));
|
|
271
295
|
for (const [field, value] of Object.entries(given)) {
|
|
272
296
|
if (!SPEC_FIELDS.has(field) && value !== undefined)
|
|
273
297
|
refuse(field, `a Docker computer does not support ${field}`);
|
|
@@ -398,8 +422,16 @@ export class DockerProvider {
|
|
|
398
422
|
const ranMs = Date.now() - lifetimeFrom;
|
|
399
423
|
if (!started.ok || started.value.exitCode !== 0) {
|
|
400
424
|
// A run that failed or was aborted may still have made the container; an allowlist's proxy and volume go with it.
|
|
401
|
-
await this.release({ id: name, name }, "delete");
|
|
402
|
-
|
|
425
|
+
const released = await this.release({ id: name, name }, "delete");
|
|
426
|
+
if (started.ok)
|
|
427
|
+
return fail("docker", `docker run failed: ${started.value.stderr.trim()}`);
|
|
428
|
+
// Cut off before its own exit: the daemon may still make the computer after release looked, and then its egress
|
|
429
|
+
// volume with it (#settle).
|
|
430
|
+
const left = await this.#settle([name], allow === undefined ? [] : [egressNameOf(name)]);
|
|
431
|
+
const what = allow === undefined ? `the computer ${name}` : `the computer ${name}, its proxy and its volume`;
|
|
432
|
+
const removed = allow === undefined ? "was removed, if Docker made it after" : "were removed, if Docker made them after";
|
|
433
|
+
const words = !released.ok ? `${what} could not all be removed: ${released.error.message}` : left === undefined ? `${what} ${removed}` : `${what} could not all be removed: ${left}`;
|
|
434
|
+
return fail(started.error.code, `${started.error.message === "docker run was aborted" ? "create was aborted during docker run" : started.error.message}; ${words}`);
|
|
403
435
|
}
|
|
404
436
|
const ref = { id: started.value.stdout.trim(), name };
|
|
405
437
|
// From here the computer exists: every step takes the caller's signal, and an abort deletes the computer.
|
|
@@ -453,6 +485,55 @@ export class DockerProvider {
|
|
|
453
485
|
return fail("docker", `docker pull ${image} failed, so nothing was made: ${pulled.value.stderr.trim()}`);
|
|
454
486
|
return ok(undefined);
|
|
455
487
|
}
|
|
488
|
+
/**
|
|
489
|
+
* After a `docker run` that did not end with an exit of the CLI's own (it was aborted, or the CLI could not be run):
|
|
490
|
+
* the CLI client is gone, but the Docker daemon may still finish making the container a moment later, after a single
|
|
491
|
+
* `docker rm` found nothing, and leave it Created. So the containers and volumes named are removed by name, then
|
|
492
|
+
* inspected, again and again SETTLE_EVERY_MS apart, until the looks have found none of them for SETTLE_QUIET_MS in a
|
|
493
|
+
* row (a create that lands a second after the abort is still seen), on a bound of their own (SETTLE_MS), never the
|
|
494
|
+
* caller's signal, which has already ended. Undefined when they are gone; else what is still there, or could not be
|
|
495
|
+
* confirmed gone, in words (settleWords). A create later than that is the janitor's: sweepLeftovers takes it at the
|
|
496
|
+
* next sweep, past #leftoverGraceMs, which stays the backstop.
|
|
497
|
+
*/
|
|
498
|
+
async #settle(containers, volumes) {
|
|
499
|
+
const bound = AbortSignal.timeout(SETTLE_MS);
|
|
500
|
+
// When the looks first found none of them in the current run of empty looks; there, what the last look found.
|
|
501
|
+
let quietSince;
|
|
502
|
+
// Each named as what it is: a container and a volume may share a name (the egress proxy's).
|
|
503
|
+
const containerWords = (name) => `the container ${name}`;
|
|
504
|
+
const volumeWords = (name) => `the volume ${name}`;
|
|
505
|
+
const checked = [...containers.map(containerWords), ...volumes.map(volumeWords)];
|
|
506
|
+
let there = checked;
|
|
507
|
+
while (!bound.aborted) {
|
|
508
|
+
// --volumes, as release removes a computer: a late container of an image that declares a VOLUME has its own.
|
|
509
|
+
for (const container of containers)
|
|
510
|
+
await this.#run(["rm", "--force", "--volumes", container], bound);
|
|
511
|
+
for (const volume of volumes)
|
|
512
|
+
await this.#run(["volume", "rm", "--force", volume], bound);
|
|
513
|
+
const found = containers.length === 0 ? ok([]) : await this.#inspect(containers, bound, "{{json .Name}}");
|
|
514
|
+
const listed = volumes.length === 0 ? undefined : await this.#run(["volume", "inspect", "--format", "{{.Name}}", ...volumes], bound);
|
|
515
|
+
// A look the bound cut off says nothing: what the last whole look found stands.
|
|
516
|
+
if (bound.aborted)
|
|
517
|
+
break;
|
|
518
|
+
// A read that fails for any reason but "no such" counts as all still there.
|
|
519
|
+
const unread = (ran) => ran.exitCode !== 0 && ran.stderr.split("\n").some((line) => line.trim() !== "" && !/no such volume/i.test(line));
|
|
520
|
+
const foundNames = found.ok ? found.value.map((name) => String(name).replace(/^\//, "")) : containers;
|
|
521
|
+
const listedText = listed === undefined ? "" : listed.ok && !unread(listed.value) ? listed.value.stdout : undefined;
|
|
522
|
+
there = [
|
|
523
|
+
...containers.filter((name) => foundNames.includes(name)).map(containerWords),
|
|
524
|
+
...volumes.filter((name) => listedText === undefined || listedText.split("\n").some((line) => line.includes(name))).map(volumeWords),
|
|
525
|
+
];
|
|
526
|
+
if (there.length > 0)
|
|
527
|
+
quietSince = undefined;
|
|
528
|
+
else {
|
|
529
|
+
quietSince ??= Date.now();
|
|
530
|
+
if (Date.now() - quietSince >= SETTLE_QUIET_MS)
|
|
531
|
+
return undefined;
|
|
532
|
+
}
|
|
533
|
+
await sleep(SETTLE_EVERY_MS, undefined, { signal: bound }).catch(() => undefined);
|
|
534
|
+
}
|
|
535
|
+
return settleWords(checked, there);
|
|
536
|
+
}
|
|
456
537
|
/** Deletes a computer whose create was aborted after docker run; the delete itself is not signalled. */
|
|
457
538
|
async #abandon(ref) {
|
|
458
539
|
const removed = await this.release(ref, "delete");
|
|
@@ -474,8 +555,12 @@ export class DockerProvider {
|
|
|
474
555
|
const { image, hint, readyMs } = this.#egress;
|
|
475
556
|
const args = egressRunArgs({ name, user, image, allow, local: this.#hostLocal(), deadline, code: this.#code, labels, ...(hint === undefined ? {} : { hint }) });
|
|
476
557
|
const ran = await this.#run(args, signal);
|
|
477
|
-
if (!ran.ok)
|
|
478
|
-
|
|
558
|
+
if (!ran.ok) {
|
|
559
|
+
// Cut off before its own exit: the daemon may still make the proxy after the caller's cleanup looked (#settle).
|
|
560
|
+
const left = await this.#settle([proxy], [proxy]);
|
|
561
|
+
const words = left === undefined ? "the proxy and its volume, if Docker made them after, were removed" : `the proxy and its volume could not all be removed: ${left}`;
|
|
562
|
+
return fail(ran.error.code, `${ran.error.message === "docker run was aborted" ? "create was aborted during docker run of the egress proxy" : ran.error.message}; ${words}`);
|
|
563
|
+
}
|
|
479
564
|
if (ran.value.exitCode !== 0)
|
|
480
565
|
return fail("docker", `docker run of the egress proxy ${proxy} failed: ${ran.value.stderr.trim()}`);
|
|
481
566
|
// Every call of the poll ends at the readiness bound, so a docker that stops answering cannot hold create past it: a
|
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
|
|
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. */
|
|
@@ -298,10 +300,12 @@ export declare class E2BProvider implements ComputerProvider {
|
|
|
298
300
|
* page and every read-back.
|
|
299
301
|
*/
|
|
300
302
|
list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
|
|
301
|
-
/** For the sweep: every sandbox E2B lists with agentrun.computer=1, whatever its name, as E2B reports it
|
|
303
|
+
/** For the sweep: every sandbox E2B lists with agentrun.computer=1, whatever its name, as E2B reports it, with its
|
|
304
|
+
* metadata as its labels (the sweep kills only a conformance run's). */
|
|
302
305
|
listLabelled({ signal }?: CallContext): Promise<Result<Array<{
|
|
303
306
|
id: string;
|
|
304
307
|
state: string;
|
|
308
|
+
labels: Record<string, string>;
|
|
305
309
|
}>>>;
|
|
306
310
|
/** For the sweep: whether E2B still has a sandbox, read once by getInfo; not_found is gone. */
|
|
307
311
|
probeGone(id: string, { signal }?: CallContext): Promise<Result<{
|
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: [
|
|
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) });
|
|
@@ -1244,10 +1247,11 @@ export class E2BProvider {
|
|
|
1244
1247
|
}
|
|
1245
1248
|
return ok(infos);
|
|
1246
1249
|
}
|
|
1247
|
-
/** For the sweep: every sandbox E2B lists with agentrun.computer=1, whatever its name, as E2B reports it
|
|
1250
|
+
/** For the sweep: every sandbox E2B lists with agentrun.computer=1, whatever its name, as E2B reports it, with its
|
|
1251
|
+
* metadata as its labels (the sweep kills only a conformance run's). */
|
|
1248
1252
|
async listLabelled({ signal } = {}) {
|
|
1249
1253
|
const listed = await this.#listPages({ [COMPUTER_LABEL]: "1" }, signal);
|
|
1250
|
-
return listed.ok ? ok(listed.value.map((sb) => ({ id: sb.sandboxId, state: sb.state }))) : listed;
|
|
1254
|
+
return listed.ok ? ok(listed.value.map((sb) => ({ id: sb.sandboxId, state: sb.state, labels: { ...(sb.metadata ?? {}) } }))) : listed;
|
|
1251
1255
|
}
|
|
1252
1256
|
/** For the sweep: whether E2B still has a sandbox, read once by getInfo; not_found is gone. */
|
|
1253
1257
|
async probeGone(id, { signal } = {}) {
|
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";
|
package/dist/isolation.d.ts
CHANGED
|
@@ -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: [
|
|
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. */
|
package/dist/kinds.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
// The default images are values: each from the provider module that owns it. Those modules import this one for types
|
|
8
8
|
// alone, so this is no import cycle.
|
|
9
9
|
import { BROWSER_IMAGE } from "./browser.js";
|
|
10
|
-
import { DAYTONA_DEFAULT_SNAPSHOT } from "./daytona.js";
|
|
10
|
+
import { DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU } from "./daytona.js";
|
|
11
11
|
import { E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE } from "./e2b.js";
|
|
12
|
-
import { MODAL_DEFAULT_IMAGE } from "./modal.js";
|
|
12
|
+
import { MODAL_DEFAULT_IMAGE, MODAL_GPU } from "./modal.js";
|
|
13
13
|
import { ORGO_BASE_IMAGE } from "./orgo.js";
|
|
14
14
|
import { PHONE_IMAGE } from "./phone-harness.js";
|
|
15
15
|
export const SETTING_KINDS = {
|
|
@@ -47,16 +47,18 @@ export function kindOf(capabilities) {
|
|
|
47
47
|
}
|
|
48
48
|
const SANDBOX = { kind: "linux", groups: ["exec", "files", "processes"] };
|
|
49
49
|
const LINUX_DESKTOP = { kind: "desktop", groups: ["exec", "files", "processes", "screen", "input.pointer", "input.keys"] };
|
|
50
|
+
/** A provider's GPU capability as its configuration carries it: a deep copy of the module's own. */
|
|
51
|
+
const gpuOf = (gpu) => structuredClone(gpu);
|
|
50
52
|
/** An entry with its kinds derived from its capabilities. */
|
|
51
53
|
function entry(fields) {
|
|
52
54
|
return { ...fields, kinds: SETTING_KIND_NAMES.filter((kind) => fields.capabilities.some((one) => serves(one, kind))) };
|
|
53
55
|
}
|
|
54
56
|
/**
|
|
55
57
|
* Every provider Settings offers, each with its provider file in the registry;
|
|
56
|
-
* a unit test then holds each to its module (CAPABILITIES, MOUNT). daytona, modal and e2b take archil mounts.
|
|
58
|
+
* a unit test then holds each to its module (CAPABILITIES, MOUNT, NETWORK). daytona, modal and e2b take archil mounts.
|
|
57
59
|
*/
|
|
58
60
|
export const PROVIDERS = [
|
|
59
|
-
entry({ id: "docker", label: "Docker", keys: [], mounts: ["bind"], metered: false, capabilities: [SANDBOX, LINUX_DESKTOP] }),
|
|
61
|
+
entry({ id: "docker", label: "Docker", keys: [], mounts: ["bind"], network: ["none", "open", "allow"], metered: false, capabilities: [SANDBOX, LINUX_DESKTOP] }),
|
|
60
62
|
entry({
|
|
61
63
|
id: "daytona",
|
|
62
64
|
label: "Daytona",
|
|
@@ -66,8 +68,9 @@ export const PROVIDERS = [
|
|
|
66
68
|
{ name: "DAYTONA_TARGET", required: false },
|
|
67
69
|
],
|
|
68
70
|
mounts: ["archil"],
|
|
71
|
+
network: ["none"],
|
|
69
72
|
metered: true,
|
|
70
|
-
capabilities: [SANDBOX],
|
|
73
|
+
capabilities: [{ ...SANDBOX, gpu: gpuOf(DAYTONA_GPU) }],
|
|
71
74
|
defaultImage: { sandbox: DAYTONA_DEFAULT_SNAPSHOT },
|
|
72
75
|
}),
|
|
73
76
|
entry({
|
|
@@ -78,8 +81,9 @@ export const PROVIDERS = [
|
|
|
78
81
|
{ name: "MODAL_TOKEN_SECRET", required: true },
|
|
79
82
|
],
|
|
80
83
|
mounts: ["archil"],
|
|
84
|
+
network: ["none"],
|
|
81
85
|
metered: true,
|
|
82
|
-
capabilities: [SANDBOX],
|
|
86
|
+
capabilities: [{ ...SANDBOX, gpu: gpuOf(MODAL_GPU) }],
|
|
83
87
|
defaultImage: { sandbox: MODAL_DEFAULT_IMAGE },
|
|
84
88
|
}),
|
|
85
89
|
entry({
|
|
@@ -87,6 +91,7 @@ export const PROVIDERS = [
|
|
|
87
91
|
label: "E2B",
|
|
88
92
|
keys: [{ name: "E2B_API_KEY", required: true }],
|
|
89
93
|
mounts: ["archil"],
|
|
94
|
+
network: ["none"],
|
|
90
95
|
metered: true,
|
|
91
96
|
capabilities: [SANDBOX, LINUX_DESKTOP],
|
|
92
97
|
defaultImage: { sandbox: E2B_BASE_TEMPLATE, desktop: E2B_DESKTOP_TEMPLATE },
|
|
@@ -96,6 +101,7 @@ export const PROVIDERS = [
|
|
|
96
101
|
label: "Orgo",
|
|
97
102
|
keys: [{ name: "ORGO_API_KEY", required: true }],
|
|
98
103
|
mounts: [],
|
|
104
|
+
network: ["none"],
|
|
99
105
|
metered: true,
|
|
100
106
|
capabilities: [LINUX_DESKTOP],
|
|
101
107
|
defaultImage: { desktop: ORGO_BASE_IMAGE },
|
|
@@ -105,6 +111,7 @@ export const PROVIDERS = [
|
|
|
105
111
|
label: "Phone harness",
|
|
106
112
|
keys: [{ name: "PHONE_HARNESS_API_KEY", required: true }],
|
|
107
113
|
mounts: [],
|
|
114
|
+
network: ["open"],
|
|
108
115
|
metered: true,
|
|
109
116
|
capabilities: [{ kind: "android", groups: ["screen", "input.touch", "input.keys", "apps", "apps.ui_tree"] }],
|
|
110
117
|
defaultImage: { phone: PHONE_IMAGE },
|
|
@@ -117,6 +124,7 @@ export const PROVIDERS = [
|
|
|
117
124
|
{ name: "BROWSERBASE_PROJECT_ID", required: true },
|
|
118
125
|
],
|
|
119
126
|
mounts: [],
|
|
127
|
+
network: ["open"],
|
|
120
128
|
metered: true,
|
|
121
129
|
capabilities: [{ kind: "browser", groups: ["cdp", "stream"] }],
|
|
122
130
|
defaultImage: { browser: BROWSER_IMAGE },
|
|
@@ -126,8 +134,20 @@ export const PROVIDERS = [
|
|
|
126
134
|
label: "Kernel",
|
|
127
135
|
keys: [{ name: "KERNEL_API_KEY", required: true }],
|
|
128
136
|
mounts: [],
|
|
137
|
+
network: ["open"],
|
|
129
138
|
metered: true,
|
|
130
139
|
capabilities: [{ kind: "browser", groups: ["cdp", "stream"] }],
|
|
131
140
|
defaultImage: { browser: BROWSER_IMAGE },
|
|
132
141
|
}),
|
|
142
|
+
// This machine's Chrome: no key, nothing billed, no live view (a person watching runs it headed).
|
|
143
|
+
entry({
|
|
144
|
+
id: "local",
|
|
145
|
+
label: "Local Chrome",
|
|
146
|
+
keys: [],
|
|
147
|
+
mounts: [],
|
|
148
|
+
network: ["open", "allow"],
|
|
149
|
+
metered: false,
|
|
150
|
+
capabilities: [{ kind: "browser", groups: ["cdp"] }],
|
|
151
|
+
defaultImage: { browser: BROWSER_IMAGE },
|
|
152
|
+
}),
|
|
133
153
|
];
|
package/dist/labels.d.ts
CHANGED
|
@@ -5,6 +5,12 @@ export { epochProblem };
|
|
|
5
5
|
export declare const RUN_LABEL = "agentrun.run";
|
|
6
6
|
/** The claim epoch of the run's runner that made the computer, in decimal. */
|
|
7
7
|
export declare const EPOCH_LABEL = "agentrun.epoch";
|
|
8
|
+
/** The run label's hash (runHash), listed in place of RUN_LABEL by a provider that keeps only the hash and is listed
|
|
9
|
+
* with no run label to match. */
|
|
10
|
+
export declare const RUN_HASH_LABEL = "agentrun.run.hash";
|
|
11
|
+
/** The run label's hash, as a provider keeps it where the run itself doesn't fit (a computer's name): base32 of its
|
|
12
|
+
* sha256, lower case, 16 letters. */
|
|
13
|
+
export declare function runHash(run: string): string;
|
|
8
14
|
/**
|
|
9
15
|
* Why run is not a run id, in words, or undefined when it is one: a non-empty string with no NUL byte. That is the
|
|
10
16
|
* strictest rule the providers share for a label's value (Docker, Daytona and Modal each refuse only a NUL), so every
|