@parcha/agentrun-computer 0.1.0-beta.38 → 0.1.0-beta.39
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 +101 -76
- package/box/README.md +2 -1
- package/box/recipe.d.mts +5 -0
- package/dist/agent37.d.ts +17 -4
- package/dist/agent37.js +96 -16
- package/dist/box-image.d.ts +14 -0
- package/dist/box-image.js +24 -0
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/agent37.d.ts +9 -4
- package/dist/conformance/agent37.js +23 -11
- package/dist/conformance/browserbase.js +3 -3
- package/dist/conformance/cases/apps.d.ts +1 -1
- package/dist/conformance/cases/apps.js +1 -1
- package/dist/conformance/cases/isolation.d.ts +18 -3
- package/dist/conformance/cases/isolation.js +57 -6
- package/dist/conformance/cases/mount.js +4 -2
- package/dist/conformance/cases/provider.js +41 -0
- package/dist/conformance/cli.js +6 -5
- package/dist/conformance/e2b.js +9 -4
- package/dist/conformance/exec-stream.d.ts +7 -0
- package/dist/conformance/exec-stream.js +8 -1
- package/dist/conformance/kernel.js +2 -2
- package/dist/conformance/modal.js +1 -1
- package/dist/conformance/orgo.js +2 -2
- package/dist/daytona.d.ts +0 -5
- package/dist/daytona.js +16 -27
- package/dist/descriptor.d.ts +5 -3
- package/dist/descriptors/agent37.d.ts +3 -11
- package/dist/descriptors/agent37.js +9 -10
- package/dist/descriptors/daytona.d.ts +1 -1
- package/dist/descriptors/daytona.js +5 -2
- package/dist/descriptors/docker.d.ts +13 -1
- package/dist/descriptors/docker.js +3 -1
- package/dist/descriptors/e2b.d.ts +2 -9
- package/dist/descriptors/e2b.js +8 -8
- package/dist/descriptors/index.d.ts +21 -19
- package/dist/descriptors/index.js +1 -3
- package/dist/descriptors/modal.d.ts +2 -6
- package/dist/descriptors/modal.js +8 -6
- package/dist/descriptors/orgo.js +2 -1
- package/dist/docker/egress-main.js +23 -15
- package/dist/docker/egress.d.ts +6 -4
- package/dist/docker/egress.js +24 -16
- package/dist/docker/inspect.d.ts +2 -2
- package/dist/docker/inspect.js +5 -5
- package/dist/docker.d.ts +6 -5
- package/dist/docker.js +12 -11
- package/dist/e2b.d.ts +12 -2
- package/dist/e2b.js +42 -19
- package/dist/host.d.ts +54 -41
- package/dist/hosted/network.d.ts +23 -0
- package/dist/hosted/network.js +77 -0
- package/dist/hosted/process.d.ts +2 -0
- package/dist/hosted/process.js +5 -0
- package/dist/hosted/provider.d.ts +6 -4
- package/dist/hosted/provider.js +244 -136
- package/dist/hosted/rest.d.ts +10 -2
- package/dist/hosted/rest.js +9 -4
- package/dist/hosted/scripts.d.ts +19 -7
- package/dist/hosted/scripts.js +55 -18
- package/dist/{agent37-ssh.d.ts → hosted/ssh-exec.d.ts} +19 -9
- package/dist/{agent37-ssh.js → hosted/ssh-exec.js} +38 -19
- package/dist/hosted/values.d.ts +21 -0
- package/dist/hosted/values.js +55 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +3 -4
- package/dist/modal.d.ts +8 -2
- package/dist/modal.js +21 -15
- package/dist/mount-archil.d.ts +5 -4
- package/dist/mount-archil.js +5 -6
- package/dist/orgo.js +6 -4
- package/dist/providers.d.ts +4 -1
- package/dist/surface/api.d.ts +0 -9
- package/dist/surface/core.d.ts +7 -2
- package/dist/surface/core.js +12 -4
- package/dist/surface/index.d.ts +1 -1
- package/dist/surface/index.js +1 -1
- package/dist/surface/script.d.ts +4 -0
- package/dist/surface/script.js +9 -3
- package/package.json +1 -1
- package/box/build-agent37.mjs +0 -158
package/dist/host.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ProviderDescriptor } from "./descriptor.js";
|
|
2
|
-
import type { ComputerCapabilities, ComputerSpec,
|
|
2
|
+
import type { ComputerCapabilities, ComputerSpec, GpuSpec, Refusal } from "./provider.js";
|
|
3
3
|
import type { ComputerErrorCode } from "./result.js";
|
|
4
4
|
/**
|
|
5
5
|
* One vendor's machines. Every call answers its value or throws: a failure whose code the host knows throws a
|
|
@@ -10,15 +10,20 @@ import type { ComputerErrorCode } from "./result.js";
|
|
|
10
10
|
export interface MachineHost {
|
|
11
11
|
/**
|
|
12
12
|
* The provider's descriptor (./descriptors): its id names the vendor of every error of code vendor, its label is the
|
|
13
|
-
* vendor in words, and capabilities() and check() read its network forms, mount kinds and unmounted kinds
|
|
13
|
+
* vendor in words, and capabilities() and check() read its network forms, mount kinds and unmounted kinds, and its
|
|
14
|
+
* configuration of the adapter's kind: the groups and GPUs.
|
|
14
15
|
*/
|
|
15
16
|
readonly descriptor: HostDescriptor;
|
|
16
17
|
readonly facts: HostFacts;
|
|
17
18
|
/**
|
|
18
19
|
* Makes one machine, by its options, and answers its id once the vendor has one. It does not wait for the machine to
|
|
19
|
-
* run (the adapter polls get while it is starting) or to be listed (the adapter waits for that too)
|
|
20
|
-
*
|
|
21
|
-
*
|
|
20
|
+
* run (the adapter polls get while it is starting) or to be listed (the adapter waits for that too), except where the
|
|
21
|
+
* vendor applies a machine's settings only once it is ready: there it may wait for ready within ctx.timeoutMs, set
|
|
22
|
+
* them, and answer then (PROVIDERS.md, create). The machine
|
|
23
|
+
* carries req.name where the vendor can find it again by listing: the vendor's native name, or a label. A native name
|
|
24
|
+
* the vendor already has throws exists (a REST host's named call: hosted/rest.ts), and the adapter adopts the machine
|
|
25
|
+
* the name lists, as a retry does. An answer that never comes is not a machine the adapter forgets: it lists by
|
|
26
|
+
* req.labels and deletes what it finds.
|
|
22
27
|
*/
|
|
23
28
|
create(req: MachineRequest, ctx: HostCall): Promise<{
|
|
24
29
|
id: string;
|
|
@@ -94,7 +99,10 @@ export interface HostCall {
|
|
|
94
99
|
signal?: AbortSignal;
|
|
95
100
|
timeoutMs: number;
|
|
96
101
|
}
|
|
97
|
-
/**
|
|
102
|
+
/**
|
|
103
|
+
* What create asks of the vendor. A size (cpus, memoryMb) is passed whenever the spec gives one: a vendor whose size is
|
|
104
|
+
* its image's refuses it in its own check.
|
|
105
|
+
*/
|
|
98
106
|
export interface MachineRequest {
|
|
99
107
|
/** computer-<12 hex digits>, from the create's request id: the vendor's native name, or a label it lists by. */
|
|
100
108
|
name: string;
|
|
@@ -102,19 +110,21 @@ export interface MachineRequest {
|
|
|
102
110
|
image: string;
|
|
103
111
|
/** The caller's labels and the adapter's own (agentrun.computer*, the Archil mount's), every one to be read back. */
|
|
104
112
|
labels: Record<string, string>;
|
|
105
|
-
/**
|
|
106
|
-
lifetimeMs
|
|
113
|
+
/** The spec's lifetime: the vendor's timer (facts.lifetime "vendor"); a janitor's host may leave it. */
|
|
114
|
+
lifetimeMs: number;
|
|
107
115
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
116
|
+
* Whether the machine reaches out: true for an Archil computer's root, which reaches Archil, and for a network open
|
|
117
|
+
* or a list, whose egress proxy init starts outside its tools' network (./hosted/network.ts). Its tools' own network
|
|
118
|
+
* is init's, loopback alone, read from inside, either way.
|
|
110
119
|
*/
|
|
111
|
-
|
|
120
|
+
egress: boolean;
|
|
112
121
|
/** facts.daemon "pid1" alone: the machine's main process (the entrypoint that waits for the daemon, then becomes init). */
|
|
113
122
|
command?: readonly string[];
|
|
123
|
+
/** A GPU computer's GPUs; the adapter records them in a label too, so no vendor reads them back. */
|
|
114
124
|
gpu?: GpuSpec;
|
|
115
125
|
cpus?: number;
|
|
116
126
|
memoryMb?: number;
|
|
117
|
-
|
|
127
|
+
/** With facts.user: the spec's user, uid:gid. */
|
|
118
128
|
user?: string;
|
|
119
129
|
}
|
|
120
130
|
/**
|
|
@@ -137,8 +147,6 @@ export interface Machine {
|
|
|
137
147
|
* make a machine before either is listed: the oldest is kept, by this, or by the lowest id where a machine has none.
|
|
138
148
|
*/
|
|
139
149
|
createdAt?: Date;
|
|
140
|
-
/** With facts.gpuReadBack: the GPUs the vendor reads back, absent for a machine with none. A retry is held to them. */
|
|
141
|
-
gpu?: GpuSpec;
|
|
142
150
|
/** The vendor's words for a machine that is gone because it failed: a create stops in them. */
|
|
143
151
|
why?: string;
|
|
144
152
|
}
|
|
@@ -155,11 +163,21 @@ export interface MachineProcess {
|
|
|
155
163
|
/** Ends it, best effort, and lets go of its streams; never throws. */
|
|
156
164
|
kill(): Promise<void>;
|
|
157
165
|
}
|
|
158
|
-
/**
|
|
159
|
-
|
|
160
|
-
|
|
166
|
+
/**
|
|
167
|
+
* What the host reads of its provider's descriptor: its id and label, its network forms and mounts, and its
|
|
168
|
+
* configurations, each kind's groups and GPUs.
|
|
169
|
+
*/
|
|
170
|
+
export type HostDescriptor = Pick<ProviderDescriptor, "id" | "label" | "network" | "mounts" | "unmounted" | "capabilities">;
|
|
171
|
+
/**
|
|
172
|
+
* What a vendor's machines are, static: with its descriptor (network, mounts, each kind's groups and GPUs) and the
|
|
173
|
+
* adapter's options, capabilities() is built from these alone.
|
|
174
|
+
*/
|
|
161
175
|
export interface HostFacts {
|
|
162
|
-
/**
|
|
176
|
+
/**
|
|
177
|
+
* child: the vendor's agent is the machine's first process and starts init, after the adapter closes the session
|
|
178
|
+
* buses in /tmp (/tmp/dbus-*) to the computer's user, since a network namespace does not cut a path socket. pid1:
|
|
179
|
+
* init is the machine's main process (Modal's, whose sandbox ends when it does), started by request.command.
|
|
180
|
+
*/
|
|
163
181
|
daemon: "child" | "pid1";
|
|
164
182
|
isolation: ComputerCapabilities["isolation"];
|
|
165
183
|
/** Who ends a machine at its deadline: the vendor's timer, or the janitor by label. */
|
|
@@ -169,33 +187,28 @@ export interface HostFacts {
|
|
|
169
187
|
arch: "amd64" | "arm64";
|
|
170
188
|
/** The TCP ports the vendor's own agent listens on inside the machine (E2B's envd 49983). */
|
|
171
189
|
vendorAgentPorts: number[];
|
|
172
|
-
/**
|
|
173
|
-
* The vendor's own path unix sockets outside /run, as shell patterns with no space (Daytona's D-Bus session bus,
|
|
174
|
-
* /tmp/dbus-*). Init takes others' access off every socket under /run itself; a child host's create does the same
|
|
175
|
-
* for each socket these name, as root, before init starts, since a network namespace does not cut a path socket.
|
|
176
|
-
*/
|
|
177
|
-
vendorSockets?: string[];
|
|
178
190
|
/** Whether its desktops run WINDOW_MANAGER (xfwm4, which its image has) once the display answers. Default none. */
|
|
179
191
|
windowManager?: boolean;
|
|
180
|
-
/**
|
|
181
|
-
* Whether get reads a machine's GPUs back from the vendor (Machine.gpu, absent for a machine with none): a retry of a
|
|
182
|
-
* request is held to them only then. A vendor that reads none back (Modal) answers the request's computer as made.
|
|
183
|
-
*/
|
|
184
|
-
gpuReadBack?: boolean;
|
|
185
|
-
gpu?: GpuCapability;
|
|
186
|
-
/** What spec.user may ask for, beside the daemon user. */
|
|
192
|
+
/** What spec.user may ask for, beside the daemon user: with it, the spec's user goes in MachineRequest.user. */
|
|
187
193
|
user?: Array<"root" | "uid">;
|
|
188
|
-
/** The spec's size and place fields the vendor takes, passed in MachineRequest; any other is refused. */
|
|
189
|
-
specFields?: Array<"cpus" | "memoryMb" | "workdir" | "user">;
|
|
190
194
|
/**
|
|
191
|
-
* The
|
|
192
|
-
*
|
|
195
|
+
* The most a machine's labels may be, the adapter's own with the caller's: count, how many; bytes, every name and
|
|
196
|
+
* value together, the adapter's at their longest. Past either, check() refuses, and so create, before any host call.
|
|
197
|
+
* Absent: no bound. packed: the host stores the labels as packLabels packs them (./hosted/values.ts: one name to
|
|
198
|
+
* list by, the map in parts of at most valueBytes each) and get answers unpackLabels' map; count and bytes are then
|
|
199
|
+
* the packed labels'.
|
|
193
200
|
*/
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
201
|
+
labels?: {
|
|
202
|
+
count?: number;
|
|
203
|
+
bytes?: number;
|
|
204
|
+
packed?: {
|
|
205
|
+
valueBytes?: number;
|
|
206
|
+
};
|
|
198
207
|
};
|
|
199
|
-
/**
|
|
200
|
-
|
|
208
|
+
/**
|
|
209
|
+
* Paths of the vendor's image that root runs or reads and whose permissions its template build sets wider than
|
|
210
|
+
* root's: create makes each root's alone (owned by root, writable by no group or other user), and everything under a
|
|
211
|
+
* directory, before the daemon's upload, so the computer's user can change nothing root runs. Default none.
|
|
212
|
+
*/
|
|
213
|
+
rootOnly?: readonly string[];
|
|
201
214
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { AllowCapability, NetworkForm, NetworkPolicy, NetworkSpec } from "../provider.js";
|
|
2
|
+
/** The label a computer whose network is open or a list carries: its form, as init was given it. None carries none. */
|
|
3
|
+
export declare const NETWORK_LABEL = "agentrun.computer.network";
|
|
4
|
+
/** Where init's proxy listens, and where it writes the form it serves (daemon/internal/egress/serve.go). */
|
|
5
|
+
export declare const EGRESS_PROXY_SOCKET: string;
|
|
6
|
+
export declare const EGRESS_POLICY: string;
|
|
7
|
+
/** The uid and gid init's proxy runs as, nobody (serve.go ProxyUser): no computer's user under open or a list may be it. */
|
|
8
|
+
export declare const EGRESS_PROXY_USER = 65534;
|
|
9
|
+
/** Init's relay on its programs' own loopback, which carries each connection to the proxy (daemon/internal/egress). */
|
|
10
|
+
export declare const EGRESS_RELAY = "127.0.0.1:3128";
|
|
11
|
+
/** What a hosted list may hold: Docker's bounds, ports 80 and 443, names and CIDRs together. */
|
|
12
|
+
export declare const HOSTED_ALLOW: AllowCapability;
|
|
13
|
+
/** A network spec as init's --network takes it: "" for none, "open", or "allow:" and the list, normalized. */
|
|
14
|
+
export declare function networkFormOf(network: NetworkSpec): string;
|
|
15
|
+
/** A form, as a label or the policy file holds it, as a network policy: none for no form; anything else in words. */
|
|
16
|
+
export declare function networkOfForm(form: string | undefined): NetworkPolicy;
|
|
17
|
+
/**
|
|
18
|
+
* Why a spec's network is refused by a provider (label) that declares forms, in plain words naming it and the choices;
|
|
19
|
+
* undefined when it is taken. A form the provider does not declare is refused, never widened or narrowed to another.
|
|
20
|
+
*/
|
|
21
|
+
export declare function networkRefusal(label: string, forms: readonly NetworkForm[], network: unknown): string | undefined;
|
|
22
|
+
/** Whether a spec's network goes out through the proxy: open, or a list. */
|
|
23
|
+
export declare const throughProxy: (network: unknown) => boolean;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
// A hosted computer's network, as the shared adapter (./provider.ts) makes, records and reads it back. Its programs run
|
|
2
|
+
// in a network of their own whose loopback alone is up (isolation.ts), so "none" holds by itself. "open" and a host list
|
|
3
|
+
// go through one egress proxy per computer that init, still root and in the machine's own network, starts before it
|
|
4
|
+
// leaves it (`computerd init --own-network --network <form>`, daemon/internal/egress): the proxy runs as nobody, listens
|
|
5
|
+
// on a Unix socket only root and the tool user's group reach, and goes to the public internet alone, so the vendor's
|
|
6
|
+
// agent, metadata, the machine's own addresses and every private range stay out of reach; with a list, to its hosts
|
|
7
|
+
// alone, refused before any lookup. Init relays the programs' loopback port 3128 to it and tells them it is their proxy.
|
|
8
|
+
// The machine itself gets the vendor's egress for it. The form is recorded in a label, written to the policy file init
|
|
9
|
+
// leaves beside the socket, and both are read back.
|
|
10
|
+
import { allowOf, MAX_ALLOW } from "../docker/egress.js";
|
|
11
|
+
import { LISTED_PORTS } from "../docker/egress-proxy.js";
|
|
12
|
+
import { COMPUTER_LABEL, DAEMON_IN_COMPUTER } from "../drift.js";
|
|
13
|
+
/** The label a computer whose network is open or a list carries: its form, as init was given it. None carries none. */
|
|
14
|
+
export const NETWORK_LABEL = `${COMPUTER_LABEL}.network`;
|
|
15
|
+
const EGRESS_DIR = `${DAEMON_IN_COMPUTER.slice(0, DAEMON_IN_COMPUTER.lastIndexOf("/"))}/egress`;
|
|
16
|
+
/** Where init's proxy listens, and where it writes the form it serves (daemon/internal/egress/serve.go). */
|
|
17
|
+
export const EGRESS_PROXY_SOCKET = `${EGRESS_DIR}/egress.sock`;
|
|
18
|
+
export const EGRESS_POLICY = `${EGRESS_DIR}/policy`;
|
|
19
|
+
/** The uid and gid init's proxy runs as, nobody (serve.go ProxyUser): no computer's user under open or a list may be it. */
|
|
20
|
+
export const EGRESS_PROXY_USER = 65534;
|
|
21
|
+
/** Init's relay on its programs' own loopback, which carries each connection to the proxy (daemon/internal/egress). */
|
|
22
|
+
export const EGRESS_RELAY = "127.0.0.1:3128"; // key-gate: loopback-rule the computer's own loopback, where init's egress relay listens
|
|
23
|
+
/** What a hosted list may hold: Docker's bounds, ports 80 and 443, names and CIDRs together. */
|
|
24
|
+
export const HOSTED_ALLOW = {
|
|
25
|
+
domains: { max: MAX_ALLOW, ports: [...LISTED_PORTS] },
|
|
26
|
+
cidrs: { max: MAX_ALLOW, ports: [...LISTED_PORTS] },
|
|
27
|
+
mixed: true,
|
|
28
|
+
};
|
|
29
|
+
/** A network spec as init's --network takes it: "" for none, "open", or "allow:" and the list, normalized. */
|
|
30
|
+
export function networkFormOf(network) {
|
|
31
|
+
if (network === "none")
|
|
32
|
+
return "";
|
|
33
|
+
if (network === "open")
|
|
34
|
+
return "open";
|
|
35
|
+
const allow = allowOf(network.allow);
|
|
36
|
+
if ("problem" in allow)
|
|
37
|
+
throw new Error(allow.problem);
|
|
38
|
+
return `allow:${allow.list.join(",")}`;
|
|
39
|
+
}
|
|
40
|
+
/** A form, as a label or the policy file holds it, as a network policy: none for no form; anything else in words. */
|
|
41
|
+
export function networkOfForm(form) {
|
|
42
|
+
if (form === undefined || form === "")
|
|
43
|
+
return "none";
|
|
44
|
+
if (form === "open")
|
|
45
|
+
return "open";
|
|
46
|
+
if (form.startsWith("allow:")) {
|
|
47
|
+
const allow = allowOf(form.slice("allow:".length).split(","));
|
|
48
|
+
if (!("problem" in allow) && `allow:${allow.list.join(",")}` === form)
|
|
49
|
+
return { allow: allow.list };
|
|
50
|
+
}
|
|
51
|
+
return { other: `the network ${JSON.stringify(form.slice(0, 200))}, which this provider never makes` };
|
|
52
|
+
}
|
|
53
|
+
const FORM_WORDS = { none: "none", open: "open", allow: "a list ({ allow: [names or CIDRs] })" };
|
|
54
|
+
/** The forms as a choice in words: "none", "none or open", "none, open or a list (...)". */
|
|
55
|
+
const choices = (forms) => {
|
|
56
|
+
const words = forms.map((form) => FORM_WORDS[form]);
|
|
57
|
+
return words.length <= 1 ? (words[0] ?? "none") : `${words.slice(0, -1).join(", ")} or ${words.at(-1)}`;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Why a spec's network is refused by a provider (label) that declares forms, in plain words naming it and the choices;
|
|
61
|
+
* undefined when it is taken. A form the provider does not declare is refused, never widened or narrowed to another.
|
|
62
|
+
*/
|
|
63
|
+
export function networkRefusal(label, forms, network) {
|
|
64
|
+
if (network === "none")
|
|
65
|
+
return forms.includes("none") ? undefined : `${label} can't run with no network; choose ${choices(forms)}`;
|
|
66
|
+
if (network === "open")
|
|
67
|
+
return forms.includes("open") ? undefined : `${label} can't open the network; choose ${choices(forms)}`;
|
|
68
|
+
if (typeof network === "object" && network !== null && !Array.isArray(network) && "allow" in network) {
|
|
69
|
+
if (!forms.includes("allow"))
|
|
70
|
+
return `${label} can't limit the network to a list; choose ${choices(forms)}`;
|
|
71
|
+
const allow = allowOf(network.allow, `${label}'s allowlist`);
|
|
72
|
+
return "problem" in allow ? allow.problem : undefined;
|
|
73
|
+
}
|
|
74
|
+
return `network is required: ${choices(forms)}`;
|
|
75
|
+
}
|
|
76
|
+
/** Whether a spec's network goes out through the proxy: open, or a list. */
|
|
77
|
+
export const throughProxy = (network) => network === "open" || (typeof network === "object" && network !== null && "allow" in network);
|
package/dist/hosted/process.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ export declare const CALL_SLACK_MS = 5000;
|
|
|
7
7
|
export declare const seconds: (ms: number) => string;
|
|
8
8
|
/** An error in words, the vendor's name kept, cut to one line of 300 characters. */
|
|
9
9
|
export declare const words: (error: unknown) => string;
|
|
10
|
+
/** text with every secret in it written [redacted], the longest first; an empty or missing secret is skipped. */
|
|
11
|
+
export declare const redact: (text: string, secrets: readonly (string | undefined)[]) => string;
|
|
10
12
|
/** A pause that ends early when signal aborts; never rejects. */
|
|
11
13
|
export declare const pause: (ms: number, signal?: AbortSignal) => Promise<void>;
|
|
12
14
|
/** A signal that aborts with the caller's, or once ms pass. */
|
package/dist/hosted/process.js
CHANGED
|
@@ -14,6 +14,11 @@ export const words = (error) => {
|
|
|
14
14
|
const message = error instanceof Error ? error.message : String(error);
|
|
15
15
|
return `${typeof name === "string" && name !== "Error" ? `${name}: ` : ""}${message}`.replace(/\s+/g, " ").slice(0, 300);
|
|
16
16
|
};
|
|
17
|
+
/** text with every secret in it written [redacted], the longest first; an empty or missing secret is skipped. */
|
|
18
|
+
export const redact = (text, secrets) => secrets
|
|
19
|
+
.filter((secret) => !!secret)
|
|
20
|
+
.sort((a, b) => b.length - a.length)
|
|
21
|
+
.reduce((said, secret) => said.replaceAll(secret, "[redacted]"), text);
|
|
17
22
|
/** A pause that ends early when signal aborts; never rejects. */
|
|
18
23
|
export const pause = (ms, signal) => new Promise((done) => {
|
|
19
24
|
const timer = setTimeout(finish, ms);
|
|
@@ -68,6 +68,8 @@ export declare const NAME_LABEL = "agentrun.computer.name";
|
|
|
68
68
|
export declare const IMAGE_LABEL = "agentrun.computer.image";
|
|
69
69
|
/** The most extend may move the deadline to: create's time plus the cap, by this machine's clock, as init was given. */
|
|
70
70
|
export declare const MAX_LABEL = "agentrun.computer.max-deadline";
|
|
71
|
+
/** A GPU computer's GPUs, type:count: a retry and attach read them here, so no vendor need read them back. */
|
|
72
|
+
export declare const GPU_LABEL = "agentrun.computer.gpu";
|
|
71
73
|
/** The adapter's timeouts, the caller's over its defaults: what a host reads for its own requestMs or pollMs. */
|
|
72
74
|
export declare const timeoutsOf: (timeouts?: Partial<HostedTimeouts>) => HostedTimeouts;
|
|
73
75
|
/** An ISO time a label holds, or undefined when it is missing or not the ISO time create writes. */
|
|
@@ -91,7 +93,7 @@ export declare class HostedProvider implements ComputerProvider {
|
|
|
91
93
|
readonly host: MachineHost;
|
|
92
94
|
readonly extend?: Extend;
|
|
93
95
|
constructor(host: MachineHost, options: HostedOptions);
|
|
94
|
-
/** The computer's facts, from the host's and the adapter's options alone. */
|
|
96
|
+
/** The computer's facts, from the descriptor, the host's facts and the adapter's options alone. */
|
|
95
97
|
capabilities(): ComputerCapabilities;
|
|
96
98
|
check(spec: ComputerSpec): Refusal[];
|
|
97
99
|
/**
|
|
@@ -119,11 +121,11 @@ export declare class HostedProvider implements ComputerProvider {
|
|
|
119
121
|
}>>;
|
|
120
122
|
/**
|
|
121
123
|
* Every computer this provider made that carries all of these labels, running or stopped: the listing finds them, and
|
|
122
|
-
* a get of each reads its state, labels and end (foundBy). Its network is
|
|
123
|
-
* it from inside.
|
|
124
|
+
* a get of each reads its state, labels and end (foundBy). Its network is the one its label records, as create made
|
|
125
|
+
* it (none without one); attach and network() read it from inside.
|
|
124
126
|
*/
|
|
125
127
|
list(labels: Record<string, string>, { signal }?: CallContext): Promise<Result<ComputerInfo[]>>;
|
|
126
|
-
/** The probe
|
|
128
|
+
/** The probe and the proxy's policy read the network back from inside. A change is refused: it is fixed at create. */
|
|
127
129
|
network(ref: ComputerRef, policy?: NetworkSpec, { signal }?: CallContext): Promise<Result<NetworkPolicy>>;
|
|
128
130
|
/**
|
|
129
131
|
* delete reads the machine back to check it is this provider's, then deletes it, both never signalled, so a release
|