benignswarm 0.12.94 → 0.12.95
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 +3 -3
- package/dist/boot-time.js +39 -0
- package/dist/build-caches.js +891 -0
- package/dist/commands/admin.js +97 -2
- package/dist/commands/cloud-admin.js +74 -0
- package/dist/commands/codex-start.js +20 -17
- package/dist/commands/machine-admin.js +94 -10
- package/dist/commands/machine.js +130 -28
- package/dist/commands/watch.js +22 -13
- package/dist/commands/wu.js +27 -2
- package/dist/git.js +19 -5
- package/dist/help.js +32 -14
- package/dist/turn-guard.js +31 -12
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/help.js
CHANGED
|
@@ -20,7 +20,7 @@ GET /account/usage reports used and allowed micro-dollars, uncertain calls and t
|
|
|
20
20
|
Session/admin clients can use GET /assistant/conversations, GET /assistant/conversations/:id/messages (paged history with saved tool notices), POST /assistant/conversations/:id/messages (SSE), and DELETE /assistant/conversations/:id. Old assistant messages report notices_available=false. The assistant can draft changes; POST /assistant/proposals/:id/apply or /discard is the operator's explicit action. See the agent/operator skill API reference for events and tools.
|
|
21
21
|
Free and paid accounts without a live Stripe subscription use the UTC calendar month; subscribed paid accounts reset at current_period_end.
|
|
22
22
|
|
|
23
|
-
GitHub repository
|
|
23
|
+
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
24
|
|
|
25
25
|
Agent commands
|
|
26
26
|
b9s login --as <name> --key <bs_agent_...> [--url <api>] [--label <machine-label>]
|
|
@@ -56,7 +56,8 @@ Agent commands
|
|
|
56
56
|
reports why candidates were passed over, and the sweep chases it;
|
|
57
57
|
--to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
|
|
58
58
|
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
|
|
59
|
+
--template --tags a,b prints the scope skeleton; --force records missing required sections, including for queue;
|
|
60
|
+
assignment reports advisory scope/tier suggestions from recorded causes, with counts and source dates; nothing is applied.
|
|
60
61
|
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
62
|
b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
|
|
62
63
|
reason is required when an assigner uses its assign_outside_qualifications role capability
|
|
@@ -70,8 +71,8 @@ Agent commands
|
|
|
70
71
|
target as of the original); a worktree left half-written by an interrupted
|
|
71
72
|
checkout is removed and made again; wu open does the same for your own units;
|
|
72
73
|
--branch continues existing work; --here uses this checkout
|
|
73
|
-
b9s record per agent
|
|
74
|
-
b9s record --by model
|
|
74
|
+
b9s record per agent/tag; --json also includes project cause aggregates, cohorts, and role-scoped attribution
|
|
75
|
+
b9s record --by model same counters keyed by model and effort; JSON also includes cause aggregates by stamped model and effort
|
|
75
76
|
b9s milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
|
|
76
77
|
b9s milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
|
|
77
78
|
{key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
|
|
@@ -132,6 +133,8 @@ Agent commands
|
|
|
132
133
|
wu release <n> [--note ..] lifts it earlier
|
|
133
134
|
b9s wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
|
|
134
135
|
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
|
|
136
|
+
b9s wu merge <n> [--note "..."] role-checked hosted merge through the API; never inspects local Git credentials or state
|
|
137
|
+
b9s wu merge status <n> operation status and non-secret audit trail for a hosted merge
|
|
135
138
|
b9s wu show <n> [--scope-only] show the full unit or only its scope for scripts
|
|
136
139
|
b9s wu recovery save <n> --reason "..." save a WIP branch commit and encrypted cutoff bundle; keep the source volume until safe_to_delete
|
|
137
140
|
b9s wu recovery restore <n> next owner: verify and restore the restricted recovery bundle into the unit worktree
|
|
@@ -153,9 +156,10 @@ Agent commands
|
|
|
153
156
|
ANTIGRAVITY_LS_ADDRESS,ANTIGRAVITY_CSRF_TOKEN). --full queues the text itself. --once /
|
|
154
157
|
--service (launchd on macOS, systemd on Linux; --launchd is the same). --turn runs each turn
|
|
155
158
|
itself (--harness codex|claude-code|dsh|antigravity --session <id>); 3 consecutive turns without an
|
|
156
|
-
agent-key call
|
|
157
|
-
|
|
158
|
-
|
|
159
|
+
agent-key call faults it; six unproductive turns in a rolling hour also fault. The 60-turn
|
|
160
|
+
hourly cap pauses a busy agent until a turn rolls out, then resumes automatically. Set
|
|
161
|
+
--turns-per-hour 1..60 and --unproductive-per-hour 1..60; an operator or assigner can
|
|
162
|
+
resume a latched fault with b9s-admin machine session resume.
|
|
159
163
|
Codex: b9s watch --exec "codex queue --thread <id> --message {summary}" --service
|
|
160
164
|
b9s update the same as install --latest: upgrade this machine's b9s, repair PATH aliases,
|
|
161
165
|
restart services on that install without waiting on one stop, and report failures
|
|
@@ -164,12 +168,12 @@ Agent commands
|
|
|
164
168
|
b9s doctor every b9s on this machine and who runs which (PATH, npx caches, this repo's
|
|
165
169
|
hook and instructions, each watcher's plist versus what launchd runs), with fixes
|
|
166
170
|
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]
|
|
171
|
+
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
172
|
run an agent headless: enroll, start or adopt its session, turn-mode watcher
|
|
169
173
|
Claude Code workspace-write defaults to a $1 per-turn cap; configure it with --max-budget-usd
|
|
170
174
|
(b9s codex start is the same with --harness codex)
|
|
171
175
|
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
|
|
176
|
+
b9s machine run [--interval seconds] | once | status | prepare | service default 30s, 1..3600; prepare checks dsh availability/version (Linux has no DSH build)
|
|
173
177
|
b9s checkpoint "<title>" --body "..." a resume note without retiring: what you are doing, open threads, next steps;
|
|
174
178
|
your next session (after a move to another machine) reads it first
|
|
175
179
|
b9s antigravity bind <conversation-id> | sync which Antigravity conversation is you, for its hook (watchers bind theirs)
|
|
@@ -224,15 +228,21 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
224
228
|
b9s-admin text-check <project> find bschat mentions in working agreements, charter, tags, roles and open scopes
|
|
225
229
|
b9s-admin signup --url <api> --key <signup-code> <account-name> <email>
|
|
226
230
|
b9s-admin project create|list|delete <name>
|
|
231
|
+
b9s-admin github status | disconnect <installation-id>
|
|
232
|
+
b9s-admin project github <project> status | unlink
|
|
233
|
+
b9s-admin project hosted-merge <project> enable|disable [--confirm-bypass-signal]
|
|
234
|
+
enable only after the live GitHub bypass-change signal check; status/link controls are also in console WU #196
|
|
227
235
|
b9s-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
|
|
228
236
|
b9s-admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
|
|
229
237
|
b9s-admin agent --account list|role|tier|rotate-key|bench|unbench|delete ...
|
|
230
238
|
b9s-admin agent --account bench|unbench <agent> [--note <text>]
|
|
239
|
+
b9s-admin agent --account retire <agent> [--note <text> | --note-file <file>] --yes
|
|
231
240
|
b9s-admin agent list <project>
|
|
232
241
|
b9s-admin agent tier <project>/<agent> <routine|careful|expert> set the routing tier (unset agents are routine)
|
|
233
242
|
b9s-admin agent --account tier <agent> <routine|careful|expert> set an account-wide agent's tier
|
|
234
243
|
b9s-admin agent bench <project>/<agent> [--note <text>] suspend keys and free an active seat
|
|
235
244
|
b9s-admin agent unbench <project>/<agent> restore keys if a seat is available
|
|
245
|
+
b9s-admin agent retire <project>/<agent> [--note <text> | --note-file <file>] --yes revoke keys, release its units, optionally save a resume handoff
|
|
236
246
|
b9s-admin agent away <project>/<agent> (--for <minutes|hours> | --until <ISO timestamp>) --reason "why"
|
|
237
247
|
b9s-admin agent back <project>/<agent>
|
|
238
248
|
b9s-admin enroll create <project> [--name n | --prefix p] [--role r] [--uses n] [--expires-hours h] prints the invite text
|
|
@@ -281,7 +291,7 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
281
291
|
b9s-admin worktree forget <project> <id> delete a stale worktree record (never the directory)
|
|
282
292
|
|
|
283
293
|
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,
|
|
294
|
+
b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] install Node and b9s (no sudo), linger, harness login checks,
|
|
285
295
|
b9s's Codex hooks in /etc/codex (passwordless sudo only), register, start the daemon;
|
|
286
296
|
--codex-userns: where Linux restricts user namespaces (Ubuntu 24.04+), install a
|
|
287
297
|
Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
|
|
@@ -289,10 +299,10 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
|
|
|
289
299
|
b9s-admin machine list | show <name> | remove <name>
|
|
290
300
|
b9s-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
|
|
291
301
|
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]
|
|
302
|
+
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]
|
|
303
|
+
[--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60]
|
|
294
304
|
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
|
|
305
|
+
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
306
|
(change its count/settings, pause scaling, pin, or bench the agent)
|
|
297
307
|
b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> [--dir <path>|auto] [--harness codex|claude-code] [--provider anthropic|deepseek] [--carry note|thread]
|
|
298
308
|
[--from local|<ssh host>] [--model m] [--effort e] [--wait min] [--force]
|
|
@@ -302,12 +312,20 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
|
|
|
302
312
|
b9s-admin machine slots <name> <n | auto> how many sessions it takes (auto: one per 4 GB of RAM)
|
|
303
313
|
b9s-admin machine writable <name> <path...> | none folders workspace-write agents there may also write (~/.cargo, ~/.ester)
|
|
304
314
|
b9s-admin machine workdir <name> <path | default> where its daemon clones projects for pool sessions (default ~/bschat)
|
|
315
|
+
b9s-admin machine cache-budget <name> [<GB> | default] [--floor <pct | default>] per-cache budget (default 40 GB) and volume free-space floor (default 15%)
|
|
316
|
+
b9s-admin machine caches <name> <path...> | none [--tool auto|cargo|generic] [--processes cmd,...] declared build-cache directories managed by the daemon
|
|
317
|
+
|
|
318
|
+
BYO AWS cloud machines (the connection is account-scoped; AWS bills the account directly)
|
|
319
|
+
b9s-admin cloud connect --file connection.json connect an IAM role, show its external ID once, and print the reviewed trust/permissions policies
|
|
320
|
+
b9s-admin cloud show | policy | test | disconnect
|
|
321
|
+
b9s-admin cloud launch --machine <id> --idempotency-key <key> request one capped on-demand instance; retries with the same key return the same operation
|
|
322
|
+
b9s-admin cloud operations | inspect <operation-id> | terminate <operation-id> --reason <why> terminate refuses unless signed ownership proof and immutable tags verify
|
|
305
323
|
|
|
306
324
|
Pools (a role, variants and a count; the server names the agents and places them on machines)
|
|
307
325
|
b9s-admin project repo <project> <git url | none> what machines clone for the project's pool sessions
|
|
308
326
|
b9s-admin project checkout <project> --exclude <path,path | none> paths new worktrees leave out (sparse checkout), e.g. logs/
|
|
309
327
|
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]
|
|
328
|
+
--count <n> --sandbox <mode> [--needs label,label] [--min-ram GB] [--turn-timeout min] [--turns-per-hour 1..60] [--unproductive-per-hour 1..60]
|
|
311
329
|
slots are agents named <name>-<tag>-<n>; fewer retires the extra ones
|
|
312
330
|
b9s-admin pool list [project] | show <project>/<name> | remove <project>/<name>
|
|
313
331
|
b9s-admin delete-account --confirm "delete everything"
|
package/dist/turn-guard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export const DEFAULT_TURNS_PER_HOUR =
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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.
|
|
1
|
+
export const CLI_VERSION = "0.12.95";
|