@parcha/agentrun-computer 0.1.0-beta.36 → 0.1.0-beta.38
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/NOTICE +2 -0
- package/README.md +547 -478
- package/box/Dockerfile +18 -1
- package/box/README.md +13 -0
- package/box/build-agent37.mjs +158 -0
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +41 -18
- package/box/recipe.mjs +43 -0
- package/dist/agent37-ssh.d.ts +89 -0
- package/dist/agent37-ssh.js +445 -0
- package/dist/agent37.d.ts +104 -0
- package/dist/agent37.js +402 -0
- package/dist/attach.d.ts +146 -0
- package/dist/attach.js +469 -0
- package/dist/browserbase.d.ts +2 -10
- package/dist/browserbase.js +3 -6
- package/dist/client.d.ts +45 -4
- package/dist/client.js +92 -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 +96 -0
- package/dist/conformance/agent37.js +154 -0
- package/dist/conformance/cases/apps.d.ts +11 -0
- package/dist/conformance/cases/apps.js +173 -73
- package/dist/conformance/cases/health.js +14 -0
- package/dist/conformance/cases/index.js +2 -0
- package/dist/conformance/cases/isolation.d.ts +7 -5
- package/dist/conformance/cases/isolation.js +44 -14
- package/dist/conformance/cases/mount.js +1 -1
- package/dist/conformance/cases/provider.js +27 -1
- package/dist/conformance/cases/screen.d.ts +3 -0
- package/dist/conformance/cases/screen.js +18 -0
- package/dist/conformance/cases/settings.d.ts +29 -23
- package/dist/conformance/cases/settings.js +76 -58
- package/dist/conformance/cases/touch.js +19 -17
- package/dist/conformance/cases/ui.d.ts +2 -0
- package/dist/conformance/cases/ui.js +475 -0
- package/dist/conformance/cli.d.ts +9 -0
- package/dist/conformance/cli.js +94 -9
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/e2b.d.ts +6 -0
- package/dist/conformance/e2b.js +9 -2
- package/dist/conformance/exec-stream.d.ts +45 -0
- package/dist/conformance/exec-stream.js +486 -0
- package/dist/conformance/fixture.d.ts +1 -1
- package/dist/conformance/fixture.js +25 -1
- package/dist/conformance/modal.d.ts +17 -13
- package/dist/conformance/modal.js +18 -9
- package/dist/conformance/orgo.d.ts +3 -3
- package/dist/conformance/orgo.js +6 -8
- package/dist/conformance/phone-harness.d.ts +6 -2
- package/dist/conformance/phone-harness.js +21 -4
- package/dist/conformance/report.js +1 -1
- package/dist/conformance/runner.js +23 -4
- package/dist/conformance/sweep.d.ts +50 -0
- package/dist/conformance/sweep.js +187 -0
- package/dist/conformance/types.d.ts +13 -5
- package/dist/conformance/ui-fixture.d.ts +56 -0
- package/dist/conformance/ui-fixture.js +43 -0
- package/dist/create-requests.d.ts +51 -0
- package/dist/create-requests.js +121 -0
- package/dist/daytona.d.ts +20 -133
- package/dist/daytona.js +405 -1449
- package/dist/descriptor.d.ts +11 -1
- package/dist/descriptor.js +9 -0
- package/dist/descriptors/agent37.d.ts +41 -0
- package/dist/descriptors/agent37.js +28 -0
- package/dist/descriptors/daytona.d.ts +6 -5
- package/dist/descriptors/daytona.js +9 -5
- package/dist/descriptors/index.d.ts +42 -7
- package/dist/descriptors/index.js +4 -2
- package/dist/descriptors/orgo.d.ts +2 -1
- package/dist/descriptors/orgo.js +3 -2
- package/dist/descriptors/phone-harness.d.ts +1 -1
- package/dist/descriptors/phone-harness.js +2 -2
- 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.d.ts +7 -10
- package/dist/docker.js +272 -34
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +16 -290
- package/dist/e2b.js +230 -1393
- package/dist/fake-ui-driver.d.ts +97 -0
- package/dist/fake-ui-driver.js +717 -0
- package/dist/host.d.ts +201 -0
- package/dist/host.js +8 -0
- package/dist/hosted/process.d.ts +81 -0
- package/dist/hosted/process.js +259 -0
- package/dist/hosted/provider.d.ts +160 -0
- package/dist/hosted/provider.js +1415 -0
- package/dist/hosted/rest.d.ts +66 -0
- package/dist/hosted/rest.js +121 -0
- package/dist/hosted/scripts.d.ts +82 -0
- package/dist/{child.js → hosted/scripts.js} +118 -12
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +8 -0
- package/dist/index.d.ts +7 -3
- package/dist/index.js +7 -4
- package/dist/kernel.d.ts +2 -10
- package/dist/kernel.js +3 -6
- package/dist/kinds.d.ts +11 -2
- package/dist/kinds.js +20 -4
- package/dist/local-chrome.d.ts +2 -10
- package/dist/local-chrome.js +3 -6
- package/dist/modal.d.ts +22 -257
- package/dist/modal.js +183 -1280
- package/dist/mount-archil.d.ts +8 -4
- package/dist/mount-archil.js +22 -11
- package/dist/mount.d.ts +10 -4
- package/dist/mount.js +8 -4
- package/dist/orgo-channel.d.ts +3 -2
- package/dist/orgo-channel.js +5 -2
- package/dist/orgo-desktop.d.ts +9 -4
- package/dist/orgo-desktop.js +33 -13
- package/dist/orgo-workspaces.d.ts +47 -0
- package/dist/orgo-workspaces.js +94 -0
- package/dist/orgo.d.ts +10 -13
- package/dist/orgo.js +32 -21
- package/dist/phone-harness.d.ts +31 -28
- package/dist/phone-harness.js +510 -702
- package/dist/png.d.ts +4 -0
- package/dist/png.js +27 -0
- package/dist/protocol.d.ts +339 -33
- package/dist/protocol.js +97 -3
- package/dist/provider.d.ts +36 -8
- package/dist/provider.js +16 -0
- package/dist/providers.d.ts +11 -12
- package/dist/result.d.ts +1 -1
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +260 -0
- package/dist/surface/api.js +1 -0
- package/dist/surface/core.d.ts +55 -0
- package/dist/surface/core.js +475 -0
- package/dist/surface/index.d.ts +5 -0
- package/dist/surface/index.js +3 -0
- package/dist/surface/outline.d.ts +10 -0
- package/dist/surface/outline.js +51 -0
- package/dist/surface/script.d.ts +10 -0
- package/dist/surface/script.js +94 -0
- package/dist/ui-engine.d.ts +114 -0
- package/dist/ui-engine.js +814 -0
- package/package.json +18 -3
- package/dist/child.d.ts +0 -42
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
- package/dist/conformance/e2b-diagnose.d.ts +0 -16
- package/dist/conformance/e2b-diagnose.js +0 -61
- package/dist/conformance/e2b-sweep.d.ts +0 -18
- package/dist/conformance/e2b-sweep.js +0 -132
- package/dist/conformance/modal-sweep.d.ts +0 -22
- package/dist/conformance/modal-sweep.js +0 -213
package/dist/orgo.js
CHANGED
|
@@ -14,7 +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 { childCommands, daemonDrift } from "./
|
|
17
|
+
import { childCommands, daemonDrift } from "./hosted/scripts.js";
|
|
18
18
|
import { DaemonClient } from "./client.js";
|
|
19
19
|
import { ORGO, ORGO_BASE_IMAGE } from "./descriptors/orgo.js";
|
|
20
20
|
import { DESKTOP_GROUPS } from "./desktop.js";
|
|
@@ -23,6 +23,7 @@ import { EPOCH_LABEL, OWNER_LABEL, OWNER_SERVER_LABEL, ownerLabels, RUN_HASH_LAB
|
|
|
23
23
|
import { checkMount } from "./mount.js";
|
|
24
24
|
import { ORGO_API_URL, orgoRest, orgoTerminalChannel, START_LOG } from "./orgo-channel.js";
|
|
25
25
|
import { OrgoDesktopProvider } from "./orgo-desktop.js";
|
|
26
|
+
import { workspaceChoices, workspaceHolder } from "./orgo-workspaces.js";
|
|
26
27
|
import { COMPUTER_ID, filterProblem, labelProblem, labelsOf, NAME_MAX, NO_DEADLINE, nameParts, orgoMemoryLedger, orgoName, claimProblem, andSettled, inTurn, ownedListing, ownerHashOfLabels, ownerReadBack, refProblem, sameComputer, settleEntry, show, renewEntry, takeEntry, withDeadline, } from "./orgo-names.js";
|
|
27
28
|
import { checkGpu, checkTenure, runLifetimeMs, } from "./provider.js";
|
|
28
29
|
import { failFor, ok, vendorFail } from "./result.js";
|
|
@@ -30,15 +31,8 @@ import { daemonWatch } from "./screen-watch.js";
|
|
|
30
31
|
import { listTested } from "./test-connection.js";
|
|
31
32
|
/** This module's failures: one with code vendor names Orgo. */
|
|
32
33
|
const fail = failFor("orgo");
|
|
33
|
-
/** The mount kinds an Orgo computer takes: none yet (an Archil mount needs an Orgo template that bakes the helper). */
|
|
34
|
-
export const MOUNT = ORGO.mounts;
|
|
35
34
|
/** The groups every Orgo computer offers: a Linux shell, files and processes, and the desktop's screen and input. */
|
|
36
35
|
const GROUPS = ["exec", "files", "processes", ...DESKTOP_GROUPS];
|
|
37
|
-
/**
|
|
38
|
-
* What a built provider declares, known without building one, per configuration (its descriptor's): the Linux desktop
|
|
39
|
-
* with computerd (the default), then the Windows and the macOS desktops Orgo's own API answers (options.os).
|
|
40
|
-
*/
|
|
41
|
-
export const CAPABILITIES = ORGO.capabilities;
|
|
42
36
|
/** The conformance CLI's module for Orgo: its live switch, the run's 1 h cap and the drifted twin. */
|
|
43
37
|
export const conformance = () => import("./conformance/orgo.js");
|
|
44
38
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
@@ -181,7 +175,7 @@ export class OrgoProvider {
|
|
|
181
175
|
version = VERSION;
|
|
182
176
|
#rest;
|
|
183
177
|
#channel;
|
|
184
|
-
#
|
|
178
|
+
#workspace;
|
|
185
179
|
#daemonPath;
|
|
186
180
|
#maxLifetimeMs;
|
|
187
181
|
#uid;
|
|
@@ -198,8 +192,8 @@ export class OrgoProvider {
|
|
|
198
192
|
constructor({ apiKey, workspaceId, apiUrl = ORGO_API_URL, fetch, webSocket, channel, daemonPath = DEFAULT_DAEMON_PATH, maxLifetimeMs = MAX_LIFETIME_MS, user = "2510:2510", start = "bash", display = ":99", timeouts = {}, probeTargets = DEFAULT_PROBE_TARGETS, ledger = orgoMemoryLedger() }) {
|
|
199
193
|
if (typeof apiKey !== "string" || apiKey === "")
|
|
200
194
|
throw new Error("options.apiKey, an Orgo API key, is required");
|
|
201
|
-
if (typeof workspaceId !== "string" || !WORKSPACE_ID.test(workspaceId))
|
|
202
|
-
throw new Error("options.workspaceId, the Orgo workspace this deployment's computers live in, is
|
|
195
|
+
if (workspaceId !== undefined && (typeof workspaceId !== "string" || !WORKSPACE_ID.test(workspaceId)))
|
|
196
|
+
throw new Error("options.workspaceId, the Orgo workspace this deployment's computers live in, is an Orgo workspace id when given");
|
|
203
197
|
let url;
|
|
204
198
|
try {
|
|
205
199
|
url = new URL(apiUrl);
|
|
@@ -229,8 +223,8 @@ export class OrgoProvider {
|
|
|
229
223
|
throw new Error("probeTargets must name at least one address for the probe, each host:port or host:port/udp");
|
|
230
224
|
}
|
|
231
225
|
this.#rest = orgoRest({ apiKey, apiUrl: url.href, ...(fetch ? { fetch } : {}) });
|
|
232
|
-
this.#
|
|
233
|
-
this.#
|
|
226
|
+
this.#workspace = workspaceHolder(workspaceId, this.#rest, merged.requestMs);
|
|
227
|
+
this.#channel = channel ?? orgoTerminalChannel({ rest: this.#rest, workspace: (signal) => this.#workspace.read(signal), ...(webSocket ? { webSocket } : {}) });
|
|
234
228
|
this.#daemonPath = daemonPath;
|
|
235
229
|
this.#maxLifetimeMs = maxLifetimeMs;
|
|
236
230
|
[this.#uid, this.#gid] = [String(Number(ids[1])), String(Number(ids[2]))];
|
|
@@ -261,7 +255,7 @@ export class OrgoProvider {
|
|
|
261
255
|
groups: [...GROUPS],
|
|
262
256
|
maxLifetimeMs: this.#maxLifetimeMs,
|
|
263
257
|
release: ["delete"],
|
|
264
|
-
mount: [...
|
|
258
|
+
mount: [...ORGO.mounts],
|
|
265
259
|
// Init starts with --own-network (childCommands): no tool reaches these, nor any port root listens on.
|
|
266
260
|
vendorAgentPorts: [...ORGO_AGENT_PORTS],
|
|
267
261
|
persistence: { keepsState: true, resume: true },
|
|
@@ -287,7 +281,7 @@ export class OrgoProvider {
|
|
|
287
281
|
if (bad)
|
|
288
282
|
refuse("labels", bad);
|
|
289
283
|
}
|
|
290
|
-
refusals.push(...checkMount(mount,
|
|
284
|
+
refusals.push(...checkMount(mount, ORGO.mounts));
|
|
291
285
|
refusals.push(...checkGpu(given.gpu, this.capabilities()));
|
|
292
286
|
for (const [field, value] of Object.entries(given)) {
|
|
293
287
|
if (SPEC_FIELDS.has(field) || field === "mount" || field === "owner" || value === undefined)
|
|
@@ -303,7 +297,8 @@ export class OrgoProvider {
|
|
|
303
297
|
}
|
|
304
298
|
return refusals;
|
|
305
299
|
}
|
|
306
|
-
async create(spec,
|
|
300
|
+
async create(spec, context) {
|
|
301
|
+
const signal = context?.signal;
|
|
307
302
|
const refusals = this.check(spec);
|
|
308
303
|
if (refusals.length > 0)
|
|
309
304
|
return fail("refused", refusals.map(({ field, message }) => `${field}: ${message}`).join("; "));
|
|
@@ -316,6 +311,9 @@ export class OrgoProvider {
|
|
|
316
311
|
}
|
|
317
312
|
if (signal?.aborted)
|
|
318
313
|
return fail("aborted", "create was aborted before Orgo was called");
|
|
314
|
+
const workspace = await this.#workspace.read(signal);
|
|
315
|
+
if (!workspace.ok)
|
|
316
|
+
return workspace;
|
|
319
317
|
// An agent's own computer outlives the run: no janitor's deadline and no Orgo end, the owner in its name and labels.
|
|
320
318
|
// Init still takes one, maxLifetimeMs out, since it ends its programs at its deadline, with no most in practice:
|
|
321
319
|
// each attach moves it maxLifetimeMs out again (#ownedInit).
|
|
@@ -332,7 +330,7 @@ export class OrgoProvider {
|
|
|
332
330
|
const ram = spec.memoryMb === undefined ? 4 : spec.memoryMb / 1024;
|
|
333
331
|
const cpu = spec.cpus ?? CPU_FOR_RAM[ram];
|
|
334
332
|
const body = {
|
|
335
|
-
workspace_id:
|
|
333
|
+
workspace_id: workspace.value,
|
|
336
334
|
name,
|
|
337
335
|
os: "linux",
|
|
338
336
|
ram,
|
|
@@ -582,7 +580,11 @@ export class OrgoProvider {
|
|
|
582
580
|
}
|
|
583
581
|
}
|
|
584
582
|
/** Orgo's record of a computer; not_found once Orgo no longer has it. */
|
|
583
|
+
/** Orgo's record of a computer. The workspace is read first, so #ours knows it for every record read. */
|
|
585
584
|
async #get(id, signal) {
|
|
585
|
+
const workspace = await this.#workspace.read(signal);
|
|
586
|
+
if (!workspace.ok)
|
|
587
|
+
return workspace;
|
|
586
588
|
const read = await this.#rest.request("GET", `/computers/${encodeURIComponent(id)}`, { timeoutMs: this.#timeouts.requestMs, ...(signal ? { signal } : {}) });
|
|
587
589
|
if (!read.ok)
|
|
588
590
|
return read;
|
|
@@ -595,7 +597,8 @@ export class OrgoProvider {
|
|
|
595
597
|
// A ref's name matches by its stable part: extend renames the computer with its new deadline.
|
|
596
598
|
// A Windows or macOS computer in the workspace is the desktop provider's (orgo-desktop.ts), where Orgo says its os.
|
|
597
599
|
return (nameParts(record.name) !== undefined &&
|
|
598
|
-
|
|
600
|
+
this.#workspace.id !== undefined &&
|
|
601
|
+
(record.workspace_id ?? record.project_id) === this.#workspace.id &&
|
|
599
602
|
(name === undefined || sameComputer(record.name, name)) &&
|
|
600
603
|
record.status !== "deleted" &&
|
|
601
604
|
(record.os === undefined || record.os === "linux"));
|
|
@@ -710,13 +713,17 @@ export class OrgoProvider {
|
|
|
710
713
|
}
|
|
711
714
|
/** The workspace's computers, as Orgo lists them. */
|
|
712
715
|
async #desktops(signal) {
|
|
713
|
-
const
|
|
716
|
+
const workspace = await this.#workspace.read(signal);
|
|
717
|
+
if (!workspace.ok)
|
|
718
|
+
return workspace;
|
|
719
|
+
const id = workspace.value;
|
|
720
|
+
const read = await this.#rest.request("GET", `/workspaces/${encodeURIComponent(id)}`, { timeoutMs: this.#timeouts.listMs, ...(signal ? { signal } : {}) });
|
|
714
721
|
if (!read.ok)
|
|
715
722
|
return read;
|
|
716
723
|
const desktops = read.value?.desktops;
|
|
717
724
|
if (!Array.isArray(desktops))
|
|
718
|
-
return vendorFail("orgo", `Orgo's workspace ${
|
|
719
|
-
return ok(desktops.filter((one) => typeof one?.id === "string" && typeof one.name === "string").map((one) => ({ ...one, workspace_id:
|
|
725
|
+
return vendorFail("orgo", `Orgo's workspace ${id} lists no computers array`);
|
|
726
|
+
return ok(desktops.filter((one) => typeof one?.id === "string" && typeof one.name === "string").map((one) => ({ ...one, workspace_id: id })));
|
|
720
727
|
}
|
|
721
728
|
/** The live view: screen.watch on a connection of the watch's own (daemonWatch), never Orgo's VNC (proxy only). */
|
|
722
729
|
watch(ref, handlers, options) {
|
|
@@ -1073,6 +1080,10 @@ export class OrgoProvider {
|
|
|
1073
1080
|
async testConnection(context = {}) {
|
|
1074
1081
|
return listTested("Orgo", await this.list({}, context));
|
|
1075
1082
|
}
|
|
1083
|
+
/** Settings' pick of ORGO_WORKSPACE_ID (workspaceId): every workspace the key's account sees, by name. Makes nothing. */
|
|
1084
|
+
keyChoices(option, { signal } = {}) {
|
|
1085
|
+
return workspaceChoices(this.#rest, option, { timeoutMs: this.#timeouts.requestMs, ...(signal ? { signal } : {}) });
|
|
1086
|
+
}
|
|
1076
1087
|
async network(ref, policy, { signal } = {}) {
|
|
1077
1088
|
const problem = refProblem(ref);
|
|
1078
1089
|
if (problem)
|
package/dist/phone-harness.d.ts
CHANGED
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type
|
|
3
|
-
import { type Rect, type UiNode } from "./protocol.js";
|
|
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";
|
|
1
|
+
import type { Duplex } from "node:stream";
|
|
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. */
|
|
16
10
|
export declare const DEFAULT_READY_MS = 240000;
|
|
17
11
|
/** One phone this provider made, as its ledger keeps it. */
|
|
18
12
|
export interface PhoneLedgerEntry {
|
|
19
|
-
/** The session's id, the computer's id
|
|
13
|
+
/** The session's id, the computer's id. */
|
|
20
14
|
id: string;
|
|
15
|
+
/** The computer's name, its request's (computerNameFor): a create of the same request finds the phone by it. */
|
|
16
|
+
name: string;
|
|
21
17
|
labels: Record<string, string>;
|
|
22
18
|
/** The image create was asked for, read back as asked. */
|
|
23
19
|
image: string;
|
|
@@ -39,6 +35,8 @@ export interface PhoneLedgerEntry {
|
|
|
39
35
|
/** Where the provider keeps its phones' labels: the vendor keeps none. Each call may be sync or async. */
|
|
40
36
|
export interface PhoneLedger {
|
|
41
37
|
put(entry: PhoneLedgerEntry): void | Promise<void>;
|
|
38
|
+
/** entry put only while the ledger holds none under its id, in one step (two writers never both put it): whether it was. */
|
|
39
|
+
claim(entry: PhoneLedgerEntry): boolean | Promise<boolean>;
|
|
42
40
|
get(id: string): PhoneLedgerEntry | undefined | Promise<PhoneLedgerEntry | undefined>;
|
|
43
41
|
list(): PhoneLedgerEntry[] | Promise<PhoneLedgerEntry[]>;
|
|
44
42
|
remove(id: string): void | Promise<void>;
|
|
@@ -76,6 +74,16 @@ export interface AdbTransport {
|
|
|
76
74
|
timeoutMs: number;
|
|
77
75
|
transport?: string;
|
|
78
76
|
}): Promise<Result<string>>;
|
|
77
|
+
/**
|
|
78
|
+
* A service of the phone on transport (exec:<command>) as a stream both ways: the adb server's socket, bound to the
|
|
79
|
+
* phone and then to the service, which carries the command's stdin and stdout raw once both answered OKAY. How phoned
|
|
80
|
+
* is started and spoken to. The stream comes paused, so nothing is lost before the caller listens: it resumes it. The
|
|
81
|
+
* words never hold the service.
|
|
82
|
+
*/
|
|
83
|
+
open(service: string, options: {
|
|
84
|
+
timeoutMs: number;
|
|
85
|
+
transport: string;
|
|
86
|
+
}): Promise<Result<Duplex>>;
|
|
79
87
|
}
|
|
80
88
|
/** The adb server's port when none is given: adb's own default. */
|
|
81
89
|
export declare const ADB_SERVER_PORT = 5037;
|
|
@@ -125,8 +133,15 @@ export interface PhoneProviderOptions {
|
|
|
125
133
|
sleep?: (ms: number) => Promise<void>;
|
|
126
134
|
/** A signal that fires after ms, which bounds a request; default AbortSignal.timeout. Tests give one they fire. */
|
|
127
135
|
timeout?: (ms: number) => AbortSignal;
|
|
128
|
-
/** The version
|
|
136
|
+
/** The version phoned's hello must report; default the provider's own. Only the conformance drift case sets another. */
|
|
129
137
|
daemonVersion?: string;
|
|
138
|
+
/** phoned, the phone's driver, as its jar (npm run build:phoned); default this package's dist/phoned.jar. */
|
|
139
|
+
phoned?: string;
|
|
140
|
+
/**
|
|
141
|
+
* APK files installed on each phone before phoned starts there (`pm install -r`), as the conformance run installs the
|
|
142
|
+
* ui fixture (npm run build:ui-fixture). Default none. A connect that cannot install one fails in words.
|
|
143
|
+
*/
|
|
144
|
+
apks?: string[];
|
|
130
145
|
}
|
|
131
146
|
/** The phone-harness provider from its options alone; throws in words when one is missing or wrong. */
|
|
132
147
|
export declare function create(options: PhoneProviderOptions): Promise<PhoneHarnessProvider>;
|
|
@@ -139,9 +154,12 @@ export declare class PhoneHarnessProvider implements ComputerProvider {
|
|
|
139
154
|
constructor(options: PhoneProviderOptions);
|
|
140
155
|
capabilities(): ComputerCapabilities;
|
|
141
156
|
check(spec: ComputerSpec): Refusal[];
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Makes a phone, once per request (provider.md, Idempotent create): context.requestId names it (computerNameFor) and
|
|
159
|
+
* gives the POST's Idempotency-Key. A request whose phone the ledger holds answers that phone once it is ready; one
|
|
160
|
+
* released is refused exists; a create of a request in flight here waits for the first (CreateRequests).
|
|
161
|
+
*/
|
|
162
|
+
create(spec: ComputerSpec, context: CreateContext): Promise<Result<CreatedComputer>>;
|
|
145
163
|
attach(ref: {
|
|
146
164
|
id: string;
|
|
147
165
|
} | {
|
|
@@ -165,18 +183,3 @@ export declare class PhoneHarnessProvider implements ComputerProvider {
|
|
|
165
183
|
detail: string;
|
|
166
184
|
}>>;
|
|
167
185
|
}
|
|
168
|
-
/** The frame `adb exec-out screencap` gives: a header (width, height, format, and a color space on newer Androids), then the pixels. */
|
|
169
|
-
export declare function decodeScreencap(raw: Buffer): Result<{
|
|
170
|
-
width: number;
|
|
171
|
-
height: number;
|
|
172
|
-
rgba: Buffer;
|
|
173
|
-
}>;
|
|
174
|
-
/** An 8-bit RGBA PNG, non-interlaced, of rect of a width-wide RGBA frame. The rows are deflated off the event loop: a
|
|
175
|
-
* 1080x2400 screen took about 170 ms, every request of the server this harness runs in waiting on it. */
|
|
176
|
-
export declare function encodePng(rgba: Buffer, width: number, [x, y, w, h]: Rect): Promise<Buffer>;
|
|
177
|
-
/** uiautomator's dump as the protocol's tree: one root (the window's, or one over several), at most MAX_UI_NODES nodes. */
|
|
178
|
-
export declare function parseUiTree(xml: string, [width, height]: [number, number]): Result<{
|
|
179
|
-
root: UiNode;
|
|
180
|
-
nodes: number;
|
|
181
|
-
truncated: boolean;
|
|
182
|
-
}>;
|