benignswarm 0.12.102 → 0.12.103
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 +1 -1
- package/dist/commands/hook.js +12 -10
- package/dist/commands/machine-admin.js +7 -4
- package/dist/commands/machine.js +96 -7
- package/dist/commands/watch.js +4 -4
- package/dist/harness.js +18 -0
- package/dist/help.js +6 -4
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/args.js
CHANGED
|
@@ -41,7 +41,7 @@ export const BOOL_FLAGS = [
|
|
|
41
41
|
"read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "template", "scope-only", "unread",
|
|
42
42
|
"pending", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind",
|
|
43
43
|
"all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive",
|
|
44
|
-
"approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor",
|
|
44
|
+
"approve", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "agy-userns", "print-apparmor",
|
|
45
45
|
"cancel", "rerun", "confirmed", "refuted", "no-source", "confirm-bypass-signal", "in-container", "assessment-only", "retrieve-ec2", "no-wait-verify", "preview", "remove-empty", "dry-run", "stdin", "context-confirmed",
|
|
46
46
|
];
|
|
47
47
|
export function parse(argv) {
|
package/dist/commands/hook.js
CHANGED
|
@@ -193,17 +193,19 @@ export async function gatherUpdates(name, opts) {
|
|
|
193
193
|
] : [];
|
|
194
194
|
let measureLines = [];
|
|
195
195
|
let nextMeasureState = null;
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
196
|
+
if (opts.refreshMeasures) {
|
|
197
|
+
try {
|
|
198
|
+
const response = await client.call("GET", "/agents/me/brief");
|
|
199
|
+
const brief = response.brief;
|
|
200
|
+
if (!brief || !Array.isArray(brief.measures))
|
|
201
|
+
throw new Error("GET /agents/me/brief returned no measures array");
|
|
200
202
|
nextMeasureState = outcomeMeasureSnapshot(brief.measures, brief.measures_omitted ?? 0);
|
|
201
203
|
if (nextMeasureState !== state.measure_state)
|
|
202
204
|
measureLines = formatOutcomeMeasures(brief.measures, brief.measures_omitted ?? 0);
|
|
203
205
|
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
catch (e) {
|
|
207
|
+
process.stderr.write(`b9s: outcome measures: ${e.message}\n`);
|
|
208
|
+
}
|
|
207
209
|
}
|
|
208
210
|
const next = { ...state, last_check: Date.now() };
|
|
209
211
|
if (messages.length) {
|
|
@@ -450,7 +452,7 @@ export async function hook(p) {
|
|
|
450
452
|
}
|
|
451
453
|
}
|
|
452
454
|
}
|
|
453
|
-
const u = await gatherUpdates(name, { force: !!p.flags.force || (harness === "claude-code" && event === "SessionStart"), model: str(p.flags, "model") });
|
|
455
|
+
const u = await gatherUpdates(name, { force: !!p.flags.force || (harness === "claude-code" && event === "SessionStart"), model: str(p.flags, "model"), refreshMeasures: event === "SessionStart" && !compacted });
|
|
454
456
|
const formatted = formatHookDelivery(omitMeasuresAlreadyIn(standing?.text, u), standing);
|
|
455
457
|
const text = formatted.text;
|
|
456
458
|
if (!text)
|
|
@@ -605,7 +607,7 @@ async function antigravityHook(p) {
|
|
|
605
607
|
if (event !== "SessionStart" && event !== "PreInvocation")
|
|
606
608
|
return out({});
|
|
607
609
|
const standing = event === "SessionStart" ? await standingRules(name, input?.source === "compact") : null;
|
|
608
|
-
const u = await gatherUpdates(name, { force: event === "SessionStart", delivery: "hook" });
|
|
610
|
+
const u = await gatherUpdates(name, { force: event === "SessionStart", delivery: "hook", refreshMeasures: event === "SessionStart" });
|
|
609
611
|
const formatted = formatHookDelivery(omitMeasuresAlreadyIn(standing?.text, u), standing);
|
|
610
612
|
if (formatted.text)
|
|
611
613
|
await reportDelivery(name, formatted.text, formatted.by_kind);
|
|
@@ -680,7 +682,7 @@ async function codexHook(p) {
|
|
|
680
682
|
if (event !== "SessionStart" && event !== "UserPromptSubmit")
|
|
681
683
|
return;
|
|
682
684
|
const standing = event === "SessionStart" ? await standingRules(name, input?.source === "compact") : null;
|
|
683
|
-
const u = await gatherUpdates(name, { force: event === "SessionStart", delivery: "hook" });
|
|
685
|
+
const u = await gatherUpdates(name, { force: event === "SessionStart", delivery: "hook", refreshMeasures: event === "SessionStart" });
|
|
684
686
|
const formatted = formatHookDelivery(omitMeasuresAlreadyIn(standing?.text, u), standing);
|
|
685
687
|
if (formatted.text)
|
|
686
688
|
await reportDelivery(name, formatted.text, formatted.by_kind);
|
|
@@ -16,7 +16,7 @@ import { readState, stateFilePath, stateTransferContents } from "../state.js";
|
|
|
16
16
|
* sessions they run (docs/REMOTE-MACHINES.md). The server never sees an ssh credential: every ssh
|
|
17
17
|
* call here runs in the operator's terminal, and the machine key reaches the machine on ssh's stdin.
|
|
18
18
|
*
|
|
19
|
-
* machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns]
|
|
19
|
+
* machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] [--agy-userns]
|
|
20
20
|
* machine list | show <name> | remove <name>
|
|
21
21
|
* machine session add <machine> <project>/<agent> --dir <path> --sandbox <mode> [--create --role r] [--model m] [--effort e] [--thread id] [--turn-timeout min]
|
|
22
22
|
* machine session stop|start|remove <machine> <project>/<agent>
|
|
@@ -111,6 +111,9 @@ function ssh(host, command, input) {
|
|
|
111
111
|
}
|
|
112
112
|
/** Runs a b9s command on the machine in a login shell (so ~/.local/bin and the harness CLIs are on PATH). */
|
|
113
113
|
const remoteBschat = (host, args, input) => ssh(host, `bash -lc ${JSON.stringify(`b9s ${args}`)}`, input);
|
|
114
|
+
export function machinePrepareCommand(options) {
|
|
115
|
+
return `machine prepare --json${options.codexUserns ? " --codex-userns" : ""}${options.bwrapUserns ? " --bwrap-userns" : ""}${options.agyUserns ? " --agy-userns" : ""}`;
|
|
116
|
+
}
|
|
114
117
|
export async function machineAdmin(action, rest, p, out) {
|
|
115
118
|
const c = adminClient(p);
|
|
116
119
|
if (action === "companion") {
|
|
@@ -123,7 +126,7 @@ export async function machineAdmin(action, rest, p, out) {
|
|
|
123
126
|
const name = rest[0];
|
|
124
127
|
const host = str(p.flags, "ssh");
|
|
125
128
|
if (!name || !host)
|
|
126
|
-
throw new CliError("usage", "machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] (the host as your ssh knows it: an alias, user@host)");
|
|
129
|
+
throw new CliError("usage", "machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] [--agy-userns] (the host as your ssh knows it: an alias, user@host)");
|
|
127
130
|
const lines = [];
|
|
128
131
|
const say = (l) => { lines.push(l); if (!out.json)
|
|
129
132
|
process.stderr.write(`${l}\n`); };
|
|
@@ -135,7 +138,7 @@ export async function machineAdmin(action, rest, p, out) {
|
|
|
135
138
|
if (boot.status !== 0)
|
|
136
139
|
throw new CliError("provision_failed", `bootstrapping ${host} failed${steps.length ? `: ${steps[steps.length - 1]}` : `: ${boot.stderr.trim().slice(-300)}`}`);
|
|
137
140
|
// 2. Linger, Codex, managed hooks: checked and fixed on the machine itself.
|
|
138
|
-
const prep = remoteBschat(host,
|
|
141
|
+
const prep = remoteBschat(host, machinePrepareCommand({ codexUserns: bool(p.flags, "codex-userns"), bwrapUserns: bool(p.flags, "bwrap-userns"), agyUserns: bool(p.flags, "agy-userns") }));
|
|
139
142
|
if (prep.status !== 0)
|
|
140
143
|
throw new CliError("provision_failed", `b9s machine prepare on ${host} failed: ${prep.stderr.trim().slice(-300)}`);
|
|
141
144
|
const prepared = JSON.parse(prep.stdout).steps;
|
|
@@ -553,7 +556,7 @@ async function runMachineCompanion(code, p, out) {
|
|
|
553
556
|
await report("bootstrap", "completed", "Node and b9s are ready on the target machine");
|
|
554
557
|
await checkCancel();
|
|
555
558
|
await report("prepare", "started", "Checking machine services and harness prerequisites");
|
|
556
|
-
const prep = remoteBschat(operation.ssh_host,
|
|
559
|
+
const prep = remoteBschat(operation.ssh_host, machinePrepareCommand({ codexUserns: operation.options.codex_userns, bwrapUserns: operation.options.bwrap_userns }));
|
|
557
560
|
if (prep.status !== 0)
|
|
558
561
|
throw new CliError("provision_failed", `b9s machine prepare on ${operation.ssh_host} failed: ${prep.stderr.trim().slice(-300)}`);
|
|
559
562
|
const prepared = JSON.parse(prep.stdout).steps;
|
package/dist/commands/machine.js
CHANGED
|
@@ -7,7 +7,7 @@ import { str } from "../args.js";
|
|
|
7
7
|
import { Client } from "../client.js";
|
|
8
8
|
import { configRoot, loadAgent, resolveAgentName, saveAgent } from "../config.js";
|
|
9
9
|
import { CliError } from "../errors.js";
|
|
10
|
-
import { BWRAP_APPARMOR_PATH, bwrapAppArmorProfile, CODEX_APPARMOR_PATH, CODEX_MANAGED_DIR, codexAppArmorProfile, codexManagedHooks, isCodexManagedRequirements } from "../harness.js";
|
|
10
|
+
import { AGY_APPARMOR_PATH, agyAppArmorProfile, BWRAP_APPARMOR_PATH, bwrapAppArmorProfile, CODEX_APPARMOR_PATH, CODEX_MANAGED_DIR, codexAppArmorProfile, codexManagedHooks, isCodexManagedRequirements } from "../harness.js";
|
|
11
11
|
import { applySparse } from "../git.js";
|
|
12
12
|
import { drainingUntil, writeMaintenance } from "../maintenance.js";
|
|
13
13
|
import { TURN_HARNESSES, claudeFacts, claudeSandbox, dshFacts, dshProcesses, probeFor, sessionProcesses } from "../harnesses.js";
|
|
@@ -350,7 +350,10 @@ export function resolveContainerLaunchPrereqs(opts) {
|
|
|
350
350
|
throw new Error("container isolation required but neither podman nor docker is available; refusing unisolated host fallback");
|
|
351
351
|
}
|
|
352
352
|
if (opts.s.sandbox !== "danger-full-access" && !nested.nested_sandbox_ok) {
|
|
353
|
-
|
|
353
|
+
const error = new Error(`refusing sandboxed container session (${opts.s.sandbox}) without silently falling back to danger-full-access: ${nested.detail}`);
|
|
354
|
+
if (nested.missing.includes("unprivileged_userns"))
|
|
355
|
+
error.environment_check = "linux_user_namespaces";
|
|
356
|
+
throw error;
|
|
354
357
|
}
|
|
355
358
|
const imageDigest = resolvePinnedImageRef(opts.project?.image);
|
|
356
359
|
if (!imageDigest) {
|
|
@@ -739,7 +742,8 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
739
742
|
catch (e) {
|
|
740
743
|
const error = e.message.slice(0, 1000);
|
|
741
744
|
log(`${s.agent}: ${error}`);
|
|
742
|
-
|
|
745
|
+
const environmentCheck = e.environment_check;
|
|
746
|
+
out.push({ id: s.id, state: "error", thread: state.sessions[s.id]?.thread ?? null, error, ...(typeof environmentCheck === "string" ? { environment_check: environmentCheck } : {}) });
|
|
743
747
|
}
|
|
744
748
|
}
|
|
745
749
|
// Sessions the operator removed: their watchers go too.
|
|
@@ -1233,6 +1237,43 @@ const AGY_SANDBOX_PROBE_MS = 10 * 60_000;
|
|
|
1233
1237
|
const AGY_SANDBOX_PROBE_MODEL = "gemini-4-hydrogen-low";
|
|
1234
1238
|
const AGY_SANDBOX_PROBE_RESPONSE = "B9S_SANDBOX_OK";
|
|
1235
1239
|
let agySandboxCache = null;
|
|
1240
|
+
const AGY_USERNS_ERROR = "Antigravity terminal sandbox unavailable (AppArmor restricts unprivileged user namespaces)";
|
|
1241
|
+
const AGY_USERNS_FIX = `${AGY_USERNS_ERROR}; run b9s machine prepare --agy-userns`;
|
|
1242
|
+
function antigravityUsernsDenied(parsed, output) {
|
|
1243
|
+
const value = parsed;
|
|
1244
|
+
const error = value?.error && typeof value.error === "object" ? value.error : null;
|
|
1245
|
+
const denied = value?.denied_actions ?? error?.denied_actions;
|
|
1246
|
+
return /Terminal sandbox unavailable/i.test(output) || (Array.isArray(denied) && denied.some((entry) => entry && typeof entry === "object" && entry.action === "command"));
|
|
1247
|
+
}
|
|
1248
|
+
/** Install only an absent or byte-identical b9s profile; leave every other owner untouched. */
|
|
1249
|
+
export function installAgyAppArmorProfile(binary, profilePath = AGY_APPARMOR_PATH, run = (args, input) => spawnSync("sudo", args, { input, encoding: "utf8", stdio: input === undefined ? "pipe" : ["pipe", "ignore", "pipe"] })) {
|
|
1250
|
+
const profile = agyAppArmorProfile(binary);
|
|
1251
|
+
let existing = null;
|
|
1252
|
+
try {
|
|
1253
|
+
existing = readFileSync(profilePath, "utf8");
|
|
1254
|
+
}
|
|
1255
|
+
catch (error) {
|
|
1256
|
+
if (error.code !== "ENOENT")
|
|
1257
|
+
return { ok: false, error: `reading ${profilePath}: ${error.message}` };
|
|
1258
|
+
}
|
|
1259
|
+
if (existing !== null && existing !== profile) {
|
|
1260
|
+
return { ok: false, error: `${profilePath} already exists and does not exactly match the b9s Antigravity profile; leaving it unchanged` };
|
|
1261
|
+
}
|
|
1262
|
+
if (existing === null) {
|
|
1263
|
+
const write = run(["-n", "sh", "-c", 'set -C; umask 022; cat > "$1"', "b9s", profilePath], profile);
|
|
1264
|
+
if (write.status !== 0)
|
|
1265
|
+
return { ok: false, error: `installing ${profilePath}: ${(write.stderr ?? "").trim() || `exit ${write.status ?? "unknown"}`}` };
|
|
1266
|
+
}
|
|
1267
|
+
const load = run(["-n", "apparmor_parser", "-r", profilePath]);
|
|
1268
|
+
return load.status === 0
|
|
1269
|
+
? { ok: true, error: null }
|
|
1270
|
+
: { ok: false, error: `loading ${profilePath}: ${(load.stderr ?? "").trim() || `exit ${load.status ?? "unknown"}`}` };
|
|
1271
|
+
}
|
|
1272
|
+
function resolvedAgyBinary(path) {
|
|
1273
|
+
const result = spawnSync("sh", ["-c", "command -v agy"], { encoding: "utf8", env: { ...process.env, PATH: path } });
|
|
1274
|
+
const binary = result.status === 0 ? (result.stdout ?? "").trim() : "";
|
|
1275
|
+
return isAbsolute(binary) ? binary : null;
|
|
1276
|
+
}
|
|
1236
1277
|
/** Runs one cached no-op turn through Antigravity's real workspace-write terminal sandbox. */
|
|
1237
1278
|
export function antigravitySandbox(force = false, path = process.env.PATH ?? "", b9sBin = readInstall()?.bin ?? null) {
|
|
1238
1279
|
if (!force && agySandboxCache && agySandboxCache.path === path && agySandboxCache.b9sBin === b9sBin && Date.now() - agySandboxCache.at < AGY_SANDBOX_PROBE_MS)
|
|
@@ -1259,9 +1300,12 @@ export function antigravitySandbox(force = false, path = process.env.PATH ?? "",
|
|
|
1259
1300
|
wroteMarker = readFileSync(marker, "utf8") === AGY_SANDBOX_PROBE_RESPONSE;
|
|
1260
1301
|
}
|
|
1261
1302
|
catch { /* a missing marker means the sandbox command did not run */ }
|
|
1303
|
+
const output = `${r.stdout ?? ""}\n${r.stderr ?? ""}`;
|
|
1262
1304
|
result = r.status === 0 && parsed?.status === "SUCCESS" && parsed.response?.trim() === AGY_SANDBOX_PROBE_RESPONSE && wroteMarker
|
|
1263
1305
|
? { ok: true, error: null }
|
|
1264
|
-
: { ok: false, error:
|
|
1306
|
+
: { ok: false, error: antigravityUsernsDenied(parsed, output)
|
|
1307
|
+
? AGY_USERNS_FIX
|
|
1308
|
+
: `sandbox could not run b9s --version and its no-op check (agy exit ${r.status ?? "unknown"}); verify recorded install ${b9sBin} and Node runtime ${process.execPath} are readable and executable inside the sandbox` };
|
|
1265
1309
|
}
|
|
1266
1310
|
catch (error) {
|
|
1267
1311
|
const detail = error instanceof Error ? error.message : String(error);
|
|
@@ -1521,6 +1565,45 @@ export function prepare(opts = {}) {
|
|
|
1521
1565
|
: agy.logged_in
|
|
1522
1566
|
? { step: "antigravity login", result: "ok", detail: `${agy.version ?? "agy"}; agy models succeeded` }
|
|
1523
1567
|
: { step: "antigravity login", result: "failed", detail: `${agy.version ?? "agy"}; agy models did not succeed; log in interactively with agy on this machine` });
|
|
1568
|
+
if (!agy.available || !agy.logged_in) {
|
|
1569
|
+
steps.push({ step: "antigravity sandbox", result: "skipped", detail: "agy must be installed and logged in before its terminal sandbox can be checked" });
|
|
1570
|
+
}
|
|
1571
|
+
else {
|
|
1572
|
+
let agySandboxResult = antigravitySandbox(true, daemonPath);
|
|
1573
|
+
if (agySandboxResult.ok) {
|
|
1574
|
+
steps.push({ step: "antigravity sandbox", result: "ok", detail: "workspace-write terminal sandbox works" });
|
|
1575
|
+
}
|
|
1576
|
+
else if (!agySandboxResult.error?.startsWith(AGY_USERNS_ERROR)) {
|
|
1577
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: agySandboxResult.error ?? "agy sandbox no-op failed" });
|
|
1578
|
+
}
|
|
1579
|
+
else if (platform() !== "linux") {
|
|
1580
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: `${AGY_USERNS_ERROR}; this opt-in AppArmor fix applies only on Linux` });
|
|
1581
|
+
}
|
|
1582
|
+
else if (!opts.agyUserns) {
|
|
1583
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: `${agySandboxResult.error}; the profile targets the resolved agy binary at ${AGY_APPARMOR_PATH}` });
|
|
1584
|
+
}
|
|
1585
|
+
else if (!sudo) {
|
|
1586
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: `--agy-userns needs passwordless sudo; install ${AGY_APPARMOR_PATH} by hand (b9s machine prepare --print-apparmor shows the profile) and run sudo apparmor_parser -r on it` });
|
|
1587
|
+
}
|
|
1588
|
+
else {
|
|
1589
|
+
const binary = resolvedAgyBinary(daemonPath);
|
|
1590
|
+
if (!binary) {
|
|
1591
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: `--agy-userns could not resolve agy on the daemon PATH; cannot safely create ${AGY_APPARMOR_PATH}` });
|
|
1592
|
+
}
|
|
1593
|
+
else {
|
|
1594
|
+
const install = installAgyAppArmorProfile(binary);
|
|
1595
|
+
if (!install.ok) {
|
|
1596
|
+
steps.push({ step: "antigravity sandbox", result: "failed", detail: install.error ?? `could not install ${AGY_APPARMOR_PATH}` });
|
|
1597
|
+
}
|
|
1598
|
+
else {
|
|
1599
|
+
agySandboxResult = antigravitySandbox(true, daemonPath);
|
|
1600
|
+
steps.push(agySandboxResult.ok
|
|
1601
|
+
? { step: "antigravity sandbox", result: "done", detail: `installed ${AGY_APPARMOR_PATH} for ${binary}; workspace-write terminal sandbox works` }
|
|
1602
|
+
: { step: "antigravity sandbox", result: "failed", detail: `${AGY_APPARMOR_PATH} loaded but sandbox still fails: ${agySandboxResult.error}` });
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1524
1607
|
const codex = spawnSync("codex", ["--version"], { encoding: "utf8", env: daemonEnv });
|
|
1525
1608
|
if (codex.status !== 0)
|
|
1526
1609
|
steps.push({ step: "codex", result: "failed", detail: "codex is not on PATH; install the Codex CLI (npm i -g @openai/codex) and log in (codex login --device-auth)" });
|
|
@@ -1918,9 +2001,15 @@ export async function machine(p, out) {
|
|
|
1918
2001
|
if (sub === "prepare") {
|
|
1919
2002
|
if (p.flags["print-hooks"])
|
|
1920
2003
|
return out.print(codexManagedHooks(requireInstall().bin).requirements, codexManagedHooks(requireInstall().bin));
|
|
1921
|
-
if (p.flags["print-apparmor"])
|
|
1922
|
-
|
|
1923
|
-
|
|
2004
|
+
if (p.flags["print-apparmor"]) {
|
|
2005
|
+
const agyBinary = resolvedAgyBinary(machineDaemonPath()) ?? join(homedir(), ".local", "bin", "agy");
|
|
2006
|
+
return out.print(`${CODEX_APPARMOR_PATH}:\n${codexAppArmorProfile()}\n${BWRAP_APPARMOR_PATH}:\n${bwrapAppArmorProfile()}\n${AGY_APPARMOR_PATH}:\n${agyAppArmorProfile(agyBinary)}`, {
|
|
2007
|
+
[CODEX_APPARMOR_PATH]: codexAppArmorProfile(),
|
|
2008
|
+
[BWRAP_APPARMOR_PATH]: bwrapAppArmorProfile(),
|
|
2009
|
+
[AGY_APPARMOR_PATH]: agyAppArmorProfile(agyBinary),
|
|
2010
|
+
});
|
|
2011
|
+
}
|
|
2012
|
+
const steps = prepare({ codexUserns: p.flags["codex-userns"] === true, bwrapUserns: p.flags["bwrap-userns"] === true, agyUserns: p.flags["agy-userns"] === true });
|
|
1924
2013
|
return out.print(steps.map((s) => `${s.result.padEnd(8)} ${s.step}: ${s.detail}`).join("\n"), { steps });
|
|
1925
2014
|
}
|
|
1926
2015
|
if (sub === "service") {
|
package/dist/commands/watch.js
CHANGED
|
@@ -325,8 +325,8 @@ export async function watch(p, out) {
|
|
|
325
325
|
return stoppingCode;
|
|
326
326
|
debugLog(`seen messages=${u?.counts.messages ?? 0} questions=${u?.counts.questions ?? 0} items=${u?.counts.items ?? 0} followed=${u?.counts.followed ?? 0} digest=${u?.counts.digest ?? 0} notices=${u?.counts.notices ?? 0}; tier=${u?.tier ?? "none"}; decision=${u ? "deliver" : "no updates"}`);
|
|
327
327
|
if (u) {
|
|
328
|
-
const recovery =
|
|
329
|
-
const update =
|
|
328
|
+
const recovery = await recoveryBriefText(name, log);
|
|
329
|
+
const update = formatUpdates(omitMeasuresAlreadyIn(recovery, u), [recovery ?? recoveryBriefUnavailableText]);
|
|
330
330
|
const total = update.counts.messages + update.counts.items + update.counts.followed + update.counts.digest + update.counts.notices;
|
|
331
331
|
const summary = update.text.split("\n")[0].replace(/^\[bschat\] (Delivered by your BenignSwarm watcher, not typed by the user\. )?/, "");
|
|
332
332
|
let delivered = true;
|
|
@@ -475,8 +475,8 @@ export async function wakeOnce(name, exec, unackedAfter, followDelay, log, model
|
|
|
475
475
|
}
|
|
476
476
|
}
|
|
477
477
|
const seq = (st.watch_seq ?? 0) + 1;
|
|
478
|
-
const recovery =
|
|
479
|
-
const recoveryPrompt =
|
|
478
|
+
const recovery = await recoveryBriefText(name, log);
|
|
479
|
+
const recoveryPrompt = recovery ?? recoveryBriefUnavailableText;
|
|
480
480
|
const wakePrefix = [
|
|
481
481
|
...(turnSink
|
|
482
482
|
? [`[b9s] Turn #${seq}, started by your BenignSwarm watcher because you were idle; not typed by the user. It is already acknowledged.`]
|
package/dist/harness.js
CHANGED
|
@@ -438,6 +438,7 @@ export function codexManagedHooks(bin) {
|
|
|
438
438
|
}
|
|
439
439
|
export const CODEX_APPARMOR_PATH = "/etc/apparmor.d/bschat-codex";
|
|
440
440
|
export const BWRAP_APPARMOR_PATH = "/etc/apparmor.d/bschat-bwrap";
|
|
441
|
+
export const AGY_APPARMOR_PATH = "/etc/apparmor.d/bschat-agy";
|
|
441
442
|
/**
|
|
442
443
|
* An AppArmor profile that lets the system's bubblewrap create user namespaces, which Claude Code's
|
|
443
444
|
* Linux sandbox runs commands in. Broader than the Codex profile: any local user may then use
|
|
@@ -480,3 +481,20 @@ export function codexAppArmorProfile() {
|
|
|
480
481
|
``,
|
|
481
482
|
].join("\n");
|
|
482
483
|
}
|
|
484
|
+
/** An opt-in AppArmor profile for the installed Antigravity CLI only. */
|
|
485
|
+
export function agyAppArmorProfile(binary) {
|
|
486
|
+
if (!binary.startsWith("/"))
|
|
487
|
+
throw new Error("Antigravity binary path must be absolute");
|
|
488
|
+
return [
|
|
489
|
+
`# b9s: let Antigravity create the user namespaces its workspace-write terminal sandbox needs (Ubuntu 24.04+ restricts them).`,
|
|
490
|
+
`# Written by b9s machine prepare --agy-userns; remove this file and run apparmor_parser -R on it to undo.`,
|
|
491
|
+
`abi <abi/4.0>,`,
|
|
492
|
+
`include <tunables/global>`,
|
|
493
|
+
``,
|
|
494
|
+
`profile bschat-agy ${binary} flags=(unconfined) {`,
|
|
495
|
+
` userns,`,
|
|
496
|
+
` include if exists <local/bschat-agy>`,
|
|
497
|
+
`}`,
|
|
498
|
+
``,
|
|
499
|
+
].join("\n");
|
|
500
|
+
}
|
package/dist/help.js
CHANGED
|
@@ -224,8 +224,9 @@ Agent commands
|
|
|
224
224
|
b9s unpause [--as <a>] lift a usage-limit pause now (the harness was switched to an account with quota)
|
|
225
225
|
b9s turn note "<short progress summary>" [--as <a>] save a 300-character turn-end excerpt for an enabled managed session; it is labelled unverified
|
|
226
226
|
b9s machine bootstrap --url <api> [--retrieve-ec2 | --token-file <path> | --token <bs_boot_...>] [--name <m>] retrieve (over TLS+IMDSv2/STS) and exchange a single-use cloud bootstrap token once, scrub it, and write mode-0600 credentials
|
|
227
|
-
b9s machine run [--interval seconds] | once | build-images | status | prepare | service
|
|
228
|
-
default interval 30s, 1..3600; prepare checks
|
|
227
|
+
b9s machine run [--interval seconds] | once | build-images | status | prepare [--agy-userns] [--print-apparmor] | service
|
|
228
|
+
default interval 30s, 1..3600; prepare checks harnesses; --agy-userns opts into an AppArmor
|
|
229
|
+
profile for the resolved agy binary if Ubuntu blocks its workspace-write terminal sandbox (passwordless sudo)
|
|
229
230
|
b9s machine processes --worktree <path> [--as <project>/<agent>] [--json] read-only host process sample for a project-owned worktree
|
|
230
231
|
includes pid/parent, start/elapsed, command (120 chars), cwd, TCP listeners and sample time
|
|
231
232
|
project agents only; stale samples are labelled; command credentials are redacted; no environment values or signaling
|
|
@@ -366,12 +367,13 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
|
|
|
366
367
|
|
|
367
368
|
Machines (provisioned over your own ssh; a daemon on each runs the agent sessions you declare)
|
|
368
369
|
Account Mac leases and trusted TestFlight signing approvals are managed in Console → Machines → Mac fleet and signing; there is no CLI signing or App Store release command.
|
|
369
|
-
b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] install Node and b9s (no sudo), linger, harness login checks,
|
|
370
|
+
b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] [--agy-userns] install Node and b9s (no sudo), linger, harness login checks,
|
|
370
371
|
on macOS also check selected Xcode/license/SDKs, actual simulator runtimes, and disk;
|
|
371
372
|
b9s's Codex hooks in /etc/codex (passwordless sudo only), register, start the daemon;
|
|
372
373
|
--codex-userns: where Linux restricts user namespaces (Ubuntu 24.04+), install a
|
|
373
374
|
Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
|
|
374
|
-
for /usr/bin/bwrap (Claude Code's sandbox; broader: any local user may use it)
|
|
375
|
+
for /usr/bin/bwrap (Claude Code's sandbox; broader: any local user may use it); --agy-userns:
|
|
376
|
+
install a profile only for the resolved ~/.local/bin/agy (Antigravity terminal sandbox)
|
|
375
377
|
b9s-admin machine list | show <name> | remove <name> [--preview] [--confirm <name> --impact-revision <revision>]
|
|
376
378
|
show includes host readiness, configured disk floors and named readiness refusals; removal previews sessions, work, keys, recovery blockers and replanned slots
|
|
377
379
|
the API requires a fresh revision for removal
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.12.
|
|
1
|
+
export const CLI_VERSION = "0.12.103";
|