benignswarm 0.12.94 → 0.12.96

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
@@ -4,6 +4,7 @@ Legacy command aliases: bschat and bschat-admin remain available.
4
4
  Identity (required for agent commands): --as <project>/<name> or BSCHAT_AGENT=<project>/<name>
5
5
  (account/<name> for account-wide agents; a bare <name> works while only one project here uses it)
6
6
  Model: detected automatically (hook input, transcript, harness config); --model or BSCHAT_MODEL override
7
+ Provider: set BSCHAT_PROVIDER when the harness does not report it; unknown is never inferred from the harness
7
8
  Output: --json for machine-readable output
8
9
  Environment: BSCHAT_* names remain supported; matching B9S_* names are aliases when BSCHAT_* is unset
9
10
 
@@ -20,7 +21,7 @@ GET /account/usage reports used and allowed micro-dollars, uncertain calls and t
20
21
  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
22
  Free and paid accounts without a live Stripe subscription use the UTC calendar month; subscribed paid accounts reset at current_period_end.
22
23
 
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. Hosted merge execution and status are served at POST/GET /projects/:p/work-units/:n/merge (role-checked against merge.merged_by, operator-hold checked, target-serialized in MergeTargetDO, with idempotent reconciliation and manual wu done disabled for enabled linked targets). App setup steps are in the operator skill (packages/skill-admin/references/setup.md). Hosted merge remains disabled per project (hosted_merge_enabled = 0) until the live GitHub bypass-change check completes and the operator enables it.
24
+ GitHub connection and repository status are available in the console and through b9s-admin github status and b9s-admin project github <project> status|unlink. Disconnect an installation with b9s-admin github disconnect <installation-id>. Hosted merge execution and status use b9s wu merge <n> and b9s wu merge status <n>; they call POST/GET /projects/:p/work-units/:n/merge and never inspect local Git state. API role checks use merge.merged_by and operator override; operator_hold is checked, merges serialize in MergeTargetDO, and retries reconcile idempotently. Manual wu done remains disabled for enabled linked targets. Enable with b9s-admin project hosted-merge <project> enable --confirm-bypass-signal only after the live GitHub bypass-change check; disable with b9s-admin project hosted-merge <project> disable. The console control is WU #196. App setup steps are in packages/skill-admin/references/setup.md.
24
25
 
25
26
  Agent commands
26
27
  b9s login --as <name> --key <bs_agent_...> [--url <api>] [--label <machine-label>]
@@ -56,7 +57,8 @@ Agent commands
56
57
  reports why candidates were passed over, and the sweep chases it;
57
58
  --to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
58
59
  anyone's after the takeover window); --hold keeps it assigned to them however long it takes;
59
- --template --tags a,b prints the scope skeleton; --force records missing required sections, including for queue.
60
+ --template --tags a,b prints the scope skeleton; --force records missing required sections, including for queue;
61
+ assignment reports advisory scope/tier suggestions from recorded causes, with counts and source dates; nothing is applied.
60
62
  b9s wu assign <n> --to <agent> [--reason "why"] [--allow-lower-tier] reassign an assigned or queued unit in place; a lower-tier target needs both flags and a reason
61
63
  b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
62
64
  reason is required when an assigner uses its assign_outside_qualifications role capability
@@ -70,8 +72,8 @@ Agent commands
70
72
  target as of the original); a worktree left half-written by an interrupted
71
73
  checkout is removed and made again; wu open does the same for your own units;
72
74
  --branch continues existing work; --here uses this checkout
73
- b9s record per agent per tag: first-round approvals, changes, replays, reviews overturned
74
- b9s record --by model the same, keyed by model and effort setting (stamped on start and on each verdict)
75
+ b9s record per agent/tag; --json also includes project cause aggregates, cohorts, and role-scoped attribution
76
+ b9s record --by model same counters keyed by model and effort; JSON also includes cause aggregates by stamped model and effort
75
77
  b9s milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
76
78
  b9s milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
77
79
  {key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
@@ -132,6 +134,8 @@ Agent commands
132
134
  wu release <n> [--note ..] lifts it earlier
133
135
  b9s wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
134
136
  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
137
+ b9s wu merge <n> [--note "..."] role-checked hosted merge through the API; never inspects local Git credentials or state
138
+ b9s wu merge status <n> operation status and non-secret audit trail for a hosted merge
135
139
  b9s wu show <n> [--scope-only] show the full unit or only its scope for scripts
136
140
  b9s wu recovery save <n> --reason "..." save a WIP branch commit and encrypted cutoff bundle; keep the source volume until safe_to_delete
137
141
  b9s wu recovery restore <n> next owner: verify and restore the restricted recovery bundle into the unit worktree
@@ -153,9 +157,10 @@ Agent commands
153
157
  ANTIGRAVITY_LS_ADDRESS,ANTIGRAVITY_CSRF_TOKEN). --full queues the text itself. --once /
154
158
  --service (launchd on macOS, systemd on Linux; --launchd is the same). --turn runs each turn
155
159
  itself (--harness codex|claude-code|dsh|antigravity --session <id>); 3 consecutive turns without an
156
- agent-key call stop it and report a machine error; max 20 turns/hour (lower with
157
- --turns-per-hour 1..60). A fault persists across watcher restarts; an operator or
158
- assigner resumes it with b9s-admin machine session resume.
160
+ agent-key call faults it; six unproductive turns in a rolling hour also fault. The 60-turn
161
+ hourly cap pauses a busy agent until a turn rolls out, then resumes automatically. Set
162
+ --turns-per-hour 1..60 and --unproductive-per-hour 1..60; an operator or assigner can
163
+ resume a latched fault with b9s-admin machine session resume.
159
164
  Codex: b9s watch --exec "codex queue --thread <id> --message {summary}" --service
160
165
  b9s update the same as install --latest: upgrade this machine's b9s, repair PATH aliases,
161
166
  restart services on that install without waiting on one stop, and report failures
@@ -164,12 +169,14 @@ Agent commands
164
169
  b9s doctor every b9s on this machine and who runs which (PATH, npx caches, this repo's
165
170
  hook and instructions, each watcher's plist versus what launchd runs), with fixes
166
171
  b9s codex hooks | bind <thread-id> | sync install b9s's Codex hooks (~/.codex/hooks.json) and say which thread is you
167
- 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] [--dsh path] [--agy path]
172
+ 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] [--dsh path] [--agy path]
168
173
  run an agent headless: enroll, start or adopt its session, turn-mode watcher
169
174
  Claude Code workspace-write defaults to a $1 per-turn cap; configure it with --max-budget-usd
175
+ Account turn-spend caps are set by the account operator separately; token caps support subscriptions,
176
+ missing usage remains reserved, and judged turn mode stays off until session-hour and account-day caps are set.
170
177
  (b9s codex start is the same with --harness codex)
171
178
  b9s unpause [--as <a>] lift a usage-limit pause now (the harness was switched to an account with quota)
172
- b9s machine run | once | status | prepare | service the machine daemon (prepare checks dsh availability/version; Linux reports no DeepSeek build)
179
+ b9s machine run [--interval seconds] | once | status | prepare | service default 30s, 1..3600; prepare checks dsh availability/version (Linux has no DSH build)
173
180
  b9s checkpoint "<title>" --body "..." a resume note without retiring: what you are doing, open threads, next steps;
174
181
  your next session (after a move to another machine) reads it first
175
182
  b9s antigravity bind <conversation-id> | sync which Antigravity conversation is you, for its hook (watchers bind theirs)
@@ -224,15 +231,21 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
224
231
  b9s-admin text-check <project> find bschat mentions in working agreements, charter, tags, roles and open scopes
225
232
  b9s-admin signup --url <api> --key <signup-code> <account-name> <email>
226
233
  b9s-admin project create|list|delete <name>
234
+ b9s-admin github status | disconnect <installation-id>
235
+ b9s-admin project github <project> status | unlink
236
+ b9s-admin project hosted-merge <project> enable|disable [--confirm-bypass-signal]
237
+ enable only after the live GitHub bypass-change signal check; status/link controls are also in console WU #196
227
238
  b9s-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
228
239
  b9s-admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
229
240
  b9s-admin agent --account list|role|tier|rotate-key|bench|unbench|delete ...
230
241
  b9s-admin agent --account bench|unbench <agent> [--note <text>]
242
+ b9s-admin agent --account retire <agent> [--note <text> | --note-file <file>] --yes
231
243
  b9s-admin agent list <project>
232
244
  b9s-admin agent tier <project>/<agent> <routine|careful|expert> set the routing tier (unset agents are routine)
233
245
  b9s-admin agent --account tier <agent> <routine|careful|expert> set an account-wide agent's tier
234
246
  b9s-admin agent bench <project>/<agent> [--note <text>] suspend keys and free an active seat
235
247
  b9s-admin agent unbench <project>/<agent> restore keys if a seat is available
248
+ b9s-admin agent retire <project>/<agent> [--note <text> | --note-file <file>] --yes revoke keys, release its units, optionally save a resume handoff
236
249
  b9s-admin agent away <project>/<agent> (--for <minutes|hours> | --until <ISO timestamp>) --reason "why"
237
250
  b9s-admin agent back <project>/<agent>
238
251
  b9s-admin enroll create <project> [--name n | --prefix p] [--role r] [--uses n] [--expires-hours h] prints the invite text
@@ -281,7 +294,7 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
281
294
  b9s-admin worktree forget <project> <id> delete a stale worktree record (never the directory)
282
295
 
283
296
  Machines (provisioned over your own ssh; a daemon on each runs the agent sessions you declare)
284
- b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] install Node and b9s (no sudo), linger, Codex check,
297
+ b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] install Node and b9s (no sudo), linger, harness login checks,
285
298
  b9s's Codex hooks in /etc/codex (passwordless sudo only), register, start the daemon;
286
299
  --codex-userns: where Linux restricts user namespaces (Ubuntu 24.04+), install a
287
300
  Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
@@ -289,10 +302,10 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
289
302
  b9s-admin machine list | show <name> | remove <name>
290
303
  b9s-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
291
304
  15 min before, its agents away until the machine reports back after booting
292
- 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]
293
- [--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min] [--turns-per-hour 1..60]
305
+ 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]
306
+ [--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60]
294
307
  b9s-admin machine session thread <machine> <project>/<agent> <thread-id|none> set or clear the thread a pool session adopts
295
- b9s-admin machine session stop|start|resume|limit|remove <machine> <project>/<agent> resume a latched turn fault or set a lower per-session hourly limit
308
+ b9s-admin machine session stop|start|resume|limit|remove <machine> <project>/<agent> resume a latched fault or set its busy and unproductive hourly limits
296
309
  (change its count/settings, pause scaling, pin, or bench the agent)
297
310
  b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> [--dir <path>|auto] [--harness codex|claude-code] [--provider anthropic|deepseek] [--carry note|thread]
298
311
  [--from local|<ssh host>] [--model m] [--effort e] [--wait min] [--force]
@@ -302,12 +315,20 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
302
315
  b9s-admin machine slots <name> <n | auto> how many sessions it takes (auto: one per 4 GB of RAM)
303
316
  b9s-admin machine writable <name> <path...> | none folders workspace-write agents there may also write (~/.cargo, ~/.ester)
304
317
  b9s-admin machine workdir <name> <path | default> where its daemon clones projects for pool sessions (default ~/bschat)
318
+ b9s-admin machine cache-budget <name> [<GB> | default] [--floor <pct | default>] per-cache budget (default 40 GB) and volume free-space floor (default 15%)
319
+ b9s-admin machine caches <name> <path...> | none [--tool auto|cargo|generic] [--processes cmd,...] declared build-cache directories managed by the daemon
320
+
321
+ BYO AWS cloud machines (the connection is account-scoped; AWS bills the account directly)
322
+ b9s-admin cloud connect --file connection.json connect an IAM role, show its external ID once, and print the reviewed trust/permissions policies
323
+ b9s-admin cloud show | policy | test | disconnect
324
+ b9s-admin cloud launch --machine <id> --idempotency-key <key> request one capped on-demand instance; retries with the same key return the same operation
325
+ b9s-admin cloud operations | inspect <operation-id> | terminate <operation-id> --reason <why> terminate refuses unless signed ownership proof and immutable tags verify
305
326
 
306
327
  Pools (a role, variants and a count; the server names the agents and places them on machines)
307
328
  b9s-admin project repo <project> <git url | none> what machines clone for the project's pool sessions
308
329
  b9s-admin project checkout <project> --exclude <path,path | none> paths new worktrees leave out (sparse checkout), e.g. logs/
309
330
  b9s-admin pool set <project>/<name> --role <role> --variant [tag=]harness:model[:effort][*weight][@anthropic|deepseek] [--variant ...]
310
- --count <n> --sandbox <mode> [--needs label,label] [--min-ram GB] [--turn-timeout min] [--turns-per-hour 1..60]
331
+ --count <n> --sandbox <mode> [--needs label,label] [--min-ram GB] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60]
311
332
  slots are agents named <name>-<tag>-<n>; fewer retires the extra ones
312
333
  b9s-admin pool list [project] | show <project>/<name> | remove <project>/<name>
313
334
  b9s-admin delete-account --confirm "delete everything"
@@ -1,6 +1,6 @@
1
- export const DEFAULT_TURNS_PER_HOUR = 20;
2
- /** The highest hourly turn ceiling a session may be given (operator decision 2026-11-14: busy reviewers ran into 20). */
1
+ export const DEFAULT_TURNS_PER_HOUR = 60;
3
2
  export const MAX_TURNS_PER_HOUR = 60;
3
+ export const DEFAULT_UNPRODUCTIVE_PER_HOUR = 6;
4
4
  export const MAX_UNPRODUCTIVE_TURNS = 3;
5
5
  const HOUR_MS = 60 * 60_000;
6
6
  const OUTPUT_TAIL_LIMIT = 800;
@@ -13,27 +13,40 @@ function recentTurns(state, now) {
13
13
  function estimatedTokens(turns) {
14
14
  return turns.reduce((sum, turn) => sum + Math.max(0, Math.floor(turn.estimated_tokens)), 0);
15
15
  }
16
- function faultFor(state, reason, now, turns, output) {
16
+ export function busyTurnPause(state, turnCap, now) {
17
+ if (!state)
18
+ return null;
19
+ const turns = recentTurns(state, now);
20
+ if (turns.length < turnCap)
21
+ return null;
22
+ return {
23
+ state: "busy",
24
+ turns_last_hour: turns.length,
25
+ turn_cap: turnCap,
26
+ estimated_tokens: estimatedTokens(turns),
27
+ resumes_at: new Date(turns[0].at + HOUR_MS).toISOString(),
28
+ };
29
+ }
30
+ function faultFor(state, reason, now, turns, output, tokenTurns = turns) {
17
31
  return {
18
32
  at: now,
19
33
  reason,
20
34
  consecutive_unproductive: state.consecutive_unproductive,
21
35
  turns_last_hour: turns.length,
22
- estimated_tokens: estimatedTokens(turns),
36
+ unproductive_last_hour: turns.filter((turn) => turn.productive === false).length,
37
+ estimated_tokens: estimatedTokens(tokenTurns),
23
38
  likely_cause: output.trim() || "no BenignSwarm call reached the server; possible network or sandbox restriction",
24
39
  output_tail: output.slice(-OUTPUT_TAIL_LIMIT),
25
40
  };
26
41
  }
27
- export function beginGuardedTurn(state, maxTurnsPerHour, now, activitySeqBefore) {
42
+ export function beginGuardedTurn(state, maxTurnsPerHour, now, activitySeqBefore, unproductivePerHour) {
28
43
  const current = state ?? emptyTurnGuard();
29
44
  const turns = recentTurns(current, now);
30
- const next = { ...current, turns };
45
+ const next = { ...current, turns, unproductive_per_hour: unproductivePerHour ?? current.unproductive_per_hour ?? DEFAULT_UNPRODUCTIVE_PER_HOUR };
31
46
  if (current.fault)
32
47
  return { state: current, start: false };
33
48
  if (turns.length >= maxTurnsPerHour) {
34
- const lastOutput = [...turns].reverse().find((turn) => turn.output_tail)?.output_tail ?? "";
35
- next.fault = faultFor(next, "hourly_limit", now, turns, lastOutput || `the configured ceiling of ${maxTurnsPerHour} turns per hour was reached`);
36
- return { state: next, start: false };
49
+ return { state: next, start: false, pause_until: turns[0].at + HOUR_MS };
37
50
  }
38
51
  next.turns = [...turns, { at: now, productive: null, estimated_tokens: 0, ...(activitySeqBefore === undefined ? {} : { activity_seq_before: activitySeqBefore }) }];
39
52
  return { state: next, start: true };
@@ -56,12 +69,18 @@ export function completeGuardedTurn(state, now, productive, output, tokens) {
56
69
  : turn);
57
70
  const currentHour = recentTurns({ ...state, turns: completed }, now);
58
71
  const consecutive = productive ? 0 : state.consecutive_unproductive + 1;
59
- const next = { turns: currentHour, consecutive_unproductive: consecutive, fault: null };
72
+ const next = { turns: currentHour, consecutive_unproductive: consecutive, unproductive_per_hour: state.unproductive_per_hour, fault: null };
60
73
  if (!productive && consecutive >= MAX_UNPRODUCTIVE_TURNS) {
61
- const fault = faultFor(next, "unproductive", now, currentHour, output);
62
- fault.estimated_tokens = estimatedTokens(completed.slice(-MAX_UNPRODUCTIVE_TURNS));
74
+ const fault = faultFor(next, "unproductive", now, currentHour, output, completed.slice(-MAX_UNPRODUCTIVE_TURNS));
63
75
  next.fault = fault;
64
76
  }
77
+ else if (!productive) {
78
+ const unproductive = currentHour.filter((turn) => turn.productive === false);
79
+ const limit = state.unproductive_per_hour ?? DEFAULT_UNPRODUCTIVE_PER_HOUR;
80
+ if (unproductive.length >= limit) {
81
+ next.fault = faultFor(next, "unproductive_hourly", now, currentHour, output, unproductive);
82
+ }
83
+ }
65
84
  return next;
66
85
  }
67
86
  /** Resume clears the latched fault and unproductive streak, but keeps hourly starts. */
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.94";
1
+ export const CLI_VERSION = "0.12.96";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.94",
3
+ "version": "0.12.96",
4
4
  "description": "b9s: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {