benignswarm 0.12.65 → 0.12.68
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/dist/args.js +2 -2
- package/dist/commands/admin.js +3 -1
- package/dist/commands/codex-start.js +110 -48
- package/dist/commands/codex.js +11 -8
- package/dist/commands/machine-admin.js +5 -3
- package/dist/commands/machine.js +57 -21
- package/dist/commands/operator.js +27 -1
- package/dist/commands/watch.js +73 -57
- package/dist/commands/wu.js +41 -6
- package/dist/harness.js +21 -0
- package/dist/harnesses.js +268 -0
- package/dist/help.js +16 -8
- package/dist/index.js +13 -3
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/watch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
|
-
import { bindSession,
|
|
3
|
-
import {
|
|
2
|
+
import { bindSession, sessionOfExec, threadOfExec } from "../sessions.js";
|
|
3
|
+
import { startTurn, stopTurn } from "../turn.js";
|
|
4
|
+
import { probeFor, turnHarness } from "../harnesses.js";
|
|
4
5
|
import { applyAck } from "./wake.js";
|
|
5
6
|
import { lingerEnabled, loadSystemdUnit, reloadLaunchAgent, removeService, requireInstall, systemdUnit, systemdUserDir, WATCH_LABEL_PREFIX, watcherServices } from "../install.js";
|
|
6
7
|
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
@@ -49,13 +50,24 @@ export async function watch(p, out) {
|
|
|
49
50
|
if (!Number.isInteger(turnTimeout) || turnTimeout < 5)
|
|
50
51
|
throw new CliError("usage", "--turn-timeout must be a whole number of minutes, at least 5");
|
|
51
52
|
const thread = exec ? threadOfExec(exec) : null;
|
|
53
|
+
// Which harness runs the turns and the session they continue. Codex watchers installed before
|
|
54
|
+
// 0.12.66 carry neither flag: their thread is in the exec command.
|
|
55
|
+
let turn = null;
|
|
52
56
|
if (turnMode) {
|
|
53
57
|
if (!exec)
|
|
54
|
-
throw new CliError("usage", '--turn needs --exec
|
|
58
|
+
throw new CliError("usage", '--turn needs --exec with the command that runs one turn, ending in {text}');
|
|
55
59
|
if (full)
|
|
56
60
|
throw new CliError("usage", "--turn and --full do not mix: a turn starts from one wake-up");
|
|
57
|
-
if (/\bcodex\s+queue\b/.test(exec)
|
|
61
|
+
if (/\bcodex\s+queue\b/.test(exec))
|
|
58
62
|
throw new CliError("usage", "--turn runs the turn itself: --exec must be codex exec resume <thread-id> ... {text}, not codex queue");
|
|
63
|
+
const named = str(p.flags, "harness") ?? (thread ? "codex" : undefined);
|
|
64
|
+
if (!named)
|
|
65
|
+
throw new CliError("usage", "--turn needs --harness <codex|claude-code> and --session <id> (a Codex exec resume command names its thread itself)");
|
|
66
|
+
const harness = turnHarness(named);
|
|
67
|
+
const session = (str(p.flags, "session") ?? (harness === "codex" ? thread : null))?.toLowerCase();
|
|
68
|
+
if (!session)
|
|
69
|
+
throw new CliError("usage", `--turn with --harness ${harness} needs --session <id>: the session its turns continue`);
|
|
70
|
+
turn = { harness, session, timeout: turnTimeout };
|
|
59
71
|
}
|
|
60
72
|
if (bool(p.flags, "launchd") || bool(p.flags, "service")) {
|
|
61
73
|
if (!exec)
|
|
@@ -68,7 +80,7 @@ export async function watch(p, out) {
|
|
|
68
80
|
throw new CliError("usage", `--env ${n}: not set in this shell; run this from a terminal inside the harness (Antigravity's terminal has ANTIGRAVITY_LS_ADDRESS and ANTIGRAVITY_CSRF_TOKEN)`);
|
|
69
81
|
extraEnv[n] = v;
|
|
70
82
|
}
|
|
71
|
-
return installWatcherService(name, exec, interval, followDelay, extraEnv, str(p.flags, "activity"), out, bool(p.flags, "prune"),
|
|
83
|
+
return installWatcherService(name, exec, interval, followDelay, extraEnv, str(p.flags, "activity"), out, bool(p.flags, "prune"), turn);
|
|
72
84
|
}
|
|
73
85
|
if (!exec && !once)
|
|
74
86
|
throw new CliError("usage", 'watch --exec "<command>" [--interval 30] | watch --once (print and exit) | watch --exec ... --service (launchd on macOS, systemd on Linux)');
|
|
@@ -101,6 +113,7 @@ export async function watch(p, out) {
|
|
|
101
113
|
// the key on its own clock.
|
|
102
114
|
let lastKeyCheck = 0;
|
|
103
115
|
const ctl = { turn: null, failedAt: 0, loggedRunning: null, pausedUntil: 0, pausedAt: 0 };
|
|
116
|
+
const probe = turn ? probeFor(turn.harness, turn.session, name) : null;
|
|
104
117
|
for (;;) {
|
|
105
118
|
if (activity && heartbeatClient)
|
|
106
119
|
lastSample = await heartbeatIfActive(heartbeatClient, activity, lastSample, interval, log);
|
|
@@ -153,8 +166,8 @@ export async function watch(p, out) {
|
|
|
153
166
|
}
|
|
154
167
|
if (!full) {
|
|
155
168
|
try {
|
|
156
|
-
if (
|
|
157
|
-
await turnStep(ctl,
|
|
169
|
+
if (probe)
|
|
170
|
+
await turnStep(ctl, probe, turnTimeout, log, (sink) => wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once, sink), name);
|
|
158
171
|
else
|
|
159
172
|
await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once);
|
|
160
173
|
}
|
|
@@ -356,22 +369,20 @@ const KEY_CHECK_MS = 5 * 60_000;
|
|
|
356
369
|
* leaves the wake-up unacknowledged on the server, so a wake path that keeps failing shows as
|
|
357
370
|
* broken; one that runs past --turn-timeout is stopped and logged.
|
|
358
371
|
*/
|
|
359
|
-
async function turnStep(ctl,
|
|
360
|
-
const rollout = codexRollout(thread);
|
|
372
|
+
async function turnStep(ctl, probe, timeoutMin, log, wake, name) {
|
|
361
373
|
const turn = ctl.turn;
|
|
362
374
|
if (turn) {
|
|
363
|
-
if (!turn.confirmed &&
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
await ackTurn(name, turn.seq, log);
|
|
368
|
-
log(`turn #${turn.seq} started in the session; wake-up acknowledged`);
|
|
369
|
-
}
|
|
375
|
+
if (!turn.confirmed && probe.startedSince(turn.startedMs)) {
|
|
376
|
+
turn.confirmed = true;
|
|
377
|
+
await ackTurn(name, turn.seq, log);
|
|
378
|
+
log(`turn #${turn.seq} started in the session; wake-up acknowledged`);
|
|
370
379
|
}
|
|
371
380
|
if (turn.exit) {
|
|
372
381
|
const mins = Math.round((Date.now() - turn.startedMs) / 60_000);
|
|
373
382
|
const how = turn.exit.code !== null ? `exit ${turn.exit.code}` : `signal ${turn.exit.signal}`;
|
|
374
|
-
|
|
383
|
+
// A harness may exit 0 with an error in its result (Claude Code's is_error), so both count.
|
|
384
|
+
const error = turn.killedForTimeout ? null : probe.turnError();
|
|
385
|
+
if (turn.exit.code === 0 && !error) {
|
|
375
386
|
if (!turn.confirmed)
|
|
376
387
|
await ackTurn(name, turn.seq, log);
|
|
377
388
|
log(`turn #${turn.seq} finished after ${mins} min`);
|
|
@@ -381,16 +392,15 @@ async function turnStep(ctl, thread, timeoutMin, log, wake, name) {
|
|
|
381
392
|
}
|
|
382
393
|
else {
|
|
383
394
|
// Every failure waits before the next turn: a turn started right after one that failed
|
|
384
|
-
// usually fails the same way. A usage limit waits until the time
|
|
385
|
-
const
|
|
386
|
-
const until = usageLimitUntil(error);
|
|
395
|
+
// usually fails the same way. A usage limit waits until the time the harness names.
|
|
396
|
+
const until = probe.limitUntil(error);
|
|
387
397
|
if (until && until > Date.now()) {
|
|
388
398
|
ctl.pausedUntil = until;
|
|
389
399
|
ctl.pausedAt = Date.now();
|
|
390
|
-
log(`TURN #${turn.seq} FAILED: the
|
|
400
|
+
log(`TURN #${turn.seq} FAILED: the ${probe.label} account hit its usage limit; no turns until ${new Date(until).toISOString()} (${probe.label} said: ${error})`);
|
|
391
401
|
}
|
|
392
402
|
else {
|
|
393
|
-
log(`TURN #${turn.seq} FAILED (${how}) after ${mins} min${turn.confirmed ? "" : "; it never started in the session, so the wake-up stays unacknowledged"}${error ? `;
|
|
403
|
+
log(`TURN #${turn.seq} FAILED (${how}) after ${mins} min${turn.confirmed ? "" : "; it never started in the session, so the wake-up stays unacknowledged"}${error ? `; ${probe.label} said: ${error}` : ""}${probe.isLimit(error) ? ` (a usage limit with no reset time named)` : ""}. Next turn in 5 min at the earliest; its output is in this log.`);
|
|
394
404
|
}
|
|
395
405
|
if (!turn.confirmed)
|
|
396
406
|
writeState(name, { ...readState(name), watch_pending: undefined, watch_dormant_logged_at: undefined });
|
|
@@ -405,10 +415,10 @@ async function turnStep(ctl, thread, timeoutMin, log, wake, name) {
|
|
|
405
415
|
}
|
|
406
416
|
return;
|
|
407
417
|
}
|
|
408
|
-
// bschat
|
|
418
|
+
// bschat unpause: the operator switched the harness to an account with quota.
|
|
409
419
|
const unpausedAt = readState(name).turn_unpaused_at ?? 0;
|
|
410
420
|
if (ctl.pausedUntil > Date.now() && unpausedAt > ctl.pausedAt) {
|
|
411
|
-
log(`usage-limit pause lifted by bschat
|
|
421
|
+
log(`usage-limit pause lifted by bschat unpause`);
|
|
412
422
|
ctl.pausedUntil = 0;
|
|
413
423
|
ctl.failedAt = 0;
|
|
414
424
|
}
|
|
@@ -416,36 +426,41 @@ async function turnStep(ctl, thread, timeoutMin, log, wake, name) {
|
|
|
416
426
|
return;
|
|
417
427
|
if (ctl.pausedUntil > Date.now())
|
|
418
428
|
return;
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
429
|
+
// A turn this watcher did not start: an app or a terminal on the same session, or a turn left
|
|
430
|
+
// running by a watcher that restarted (turns run in their own process group and outlive it).
|
|
431
|
+
// Never start a second one.
|
|
432
|
+
const ph = probe.phase();
|
|
433
|
+
if ("missing" in ph) {
|
|
434
|
+
log(ph.missing);
|
|
435
|
+
return;
|
|
436
|
+
}
|
|
437
|
+
// A watcher that restarted after a usage-limit failure reads the pause from the session itself.
|
|
438
|
+
const until = !ph.running && Date.parse(ph.lastErrorAt ?? "") > unpausedAt ? probe.limitUntil(ph.lastError) : null;
|
|
439
|
+
if (until && until > Date.now()) {
|
|
440
|
+
ctl.pausedUntil = until;
|
|
441
|
+
ctl.pausedAt = Date.now();
|
|
442
|
+
log(`the last turn in ${probe.what} hit the ${probe.label} usage limit; no turns until ${new Date(until).toISOString()}`);
|
|
443
|
+
return;
|
|
444
|
+
}
|
|
445
|
+
if (ph.running) {
|
|
446
|
+
const quietMs = Date.now() - Date.parse(ph.lastEventAt ?? ph.startedAt ?? "");
|
|
447
|
+
if (!(quietMs >= timeoutMin * 60_000)) {
|
|
439
448
|
if (ctl.loggedRunning !== ph.startedAt)
|
|
440
|
-
log(`
|
|
449
|
+
log(`a turn started at ${ph.startedAt} is still running in ${probe.what} (an app or terminal on it, or a turn from before a restart); waiting for it`);
|
|
441
450
|
ctl.loggedRunning = ph.startedAt;
|
|
451
|
+
return;
|
|
442
452
|
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
453
|
+
if (probe.label !== "Codex") {
|
|
454
|
+
// A live process still holds the session: a second turn on it would conflict. Say so once.
|
|
455
|
+
if (ctl.loggedRunning !== `stuck:${ph.startedAt}`)
|
|
456
|
+
log(`a process still holds ${probe.what} and has written nothing for ${Math.round(quietMs / 60_000)} min (over the ${timeoutMin}-min limit); starting no turn while it runs. End it to free the session.`);
|
|
457
|
+
ctl.loggedRunning = `stuck:${ph.startedAt}`;
|
|
458
|
+
return;
|
|
459
|
+
}
|
|
460
|
+
// Codex: the rollout shows a turn that never closed; with nothing written for that long it is dead.
|
|
461
|
+
if (ctl.loggedRunning !== ph.startedAt)
|
|
462
|
+
log(`the turn started at ${ph.startedAt} has written nothing for ${Math.round(quietMs / 60_000)} min (over the ${timeoutMin}-min limit); treating it as dead`);
|
|
463
|
+
ctl.loggedRunning = ph.startedAt;
|
|
449
464
|
}
|
|
450
465
|
const st = readState(name);
|
|
451
466
|
if (st.watch_pending) {
|
|
@@ -503,9 +518,9 @@ function run(cmd, stdin, env) {
|
|
|
503
518
|
* Installs the watcher as a service that keeps it running for this identity: a LaunchAgent on macOS,
|
|
504
519
|
* a systemd user unit on Linux. Both run the machine's recorded install from this directory.
|
|
505
520
|
*/
|
|
506
|
-
export function installWatcherService(name, exec, interval, followDelay, extraEnv, activity, out, prune = false,
|
|
521
|
+
export function installWatcherService(name, exec, interval, followDelay, extraEnv, activity, out, prune = false, turn = null) {
|
|
507
522
|
if (process.platform === "darwin")
|
|
508
|
-
return installLaunchd(name, exec, interval, followDelay, extraEnv, activity, out, prune,
|
|
523
|
+
return installLaunchd(name, exec, interval, followDelay, extraEnv, activity, out, prune, turn);
|
|
509
524
|
if (process.platform !== "linux")
|
|
510
525
|
throw new CliError("unsupported", "--service runs watchers under launchd (macOS) or systemd (Linux); on this system run bschat watch under your own supervisor");
|
|
511
526
|
const slug = name.replace("/", ".");
|
|
@@ -513,7 +528,7 @@ export function installWatcherService(name, exec, interval, followDelay, extraEn
|
|
|
513
528
|
const logDir = join(homedir(), ".bschat", "logs");
|
|
514
529
|
mkdirSync(systemdUserDir(), { recursive: true });
|
|
515
530
|
mkdirSync(logDir, { recursive: true });
|
|
516
|
-
const args = [requireInstall().bin, "watch", "--as", name, "--exec", exec, "--interval", String(interval), "--follow-delay", String(followDelay), ...(activity ? ["--activity", activity] : []), ...(prune ? ["--prune"] : []), ...(
|
|
531
|
+
const args = [requireInstall().bin, "watch", "--as", name, "--exec", exec, "--interval", String(interval), "--follow-delay", String(followDelay), ...(activity ? ["--activity", activity] : []), ...(prune ? ["--prune"] : []), ...turnArgs(turn)];
|
|
517
532
|
const env = { PATH: process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin", HOME: homedir(), ...extraEnv };
|
|
518
533
|
const path = join(systemdUserDir(), `${label}.service`);
|
|
519
534
|
writeFileSync(path, systemdUnit(label, args, process.cwd(), env, logDir));
|
|
@@ -532,7 +547,7 @@ export function installWatcherService(name, exec, interval, followDelay, extraEn
|
|
|
532
547
|
].filter(Boolean).join("\n"), { unit: path, label, program: args[0], linger });
|
|
533
548
|
}
|
|
534
549
|
/** Writes a launchd agent that keeps `bschat watch` running for this identity on macOS. */
|
|
535
|
-
function installLaunchd(name, exec, interval, followDelay, extraEnv, activity, out, prune = false,
|
|
550
|
+
function installLaunchd(name, exec, interval, followDelay, extraEnv, activity, out, prune = false, turn = null) {
|
|
536
551
|
if (process.platform !== "darwin")
|
|
537
552
|
throw new CliError("unsupported", "--launchd is macOS only; on Linux run `bschat watch` under a systemd user service");
|
|
538
553
|
const slug = name.replace("/", ".");
|
|
@@ -555,8 +570,8 @@ function installLaunchd(name, exec, interval, followDelay, extraEnv, activity, o
|
|
|
555
570
|
<string>--interval</string><string>${interval}</string>
|
|
556
571
|
<string>--follow-delay</string><string>${followDelay}</string>${activity ? `
|
|
557
572
|
<string>--activity</string><string>${escapeXml(activity)}</string>` : ""}${prune ? `
|
|
558
|
-
<string>--prune</string>` : ""}${
|
|
559
|
-
|
|
573
|
+
<string>--prune</string>` : ""}${turnArgs(turn).length ? `
|
|
574
|
+
${turnArgs(turn).map((a) => `<string>${escapeXml(a)}</string>`).join("")}` : ""}
|
|
560
575
|
</array>
|
|
561
576
|
<key>EnvironmentVariables</key><dict><key>PATH</key><string>${escapeXml(process.env.PATH ?? "/usr/local/bin:/usr/bin:/bin")}</string><key>HOME</key><string>${homedir()}</string>${Object.entries(extraEnv).map(([k, v]) => `<key>${escapeXml(k)}</key><string>${escapeXml(v)}</string>`).join("")}</dict>
|
|
562
577
|
<key>WorkingDirectory</key><string>${escapeXml(process.cwd())}</string>
|
|
@@ -577,6 +592,7 @@ function installLaunchd(name, exec, interval, followDelay, extraEnv, activity, o
|
|
|
577
592
|
bindSession(sess.kind, sess.id, name);
|
|
578
593
|
out.print(`Wrote ${path} and (re)loaded it: the watcher is running ${program[0]}.${Object.keys(extraEnv).length ? `\nCaptured env: ${Object.keys(extraEnv).join(", ")} (re-run this command if the harness restarts and these change)` : ""}\nStop it: launchctl bootout gui/$(id -u)/${label}\nLogs: ${logDir}/watch.${slug}.*.log\nCheck it: bschat doctor\nThe watcher runs from ${process.cwd()} so the repo identity file applies.`, { plist: path, label, program: program[0] });
|
|
579
594
|
}
|
|
595
|
+
const turnArgs = (t) => (t ? ["--turn", "--turn-timeout", String(t.timeout), "--harness", t.harness, "--session", t.session] : []);
|
|
580
596
|
function escapeXml(s) {
|
|
581
597
|
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">");
|
|
582
598
|
}
|
package/dist/commands/wu.js
CHANGED
|
@@ -177,6 +177,15 @@ export async function wu(p, out) {
|
|
|
177
177
|
out.print(`${fmt(r.unit)}\nReopened: continue on the same branch and resubmit this unit.`, r);
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
+
case "explain": {
|
|
181
|
+
// The operator asked (the banner's Explain) for the question on this unit in plain words.
|
|
182
|
+
const text = p.positionals.slice(3).join(" ").trim();
|
|
183
|
+
if (!text)
|
|
184
|
+
throw new CliError("usage", 'wu explain <n> "the question in plain words: what it is about, why it needs the operator, what to decide, what happens either way"');
|
|
185
|
+
const r = await client.call("POST", `${base}/${num()}/question/explanation`, { text });
|
|
186
|
+
out.print(`${fmt(r.unit)}\nExplained; the operator sees it with the question.`, r);
|
|
187
|
+
return;
|
|
188
|
+
}
|
|
180
189
|
case "propose": {
|
|
181
190
|
const text = (p.positionals.slice(3).join(" ") || str(p.flags, "propose") || "").trim();
|
|
182
191
|
if (!text)
|
|
@@ -254,8 +263,14 @@ export async function wu(p, out) {
|
|
|
254
263
|
case "done": {
|
|
255
264
|
const def = await processDef();
|
|
256
265
|
const merged = str(p.flags, "merged") ?? null;
|
|
257
|
-
const
|
|
258
|
-
|
|
266
|
+
const unit = (await client.call("GET", `${base}/${num()}`)).unit;
|
|
267
|
+
const landsIn = unit.target ?? def.merge.target_branch;
|
|
268
|
+
if (unit.replay_of) {
|
|
269
|
+
// A replay is an evaluation: it closes without merging (the server records it as evaluated).
|
|
270
|
+
if (merged)
|
|
271
|
+
throw new CliError("usage", `WU #${num()} is a replay, compared and never merged: close it without --merged`);
|
|
272
|
+
}
|
|
273
|
+
else if (merged) {
|
|
259
274
|
// Where pushes are required the remote target is the truth, not this machine's copy of it.
|
|
260
275
|
const target = def.merge.require_pushed ? (fetchRef(landsIn) ? `origin/${landsIn}` : null) : landsIn;
|
|
261
276
|
if (target === null)
|
|
@@ -645,7 +660,10 @@ export async function lock(p, out) {
|
|
|
645
660
|
? `You hold ${lockName}${r.lock.machine ? ` on ${r.lock.machine}` : " (shared)"}${unit ? ` for WU #${unit}` : ""}. Release it when done: bschat unlock ${lockName}`
|
|
646
661
|
: `${lockName} is held by ${r.lock.holder_name}${r.lock.unit ? ` (WU #${r.lock.unit})` : ""}; you are ${r.position === 1 ? "next" : `#${r.position} in line`}. You will be @mentioned when it is yours; do not poll. Leave the queue: bschat unlock ${lockName}`, r);
|
|
647
662
|
}
|
|
648
|
-
/**
|
|
663
|
+
/**
|
|
664
|
+
* bschat ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."]:
|
|
665
|
+
* a decision only the operator can make, in a shape they can follow without the thread.
|
|
666
|
+
*/
|
|
649
667
|
export async function askOperator(p, out) {
|
|
650
668
|
const name = resolveAgentName(str(p.flags, "as"));
|
|
651
669
|
const creds = loadAgent(name);
|
|
@@ -654,10 +672,12 @@ export async function askOperator(p, out) {
|
|
|
654
672
|
if (!project)
|
|
655
673
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
656
674
|
const text = (p.positionals.slice(1).join(" ") || str(p.flags, "question") || "").trim();
|
|
657
|
-
if (
|
|
658
|
-
|
|
675
|
+
const fields = { plain: str(p.flags, "plain") ?? "", blocks: str(p.flags, "blocks") ?? "", if_yes: str(p.flags, "if-yes") ?? "", if_no: str(p.flags, "if-no") ?? "" };
|
|
676
|
+
const missing = Object.entries({ "--plain": fields.plain, "--blocks": fields.blocks, "--if-yes": fields.if_yes, "--if-no": fields.if_no }).filter(([, v]) => !v.trim()).map(([k]) => k);
|
|
677
|
+
if (!text || missing.length)
|
|
678
|
+
throw new CliError("usage", `ask-operator "exactly what you need the operator to do or decide" --plain "one or two plain sentences for someone who has not read the thread: what this is about (no unit numbers or jargon unexplained)" --blocks "what's stuck until they answer" --if-yes "what happens then" --if-no "what happens then" [--propose "your recommended answer, approvable as written"]${missing.length ? `\nmissing: ${missing.join(", ")}` : ""}`);
|
|
659
679
|
const proposal = str(p.flags, "propose") ?? "";
|
|
660
|
-
const r = await client.call("POST", `/projects/${project}/ask-operator`, { text,
|
|
680
|
+
const r = await client.call("POST", `/projects/${project}/ask-operator`, { text, ...fields, proposal });
|
|
661
681
|
out.print(`Asked the operator${proposal ? " with your proposal (they can approve it as written)" : ""}; it is on their console banner and reported to them. You will be @mentioned with the decision. Carry on with what does not depend on it.`, r);
|
|
662
682
|
}
|
|
663
683
|
/**
|
|
@@ -691,3 +711,18 @@ async function roundUsage(client, base, n, name) {
|
|
|
691
711
|
return { harness: session?.harness ?? "unknown", source: "none", scope: "session", since, until, tokens: null, reason: `could not read the session: ${e.message}` };
|
|
692
712
|
}
|
|
693
713
|
}
|
|
714
|
+
/** bschat explain <ask-id> "...": the operator asked (the banner's Explain) for your request in plain words. */
|
|
715
|
+
export async function explainAsk(p, out) {
|
|
716
|
+
const name = resolveAgentName(str(p.flags, "as"));
|
|
717
|
+
const creds = loadAgent(name);
|
|
718
|
+
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name), { effort: str(p.flags, "effort") });
|
|
719
|
+
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
720
|
+
if (!project)
|
|
721
|
+
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
722
|
+
const id = p.positionals[1];
|
|
723
|
+
const text = p.positionals.slice(2).join(" ").trim();
|
|
724
|
+
if (!id || !text)
|
|
725
|
+
throw new CliError("usage", 'explain <ask-id> "your request in plain words: what it is about, why it needs the operator, exactly what to do or decide, what happens on yes and on no"');
|
|
726
|
+
const r = await client.call("POST", `/projects/${project}/asks/${id}/explanation`, { text });
|
|
727
|
+
out.print("Explained; the operator sees it with your request, and it goes out with the next report to them.", r);
|
|
728
|
+
}
|
package/dist/harness.js
CHANGED
|
@@ -307,6 +307,27 @@ export function codexManagedHooks(bin) {
|
|
|
307
307
|
return { requirements, wrapper };
|
|
308
308
|
}
|
|
309
309
|
export const CODEX_APPARMOR_PATH = "/etc/apparmor.d/bschat-codex";
|
|
310
|
+
export const BWRAP_APPARMOR_PATH = "/etc/apparmor.d/bschat-bwrap";
|
|
311
|
+
/**
|
|
312
|
+
* An AppArmor profile that lets the system's bubblewrap create user namespaces, which Claude Code's
|
|
313
|
+
* Linux sandbox runs commands in. Broader than the Codex profile: any local user may then use
|
|
314
|
+
* bubblewrap to make a user namespace, as before Ubuntu 24.04 restricted them, so it is installed
|
|
315
|
+
* only when the operator opts in (machine add --bwrap-userns).
|
|
316
|
+
*/
|
|
317
|
+
export function bwrapAppArmorProfile() {
|
|
318
|
+
return [
|
|
319
|
+
`# bschat: let bubblewrap create the user namespaces sandboxes (Claude Code) need (Ubuntu 24.04+ restricts them).`,
|
|
320
|
+
`# Written by bschat machine prepare --bwrap-userns; remove this file and run apparmor_parser -R on it to undo.`,
|
|
321
|
+
`abi <abi/4.0>,`,
|
|
322
|
+
`include <tunables/global>`,
|
|
323
|
+
``,
|
|
324
|
+
`profile bschat-bwrap /usr/bin/bwrap flags=(unconfined) {`,
|
|
325
|
+
` userns,`,
|
|
326
|
+
` include if exists <local/bschat-bwrap>`,
|
|
327
|
+
`}`,
|
|
328
|
+
``,
|
|
329
|
+
].join("\n");
|
|
330
|
+
}
|
|
310
331
|
/**
|
|
311
332
|
* An AppArmor profile that lets only Codex's own binary create user namespaces, which its Linux
|
|
312
333
|
* sandbox (bubblewrap, built into the binary) needs. Ubuntu 24.04+ restricts unprivileged user
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, readFileSync, readdirSync, statSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { dirname, join } from "node:path";
|
|
5
|
+
import { CliError } from "./errors.js";
|
|
6
|
+
import { codexArchivedRollout, codexRollout } from "./sessions.js";
|
|
7
|
+
import { codexTurnPhase, usageLimitUntil } from "./turn.js";
|
|
8
|
+
/**
|
|
9
|
+
* Harnesses a machine can run headless in turn mode (docs/REMOTE-MACHINES.md, "Harness adapters").
|
|
10
|
+
* Each adapter says how to start a session, what one turn's command is, whether a turn is running in
|
|
11
|
+
* that session (by anyone: an app, a terminal, a turn left by a watcher that restarted), and how the
|
|
12
|
+
* last turn ended. Antigravity is a desktop application with no headless turn and stays hand-run;
|
|
13
|
+
* Gemini CLI no longer accepts personal logins (Google moved individuals to Antigravity).
|
|
14
|
+
*/
|
|
15
|
+
export const TURN_HARNESSES = ["codex", "claude-code"];
|
|
16
|
+
export function turnHarness(h) {
|
|
17
|
+
if (TURN_HARNESSES.includes(h))
|
|
18
|
+
return h;
|
|
19
|
+
throw new CliError("unsupported", `harness ${h} cannot run headless turns; supported: ${TURN_HARNESSES.join(", ")}`);
|
|
20
|
+
}
|
|
21
|
+
export const HARNESS_LABEL = { codex: "Codex", "claude-code": "Claude Code" };
|
|
22
|
+
export const HARNESS_BIN = { codex: "codex", "claude-code": "claude" };
|
|
23
|
+
export function probeFor(harness, session, ref) {
|
|
24
|
+
return harness === "codex" ? codexProbe(session) : claudeProbe(session, ref);
|
|
25
|
+
}
|
|
26
|
+
function codexProbe(thread) {
|
|
27
|
+
const read = () => { const r = codexRollout(thread); return r ? codexTurnPhase(readFileSync(r, "utf8")) : null; };
|
|
28
|
+
return {
|
|
29
|
+
label: "Codex",
|
|
30
|
+
what: `thread ${thread}`,
|
|
31
|
+
phase() {
|
|
32
|
+
const ph = read();
|
|
33
|
+
if (ph)
|
|
34
|
+
return { ...ph, lastErrorAt: ph.lastEventAt };
|
|
35
|
+
return {
|
|
36
|
+
missing: codexArchivedRollout(thread)
|
|
37
|
+
? `thread ${thread} is archived in the Codex app (its session file is in ~/.codex/archived_sessions); starting no turn until it is unarchived`
|
|
38
|
+
: `no session file for thread ${thread} under ~/.codex/sessions; cannot tell whether a turn is running, so starting none`,
|
|
39
|
+
};
|
|
40
|
+
},
|
|
41
|
+
startedSince(ms) { const ph = read(); return !!ph?.startedAt && Date.parse(ph.startedAt) >= ms - 5_000; },
|
|
42
|
+
turnError() { return read()?.lastError ?? null; },
|
|
43
|
+
limitUntil: usageLimitUntil,
|
|
44
|
+
isLimit: (e) => !!e && /usage limit/i.test(e),
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
// ---- Claude Code ----
|
|
48
|
+
const claudeHome = () => process.env.CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude");
|
|
49
|
+
/** A Claude Code session's transcript (~/.claude/projects/<folder>/<id>.jsonl), wherever its folder is. */
|
|
50
|
+
export function claudeTranscript(session) {
|
|
51
|
+
const root = join(claudeHome(), "projects");
|
|
52
|
+
if (!existsSync(root))
|
|
53
|
+
return null;
|
|
54
|
+
for (const d of readdirSync(root, { withFileTypes: true })) {
|
|
55
|
+
if (!d.isDirectory())
|
|
56
|
+
continue;
|
|
57
|
+
const f = join(root, d.name, `${session}.jsonl`);
|
|
58
|
+
if (existsSync(f))
|
|
59
|
+
return f;
|
|
60
|
+
}
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
/** The last turn's output (`claude -p --output-format json`), written by the watcher's turn command. */
|
|
64
|
+
export const claudeResultFile = (ref) => join(homedir(), ".bschat", "logs", `turn.${ref.replace("/", ".")}.json`);
|
|
65
|
+
/** The latest timestamp in a transcript, and the latest user prompt's. */
|
|
66
|
+
export function claudeTranscriptTimes(text) {
|
|
67
|
+
let lastEventAt = null;
|
|
68
|
+
let promptAt = null;
|
|
69
|
+
for (const line of text.split("\n")) {
|
|
70
|
+
if (!line)
|
|
71
|
+
continue;
|
|
72
|
+
let j;
|
|
73
|
+
try {
|
|
74
|
+
j = JSON.parse(line);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
continue;
|
|
78
|
+
} // a line still being written
|
|
79
|
+
if (!j.timestamp)
|
|
80
|
+
continue;
|
|
81
|
+
lastEventAt = j.timestamp;
|
|
82
|
+
if (j.type === "user" && typeof j.message?.content === "string")
|
|
83
|
+
promptAt = j.timestamp;
|
|
84
|
+
}
|
|
85
|
+
return { lastEventAt, promptAt };
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* The error a `claude -p --output-format json` run ended with, or null when it succeeded. Output
|
|
89
|
+
* that is not the result object (a missing session prints plain text) is returned as the error.
|
|
90
|
+
*/
|
|
91
|
+
export function claudeResultError(text) {
|
|
92
|
+
const t = text.trim();
|
|
93
|
+
if (!t)
|
|
94
|
+
return "the turn wrote no result";
|
|
95
|
+
let j;
|
|
96
|
+
try {
|
|
97
|
+
j = JSON.parse(t.split("\n").filter((l) => l.startsWith("{")).pop() ?? "");
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return t.split("\n").pop().slice(0, 500);
|
|
101
|
+
}
|
|
102
|
+
if (!j.is_error)
|
|
103
|
+
return null;
|
|
104
|
+
const parts = [j.result, ...(Array.isArray(j.errors) ? j.errors.map(String) : [])].filter((x) => typeof x === "string" && x.length > 0);
|
|
105
|
+
return `${parts.join("; ") || "error"}${j.terminal_reason ? ` (${j.terminal_reason}${j.api_error_status ? `, HTTP ${j.api_error_status}` : ""})` : ""}`.slice(0, 500);
|
|
106
|
+
}
|
|
107
|
+
export const claudeIsLimit = (e) => !!e && /usage limit|session limit|weekly limit|monthly limit|hit your .* limit|HTTP 429|rate_limit/i.test(e);
|
|
108
|
+
/**
|
|
109
|
+
* When a Claude usage-limit message says it resets ("resets 3pm", "resets at 3:30 PM"), in this
|
|
110
|
+
* machine's local time (the turn ran here), the next such moment after `now`; null when it names none.
|
|
111
|
+
*/
|
|
112
|
+
export function claudeLimitUntil(error, now = Date.now()) {
|
|
113
|
+
if (!claudeIsLimit(error))
|
|
114
|
+
return null;
|
|
115
|
+
const epoch = /\|(\d{10})\b/.exec(error);
|
|
116
|
+
if (epoch)
|
|
117
|
+
return Number(epoch[1]) * 1000;
|
|
118
|
+
const m = /resets?\s+(?:at\s+)?(\d{1,2})(?::(\d{2}))?\s*([ap]m)\b/i.exec(error);
|
|
119
|
+
if (!m)
|
|
120
|
+
return null;
|
|
121
|
+
let h = Number(m[1]) % 12;
|
|
122
|
+
if (m[3].toLowerCase() === "pm")
|
|
123
|
+
h += 12;
|
|
124
|
+
const d = new Date(now);
|
|
125
|
+
d.setHours(h, Number(m[2] ?? 0), 0, 0);
|
|
126
|
+
if (d.getTime() <= now)
|
|
127
|
+
d.setDate(d.getDate() + 1);
|
|
128
|
+
return d.getTime();
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* The command is Claude Code itself (its native binary, or node running its package), not a shell
|
|
132
|
+
* wrapping it and not a bschat watcher whose --exec names the session.
|
|
133
|
+
*/
|
|
134
|
+
export function isClaudeCommand(args) {
|
|
135
|
+
const [first, second = ""] = args.trim().split(/\s+/);
|
|
136
|
+
const base = first.split("/").pop();
|
|
137
|
+
if (base === "claude" || base === "claude.exe")
|
|
138
|
+
return true;
|
|
139
|
+
return /^node(js)?$/.test(base) && /claude-code\/|\/claude$/.test(second);
|
|
140
|
+
}
|
|
141
|
+
/** Processes whose arguments carry this session id (a turn, or someone's `claude --resume <id>`), not counting ps itself. */
|
|
142
|
+
export function sessionProcesses(session, psOutput) {
|
|
143
|
+
const out = psOutput ?? (spawnSync("ps", ["-axo", "pid=,pcpu=,rss=,args="], { encoding: "utf8", maxBuffer: 16 * 1024 * 1024 }).stdout ?? "");
|
|
144
|
+
const found = [];
|
|
145
|
+
for (const line of out.split("\n")) {
|
|
146
|
+
const m = /^\s*(\d+)\s+([\d.]+)\s+(\d+)\s+(.*)$/.exec(line);
|
|
147
|
+
if (m && m[4].includes(session) && isClaudeCommand(m[4]) && Number(m[1]) !== process.pid)
|
|
148
|
+
found.push({ pid: Number(m[1]), cpu: Number(m[2]), rss_bytes: Number(m[3]) * 1024, args: m[4] });
|
|
149
|
+
}
|
|
150
|
+
return found;
|
|
151
|
+
}
|
|
152
|
+
function claudeProbe(session, ref) {
|
|
153
|
+
const resultFile = claudeResultFile(ref);
|
|
154
|
+
const lastResult = () => existsSync(resultFile) ? { error: claudeResultError(readFileSync(resultFile, "utf8")), at: statSync(resultFile).mtime.toISOString() } : null;
|
|
155
|
+
return {
|
|
156
|
+
label: "Claude Code",
|
|
157
|
+
what: `session ${session}`,
|
|
158
|
+
phase() {
|
|
159
|
+
const tr = claudeTranscript(session);
|
|
160
|
+
if (!tr)
|
|
161
|
+
return { missing: `no transcript for Claude Code session ${session} under ${join(claudeHome(), "projects")}; cannot tell whether a turn is running, so starting none` };
|
|
162
|
+
const times = claudeTranscriptTimes(readFileSync(tr, "utf8"));
|
|
163
|
+
// Claude Code writes no turn-ended marker, so a running turn is a process holding the session.
|
|
164
|
+
const running = sessionProcesses(session).length > 0;
|
|
165
|
+
const res = lastResult();
|
|
166
|
+
return { running, startedAt: times.promptAt, lastEventAt: times.lastEventAt, lastError: running ? null : res?.error ?? null, lastErrorAt: res?.at ?? null };
|
|
167
|
+
},
|
|
168
|
+
startedSince(ms) {
|
|
169
|
+
const tr = claudeTranscript(session);
|
|
170
|
+
const p = tr ? claudeTranscriptTimes(readFileSync(tr, "utf8")).promptAt : null;
|
|
171
|
+
return !!p && Date.parse(p) >= ms - 5_000;
|
|
172
|
+
},
|
|
173
|
+
turnError: () => lastResult()?.error ?? null,
|
|
174
|
+
limitUntil: (e) => claudeLimitUntil(e),
|
|
175
|
+
isLimit: claudeIsLimit,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* The Claude Code flags a headless turn runs with. Claude Code's sandbox always lets the agent write
|
|
180
|
+
* its working folder, so read-only cannot be honoured and is refused. workspace-write is its sandbox
|
|
181
|
+
* (refusing to start when the sandbox is unavailable, never running a command outside it), every
|
|
182
|
+
* domain reachable as with Codex, edits allowed in the checkout and the folders `wu start` and bschat
|
|
183
|
+
* write (the checkout's parent, ~/.bschat) plus the machine's writable folders; anything that would
|
|
184
|
+
* need a prompt is denied, since nobody can answer one. danger-full-access skips permissions.
|
|
185
|
+
*/
|
|
186
|
+
export function claudeSettings(sandbox, model, effort, cwd, bschatHome, extraWritable = []) {
|
|
187
|
+
const common = [...(model ? ["--model", model] : []), ...(effort ? ["--effort", effort] : [])];
|
|
188
|
+
if (sandbox === "danger-full-access")
|
|
189
|
+
return [...common, "--permission-mode", "bypassPermissions"];
|
|
190
|
+
if (sandbox === "read-only")
|
|
191
|
+
throw new CliError("unsupported", "Claude Code has no read-only sandbox: its sandbox always lets the agent write its working folder. Use workspace-write (sandboxed; writes limited to the checkout, its unit worktrees, ~/.bschat and the machine's writable folders) or danger-full-access");
|
|
192
|
+
if (sandbox !== "workspace-write")
|
|
193
|
+
throw new CliError("usage", `unknown sandbox ${sandbox}`);
|
|
194
|
+
const dirs = [dirname(cwd), bschatHome, ...extraWritable];
|
|
195
|
+
const settings = {
|
|
196
|
+
sandbox: {
|
|
197
|
+
enabled: true,
|
|
198
|
+
failIfUnavailable: true,
|
|
199
|
+
autoAllowBashIfSandboxed: true,
|
|
200
|
+
allowUnsandboxedCommands: false,
|
|
201
|
+
filesystem: { allowWrite: dirs },
|
|
202
|
+
network: { allowedDomains: ["*"] },
|
|
203
|
+
},
|
|
204
|
+
};
|
|
205
|
+
return [...common, "--permission-mode", "acceptEdits", ...dirs.flatMap((d) => ["--add-dir", d]), "--settings", JSON.stringify(settings)];
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Claude Code's version and login, for the machine report. `claude auth status` only reads the stored
|
|
209
|
+
* credentials: on one machine it said logged in while every call failed with "401 OAuth access token
|
|
210
|
+
* is invalid". So the login is verified with one minimal call (`verifyClaudeLogin`), again whenever
|
|
211
|
+
* the credentials file changes and at most every 6 hours otherwise; only an authentication error
|
|
212
|
+
* counts as logged out, and any other failure is reported as unverified with its error.
|
|
213
|
+
*/
|
|
214
|
+
export function claudeFacts(verify = verifyClaudeLoginCached) {
|
|
215
|
+
const v = spawnSync("claude", ["--version"], { encoding: "utf8", timeout: 30_000 });
|
|
216
|
+
if (v.status !== 0)
|
|
217
|
+
return null;
|
|
218
|
+
const s = spawnSync("claude", ["auth", "status"], { encoding: "utf8", timeout: 30_000 });
|
|
219
|
+
let stored = false;
|
|
220
|
+
let method = "unknown method";
|
|
221
|
+
try {
|
|
222
|
+
const j = JSON.parse(s.stdout);
|
|
223
|
+
stored = s.status === 0 && j.loggedIn === true;
|
|
224
|
+
method = j.authMethod ?? method;
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
stored = false;
|
|
228
|
+
}
|
|
229
|
+
if (!stored)
|
|
230
|
+
return { version: v.stdout.trim(), logged_in: false, login: "not logged in", verified: { ok: false, error: "no stored login" } };
|
|
231
|
+
const verified = verify();
|
|
232
|
+
const login = verified.ok === true ? `logged in (${method})` : verified.ok === false ? `stored login rejected: ${verified.error}` : `logged in (${method}), not verified: ${verified.error}`;
|
|
233
|
+
return { version: v.stdout.trim(), logged_in: verified.ok !== false, login: login.slice(0, 200), verified };
|
|
234
|
+
}
|
|
235
|
+
/** One minimal headless call; ok false only when Claude Code reports an authentication failure. */
|
|
236
|
+
export function verifyClaudeLogin() {
|
|
237
|
+
const r = spawnSync("claude", ["-p", "Reply OK", "--model", "claude-haiku-4-5-20251001", "--output-format", "json"], { encoding: "utf8", timeout: 120_000, cwd: homedir() });
|
|
238
|
+
const error = claudeResultError(r.stdout ?? "") ?? (r.status !== 0 ? `${r.stderr ?? ""}`.trim().split("\n")[0] || `exit ${r.status}` : null);
|
|
239
|
+
if (!error)
|
|
240
|
+
return { ok: true, error: null };
|
|
241
|
+
return { ok: claudeIsAuthError(error) ? false : null, error: error.slice(0, 200) };
|
|
242
|
+
}
|
|
243
|
+
export const claudeIsAuthError = (e) => /401|403|authenticat|not logged in|\/login|oauth token|invalid api key/i.test(e);
|
|
244
|
+
let loginCache = null;
|
|
245
|
+
function verifyClaudeLoginCached() {
|
|
246
|
+
const cred = join(claudeHome(), ".credentials.json");
|
|
247
|
+
const key = existsSync(cred) ? String(statSync(cred).mtimeMs) : "keychain";
|
|
248
|
+
if (loginCache && loginCache.key === key && Date.now() - loginCache.at < 6 * 60 * 60_000)
|
|
249
|
+
return loginCache.result;
|
|
250
|
+
loginCache = { key, at: Date.now(), result: verifyClaudeLogin() };
|
|
251
|
+
return loginCache.result;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Whether Claude Code's sandbox can run here. On macOS it uses the system's sandbox-exec; on Linux
|
|
255
|
+
* bubblewrap and socat, and bubblewrap needs unprivileged user namespaces (Ubuntu 24.04 restricts
|
|
256
|
+
* them with AppArmor), so this runs bubblewrap the way a sandboxed command would.
|
|
257
|
+
*/
|
|
258
|
+
export function claudeSandbox() {
|
|
259
|
+
if (process.platform === "darwin")
|
|
260
|
+
return existsSync("/usr/bin/sandbox-exec") ? { ok: true, error: null } : { ok: false, error: "sandbox-exec is missing" };
|
|
261
|
+
if (process.platform !== "linux")
|
|
262
|
+
return { ok: false, error: `no Claude Code sandbox on ${process.platform}` };
|
|
263
|
+
const missing = ["bwrap", "socat"].filter((b) => spawnSync("/bin/sh", ["-c", `command -v ${b}`]).status !== 0);
|
|
264
|
+
if (missing.length)
|
|
265
|
+
return { ok: false, error: `${missing.join(" and ")} not installed (sudo apt-get install bubblewrap socat)` };
|
|
266
|
+
const r = spawnSync("bwrap", ["--ro-bind", "/", "/", "--dev", "/dev", "--proc", "/proc", "--unshare-all", "--die-with-parent", "true"], { encoding: "utf8", timeout: 30_000 });
|
|
267
|
+
return r.status === 0 ? { ok: true, error: null } : { ok: false, error: `bubblewrap cannot start: ${`${r.stderr ?? ""}`.trim().split("\n")[0].slice(0, 250) || `exit ${r.status}`}` };
|
|
268
|
+
}
|