benignswarm 0.12.120 → 0.12.121
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/command-runner.js +6 -1
- package/dist/commands/machine.js +19 -18
- package/dist/commands/operator.js +0 -1
- package/dist/commands/wu.js +25 -5
- package/dist/help.js +9 -7
- package/dist/index.js +1 -0
- package/dist/output.js +1 -3
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/command-runner.js
CHANGED
|
@@ -3,7 +3,12 @@ import { printWrittenReceiptMismatch } from "./output.js";
|
|
|
3
3
|
/** Print committed write results when their receipt is invalid; ordinary API refusals stay errors. */
|
|
4
4
|
export async function runCommandSafely(run, out) {
|
|
5
5
|
try {
|
|
6
|
-
|
|
6
|
+
const code = await run();
|
|
7
|
+
if (code !== undefined)
|
|
8
|
+
return code;
|
|
9
|
+
// A command that reports failure by setting process.exitCode (doctor, status, lock run) keeps it:
|
|
10
|
+
// the caller assigns our return value to process.exitCode, and a 0 here would erase the failure.
|
|
11
|
+
return typeof process.exitCode === "number" ? process.exitCode : 0;
|
|
7
12
|
}
|
|
8
13
|
catch (error) {
|
|
9
14
|
if (error instanceof WrittenReceiptMismatchError) {
|
package/dist/commands/machine.js
CHANGED
|
@@ -793,14 +793,14 @@ export function processStartStamp(pid) {
|
|
|
793
793
|
* since it may be another process, and not treated as gone, since it may be the child about to
|
|
794
794
|
* begin a first turn. A record from before the start time was kept is judged by pid alone.
|
|
795
795
|
*/
|
|
796
|
-
function startChildState(pending) {
|
|
796
|
+
function startChildState(pending, readStartStamp = processStartStamp) {
|
|
797
797
|
if (!pidAlive(pending.pid))
|
|
798
798
|
return "gone";
|
|
799
799
|
if (pending.pid_started === undefined)
|
|
800
800
|
return "alive";
|
|
801
801
|
if (pending.pid_started === null)
|
|
802
802
|
return "unknown";
|
|
803
|
-
const stamp =
|
|
803
|
+
const stamp = readStartStamp(pending.pid);
|
|
804
804
|
if (stamp === null)
|
|
805
805
|
return pidAlive(pending.pid) ? "unknown" : "gone";
|
|
806
806
|
return stamp === pending.pid_started ? "alive" : "gone";
|
|
@@ -818,7 +818,7 @@ function cleanupMachineStart(pending) {
|
|
|
818
818
|
for (const file of [pending.progress_file, pending.result_file, ...(pending.child_file ? [pending.child_file] : []), ...(pending.secret_files ?? [])])
|
|
819
819
|
rmSync(file, { force: true });
|
|
820
820
|
}
|
|
821
|
-
function adoptStartChild(pending) {
|
|
821
|
+
function adoptStartChild(pending, readStartStamp = processStartStamp) {
|
|
822
822
|
if (pending.pid !== 0)
|
|
823
823
|
return;
|
|
824
824
|
let childPid = 0;
|
|
@@ -828,7 +828,7 @@ function adoptStartChild(pending) {
|
|
|
828
828
|
catch { /* not launched, or not yet */ }
|
|
829
829
|
if (childPid > 1) {
|
|
830
830
|
pending.pid = childPid;
|
|
831
|
-
pending.pid_started =
|
|
831
|
+
pending.pid_started = readStartStamp(childPid);
|
|
832
832
|
}
|
|
833
833
|
}
|
|
834
834
|
/**
|
|
@@ -838,7 +838,7 @@ function adoptStartChild(pending) {
|
|
|
838
838
|
* again on the next pass; nothing is started for the session meanwhile. It waits at most a second
|
|
839
839
|
* for the child, so several endings cannot hold up the machine report. Throws while incomplete.
|
|
840
840
|
*/
|
|
841
|
-
async function endPendingStart(state, id, pending, reason, runner, log) {
|
|
841
|
+
async function endPendingStart(state, id, pending, reason, runner, log, readStartStamp = processStartStamp) {
|
|
842
842
|
if (!pending.ending) {
|
|
843
843
|
// A first turn that had begun may outlive its start; nothing new starts beside it.
|
|
844
844
|
if (startProgressState(pending) === "onboarding_turn_running" && pending.desired?.dir)
|
|
@@ -846,12 +846,12 @@ async function endPendingStart(state, id, pending, reason, runner, log) {
|
|
|
846
846
|
pending.ending = { reason, since: new Date().toISOString() };
|
|
847
847
|
writeMachineState(state);
|
|
848
848
|
}
|
|
849
|
-
adoptStartChild(pending);
|
|
849
|
+
adoptStartChild(pending, readStartStamp);
|
|
850
850
|
if (pending.pid === 0 && Date.now() - Date.parse(pending.started_at) <= START_INTENT_GRACE_MS) {
|
|
851
851
|
throw new Error(`${pending.ending.reason}; waiting to learn whether its start process was launched`);
|
|
852
852
|
}
|
|
853
853
|
// Only the process this record names is signalled: a pid that now belongs to something else is left alone.
|
|
854
|
-
const child = pending.pid > 1 && pending.pid !== process.pid ? startChildState(pending) : "gone";
|
|
854
|
+
const child = pending.pid > 1 && pending.pid !== process.pid ? startChildState(pending, readStartStamp) : "gone";
|
|
855
855
|
if (child === "unknown")
|
|
856
856
|
throw new Error(`${pending.ending.reason}; process ${pending.pid} cannot be identified as its start process, so it is not signalled and nothing is started in its place until it has exited`);
|
|
857
857
|
if (child === "alive") {
|
|
@@ -873,9 +873,9 @@ async function endPendingStart(state, id, pending, reason, runner, log) {
|
|
|
873
873
|
}
|
|
874
874
|
}
|
|
875
875
|
const until = Date.now() + 1_000;
|
|
876
|
-
while (startChildState(pending) !== "gone" && Date.now() < until)
|
|
876
|
+
while (startChildState(pending, readStartStamp) !== "gone" && Date.now() < until)
|
|
877
877
|
await new Promise((resolve) => setTimeout(resolve, 50));
|
|
878
|
-
if (startChildState(pending) !== "gone")
|
|
878
|
+
if (startChildState(pending, readStartStamp) !== "gone")
|
|
879
879
|
throw new Error(`${pending.ending.reason}; its start process ${pending.pid} has not exited yet`);
|
|
880
880
|
}
|
|
881
881
|
const agent = pending.desired?.agent;
|
|
@@ -1072,6 +1072,7 @@ export async function launchDesiredSession(opts) {
|
|
|
1072
1072
|
const LOG_ROTATION_EVERY_MS = 10 * 60_000;
|
|
1073
1073
|
let lastLogRotationAt = 0;
|
|
1074
1074
|
export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
1075
|
+
const readStartStamp = deps?.processStartStamp ?? processStartStamp;
|
|
1075
1076
|
const client = Client.raw(m.url, m.key, {
|
|
1076
1077
|
requestTimeoutMs: MACHINE_REQUEST_TIMEOUT_MS,
|
|
1077
1078
|
stagedPoolPreparation: true,
|
|
@@ -1138,7 +1139,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1138
1139
|
const local = state.sessions[s.id];
|
|
1139
1140
|
const pending = state.starting_sessions?.[s.id];
|
|
1140
1141
|
if (pending)
|
|
1141
|
-
await endPendingStart(state, s.id, pending, "benched", runner, log);
|
|
1142
|
+
await endPendingStart(state, s.id, pending, "benched", runner, log, readStartStamp);
|
|
1142
1143
|
const w = svc();
|
|
1143
1144
|
const reason = `benched by ${s.benched_by ?? "the operator"}${s.benched_at ? ` at ${s.benched_at}` : ""}${s.bench_note ? `: ${s.bench_note}` : ""}`;
|
|
1144
1145
|
if (w) {
|
|
@@ -1156,7 +1157,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1156
1157
|
const local = state.sessions[s.id];
|
|
1157
1158
|
const pending = state.starting_sessions?.[s.id];
|
|
1158
1159
|
if (pending)
|
|
1159
|
-
await endPendingStart(state, s.id, pending, "stopped", runner, log);
|
|
1160
|
+
await endPendingStart(state, s.id, pending, "stopped", runner, log, readStartStamp);
|
|
1160
1161
|
const w = svc();
|
|
1161
1162
|
if (w) {
|
|
1162
1163
|
removeService(w);
|
|
@@ -1247,19 +1248,19 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1247
1248
|
let result = readMachineStartResult(pendingStart.result_file);
|
|
1248
1249
|
const ageMs = Date.now() - Date.parse(pendingStart.started_at);
|
|
1249
1250
|
const endPending = async (reason) => {
|
|
1250
|
-
await endPendingStart(state, s.id, pendingStart, reason, runner, log);
|
|
1251
|
+
await endPendingStart(state, s.id, pendingStart, reason, runner, log, readStartStamp);
|
|
1251
1252
|
throw new Error(reason);
|
|
1252
1253
|
};
|
|
1253
1254
|
if (pendingStart.ending) {
|
|
1254
1255
|
// An ending begun on an earlier pass: finish it (it throws while incomplete), then start afresh.
|
|
1255
|
-
await endPendingStart(state, s.id, pendingStart, pendingStart.ending.reason, runner, log);
|
|
1256
|
+
await endPendingStart(state, s.id, pendingStart, pendingStart.ending.reason, runner, log, readStartStamp);
|
|
1256
1257
|
neverLaunched = true;
|
|
1257
1258
|
result = null;
|
|
1258
1259
|
}
|
|
1259
1260
|
else if (!result && pendingStart.pid === 0) {
|
|
1260
1261
|
// The daemon stopped between recording the intent and recording the child. The child
|
|
1261
1262
|
// names itself in its own file as its first act, so it is found here if it was launched.
|
|
1262
|
-
adoptStartChild(pendingStart);
|
|
1263
|
+
adoptStartChild(pendingStart, readStartStamp);
|
|
1263
1264
|
if (pendingStart.pid !== 0)
|
|
1264
1265
|
writeMachineState(state);
|
|
1265
1266
|
else if (ageMs > START_INTENT_GRACE_MS) {
|
|
@@ -1274,7 +1275,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1274
1275
|
// Falls through to the ordinary launch decision below.
|
|
1275
1276
|
}
|
|
1276
1277
|
else if (!result) {
|
|
1277
|
-
if (pendingStart.pid !== 0 && startChildState(pendingStart) === "gone")
|
|
1278
|
+
if (pendingStart.pid !== 0 && startChildState(pendingStart, readStartStamp) === "gone")
|
|
1278
1279
|
await endPending("tracked b9s start process exited before returning a session or failure reason");
|
|
1279
1280
|
const limitMs = startWaitMs(pendingStart.desired ?? s) + 120_000;
|
|
1280
1281
|
if (ageMs > limitMs)
|
|
@@ -1475,7 +1476,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1475
1476
|
cleanupMachineStart(pending);
|
|
1476
1477
|
throw error;
|
|
1477
1478
|
}
|
|
1478
|
-
pending.pid_started =
|
|
1479
|
+
pending.pid_started = readStartStamp(pending.pid);
|
|
1479
1480
|
try {
|
|
1480
1481
|
writeMachineState(state);
|
|
1481
1482
|
}
|
|
@@ -1588,7 +1589,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1588
1589
|
// The session as now asked for cannot run here, and a start made for its earlier form is
|
|
1589
1590
|
// still pending: that start is ended, not left running behind the error.
|
|
1590
1591
|
try {
|
|
1591
|
-
await endPendingStart(state, s.id, stranded, "the session can no longer start as it was asked", runner, log);
|
|
1592
|
+
await endPendingStart(state, s.id, stranded, "the session can no longer start as it was asked", runner, log, readStartStamp);
|
|
1592
1593
|
}
|
|
1593
1594
|
catch (ending) {
|
|
1594
1595
|
error = `${error}; ${ending.message}`.slice(0, 1000);
|
|
@@ -1620,7 +1621,7 @@ export async function reconcile(m, log, reportIntervalSeconds = 30, deps) {
|
|
|
1620
1621
|
continue;
|
|
1621
1622
|
// One ending that cannot finish yet must not cost the other sessions their report; it is taken up again next pass.
|
|
1622
1623
|
try {
|
|
1623
|
-
await endPendingStart(state, id, pending, "session removed by the operator", runner, log);
|
|
1624
|
+
await endPendingStart(state, id, pending, "session removed by the operator", runner, log, readStartStamp);
|
|
1624
1625
|
}
|
|
1625
1626
|
catch (error) {
|
|
1626
1627
|
log(`${pending.desired?.agent ?? id}: ${error.message}`);
|
|
@@ -131,7 +131,6 @@ function describeProcess(r) {
|
|
|
131
131
|
` requires: scope ${d.require_scope ? "yes" : "no"}, evidence to submit ${d.require_evidence_to_submit ? "yes" : "no"}; default approver ${d.default_approver_role ?? "none"}; assigners ${d.assigners.join(", ") || "none"}`,
|
|
132
132
|
` merging: into ${m.target_branch} by ${m.merged_by === "integrator" ? `a ${m.integrator_role}` : `the ${m.merged_by}`}; merge commit ${m.require_merge_commit ? "yes" : "no"}, rebased ${m.require_rebased ? "yes" : "no"}, pushed ${m.require_pushed ? "yes" : "no"}; gate ${m.gate_command ?? "none"}`,
|
|
133
133
|
` capabilities: ${(d.capabilities ?? []).map((c) => `${c.name} (${c.scope}${c.min_version ? ` >= ${c.min_version}` : ""})`).join(", ") || "none"}`,
|
|
134
|
-
` heavy jobs: ${Object.entries(d.heavy_jobs ?? {}).map(([name, job]) => `${name} (${job.memory_gib} GiB; ${job.purpose}; workflows ${job.workflows.join(", ")})`).join("; ") || "none"}`,
|
|
135
134
|
` steward: ${d.steward.enabled ? "on" : "off"}, quiet ${d.steward.quiet_minutes} min, summary every ${d.steward.summary_minutes} min, ask the operator after ${d.steward.churn_rounds ? `${d.steward.churn_rounds} rounds on one goal` : "(never)"}`,
|
|
136
135
|
` agreements: ${r.process.agreements.length} of 8000 characters; charter: ${(r.process.charter ?? "").length ? `${r.process.charter.length} of 4000 characters` : "none (b9s-admin process charter <project> --file charter.md)"}; send-backs ${d.require_cited_changes === false ? "free-form" : "must cite the clause they fail"}`,
|
|
137
136
|
...(d.routing_policy ? [` routing: weights ${d.routing_policy.weights?.quality ?? 65}/${d.routing_policy.weights?.time ?? 20}/${d.routing_policy.weights?.cost ?? 15}, target ${d.routing_policy.quality_target_percent ?? "none"}, half-life ${d.routing_policy.recency_half_life_days ?? 30}d, min samples ${d.routing_policy.minimum_sample_count ?? 8}, build explore ${d.routing_policy.build_exploration_budget_percent ?? 10}%${d.routing_policy.build_exploration_paused ? " (paused)" : ""}, review explore ${d.routing_policy.review_exploration_budget_percent ?? 10}%${d.routing_policy.review_exploration_paused ? " (paused)" : ""}`] : []),
|
package/dist/commands/wu.js
CHANGED
|
@@ -575,7 +575,7 @@ export async function wu(p, out) {
|
|
|
575
575
|
const createdReceiptLine = (u) => `WU #${u.number} created: ${u.title}`;
|
|
576
576
|
const fmt = (u) => {
|
|
577
577
|
const waitList = Array.isArray(u.waits_on) ? u.waits_on : u.waiting_on ? [u.waiting_on] : [];
|
|
578
|
-
const flags = [u.assigned_by ? `assigned by ${u.assigned_by}` : null, u.preferred_name ? `reserved for ${u.preferred_name}${u.hold ? " until free" : ""}` : null, u.hold && u.status === "assigned" ? "held" : null, waitList.length ? `waits on ${waitList.map((n) => `#${n}`).join(", ")}` : null, u.lands_with ? `lands with WU #${u.lands_with}` : null, u.review_wait ? `waiting on ${u.review_wait.type === "unit" ? `WU #${u.review_wait.target}` : u.review_wait.type === "ask" ? `ask ${u.review_wait.target}` : u.review_wait.type === "machine" ? `machine ${u.review_wait.target}` : u.review_wait.type === "text" ? u.review_wait.target : "evidence"} for ${Math.max(0, Math.round((Date.now() - Date.parse(u.review_wait.started_at)) / 60000))} min` : null, u.milestone ? `milestone ${u.milestone}` : null, u.target ? `lands in ${u.target}` : null, u.replay_of ? "REPLAY" : null, u.trial_tags?.length ? `trial on ${u.trial_tags.map((t) => `#${t}`).join(" ")}` : null].filter(Boolean).join(" · ");
|
|
578
|
+
const flags = [u.priority === "urgent" ? "URGENT" : null, u.assigned_by ? `assigned by ${u.assigned_by}` : null, u.preferred_name ? `reserved for ${u.preferred_name}${u.hold ? " until free" : ""}` : null, u.hold && u.status === "assigned" ? "held" : null, waitList.length ? `waits on ${waitList.map((n) => `#${n}`).join(", ")}` : null, u.lands_with ? `lands with WU #${u.lands_with}` : null, u.review_wait ? `waiting on ${u.review_wait.type === "unit" ? `WU #${u.review_wait.target}` : u.review_wait.type === "ask" ? `ask ${u.review_wait.target}` : u.review_wait.type === "machine" ? `machine ${u.review_wait.target}` : u.review_wait.type === "text" ? u.review_wait.target : "evidence"} for ${Math.max(0, Math.round((Date.now() - Date.parse(u.review_wait.started_at)) / 60000))} min` : null, u.milestone ? `milestone ${u.milestone}` : null, u.target ? `lands in ${u.target}` : null, u.replay_of ? "REPLAY" : null, u.trial_tags?.length ? `trial on ${u.trial_tags.map((t) => `#${t}`).join(" ")}` : null].filter(Boolean).join(" · ");
|
|
579
579
|
const reviewers = u.reviewers.map((r) => `${r.name}${r.tags.length ? ` for ${r.tags.map((t) => `#${t}`).join(" ")}` : ""}`).join(", ");
|
|
580
580
|
const approvals = u.approvals.map((a) => a.name).join(", ");
|
|
581
581
|
return [
|
|
@@ -635,7 +635,10 @@ export async function wu(p, out) {
|
|
|
635
635
|
// and recorded exactly as `wu start` would; --here keeps the current checkout.
|
|
636
636
|
// One client id per create, reused across retries: a lost response or a 5xx after the unit was written returns that unit instead of making a second.
|
|
637
637
|
const clientId = randomUUID();
|
|
638
|
-
const
|
|
638
|
+
const priority = str(p.flags, "priority");
|
|
639
|
+
if (priority !== undefined && priority !== "normal" && priority !== "urgent")
|
|
640
|
+
throw new CliError("usage", "--priority must be urgent or normal");
|
|
641
|
+
const r = await client.call("POST", base, { client_id: clientId, title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), after: afterUnits(), reworks: list("reworks").map(Number), force: bool(p.flags, "force"), ...(priority ? { priority } : {}), ...symbolicBranchAndHead(), worktree: process.cwd(), target: str(p.flags, "target") ?? null, lands_with: parseLandsWith(str(p.flags, "lands-with")), milestone: str(p.flags, "milestone") ?? null, ...startTelemetry(name) }, { retries: 3 });
|
|
639
642
|
const n = r.unit.number;
|
|
640
643
|
const created = createdReceipt(r.unit);
|
|
641
644
|
if (r.unit.waiting_on != null) {
|
|
@@ -669,6 +672,9 @@ export async function wu(p, out) {
|
|
|
669
672
|
}
|
|
670
673
|
const to = str(p.flags, "to");
|
|
671
674
|
const reason = str(p.flags, "reason");
|
|
675
|
+
const priority = str(p.flags, "priority");
|
|
676
|
+
if (priority !== undefined && priority !== "normal" && priority !== "urgent")
|
|
677
|
+
throw new CliError("usage", "--priority must be urgent or normal");
|
|
672
678
|
if (!to)
|
|
673
679
|
throw new CliError("usage", 'wu assign "<title>" --to <agent|auto|queue> --scope "<what it covers and does not>" [--scope-file <path> | --scope-from <n>] [--tags a,b] [--after <n>[,<m>]] [--evidence id] [--replay-of <n>]');
|
|
674
680
|
const existingNumber = Number(p.positionals[2]);
|
|
@@ -687,7 +693,7 @@ export async function wu(p, out) {
|
|
|
687
693
|
const scope = await scopeText();
|
|
688
694
|
const replay = str(p.flags, "replay-of");
|
|
689
695
|
const clientId = randomUUID();
|
|
690
|
-
const r = await client.call("POST", `${base}/assign`, { client_id: clientId, to, title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), after: afterUnits(), replay_of: replay ? Number(replay) : null, reworks: list("reworks").map(Number), branch: explicitBranch, target: str(p.flags, "target") ?? null, lands_with: parseLandsWith(str(p.flags, "lands-with")), milestone: str(p.flags, "milestone") ?? null, hold: !!p.flags.hold, force: bool(p.flags, "force"), ...(reason === undefined ? {} : { reason }) }, { retries: 3 });
|
|
696
|
+
const r = await client.call("POST", `${base}/assign`, { client_id: clientId, to, title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), after: afterUnits(), replay_of: replay ? Number(replay) : null, reworks: list("reworks").map(Number), branch: explicitBranch, target: str(p.flags, "target") ?? null, lands_with: parseLandsWith(str(p.flags, "lands-with")), milestone: str(p.flags, "milestone") ?? null, hold: !!p.flags.hold, force: bool(p.flags, "force"), ...(priority ? { priority } : {}), ...(reason === undefined ? {} : { reason }) }, { retries: 3 });
|
|
691
697
|
out.print(`${createdReceiptLine(r.unit)}\n${fmt(r.unit)}\n${assignmentDisposition(r.unit, to)}${assignmentGuidanceOutput(r.warnings ?? [])}`, createdReceipt(r.unit));
|
|
692
698
|
return;
|
|
693
699
|
}
|
|
@@ -933,6 +939,17 @@ export async function wu(p, out) {
|
|
|
933
939
|
out.print(`${fmt(r.unit)}\n${actionResult}`, r);
|
|
934
940
|
return;
|
|
935
941
|
}
|
|
942
|
+
case "priority": {
|
|
943
|
+
const value = p.positionals[3];
|
|
944
|
+
const note = str(p.flags, "note");
|
|
945
|
+
if (value !== "urgent" && value !== "normal")
|
|
946
|
+
throw new CliError("usage", 'wu priority <n> urgent|normal --note "why this priority changed"');
|
|
947
|
+
if (!note?.trim())
|
|
948
|
+
throw new CliError("usage", 'wu priority <n> urgent|normal --note "why this priority changed"');
|
|
949
|
+
const r = await client.call("POST", `${base}/${num()}/priority`, { priority: value, note });
|
|
950
|
+
out.print(`${fmt(r.unit)}\nWU #${num()} priority is ${value}.`, r);
|
|
951
|
+
return;
|
|
952
|
+
}
|
|
936
953
|
case "supersede": {
|
|
937
954
|
const by = str(p.flags, "by");
|
|
938
955
|
if (!by)
|
|
@@ -1272,7 +1289,6 @@ export async function processCmd(p, out) {
|
|
|
1272
1289
|
const lines = [
|
|
1273
1290
|
`Process v${r.process.version}${r.process.version === 0 ? " (defaults; the operator has not published one)" : ""}`,
|
|
1274
1291
|
`Machine capabilities: ${(d.capabilities ?? []).map((c) => `${c.name} (${c.scope}${c.min_version ? ` >= ${c.min_version}` : ""})`).join(", ") || "none"}`,
|
|
1275
|
-
`Heavy job classes: ${Object.entries(d.heavy_jobs ?? {}).map(([name, job]) => `${name} (${job.memory_gib} GiB; ${job.purpose}; workflows ${job.workflows.join(", ")})`).join("; ") || "none"}`,
|
|
1276
1292
|
`Unlisted heavy workflows use the exclusive unknown-heavy class (the whole safe budget); an unknown budget or stale telemetry waits for operator review.`,
|
|
1277
1293
|
vocab.length ? `Tags (use them on b9s wu open --tags):` : `No tag vocabulary yet: units route to the default approver (${d.default_approver_role ?? "none"}).`,
|
|
1278
1294
|
...vocab.map((t) => ` #${t.name}: ${t.meaning || "(no meaning written)"}${t.require_evidence ? " · requires evidence" : ""}${t.require_rebased ? " · requires a rebased branch" : ""}${t.requires?.length ? ` · requires capabilities ${t.requires.join(", ")}` : ""}${t.focus ? ` · reviewer focus: ${t.focus}` : ""} · reviewed by ${whoReviews(t.name).join(", ") || "NOBODY (the operator must qualify a role)"}`),
|
|
@@ -1731,7 +1747,11 @@ export async function askOperator(p, out) {
|
|
|
1731
1747
|
if (!text || missing.length)
|
|
1732
1748
|
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(", ")}` : ""}`);
|
|
1733
1749
|
const proposal = str(p.flags, "propose") ?? "";
|
|
1734
|
-
const
|
|
1750
|
+
const milestone = str(p.flags, "milestone");
|
|
1751
|
+
const rawUnit = str(p.flags, "unit");
|
|
1752
|
+
if (rawUnit !== undefined && !/^[1-9]\d*$/.test(rawUnit))
|
|
1753
|
+
throw new CliError("usage", "--unit must be a positive work unit number");
|
|
1754
|
+
const r = await client.call("POST", `/projects/${project}/ask-operator`, { text, ...fields, proposal, ...(milestone !== undefined ? { milestone } : {}), ...(rawUnit !== undefined ? { unit: Number(rawUnit) } : {}) });
|
|
1735
1755
|
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);
|
|
1736
1756
|
}
|
|
1737
1757
|
async function reviewUsage(client, project, name) {
|
package/dist/help.js
CHANGED
|
@@ -69,10 +69,10 @@ Agent commands
|
|
|
69
69
|
b9s rule supersede <rule-id> --text "..." [--expires-at <UTC>] [--conflicts-with id,id] --confirm-compatible
|
|
70
70
|
b9s rule retire <rule-id> authorized assigner; project agent credentials restrict scope
|
|
71
71
|
review current charter/agreements before --confirm-compatible; no rule is inferred from chat
|
|
72
|
-
b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--force] [--evidence id[,id...]] [--target <branch>] [--here] [--json] open a work unit in its own
|
|
72
|
+
b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--priority urgent|normal] [--force] [--evidence id[,id...]] [--target <branch>] [--here] [--json] open a work unit in its own
|
|
73
73
|
worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
|
|
74
74
|
process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
|
|
75
|
-
b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--force] [--replay-of n] [--template] [--reason "why"] [--json] hand out a unit (assigner roles);
|
|
75
|
+
b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--priority urgent|normal] [--force] [--replay-of n] [--template] [--reason "why"] [--json] hand out a unit (assigner roles);
|
|
76
76
|
--to auto picks the active qualified worker with the lightest load; it queues when nobody fits,
|
|
77
77
|
reports why candidates were passed over, and the sweep chases it;
|
|
78
78
|
--to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
|
|
@@ -83,6 +83,7 @@ Agent commands
|
|
|
83
83
|
b9s wu list --json keeps complete titles.
|
|
84
84
|
b9s wu assign <n> --to <agent> [--reason "why"] reassign an assigned or queued unit in place
|
|
85
85
|
b9s wu lands-with <n> <base-unit|clear> set or clear the base WU whose landing gates this unit
|
|
86
|
+
b9s wu priority <n> urgent|normal --note "why this priority changed" operator or assigner: change dispatch priority; urgent work is dispatched first
|
|
86
87
|
b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
|
|
87
88
|
reason is required when an assigner uses its assign_outside_qualifications role capability
|
|
88
89
|
b9s wu next take the oldest queued unit you qualify for
|
|
@@ -133,8 +134,8 @@ Agent commands
|
|
|
133
134
|
closing a unit does not release a new job's lock
|
|
134
135
|
assigners/operators can remove an empty scoped lock with --remove-empty
|
|
135
136
|
lock names acquire/list/release/show/status are reserved: use lock <name>, locks, or unlock <name> as suggested
|
|
136
|
-
project locks are
|
|
137
|
-
Machine placement
|
|
137
|
+
project locks are the admission control for named concurrent work
|
|
138
|
+
Machine placement enforces configured session slots and reports machine pressure for operators. Pressure is telemetry only. Linux kernel memory limits protect running processes; a fresh disk-floor check blocks starts when the checkout or state volume is too low.
|
|
138
139
|
b9s measures latest measure values, freshness and merges since each value
|
|
139
140
|
b9s measure show <name> definition history, values and runner requests
|
|
140
141
|
b9s measure run <name> --sha <commit> [--target branch] [--rerun] request a bounded runner unit
|
|
@@ -167,12 +168,13 @@ Machine placement shares capacity across the account's projects: session seats a
|
|
|
167
168
|
b9s wu scope <n> --scope ".." | --scope-file <path> | --scope-from <n> --note ".." assigner or operator: replace the full scope; recorded and announced
|
|
168
169
|
b9s wu scope <n> --replace "<old>" "<new>" --note ".." replace one exact, unique substring of the scope
|
|
169
170
|
b9s wu scope <n> --append ".." --note ".." add a dated scope amendment (up to 2000 chars); the base scope stays capped at 4000
|
|
170
|
-
b9s ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."]
|
|
171
|
+
b9s ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."] [--milestone <key> | --unit <n>]
|
|
171
172
|
b9s ask-operator --amend <id> ["new question"] [--plain ".."] [--blocks ".."] [--if-yes ".."] [--if-no ".."] [--propose ".."] amend your own open ask
|
|
172
173
|
b9s ask-operator withdraw <key> --note "why it no longer needs an operator answer" withdraw your own ask, a steward-raised declared-wait ask, or an ask if you are a project assigner
|
|
173
174
|
b9s ask-operator refuses a second ask naming the same WU; use --amend <id>. Account needs group asks/questions by unit and can answer several together.
|
|
174
175
|
a decision only the operator can make, on their console banner and reported to them; never
|
|
175
176
|
ask in chat. --plain: one or two sentences for someone who has not read the thread; --propose: your recommended answer, phrased so they can approve it as written; --blocks: what's stuck; --if-yes/--if-no: what happens on each answer
|
|
177
|
+
b9s ask ... alias for ask-operator
|
|
176
178
|
b9s explain <ask-id> "..." the operator asked you (Explain) to put your request in plain words
|
|
177
179
|
b9s wu explain <n> "..." the same for a unit's question waiting on the operator
|
|
178
180
|
b9s wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
|
|
@@ -232,7 +234,7 @@ Machine placement shares capacity across the account's projects: session seats a
|
|
|
232
234
|
Persistent watcher startup waits a random logged 0..60 s by default; set --startup-jitter-seconds 0 to disable it for a deterministic start.
|
|
233
235
|
Machine pressure is advisory: it is reported, never a reason to hold a turn. A turn is refused only while
|
|
234
236
|
the checkout's or state volume has under 1 GiB or 2% free (checked fresh each time, nothing latched).
|
|
235
|
-
|
|
237
|
+
Machine pressure is reported as telemetry and does not hold a turn.
|
|
236
238
|
Claude Code workspace-write defaults to a $1 per-turn cap; configure it with --max-budget-usd
|
|
237
239
|
Account turn-spend caps are set by the account operator separately; token caps support subscriptions,
|
|
238
240
|
missing usage remains reserved. Hard caps alone do not enable judgment capture; the account owner explicitly
|
|
@@ -365,7 +367,7 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
|
|
|
365
367
|
b9s-admin channel create|delete <project> <name>
|
|
366
368
|
b9s-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
|
|
367
369
|
b9s-admin process show|export <project> [--out f] the process as agents are told it, or as an editable file
|
|
368
|
-
b9s-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules, tag focus
|
|
370
|
+
b9s-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules, and tag focus)
|
|
369
371
|
b9s-admin process tag add|edit|remove <project> <tag> [--meaning ..] [--require-evidence yes|no] [--require-rebased yes|no] [--expert-role r|none] [--requires name,name]
|
|
370
372
|
legacy project-first order also accepted; for operation-first with a project named add, edit, or remove:
|
|
371
373
|
b9s-admin process tag <op> <tag> --project <project>
|
package/dist/index.js
CHANGED
package/dist/output.js
CHANGED
|
@@ -51,9 +51,8 @@ export function fmtMessage(m) {
|
|
|
51
51
|
return `${m.created_at.slice(11, 19)} ${ch}${String(m.seq).padStart(5)} ${m.agent_name}${role}: ${m.body}`;
|
|
52
52
|
}
|
|
53
53
|
export function fmtStatus(s) {
|
|
54
|
-
const machineWaiting = s.machine_job_waiting === true;
|
|
55
54
|
const parts = [
|
|
56
|
-
`${s.state === "benched" ? "BENCHED " : ""}${s.agent_name}${s.role_name ? `[${s.role_name}]` : ""}${s.away ? ` (away until ${s.away.until}: ${s.away.reason})` : s.usage_limit_until ? ` (usage limit until ${s.usage_limit_until})` :
|
|
55
|
+
`${s.state === "benched" ? "BENCHED " : ""}${s.agent_name}${s.role_name ? `[${s.role_name}]` : ""}${s.away ? ` (away until ${s.away.until}: ${s.away.reason})` : s.usage_limit_until ? ` (usage limit until ${s.usage_limit_until})` : s.liveness === "quiet" ? " (quiet: harness went silent)" : s.liveness === "unknown" ? " (stale, harness unmonitored)" : s.liveness === "scheduled" ? ` (checks every ${s.checks_every} min, next ${(s.next_check_at ?? "").slice(11, 16)} UTC)` : s.liveness === "missed" ? ` (missed its ${s.checks_every}-min check)` : ""}`,
|
|
57
56
|
`state=${s.state ?? "-"}`,
|
|
58
57
|
s.goal ? `goal="${s.goal}"` : null,
|
|
59
58
|
s.task ? `task="${s.task}"` : null,
|
|
@@ -61,7 +60,6 @@ export function fmtStatus(s) {
|
|
|
61
60
|
`model=${s.model ?? "-"}`,
|
|
62
61
|
s.machine ? `machine=${s.machine}` : null,
|
|
63
62
|
s.machine_pressure ? `machine_health=${s.machine_pressure.state ?? "unknown"} (sample_age=${typeof s.machine_pressure.age_seconds === "number" ? `${Math.floor(s.machine_pressure.age_seconds)}s` : "unknown"}${s.machine_pressure.reasons?.length ? `; reasons=${s.machine_pressure.reasons.join(",")}` : ""})` : null,
|
|
64
|
-
machineWaiting ? "machine_wait=heavy_permit" : null,
|
|
65
63
|
s.capabilities?.length ? `capabilities=${s.capabilities.map((c) => `${c.name}:${c.ready ? c.version ?? "ok" : c.error ?? "stale/unknown"}`).join(",")}` : null,
|
|
66
64
|
s.branch ? `branch=${s.branch}${s.dirty ? "*" : ""}@${s.head ?? "?"}` : null,
|
|
67
65
|
s.worktree ? `worktree=${s.worktree}` : null,
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.12.
|
|
1
|
+
export const CLI_VERSION = "0.12.121";
|