benignswarm 0.12.95 → 0.12.97
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/admin-index.js +0 -0
- package/dist/args.js +39 -3
- package/dist/brief.js +5 -1
- package/dist/client.js +207 -1
- package/dist/commands/admin.js +84 -22
- package/dist/commands/agent.js +15 -2
- package/dist/commands/cloud-admin.js +56 -3
- package/dist/commands/codex-start.js +333 -239
- package/dist/commands/environment-admin.js +130 -0
- package/dist/commands/environment.js +53 -0
- package/dist/commands/evidence.js +6 -3
- package/dist/commands/feedback.js +12 -1
- package/dist/commands/flow.js +153 -0
- package/dist/commands/hook.js +29 -9
- package/dist/commands/image-admin.js +77 -0
- package/dist/commands/install.js +81 -3
- package/dist/commands/lists.js +4 -0
- package/dist/commands/machine-admin.js +444 -111
- package/dist/commands/machine-resize.js +234 -0
- package/dist/commands/machine.js +957 -39
- package/dist/commands/operator.js +5 -8
- package/dist/commands/retire.js +4 -0
- package/dist/commands/templates.js +27 -0
- package/dist/commands/watch.js +43 -10
- package/dist/commands/wu.js +131 -81
- package/dist/container.js +480 -0
- package/dist/environment-checks.js +79 -0
- package/dist/git.js +29 -1
- package/dist/help.js +88 -34
- package/dist/index.js +5 -1
- package/dist/install.js +43 -1
- package/dist/macos-readiness.js +173 -0
- package/dist/output.js +15 -4
- package/dist/templates.js +218 -0
- package/dist/test-workers.js +17 -0
- package/dist/turn.js +6 -0
- package/dist/usage.js +117 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/help.js
CHANGED
|
@@ -4,7 +4,8 @@ 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
|
-
|
|
7
|
+
Provider: set BSCHAT_PROVIDER when the harness does not report it; unknown is never inferred from the harness
|
|
8
|
+
Output: --json for machine-readable output; successful text writes print stored bytes and SHA-256
|
|
8
9
|
Environment: BSCHAT_* names remain supported; matching B9S_* names are aliases when BSCHAT_* is unset
|
|
9
10
|
|
|
10
11
|
Joining (first time on a machine, with an enrollment token from the account owner)
|
|
@@ -20,7 +21,13 @@ 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
|
-
|
|
24
|
+
Mac capacity/signing API records (profiles, lease requests, capability snapshots, signer-only references and TestFlight requests) are documented in docs/MACOS-MACHINES-API.md. This API contract does not provision a host or sign/upload; operator controls are the named Mac fleet and signing console unit.
|
|
25
|
+
|
|
26
|
+
GitHub connection and repository status are available in the console and through b9s-admin github status and b9s-admin project github <project> status|unlink. A repository link enables agent credentials without requiring a ruleset. Verify an exact target ruleset in Account -> GitHub connection before enabling hosted merge; the CLI cannot perform this owner OAuth step. 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 ruleset verification and 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.
|
|
27
|
+
|
|
28
|
+
Environment problems: agents report bounded, redacted observations with b9s environment report; reports use scoped project or machine access, account-scoped evidence, and only the agent's own blocked units. Agents can append observations but cannot claim, diagnose, or resolve issues. Operators and agents whose role has own_environment_problems can manage visible issues. Operators use Account → Environment in the console to filter and inspect issues, claim/assign/reassign, record diagnoses, and resolve with a note and verification. Manual diagnoses use source agent; doctor/daemon provenance is for actual check results. Banner links open the same issue detail with impact context. Issue detail links active notices in the same scope and current machine-session faults related to its machine or explicitly linked unit owner. The read-only steward summary lists active linked issues and currently waiting linked units, without publishing notices or creating work. Machine issue views respect linked-project access. Spending impact is unknown and creates no banner until unit-attributed telemetry lands in WU #236; see packages/skill/references/api.md.
|
|
29
|
+
|
|
30
|
+
Work-unit open, start, submit and close endpoints accept context fill and compaction metadata on lifecycle events. Report explicit unknown reasons when unavailable; never send prompt or response text as context. Context aggregation is grouped by the event owner and its stamped model/effort. Context policies (keep | compact | clear | agent-decides) resolve unit > role > project > system default keep, freeze on assignment/open, audit settings and action-metadata decisions via GET/PUT /projects/:p/context-policy, POST /projects/:p/work-units/:n/context-policy, and POST /projects/:p/work-units/:n/context-policy/decision, and fail closed until an assigner or operator updates a blocked unit. See packages/skill/references/api.md for field validation and response shapes.
|
|
24
31
|
|
|
25
32
|
Agent commands
|
|
26
33
|
b9s login --as <name> --key <bs_agent_...> [--url <api>] [--label <machine-label>]
|
|
@@ -31,7 +38,7 @@ Agent commands
|
|
|
31
38
|
b9s resume compact recovery brief: units, reviews, asks, slices, decisions, outcomes, process and notices
|
|
32
39
|
b9s notice add --project <p> "<text>" [--until <time>] [--command-pattern <regex>]
|
|
33
40
|
assigner only: add a project notice; matching commands warn but continue
|
|
34
|
-
b9s who [--account] what every agent is doing (--account: all projects); benched agents
|
|
41
|
+
b9s who [--account] what every agent is doing (--account: all projects); benched agents get their own line, usage-limited agents show the harness reset time
|
|
35
42
|
b9s status set [--state s] [--goal g] [--task t] [--blocked-on b] [--tags a,b] [--custom '{json}']
|
|
36
43
|
[--checks-every <min>|none] not always on but checking on a schedule: say how often
|
|
37
44
|
b9s status history <agent> [--limit n]
|
|
@@ -41,24 +48,26 @@ Agent commands
|
|
|
41
48
|
b9s send <channel> <message...> [--reply-to <seq>] @name, @role:name, @role:* are resolved and validated
|
|
42
49
|
b9s send <channel> --body-file <f|-> multi-line / markdown message from a file or stdin (use this for anything long)
|
|
43
50
|
b9s read <channel> [--since <seq>] [--limit n] [--follow] | b9s read --pending
|
|
44
|
-
b9s inbox [--unread] [--after <iso-time>] [--limit n] mentions
|
|
51
|
+
b9s inbox [--unread] [--after <iso-time>] [--limit n] mentions/replies and open questions addressed to your assigner role
|
|
52
|
+
b9s inbox handle <project>/<channel>/<seq> mark an addressed question handled outside its thread
|
|
45
53
|
b9s follow <channel> | unfollow <channel> | following followed channels' new messages are injected by the hook;
|
|
46
54
|
other channels appear as a one-line unread digest
|
|
47
55
|
b9s process the project's process: tag vocabulary, reviewers, wake-path warnings, scope templates, requirements, agreements
|
|
48
|
-
b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--after <n>[,<m>]] [--
|
|
56
|
+
b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--lands-with <n>] [--after <n>[,<m>]] [--requires cap,cap] [--force] [--evidence id[,id...]] [--target <branch>] [--here] open a work unit in its own
|
|
49
57
|
worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
|
|
50
58
|
process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
|
|
51
|
-
b9s wu open "<title>" --scope "..." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--reworks n,m] [--after <n>[,<m>]] [--
|
|
59
|
+
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] [--force] [--evidence id[,id...]] [--target <branch>] [--here] open a work unit in its own
|
|
52
60
|
worktree; tags come from the vocabulary; --target is the branch it lands in (default: the
|
|
53
61
|
process target), e.g. a lane branch; wu target <n> <branch|default> changes it before review
|
|
54
|
-
b9s wu assign "<title>" --to <agent|auto|queue> --scope ".." [--scope-file <path> | --scope-from <n>] [--tags a,b] [--reworks n,m] [--after <n>[,<m>]] [--
|
|
62
|
+
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] [--force] [--replay-of n] [--template] [--reason "why"] hand out a unit (assigner roles);
|
|
55
63
|
--to auto picks the active qualified worker with the lightest load; it queues when nobody fits,
|
|
56
64
|
reports why candidates were passed over, and the sweep chases it;
|
|
57
65
|
--to queue waits deliberately; naming a busy worker reserves it for them (theirs when free,
|
|
58
66
|
anyone's after the takeover window); --hold keeps it assigned to them however long it takes;
|
|
59
67
|
--template --tags a,b prints the scope skeleton; --force records missing required sections, including for queue;
|
|
60
|
-
assignment reports advisory scope
|
|
61
|
-
b9s wu assign <n> --to <agent> [--reason "why"]
|
|
68
|
+
assignment reports advisory scope suggestions from recorded causes, with counts and source dates; nothing is applied.
|
|
69
|
+
b9s wu assign <n> --to <agent> [--reason "why"] reassign an assigned or queued unit in place
|
|
70
|
+
b9s wu lands-with <n> <base-unit|clear> set or clear the base WU whose landing gates this unit
|
|
62
71
|
b9s wu take <n> [--to <agent>] [--reason "why"] pull a unit or hand it to someone
|
|
63
72
|
reason is required when an assigner uses its assign_outside_qualifications role capability
|
|
64
73
|
b9s wu next take the oldest queued unit you qualify for
|
|
@@ -70,9 +79,12 @@ Agent commands
|
|
|
70
79
|
b9s wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
|
|
71
80
|
target as of the original); a worktree left half-written by an interrupted
|
|
72
81
|
checkout is removed and made again; wu open does the same for your own units;
|
|
73
|
-
--branch continues existing work; --here uses this checkout
|
|
74
|
-
|
|
75
|
-
|
|
82
|
+
--branch continues existing work (never a SHA); always fetches and branches from origin/<target>; --here uses this checkout
|
|
83
|
+
lifecycle events include context-fill metadata and compaction deltas: Claude Code reads assistant usage
|
|
84
|
+
and compact markers, Codex reads token_count and compaction events; Antigravity needs a confirmed window;
|
|
85
|
+
unsupported or unavailable measurements include a reason; compaction intervals include the start and exclude the end
|
|
86
|
+
b9s record per agent/tag; --json also includes project cause/evidence aggregates, cohorts, and role-scoped attribution
|
|
87
|
+
b9s record --by model same counters keyed by model and effort; JSON includes attempt/review outcomes, recorded wait timing, cause aggregates by stamped model/effort, and usage availability
|
|
76
88
|
b9s milestones the plan's slices: ready or waiting on which, units done/total; wu open|assign --milestone <key>
|
|
77
89
|
b9s milestones set --file plan.json define or replace the plan (assigner roles or the operator): a JSON list of
|
|
78
90
|
{key, title, exit, depends_on, default_tags}; existing keys keep their status; cycles are refused
|
|
@@ -89,17 +101,22 @@ Agent commands
|
|
|
89
101
|
b9s milestone review <key> assigner or operator: request a closure review now (the steward does it when the last unit closes)
|
|
90
102
|
b9s lock <name> [--unit n] [--note ..] [--shared] take this machine's <name> (build slot, scratch) or queue; --shared for a project-wide resource (a test board)
|
|
91
103
|
acquisition queues through a machine maintenance drain/window and resumes after it
|
|
92
|
-
b9s unlock <name> | b9s locks
|
|
104
|
+
b9s unlock <name> [--machine <label>|--shared] [--remove-empty] | b9s locks
|
|
105
|
+
release it (also released when your unit closes); assigners/operators can remove an empty scoped lock with --remove-empty
|
|
106
|
+
lock names acquire/list/release/show/status are reserved: use lock <name>, locks, or unlock <name> as suggested
|
|
93
107
|
b9s measures latest measure values, freshness and merges since each value
|
|
94
108
|
b9s measure show <name> definition history, values and runner requests
|
|
95
109
|
b9s measure run <name> --sha <commit> [--target branch] [--rerun] request a bounded runner unit
|
|
96
110
|
b9s measure post <name> --sha <commit> --value <v> --evidence <id[,id...]> [--target branch]
|
|
97
111
|
b9s measure check <name> run the command producer for the active matching unit at this clean worktree's HEAD and compare with its target's latest good value
|
|
112
|
+
b9s templates validate [--root <repo>] validate all six checked-in environment template families and their pins
|
|
113
|
+
b9s templates pack --signing-key <pem> [--root <repo>] [--out <dir>]
|
|
114
|
+
create a signed, immutable source archive from a clean catalog revision
|
|
98
115
|
Global: --effort <high|medium|low|...> reasoning effort to report (else BSCHAT_EFFORT, CLAUDE_EFFORT, codex model_reasoning_effort)
|
|
99
116
|
b9s wu submit <n> [--evidence id[,id...] ...] [--pr url] [--expect 'measure: effect'] [--lesson "..."] [--disputes '<JSON list>'] ask for review; after a send-back give one lesson (max 280 chars); optional disputes cite send-back event IDs and exact clauses
|
|
100
117
|
b9s wu review <n> reviewer's checkout: fetch the submitted branch from origin and open
|
|
101
118
|
../<repo>-review-wu<n> detached at the submitted head (refused if origin differs)
|
|
102
|
-
b9s wu approve <n> --note ".." [--confirm-causes cause,cause] approval covers tags your role reviews; complete approval confirms classified send-back causes in timeline order
|
|
119
|
+
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
|
|
103
120
|
a planned reviewer still owing may approve after coverage; status stays approved until merge
|
|
104
121
|
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
|
|
105
122
|
concerns outside those are notes (wu note) or questions (wu ask)
|
|
@@ -158,22 +175,33 @@ Agent commands
|
|
|
158
175
|
itself (--harness codex|claude-code|dsh|antigravity --session <id>); 3 consecutive turns without an
|
|
159
176
|
agent-key call faults it; six unproductive turns in a rolling hour also fault. The 60-turn
|
|
160
177
|
hourly cap pauses a busy agent until a turn rolls out, then resumes automatically. Set
|
|
161
|
-
--turns-per-hour 1..60
|
|
162
|
-
|
|
178
|
+
--turns-per-hour 1..60, --unproductive-per-hour 1..60, and --turn-coalesce-seconds 0..3600;
|
|
179
|
+
direct wake-ups coalesce for 180s by default; 0 disables it. Operators and urgent-marked items
|
|
180
|
+
bypass the window when the API exposes that marker. An operator or assigner can resume a latched
|
|
181
|
+
fault with b9s-admin machine session resume.
|
|
163
182
|
Codex: b9s watch --exec "codex queue --thread <id> --message {summary}" --service
|
|
164
183
|
b9s update the same as install --latest: upgrade this machine's b9s, repair PATH aliases,
|
|
165
184
|
restart services on that install without waiting on one stop, and report failures
|
|
166
185
|
b9s install [<version> | --latest] make or upgrade this machine's one b9s (join does it once), repair PATH aliases,
|
|
167
186
|
restart services resolving to it; other installs are left alone and named
|
|
168
187
|
b9s doctor every b9s on this machine and who runs which (PATH, npx caches, this repo's
|
|
169
|
-
hook and instructions, each watcher's plist versus what launchd runs), with fixes
|
|
188
|
+
hook and instructions, each watcher's plist versus what launchd runs), with fixes;
|
|
189
|
+
--json also includes structured sandbox, writable-root, PATH, disk and state checks
|
|
190
|
+
b9s environment report --project <p> | --machine <m> --title <text> --category <name> --component <name> --description <what failed> [--normalized-key <key>] [--evidence <id,...>] [--units <id,...>]
|
|
191
|
+
submit a bounded observation; evidence is account-scoped, and agents may link only their own units
|
|
170
192
|
b9s codex hooks | bind <thread-id> | sync install b9s's Codex hooks (~/.codex/hooks.json) and say which thread is you
|
|
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]
|
|
193
|
+
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] [--dsh path] [--agy path]
|
|
172
194
|
run an agent headless: enroll, start or adopt its session, turn-mode watcher
|
|
173
195
|
Claude Code workspace-write defaults to a $1 per-turn cap; configure it with --max-budget-usd
|
|
196
|
+
Account turn-spend caps are set by the account operator separately; token caps support subscriptions,
|
|
197
|
+
missing usage remains reserved, and judged turn mode stays off until session-hour and account-day caps are set.
|
|
198
|
+
Admin-only account reads: GET /account/turn-spend/reservations and
|
|
199
|
+
GET /account/turn-spend/sessions/:session/reservations list unresolved reservations;
|
|
200
|
+
GET /account/turn-budget/audit lists policy changes. All three are paged and account-scoped.
|
|
174
201
|
(b9s codex start is the same with --harness codex)
|
|
175
202
|
b9s unpause [--as <a>] lift a usage-limit pause now (the harness was switched to an account with quota)
|
|
176
|
-
b9s machine
|
|
203
|
+
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
|
|
204
|
+
b9s machine run [--interval seconds] | once | build-images | status | prepare | service default 30s, 1..3600; prepare checks dsh availability/version (Linux has no DSH build)
|
|
177
205
|
b9s checkpoint "<title>" --body "..." a resume note without retiring: what you are doing, open threads, next steps;
|
|
178
206
|
your next session (after a move to another machine) reads it first
|
|
179
207
|
b9s antigravity bind <conversation-id> | sync which Antigravity conversation is you, for its hook (watchers bind theirs)
|
|
@@ -206,6 +234,7 @@ Agent commands
|
|
|
206
234
|
b9s item show|set|done|view|rm <id> item set: --status s [--if-status prev] --title --body --assign --evidence
|
|
207
235
|
b9s feedback "<text>" [--category bug|friction|idea|docs] [--command "<what you ran>"] [--body-file f|-]
|
|
208
236
|
tell BenignSwarm's maintainers what got in your way or what would help
|
|
237
|
+
b9s feedback get <id> read your feedback for 24 hours after sending
|
|
209
238
|
b9s skill install [--dir <path>] write the agent skill (default .claude/skills/b9s)
|
|
210
239
|
b9s skill print
|
|
211
240
|
|
|
@@ -231,15 +260,19 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
231
260
|
b9s-admin github status | disconnect <installation-id>
|
|
232
261
|
b9s-admin project github <project> status | unlink
|
|
233
262
|
b9s-admin project hosted-merge <project> enable|disable [--confirm-bypass-signal]
|
|
234
|
-
enable only after
|
|
263
|
+
enable only after exact ruleset verification in console and live bypass-change signal check; controls are also in console WU #196
|
|
264
|
+
b9s-admin project environment show <project> | setup <project> [--catalog family@version] [--assessment-only] [--context text] | set <project> --file declaration.json --source-commit <merged-sha>
|
|
265
|
+
setup queues one reviewed work unit; set records its merged declaration; catalog versions are x.y.z
|
|
266
|
+
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]
|
|
267
|
+
staged rollout, closed-issue retention, and operator alert settings (also in Account -> Environment)
|
|
268
|
+
b9s-admin environment retention run [--dry-run] | alerts [list|evaluate]
|
|
269
|
+
preview or prune closed issues past retention; inspect or evaluate cooled-down alerts
|
|
235
270
|
b9s-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
|
|
236
271
|
b9s-admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
|
|
237
|
-
b9s-admin agent --account list|role|
|
|
272
|
+
b9s-admin agent --account list|role|rotate-key|bench|unbench|delete ...
|
|
238
273
|
b9s-admin agent --account bench|unbench <agent> [--note <text>]
|
|
239
274
|
b9s-admin agent --account retire <agent> [--note <text> | --note-file <file>] --yes
|
|
240
275
|
b9s-admin agent list <project>
|
|
241
|
-
b9s-admin agent tier <project>/<agent> <routine|careful|expert> set the routing tier (unset agents are routine)
|
|
242
|
-
b9s-admin agent --account tier <agent> <routine|careful|expert> set an account-wide agent's tier
|
|
243
276
|
b9s-admin agent bench <project>/<agent> [--note <text>] suspend keys and free an active seat
|
|
244
277
|
b9s-admin agent unbench <project>/<agent> restore keys if a seat is available
|
|
245
278
|
b9s-admin agent retire <project>/<agent> [--note <text> | --note-file <file>] --yes revoke keys, release its units, optionally save a resume handoff
|
|
@@ -264,8 +297,8 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
264
297
|
b9s-admin channel create|delete <project> <name>
|
|
265
298
|
b9s-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
|
|
266
299
|
b9s-admin process show|export <project> [--out f] the process as agents are told it, or as an editable file
|
|
267
|
-
b9s-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules and
|
|
268
|
-
b9s-admin process tag add|edit|remove <project> <tag> [--meaning ..] [--
|
|
300
|
+
b9s-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version (including capabilities, review_rules, tag focus and heavy_jobs class declarations under definition)
|
|
301
|
+
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]
|
|
269
302
|
legacy project-first order also accepted; for operation-first with a project named add, edit, or remove:
|
|
270
303
|
b9s-admin process tag <op> <tag> --project <project>
|
|
271
304
|
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]
|
|
@@ -276,6 +309,8 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
276
309
|
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)
|
|
277
310
|
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
|
|
278
311
|
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
|
|
312
|
+
b9s-admin flow [--project <p>] [--from <UTC date/time>] [--to <UTC date/time>] [--json]
|
|
313
|
+
read-only state counts, waits, capacity, critical paths, attention, trends, freshness and coverage
|
|
279
314
|
b9s-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
|
|
280
315
|
--assign-outside-qualifications yes|no allow assigners in this role to make reasoned ownership exceptions; dispatch stays qualified
|
|
281
316
|
b9s-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
|
|
@@ -292,34 +327,53 @@ b9s-admin login (approve it in your signed-in browser); the session lasts 30 day
|
|
|
292
327
|
|
|
293
328
|
Machines (provisioned over your own ssh; a daemon on each runs the agent sessions you declare)
|
|
294
329
|
b9s-admin machine add <name> --ssh <host> [--rotate] [--codex-userns] [--bwrap-userns] install Node and b9s (no sudo), linger, harness login checks,
|
|
330
|
+
on macOS also check selected Xcode/license/SDKs, actual simulator runtimes, and disk;
|
|
295
331
|
b9s's Codex hooks in /etc/codex (passwordless sudo only), register, start the daemon;
|
|
296
332
|
--codex-userns: where Linux restricts user namespaces (Ubuntu 24.04+), install a
|
|
297
333
|
Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
|
|
298
334
|
for /usr/bin/bwrap (Claude Code's sandbox; broader: any local user may use it)
|
|
299
|
-
b9s-admin machine list | show <name> | remove <name>
|
|
335
|
+
b9s-admin machine list | show <name> | remove <name> [--preview] [--confirm <name> --impact-revision <revision>]
|
|
336
|
+
show includes host readiness, configured disk floors and named readiness refusals; removal previews sessions, work, keys, recovery blockers and replanned slots
|
|
337
|
+
the API requires a fresh revision for removal
|
|
338
|
+
b9s-admin machine companion run <handoff-code> [--confirm <name>] accept a 15-minute, single-use console operation; confirms locally and reports progress
|
|
300
339
|
b9s-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
|
|
301
340
|
15 min before, its agents away until the machine reports back after booting
|
|
341
|
+
b9s-admin machine resize <name> --type <t> [--instance-id <id>] [--drain-timeout 5m] [--yes] [--on-running-turn wait|proceed|abort] [--extend 5m] [--ssh <host>]
|
|
342
|
+
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
|
|
302
343
|
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]
|
|
344
|
+
[--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]
|
|
304
345
|
b9s-admin machine session thread <machine> <project>/<agent> <thread-id|none> set or clear the thread a pool session adopts
|
|
305
|
-
b9s-admin machine session stop|start|resume|limit|remove <machine> <project>/<agent>
|
|
346
|
+
b9s-admin machine session stop|start|resume|limit|coalesce|remove <machine> <project>/<agent> set its busy, unproductive, or coalescing limit
|
|
306
347
|
(change its count/settings, pause scaling, pin, or bench the agent)
|
|
307
|
-
b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> [--dir <path>|auto]
|
|
308
|
-
[--
|
|
309
|
-
|
|
310
|
-
|
|
348
|
+
b9s-admin agent move <project>/<agent> --to <machine> --sandbox <mode> --from local|<ssh host> [--dir <path>|auto]
|
|
349
|
+
[--harness codex|claude-code] [--provider anthropic|deepseek] [--carry note|thread]
|
|
350
|
+
[--model m] [--effort e] [--wait min] [--force --confirm-force <project>/<agent>]
|
|
351
|
+
opens a server move operation, checks the source worktrees and transfers context locally,
|
|
352
|
+
then commits the session only after handoff succeeds; work left on the source requires both flags
|
|
311
353
|
b9s-admin machine label <name> <label...> [--remove a,b] what cannot be measured (lab-lan, builds); pools' --needs match it
|
|
312
354
|
b9s-admin machine slots <name> <n | auto> how many sessions it takes (auto: one per 4 GB of RAM)
|
|
313
355
|
b9s-admin machine writable <name> <path...> | none folders workspace-write agents there may also write (~/.cargo, ~/.ester)
|
|
314
356
|
b9s-admin machine workdir <name> <path | default> where its daemon clones projects for pool sessions (default ~/bschat)
|
|
315
357
|
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
358
|
b9s-admin machine caches <name> <path...> | none [--tool auto|cargo|generic] [--processes cmd,...] declared build-cache directories managed by the daemon
|
|
359
|
+
b9s-admin machine readiness <name> [--project <p>] git identity, nested sandbox, IMDS block, harness logins/secrets, and image probe readiness (console in WU #200)
|
|
360
|
+
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 #200)
|
|
317
361
|
|
|
318
|
-
BYO AWS cloud machines (the connection is account-scoped; AWS bills the account directly)
|
|
362
|
+
BYO AWS cloud machines (the connection is account-scoped; AWS bills the account directly; console controls in WU #200)
|
|
319
363
|
b9s-admin cloud connect --file connection.json connect an IAM role, show its external ID once, and print the reviewed trust/permissions policies
|
|
320
364
|
b9s-admin cloud show | policy | test | disconnect
|
|
321
|
-
b9s-admin cloud
|
|
365
|
+
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
|
|
366
|
+
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)
|
|
367
|
+
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
|
|
322
368
|
b9s-admin cloud operations | inspect <operation-id> | terminate <operation-id> --reason <why> terminate refuses unless signed ownership proof and immutable tags verify
|
|
369
|
+
Cloud audit history and recovery-hold resolution are available in the signed-in operator console; the account provisioning switch blocks launches while allowing safe drain and termination.
|
|
370
|
+
|
|
371
|
+
Project devcontainer images & immutable registry builds (console controls in WU #200)
|
|
372
|
+
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
|
|
373
|
+
b9s-admin project image config <project> [--path <path>] [--arch linux/amd64|linux/arm64] [--cache name,...] configure immutable per-account image registry & build cache allowlist
|
|
374
|
+
b9s-admin project image show <project> active digest, rollback target, latest build, and image capability probes
|
|
375
|
+
b9s-admin project image build <project> --commit <sha> --file <.devcontainer/devcontainer.json> [--dockerfile Dockerfile] [--arch <arch>] validate recipe and record immutable build request
|
|
376
|
+
b9s-admin project image rollback <project> (<sha256:...> | clear) select a previously ready digest in the same account/project without mutating tags
|
|
323
377
|
|
|
324
378
|
Pools (a role, variants and a count; the server names the agents and places them on machines)
|
|
325
379
|
b9s-admin project repo <project> <git url | none> what machines clone for the project's pool sessions
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,8 @@ import { loadAgent, resolveAgentName } from "./config.js";
|
|
|
32
32
|
import { agentNotice } from "./commands/notices.js";
|
|
33
33
|
import { versionLine, warnLegacyAlias } from "./legacy-alias.js";
|
|
34
34
|
import { gitCredentialMain } from "./commands/git-credential.js";
|
|
35
|
+
import { templates } from "./commands/templates.js";
|
|
36
|
+
import { environment } from "./commands/environment.js";
|
|
35
37
|
const COMMANDS = {
|
|
36
38
|
join,
|
|
37
39
|
setup,
|
|
@@ -41,6 +43,8 @@ const COMMANDS = {
|
|
|
41
43
|
me: a.me,
|
|
42
44
|
resume,
|
|
43
45
|
"git-credential": async (p) => gitCredentialMain(p),
|
|
46
|
+
templates,
|
|
47
|
+
environment,
|
|
44
48
|
notice: agentNotice,
|
|
45
49
|
who: a.who,
|
|
46
50
|
status: a.status,
|
|
@@ -106,7 +110,7 @@ const COMMANDS = {
|
|
|
106
110
|
// These commands establish identity, own their startup validation, or inspect/change only local
|
|
107
111
|
// machine state. Their dispatch must run before any notice lookup attempts to load an agent.
|
|
108
112
|
const NOTICE_PREFLIGHT_EXEMPT_COMMANDS = new Set([
|
|
109
|
-
"join", "setup", "login", "logout", "identities", "skill", "hook", "machine", "install", "doctor", "update", "version", "admin", "start", "git-credential",
|
|
113
|
+
"join", "setup", "login", "logout", "identities", "skill", "hook", "machine", "install", "doctor", "update", "version", "admin", "start", "git-credential", "templates",
|
|
110
114
|
]);
|
|
111
115
|
let invokedCommand;
|
|
112
116
|
async function main(argv) {
|
package/dist/install.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawnSync } from "node:child_process";
|
|
2
|
-
import { existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { accessSync, constants, existsSync, lstatSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { homedir, userInfo } from "node:os";
|
|
4
4
|
import { basename, delimiter, dirname, join, resolve } from "node:path";
|
|
5
5
|
import { configRoot } from "./config.js";
|
|
6
6
|
import { CliError } from "./errors.js";
|
|
7
7
|
import { cmp } from "./update.js";
|
|
8
|
+
import { CLI_VERSION } from "./version.js";
|
|
8
9
|
export const installFile = () => join(configRoot(), "install.json");
|
|
9
10
|
export function readInstall() {
|
|
10
11
|
const p = installFile();
|
|
@@ -34,6 +35,47 @@ export function requireInstall() {
|
|
|
34
35
|
}
|
|
35
36
|
return r;
|
|
36
37
|
}
|
|
38
|
+
function findExecutableOnPath(command, pathEnv) {
|
|
39
|
+
for (const dir of pathEnv.split(delimiter).filter(Boolean)) {
|
|
40
|
+
const candidate = join(dir, command);
|
|
41
|
+
try {
|
|
42
|
+
if (!statSync(candidate).isFile())
|
|
43
|
+
continue;
|
|
44
|
+
accessSync(candidate, constants.X_OK);
|
|
45
|
+
return candidate;
|
|
46
|
+
}
|
|
47
|
+
catch {
|
|
48
|
+
// continue scanning container PATH
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Provisions a container-local install.json pointing exclusively to the b9s executable on the
|
|
55
|
+
* container PATH (never capturing a host binary path). Idempotent when the existing record
|
|
56
|
+
* already references a live container b9s executable at the current CLI version.
|
|
57
|
+
*/
|
|
58
|
+
export function provisionContainerInstallRecord(pathEnv = process.env.PATH ?? "") {
|
|
59
|
+
const existing = readInstall();
|
|
60
|
+
if (existing && existsSync(existing.bin) && basename(existing.bin) === "b9s" && existing.version === CLI_VERSION) {
|
|
61
|
+
return requireInstall();
|
|
62
|
+
}
|
|
63
|
+
const bin = findExecutableOnPath("b9s", pathEnv);
|
|
64
|
+
if (!bin) {
|
|
65
|
+
throw new CliError("not_installed", "b9s executable was not found on container PATH", "Ensure b9s is installed on PATH inside the container image");
|
|
66
|
+
}
|
|
67
|
+
const npm = findExecutableOnPath("npm", pathEnv) ?? "npm";
|
|
68
|
+
const record = {
|
|
69
|
+
bin,
|
|
70
|
+
npm,
|
|
71
|
+
version: CLI_VERSION,
|
|
72
|
+
installed_at: new Date().toISOString(),
|
|
73
|
+
};
|
|
74
|
+
const file = installFile();
|
|
75
|
+
mkdirSync(dirname(file), { recursive: true });
|
|
76
|
+
writeFileSync(file, JSON.stringify(record, null, 2) + "\n");
|
|
77
|
+
return requireInstall();
|
|
78
|
+
}
|
|
37
79
|
/** Build the environment installed for the machine daemon and used by its harness checks. */
|
|
38
80
|
export function composeMachinePath(options) {
|
|
39
81
|
const isDirectory = options.exists ?? ((path) => {
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { spawnSync } from "node:child_process";
|
|
2
|
+
import { existsSync, statfsSync } from "node:fs";
|
|
3
|
+
import { arch, homedir } from "node:os";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
import { DEFAULT_CACHE_FLOOR_PCT } from "./build-caches.js";
|
|
6
|
+
const runDefault = (path) => (command, args) => {
|
|
7
|
+
const result = spawnSync(command, args, { encoding: "utf8", timeout: 30_000, maxBuffer: 2 * 1024 * 1024, env: path ? { ...process.env, PATH: path } : process.env });
|
|
8
|
+
return { status: result.status, stdout: result.stdout ?? "", stderr: result.stderr ?? "" };
|
|
9
|
+
};
|
|
10
|
+
function firstLine(value) {
|
|
11
|
+
return value.trim().split(/\r?\n/, 1)[0]?.trim() || null;
|
|
12
|
+
}
|
|
13
|
+
function commandOutput(run, command, args) {
|
|
14
|
+
try {
|
|
15
|
+
const result = run(command, args);
|
|
16
|
+
const output = result.stdout.trim();
|
|
17
|
+
const detail = firstLine(result.stderr) ?? firstLine(result.stdout) ?? `exit ${result.status ?? "unknown"}`;
|
|
18
|
+
return { ok: result.status === 0, output, error: result.status === 0 ? null : `${command} ${args.join(" ")}: ${detail}`.slice(0, 300) };
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
return { ok: false, output: "", error: `${command} ${args.join(" ")}: ${error.message}`.slice(0, 300) };
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function diskFact(path, stat, floorPct) {
|
|
25
|
+
try {
|
|
26
|
+
const fs = stat(existsSync(path) ? path : dirname(path));
|
|
27
|
+
const free = fs.bavail * fs.bsize;
|
|
28
|
+
const total = fs.blocks * fs.bsize;
|
|
29
|
+
const valid = Number.isFinite(free) && Number.isFinite(total) && total > 0;
|
|
30
|
+
const freePct = valid ? (free / total) * 100 : null;
|
|
31
|
+
return {
|
|
32
|
+
path, free_bytes: valid ? free : null, total_bytes: valid ? total : null,
|
|
33
|
+
free_pct: freePct === null ? null : Math.round(freePct * 100) / 100,
|
|
34
|
+
floor_pct: floorPct, threshold_source: "machine cache floor",
|
|
35
|
+
status: freePct === null ? "unknown" : freePct < floorPct ? "below_floor" : "ready",
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
function platformFromIdentifier(identifier, fallback) {
|
|
43
|
+
const match = /^com\.apple\.CoreSimulator\.SimRuntime\.([A-Za-z]+)-/.exec(identifier);
|
|
44
|
+
return match?.[1]?.toLowerCase() ?? fallback?.replace(/\s+Simulator$/i, "").toLowerCase() ?? "unknown";
|
|
45
|
+
}
|
|
46
|
+
function runtimesFromJson(raw, devicesRaw, stat, floorPct) {
|
|
47
|
+
let json;
|
|
48
|
+
let devices;
|
|
49
|
+
try {
|
|
50
|
+
json = JSON.parse(raw);
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return { runtimes: [], error: "simctl runtimes returned invalid JSON" };
|
|
54
|
+
}
|
|
55
|
+
let devicesValid = true;
|
|
56
|
+
try {
|
|
57
|
+
devices = JSON.parse(devicesRaw);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
devices = null;
|
|
61
|
+
devicesValid = false;
|
|
62
|
+
}
|
|
63
|
+
if (!Array.isArray(json?.runtimes))
|
|
64
|
+
return { runtimes: [], error: "simctl runtimes JSON has no runtimes list" };
|
|
65
|
+
const groups = devices?.devices && typeof devices.devices === "object" ? devices.devices : {};
|
|
66
|
+
const runtimes = json.runtimes.flatMap((value) => {
|
|
67
|
+
const identifier = typeof value?.identifier === "string" ? value.identifier : typeof value?.runtimeIdentifier === "string" ? value.runtimeIdentifier : null;
|
|
68
|
+
if (!identifier)
|
|
69
|
+
return [];
|
|
70
|
+
const runtimeDevices = Array.isArray(groups[identifier]) ? groups[identifier] : [];
|
|
71
|
+
const bundlePath = typeof value.bundlePath === "string" ? value.bundlePath : null;
|
|
72
|
+
const available = value.isAvailable === true;
|
|
73
|
+
return [{
|
|
74
|
+
platform: platformFromIdentifier(identifier, value.platform),
|
|
75
|
+
identifier,
|
|
76
|
+
version: typeof value.version === "string" ? value.version : null,
|
|
77
|
+
build: typeof value.buildversion === "string" ? value.buildversion : null,
|
|
78
|
+
available,
|
|
79
|
+
available_devices: devicesValid ? runtimeDevices.filter((device) => device?.isAvailable === true).length : null,
|
|
80
|
+
bundle_path: bundlePath,
|
|
81
|
+
disk: bundlePath ? diskFact(bundlePath, stat, floorPct) : null,
|
|
82
|
+
error: available ? null : "runtime is installed but simctl marks it unavailable",
|
|
83
|
+
}];
|
|
84
|
+
});
|
|
85
|
+
return { runtimes, error: devicesValid ? null : "simctl devices returned invalid JSON" };
|
|
86
|
+
}
|
|
87
|
+
/** Read-only macOS/Xcode facts; probes never select Xcode, install runtimes, or accept licenses. */
|
|
88
|
+
export function macReadiness(options = {}) {
|
|
89
|
+
const run = options.run ?? runDefault(options.path);
|
|
90
|
+
const stat = options.stat ?? ((path) => {
|
|
91
|
+
const fs = statfsSync(path);
|
|
92
|
+
return { bavail: fs.bavail, bsize: fs.bsize, blocks: fs.blocks };
|
|
93
|
+
});
|
|
94
|
+
const home = options.home ?? homedir();
|
|
95
|
+
const checkout = options.checkout ?? `${home}/bschat`;
|
|
96
|
+
const floorPct = Number.isInteger(options.diskFloorPct) && options.diskFloorPct >= 1 && options.diskFloorPct <= 90
|
|
97
|
+
? options.diskFloorPct
|
|
98
|
+
: DEFAULT_CACHE_FLOOR_PCT;
|
|
99
|
+
const product = commandOutput(run, "sw_vers", ["-productVersion"]);
|
|
100
|
+
const build = commandOutput(run, "sw_vers", ["-buildVersion"]);
|
|
101
|
+
const model = commandOutput(run, "sysctl", ["-n", "hw.model"]);
|
|
102
|
+
const hardwareArch = commandOutput(run, "sysctl", ["-n", "hw.machine"]);
|
|
103
|
+
const selected = commandOutput(run, "xcode-select", ["-p"]);
|
|
104
|
+
const xcodeVersion = commandOutput(run, "xcodebuild", ["-version"]);
|
|
105
|
+
const sdkList = commandOutput(run, "xcodebuild", ["-showsdks"]);
|
|
106
|
+
const license = selected.ok && xcodeVersion.ok
|
|
107
|
+
? commandOutput(run, "xcodebuild", ["-license", "check"])
|
|
108
|
+
: { ok: false, output: "", error: "cannot check Xcode license without a selected Xcode" };
|
|
109
|
+
const runtimeList = commandOutput(run, "xcrun", ["simctl", "list", "runtimes", "--json"]);
|
|
110
|
+
const deviceList = commandOutput(run, "xcrun", ["simctl", "list", "devices", "--json"]);
|
|
111
|
+
const version = /^Xcode\s+(.+)$/mi.exec(xcodeVersion.output)?.[1]?.trim() ?? null;
|
|
112
|
+
const xcodeBuild = /^Build version\s+(.+)$/mi.exec(xcodeVersion.output)?.[1]?.trim() ?? null;
|
|
113
|
+
const sdks = sdkList.ok ? sdkList.output.split(/\r?\n/).map((line) => line.trim()).filter((line) => /^.+\s+-sdk\s+\S+/i.test(line)).map((line) => line.slice(0, 200)) : [];
|
|
114
|
+
const simulatorJson = runtimeList.ok
|
|
115
|
+
? runtimesFromJson(runtimeList.output, deviceList.ok ? deviceList.output : "", stat, floorPct)
|
|
116
|
+
: { runtimes: [], error: runtimeList.error ?? "simctl runtimes probe failed" };
|
|
117
|
+
const simulatorError = !runtimeList.ok ? runtimeList.error : !deviceList.ok ? deviceList.error : simulatorJson.error;
|
|
118
|
+
const licenseAccepted = license.ok ? true : /not\s+agreed|license.{0,50}(not accepted|unaccepted)|must accept/i.test(license.error ?? "") ? false : null;
|
|
119
|
+
const xcodeReady = selected.ok && !!selected.output && xcodeVersion.ok && !!version && !!xcodeBuild && sdkList.ok && sdks.length > 0 && licenseAccepted === true;
|
|
120
|
+
const macVersion = product.ok ? firstLine(product.output) : null;
|
|
121
|
+
const machineArch = options.architecture ?? (hardwareArch.ok ? firstLine(hardwareArch.output) : null) ?? arch();
|
|
122
|
+
const homeDisk = diskFact(home, stat, floorPct);
|
|
123
|
+
const checkoutDisk = diskFact(checkout, stat, floorPct);
|
|
124
|
+
const buildRefusals = [volumeRefusal("home", homeDisk), volumeRefusal("checkout/build", checkoutDisk)].filter((value) => value !== null);
|
|
125
|
+
const simulatorRefusals = [...buildRefusals, ...simulatorJson.runtimes.flatMap((runtime) => {
|
|
126
|
+
if (!runtime.available || runtime.disk?.status === "ready")
|
|
127
|
+
return [];
|
|
128
|
+
return [volumeRefusal(`${runtime.platform} ${runtime.version ?? runtime.identifier} simulator runtime`, runtime.disk)];
|
|
129
|
+
})];
|
|
130
|
+
return {
|
|
131
|
+
product_version: macVersion,
|
|
132
|
+
product_build: build.ok ? firstLine(build.output) : null,
|
|
133
|
+
model: model.ok ? firstLine(model.output) : null,
|
|
134
|
+
architecture: machineArch,
|
|
135
|
+
developer_directory: selected.ok ? firstLine(selected.output) : null,
|
|
136
|
+
developer_directory_ok: selected.ok && !!selected.output,
|
|
137
|
+
xcode: { version, build: xcodeBuild, sdks, license_accepted: licenseAccepted, ready: xcodeReady, error: !xcodeReady ? [selected.error, xcodeVersion.error, sdkList.error, license.error, licenseAccepted === false ? "Xcode license is not accepted (accept it interactively as the machine owner)" : null].filter(Boolean).join("; ").slice(0, 500) || "selected Xcode is incomplete" : null },
|
|
138
|
+
simulators: { probe_ok: runtimeList.ok && deviceList.ok && !simulatorJson.error, runtimes: simulatorJson.runtimes, error: simulatorError },
|
|
139
|
+
disk: { home: homeDisk, checkout_build: checkoutDisk },
|
|
140
|
+
disk_policy: { floor_pct: floorPct, source: "machine cache floor" },
|
|
141
|
+
readiness_refusals: { build: buildRefusals, simulators: simulatorRefusals },
|
|
142
|
+
capabilities: {
|
|
143
|
+
mac: { ok: !!macVersion, version: macVersion },
|
|
144
|
+
architecture: { ok: !!machineArch, version: machineArch },
|
|
145
|
+
xcode: { ok: xcodeReady && buildRefusals.length === 0, version },
|
|
146
|
+
simulators: simulatorJson.runtimes.map((runtime) => ({ platform: runtime.platform, runtime: runtime.identifier, ok: xcodeReady && simulatorJson.error === null && runtime.available && runtime.disk?.status === "ready" && buildRefusals.length === 0, version: runtime.version, build: runtime.build })),
|
|
147
|
+
},
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
function volumeRefusal(name, disk) {
|
|
151
|
+
if (disk?.status === "ready")
|
|
152
|
+
return null;
|
|
153
|
+
const reason = disk?.status === "below_floor"
|
|
154
|
+
? `${disk.free_pct}% free is below the machine cache floor`
|
|
155
|
+
: "free space is unknown against the machine cache floor";
|
|
156
|
+
return `refuse new ${name.includes("simulator runtime") ? "simulator" : "build/simulator"} work: ${name} ${reason} ${disk?.floor_pct ?? DEFAULT_CACHE_FLOOR_PCT}% (source: ${disk?.threshold_source ?? "machine cache floor"})`;
|
|
157
|
+
}
|
|
158
|
+
function diskReadinessDetail(name, disk) {
|
|
159
|
+
const refusal = volumeRefusal(name, disk);
|
|
160
|
+
if (refusal)
|
|
161
|
+
return refusal;
|
|
162
|
+
return `${disk.free_pct}% free (${Math.round(disk.free_bytes / 1e9)} GB of ${Math.round(disk.total_bytes / 1e9)} GB), above machine cache floor ${disk.floor_pct}% (source: ${disk.threshold_source})`;
|
|
163
|
+
}
|
|
164
|
+
export function macReadinessSteps(facts) {
|
|
165
|
+
const steps = [
|
|
166
|
+
{ step: "macOS", result: facts.capabilities.mac.ok ? "ok" : "failed", detail: facts.product_version ? `${facts.product_version} (${facts.product_build ?? "build unknown"}), ${facts.model ?? "model unknown"}, ${facts.architecture}` : "macOS version probe failed" },
|
|
167
|
+
{ step: "Xcode selection", result: facts.developer_directory_ok ? "ok" : "failed", detail: facts.developer_directory ?? "xcode-select has no valid developer directory; select one as the machine owner" },
|
|
168
|
+
{ step: "Xcode readiness", result: facts.xcode.ready ? "ok" : "failed", detail: facts.xcode.ready ? `Xcode ${facts.xcode.version} (${facts.xcode.build}); SDKs ${facts.xcode.sdks.join(", ")}; license accepted` : facts.xcode.error ?? "Xcode is not ready" },
|
|
169
|
+
{ step: "simulator runtimes", result: facts.xcode.ready && facts.simulators.probe_ok && facts.simulators.runtimes.some((runtime) => runtime.available && runtime.disk?.status === "ready" && facts.readiness_refusals.build.length === 0) ? "ok" : "failed", detail: `${facts.xcode.ready ? "" : `blocked: Xcode is not ready (${facts.xcode.error ?? "readiness probe failed"}); `}${facts.simulators.runtimes.length ? facts.simulators.runtimes.map((runtime) => `${runtime.platform} ${runtime.version ?? "version unknown"} (${runtime.build ?? "build unknown"}) ${runtime.available ? runtime.disk?.status === "ready" && facts.readiness_refusals.build.length === 0 ? `available; runtime volume ${runtime.disk.free_pct}% free vs ${runtime.disk.floor_pct}% machine cache floor` : volumeRefusal(`${runtime.platform} ${runtime.version ?? runtime.identifier} simulator runtime`, runtime.disk) ?? "build volumes below machine cache floor" : "unavailable"}`).join("; ") : "no simulator runtimes are installed"}${facts.simulators.error ? `; ${facts.simulators.error}` : ""}` },
|
|
170
|
+
{ step: "Mac disk", result: facts.readiness_refusals.build.length === 0 ? "ok" : "failed", detail: `home: ${diskReadinessDetail("home", facts.disk.home)}; checkout/build: ${diskReadinessDetail("checkout/build", facts.disk.checkout_build)}` },
|
|
171
|
+
];
|
|
172
|
+
return steps;
|
|
173
|
+
}
|
package/dist/output.js
CHANGED
|
@@ -1,11 +1,23 @@
|
|
|
1
|
+
function receiptLine(data) {
|
|
2
|
+
const receipts = Array.isArray(data?.receipts) ? data.receipts : data?.receipt ? [data.receipt] : [];
|
|
3
|
+
if (!receipts.length)
|
|
4
|
+
return null;
|
|
5
|
+
return receipts.map((r) => {
|
|
6
|
+
const label = receipts.length > 1 && typeof r.field === "string" ? ` ${r.field}` : "";
|
|
7
|
+
return `stored${label} ${r.bytes_stored} bytes, sha256 ${(String(r.sha256 ?? "")).slice(0, 12)}`;
|
|
8
|
+
}).join("; ");
|
|
9
|
+
}
|
|
1
10
|
export function makeOut(json) {
|
|
2
11
|
return {
|
|
3
12
|
json,
|
|
4
13
|
print(human, data) {
|
|
5
14
|
if (json)
|
|
6
15
|
process.stdout.write(JSON.stringify(data, null, 2) + "\n");
|
|
7
|
-
else
|
|
8
|
-
|
|
16
|
+
else {
|
|
17
|
+
const receipt = receiptLine(data);
|
|
18
|
+
const text = receipt ? `${human}\n${receipt}` : human;
|
|
19
|
+
process.stdout.write(text.endsWith("\n") ? text : text + "\n");
|
|
20
|
+
}
|
|
9
21
|
},
|
|
10
22
|
};
|
|
11
23
|
}
|
|
@@ -16,9 +28,8 @@ export function fmtMessage(m) {
|
|
|
16
28
|
}
|
|
17
29
|
export function fmtStatus(s) {
|
|
18
30
|
const parts = [
|
|
19
|
-
`${s.state === "benched" ? "BENCHED " : ""}${s.agent_name}${s.role_name ? `[${s.role_name}]` : ""}${s.away ? ` (away until ${s.away.until}: ${s.away.reason})` : s.liveness === "quiet" ? " (quiet: harness went silent)" : s.liveness === "unknown" ? " (stale, harness unmonitored)" : s.liveness === "scheduled" ? ` (checks every ${s.checks_every} min, next ${(s.next_check_at ?? "").slice(11, 16)} UTC)` : s.liveness === "missed" ? ` (missed its ${s.checks_every}-min check)` : ""}`,
|
|
31
|
+
`${s.state === "benched" ? "BENCHED " : ""}${s.agent_name}${s.role_name ? `[${s.role_name}]` : ""}${s.away ? ` (away until ${s.away.until}: ${s.away.reason})` : s.usage_limit_until ? ` (usage limit until ${s.usage_limit_until})` : s.liveness === "quiet" ? " (quiet: harness went silent)" : s.liveness === "unknown" ? " (stale, harness unmonitored)" : s.liveness === "scheduled" ? ` (checks every ${s.checks_every} min, next ${(s.next_check_at ?? "").slice(11, 16)} UTC)` : s.liveness === "missed" ? ` (missed its ${s.checks_every}-min check)` : ""}`,
|
|
20
32
|
`state=${s.state ?? "-"}`,
|
|
21
|
-
`tier=${s.tier ?? "routine"}`,
|
|
22
33
|
s.goal ? `goal="${s.goal}"` : null,
|
|
23
34
|
s.task ? `task="${s.task}"` : null,
|
|
24
35
|
s.blocked_on ? `blocked_on="${s.blocked_on}"` : null,
|