@parcha/agentrun-computer 0.1.0-beta.35 → 0.1.0-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +108 -21
- package/box/Dockerfile +3 -1
- package/box/agentrun-archil +59 -7
- package/box/build-daytona.py +20 -4
- package/dist/browser.d.ts +61 -10
- package/dist/browser.js +125 -3
- package/dist/browserbase.d.ts +45 -20
- package/dist/browserbase.js +161 -17
- package/dist/chrome.d.ts +3 -4
- package/dist/chrome.js +6 -11
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/conformance/daytona.d.ts +4 -0
- package/dist/conformance/daytona.js +5 -0
- package/dist/daytona.d.ts +13 -1
- package/dist/daytona.js +55 -36
- package/dist/descriptor.d.ts +24 -2
- package/dist/descriptor.js +11 -0
- package/dist/descriptors/browserbase.d.ts +1 -0
- package/dist/descriptors/browserbase.js +2 -0
- package/dist/descriptors/daytona.d.ts +23 -2
- package/dist/descriptors/daytona.js +34 -2
- package/dist/descriptors/index.d.ts +28 -1
- package/dist/descriptors/index.js +1 -1
- package/dist/descriptors/kernel.d.ts +1 -0
- package/dist/descriptors/kernel.js +2 -0
- package/dist/descriptors/modal.d.ts +4 -0
- package/dist/descriptors/modal.js +11 -1
- package/dist/descriptors/orgo.d.ts +11 -0
- package/dist/descriptors/orgo.js +6 -1
- package/dist/descriptors/phone-harness.d.ts +5 -0
- package/dist/descriptors/phone-harness.js +3 -0
- package/dist/docker/egress.d.ts +4 -3
- package/dist/docker/egress.js +7 -6
- package/dist/docker.js +7 -5
- package/dist/e2b.js +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/janitor.d.ts +5 -4
- package/dist/janitor.js +1 -1
- package/dist/kernel.d.ts +16 -24
- package/dist/kernel.js +93 -18
- package/dist/kinds.d.ts +9 -4
- package/dist/labels.d.ts +10 -2
- package/dist/labels.js +30 -7
- package/dist/local-chrome.d.ts +3 -1
- package/dist/local-chrome.js +8 -4
- package/dist/modal.d.ts +3 -3
- package/dist/modal.js +71 -57
- package/dist/mount-archil.d.ts +25 -3
- package/dist/mount-archil.js +39 -8
- package/dist/orgo-desktop.d.ts +15 -6
- package/dist/orgo-desktop.js +295 -53
- package/dist/orgo-names.d.ts +129 -3
- package/dist/orgo-names.js +211 -8
- package/dist/orgo.d.ts +18 -7
- package/dist/orgo.js +381 -69
- package/dist/phone-harness.d.ts +3 -2
- package/dist/phone-harness.js +25 -8
- package/dist/protocol.d.ts +5 -0
- package/dist/provider.d.ts +63 -1
- package/dist/provider.js +8 -3
- package/package.json +1 -1
|
@@ -19,6 +19,10 @@ export declare const MACOS_GROUPS: readonly Group[];
|
|
|
19
19
|
export declare const ORGO_CONFIGURATIONS: readonly [{
|
|
20
20
|
readonly image: "linux";
|
|
21
21
|
readonly options: {};
|
|
22
|
+
readonly persistence: {
|
|
23
|
+
readonly keepsState: true;
|
|
24
|
+
readonly resume: true;
|
|
25
|
+
};
|
|
22
26
|
readonly kind: import("../protocol.js").ComputerKind;
|
|
23
27
|
readonly groups: Group[];
|
|
24
28
|
readonly gpu?: import("../provider.js").GpuCapability;
|
|
@@ -60,6 +64,10 @@ export declare const ORGO: {
|
|
|
60
64
|
readonly capabilities: readonly [{
|
|
61
65
|
readonly image: "linux";
|
|
62
66
|
readonly options: {};
|
|
67
|
+
readonly persistence: {
|
|
68
|
+
readonly keepsState: true;
|
|
69
|
+
readonly resume: true;
|
|
70
|
+
};
|
|
63
71
|
readonly kind: import("../protocol.js").ComputerKind;
|
|
64
72
|
readonly groups: Group[];
|
|
65
73
|
readonly gpu?: import("../provider.js").GpuCapability;
|
|
@@ -81,6 +89,9 @@ export declare const ORGO: {
|
|
|
81
89
|
};
|
|
82
90
|
readonly why: "Orgo's macOS desktops are parked for now: Orgo offers Linux desktops";
|
|
83
91
|
}];
|
|
92
|
+
readonly ledger: {
|
|
93
|
+
readonly option: "ledger";
|
|
94
|
+
};
|
|
84
95
|
readonly defaultImage: {
|
|
85
96
|
readonly desktop: "linux";
|
|
86
97
|
};
|
package/dist/descriptors/orgo.js
CHANGED
|
@@ -17,7 +17,10 @@ export const MACOS_GROUPS = ["exec", "screen", "input.pointer", "input.keys"];
|
|
|
17
17
|
* Windows and macOS are parked (ORGO_PARKED): create({ os }) still builds them, for the conformance suite and their
|
|
18
18
|
* tests, but no agent's setting selects one, and a setting that names one is refused in words saying so.
|
|
19
19
|
*/
|
|
20
|
-
export const ORGO_CONFIGURATIONS = [
|
|
20
|
+
export const ORGO_CONFIGURATIONS = [
|
|
21
|
+
// Orgo's suspend keeps a Linux desktop's memory and disk: an agent's own computer resumes where it was.
|
|
22
|
+
{ ...LINUX_DESKTOP, image: ORGO_BASE_IMAGE, options: {}, persistence: { keepsState: true, resume: true } },
|
|
23
|
+
];
|
|
21
24
|
/** Orgo's desktops not offered yet, each as its module builds it (create()'s os), and why, in the words a setting naming
|
|
22
25
|
* one is refused in. */
|
|
23
26
|
export const ORGO_PARKED = [
|
|
@@ -39,6 +42,8 @@ export const ORGO = defineProvider({
|
|
|
39
42
|
network: ["none"],
|
|
40
43
|
capabilities: ORGO_CONFIGURATIONS,
|
|
41
44
|
parked: ORGO_PARKED,
|
|
45
|
+
// An agent's own computers' labels: Orgo holds none, and a detached computer is never woken to read its labels file.
|
|
46
|
+
ledger: { option: "ledger" },
|
|
42
47
|
defaultImage: { desktop: ORGO_BASE_IMAGE },
|
|
43
48
|
load: () => import("../orgo.js"),
|
|
44
49
|
});
|
|
@@ -24,5 +24,10 @@ export declare const PHONE_HARNESS: {
|
|
|
24
24
|
readonly ledger: {
|
|
25
25
|
readonly option: "ledger";
|
|
26
26
|
};
|
|
27
|
+
readonly hostCommand: {
|
|
28
|
+
readonly command: "adb";
|
|
29
|
+
readonly from: "Android platform-tools";
|
|
30
|
+
readonly builds: readonly ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"];
|
|
31
|
+
};
|
|
27
32
|
readonly load: () => Promise<typeof import("../phone-harness.js")>;
|
|
28
33
|
};
|
|
@@ -16,5 +16,8 @@ export const PHONE_HARNESS = defineProvider({
|
|
|
16
16
|
defaultImage: { phone: PHONE_IMAGE },
|
|
17
17
|
// The phones it rents, by session: the server's store backs this ledger, so a phone is never lost across restarts.
|
|
18
18
|
ledger: { option: "ledger" },
|
|
19
|
+
// The phone is driven by adb from the server's machine (the module's adb option, adb on PATH by default). Google
|
|
20
|
+
// builds platform-tools for x86-64 Linux, macOS and x86-64 Windows alone.
|
|
21
|
+
hostCommand: { command: "adb", from: "Android platform-tools", builds: ["linux-x64", "darwin-x64", "darwin-arm64", "win32-x64"] },
|
|
19
22
|
load: () => import("../phone-harness.js"),
|
|
20
23
|
});
|
package/dist/docker/egress.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { DockerInspect } from "./inspect.js";
|
|
2
2
|
import type { NetworkPolicy } from "../provider.js";
|
|
3
|
-
/** The proxy container's image: node:22.23.
|
|
4
|
-
*
|
|
5
|
-
|
|
3
|
+
/** The proxy container's image: node:22.23.5-trixie-slim (Node 22's November 2026 security release), pinned to its
|
|
4
|
+
* multi-arch index digest (amd64 and arm64 both listed), so every host runs the same Node. serve's macOS proxy pins the
|
|
5
|
+
* same image. The provider's `egress.image` replaces it. */
|
|
6
|
+
export declare const EGRESS_IMAGE = "node:22.23.5-trixie-slim@sha256:68c76cfad89921b927eae28ba21407475e29d0ce450afcdbe70c1532db042b64";
|
|
6
7
|
/** The label the proxy container and the volume carry: the computer's name. In the provider's own namespace, which a
|
|
7
8
|
* spec's labels cannot use. */
|
|
8
9
|
export declare const EGRESS_LABEL = "agentrun.computer.egress";
|
package/dist/docker/egress.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// A Docker computer's way out to the network when its spec asks for an allowlist ({ allow: [names or CIDRs] }): the
|
|
2
2
|
// computer stays `--network none`, and its own egress proxy runs in a second container the provider makes, reads back
|
|
3
|
-
// and removes with it.
|
|
4
|
-
//
|
|
5
|
-
//
|
|
3
|
+
// and removes with it. The proxy does not live in the process that
|
|
4
|
+
// made the computer, so the computer keeps its network when that process ends, and attach and list read it back from
|
|
5
|
+
// Docker anywhere.
|
|
6
6
|
//
|
|
7
7
|
// - The volume `<computer>-egress`: a tmpfs of 1 MiB, mode 0700, owned by the computer's uid:gid. The proxy's Unix
|
|
8
8
|
// socket is made in it; the computer mounts it read-only at EGRESS_MOUNT.
|
|
@@ -20,9 +20,10 @@ import { fileURLToPath } from "node:url";
|
|
|
20
20
|
import { DEADLINE_LABEL } from "../drift.js";
|
|
21
21
|
import { LISTED_PORTS, parseAllow } from "./egress-proxy.js";
|
|
22
22
|
import { checkAddress } from "./egress-table.js";
|
|
23
|
-
/** The proxy container's image: node:22.23.
|
|
24
|
-
*
|
|
25
|
-
|
|
23
|
+
/** The proxy container's image: node:22.23.5-trixie-slim (Node 22's November 2026 security release), pinned to its
|
|
24
|
+
* multi-arch index digest (amd64 and arm64 both listed), so every host runs the same Node. serve's macOS proxy pins the
|
|
25
|
+
* same image. The provider's `egress.image` replaces it. */
|
|
26
|
+
export const EGRESS_IMAGE = "node:22.23.5-trixie-slim@sha256:68c76cfad89921b927eae28ba21407475e29d0ce450afcdbe70c1532db042b64";
|
|
26
27
|
/** The label the proxy container and the volume carry: the computer's name. In the provider's own namespace, which a
|
|
27
28
|
* spec's labels cannot use. */
|
|
28
29
|
export const EGRESS_LABEL = "agentrun.computer.egress";
|
package/dist/docker.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
// The Docker provisioner: every call through the docker CLI with execFile or spawn, never a shell.
|
|
2
|
-
// and the inspect reading follow pi-transport's Docker box.
|
|
1
|
+
// The Docker provisioner: every call through the docker CLI with execFile or spawn, never a shell.
|
|
3
2
|
import { execFile, spawn } from "node:child_process";
|
|
4
3
|
import { randomBytes } from "node:crypto";
|
|
5
4
|
import { readFileSync, statSync } from "node:fs";
|
|
@@ -80,10 +79,13 @@ const HELLO_TIMEOUT_MS = 30_000;
|
|
|
80
79
|
/** Ids a list() inspect takes at once, so its argv and output stay bounded however many computers match. */
|
|
81
80
|
const INSPECT_BATCH = 50;
|
|
82
81
|
/** Only the fields list() reads, in inspect's own shape: a whole inspect is kilobytes a container, and execFile's
|
|
83
|
-
* output is capped. The user and init's command are an allowlist's read-back: its relay, and its proxy's user.
|
|
82
|
+
* output is capped. The user and init's command are an allowlist's read-back: its relay, and its proxy's user.
|
|
83
|
+
* Docker runs the template on the inspect's JSON as a map and a missing key fails the whole inspect, so a field Docker
|
|
84
|
+
* leaves out when empty is read with index, which reads null: HostConfig.Mounts is absent from a container made with no
|
|
85
|
+
* --mount (one the label filter matches yet this provider never made), and one such container would fail the list. */
|
|
84
86
|
const LIST_FORMAT = '{"Id":{{json .Id}},"Name":{{json .Name}},"State":{"Running":{{json .State.Running}}},' +
|
|
85
87
|
'"Config":{"Labels":{{json .Config.Labels}},"User":{{json .Config.User}},"Cmd":{{json .Config.Cmd}}},' +
|
|
86
|
-
'"HostConfig":{"NetworkMode":{{json .HostConfig.NetworkMode}},"Mounts":{{json .HostConfig
|
|
88
|
+
'"HostConfig":{"NetworkMode":{{json .HostConfig.NetworkMode}},"Mounts":{{json (index .HostConfig "Mounts")}}},"NetworkSettings":{"Networks":{{json .NetworkSettings.Networks}}},"Mounts":{{json .Mounts}}}';
|
|
87
89
|
/** The longest lifetime: 30 days. A computer meant to live longer is asked for again. No extend(): the deadline is a
|
|
88
90
|
* container label, and a label cannot change after create. */
|
|
89
91
|
const MAX_LIFETIME_MS = 30 * 24 * 60 * 60 * 1000;
|
|
@@ -250,7 +252,7 @@ export class DockerProvider {
|
|
|
250
252
|
const refusals = [];
|
|
251
253
|
const refuse = (field, message) => refusals.push({ field, message });
|
|
252
254
|
const given = spec;
|
|
253
|
-
const { image,
|
|
255
|
+
const { image, network, cpus, memoryMb, pids, labels, workdir, user, mount } = given;
|
|
254
256
|
if (typeof image !== "string" || image.trim() === "" || image.startsWith("-")) {
|
|
255
257
|
refuse("image", "an image is required, such as debian:bookworm-slim");
|
|
256
258
|
}
|
package/dist/e2b.js
CHANGED
|
@@ -418,7 +418,7 @@ export class E2BProvider {
|
|
|
418
418
|
const refusals = [];
|
|
419
419
|
const refuse = (field, message) => refusals.push({ field, message });
|
|
420
420
|
const given = (typeof spec === "object" && spec !== null ? spec : {});
|
|
421
|
-
const { image,
|
|
421
|
+
const { image, network, labels, mount } = given;
|
|
422
422
|
refusals.push(...checkMount(mount, MOUNT), ...archilRefusals(given));
|
|
423
423
|
const daemonUser = `${this.#uid}:${this.#gid}`;
|
|
424
424
|
if (mount?.kind === "archil" && daemonUser !== ARCHIL_USER) {
|
package/dist/index.d.ts
CHANGED
|
@@ -10,17 +10,17 @@ export { type ActionMapper, createActionMapper, daemonWatch, redactWords, type S
|
|
|
10
10
|
export { type DockerVolume, VOLUME_SUBPATH_ENGINE } from "./docker/volume.js";
|
|
11
11
|
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";
|
|
12
12
|
export { EGRESS_IMAGE, EGRESS_LABEL, EGRESS_MOUNT, EGRESS_SOCKET } from "./docker/egress.js";
|
|
13
|
-
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";
|
|
14
|
-
export { type BrowserStream, BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, type ReleaseConfirm, type RestReply, type UrlStore, } from "./browser.js";
|
|
13
|
+
export { ARCHIL_HELPER, ARCHIL_MOUNT_LABEL, ARCHIL_SYNC_SOCKET, ARCHIL_TOOL_UID, ARCHIL_TOOL_USER, ARCHIL_VERSION, type ArchilMount, type ArchilEgress, type ArchilMountOptions, type ArchilRoot, type ProviderNote, archilEgressOf, archilLabels, archilMount, archilReadBack, archilRefusals, archilRelease, claimEpoch, helperSha256, mountDrift, mountWords, type RecordedArchil, readArchilMount, recordedArchil, recordedMount, syncingClient, } from "./mount-archil.js";
|
|
14
|
+
export { type BrowserComputerProvider, type BrowserDownloads, type BrowserFile, type BrowserProfiles, browserSpecRefusals, type BrowserStream, isBrowserProvider, BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, type ReleaseConfirm, type RestReply, type UrlStore, } from "./browser.js";
|
|
15
15
|
export { CHROME_ENV, CHROME_FLAGS, checkChrome, chromeFence, findChrome, killTree, NO_CHROME } from "./chrome.js";
|
|
16
16
|
export { DAEMON_IN_COMPUTER, helloDrift, type HelloExpected } from "./drift.js";
|
|
17
17
|
export { drift, hostOf, inspectDrift, mountOf, networkOf, type DockerHost, type DockerInfo, type DockerInspect, type DriftExpected } from "./docker/inspect.js";
|
|
18
18
|
export { type ReleasedOlder, releaseOlder, sweep, type SweepOptions, type Swept } from "./janitor.js";
|
|
19
|
-
export { EPOCH_LABEL, epochOf, epochProblem, IDLE_TTL_LABEL, OWNER_LABEL, ownerLabels, ownerOf, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
|
|
19
|
+
export { EPOCH_LABEL, epochOf, epochProblem, IDLE_TTL_LABEL, OWNER_LABEL, OWNER_SERVER_LABEL, ownerFilter, ownerLabels, ownerOf, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
|
|
20
20
|
export { waitUntil, type WaitOptions } from "./wait.js";
|
|
21
21
|
export { type BuiltinProviderId, type ConformanceModule, descriptorOf, isProviderId, type ProviderEnv, providerFor, type ProviderId, providerIds, type ProviderModule, providerModule, type ProviderOptions, providers, } from "./providers.js";
|
|
22
|
-
export { type DescriptorKey, type DescriptorSetting, defineProvider, descriptorProblems, type ParkedConfiguration, type ProviderDescriptor } from "./descriptor.js";
|
|
23
|
-
export { BROWSER_IMAGE, BROWSERBASE, DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DESCRIPTORS, DOCKER, E2B, E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE, KERNEL, LOCAL, MODAL, MODAL_DEFAULT_IMAGE, ORGO, ORGO_BASE_IMAGE, PHONE_GROUPS, PHONE_HARNESS, PHONE_IMAGE, } from "./descriptors/index.js";
|
|
22
|
+
export { type DescriptorKey, type DescriptorSetting, defineProvider, descriptorProblems, type HostCommand, type ParkedConfiguration, type ProviderDescriptor } from "./descriptor.js";
|
|
23
|
+
export { BROWSER_IMAGE, BROWSERBASE, DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, type DaytonaGpuSnapshot, DESCRIPTORS, daytonaGpu, daytonaGpuSnapshot, DOCKER, E2B, E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE, KERNEL, LOCAL, MODAL, MODAL_DEFAULT_IMAGE, ORGO, ORGO_BASE_IMAGE, PHONE_GROUPS, PHONE_HARNESS, PHONE_IMAGE, } from "./descriptors/index.js";
|
|
24
24
|
export type { PhoneLedger, PhoneLedgerEntry } from "./phone-harness.js";
|
|
25
25
|
export { type ComputerSettingKind, configurationOf, entryOf, imagesOf, type KindCapabilities, kindOf, type ProviderEntry, PROVIDERS, SETTING_KIND_NAMES, SETTING_KINDS, type SettingKindSpec, serves, servingRefusals, type TestConnection, type TestConnectionOptions, } from "./kinds.js";
|
|
26
26
|
export * from "./conformance/index.js";
|
package/dist/index.js
CHANGED
|
@@ -13,18 +13,18 @@ export { createActionMapper, daemonWatch, redactWords, ScreenWatchError, toActio
|
|
|
13
13
|
export { VOLUME_SUBPATH_ENGINE } from "./docker/volume.js";
|
|
14
14
|
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";
|
|
15
15
|
export { EGRESS_IMAGE, EGRESS_LABEL, EGRESS_MOUNT, EGRESS_SOCKET } from "./docker/egress.js";
|
|
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
|
-
export { BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, } from "./browser.js";
|
|
16
|
+
export { ARCHIL_HELPER, ARCHIL_MOUNT_LABEL, ARCHIL_SYNC_SOCKET, ARCHIL_TOOL_UID, ARCHIL_TOOL_USER, ARCHIL_VERSION, archilEgressOf, archilLabels, archilMount, archilReadBack, archilRefusals, archilRelease, claimEpoch, helperSha256, mountDrift, mountWords, readArchilMount, recordedArchil, recordedMount, syncingClient, } from "./mount-archil.js";
|
|
17
|
+
export { browserSpecRefusals, isBrowserProvider, BrowserVendorError, CREATE_LABEL, causeOf, memoryUrls, RECOVER_MS, } from "./browser.js";
|
|
18
18
|
// Local Chrome's provider class is on its provider id's subpath (@parcha/agentrun-computer/local-chrome), as every
|
|
19
19
|
// provider's is; the Chrome helpers it runs on are not a provider and stay here.
|
|
20
20
|
export { CHROME_ENV, CHROME_FLAGS, checkChrome, chromeFence, findChrome, killTree, NO_CHROME } from "./chrome.js";
|
|
21
21
|
export { DAEMON_IN_COMPUTER, helloDrift } from "./drift.js";
|
|
22
22
|
export { drift, hostOf, inspectDrift, mountOf, networkOf } from "./docker/inspect.js";
|
|
23
23
|
export { releaseOlder, sweep } from "./janitor.js";
|
|
24
|
-
export { EPOCH_LABEL, epochOf, epochProblem, IDLE_TTL_LABEL, OWNER_LABEL, ownerLabels, ownerOf, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
|
|
24
|
+
export { EPOCH_LABEL, epochOf, epochProblem, IDLE_TTL_LABEL, OWNER_LABEL, OWNER_SERVER_LABEL, ownerFilter, ownerLabels, ownerOf, RUN_HASH_LABEL, RUN_LABEL, runHash, runLabels, runProblem } from "./labels.js";
|
|
25
25
|
export { waitUntil } from "./wait.js";
|
|
26
26
|
export { descriptorOf, isProviderId, providerFor, providerIds, providerModule, providers, } from "./providers.js";
|
|
27
27
|
export { defineProvider, descriptorProblems } from "./descriptor.js";
|
|
28
|
-
export { BROWSER_IMAGE, BROWSERBASE, DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DESCRIPTORS, DOCKER, E2B, E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE, KERNEL, LOCAL, MODAL, MODAL_DEFAULT_IMAGE, ORGO, ORGO_BASE_IMAGE, PHONE_GROUPS, PHONE_HARNESS, PHONE_IMAGE, } from "./descriptors/index.js";
|
|
28
|
+
export { BROWSER_IMAGE, BROWSERBASE, DAYTONA, DAYTONA_DEFAULT_SNAPSHOT, DAYTONA_GPU_SNAPSHOT, DESCRIPTORS, daytonaGpu, daytonaGpuSnapshot, DOCKER, E2B, E2B_BASE_TEMPLATE, E2B_DESKTOP_TEMPLATE, KERNEL, LOCAL, MODAL, MODAL_DEFAULT_IMAGE, ORGO, ORGO_BASE_IMAGE, PHONE_GROUPS, PHONE_HARNESS, PHONE_IMAGE, } from "./descriptors/index.js";
|
|
29
29
|
export { configurationOf, entryOf, imagesOf, kindOf, PROVIDERS, SETTING_KIND_NAMES, SETTING_KINDS, serves, servingRefusals, } from "./kinds.js";
|
|
30
30
|
export * from "./conformance/index.js";
|
package/dist/janitor.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CallContext, ComputerProvider, ComputerRef } from "./provider.js";
|
|
1
|
+
import type { CallContext, ComputerOwner, ComputerProvider, ComputerRef } from "./provider.js";
|
|
2
2
|
import { type Result } from "./result.js";
|
|
3
3
|
export interface SweepOptions {
|
|
4
4
|
/** Only computers with all of these labels; default every computer the provider made. */
|
|
@@ -6,10 +6,11 @@ export interface SweepOptions {
|
|
|
6
6
|
/** The time to compare deadlines with; default now. */
|
|
7
7
|
now?: Date;
|
|
8
8
|
/**
|
|
9
|
-
* Whether an
|
|
10
|
-
*
|
|
9
|
+
* Whether an owner is gone, by the owner the computer carries (its agent, and its server when it names one): the
|
|
10
|
+
* caller's answer (serve's: its own agent that no longer exists; another server's owner is never gone to it). An
|
|
11
|
+
* agent's computer whose owner is gone is deleted; without this, no owner counts as gone.
|
|
11
12
|
*/
|
|
12
|
-
ownerGone?: (
|
|
13
|
+
ownerGone?: (owner: ComputerOwner) => boolean | Promise<boolean>;
|
|
13
14
|
signal?: AbortSignal;
|
|
14
15
|
}
|
|
15
16
|
export interface Swept {
|
package/dist/janitor.js
CHANGED
|
@@ -29,7 +29,7 @@ function tenureOf(info, persistence) {
|
|
|
29
29
|
}
|
|
30
30
|
/** Whether an agent's computer ends: its owner is gone, or it has been detached for longer than its idle TTL. */
|
|
31
31
|
async function ownerEnds(info, owner, at, ownerGone) {
|
|
32
|
-
if (ownerGone !== undefined && (await ownerGone(owner
|
|
32
|
+
if (ownerGone !== undefined && (await ownerGone(owner)) === true)
|
|
33
33
|
return true;
|
|
34
34
|
const since = info.detachedAt instanceof Date ? info.detachedAt.getTime() : Number.NaN;
|
|
35
35
|
return owner.idleTtlMs !== undefined && !Number.isNaN(since) && at - since >= owner.idleTtlMs;
|
package/dist/kernel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type BrowserStream, type ReleaseConfirm, type
|
|
1
|
+
import { type BrowserComputerProvider, type BrowserProfiles, type BrowserStream, type ReleaseConfirm, type RestInit, type RestReply } from "./browser.js";
|
|
2
2
|
import type { KindCapabilities } from "./kinds.js";
|
|
3
3
|
import type { MountKind } from "./mount.js";
|
|
4
4
|
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, type ReleaseHow } from "./provider.js";
|
|
@@ -26,13 +26,9 @@ export interface KernelBrowser {
|
|
|
26
26
|
/**
|
|
27
27
|
* One Kernel request, never retried: a create sent twice would be a second paid browser. It answers 404 as a reply,
|
|
28
28
|
* and throws on any other failure, with the HTTP status as `status`; the provider returns that as a result whose hidden
|
|
29
|
-
* cause is the thrown error
|
|
29
|
+
* cause is the thrown error.
|
|
30
30
|
*/
|
|
31
|
-
export type KernelRequest = (method: string, route: string, init?:
|
|
32
|
-
body?: unknown;
|
|
33
|
-
query?: URLSearchParams;
|
|
34
|
-
signal?: AbortSignal;
|
|
35
|
-
}) => Promise<RestReply>;
|
|
31
|
+
export type KernelRequest = (method: string, route: string, init?: RestInit) => Promise<RestReply>;
|
|
36
32
|
/** Kernel's REST API over fetch: the default request. */
|
|
37
33
|
export declare function kernelRest({ apiKey, apiUrl, fetch: fetcher }: {
|
|
38
34
|
apiKey: string;
|
|
@@ -40,41 +36,38 @@ export declare function kernelRest({ apiKey, apiUrl, fetch: fetcher }: {
|
|
|
40
36
|
fetch?: typeof fetch;
|
|
41
37
|
}): KernelRequest;
|
|
42
38
|
export interface KernelProviderOptions {
|
|
43
|
-
/** With apiUrl and fetch, the REST request is built from it
|
|
39
|
+
/** With apiUrl and fetch, the REST request is built from it. */
|
|
44
40
|
apiKey?: string;
|
|
41
|
+
/** Kernel's API; default KERNEL_BASE_URL in env (a server behind a gateway that fronts it), else Kernel's own. */
|
|
45
42
|
apiUrl?: string;
|
|
43
|
+
/** The host's own variables its descriptor declares (hostEnv): KERNEL_BASE_URL alone. */
|
|
44
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
46
45
|
fetch?: typeof fetch;
|
|
47
|
-
/** One Kernel request, a host's own; default the REST one. */
|
|
48
|
-
request?: KernelRequest;
|
|
49
|
-
/** Where the signed CDP URLs are held; default a Map of this provider's own. */
|
|
50
|
-
urls?: UrlStore;
|
|
51
|
-
/** Where the live views' URLs are held; default a Map of this provider's own. */
|
|
52
|
-
liveUrls?: UrlStore;
|
|
53
46
|
confirm?: ReleaseConfirm;
|
|
54
47
|
sleep?: (ms: number) => Promise<void>;
|
|
55
48
|
}
|
|
56
|
-
/** What a host may add to a browser's create body: Kernel's own fields (headless, stealth, viewport, a profile, extensions). */
|
|
57
|
-
export type KernelBrowserSettings = Record<string, unknown>;
|
|
58
49
|
/** Computers that are Kernel browsers. */
|
|
59
|
-
export declare class KernelProvider implements ComputerProvider {
|
|
50
|
+
export declare class KernelProvider implements ComputerProvider, BrowserComputerProvider {
|
|
60
51
|
#private;
|
|
61
52
|
readonly id = "kernel";
|
|
62
53
|
readonly version: string;
|
|
63
|
-
|
|
54
|
+
readonly profiles: BrowserProfiles;
|
|
55
|
+
constructor({ apiKey, apiUrl, env, fetch: fetcher, confirm, sleep }: KernelProviderOptions);
|
|
64
56
|
/**
|
|
65
57
|
* A browser: Kernel ends a browser after its idle timeout (lifetime vendor), at most 72 h; it reaches the open web;
|
|
66
58
|
* each browser is its own VM. Kernel's replays and file APIs are not wired here, so recordings and downloads are not
|
|
67
|
-
* declared.
|
|
59
|
+
* declared. Its sessions' timeout is idle time (inactivity); a browser may be headless and opens a profile, which
|
|
60
|
+
* Kernel has written back once the browser is deleted (settleMs 0). Its stealth mode is not declared.
|
|
68
61
|
*/
|
|
69
62
|
capabilities(): ComputerCapabilities;
|
|
70
63
|
check(spec: ComputerSpec): Refusal[];
|
|
71
64
|
/**
|
|
72
65
|
* Makes a browser at most once, with the lifetime as its idle timeout in whole seconds and the labels as its tags.
|
|
73
|
-
*
|
|
66
|
+
* spec.browser is the session's own options, each refused by check() unless declared; a profile is made first if
|
|
67
|
+
* Kernel does not know it.
|
|
74
68
|
*/
|
|
75
|
-
create(spec: ComputerSpec, { signal
|
|
69
|
+
create(spec: ComputerSpec, { signal }?: {
|
|
76
70
|
signal?: AbortSignal;
|
|
77
|
-
settings?: KernelBrowserSettings;
|
|
78
71
|
}): Promise<Result<CreatedComputer>>;
|
|
79
72
|
/**
|
|
80
73
|
* Settings' test: one page of the organization's active browsers (GET /browsers?status=active), which makes nothing.
|
|
@@ -105,8 +98,7 @@ export declare class KernelProvider implements ComputerProvider {
|
|
|
105
98
|
}, { signal }?: CallContext): Promise<Result<BrowserStream>>;
|
|
106
99
|
}
|
|
107
100
|
/**
|
|
108
|
-
* The provider, built from its options alone, the key included (options.apiKey,
|
|
109
|
-
* host's own transport); it reads no environment, and throws in words when the key is missing, never echoing one.
|
|
101
|
+
* The provider, built from its options alone, the key included (options.apiKey); it reads no environment, and throws in words when the key is missing, never echoing one.
|
|
110
102
|
*/
|
|
111
103
|
export declare function create(options: KernelProviderOptions): KernelProvider;
|
|
112
104
|
/** The conformance CLI's module for Kernel: its live switch, its image and its notes. */
|
package/dist/kernel.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// Kernel as a computer of kind browser: each computer is a Kernel browser, over Kernel's REST API with fetch (no SDK)
|
|
2
|
-
//
|
|
3
|
-
// browser by them; connect hands over its cdp_ws_url, which a driver dials; stream is its browser_live_view_url. Both
|
|
1
|
+
// Kernel as a computer of kind browser: each computer is a Kernel browser, over Kernel's REST API with fetch (no SDK). Labels
|
|
2
|
+
// ride the browser's own tags; attach and list find a browser by them; connect hands over its cdp_ws_url, which a driver dials; stream is its browser_live_view_url. Both
|
|
4
3
|
// URLs are secrets: they stay in memory and never reach a ref, a list, an error's words or a report.
|
|
5
4
|
//
|
|
6
5
|
// Calls: POST /browsers (create, with timeout_seconds and tags), GET /browsers/{id} (read; 404 or deleted_at once
|
|
@@ -8,13 +7,20 @@
|
|
|
8
7
|
// paged by X-Has-More and X-Next-Offset), and
|
|
9
8
|
// DELETE /browsers/{id} (release). The key is a bearer token.
|
|
10
9
|
//
|
|
10
|
+
// A session's own options (spec.browser): viewport and headless ride the create body (stealth false: Kernel's stealth
|
|
11
|
+
// mode brings its own proxy, which nothing here prices yet, so it is not declared); a profile is a
|
|
12
|
+
// Kernel profile by name, { name: pointer, save_changes: save }, made first if Kernel does not know it (GET
|
|
13
|
+
// /profiles/{name}, then POST /profiles; a 409 is another process making it). Profiles: POST /profiles { name } and
|
|
14
|
+
// DELETE /profiles/{name}.
|
|
15
|
+
//
|
|
11
16
|
// Kernel's timeout_seconds is an idle timeout: Kernel ends a browser that long after its last CDP or live-view
|
|
12
17
|
// connection closes, and sets no wall clock. So lifetimeMs is the longest a browser lives unwatched, at most Kernel's
|
|
13
18
|
// largest idle timeout (72 h), and list reads no deadline.
|
|
19
|
+
import { randomBytes } from "node:crypto";
|
|
14
20
|
import { readFileSync } from "node:fs";
|
|
15
21
|
import { KERNEL } from "./descriptors/kernel.js";
|
|
16
22
|
import { BROWSER_IMAGE } from "./descriptors/shared.js";
|
|
17
|
-
import { cdpUrlProblem, browserClient, browserHello, BrowserVendorError, CREATE_LABEL, carries, causeOf, checkBrowser, createLabelValue, createUncertain, DEFAULT_CONFIRM, defaultSleep, httpsBase, idProblem, labelsOf, labelsProblem, memoryUrls, queryable, recoverCreate, releaseConfirmed, restCall, causedFail, vendorFailure, withoutCreateLabel, } from "./browser.js";
|
|
23
|
+
import { cdpUrlProblem, browserClient, browserHello, BrowserVendorError, CREATE_LABEL, carries, causeOf, checkBrowser, createLabelValue, createUncertain, DEFAULT_CONFIRM, defaultSleep, httpsBase, idProblem, labelsOf, labelsProblem, memoryUrls, pointerOk, queryable, recoverCreate, releaseConfirmed, restCall, causedFail, vendorFailure, withoutCreateLabel, } from "./browser.js";
|
|
18
24
|
import { runLifetimeMs, } from "./provider.js";
|
|
19
25
|
import { failFor, ok, vendorFail } from "./result.js";
|
|
20
26
|
import { connectionError } from "./test-connection.js";
|
|
@@ -40,32 +46,38 @@ export function kernelRest({ apiKey, apiUrl = KERNEL_API_URL, fetch: fetcher = f
|
|
|
40
46
|
const o = { vendor: NAME, fetch: fetcher, base: httpsBase(apiUrl, "the Kernel API URL"), headers: { Authorization: `Bearer ${apiKey}` } };
|
|
41
47
|
return (method, route, init = {}) => restCall(o, method, route, `${method} ${callName(route)}`, init);
|
|
42
48
|
}
|
|
43
|
-
/** A route as a failure names it: ids out, so no session id reads as a secret's neighbour. */
|
|
44
|
-
const callName = (route) => route.replace(/\/browsers\/[^/?]+/, "/browsers/{id}");
|
|
49
|
+
/** A route as a failure names it: ids and names out, so no session id reads as a secret's neighbour and no profile's name (a pointer) is in words. */
|
|
50
|
+
const callName = (route) => route.replace(/\/browsers\/[^/?]+/, "/browsers/{id}").replace(/\/profiles\/[^/?]+/, "/profiles/{name}");
|
|
45
51
|
const text = (value) => (typeof value === "string" ? value.trim() : "");
|
|
46
52
|
const refOf = (id) => ({ id, name: id });
|
|
53
|
+
const statusOf = (error) => error?.status;
|
|
54
|
+
/** What a Kernel browser offers beyond the protocol, a fresh copy each time. */
|
|
55
|
+
const KERNEL_BROWSER = () => ({ timeout: "inactivity", minLifetimeMs: KERNEL_MIN_LIFETIME_MS, profiles: { settleMs: 0 }, headless: true });
|
|
47
56
|
/** Computers that are Kernel browsers. */
|
|
48
57
|
export class KernelProvider {
|
|
49
58
|
id = "kernel";
|
|
50
59
|
version = VERSION;
|
|
60
|
+
profiles = { create: (context) => this.#createProfile(context), remove: (pointer, context) => this.#removeProfile(pointer, context) };
|
|
51
61
|
#request;
|
|
52
62
|
#urls;
|
|
53
63
|
#live;
|
|
54
64
|
#confirm;
|
|
55
65
|
#sleep;
|
|
56
|
-
constructor({ apiKey, apiUrl,
|
|
57
|
-
if (
|
|
58
|
-
throw new Error("set options.apiKey to a Kernel API key
|
|
59
|
-
|
|
60
|
-
this.#
|
|
61
|
-
this.#
|
|
66
|
+
constructor({ apiKey, apiUrl, env = {}, fetch: fetcher, confirm = DEFAULT_CONFIRM, sleep = defaultSleep }) {
|
|
67
|
+
if (typeof apiKey !== "string" || apiKey === "")
|
|
68
|
+
throw new Error("set options.apiKey to a Kernel API key: the provider reads no environment");
|
|
69
|
+
const api = apiUrl || env.KERNEL_BASE_URL?.trim() || undefined;
|
|
70
|
+
this.#request = kernelRest({ apiKey, ...(api ? { apiUrl: api } : {}), ...(fetcher ? { fetch: fetcher } : {}) });
|
|
71
|
+
this.#urls = memoryUrls();
|
|
72
|
+
this.#live = memoryUrls();
|
|
62
73
|
this.#confirm = confirm;
|
|
63
74
|
this.#sleep = sleep;
|
|
64
75
|
}
|
|
65
76
|
/**
|
|
66
77
|
* A browser: Kernel ends a browser after its idle timeout (lifetime vendor), at most 72 h; it reaches the open web;
|
|
67
78
|
* each browser is its own VM. Kernel's replays and file APIs are not wired here, so recordings and downloads are not
|
|
68
|
-
* declared.
|
|
79
|
+
* declared. Its sessions' timeout is idle time (inactivity); a browser may be headless and opens a profile, which
|
|
80
|
+
* Kernel has written back once the browser is deleted (settleMs 0). Its stealth mode is not declared.
|
|
69
81
|
*/
|
|
70
82
|
capabilities() {
|
|
71
83
|
return {
|
|
@@ -78,6 +90,7 @@ export class KernelProvider {
|
|
|
78
90
|
groups: [...CAPABILITIES[0].groups],
|
|
79
91
|
maxLifetimeMs: KERNEL_MAX_LIFETIME_MS,
|
|
80
92
|
release: ["delete"],
|
|
93
|
+
browser: KERNEL_BROWSER(),
|
|
81
94
|
};
|
|
82
95
|
}
|
|
83
96
|
check(spec) {
|
|
@@ -85,16 +98,30 @@ export class KernelProvider {
|
|
|
85
98
|
}
|
|
86
99
|
/**
|
|
87
100
|
* Makes a browser at most once, with the lifetime as its idle timeout in whole seconds and the labels as its tags.
|
|
88
|
-
*
|
|
101
|
+
* spec.browser is the session's own options, each refused by check() unless declared; a profile is made first if
|
|
102
|
+
* Kernel does not know it.
|
|
89
103
|
*/
|
|
90
|
-
async create(spec, { signal
|
|
104
|
+
async create(spec, { signal } = {}) {
|
|
91
105
|
const refusals = this.check(spec);
|
|
92
106
|
if (refusals.length > 0)
|
|
93
107
|
return fail("refused", refusals.map(({ field, message }) => `${field}: ${message}`).join("; "));
|
|
94
108
|
if (signal?.aborted)
|
|
95
109
|
return fail("aborted", "create was aborted before Kernel was called");
|
|
110
|
+
const options = spec.browser;
|
|
111
|
+
if (options?.profile !== undefined) {
|
|
112
|
+
const ensured = await this.#ensureProfile(options.profile.pointer, signal);
|
|
113
|
+
if (!ensured.ok)
|
|
114
|
+
return causedFail(ensured.error.code, `the profile could not be made ready: ${ensured.error.message}; no browser was made`, causeOf(ensured), "kernel");
|
|
115
|
+
}
|
|
96
116
|
const written = { [CREATE_LABEL]: createLabelValue(), ...spec.labels };
|
|
97
|
-
const body = {
|
|
117
|
+
const body = {
|
|
118
|
+
...(options !== undefined ? { stealth: false } : {}),
|
|
119
|
+
...(options?.viewport ? { viewport: { width: options.viewport.width, height: options.viewport.height } } : {}),
|
|
120
|
+
...(options?.headless !== undefined ? { headless: options.headless } : {}),
|
|
121
|
+
...(options?.profile ? { profile: { name: options.profile.pointer, save_changes: options.profile.save } } : {}),
|
|
122
|
+
timeout_seconds: Math.ceil(runLifetimeMs(spec) / 1000),
|
|
123
|
+
tags: written,
|
|
124
|
+
};
|
|
98
125
|
let made;
|
|
99
126
|
try {
|
|
100
127
|
made = await this.#request("POST", "/browsers", { body, ...(signal ? { signal } : {}) });
|
|
@@ -127,6 +154,55 @@ export class KernelProvider {
|
|
|
127
154
|
this.#live.set(id, live);
|
|
128
155
|
return ok(refOf(id));
|
|
129
156
|
}
|
|
157
|
+
/** A browser names only a profile Kernel knows: made if it is not (GET, then POST); a 409 is another process making it. */
|
|
158
|
+
async #ensureProfile(name, signal) {
|
|
159
|
+
try {
|
|
160
|
+
const found = await this.#request("GET", `/profiles/${encodeURIComponent(name)}`, signal ? { signal } : {});
|
|
161
|
+
if (found.status !== 404)
|
|
162
|
+
return ok(undefined);
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
return vendorFailure("kernel", NAME, "GET /profiles/{name}", error);
|
|
166
|
+
}
|
|
167
|
+
try {
|
|
168
|
+
const made = await this.#request("POST", "/profiles", { body: { name }, ...(signal ? { signal } : {}) });
|
|
169
|
+
if (made.status === 404)
|
|
170
|
+
return vendorFailure("kernel", NAME, "POST /profiles", new BrowserVendorError(NAME, "POST /profiles", 404));
|
|
171
|
+
return ok(undefined);
|
|
172
|
+
}
|
|
173
|
+
catch (error) {
|
|
174
|
+
return statusOf(error) === 409 ? ok(undefined) : vendorFailure("kernel", NAME, "POST /profiles", error);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/** A new profile under a random name, which is its pointer: one POST /profiles, never retried. */
|
|
178
|
+
async #createProfile({ signal } = {}) {
|
|
179
|
+
const name = `agentrun-${randomBytes(12).toString("hex")}`;
|
|
180
|
+
const call = "POST /profiles";
|
|
181
|
+
let made;
|
|
182
|
+
try {
|
|
183
|
+
made = await this.#request("POST", "/profiles", { body: { name }, ...(signal ? { signal } : {}) });
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
return vendorFailure("kernel", NAME, call, error);
|
|
187
|
+
}
|
|
188
|
+
if (made.status === 404)
|
|
189
|
+
return vendorFailure("kernel", NAME, call, new BrowserVendorError(NAME, call, 404));
|
|
190
|
+
if (made.json?.name !== name)
|
|
191
|
+
return vendorFail("kernel", `Kernel ${call} answered ${made.status} with another profile's name than the one asked for`);
|
|
192
|
+
return ok(name);
|
|
193
|
+
}
|
|
194
|
+
/** Deletes the profile; one Kernel no longer knows is removed. The words never carry the pointer. */
|
|
195
|
+
async #removeProfile(pointer, { signal } = {}) {
|
|
196
|
+
if (!pointerOk(pointer))
|
|
197
|
+
return fail("invalid", "a profile's pointer is a plain token, as profiles.create gave it");
|
|
198
|
+
try {
|
|
199
|
+
await this.#request("DELETE", `/profiles/${encodeURIComponent(pointer)}`, signal ? { signal } : {});
|
|
200
|
+
return ok(undefined);
|
|
201
|
+
}
|
|
202
|
+
catch (error) {
|
|
203
|
+
return vendorFailure("kernel", NAME, "DELETE /profiles/{name}", error);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
130
206
|
/**
|
|
131
207
|
* The browsers a lost create made, released: what recoverCreate says of them. They are found as list finds any, by the
|
|
132
208
|
* tags the create wrote (its create label first, so the query names it, then the run's), through #browsers: another
|
|
@@ -353,8 +429,7 @@ export class KernelProvider {
|
|
|
353
429
|
}
|
|
354
430
|
}
|
|
355
431
|
/**
|
|
356
|
-
* The provider, built from its options alone, the key included (options.apiKey,
|
|
357
|
-
* host's own transport); it reads no environment, and throws in words when the key is missing, never echoing one.
|
|
432
|
+
* The provider, built from its options alone, the key included (options.apiKey); it reads no environment, and throws in words when the key is missing, never echoing one.
|
|
358
433
|
*/
|
|
359
434
|
export function create(options) {
|
|
360
435
|
return new KernelProvider(options ?? {});
|
package/dist/kinds.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { DescriptorKey, DescriptorSetting, ParkedConfiguration, ProviderDescriptor } from "./descriptor.js";
|
|
1
|
+
import type { DescriptorKey, DescriptorSetting, HostCommand, ParkedConfiguration, ProviderDescriptor } from "./descriptor.js";
|
|
2
2
|
import type { MountKind } from "./mount.js";
|
|
3
3
|
import type { ComputerKind, Group } from "./protocol.js";
|
|
4
4
|
import type { ComputerCapabilities, NetworkForm } from "./provider.js";
|
|
@@ -23,12 +23,13 @@ export declare const SETTING_KINDS: Readonly<Record<ComputerSettingKind, Setting
|
|
|
23
23
|
export declare const SETTING_KIND_NAMES: ComputerSettingKind[];
|
|
24
24
|
/**
|
|
25
25
|
* The capabilities serves() and kindOf() read: one configuration a provider offers, with the GPUs it offers (Settings'
|
|
26
|
-
* GPU choice)
|
|
27
|
-
*
|
|
26
|
+
* GPU choice), and whether it keeps a computer for an agent (`persistence`, as its built provider declares it: Settings'
|
|
27
|
+
* persistent choice). In a descriptor, `image` is the name an agent's setting selects it by (Orgo's `windows`), the image
|
|
28
|
+
* its computer starts from, and `options` are what create() takes to build it ({ os: "windows" }), beside the keys. A
|
|
28
29
|
* configuration with no image is the one a setting that names none gets, as is the one whose image is the kind's
|
|
29
30
|
* defaultImage.
|
|
30
31
|
*/
|
|
31
|
-
export type KindCapabilities = Pick<ComputerCapabilities, "kind" | "groups" | "gpu"> & {
|
|
32
|
+
export type KindCapabilities = Pick<ComputerCapabilities, "kind" | "groups" | "gpu" | "persistence"> & {
|
|
32
33
|
readonly image?: string;
|
|
33
34
|
readonly options?: Readonly<Record<string, unknown>>;
|
|
34
35
|
};
|
|
@@ -74,6 +75,8 @@ export interface ProviderEntry {
|
|
|
74
75
|
readonly defaultImage?: Partial<Record<ComputerSettingKind, string>>;
|
|
75
76
|
/** Its built providers make or pull their image before the first create (prepareImage()). */
|
|
76
77
|
readonly prepareImage?: boolean;
|
|
78
|
+
/** The server's environment variable whose value, when set, is the image of every computer of it (descriptor.ts). */
|
|
79
|
+
readonly imageEnv?: string;
|
|
77
80
|
/** Its computers run on this machine's container engine. */
|
|
78
81
|
readonly local?: boolean;
|
|
79
82
|
/** create() takes a ledger the server keeps for it, as this option. */
|
|
@@ -82,6 +85,8 @@ export interface ProviderEntry {
|
|
|
82
85
|
};
|
|
83
86
|
/** The server's environment variables its provider reads on this machine, passed as options.env (descriptor.ts). */
|
|
84
87
|
readonly hostEnv?: readonly string[];
|
|
88
|
+
/** A program its computers need on this machine's PATH, and the machines it is built for (descriptor.ts). */
|
|
89
|
+
readonly hostCommand?: HostCommand;
|
|
85
90
|
/** Configurations it builds but does not offer yet, each with why: a setting naming one's image is refused as parked. */
|
|
86
91
|
readonly parked?: readonly ParkedConfiguration[];
|
|
87
92
|
}
|
package/dist/labels.d.ts
CHANGED
|
@@ -14,13 +14,21 @@ export declare const RUN_HASH_LABEL = "agentrun.run.hash";
|
|
|
14
14
|
export declare function runHash(run: string): string;
|
|
15
15
|
/** The agent a persistent computer belongs to, as agent:<id>. */
|
|
16
16
|
export declare const OWNER_LABEL = "agentrun.owner";
|
|
17
|
+
/** The server that agent is on, when the owner names one (owner.server). */
|
|
18
|
+
export declare const OWNER_SERVER_LABEL = "agentrun.owner-server";
|
|
17
19
|
/** The owner's idle TTL of a persistent computer, in milliseconds, in decimal: how long it may stay detached. */
|
|
18
20
|
export declare const IDLE_TTL_LABEL = "agentrun.idle-ttl-ms";
|
|
19
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* The labels of an agent's computer: its owner, its server when the owner names one, and its idle TTL when the owner
|
|
23
|
+
* set one. Throws, in words, on an owner that is not one.
|
|
24
|
+
*/
|
|
20
25
|
export declare function ownerLabels(owner: ComputerOwner): Record<string, string>;
|
|
26
|
+
/** The labels an owner's listing filters by: its agent's, and its server's when it names one (no idle TTL). */
|
|
27
|
+
export declare function ownerFilter(owner: Pick<ComputerOwner, "agent" | "server">): Record<string, string>;
|
|
21
28
|
/**
|
|
22
29
|
* A computer's owner, read from its labels: undefined for a run's computer (no owner label). An owner label that is not
|
|
23
|
-
* agent:<id>, or an idle TTL that is not a decimal whole number above 0, is
|
|
30
|
+
* agent:<id>, a server label that is not a server id, or an idle TTL that is not a decimal whole number above 0, is
|
|
31
|
+
* invalid, in words naming what it reads.
|
|
24
32
|
*/
|
|
25
33
|
export declare function ownerOf(labels: Record<string, string> | undefined): Result<ComputerOwner | undefined>;
|
|
26
34
|
/**
|