@parcha/agentrun-computer 0.1.0-beta.57 → 0.1.0-beta.59
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 +187 -62
- package/box/Dockerfile +4 -3
- package/box/install.sh +57 -11
- package/dist/agent37.js +6 -9
- package/dist/attach.d.ts +24 -4
- package/dist/attach.js +50 -19
- package/dist/boxd.js +22 -9
- package/dist/browserbase.d.ts +6 -2
- package/dist/browserbase.js +50 -7
- package/dist/child-env.d.ts +11 -0
- package/dist/child-env.js +22 -0
- package/dist/chrome.d.ts +5 -2
- package/dist/chrome.js +5 -2
- package/dist/cloudflare.d.ts +2 -0
- package/dist/cloudflare.js +5 -3
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +1 -1
- package/dist/conformance/agent37.d.ts +10 -38
- package/dist/conformance/agent37.js +25 -113
- package/dist/conformance/archil.d.ts +13 -3
- package/dist/conformance/archil.js +22 -17
- package/dist/conformance/boxd.d.ts +8 -31
- package/dist/conformance/boxd.js +19 -74
- package/dist/conformance/browserbase.d.ts +3 -6
- package/dist/conformance/browserbase.js +6 -17
- package/dist/conformance/cases/health.js +6 -3
- package/dist/conformance/cli.d.ts +3 -1
- package/dist/conformance/cli.js +69 -9
- package/dist/conformance/cloudflare.d.ts +3 -6
- package/dist/conformance/cloudflare.js +7 -15
- package/dist/conformance/daytona.d.ts +6 -20
- package/dist/conformance/daytona.js +22 -57
- package/dist/conformance/dial-only.d.ts +4 -3
- package/dist/conformance/dial-only.js +3 -3
- package/dist/conformance/docker.d.ts +4 -5
- package/dist/conformance/docker.js +8 -14
- package/dist/conformance/e2b.d.ts +10 -36
- package/dist/conformance/e2b.js +27 -84
- package/dist/conformance/fly.d.ts +3 -6
- package/dist/conformance/fly.js +2 -6
- package/dist/conformance/groundbox.d.ts +7 -23
- package/dist/conformance/groundbox.js +16 -56
- package/dist/conformance/index.d.ts +1 -0
- package/dist/conformance/index.js +1 -0
- package/dist/conformance/kernel.d.ts +3 -6
- package/dist/conformance/kernel.js +5 -15
- package/dist/conformance/kind.d.ts +0 -6
- package/dist/conformance/kind.js +0 -4
- package/dist/conformance/local-chrome.d.ts +5 -7
- package/dist/conformance/local-chrome.js +7 -11
- package/dist/conformance/modal.d.ts +10 -38
- package/dist/conformance/modal.js +27 -74
- package/dist/conformance/module-kit.d.ts +87 -0
- package/dist/conformance/module-kit.js +88 -0
- package/dist/conformance/morph.d.ts +7 -23
- package/dist/conformance/morph.js +20 -66
- package/dist/conformance/orgo.d.ts +5 -10
- package/dist/conformance/orgo.js +15 -27
- package/dist/conformance/phone-harness.d.ts +3 -5
- package/dist/conformance/phone-harness.js +3 -11
- package/dist/conformance/runner.d.ts +13 -3
- package/dist/conformance/runner.js +32 -11
- package/dist/conformance/smolcloud.d.ts +7 -23
- package/dist/conformance/smolcloud.js +16 -49
- package/dist/conformance/sweep.d.ts +10 -5
- package/dist/conformance/sweep.js +91 -38
- package/dist/conformance/tti.d.ts +69 -0
- package/dist/conformance/tti.js +205 -0
- package/dist/conformance/types.d.ts +9 -2
- package/dist/daytona.js +60 -20
- package/dist/descriptor.d.ts +10 -0
- package/dist/descriptor.js +7 -0
- package/dist/descriptors/browserbase.d.ts +3 -0
- package/dist/descriptors/browserbase.js +4 -0
- package/dist/descriptors/docker.d.ts +1 -0
- package/dist/descriptors/docker.js +3 -0
- package/dist/descriptors/env-names.d.ts +32 -0
- package/dist/descriptors/env-names.js +60 -0
- package/dist/descriptors/index.d.ts +9 -2
- package/dist/descriptors/kernel.d.ts +3 -0
- package/dist/descriptors/kernel.js +2 -0
- package/dist/descriptors/local-chrome.d.ts +1 -1
- package/dist/descriptors/local-chrome.js +5 -3
- package/dist/descriptors/phone-harness.d.ts +1 -1
- package/dist/descriptors/phone-harness.js +4 -2
- package/dist/docker/egress.d.ts +7 -0
- package/dist/docker/egress.js +8 -0
- package/dist/docker/image.d.ts +5 -1
- package/dist/docker/image.js +12 -8
- package/dist/docker.d.ts +63 -15
- package/dist/docker.js +181 -98
- package/dist/drift.js +6 -6
- package/dist/e2b.d.ts +2 -2
- package/dist/e2b.js +2 -3
- package/dist/groundbox.js +6 -6
- package/dist/host.d.ts +23 -0
- package/dist/hosted/download.d.ts +23 -0
- package/dist/hosted/download.js +144 -0
- package/dist/hosted/process.d.ts +5 -0
- package/dist/hosted/process.js +20 -0
- package/dist/hosted/provider.js +120 -48
- package/dist/hosted/rest.d.ts +19 -8
- package/dist/hosted/rest.js +47 -14
- package/dist/hosted/scripts.d.ts +10 -0
- package/dist/hosted/scripts.js +23 -2
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/janitor.d.ts +7 -1
- package/dist/janitor.js +2 -2
- package/dist/kernel.js +1 -1
- package/dist/local-chrome.d.ts +5 -2
- package/dist/local-chrome.js +4 -2
- package/dist/local-supervisor.js +1 -0
- package/dist/modal.d.ts +6 -5
- package/dist/modal.js +7 -7
- package/dist/morph.js +5 -8
- package/dist/orgo-channel.d.ts +3 -2
- package/dist/orgo-channel.js +3 -3
- package/dist/orgo-desktop.js +2 -4
- package/dist/orgo.js +2 -4
- package/dist/phone-harness.d.ts +7 -5
- package/dist/phone-harness.js +60 -61
- package/dist/protocol.d.ts +10 -0
- package/dist/protocol.js +17 -0
- package/dist/provider.d.ts +6 -2
- package/dist/screen-watch.d.ts +6 -1
- package/dist/screen-watch.js +166 -12
- package/dist/vendor-sdk.d.ts +9 -0
- package/dist/vendor-sdk.js +26 -0
- package/package.json +8 -1
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
// Docker for the conformance CLI (`--provider docker`): the provider as create() builds it from the settings this module
|
|
2
2
|
// reads (COMPUTER_DOCKER_DAEMON, COMPUTER_DOCKER_DAEMON_CACHE, COMPUTER_DOCKER_USER), and its drifted twin, the same
|
|
3
|
-
// provider with a daemon of another version, built with Go for Docker's architecture when the drift case first asks.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// mountFor("bind") makes a run folder on this host, owned by the computer's user.
|
|
3
|
+
// provider with a daemon of another version, built with Go for Docker's architecture when the drift case first asks.
|
|
4
|
+
// With desktop, both are desktops (kind desktop) on an image with an X server, such as test/fixtures/desktop/Dockerfile's.
|
|
5
|
+
// For the mount cases, mountFor("bind") makes a run folder on this host, owned by the computer's user.
|
|
7
6
|
import { chownSync, mkdtempSync, realpathSync } from "node:fs";
|
|
8
7
|
import { readFile, rm, writeFile } from "node:fs/promises";
|
|
9
8
|
import { tmpdir } from "node:os";
|
|
10
9
|
import { join } from "node:path";
|
|
11
10
|
import { create, dockerArch } from "../docker.js";
|
|
12
11
|
import { buildDriftDaemon } from "./drift-daemon.js";
|
|
13
|
-
|
|
12
|
+
import { setOptions } from "./module-kit.js";
|
|
14
13
|
export const DOCKER_ENV = {
|
|
15
14
|
/** The daemon binary for Docker's architecture; default this package's dist/computerd-linux-<arch>. */
|
|
16
15
|
daemon: "COMPUTER_DOCKER_DAEMON",
|
|
@@ -19,24 +18,19 @@ export const DOCKER_ENV = {
|
|
|
19
18
|
/** Who a computer runs as when its spec does not say, uid or uid:gid in numbers; see DockerProviderOptions.user. */
|
|
20
19
|
user: "COMPUTER_DOCKER_USER",
|
|
21
20
|
};
|
|
22
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
23
21
|
export const ENV = DOCKER_ENV;
|
|
24
22
|
/** The provider's options this module reads from env, each only when its name is set. */
|
|
25
23
|
export function settingsFromEnv(env = process.env) {
|
|
26
|
-
return {
|
|
27
|
-
...(env[DOCKER_ENV.daemon] ? { daemonPath: env[DOCKER_ENV.daemon] } : {}),
|
|
28
|
-
...(env[DOCKER_ENV.daemonCache] ? { daemonCache: env[DOCKER_ENV.daemonCache] } : {}),
|
|
29
|
-
...(env[DOCKER_ENV.user] ? { user: env[DOCKER_ENV.user] } : {}),
|
|
30
|
-
};
|
|
24
|
+
return setOptions(env, { daemonPath: DOCKER_ENV.daemon, daemonCache: DOCKER_ENV.daemonCache, user: DOCKER_ENV.user });
|
|
31
25
|
}
|
|
32
26
|
/** The provider the CLI runs; throws in words when Docker cannot be asked its architecture, or its daemon is not built. */
|
|
33
27
|
export function createProvider({ env = process.env, ...options } = {}) {
|
|
34
|
-
return create({ ...settingsFromEnv(env), ...options });
|
|
28
|
+
return create({ ...settingsFromEnv(env), env, ...options });
|
|
35
29
|
}
|
|
36
30
|
/** The same provider with a daemon that reports another version, for the drift.version case. */
|
|
37
31
|
export async function createDriftedProvider({ env = process.env, ...options } = {}) {
|
|
38
|
-
const daemonPath = await buildDriftDaemon(await dockerArch(options));
|
|
39
|
-
return create({ ...settingsFromEnv(env), ...options, daemonPath });
|
|
32
|
+
const daemonPath = await buildDriftDaemon(await dockerArch({ ...options, env }));
|
|
33
|
+
return create({ ...settingsFromEnv(env), env, ...options, daemonPath });
|
|
40
34
|
}
|
|
41
35
|
/**
|
|
42
36
|
* A run folder for a bind, and none for any other kind: a new directory under the temp dir, by its canonical path, owned
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { type E2BOptions, type E2BProvider } from "../e2b.js";
|
|
2
|
-
import type
|
|
3
|
-
import type
|
|
4
|
-
|
|
5
|
-
import type { RunFolder } from "./types.js";
|
|
2
|
+
import { type ArchilMountOptions } from "./archil.js";
|
|
3
|
+
import { type Env, type HostedModuleOptions } from "./module-kit.js";
|
|
4
|
+
export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
|
|
6
5
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
7
6
|
export { ARCHIL_ENV } from "./archil.js";
|
|
8
|
-
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
|
|
9
7
|
export declare const E2B_ENV: {
|
|
10
8
|
readonly live: "AGENTRUN_COMPUTER_LIVE_E2B";
|
|
11
9
|
/** The template every computer of the run starts from; default "desktop", E2B Desktop's. */
|
|
@@ -18,14 +16,13 @@ export declare const E2B_ENV: {
|
|
|
18
16
|
readonly daemon: "COMPUTER_E2B_DAEMON";
|
|
19
17
|
/** kind: desktop (default) or linux. */
|
|
20
18
|
readonly kind: "COMPUTER_E2B_KIND";
|
|
21
|
-
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run
|
|
19
|
+
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run takes it when it is under 30 minutes, else 30 minutes. */
|
|
22
20
|
readonly maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS";
|
|
23
21
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
24
22
|
readonly user: "COMPUTER_E2B_USER";
|
|
25
23
|
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
26
24
|
readonly connect: "COMPUTER_E2B_CONNECT";
|
|
27
25
|
};
|
|
28
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
29
26
|
export declare const ENV: {
|
|
30
27
|
readonly live: "AGENTRUN_COMPUTER_LIVE_E2B";
|
|
31
28
|
/** The template every computer of the run starts from; default "desktop", E2B Desktop's. */
|
|
@@ -38,7 +35,7 @@ export declare const ENV: {
|
|
|
38
35
|
readonly daemon: "COMPUTER_E2B_DAEMON";
|
|
39
36
|
/** kind: desktop (default) or linux. */
|
|
40
37
|
readonly kind: "COMPUTER_E2B_KIND";
|
|
41
|
-
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run
|
|
38
|
+
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run takes it when it is under 30 minutes, else 30 minutes. */
|
|
42
39
|
readonly maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS";
|
|
43
40
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
44
41
|
readonly user: "COMPUTER_E2B_USER";
|
|
@@ -50,40 +47,17 @@ export type E2BSettings = Omit<E2BOptions, "Sandbox" | "desktop" | "timeouts" |
|
|
|
50
47
|
/**
|
|
51
48
|
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
52
49
|
* on a value it cannot read, or while E2B_SANDBOX_URL is set there (the SDK would send every sandbox call to it), never
|
|
53
|
-
* echoing a key.
|
|
50
|
+
* echoing a key.
|
|
54
51
|
*/
|
|
55
|
-
export declare function settingsFromEnv(env?:
|
|
56
|
-
/** The longest lifetime a computer of a run may ask for: E2B kills each sandbox at its timeout, the lifetime. */
|
|
57
|
-
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
58
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
52
|
+
export declare function settingsFromEnv(env?: Env): E2BSettings;
|
|
59
53
|
export declare const conformanceNotes: string[];
|
|
60
|
-
export interface E2BModuleOptions extends Pick<E2BOptions, "Sandbox" | "daemonPath" | "timeouts" | "onNote" | "dial"
|
|
61
|
-
/** Where the settings are read; default process.env. */
|
|
62
|
-
env?: Record<string, string | undefined>;
|
|
63
|
-
/** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
|
|
64
|
-
buildDaemon?: (version: string) => Promise<string>;
|
|
65
|
-
/** For mountFor("archil"): the disk's object API, or the SDK's Archil client, in place of the host's disk package. */
|
|
66
|
-
archil?: Pick<ArchilRunFolderOptions, "objects" | "Archil" | "baseUrl">;
|
|
54
|
+
export interface E2BModuleOptions extends HostedModuleOptions, Pick<E2BOptions, "Sandbox" | "daemonPath" | "timeouts" | "onNote" | "dial">, ArchilMountOptions {
|
|
67
55
|
}
|
|
56
|
+
export declare const createProvider: (options?: E2BModuleOptions | undefined) => Promise<E2BProvider>, createDriftedProvider: (options?: E2BModuleOptions | undefined) => Promise<E2BProvider>, createHost: (options?: E2BModuleOptions | undefined) => Promise<import("../host.js").MachineHost>;
|
|
68
57
|
/**
|
|
69
58
|
* The template every computer of the run starts from: COMPUTER_E2B_TEMPLATE; else on dial the box template, since only the
|
|
70
59
|
* box image holds agentrun-dial; else E2B Desktop's (the plain one for kind linux).
|
|
71
60
|
*/
|
|
72
61
|
export declare function conformanceImage({ env }?: Pick<E2BModuleOptions, "env">): string;
|
|
73
|
-
/** The provider the CLI runs; throws in words without the live switch, or when a setting is missing or wrong. */
|
|
74
|
-
export declare function createProvider({ env, Sandbox, daemonPath, timeouts, onNote, dial }?: E2BModuleOptions): Promise<E2BProvider>;
|
|
75
|
-
/** A dial machine (COMPUTER_E2B_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
76
62
|
export declare const dialKit: () => import("./types.js").DialKit;
|
|
77
|
-
|
|
78
|
-
* A run folder for an Archil mount, and none for any other kind (an E2B computer takes no bind): a fresh folder on the
|
|
79
|
-
* disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none (archilRunFolder, ./archil.ts).
|
|
80
|
-
* Reaching it is a call to Archil, so it needs the live switch.
|
|
81
|
-
*/
|
|
82
|
-
export declare function mountFor(kind: MountKind, { env, archil }?: E2BModuleOptions): Promise<RunFolder | undefined>;
|
|
83
|
-
/**
|
|
84
|
-
* The E2B host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
85
|
-
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
86
|
-
*/
|
|
87
|
-
export declare function createHost({ env, Sandbox }?: Pick<E2BModuleOptions, "env" | "Sandbox">): Promise<MachineHost>;
|
|
88
|
-
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
89
|
-
export declare function createDriftedProvider({ env, Sandbox, timeouts, buildDaemon }?: E2BModuleOptions): Promise<E2BProvider>;
|
|
63
|
+
export declare const mountFor: (kind: import("../mount.js").MountKind, options?: ArchilMountOptions) => Promise<import("./types.js").RunFolder | undefined>;
|
package/dist/conformance/e2b.js
CHANGED
|
@@ -1,29 +1,21 @@
|
|
|
1
1
|
// E2B for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider e2b [--image <template>]`.
|
|
2
2
|
// It makes real sandboxes, so it runs only with AGENTRUN_COMPUTER_LIVE_E2B=1 and a key for an account you can bill, under
|
|
3
|
-
// COMPUTER_E2B_API_KEY
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
// switch is checked first, before any other setting is read. The live sweep (sweep.ts, --provider e2b) reads the same
|
|
7
|
-
// names through createHost, which needs no live switch: it makes nothing.
|
|
8
|
-
//
|
|
9
|
-
// The daemon is uploaded into each sandbox (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
|
|
10
|
-
// nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run lives
|
|
11
|
-
// at most 30 minutes, E2B Hobby's plan for conformance: E2B's timeout is the lifetime, and a longer one is refused.
|
|
12
|
-
//
|
|
3
|
+
// COMPUTER_E2B_API_KEY (never E2B_API_KEY, which may hold another team's key); the provider gives the SDK the key, domain
|
|
4
|
+
// and API URL explicitly, and refuses an ambient E2B_SANDBOX_URL (see create in ../e2b.ts). Every computer of a run
|
|
5
|
+
// lives at most 30 minutes, E2B Hobby's plan for conformance: E2B's timeout is the lifetime, and a longer one is refused.
|
|
13
6
|
// For the mount cases, mountFor("archil") makes a fresh run folder on the Archil disk COMPUTER_ARCHIL_DISK names (in
|
|
14
|
-
// COMPUTER_ARCHIL_REGION, mounted with the disk token COMPUTER_ARCHIL_TOKEN), and reaches it from outside
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
// are skipped. An Archil computer needs a provider whose daemon user is the tool user: COMPUTER_E2B_USER=2510:2510.
|
|
7
|
+
// COMPUTER_ARCHIL_REGION, mounted with the disk token COMPUTER_ARCHIL_TOKEN), and reaches it from outside with the
|
|
8
|
+
// host's disk SDK (COMPUTER_ARCHIL_API_KEY and COMPUTER_ARCHIL_S3_URL, ./archil.ts); with no disk named the cases are
|
|
9
|
+
// skipped. An Archil computer needs a provider whose daemon user is the tool user: COMPUTER_E2B_USER=2510:2510.
|
|
18
10
|
import { boxE2bTemplate } from "../box-image.js";
|
|
11
|
+
import { E2B } from "../descriptors/e2b.js";
|
|
19
12
|
import { create } from "../e2b.js";
|
|
20
|
-
import {
|
|
13
|
+
import { archilMountFor } from "./archil.js";
|
|
21
14
|
import { dialOnlyFromServer } from "./dial-only.js";
|
|
22
|
-
import {
|
|
23
|
-
|
|
15
|
+
import { hostedModule, kindFrom, lifetimeFromEnv, requiredSecret, setOptions } from "./module-kit.js";
|
|
16
|
+
export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
|
|
24
17
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
25
18
|
export { ARCHIL_ENV } from "./archil.js";
|
|
26
|
-
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
|
|
27
19
|
export const E2B_ENV = {
|
|
28
20
|
live: "AGENTRUN_COMPUTER_LIVE_E2B",
|
|
29
21
|
/** The template every computer of the run starts from; default "desktop", E2B Desktop's. */
|
|
@@ -36,55 +28,39 @@ export const E2B_ENV = {
|
|
|
36
28
|
daemon: "COMPUTER_E2B_DAEMON",
|
|
37
29
|
/** kind: desktop (default) or linux. */
|
|
38
30
|
kind: "COMPUTER_E2B_KIND",
|
|
39
|
-
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run
|
|
31
|
+
/** maxLifetimeMs: the cap, in ms, 3600000 (Hobby, default) up to 86400000 (Pro); a run takes it when it is under 30 minutes, else 30 minutes. */
|
|
40
32
|
maxLifetimeMs: "COMPUTER_E2B_MAX_LIFETIME_MS",
|
|
41
33
|
/** daemonUser: uid:gid the daemon runs as; default 2510:2510. */
|
|
42
34
|
user: "COMPUTER_E2B_USER",
|
|
43
35
|
/** connect: exec (default) or dial, which needs the public server's process (dialKit). */
|
|
44
36
|
connect: "COMPUTER_E2B_CONNECT",
|
|
45
37
|
};
|
|
46
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
47
38
|
export const ENV = E2B_ENV;
|
|
48
39
|
/**
|
|
49
40
|
* The provider's options this module reads from env, each only when its name is set; throws in words without the key,
|
|
50
41
|
* on a value it cannot read, or while E2B_SANDBOX_URL is set there (the SDK would send every sandbox call to it), never
|
|
51
|
-
* echoing a key.
|
|
42
|
+
* echoing a key.
|
|
52
43
|
*/
|
|
53
44
|
export function settingsFromEnv(env = process.env) {
|
|
54
|
-
const apiKey = env
|
|
55
|
-
if (apiKey === undefined || apiKey === "")
|
|
56
|
-
throw new Error(`set ${E2B_ENV.key} to an E2B API key: the conformance module reads it there and nowhere else, never from E2B_API_KEY`);
|
|
45
|
+
const apiKey = requiredSecret(env, E2B_ENV.key, "an E2B API key");
|
|
57
46
|
if (env.E2B_SANDBOX_URL)
|
|
58
47
|
throw new Error("the E2B provider refuses to start while E2B_SANDBOX_URL is set: the SDK would send every call into a sandbox there. Unset it");
|
|
59
|
-
const lifetime = env
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
const domain = env[E2B_ENV.domain] || undefined;
|
|
63
|
-
const daemonPath = env[E2B_ENV.daemon] || undefined;
|
|
64
|
-
const daemonUser = env[E2B_ENV.user] || undefined;
|
|
65
|
-
const connect = env[E2B_ENV.connect] || undefined;
|
|
66
|
-
return {
|
|
67
|
-
apiKey,
|
|
68
|
-
// create() refuses any other value in words.
|
|
69
|
-
...(connect === undefined ? {} : { connect: connect }),
|
|
70
|
-
...(domain === undefined ? {} : { domain }),
|
|
71
|
-
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
72
|
-
...kindFrom(env, E2B_ENV.kind),
|
|
73
|
-
...(lifetime === undefined ? {} : { maxLifetimeMs: Number(lifetime) }),
|
|
74
|
-
...(daemonUser === undefined ? {} : { daemonUser }),
|
|
75
|
-
};
|
|
48
|
+
const lifetime = lifetimeFromEnv(env, E2B_ENV.maxLifetimeMs, "3600000 (Hobby) or 86400000 (Pro)");
|
|
49
|
+
const set = setOptions(env, { connect: E2B_ENV.connect, domain: E2B_ENV.domain, daemonPath: E2B_ENV.daemon, daemonUser: E2B_ENV.user });
|
|
50
|
+
return { apiKey, ...set, ...kindFrom(env, E2B_ENV.kind), ...lifetime };
|
|
76
51
|
}
|
|
77
|
-
/** The longest lifetime a computer of a run may ask for: E2B kills each sandbox at its timeout, the lifetime. */
|
|
78
|
-
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
79
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
80
52
|
export const conformanceNotes = [
|
|
81
53
|
"e2b: E2B Hobby plan: every sandbox's timeout is its lifetime, capped at 30 minutes for the run (Hobby caps a sandbox at 1 h, Pro at 24 h). The daemon is a child of E2B's envd, started as a background command; network none is no internet access and no public traffic, read back from E2B and probed from inside; no stream() (a screen is streamed through agentrun, never a vendor URL), so screen.stream is skipped.",
|
|
82
54
|
];
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
55
|
+
const e2b = hostedModule({
|
|
56
|
+
live: { name: E2B_ENV.live, what: "the E2B conformance module makes real sandboxes", whose: "a key for an account you can bill" },
|
|
57
|
+
settingsFromEnv,
|
|
58
|
+
create,
|
|
59
|
+
host: ["Sandbox"],
|
|
60
|
+
run: ["timeouts", "onNote", "dial"],
|
|
61
|
+
runDefined: ["daemonPath"],
|
|
62
|
+
});
|
|
63
|
+
export const { createProvider, createDriftedProvider, createHost } = e2b;
|
|
88
64
|
/**
|
|
89
65
|
* The conformance run's own default templates, E2B's stock ones: E2B Desktop's, and its plain one for kind linux. A server
|
|
90
66
|
* starts from the box template (the provider's prepareImage); a run on it names it with --image.
|
|
@@ -103,38 +79,5 @@ export function conformanceImage({ env = process.env } = {}) {
|
|
|
103
79
|
return boxE2bTemplate();
|
|
104
80
|
return env[E2B_ENV.kind] === "linux" ? BASE_TEMPLATE : DESKTOP_TEMPLATE;
|
|
105
81
|
}
|
|
106
|
-
|
|
107
|
-
export
|
|
108
|
-
live(env);
|
|
109
|
-
return create({ ...settingsFromEnv(env), ...(Sandbox ? { Sandbox } : {}), ...(daemonPath === undefined ? {} : { daemonPath }), ...(timeouts ? { timeouts } : {}), ...(onNote ? { onNote } : {}), ...(dial ? { dial } : {}), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
110
|
-
}
|
|
111
|
-
/** A dial machine (COMPUTER_E2B_CONNECT=dial) runs its Core inside the public server's process: refused here (dial-only.ts). */
|
|
112
|
-
export const dialKit = dialOnlyFromServer("e2b", "E2B", `${E2B_ENV.connect}=dial`);
|
|
113
|
-
/**
|
|
114
|
-
* A run folder for an Archil mount, and none for any other kind (an E2B computer takes no bind): a fresh folder on the
|
|
115
|
-
* disk the COMPUTER_ARCHIL_* names name (archilSettings), none when they name none (archilRunFolder, ./archil.ts).
|
|
116
|
-
* Reaching it is a call to Archil, so it needs the live switch.
|
|
117
|
-
*/
|
|
118
|
-
export async function mountFor(kind, { env = process.env, archil = {} } = {}) {
|
|
119
|
-
if (kind !== "archil")
|
|
120
|
-
return undefined;
|
|
121
|
-
const settings = archilSettings(env);
|
|
122
|
-
if (settings === undefined)
|
|
123
|
-
return undefined;
|
|
124
|
-
live(env);
|
|
125
|
-
return archilRunFolder({ ...settings, ...archil });
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* The E2B host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live switch,
|
|
129
|
-
* since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
130
|
-
*/
|
|
131
|
-
export async function createHost({ env = process.env, Sandbox } = {}) {
|
|
132
|
-
return (await create({ ...settingsFromEnv(env), ...(Sandbox ? { Sandbox } : {}) })).host;
|
|
133
|
-
}
|
|
134
|
-
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
135
|
-
export async function createDriftedProvider({ env = process.env, Sandbox, timeouts, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = {}) {
|
|
136
|
-
live(env);
|
|
137
|
-
const settings = settingsFromEnv(env);
|
|
138
|
-
const daemonPath = await buildDaemon(DRIFT_VERSION);
|
|
139
|
-
return create({ ...settings, ...(Sandbox ? { Sandbox } : {}), ...(timeouts ? { timeouts } : {}), daemonPath, maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
140
|
-
}
|
|
82
|
+
export const dialKit = dialOnlyFromServer(E2B, `${E2B_ENV.connect}=dial`);
|
|
83
|
+
export const mountFor = archilMountFor(e2b.live);
|
|
@@ -2,8 +2,9 @@ import type { HostedDial } from "../hosted/provider.js";
|
|
|
2
2
|
import { type FlyProvider } from "../fly.js";
|
|
3
3
|
import type { MachineHost } from "../host.js";
|
|
4
4
|
import type { ProviderNote } from "../mount-archil.js";
|
|
5
|
+
import { CONFORMANCE_MAX_LIFETIME_MS, type Env } from "./module-kit.js";
|
|
5
6
|
import type { DialKit } from "./types.js";
|
|
6
|
-
|
|
7
|
+
export { CONFORMANCE_MAX_LIFETIME_MS };
|
|
7
8
|
export declare const FLY_ENV: {
|
|
8
9
|
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
9
10
|
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
@@ -12,7 +13,6 @@ export declare const FLY_ENV: {
|
|
|
12
13
|
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
13
14
|
readonly kind: "COMPUTER_FLY_KIND";
|
|
14
15
|
};
|
|
15
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
16
16
|
export declare const ENV: {
|
|
17
17
|
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
18
18
|
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
@@ -21,10 +21,8 @@ export declare const ENV: {
|
|
|
21
21
|
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
22
22
|
readonly kind: "COMPUTER_FLY_KIND";
|
|
23
23
|
};
|
|
24
|
-
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each machine by then. */
|
|
25
|
-
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
26
24
|
/** The provider's options this module reads from env; throws in words without the token or the app, never echoing one. */
|
|
27
|
-
export declare function settingsFromEnv(env?:
|
|
25
|
+
export declare function settingsFromEnv(env?: Env): {
|
|
28
26
|
apiToken: string;
|
|
29
27
|
app: string;
|
|
30
28
|
};
|
|
@@ -50,7 +48,6 @@ export declare function conformanceImage(): string;
|
|
|
50
48
|
* dial-conformance.mjs stands that server up and gives the run its DialKit itself.
|
|
51
49
|
*/
|
|
52
50
|
export declare function dialKit(): DialKit;
|
|
53
|
-
/** The Fly host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
54
51
|
export declare function createHost({ env, fetch }?: Pick<FlyModuleOptions, "env" | "fetch">): MachineHost;
|
|
55
52
|
/** Where the sweep lists, in words: the app the settings name. */
|
|
56
53
|
export declare function sweepScope({ env }?: Pick<FlyModuleOptions, "env">): string;
|
package/dist/conformance/fly.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { boxImageRef } from "../box-image.js";
|
|
2
2
|
import { create } from "../fly.js";
|
|
3
|
-
import { kindFrom } from "./
|
|
4
|
-
|
|
3
|
+
import { CONFORMANCE_MAX_LIFETIME_MS, kindFrom } from "./module-kit.js";
|
|
4
|
+
export { CONFORMANCE_MAX_LIFETIME_MS };
|
|
5
5
|
export const FLY_ENV = {
|
|
6
6
|
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
7
7
|
token: "COMPUTER_FLY_API_TOKEN",
|
|
@@ -10,10 +10,7 @@ export const FLY_ENV = {
|
|
|
10
10
|
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
11
11
|
kind: "COMPUTER_FLY_KIND",
|
|
12
12
|
};
|
|
13
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
14
13
|
export const ENV = FLY_ENV;
|
|
15
|
-
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each machine by then. */
|
|
16
|
-
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
17
14
|
/** The provider's options this module reads from env; throws in words without the token or the app, never echoing one. */
|
|
18
15
|
export function settingsFromEnv(env = process.env) {
|
|
19
16
|
const apiToken = env[FLY_ENV.token];
|
|
@@ -46,7 +43,6 @@ export function conformanceImage() {
|
|
|
46
43
|
export function dialKit() {
|
|
47
44
|
throw new Error("a Fly machine dials the server that minted its token, and this run has no public server: run Fly's Core with packages/serve/scripts/dial-conformance.mjs --provider fly inside a server the internet reaches at AGENTRUN_PUBLIC_URL");
|
|
48
45
|
}
|
|
49
|
-
/** The Fly host the live sweep lists and deletes through, from the same settings; it makes nothing. */
|
|
50
46
|
export function createHost({ env = process.env, fetch } = {}) {
|
|
51
47
|
return create({ ...settingsFromEnv(env), ...(fetch ? { fetch } : {}) }).host;
|
|
52
48
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type GroundboxProvider, type GroundboxProviderOptions } from "../groundbox.js";
|
|
2
|
-
import type
|
|
3
|
-
|
|
2
|
+
import { type Env, type HostedModuleOptions } from "./module-kit.js";
|
|
3
|
+
export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
|
|
4
4
|
export declare const GROUNDBOX_ENV: {
|
|
5
5
|
readonly live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX";
|
|
6
6
|
/** apiKey, required: the Groundbox API key. */
|
|
@@ -16,7 +16,6 @@ export declare const GROUNDBOX_ENV: {
|
|
|
16
16
|
/** kind: linux (default) or desktop. */
|
|
17
17
|
readonly kind: "COMPUTER_GROUNDBOX_KIND";
|
|
18
18
|
};
|
|
19
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
20
19
|
export declare const ENV: {
|
|
21
20
|
readonly live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX";
|
|
22
21
|
/** apiKey, required: the Groundbox API key. */
|
|
@@ -35,27 +34,12 @@ export declare const ENV: {
|
|
|
35
34
|
/** What this module reads from the environment: the key, and each other option whose name is set. */
|
|
36
35
|
export type GroundboxSettings = Pick<GroundboxProviderOptions, "apiKey" | "apiUrl" | "daemonPath" | "daemonUser" | "kind">;
|
|
37
36
|
/** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
|
|
38
|
-
export declare function settingsFromEnv(env?:
|
|
39
|
-
/** The longest lifetime a computer of a run may ask for. */
|
|
40
|
-
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
41
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
37
|
+
export declare function settingsFromEnv(env?: Env): GroundboxSettings;
|
|
42
38
|
export declare const conformanceNotes: string[];
|
|
43
|
-
export interface GroundboxModuleOptions extends Pick<GroundboxProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts"> {
|
|
44
|
-
/** Where the settings are read; default process.env. */
|
|
45
|
-
env?: Record<string, string | undefined>;
|
|
46
|
-
/** Builds this package's daemon for linux/amd64 stamped with version, and gives its path; default go build. */
|
|
47
|
-
buildDaemon?: (version: string) => Promise<string>;
|
|
39
|
+
export interface GroundboxModuleOptions extends HostedModuleOptions, Pick<GroundboxProviderOptions, "fetch" | "webSocket" | "daemonPath" | "timeouts" | "onNote"> {
|
|
48
40
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
export declare function createDriftedProvider(options?: GroundboxModuleOptions): Promise<GroundboxProvider>;
|
|
41
|
+
export declare const createProvider: (options?: GroundboxModuleOptions | undefined) => Promise<GroundboxProvider>, createDriftedProvider: (options?: GroundboxModuleOptions | undefined) => Promise<GroundboxProvider>, createHost: (options?: GroundboxModuleOptions | undefined) => Promise<import("../host.js").MachineHost>, sweepScope: (options?: {
|
|
42
|
+
env?: Env;
|
|
43
|
+
}) => string;
|
|
53
44
|
/** The image every computer of the run starts from: COMPUTER_GROUNDBOX_IMAGE, else the box image prepareImage() answers. */
|
|
54
45
|
export declare function conformanceImage({ env }?: Pick<GroundboxModuleOptions, "env">): Promise<string>;
|
|
55
|
-
/**
|
|
56
|
-
* The Groundbox host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live
|
|
57
|
-
* switch, since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
58
|
-
*/
|
|
59
|
-
export declare function createHost(options?: Pick<GroundboxModuleOptions, "env" | "fetch" | "webSocket">): Promise<MachineHost>;
|
|
60
|
-
/** Where the sweep lists, in words: the key's team, the key named by its sha256 prefix alone. */
|
|
61
|
-
export declare function sweepScope({ env }?: Pick<GroundboxModuleOptions, "env">): string;
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
// Groundbox for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider groundbox`. It makes
|
|
2
2
|
// real sandboxes, which bill until deleted, so it runs only with AGENTRUN_COMPUTER_LIVE_GROUNDBOX=1 and your own key,
|
|
3
|
-
// under COMPUTER_GROUNDBOX_API_KEY
|
|
4
|
-
//
|
|
5
|
-
// switch is checked first, before any other setting is read. The live sweep (sweep.ts, --provider groundbox) reads the
|
|
6
|
-
// same names through createHost, which needs no live switch: it makes nothing; sweepScope names the key and API a
|
|
7
|
-
// before file must have been listed from.
|
|
8
|
-
//
|
|
9
|
-
// The daemon is uploaded into each sandbox (dist/computerd-linux-amd64, `npm run build:daemon`), so a run publishes
|
|
10
|
-
// nothing. The drifted provider uploads a daemon built with Go as version <version>-drift. Every computer of a run has
|
|
11
|
-
// a deadline of at most 30 minutes, and Groundbox's own timer ends it 5 minutes past that.
|
|
12
|
-
import { createHash } from "node:crypto";
|
|
3
|
+
// under COMPUTER_GROUNDBOX_API_KEY (never GROUNDBOX_API_KEY, which may hold another team's key). Every computer of a run
|
|
4
|
+
// has a deadline of at most 30 minutes, and Groundbox's own timer ends it 5 minutes past that.
|
|
13
5
|
import { boxImageRef } from "../box-image.js";
|
|
14
6
|
import { create, DEFAULT_API_URL } from "../groundbox.js";
|
|
15
|
-
import {
|
|
16
|
-
import { kindFrom } from "./
|
|
17
|
-
|
|
7
|
+
import { httpsBase } from "../hosted/rest.js";
|
|
8
|
+
import { hostedModule, keyPrint, kindFrom, requiredSecret, setOptions } from "./module-kit.js";
|
|
9
|
+
export { CONFORMANCE_MAX_LIFETIME_MS } from "./module-kit.js";
|
|
18
10
|
export const GROUNDBOX_ENV = {
|
|
19
11
|
live: "AGENTRUN_COMPUTER_LIVE_GROUNDBOX",
|
|
20
12
|
/** apiKey, required: the Groundbox API key. */
|
|
@@ -30,57 +22,25 @@ export const GROUNDBOX_ENV = {
|
|
|
30
22
|
/** kind: linux (default) or desktop. */
|
|
31
23
|
kind: "COMPUTER_GROUNDBOX_KIND",
|
|
32
24
|
};
|
|
33
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
34
25
|
export const ENV = GROUNDBOX_ENV;
|
|
35
26
|
/** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing it. */
|
|
36
27
|
export function settingsFromEnv(env = process.env) {
|
|
37
|
-
const apiKey = env
|
|
38
|
-
|
|
39
|
-
throw new Error(`set ${GROUNDBOX_ENV.key} to a Groundbox API key: the conformance module reads it there and nowhere else, never from GROUNDBOX_API_KEY`);
|
|
40
|
-
const apiUrl = env[GROUNDBOX_ENV.apiUrl] || undefined;
|
|
41
|
-
const daemonPath = env[GROUNDBOX_ENV.daemon] || undefined;
|
|
42
|
-
const daemonUser = env[GROUNDBOX_ENV.user] || undefined;
|
|
43
|
-
return { apiKey, ...(apiUrl === undefined ? {} : { apiUrl }), ...(daemonPath === undefined ? {} : { daemonPath }), ...(daemonUser === undefined ? {} : { daemonUser }), ...kindFrom(env, GROUNDBOX_ENV.kind) };
|
|
28
|
+
const apiKey = requiredSecret(env, GROUNDBOX_ENV.key, "a Groundbox API key");
|
|
29
|
+
return { apiKey, ...setOptions(env, { apiUrl: GROUNDBOX_ENV.apiUrl, daemonPath: GROUNDBOX_ENV.daemon, daemonUser: GROUNDBOX_ENV.user }), ...kindFrom(env, GROUNDBOX_ENV.kind) };
|
|
44
30
|
}
|
|
45
|
-
/** The longest lifetime a computer of a run may ask for. */
|
|
46
|
-
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
47
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
48
31
|
export const conformanceNotes = [
|
|
49
32
|
"groundbox: every computer is a Groundbox sandbox (a Firecracker microVM, amd64) whose own timer is set to the adapter's backstop; the daemon is a child of a resumable command of the WebSocket command stream, installed as root (the box image) or through passwordless sudo (Groundbox's own image), its output read by position across sockets and its stdin written to a fifo one answered call at a time; lifetime is the janitor's, by the deadline label, capped at 30 minutes for the run. Network none, open and a list are init's. The run's folder is a synced folder; no Archil mount. Kind desktop (COMPUTER_GROUNDBOX_KIND=desktop) starts from the box image too, with Xvfb on :0 and xfwm4 started through the daemon as the tool user.",
|
|
50
33
|
];
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
live(env);
|
|
61
|
-
return create({ ...settingsFromEnv(env), ...doubles(options), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
62
|
-
}
|
|
63
|
-
/** The same provider uploading a daemon that reports version <version>-drift, for the drift.version case. */
|
|
64
|
-
export async function createDriftedProvider(options = {}) {
|
|
65
|
-
const { env = process.env, buildDaemon = (version) => buildDriftDaemon("amd64", version) } = options;
|
|
66
|
-
live(env);
|
|
67
|
-
const settings = settingsFromEnv(env);
|
|
68
|
-
return create({ ...settings, ...doubles(options), daemonPath: await buildDaemon(DRIFT_VERSION), maxLifetimeMs: CONFORMANCE_MAX_LIFETIME_MS });
|
|
69
|
-
}
|
|
34
|
+
export const { createProvider, createDriftedProvider, createHost, sweepScope } = hostedModule({
|
|
35
|
+
live: { name: GROUNDBOX_ENV.live, what: "the Groundbox conformance module makes real sandboxes, which bill until deleted", whose: "your own key" },
|
|
36
|
+
settingsFromEnv,
|
|
37
|
+
create,
|
|
38
|
+
host: ["fetch", "webSocket", "daemonPath", "timeouts"],
|
|
39
|
+
run: ["onNote"],
|
|
40
|
+
// The key's team, the key named by its sha256 prefix alone.
|
|
41
|
+
scope: ({ apiKey, apiUrl }) => `the Groundbox team of the key ${keyPrint(apiKey)} at ${httpsBase(apiUrl ?? DEFAULT_API_URL, `the Groundbox API URL (${GROUNDBOX_ENV.apiUrl})`)}`,
|
|
42
|
+
});
|
|
70
43
|
/** The image every computer of the run starts from: COMPUTER_GROUNDBOX_IMAGE, else the box image prepareImage() answers. */
|
|
71
44
|
export async function conformanceImage({ env = process.env } = {}) {
|
|
72
45
|
return env[GROUNDBOX_ENV.image] || boxImageRef();
|
|
73
46
|
}
|
|
74
|
-
/**
|
|
75
|
-
* The Groundbox host the live sweep (sweep.ts) lists and deletes through, from the same settings; it needs no live
|
|
76
|
-
* switch, since the sweep makes nothing, and it calls nothing until the sweep does.
|
|
77
|
-
*/
|
|
78
|
-
export async function createHost(options = {}) {
|
|
79
|
-
return (await create({ ...settingsFromEnv(options.env ?? process.env), ...doubles(options) })).host;
|
|
80
|
-
}
|
|
81
|
-
/** Where the sweep lists, in words: the key's team, the key named by its sha256 prefix alone. */
|
|
82
|
-
export function sweepScope({ env = process.env } = {}) {
|
|
83
|
-
const { apiKey, apiUrl } = settingsFromEnv(env);
|
|
84
|
-
const key = createHash("sha256").update(apiKey, "utf8").digest("hex").slice(0, 12);
|
|
85
|
-
return `the Groundbox team of the key sha256:${key} at ${apiUrl ?? DEFAULT_API_URL}`;
|
|
86
|
-
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export { runConformance } from "./runner.js";
|
|
3
3
|
export { formatReport } from "./report.js";
|
|
4
|
+
export { formatTti, measureTti, type TtiOptions, type TtiReport, type TtiShape, type TtiStats, ttiScore, ttiStats } from "./tti.js";
|
|
4
5
|
export { browserCases, browserOnlyCases, casesFor, conformanceCases } from "./cases/index.js";
|
|
5
6
|
export { kindCases, kindRunProblem, kindVerdict, type KindVerdict } from "./kind.js";
|
|
6
7
|
export { type CdpDialer, type CdpSocket, dialCdp } from "./cdp.js";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./types.js";
|
|
2
2
|
export { runConformance } from "./runner.js";
|
|
3
3
|
export { formatReport } from "./report.js";
|
|
4
|
+
export { formatTti, measureTti, ttiScore, ttiStats } from "./tti.js";
|
|
4
5
|
export { browserCases, browserOnlyCases, casesFor, conformanceCases } from "./cases/index.js";
|
|
5
6
|
export { kindCases, kindRunProblem, kindVerdict } from "./kind.js";
|
|
6
7
|
export { dialCdp } from "./cdp.js";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type KernelProvider, type KernelProviderOptions } from "../kernel.js";
|
|
2
|
-
|
|
2
|
+
import { type Env } from "./module-kit.js";
|
|
3
3
|
export declare const KERNEL_ENV: {
|
|
4
4
|
readonly live: "AGENTRUN_COMPUTER_LIVE_KERNEL";
|
|
5
5
|
/** apiKey, required: the Kernel API key. */
|
|
@@ -7,7 +7,6 @@ export declare const KERNEL_ENV: {
|
|
|
7
7
|
/** apiUrl: Kernel's API; default https://api.onkernel.com. */
|
|
8
8
|
readonly url: "COMPUTER_KERNEL_API_URL";
|
|
9
9
|
};
|
|
10
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
11
10
|
export declare const ENV: {
|
|
12
11
|
readonly live: "AGENTRUN_COMPUTER_LIVE_KERNEL";
|
|
13
12
|
/** apiKey, required: the Kernel API key. */
|
|
@@ -18,12 +17,10 @@ export declare const ENV: {
|
|
|
18
17
|
/** What this module reads from the environment: the key, and the API URL when its name is set. */
|
|
19
18
|
export type KernelSettings = Pick<KernelProviderOptions, "apiKey" | "apiUrl">;
|
|
20
19
|
/** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing one. */
|
|
21
|
-
export declare function settingsFromEnv(env?:
|
|
22
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
20
|
+
export declare function settingsFromEnv(env?: Env): KernelSettings;
|
|
23
21
|
export declare const conformanceNotes: string[];
|
|
24
22
|
export interface KernelModuleOptions extends Pick<KernelProviderOptions, "fetch" | "sleep" | "confirm"> {
|
|
25
|
-
|
|
26
|
-
env?: Record<string, string | undefined>;
|
|
23
|
+
env?: Env;
|
|
27
24
|
}
|
|
28
25
|
/** The image every computer of the run asks for: the vendor's Chromium. */
|
|
29
26
|
export declare function conformanceImage(): string;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
// Kernel for the conformance CLI: `npm run conformance -w @parcha/agentrun-computer -- --provider kernel`. It makes a
|
|
2
|
-
// real, billed Kernel browser,
|
|
3
|
-
// COMPUTER_KERNEL_API_KEY. The provider reads no environment: this module reads its own COMPUTER_KERNEL_* names (never
|
|
4
|
-
// KERNEL_API_KEY, which may hold another organization's key) and passes each to create() as its option. The live switch
|
|
5
|
-
// is checked first, before any other setting is read. The run makes one browser, shared by every case, and deletes it.
|
|
2
|
+
// real, billed Kernel browser, under COMPUTER_KERNEL_API_KEY (never KERNEL_API_KEY, which may hold another organization's key).
|
|
6
3
|
import { BROWSER_IMAGE } from "../descriptors/shared.js";
|
|
7
4
|
import { create } from "../kernel.js";
|
|
8
|
-
|
|
5
|
+
import { requiredSecret, requireLive, setOptions } from "./module-kit.js";
|
|
9
6
|
export const KERNEL_ENV = {
|
|
10
7
|
live: "AGENTRUN_COMPUTER_LIVE_KERNEL",
|
|
11
8
|
/** apiKey, required: the Kernel API key. */
|
|
@@ -13,17 +10,12 @@ export const KERNEL_ENV = {
|
|
|
13
10
|
/** apiUrl: Kernel's API; default https://api.onkernel.com. */
|
|
14
11
|
url: "COMPUTER_KERNEL_API_URL",
|
|
15
12
|
};
|
|
16
|
-
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
17
13
|
export const ENV = KERNEL_ENV;
|
|
18
14
|
/** The provider's options this module reads from env, each only when its name is set; throws in words without the key, never echoing one. */
|
|
19
15
|
export function settingsFromEnv(env = process.env) {
|
|
20
|
-
const apiKey = env
|
|
21
|
-
|
|
22
|
-
throw new Error(`set ${KERNEL_ENV.key} to a Kernel API key: the conformance module reads it there and nowhere else, never from KERNEL_API_KEY`);
|
|
23
|
-
const apiUrl = env[KERNEL_ENV.url] || undefined;
|
|
24
|
-
return { apiKey, ...(apiUrl === undefined ? {} : { apiUrl }) };
|
|
16
|
+
const apiKey = requiredSecret(env, KERNEL_ENV.key, "a Kernel API key");
|
|
17
|
+
return { apiKey, ...setOptions(env, { apiUrl: KERNEL_ENV.url }) };
|
|
25
18
|
}
|
|
26
|
-
/** For the run's report: what this configuration means for the suite. */
|
|
27
19
|
export const conformanceNotes = [
|
|
28
20
|
"kernel: one browser for the whole run, deleted by its last case (browser.release) and again at the run's end. Kernel's lifetime is an idle timeout (no wall clock), so list reads no deadline.",
|
|
29
21
|
];
|
|
@@ -33,8 +25,6 @@ export function conformanceImage() {
|
|
|
33
25
|
}
|
|
34
26
|
/** The provider the CLI runs; throws in words without the live switch, or when the key is missing. */
|
|
35
27
|
export async function createProvider({ env = process.env, ...transport } = {}) {
|
|
36
|
-
|
|
37
|
-
throw new Error(`the Kernel conformance module makes a real, billed browser: set ${KERNEL_ENV.live}=1, with a key for an account you can bill, to run it`);
|
|
38
|
-
}
|
|
28
|
+
requireLive(env, KERNEL_ENV.live, "the Kernel conformance module makes a real, billed browser", "a key for an account you can bill");
|
|
39
29
|
return create({ ...settingsFromEnv(env), ...transport });
|
|
40
30
|
}
|