@parcha/agentrun-computer 0.1.0-beta.58 → 0.1.0-beta.60
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 +285 -81
- package/box/Dockerfile +4 -3
- package/box/install.sh +57 -11
- package/dist/agent37.d.ts +11 -4
- package/dist/agent37.js +217 -19
- package/dist/attach.d.ts +24 -4
- package/dist/attach.js +50 -19
- package/dist/boxd.js +22 -9
- package/dist/browser.d.ts +56 -11
- package/dist/browser.js +76 -17
- package/dist/browserbase.d.ts +20 -5
- package/dist/browserbase.js +186 -21
- 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 +20 -40
- package/dist/conformance/agent37.js +31 -118
- 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/cases/provider.js +4 -1
- 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 +37 -0
- package/dist/descriptor.js +9 -0
- package/dist/descriptors/agent37.d.ts +4 -1
- package/dist/descriptors/agent37.js +5 -2
- package/dist/descriptors/browserbase.d.ts +3 -0
- package/dist/descriptors/browserbase.js +4 -0
- package/dist/descriptors/docker.d.ts +2 -0
- package/dist/descriptors/docker.js +5 -0
- package/dist/descriptors/env-names.d.ts +32 -0
- package/dist/descriptors/env-names.js +60 -0
- package/dist/descriptors/index.d.ts +14 -3
- 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 +52 -13
- package/dist/docker.js +166 -92
- 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/hosted/ssh-exec.d.ts +7 -1
- package/dist/hosted/ssh-exec.js +19 -14
- package/dist/hosted/ssh-key.d.ts +18 -0
- package/dist/hosted/ssh-key.js +36 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/dist/janitor.d.ts +7 -1
- package/dist/janitor.js +2 -2
- package/dist/kernel.d.ts +14 -4
- package/dist/kernel.js +141 -18
- package/dist/local-chrome.d.ts +12 -3
- package/dist/local-chrome.js +108 -10
- 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.d.ts +6 -0
- package/dist/orgo.js +158 -15
- 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
package/dist/descriptor.d.ts
CHANGED
|
@@ -44,6 +44,20 @@ export interface HostCommand {
|
|
|
44
44
|
*/
|
|
45
45
|
readonly builds?: readonly string[];
|
|
46
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Where a provider keeps a secret it makes for itself (its descriptor's `secrets`): one value by each name, shared by
|
|
49
|
+
* every provider made on the same store, and by every process on it. A server's is sealed in its store.
|
|
50
|
+
*/
|
|
51
|
+
export interface ProviderSecrets {
|
|
52
|
+
/** The value kept under `name`; undefined for none, and for one that does not open there. */
|
|
53
|
+
get(name: string): Promise<string | undefined>;
|
|
54
|
+
/**
|
|
55
|
+
* Keeps `value` under `name` unless a value is kept there already, and answers the one kept: of callers racing on one
|
|
56
|
+
* name, in this process or another on the same store, every one answers the same value. Undefined when none could be
|
|
57
|
+
* kept.
|
|
58
|
+
*/
|
|
59
|
+
putIfAbsent(name: string, value: string): Promise<string | undefined>;
|
|
60
|
+
}
|
|
47
61
|
/**
|
|
48
62
|
* A provider, declared once. Every field is data but load(), which imports the provider module only when called:
|
|
49
63
|
* reading a descriptor loads no provider and no vendor SDK.
|
|
@@ -124,10 +138,23 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
|
|
|
124
138
|
readonly connect?: "dial" | "either";
|
|
125
139
|
/** Its computers run on this machine's container engine: a server passes it its local host options (volume, host addresses). */
|
|
126
140
|
readonly local?: boolean;
|
|
141
|
+
/**
|
|
142
|
+
* Its sandbox is the box a server gives a new agent that names no place and needs a shell (Docker's): one provider at
|
|
143
|
+
* most sets it. Where that box is not available, a server gives such an agent no other box in its place.
|
|
144
|
+
*/
|
|
145
|
+
readonly defaultBox?: true;
|
|
127
146
|
/** create() takes a ledger the server keeps for it, as `options[ledger.option]` (the phone harness's sessions). */
|
|
128
147
|
readonly ledger?: {
|
|
129
148
|
readonly option: string;
|
|
130
149
|
};
|
|
150
|
+
/**
|
|
151
|
+
* create() takes the server's store of secrets the provider makes for itself (ProviderSecrets: Agent37's SSH key), as
|
|
152
|
+
* `options[secrets.option]`: one per server store, sealed at rest, never shown. Without one, a provider keeps what it
|
|
153
|
+
* makes for its process alone.
|
|
154
|
+
*/
|
|
155
|
+
readonly secrets?: {
|
|
156
|
+
readonly option: string;
|
|
157
|
+
};
|
|
131
158
|
/**
|
|
132
159
|
* The server's own environment variables its provider reads on this machine, by name (Local Chrome's, where it finds
|
|
133
160
|
* Chrome; a cloud browser's, the gateway a server reaches its API through): a server passes their values, and no other
|
|
@@ -145,6 +172,16 @@ export interface ProviderDescriptor<Module extends ProviderModule = ProviderModu
|
|
|
145
172
|
* image. No setting kind lists one, and Settings never offers one.
|
|
146
173
|
*/
|
|
147
174
|
readonly parked?: readonly ParkedConfiguration[];
|
|
175
|
+
/**
|
|
176
|
+
* Its browsers open a profile the vendor keeps (a Browserbase context, a Kernel profile), which its built providers
|
|
177
|
+
* make and delete (profiles.create, profiles.remove) and declare (capabilities().browser.profiles, this same value). A
|
|
178
|
+
* server keeps an agent's saved sign-in only at a provider that declares this. settleMs: how long after a saving
|
|
179
|
+
* session ends the vendor may still be writing the profile back, which a server waits out before another session saves
|
|
180
|
+
* to it. Absent: its browsers keep no profile.
|
|
181
|
+
*/
|
|
182
|
+
readonly profiles?: {
|
|
183
|
+
readonly settleMs: number;
|
|
184
|
+
};
|
|
148
185
|
/** The provider module, loaded on demand: its create(), its conformance module. */
|
|
149
186
|
load(): Promise<Module>;
|
|
150
187
|
}
|
package/dist/descriptor.js
CHANGED
|
@@ -95,6 +95,8 @@ export function descriptorProblems(value) {
|
|
|
95
95
|
problems.push("connect is either exactly where a setting fills the connect option");
|
|
96
96
|
if (d.ledger !== undefined && (typeof d.ledger?.option !== "string" || d.ledger.option === ""))
|
|
97
97
|
problems.push("ledger names the option it fills");
|
|
98
|
+
if (d.secrets !== undefined && (typeof d.secrets?.option !== "string" || d.secrets.option === ""))
|
|
99
|
+
problems.push("secrets names the option it fills");
|
|
98
100
|
if (d.imageEnv !== undefined && (typeof d.imageEnv !== "string" || !/^[A-Z][A-Z0-9_]*$/.test(d.imageEnv)))
|
|
99
101
|
problems.push("imageEnv is an environment variable name (capital letters, digits and underscores)");
|
|
100
102
|
if (d.hostEnv !== undefined && (!Array.isArray(d.hostEnv) || d.hostEnv.some((name) => typeof name !== "string" || name === "")))
|
|
@@ -114,6 +116,13 @@ export function descriptorProblems(value) {
|
|
|
114
116
|
else if (Array.isArray(d.capabilities) && d.parked.some((one) => d.capabilities.some((offered) => offered?.image === one.image)))
|
|
115
117
|
problems.push("a parked image is also offered");
|
|
116
118
|
}
|
|
119
|
+
if (d.profiles !== undefined) {
|
|
120
|
+
const settleMs = d.profiles?.settleMs;
|
|
121
|
+
if (typeof settleMs !== "number" || !Number.isInteger(settleMs) || settleMs < 0)
|
|
122
|
+
problems.push("profiles is { settleMs }, a whole number of milliseconds, 0 or more");
|
|
123
|
+
else if (!Array.isArray(d.capabilities) || !d.capabilities.some((one) => one?.kind === "browser"))
|
|
124
|
+
problems.push("profiles is a browser's: no configuration is of kind browser");
|
|
125
|
+
}
|
|
117
126
|
return problems;
|
|
118
127
|
}
|
|
119
128
|
/**
|
|
@@ -10,8 +10,11 @@ export declare const AGENT37: {
|
|
|
10
10
|
}, {
|
|
11
11
|
readonly name: "AGENT37_SSH_KEY";
|
|
12
12
|
readonly option: "sshKey";
|
|
13
|
-
readonly required:
|
|
13
|
+
readonly required: false;
|
|
14
14
|
}];
|
|
15
|
+
readonly secrets: {
|
|
16
|
+
readonly option: "secrets";
|
|
17
|
+
};
|
|
15
18
|
readonly metered: true;
|
|
16
19
|
readonly mounts: readonly ["archil"];
|
|
17
20
|
readonly network: readonly ["none", "open", "allow"];
|
|
@@ -10,9 +10,12 @@ export const AGENT37 = defineProvider({
|
|
|
10
10
|
label: "Agent37",
|
|
11
11
|
keys: [
|
|
12
12
|
{ name: "AGENT37_API_KEY", option: "apiKey", required: true },
|
|
13
|
-
//
|
|
14
|
-
|
|
13
|
+
// Every command reaches the machine over SSH. Optional: the private half of a key already on the workspace, used as
|
|
14
|
+
// given; unset, the provider makes its own and registers it with the API key (agent37.ts, kept in `secrets`).
|
|
15
|
+
{ name: "AGENT37_SSH_KEY", option: "sshKey", required: false },
|
|
15
16
|
],
|
|
17
|
+
// The SSH key the provider makes for itself, kept in the server's sealed store: one per server.
|
|
18
|
+
secrets: { option: "secrets" },
|
|
16
19
|
metered: true,
|
|
17
20
|
mounts: ["archil"],
|
|
18
21
|
// None: its programs run in a network of their own, their loopback alone (isolation.ts), and the instance is made
|
|
@@ -16,5 +16,9 @@ export const BROWSERBASE = defineProvider({
|
|
|
16
16
|
hostEnv: ["BROWSERBASE_BASE_URL", "BROWSERBASE_CONNECT_BASE_URL"],
|
|
17
17
|
capabilities: [{ kind: "browser", groups: ["cdp", "stream"] }],
|
|
18
18
|
defaultImage: { browser: BROWSER_IMAGE },
|
|
19
|
+
// A profile is a context, which Browserbase writes back a few seconds after a saving session ends and publishes no
|
|
20
|
+
// bound for: 10 s, twice the few seconds seen, since a session opened on it too soon starts from what was there
|
|
21
|
+
// before, and a wait too long only holds the next save back.
|
|
22
|
+
profiles: { settleMs: 10_000 },
|
|
19
23
|
load: () => import("../browserbase.js"),
|
|
20
24
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Docker's descriptor: computers on this machine's Docker, a sandbox or a desktop; no key, no meter.
|
|
2
|
+
import { DOCKER_ENV_NAMES } from "./env-names.js";
|
|
2
3
|
import { defineProvider } from "../descriptor.js";
|
|
3
4
|
import { LINUX_DESKTOP, SANDBOX } from "./shared.js";
|
|
4
5
|
export const DOCKER = defineProvider({
|
|
@@ -15,5 +16,9 @@ export const DOCKER = defineProvider({
|
|
|
15
16
|
// No default image: the server makes one from the provider's recipe (prepareImage) before the first create.
|
|
16
17
|
prepareImage: true,
|
|
17
18
|
local: true,
|
|
19
|
+
// The box a new agent with no place gets, where this machine's Docker answers.
|
|
20
|
+
defaultBox: true,
|
|
21
|
+
// What the docker CLI reads (env-names.ts DOCKER_ENV_NAMES): the server's own values of these, and no other.
|
|
22
|
+
hostEnv: DOCKER_ENV_NAMES,
|
|
18
23
|
load: () => import("../docker.js"),
|
|
19
24
|
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** The variables every child reads: where programs and the home and temp directories are, the locale, and Windows' and
|
|
2
|
+
* macOS's own. */
|
|
3
|
+
export declare const BASE_ENV_NAMES: readonly string[];
|
|
4
|
+
/**
|
|
5
|
+
* The docker CLI's, beside the base (and what it starts: buildx, ssh, a credential helper, which inherit its environment):
|
|
6
|
+
* - the daemon: DOCKER_HOST, DOCKER_CONTEXT, the TLS files, the API version; SSH_AUTH_SOCK for an ssh:// host;
|
|
7
|
+
* - content trust: DOCKER_CONTENT_TRUST and its server, so a host that verifies its images' signatures still does;
|
|
8
|
+
* XDG_RUNTIME_DIR for a rootless one; the proxy a TCP daemon or a registry is reached through, in both cases;
|
|
9
|
+
* - its config: DOCKER_CONFIG, else HOME's .docker (config.json, contexts, cli-plugins, buildx), BUILDX_*;
|
|
10
|
+
* - a pull's credentials: the credential helper config.json names (docker-credential-<name>, on PATH) finds them where
|
|
11
|
+
* these say: the Secret Service's bus, GnuPG's home and agent, a cloud CLI's profile, region and config. Never a key
|
|
12
|
+
* (AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AZURE_CLIENT_SECRET, DOCKER_CUSTOM_HEADERS, a content trust passphrase),
|
|
13
|
+
* nor a name shaped as one (AWS_SHARED_CREDENTIALS_FILE, AWS_WEB_IDENTITY_TOKEN_FILE,
|
|
14
|
+
* AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, GOOGLE_APPLICATION_CREDENTIALS, PASSWORD_STORE_DIR): a helper that needs
|
|
15
|
+
* one reads it from its default place, a profile or a role instead.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DOCKER_ENV_NAMES: readonly string[];
|
|
18
|
+
/**
|
|
19
|
+
* Chrome's, beside the base, for the local browser's supervisor and the Chrome it starts and the sandbox check's Chrome:
|
|
20
|
+
* the display it may draw on (X's or Wayland's, and X's authority file), the XDG directories it keeps its config, cache
|
|
21
|
+
* and fonts' cache in, fontconfig's files, the session bus, and the setuid sandbox's path where a host names one. No
|
|
22
|
+
* proxy: Chrome is always given its own (--proxy-server), the fence. Nothing else it may read (GOOGLE_API_KEY and the
|
|
23
|
+
* like, Google's services' keys) reaches it.
|
|
24
|
+
*/
|
|
25
|
+
export declare const CHROME_ENV_NAMES: readonly string[];
|
|
26
|
+
/**
|
|
27
|
+
* adb's (Android platform-tools), beside the base, for every adb the phone provider runs and the adb server it starts:
|
|
28
|
+
* where the SDK is (ANDROID_HOME, ANDROID_SDK_ROOT) and where adb keeps its key pair (ANDROID_USER_HOME, or the older
|
|
29
|
+
* ANDROID_SDK_HOME). No ADB_* nor ANDROID_ADB_* name and no ANDROID_SERIAL: each points adb at another server or
|
|
30
|
+
* device than the provider's own -P port and socket requests reach.
|
|
31
|
+
*/
|
|
32
|
+
export declare const ADB_ENV_NAMES: readonly string[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
// The names of the host's environment a child this package starts is handed (child-env.ts childEnv): every child's,
|
|
2
|
+
// the docker CLI's, Chrome's and adb's. Here, beside the descriptors, so a descriptor's hostEnv names them and loads no provider
|
|
3
|
+
// code; this file imports nothing.
|
|
4
|
+
//
|
|
5
|
+
// No list names a variable serve's keyShaped() takes for a key's (a segment KEY, TOKEN, SECRET, PASS, CREDENTIAL(S) ...):
|
|
6
|
+
// serve's child-env-names test holds that for every list here. Docker's own credential places stay (DOCKER_CONFIG, a
|
|
7
|
+
// cloud CLI's config file, GnuPG's home), since a pull reads its registry's credentials there.
|
|
8
|
+
/** The variables every child reads: where programs and the home and temp directories are, the locale, and Windows' and
|
|
9
|
+
* macOS's own. */
|
|
10
|
+
export const BASE_ENV_NAMES = Object.freeze([
|
|
11
|
+
"PATH", "HOME", "TMPDIR", "TZ",
|
|
12
|
+
"LANG", "LANGUAGE", "LC_ALL", "LC_CTYPE", "LC_COLLATE", "LC_MESSAGES", "LC_NUMERIC", "LC_TIME", "LC_MONETARY", "LC_PAPER",
|
|
13
|
+
"LC_NAME", "LC_ADDRESS", "LC_TELEPHONE", "LC_MEASUREMENT", "LC_IDENTIFICATION",
|
|
14
|
+
"SystemRoot", "SYSTEMROOT", "WINDIR", "USERPROFILE", "APPDATA", "LOCALAPPDATA", "ProgramData", "PATHEXT", "COMSPEC", "TEMP", "TMP",
|
|
15
|
+
]);
|
|
16
|
+
/**
|
|
17
|
+
* The docker CLI's, beside the base (and what it starts: buildx, ssh, a credential helper, which inherit its environment):
|
|
18
|
+
* - the daemon: DOCKER_HOST, DOCKER_CONTEXT, the TLS files, the API version; SSH_AUTH_SOCK for an ssh:// host;
|
|
19
|
+
* - content trust: DOCKER_CONTENT_TRUST and its server, so a host that verifies its images' signatures still does;
|
|
20
|
+
* XDG_RUNTIME_DIR for a rootless one; the proxy a TCP daemon or a registry is reached through, in both cases;
|
|
21
|
+
* - its config: DOCKER_CONFIG, else HOME's .docker (config.json, contexts, cli-plugins, buildx), BUILDX_*;
|
|
22
|
+
* - a pull's credentials: the credential helper config.json names (docker-credential-<name>, on PATH) finds them where
|
|
23
|
+
* these say: the Secret Service's bus, GnuPG's home and agent, a cloud CLI's profile, region and config. Never a key
|
|
24
|
+
* (AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN, AZURE_CLIENT_SECRET, DOCKER_CUSTOM_HEADERS, a content trust passphrase),
|
|
25
|
+
* nor a name shaped as one (AWS_SHARED_CREDENTIALS_FILE, AWS_WEB_IDENTITY_TOKEN_FILE,
|
|
26
|
+
* AWS_CONTAINER_CREDENTIALS_RELATIVE_URI, GOOGLE_APPLICATION_CREDENTIALS, PASSWORD_STORE_DIR): a helper that needs
|
|
27
|
+
* one reads it from its default place, a profile or a role instead.
|
|
28
|
+
*/
|
|
29
|
+
export const DOCKER_ENV_NAMES = Object.freeze([
|
|
30
|
+
...BASE_ENV_NAMES,
|
|
31
|
+
"DOCKER_HOST", "DOCKER_CONTEXT", "DOCKER_CONFIG", "DOCKER_CERT_PATH", "DOCKER_TLS", "DOCKER_TLS_VERIFY", "DOCKER_API_VERSION",
|
|
32
|
+
"DOCKER_CONTENT_TRUST", "DOCKER_CONTENT_TRUST_SERVER",
|
|
33
|
+
"DOCKER_DEFAULT_PLATFORM", "DOCKER_BUILDKIT", "BUILDX_CONFIG", "BUILDX_BUILDER",
|
|
34
|
+
"SSH_AUTH_SOCK", "XDG_RUNTIME_DIR", "XDG_CONFIG_HOME",
|
|
35
|
+
"HTTP_PROXY", "HTTPS_PROXY", "NO_PROXY", "ALL_PROXY", "http_proxy", "https_proxy", "no_proxy", "all_proxy",
|
|
36
|
+
"DBUS_SESSION_BUS_ADDRESS", "GNUPGHOME", "GPG_AGENT_INFO",
|
|
37
|
+
"AWS_PROFILE", "AWS_REGION", "AWS_DEFAULT_REGION", "AWS_CONFIG_FILE", "AWS_SDK_LOAD_CONFIG",
|
|
38
|
+
"CLOUDSDK_CONFIG",
|
|
39
|
+
]);
|
|
40
|
+
/**
|
|
41
|
+
* Chrome's, beside the base, for the local browser's supervisor and the Chrome it starts and the sandbox check's Chrome:
|
|
42
|
+
* the display it may draw on (X's or Wayland's, and X's authority file), the XDG directories it keeps its config, cache
|
|
43
|
+
* and fonts' cache in, fontconfig's files, the session bus, and the setuid sandbox's path where a host names one. No
|
|
44
|
+
* proxy: Chrome is always given its own (--proxy-server), the fence. Nothing else it may read (GOOGLE_API_KEY and the
|
|
45
|
+
* like, Google's services' keys) reaches it.
|
|
46
|
+
*/
|
|
47
|
+
export const CHROME_ENV_NAMES = Object.freeze([
|
|
48
|
+
...BASE_ENV_NAMES,
|
|
49
|
+
"DISPLAY", "WAYLAND_DISPLAY", "XAUTHORITY",
|
|
50
|
+
"XDG_RUNTIME_DIR", "XDG_CONFIG_HOME", "XDG_CACHE_HOME", "XDG_DATA_HOME", "XDG_DATA_DIRS", "XDG_CONFIG_DIRS",
|
|
51
|
+
"FONTCONFIG_FILE", "FONTCONFIG_PATH", "FONTCONFIG_SYSROOT",
|
|
52
|
+
"DBUS_SESSION_BUS_ADDRESS", "CHROME_DEVEL_SANDBOX",
|
|
53
|
+
]);
|
|
54
|
+
/**
|
|
55
|
+
* adb's (Android platform-tools), beside the base, for every adb the phone provider runs and the adb server it starts:
|
|
56
|
+
* where the SDK is (ANDROID_HOME, ANDROID_SDK_ROOT) and where adb keeps its key pair (ANDROID_USER_HOME, or the older
|
|
57
|
+
* ANDROID_SDK_HOME). No ADB_* nor ANDROID_ADB_* name and no ANDROID_SERIAL: each points adb at another server or
|
|
58
|
+
* device than the provider's own -P port and socket requests reach.
|
|
59
|
+
*/
|
|
60
|
+
export const ADB_ENV_NAMES = Object.freeze([...BASE_ENV_NAMES, "ANDROID_HOME", "ANDROID_SDK_ROOT", "ANDROID_USER_HOME", "ANDROID_SDK_HOME"]);
|
|
@@ -36,6 +36,8 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
36
36
|
}];
|
|
37
37
|
readonly prepareImage: true;
|
|
38
38
|
readonly local: true;
|
|
39
|
+
readonly defaultBox: true;
|
|
40
|
+
readonly hostEnv: readonly string[];
|
|
39
41
|
readonly load: () => Promise<typeof import("../docker.js")>;
|
|
40
42
|
}, {
|
|
41
43
|
readonly id: "daytona";
|
|
@@ -187,8 +189,11 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
187
189
|
}, {
|
|
188
190
|
readonly name: "AGENT37_SSH_KEY";
|
|
189
191
|
readonly option: "sshKey";
|
|
190
|
-
readonly required:
|
|
192
|
+
readonly required: false;
|
|
191
193
|
}];
|
|
194
|
+
readonly secrets: {
|
|
195
|
+
readonly option: "secrets";
|
|
196
|
+
};
|
|
192
197
|
readonly metered: true;
|
|
193
198
|
readonly mounts: readonly ["archil"];
|
|
194
199
|
readonly network: readonly ["none", "open", "allow"];
|
|
@@ -363,7 +368,7 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
363
368
|
readonly from: "Android platform-tools";
|
|
364
369
|
readonly builds: readonly ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"];
|
|
365
370
|
};
|
|
366
|
-
readonly hostEnv: readonly ["PHONE_HARNESS_APKS"];
|
|
371
|
+
readonly hostEnv: readonly ["PHONE_HARNESS_APKS", ...string[]];
|
|
367
372
|
readonly load: () => Promise<typeof import("../phone-harness.js")>;
|
|
368
373
|
}, {
|
|
369
374
|
readonly id: "browserbase";
|
|
@@ -388,6 +393,9 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
388
393
|
readonly defaultImage: {
|
|
389
394
|
readonly browser: "chromium";
|
|
390
395
|
};
|
|
396
|
+
readonly profiles: {
|
|
397
|
+
readonly settleMs: 10000;
|
|
398
|
+
};
|
|
391
399
|
readonly load: () => Promise<typeof import("../browserbase.js")>;
|
|
392
400
|
}, {
|
|
393
401
|
readonly id: "kernel";
|
|
@@ -408,6 +416,9 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
408
416
|
readonly defaultImage: {
|
|
409
417
|
readonly browser: "chromium";
|
|
410
418
|
};
|
|
419
|
+
readonly profiles: {
|
|
420
|
+
readonly settleMs: 0;
|
|
421
|
+
};
|
|
411
422
|
readonly load: () => Promise<typeof import("../kernel.js")>;
|
|
412
423
|
}, {
|
|
413
424
|
readonly id: "local-chrome";
|
|
@@ -423,7 +434,7 @@ export declare const DESCRIPTORS: readonly [{
|
|
|
423
434
|
readonly defaultImage: {
|
|
424
435
|
readonly browser: "chromium";
|
|
425
436
|
};
|
|
426
|
-
readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH",
|
|
437
|
+
readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH", ...string[]];
|
|
427
438
|
readonly load: () => Promise<typeof import("../local-chrome.js")>;
|
|
428
439
|
}, {
|
|
429
440
|
readonly id: "boxd";
|
|
@@ -13,5 +13,7 @@ export const KERNEL = defineProvider({
|
|
|
13
13
|
hostEnv: ["KERNEL_BASE_URL"],
|
|
14
14
|
capabilities: [{ kind: "browser", groups: ["cdp", "stream"] }],
|
|
15
15
|
defaultImage: { browser: BROWSER_IMAGE },
|
|
16
|
+
// A profile Kernel has written back once the browser that saved to it is deleted: nothing to wait out.
|
|
17
|
+
profiles: { settleMs: 0 },
|
|
16
18
|
load: () => import("../kernel.js"),
|
|
17
19
|
});
|
|
@@ -12,6 +12,6 @@ export declare const LOCAL: {
|
|
|
12
12
|
readonly defaultImage: {
|
|
13
13
|
readonly browser: "chromium";
|
|
14
14
|
};
|
|
15
|
-
readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH",
|
|
15
|
+
readonly hostEnv: readonly ["PI_BROWSER_CHROME", "CHROME_PATH", ...string[]];
|
|
16
16
|
readonly load: () => Promise<typeof import("../local-chrome.js")>;
|
|
17
17
|
};
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// addresses through its egress proxy, every one or only a list's. No live view: a person watching runs it headed. Its id is local-chrome, a token
|
|
3
3
|
// nothing else in the code base uses (a folder mode, a region and an API tag are all "local").
|
|
4
4
|
import { defineProvider } from "../descriptor.js";
|
|
5
|
+
import { CHROME_ENV_NAMES } from "./env-names.js";
|
|
5
6
|
import { BROWSER_IMAGE } from "./shared.js";
|
|
6
7
|
export const LOCAL = defineProvider({
|
|
7
8
|
id: "local-chrome",
|
|
@@ -14,8 +15,9 @@ export const LOCAL = defineProvider({
|
|
|
14
15
|
network: ["open", "allow"],
|
|
15
16
|
capabilities: [{ kind: "browser", groups: ["cdp"] }],
|
|
16
17
|
defaultImage: { browser: BROWSER_IMAGE },
|
|
17
|
-
// Where it finds this machine's Chrome (chrome.ts CHROME_ENV, then PATH)
|
|
18
|
-
//
|
|
19
|
-
|
|
18
|
+
// Where it finds this machine's Chrome (chrome.ts CHROME_ENV, then PATH), and what Chrome reads (env-names.ts
|
|
19
|
+
// CHROME_ENV_NAMES): the server's own values of these, and no other. The finder's two are written out, so reading the
|
|
20
|
+
// descriptor loads no provider code (kinds.test holds the lists together); env-names.ts imports nothing.
|
|
21
|
+
hostEnv: ["PI_BROWSER_CHROME", "CHROME_PATH", ...CHROME_ENV_NAMES],
|
|
20
22
|
load: () => import("../local-chrome.js"),
|
|
21
23
|
});
|
|
@@ -29,6 +29,6 @@ export declare const PHONE_HARNESS: {
|
|
|
29
29
|
readonly from: "Android platform-tools";
|
|
30
30
|
readonly builds: readonly ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"];
|
|
31
31
|
};
|
|
32
|
-
readonly hostEnv: readonly ["PHONE_HARNESS_APKS"];
|
|
32
|
+
readonly hostEnv: readonly ["PHONE_HARNESS_APKS", ...string[]];
|
|
33
33
|
readonly load: () => Promise<typeof import("../phone-harness.js")>;
|
|
34
34
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The phone harness's descriptor: a cloud Android over adb, its sessions in a ledger the server keeps.
|
|
2
2
|
import { defineProvider } from "../descriptor.js";
|
|
3
|
+
import { ADB_ENV_NAMES } from "./env-names.js";
|
|
3
4
|
/** The groups a phone harness phone offers: phoned's, the driver it runs (daemon-android/), in its hello's order. */
|
|
4
5
|
export const PHONE_GROUPS = ["exec", "screen", "input.keys", "input.touch", "apps", "ui"];
|
|
5
6
|
/** The phone harness's Android: a phone computer when its setting names no image. */
|
|
@@ -19,7 +20,8 @@ export const PHONE_HARNESS = defineProvider({
|
|
|
19
20
|
// The phone is driven by adb from the server's machine (the module's adb option, adb on PATH by default). Google
|
|
20
21
|
// builds platform-tools for x86-64 Linux, macOS and x86-64 Windows alone.
|
|
21
22
|
hostCommand: { command: "adb", from: "Android platform-tools", builds: ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"] },
|
|
22
|
-
// The APKs every phone installs, files on this machine each pinned by its sha256: the operator's setting alone.
|
|
23
|
-
|
|
23
|
+
// The APKs every phone installs, files on this machine each pinned by its sha256: the operator's setting alone. And
|
|
24
|
+
// what adb reads (ADB_ENV_NAMES), the only environment an adb the provider runs starts with.
|
|
25
|
+
hostEnv: ["PHONE_HARNESS_APKS", ...ADB_ENV_NAMES],
|
|
24
26
|
load: () => import("../phone-harness.js"),
|
|
25
27
|
});
|
package/dist/docker/egress.d.ts
CHANGED
|
@@ -10,6 +10,13 @@ export declare const EGRESS_LABEL = "agentrun.computer.egress";
|
|
|
10
10
|
/** Where the computer mounts the volume, read-only, and the proxy's socket in it: what init's relay connects to. */
|
|
11
11
|
export declare const EGRESS_MOUNT = "/opt/agentrun/egress";
|
|
12
12
|
export declare const EGRESS_SOCKET = "/opt/agentrun/egress/egress.sock";
|
|
13
|
+
/**
|
|
14
|
+
* `docker run`'s `--env` for the proxy variables, each set empty: the docker CLI fills in each one a run does not set
|
|
15
|
+
* itself from config.json's `proxies` (DOCKER_CONFIG, else HOME's .docker), so without these a computer, and its
|
|
16
|
+
* proxy, would hold the host's docker proxy, a credential in its URL included. A fenced computer's programs get their
|
|
17
|
+
* proxy from init's relay alone.
|
|
18
|
+
*/
|
|
19
|
+
export declare const NO_CONFIG_PROXY: readonly string[];
|
|
13
20
|
/** Init's flag for the relay: computerd init --egress <socket>. */
|
|
14
21
|
export declare const RELAY_FLAG = "--egress";
|
|
15
22
|
/** The most entries of each kind an allowlist holds: Docker's own bound, so the list fits one argv element. */
|
package/dist/docker/egress.js
CHANGED
|
@@ -35,6 +35,13 @@ export const EGRESS_LABEL = "agentrun.computer.egress";
|
|
|
35
35
|
/** Where the computer mounts the volume, read-only, and the proxy's socket in it: what init's relay connects to. */
|
|
36
36
|
export const EGRESS_MOUNT = "/opt/agentrun/egress";
|
|
37
37
|
export const EGRESS_SOCKET = `${EGRESS_MOUNT}/egress.sock`;
|
|
38
|
+
/**
|
|
39
|
+
* `docker run`'s `--env` for the proxy variables, each set empty: the docker CLI fills in each one a run does not set
|
|
40
|
+
* itself from config.json's `proxies` (DOCKER_CONFIG, else HOME's .docker), so without these a computer, and its
|
|
41
|
+
* proxy, would hold the host's docker proxy, a credential in its URL included. A fenced computer's programs get their
|
|
42
|
+
* proxy from init's relay alone.
|
|
43
|
+
*/
|
|
44
|
+
export const NO_CONFIG_PROXY = Object.freeze(["HTTP_PROXY", "http_proxy", "HTTPS_PROXY", "https_proxy", "FTP_PROXY", "ftp_proxy", "NO_PROXY", "no_proxy", "ALL_PROXY", "all_proxy"].flatMap((name) => ["--env", `${name}=`]));
|
|
38
45
|
/** Init's flag for the relay: computerd init --egress <socket>. */
|
|
39
46
|
export const RELAY_FLAG = "--egress";
|
|
40
47
|
/** The most entries of each kind an allowlist holds: Docker's own bound, so the list fits one argv element. */
|
|
@@ -195,6 +202,7 @@ export function egressRunArgs({ name, user, image, allow, local, deadline, code,
|
|
|
195
202
|
for (const [key, value] of Object.entries(labels))
|
|
196
203
|
args.push("--label", `${key}=${value}`);
|
|
197
204
|
args.push("--user", user, "--read-only", "--cap-drop", "ALL", "--security-opt", "no-new-privileges", "--ipc", "private", "--cgroupns", "private");
|
|
205
|
+
args.push(...NO_CONFIG_PROXY);
|
|
198
206
|
const memory = `${PROXY_MEMORY_MB}m`;
|
|
199
207
|
args.push("--pids-limit", String(PROXY_PIDS), "--memory", memory, "--memory-swap", memory);
|
|
200
208
|
args.push("--cpu-period", String(PROXY_CPU_PERIOD_US), "--cpu-quota", String(PROXY_CPU_QUOTA_US), "--ulimit", `nofile=${PROXY_NOFILE}:${PROXY_NOFILE}`);
|
package/dist/docker/image.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Result } from "../result.js";
|
|
2
|
+
import { type HostEnv } from "../child-env.js";
|
|
2
3
|
/** The repository every recipe's image is tagged in. */
|
|
3
4
|
export declare const IMAGE_REPOSITORY = "agentrun-computer";
|
|
4
5
|
/** The label a recipe's image carries: the recipe's whole sha256. A computer made from the image carries it too. */
|
|
@@ -25,6 +26,9 @@ export type ImageSource = {
|
|
|
25
26
|
export interface EnsureImageOptions {
|
|
26
27
|
/** The docker CLI. */
|
|
27
28
|
docker?: string;
|
|
29
|
+
/** The host's environment variables: each docker call holds the names docker reads of them (DOCKER_ENV_NAMES), and
|
|
30
|
+
* nothing else; without env, none. A pull's credential helper finds its credentials through these. */
|
|
31
|
+
env?: HostEnv;
|
|
28
32
|
/** Ends this caller's wait; the last caller's abort stops the build or pull. */
|
|
29
33
|
signal?: AbortSignal;
|
|
30
34
|
/** The flight's bound, when this call starts it; default IMAGE_TIMEOUT_MS. */
|
|
@@ -46,4 +50,4 @@ export declare function imageSourceProblem(source: unknown): string | undefined;
|
|
|
46
50
|
* The image ready in Docker: its tag, for create's spec.image. A recipe is built when Docker has no image of it under its
|
|
47
51
|
* tag; an image by name is pulled when Docker has none. Concurrent callers share one flight; see the top of this file.
|
|
48
52
|
*/
|
|
49
|
-
export declare function ensureImage(source: ImageSource, { docker, signal, timeoutMs, onWait }?: EnsureImageOptions): Promise<Result<string>>;
|
|
53
|
+
export declare function ensureImage(source: ImageSource, { docker, env, signal, timeoutMs, onWait }?: EnsureImageOptions): Promise<Result<string>>;
|
package/dist/docker/image.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
import { execFile } from "node:child_process";
|
|
20
20
|
import { createHash } from "node:crypto";
|
|
21
21
|
import { failFor, ok, vendorFail } from "../result.js";
|
|
22
|
+
import { dockerEnv } from "../child-env.js";
|
|
22
23
|
/** This module's failures: one with code vendor names Docker. */
|
|
23
24
|
const fail = failFor("docker");
|
|
24
25
|
/** The repository every recipe's image is tagged in. */
|
|
@@ -98,7 +99,7 @@ function sourceOf(source) {
|
|
|
98
99
|
* The image ready in Docker: its tag, for create's spec.image. A recipe is built when Docker has no image of it under its
|
|
99
100
|
* tag; an image by name is pulled when Docker has none. Concurrent callers share one flight; see the top of this file.
|
|
100
101
|
*/
|
|
101
|
-
export async function ensureImage(source, { docker = "docker", signal, timeoutMs = IMAGE_TIMEOUT_MS, onWait } = {}) {
|
|
102
|
+
export async function ensureImage(source, { docker = "docker", env, signal, timeoutMs = IMAGE_TIMEOUT_MS, onWait } = {}) {
|
|
102
103
|
const checked = sourceOf(source);
|
|
103
104
|
if (typeof checked === "string")
|
|
104
105
|
return fail("invalid", checked);
|
|
@@ -107,12 +108,15 @@ export async function ensureImage(source, { docker = "docker", signal, timeoutMs
|
|
|
107
108
|
}
|
|
108
109
|
if (signal?.aborted)
|
|
109
110
|
return fail("aborted", `the wait for ${checked.tag} was aborted before it began`);
|
|
110
|
-
|
|
111
|
+
// The environment docker is started with is part of the flight: two Docker hosts (DOCKER_HOST, DOCKER_CONTEXT) never
|
|
112
|
+
// share one pull or build. Its names are sorted, so the same environment is the same flight.
|
|
113
|
+
const childEnvOf = dockerEnv(env);
|
|
114
|
+
const key = JSON.stringify([docker, Object.entries(childEnvOf).sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0)), checked.kind, checked.kind === "recipe" ? checked.hash : checked.tag]);
|
|
111
115
|
let flight = flights.get(key);
|
|
112
116
|
// A flight every caller left is stopping: a new caller starts its own.
|
|
113
117
|
if (flight === undefined || flight.controller.signal.aborted) {
|
|
114
118
|
const crew = { controller: new AbortController(), waiting: 0, toTell: new Set() };
|
|
115
|
-
const started = Object.assign(crew, { result: fly(docker, checked, timeoutMs, crew) });
|
|
119
|
+
const started = Object.assign(crew, { result: fly(docker, childEnvOf, checked, timeoutMs, crew) });
|
|
116
120
|
flight = started;
|
|
117
121
|
flights.set(key, started);
|
|
118
122
|
void started.result.finally(() => {
|
|
@@ -176,14 +180,14 @@ export async function ensureImage(source, { docker = "docker", signal, timeoutMs
|
|
|
176
180
|
* that fails asks Docker once more: another process may have tagged the image first (Docker 29's containerd image store
|
|
177
181
|
* fails the loser of that race with "already exists"), and an image of this source under the tag is the answer.
|
|
178
182
|
*/
|
|
179
|
-
async function fly(docker, source, timeoutMs, flight) {
|
|
183
|
+
async function fly(docker, env, source, timeoutMs, flight) {
|
|
180
184
|
const { controller } = flight;
|
|
181
185
|
let late = false;
|
|
182
186
|
const timer = setTimeout(() => {
|
|
183
187
|
late = true;
|
|
184
188
|
controller.abort();
|
|
185
189
|
}, timeoutMs);
|
|
186
|
-
const call = (args, input) => run(docker, args, controller.signal, () => late, input);
|
|
190
|
+
const call = (args, input) => run(docker, env, args, controller.signal, () => late, input);
|
|
187
191
|
const inspect = () => call(["image", "inspect", "--format", "{{json .Config.Labels}}", source.tag]);
|
|
188
192
|
const ready = (answer) => answer.code === 0 && (source.kind === "image" || labelsOf(answer.stdout)[RECIPE_LABEL] === source.hash);
|
|
189
193
|
try {
|
|
@@ -218,10 +222,10 @@ async function fly(docker, source, timeoutMs, flight) {
|
|
|
218
222
|
clearTimeout(timer);
|
|
219
223
|
}
|
|
220
224
|
}
|
|
221
|
-
/** `docker` with args, the input on its stdin, killed with SIGKILL when the signal aborts. */
|
|
222
|
-
function run(docker, args, signal, late, input) {
|
|
225
|
+
/** `docker` with args, the input on its stdin, killed with SIGKILL when the signal aborts; `env` is its whole environment. */
|
|
226
|
+
function run(docker, env, args, signal, late, input) {
|
|
223
227
|
return new Promise((resolve) => {
|
|
224
|
-
const child = execFile(docker, args, { encoding: "utf8", signal, killSignal: "SIGKILL", maxBuffer: 32 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
228
|
+
const child = execFile(docker, args, { env, encoding: "utf8", signal, killSignal: "SIGKILL", maxBuffer: 32 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
225
229
|
if (error === null)
|
|
226
230
|
return resolve({ code: 0, stdout, stderr });
|
|
227
231
|
const failed = error;
|