@parcha/agentrun-computer 0.1.0-beta.37 → 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 +341 -260
- package/box/Dockerfile +18 -1
- package/box/README.md +14 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.d.mts +5 -0
- package/box/recipe.mjs +43 -0
- package/dist/agent37.d.ts +18 -66
- package/dist/agent37.js +187 -464
- package/dist/box-image.d.ts +14 -0
- package/dist/box-image.js +24 -0
- package/dist/browserbase.d.ts +0 -6
- package/dist/browserbase.js +1 -5
- package/dist/client.d.ts +12 -3
- package/dist/client.js +39 -4
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +4 -0
- 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 +6 -0
- package/dist/conformance/cases/apps.js +18 -5
- package/dist/conformance/cases/isolation.d.ts +22 -5
- package/dist/conformance/cases/isolation.js +97 -16
- package/dist/conformance/cases/mount.js +5 -3
- package/dist/conformance/cases/provider.js +41 -0
- package/dist/conformance/cli.js +72 -11
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.js +9 -4
- package/dist/conformance/exec-stream.d.ts +52 -0
- package/dist/conformance/exec-stream.js +493 -0
- package/dist/conformance/kernel.js +2 -2
- package/dist/conformance/modal.js +1 -1
- package/dist/conformance/orgo.js +2 -2
- package/dist/conformance/sweep.js +8 -8
- package/dist/conformance/types.d.ts +2 -2
- package/dist/create-requests.d.ts +1 -1
- package/dist/daytona.d.ts +17 -133
- package/dist/daytona.js +396 -1452
- package/dist/descriptor.d.ts +11 -4
- package/dist/descriptor.js +7 -0
- package/dist/descriptors/agent37.d.ts +3 -11
- package/dist/descriptors/agent37.js +9 -10
- package/dist/descriptors/daytona.d.ts +7 -6
- package/dist/descriptors/daytona.js +14 -7
- 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 +25 -24
- 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/descriptors/shared.d.ts +1 -1
- package/dist/descriptors/shared.js +2 -2
- package/dist/desktop.d.ts +18 -4
- package/dist/desktop.js +89 -9
- 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 -11
- package/dist/docker.js +13 -16
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +22 -130
- package/dist/e2b.js +163 -243
- package/dist/host.d.ts +136 -104
- package/dist/host.js +8 -1
- package/dist/hosted/network.d.ts +23 -0
- package/dist/hosted/network.js +77 -0
- package/dist/hosted/process.d.ts +24 -8
- package/dist/hosted/process.js +80 -44
- package/dist/hosted/provider.d.ts +38 -22
- package/dist/hosted/provider.js +500 -341
- package/dist/hosted/rest.d.ts +74 -0
- package/dist/hosted/rest.js +126 -0
- package/dist/hosted/scripts.d.ts +21 -3
- package/dist/hosted/scripts.js +76 -14
- package/dist/hosted/ssh-exec.d.ts +99 -0
- package/dist/hosted/ssh-exec.js +464 -0
- package/dist/hosted/values.d.ts +26 -0
- package/dist/hosted/values.js +63 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/isolation.d.ts +0 -2
- package/dist/isolation.js +3 -4
- package/dist/kernel.d.ts +0 -6
- package/dist/kernel.js +1 -5
- package/dist/kinds.d.ts +3 -1
- package/dist/local-chrome.d.ts +0 -6
- package/dist/local-chrome.js +1 -5
- package/dist/modal.d.ts +15 -86
- package/dist/modal.js +67 -185
- package/dist/mount-archil.d.ts +13 -8
- package/dist/mount-archil.js +27 -17
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo.d.ts +0 -9
- package/dist/orgo.js +8 -13
- package/dist/phone-harness.d.ts +0 -6
- package/dist/phone-harness.js +0 -4
- package/dist/protocol.d.ts +4 -1
- package/dist/protocol.js +1 -0
- package/dist/provider.d.ts +2 -2
- package/dist/providers.d.ts +15 -13
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +14 -11
- package/dist/surface/core.d.ts +23 -5
- package/dist/surface/core.js +105 -15
- package/dist/surface/index.d.ts +1 -1
- package/dist/surface/index.js +1 -1
- package/dist/surface/outline.d.ts +2 -0
- package/dist/surface/outline.js +2 -1
- package/dist/surface/script.d.ts +4 -0
- package/dist/surface/script.js +11 -3
- package/dist/ui-engine.js +19 -3
- package/package.json +2 -3
- package/box/build-agent37.mjs +0 -177
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
package/dist/mount-archil.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export declare const ARCHIL_TOOL_UID = 2510;
|
|
|
13
13
|
export declare const ARCHIL_SYNC_SOCKET = "/run/agentrun-archil/archil.sock";
|
|
14
14
|
/** The archil client the image pins, the version the live checks ran. */
|
|
15
15
|
export declare const ARCHIL_VERSION = "0.10.1-1793222256";
|
|
16
|
-
/** The label (Daytona) or metadata (E2B) an Archil computer carries its mount in:
|
|
16
|
+
/** The label (Daytona) or metadata (E2B) an Archil computer carries its mount in: never the token (archilLabels). */
|
|
17
17
|
export declare const ARCHIL_MOUNT_LABEL = "agentrun.mount";
|
|
18
18
|
/** An Archil mount, as a spec gives it. */
|
|
19
19
|
export type ArchilMount = Extract<MountSpec, {
|
|
@@ -50,10 +50,11 @@ export type ProviderNote = (note: {
|
|
|
50
50
|
*/
|
|
51
51
|
export declare const ARCHIL_REGION = "[a-z0-9]+-[a-z0-9][a-z0-9-]{0,62}";
|
|
52
52
|
/**
|
|
53
|
-
* The Archil rule every provider's check() adds to checkMount's, with no vendor call:
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
53
|
+
* The Archil rule every provider's check() adds to checkMount's, with no vendor call: the run's agentrun.run and
|
|
54
|
+
* agentrun.epoch labels (the claim the mount is made under), a disk, region and folder of the helper's shapes, the folder
|
|
55
|
+
* of the labelled run, and a token of a disk token's shape. No word holds a value of the mount but the folder's run, and
|
|
56
|
+
* only once the folder has the folder's shape. The tools' network is the provider's descriptor's to take (none, or open
|
|
57
|
+
* and a list through init's egress proxy): the mount is root's, outside their network either way.
|
|
57
58
|
*/
|
|
58
59
|
export declare function archilRefusals(spec: ComputerSpec): Refusal[];
|
|
59
60
|
/** The sha256 of the helper this package ships (box/agentrun-archil): the one an image must have. */
|
|
@@ -118,14 +119,18 @@ export declare function archilMount({ root, mount, self: computer, releaseOlder,
|
|
|
118
119
|
* process.start, which makes its log and the folders above it; process.write and signal; a process seen
|
|
119
120
|
* ended, by process.wait or a process.read that says so) syncs before it answers, through mount.sync, coalesced: a
|
|
120
121
|
* call during a sync in flight waits for it, then shares one more. A failed sync fails the call in words; a call that
|
|
121
|
-
* failed still syncs, and answers its own error
|
|
122
|
+
* failed still syncs, and answers its own error (one the client timed out with no answer from the daemon does so at
|
|
123
|
+
* once, not waiting for the sync, which rides the same transport; a timeout the daemon answered waits). A caller whose signal fires stops waiting, answered "aborted" in words
|
|
122
124
|
* (or its own error), while the shared sync goes on for every other caller. A tar.push.begin answered with such an error
|
|
123
125
|
* instead of its id first ends the push it began, so no push slot is held by a push its caller cannot name.
|
|
124
126
|
*/
|
|
125
127
|
export declare function syncingClient(client: ComputerClient): ComputerClient;
|
|
126
|
-
/**
|
|
128
|
+
/**
|
|
129
|
+
* The label an Archil computer carries its mount in: kind, disk, region and the folder's agent as JSON, never the token.
|
|
130
|
+
* The folder's run is the computer's agentrun.run label (check holds them equal), so the label does not repeat it.
|
|
131
|
+
*/
|
|
127
132
|
export declare function archilLabels(mount: ArchilMount): Record<string, string>;
|
|
128
|
-
/** The mount a computer's
|
|
133
|
+
/** The mount a computer's labels record, its folder from the agent and agentrun.run; undefined when there is none, or it is not one. */
|
|
129
134
|
export declare function recordedMount(labels: Record<string, string> | undefined): Omit<ArchilMount, "token"> | undefined;
|
|
130
135
|
/**
|
|
131
136
|
* What is mounted at /workspace, read back from the computer's mount table (`mounts`, its /proc/self/mounts): an Archil
|
package/dist/mount-archil.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
// a read-back or an error. Whatever a computer prints is scrubbed of it before it reaches an error's words.
|
|
10
10
|
import { createHash } from "node:crypto";
|
|
11
11
|
import { readFileSync } from "node:fs";
|
|
12
|
+
import { unanswered } from "./client.js";
|
|
12
13
|
import { EPOCH_LABEL, epochOf, RUN_LABEL, runProblem } from "./labels.js";
|
|
13
14
|
import { readBackOf, WORKSPACE } from "./mount.js";
|
|
14
15
|
import { fail, failAs, ok } from "./result.js";
|
|
@@ -23,7 +24,7 @@ export const ARCHIL_TOOL_UID = 2510;
|
|
|
23
24
|
export const ARCHIL_SYNC_SOCKET = "/run/agentrun-archil/archil.sock";
|
|
24
25
|
/** The archil client the image pins, the version the live checks ran. */
|
|
25
26
|
export const ARCHIL_VERSION = "0.10.1-1793222256";
|
|
26
|
-
/** The label (Daytona) or metadata (E2B) an Archil computer carries its mount in:
|
|
27
|
+
/** The label (Daytona) or metadata (E2B) an Archil computer carries its mount in: never the token (archilLabels). */
|
|
27
28
|
export const ARCHIL_MOUNT_LABEL = "agentrun.mount";
|
|
28
29
|
// The shapes the helper itself checks (box/agentrun-archil), so a spec it would refuse is refused before any vendor call.
|
|
29
30
|
const DISK = /^(?:dsk-[0-9a-f]{16}|[A-Za-z0-9][A-Za-z0-9._@+-]{0,127}\/[A-Za-z0-9][A-Za-z0-9._-]{0,127})$/;
|
|
@@ -33,13 +34,14 @@ const DISK = /^(?:dsk-[0-9a-f]{16}|[A-Za-z0-9][A-Za-z0-9._@+-]{0,127}\/[A-Za-z0-
|
|
|
33
34
|
*/
|
|
34
35
|
export const ARCHIL_REGION = "[a-z0-9]+-[a-z0-9][a-z0-9-]{0,62}";
|
|
35
36
|
const REGION = new RegExp(`^${ARCHIL_REGION}$`);
|
|
36
|
-
const FOLDER = /^agents\/[A-Za-z0-9][A-Za-z0-9_-]{0,127}\/runs\/([A-Za-z0-9][A-Za-z0-9_-]{0,127})\/work$/;
|
|
37
|
+
const FOLDER = /^agents\/([A-Za-z0-9][A-Za-z0-9_-]{0,127})\/runs\/([A-Za-z0-9][A-Za-z0-9_-]{0,127})\/work$/;
|
|
37
38
|
const TOKEN = /^[A-Za-z0-9._~+/=-]{16,4096}$/;
|
|
38
39
|
/**
|
|
39
|
-
* The Archil rule every provider's check() adds to checkMount's, with no vendor call:
|
|
40
|
-
*
|
|
41
|
-
*
|
|
42
|
-
*
|
|
40
|
+
* The Archil rule every provider's check() adds to checkMount's, with no vendor call: the run's agentrun.run and
|
|
41
|
+
* agentrun.epoch labels (the claim the mount is made under), a disk, region and folder of the helper's shapes, the folder
|
|
42
|
+
* of the labelled run, and a token of a disk token's shape. No word holds a value of the mount but the folder's run, and
|
|
43
|
+
* only once the folder has the folder's shape. The tools' network is the provider's descriptor's to take (none, or open
|
|
44
|
+
* and a list through init's egress proxy): the mount is root's, outside their network either way.
|
|
43
45
|
*/
|
|
44
46
|
export function archilRefusals(spec) {
|
|
45
47
|
const mount = spec.mount;
|
|
@@ -47,8 +49,6 @@ export function archilRefusals(spec) {
|
|
|
47
49
|
return [];
|
|
48
50
|
const found = [];
|
|
49
51
|
const refuse = (field, message) => found.push({ field, message });
|
|
50
|
-
if (spec.network !== "none")
|
|
51
|
-
refuse("network", 'a computer with an Archil mount takes network "none": its tools have no network, only loopback in init\'s own namespace');
|
|
52
52
|
const labels = spec.labels ?? {};
|
|
53
53
|
const run = labels[RUN_LABEL];
|
|
54
54
|
const runWrong = runProblem(run);
|
|
@@ -65,8 +65,8 @@ export function archilRefusals(spec) {
|
|
|
65
65
|
const folder = FOLDER.exec(text(mount.folder));
|
|
66
66
|
if (folder === null)
|
|
67
67
|
refuse("mount", "mount.folder is agents/<agent>/runs/<run>/work, nothing else");
|
|
68
|
-
else if (runWrong === undefined && folder[
|
|
69
|
-
refuse("mount", `mount.folder is run ${folder[
|
|
68
|
+
else if (runWrong === undefined && folder[2] !== run)
|
|
69
|
+
refuse("mount", `mount.folder is run ${folder[2]}'s folder, not the run this computer is labelled for (${RUN_LABEL})`);
|
|
70
70
|
if (!TOKEN.test(text(mount.token)))
|
|
71
71
|
refuse("mount", "mount.token is not a disk token: 16 to 4096 of letters, digits and ._~+/=-");
|
|
72
72
|
return found;
|
|
@@ -271,7 +271,8 @@ const MUTATING = new Set(["files.write", "files.move", "files.remove", "files.mk
|
|
|
271
271
|
* process.start, which makes its log and the folders above it; process.write and signal; a process seen
|
|
272
272
|
* ended, by process.wait or a process.read that says so) syncs before it answers, through mount.sync, coalesced: a
|
|
273
273
|
* call during a sync in flight waits for it, then shares one more. A failed sync fails the call in words; a call that
|
|
274
|
-
* failed still syncs, and answers its own error
|
|
274
|
+
* failed still syncs, and answers its own error (one the client timed out with no answer from the daemon does so at
|
|
275
|
+
* once, not waiting for the sync, which rides the same transport; a timeout the daemon answered waits). A caller whose signal fires stops waiting, answered "aborted" in words
|
|
275
276
|
* (or its own error), while the shared sync goes on for every other caller. A tar.push.begin answered with such an error
|
|
276
277
|
* instead of its id first ends the push it began, so no push slot is held by a push its caller cannot name.
|
|
277
278
|
*/
|
|
@@ -340,6 +341,11 @@ export function syncingClient(client) {
|
|
|
340
341
|
};
|
|
341
342
|
if (signal?.aborted)
|
|
342
343
|
return result.ok ? stopped() : result;
|
|
344
|
+
// A call the client gave up on at its own timeoutMs got no answer over the transport, and a sync rides that same
|
|
345
|
+
// transport: the caller gets its timeout now, and the sync it asked for goes on for the others. A timeout the
|
|
346
|
+
// daemon answered came over a live transport, after the call may have run in part: that one waits for the sync.
|
|
347
|
+
if (!result.ok && unanswered(result.error))
|
|
348
|
+
return result;
|
|
343
349
|
const synced = signal === undefined ? await shared : await new Promise((resolve) => {
|
|
344
350
|
const onAbort = () => resolve("stopped");
|
|
345
351
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -358,19 +364,23 @@ export function syncingClient(client) {
|
|
|
358
364
|
close: () => client.close(),
|
|
359
365
|
};
|
|
360
366
|
}
|
|
361
|
-
/**
|
|
367
|
+
/**
|
|
368
|
+
* The label an Archil computer carries its mount in: kind, disk, region and the folder's agent as JSON, never the token.
|
|
369
|
+
* The folder's run is the computer's agentrun.run label (check holds them equal), so the label does not repeat it.
|
|
370
|
+
*/
|
|
362
371
|
export function archilLabels(mount) {
|
|
363
|
-
return { [ARCHIL_MOUNT_LABEL]: JSON.stringify({ kind: "archil", disk: mount.disk, region: mount.region,
|
|
372
|
+
return { [ARCHIL_MOUNT_LABEL]: JSON.stringify({ kind: "archil", disk: mount.disk, region: mount.region, agent: FOLDER.exec(mount.folder)?.[1] ?? "" }) };
|
|
364
373
|
}
|
|
365
|
-
/** The mount a computer's
|
|
374
|
+
/** The mount a computer's labels record, its folder from the agent and agentrun.run; undefined when there is none, or it is not one. */
|
|
366
375
|
export function recordedMount(labels) {
|
|
367
376
|
const text = labels?.[ARCHIL_MOUNT_LABEL];
|
|
368
377
|
if (text === undefined)
|
|
369
378
|
return undefined;
|
|
370
379
|
try {
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
|
|
380
|
+
const { kind, disk, region, agent, ...rest } = (JSON.parse(text) ?? {});
|
|
381
|
+
const run = labels?.[RUN_LABEL];
|
|
382
|
+
const folder = `agents/${String(agent)}/runs/${String(run)}/work`;
|
|
383
|
+
if (kind !== "archil" || typeof disk !== "string" || typeof region !== "string" || typeof agent !== "string" || typeof run !== "string" || Object.keys(rest).length > 0 || !FOLDER.test(folder))
|
|
374
384
|
return undefined;
|
|
375
385
|
return { kind, disk, region, folder };
|
|
376
386
|
}
|
package/dist/mount.d.ts
CHANGED
|
@@ -42,13 +42,19 @@ export type MountReadBack = {
|
|
|
42
42
|
} | {
|
|
43
43
|
other: string;
|
|
44
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* Mount kinds a provider's computers don't take though a caller would ask for them, each with why, in the one sentence
|
|
47
|
+
* its refusal gives (Daytona's archil: Archil's client hangs on its sandboxes).
|
|
48
|
+
*/
|
|
49
|
+
export type Unmounted = Readonly<Partial<Record<MountKind, string>>>;
|
|
45
50
|
/**
|
|
46
51
|
* The one mount rule, with no vendor call: no mount is no refusal; a kind the provider does not declare is refused in
|
|
47
|
-
* words
|
|
48
|
-
* existing directory on the host, with no NUL; an Archil
|
|
49
|
-
* NUL, the folder relative to the disk's root and
|
|
52
|
+
* words (the provider's own reason, `unmounted`, where it gives one); a bind's path is absolute, canonical (its own
|
|
53
|
+
* realpath: what a provider reads back is what is bound), an existing directory on the host, with no NUL; an Archil
|
|
54
|
+
* mount's disk, region, folder and token are non-empty strings with no NUL, the folder relative to the disk's root and
|
|
55
|
+
* never above it. Each refusal names a field, never an Archil value.
|
|
50
56
|
*/
|
|
51
|
-
export declare function checkMount(mount: unknown, declared: readonly MountKind[] | undefined): Refusal[];
|
|
57
|
+
export declare function checkMount(mount: unknown, declared: readonly MountKind[] | undefined, unmounted?: Unmounted): Refusal[];
|
|
52
58
|
/**
|
|
53
59
|
* What a provider reads back of a mount it made as asked: its kind and source, never the token. An Archil mount is
|
|
54
60
|
* always exclusive, and is read back under `epoch`, the computer's claim epoch. With no epoch, or a value that is not
|
package/dist/mount.js
CHANGED
|
@@ -19,11 +19,12 @@ const NUL = "a NUL byte cannot be passed to a mount";
|
|
|
19
19
|
const filled = (value) => typeof value === "string" && value !== "";
|
|
20
20
|
/**
|
|
21
21
|
* The one mount rule, with no vendor call: no mount is no refusal; a kind the provider does not declare is refused in
|
|
22
|
-
* words
|
|
23
|
-
* existing directory on the host, with no NUL; an Archil
|
|
24
|
-
* NUL, the folder relative to the disk's root and
|
|
22
|
+
* words (the provider's own reason, `unmounted`, where it gives one); a bind's path is absolute, canonical (its own
|
|
23
|
+
* realpath: what a provider reads back is what is bound), an existing directory on the host, with no NUL; an Archil
|
|
24
|
+
* mount's disk, region, folder and token are non-empty strings with no NUL, the folder relative to the disk's root and
|
|
25
|
+
* never above it. Each refusal names a field, never an Archil value.
|
|
25
26
|
*/
|
|
26
|
-
export function checkMount(mount, declared) {
|
|
27
|
+
export function checkMount(mount, declared, unmounted = {}) {
|
|
27
28
|
if (mount === undefined)
|
|
28
29
|
return [];
|
|
29
30
|
const refuse = (message) => [{ field: "mount", message }];
|
|
@@ -33,6 +34,9 @@ export function checkMount(mount, declared) {
|
|
|
33
34
|
return refuse(SHAPE);
|
|
34
35
|
const takes = declared ?? [];
|
|
35
36
|
if (!takes.includes(kind)) {
|
|
37
|
+
const why = unmounted[kind];
|
|
38
|
+
if (why !== undefined)
|
|
39
|
+
return refuse(why);
|
|
36
40
|
return refuse(takes.length === 0
|
|
37
41
|
? `this provider declares no mount kind, so it mounts no run folder (capabilities().mount)`
|
|
38
42
|
: `this provider does not take a mount of kind ${kind}; it takes ${takes.join(" or ")}`);
|
package/dist/orgo.d.ts
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import type { KindCapabilities } from "./kinds.js";
|
|
2
|
-
import { type MountKind } from "./mount.js";
|
|
3
1
|
import { type OrgoChannel, type OrgoStart, type OrgoWebSocketFactory } from "./orgo-channel.js";
|
|
4
2
|
import { OrgoDesktopProvider, type OrgoDesktopOptions } from "./orgo-desktop.js";
|
|
5
3
|
import { type OrgoLedger } from "./orgo-names.js";
|
|
6
4
|
import { type AttachContext, type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreateContext, type CreatedComputer, type KeyChoice, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseContext, type ReleaseHow } from "./provider.js";
|
|
7
5
|
import { type Result } from "./result.js";
|
|
8
6
|
import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
|
|
9
|
-
/** The mount kinds an Orgo computer takes: none yet (an Archil mount needs an Orgo template that bakes the helper). */
|
|
10
|
-
export declare const MOUNT: readonly MountKind[];
|
|
11
|
-
/**
|
|
12
|
-
* What a built provider declares, known without building one, per configuration (its descriptor's): the Linux desktop
|
|
13
|
-
* with computerd (the default), then the Windows and the macOS desktops Orgo's own API answers (options.os).
|
|
14
|
-
*/
|
|
15
|
-
export declare const CAPABILITIES: readonly KindCapabilities[];
|
|
16
7
|
/** The conformance CLI's module for Orgo: its live switch, the run's 1 h cap and the drifted twin. */
|
|
17
8
|
export declare const conformance: () => Promise<typeof import("./conformance/orgo.js")>;
|
|
18
9
|
/** The longest each kind of call may take, and the pause between two polls. */
|
package/dist/orgo.js
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
import { createHash, randomBytes, randomUUID } from "node:crypto";
|
|
15
15
|
import { readFileSync } from "node:fs";
|
|
16
16
|
import { fileURLToPath } from "node:url";
|
|
17
|
+
import { networkRefusal } from "./hosted/network.js";
|
|
17
18
|
import { childCommands, daemonDrift } from "./hosted/scripts.js";
|
|
18
19
|
import { DaemonClient } from "./client.js";
|
|
19
20
|
import { ORGO, ORGO_BASE_IMAGE } from "./descriptors/orgo.js";
|
|
@@ -31,15 +32,8 @@ import { daemonWatch } from "./screen-watch.js";
|
|
|
31
32
|
import { listTested } from "./test-connection.js";
|
|
32
33
|
/** This module's failures: one with code vendor names Orgo. */
|
|
33
34
|
const fail = failFor("orgo");
|
|
34
|
-
/** The mount kinds an Orgo computer takes: none yet (an Archil mount needs an Orgo template that bakes the helper). */
|
|
35
|
-
export const MOUNT = ORGO.mounts;
|
|
36
35
|
/** The groups every Orgo computer offers: a Linux shell, files and processes, and the desktop's screen and input. */
|
|
37
36
|
const GROUPS = ["exec", "files", "processes", ...DESKTOP_GROUPS];
|
|
38
|
-
/**
|
|
39
|
-
* What a built provider declares, known without building one, per configuration (its descriptor's): the Linux desktop
|
|
40
|
-
* with computerd (the default), then the Windows and the macOS desktops Orgo's own API answers (options.os).
|
|
41
|
-
*/
|
|
42
|
-
export const CAPABILITIES = ORGO.capabilities;
|
|
43
37
|
/** The conformance CLI's module for Orgo: its live switch, the run's 1 h cap and the drifted twin. */
|
|
44
38
|
export const conformance = () => import("./conformance/orgo.js");
|
|
45
39
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
@@ -77,8 +71,9 @@ const DELETE_TRIES = 5;
|
|
|
77
71
|
const SPEC_FIELDS = new Set(["image", "lifetimeMs", "network", "cpus", "memoryMb", "labels", "gpu"]);
|
|
78
72
|
/** The states in which a computer runs, or is on its way to. */
|
|
79
73
|
const RUNNING = new Set(["running", "creating", "restarting", "updating", "resuming"]);
|
|
80
|
-
/** Why a network other than "none" is refused
|
|
81
|
-
|
|
74
|
+
/** Why a network other than "none" is refused, in the words every hosted provider uses (hosted/network.ts), and why:
|
|
75
|
+
* this configuration makes none alone. */
|
|
76
|
+
const networkRefused = (network) => `${networkRefusal("Orgo", ORGO.network, network)}: an Orgo computer's tools have no network of their own (init's namespace holds them to loopback), and Orgo's adapter, unlike the shared hosted one, starts no egress proxy out of it`;
|
|
82
77
|
/** The scripts the provider runs as root, each marked on its first line, its arguments after it. */
|
|
83
78
|
const X11_SCRIPT = ["# agentrun-computer: orgo-x11", "s=$1", '[ -S "$s" ] || { echo "no X socket at $s"; exit 1; }'].join("\n");
|
|
84
79
|
const LABELS_SCRIPT = ["# agentrun-computer: orgo-labels", 'p=$1; t=$2; d=${p%/*}', 'mkdir -p "$d" && printf \'%s\' "$t" > "$p.part" && chmod 0644 "$p.part" && mv -f "$p.part" "$p"'].join("\n");
|
|
@@ -262,7 +257,7 @@ export class OrgoProvider {
|
|
|
262
257
|
groups: [...GROUPS],
|
|
263
258
|
maxLifetimeMs: this.#maxLifetimeMs,
|
|
264
259
|
release: ["delete"],
|
|
265
|
-
mount: [...
|
|
260
|
+
mount: [...ORGO.mounts],
|
|
266
261
|
// Init starts with --own-network (childCommands): no tool reaches these, nor any port root listens on.
|
|
267
262
|
vendorAgentPorts: [...ORGO_AGENT_PORTS],
|
|
268
263
|
persistence: { keepsState: true, resume: true },
|
|
@@ -277,7 +272,7 @@ export class OrgoProvider {
|
|
|
277
272
|
refuse("image", `an image is "${BASE}" (Orgo's base desktop) or an Orgo template, namespace/name@version`);
|
|
278
273
|
refusals.push(...checkTenure(given, this.capabilities(), "Orgo"));
|
|
279
274
|
if (network !== "none")
|
|
280
|
-
refuse("network",
|
|
275
|
+
refuse("network", networkRefused(network));
|
|
281
276
|
if (memoryMb !== undefined && !RAM_GB.some((gb) => gb * 1024 === memoryMb))
|
|
282
277
|
refuse("memoryMb", "memoryMb is one of Orgo's sizes: 4096, 8192, 16384 or 32768");
|
|
283
278
|
if (cpus !== undefined && !CPUS.includes(cpus))
|
|
@@ -288,7 +283,7 @@ export class OrgoProvider {
|
|
|
288
283
|
if (bad)
|
|
289
284
|
refuse("labels", bad);
|
|
290
285
|
}
|
|
291
|
-
refusals.push(...checkMount(mount,
|
|
286
|
+
refusals.push(...checkMount(mount, ORGO.mounts));
|
|
292
287
|
refusals.push(...checkGpu(given.gpu, this.capabilities()));
|
|
293
288
|
for (const [field, value] of Object.entries(given)) {
|
|
294
289
|
if (SPEC_FIELDS.has(field) || field === "mount" || field === "owner" || value === undefined)
|
|
@@ -1096,7 +1091,7 @@ export class OrgoProvider {
|
|
|
1096
1091
|
if (problem)
|
|
1097
1092
|
return fail("invalid", problem);
|
|
1098
1093
|
if (policy !== undefined && policy !== "none")
|
|
1099
|
-
return fail("refused",
|
|
1094
|
+
return fail("refused", networkRefused(policy));
|
|
1100
1095
|
const found = await this.#own(ref, signal);
|
|
1101
1096
|
if (!found.ok)
|
|
1102
1097
|
return found;
|
package/dist/phone-harness.d.ts
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import type { Duplex } from "node:stream";
|
|
2
|
-
import type { KindCapabilities } from "./kinds.js";
|
|
3
|
-
import type { MountKind } from "./mount.js";
|
|
4
2
|
import { type AttachedComputer, type CallContext, type ComputerCapabilities, type ComputerConnection, type ComputerInfo, type ComputerProvider, type ComputerRef, type ComputerSpec, type CreateContext, type CreatedComputer, type NetworkPolicy, type NetworkSpec, type Refusal, type ReleaseHow } from "./provider.js";
|
|
5
3
|
import { type Result } from "./result.js";
|
|
6
4
|
import { type ScreenWatch, type ScreenWatchHandlers, type WatchOptions } from "./screen-watch.js";
|
|
7
5
|
/** The phone harness's API. */
|
|
8
6
|
export declare const PHONE_HARNESS_URL = "https://api.phone-harness.com";
|
|
9
|
-
/** A phone mounts no folder. */
|
|
10
|
-
export declare const MOUNT: readonly MountKind[];
|
|
11
|
-
/** The one configuration it offers, as its capabilities() declare it: its descriptor's. */
|
|
12
|
-
export declare const CAPABILITIES: readonly KindCapabilities[];
|
|
13
7
|
/** The longest lifetime by default: a rented phone bills by the minute. */
|
|
14
8
|
export declare const DEFAULT_MAX_LIFETIME_MS: number;
|
|
15
9
|
/** How long create waits for a phone to be ready by default: the service's own CLI waits 240 s. */
|
package/dist/phone-harness.js
CHANGED
|
@@ -27,10 +27,6 @@ import { listTested } from "./test-connection.js";
|
|
|
27
27
|
const fail = failFor("phone-harness");
|
|
28
28
|
/** The phone harness's API. */
|
|
29
29
|
export const PHONE_HARNESS_URL = "https://api.phone-harness.com";
|
|
30
|
-
/** A phone mounts no folder. */
|
|
31
|
-
export const MOUNT = PHONE_HARNESS.mounts;
|
|
32
|
-
/** The one configuration it offers, as its capabilities() declare it: its descriptor's. */
|
|
33
|
-
export const CAPABILITIES = PHONE_HARNESS.capabilities;
|
|
34
30
|
/** The longest lifetime by default: a rented phone bills by the minute. */
|
|
35
31
|
export const DEFAULT_MAX_LIFETIME_MS = 30 * 60_000;
|
|
36
32
|
/** How long create waits for a phone to be ready by default: the service's own CLI waits 240 s. */
|
package/dist/protocol.d.ts
CHANGED
|
@@ -103,6 +103,7 @@ export interface Features {
|
|
|
103
103
|
*/
|
|
104
104
|
export declare const FEATURES: {
|
|
105
105
|
readonly "screen.capture": "screen.shot and screen.watch capture the whole screen; a computer of the screen group that does not list it captures it, and one that lists it off refuses both with its reason (a Mac whose owner has not granted the server it is paired with the screen)";
|
|
106
|
+
readonly "screen.ahead": "screen.watch takes an after one past the newest frame, an ask ahead that waits for the frame after the one the ask before it answers: a caller keeps two asks in flight, and frames come at the computer's pace, not one each round trip";
|
|
106
107
|
readonly "apps.background": "apps.launch with background: true opens an app without bringing it to the front";
|
|
107
108
|
readonly "ui.tree": "ui.observe reads the window's elements; off, it answers the window's image with no nodes (ui.image on) or is refused";
|
|
108
109
|
readonly "ui.image": "ui.observe returns the window's image";
|
|
@@ -446,7 +447,9 @@ export interface ScreenReadResult {
|
|
|
446
447
|
}
|
|
447
448
|
/**
|
|
448
449
|
* The live view's frames (screen.watch): the next frame after the caller's ack, once the screen changed. `after` is
|
|
449
|
-
* the seq of the last frame the caller has whole, 0 for none; an older one gets the newest frame at once.
|
|
450
|
+
* the seq of the last frame the caller has whole, 0 for none; an older one gets the newest frame at once. On a computer
|
|
451
|
+
* that lists screen.ahead, `after` may be one past the newest frame: an ask ahead, which waits as an ask for the newest
|
|
452
|
+
* does.
|
|
450
453
|
*/
|
|
451
454
|
export interface ScreenWatchParams {
|
|
452
455
|
after: number;
|
package/dist/protocol.js
CHANGED
|
@@ -39,6 +39,7 @@ export const PROTOCOL_VERSION = "0.2";
|
|
|
39
39
|
*/
|
|
40
40
|
export const FEATURES = {
|
|
41
41
|
"screen.capture": "screen.shot and screen.watch capture the whole screen; a computer of the screen group that does not list it captures it, and one that lists it off refuses both with its reason (a Mac whose owner has not granted the server it is paired with the screen)",
|
|
42
|
+
"screen.ahead": "screen.watch takes an after one past the newest frame, an ask ahead that waits for the frame after the one the ask before it answers: a caller keeps two asks in flight, and frames come at the computer's pace, not one each round trip",
|
|
42
43
|
"apps.background": "apps.launch with background: true opens an app without bringing it to the front",
|
|
43
44
|
"ui.tree": "ui.observe reads the window's elements; off, it answers the window's image with no nodes (ui.image on) or is refused",
|
|
44
45
|
"ui.image": "ui.observe returns the window's image",
|
package/dist/provider.d.ts
CHANGED
|
@@ -179,8 +179,8 @@ export interface ComputerCapabilities {
|
|
|
179
179
|
isolation: "container" | "gvisor" | "microvm" | "vm" | "machine" | "host";
|
|
180
180
|
os: ComputerOs;
|
|
181
181
|
/**
|
|
182
|
-
* With release "stop": true when a stop ends in deletion
|
|
183
|
-
*
|
|
182
|
+
* With release "stop": true when a stop ends in deletion, so release(ref, "stop") leaves no computer, listed or
|
|
183
|
+
* attachable. Absent or false: a stopped computer is kept, listed stopped, until deleted.
|
|
184
184
|
*/
|
|
185
185
|
stopDeletes?: boolean;
|
|
186
186
|
daemon: DaemonMode;
|
package/dist/providers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { RunFolder } from "./conformance/types.js";
|
|
2
2
|
import type { ProviderDescriptor } from "./descriptor.js";
|
|
3
3
|
import { DESCRIPTORS } from "./descriptors/index.js";
|
|
4
|
-
import type {
|
|
4
|
+
import type { MachineHost } from "./host.js";
|
|
5
5
|
import type { MountKind } from "./mount.js";
|
|
6
6
|
import type { ComputerProvider } from "./provider.js";
|
|
7
7
|
/** Where the conformance side reads its settings: process.env, or a record of the same shape. */
|
|
@@ -18,24 +18,26 @@ export interface ConformanceModule {
|
|
|
18
18
|
createDriftedProvider?(options?: object): ComputerProvider | Promise<ComputerProvider>;
|
|
19
19
|
/** A fresh run folder for a mount kind the provider declares, with its outside; undefined for a kind it cannot make. */
|
|
20
20
|
mountFor?(kind: MountKind, options?: object): RunFolder | undefined | Promise<RunFolder | undefined>;
|
|
21
|
-
|
|
21
|
+
/** The run's image when --image names none; `signal` is the run's own (Ctrl-C), for one that makes or registers it. */
|
|
22
|
+
conformanceImage?(options?: object, context?: {
|
|
23
|
+
signal?: AbortSignal;
|
|
24
|
+
}): string | Promise<string>;
|
|
22
25
|
conformanceNotes?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* A provider on the shared adapter: its MachineHost from the same settings, with no live switch, since it makes
|
|
28
|
+
* nothing by itself. The live sweep lists and deletes through it, and the exec pre-check (--exec-stream) calls its
|
|
29
|
+
* exec alone.
|
|
30
|
+
*/
|
|
31
|
+
createHost?(options?: object): MachineHost | Promise<MachineHost>;
|
|
23
32
|
settingsFromEnv?(env?: ProviderEnv): object;
|
|
24
33
|
/** Every name settingsFromEnv (and the module) reads, by role: COMPUTER_<ID>_*, or its live switch. */
|
|
25
34
|
readonly ENV?: Readonly<Record<string, string>>;
|
|
26
35
|
}
|
|
27
|
-
/**
|
|
36
|
+
/**
|
|
37
|
+
* What every registry line resolves to: the provider file's module. Its mount kinds and configurations are its
|
|
38
|
+
* descriptor's (mounts, capabilities), read without loading it.
|
|
39
|
+
*/
|
|
28
40
|
export interface ProviderModule {
|
|
29
|
-
/**
|
|
30
|
-
* The mount kinds its computers take, the same as its provider's capabilities().mount (none: []): a caller tells which
|
|
31
|
-
* provider binds a local folder from the registry alone, without building one.
|
|
32
|
-
*/
|
|
33
|
-
readonly MOUNT: readonly MountKind[];
|
|
34
|
-
/**
|
|
35
|
-
* The machine kind and groups of each configuration it offers, as its built providers' capabilities() declare them:
|
|
36
|
-
* the kind registry's entry for it (PROVIDERS in kinds.ts) holds the same, and derives its setting kinds from them.
|
|
37
|
-
*/
|
|
38
|
-
readonly CAPABILITIES: readonly KindCapabilities[];
|
|
39
41
|
/**
|
|
40
42
|
* The provider, built from its options alone, its key included; it reads no environment, and throws in words when an
|
|
41
43
|
* option is missing or wrong, never echoing a key. Each provider file types its own options.
|
package/dist/screen-watch.js
CHANGED
|
@@ -2,13 +2,16 @@
|
|
|
2
2
|
//
|
|
3
3
|
// watchScreen(connection, options) is the internal seam: the screen as pull-paced frames and an input sink on one
|
|
4
4
|
// connection. screen.watch asks for the frame after the last one given, and the next ask is made only when the caller
|
|
5
|
-
// calls next() again, so each next() is the ack of the frame before it.
|
|
5
|
+
// calls next() again, so each next() is the ack of the frame before it. A computer that lists screen.ahead (computerd
|
|
6
|
+
// on a desktop) is asked one frame ahead: two asks are kept in flight, the second for the frame after the first's, so
|
|
7
|
+
// its frames come at its own pace and not one each round trip; next() still gives one frame at a time, the newest
|
|
8
|
+
// answered, and a frame bettered before next() asked for it is dropped. act() sends input.actions on the same
|
|
6
9
|
// connection. close() and the caller's signal end both: the waiting ask is cancelled, the frames end, and act()
|
|
7
10
|
// refuses in words. A computer that fails makes next() reject with a ScreenWatchError.
|
|
8
11
|
//
|
|
9
12
|
// provider.watch(ref, handlers, options) is what the runner's viewer calls (tl-browser's handler shape, final), built
|
|
10
13
|
// once, by daemonWatch, as an adapter over watchScreen: each frame goes to handlers.frame(frame, ack), and the next is
|
|
11
|
-
//
|
|
14
|
+
// given only once ack() is called; a computer that goes ends it once with handlers.ended(error), its code gone,
|
|
12
15
|
// unreachable, refused or unsupported; close() and the signal end it with no ended(). Every computerd provider and the
|
|
13
16
|
// phone answer watch() through daemonWatch, on a connection of the watch's own: computerd gives JPEG frames, the phone
|
|
14
17
|
// client PNG ones. No error in either layer holds a URL or a secret.
|
|
@@ -84,18 +87,40 @@ export function watchScreen(connection, options = {}) {
|
|
|
84
87
|
...(options.maxWidth === undefined ? {} : { maxWidth: options.maxWidth }),
|
|
85
88
|
...(options.quality === undefined ? {} : { quality: options.quality }),
|
|
86
89
|
};
|
|
90
|
+
// A computer that lists screen.ahead takes a second ask while the first waits (after one past the newest frame): two
|
|
91
|
+
// are kept in flight, so its frames come at its own pace, not one each round trip. Else one, after each ack.
|
|
92
|
+
// Why it exists: with one ask in flight each frame waits a full round trip, about 7 fps (kit-10, 5-run medians:
|
|
93
|
+
// E2B 7.00 one ask vs 12.96 two, Agent37 6.15 vs 14.53).
|
|
94
|
+
const depth = connection.hello?.features?.["screen.ahead"] === true ? 2 : 1;
|
|
87
95
|
async function* frames() {
|
|
88
|
-
|
|
96
|
+
/** The seq of the newest frame given. */
|
|
97
|
+
let last = 0;
|
|
98
|
+
/** The asks in flight, oldest first. */
|
|
99
|
+
const asks = [];
|
|
100
|
+
const newer = (answer) => answer?.ok === true && answer.value.changed && answer.value.seq > last;
|
|
101
|
+
const ask = () => {
|
|
102
|
+
while (asks.length < depth) {
|
|
103
|
+
// The ask after one in flight is ahead by one: it waits for the frame after the one the first answers.
|
|
104
|
+
const asked = { promise: client.call("screen.watch", { after: last + asks.length, ...params }, { signal: stop.signal }) };
|
|
105
|
+
void asked.promise.then((answer) => (asked.answer = answer));
|
|
106
|
+
asks.push(asked);
|
|
107
|
+
}
|
|
108
|
+
};
|
|
89
109
|
for (;;) {
|
|
90
110
|
if (ended)
|
|
91
111
|
return;
|
|
92
|
-
|
|
112
|
+
ask();
|
|
113
|
+
// A frame the ask after it has already bettered is dropped: the viewer wants the newest.
|
|
114
|
+
while (asks.length > 1 && asks[0].answer !== undefined && newer(asks[1].answer))
|
|
115
|
+
asks.shift();
|
|
116
|
+
const asked = await asks.shift().promise;
|
|
93
117
|
if (ended)
|
|
94
118
|
return;
|
|
95
119
|
if (!asked.ok)
|
|
96
120
|
throw new ScreenWatchError(asked.error.code, redactWords(asked.error.message));
|
|
97
121
|
const answer = asked.value;
|
|
98
|
-
if (!answer.changed) {
|
|
122
|
+
if (!answer.changed || answer.seq <= last) {
|
|
123
|
+
// No change within the wait, or a frame given already (two asks may answer the same newest frame).
|
|
99
124
|
// The computer waited its waitMs; one that answers at once must not spin: timers and the signal run first.
|
|
100
125
|
await new Promise((resolve) => setImmediate(resolve));
|
|
101
126
|
continue;
|
|
@@ -128,7 +153,10 @@ export function watchScreen(connection, options = {}) {
|
|
|
128
153
|
}
|
|
129
154
|
if (sized && size !== said)
|
|
130
155
|
throw new ScreenWatchError("invalid", `frame ${answer.seq} ended at ${size} bytes of the ${said} it said`);
|
|
131
|
-
|
|
156
|
+
last = answer.seq;
|
|
157
|
+
// Asked ahead, the next asks go out before this frame is drawn: the computer makes the next one meanwhile.
|
|
158
|
+
if (depth > 1)
|
|
159
|
+
ask();
|
|
132
160
|
yield {
|
|
133
161
|
seq: answer.seq,
|
|
134
162
|
format: answer.format ?? "jpeg",
|
package/dist/surface/api.d.ts
CHANGED
|
@@ -195,6 +195,18 @@ export interface Computer {
|
|
|
195
195
|
env?: Record<string, string>;
|
|
196
196
|
}): Promise<RunResult>;
|
|
197
197
|
};
|
|
198
|
+
/** @group processes */
|
|
199
|
+
readonly processes: {
|
|
200
|
+
/** Start a program that runs on after the call (an app on the desktop, a server), the way shell.run can't: it ends
|
|
201
|
+
* everything its command started. Answers once it started; it and what it starts run until they exit or the
|
|
202
|
+
* computer ends. A string runs in sh -c, a list is the program and its arguments. */
|
|
203
|
+
start(command: string | string[], options?: {
|
|
204
|
+
cwd?: string;
|
|
205
|
+
env?: Record<string, string>;
|
|
206
|
+
}): Promise<{
|
|
207
|
+
pid: number;
|
|
208
|
+
}>;
|
|
209
|
+
};
|
|
198
210
|
/** @group files */
|
|
199
211
|
readonly files: {
|
|
200
212
|
/** A file's text (UTF-8), or with base64 its bytes. */
|
|
@@ -210,7 +222,7 @@ export interface Computer {
|
|
|
210
222
|
}
|
|
211
223
|
/** computer_observe: observe an app's window (or, with no ui group, the screen). */
|
|
212
224
|
export interface ObserveArgs {
|
|
213
|
-
/** Default: the app in front. */
|
|
225
|
+
/** Default: the app in front. With no ui group, opened or brought in front first. */
|
|
214
226
|
app?: string;
|
|
215
227
|
/** Add the window's picture (always, with no ui group). */
|
|
216
228
|
image?: boolean;
|
|
@@ -219,7 +231,7 @@ export interface ObserveArgs {
|
|
|
219
231
|
}
|
|
220
232
|
/** computer_act: run steps on an app, and check a condition after them. */
|
|
221
233
|
export interface ActArgs {
|
|
222
|
-
/** Default: the state's app, else the app in front. */
|
|
234
|
+
/** Default: the state's app, else the app in front. With no ui group, opened or brought in front first. */
|
|
223
235
|
app?: string;
|
|
224
236
|
/** The state a step's point was read from. Default: the last observed. */
|
|
225
237
|
state?: string;
|
|
@@ -237,12 +249,3 @@ export interface ScreenshotArgs {
|
|
|
237
249
|
/** [x, y, w, h] in screen pixels. */
|
|
238
250
|
region?: Rect;
|
|
239
251
|
}
|
|
240
|
-
/** computer_script: run JavaScript against the `computer` object. */
|
|
241
|
-
export interface ScriptArgs {
|
|
242
|
-
/** An async function's body; `return` what you need. */
|
|
243
|
-
code: string;
|
|
244
|
-
/** For the run's timeline. */
|
|
245
|
-
title?: string;
|
|
246
|
-
/** Default 120000, at most 600000. */
|
|
247
|
-
timeoutMs?: number;
|
|
248
|
-
}
|
package/dist/surface/core.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComputerClient, HelloResult, UiStep } from "../protocol.js";
|
|
2
2
|
import type { ActResult, Card, Image } from "./api.js";
|
|
3
3
|
/** What a surface can be asked, by name: the members of Computer and the tools' calls. */
|
|
4
|
-
export type SurfaceOp = "observe" | "act" | "screenshot" | "input.act" | "apps.list" | "apps.open" | "shell.run" | "files.read" | "files.write" | "files.list" | "files.stat";
|
|
4
|
+
export type SurfaceOp = "observe" | "act" | "screenshot" | "input.act" | "apps.list" | "apps.open" | "shell.run" | "processes.start" | "files.read" | "files.write" | "files.list" | "files.stat";
|
|
5
5
|
export declare const SURFACE_OPS: readonly SurfaceOp[];
|
|
6
6
|
/** One call's answer: the value a script gets, the text a model reads, and the images that go with it. */
|
|
7
7
|
export interface SurfaceAnswer {
|
|
@@ -31,12 +31,30 @@ export declare function cardOf(hello: HelloResult): Card;
|
|
|
31
31
|
export declare function opsOf(groups: readonly string[]): SurfaceOp[];
|
|
32
32
|
/** The name of a step: its first key ("press", "click", ...). */
|
|
33
33
|
export declare const stepName: (step: UiStep) => string;
|
|
34
|
-
/** An
|
|
35
|
-
|
|
34
|
+
/** An element as a step's line names it: its ref, its role, its name, and `[secure]` for a secure field. */
|
|
35
|
+
type Named = {
|
|
36
|
+
role: string;
|
|
37
|
+
name?: string;
|
|
38
|
+
secure: boolean;
|
|
39
|
+
};
|
|
40
|
+
/** A step as its line in an act's answer names it: its name, then the element it acted on as the outline names it
|
|
41
|
+
* (`press @e3 button "Save"`, `type into @e4 textbox "PIN" [secure]`), where that element was seen in an observation;
|
|
42
|
+
* `[secure]` is that element's own flag. A type with no element names none: where the focus is when it runs (which
|
|
43
|
+
* app, which field, after what the steps before it, a person, or the system did) is not known here, so no reader of
|
|
44
|
+
* its line can tell it went to an ordinary field, and none shows what was typed. */
|
|
45
|
+
export declare function stepWords(step: UiStep, named: (ref: string) => Named | undefined): string;
|
|
46
|
+
/** An act's answer as lines: one per step (named by `names`, stepWords), then the expect, then whether it changed and
|
|
47
|
+
* the new state, then the new observation's outline when there is one. */
|
|
36
48
|
export declare function actText(names: readonly string[], result: ActResult): string;
|
|
37
49
|
/** A chord's keys: "ctrl+shift+t" is ctrl, shift, t; a trailing "+" is the plus key ("ctrl++"). */
|
|
38
50
|
export declare const chordKeys: (chord: string) => string[];
|
|
39
|
-
/**
|
|
40
|
-
|
|
51
|
+
/**
|
|
52
|
+
* The surface of one computer, over its connection. `cwd`: where shell.run and processes.start start a program whose
|
|
53
|
+
* call names no folder (the run's folder, where the computer mounts it); absent, where the computer starts it.
|
|
54
|
+
*/
|
|
55
|
+
export declare function createSurface(client: ComputerClient, hello: HelloResult, { cwd }?: {
|
|
56
|
+
readonly cwd?: string;
|
|
57
|
+
}): Surface;
|
|
41
58
|
/** A value with its images' data left out: the structured half of an answer whose images travel beside it. */
|
|
42
59
|
export declare function withoutImageData(value: unknown): unknown;
|
|
60
|
+
export {};
|