benignswarm 0.12.87 → 0.12.89

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.
@@ -16,6 +16,7 @@ import { heartbeatIfActive, resolveActivitySource } from "../heartbeat.js";
16
16
  import { scanProject, unitWorktrees } from "./worktrees.js";
17
17
  import { formatBytes, freeSpaceProbe, pruneReport, removePrunable } from "../git.js";
18
18
  import { CliError } from "../errors.js";
19
+ import { claudeTurnEnv } from "../providers.js";
19
20
  import { acquireWatchLock } from "../lock.js";
20
21
  import { formatUpdates, gatherUpdates, reportDelivery } from "./hook.js";
21
22
  import { readState, writeState } from "../state.js";
@@ -83,7 +84,15 @@ export async function watch(p, out) {
83
84
  const session = (str(p.flags, "session") ?? (harness === "codex" ? thread : null))?.toLowerCase();
84
85
  if (!session)
85
86
  throw new CliError("usage", `--turn with --harness ${harness} needs --session <id>: the session its turns continue`);
86
- turn = { harness, session, timeout: turnTimeout };
87
+ const providerName = str(p.flags, "provider") ?? "anthropic";
88
+ if (providerName !== "anthropic" && providerName !== "deepseek")
89
+ throw new CliError("usage", "--provider must be anthropic or deepseek");
90
+ if (providerName === "deepseek" && harness !== "claude-code")
91
+ throw new CliError("usage", "--provider deepseek requires --harness claude-code");
92
+ turn = { harness, session, timeout: turnTimeout, provider: providerName, model: str(p.flags, "model") };
93
+ }
94
+ else if (p.flags.provider !== undefined) {
95
+ throw new CliError("usage", "--provider is only used with --turn --harness claude-code");
87
96
  }
88
97
  if (bool(p.flags, "launchd") || bool(p.flags, "service")) {
89
98
  if (!exec)
@@ -229,7 +238,7 @@ export async function watch(p, out) {
229
238
  try {
230
239
  if (probe)
231
240
  await turnStep(ctl, probe, turnTimeout, log, async (sink) => {
232
- const result = await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once, sink, !resumeBriefDelivered, turn?.harness === "dsh", () => probe.beginTurn?.());
241
+ const result = await wakeOnce(name, exec, unackedAfter, followDelay, log, turn?.model ?? str(p.flags, "model"), once, sink, !resumeBriefDelivered, turn?.harness === "claude-code" && turn.provider === "deepseek" ? turn.provider : undefined, turn?.harness === "dsh", () => probe.beginTurn?.());
233
242
  resumeBriefDelivered = resumeBriefDelivered || result.recoveryBriefDelivered;
234
243
  }, name);
235
244
  else {
@@ -318,7 +327,7 @@ async function waitIntervalOrStop(ms, stopped) {
318
327
  if (timer)
319
328
  clearTimeout(timer);
320
329
  }
321
- async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once, turnSink, includeResumeBrief = false, turnStdin = false, beforeTurn) {
330
+ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once, turnSink, includeResumeBrief = false, provider, turnStdin = false, beforeTurn) {
322
331
  const state = readState(name);
323
332
  const pending = state.watch_pending;
324
333
  if (pending) {
@@ -405,7 +414,7 @@ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once,
405
414
  // `{summary}` commands get the same bounded prompt as `{text}`: this wrapper itself contains
406
415
  // the acknowledgement, operator note, process pointer, read commands, and delivery body.
407
416
  const line = wake;
408
- if (!(await deliver(name, exec, wake, line, u ? u.tier : "process", total, log, operatorNew ? "operator message; " : "", seq, turnSink, payload?.delivery.by_kind ?? u?.delivery.by_kind, turnStdin, beforeTurn)))
417
+ if (!(await deliver(name, exec, wake, line, u ? u.tier : "process", total, log, operatorNew ? "operator message; " : "", seq, turnSink, payload?.delivery.by_kind ?? u?.delivery.by_kind, provider, model, turnStdin, beforeTurn)))
409
418
  return { sent: false, recoveryBriefDelivered: false };
410
419
  writeState(name, {
411
420
  ...readState(name),
@@ -430,7 +439,7 @@ async function recoveryBriefText(name, log) {
430
439
  }
431
440
  }
432
441
  /** Runs the wake command (or prints the wake-up without one). False when the command failed: nothing was delivered. */
433
- async function deliver(name, exec, wake, summary, tier, total, log, prefix, seq, turnSink, kinds = {}, turnStdin = false, beforeTurn) {
442
+ export async function deliver(name, exec, wake, summary, tier, total, log, prefix, seq, turnSink, kinds = {}, provider, model, turnStdin = false, beforeTurn, dependencies = {}) {
434
443
  if (!exec) {
435
444
  process.stdout.write(wake + "\n");
436
445
  return true;
@@ -442,8 +451,11 @@ async function deliver(name, exec, wake, summary, tier, total, log, prefix, seq,
442
451
  // it started, and reports how it ended.
443
452
  log(`${prefix}[${tier}] starting turn #${seq}: ${summary}`);
444
453
  // The agent's own b9s calls in the turn know who they are without any repo file.
454
+ // Provider credentials are read only when spawning the turn and are never persisted in the
455
+ // launchd/systemd service or its command line.
456
+ const providerEnv = claudeTurnEnv(provider, model, dependencies.providerRoot);
445
457
  beforeTurn?.();
446
- turnSink(startTurn(cmd, { ...env, BSCHAT_AGENT: name }, seq, turnStdin ? wake : undefined));
458
+ turnSink((dependencies.startTurn ?? startTurn)(cmd, { ...env, BSCHAT_AGENT: name, ...providerEnv }, seq, turnStdin ? wake : undefined));
447
459
  }
448
460
  else {
449
461
  log(`${prefix}[${tier}] queueing wake-up: ${summary}`);
@@ -752,7 +764,7 @@ function installLaunchd(name, exec, interval, followDelay, extraEnv, activity, o
752
764
  bindSession(sess.kind, sess.id, name);
753
765
  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: b9s doctor\nThe watcher runs from ${process.cwd()} so the repo identity file applies.`, { plist: path, label, program: program[0] });
754
766
  }
755
- const turnArgs = (t) => (t ? ["--turn", "--turn-timeout", String(t.timeout), "--harness", t.harness, "--session", t.session] : []);
767
+ const turnArgs = (t) => (t ? ["--turn", "--turn-timeout", String(t.timeout), "--harness", t.harness, "--session", t.session, ...(t.provider === "deepseek" ? ["--provider", t.provider] : []), ...(t.model ? ["--model", t.model] : [])] : []);
756
768
  function escapeXml(s) {
757
769
  return s.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
758
770
  }
@@ -7,7 +7,7 @@ import { readState } from "../state.js";
7
7
  import { codexRollout, sessionsOf } from "../sessions.js";
8
8
  import { sessionUsage } from "../usage.js";
9
9
  import { CliError } from "../errors.js";
10
- import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, findRemoteCommitBranch, formatRemoteCommitFailure, formatRemoteCommitSuccess, fullSha, isAncestor, removeWorktreeIfClean, repoName, repoParent, verifyMergedCommit, worktreeForBranch } from "../git.js";
10
+ import { branchAndHead, commitAtTime, ensureReviewWorktree, ensureWorktree, fetchRef, findRemoteCommitBranch, formatRemoteCommitFailure, formatRemoteCommitSuccess, fullSha, isAncestor, removeWorktreeIfClean, repoName, repoParent, verifyMergedCommit, verifyNoCommitsBeyondTarget, worktreeForBranch } from "../git.js";
11
11
  import { resolve } from "node:path";
12
12
  import { table } from "../output.js";
13
13
  export function scopeEditFromArgs(p) {
@@ -102,7 +102,17 @@ export function changedPathsAgainstTarget(target, cwd = process.cwd()) {
102
102
  return diff.stdout.split("\0").filter((path) => path.length > 0);
103
103
  }
104
104
  export function submitPayload(fields, hasReviewRules, target, cwd = process.cwd()) {
105
- return { ...fields, changed_paths: hasReviewRules ? changedPathsAgainstTarget(target, cwd) : [] };
105
+ const paths = changedPathsAgainstTarget(target, cwd);
106
+ const directories = {}, fileKinds = {};
107
+ for (const path of paths) {
108
+ const slash = path.lastIndexOf("/");
109
+ const directory = slash < 0 ? "(root)" : path.slice(0, path.indexOf("/"));
110
+ const basename = path.slice(slash + 1), dot = basename.lastIndexOf(".");
111
+ const kind = dot <= 0 ? "(no extension)" : basename.slice(dot).toLowerCase();
112
+ directories[directory] = (directories[directory] ?? 0) + 1;
113
+ fileKinds[kind] = (fileKinds[kind] ?? 0) + 1;
114
+ }
115
+ return { ...fields, changed_paths: hasReviewRules ? paths : [], changed_path_summary: { total: paths.length, by_directory: directories, by_file_kind: fileKinds, paths: paths.slice(0, 200), truncated: paths.length > 200 } };
106
116
  }
107
117
  export function branchValueIdsAtHead(values, head) {
108
118
  if (!head)
@@ -157,6 +167,11 @@ export async function wu(p, out) {
157
167
  }
158
168
  return items;
159
169
  };
170
+ const afterUnits = () => list("after").map((item) => {
171
+ if (!/^\d+$/.test(item) || Number(item) < 1)
172
+ throw new CliError("usage", `--after expects comma-separated work unit numbers, got ${JSON.stringify(item)}`);
173
+ return Number(item);
174
+ });
160
175
  const num = () => {
161
176
  const n = Number(p.positionals[2]);
162
177
  if (!Number.isInteger(n) || n < 1)
@@ -165,7 +180,8 @@ export async function wu(p, out) {
165
180
  };
166
181
  const tags = (u) => (u.tags.length ? u.tags.map((t) => `#${t}`).join(" ") : "(untagged)");
167
182
  const fmt = (u) => {
168
- const flags = [u.assigned_by ? `assigned by ${u.assigned_by}` : null, u.preferred_name ? `reserved for ${u.preferred_name}` : null, u.hold && u.status === "assigned" ? "held" : null, u.waiting_on ? `waits on #${u.waiting_on}` : 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(" · ");
183
+ const waitList = Array.isArray(u.waits_on) ? u.waits_on : u.waiting_on ? [u.waiting_on] : [];
184
+ 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.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(" · ");
169
185
  const reviewers = u.reviewers.map((r) => `${r.name}${r.tags.length ? ` for ${r.tags.map((t) => `#${t}`).join(" ")}` : ""}`).join(", ");
170
186
  const approvals = u.approvals.map((a) => a.name).join(", ");
171
187
  return [
@@ -177,7 +193,8 @@ export async function wu(p, out) {
177
193
  u.question ? ` QUESTION for ${u.question.level === "expert" ? `a ${u.question.roles.join(" or ")}` : "the operator"} (asked by ${u.question.asked_by}${u.question.passed_by ? `, passed up by ${u.question.passed_by}` : ""}): ${u.question.text}` : null,
178
194
  u.evidence_claims?.total ? ` evidence claims: ${u.evidence_claims.confirmed} confirmed / ${u.evidence_claims.refuted} refuted / ${u.evidence_claims.unchecked} unchecked\n${u.evidence_claims.items.map((claim) => ` [${claim.state}] ${claim.filename}: ${claim.claim}${claim.verifier_name ? ` — ${claim.verifier_name}${claim.note ? `: ${claim.note}` : ""}` : ""}`).join("\n")}` : null,
179
195
  ` ${u.branch ? `${u.branch}${u.head ? ` @ ${u.head}` : ""}` : "no branch recorded"}${u.worktree ? ` in ${u.worktree.replace(/^\/(Users|home)\/[^/]+\//, "~/")}` : ""}${u.pr_url ? ` · ${u.pr_url}` : ""}${u.merged_sha ? ` · merged ${u.merged_sha}` : ""}${u.evidence.length ? ` · evidence ${u.evidence.map((e) => `evidence:${e}`).join(" ")}` : ""}`,
180
- u.scope ? ` scope: ${u.scope}` : null,
196
+ (u.base_scope ?? u.scope) ? ` scope: ${u.base_scope ?? u.scope}` : null,
197
+ u.scope_amendments?.length ? ` scope amendments:\n${u.scope_amendments.map((amendment) => ` ${amendment.at} ${amendment.author}: ${amendment.text}`).join("\n")}` : null,
181
198
  ].filter(Boolean).join("\n");
182
199
  };
183
200
  const processDef = async () => (await client.call("GET", `/projects/${project}/process`)).process.definition;
@@ -217,13 +234,17 @@ export async function wu(p, out) {
217
234
  case "open": {
218
235
  const title = p.positionals.slice(2).join(" ").trim();
219
236
  if (!title)
220
- throw new CliError("usage", 'wu open "<title>" --scope "<what it covers and does not>" [--scope-file <path> | --scope-from <n>] [--tags a,b] [--tier routine|careful|expert] [--evidence id]');
237
+ throw new CliError("usage", 'wu open "<title>" --scope "<what it covers and does not>" [--scope-file <path> | --scope-from <n>] [--tags a,b] [--after <n>[,<m>]] [--tier routine|careful|expert] [--evidence id]');
221
238
  const unitTags = list("tags");
222
239
  const scope = await scopeText();
223
240
  // The unit exists first (it needs its number for the branch name), then its worktree is made
224
241
  // and recorded exactly as `wu start` would; --here keeps the current checkout.
225
- const r = await client.call("POST", base, { title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), min_tier: str(p.flags, "tier"), force: bool(p.flags, "force"), ...branchAndHead(), worktree: process.cwd(), target: str(p.flags, "target") ?? null, milestone: str(p.flags, "milestone") ?? null });
242
+ const r = await client.call("POST", base, { title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), after: afterUnits(), reworks: list("reworks").map(Number), min_tier: str(p.flags, "tier"), force: bool(p.flags, "force"), ...branchAndHead(), worktree: process.cwd(), target: str(p.flags, "target") ?? null, milestone: str(p.flags, "milestone") ?? null });
226
243
  const n = r.unit.number;
244
+ if (r.unit.waiting_on != null) {
245
+ out.print(`${fmt(r.unit)}\nWait until ${r.unit.waits_on.map((on) => `WU #${on}`).join(", ")} closes, then start with: b9s wu start ${n}`, r);
246
+ return;
247
+ }
227
248
  const { path, branch, mode } = prepareWorktree(n, r.unit, await processDef(), p, await checkoutExclude());
228
249
  const where = branchAndHead(path);
229
250
  const s = await client.call("POST", `${base}/${n}/start`, { branch: branch ?? where.branch, head: where.head, worktree: path, mode });
@@ -245,27 +266,33 @@ export async function wu(p, out) {
245
266
  return;
246
267
  }
247
268
  const to = str(p.flags, "to");
269
+ const reason = str(p.flags, "reason");
248
270
  if (!to)
249
- 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] [--tier routine|careful|expert] [--evidence id] [--replay-of <n>]');
271
+ 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>]] [--tier routine|careful|expert] [--evidence id] [--replay-of <n>]');
250
272
  const existingNumber = Number(p.positionals[2]);
251
273
  if (Number.isInteger(existingNumber) && existingNumber > 0 && p.positionals.length === 3) {
252
- const r = await client.call("POST", `${base}/${existingNumber}/assign`, { to });
274
+ if (p.flags.after !== undefined)
275
+ throw new CliError("usage", "--after applies when creating a unit; use b9s wu wait to change an existing unit's wait");
276
+ const r = await client.call("POST", `${base}/${existingNumber}/assign`, { to, ...(reason === undefined ? {} : { reason }) });
253
277
  out.print(fmt(r.unit), r);
254
278
  return;
255
279
  }
256
280
  const title = p.positionals.slice(2).join(" ").trim();
257
281
  if (!title)
258
- 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] [--tier routine|careful|expert] [--evidence id] [--replay-of <n>]');
282
+ 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>]] [--tier routine|careful|expert] [--evidence id] [--replay-of <n>]');
259
283
  const scope = await scopeText();
260
284
  const replay = str(p.flags, "replay-of");
261
- const r = await client.call("POST", `${base}/assign`, { to, title, scope, tags: unitTags, requires: list("requires"), evidence: list("evidence"), replay_of: replay ? Number(replay) : null, branch: str(p.flags, "branch") ?? null, target: str(p.flags, "target") ?? null, milestone: str(p.flags, "milestone") ?? null, min_tier: str(p.flags, "tier"), hold: !!p.flags.hold, force: bool(p.flags, "force") });
285
+ const r = await client.call("POST", `${base}/assign`, { 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: str(p.flags, "branch") ?? null, target: str(p.flags, "target") ?? null, milestone: str(p.flags, "milestone") ?? null, min_tier: str(p.flags, "tier"), hold: !!p.flags.hold, force: bool(p.flags, "force"), ...(reason === undefined ? {} : { reason }) });
262
286
  out.print(`${fmt(r.unit)}\n${assignmentDisposition(r.unit, to)}${r.warnings?.length ? `\nScope warnings:\n${r.warnings.map((w) => `- ${w}`).join("\n")}` : ""}`, r);
263
287
  return;
264
288
  }
265
289
  case "take": {
266
290
  // Pull a queued unit: for yourself (qualified by works or trial), or for someone with --to (assigners).
267
291
  const to = str(p.flags, "to") ?? null;
268
- const r = await client.call("POST", `${base}/${num()}/take`, { to });
292
+ const reason = str(p.flags, "reason");
293
+ if (reason !== undefined && !to)
294
+ throw new CliError("usage", 'wu take <n> --to <agent> --reason "why" is only for an assigner handing work to a named agent');
295
+ const r = await client.call("POST", `${base}/${num()}/take`, { to, ...(reason === undefined ? {} : { reason }) });
269
296
  out.print(`${fmt(r.unit)}\n${to ? `Handed to ${r.unit.owner_name}.` : `Yours. Start it: b9s wu start ${r.unit.number}`}`, r);
270
297
  return;
271
298
  }
@@ -310,7 +337,7 @@ export async function wu(p, out) {
310
337
  throw new CliError("usage", 'wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] (a planning unit needs one of them)');
311
338
  const waits = str(p.flags, "waits-on");
312
339
  const r = await client.call("POST", `${base}/${num()}/decline`, { note, ...(waits ? { waits_on: waits.split(",").map((k) => k.trim()).filter(Boolean) } : {}), ...(bool(p.flags, "defer") ? { defer: true } : {}) });
313
- out.print(fmt(r.unit), r);
340
+ out.print(`Declined; now ${r.unit.status}.\n${fmt(r.unit)}`, r);
314
341
  return;
315
342
  }
316
343
  case "submit": {
@@ -477,16 +504,44 @@ export async function wu(p, out) {
477
504
  out.print(fmt(r.unit), r);
478
505
  return;
479
506
  }
507
+ case "kind": {
508
+ const kind = str(p.flags, "kind");
509
+ const reason = str(p.flags, "reason");
510
+ if (!kind || !reason)
511
+ throw new CliError("usage", 'wu kind <n> --kind <product_change|enabling_tooling|diagnosis_audit|documentation|rework|needs_classification> --reason "why"');
512
+ const r = await client.call("POST", `${base}/${num()}/kind`, { kind, reason });
513
+ out.print(fmt(r.unit), r);
514
+ return;
515
+ }
480
516
  case "done": {
481
517
  const def = await processDef();
482
518
  const merged = str(p.flags, "merged") ?? null;
519
+ const noSource = bool(p.flags, "no-source");
520
+ const evidence = list("evidence");
521
+ if (noSource && merged)
522
+ throw new CliError("usage", "--merged and --no-source are mutually exclusive");
523
+ if (!noSource && evidence.length)
524
+ throw new CliError("usage", "--evidence on wu done requires --no-source");
483
525
  const unit = (await client.call("GET", `${base}/${num()}`)).unit;
484
526
  const landsIn = unit.target ?? def.merge.target_branch;
485
527
  let verifiedRemoteTarget = null;
528
+ let noCommitsBeyondTarget = false;
486
529
  if (unit.replay_of) {
487
530
  // A replay is an evaluation: it closes without merging (the server records it as evaluated).
488
- if (merged)
489
- throw new CliError("usage", `WU #${num()} is a replay, compared and never merged: close it without --merged`);
531
+ if (merged || noSource)
532
+ throw new CliError("usage", `WU #${num()} is a replay, compared and never merged: close it without --merged or --no-source`);
533
+ }
534
+ else if (noSource) {
535
+ if (!evidence.length)
536
+ throw new CliError("usage", "--no-source requires at least one --evidence id");
537
+ if (unit.branch) {
538
+ const check = verifyNoCommitsBeyondTarget(unit.branch, landsIn, process.cwd(), def.merge.require_pushed);
539
+ if (check.on === null)
540
+ throw new CliError("unknown_commit", `cannot verify ${unit.branch} against ${check.ref}`, `Fetch the branch and ${landsIn} in the project repository, then retry`);
541
+ if (!check.on)
542
+ throw new CliError("has_commits", `${unit.branch} has commits not contained by ${check.ref}; --no-source is only for work with no commits beyond its target`);
543
+ noCommitsBeyondTarget = true;
544
+ }
490
545
  }
491
546
  else if (merged) {
492
547
  // Where pushes are required the remote target is the truth, not this machine's copy of it.
@@ -513,7 +568,7 @@ export async function wu(p, out) {
513
568
  else if (def.merge.require_merge_commit) {
514
569
  throw new CliError("usage", `this project's process requires the merge commit: b9s wu done ${num()} --merged <sha>`);
515
570
  }
516
- const r = await client.call("POST", `${base}/${num()}/done`, { note: str(p.flags, "note") ?? "", merged });
571
+ const r = await client.call("POST", `${base}/${num()}/done`, { note: str(p.flags, "note") ?? "", merged, ...(noSource ? { no_source: true, evidence, no_commits_beyond_target: noCommitsBeyondTarget } : {}) });
517
572
  out.print(fmt(r.unit) + (verifiedRemoteTarget ? `\nverified on ${verifiedRemoteTarget}` : "") + cleanupUnitWorktree(r.unit.worktree, def, !!p.flags["keep-worktree"]), r);
518
573
  return;
519
574
  }
@@ -629,6 +684,10 @@ export async function wu(p, out) {
629
684
  }
630
685
  /** Queued units have no owner; ask the API to reject before any local worktree is made. */
631
686
  export async function preflightQueuedStart(client, base, n, unit) {
687
+ if (unit.waiting_on != null) {
688
+ const waits = unit.waits_on?.length ? unit.waits_on : [unit.waiting_on];
689
+ throw new CliError("unit_waiting", `work unit #${n} waits on ${waits.map((on) => `#${on}`).join(", ")}; start it after those units close`);
690
+ }
632
691
  if (unit.status === "queued")
633
692
  await client.call("POST", `${base}/${n}/start`, {});
634
693
  }
@@ -655,6 +714,7 @@ export async function processCmd(p, out) {
655
714
  `Untagged units are approved by ${d.default_approver_role ?? "nobody (set a default approver)"}.${d.classification === "classifier" ? ` A ${d.classifier_role} confirms tags before review.` : ""}`,
656
715
  `A unit needs a title${d.require_scope ? ", a scope statement" : ""}${d.require_evidence_to_submit ? ", evidence before review" : ""}. Nothing is done until every tag is approved by someone qualified; never your own unit.`,
657
716
  `Review SLA ${d.review_sla_minutes} min; after ${d.escalate_after_minutes} min another qualified reviewer takes over. Max ${d.max_open_per_agent} open units per agent. Announcements in #${d.channel}.`,
717
+ ...(r.wake_path_warnings?.length ? [`No verified wake path:`, ...r.wake_path_warnings.map((warning) => ` ${warning.consequence}`)] : []),
658
718
  `Merging: ${d.merge.merged_by === "owner" ? "the owner" : d.merge.merged_by === "approver" ? "an approver" : `a ${d.merge.integrator_role}`} merges approved work into ${d.merge.target_branch}${d.merge.require_rebased ? "; the branch must contain " + d.merge.target_branch + " before review" : ""}${d.merge.require_merge_commit ? "; done carries the merge commit (b9s wu done <n> --merged <sha>)" : ""}.`,
659
719
  r.process.agreements ? `\nWorking agreements:\n${r.process.agreements}` : null,
660
720
  r.process.charter ? `\nCharter (how this project weighs its trade-offs; judge reviews and questions by it):\n${r.process.charter}` : null,
@@ -760,7 +820,7 @@ export async function milestones(p, out) {
760
820
  */
761
821
  export async function milestonesWith(client, project, sub, p, out) {
762
822
  if (sub === "export") {
763
- const list = (await client.call("GET", `/projects/${project}/milestones`)).milestones.map((m) => ({ key: m.key, title: m.title, exit: m.exit, ...(m.source ? { source: m.source } : {}), depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], ...(m.priority !== null && m.priority !== undefined ? { priority: m.priority } : {}) }));
823
+ const list = (await client.call("GET", `/projects/${project}/milestones`)).milestones.map((m) => ({ key: m.key, title: m.title, exit: m.exit, expectations: m.expectations ?? [], ...(m.source ? { source: m.source } : {}), depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], ...(m.priority !== null && m.priority !== undefined ? { priority: m.priority } : {}) }));
764
824
  const text = JSON.stringify(list, null, 2) + "\n";
765
825
  const file = str(p.flags, "out");
766
826
  if (file) {
@@ -833,17 +893,28 @@ export async function milestoneWith(client, project, sub, key, p, out, decisionP
833
893
  const dependencies = [...deps.map((key) => ({ key, kind: "blocks" })), ...informs.map((key) => ({ key, kind: "informs" }))];
834
894
  const exit = str(p.flags, "exit") ?? existing?.exit ?? "";
835
895
  const source = str(p.flags, "source") ?? existing?.source ?? "";
896
+ let expectations = existing?.expectations ?? [];
897
+ if (str(p.flags, "expectations") !== undefined) {
898
+ try {
899
+ expectations = JSON.parse(str(p.flags, "expectations"));
900
+ }
901
+ catch {
902
+ throw new CliError("usage", "--expectations must be a JSON list of {measure, direction?, value?, checkpoint?: closure}");
903
+ }
904
+ if (!Array.isArray(expectations))
905
+ throw new CliError("usage", "--expectations must be a JSON list of expectation objects");
906
+ }
836
907
  const default_tags = str(p.flags, "default-tags") !== undefined ? (str(p.flags, "default-tags") ?? "").split(",").map((s) => s.trim().replace(/^#/, "")).filter(Boolean) : existing?.default_tags ?? [];
837
908
  // --priority <n> (higher first) or none; the steward asks for units only on the highest-priority ready slices.
838
909
  const pr = str(p.flags, "priority");
839
910
  if (pr !== undefined && pr !== "none" && !/^-?\d+$/.test(pr))
840
911
  throw new CliError("usage", "--priority takes a whole number (higher first) or none");
841
912
  const priority = pr === undefined ? existing?.priority ?? null : pr === "none" ? null : Number(pr);
842
- const next = cur.map((m) => ({ key: m.key, title: m.title, exit: m.exit, source: m.source ?? "", depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], priority: m.priority ?? null }));
913
+ const next = cur.map((m) => ({ key: m.key, title: m.title, exit: m.exit, expectations: m.expectations ?? [], source: m.source ?? "", depends_on: m.dependencies ?? m.depends_on, default_tags: m.default_tags ?? [], priority: m.priority ?? null }));
843
914
  if (existing)
844
- Object.assign(next.find((m) => m.key === key), { title, exit, source, depends_on: dependencies, default_tags, priority });
915
+ Object.assign(next.find((m) => m.key === key), { title, exit, expectations, source, depends_on: dependencies, default_tags, priority });
845
916
  else
846
- next.push({ key, title, exit, source, depends_on: dependencies, default_tags, priority });
917
+ next.push({ key, title, exit, expectations, source, depends_on: dependencies, default_tags, priority });
847
918
  const r = await client.call("PUT", `/projects/${project}/milestones`, { milestones: next });
848
919
  const m = r.milestones.find((x) => x.key === key);
849
920
  out.print(`${sub === "add" ? "Added" : "Updated"} milestone ${m.key}: ${m.title} [${m.ready ? "ready" : `waits on ${m.waiting_on.join(", ")}`}]${!m.exit && !m.depends_on.length ? " (container: never chased)" : ""}`, r);
package/dist/git.js CHANGED
@@ -71,6 +71,25 @@ export function isAncestor(ancestor, ref, cwd = process.cwd()) {
71
71
  const r = spawnSync("git", ["merge-base", "--is-ancestor", ancestor, ref], { cwd, stdio: "ignore" });
72
72
  return r.status === 0;
73
73
  }
74
+ /** Confirm an evidence-only unit branch contains no commits missing from its configured target. */
75
+ export function verifyNoCommitsBeyondTarget(branch, target, cwd = process.cwd(), requirePushed = false) {
76
+ if (requirePushed) {
77
+ const ref = `origin/${target}`;
78
+ const fetched = spawnSync("git", ["fetch", "--quiet", "origin", `+refs/heads/${target}:refs/remotes/origin/${target}`], { cwd, encoding: "utf8", timeout: 120_000 }).status === 0;
79
+ if (!fetched)
80
+ return { on: null, ref };
81
+ return { on: isAncestor(branch, ref, cwd), ref };
82
+ }
83
+ const local = isAncestor(branch, target, cwd);
84
+ if (local === true)
85
+ return { on: true, ref: target };
86
+ const ref = `origin/${target}`;
87
+ const fetched = spawnSync("git", ["fetch", "--quiet", "origin", `+refs/heads/${target}:refs/remotes/origin/${target}`], { cwd, encoding: "utf8", timeout: 120_000 }).status === 0;
88
+ if (!fetched)
89
+ return { on: local, ref: target };
90
+ const remote = isAncestor(branch, ref, cwd);
91
+ return remote === true ? { on: true, ref } : { on: remote, ref };
92
+ }
74
93
  /** Branch and short head of the worktree at cwd, or nulls outside a repo. */
75
94
  export function branchAndHead(cwd = process.cwd()) {
76
95
  const a = collectAuto({ model: undefined, machine: "", cwd });
package/dist/harnesses.js CHANGED
@@ -418,11 +418,12 @@ export function claudeSettings(sandbox, model, effort, cwd, bschatHome, extraWri
418
418
  * the credentials file changes and at most every 6 hours otherwise; only an authentication error
419
419
  * counts as logged out, and any other failure is reported as unverified with its error.
420
420
  */
421
- export function claudeFacts(verify = verifyClaudeLoginCached) {
422
- const v = spawnSync("claude", ["--version"], { encoding: "utf8", timeout: 30_000 });
421
+ export function claudeFacts(verify, path = process.env.PATH ?? "") {
422
+ const env = { ...process.env, PATH: path };
423
+ const v = spawnSync("claude", ["--version"], { encoding: "utf8", timeout: 30_000, env });
423
424
  if (v.status !== 0)
424
425
  return null;
425
- const s = spawnSync("claude", ["auth", "status"], { encoding: "utf8", timeout: 30_000 });
426
+ const s = spawnSync("claude", ["auth", "status"], { encoding: "utf8", timeout: 30_000, env });
426
427
  let stored = false;
427
428
  let method = "unknown method";
428
429
  try {
@@ -435,13 +436,13 @@ export function claudeFacts(verify = verifyClaudeLoginCached) {
435
436
  }
436
437
  if (!stored)
437
438
  return { version: v.stdout.trim(), logged_in: false, login: "not logged in", verified: { ok: false, error: "no stored login" } };
438
- const verified = verify();
439
+ const verified = (verify ?? (() => verifyClaudeLoginCached(env)))();
439
440
  const login = verified.ok === true ? `logged in (${method})` : verified.ok === false ? `stored login rejected: ${verified.error}` : `logged in (${method}), not verified: ${verified.error}`;
440
441
  return { version: v.stdout.trim(), logged_in: verified.ok !== false, login: login.slice(0, 200), verified };
441
442
  }
442
443
  /** One minimal headless call; ok false only when Claude Code reports an authentication failure. */
443
- export function verifyClaudeLogin() {
444
- const r = spawnSync("claude", ["-p", "Reply OK", "--model", "claude-haiku-4-5-20251001", "--output-format", "json"], { encoding: "utf8", timeout: 120_000, cwd: homedir() });
444
+ export function verifyClaudeLogin(env = process.env) {
445
+ const r = spawnSync("claude", ["-p", "Reply OK", "--model", "claude-haiku-4-5-20251001", "--output-format", "json"], { encoding: "utf8", timeout: 120_000, cwd: homedir(), env });
445
446
  const error = claudeResultError(r.stdout ?? "") ?? (r.status !== 0 ? `${r.stderr ?? ""}`.trim().split("\n")[0] || `exit ${r.status}` : null);
446
447
  if (!error)
447
448
  return { ok: true, error: null };
@@ -449,12 +450,13 @@ export function verifyClaudeLogin() {
449
450
  }
450
451
  export const claudeIsAuthError = (e) => /401|403|authenticat|not logged in|\/login|oauth token|invalid api key/i.test(e);
451
452
  let loginCache = null;
452
- function verifyClaudeLoginCached() {
453
+ function verifyClaudeLoginCached(env = process.env) {
453
454
  const cred = join(claudeHome(), ".credentials.json");
454
455
  const key = existsSync(cred) ? String(statSync(cred).mtimeMs) : "keychain";
455
- if (loginCache && loginCache.key === key && Date.now() - loginCache.at < 6 * 60 * 60_000)
456
+ const cacheKey = `${key}\0${env.PATH ?? ""}`;
457
+ if (loginCache && loginCache.key === cacheKey && Date.now() - loginCache.at < 6 * 60 * 60_000)
456
458
  return loginCache.result;
457
- loginCache = { key, at: Date.now(), result: verifyClaudeLogin() };
459
+ loginCache = { key: cacheKey, at: Date.now(), result: verifyClaudeLogin(env) };
458
460
  return loginCache.result;
459
461
  }
460
462
  /**
@@ -462,14 +464,15 @@ function verifyClaudeLoginCached() {
462
464
  * bubblewrap and socat, and bubblewrap needs unprivileged user namespaces (Ubuntu 24.04 restricts
463
465
  * them with AppArmor), so this runs bubblewrap the way a sandboxed command would.
464
466
  */
465
- export function claudeSandbox() {
467
+ export function claudeSandbox(path = process.env.PATH ?? "") {
466
468
  if (process.platform === "darwin")
467
469
  return existsSync("/usr/bin/sandbox-exec") ? { ok: true, error: null } : { ok: false, error: "sandbox-exec is missing" };
468
470
  if (process.platform !== "linux")
469
471
  return { ok: false, error: `no Claude Code sandbox on ${process.platform}` };
470
- const missing = ["bwrap", "socat"].filter((b) => spawnSync("/bin/sh", ["-c", `command -v ${b}`]).status !== 0);
472
+ const env = { ...process.env, PATH: path };
473
+ const missing = ["bwrap", "socat"].filter((b) => spawnSync("/bin/sh", ["-c", `command -v ${b}`], { env }).status !== 0);
471
474
  if (missing.length)
472
475
  return { ok: false, error: `${missing.join(" and ")} not installed (sudo apt-get install bubblewrap socat)` };
473
- const r = spawnSync("bwrap", ["--ro-bind", "/", "/", "--dev", "/dev", "--proc", "/proc", "--unshare-all", "--die-with-parent", "true"], { encoding: "utf8", timeout: 30_000 });
476
+ const r = spawnSync("bwrap", ["--ro-bind", "/", "/", "--dev", "/dev", "--proc", "/proc", "--unshare-all", "--die-with-parent", "true"], { encoding: "utf8", timeout: 30_000, env });
474
477
  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}`}` };
475
478
  }
package/dist/help.js CHANGED
@@ -20,6 +20,8 @@ GET /account/usage reports used and allowed micro-dollars, uncertain calls and t
20
20
  Session/admin clients can use GET /assistant/conversations, GET /assistant/conversations/:id/messages (paged history with saved tool notices), POST /assistant/conversations/:id/messages (SSE), and DELETE /assistant/conversations/:id. Old assistant messages report notices_available=false. The assistant can draft changes; POST /assistant/proposals/:id/apply or /discard is the operator's explicit action. See the agent/operator skill API reference for events and tools.
21
21
  Free and paid accounts without a live Stripe subscription use the UTC calendar month; subscribed paid accounts reset at current_period_end.
22
22
 
23
+ GitHub repository links are managed by the account owner through the browser session API: POST /github/connect, GET /github/callback, GET /github/repositories, and POST/GET/DELETE /projects/:p/github-link. App setup steps are in the operator skill (packages/skill-admin/references/setup.md). Hosted merge remains disabled; this connection unit's stand-in ruleset test is accepted, and a separate live GitHub bypass-change check is required before enablement.
24
+
23
25
  Agent commands
24
26
  b9s login --as <name> --key <bs_agent_...> [--url <api>] [--label <machine-label>]
25
27
  b9s logout --as <name>
@@ -41,20 +43,24 @@ Agent commands
41
43
  b9s inbox [--unread] [--after <iso-time>] [--limit n] mentions of you and replies to your messages
42
44
  b9s follow <channel> | unfollow <channel> | following followed channels' new messages are injected by the hook;
43
45
  other channels appear as a one-line unread digest
44
- b9s process the project's process: tag vocabulary, scope templates, reviewer focus, machine/path requirements, slice defaults, agreements
45
- b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--tier routine|careful|expert] [--requires cap,cap] [--force] [--evidence id[,id...]] [--target <branch>] [--here] open a work unit in its own
46
+ b9s process the project's process: tag vocabulary, reviewers, wake-path warnings, scope templates, requirements, agreements
47
+ b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--after <n>[,<m>]] [--tier routine|careful|expert] [--requires cap,cap] [--force] [--evidence id[,id...]] [--target <branch>] [--here] open a work unit in its own
46
48
  worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
47
49
  process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
48
- b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--tier routine|careful|expert] [--requires cap,cap] [--force] [--replay-of n] [--template] hand out a unit (assigner roles);
50
+ b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--reworks n,m] [--after <n>[,<m>]] [--tier routine|careful|expert] [--requires cap,cap] [--force] [--evidence id[,id...]] [--target <branch>] [--here] open a work unit in its own
51
+ worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
52
+ process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
53
+ b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--reworks n,m] [--after <n>[,<m>]] [--tier routine|careful|expert] [--requires cap,cap] [--force] [--replay-of n] [--template] [--reason "why"] hand out a unit (assigner roles);
49
54
  --to auto picks the active qualified worker with the lightest load; it queues when nobody fits,
50
55
  reports why candidates were passed over, and the sweep chases it;
51
56
  --to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
52
57
  anyone's after the takeover window); --hold keeps it assigned to them however long it takes;
53
58
  --template --tags a,b prints the scope skeleton; --force records missing required sections, including for queue.
54
- b9s wu assign <n> --to <agent> reassign an assigned or queued unit in place
55
- b9s wu take <n> [--to <agent>] pull a queued unit for yourself (qualified by works or trial), or hand it to someone
59
+ b9s wu assign <n> --to <agent> [--reason "why"] reassign an assigned or queued unit in place
60
+ b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
61
+ reason is required when an assigner uses its assign_outside_qualifications role capability
56
62
  b9s wu next take the oldest queued unit you qualify for
57
- b9s wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] decline an assignment; a steward planning unit
63
+ b9s wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] decline and requeue an assignment (use wu abandon to close); a steward planning unit
58
64
  ("Advance milestone X") needs the plan decision: what X waits on, or defer X
59
65
  b9s wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
60
66
  target as of the original); a worktree left half-written by an interrupted
@@ -65,7 +71,7 @@ Agent commands
65
71
  b9s milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
66
72
  b9s milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
67
73
  {key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
68
- b9s milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--default-tags a,b] [--priority n|none] add one slice (assigner
74
+ b9s milestone add <key> --title ".." [--exit ".."] [--source "docs/plan.md#b0"] [--depends-on a,b] [--informs c,d] [--default-tags a,b] [--priority n|none] [--expectations '<JSON list>'] add one slice (assigner
69
75
  roles or the operator); --source is where the full brief lives, read only when planning the slice;
70
76
  no exit and no dependencies makes a container for ongoing work; milestone edit (or set) <key> amends;
71
77
  --priority <n|none> (higher first): the steward asks for units only on the top ready slices
@@ -106,7 +112,7 @@ Agent commands
106
112
  owner or reviewer: pause review on a named blocker; reviewer may record a partial verdict
107
113
  b9s wu scope <n> --scope ".." | --scope-file <path> | --scope-from <n> --note ".." assigner or operator: replace the full scope; recorded and announced
108
114
  b9s wu scope <n> --replace "<old>" "<new>" --note ".." replace one exact, unique substring of the scope
109
- b9s wu scope <n> --append ".." --note ".." append a scope clause; changes are recorded and announced as a short before/after
115
+ b9s wu scope <n> --append ".." --note ".." add a dated scope amendment (up to 2000 chars); the base scope stays capped at 4000
110
116
  b9s ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."]
111
117
  b9s ask-operator --amend <id> ["new question"] [--plain ".."] [--blocks ".."] [--if-yes ".."] [--if-no ".."] [--propose ".."] amend your own open ask
112
118
  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.
@@ -115,10 +121,11 @@ Agent commands
115
121
  b9s explain <ask-id> "..." the operator asked you (Explain) to put your request in plain words
116
122
  b9s wu explain <n> "..." the same for a unit's question waiting on the operator
117
123
  b9s wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
124
+ b9s wu kind <n> --kind <kind> --reason "why" assigner/operator overrides the progress-view kind, with an audit event
118
125
  b9s wu hold <n> --note ".." operator or assigner: no verdict and no merge until the owner resubmits;
119
126
  wu release <n> [--note ..] lifts it earlier
120
127
  b9s wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
121
- b9s wu done <n> --merged <sha> [--keep-worktree] after approval; verifies locally, then on origin if needed; removes the unit's clean worktree
128
+ b9s wu done <n> --merged <sha> | --no-source --evidence id[,id...] [--keep-worktree] after approval; no-source closes an evidence-only unit without a merge SHA and checks its branch has no commits beyond the target
122
129
  b9s wu show <n> [--scope-only] show the full unit or only its scope for scripts
123
130
  b9s wu abandon <n> [--note ..] wu list [--all] for state and timeline
124
131
  b9s worktrees prune [--yes] [--archive] remove clean worktrees whose work landed or whose unit is closed (dry run without --yes);
@@ -146,7 +153,7 @@ Agent commands
146
153
  b9s doctor every b9s on this machine and who runs which (PATH, npx caches, this repo's
147
154
  hook and instructions, each watcher's plist versus what launchd runs), with fixes
148
155
  b9s codex hooks | bind <thread-id> | sync install b9s's Codex hooks (~/.codex/hooks.json) and say which thread is you
149
- b9s start --harness codex|claude-code|dsh --as <a> --sandbox <mode> [--token t] [--thread id] [--model m] [--effort e] [--dsh path]
156
+ b9s start --harness codex|claude-code|dsh --as <a> --sandbox <mode> [--provider anthropic|deepseek] [--token t] [--thread id] [--model m] [--effort e] [--dsh path]
150
157
  run an agent headless: enroll, start or adopt its session, turn-mode watcher
151
158
  (b9s codex start is the same with --harness codex)
152
159
  b9s unpause [--as <a>] lift a usage-limit pause now (the harness was switched to an account with quota)
@@ -228,8 +235,9 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
228
235
  pin a notice to every agent on a machine or in a project
229
236
  b9s-admin notice list | remove <id> list or remove a machine/project notice
230
237
  b9s-admin role create <name> [--project p] [--description d] [--broadcast] [--create-channels] [--read-account-status] [--permissions '{json}'] [--cardinality one|many]
231
- b9s-admin role edit <name> [--project p] [--projects a,b|*] [--post c1,c2] [--broadcast] [--create-channels] [--read-account-status] [--description d] [--cardinality one|many]
238
+ b9s-admin role edit <name> [--project p] [--projects a,b|*] [--post c1,c2] [--broadcast] [--create-channels] [--read-account-status] [--assign-outside-qualifications yes|no] [--description d] [--cardinality one|many]
232
239
  b9s-admin role list [--project p]
240
+ b9s-admin wu assign <project> <n> --to <agent> [--reason "why"] operator: reassign a unit in place
233
241
  b9s-admin role delete <name> [--project p]
234
242
  b9s-admin channel create|delete <project> <name>
235
243
  b9s-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
@@ -245,6 +253,7 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
245
253
  b9s-admin milestone <project> add|edit <key> --title .. [--exit ..] [--source ..] [--depends-on a,b] [--informs c,d] [--default-tags a,b] one slice in, the rest untouched
246
254
  b9s-admin milestone <project> show|review|reopen <key> | decide <key> "ruling" --unit n | close <key> --note .. [--abandon|--defer] | verdict <key> --met|--gaps .. | gap-units <key> --units n,m
247
255
  b9s-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
256
+ --assign-outside-qualifications yes|no allow assigners in this role to make reasoned ownership exceptions; dispatch stays qualified
248
257
  b9s-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
249
258
  b9s-admin answer <key> "decision" answer one; the asker is @mentioned
250
259
  b9s-admin answer <key> --approve [--assign <agent>] [--note ".."] accept an ask proposal and name its action owner
@@ -266,10 +275,10 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
266
275
  b9s-admin machine list | show <name> | remove <name>
267
276
  b9s-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
268
277
  15 min before, its agents away until the machine reports back after booting
269
- b9s-admin machine session add <machine> <project>/<agent> --dir <checkout> --sandbox <read-only|workspace-write|danger-full-access>
278
+ b9s-admin machine session add <machine> <project>/<agent> --dir <checkout> --sandbox <read-only|workspace-write|danger-full-access> [--harness codex|claude-code] [--provider anthropic|deepseek]
270
279
  [--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min]
271
280
  b9s-admin machine session stop|start|remove <machine> <project>/<agent>
272
- b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> [--dir <path>|auto] [--carry note|thread]
281
+ b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> [--dir <path>|auto] [--harness codex|claude-code] [--provider anthropic|deepseek] [--carry note|thread]
273
282
  [--from local|<ssh host>] [--model m] [--effort e] [--wait min] [--force]
274
283
  run an existing agent on a provisioned machine: refuses unpushed unit work (checked on
275
284
  --from), carries its context as a resume note or its Codex thread, revokes other keys
@@ -281,7 +290,7 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
281
290
  Pools (a role, variants and a count; the server names the agents and places them on machines)
282
291
  b9s-admin project repo <project> <git url | none> what machines clone for the project's pool sessions
283
292
  b9s-admin project checkout <project> --exclude <path,path | none> paths new worktrees leave out (sparse checkout), e.g. logs/
284
- b9s-admin pool set <project>/<name> --role <role> --variant [tag=]harness:model[:effort][*weight] [--variant ...]
293
+ b9s-admin pool set <project>/<name> --role <role> --variant [tag=]harness:model[:effort][*weight][@anthropic|deepseek] [--variant ...]
285
294
  --count <n> --sandbox <mode> [--needs label,label] [--min-ram GB] [--turn-timeout min]
286
295
  slots are agents named <name>-<tag>-<n>; fewer retires the extra ones
287
296
  b9s-admin pool list [project] | show <project>/<name> | remove <project>/<name>