@parcha/agentrun-computer 0.1.0-beta.37 → 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/README.md +259 -203
- package/box/Dockerfile +18 -1
- package/box/README.md +13 -0
- package/box/build-agent37.mjs +8 -27
- 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 +2 -63
- package/dist/agent37.js +104 -461
- 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/cases/apps.d.ts +6 -0
- package/dist/conformance/cases/apps.js +18 -5
- 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/cli.js +66 -6
- package/dist/conformance/daytona.d.ts +9 -20
- package/dist/conformance/daytona.js +12 -21
- package/dist/conformance/exec-stream.d.ts +45 -0
- package/dist/conformance/exec-stream.js +486 -0
- 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 +20 -131
- package/dist/daytona.js +405 -1450
- package/dist/descriptor.d.ts +6 -1
- package/dist/descriptor.js +7 -0
- package/dist/descriptors/agent37.d.ts +1 -1
- package/dist/descriptors/agent37.js +1 -1
- package/dist/descriptors/daytona.d.ts +6 -5
- package/dist/descriptors/daytona.js +9 -5
- package/dist/descriptors/index.d.ts +4 -5
- 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 +0 -6
- package/dist/docker.js +1 -5
- package/dist/drift.js +4 -4
- package/dist/e2b.d.ts +10 -128
- package/dist/e2b.js +130 -233
- package/dist/host.d.ts +106 -87
- package/dist/host.js +8 -1
- package/dist/hosted/process.d.ts +22 -8
- package/dist/hosted/process.js +75 -44
- package/dist/hosted/provider.d.ts +35 -21
- package/dist/hosted/provider.js +312 -261
- package/dist/hosted/rest.d.ts +66 -0
- package/dist/hosted/rest.js +121 -0
- package/dist/hosted/scripts.d.ts +8 -2
- package/dist/hosted/scripts.js +27 -2
- package/dist/hosted/values.d.ts +5 -0
- package/dist/hosted/values.js +8 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- 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 +7 -84
- package/dist/modal.js +50 -174
- 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.d.ts +0 -9
- package/dist/orgo.js +2 -9
- 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 +11 -12
- package/dist/screen-watch.js +34 -6
- package/dist/surface/api.d.ts +14 -2
- package/dist/surface/core.d.ts +16 -3
- package/dist/surface/core.js +95 -13
- package/dist/surface/outline.d.ts +2 -0
- package/dist/surface/outline.js +2 -1
- package/dist/surface/script.js +2 -0
- package/dist/ui-engine.js +19 -3
- package/package.json +2 -3
- package/dist/conformance/daytona-sweep.d.ts +0 -18
- package/dist/conformance/daytona-sweep.js +0 -126
package/dist/modal.js
CHANGED
|
@@ -1,28 +1,10 @@
|
|
|
1
|
-
// The Modal host: Modal sandboxes on the VM runtime, and on gVisor for a GPU computer (Modal's one GPU runtime), every
|
|
2
|
-
// call through the host's own Modal JS SDK client, of which this package names only the slice it uses (ModalSdk) and
|
|
3
|
-
// imports nothing. A Modal sandbox's command is its main process, so computerd is pid1: the sandbox's command is the
|
|
4
|
-
// shared entrypoint, which waits for the daemon and becomes init, and Modal finishes the sandbox when init exits. Modal
|
|
5
|
-
// has no file API, so the daemon goes in through exec's stdin; it has no kill for an exec (closing stdin ends one), and
|
|
6
|
-
// reads no network back, so the probe from inside stands for network none. The rest of the computer is the shared
|
|
7
|
-
// machine-host adapter's (./hosted/provider.ts). Every SDK fact below is cited in the README's Modal section, from
|
|
8
|
-
// modal-client@64880502 (js/src) and Modal's docs.
|
|
9
1
|
import { MODAL, MODAL_DEFAULT_IMAGE, MODAL_GPU } from "./descriptors/modal.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import { ARCHIL_MOUNT_LABEL, archilLabels } from "./mount-archil.js";
|
|
15
|
-
import { failFor, ok } from "./result.js";
|
|
16
|
-
/** This module's failures: one with code vendor names Modal. */
|
|
17
|
-
const fail = failFor("modal");
|
|
18
|
-
/** The mount kinds a Modal computer takes, as capabilities().mount declares them: the run's folder on an Archil disk. */
|
|
19
|
-
export const MOUNT = MODAL.mounts;
|
|
20
|
-
/** A copy of its descriptor's MODAL_GPU, so no caller can change the provider's own. */
|
|
21
|
-
const modalGpuCapability = () => ({ ...MODAL_GPU, types: [...MODAL_GPU.types], mounts: [] });
|
|
2
|
+
import { DEFAULT_CPUS, DEFAULT_MEMORY_MB, WORK } from "./drift.js";
|
|
3
|
+
import { HostError } from "./host.js";
|
|
4
|
+
import { HostedProvider } from "./hosted/provider.js";
|
|
5
|
+
import { isWhole } from "./hosted/values.js";
|
|
22
6
|
/** A GPU as the SDK takes it: the type, then :count past one ("T4", "H100:8"). */
|
|
23
7
|
const modalGpu = ({ type, count }) => (count === 1 ? type : `${type}:${count}`);
|
|
24
|
-
/** The machine kind, groups and GPUs of its one configuration (its descriptor's): a linux computer, with GPUs when asked. */
|
|
25
|
-
export const CAPABILITIES = MODAL.capabilities;
|
|
26
8
|
/** The SDK's default server (modal-client@64880502:js/src/config.ts:143). */
|
|
27
9
|
export const MODAL_DEFAULT_SERVER_URL = "https://api.modal.com:443";
|
|
28
10
|
/** Not a literal, so no type checker or bundler resolves the SDK from this package. */
|
|
@@ -108,11 +90,7 @@ const CPUS_PER_CORE = 2;
|
|
|
108
90
|
* terminate is asynchronous, and the daemon is streamed in through exec.
|
|
109
91
|
*/
|
|
110
92
|
const MODAL_TIMEOUTS = { requestMs: 60_000, createMs: 600_000, uploadMs: 300_000, listMs: 120_000, goneMs: 120_000, pollMs: 500, mountMs: 120_000 };
|
|
111
|
-
/** An Archil folder agents/<agent>/runs/<run>/work, the shape the shared check holds it to. */
|
|
112
|
-
const FOLDER = /^agents\/([^/]+)\/runs\/([^/]+)\/work$/;
|
|
113
93
|
const isNumber = (value) => typeof value === "number" && Number.isFinite(value);
|
|
114
|
-
const isWhole = (value) => typeof value === "number" && Number.isSafeInteger(value);
|
|
115
|
-
const isLabels = (value) => typeof value === "object" && value !== null && !Array.isArray(value) && Object.values(value).every((one) => typeof one === "string");
|
|
116
94
|
/** The SDK names its errors (js/src/errors.ts); a call that failed on the wire carries a gRPC status code. */
|
|
117
95
|
function codeOf(error) {
|
|
118
96
|
const { name, code } = (error ?? {});
|
|
@@ -129,68 +107,9 @@ function codeOf(error) {
|
|
|
129
107
|
return "gone";
|
|
130
108
|
return "vendor";
|
|
131
109
|
}
|
|
132
|
-
/**
|
|
133
|
-
* The tags a sandbox carries for a machine's labels. Every label is its own tag, with one exception that keeps an
|
|
134
|
-
* Archil computer within Modal's 512 bytes: the mount label's folder, agents/<agent>/runs/<run>/work, names the run its
|
|
135
|
-
* agentrun.run label holds, so the tag records the agent alone, and labelsOf puts the folder back.
|
|
136
|
-
*/
|
|
137
|
-
export function tagsOf(labels) {
|
|
138
|
-
const tags = { ...labels };
|
|
139
|
-
const text = labels[ARCHIL_MOUNT_LABEL];
|
|
140
|
-
if (text === undefined)
|
|
141
|
-
return tags;
|
|
142
|
-
let mount;
|
|
143
|
-
try {
|
|
144
|
-
mount = JSON.parse(text);
|
|
145
|
-
}
|
|
146
|
-
catch {
|
|
147
|
-
return tags;
|
|
148
|
-
}
|
|
149
|
-
const { kind, disk, region, folder } = mount ?? {};
|
|
150
|
-
const found = typeof folder === "string" ? FOLDER.exec(folder) : null;
|
|
151
|
-
// Only a label exactly as the adapter writes it (archilLabels) is shortened, so labelsOf gives back the same text.
|
|
152
|
-
if (found === null || found[2] !== labels[RUN_LABEL] || text !== archilLabels({ kind: "archil", disk, region, folder })[ARCHIL_MOUNT_LABEL])
|
|
153
|
-
return tags;
|
|
154
|
-
tags[ARCHIL_MOUNT_LABEL] = JSON.stringify({ kind, disk, region, agent: found[1] });
|
|
155
|
-
return tags;
|
|
156
|
-
}
|
|
157
|
-
/** A sandbox's labels from its tags: tagsOf undone. */
|
|
158
|
-
export function labelsOf(tags) {
|
|
159
|
-
const labels = { ...tags };
|
|
160
|
-
const text = tags[ARCHIL_MOUNT_LABEL];
|
|
161
|
-
const run = tags[RUN_LABEL];
|
|
162
|
-
if (text === undefined || run === undefined)
|
|
163
|
-
return labels;
|
|
164
|
-
try {
|
|
165
|
-
const { kind, disk, region, agent, ...rest } = (JSON.parse(text) ?? {});
|
|
166
|
-
if (kind !== "archil" || typeof disk !== "string" || typeof region !== "string" || typeof agent !== "string" || Object.keys(rest).length > 0)
|
|
167
|
-
return labels;
|
|
168
|
-
Object.assign(labels, archilLabels({ kind: "archil", disk, region, folder: `agents/${agent}/runs/${run}/work` }));
|
|
169
|
-
}
|
|
170
|
-
catch {
|
|
171
|
-
// Not the shortened mount: the tag as it is.
|
|
172
|
-
}
|
|
173
|
-
return labels;
|
|
174
|
-
}
|
|
175
|
-
/** The bytes Modal counts of `tags`: every name and value, in UTF-8. */
|
|
176
|
-
const tagBytes = (tags) => Object.entries(tags).reduce((sum, [key, value]) => sum + Buffer.byteLength(key) + Buffer.byteLength(value), 0);
|
|
177
|
-
/** A sandbox's tags as the adapter would make them of spec: its labels, the adapter's own, its name and deadline as long as create's. */
|
|
178
|
-
function tagsForSpec(spec) {
|
|
179
|
-
const at = new Date(0).toISOString();
|
|
180
|
-
const own = { [COMPUTER_LABEL]: "1", [NAME_LABEL]: "computer-000000000000", [DEADLINE_LABEL]: at, [IMAGE_LABEL]: spec.image, [MAX_LABEL]: at };
|
|
181
|
-
return tagsOf({ ...spec.labels, ...own, ...(spec.mount?.kind === "archil" ? archilLabels(spec.mount) : {}) });
|
|
182
|
-
}
|
|
183
|
-
/** Why tags are past Modal's bound, or undefined. */
|
|
184
|
-
function tagProblem(tags) {
|
|
185
|
-
const bytes = tagBytes(tags);
|
|
186
|
-
if (bytes <= MAX_TAG_BYTES)
|
|
187
|
-
return undefined;
|
|
188
|
-
const sizes = Object.entries(tags).map(([key, value]) => `${key} ${Buffer.byteLength(key) + Buffer.byteLength(value)}`).join(", ");
|
|
189
|
-
return `a Modal sandbox's tags come to at most ${MAX_TAG_BYTES} bytes, names and values together, and this computer's would come to ${bytes} (${sizes}): give a shorter image, mount folder or labels`;
|
|
190
|
-
}
|
|
191
110
|
/** Modal's sandboxes as a MachineHost (../host.ts). */
|
|
192
111
|
class ModalHost {
|
|
193
|
-
|
|
112
|
+
descriptor = MODAL;
|
|
194
113
|
facts;
|
|
195
114
|
#sdk;
|
|
196
115
|
#appName;
|
|
@@ -212,48 +131,44 @@ class ModalHost {
|
|
|
212
131
|
arch: "amd64",
|
|
213
132
|
// No listener of Modal's own inside a sandbox is documented, so none is declared.
|
|
214
133
|
vendorAgentPorts: [],
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
mounts: [...MOUNT],
|
|
218
|
-
release: ["delete"],
|
|
219
|
-
gpu: modalGpuCapability(),
|
|
134
|
+
// capabilities() reads a copy, so no caller can change the descriptor's own.
|
|
135
|
+
gpu: MODAL_GPU,
|
|
220
136
|
// Never root: each connection is Modal's exec of the stdio bridge, as Modal's root, outside the daemon.
|
|
221
137
|
user: ["uid"],
|
|
222
138
|
specFields: ["cpus", "memoryMb", "user"],
|
|
223
|
-
labelRules: { max: MAX_TAGS },
|
|
139
|
+
labelRules: { max: MAX_TAGS, maxBytes: MAX_TAG_BYTES, measure: "pairs" },
|
|
224
140
|
runtime: (req) => (req.gpu === undefined ? "vm" : "gvisor"),
|
|
225
141
|
};
|
|
226
142
|
}
|
|
227
143
|
errorCode(error) {
|
|
228
144
|
return codeOf(error);
|
|
229
145
|
}
|
|
230
|
-
/**
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
/** The sandbox with an id: the one create gave, or sandboxes.fromId; undefined when Modal does not know it. */
|
|
236
|
-
async #sandbox(id) {
|
|
237
|
-
const known = this.#sandboxes.get(id);
|
|
238
|
-
if (known !== undefined)
|
|
239
|
-
return known;
|
|
146
|
+
/**
|
|
147
|
+
* The app, looked up once per provider, and made when missing by create alone: a listing before any computer makes
|
|
148
|
+
* nothing and finds none (undefined). A failed or missing lookup is tried again next time.
|
|
149
|
+
*/
|
|
150
|
+
async #theApp(make) {
|
|
240
151
|
try {
|
|
241
|
-
|
|
152
|
+
this.#app ??= await this.#sdk.apps.fromName(this.#appName, { createIfMissing: make });
|
|
242
153
|
}
|
|
243
154
|
catch (error) {
|
|
244
|
-
if (codeOf(error)
|
|
245
|
-
|
|
246
|
-
throw error;
|
|
155
|
+
if (make || codeOf(error) !== "not_found")
|
|
156
|
+
throw error;
|
|
247
157
|
}
|
|
158
|
+
return this.#app;
|
|
159
|
+
}
|
|
160
|
+
/** The sandbox with an id: the one create gave, or sandboxes.fromId, which throws NotFoundError for one Modal does not know. */
|
|
161
|
+
async #sandbox(id) {
|
|
162
|
+
return this.#sandboxes.get(id) ?? this.#sdk.sandboxes.fromId(id);
|
|
248
163
|
}
|
|
249
164
|
/**
|
|
250
165
|
* Modal's own rules of a spec, over the adapter's: an image Modal can pull or holds (no option, no space), sizes in
|
|
251
|
-
* the units Modal takes
|
|
166
|
+
* the units Modal takes. No call; the adapter holds the tags to Modal's 512 bytes (labelRules).
|
|
252
167
|
*/
|
|
253
168
|
check(spec) {
|
|
254
169
|
const refusals = [];
|
|
255
170
|
const refuse = (field, message) => refusals.push({ field, message });
|
|
256
|
-
const { image, cpus, memoryMb
|
|
171
|
+
const { image, cpus, memoryMb } = spec;
|
|
257
172
|
if (typeof image === "string" && (image.startsWith("-") || /\s/.test(image))) {
|
|
258
173
|
refuse("image", `an image is a registry tag for linux/amd64 that Modal can pull, such as ${MODAL_DEFAULT_IMAGE}, or an image Modal holds by its id (im-...)`);
|
|
259
174
|
}
|
|
@@ -262,12 +177,6 @@ class ModalHost {
|
|
|
262
177
|
}
|
|
263
178
|
if (memoryMb !== undefined && !(isWhole(memoryMb) && memoryMb > 0))
|
|
264
179
|
refuse("memoryMb", "memoryMb must be a whole number of MiB above 0");
|
|
265
|
-
const archil = mount === undefined || (mount?.kind === "archil" && ["disk", "region", "folder"].every((key) => typeof mount[key] === "string"));
|
|
266
|
-
if (refusals.length === 0 && typeof image === "string" && (labels === undefined || isLabels(labels)) && archil) {
|
|
267
|
-
const problem = tagProblem(tagsForSpec(spec));
|
|
268
|
-
if (problem)
|
|
269
|
-
refuse(mount === undefined ? "labels" : "mount", problem);
|
|
270
|
-
}
|
|
271
180
|
return refusals;
|
|
272
181
|
}
|
|
273
182
|
/**
|
|
@@ -279,16 +188,12 @@ class ModalHost {
|
|
|
279
188
|
async create(req, ctx) {
|
|
280
189
|
void ctx;
|
|
281
190
|
if (req.command === undefined)
|
|
282
|
-
|
|
283
|
-
const tags = tagsOf(req.labels);
|
|
284
|
-
const problem = tagProblem(tags);
|
|
285
|
-
if (problem)
|
|
286
|
-
return fail("refused", problem);
|
|
191
|
+
throw new HostError("invalid", "a Modal sandbox's command is the entrypoint the adapter gives a pid1 host, and the request has none");
|
|
287
192
|
let base;
|
|
288
193
|
if (MODAL_IMAGE_ID.test(req.image)) {
|
|
289
194
|
const fromId = this.#sdk.images.fromId;
|
|
290
195
|
if (typeof fromId !== "function")
|
|
291
|
-
|
|
196
|
+
throw new HostError("invalid", `the image ${req.image} is a Modal image id, and options.sdk has no images.fromId to open it: pass the SDK's own ModalClient`);
|
|
292
197
|
base = await fromId.call(this.#sdk.images, req.image);
|
|
293
198
|
}
|
|
294
199
|
else
|
|
@@ -307,12 +212,12 @@ class ModalHost {
|
|
|
307
212
|
memoryMiB: Math.min(MEMORY_REQUEST_MIB, memoryMb),
|
|
308
213
|
memoryLimitMiB: memoryMb,
|
|
309
214
|
...(req.network === "none" ? { blockNetwork: true } : {}),
|
|
310
|
-
tags,
|
|
215
|
+
tags: req.labels,
|
|
311
216
|
};
|
|
312
217
|
const image = base.dockerfileCommands([`ENV HOME=${WORK}`, `WORKDIR ${WORK}`]);
|
|
313
|
-
const sandbox = await this.#sdk.sandboxes.create(await this.#theApp(), image, params);
|
|
218
|
+
const sandbox = await this.#sdk.sandboxes.create((await this.#theApp(true)), image, params);
|
|
314
219
|
this.#sandboxes.set(sandbox.sandboxId, sandbox);
|
|
315
|
-
return
|
|
220
|
+
return { id: sandbox.sandboxId };
|
|
316
221
|
}
|
|
317
222
|
/**
|
|
318
223
|
* The sandbox as a machine: running while poll reads null (sandbox.ts:2761-2771), its labels from its tags. One that
|
|
@@ -321,17 +226,14 @@ class ModalHost {
|
|
|
321
226
|
*/
|
|
322
227
|
async get(id, ctx) {
|
|
323
228
|
void ctx;
|
|
324
|
-
|
|
325
|
-
if (sandbox === undefined)
|
|
326
|
-
return ok(undefined);
|
|
327
|
-
return ok(await this.#machine(sandbox));
|
|
229
|
+
return this.#machine(await this.#sandbox(id));
|
|
328
230
|
}
|
|
329
231
|
/** One sandbox read: none once it has finished or Modal no longer knows it. */
|
|
330
232
|
async #machine(sandbox) {
|
|
331
233
|
try {
|
|
332
234
|
if ((await sandbox.poll()) !== null)
|
|
333
235
|
return undefined;
|
|
334
|
-
return { id: sandbox.sandboxId, labels:
|
|
236
|
+
return { id: sandbox.sandboxId, labels: await sandbox.getTags(), state: "running" };
|
|
335
237
|
}
|
|
336
238
|
catch (error) {
|
|
337
239
|
if (codeOf(error) === "not_found")
|
|
@@ -342,92 +244,68 @@ class ModalHost {
|
|
|
342
244
|
/**
|
|
343
245
|
* Every running sandbox in the app whose tags carry these labels: Modal's list asks for running sandboxes only
|
|
344
246
|
* (includeFinished: false, sandbox.ts:1135-1140), yet one terminated a moment ago is still listed, so each is polled,
|
|
345
|
-
* and one finished or no longer known is left out. One bound, ctx.timeoutMs, for the listing and every read.
|
|
247
|
+
* and one finished or no longer known is left out. One bound, ctx.timeoutMs, for the listing and every read. An app
|
|
248
|
+
* not made yet holds none.
|
|
346
249
|
*/
|
|
347
250
|
async list(labels, ctx) {
|
|
348
251
|
const until = Date.now() + ctx.timeoutMs;
|
|
349
|
-
const app = await this.#theApp();
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
const iterator = this.#sdk.sandboxes.list({ appId: app.appId, tags:
|
|
252
|
+
const app = await this.#theApp(false);
|
|
253
|
+
if (app === undefined)
|
|
254
|
+
return [];
|
|
255
|
+
const iterator = this.#sdk.sandboxes.list({ appId: app.appId, tags: labels })[Symbol.asyncIterator]();
|
|
353
256
|
const machines = [];
|
|
354
257
|
try {
|
|
355
258
|
for (;;) {
|
|
356
259
|
if (Date.now() >= until)
|
|
357
|
-
|
|
260
|
+
throw new HostError("timeout", `sandboxes.list read ${machines.length} sandboxes, and did not finish within ${ctx.timeoutMs / 1000} s`);
|
|
358
261
|
const next = await iterator.next();
|
|
359
262
|
if (next.done)
|
|
360
263
|
break;
|
|
361
264
|
const machine = await this.#machine(next.value);
|
|
362
|
-
if (machine !== undefined
|
|
265
|
+
if (machine !== undefined)
|
|
363
266
|
machines.push(machine);
|
|
364
267
|
}
|
|
365
268
|
}
|
|
366
269
|
finally {
|
|
367
270
|
Promise.resolve(iterator.return?.()).catch(() => { });
|
|
368
271
|
}
|
|
369
|
-
return
|
|
272
|
+
return machines;
|
|
370
273
|
}
|
|
371
274
|
/**
|
|
372
275
|
* terminate, which returns before Modal has ended the sandbox (sandbox.ts:1292-1296): the adapter waits for it to be
|
|
373
|
-
* gone. One Modal no longer knows, or one that had finished when terminate failed, is done.
|
|
276
|
+
* gone. One Modal no longer knows (not_found, done to the adapter), or one that had finished when terminate failed, is done.
|
|
374
277
|
*/
|
|
375
278
|
async delete(id, ctx) {
|
|
376
279
|
void ctx;
|
|
377
|
-
const sandbox = await this.#sandbox(id);
|
|
378
|
-
this.#sandboxes.delete(id);
|
|
379
|
-
if (sandbox === undefined)
|
|
380
|
-
return ok(undefined);
|
|
280
|
+
const sandbox = await this.#sandbox(id).finally(() => this.#sandboxes.delete(id));
|
|
381
281
|
try {
|
|
382
282
|
await sandbox.terminate();
|
|
383
283
|
}
|
|
384
284
|
catch (error) {
|
|
385
285
|
if (codeOf(error) === "not_found")
|
|
386
|
-
|
|
286
|
+
throw error;
|
|
387
287
|
const finished = await sandbox.poll().then((code) => code !== null, (polled) => codeOf(polled) === "not_found");
|
|
388
288
|
if (!finished)
|
|
389
289
|
throw error;
|
|
390
290
|
}
|
|
391
|
-
return ok(undefined);
|
|
392
291
|
}
|
|
393
292
|
/**
|
|
394
|
-
* exec in binary mode, as root (Modal containers always run as root), outside computerd.
|
|
395
|
-
*
|
|
396
|
-
* reads it.
|
|
293
|
+
* exec in binary mode, as root (Modal containers always run as root), outside computerd. Modal has no kill for an
|
|
294
|
+
* exec: kill closes its stdin, which ends the stdio bridge and anything else that reads it.
|
|
397
295
|
*/
|
|
398
|
-
async exec(id, argv,
|
|
296
|
+
async exec(id, argv, ctx) {
|
|
399
297
|
void ctx;
|
|
400
298
|
const sandbox = await this.#sandbox(id);
|
|
401
|
-
if (sandbox === undefined)
|
|
402
|
-
return fail("not_found", `no Modal sandbox has the id ${id}`);
|
|
403
299
|
const program = await sandbox.exec([...argv], { mode: "binary" });
|
|
404
300
|
const close = () => program.stdin.close().catch(() => { });
|
|
405
|
-
|
|
406
|
-
await close();
|
|
407
|
-
return ok({
|
|
301
|
+
return {
|
|
408
302
|
stdout: program.stdout,
|
|
409
303
|
stderr: program.stderr,
|
|
410
304
|
write: (bytes) => program.stdin.writeBytes(bytes),
|
|
411
305
|
end: () => program.stdin.close(),
|
|
412
306
|
wait: () => program.wait(),
|
|
413
307
|
kill: async () => void (await close()),
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
/**
|
|
417
|
-
* Settings' test: the app read without making it (createIfMissing false), which makes nothing, where a listing would
|
|
418
|
-
* make the app. An app not made yet is a connection all the same: the token was taken, and the first computer makes it.
|
|
419
|
-
*/
|
|
420
|
-
async testConnection(ctx) {
|
|
421
|
-
void ctx;
|
|
422
|
-
try {
|
|
423
|
-
await this.#sdk.apps.fromName(this.#appName, { createIfMissing: false });
|
|
424
|
-
return ok({ detail: `Modal answered: the app ${this.#appName} is there` });
|
|
425
|
-
}
|
|
426
|
-
catch (error) {
|
|
427
|
-
if (codeOf(error) === "not_found")
|
|
428
|
-
return ok({ detail: `Modal answered: no app ${this.#appName} yet; the first computer makes it` });
|
|
429
|
-
return fail(codeOf(error), `apps.fromName ${this.#appName} failed: ${words(error)}`);
|
|
430
|
-
}
|
|
308
|
+
};
|
|
431
309
|
}
|
|
432
310
|
}
|
|
433
311
|
/**
|
|
@@ -439,7 +317,8 @@ class ModalHost {
|
|
|
439
317
|
*/
|
|
440
318
|
export class ModalProvider extends HostedProvider {
|
|
441
319
|
constructor(options) {
|
|
442
|
-
const {
|
|
320
|
+
const { app, timeouts = {}, ...rest } = options ?? {};
|
|
321
|
+
const sdk = options?.sdk;
|
|
443
322
|
const lacks = [
|
|
444
323
|
["apps.fromName", sdk?.apps?.fromName],
|
|
445
324
|
["images.fromRegistry", sdk?.images?.fromRegistry],
|
|
@@ -451,9 +330,6 @@ export class ModalProvider extends HostedProvider {
|
|
|
451
330
|
throw new Error(`options.sdk must be a Modal client; it lacks ${lacks.map(([name]) => name).join(", ")}`);
|
|
452
331
|
if (typeof app !== "string" || app.trim() === "")
|
|
453
332
|
throw new Error("options.app, the Modal app's name, is required");
|
|
454
|
-
|
|
455
|
-
throw new Error(`maxLifetimeMs must be a whole number of ms above 0 and at most 24 hours (${MAX_LIFETIME_MS} ms), Modal's longest timeout`);
|
|
456
|
-
}
|
|
457
|
-
super(new ModalHost(sdk, app), { ...rest, label: "Modal", kind: "linux", maxLifetimeMs, timeouts: { ...MODAL_TIMEOUTS, ...timeouts } });
|
|
333
|
+
super(new ModalHost(sdk, app), { ...rest, kind: "linux", timeouts: { ...MODAL_TIMEOUTS, ...timeouts } });
|
|
458
334
|
}
|
|
459
335
|
}
|
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, {
|
|
@@ -118,14 +118,18 @@ export declare function archilMount({ root, mount, self: computer, releaseOlder,
|
|
|
118
118
|
* process.start, which makes its log and the folders above it; process.write and signal; a process seen
|
|
119
119
|
* ended, by process.wait or a process.read that says so) syncs before it answers, through mount.sync, coalesced: a
|
|
120
120
|
* 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
|
|
121
|
+
* failed still syncs, and answers its own error (one the client timed out with no answer from the daemon does so at
|
|
122
|
+
* 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
123
|
* (or its own error), while the shared sync goes on for every other caller. A tar.push.begin answered with such an error
|
|
123
124
|
* instead of its id first ends the push it began, so no push slot is held by a push its caller cannot name.
|
|
124
125
|
*/
|
|
125
126
|
export declare function syncingClient(client: ComputerClient): ComputerClient;
|
|
126
|
-
/**
|
|
127
|
+
/**
|
|
128
|
+
* The label an Archil computer carries its mount in: kind, disk, region and the folder's agent as JSON, never the token.
|
|
129
|
+
* The folder's run is the computer's agentrun.run label (check holds them equal), so the label does not repeat it.
|
|
130
|
+
*/
|
|
127
131
|
export declare function archilLabels(mount: ArchilMount): Record<string, string>;
|
|
128
|
-
/** The mount a computer's
|
|
132
|
+
/** 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
133
|
export declare function recordedMount(labels: Record<string, string> | undefined): Omit<ArchilMount, "token"> | undefined;
|
|
130
134
|
/**
|
|
131
135
|
* 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,7 +34,7 @@ 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
40
|
* The Archil rule every provider's check() adds to checkMount's, with no vendor call: network "none" (the tools have no
|
|
@@ -65,8 +66,8 @@ export function archilRefusals(spec) {
|
|
|
65
66
|
const folder = FOLDER.exec(text(mount.folder));
|
|
66
67
|
if (folder === null)
|
|
67
68
|
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[
|
|
69
|
+
else if (runWrong === undefined && folder[2] !== run)
|
|
70
|
+
refuse("mount", `mount.folder is run ${folder[2]}'s folder, not the run this computer is labelled for (${RUN_LABEL})`);
|
|
70
71
|
if (!TOKEN.test(text(mount.token)))
|
|
71
72
|
refuse("mount", "mount.token is not a disk token: 16 to 4096 of letters, digits and ._~+/=-");
|
|
72
73
|
return found;
|
|
@@ -271,7 +272,8 @@ const MUTATING = new Set(["files.write", "files.move", "files.remove", "files.mk
|
|
|
271
272
|
* process.start, which makes its log and the folders above it; process.write and signal; a process seen
|
|
272
273
|
* ended, by process.wait or a process.read that says so) syncs before it answers, through mount.sync, coalesced: a
|
|
273
274
|
* 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
|
|
275
|
+
* failed still syncs, and answers its own error (one the client timed out with no answer from the daemon does so at
|
|
276
|
+
* 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
277
|
* (or its own error), while the shared sync goes on for every other caller. A tar.push.begin answered with such an error
|
|
276
278
|
* instead of its id first ends the push it began, so no push slot is held by a push its caller cannot name.
|
|
277
279
|
*/
|
|
@@ -340,6 +342,11 @@ export function syncingClient(client) {
|
|
|
340
342
|
};
|
|
341
343
|
if (signal?.aborted)
|
|
342
344
|
return result.ok ? stopped() : result;
|
|
345
|
+
// A call the client gave up on at its own timeoutMs got no answer over the transport, and a sync rides that same
|
|
346
|
+
// transport: the caller gets its timeout now, and the sync it asked for goes on for the others. A timeout the
|
|
347
|
+
// daemon answered came over a live transport, after the call may have run in part: that one waits for the sync.
|
|
348
|
+
if (!result.ok && unanswered(result.error))
|
|
349
|
+
return result;
|
|
343
350
|
const synced = signal === undefined ? await shared : await new Promise((resolve) => {
|
|
344
351
|
const onAbort = () => resolve("stopped");
|
|
345
352
|
signal.addEventListener("abort", onAbort, { once: true });
|
|
@@ -358,19 +365,23 @@ export function syncingClient(client) {
|
|
|
358
365
|
close: () => client.close(),
|
|
359
366
|
};
|
|
360
367
|
}
|
|
361
|
-
/**
|
|
368
|
+
/**
|
|
369
|
+
* The label an Archil computer carries its mount in: kind, disk, region and the folder's agent as JSON, never the token.
|
|
370
|
+
* The folder's run is the computer's agentrun.run label (check holds them equal), so the label does not repeat it.
|
|
371
|
+
*/
|
|
362
372
|
export function archilLabels(mount) {
|
|
363
|
-
return { [ARCHIL_MOUNT_LABEL]: JSON.stringify({ kind: "archil", disk: mount.disk, region: mount.region,
|
|
373
|
+
return { [ARCHIL_MOUNT_LABEL]: JSON.stringify({ kind: "archil", disk: mount.disk, region: mount.region, agent: FOLDER.exec(mount.folder)?.[1] ?? "" }) };
|
|
364
374
|
}
|
|
365
|
-
/** The mount a computer's
|
|
375
|
+
/** 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
376
|
export function recordedMount(labels) {
|
|
367
377
|
const text = labels?.[ARCHIL_MOUNT_LABEL];
|
|
368
378
|
if (text === undefined)
|
|
369
379
|
return undefined;
|
|
370
380
|
try {
|
|
371
|
-
const
|
|
372
|
-
const
|
|
373
|
-
|
|
381
|
+
const { kind, disk, region, agent, ...rest } = (JSON.parse(text) ?? {});
|
|
382
|
+
const run = labels?.[RUN_LABEL];
|
|
383
|
+
const folder = `agents/${String(agent)}/runs/${String(run)}/work`;
|
|
384
|
+
if (kind !== "archil" || typeof disk !== "string" || typeof region !== "string" || typeof agent !== "string" || typeof run !== "string" || Object.keys(rest).length > 0 || !FOLDER.test(folder))
|
|
374
385
|
return undefined;
|
|
375
386
|
return { kind, disk, region, folder };
|
|
376
387
|
}
|
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
|
@@ -31,15 +31,8 @@ import { daemonWatch } from "./screen-watch.js";
|
|
|
31
31
|
import { listTested } from "./test-connection.js";
|
|
32
32
|
/** This module's failures: one with code vendor names Orgo. */
|
|
33
33
|
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
34
|
/** The groups every Orgo computer offers: a Linux shell, files and processes, and the desktop's screen and input. */
|
|
37
35
|
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
36
|
/** The conformance CLI's module for Orgo: its live switch, the run's 1 h cap and the drifted twin. */
|
|
44
37
|
export const conformance = () => import("./conformance/orgo.js");
|
|
45
38
|
const VERSION = JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
@@ -262,7 +255,7 @@ export class OrgoProvider {
|
|
|
262
255
|
groups: [...GROUPS],
|
|
263
256
|
maxLifetimeMs: this.#maxLifetimeMs,
|
|
264
257
|
release: ["delete"],
|
|
265
|
-
mount: [...
|
|
258
|
+
mount: [...ORGO.mounts],
|
|
266
259
|
// Init starts with --own-network (childCommands): no tool reaches these, nor any port root listens on.
|
|
267
260
|
vendorAgentPorts: [...ORGO_AGENT_PORTS],
|
|
268
261
|
persistence: { keepsState: true, resume: true },
|
|
@@ -288,7 +281,7 @@ export class OrgoProvider {
|
|
|
288
281
|
if (bad)
|
|
289
282
|
refuse("labels", bad);
|
|
290
283
|
}
|
|
291
|
-
refusals.push(...checkMount(mount,
|
|
284
|
+
refusals.push(...checkMount(mount, ORGO.mounts));
|
|
292
285
|
refusals.push(...checkGpu(given.gpu, this.capabilities()));
|
|
293
286
|
for (const [field, value] of Object.entries(given)) {
|
|
294
287
|
if (SPEC_FIELDS.has(field) || field === "mount" || field === "owner" || value === undefined)
|
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. */
|