@parcha/agentrun-computer 0.1.0-beta.39 → 0.1.0-beta.40
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 +25 -7
- package/box/Dockerfile +5 -54
- package/box/README.md +7 -2
- package/box/build-daytona.py +2 -2
- package/box/build-e2b.mjs +1 -1
- package/box/install.sh +87 -0
- package/box/recipe.mjs +12 -10
- package/dist/agent37.js +2 -1
- package/dist/computerd-linux-amd64 +0 -0
- package/dist/computerd-linux-arm64 +0 -0
- package/dist/computerd.json +2 -2
- package/dist/conformance/cases/isolation.js +17 -1
- package/dist/conformance/cases/lifetime.js +30 -0
- package/dist/conformance/cases/provider.js +47 -1
- package/dist/conformance/cli.js +23 -4
- package/dist/conformance/exec-stream.d.ts +37 -7
- package/dist/conformance/exec-stream.js +339 -87
- package/dist/conformance/report.js +3 -0
- package/dist/conformance/runner.js +127 -9
- package/dist/conformance/types.d.ts +21 -0
- package/dist/daytona.js +4 -2
- package/dist/host.d.ts +60 -19
- package/dist/host.js +5 -0
- package/dist/hosted/framed-exec.d.ts +49 -0
- package/dist/hosted/framed-exec.js +185 -0
- package/dist/hosted/process.d.ts +11 -5
- package/dist/hosted/process.js +30 -12
- package/dist/hosted/provider.d.ts +10 -5
- package/dist/hosted/provider.js +233 -36
- package/dist/hosted/rest.d.ts +10 -0
- package/dist/hosted/rest.js +15 -6
- package/dist/hosted/scripts.d.ts +8 -0
- package/dist/hosted/scripts.js +22 -0
- package/dist/hosted/values.d.ts +1 -1
- package/package.json +1 -1
|
@@ -1,22 +1,32 @@
|
|
|
1
1
|
// The exec pre-check: the one thing a new vendor proves before writing anything else of its host. AgentRun installs its
|
|
2
2
|
// daemon through MachineHost.exec and then talks to it over that one process's stdin and stdout for the computer's whole
|
|
3
|
-
// life, so exec must be a live, two-way
|
|
4
|
-
// ../host.ts). This runs exec alone, on a machine the vendor made by hand, and says in plain words what it
|
|
3
|
+
// life, so exec must be a live, two-way stream that keeps UTF-8 text intact, with no timeout (the contract is exec's doc
|
|
4
|
+
// comment in ../host.ts). This runs exec alone, on a machine the vendor made by hand, and says in plain words what it
|
|
5
|
+
// did wrong:
|
|
5
6
|
//
|
|
6
7
|
// npm run conformance -w @parcha/agentrun-computer -- --provider <id | ./module.js> --exec-stream --machine <id> [--quick]
|
|
7
8
|
//
|
|
8
9
|
// It calls nothing but host.exec, so a host whose other members are still stubs can run it. Each check starts its own
|
|
9
|
-
// process and kills it when it is done with it, pass or fail.
|
|
10
|
+
// process and kills it when it is done with it, pass or fail. No check ends stdin: the adapter never needs a vendor's
|
|
11
|
+
// end of file, so one with none passes. After the checks, one more exec reads what the machine offers the rest of the
|
|
12
|
+
// host (root's network namespace, /dev/fuse, the arch, the kernel, the TCP listeners): facts, each with what it means
|
|
13
|
+
// for the provider, never a pass or a fail of exec.
|
|
10
14
|
import { createHash, randomBytes } from "node:crypto";
|
|
11
15
|
import { words } from "../hosted/process.js";
|
|
12
16
|
/** The checks, in the order they run. */
|
|
13
|
-
export const EXEC_STREAM_CHECKS = ["stdout-
|
|
17
|
+
export const EXEC_STREAM_CHECKS = ["stdout-text", "stdin-text", "large", "stdout-live", "stdin-live", "stdout-unread", "stderr", "exit-code", "kill", "no-timeout"];
|
|
18
|
+
/** What the capability probe reads, in the order the report gives it. */
|
|
19
|
+
export const EXEC_STREAM_FACTS = ["root", "netns", "fuse", "arch", "kernel", "listeners"];
|
|
14
20
|
export const DEFAULT_LONG_MS = 75_000;
|
|
15
21
|
/** --quick's no-timeout check: long enough to cross a second, short enough for CI. */
|
|
16
22
|
export const QUICK_LONG_MS = 5_000;
|
|
17
23
|
const DEFAULT_STEP_MS = 30_000;
|
|
18
24
|
const DEFAULT_LARGE_BYTES = 8 * 1024 * 1024;
|
|
19
25
|
const DEFAULT_LARGE_MS = 180_000;
|
|
26
|
+
const DEFAULT_UNREAD_MS = 10_000;
|
|
27
|
+
/** stdout-unread's writes: this many, of UNREAD_CHUNK bytes each, spread over unreadMs; 4 MiB, far past a 64 KiB window. */
|
|
28
|
+
const UNREAD_WRITES = 64;
|
|
29
|
+
const UNREAD_CHUNK = 64 * 1024;
|
|
20
30
|
/** What one write gives exec's stdin, as the adapter's own upload does (runToExit). */
|
|
21
31
|
const WRITE_CHUNK = 256 * 1024;
|
|
22
32
|
/** How long stdout-live watches, after "early", that stdout stays open and wait() has no answer. */
|
|
@@ -32,42 +42,96 @@ export const PID_STATE_SCRIPT = 'st=$(sed -n "s/^State:[[:space:]]*\\([A-Z]\\).*
|
|
|
32
42
|
class Problem extends Error {
|
|
33
43
|
}
|
|
34
44
|
const hex = (bytes) => [...bytes].map((b) => b.toString(16).padStart(2, "0")).join(" ");
|
|
35
|
-
const byte = (b) => `0x${b.toString(16).padStart(2, "0")}`;
|
|
36
45
|
const secondsOf = (ms) => `${Math.round(ms / 100) / 10} s`;
|
|
37
46
|
const shown = (argv) => argv.map((word) => (/^[\w./=:-]+$/.test(word) ? word : `'${word.replaceAll("'", "'\\''")}'`)).join(" ");
|
|
38
|
-
const
|
|
39
|
-
/** printf's format for every byte value, 0 to 255, each as an octal escape: dash, bash and busybox all read it. */
|
|
40
|
-
const PRINTF_ALL = [...ALL_BYTES].map((b) => `\\${b.toString(8).padStart(3, "0")}`).join("");
|
|
47
|
+
const range = (from, to) => String.fromCodePoint(...Array.from({ length: to - from + 1 }, (_, i) => from + i));
|
|
41
48
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
49
|
+
* A BOM first, which a TextDecoder drops from the start of a stream unless told to keep it (ignoreBOM). Then one of
|
|
50
|
+
* each class of code point: all of ASCII but NUL (no text the adapter carries holds one: JSON escapes it), all of
|
|
51
|
+
* Latin-1, the BMP's scripts and its odd ones (the line and paragraph separators, a BOM, U+FFFD), astral ones, and
|
|
52
|
+
* combining marks and a joined emoji, which a normalizer would change. Then \r alone and \r\n, which a terminal changes.
|
|
44
53
|
*/
|
|
45
|
-
|
|
54
|
+
const CODE_POINTS = `\u{feff}${range(0x01, 0x7f)}${range(0x80, 0xff)}ĀſΩЖאعह中文日本語한국어€
�𝄞😀\u{10ffff}éä\u{1f469}\u{1f4bb}carriage\rreturn\r\nline`;
|
|
55
|
+
/** 16 KiB of text of every width (1, 2, 3 and 4 bytes a character), no newline: 64 of them are the 1 MiB line. */
|
|
56
|
+
const LONG_PIECE = `${"aé€𝄞".repeat(1638)}abcd`;
|
|
57
|
+
const LONG_PIECES = 64;
|
|
58
|
+
/** What stdout-text and stdin-text carry: every class of code point, \r and \r\n, a line of 1 MiB, and a lone \n at the end. */
|
|
59
|
+
const TEXT = Buffer.from(`${CODE_POINTS}${LONG_PIECE.repeat(LONG_PIECES)}\n`, "utf8");
|
|
60
|
+
/**
|
|
61
|
+
* length bytes of random UTF-8 text: characters of 1, 2, 3 and 4 bytes at random, any code point of each width but NUL
|
|
62
|
+
* and the surrogates (which are no text).
|
|
63
|
+
*/
|
|
64
|
+
export function randomText(length) {
|
|
65
|
+
const text = Buffer.alloc(length);
|
|
66
|
+
const random = randomBytes(4 * length);
|
|
67
|
+
let r = 0;
|
|
68
|
+
const next = (bytes) => {
|
|
69
|
+
let value = 0;
|
|
70
|
+
for (let i = 0; i < bytes; i++)
|
|
71
|
+
value = value * 256 + random[r++];
|
|
72
|
+
return value;
|
|
73
|
+
};
|
|
74
|
+
for (let at = 0; at < length;) {
|
|
75
|
+
const width = Math.min(length - at, 1 + (next(1) & 3));
|
|
76
|
+
if (width === 1)
|
|
77
|
+
text[at] = 1 + (next(1) % 0x7f);
|
|
78
|
+
else if (width === 2)
|
|
79
|
+
text.write(String.fromCodePoint(0x80 + (next(2) % 0x780)), at, "utf8");
|
|
80
|
+
else if (width === 3) {
|
|
81
|
+
const point = 0x800 + (next(2) % 0xf000);
|
|
82
|
+
text.write(String.fromCodePoint(point >= 0xd800 ? point + 0x800 : point), at, "utf8");
|
|
83
|
+
}
|
|
84
|
+
else
|
|
85
|
+
text.write(String.fromCodePoint(0x10000 + (next(3) % 0x100000)), at, "utf8");
|
|
86
|
+
at += width;
|
|
87
|
+
}
|
|
88
|
+
return text;
|
|
89
|
+
}
|
|
90
|
+
/** printf's format for text: each of its UTF-8 bytes as an octal escape, which dash, bash and busybox all read. */
|
|
91
|
+
const printfOf = (text) => [...Buffer.from(text, "utf8")].map((b) => `\\${b.toString(8).padStart(3, "0")}`).join("");
|
|
92
|
+
/** The code point of the character the byte at i is part of, as U+XXXX, and where that character starts. */
|
|
93
|
+
function characterAt(bytes, i) {
|
|
94
|
+
let start = i;
|
|
95
|
+
while (start > 0 && (bytes[start] & 0xc0) === 0x80)
|
|
96
|
+
start--;
|
|
97
|
+
const point = Buffer.from(bytes.subarray(start, start + 4)).toString("utf8").codePointAt(0) ?? 0;
|
|
98
|
+
return { name: `U+${point.toString(16).toUpperCase().padStart(4, "0")}`, start };
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Why `got` is not `sent`, in words, or undefined when they are the same text. Both are UTF-8; `way` is where it went
|
|
102
|
+
* ("on stdout"). The first character that differs is named, and the usual ways an exec changes text are named for what
|
|
103
|
+
* they are.
|
|
104
|
+
*/
|
|
105
|
+
export function textProblem(sent, got, way) {
|
|
46
106
|
let i = 0;
|
|
47
107
|
while (i < sent.length && i < got.length && sent[i] === got[i])
|
|
48
108
|
i++;
|
|
49
109
|
if (i === sent.length && i === got.length)
|
|
50
110
|
return undefined;
|
|
51
|
-
if (i === got.length)
|
|
52
|
-
|
|
53
|
-
return `only ${got.length} of ${sent.length} bytes came back ${way}${nul}. Pass every byte on as it comes`;
|
|
54
|
-
}
|
|
111
|
+
if (i === got.length)
|
|
112
|
+
return `only ${got.length} of ${sent.length} bytes of text came back ${way}. Pass every character on as it comes`;
|
|
55
113
|
if (i === sent.length)
|
|
56
|
-
return `${got.length - sent.length} bytes came back ${way} that were never sent, after all ${sent.length} that were (${hex(got.subarray(i, i + 8))}): your exec adds output of its own (a shell's login banner, a prompt). Pass only the process's own
|
|
57
|
-
const
|
|
58
|
-
const
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
|
|
114
|
+
return `${got.length - sent.length} bytes came back ${way} that were never sent, after all ${sent.length} that were (${hex(got.subarray(i, i + 8))}): your exec adds output of its own (a shell's login banner, a prompt). Pass only the process's own output`;
|
|
115
|
+
const { name, start } = characterAt(sent, i);
|
|
116
|
+
const was = got.subarray(start, start + 4);
|
|
117
|
+
const said = `${name} (at byte ${start}) came back ${way} as ${hex(was)}`;
|
|
118
|
+
const b = sent[start];
|
|
119
|
+
if (b === 0x0a && was[0] === 0x0d && was[1] === 0x0a)
|
|
120
|
+
return `${said}: your exec turns \\n into \\r\\n, as a terminal does. Run the process on pipes, not a terminal`;
|
|
121
|
+
if (b === 0x0d && was[0] === 0x0a)
|
|
122
|
+
return `${said}: your exec turns \\r into \\n, as newline translation does. Pass every character on as it comes`;
|
|
123
|
+
if (b === 0x0d)
|
|
124
|
+
return `${said}: your exec drops \\r, as newline translation does. Pass every character on as it comes`;
|
|
125
|
+
if (b >= 0x80 && was[0] === (0xc0 | (b >> 6)) && was[1] === (0x80 | (b & 0x3f))) {
|
|
126
|
+
return `${said}: your exec reads UTF-8 as Latin-1 and writes it back as UTF-8 again. Read the process's output as UTF-8`;
|
|
62
127
|
}
|
|
63
|
-
if (
|
|
64
|
-
return `${
|
|
128
|
+
if (name === "U+FEFF" && Buffer.from(got.subarray(start, start + 8)).equals(Buffer.from(sent.subarray(start + 3, start + 11)))) {
|
|
129
|
+
return `${said}: your exec drops a U+FEFF that starts its text, as a TextDecoder does unless given ignoreBOM: true. Keep it: it is text like any other`;
|
|
65
130
|
}
|
|
66
|
-
if (
|
|
67
|
-
return `${
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
return `${was} (offset ${i}): your exec changes bytes. Pass every byte on as it comes, unchanged`;
|
|
131
|
+
if (was[0] === 0xef && was[1] === 0xbf && was[2] === 0xbd) {
|
|
132
|
+
return `${said}: U+FFFD (ef bf bd), as a decoder makes of half a character: your exec decodes each piece of output as text on its own. Decode the stream as one (TextDecoder's stream: true)`;
|
|
133
|
+
}
|
|
134
|
+
return `${said}: your exec changes text (a terminal, a normalizer, an escape filter). Pass every character on as it comes, unchanged`;
|
|
71
135
|
}
|
|
72
136
|
/** One output stream of a process, read as it comes: its bytes so far, whether it ended, and a wait for more. */
|
|
73
137
|
class Reader {
|
|
@@ -76,10 +140,12 @@ class Reader {
|
|
|
76
140
|
ended = false;
|
|
77
141
|
error;
|
|
78
142
|
#wake = [];
|
|
79
|
-
|
|
80
|
-
|
|
143
|
+
/** Reads the stream as it comes; with `from`, not a byte until it settles: the stream is left unread until then. */
|
|
144
|
+
constructor(stream, from) {
|
|
145
|
+
void this.#pump(stream, from);
|
|
81
146
|
}
|
|
82
|
-
async #pump(stream) {
|
|
147
|
+
async #pump(stream, from) {
|
|
148
|
+
await from;
|
|
83
149
|
try {
|
|
84
150
|
for await (const chunk of stream) {
|
|
85
151
|
// A copy: a vendor's client may reuse its buffer.
|
|
@@ -144,6 +210,8 @@ function within(promise, ms, late, signal) {
|
|
|
144
210
|
});
|
|
145
211
|
}
|
|
146
212
|
const LATE = Symbol("late");
|
|
213
|
+
/** Waits ms, or less when signal aborts. */
|
|
214
|
+
const pause = (ms, signal) => within(new Promise(() => { }), Math.max(0, ms), undefined, signal);
|
|
147
215
|
/** The pre-check's run of host.exec on one machine. */
|
|
148
216
|
class Session {
|
|
149
217
|
#host;
|
|
@@ -165,9 +233,9 @@ class Session {
|
|
|
165
233
|
}
|
|
166
234
|
/**
|
|
167
235
|
* exec(argv), answered within the step's bound; any failure (a throw) is a Problem naming the command. Without stdin,
|
|
168
|
-
* end() is called at once, as the adapter does.
|
|
236
|
+
* end() is called at once, as the adapter does. With `readFrom`, stdout is left unread until it settles.
|
|
169
237
|
*/
|
|
170
|
-
async start(argv, stdin) {
|
|
238
|
+
async start(argv, stdin, readFrom) {
|
|
171
239
|
const what = `exec of ${shown(argv)}`;
|
|
172
240
|
let answer;
|
|
173
241
|
try {
|
|
@@ -198,7 +266,7 @@ class Session {
|
|
|
198
266
|
lacks.unshift("stderr");
|
|
199
267
|
if (lacks.length > 0)
|
|
200
268
|
throw new Problem(`${what} answered a process that lacks ${lacks.join(", ")}: a MachineProcess (src/host.ts) has stdout, stderr, write, end, wait and kill`);
|
|
201
|
-
const run = { proc, out: new Reader(proc.stdout), err: new Reader(proc.stderr), exited: Promise.resolve(0) };
|
|
269
|
+
const run = { proc, out: new Reader(proc.stdout, readFrom), err: new Reader(proc.stderr), exited: Promise.resolve(0) };
|
|
202
270
|
run.exited = Promise.resolve()
|
|
203
271
|
.then(() => proc.wait())
|
|
204
272
|
.then((code) => {
|
|
@@ -213,16 +281,21 @@ class Session {
|
|
|
213
281
|
return run;
|
|
214
282
|
}
|
|
215
283
|
/**
|
|
216
|
-
* Writes
|
|
217
|
-
* is bounded by the step, and by `by` when the
|
|
284
|
+
* Writes UTF-8 text to the process's stdin, in pieces of at most WRITE_CHUNK bytes, each whole characters as the
|
|
285
|
+
* adapter's are, one after another; a refusal is a Problem. Each write is bounded by the step, and by `by` when the
|
|
286
|
+
* check has one deadline for all of its steps.
|
|
218
287
|
*/
|
|
219
288
|
async write(run, bytes, what, by) {
|
|
220
|
-
for (let at = 0; at < bytes.length; at
|
|
289
|
+
for (let at = 0, end = 0; at < bytes.length; at = end) {
|
|
290
|
+
end = Math.min(at + WRITE_CHUNK, bytes.length);
|
|
291
|
+
while (end < bytes.length && (bytes[end] & 0xc0) === 0x80)
|
|
292
|
+
end--;
|
|
293
|
+
const piece = bytes.subarray(at, end);
|
|
221
294
|
const ms = by ? by.left(this.#stepMs) : this.#stepMs;
|
|
222
295
|
// Whether the deadline, not the step, set this bound. Asking by.passed() after the timeout is not enough: a
|
|
223
296
|
// timer can fire a millisecond before Date.now() reads the deadline.
|
|
224
297
|
const deadlineBound = by !== undefined && ms < this.#stepMs;
|
|
225
|
-
const written = await within(Promise.resolve().then(() => run.proc.write(
|
|
298
|
+
const written = await within(Promise.resolve().then(() => run.proc.write(piece)), ms, LATE, this.#signal).catch((error) => {
|
|
226
299
|
throw new Problem(`write() of ${what} failed while the process ran: ${words(error)}`);
|
|
227
300
|
});
|
|
228
301
|
// within() answers LATE for an abort too: a stopped write names no bound that did not run out.
|
|
@@ -232,15 +305,6 @@ class Session {
|
|
|
232
305
|
throw new Problem(by && (deadlineBound || by.passed()) ? `writing ${what} ran past ${secondsOf(by.ms)}, with ${at} bytes written` : `write() of ${what} did not answer within ${secondsOf(ms)}`);
|
|
233
306
|
}
|
|
234
307
|
}
|
|
235
|
-
/** Ends the process's stdin; a refusal is a Problem. */
|
|
236
|
-
async end(run, by) {
|
|
237
|
-
const ms = by ? by.left(this.#stepMs) : this.#stepMs;
|
|
238
|
-
const ended = await within(Promise.resolve().then(() => run.proc.end()), ms, LATE, this.#signal).catch((error) => {
|
|
239
|
-
throw new Problem(`end() failed: ${words(error)}`);
|
|
240
|
-
});
|
|
241
|
-
if (ended === LATE)
|
|
242
|
-
throw new Problem(`end() did not answer within ${secondsOf(ms)}`);
|
|
243
|
-
}
|
|
244
308
|
/** wait()'s exit code within ms; one that never comes, or a wait() that throws, is a Problem. */
|
|
245
309
|
async exit(run, ms, what) {
|
|
246
310
|
let code;
|
|
@@ -281,55 +345,51 @@ class Deadline {
|
|
|
281
345
|
}
|
|
282
346
|
}
|
|
283
347
|
const CHECKS = {
|
|
284
|
-
/**
|
|
285
|
-
async "stdout-
|
|
286
|
-
const
|
|
287
|
-
const run = await s.start(
|
|
348
|
+
/** Text of every kind out, on stdout alone: printf in the machine writes it, the 1 MiB line a piece at a time. */
|
|
349
|
+
async "stdout-text"(s) {
|
|
350
|
+
const script = `printf "$1"; i=0; while [ "$i" -lt ${LONG_PIECES} ]; do printf "$2"; i=$((i+1)); done; printf '\\n'`;
|
|
351
|
+
const run = await s.start(["sh", "-c", script, "sh", printfOf(CODE_POINTS), printfOf(LONG_PIECE)], false);
|
|
288
352
|
if (!(await run.out.end(s.stepMs, s.signal)))
|
|
289
353
|
throw new Problem(`stdout of printf did not end within ${secondsOf(s.stepMs)} of its start`);
|
|
290
354
|
const code = await s.exit(run, s.stepMs, "printf");
|
|
291
355
|
if (code !== 0)
|
|
292
|
-
throw new Problem(`printf of the
|
|
293
|
-
const problem =
|
|
356
|
+
throw new Problem(`printf of the text exited ${code} (stderr: ${run.err.bytes().toString("utf8").trim().slice(0, 200) || "none"})`);
|
|
357
|
+
const problem = textProblem(TEXT, run.out.bytes(), "on stdout");
|
|
294
358
|
if (problem)
|
|
295
359
|
throw new Problem(problem);
|
|
296
|
-
return "
|
|
360
|
+
return "text of every class of code point, \\r and \\r\\n, and a 1 MiB line, printed in the machine, came back unchanged on stdout";
|
|
297
361
|
},
|
|
298
|
-
/**
|
|
299
|
-
async "stdin-
|
|
362
|
+
/** The same text in on stdin and out again, through cat, read until it has all come back: no end of stdin. */
|
|
363
|
+
async "stdin-text"(s, _options, earlier) {
|
|
300
364
|
const run = await s.start(["cat"], true);
|
|
301
|
-
await s.write(run,
|
|
302
|
-
await
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
const outOk = earlier.get("stdout-bytes")?.status === "pass";
|
|
307
|
-
const problem = bytesProblem(ALL_BYTES, run.out.bytes(), "through cat");
|
|
365
|
+
await s.write(run, TEXT, "the text");
|
|
366
|
+
const came = await run.out.until(() => run.out.length >= TEXT.length, s.stepMs, s.signal);
|
|
367
|
+
const got = run.out.bytes();
|
|
368
|
+
// What came back is checked as far as it goes: a character changed on the way says so, before any that never came.
|
|
369
|
+
const problem = textProblem(came ? TEXT : TEXT.subarray(0, got.length), got, "through cat");
|
|
308
370
|
if (problem)
|
|
309
|
-
throw new Problem(
|
|
310
|
-
|
|
371
|
+
throw new Problem(earlier.get("stdout-text")?.status === "pass" ? `${problem}. stdout alone passes it (stdout-text), so it changed on the way in, on stdin` : problem);
|
|
372
|
+
if (!came)
|
|
373
|
+
throw new Problem(`only ${got.length} of ${TEXT.length} bytes of text came back through cat within ${secondsOf(s.stepMs)} of the last write: your exec holds stdin, or drops some of it. Pass each write on as it comes`);
|
|
374
|
+
return "the same text written to stdin came back unchanged through cat";
|
|
311
375
|
},
|
|
312
|
-
/**
|
|
376
|
+
/** Large random text through cat, read while it is written, compared by sha256, all within largeMs. */
|
|
313
377
|
async large(s, { largeBytes, largeMs }) {
|
|
314
|
-
const payload =
|
|
378
|
+
const payload = randomText(largeBytes);
|
|
315
379
|
const started = Date.now();
|
|
316
380
|
const by = new Deadline(largeMs);
|
|
317
381
|
const run = await s.start(["cat"], true);
|
|
318
|
-
await s.write(run, payload, `${largeBytes} random
|
|
319
|
-
await
|
|
320
|
-
|
|
321
|
-
throw new Problem(`${run.out.length} of ${largeBytes} bytes came back through cat within ${secondsOf(largeMs)}, and its stdout had not ended: your exec is too slow, or stops passing output on`);
|
|
382
|
+
await s.write(run, payload, `${largeBytes} bytes of random text`, by);
|
|
383
|
+
if (!(await run.out.until(() => run.out.length >= largeBytes, by.left(largeMs), s.signal))) {
|
|
384
|
+
throw new Problem(`${run.out.length} of ${largeBytes} bytes of text came back through cat within ${secondsOf(largeMs)}: your exec is too slow, or stops passing output on`);
|
|
322
385
|
}
|
|
323
|
-
await s.exit(run, by.left(s.stepMs), "cat");
|
|
324
|
-
if (by.passed())
|
|
325
|
-
throw new Problem(`${largeBytes} bytes through cat took ${secondsOf(Date.now() - started)}, past ${secondsOf(largeMs)}: your exec is too slow`);
|
|
326
386
|
const got = run.out.bytes();
|
|
327
387
|
const sent = createHash("sha256").update(payload).digest("hex");
|
|
328
388
|
const back = createHash("sha256").update(got).digest("hex");
|
|
329
389
|
if (sent !== back) {
|
|
330
|
-
throw new Problem(`${largeBytes} random
|
|
390
|
+
throw new Problem(`${largeBytes} bytes of random text went in, ${got.length} came back with sha256 ${back.slice(0, 16)}…, not ${sent.slice(0, 16)}…: ${textProblem(payload, got, "through cat") ?? "they differ"}`);
|
|
331
391
|
}
|
|
332
|
-
return `${largeBytes} random
|
|
392
|
+
return `${largeBytes} bytes of random text came back through cat with the same sha256 in ${secondsOf(Date.now() - started)}`;
|
|
333
393
|
},
|
|
334
394
|
/** Output comes back while the process runs: printf, then a sleep that never ends on its own. */
|
|
335
395
|
async "stdout-live"(s) {
|
|
@@ -368,15 +428,58 @@ const CHECKS = {
|
|
|
368
428
|
: `write ${i + 1} to cat, with stdin still open, never came back on stdout in ${secondsOf(s.stepMs)}: your exec holds stdin until end(), or output until the process exits (see stdout-live)`);
|
|
369
429
|
}
|
|
370
430
|
}
|
|
371
|
-
const problem =
|
|
431
|
+
const problem = textProblem(Buffer.concat(rounds), run.out.bytes(), "through cat");
|
|
372
432
|
if (problem)
|
|
373
433
|
throw new Problem(problem);
|
|
374
|
-
await s.end(run);
|
|
375
|
-
const code = await s.exit(run, s.stepMs, "cat");
|
|
376
|
-
if (code !== 0)
|
|
377
|
-
throw new Problem(`cat exited ${code} after end(), not 0`);
|
|
378
434
|
return "two writes came back through cat, each before the next was written, while stdin stayed open";
|
|
379
435
|
},
|
|
436
|
+
/**
|
|
437
|
+
* stdin keeps coming while stdout is left unread for unreadMs; then stdout is read, and every byte comes back, in
|
|
438
|
+
* order. A write may wait while nobody reads stdout, but once stdout is read it goes on: an exec whose stdin waits on
|
|
439
|
+
* a stalled reader for good deadlocks the daemon's one stream (microsandbox holds a 64 KiB stdin window per execution).
|
|
440
|
+
*/
|
|
441
|
+
async "stdout-unread"(s, { unreadMs }) {
|
|
442
|
+
let read = () => { };
|
|
443
|
+
const run = await s.start(["cat"], true, new Promise((done) => (read = done)));
|
|
444
|
+
const started = Date.now();
|
|
445
|
+
const readAt = started + unreadMs;
|
|
446
|
+
const reading = setTimeout(read, unreadMs);
|
|
447
|
+
const sent = [];
|
|
448
|
+
let written = 0;
|
|
449
|
+
try {
|
|
450
|
+
// Every write, paced over unreadMs: one that waits for the reader goes on once stdout is read, and the rest follow.
|
|
451
|
+
// All of them are answered within stepMs of stdout being read: one deadline, not a step per write.
|
|
452
|
+
for (let i = 0; i < UNREAD_WRITES && !s.signal?.aborted; i++) {
|
|
453
|
+
await pause(started + (i * unreadMs) / UNREAD_WRITES - Date.now(), s.signal);
|
|
454
|
+
const chunk = Buffer.alloc(UNREAD_CHUNK, `write ${String(i + 1).padStart(2, "0")} `);
|
|
455
|
+
const madeUnread = Date.now() < readAt;
|
|
456
|
+
const answered = await within(Promise.resolve().then(() => run.proc.write(chunk)), Math.max(1, readAt + s.stepMs - Date.now()), LATE, s.signal).catch((error) => {
|
|
457
|
+
throw new Problem(`write() to cat failed while its stdout was left unread, with ${written} bytes written: ${words(error)}`);
|
|
458
|
+
});
|
|
459
|
+
if (answered === LATE && s.signal?.aborted)
|
|
460
|
+
throw new Problem(`writing to cat was stopped, with ${written} bytes written`);
|
|
461
|
+
if (answered === LATE && !madeUnread)
|
|
462
|
+
throw new Problem(`the ${UNREAD_WRITES} writes to cat ran past ${secondsOf(s.stepMs)} after stdout was read, with ${written} bytes written: your exec's writes are too slow`);
|
|
463
|
+
if (answered === LATE) {
|
|
464
|
+
throw new Problem(`write ${i + 1} to cat, made while its stdout was left unread, still had no answer ${secondsOf(s.stepMs)} after stdout was read again (${written} bytes written): your exec's stdin waits for stdout to be read and does not go on once it is, so one stalled reader deadlocks the stream. Let stdin wait only until stdout is read`);
|
|
465
|
+
}
|
|
466
|
+
sent.push(chunk);
|
|
467
|
+
written += chunk.length;
|
|
468
|
+
}
|
|
469
|
+
await pause(readAt - Date.now(), s.signal);
|
|
470
|
+
}
|
|
471
|
+
finally {
|
|
472
|
+
clearTimeout(reading);
|
|
473
|
+
read();
|
|
474
|
+
}
|
|
475
|
+
if (!(await run.out.until(() => run.out.length >= written, s.stepMs, s.signal))) {
|
|
476
|
+
throw new Problem(`${run.out.length} of ${written} bytes came back through cat within ${secondsOf(s.stepMs)} of stdout being read`);
|
|
477
|
+
}
|
|
478
|
+
const problem = textProblem(Buffer.concat(sent), run.out.bytes(), "through cat");
|
|
479
|
+
if (problem)
|
|
480
|
+
throw new Problem(`${problem}; stdout was left unread ${secondsOf(unreadMs)} while stdin was written: output nobody reads yet is held until it is read, never dropped`);
|
|
481
|
+
return `${written} bytes written to cat while its stdout was left unread for ${secondsOf(unreadMs)} all came back, in order, once it was read`;
|
|
482
|
+
},
|
|
380
483
|
/** stderr comes back apart from stdout. */
|
|
381
484
|
async stderr(s) {
|
|
382
485
|
const run = await s.start(["sh", "-c", "printf to-stdout; printf to-stderr >&2"], false);
|
|
@@ -449,12 +552,144 @@ const CHECKS = {
|
|
|
449
552
|
return `a process that slept ${seconds} s, silent, ran to its end and printed "done"`;
|
|
450
553
|
},
|
|
451
554
|
};
|
|
555
|
+
/**
|
|
556
|
+
* The capability probe, one sh script run through exec (as root, as exec runs): a tab-separated line for each thing it
|
|
557
|
+
* reads, each value on one line, and every line of the kernel's TCP tables as a "tcp" line. readFacts reads it. It needs
|
|
558
|
+
* no ss, ip or util-linux beyond unshare, and says "none" where the machine lacks unshare.
|
|
559
|
+
*/
|
|
560
|
+
export const CAPABILITY_SCRIPT = [
|
|
561
|
+
`line() { printf '%s\\t%s\\n' "$1" "$(printf '%s' "$2" | tr '\\n\\t' ' ')"; }`,
|
|
562
|
+
'line uid "$(id -u 2>&1)"',
|
|
563
|
+
'line arch "$(uname -m 2>&1)"',
|
|
564
|
+
'line kernel "$(uname -sr 2>&1)"',
|
|
565
|
+
`if d=$(dmesg 2>/dev/null); then line gvisor "$(printf '%s' "$d" | grep -i gvisor | head -n 1)"; else line gvisor unread; fi`,
|
|
566
|
+
'if command -v unshare >/dev/null 2>&1; then e=$(unshare -n true 2>&1); line netns "$? $e"; e=$(unshare -Urn true 2>&1); line userns "$? $e"; else line netns none; fi',
|
|
567
|
+
'if [ -e /dev/fuse ]; then e=$( (: <>/dev/fuse) 2>&1); line fuse "$? $e"; else line fuse absent; fi',
|
|
568
|
+
`for f in /proc/net/tcp /proc/net/tcp6; do if [ -r "$f" ]; then line table "$f"; while read -r l; do printf 'tcp\\t%s\\n' "$l"; done < "$f"; else line unreadable "$f"; fi; done`,
|
|
569
|
+
"true",
|
|
570
|
+
].join("\n");
|
|
571
|
+
/** A /proc/net/tcp{,6} address, hex as the kernel writes it (each 32-bit word in host order, little-endian here), as text. */
|
|
572
|
+
function tcpAddress(hex) {
|
|
573
|
+
const bytes = Buffer.from(hex, "hex");
|
|
574
|
+
for (let at = 0; at + 4 <= bytes.length; at += 4)
|
|
575
|
+
bytes.subarray(at, at + 4).reverse();
|
|
576
|
+
if (bytes.length === 4)
|
|
577
|
+
return [...bytes].join(".");
|
|
578
|
+
const groups = Array.from({ length: 8 }, (_, i) => bytes.readUInt16BE(i * 2).toString(16));
|
|
579
|
+
return new URL(`http://[${groups.join(":")}]`).hostname;
|
|
580
|
+
}
|
|
581
|
+
/** The most listeners the report names; a vendor's machine has a handful, a developer's box hundreds. */
|
|
582
|
+
const MAX_LISTENERS_SHOWN = 24;
|
|
583
|
+
/** The TCP listeners in the probe's "tcp" lines: address:port, each once, in the order the kernel lists them. */
|
|
584
|
+
export function tcpListeners(lines) {
|
|
585
|
+
const found = [];
|
|
586
|
+
for (const line of lines) {
|
|
587
|
+
const [, local = "", , state] = line.trim().split(/\s+/);
|
|
588
|
+
const match = /^([0-9A-F]{8}|[0-9A-F]{32}):([0-9A-F]{4})$/i.exec(local);
|
|
589
|
+
if (state !== "0A" || match === null)
|
|
590
|
+
continue;
|
|
591
|
+
const at = `${tcpAddress(match[1])}:${Number.parseInt(match[2], 16)}`;
|
|
592
|
+
if (!found.includes(at))
|
|
593
|
+
found.push(at);
|
|
594
|
+
}
|
|
595
|
+
return found;
|
|
596
|
+
}
|
|
597
|
+
/** What `<code> <words>` says of a command the probe ran: whether it worked, and its words. */
|
|
598
|
+
function ranOf(text) {
|
|
599
|
+
const match = /^(\d+) ?(.*)$/.exec(text ?? "");
|
|
600
|
+
return match === null ? undefined : { ok: match[1] === "0", said: match[2].trim() };
|
|
601
|
+
}
|
|
602
|
+
/** The probe's output as facts, each with what it means for the provider. */
|
|
603
|
+
export function readFacts(output) {
|
|
604
|
+
const values = new Map();
|
|
605
|
+
const tcp = [];
|
|
606
|
+
/** The TCP tables read, and those that could not be. */
|
|
607
|
+
const tables = { read: [], unreadable: [] };
|
|
608
|
+
for (const line of output.split("\n")) {
|
|
609
|
+
const tab = line.indexOf("\t");
|
|
610
|
+
if (tab < 0)
|
|
611
|
+
continue;
|
|
612
|
+
const [key, value] = [line.slice(0, tab), line.slice(tab + 1).trim()];
|
|
613
|
+
if (key === "tcp")
|
|
614
|
+
tcp.push(value);
|
|
615
|
+
else if (key === "table")
|
|
616
|
+
tables.read.push(value);
|
|
617
|
+
else if (key === "unreadable")
|
|
618
|
+
tables.unreadable.push(value);
|
|
619
|
+
else if (!values.has(key))
|
|
620
|
+
values.set(key, value);
|
|
621
|
+
}
|
|
622
|
+
const facts = [];
|
|
623
|
+
const uid = values.get("uid") ?? "";
|
|
624
|
+
facts.push(uid === "0"
|
|
625
|
+
? { id: "root", value: "uid 0", means: "exec runs as root, as the adapter needs: the lines below are what root can do" }
|
|
626
|
+
: { id: "root", value: uid === "" ? "not read" : `uid ${uid}`, means: "exec does not run as root: the adapter installs its daemon as root through exec, so run it as root (or through passwordless sudo); the lines below are what this user can do" });
|
|
627
|
+
const netns = values.get("netns");
|
|
628
|
+
const own = ranOf(netns);
|
|
629
|
+
const inUser = ranOf(values.get("userns"));
|
|
630
|
+
if (netns === "none")
|
|
631
|
+
facts.push({ id: "netns", value: "no unshare program", means: "not read: the machine has no unshare (util-linux), so whether root can make a network namespace shows only at the Core run" });
|
|
632
|
+
else if (own?.ok)
|
|
633
|
+
facts.push({ id: "netns", value: "unshare -n works", means: "root makes a network namespace: our fence holds network none, open and allow (netns)" });
|
|
634
|
+
else if (own !== undefined && inUser?.ok) {
|
|
635
|
+
facts.push({ id: "netns", value: `unshare -n failed (${own.said || "no words"}); unshare -Urn works`, means: "root makes a network namespace only inside a user namespace, as on gVisor: our fence holds network none, open and allow there (userns-netns)" });
|
|
636
|
+
}
|
|
637
|
+
else {
|
|
638
|
+
const why = [own && `unshare -n failed (${own.said || "no words"})`, inUser && `unshare -Urn failed (${inUser.said || "no words"})`].filter(Boolean).join("; ") || "not read";
|
|
639
|
+
facts.push({ id: "netns", value: why, means: "no netns: network none, open and allow can't be held by our fence on this vendor" });
|
|
640
|
+
}
|
|
641
|
+
const fuse = values.get("fuse");
|
|
642
|
+
const opened = ranOf(fuse);
|
|
643
|
+
if (fuse === "absent")
|
|
644
|
+
facts.push({ id: "fuse", value: "no /dev/fuse", means: "no Archil mount (mount:archil) on this vendor: the Archil client needs /dev/fuse" });
|
|
645
|
+
else if (opened?.ok)
|
|
646
|
+
facts.push({ id: "fuse", value: "/dev/fuse opens", means: "an Archil mount (mount:archil) can be made here" });
|
|
647
|
+
else
|
|
648
|
+
facts.push({ id: "fuse", value: opened ? `/dev/fuse does not open (${opened.said || "no words"})` : "not read", means: "no Archil mount (mount:archil) on this vendor until root can open /dev/fuse" });
|
|
649
|
+
const arch = values.get("arch") ?? "";
|
|
650
|
+
const goArch = arch === "x86_64" || arch === "amd64" ? "amd64" : arch === "aarch64" || arch === "arm64" ? "arm64" : undefined;
|
|
651
|
+
facts.push({ id: "arch", value: arch || "not read", means: goArch ? `facts.arch "${goArch}"` : "neither amd64 nor arm64: computerd is built for those two alone" });
|
|
652
|
+
const kernel = values.get("kernel") || "not read";
|
|
653
|
+
const gvisor = values.get("gvisor") ?? "unread";
|
|
654
|
+
const isolationCases = "the isolation cases show how its fences hold";
|
|
655
|
+
if (gvisor !== "unread" && gvisor !== "") {
|
|
656
|
+
facts.push({ id: "kernel", value: `gVisor (${kernel} as it reports; dmesg: ${gvisor.slice(0, 80)})`, means: "gVisor: root has no CAP_SYS_ADMIN and the network stack is gVisor's own, so run the isolation cases here; a Docker stand-in does not show how it behaves" });
|
|
657
|
+
}
|
|
658
|
+
else {
|
|
659
|
+
const marker = gvisor === "" ? "no gVisor marker in dmesg" : "dmesg could not be read, so gVisor is not ruled out";
|
|
660
|
+
facts.push({ id: "kernel", value: `${kernel} (${marker})`, means: `the kernel as it reports itself: ${isolationCases}` });
|
|
661
|
+
}
|
|
662
|
+
const listeners = tcpListeners(tcp);
|
|
663
|
+
const shownListeners = listeners.length > MAX_LISTENERS_SHOWN ? `${listeners.slice(0, MAX_LISTENERS_SHOWN).join(", ")} and ${listeners.length - MAX_LISTENERS_SHOWN} more` : listeners.join(", ");
|
|
664
|
+
const unread = tables.unreadable.length > 0 ? ` (${tables.unreadable.join(" and ")} could not be read)` : "";
|
|
665
|
+
if (tables.read.length === 0) {
|
|
666
|
+
facts.push({ id: "listeners", value: `not read${unread}`, means: "the listeners are unknown: find the vendor agent's ports some other way before you set facts.vendorAgentPorts" });
|
|
667
|
+
}
|
|
668
|
+
else if (listeners.length > 0) {
|
|
669
|
+
facts.push({ id: "listeners", value: `${shownListeners}${unread}`, means: "TCP listeners before AgentRun runs anything: the vendor's agent and services. Put the agent's ports in facts.vendorAgentPorts, so isolation.vendor-agent checks the computer's programs reach none of them" });
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
facts.push({ id: "listeners", value: `none${unread}`, means: unread === "" ? "no TCP listener before AgentRun runs anything: facts.vendorAgentPorts may be []" : `no TCP listener in ${tables.read.join(" or ")}: check the table that could not be read before you set facts.vendorAgentPorts to []` });
|
|
673
|
+
}
|
|
674
|
+
return facts;
|
|
675
|
+
}
|
|
676
|
+
/** The capability probe through exec: its facts, or a Problem in words when exec could not run it. */
|
|
677
|
+
async function probe(session) {
|
|
678
|
+
const run = await session.start(["sh", "-c", CAPABILITY_SCRIPT], false);
|
|
679
|
+
if (!(await run.out.end(session.stepMs, session.signal)))
|
|
680
|
+
throw new Problem(`its stdout did not end within ${secondsOf(session.stepMs)}`);
|
|
681
|
+
// The script ends in `true`: any other exit is a shell that broke partway, whose output is not read as facts.
|
|
682
|
+
const code = await session.exit(run, session.stepMs, "the probe");
|
|
683
|
+
if (code !== 0)
|
|
684
|
+
throw new Problem(`the probe's sh exited ${code} (stderr: ${run.err.bytes().toString("utf8").trim().slice(0, 200) || "none"})`);
|
|
685
|
+
return readFacts(run.out.bytes().toString("utf8"));
|
|
686
|
+
}
|
|
452
687
|
/**
|
|
453
688
|
* The exec pre-check on one machine: each check in EXEC_STREAM_CHECKS runs in turn, and the report passes when every one
|
|
454
|
-
* does. host.exec is the only member called.
|
|
689
|
+
* does; then the capability probe, which passes or fails nothing. host.exec is the only member called.
|
|
455
690
|
*/
|
|
456
691
|
export async function checkExecStream(host, machine, options = {}) {
|
|
457
|
-
const { longMs = DEFAULT_LONG_MS, stepMs = DEFAULT_STEP_MS, largeBytes = DEFAULT_LARGE_BYTES, largeMs = DEFAULT_LARGE_MS, signal, onCheck } = options;
|
|
692
|
+
const { longMs = DEFAULT_LONG_MS, stepMs = DEFAULT_STEP_MS, largeBytes = DEFAULT_LARGE_BYTES, largeMs = DEFAULT_LARGE_MS, unreadMs = DEFAULT_UNREAD_MS, signal, onCheck } = options;
|
|
458
693
|
const session = new Session(host, machine, stepMs, signal);
|
|
459
694
|
const done = new Map();
|
|
460
695
|
for (const id of EXEC_STREAM_CHECKS) {
|
|
@@ -464,7 +699,7 @@ export async function checkExecStream(host, machine, options = {}) {
|
|
|
464
699
|
check = { id, status: "fail", words: "the run was aborted before this check", ms: 0 };
|
|
465
700
|
else {
|
|
466
701
|
try {
|
|
467
|
-
const said = await CHECKS[id](session, { longMs, largeBytes, largeMs }, done);
|
|
702
|
+
const said = await CHECKS[id](session, { longMs, largeBytes, largeMs, unreadMs }, done);
|
|
468
703
|
check = { id, status: "pass", words: said, ms: Date.now() - started };
|
|
469
704
|
}
|
|
470
705
|
catch (error) {
|
|
@@ -477,17 +712,34 @@ export async function checkExecStream(host, machine, options = {}) {
|
|
|
477
712
|
onCheck?.(check);
|
|
478
713
|
}
|
|
479
714
|
const checks = [...done.values()];
|
|
480
|
-
|
|
715
|
+
const report = { host: host.descriptor.id, machine, checks, pass: checks.every((check) => check.status === "pass"), facts: [] };
|
|
716
|
+
if (signal?.aborted)
|
|
717
|
+
report.factsProblem = "the run was aborted before the probe";
|
|
718
|
+
else {
|
|
719
|
+
try {
|
|
720
|
+
report.facts = await probe(session);
|
|
721
|
+
}
|
|
722
|
+
catch (error) {
|
|
723
|
+
report.factsProblem = error instanceof Problem ? error.message : `the probe itself failed: ${words(error)}`;
|
|
724
|
+
}
|
|
725
|
+
await session.killAll();
|
|
726
|
+
}
|
|
727
|
+
return report;
|
|
481
728
|
}
|
|
482
|
-
/** The report as a person reads it: one line per check, what failed in words, the verdict last. */
|
|
729
|
+
/** The report as a person reads it: one line per check, what failed in words, the machine's facts, the verdict last. */
|
|
483
730
|
export function formatExecStream(report) {
|
|
484
731
|
const width = Math.max(...EXEC_STREAM_CHECKS.map((id) => id.length));
|
|
485
732
|
const lines = [`exec pre-check · ${report.host} · machine ${report.machine}`];
|
|
486
733
|
for (const check of report.checks)
|
|
487
734
|
lines.push(`${check.status === "pass" ? "✓" : "✗"} ${check.id.padEnd(width)} ${check.words}`);
|
|
735
|
+
lines.push("what the machine offers (facts for the rest of your host, not checks of exec):");
|
|
736
|
+
if (report.factsProblem !== undefined)
|
|
737
|
+
lines.push(` not read: ${report.factsProblem}`);
|
|
738
|
+
for (const fact of report.facts)
|
|
739
|
+
lines.push(`· ${fact.id.padEnd(width)} ${fact.value}: ${fact.means}`);
|
|
488
740
|
const failed = report.checks.filter((check) => check.status === "fail").length;
|
|
489
741
|
lines.push(report.pass
|
|
490
|
-
? "exec PASS: a live, two-way
|
|
742
|
+
? "exec PASS: a live, two-way stream that keeps text intact, with no timeout. Write the rest of your host next."
|
|
491
743
|
: `exec FAIL: ${failed} of ${report.checks.length} checks failed. Fix exec before you write the rest of your host: AgentRun reaches its daemon through it.`);
|
|
492
744
|
return `${lines.join("\n")}\n`;
|
|
493
745
|
}
|
|
@@ -67,6 +67,9 @@ export function formatReport(report) {
|
|
|
67
67
|
// What a provider said through onNote, such as a release whose final sync or checkin did not go cleanly.
|
|
68
68
|
for (const { computer, note } of report.providerNotes ?? [])
|
|
69
69
|
lines.push(`provider note ${computer}: ${note}`);
|
|
70
|
+
// What a vendor plan or rate limit that keeps fewer would refuse: --concurrency caps it.
|
|
71
|
+
const { peak, cap } = report.computers;
|
|
72
|
+
lines.push(`computers alive at once: ${peak} at most${cap === undefined ? "" : ` (--concurrency ${cap})`}`);
|
|
70
73
|
const core = results.filter((r) => levelOf(r) === "core");
|
|
71
74
|
const notDeclared = results.filter((r) => levelOf(r) === "optional").length;
|
|
72
75
|
const full = results.filter((r) => r.level === "full");
|