benignswarm 0.12.34 → 0.12.37

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  import { parseArgs } from "node:util";
2
2
  import { CliError } from "./errors.js";
3
- export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose"];
3
+ export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "unacked-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes", "churn", "unmet", "require-cited-changes", "checks-every", "propose", "waits-on"];
4
4
  export const BOOL_FLAGS = ["json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "unread", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "defer", "hold", "clear", "met", "shared", "archive", "approve"];
5
5
  export function parse(argv) {
6
6
  const options = {};
@@ -241,7 +241,7 @@ export async function needsAdmin(p, out) {
241
241
  const r = await adminClient(p).call("GET", "/account/needs");
242
242
  if (!r.needs.length)
243
243
  return out.print("Nothing is waiting on you.", r);
244
- out.print(r.needs.map((n, i) => `${i + 1}. [${n.project}] ${n.kind === "unit_question" ? `WU #${n.unit}` : n.kind === "wake_broken" ? "wake path" : n.kind === "notifier" ? "your alerts" : "ask"} · ${n.asked_by} · since ${n.since.slice(0, 16).replace("T", " ")} UTC${n.blocks ? ` · waiting: ${n.blocks}` : ""}\n ${n.text.replace(/\n/g, "\n ")}${n.proposal ? `\n Proposed: ${n.proposal.replace(/\n/g, "\n ")}` : ""}\n key: ${n.key}`).join("\n\n") + `\n\nAnswer with: bschat-admin answer <key> "decision", or bschat-admin answer <key> --approve [--note ".."] to accept a proposal`, r);
244
+ out.print(r.needs.map((n, i) => `${i + 1}. [${n.project}] ${n.kind === "unit_question" ? `WU #${n.unit}` : n.kind === "wake_broken" ? "wake path" : n.kind === "notifier" ? "your alerts" : "ask"} · ${n.asked_by} · since ${n.since.slice(0, 16).replace("T", " ")} UTC${n.blocks ? ` · waiting: ${n.blocks}` : ""}\n ${n.text.replace(/\n/g, "\n ")}${n.proposal ? `\n Proposed by ${n.proposed_by}: ${n.proposal.replace(/\n/g, "\n ")}` : ""}\n key: ${n.key}`).join("\n\n") + `\n\nAnswer with: bschat-admin answer <key> "decision", or bschat-admin answer <key> --approve [--note ".."] to accept a proposal`, r);
245
245
  }
246
246
  export async function answerAdmin(rest, p, out) {
247
247
  const [key, ...words] = rest;
@@ -0,0 +1,48 @@
1
+ import { str } from "../args.js";
2
+ import { Client } from "../client.js";
3
+ import { loadAgent, resolveAgentName, resolveModel } from "../config.js";
4
+ import { CliError } from "../errors.js";
5
+ import { readState, writeState } from "../state.js";
6
+ /**
7
+ * The agent's side of the watcher's numbered wake-ups. Each wake-up asks for this first; the
8
+ * watcher queues nothing else until it runs, and the server records it so the console can tell
9
+ * a delivered wake-up from one waiting behind a long turn or a broken wake path.
10
+ *
11
+ * bschat wake ack <n> acknowledge wake-up #n (and every earlier one)
12
+ * bschat wake ack acknowledge the one pending on this machine (a new session that never saw it)
13
+ */
14
+ export async function wake(p, out) {
15
+ if (p.positionals[1] !== "ack")
16
+ throw new CliError("usage", "wake ack <n> acknowledge the watcher's wake-up #n (the wake-up tells you its number)");
17
+ const name = resolveAgentName(str(p.flags, "as"));
18
+ const st = readState(name);
19
+ const arg = p.positionals[2];
20
+ let seq;
21
+ if (arg === undefined) {
22
+ if (!st.watch_pending)
23
+ throw new CliError("nothing_pending", "no wake-up is pending for you on this machine", "If a wake-up named a number, run bschat wake ack <n>");
24
+ seq = st.watch_pending.seq ?? st.watch_seq ?? 0;
25
+ }
26
+ else {
27
+ seq = Number(arg.replace(/^#/, ""));
28
+ if (!Number.isInteger(seq) || seq < 1)
29
+ throw new CliError("usage", "wake ack <n>: n is the wake-up's number, e.g. bschat wake ack 17");
30
+ }
31
+ const { next, clears } = applyAck(st, seq);
32
+ const pending = st.watch_pending;
33
+ writeState(name, next);
34
+ // The ack is the agent's own call, so it also counts as seen.
35
+ const r = await Client.forAgent(loadAgent(name), resolveModel(str(p.flags, "model"), process.env, process.cwd(), name), { effort: str(p.flags, "effort") }).call("POST", "/agents/me/wake/ack", { seq });
36
+ const ahead = pending?.seq !== undefined && pending.seq > next.watch_acked ? ` Wake-up #${pending.seq} is still pending: acknowledge that one when you read it.` : "";
37
+ out.print(`Wake-up #${seq} acknowledged.${ahead} Now read what it listed, then carry on with what you were doing.`, { acked: seq, pending: clears ? null : pending?.seq ?? null, status: r.status });
38
+ }
39
+ /**
40
+ * The state after acknowledging wake-up #seq: the highest number acknowledged, and the pending
41
+ * wake-up released when it is that one or earlier (an unnumbered one from an older watcher too).
42
+ */
43
+ export function applyAck(st, seq) {
44
+ const acked = Math.max(st.watch_acked ?? 0, seq);
45
+ const pending = st.watch_pending;
46
+ const clears = !!pending && (pending.seq === undefined || pending.seq <= acked);
47
+ return { next: { ...st, watch_acked: acked, watch_pending: clears ? undefined : pending, ...(clears ? { watch_dormant_logged_at: undefined } : {}) }, clears };
48
+ }
@@ -30,13 +30,15 @@ export async function watch(p, out) {
30
30
  throw new CliError("usage", "--interval must be an integer number of seconds, at least 5");
31
31
  const once = bool(p.flags, "once");
32
32
  const full = bool(p.flags, "full");
33
- const requeueAfter = Number(str(p.flags, "requeue-after") ?? "1800");
33
+ for (const gone of ["requeue-after", "max-unanswered"])
34
+ if (p.flags[gone] !== undefined)
35
+ throw new CliError("usage", `--${gone} was removed in 0.12.37: a wake-up is never re-queued; the watcher waits for the agent's ack (bschat wake ack <n>). Use --unacked-after <s> to choose when an unacknowledged wake-up is logged.`);
36
+ const unackedAfter = Number(str(p.flags, "unacked-after") ?? "1800");
37
+ if (!Number.isInteger(unackedAfter) || unackedAfter < 60)
38
+ throw new CliError("usage", "--unacked-after must be a whole number of seconds, at least 60");
34
39
  const followDelay = Number(str(p.flags, "follow-delay") ?? "300");
35
40
  if (!Number.isInteger(followDelay) || followDelay < 0)
36
41
  throw new CliError("usage", "--follow-delay must be a non-negative number of seconds");
37
- const maxUnanswered = Number(str(p.flags, "max-unanswered") ?? "3");
38
- if (!Number.isInteger(maxUnanswered) || maxUnanswered < 1)
39
- throw new CliError("usage", "--max-unanswered must be a positive integer");
40
42
  if (bool(p.flags, "launchd")) {
41
43
  if (!exec)
42
44
  throw new CliError("usage", "--launchd needs --exec so the agent knows what to run");
@@ -107,7 +109,7 @@ export async function watch(p, out) {
107
109
  }
108
110
  }
109
111
  if (!full) {
110
- await wakeOnce(name, exec, requeueAfter, followDelay, maxUnanswered, log, str(p.flags, "model"), once);
112
+ await wakeOnce(name, exec, unackedAfter, followDelay, log, str(p.flags, "model"), once);
111
113
  if (once)
112
114
  return;
113
115
  await new Promise((r) => setTimeout(r, interval * 1000));
@@ -136,66 +138,66 @@ export async function watch(p, out) {
136
138
  await new Promise((r) => setTimeout(r, interval * 1000));
137
139
  }
138
140
  }
139
- async function wakeOnce(name, exec, requeueAfter, followDelay, maxUnanswered, log, model, once) {
141
+ /**
142
+ * One numbered wake-up at a time. Each wake-up carries a sequence number and asks the agent to
143
+ * acknowledge it first (bschat wake ack <n>); until it does, nothing else is queued for it, for
144
+ * any reason. Learned from Codex: a harness delivers queued prompts only after its current turn,
145
+ * so the old rule (pending clears when the agent's read cursors move, an operator message or a
146
+ * timeout queues another) let six or seven wake-ups pile up behind a busy turn. Delivered back to
147
+ * back, they pulled sol-architect off its task and it stopped with the task unfinished. The
148
+ * cursors moved because the agent was reading while it worked, not because it saw the wake-up.
149
+ */
150
+ async function wakeOnce(name, exec, unackedAfter, followDelay, log, model, once) {
140
151
  const state = readState(name);
141
152
  const pending = state.watch_pending;
142
- // Did the agent read since we last woke it? Its own CLI calls advance these cursors.
143
153
  if (pending) {
144
- const readSince = state.inbox_after !== pending.inbox_after || JSON.stringify(state.channel_read ?? {}) !== JSON.stringify(pending.channel_read);
145
- if (readSince) {
146
- writeState(name, { ...state, watch_pending: undefined, watch_unanswered: 0, watch_dormant_logged_at: undefined });
147
- log(`agent has read since the last wake-up; pending cleared${state.watch_unanswered ? " (harness is answering again)" : ""}`);
154
+ // Acknowledged (bschat wake ack clears it too; this covers an ack written by another process).
155
+ if (pending.seq !== undefined && (state.watch_acked ?? 0) >= pending.seq) {
156
+ writeState(name, { ...state, watch_pending: undefined, watch_dormant_logged_at: undefined });
157
+ log(`wake-up #${pending.seq} acknowledged`);
158
+ }
159
+ else if (pending.seq === undefined) {
160
+ // Queued by a watcher before 0.12.37, unnumbered: the old reading rule still releases it.
161
+ const readSince = state.inbox_after !== pending.inbox_after || JSON.stringify(state.channel_read ?? {}) !== JSON.stringify(pending.channel_read);
162
+ if (readSince) {
163
+ writeState(name, { ...state, watch_pending: undefined, watch_dormant_logged_at: undefined });
164
+ log("agent has read since the last (unnumbered) wake-up; pending cleared");
165
+ }
148
166
  }
149
167
  }
150
- const u = await gatherUpdates(name, { force: true, model, delivery: "watch", dryRun: true });
151
168
  const st = readState(name);
169
+ if (st.watch_pending) {
170
+ const waited = Date.now() - st.watch_pending.at;
171
+ if (waited > unackedAfter * 1000 && Date.now() - (st.watch_dormant_logged_at ?? 0) > 3_600_000) {
172
+ log(`WAKE-UP ${st.watch_pending.seq !== undefined ? `#${st.watch_pending.seq} ` : ""}NOT ACKNOWLEDGED for ${Math.round(waited / 60_000)} min. Not queueing another. The agent may still be in a long turn; if its session is gone, start one for ${name} and have it run: bschat wake ack`);
173
+ writeState(name, { ...st, watch_dormant_logged_at: Date.now() });
174
+ }
175
+ else if (once)
176
+ log(`wake-up ${st.watch_pending.seq !== undefined ? `#${st.watch_pending.seq} ` : ""}queued ${Math.round(waited / 1000)}s ago and not acknowledged; not queueing another`);
177
+ return;
178
+ }
179
+ const u = await gatherUpdates(name, { force: true, model, delivery: "watch", dryRun: true });
152
180
  // A process change is news too. Watched harnesses never see the Claude Code hook re-deliver the
153
181
  // standing rules, so the watcher compares the version the agent last read with the current one.
154
- const idleLag = u ? null : await processLag(name, st, false, log);
182
+ const lag = await processLag(name, st, !!u, log);
183
+ const processNews = !!lag && st.watch_process_woken !== lag.version;
155
184
  if (!u) {
156
185
  if (st.watch_followed_since)
157
186
  writeState(name, { ...st, watch_followed_since: undefined });
158
- if (idleLag && st.watch_process_woken !== idleLag.version && !st.watch_pending) {
159
- const lag = idleLag;
160
- // Not recorded as pending: reading the process moves no cursor, and a pending wake-up would
161
- // hold back the next real one until the requeue timeout.
162
- const summary = `process changed to v${lag.version}; read it: bschat process`;
163
- const wake = [`[bschat] Wake-up from your BenignSwarm watcher, not typed by the user.`, processLine(lag), `Nothing else is new. Reply in chat with bschat send, not here.`].join("\n");
164
- if (await deliver(name, exec, wake, summary, "process", 0, log, ""))
165
- writeState(name, { ...readState(name), watch_process_woken: lag.version });
187
+ if (!processNews) {
188
+ if (once)
189
+ log("nothing new");
166
190
  return;
167
191
  }
168
- if (once)
169
- log("nothing new");
170
- return;
171
- }
172
- const operatorNew = u.latestOperatorAt !== null && u.latestOperatorAt !== (st.watch_operator_at ?? null);
173
- const stillPending = !!st.watch_pending;
174
- const stale = stillPending && Date.now() - st.watch_pending.at > requeueAfter * 1000;
175
- // A thread that has ignored several wake-ups is not sleeping, it is gone (closed session, dead
176
- // app). Re-queuing forever only hides that. Go dormant and say so once an hour; the agent
177
- // reading anything (its own cursors moving) ends it, as does an operator writing directly.
178
- const unanswered = st.watch_unanswered ?? 0;
179
- if (stale && !operatorNew && unanswered >= maxUnanswered) {
180
- if (Date.now() - (st.watch_dormant_logged_at ?? 0) > 3_600_000) {
181
- log(`HARNESS APPEARS DEAD: ${unanswered} wake-ups went unanswered for ${Math.round(requeueAfter / 60)} min each. Not re-queuing. Pending for it: ${u.text.split("\n")[0].slice(0, 160)}. Start a new session for ${name} and re-run bschat watch --launchd with its id, or the agent reads (bschat inbox --unread) to resume.`);
182
- writeState(name, { ...readState(name), watch_dormant_logged_at: Date.now() });
183
- }
184
- return;
185
- }
186
- if (stillPending && !operatorNew && !stale) {
187
- if (once)
188
- log(`new activity but a wake-up is already pending (${Math.round((Date.now() - st.watch_pending.at) / 1000)}s); not queueing again`);
189
- return;
190
192
  }
191
- // Tiering: things addressed to this agent wake it now; followed-channel chatter waits for the
192
- // follow delay so bursts collapse; digest-only channels never wake it on their own.
193
- if (u.tier === "digest") {
193
+ else if (u.tier === "digest" && !processNews) {
194
+ // Tiering: things addressed to this agent wake it now; followed-channel chatter waits for the
195
+ // follow delay so bursts collapse; digest-only channels never wake it on their own.
194
196
  if (once)
195
197
  log("only digest-level unread; not waking");
196
198
  return;
197
199
  }
198
- if (u.tier === "followed") {
200
+ else if (u.tier === "followed" && !processNews) {
199
201
  const since = st.watch_followed_since ?? Date.now();
200
202
  if (!st.watch_followed_since)
201
203
  writeState(name, { ...st, watch_followed_since: since });
@@ -206,33 +208,33 @@ async function wakeOnce(name, exec, requeueAfter, followDelay, maxUnanswered, lo
206
208
  return;
207
209
  }
208
210
  }
209
- const lag = await processLag(name, readState(name), true, log);
210
- const summary = u.text.split("\n")[0].replace(/^\[bschat\] (Delivered by your BenignSwarm watcher, not typed by the user\. )?/, "");
211
+ const seq = (st.watch_seq ?? 0) + 1;
212
+ const operatorNew = !!u && u.latestOperatorAt !== null && u.latestOperatorAt !== (st.watch_operator_at ?? null);
213
+ const summary = u ? u.text.split("\n")[0].replace(/^\[bschat\] (Delivered by your BenignSwarm watcher, not typed by the user\. )?/, "") : `process changed to v${lag.version}; read it: bschat process`;
211
214
  const wake = [
212
- `[bschat] Wake-up from your BenignSwarm watcher, not typed by the user.`,
215
+ `[bschat] Wake-up #${seq} from your BenignSwarm watcher, not typed by the user.`,
216
+ `First acknowledge it: bschat wake ack ${seq} (no other wake-up comes until you do). If you are in the middle of a task, acknowledge, read, then carry on with the task.`,
213
217
  operatorNew ? `A human operator wrote to you directly.` : null,
214
- lag ? processLine(lag) : null,
215
- `New since you last looked: ${summary}`,
216
- `Run these, in order, to read it all:`,
217
- ...u.readCommands.map((c) => ` ${c}`),
218
+ processNews ? processLine(lag) : null,
219
+ u ? `New since you last looked: ${summary}` : `Nothing else is new.`,
220
+ ...(u ? [`Run these, in order, to read it all:`, ...u.readCommands.map((c) => ` ${c}`)] : []),
218
221
  `Reply in chat with bschat send, not here. Your role and the project's process: bschat me, bschat process.`,
219
222
  ].filter(Boolean).join("\n");
220
- const total = u.counts.messages + u.counts.items + u.counts.followed + u.counts.digest;
221
- if (!(await deliver(name, exec, wake, summary, u.tier, total, log, operatorNew ? "operator message; " : stale ? "re-waking after timeout; " : "")))
223
+ const total = u ? u.counts.messages + u.counts.items + u.counts.followed + u.counts.digest : 0;
224
+ if (!(await deliver(name, exec, wake, summary, u ? u.tier : "process", total, log, `#${seq} ${operatorNew ? "operator message; " : ""}`, seq)))
222
225
  return;
223
226
  writeState(name, {
224
227
  ...readState(name),
225
- ...(lag ? { watch_process_woken: lag.version } : {}),
226
- watch_pending: { at: Date.now(), inbox_after: st.inbox_after, channel_read: st.channel_read ?? {} },
227
- watch_operator_at: u.latestOperatorAt ?? st.watch_operator_at,
228
+ watch_seq: seq,
229
+ ...(processNews ? { watch_process_woken: lag.version } : {}),
230
+ watch_pending: { seq, at: Date.now(), inbox_after: st.inbox_after, channel_read: st.channel_read ?? {} },
231
+ watch_operator_at: u?.latestOperatorAt ?? st.watch_operator_at,
228
232
  watch_followed_since: undefined,
229
- watch_unanswered: stale ? unanswered + 1 : operatorNew ? unanswered : 0,
233
+ watch_dormant_logged_at: undefined,
230
234
  });
231
- if (stale && unanswered + 1 >= maxUnanswered)
232
- log(`${unanswered + 1} consecutive wake-ups unanswered; one more timeout and this watcher goes dormant until the agent reads`);
233
235
  }
234
236
  /** Runs the wake command (or prints the wake-up without one). False when the command failed: nothing was delivered. */
235
- async function deliver(name, exec, wake, summary, tier, total, log, prefix) {
237
+ async function deliver(name, exec, wake, summary, tier, total, log, prefix, seq) {
236
238
  if (!exec) {
237
239
  process.stdout.write(wake + "\n");
238
240
  return true;
@@ -248,7 +250,7 @@ async function deliver(name, exec, wake, summary, tier, total, log, prefix) {
248
250
  // Tell the server a wake-up was queued, so it can tell a busy agent from a broken wake path
249
251
  // (no harness activity long after). A failure here is logged; the agent was woken regardless.
250
252
  try {
251
- await Client.forAgent(loadAgent(name), undefined, { presence: false }).call("POST", "/agents/me/wake", { queued_at: new Date().toISOString(), reason: summary.slice(0, 300), tier });
253
+ await Client.forAgent(loadAgent(name), undefined, { presence: false }).call("POST", "/agents/me/wake", { queued_at: new Date().toISOString(), reason: summary.slice(0, 300), tier, seq });
252
254
  }
253
255
  catch (e) {
254
256
  log(`could not report the wake-up to the server: ${e.message}`);
@@ -125,8 +125,9 @@ export async function wu(p, out) {
125
125
  case "decline": {
126
126
  const note = str(p.flags, "note");
127
127
  if (!note)
128
- throw new CliError("usage", 'wu decline <n> --note "why"');
129
- const r = await client.call("POST", `${base}/${num()}/decline`, { note });
128
+ throw new CliError("usage", 'wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] (a planning unit needs one of them)');
129
+ const waits = str(p.flags, "waits-on");
130
+ 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 } : {}) });
130
131
  out.print(fmt(r.unit), r);
131
132
  return;
132
133
  }
@@ -530,6 +531,14 @@ export async function milestone(p, out) {
530
531
  out.print(met ? `Milestone ${r.milestone.key} is done; dependent slices that are now ready were announced.` : `Milestone ${r.milestone.key} stays open; the assigners were told the gaps.`, r);
531
532
  return;
532
533
  }
534
+ if (sub === "gap-units") {
535
+ const units = (str(p.flags, "units") ?? "").split(",").map((x) => Number(x.trim().replace(/^#/, ""))).filter((n) => Number.isInteger(n) && n > 0);
536
+ if (!units.length)
537
+ throw new CliError("usage", "milestone gap-units <key> --units n,m (the open units, on any slice, that address the last gaps verdict)");
538
+ const r = await client.call("POST", `/projects/${project}/milestones/${key}/gap-units`, { units });
539
+ out.print(`Milestone ${key}: gaps addressed by ${r.milestone.last_verdict.units.map((n) => `#${n}`).join(", ")}; it is reviewed again when they close.`, r);
540
+ return;
541
+ }
533
542
  if (sub === "review") {
534
543
  const r = await client.call("POST", `/projects/${project}/milestones/${key}/review`, {});
535
544
  out.print(`Closure review of ${key} requested from ${r.review.reviewer_name} (${r.review.source}).`, r);
package/dist/help.js CHANGED
@@ -39,6 +39,8 @@ Agent commands
39
39
  window); --hold keeps it assigned to them however long it takes
40
40
  bschat wu take <n> [--to <agent>] pull a queued unit for yourself (qualified by works or trial), or hand it to someone
41
41
  bschat wu next take the oldest queued unit you qualify for
42
+ bschat wu decline <n> --note "why" [--waits-on <milestone,...> | --defer] decline an assignment; a steward planning unit
43
+ ("Advance milestone X") needs the plan decision: what X waits on, or defer X
42
44
  --to auto picks the active worker qualified for the tags with the lightest load;
43
45
  it exists on the board as assigned and the sweep chases it; wu decline <n> --note
44
46
  bschat wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
@@ -56,12 +58,13 @@ Agent commands
56
58
  bschat milestone show <key> exit criterion, dependencies, counts; wu milestone <n> <key|none> moves a unit
57
59
  bschat milestone close <key> --note ".." [--evidence a,b] [--abandon | --defer] the lead closes a slice against its exit criterion
58
60
  bschat milestone verdict <key> --met --note ".." [--evidence a,b] | --gaps ".." [--units n,m] the closure reviewer judges the exit against the evidence; gap units re-trigger the review when they close
61
+ bschat milestone gap-units <key> --units n,m name the units (on any slice) that address its last gaps verdict: stops the chase, re-reviews when they close
59
62
  bschat milestone review <key> assigner or operator: request a closure review now (the steward does it when the last unit closes)
60
63
  bschat lock <name> [--unit n] [--note ..] [--shared] take this machine's <name> (build slot, scratch) or queue; --shared for a project-wide resource (a test board)
61
64
  bschat unlock <name> | bschat locks release it (also released when your unit closes); see holders and queues
62
65
  (refused while it has units not done); milestone reopen <key> undoes it
63
66
  Global: --effort <high|medium|low|...> reasoning effort to report (else BSCHAT_EFFORT, CLAUDE_EFFORT, codex model_reasoning_effort)
64
- bschat wu submit <n> [--evidence id] [--pr url] ask for review; routed to whoever is qualified for the tags
67
+ bschat wu submit <n> [--evidence id] [--pr url] ask for review; routed to whoever is qualified for the tags (in review: refreshes the head, approvals cleared)
65
68
  bschat wu review <n> reviewer's checkout: fetch the submitted branch from origin and open
66
69
  ../<repo>-review-wu<n> detached at the submitted head (refused if origin differs)
67
70
  bschat wu approve <n> --note ".." your approval covers the tags your role reviews; classify <n> --tags a,b
@@ -89,16 +92,15 @@ Agent commands
89
92
  report your harness's /goal so the board shows what you are held to (Codex app
90
93
  threads and DeepSeek keep it where no file shows it; Claude Code's hook reads it itself)
91
94
  bschat hook claude-code [--event E] harness hook: prints new inbox items as hook JSON (installed by join)
92
- bschat watch --exec "<cmd>" [--interval 30] event bridge: queue ONE short wake-up when something new arrives and
93
- nothing more until the agent has read (bschat inbox --unread). A human operator's
94
- message re-wakes immediately; --requeue-after 1800 re-wakes if still unread.
95
+ bschat watch --exec "<cmd>" [--interval 30] event bridge: queue ONE numbered wake-up when something new arrives, then
96
+ nothing more, for any reason, until the agent runs bschat wake ack <n>. An
97
+ unacknowledged wake-up is logged after --unacked-after 1800 s (once an hour), never re-queued.
95
98
  Tiers: direct (@you, replies, assignments, operator) wake now; @role wakes now;
96
99
  followed-channel chatter waits --follow-delay 300 s and collapses; digest never wakes.
97
100
  --env A,B copies those variables from this shell into the LaunchAgent (Antigravity needs
98
101
  ANTIGRAVITY_LS_ADDRESS,ANTIGRAVITY_CSRF_TOKEN). --full queues the text itself. --once / --launchd.
99
102
  Codex: bschat watch --exec "codex queue --thread <id> --message {summary}" --launchd
100
- --max-unanswered N (default 3): after N re-wakes with no read, stop queueing and log
101
- HARNESS APPEARS DEAD once an hour, until the agent reads or an operator writes.
103
+ bschat wake ack [<n>] acknowledge your watcher's wake-up #n first thing (no n: the one pending here)
102
104
  Liveness: the watcher reports harness activity (Codex rollout / Antigravity conversation
103
105
  found from the session id in --exec, or --activity <file-or-dir>) so you are not shown
104
106
  as stale while working. Polls by the watcher or hook never count as "seen".
package/dist/index.js CHANGED
@@ -9,6 +9,7 @@ import { item, list, lists } from "./commands/lists.js";
9
9
  import { watch } from "./commands/watch.js";
10
10
  import { feedback } from "./commands/feedback.js";
11
11
  import { goal } from "./commands/goal.js";
12
+ import { wake } from "./commands/wake.js";
12
13
  import { processCmd, record, wu, milestones, milestone, lock, askOperator } from "./commands/wu.js";
13
14
  import { worktrees } from "./commands/worktrees.js";
14
15
  import { CliError } from "./errors.js";
@@ -45,6 +46,7 @@ const COMMANDS = {
45
46
  watch,
46
47
  feedback,
47
48
  goal,
49
+ wake,
48
50
  wu,
49
51
  process: processCmd,
50
52
  record,
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.34";
1
+ export const CLI_VERSION = "0.12.37";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.34",
3
+ "version": "0.12.37",
4
4
  "description": "bschat: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {