benignswarm 0.12.129 → 0.12.130

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/help.js CHANGED
@@ -7,6 +7,8 @@ Model: detected automatically (hook input, transcript, harness config); --model
7
7
  Provider: set BSCHAT_PROVIDER when the harness does not report it; unknown is never inferred from the harness
8
8
  Output: --json for machine-readable output; action results precede receipts for persisted caller text
9
9
  b9s and b9s-admin: a 2xx write with a receipt mismatch prints the returned object and warning, then exits 3; inspect it and do not retry
10
+ Options: options are command-scoped; an unsupported option is a usage error before command execution
11
+ project-scoped agents cannot override their project with --project
10
12
  Environment: BSCHAT_* names remain supported; matching B9S_* names are aliases when BSCHAT_* is unset
11
13
 
12
14
  Joining (first time on a machine, with an enrollment token from the account owner)
@@ -57,7 +59,8 @@ Agent commands
57
59
  b9s back clear your away status early
58
60
  b9s send <channel> <message...> [--reply-to <seq>] @name, @role:name, @role:* are resolved and validated
59
61
  b9s send <channel> --body-file <f|-> multi-line / markdown message from a file or stdin (use this for anything long)
60
- b9s read <channel> [--since <seq>] [--limit n] [--follow] | b9s read --pending
62
+ b9s read <channel> [--since <seq>] [--limit n] [--follow]
63
+ b9s read --pending
61
64
  b9s inbox [--unread] [--after <iso-time>] [--limit n] mentions/replies and open questions addressed to your assigner role
62
65
  b9s inbox handle <project>/<channel>/<seq> mark an addressed question handled outside its thread
63
66
  b9s follow <channel> | unfollow <channel> | following followed channels' new messages are injected by the hook;
@@ -69,10 +72,10 @@ Agent commands
69
72
  b9s rule supersede <rule-id> --text "..." [--expires-at <UTC>] [--conflicts-with id,id] --confirm-compatible
70
73
  b9s rule retire <rule-id> authorized assigner; project agent credentials restrict scope
71
74
  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] [--priority urgent|normal] [--force] [--evidence id[,id...]] [--target <branch>] [--here] [--json] open a work unit in its own
75
+ b9s wu open "<title>" --scope "..." [--summary "plain work summary"] [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--priority urgent|normal] [--milestone <key>] [--force] [--evidence id[,id...]] [--target <branch>] [--here] [--json] open a work unit in its own
73
76
  worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
74
77
  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] [--priority urgent|normal] [--force] [--replay-of n] [--template] [--reason "why"] [--json] hand out a unit (assigner roles);
78
+ b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--summary "plain work summary"] [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--reworks n,m] [--after <n>[,<m>]] [--requires cap,cap] [--priority urgent|normal] [--milestone <key>] [--branch <branch>] [--hold] [--evidence id[,id...]] [--force] [--replay-of n] [--template] [--reason "why"] [--json] hand out a unit (assigner roles);
76
79
  --to auto picks the active qualified worker with the lightest load; it queues when nobody fits,
77
80
  reports why candidates were passed over, and the sweep chases it;
78
81
  --to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
@@ -93,7 +96,7 @@ Agent commands
93
96
  b9s wu park <n> --note "why" assigner or operator: park open or sent-back work, keep its owner/branch and free its in-progress slot
94
97
  b9s wu unpark <n> assigner or operator: return parked work to open when its owner's slot is free
95
98
  b9s wu requeue <n> --note "why" assigner or operator: return an assigned, unstarted unit to the queue; history and branch stay
96
- b9s wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
99
+ b9s wu start <n> [--branch b | --here] [--context-action keep|compact|clear] [--context-confirmed] [--context-checkpoint-ref <id> --context-old-thread <id> --context-new-thread <id>] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
97
100
  target as of the original); a worktree left half-written by an interrupted
98
101
  checkout is removed and made again; wu open does the same for your own units;
99
102
  --branch continues existing work (never a SHA); always fetches and branches from origin/<target>; --here uses this checkout
@@ -118,7 +121,7 @@ Agent commands
118
121
  no exit and no dependencies makes a container for ongoing work; milestone edit (or set) <key> amends;
119
122
  --priority <n|none> (higher first): the steward asks for units only on the top ready slices
120
123
  b9s milestone show <key> exit criterion, dependencies, counts; wu milestone <n> <key|none> moves a unit
121
- b9s milestone decide <key> "ruling" --unit <n> record a one-line lead decision for a unit on this slice
124
+ b9s milestone decide <key> "ruling" --unit <n> [--decision <text>] record a one-line lead decision for a unit on this slice
122
125
  b9s milestone close <key> --note ".." [--evidence a,b] [--abandon | --defer] [--waive-informs ".."] the lead closes a slice against its exit criterion
123
126
  (done/defer refused while it has units not done); milestone reopen <key> undoes it
124
127
  b9s milestone verdict <key> --met --note ".." [--evidence a,b] | --gaps ".." [--units n,m] [--waive-informs ".."] the closure reviewer judges the exit against the evidence; gap units re-trigger the review when they close
@@ -128,7 +131,7 @@ Agent commands
128
131
  acquisition queues through a machine maintenance drain/window and resumes after it
129
132
  machine identity is this host's hostname plus its registered label, shared by all agents here
130
133
  save the returned job token; reuse --token to check/retry the same job
131
- b9s lock run <name> [--unit n] [--note ..] [--shared] -- <command> poll until granted, run the command, then release; exits with its code
134
+ b9s lock run <name> [--unit n] [--note ..] [--shared] [--token <job-token>] -- <command> poll until granted, run the command, then release; exits with its code
132
135
  polls every 15s; stale waiters are skipped after 60s with a process notice; later polls reap unreported holders idle 60s
133
136
  b9s locks shows waiter poll age; reported-command holders do not expire
134
137
  b9s unlock <name> [--job <id> | --token <job-token>] [--machine <label>|--shared] | b9s locks shows lock-run waiters' last-poll age; on this host the job token is kept for you
@@ -153,14 +156,14 @@ Machine placement enforces configured session slots and reports machine pressure
153
156
  ../<repo>-review-wu<n> detached at the submitted head (refused if origin differs)
154
157
  b9s wu approve <n> --note ".." [--confirm-causes cause,cause] approval covers tags your role reviews (escalated or away-takeover reviewers cover only their handed-over tags); complete approval confirms classified send-back causes in timeline order
155
158
  a planned reviewer still owing may approve after coverage; status stays approved until merge
156
- b9s wu changes <n> --unmet ".." --cause <cause> --note ".." send back with a cited clause and cause (scope_gap, missing_context, worker_error, reviewer_scope_growth, environment, stale_base); a planned reviewer still owing may send an approved, unmerged unit back
159
+ b9s wu changes <n> --unmet ".." --cause <cause> --note ".." [--summary "..." | --plain-summary "..."] send back with a cited clause, cause and stored explanation (scope_gap, missing_context, worker_error, reviewer_scope_growth, environment, stale_base)
157
160
  concerns outside those are notes (wu note) or questions (wu ask)
158
161
  b9s wu classify <n> --tags a,b classifier: confirm or change a new unit's tags before it routes for review
159
162
  b9s wu proceed <n> --note ".." reviewer: this step is good, carry on; back to the owner, NOT an approval
160
163
  b9s wu reopen <n> --note ".." owner or reviewer: withdraw an unmerged approval (verification failed); resubmit the same unit
161
164
  b9s wu supersede <n> --by <m> owner or assigner: this unit continues as #m; anyone blocked on #n now waits on #m
162
- b9s wu ask <n> "question" owner, reviewer or assigner: a decision this unit cannot move without, including queued units (tag expert first, then the operator)
163
- b9s wu rule <n> "decision" | --approve the tag's expert: answer an open question, or approve its proposal as written (operator questions are answered in the console); --send-back-event <id> --cause <cause> records an explicit retrospective ruling
165
+ b9s wu ask <n> "question" [--question <text>] owner, reviewer or assigner: a decision this unit cannot move without, including queued units (tag expert first, then the operator)
166
+ b9s wu rule <n> "decision" [--ruling <text>|--note <text>] [--send-back-event <id> --cause <cause>] | --approve the tag's expert: answer an open question, or approve its proposal as written (operator questions are answered in the console); the event and cause record an explicit retrospective ruling
164
167
  b9s wu note <n> --note ".." [--annotation '<JSON object>'] add a note; assigner annotation links a cited scope finding to a cause and one-line reason
165
168
  b9s wu propose <n> "answer" owner, reviewer, assigner or expert: recommend an answer to the unit's open question, approvable as written
166
169
  b9s wu escalate <n> [--note ..] the tag's expert: pass the question to the operator
@@ -168,11 +171,12 @@ Machine placement enforces configured session slots and reports machine pressure
168
171
  owner, assigner or operator: wait for any non-closed unit; released when it closes
169
172
  b9s wu wait <n> --on "evidence|unit #m|ask id|machine name|text blocker" --note "why" [--partial "verdict"] | --clear
170
173
  owner or reviewer: pause review on a named blocker; reviewer may record a partial verdict
171
- b9s wu scope <n> --scope ".." | --scope-file <path> | --scope-from <n> --note ".." assigner or operator: replace the full scope; recorded and announced
174
+ b9s wu scope <n> --scope ".." | --scope-file <path> | --scope-from <n> --note ".." [--summary "..." | --plain-summary "..."] assigner or operator: replace the full scope; recorded and announced
172
175
  b9s wu scope <n> --replace "<old>" "<new>" --note ".." replace one exact, unique substring of the scope
173
176
  b9s wu scope <n> --append ".." --note ".." add a dated scope amendment (up to 2000 chars); the base scope stays capped at 4000
174
- b9s ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."] [--milestone <key> | --unit <n>]
175
- b9s ask-operator --amend <id> ["new question"] [--plain ".."] [--blocks ".."] [--if-yes ".."] [--if-no ".."] [--propose ".."] amend your own open ask
177
+ b9s wu target <n> <branch|default> [--summary "reviewed work summary"] owner, assigner or operator: change where this unit lands
178
+ b9s ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."] [--milestone <key> | --unit <n>] [--question <text>]
179
+ b9s ask-operator --amend <id> ["new question"] [--plain ".."] [--blocks ".."] [--if-yes ".."] [--if-no ".."] [--propose ".."] [--question <text>] amend your own open ask
176
180
  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
177
181
  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.
178
182
  a decision only the operator can make, on their console banner and reported to them; never
@@ -192,6 +196,7 @@ Machine placement enforces configured session slots and reports machine pressure
192
196
  b9s wu recovery save <n> --reason "..." save a WIP branch commit and encrypted cutoff bundle; keep the source volume until safe_to_delete
193
197
  b9s wu recovery restore <n> next owner: verify and restore the restricted recovery bundle into the unit worktree
194
198
  b9s wu abandon <n> [--note ..] wu list [--all] [--json] for state and timeline (JSON keeps complete titles)
199
+ b9s wu list [--all] [--status s] [--tag t] [--agent name] list visible work units; --all includes closed units
195
200
  b9s worktrees prune [--yes] [--archive] remove clean, fully pushed worktrees whose work landed or whose unit is closed (dry run without --yes);
196
201
  --archive also saves a closed unit's uncommitted files to archive/wu<n>-leftovers and removes it
197
202
  b9s worktrees [scan] the project's worktree registry (machine, path, branch, dirty, merged, who);
@@ -200,7 +205,7 @@ Machine placement enforces configured session slots and reports machine pressure
200
205
  report your harness's /goal so the board shows what you are held to (Codex app
201
206
  threads and DeepSeek keep it where no file shows it; Claude Code's hook reads it itself)
202
207
  b9s hook claude-code [--event E] harness hook: prints new inbox items as hook JSON (installed by join)
203
- b9s watch --exec "<cmd>" [--interval 30] event bridge: queue ONE numbered wake-up when something new arrives, then
208
+ b9s watch --exec "<cmd>" [--interval seconds] [--unacked-after seconds] [--follow-delay seconds] [--startup-jitter-seconds 0..60] [--once] [--full] [--env A,B] [--activity path] [--prune] [--turn] [--harness codex|claude-code|dsh|antigravity] [--session id] [--machine-session-id uuid] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60] [--turn-coalesce-seconds 0..3600] [--turn-claude-runtime JSON] [--service|--launchd] event bridge: queue ONE numbered wake-up when something new arrives, then
204
209
  nothing more, for any reason, until the agent runs b9s wake ack <n>. An
205
210
  unacknowledged wake-up is logged after --unacked-after 1800 s (once an hour), never re-queued.
206
211
  Tiers: direct (@you, replies, assignments, operator) wake now; @role wakes now;
@@ -211,6 +216,7 @@ Machine placement enforces configured session slots and reports machine pressure
211
216
  Set BSCHAT_WATCH_DEBUG=1 for per-poll item counts, tier and wake decisions.
212
217
  --service (launchd on macOS, systemd on Linux; --launchd is the same). --turn runs each turn
213
218
  itself (--harness codex|claude-code|dsh|antigravity --session <id> [--machine-session-id uuid]); without activated judgment capture,
219
+ --turn-claude-runtime is internal Claude Code runtime settings used by b9s start to rebuild workspace-write permissions for each turn's cwd.
214
220
  3 consecutive turns without an agent-key call fault it and six unproductive turns in a rolling hour also fault.
215
221
  With judgment capture activated, these become triggers and the watcher pauses before the next turn;
216
222
  hard-budget caps still reserve each launch independently. Capture defaults off; hard caps alone do not activate it.
@@ -221,11 +227,11 @@ Machine placement enforces configured session slots and reports machine pressure
221
227
  bypass the window when the API exposes that marker. An operator or assigner can resume a latched
222
228
  fault with b9s-admin machine session resume.
223
229
  Codex: b9s watch --exec "codex queue --thread <id> --message {summary}" --service
224
- b9s update the same as install --latest: upgrade this machine's b9s, repair PATH aliases,
230
+ b9s update [--no-restart] the same as install --latest: upgrade this machine's b9s, repair PATH aliases,
225
231
  restart services on that install without waiting on one stop, and report failures
226
- b9s install [<version> | --latest] make or upgrade this machine's one b9s (join does it once), repair PATH aliases,
232
+ b9s install [<version> | --latest] [--no-restart] make or upgrade this machine's one b9s (join does it once), repair PATH aliases,
227
233
  restart services resolving to it; other installs are left alone and named
228
- b9s sandbox probe [--checkout <dir>] [--api <host>] [--out <file>]
234
+ b9s sandbox probe [--checkout <dir>] [--api <host>] [--out <file>] [--nonce <id>]
229
235
  what the sandbox this runs in really allows: where commands run, which tools
230
236
  are there, what git can do, which hosts answer, what is writable; facts only
231
237
  b9s sandbox check <file> --harness <h> --sandbox <mode>
@@ -236,7 +242,8 @@ Machine placement enforces configured session slots and reports machine pressure
236
242
  b9s environment report --project <p> | --machine <m> --title <text> --category <name> --component <name> --description <what failed> [--normalized-key <key>] [--evidence <id,...>] [--units <id,...>]
237
243
  submit a bounded observation; evidence is account-scoped, and agents may link only their own units
238
244
  b9s codex hooks | bind <thread-id> | sync install b9s's Codex hooks (~/.codex/hooks.json) and say which thread is you
239
- b9s start --harness codex|claude-code|dsh|antigravity --as <project>/<name> --sandbox <mode> [--provider anthropic|deepseek] [--token t] [--thread id] [--model m] [--effort e] [--writable-root path]... [--max-budget-usd n] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60] [--turn-coalesce-seconds 0..3600] [--startup-jitter-seconds 0..60] [--machine-session-id uuid] [--dsh path] [--agy path]
245
+ b9s codex start [--in-container] [--writable <path,...>] [--prune] Codex start options in addition to b9s start's session options
246
+ b9s start --harness codex|claude-code|dsh|antigravity --as <project>/<name> --sandbox <mode> [--provider anthropic|deepseek] [--token t] [--thread id] [--model m] [--effort e] [--writable-root path]... [--max-budget-usd n] [--turn-timeout min] [--interval seconds] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60] [--turn-coalesce-seconds 0..3600] [--startup-jitter-seconds 0..60] [--machine-session-id uuid] [--dsh path] [--agy path] [--in-container]
240
247
  run an agent headless: enroll, start or adopt its session, turn-mode watcher
241
248
  --machine-session-id is normally supplied by b9s-admin for a managed machine session
242
249
  Persistent watcher startup waits a random logged 0..60 s by default; set --startup-jitter-seconds 0 to disable it for a deterministic start.
@@ -254,11 +261,17 @@ Machine placement enforces configured session slots and reports machine pressure
254
261
  b9s unpause [--as <a>] lift a usage-limit pause now (the harness was switched to an account with quota)
255
262
  b9s turn note "<short progress summary>" [--as <a>] save a 300-character turn-end excerpt for an enabled managed session; it is labelled unverified
256
263
  b9s turn state [--session <id>] this session's turn policy, any judge pause/stop/continuation and the next action (never another session's packet)
257
- b9s machine bootstrap --url <api> [--retrieve-ec2 | --token-file <path> | --token <bs_boot_...>] [--name <m>] retrieve (over TLS+IMDSv2/STS) and exchange a single-use cloud bootstrap token once, scrub it, and write mode-0600 credentials
258
- b9s machine run [--interval seconds] | once | build-images | status | prepare [--agy-userns] [--print-apparmor] | service
259
- default interval 30s, 1..3600; prepare checks harnesses; --agy-userns opts into an AppArmor
264
+ b9s machine bootstrap --url <api> [--retrieve-ec2 | --token-file <path> | --token <bs_boot_...>] [--name <m>] [--machine-id <id>] retrieve (over TLS+IMDSv2/STS) and exchange a single-use cloud bootstrap token once, scrub it, and write mode-0600 credentials
265
+ b9s machine run [--interval seconds] run the machine daemon; default interval 30s, 1..3600
266
+ b9s machine once run one daemon cycle
267
+ b9s machine build-images run pending image builds
268
+ b9s machine status show daemon state
269
+ b9s machine prepare [--codex-userns] [--bwrap-userns] [--agy-userns] [--print-hooks] [--print-apparmor] check machine readiness and required sandbox profiles
270
+ --agy-userns opts into an AppArmor
260
271
  profile for the resolved agy binary if Ubuntu blocks its workspace-write terminal sandbox (passwordless sudo)
261
272
  Antigravity workspace-write readiness makes an authenticated b9s me call inside the sandbox
273
+ Antigravity workspace-write readiness makes an authenticated b9s me call inside the sandbox
274
+ b9s machine service install or control the machine daemon service
262
275
  b9s machine processes --worktree <path> [--as <project>/<agent>] [--json] read-only host process sample for a project-owned worktree
263
276
  includes pid/parent, start/elapsed, command (120 chars), cwd, TCP listeners and sample time
264
277
  project agents only; stale samples are labelled; command credentials are redacted; no environment values or signaling
@@ -292,12 +305,16 @@ Machine placement enforces configured session slots and reports machine pressure
292
305
  b9s handoffs [--open] [--agent a] notes left by retired agents (open = not yet picked up)
293
306
  b9s handoffs show <id> | pickup <id>
294
307
  b9s lists [--account] shared lists (open/total, your unread count)
295
- b9s list create <name> [--description d] [--parent <list>] [--parent-item <id>] [--bind-here] [--agent a] [--channel c]
308
+ b9s list create <name> [--description d] [--parent <list>] [--parent-item <id>] [--bind-here] [--agent a] [--channel c] [--statuses open,done:closed]
296
309
  b9s list show <name|id> [--peek] items, sub-lists, who has viewed; marks viewed unless --peek
297
310
  b9s list add <list> <title...> [--body b | --body-file f] [--status s] [--assign @x|@role:y] [--evidence ids]
298
311
  b9s list edit <list> [--description d] [--name n] [--statuses open,in_progress,done:closed]
299
312
  b9s list rm <list> --yes
300
- b9s item show|set|done|view|rm <id> item set: --status s [--if-status prev] --title --body --assign --evidence
313
+ b9s item show <id>
314
+ b9s item set <id> [--status s] [--if-status prev] [--title t] [--body b | --body-file f] [--assign @x] [--evidence ids]
315
+ b9s item done <id> [--status s] [--if-status prev] [--title t] [--body b | --body-file f] [--assign @x] [--evidence ids]
316
+ b9s item view <id>
317
+ b9s item rm <id> --yes
301
318
  b9s feedback "<text>" [--category bug|friction|idea|docs] [--command "<what you ran>"] [--body-file f|-]
302
319
  tell BenignSwarm's maintainers what got in your way or what would help
303
320
  b9s feedback get <id> read your feedback for 24 hours after sending
@@ -314,6 +331,8 @@ tool should run b9s-admin --agent first, then install the operator skill. Sign i
314
331
  b9s-admin login (approve it in your signed-in browser); the session lasts 30 days, like the console's.
315
332
  Successful writes verify stored-text receipts. If a 2xx write receipt mismatches, b9s-admin prints
316
333
  the returned object and warning, then exits 3. Inspect the object and do not retry that write.
334
+ Options are command-scoped; unsupported options are usage errors before command execution.
335
+ Use --admin <nickname> to select one of this machine's saved operator identities.
317
336
 
318
337
  b9s-admin login [--as <nickname>] [--url <api>]
319
338
  prints a link and a code and opens it: approve it in a browser already signed in to BenignSwarm
@@ -327,15 +346,27 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
327
346
  b9s-admin project create|list|delete <name>
328
347
  b9s-admin github status | disconnect <installation-id>
329
348
  b9s-admin project github <project> status | unlink
330
- b9s-admin project hosted-merge <project> enable|disable [--confirm-bypass-signal]
349
+ b9s-admin project hosted-merge <project> enable [--confirm-bypass-signal]
350
+ b9s-admin project hosted-merge <project> disable
331
351
  enable only after exact ruleset verification in console and live bypass-change signal check; controls are also in console WU #196
332
- b9s-admin project secrets <project> list | show <name> | create <name> --purpose <text> --storage-mode hosted|aws_secrets_manager --units 1,2 --tags api --hosts host[,host] [--arn <exact ARN> --version-id <id>] | update <name> [--purpose <text>] [--units 1,2] [--tags api] [--hosts host[,host]] | rotate <name> --arn <exact ARN> --version-id <id> | revoke <name> | delete <name> | set <name> [--stdin]
352
+ b9s-admin project secrets <project> list
353
+ b9s-admin project secrets <project> show <name>
354
+ b9s-admin project secrets <project> create <name> --purpose <text> --storage-mode hosted|aws_secrets_manager --units 1,2 --tags api --hosts host[,host] [--arn <exact ARN> --version-id <id>]
355
+ b9s-admin project secrets <project> update <name> [--purpose <text>] [--units 1,2] [--tags api] [--hosts host[,host]]
356
+ b9s-admin project secrets <project> rotate <name> --arn <exact ARN> --version-id <id>
357
+ b9s-admin project secrets <project> revoke <name>
358
+ b9s-admin project secrets <project> delete <name>
359
+ b9s-admin project secrets <project> set <name> [--stdin]
333
360
  purpose is trimmed before send (1–200 characters); values remain unavailable until encrypted storage lands in WU #231; set checks before reading input; console control is WU #230
334
- b9s-admin project environment show <project> | setup <project> [--catalog family@version] [--assessment-only] [--context text] | set <project> --file declaration.json --source-commit <merged-sha>
361
+ b9s-admin project environment show <project>
362
+ b9s-admin project environment setup <project> [--catalog family@version] [--assessment-only] [--context text]
363
+ b9s-admin project environment set <project> --file declaration.json --source-commit <merged-sha>
335
364
  setup queues one reviewed work unit; set records its merged declaration; catalog versions are x.y.z
336
- b9s-admin environment settings show | settings set [--stage disabled|report_only|staged|enabled] [--projects a,b] [--machines m1,m2] [--resolved-retention-days n] [--wont-fix-retention-days n] [--alerts on|off] [--alert-cooldown-minutes n]
365
+ b9s-admin environment settings show
366
+ b9s-admin environment settings set [--stage disabled|report_only|staged|enabled] [--projects a,b] [--machines m1,m2] [--resolved-retention-days n] [--wont-fix-retention-days n] [--alerts on|off] [--alert-cooldown-minutes n]
337
367
  staged rollout, closed-issue retention, and operator alert settings (also in Account -> Environment)
338
- b9s-admin environment retention run --dry-run | alerts [list|evaluate]
368
+ b9s-admin environment retention run --dry-run
369
+ b9s-admin environment retention alerts [list|evaluate]
339
370
  inspect closed-issue candidates; deletion requires a reviewed batch in Account -> Environment
340
371
  b9s-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
341
372
  b9s-admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
@@ -374,23 +405,31 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
374
405
  b9s-admin role delete <name> [--project p]
375
406
  b9s-admin channel create|delete <project> <name>
376
407
  b9s-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
377
- b9s-admin process show|export <project> [--out f] the process as agents are told it, or as an editable file
408
+ b9s-admin process show <project> the process as agents are told it
409
+ b9s-admin process export <project> [--out f] the process as an editable file
378
410
  b9s-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules, and tag focus)
379
411
  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]
380
412
  legacy project-first order also accepted; for operation-first with a project named add, edit, or remove:
381
413
  b9s-admin process tag <op> <tag> --project <project>
382
414
  b9s-admin process timing <project> [--sla m] [--takeover m] [--max-open n] [--max-in-progress n] [--require-scope yes|no] [--require-evidence yes|no] [--require-cited-changes yes|no] [--default-approver r|none]
383
415
  b9s-admin process merge <project> [--target b] [--merged-by owner|approver|integrator] [--integrator-role r] [--require-rebased|--require-merge-commit|--require-pushed yes|no] [--gate-command "<one command>"|none]
384
- b9s-admin process assigners <project> role1,role2 | agreements <project> --file agreements.md
416
+ b9s-admin process assigners <project> role1,role2
417
+ b9s-admin process agreements <project> --file agreements.md
385
418
  b9s-admin process charter <project> --file charter.md how the project weighs trade-offs; sent with every expert question
386
419
  b9s-admin process steward <project> on|off [--quiet m] [--summary m] [--churn n] (--churn: ask the operator when a goal is sent back or handed over n times; 0 off)
387
420
  b9s-admin rule list <project> | show <project> <rule-id>
388
421
  b9s-admin rule add <project> --scope account|project|role:<name>|agent:<name> --text "..." [--expires-at <UTC>] [--conflicts-with id,id] [--source-channel-id <id> --source-message-id <id>] --confirm-compatible
389
422
  b9s-admin rule supersede <project> <rule-id> --text "..." [--expires-at <UTC>] [--conflicts-with id,id] --confirm-compatible | retire <project> <rule-id>
390
423
  rules are audited revisions; review charter and agreements first. Console promotion is the primary management surface.
391
- b9s-admin milestones <project> [export [--out plan.json] | set --file plan.json] the plan's slices: list, the editable JSON, or replace it (keys keep their status)
424
+ b9s-admin milestones <project> the plan's slices: list
425
+ b9s-admin milestones <project> export [--out plan.json] the editable JSON
426
+ b9s-admin milestones <project> set --file plan.json replace it (keys keep their status)
392
427
  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
393
- 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
428
+ b9s-admin milestone <project> show|review|reopen <key>
429
+ b9s-admin milestone <project> decide <key> "ruling" --unit n
430
+ b9s-admin milestone <project> close <key> --note .. [--abandon|--defer]
431
+ b9s-admin milestone <project> verdict <key> --met|--gaps ..
432
+ b9s-admin milestone <project> gap-units <key> --units n,m
394
433
  b9s-admin flow [--project <p>] [--from <UTC date/time>] [--to <UTC date/time>] [--json]
395
434
  read-only state counts, waits, qualified worker/reviewer capacity, critical paths, attention, trends, freshness and coverage
396
435
  b9s-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
@@ -405,6 +444,7 @@ the returned object and warning, then exits 3. Inspect the object and do not ret
405
444
  b9s-admin notifier [--agent name|none] [--email yes|no] [--repeat m] [--flow-summary yes|no] [--flow-min-age m] [--flow-min-impact n] how you are reached away from the console, and the last report
406
445
  b9s-admin account [--summary-minutes m] plan, usage and the account summary period
407
446
  assistant stays opt-in: PATCH /account {"assistant_enabled":true|false}; GET /account/usage shows used, allowance, uncertain calls and reset date
447
+ b9s-admin account-stores migrations show|run [--json] inspect or resume the per-account SQLite schema migration runner (platform admin only)
408
448
  session/admin clients use GET /assistant/conversations/:id/messages for paged history and GET/POST/DELETE /assistant/conversations; POST messages streams data and saves tool notices with assistant messages; old assistant messages have notices_available=false; operator must explicitly apply or discard (see operator skill)
409
449
  POST /assistant/proposals/:id/apply|discard applies or discards the operator-reviewed draft (see operator skill)
410
450
  b9s-admin worktree forget <project> <id> delete a stale worktree record (never the directory)
@@ -420,15 +460,18 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
420
460
  Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
421
461
  for /usr/bin/bwrap (Claude Code's sandbox; broader: any local user may use it); --agy-userns:
422
462
  install a profile only for the resolved ~/.local/bin/agy (Antigravity terminal sandbox)
423
- b9s-admin machine list | show <name> | remove <name> [--preview] [--confirm <name> --impact-revision <revision>]
463
+ b9s-admin machine list
464
+ b9s-admin machine show <name>
465
+ b9s-admin machine remove <name> [--preview] [--confirm <name> --impact-revision <revision>]
424
466
  show includes host readiness, configured disk floors and named readiness refusals; removal previews sessions, work, keys, recovery blockers and replanned slots
425
467
  the API requires a fresh revision for removal
426
468
  b9s-admin machine companion run <handoff-code> [--confirm <name>] accept a 15-minute, single-use handoff from Account > Machines; confirms locally and reports progress
427
469
  b9s-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
428
470
  15 min before, its agents away until the machine reports back after booting
429
- b9s-admin machine resize <name> --type <t> [--instance-id <id>] [--drain-timeout 5m] [--yes] [--on-running-turn wait|proceed|abort] [--extend 5m] [--ssh <host>]
471
+ b9s-admin machine resize <name> --type <t> [--instance-id <id>] [--drain-timeout 5m] [--yes] [--on-running-turn wait|proceed|abort] [--extend 5m] [--ssh <host>] [--poll-ms <ms>] [--no-wait-verify] [--ssh-config <path>]
430
472
  preflight (AZ offering, arch, ENA/NVMe + root UUID/PARTUUID, quota, hourly/daily cap delta), drain with deadline, stop/modify/start via AWS role, verify cores/RAM + resumed session threads, update BYO SSH config without opening SSH, and audit every step
431
- b9s-admin machine quarantine <name> --reason <text> [--evidence <json>] | unquarantine <name> [--reason <text>]
473
+ b9s-admin machine quarantine <name> --reason <text> [--evidence <json>]
474
+ b9s-admin machine unquarantine <name> [--reason <text>]
432
475
  exclude a host from scheduler/pool placement and preserve containment across scale-down; only unquarantine clears it
433
476
  b9s-admin machine session add <machine> <project>/<agent> --dir <checkout> --sandbox <read-only|workspace-write|danger-full-access> [--harness codex|claude-code|dsh|antigravity] [--provider anthropic|deepseek]
434
477
  [--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60] [--turn-coalesce-seconds 0..3600]
@@ -451,22 +494,32 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
451
494
  b9s-admin machine cache-budget <name> [<GB> | default] [--floor <pct | default>] per-cache budget (default 40 GB) and volume free-space floor (default 15%)
452
495
  b9s-admin machine caches <name> <path...> | none [--tool auto|cargo|generic] [--processes cmd,...] declared build-cache directories managed by the daemon
453
496
  b9s-admin machine readiness <name> [--project <p>] git identity, nested sandbox, IMDS block, harness logins/secrets, and image probe readiness (console in WU #379; image build/pins in WU #377)
454
- b9s-admin machine login <name> --harness codex|claude-code|antigravity [--provider default|openai|anthropic|deepseek] | status <name> | cancel <name> <id> one-time device-code login handled via /account/needs (console in WU #379)
497
+ b9s-admin machine login <name> --harness codex|claude-code|antigravity [--provider default|openai|anthropic|deepseek] one-time device-code login handled via /account/needs (console in WU #379)
498
+ b9s-admin machine status <name>
499
+ b9s-admin machine cancel <name> <id>
455
500
 
456
501
  BYO AWS cloud machines (the connection is account-scoped; AWS bills the account directly; console controls in WU #200)
457
502
  b9s-admin cloud connect --file connection.json connect an IAM role, show its external ID once, and print the reviewed trust/permissions policies
458
503
  b9s-admin cloud show | policy | test | disconnect
459
504
  b9s-admin cloud bootstrap-script [--recipe-version v] [--node-version v] [--node-sha256 hex] [--b9s-version v] [--base-image ref] render the pinned secret-free cloud-init recipe
460
- b9s-admin cloud secret set --harness <h> --arn <arn> [--provider p] [--project p] [--region r] [--name n] | list [--project p] | remove <id> store AWS Secrets Manager ARN refs for JIT host delivery (never secrets)
461
- b9s-admin cloud launch --machine <id> --idempotency-key <key> [--project <p>] [--recipe-version v] [--node-version v] [--node-sha256 hex] [--b9s-version v] [--base-image ref] request one capped instance and mint one single-use bootstrap token once
462
- b9s-admin cloud operations | inspect <operation-id> | terminate <operation-id> --reason <why> terminate refuses unless signed ownership proof and immutable tags verify
463
- b9s-admin cloud capacity | regions set <r[,r...]> --reason <why> | regions clear [--reason <why>] | hosted-provisioning enable|disable --reason <why> | spend-signal <0..200|clear> [--source aws_budget|cost_explorer|billing_alarm|operator] [--detail <text>]
505
+ b9s-admin cloud secret set --harness <h> --arn <arn> [--provider p] [--project p] [--region r] [--name n]
506
+ b9s-admin cloud secret list [--project p]
507
+ b9s-admin cloud secret remove <id> store AWS Secrets Manager ARN refs for JIT host delivery (never secrets)
508
+ b9s-admin cloud launch --machine <id> --idempotency-key <key> [--project <p>] [--machine-name <name>] [--recipe-version v] [--node-version v] [--node-sha256 hex] [--b9s-version v] [--base-image ref] request one capped instance and mint one single-use bootstrap token once
509
+ b9s-admin cloud operations
510
+ b9s-admin cloud inspect <operation-id>
511
+ b9s-admin cloud terminate <operation-id> --reason <why> terminate refuses unless signed ownership proof and immutable tags verify
512
+ b9s-admin cloud capacity
513
+ b9s-admin cloud regions set <r[,r...]> --reason <why>
514
+ b9s-admin cloud regions clear [--reason <why>]
515
+ b9s-admin cloud hosted-provisioning enable|disable --reason <why>
516
+ b9s-admin cloud spend-signal <0..200|clear> [--source aws_budget|cost_explorer|billing_alarm|operator] [--detail <text>]
464
517
  inspect effective BYO limits/spend/active builds, manage approved regions, toggle hosted kill switch, and record budget/cost signals
465
518
  Cloud audit history and recovery-hold resolution are available in the signed-in operator console (WU #200, WU #309); the account provisioning switch blocks launches while allowing safe drain and termination.
466
519
 
467
520
  Project devcontainer images & immutable registry builds (console controls in WU #377)
468
521
  b9s-admin project image validate --file <.devcontainer/devcontainer.json> [--dockerfile Dockerfile] [--arch linux/amd64|linux/arm64] validate @sha256 pins and reject secrets/host mounts/--privileged
469
- b9s-admin project image config <project> [--path <path>] [--arch linux/amd64|linux/arm64] [--cache name,...] [--pool-sessions on|off] [--registry <ns>] configure immutable per-account image registry, project-scoped writable cache mounts, and SSH-machine container pool opt-in
522
+ b9s-admin project image config <project> [--path <path>] [--arch linux/amd64|linux/arm64] [--cache name,...|--caches name,...] [--pool-sessions on|off] [--registry <ns>] configure immutable per-account image registry, project-scoped writable cache mounts, and SSH-machine container pool opt-in
470
523
  b9s-admin project image show <project> active digest, rollback target, latest build, and image capability probes
471
524
  b9s-admin project image build <project> --commit <sha> --file <.devcontainer/devcontainer.json> [--dockerfile Dockerfile] [--arch <arch>] build only the reviewed declaration commit; machine validation runs its image probes and project test before ready
472
525
  b9s-admin project image activate <project> <sha256:...> explicitly select a ready candidate for future or restarted sessions
@@ -481,11 +534,14 @@ Pools (fixed or adaptive; the server names the agents and places them on machine
481
534
  slots are agents named <name>-<tag>-<n>; fewer retires the extra ones
482
535
  [--quota-substitution | --no-quota-substitution] allows another eligible variant after authoritative quota exhaustion
483
536
  pool writes first show a server impact preview; confirm a fresh revision with --impact-revision <revision>
484
- b9s-admin pool list [project] | show <project>/<name> | events <project>/<name> [--limit 1..100]
537
+ b9s-admin pool list [project]
538
+ b9s-admin pool show <project>/<name>
539
+ b9s-admin pool events <project>/<name> [--limit 1..100]
485
540
  Console: Pools → pool details → Adaptive history and overrides.
486
541
  Console → Pools shows seat/agent counts, placement, slot work/session state, machine headroom, and previewed slot suspend/restore (with /account recovery on 402 plan_limit)
487
542
  b9s-admin pool pause|resume <project>/<name> [--reason <text>] pause only automatic scaling; sessions keep running
488
- b9s-admin pool pin <project>/<name> <slot> --machine <name> [--until <ISO>] [--reason <text>] | unpin <project>/<name> <slot>
543
+ b9s-admin pool pin <project>/<name> <slot> --machine <name> [--until <ISO>] [--reason <text>]
544
+ b9s-admin pool unpin <project>/<name> <slot>
489
545
  b9s-admin pool suspend|restore <project>/<name> <slot> [--reason <text>] [--note <text>] suspended agents stay benched until restored; no replacement is created
490
546
  b9s-admin pool remove <project>/<name> retires its agents; their units go back to the queue
491
547
  Console → Pools (WU #185) creates, edits, and retires pools with server impact previews and revision confirmation; repository and checkout defaults save separately and immediately.
package/dist/index.js CHANGED
@@ -34,8 +34,11 @@ import { commandWarnings } from "./commands/hook.js";
34
34
  import { loadAgent, resolveAgentName } from "./config.js";
35
35
  import { agentNotice } from "./commands/notices.js";
36
36
  import { versionLine, warnLegacyAlias } from "./legacy-alias.js";
37
+ import { validateCommandFlags } from "./command-flags.js";
37
38
  import { gitCredentialMain } from "./commands/git-credential.js";
38
39
  import { templates } from "./commands/templates.js";
40
+ import { realpathSync } from "node:fs";
41
+ import { fileURLToPath } from "node:url";
39
42
  import { standingRuleCommand } from "./commands/standing-rules.js";
40
43
  import { testResults } from "./commands/test-results.js";
41
44
  import { environment } from "./commands/environment.js";
@@ -125,10 +128,11 @@ const NOTICE_PREFLIGHT_EXEMPT_COMMANDS = new Set([
125
128
  "join", "setup", "login", "logout", "identities", "skill", "hook", "machine", "install", "doctor", "sandbox", "update", "version", "admin", "start", "git-credential", "templates",
126
129
  ]);
127
130
  let invokedCommand;
128
- async function main(argv) {
131
+ export async function main(argv) {
129
132
  warnLegacyAlias();
130
133
  applyEnvAliases();
131
134
  const p = parse(argv);
135
+ validateCommandFlags(p, HELP, argv);
132
136
  const out = makeOut(bool(p.flags, "json"));
133
137
  if (bool(p.flags, "version")) {
134
138
  process.stdout.write(`${versionLine(CLI_VERSION, false)}\n`);
@@ -143,6 +147,12 @@ async function main(argv) {
143
147
  const fn = COMMANDS[cmd];
144
148
  if (!fn)
145
149
  throw new CliError("usage", `unknown command ${cmd}`, "Run: b9s --help");
150
+ const selectedProject = str(p.flags, "project");
151
+ if (selectedProject) {
152
+ const agentName = resolveAgentName(str(p.flags, "as"));
153
+ const credentials = loadAgent(agentName);
154
+ await a.assertProjectUsable(credentials, selectedProject);
155
+ }
146
156
  warnIfForeignCopy(cmd, CLI_VERSION);
147
157
  const codexSubcommand = cmd === "codex" ? p.positionals[1] : undefined;
148
158
  const antigravitySubcommand = cmd === "antigravity" ? p.positionals[1] : undefined;
@@ -165,11 +175,13 @@ async function main(argv) {
165
175
  }
166
176
  return runCommandSafely(() => fn(p, out), out);
167
177
  }
168
- main(process.argv.slice(2)).then((code) => { process.exitCode = code; }, (err) => {
169
- const isWatcherDirectoryConflict = err instanceof CliError && err.code === "directory_conflict" && invokedCommand === "watch";
170
- const e = err instanceof CliError
171
- ? { error: err.code, message: err.message, hint: err.hint, ...(isWatcherDirectoryConflict ? { watcher_exit: true } : {}) }
172
- : { error: "internal", message: err instanceof Error ? err.stack ?? err.message : String(err) };
173
- process.exitCode = isWatcherDirectoryConflict ? DIRECTORY_CONFLICT_EXIT_CODE : 1;
174
- process.stderr.write(JSON.stringify(e) + "\n");
175
- });
178
+ if (process.argv[1] && realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url))) {
179
+ main(process.argv.slice(2)).then((code) => { process.exitCode = code; }, (err) => {
180
+ const isWatcherDirectoryConflict = err instanceof CliError && err.code === "directory_conflict" && invokedCommand === "watch";
181
+ const e = err instanceof CliError
182
+ ? { error: err.code, message: err.message, hint: err.hint, ...(isWatcherDirectoryConflict ? { watcher_exit: true } : {}) }
183
+ : { error: "internal", message: err instanceof Error ? err.stack ?? err.message : String(err) };
184
+ process.exitCode = isWatcherDirectoryConflict ? DIRECTORY_CONFLICT_EXIT_CODE : 1;
185
+ process.stderr.write(JSON.stringify(e) + "\n");
186
+ });
187
+ }
@@ -157,6 +157,9 @@ export function writeProbeResult(path, result) {
157
157
  }
158
158
  const ACCEPTED_GIT = "accepted limit (2026-11-19): the clone's shared git folder is writable under the checkout's parent; see docs/REMOTE-MACHINES.md";
159
159
  const UNMEASURED = "not measured for this harness yet";
160
+ const CODEX_WORKSPACE_WRITE = "measured 2026-11-19 in Codex workspace-write: writes to the user's home and the Node installation are refused";
161
+ const CLAUDE_WORKTREE = "measured 2026-11-19 in Claude Code workspace-write: git worktree add is refused because the clone's shared .git/worktrees folder is read-only; the watcher must prepare unit worktrees outside the sandbox";
162
+ const CLAUDE_WORKSPACE_WRITE = "measured 2026-11-19 in Claude Code workspace-write: writes to the user's home, Node installation, shared git config and hooks are refused";
160
163
  export function expectedFor(harness, sandbox) {
161
164
  const works = { expected: "works" };
162
165
  const base = {
@@ -182,10 +185,25 @@ export function expectedFor(harness, sandbox) {
182
185
  }
183
186
  if (harness === "claude-code") {
184
187
  // Its sandbox proxies HTTP(S) only, so an SSH origin cannot be reached (the reason b9s start
185
- // rewrites it per worktree). The rest is not measured with this probe yet.
186
- return { ...base, origin_is_https: works };
188
+ // rewrites it per worktree). On 2026-11-19 workspace-write also refused writes to home, the
189
+ // Node installation, shared git config/hooks, and git worktree registration.
190
+ return {
191
+ ...base,
192
+ origin_is_https: works,
193
+ git_worktree: { expected: "refused", note: CLAUDE_WORKTREE },
194
+ write_git_config: { expected: "refused", note: CLAUDE_WORKSPACE_WRITE },
195
+ write_git_hooks: { expected: "refused", note: CLAUDE_WORKSPACE_WRITE },
196
+ write_home: { expected: "refused", note: CLAUDE_WORKSPACE_WRITE },
197
+ write_node_install: { expected: "refused", note: CLAUDE_WORKSPACE_WRITE },
198
+ };
187
199
  }
188
- if (harness === "codex" || harness === "dsh")
200
+ if (harness === "codex")
201
+ return {
202
+ ...base,
203
+ write_home: { expected: "refused", note: CODEX_WORKSPACE_WRITE },
204
+ write_node_install: { expected: "refused", note: CODEX_WORKSPACE_WRITE },
205
+ };
206
+ if (harness === "dsh")
189
207
  return base;
190
208
  throw new CliError("usage", `no sandbox expectations for harness ${harness}`);
191
209
  }
@@ -0,0 +1,28 @@
1
+ export function bindingForObservedTurn(startedAt, saved) {
2
+ if (!startedAt || !saved || saved.started_at !== startedAt || !Number.isSafeInteger(saved.work_unit_number) || Number(saved.work_unit_number) < 1
3
+ || typeof saved.assignment_event_id !== "string" || !saved.assignment_event_id)
4
+ return null;
5
+ return { work_unit_number: Number(saved.work_unit_number), assignment_event_id: saved.assignment_event_id };
6
+ }
7
+ /** Accept only server-linked assignment events whose message IDs the final budget retained. */
8
+ export function deliveredAssignmentBinding(messages, selectedMessageIds) {
9
+ const selected = new Set(selectedMessageIds);
10
+ const candidates = new Map();
11
+ for (const message of messages) {
12
+ if (!message.direct || !selected.has(message.id))
13
+ continue;
14
+ if (!Number.isSafeInteger(message.work_unit_number) || Number(message.work_unit_number) < 1
15
+ || typeof message.assignment_event_id !== "string" || !message.assignment_event_id)
16
+ continue;
17
+ const binding = { work_unit_number: Number(message.work_unit_number), assignment_event_id: message.assignment_event_id };
18
+ candidates.set(`${binding.work_unit_number}\0${binding.assignment_event_id}`, binding);
19
+ }
20
+ return candidates.size === 1 ? [...candidates.values()][0] : null;
21
+ }
22
+ /** Select the exact active assignment event for an explicit context-clear start. */
23
+ export function currentAssignmentEvent(events, ownerAgentId, ownerName) {
24
+ return events.filter((event) => (event.type === "opened" && event.actor_id === ownerAgentId)
25
+ || ((event.type === "assigned" || event.type === "reassigned") && event.data?.to === ownerName
26
+ && (event.data?.queued === undefined || event.data.queued === null || event.data.queued === false || event.data.queued === 0))
27
+ || event.type === "reopened").sort((a, b) => Date.parse(b.at) - Date.parse(a.at) || b.id.localeCompare(a.id))[0] ?? null;
28
+ }
package/dist/turn.js CHANGED
@@ -110,9 +110,9 @@ export function readTurnPhase(rollout) {
110
110
  * LaunchAgent) does not kill a turn halfway through; the next watcher sees it running in the
111
111
  * session file and waits. Output goes to the watcher's logs.
112
112
  */
113
- export function startTurn(cmd, env, seq, stdin) {
114
- const child = spawn("/bin/sh", ["-c", cmd], { stdio: [stdin === undefined ? "ignore" : "pipe", "inherit", "inherit"], env: { ...process.env, ...env }, detached: true });
115
- const turn = { seq, child, startedMs: Date.now(), confirmed: false };
113
+ export function startTurn(cmd, env, seq, stdin, workUnitBinding = null, cwd = process.cwd()) {
114
+ const child = spawn("/bin/sh", ["-c", cmd], { stdio: [stdin === undefined ? "ignore" : "pipe", "inherit", "inherit"], env: { ...process.env, ...env }, detached: true, cwd });
115
+ const turn = { seq, child, startedMs: Date.now(), confirmed: false, workUnitBinding };
116
116
  if (stdin !== undefined && child.stdin) {
117
117
  child.stdin.on("error", (error) => {
118
118
  if (error.code === "EPIPE") {
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.129";
1
+ export const CLI_VERSION = "0.12.130";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.129",
3
+ "version": "0.12.130",
4
4
  "description": "b9s: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {