@parcha/agentrun-computer 0.1.0-beta.45 → 0.1.0-beta.47
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 +75 -7
- package/dist/attach.d.ts +23 -5
- package/dist/attach.js +83 -20
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/agent37.js +2 -2
- package/dist/conformance/boxd.js +2 -3
- package/dist/conformance/cli.js +1 -1
- package/dist/conformance/cloudflare.d.ts +2 -0
- package/dist/conformance/cloudflare.js +4 -0
- package/dist/conformance/e2b.js +2 -3
- package/dist/conformance/fixture.js +1 -1
- package/dist/conformance/fly.d.ts +4 -0
- package/dist/conformance/fly.js +4 -0
- package/dist/conformance/kind.d.ts +8 -1
- package/dist/conformance/kind.js +6 -1
- package/dist/conformance/modal.d.ts +4 -0
- package/dist/conformance/modal.js +5 -1
- package/dist/conformance/smolcloud.d.ts +47 -0
- package/dist/conformance/smolcloud.js +73 -0
- package/dist/conformance/sweep.js +1 -1
- package/dist/conformance/types.d.ts +2 -1
- package/dist/daytona.d.ts +1 -1
- package/dist/daytona.js +5 -6
- package/dist/descriptor.d.ts +22 -3
- package/dist/descriptor.js +31 -2
- package/dist/descriptors/cloudflare.js +1 -1
- package/dist/descriptors/daytona.d.ts +5 -13
- package/dist/descriptors/daytona.js +6 -6
- package/dist/descriptors/fly.js +1 -1
- package/dist/descriptors/index.d.ts +22 -14
- package/dist/descriptors/index.js +3 -2
- package/dist/descriptors/smolcloud.d.ts +18 -0
- package/dist/descriptors/smolcloud.js +21 -0
- package/dist/hosted/provider.js +12 -28
- package/dist/hosted/rest.d.ts +2 -0
- package/dist/hosted/rest.js +1 -1
- package/dist/hosted/values.d.ts +0 -2
- package/dist/hosted/values.js +0 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +4 -3
- package/dist/kinds.d.ts +11 -71
- package/dist/kinds.js +2 -9
- package/dist/modal.js +5 -4
- package/dist/setting-kinds.d.ts +19 -0
- package/dist/setting-kinds.js +9 -0
- package/dist/smolcloud.d.ts +21 -0
- package/dist/smolcloud.js +254 -0
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -16,7 +16,7 @@ import { checkMount, readBackOf, WORKSPACE, type MountSpec } from "@parcha/agent
|
|
|
16
16
|
|
|
17
17
|
The package root holds the protocol, the registry and the descriptors, and loads no provider: a provider loads by its
|
|
18
18
|
id (`providerFor(id, options)`, which imports that one provider's file), or from its subpath (`/docker`, `/daytona`,
|
|
19
|
-
`/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`). A provider's
|
|
19
|
+
`/modal`, `/e2b`, `/orgo`, `/orgo-desktop`, `/phone-harness`, `/browserbase`, `/kernel`, `/local-chrome`, `/boxd`, `/smolcloud`). A provider's
|
|
20
20
|
option types (`DockerProviderOptions`, `ModalProviderOptions` and the like) come from its subpath too, not the root.
|
|
21
21
|
|
|
22
22
|
The package carries the daemon for Linux amd64 and arm64 in `dist/`, so a provider runs it with no Go on the host. A
|
|
@@ -444,6 +444,7 @@ in the kernel's tool registry, keyed by these groups.
|
|
|
444
444
|
| daytona | sandbox: `DAYTONA_DEFAULT_SNAPSHOT` ("default") |
|
|
445
445
|
| modal | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
446
446
|
| e2b | none: `prepareImage()` answers the box template (`boxE2bTemplate()`), for a sandbox and a desktop alike |
|
|
447
|
+
| smolcloud | none: `prepareImage()` answers the box image (`boxImageRef()`) |
|
|
447
448
|
| orgo | desktop: `ORGO_BASE_IMAGE` ("linux") |
|
|
448
449
|
| phone-harness | phone: `PHONE_IMAGE` ("android") |
|
|
449
450
|
| browserbase, kernel, local | browser: `BROWSER_IMAGE` ("chromium") |
|
|
@@ -669,6 +670,7 @@ live under:
|
|
|
669
670
|
| `BROWSERBASE_API_KEY`, `BROWSERBASE_PROJECT_ID` | Browserbase's `apiKey`, `projectId`: the names pi-browser reads today |
|
|
670
671
|
| `KERNEL_API_KEY` | Kernel's `apiKey`: the name pi-browser reads today |
|
|
671
672
|
| `BOXD_API_KEY`, `BOXD_ORG`, `BOXD_REGION` | boxd's `apiKey`, `org` and `region` (unset: the key's own org, the API's home region) |
|
|
673
|
+
| `SMOLCLOUD_API_KEY` | smol cloud's `apiKey` |
|
|
672
674
|
|
|
673
675
|
- **the conformance CLI and the live harness** (`src/conformance/`: the CLI, each provider's conformance module and the
|
|
674
676
|
sweeps) read their own `COMPUTER_<ID>_*` names, the ones the live scripts set, through each module's
|
|
@@ -1374,7 +1376,7 @@ The conformance module, `dist/conformance/modal.js` (`--provider modal`), reads
|
|
|
1374
1376
|
(`settingsFromEnv`) and passes each to `create()` as its option: `COMPUTER_MODAL_TOKEN_ID` and
|
|
1375
1377
|
`COMPUTER_MODAL_TOKEN_SECRET` (never `MODAL_TOKEN_ID` or `MODAL_TOKEN_SECRET`: a host may hold a production token under
|
|
1376
1378
|
those names, and with only them set it refuses, naming the `COMPUTER_MODAL_` pair), `COMPUTER_MODAL_APP`, and, if set,
|
|
1377
|
-
`COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1379
|
+
`COMPUTER_MODAL_SERVER_URL` and `COMPUTER_MODAL_CONNECT` (`connect`); `createProvider()` alone also reads `COMPUTER_MODAL_KIND` (`kind`, `desktop` on dial only). It builds its provider only with `AGENTRUN_COMPUTER_LIVE_MODAL=1` set, checked before
|
|
1378
1380
|
anything else. Its `createDriftedProvider()` uploads a daemon it builds with Go as version `<version>-drift`, so Go must
|
|
1379
1381
|
be on PATH. Every computer of a run gets `maxLifetimeMs` 30 minutes. Core `provider.stop` expects Modal's refusal (it
|
|
1380
1382
|
declares no stop), and the Full `provider.janitor` case is skipped (`lifetime:janitor`, `release:stop`).
|
|
@@ -1679,11 +1681,9 @@ default) a Daytona sandbox dials the server instead ([PROVIDERS.md](PROVIDERS.md
|
|
|
1679
1681
|
no exec and no upload, and nothing goes through the toolbox: create sends the boot env as `CreateSandbox.env` and
|
|
1680
1682
|
`networkBlockAll: false` (the machine's root reaches the server; network none is init's, inside), and the snapshot's
|
|
1681
1683
|
entrypoint runs `agentrun-dial`. No Archil mount, no GPU, and not `image: "default"` (Daytona's default snapshot holds
|
|
1682
|
-
no `agentrun-dial`): `check()` refuses each in words. Labels as on exec. A
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
descriptor's desktop configuration selects `connect: "dial"` itself, so a server whose `daytonaConnect` is exec still
|
|
1686
|
-
makes its desktop over dial. **Unverified**: Xvfb and the window manager on Daytona (no live run yet). What each part rests on:
|
|
1684
|
+
no `agentrun-dial`): `check()` refuses each in words. Labels as on exec. A Daytona computer is kind `linux` alone, on
|
|
1685
|
+
dial as on exec; why: [PROVIDERS.md](PROVIDERS.md#machines-that-dial-in).
|
|
1686
|
+
What each part of a dial sandbox rests on:
|
|
1687
1687
|
|
|
1688
1688
|
- **A snapshot, never an image.** A create names a snapshot; a snapshot is made from "any publicly accessible image"
|
|
1689
1689
|
whose tag is not `latest`, `lts` or `stable` ([docs: create snapshots](https://www.daytona.io/docs/en/snapshots.md#create-snapshots)).
|
|
@@ -2827,6 +2827,74 @@ On 2026-11-16, `kind linux` passed Core again and `kind desktop` did not: 0 case
|
|
|
2827
2827
|
skipped, five because the run passed no `--fixture`, and `apps.launch-terminate` because boxd's own image lists none
|
|
2828
2828
|
of the stock apps. The desktop snapshot above is the fix for the last; it has not run live yet.
|
|
2829
2829
|
|
|
2830
|
+
## smol cloud
|
|
2831
|
+
|
|
2832
|
+
```ts
|
|
2833
|
+
import { providerFor } from "@parcha/agentrun-computer";
|
|
2834
|
+
|
|
2835
|
+
// The key is the caller's to pass (serve's SMOLCLOUD_API_KEY).
|
|
2836
|
+
const smol = await providerFor("smolcloud", { apiKey });
|
|
2837
|
+
const made = await smol.create({ image: "alpine:3.20", lifetimeMs: 600_000, network: "none" }, { requestId: "r1#3" });
|
|
2838
|
+
```
|
|
2839
|
+
|
|
2840
|
+
A smol cloud computer is kind `linux`, a [smol cloud](https://smolmachines.com) machine: a microVM booted from any OCI
|
|
2841
|
+
image, with its own kernel. With no image named, it starts from the box image, the public registry tag
|
|
2842
|
+
`prepareImage()` answers (`boxImageRef()`), which smol cloud pulls at create. smol cloud runs on the shared machine-host adapter ([PROVIDERS.md](PROVIDERS.md)):
|
|
2843
|
+
`src/smolcloud.ts` is its `MachineHost`, over smol cloud's REST API (`https://api.smolmachines.com`,
|
|
2844
|
+
`Authorization: Bearer <key>`) with `fetch` and the shared REST client.
|
|
2845
|
+
|
|
2846
|
+
| MachineHost | smol cloud |
|
|
2847
|
+
| --- | --- |
|
|
2848
|
+
| `create` | `POST /v1/machines` named `agr-<computer name>`, the image on an amd64 node, the labels, the spec's size (2 CPUs and 4 GiB unless it names one), `autoStopSeconds: 0` (the idle stop off), `ttlSeconds` to the request's backstop, `start: true`; a 409 is `exists` |
|
|
2849
|
+
| `get` | `GET /v1/machines/{id}`: `started` is running, `creating` starting, `created`, `stopped`, `pausing` and `paused` stopped, `error` and `deleting` gone (with smol cloud's `error` as why), `deleted` none |
|
|
2850
|
+
| `list` | `GET /v1/machines?label=k=v`, one `label` per label |
|
|
2851
|
+
| `delete` | `DELETE /v1/machines/{id}`; a 404 is done |
|
|
2852
|
+
| `exec` | a resumable exec started interactive (`POST /v1/machines/{id}/execs`), through `framedExec`: output read by offset with a 25 s long poll (`GET .../execs/{execId}?after=&wait=25`), stdin as numbered base64 frames of 48 KiB (`POST .../stdin`, safe to resend), `eof` to end it, `DELETE` to kill it |
|
|
2853
|
+
| `upload` | `PUT /v1/machines/{id}/files/{path}`, the bytes as they are |
|
|
2854
|
+
| `extend` | `PATCH /v1/machines/{id}/labels` with the deadline label alone |
|
|
2855
|
+
|
|
2856
|
+
What smol cloud refuses or this host works around:
|
|
2857
|
+
|
|
2858
|
+
- An argv with an empty word is refused (400 `command arguments cannot be empty`), and the adapter's scripts pass one
|
|
2859
|
+
for an unset option. Such an argv runs as one quoted line, `/bin/sh -c 'exec <argv>'`; any other runs as given. The
|
|
2860
|
+
API's own shell form (`command` as a string) is not used: it runs `sh -lc`, a login shell.
|
|
2861
|
+
- An account without a card runs 4 machines at once, so a run takes `--concurrency 4`. The cap answers 422 with the
|
|
2862
|
+
status's own code; its words (`concurrency limit reached: ...`) are read as `limit`.
|
|
2863
|
+
- Labels: at most 32, keys of `[a-z0-9._/-]`, values up to 255 characters (`facts.labels.count` is 32).
|
|
2864
|
+
- Machines are placed on amd64 nodes (`source.arch`), so the daemon uploaded is `computerd-linux-amd64`; smol cloud
|
|
2865
|
+
has arm64 nodes too, unused here.
|
|
2866
|
+
- No mount of the run's folder yet, and no desktop. smol cloud binds each machine's own storage disk at `/workspace`
|
|
2867
|
+
(an ext4 mount of `/dev/vda`), and a synced folder can be held only where nothing is mounted there, so the
|
|
2868
|
+
descriptor says so in `unmounted.sync` and serve's Mode 2 refuses a smol cloud sandbox in those words. An Archil
|
|
2869
|
+
mount is untried (`/dev/fuse` opens in the guest).
|
|
2870
|
+
|
|
2871
|
+
### Conformance on smol cloud
|
|
2872
|
+
|
|
2873
|
+
```sh
|
|
2874
|
+
AGENTRUN_COMPUTER_LIVE_SMOLCLOUD=1 COMPUTER_SMOLCLOUD_API_KEY=... \
|
|
2875
|
+
npm run conformance -w @parcha/agentrun-computer -- --provider smolcloud --long --concurrency 4
|
|
2876
|
+
node packages/computer/dist/conformance/sweep.js --provider smolcloud --before /tmp/smolcloud-before.json # then --after
|
|
2877
|
+
```
|
|
2878
|
+
|
|
2879
|
+
The conformance module, `dist/conformance/smolcloud.js`, checks `AGENTRUN_COMPUTER_LIVE_SMOLCLOUD=1` first, then reads
|
|
2880
|
+
`COMPUTER_SMOLCLOUD_API_KEY` (`apiKey`, required), `COMPUTER_SMOLCLOUD_API_URL` (`apiUrl`) and
|
|
2881
|
+
`COMPUTER_SMOLCLOUD_IMAGE` (the run's image, default the box image), never `SMOLCLOUD_API_KEY`. Every computer of a run
|
|
2882
|
+
lives at most 30 minutes. The live sweep is the shared one; its scope is the key's account.
|
|
2883
|
+
|
|
2884
|
+
### Live runs
|
|
2885
|
+
|
|
2886
|
+
On 2026-11-17, against smol cloud with an account key: the exec pre-check passed every check (8 MiB through `cat` in
|
|
2887
|
+
40 s, the stdin frames one after another; the daemon goes in through `upload` instead). The `--long` run at
|
|
2888
|
+
`--concurrency 4` passed Core 67/67 and Full 9/37 (the rest not declared) in 40 minutes; Full's `lifetime.idle` timed
|
|
2889
|
+
out while the test host lost DNS, and passed when run again on its own. An account without a card runs at most 4
|
|
2890
|
+
machines at once, and a create past that answers `422`, read as `limit`.
|
|
2891
|
+
|
|
2892
|
+
On 2026-11-18, from the box image: the exec pre-check passed every check (8 MiB through `cat` in 33 s), and the
|
|
2893
|
+
`--long` run at `--concurrency 4` passed Core 67/67 and Full 10/41 (the rest not declared, `mount:sync` among them) in
|
|
2894
|
+
18 minutes. An earlier run that day, before the descriptor said `unmounted.sync`, had every `mount.sync` case refused
|
|
2895
|
+
at create: the read back found an ext4 mount of `/dev/vda` at `/workspace`. The sweep after the last run read
|
|
2896
|
+
`{"swept":0,"gone":0,"stillThere":[],"leftAlone":0}`.
|
|
2897
|
+
|
|
2830
2898
|
## Conformance
|
|
2831
2899
|
|
|
2832
2900
|
A provider for another vendor passes the same suite as Docker's, with one command. The suite is data: each case in
|
package/dist/attach.d.ts
CHANGED
|
@@ -99,10 +99,17 @@ export interface MachineMint {
|
|
|
99
99
|
* name. Absent for a computer of no run. */
|
|
100
100
|
run?: string;
|
|
101
101
|
}
|
|
102
|
+
/** A machine token's shape, as a RegExp source without anchors or flags: `art_` and 43 base64url characters (32 bytes).
|
|
103
|
+
* computerd takes this alone (daemon/internal/attach/attach.go tokenPattern, the same source anchored); a scrub
|
|
104
|
+
* builds its global RegExp from it. */
|
|
105
|
+
export declare const MACHINE_TOKEN_SOURCE = "art_[A-Za-z0-9_-]{43}";
|
|
106
|
+
/** A new machine token, a paired computer's or a hosted machine's: `art_` and 32 random bytes in base64url
|
|
107
|
+
* (MACHINE_TOKEN_SOURCE). */
|
|
108
|
+
export declare const newMachineToken: () => string;
|
|
102
109
|
/**
|
|
103
110
|
* The tokens of hosted machines that dial (spec/computer/attach.md, Hosted machines that dial), as the server's store
|
|
104
|
-
* keeps them: HostedProvider mints one at each dial create and revokes it at the delete. A token is
|
|
105
|
-
*
|
|
111
|
+
* keeps them: HostedProvider mints one at each dial create and revokes it at the delete. A token is newMachineToken's;
|
|
112
|
+
* the store keeps only its sha256, bound to the machine and its mint, and never logs it. The
|
|
106
113
|
* server's attach upgrade and its daemon route take it while it is neither revoked nor past expiresAt, and hand its
|
|
107
114
|
* socket to the AttachHub as mintedComputer(machine, mint). machine is the computer's name, computer-<12 hex digits>,
|
|
108
115
|
* from its create's request id (computerNameFor): what the provider's connect and release are given.
|
|
@@ -184,10 +191,21 @@ export declare class AttachHub {
|
|
|
184
191
|
/** The deadline of the run that holds the computer, or undefined (no hold, or an agent's). */
|
|
185
192
|
deadline(id: string): Date | undefined;
|
|
186
193
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
194
|
+
* `answer`, a call that changes the computer (a create's files.remove or KILL), kept until it ends: computerd ends
|
|
195
|
+
* what a cancelled call started, so it has ended only when the computer answers it or its connection closes. No hold
|
|
196
|
+
* on the computer ends before that (unclaim).
|
|
189
197
|
*/
|
|
190
|
-
|
|
198
|
+
changing(id: string, answer: Promise<unknown>): void;
|
|
199
|
+
/** Resolves once no call that changes the computer runs (changing), one sent after another's answer too: at once
|
|
200
|
+
* while none does. */
|
|
201
|
+
unchanged(id: string): Promise<void>;
|
|
202
|
+
/**
|
|
203
|
+
* Ends the hold named by its token, and closes the connections it was given: at once, or while a call that changes
|
|
204
|
+
* the computer still runs (changing), once it has ended, so no next run is given a computer an earlier call still
|
|
205
|
+
* changes. A token of a hold already ended (a late release, after the deadline gave the computer to another run), or
|
|
206
|
+
* ended by another unclaim while this one waited, ends nothing: false.
|
|
207
|
+
*/
|
|
208
|
+
unclaim(id: string, hold: string): Promise<boolean>;
|
|
191
209
|
/** Ends a computer's attachment: its token was revoked, or the computer was removed. */
|
|
192
210
|
revoke(id: string, why: string): void;
|
|
193
211
|
}
|
package/dist/attach.js
CHANGED
|
@@ -93,6 +93,13 @@ export function socketStreams(socket) {
|
|
|
93
93
|
});
|
|
94
94
|
return { readable, writable };
|
|
95
95
|
}
|
|
96
|
+
/** A machine token's shape, as a RegExp source without anchors or flags: `art_` and 43 base64url characters (32 bytes).
|
|
97
|
+
* computerd takes this alone (daemon/internal/attach/attach.go tokenPattern, the same source anchored); a scrub
|
|
98
|
+
* builds its global RegExp from it. */
|
|
99
|
+
export const MACHINE_TOKEN_SOURCE = "art_[A-Za-z0-9_-]{43}";
|
|
100
|
+
/** A new machine token, a paired computer's or a hosted machine's: `art_` and 32 random bytes in base64url
|
|
101
|
+
* (MACHINE_TOKEN_SOURCE). */
|
|
102
|
+
export const newMachineToken = () => `art_${randomBytes(32).toString("base64url")}`;
|
|
96
103
|
const sha256 = (token) => createHash("sha256").update(token).digest("hex");
|
|
97
104
|
/**
|
|
98
105
|
* MachineTokens in one process's memory, as serve's store keeps them (the sha256 alone): for tests and a conformance
|
|
@@ -104,7 +111,7 @@ export class MemoryMachineTokens {
|
|
|
104
111
|
// No await in either: a mint replaces the machine's token at once, so two of one machine leave one token, not two.
|
|
105
112
|
async mint(machine, mint) {
|
|
106
113
|
this.#drop(machine);
|
|
107
|
-
const token =
|
|
114
|
+
const token = newMachineToken();
|
|
108
115
|
this.#held.set(sha256(token), { machine, mint: { ...mint } });
|
|
109
116
|
this.#hashOf.set(machine, sha256(token));
|
|
110
117
|
return token;
|
|
@@ -197,6 +204,9 @@ export class AttachHub {
|
|
|
197
204
|
#live = new Map();
|
|
198
205
|
/** The run holding each computer: the hold's own token, its labels, and its deadline with the timer that ends it. */
|
|
199
206
|
#claims = new Map();
|
|
207
|
+
/** The call still running on each computer that changes it (changing): no hold on it ends before it has ended. A
|
|
208
|
+
* create sends them one at a time, and none after its abort. */
|
|
209
|
+
#changing = new Map();
|
|
200
210
|
/** The sockets still saying hello, by computer: a revoke closes them too, so none comes back after it. */
|
|
201
211
|
#pending = new Map();
|
|
202
212
|
/** Each computer's connections given out, by the function that closes one. */
|
|
@@ -332,7 +342,7 @@ export class AttachHub {
|
|
|
332
342
|
if (this.#claims.has(id))
|
|
333
343
|
return undefined;
|
|
334
344
|
const hold = randomUUID().replaceAll("-", "").slice(0, 16);
|
|
335
|
-
const timer = deadline === undefined ? undefined : setTimeout(() => this.unclaim(id, hold), Math.max(0, deadline.getTime() - Date.now()));
|
|
345
|
+
const timer = deadline === undefined ? undefined : setTimeout(() => void this.unclaim(id, hold), Math.max(0, deadline.getTime() - Date.now()));
|
|
336
346
|
timer?.unref?.();
|
|
337
347
|
this.#claims.set(id, { hold, labels: { ...labels }, ...(deadline === undefined ? {} : { deadline, timer }) });
|
|
338
348
|
return hold;
|
|
@@ -353,23 +363,49 @@ export class AttachHub {
|
|
|
353
363
|
return this.#claims.get(id)?.deadline;
|
|
354
364
|
}
|
|
355
365
|
/**
|
|
356
|
-
*
|
|
357
|
-
*
|
|
366
|
+
* `answer`, a call that changes the computer (a create's files.remove or KILL), kept until it ends: computerd ends
|
|
367
|
+
* what a cancelled call started, so it has ended only when the computer answers it or its connection closes. No hold
|
|
368
|
+
* on the computer ends before that (unclaim).
|
|
358
369
|
*/
|
|
359
|
-
|
|
370
|
+
changing(id, answer) {
|
|
371
|
+
this.#changing.set(id, answer);
|
|
372
|
+
void answer.finally(() => {
|
|
373
|
+
if (this.#changing.get(id) === answer)
|
|
374
|
+
this.#changing.delete(id);
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
/** Resolves once no call that changes the computer runs (changing), one sent after another's answer too: at once
|
|
378
|
+
* while none does. */
|
|
379
|
+
async unchanged(id) {
|
|
380
|
+
for (let running = this.#changing.get(id); running !== undefined; running = this.#changing.get(id))
|
|
381
|
+
await Promise.allSettled([running]);
|
|
382
|
+
}
|
|
383
|
+
/**
|
|
384
|
+
* Ends the hold named by its token, and closes the connections it was given: at once, or while a call that changes
|
|
385
|
+
* the computer still runs (changing), once it has ended, so no next run is given a computer an earlier call still
|
|
386
|
+
* changes. A token of a hold already ended (a late release, after the deadline gave the computer to another run), or
|
|
387
|
+
* ended by another unclaim while this one waited, ends nothing: false.
|
|
388
|
+
*/
|
|
389
|
+
async unclaim(id, hold) {
|
|
360
390
|
const held = this.#claims.get(id);
|
|
361
391
|
if (held === undefined || held.hold !== hold)
|
|
362
392
|
return false;
|
|
393
|
+
// Checked again after each wait: a create still running sends its next remove once the last one answers.
|
|
394
|
+
while (this.#changing.has(id)) {
|
|
395
|
+
await this.unchanged(id);
|
|
396
|
+
if (this.#claims.get(id) !== held)
|
|
397
|
+
return false;
|
|
398
|
+
}
|
|
363
399
|
clearTimeout(held.timer);
|
|
364
400
|
this.#claims.delete(id);
|
|
365
401
|
this.#closeGiven(id);
|
|
366
402
|
return true;
|
|
367
403
|
}
|
|
368
|
-
/** A hold past its deadline ends at once, whether or not its timer has run yet. */
|
|
404
|
+
/** A hold past its deadline ends at once, whether or not its timer has run yet (once its changing calls end). */
|
|
369
405
|
#expire(id) {
|
|
370
406
|
const held = this.#claims.get(id);
|
|
371
407
|
if (held?.deadline !== undefined && held.deadline.getTime() <= Date.now())
|
|
372
|
-
this.unclaim(id, held.hold);
|
|
408
|
+
void this.unclaim(id, held.hold);
|
|
373
409
|
}
|
|
374
410
|
/** Ends a computer's attachment: its token was revoked, or the computer was removed. */
|
|
375
411
|
revoke(id, why) {
|
|
@@ -416,11 +452,31 @@ async function pairedWorkspaceWhy(client, name, signal) {
|
|
|
416
452
|
return ok(`${WORKSPACE} on ${name} is open to its group or others (mode ${(mode & 0o7777).toString(8).padStart(4, "0")}): ${WORKSPACE_FIX}`);
|
|
417
453
|
return ok(undefined);
|
|
418
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* A call that changes the box (files.remove, process.signal), sent with no abort of its own: computerd still ends what a
|
|
457
|
+
* cancelled call started, so the call has ended only when the box answers it or its connection closes. Its answer goes
|
|
458
|
+
* to `changing` (AttachHub.changing), which keeps the box's hold until then. The caller's own wait still ends at
|
|
459
|
+
* `signal`, and none is sent once that has aborted.
|
|
460
|
+
*/
|
|
461
|
+
function changeBox(client, changing, method, params, signal) {
|
|
462
|
+
if (signal?.aborted)
|
|
463
|
+
return Promise.resolve(fail("aborted", `${method} was aborted before it was sent`));
|
|
464
|
+
const answer = client.call(method, params);
|
|
465
|
+
changing(answer);
|
|
466
|
+
if (signal === undefined)
|
|
467
|
+
return answer;
|
|
468
|
+
const aborted = new Promise((resolve) => {
|
|
469
|
+
const onAbort = () => resolve(fail("aborted", `${method} was aborted`));
|
|
470
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
471
|
+
void answer.finally(() => signal.removeEventListener("abort", onAbort));
|
|
472
|
+
});
|
|
473
|
+
return Promise.race([answer, aborted]);
|
|
474
|
+
}
|
|
419
475
|
/** Every program computerd still runs on `name` ended, waited for up to 5 s each: the box outlives its runs, and one
|
|
420
476
|
* run holds it at a time, so a program running at a claim is an earlier run's (a background program left when its hold
|
|
421
477
|
* ended at its deadline, or its runner was lost), which could read or write the next run's folder. KILL goes to its
|
|
422
|
-
* process group; init kills what left that group once its guard is gone. */
|
|
423
|
-
async function endPrograms(client, name, signal) {
|
|
478
|
+
* process group; init kills what left that group once its guard is gone. Each KILL goes to `changing` (changeBox). */
|
|
479
|
+
async function endPrograms(client, name, changing, signal) {
|
|
424
480
|
const options = signal ? { signal } : {};
|
|
425
481
|
const words = (message) => `ending an earlier run's programs on ${name}: ${message}`;
|
|
426
482
|
for (let from = 0;;) {
|
|
@@ -428,7 +484,7 @@ async function endPrograms(client, name, signal) {
|
|
|
428
484
|
if (!listed.ok)
|
|
429
485
|
return fail(listed.error.code, words(listed.error.message));
|
|
430
486
|
for (const program of listed.value.processes.filter((one) => one.running)) {
|
|
431
|
-
const killed = await client
|
|
487
|
+
const killed = await changeBox(client, changing, "process.signal", { id: program.id, signal: "KILL" }, signal);
|
|
432
488
|
if (!killed.ok && killed.error.code !== "not_found")
|
|
433
489
|
return fail(killed.error.code, words(killed.error.message));
|
|
434
490
|
const waited = await client.call("process.wait", { id: program.id, timeoutMs: 5_000 }, options);
|
|
@@ -443,8 +499,9 @@ async function endPrograms(client, name, signal) {
|
|
|
443
499
|
/** Everything in `name`'s /workspace removed, the folder itself kept (only root makes one): each entry of its first
|
|
444
500
|
* level, a directory with what it holds, a link removed and never followed (files.remove). An entry a remove can't
|
|
445
501
|
* find (a name that is not UTF-8 reaches the wire changed) is left: a whole listing with one left, or a truncated one
|
|
446
|
-
* that a pass removes nothing of, refuses the box in words naming what was left.
|
|
447
|
-
|
|
502
|
+
* that a pass removes nothing of, refuses the box in words naming what was left. Each remove goes to `changing`
|
|
503
|
+
* (changeBox): a cancelled one's RemoveAll still deletes on the box. */
|
|
504
|
+
async function emptyWorkspace(client, name, changing, signal) {
|
|
448
505
|
const options = signal ? { signal } : {};
|
|
449
506
|
const words = (message) => `emptying ${WORKSPACE} on ${name} of an earlier run's folder: ${message}`;
|
|
450
507
|
for (;;) {
|
|
@@ -453,7 +510,7 @@ async function emptyWorkspace(client, name, signal) {
|
|
|
453
510
|
return fail(listed.error.code, words(listed.error.message));
|
|
454
511
|
const left = [];
|
|
455
512
|
for (const entry of listed.value.entries) {
|
|
456
|
-
const removed = await client
|
|
513
|
+
const removed = await changeBox(client, changing, "files.remove", { path: entry.path, recursive: true }, signal);
|
|
457
514
|
if (removed.ok)
|
|
458
515
|
continue;
|
|
459
516
|
if (removed.error.code !== "not_found")
|
|
@@ -531,11 +588,13 @@ export function attachedProvider(paired, hub) {
|
|
|
531
588
|
/** The synced folder read back from inside the box: its /workspace as pairedWorkspaceWhy holds it, else in words.
|
|
532
589
|
* `fresh`: what an earlier run left is ended and removed first, its programs (endPrograms) and then each entry of the
|
|
533
590
|
* folder (a link removed and never followed), so the run's push goes into an empty folder no other run's program
|
|
534
|
-
* reaches, as into a hosted computer's new one.
|
|
591
|
+
* reaches, as into a hosted computer's new one. Each of those calls that changes the box is the hub's (changing)
|
|
592
|
+
* until it has ended, and the connection is closed only then, as a close would drop their answers. */
|
|
535
593
|
const folder = async (signal, fresh = false) => {
|
|
536
594
|
const connection = hub.connection(paired.id);
|
|
537
595
|
if (connection === undefined)
|
|
538
596
|
return offline();
|
|
597
|
+
const changing = (answer) => hub.changing(paired.id, answer);
|
|
539
598
|
try {
|
|
540
599
|
const why = await pairedWorkspaceWhy(connection.client, paired.name, signal);
|
|
541
600
|
if (!why.ok)
|
|
@@ -543,17 +602,17 @@ export function attachedProvider(paired, hub) {
|
|
|
543
602
|
if (why.value !== undefined)
|
|
544
603
|
return ok({ other: why.value });
|
|
545
604
|
if (fresh) {
|
|
546
|
-
const stopped = await endPrograms(connection.client, paired.name, signal);
|
|
605
|
+
const stopped = await endPrograms(connection.client, paired.name, changing, signal);
|
|
547
606
|
if (!stopped.ok)
|
|
548
607
|
return stopped;
|
|
549
|
-
const emptied = await emptyWorkspace(connection.client, paired.name, signal);
|
|
608
|
+
const emptied = await emptyWorkspace(connection.client, paired.name, changing, signal);
|
|
550
609
|
if (!emptied.ok)
|
|
551
610
|
return emptied;
|
|
552
611
|
}
|
|
553
612
|
return ok(recorded());
|
|
554
613
|
}
|
|
555
614
|
finally {
|
|
556
|
-
|
|
615
|
+
void hub.unchanged(paired.id).then(() => connection.close());
|
|
557
616
|
}
|
|
558
617
|
};
|
|
559
618
|
return {
|
|
@@ -612,7 +671,10 @@ export function attachedProvider(paired, hub) {
|
|
|
612
671
|
const answer = (async () => {
|
|
613
672
|
const read = await folder(context.signal, true);
|
|
614
673
|
if (!read.ok || "other" in read.value) {
|
|
615
|
-
|
|
674
|
+
// A cancelled create answers at once, but the box may still run a remove or KILL it stopped waiting for: the
|
|
675
|
+
// hold is let go once each has answered or its connection closed (unclaim), so no next run's folder lands
|
|
676
|
+
// under it.
|
|
677
|
+
void hub.unclaim(paired.id, hold);
|
|
616
678
|
return read.ok ? fail("refused", read.value.other) : read;
|
|
617
679
|
}
|
|
618
680
|
syncedHold = hold;
|
|
@@ -672,8 +734,9 @@ export function attachedProvider(paired, hub) {
|
|
|
672
734
|
return fail("unsupported", `${paired.name} is a person's own machine: a run releases its hold, and never stops it`);
|
|
673
735
|
if (which.hold === undefined)
|
|
674
736
|
return fail("invalid", `release names the run's hold on ${paired.name}, the ref create gave (${paired.id}.<hold>), never the computer itself`);
|
|
675
|
-
// A hold already ended is released already: the hold on the computer now, if any, is another run's and stays.
|
|
676
|
-
|
|
737
|
+
// A hold already ended is released already: the hold on the computer now, if any, is another run's and stays. A
|
|
738
|
+
// release while a create's remove or KILL still runs on the box answers once the hold has ended, after it.
|
|
739
|
+
await hub.unclaim(paired.id, which.hold);
|
|
677
740
|
return ok(undefined);
|
|
678
741
|
},
|
|
679
742
|
};
|
|
Binary file
|
|
Binary file
|
package/dist/computerd.json
CHANGED
|
@@ -22,6 +22,7 @@ import { create, workspaceOf } from "../agent37.js";
|
|
|
22
22
|
import { AGENT37_BASE_TEMPLATE } from "../descriptors/agent37.js";
|
|
23
23
|
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
24
24
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
25
|
+
import { kindFrom } from "./kind.js";
|
|
25
26
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
26
27
|
export { ARCHIL_ENV } from "./archil.js";
|
|
27
28
|
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
|
|
@@ -69,14 +70,13 @@ export function settingsFromEnv(env = process.env) {
|
|
|
69
70
|
const apiUrl = env[AGENT37_ENV.apiUrl] || undefined;
|
|
70
71
|
const daemonPath = env[AGENT37_ENV.daemon] || undefined;
|
|
71
72
|
const daemonUser = env[AGENT37_ENV.user] || undefined;
|
|
72
|
-
const kind = env[AGENT37_ENV.kind] || undefined;
|
|
73
73
|
return {
|
|
74
74
|
apiKey,
|
|
75
75
|
sshKey,
|
|
76
76
|
// create() refuses any other type or region in words.
|
|
77
77
|
...(type === undefined ? {} : { type: type }),
|
|
78
78
|
...(region === undefined ? {} : { region: region }),
|
|
79
|
-
...(
|
|
79
|
+
...kindFrom(env, AGENT37_ENV.kind),
|
|
80
80
|
...(apiUrl === undefined ? {} : { apiUrl }),
|
|
81
81
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
82
82
|
...(lifetime === undefined ? {} : { maxLifetimeMs: Number(lifetime) }),
|
package/dist/conformance/boxd.js
CHANGED
|
@@ -13,6 +13,7 @@ import { createHash } from "node:crypto";
|
|
|
13
13
|
import { BOXD_DEFAULT_IMAGE } from "../descriptors/boxd.js";
|
|
14
14
|
import { create } from "../boxd.js";
|
|
15
15
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
16
|
+
import { kindFrom } from "./kind.js";
|
|
16
17
|
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's image. */
|
|
17
18
|
export const BOXD_ENV = {
|
|
18
19
|
live: "AGENTRUN_COMPUTER_LIVE_BOXD",
|
|
@@ -44,15 +45,13 @@ export function settingsFromEnv(env = process.env) {
|
|
|
44
45
|
const org = env[BOXD_ENV.org] || undefined;
|
|
45
46
|
const region = env[BOXD_ENV.region] || undefined;
|
|
46
47
|
const daemonPath = env[BOXD_ENV.daemon] || undefined;
|
|
47
|
-
const kind = env[BOXD_ENV.kind] || undefined;
|
|
48
48
|
const daemonUser = env[BOXD_ENV.user] || undefined;
|
|
49
49
|
return {
|
|
50
50
|
apiKey,
|
|
51
51
|
...(org === undefined ? {} : { org }),
|
|
52
52
|
...(region === undefined ? {} : { region }),
|
|
53
53
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
54
|
-
|
|
55
|
-
...(kind === undefined ? {} : { kind: kind }),
|
|
54
|
+
...kindFrom(env, BOXD_ENV.kind),
|
|
56
55
|
...(daemonUser === undefined ? {} : { daemonUser }),
|
|
57
56
|
};
|
|
58
57
|
}
|
package/dist/conformance/cli.js
CHANGED
|
@@ -10,7 +10,7 @@ import { resolve } from "node:path";
|
|
|
10
10
|
import { pathToFileURL } from "node:url";
|
|
11
11
|
import { isCommand } from "../entry.js";
|
|
12
12
|
import { descriptorOf, isProviderId, providerIds, providerModule } from "../providers.js";
|
|
13
|
-
import { SETTING_KIND_NAMES } from "../kinds.js";
|
|
13
|
+
import { SETTING_KIND_NAMES } from "../setting-kinds.js";
|
|
14
14
|
import { browserCases, casesFor, conformanceCases } from "./cases/index.js";
|
|
15
15
|
import { checkExecStream, DEFAULT_LONG_MS, formatExecStream, QUICK_LONG_MS } from "./exec-stream.js";
|
|
16
16
|
import { kindRunProblem } from "./kind.js";
|
|
@@ -8,6 +8,8 @@ export declare const ENV: {
|
|
|
8
8
|
readonly url: "COMPUTER_CLOUDFLARE_RELAY_URL";
|
|
9
9
|
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
10
10
|
readonly token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN";
|
|
11
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
12
|
+
readonly kind: "COMPUTER_CLOUDFLARE_KIND";
|
|
11
13
|
};
|
|
12
14
|
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
13
15
|
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
// as its option. The live sweep (sweep.ts, --provider cloudflare) reads the same names through createHost.
|
|
8
8
|
import { create } from "../cloudflare.js";
|
|
9
9
|
import { dialOnlyFromServer } from "./dial-only.js";
|
|
10
|
+
import { kindFrom } from "./kind.js";
|
|
10
11
|
/** The environment this module reads, by name, each for the option its comment names. */
|
|
11
12
|
export const ENV = {
|
|
12
13
|
/** relayUrl, required: the relay Worker's https address. */
|
|
13
14
|
url: "COMPUTER_CLOUDFLARE_RELAY_URL",
|
|
14
15
|
/** relayToken, required: the relay's RELAY_TOKEN. */
|
|
15
16
|
token: "COMPUTER_CLOUDFLARE_RELAY_TOKEN",
|
|
17
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
18
|
+
kind: "COMPUTER_CLOUDFLARE_KIND",
|
|
16
19
|
};
|
|
17
20
|
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each container by then. */
|
|
18
21
|
export const CONFORMANCE_MAX_LIFETIME_MS = 30 * 60_000;
|
|
@@ -28,6 +31,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
28
31
|
export function createProvider({ env = process.env, dial, daemonPath, fetch, onNote } = {}) {
|
|
29
32
|
return create({
|
|
30
33
|
...settingsFromEnv(env),
|
|
34
|
+
...kindFrom(env, ENV.kind),
|
|
31
35
|
...(dial ? { dial } : {}),
|
|
32
36
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
33
37
|
...(fetch ? { fetch } : {}),
|
package/dist/conformance/e2b.js
CHANGED
|
@@ -20,6 +20,7 @@ import { create } from "../e2b.js";
|
|
|
20
20
|
import { archilRunFolder, archilSettings } from "./archil.js";
|
|
21
21
|
import { dialOnlyFromServer } from "./dial-only.js";
|
|
22
22
|
import { buildDriftDaemon, DRIFT_VERSION } from "./drift-daemon.js";
|
|
23
|
+
import { kindFrom } from "./kind.js";
|
|
23
24
|
/** The Archil disk's settings for the mount cases, by name (COMPUTER_ARCHIL_*: all five, or none). */
|
|
24
25
|
export { ARCHIL_ENV } from "./archil.js";
|
|
25
26
|
/** The environment this module reads, by name, each for the option its comment names, the live switch and the run's template. */
|
|
@@ -60,7 +61,6 @@ export function settingsFromEnv(env = process.env) {
|
|
|
60
61
|
throw new Error(`${E2B_ENV.maxLifetimeMs} is a whole number of milliseconds, such as 3600000 (Hobby) or 86400000 (Pro)`);
|
|
61
62
|
const domain = env[E2B_ENV.domain] || undefined;
|
|
62
63
|
const daemonPath = env[E2B_ENV.daemon] || undefined;
|
|
63
|
-
const kind = env[E2B_ENV.kind] || undefined;
|
|
64
64
|
const daemonUser = env[E2B_ENV.user] || undefined;
|
|
65
65
|
const connect = env[E2B_ENV.connect] || undefined;
|
|
66
66
|
return {
|
|
@@ -69,8 +69,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
69
69
|
...(connect === undefined ? {} : { connect: connect }),
|
|
70
70
|
...(domain === undefined ? {} : { domain }),
|
|
71
71
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
72
|
-
|
|
73
|
-
...(kind === undefined ? {} : { kind: kind }),
|
|
72
|
+
...kindFrom(env, E2B_ENV.kind),
|
|
74
73
|
...(lifetime === undefined ? {} : { maxLifetimeMs: Number(lifetime) }),
|
|
75
74
|
...(daemonUser === undefined ? {} : { daemonUser }),
|
|
76
75
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// The model-free fixtures the screen, input, touch and apps cases check effects with. A fixture is an app that logs
|
|
2
2
|
// every input event it gets as one JSON line in a file the case reads over files. On a desktop it is computerd-fixture,
|
|
3
|
-
// a
|
|
3
|
+
// a static binary the server's image carries for dial conformance: a 200x200 override-redirect window at (0, 0) in four known colors, which grabs focus. On
|
|
4
4
|
// Android it is a small APK that logs touches and its own launch to its files directory and shows a button with a fixed
|
|
5
5
|
// id. This file is their contract: the binary and the APK come with the PRs that first run them. On a Windows desktop it
|
|
6
6
|
// is a PowerShell script this package carries (windows-fixture.ts), the same window, started detached with Start-Process.
|
|
@@ -9,6 +9,8 @@ export declare const FLY_ENV: {
|
|
|
9
9
|
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
10
10
|
/** app, required: the Fly app the run's machines live in. */
|
|
11
11
|
readonly app: "COMPUTER_FLY_APP";
|
|
12
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
13
|
+
readonly kind: "COMPUTER_FLY_KIND";
|
|
12
14
|
};
|
|
13
15
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
14
16
|
export declare const ENV: {
|
|
@@ -16,6 +18,8 @@ export declare const ENV: {
|
|
|
16
18
|
readonly token: "COMPUTER_FLY_API_TOKEN";
|
|
17
19
|
/** app, required: the Fly app the run's machines live in. */
|
|
18
20
|
readonly app: "COMPUTER_FLY_APP";
|
|
21
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
22
|
+
readonly kind: "COMPUTER_FLY_KIND";
|
|
19
23
|
};
|
|
20
24
|
/** The longest lifetime a computer of a run may ask for: init's deadline and the janitor end each machine by then. */
|
|
21
25
|
export declare const CONFORMANCE_MAX_LIFETIME_MS: number;
|
package/dist/conformance/fly.js
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { boxImageRef } from "../box-image.js";
|
|
2
2
|
import { create } from "../fly.js";
|
|
3
|
+
import { kindFrom } from "./kind.js";
|
|
3
4
|
/** The environment this module reads, by name, each for the option its comment names. */
|
|
4
5
|
export const FLY_ENV = {
|
|
5
6
|
/** apiToken, required: a Fly API token that may make machines in the app. */
|
|
6
7
|
token: "COMPUTER_FLY_API_TOKEN",
|
|
7
8
|
/** app, required: the Fly app the run's machines live in. */
|
|
8
9
|
app: "COMPUTER_FLY_APP",
|
|
10
|
+
/** kind: linux (default) or desktop, which needs the public server's process (dialKit). */
|
|
11
|
+
kind: "COMPUTER_FLY_KIND",
|
|
9
12
|
};
|
|
10
13
|
/** The names this module reads, under the conformance modules' common name (ConformanceModule.ENV). */
|
|
11
14
|
export const ENV = FLY_ENV;
|
|
@@ -23,6 +26,7 @@ export function settingsFromEnv(env = process.env) {
|
|
|
23
26
|
export function createProvider({ env = process.env, dial, daemonPath, fetch, onNote } = {}) {
|
|
24
27
|
return create({
|
|
25
28
|
...settingsFromEnv(env),
|
|
29
|
+
...kindFrom(env, FLY_ENV.kind),
|
|
26
30
|
...(dial ? { dial } : {}),
|
|
27
31
|
...(daemonPath === undefined ? {} : { daemonPath }),
|
|
28
32
|
...(fetch ? { fetch } : {}),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type KindCapabilities } from "../kinds.js";
|
|
2
|
+
import { type ComputerSettingKind } from "../setting-kinds.js";
|
|
2
3
|
import type { Case, ConformanceReport } from "./types.js";
|
|
3
4
|
/** A kind's verdict: pass, or fail with why, in words. */
|
|
4
5
|
export interface KindVerdict {
|
|
@@ -6,6 +7,12 @@ export interface KindVerdict {
|
|
|
6
7
|
verdict: "pass" | "fail";
|
|
7
8
|
reasons: string[];
|
|
8
9
|
}
|
|
10
|
+
/** A hosted provider module's kind from its env variable `name` (COMPUTER_<VENDOR>_KIND), as create() options: none
|
|
11
|
+
* when it is unset or empty (the provider's default), else what it says, which create() refuses in words unless it is
|
|
12
|
+
* desktop or linux. */
|
|
13
|
+
export declare const kindFrom: (env: Record<string, string | undefined>, name: string) => {
|
|
14
|
+
kind?: "desktop" | "linux";
|
|
15
|
+
};
|
|
9
16
|
/** Why a run cannot be by this kind, in words; undefined when it can. Kind none is no computer. */
|
|
10
17
|
export declare function kindRunProblem(kind: ComputerSettingKind): string | undefined;
|
|
11
18
|
/**
|
package/dist/conformance/kind.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
// Conformance by kind: the cases a setting kind runs, and whether a provider passes it. One table with the registry
|
|
2
2
|
// (src/kinds.ts): a kind's cases are those whose protocol groups it requires or allows, and a provider passes the kind
|
|
3
3
|
// only when it serves it and every case of each required group passes, at least one of them.
|
|
4
|
-
import {
|
|
4
|
+
import { servingRefusals } from "../kinds.js";
|
|
5
|
+
import { SETTING_KIND_NAMES, SETTING_KINDS } from "../setting-kinds.js";
|
|
5
6
|
import { GROUPS } from "../protocol.js";
|
|
6
7
|
import { casesFor } from "./cases/index.js";
|
|
7
8
|
const groupsOf = (c) => c.needs.filter((need) => GROUPS.includes(need));
|
|
9
|
+
/** A hosted provider module's kind from its env variable `name` (COMPUTER_<VENDOR>_KIND), as create() options: none
|
|
10
|
+
* when it is unset or empty (the provider's default), else what it says, which create() refuses in words unless it is
|
|
11
|
+
* desktop or linux. */
|
|
12
|
+
export const kindFrom = (env, name) => (env[name] ? { kind: env[name] } : {});
|
|
8
13
|
/** Why a run cannot be by this kind, in words; undefined when it can. Kind none is no computer. */
|
|
9
14
|
export function kindRunProblem(kind) {
|
|
10
15
|
const spec = Object.hasOwn(SETTING_KINDS, kind) ? SETTING_KINDS[kind] : undefined;
|