benignswarm 0.12.23 → 0.12.25

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.
@@ -0,0 +1,34 @@
1
+ #!/usr/bin/env node
2
+ import { bool, parse } from "./args.js";
3
+ import { admin } from "./commands/admin.js";
4
+ import { CliError } from "./errors.js";
5
+ import { ADMIN_HELP } from "./help.js";
6
+ import { AGENT_ORIENTATION } from "./commands/operator.js";
7
+ import { makeOut } from "./output.js";
8
+ import { CLI_VERSION } from "./version.js";
9
+ /** bschat-admin: the operator binary. Agents use bschat, whose help never lists these. */
10
+ async function main(argv) {
11
+ // For an AI agent driving this tool: what it is, and how to load the operator skill. Checked
12
+ // before parsing because --agent also takes a value elsewhere (notifier --agent <name>).
13
+ if (argv[0] === "--agent") {
14
+ process.stdout.write(AGENT_ORIENTATION);
15
+ return 0;
16
+ }
17
+ const p = parse(argv);
18
+ const out = makeOut(bool(p.flags, "json"));
19
+ if (bool(p.flags, "version")) {
20
+ process.stdout.write(`bschat-admin ${CLI_VERSION}\n`);
21
+ return 0;
22
+ }
23
+ if (!p.positionals[0] || bool(p.flags, "help")) {
24
+ process.stdout.write(ADMIN_HELP);
25
+ return p.positionals[0] ? 0 : 2;
26
+ }
27
+ await admin({ ...p, positionals: ["admin", ...p.positionals] }, out);
28
+ return 0;
29
+ }
30
+ main(process.argv.slice(2)).then((code) => process.exit(code), (err) => {
31
+ const e = err instanceof CliError ? { error: err.code, message: err.message, hint: err.hint } : { error: "internal", message: err instanceof Error ? err.stack ?? err.message : String(err) };
32
+ process.stderr.write(JSON.stringify(e) + "\n");
33
+ process.exit(1);
34
+ });
package/dist/args.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { parseArgs } from "node:util";
2
2
  import { CliError } from "./errors.js";
3
- export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks"];
3
+ export const STRING_FLAGS = ["as", "admin", "key", "url", "label", "model", "since", "limit", "after", "topic", "goal", "task", "state", "blocked-on", "tags", "custom", "vendor", "role", "description", "permissions", "cardinality", "machine", "dir", "confirm", "type", "name", "out", "token", "prefix", "uses", "expires-hours", "skill-dir", "harness", "reply-to", "event", "project", "projects", "post", "title", "body", "body-file", "handoff-to", "evidence", "agent", "parent", "parent-item", "channel", "statuses", "assign", "if-status", "status", "exec", "interval", "requeue-after", "category", "command", "follow-delay", "env", "scope", "pr", "note", "add", "remove", "merged", "tag", "activity", "max-unanswered", "to", "replay-of", "branch", "effort", "by", "target", "milestone", "file", "exit", "depends-on", "source", "by", "on", "question", "ruling", "gaps", "unit", "units", "blocks", "sla", "takeover", "max-open", "max-in-progress", "require-scope", "require-evidence", "default-approver", "merged-by", "integrator-role", "require-rebased", "require-merge-commit", "require-pushed", "quiet", "summary", "meaning", "expert-role", "reviews", "works", "trials", "email", "repeat", "summary-minutes"];
4
4
  export const BOOL_FLAGS = ["json", "follow", "account", "help", "version", "broadcast", "create-channels", "read-account-status", "replace-key", "mentions-me", "no-skill", "replace", "unread", "force", "no-hooks", "yes", "open", "bind-here", "peek", "once", "launchd", "full", "no-bind", "all", "here", "keep-worktree", "prune", "abandon", "hold", "clear", "met", "shared"];
5
5
  export function parse(argv) {
6
6
  const options = {};
@@ -1,9 +1,12 @@
1
1
  import { CLI_VERSION } from "../version.js";
2
2
  import { bool, need, str } from "../args.js";
3
3
  import { Client } from "../client.js";
4
- import { DEFAULT_URL, loadAdmin, resolveAdminName, saveAdmin } from "../config.js";
4
+ import { DEFAULT_URL, forgetAdmin, loadAdmin, resolveAdminName, saveAdmin } from "../config.js";
5
+ import { hostname } from "node:os";
6
+ import { spawnSync } from "node:child_process";
5
7
  import { CliError } from "../errors.js";
6
8
  import { table } from "../output.js";
9
+ import { accountAdmin, answerAdmin, keysAdmin, needsAdmin, notifierAdmin, processAdmin, skillAdmin, tagList, worktreeAdmin } from "./operator.js";
7
10
  function adminClient(p) {
8
11
  return Client.forAdmin(loadAdmin(resolveAdminName(str(p.flags, "admin"))));
9
12
  }
@@ -11,13 +14,15 @@ export async function admin(p, out) {
11
14
  const [, group, action, ...rest] = p.positionals;
12
15
  switch (group) {
13
16
  case "login": {
17
+ const url = (str(p.flags, "url") ?? process.env.BSCHAT_URL ?? DEFAULT_URL).replace(/\/$/, "");
18
+ if (str(p.flags, "key") === undefined)
19
+ return browserLogin(url, str(p.flags, "email") ?? null, str(p.flags, "as") ?? "default", out);
14
20
  const nick = str(p.flags, "as");
15
21
  if (!nick)
16
- throw new CliError("usage", "admin login --as <nickname> --key <bs_admin_...>");
22
+ throw new CliError("usage", "bschat-admin login (approve in your browser) or, for scripts and CI: --as <nickname> --key <bs_admin_...>");
17
23
  const key = need(p.flags, "key");
18
24
  if (!key.startsWith("bs_admin_"))
19
25
  throw new CliError("usage", "admin login expects an admin key (bs_admin_...)");
20
- const url = (str(p.flags, "url") ?? process.env.BSCHAT_URL ?? DEFAULT_URL).replace(/\/$/, "");
21
26
  const me = await Client.raw(url, key).call("GET", "/me");
22
27
  if (me.kind !== "admin")
23
28
  throw new CliError("bad_key", "key is not an admin key");
@@ -25,6 +30,15 @@ export async function admin(p, out) {
25
30
  out.print(`Saved admin login ${nick} to ${path}\nNext: export BSCHAT_ADMIN=${nick}`, { saved: path });
26
31
  return;
27
32
  }
33
+ case "logout": {
34
+ const nick = resolveAdminName(str(p.flags, "as") ?? str(p.flags, "admin"));
35
+ const creds = loadAdmin(nick);
36
+ if (creds.key.startsWith("bs_cli_"))
37
+ await Client.raw(creds.url, creds.key).call("POST", "/auth/cli/logout", {});
38
+ forgetAdmin(nick);
39
+ out.print(`Signed out ${nick}${creds.key.startsWith("bs_cli_") ? " and ended its session" : " (an admin key stays valid until revoked: bschat-admin keys revoke <id>)"}.`, { signed_out: nick });
40
+ return;
41
+ }
28
42
  case "signup": {
29
43
  const url = (str(p.flags, "url") ?? process.env.BSCHAT_URL ?? DEFAULT_URL).replace(/\/$/, "");
30
44
  const code = need(p.flags, "key");
@@ -35,7 +49,7 @@ export async function admin(p, out) {
35
49
  const json = await res.json();
36
50
  if (!res.ok)
37
51
  throw new CliError(json.error, json.message);
38
- out.print(`Account ${json.account.name} created.\nAdmin key (shown once): ${json.admin_key}\nNext: bschat admin login --as ${name} --key ${json.admin_key} --url ${url}`, json);
52
+ out.print(`Account ${json.account.name} created.\nAdmin key (shown once): ${json.admin_key}\nNext: bschat-admin login --as ${name} --key ${json.admin_key} --url ${url}`, json);
39
53
  return;
40
54
  }
41
55
  case "project":
@@ -48,11 +62,22 @@ export async function admin(p, out) {
48
62
  return channel(action, rest, p, out);
49
63
  case "enroll":
50
64
  return enroll(action, rest, p, out);
51
- case "keys": {
52
- const r = await adminClient(p).call("GET", "/account/keys");
53
- out.print(table(r.keys, ["id", "kind", "prefix", "agent_name", "project_name", "machine", "created_at", "revoked_at"]), r);
54
- return;
55
- }
65
+ case "keys":
66
+ return keysAdmin(action, rest, p, out);
67
+ case "process":
68
+ return processAdmin(action, rest, p, out);
69
+ case "needs":
70
+ return needsAdmin(p, out);
71
+ case "answer":
72
+ return answerAdmin([action, ...rest].filter((x) => x !== undefined), p, out);
73
+ case "notifier":
74
+ return notifierAdmin(p, out);
75
+ case "account":
76
+ return accountAdmin(p, out);
77
+ case "worktree":
78
+ return worktreeAdmin(action, rest, p, out);
79
+ case "skill":
80
+ return skillAdmin(action, p, out);
56
81
  case "delete-account": {
57
82
  const confirm = str(p.flags, "confirm");
58
83
  if (confirm !== "delete everything")
@@ -169,13 +194,13 @@ async function role(action, rest, p, out) {
169
194
  const base = proj ? `/projects/${proj}/roles` : "/roles";
170
195
  if (action === "list") {
171
196
  const r = await c.call("GET", base);
172
- const rows = r.roles.map((x) => ({ name: x.name, scope: x.project_id ? "project" : "account", cardinality: x.cardinality, projects: x.project_id ? "(own)" : (x.permissions.projects ?? []).join(",") || "(none)", post: x.permissions.post_channels.join(","), broadcast: x.permissions.broadcast, create_channels: x.permissions.create_channels, read_account_status: x.permissions.read_account_status }));
173
- out.print(table(rows, ["name", "scope", "cardinality", "projects", "post", "broadcast", "create_channels", "read_account_status"]), r);
197
+ const rows = r.roles.map((x) => ({ name: x.name, scope: x.project_id ? "project" : "account", reviews: (x.reviews ?? []).join(",") || "-", works: (x.works ?? []).join(",") || "-", trials: (x.trials ?? []).join(",") || "-", cardinality: x.cardinality, projects: x.project_id ? "(own)" : (x.permissions.projects ?? []).join(",") || "(none)", post: x.permissions.post_channels.join(","), broadcast: x.permissions.broadcast, create_channels: x.permissions.create_channels, read_account_status: x.permissions.read_account_status }));
198
+ out.print(table(rows, ["name", "scope", "reviews", "works", "trials", "cardinality", "projects", "post", "broadcast", "create_channels", "read_account_status"]), r);
174
199
  }
175
200
  else if (action === "create" && rest[0]) {
176
201
  const permissions = permsFromFlags(p, !!proj) ?? { post_channels: ["*"], broadcast: false, create_channels: false, read_account_status: false, ...(proj ? {} : { projects: [] }) };
177
- const r = await c.call("POST", base, { name: rest[0], description: str(p.flags, "description") ?? "", permissions, cardinality: str(p.flags, "cardinality") ?? "many" });
178
- out.print(`created ${proj ? "project" : "account"} role ${r.role.name}${!proj ? ` (projects: ${r.role.permissions.projects.join(",") || "none; set with: bschat admin role edit ${r.role.name} --projects a,b or '*'"})` : ""}`, r);
202
+ const r = await c.call("POST", base, { name: rest[0], description: str(p.flags, "description") ?? "", permissions, cardinality: str(p.flags, "cardinality") ?? "many", reviews: tagList(str(p.flags, "reviews")) ?? [], works: tagList(str(p.flags, "works")) ?? [], trials: tagList(str(p.flags, "trials")) ?? [] });
203
+ out.print(`created ${proj ? "project" : "account"} role ${r.role.name}${!proj ? ` (projects: ${r.role.permissions.projects.join(",") || "none; set with: bschat-admin role edit ${r.role.name} --projects a,b or '*'"})` : ""}`, r);
179
204
  }
180
205
  else if (action === "edit" && rest[0]) {
181
206
  const body = {};
@@ -188,10 +213,15 @@ async function role(action, rest, p, out) {
188
213
  const permissions = permsFromFlags(p, !!proj);
189
214
  if (permissions)
190
215
  body.permissions = permissions;
216
+ for (const q of ["reviews", "works", "trials"]) {
217
+ const v = tagList(str(p.flags, q));
218
+ if (v !== undefined)
219
+ body[q] = v;
220
+ }
191
221
  if (!Object.keys(body).length)
192
- throw new CliError("usage", "role edit needs --description, --cardinality, --projects, --post, --broadcast, --create-channels, --read-account-status or --permissions");
222
+ throw new CliError("usage", "role edit needs --description, --cardinality, --projects, --post, --broadcast, --create-channels, --read-account-status, --permissions, --reviews, --works or --trials");
193
223
  const r = await c.call("PATCH", `${base}/${rest[0]}`, body);
194
- out.print(`updated role ${r.role.name}: projects=${r.role.permissions.projects.join(",") || "(none)"} post=${r.role.permissions.post_channels.join(",")} broadcast=${r.role.permissions.broadcast}`, r);
224
+ out.print(`updated role ${r.role.name}: reviews=${(r.role.reviews ?? []).join(",") || "-"} works=${(r.role.works ?? []).join(",") || "-"} trials=${(r.role.trials ?? []).join(",") || "-"} projects=${r.role.permissions.projects.join(",") || "(none)"} post=${r.role.permissions.post_channels.join(",")} broadcast=${r.role.permissions.broadcast}`, r);
195
225
  }
196
226
  else if (action === "delete" && rest[0]) {
197
227
  const r = await c.call("DELETE", `${base}/${rest[0]}`);
@@ -250,3 +280,55 @@ async function enroll(action, rest, p, out) {
250
280
  else
251
281
  throw new CliError("usage", "admin enroll create <project> [--name n | --prefix p] [--role r] | list <project> | revoke <project> <id> (use --account instead of <project> for account-wide agents)");
252
282
  }
283
+ /**
284
+ * Sign in the way the console does. By default: print a link with a short code, open it, and the
285
+ * operator approves it in a browser that is already signed in to BenignSwarm. With an email: the
286
+ * server mails an approval link instead. Either way this terminal polls with a device code and
287
+ * receives its own session.
288
+ */
289
+ async function browserLogin(url, email, nick, out) {
290
+ const post = async (path, body) => {
291
+ const res = await fetch(`${url}${path}`, { method: "POST", headers: { "content-type": "application/json", "user-agent": `bschat-cli/${CLI_VERSION}` }, body: JSON.stringify(body) });
292
+ const json = await res.json().catch(() => ({}));
293
+ return { status: res.status, json };
294
+ };
295
+ const start = await post("/auth/cli/start", { ...(email ? { email } : {}), label: hostname().split(".")[0] });
296
+ if (start.status !== 200)
297
+ throw new CliError(start.json.error ?? "login_failed", start.json.message ?? `sign-in failed (${start.status})`);
298
+ if (email) {
299
+ process.stderr.write(`${start.json.message}\n`);
300
+ }
301
+ else {
302
+ process.stderr.write(`${start.json.message}\n\n ${start.json.verification_url}\n\n code: ${start.json.user_code}\n\n`);
303
+ const opened = openInBrowser(start.json.verification_url);
304
+ process.stderr.write(opened ? "Opened it in your browser. " : "Open it in your browser (this machine has no browser opener; any signed-in browser works, on any device). ");
305
+ }
306
+ process.stderr.write(`Waiting for approval (expires ${String(start.json.expires_at).slice(11, 16)} UTC). Ctrl-C to stop.\n`);
307
+ const interval = Math.max(2, Number(start.json.interval_seconds) || 3) * 1000;
308
+ for (;;) {
309
+ await new Promise((r) => setTimeout(r, interval));
310
+ const r = await post("/auth/cli/poll", { device_code: start.json.device_code });
311
+ if (r.status === 200 && r.json.status === "pending")
312
+ continue;
313
+ if (r.status === 200 && r.json.status === "approved") {
314
+ const path = saveAdmin(nick, { url, key: r.json.session_token, account: r.json.account_id });
315
+ out.print(`Signed in as ${r.json.email} (saved as ${nick} in ${path}; the session lasts until ${String(r.json.expires_at).slice(0, 10)}).${nick === "default" ? "" : `\nNext: export BSCHAT_ADMIN=${nick}`}`, { saved: path, email: r.json.email });
316
+ return;
317
+ }
318
+ throw new CliError(r.json.error ?? "login_failed", r.json.message ?? `sign-in failed (${r.status})`);
319
+ }
320
+ }
321
+ /** Opens a URL with the platform's opener; false when there is none (a headless box), so the caller says so. */
322
+ function openInBrowser(target) {
323
+ const cmd = process.platform === "darwin" ? "open" : process.platform === "win32" ? "cmd" : "xdg-open";
324
+ const args = process.platform === "win32" ? ["/c", "start", "", target] : [target];
325
+ if (process.platform === "linux" && !process.env.DISPLAY && !process.env.WAYLAND_DISPLAY)
326
+ return false;
327
+ try {
328
+ const r = spawnSync(cmd, args, { stdio: "ignore", timeout: 5000 });
329
+ return r.status === 0;
330
+ }
331
+ catch {
332
+ return false;
333
+ }
334
+ }
@@ -33,7 +33,7 @@ export async function login(p, out) {
33
33
  const name = asFlag.includes("/") ? asFlag.slice(asFlag.indexOf("/") + 1) : asFlag;
34
34
  const key = need(p.flags, "key");
35
35
  if (!key.startsWith("bs_agent_"))
36
- throw new CliError("usage", "login expects an agent key (bs_agent_...). For admin keys use: bschat admin login");
36
+ throw new CliError("usage", "login expects an agent key (bs_agent_...). Operators sign in with bschat-admin login.");
37
37
  const url = (str(p.flags, "url") ?? process.env.BSCHAT_URL ?? DEFAULT_URL).replace(/\/$/, "");
38
38
  const me = await Client.raw(url, key).call("GET", "/me");
39
39
  if (me.kind !== "agent")
@@ -0,0 +1,364 @@
1
+ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
+ import { homedir } from "node:os";
3
+ import { join } from "node:path";
4
+ import { DEFAULT_URL, listSaved } from "../config.js";
5
+ import { str } from "../args.js";
6
+ import { Client } from "../client.js";
7
+ import { loadAdmin, resolveAdminName } from "../config.js";
8
+ import { CliError } from "../errors.js";
9
+ import { table } from "../output.js";
10
+ /**
11
+ * Operator commands that used to exist only in the console: the project process (definition,
12
+ * vocabulary, agreements, steward), decisions waiting on the operator, the notifier, admin keys,
13
+ * the account summary period and worktree records. Every one is the same API call the console
14
+ * makes, so a project can be set up end to end from a script.
15
+ */
16
+ const adminClient = (p) => Client.forAdmin(loadAdmin(resolveAdminName(str(p.flags, "admin"))));
17
+ export function yesNo(v, flag) {
18
+ if (v === undefined)
19
+ return undefined;
20
+ if (["yes", "true", "on", "1"].includes(v.toLowerCase()))
21
+ return true;
22
+ if (["no", "false", "off", "0"].includes(v.toLowerCase()))
23
+ return false;
24
+ throw new CliError("usage", `--${flag} takes yes or no`);
25
+ }
26
+ export function intFlag(v, flag) {
27
+ if (v === undefined)
28
+ return undefined;
29
+ const n = Number(v);
30
+ if (!Number.isInteger(n))
31
+ throw new CliError("usage", `--${flag} must be a whole number`);
32
+ return n;
33
+ }
34
+ /** A comma list where "" clears and "*" means every tag. */
35
+ export function tagList(v) {
36
+ if (v === undefined)
37
+ return undefined;
38
+ return v.split(",").map((x) => x.trim().replace(/^#/, "")).filter(Boolean);
39
+ }
40
+ /** Adds, edits or removes one tag; the rest of the vocabulary is sent back unchanged. */
41
+ export function editVocabulary(vocab, op, tag, f) {
42
+ const name = tag.replace(/^#/, "").toLowerCase();
43
+ const i = vocab.findIndex((t) => t.name === name);
44
+ if (op === "add" && i >= 0)
45
+ throw new CliError("exists", `#${name} is already in the vocabulary; use: process tag edit`);
46
+ if (op !== "add" && i < 0)
47
+ throw new CliError("not_found", `#${name} is not in the vocabulary`);
48
+ if (op === "remove")
49
+ return vocab.filter((t) => t.name !== name);
50
+ const base = i >= 0 ? vocab[i] : { name, meaning: "", require_evidence: false, require_rebased: false, expert_role: null };
51
+ const next = {
52
+ ...base,
53
+ ...(f.meaning !== undefined ? { meaning: f.meaning } : {}),
54
+ ...(f.evidence !== undefined ? { require_evidence: f.evidence } : {}),
55
+ ...(f.rebased !== undefined ? { require_rebased: f.rebased } : {}),
56
+ ...(f.expert !== undefined ? { expert_role: f.expert === "none" || f.expert === "" ? null : f.expert } : {}),
57
+ };
58
+ if (op === "add" && !next.meaning.trim())
59
+ throw new CliError("usage", `a tag needs a meaning, the sentence workers decide by: --meaning ".."`);
60
+ return i >= 0 ? vocab.map((t, j) => (j === i ? next : t)) : [...vocab, next];
61
+ }
62
+ /** The definition fields a flag set changes; nothing else is sent, so the server keeps the rest. */
63
+ export function definitionPatch(p, cur) {
64
+ const d = {};
65
+ const sla = intFlag(str(p.flags, "sla"), "sla");
66
+ if (sla !== undefined)
67
+ d.review_sla_minutes = sla;
68
+ const take = intFlag(str(p.flags, "takeover"), "takeover");
69
+ if (take !== undefined)
70
+ d.escalate_after_minutes = take;
71
+ const open = intFlag(str(p.flags, "max-open"), "max-open");
72
+ if (open !== undefined)
73
+ d.max_open_per_agent = open;
74
+ const prog = intFlag(str(p.flags, "max-in-progress"), "max-in-progress");
75
+ if (prog !== undefined)
76
+ d.max_in_progress_per_agent = prog;
77
+ const scope = yesNo(str(p.flags, "require-scope"), "require-scope");
78
+ if (scope !== undefined)
79
+ d.require_scope = scope;
80
+ const ev = yesNo(str(p.flags, "require-evidence"), "require-evidence");
81
+ if (ev !== undefined)
82
+ d.require_evidence_to_submit = ev;
83
+ const appr = str(p.flags, "default-approver");
84
+ if (appr !== undefined)
85
+ d.default_approver_role = appr === "none" || appr === "" ? null : appr;
86
+ const merge = {};
87
+ const target = str(p.flags, "target");
88
+ if (target !== undefined)
89
+ merge.target_branch = target;
90
+ const by = str(p.flags, "merged-by");
91
+ if (by !== undefined)
92
+ merge.merged_by = by;
93
+ const integ = str(p.flags, "integrator-role");
94
+ if (integ !== undefined)
95
+ merge.integrator_role = integ === "none" ? null : integ;
96
+ for (const [flag, key] of [["require-rebased", "require_rebased"], ["require-merge-commit", "require_merge_commit"], ["require-pushed", "require_pushed"]]) {
97
+ const v = yesNo(str(p.flags, flag), flag);
98
+ if (v !== undefined)
99
+ merge[key] = v;
100
+ }
101
+ if (Object.keys(merge).length)
102
+ d.merge = { ...cur.merge, ...merge };
103
+ const steward = {};
104
+ const quiet = intFlag(str(p.flags, "quiet"), "quiet");
105
+ if (quiet !== undefined)
106
+ steward.quiet_minutes = quiet;
107
+ const summ = intFlag(str(p.flags, "summary"), "summary");
108
+ if (summ !== undefined)
109
+ steward.summary_minutes = summ;
110
+ if (Object.keys(steward).length)
111
+ d.steward = { ...cur.steward, ...steward };
112
+ return d;
113
+ }
114
+ function describeProcess(r) {
115
+ const d = r.process.definition;
116
+ const v = r.vocabulary;
117
+ const m = d.merge;
118
+ return [
119
+ `Process v${r.process.version}${r.process.version === 0 ? " (defaults; nothing published yet)" : ""}`,
120
+ ` timing: review SLA ${d.review_sla_minutes} min, takeover ${d.escalate_after_minutes} min, ${d.max_open_per_agent} open / ${d.max_in_progress_per_agent} in progress per agent`,
121
+ ` requires: scope ${d.require_scope ? "yes" : "no"}, evidence to submit ${d.require_evidence_to_submit ? "yes" : "no"}; default approver ${d.default_approver_role ?? "none"}; assigners ${d.assigners.join(", ") || "none"}`,
122
+ ` merging: into ${m.target_branch} by ${m.merged_by === "integrator" ? `a ${m.integrator_role}` : `the ${m.merged_by}`}; merge commit ${m.require_merge_commit ? "yes" : "no"}, rebased ${m.require_rebased ? "yes" : "no"}, pushed ${m.require_pushed ? "yes" : "no"}`,
123
+ ` steward: ${d.steward.enabled ? "on" : "off"}, quiet ${d.steward.quiet_minutes} min, summary every ${d.steward.summary_minutes} min`,
124
+ ` agreements: ${r.process.agreements.length} of 8000 characters`,
125
+ v.length ? `Tags:` : `No tag vocabulary: every unit goes to the default approver.`,
126
+ ...v.map((t) => ` #${t.name}: ${t.meaning || "(NO MEANING: workers cannot decide by it)"}${t.require_evidence ? " · evidence" : ""}${t.require_rebased ? " · rebased" : ""}${t.expert_role ? ` · expert ${t.expert_role}` : ""}`),
127
+ ].join("\n");
128
+ }
129
+ export async function processAdmin(action, rest, p, out) {
130
+ const c = adminClient(p);
131
+ const proj = rest[0];
132
+ if (!proj && action !== undefined)
133
+ throw new CliError("usage", "admin process <show|export|set|tag|timing|merge|assigners|agreements|steward> <project> ...");
134
+ const base = `/projects/${proj}/process`;
135
+ const get = () => c.call("GET", base);
136
+ const publish = async (body, what) => {
137
+ const r = await c.call("PUT", base, body);
138
+ out.print(r.unchanged ? `Nothing changed; still v${r.process.version}.` : `Published v${r.process.version} (${what}). The change was announced to every agent in #${r.process.definition.channel}.`, r);
139
+ };
140
+ switch (action) {
141
+ case "show": {
142
+ const r = await get();
143
+ out.print(describeProcess(r), r);
144
+ return;
145
+ }
146
+ case "export": {
147
+ const r = await get();
148
+ const doc = { definition: r.process.definition, vocabulary: r.vocabulary, agreements: r.process.agreements };
149
+ const file = str(p.flags, "out");
150
+ const text = JSON.stringify(doc, null, 2) + "\n";
151
+ if (file) {
152
+ writeFileSync(file, text);
153
+ out.print(`Wrote v${r.process.version} to ${file}. Edit it and publish with: bschat-admin process set ${proj} --file ${file}`, doc);
154
+ }
155
+ else
156
+ process.stdout.write(text);
157
+ return;
158
+ }
159
+ case "set": {
160
+ const file = str(p.flags, "file");
161
+ if (!file)
162
+ throw new CliError("usage", "admin process set <project> --file process.json (the shape admin process export writes: definition, vocabulary, agreements; each optional)");
163
+ let doc;
164
+ try {
165
+ doc = JSON.parse(readFileSync(file, "utf8"));
166
+ }
167
+ catch (e) {
168
+ throw new CliError("bad_file", `${file}: ${e.message}`);
169
+ }
170
+ if (!doc || typeof doc !== "object" || Array.isArray(doc))
171
+ throw new CliError("bad_file", `${file} must hold an object with definition, vocabulary and/or agreements`);
172
+ const unknown = Object.keys(doc).filter((k) => !["definition", "vocabulary", "agreements"].includes(k));
173
+ if (unknown.length)
174
+ throw new CliError("bad_file", `${file}: unknown keys ${unknown.join(", ")}; expected definition, vocabulary, agreements`);
175
+ return publish(doc, `from ${file}`);
176
+ }
177
+ case "tag": {
178
+ const [, op, tag] = rest;
179
+ if (!["add", "edit", "remove"].includes(op) || !tag)
180
+ throw new CliError("usage", 'admin process tag add|edit|remove <project> <tag> [--meaning ".."] [--require-evidence yes|no] [--require-rebased yes|no] [--expert-role <role>|none]');
181
+ const r = await get();
182
+ const vocabulary = editVocabulary(r.vocabulary, op, tag, { meaning: str(p.flags, "meaning"), evidence: yesNo(str(p.flags, "require-evidence"), "require-evidence"), rebased: yesNo(str(p.flags, "require-rebased"), "require-rebased"), expert: str(p.flags, "expert-role") });
183
+ return publish({ vocabulary }, `tag #${tag.replace(/^#/, "")} ${op === "add" ? "added" : op === "edit" ? "edited" : "removed"}`);
184
+ }
185
+ case "timing":
186
+ case "merge": {
187
+ const r = await get();
188
+ const definition = definitionPatch(p, r.process.definition);
189
+ if (!Object.keys(definition).length)
190
+ throw new CliError("usage", action === "timing"
191
+ ? "admin process timing <project> [--sla m] [--takeover m] [--max-open n] [--max-in-progress n] [--require-scope yes|no] [--require-evidence yes|no] [--default-approver role|none]"
192
+ : "admin process merge <project> [--target branch] [--merged-by owner|approver|integrator] [--integrator-role r] [--require-rebased yes|no] [--require-merge-commit yes|no] [--require-pushed yes|no]");
193
+ return publish({ definition }, Object.keys(definition).join(", "));
194
+ }
195
+ case "assigners": {
196
+ const roles = tagList(rest[1]);
197
+ if (roles === undefined)
198
+ throw new CliError("usage", "admin process assigners <project> role1,role2 (\"\" for none)");
199
+ return publish({ definition: { assigners: roles } }, `assigners ${roles.join(", ") || "none"}`);
200
+ }
201
+ case "agreements": {
202
+ const file = str(p.flags, "file");
203
+ if (!file)
204
+ throw new CliError("usage", "admin process agreements <project> --file agreements.md (at most 8000 characters; agents re-read it after every compaction)");
205
+ return publish({ agreements: readFileSync(file, "utf8") }, "working agreements");
206
+ }
207
+ case "steward": {
208
+ const sw = rest[1];
209
+ const cur = await get();
210
+ const patch = definitionPatch(p, cur.process.definition);
211
+ if (sw !== "on" && sw !== "off" && !Object.keys(patch).length)
212
+ throw new CliError("usage", "admin process steward <project> on|off [--quiet m] [--summary m]");
213
+ if (sw === "on" || sw === "off") {
214
+ const r = await c.call("POST", `/projects/${proj}/steward`, { enabled: sw === "on" });
215
+ out.print(`Steward ${sw} for ${proj} (process v${r.process.version}).`, r);
216
+ }
217
+ if (Object.keys(patch).length) {
218
+ const fresh = sw ? await get() : cur;
219
+ await publish({ definition: definitionPatch(p, fresh.process.definition) }, "steward timing");
220
+ }
221
+ return;
222
+ }
223
+ default:
224
+ throw new CliError("usage", "admin process <show|export|set|tag|timing|merge|assigners|agreements|steward> <project> ...");
225
+ }
226
+ }
227
+ /** Decisions waiting on the operator, and answering them: the console banner from a terminal. */
228
+ export async function needsAdmin(p, out) {
229
+ const r = await adminClient(p).call("GET", "/account/needs");
230
+ if (!r.needs.length)
231
+ return out.print("Nothing is waiting on you.", r);
232
+ out.print(r.needs.map((n, i) => `${i + 1}. [${n.project}] ${n.kind === "unit_question" ? `WU #${n.unit}` : n.kind === "wake_broken" ? "wake path" : n.kind === "notifier" ? "your alerts" : "ask"} · ${n.asked_by} · since ${n.since.slice(0, 16).replace("T", " ")} UTC${n.blocks ? ` · waiting: ${n.blocks}` : ""}\n ${n.text.replace(/\n/g, "\n ")}\n key: ${n.key}`).join("\n\n") + `\n\nAnswer with: bschat-admin answer <key> "decision"`, r);
233
+ }
234
+ export async function answerAdmin(rest, p, out) {
235
+ const [key, ...words] = rest;
236
+ const answer = (words.join(" ") || str(p.flags, "note") || "").trim();
237
+ if (!key || !answer)
238
+ throw new CliError("usage", 'admin answer <key from admin needs> "decision"');
239
+ const c = adminClient(p);
240
+ const n = (await c.call("GET", "/account/needs")).needs.find((x) => x.key === key);
241
+ if (!n)
242
+ throw new CliError("not_found", `nothing waiting with key ${key}; list them with: bschat-admin needs`);
243
+ if (n.kind === "ask")
244
+ return out.print("Answered; the asker was told.", await c.call("POST", `/projects/${n.project}/asks/${n.ask_id}/answer`, { answer }));
245
+ if (n.kind === "unit_question")
246
+ return out.print(`Ruled on WU #${n.unit}; the asker, owner and reviewers were told.`, await c.call("POST", `/projects/${n.project}/work-units/${n.unit}/rule`, { ruling: answer }));
247
+ throw new CliError("not_answerable", n.kind === "wake_broken" ? `a broken wake path clears when ${n.agent} shows activity: fix its watcher or harness session` : "a notifier problem clears on the next report that reaches you: fix it with bschat-admin notifier");
248
+ }
249
+ export async function notifierAdmin(p, out) {
250
+ const c = adminClient(p);
251
+ const patch = {};
252
+ const agent = str(p.flags, "agent");
253
+ if (agent !== undefined)
254
+ patch.agent = agent === "none" || agent === "" ? null : agent;
255
+ const email = yesNo(str(p.flags, "email"), "email");
256
+ if (email !== undefined)
257
+ patch.email = email;
258
+ const rep = intFlag(str(p.flags, "repeat"), "repeat");
259
+ if (rep !== undefined)
260
+ patch.repeat_minutes = rep;
261
+ if (Object.keys(patch).length)
262
+ await c.call("PATCH", "/account/notifier", patch);
263
+ const r = await c.call("GET", "/account/notifier");
264
+ const n = r.notifier;
265
+ const l = n.last_delivery;
266
+ out.print([
267
+ `notifier agent: ${n.agent ?? "none"} · email: ${n.email ? (n.email_to === undefined ? "on (this server does not report the address; it predates the notifier fix)" : n.email_to ?? "(the account has no contact email)") : "off"} · repeat after ${n.repeat_minutes} min`,
268
+ l ? `last report ${l.at.slice(0, 16).replace("T", " ")} UTC (${l.project}, ${l.items} item${l.items === 1 ? "" : "s"})${l.agent ? `\n ${l.agent.ok ? "ok " : "FAIL"} ${l.agent.name}: ${l.agent.detail}` : ""}${l.email ? `\n ${l.email.ok ? "ok " : "FAIL"} email ${l.email.to}: ${l.email.detail}` : ""}` : "nothing reported yet",
269
+ ].join("\n"), r);
270
+ }
271
+ export async function accountAdmin(p, out) {
272
+ const c = adminClient(p);
273
+ const m = intFlag(str(p.flags, "summary-minutes"), "summary-minutes");
274
+ if (m !== undefined)
275
+ await c.call("PATCH", "/account", { summary_minutes: m });
276
+ const r = await c.call("GET", "/account");
277
+ const u = await c.call("GET", "/account/usage");
278
+ const a = r.account ?? r;
279
+ out.print(`${a.name} · plan ${a.plan} · account summary every ${a.summary_minutes ?? 60} min\nusage: ${JSON.stringify(u.usage ?? u)}`, { account: a, usage: u });
280
+ }
281
+ export async function keysAdmin(action, rest, p, out) {
282
+ const c = adminClient(p);
283
+ if (action === "create") {
284
+ const r = await c.call("POST", "/account/keys", {});
285
+ return out.print(`New admin key (shown once, store it now): ${r.admin_key}\nUse it with: bschat-admin login --as <nickname> --key <the key>`, r);
286
+ }
287
+ if (action === "revoke") {
288
+ if (!rest[0])
289
+ throw new CliError("usage", "admin keys revoke <key id from admin keys>");
290
+ return out.print(`revoked key ${rest[0]}`, await c.call("DELETE", `/account/keys/${rest[0]}`));
291
+ }
292
+ const r = await c.call("GET", "/account/keys");
293
+ out.print(table(r.keys, ["id", "kind", "prefix", "agent_name", "project_name", "machine", "created_at", "revoked_at"]), r);
294
+ }
295
+ export async function worktreeAdmin(action, rest, p, out) {
296
+ const [proj, id] = rest;
297
+ if (action !== "forget" || !proj || !id)
298
+ throw new CliError("usage", "admin worktree forget <project> <record id from bschat worktrees --json> (deletes the record only, never the directory)");
299
+ out.print(`forgot worktree record ${id}`, await adminClient(p).call("DELETE", `/projects/${proj}/worktrees/${id}`));
300
+ }
301
+ /**
302
+ * For an AI agent asked to drive bschat-admin: what this is and how to load the full operator
303
+ * skill. Printed offline, so it works before sign-in.
304
+ */
305
+ export const AGENT_ORIENTATION = `bschat-admin, for an AI agent helping a person run BenignSwarm
306
+
307
+ You are acting for the account's operator (a person), not as an agent in a project. BenignSwarm
308
+ coordinates their AI coding agents (Claude Code, Codex, Antigravity, DeepSeek, Gemini; any
309
+ machine) through work units, reviews by qualified roles, milestones and evidence. The agents use
310
+ \`bschat\`; you use \`bschat-admin\` to set projects up and keep them running.
311
+
312
+ Before acting, load the operator skill. It explains the philosophy, the setup interview, how to
313
+ design the process (tags, roles, merge policy, milestones), how each harness joins and is woken,
314
+ several machines, and how to recognise and fix stalls:
315
+
316
+ bschat-admin skill install # writes ~/.claude/skills/benignswarm-operator (Claude Code)
317
+ bschat-admin skill install --dir <path> # any other harness: a directory you will read from
318
+ bschat-admin skill print # or print SKILL.md and read it now
319
+
320
+ Then read references/setup.md and interview the operator before running anything. Rules that
321
+ matter from the start:
322
+ - Sign in with \`bschat-admin login\` (the operator approves it in their browser). Never ask for,
323
+ print or store admin or agent keys in chat or in committed files.
324
+ - Propose a process and get a yes before publishing it: a publish wakes every agent to re-read it.
325
+ - Ask before anything destructive (deleting a project, agent, key or account).
326
+ - You are not an agent in the project: never post as one, take units or approve work.
327
+
328
+ Commands: bschat-admin --help
329
+ `;
330
+ export async function skillAdmin(action, p, out) {
331
+ const saved = listSaved("admins");
332
+ const url = (process.env.BSCHAT_URL ?? (saved.length ? loadAdmin(resolveAdminName(str(p.flags, "admin"))).url : DEFAULT_URL)).replace(/\/$/, "");
333
+ const fetchText = async (path) => {
334
+ let res;
335
+ try {
336
+ res = await fetch(url + path);
337
+ }
338
+ catch (e) {
339
+ throw new CliError("network", `could not reach ${url}: ${e.message}`);
340
+ }
341
+ if (!res.ok)
342
+ throw new CliError("fetch_failed", `${url}${path} returned ${res.status}`);
343
+ return res.text();
344
+ };
345
+ if (action === "print") {
346
+ process.stdout.write(await fetchText("/skill/admin/SKILL.md"));
347
+ return;
348
+ }
349
+ if (action === "install") {
350
+ const dir = str(p.flags, "dir") ?? join(homedir(), ".claude", "skills", "benignswarm-operator");
351
+ const main = await fetchText("/skill/admin/SKILL.md");
352
+ const refs = JSON.parse(await fetchText("/skill/admin/references")).references;
353
+ mkdirSync(join(dir, "references"), { recursive: true });
354
+ writeFileSync(join(dir, "SKILL.md"), main);
355
+ for (const f of refs) {
356
+ if (!/^[a-z0-9-]+\.md$/.test(f))
357
+ throw new CliError("bad_reference", `the server listed an unexpected reference name ${JSON.stringify(f)}`);
358
+ writeFileSync(join(dir, "references", f), await fetchText(`/skill/admin/references/${f}`));
359
+ }
360
+ out.print(`Installed the operator skill to ${dir} (SKILL.md and ${refs.length} references). Claude Code loads ~/.claude/skills automatically; for another harness, point it at that directory or paste SKILL.md into its instructions.`, { dir, references: refs });
361
+ return;
362
+ }
363
+ throw new CliError("usage", "bschat-admin skill install [--dir <path>] | skill print");
364
+ }
package/dist/config.js CHANGED
@@ -152,7 +152,7 @@ export function resolveAgentName(asFlag, env = process.env, cwd = process.cwd())
152
152
  const saved = listSaved("agents", env);
153
153
  throw new CliError("no_identity", "BSCHAT_AGENT is not set and --as was not given; bschat cannot tell which agent you are", saved.length
154
154
  ? `Saved identities on this machine: ${saved.join(", ")}. Ask the user which one is yours, then: export BSCHAT_AGENT=<project>/<name> (or run: bschat setup --as <project>/<name> to record it for this repo)`
155
- : "No identities are saved here. The account admin creates one with: bschat admin agent create <project> <name> --vendor <vendor>, then you run: bschat login --as <name> --key <key>");
155
+ : "No identities are saved here. Ask the account owner for an invite (an enrollment token) and run: npx -y benignswarm join --as <name> --token <bs_enroll_...>");
156
156
  }
157
157
  return isRef(name) ? name : resolveSavedRef(name, env);
158
158
  }
@@ -171,12 +171,15 @@ export function resolveAdminName(flag, env = process.env) {
171
171
  const saved = listSaved("admins", env);
172
172
  if (saved.length === 1)
173
173
  return saved[0];
174
- throw new CliError("no_admin", "BSCHAT_ADMIN is not set and --admin was not given", saved.length ? `Saved admin logins: ${saved.join(", ")}` : "Run: bschat admin login --as <account-nickname> --key <bs_admin_...>");
174
+ // bschat-admin login without --as saves under "default": that is the one meant when none is named.
175
+ if (saved.includes("default"))
176
+ return "default";
177
+ throw new CliError("no_admin", "BSCHAT_ADMIN is not set and --admin was not given", saved.length ? `Saved admin logins: ${saved.join(", ")}` : "Run: bschat-admin login --email <you@example.com>");
175
178
  }
176
179
  export function loadAdmin(name, env = process.env) {
177
180
  const p = adminPath(name, env);
178
181
  if (!existsSync(p))
179
- throw new CliError("not_logged_in", `no saved admin credentials named ${name}`, "Run: bschat admin login --as <name> --key <bs_admin_...>");
182
+ throw new CliError("not_logged_in", `no saved admin credentials named ${name}`, "Run: bschat-admin login --email <you@example.com>");
180
183
  return JSON.parse(readFileSync(p, "utf8"));
181
184
  }
182
185
  /**
@@ -224,3 +227,9 @@ export function resolveModel(flag, env = process.env, cwd = process.cwd(), agent
224
227
  }
225
228
  return r.model;
226
229
  }
230
+ /** Removes a saved admin login (the session itself is ended server-side by the caller). */
231
+ export function forgetAdmin(name, env = process.env) {
232
+ const p = adminPath(name, env);
233
+ if (existsSync(p))
234
+ unlinkSync(p);
235
+ }
package/dist/help.js CHANGED
@@ -123,26 +123,52 @@ Agent commands
123
123
  bschat skill install [--dir <path>] write the agent skill (default .claude/skills/bschat)
124
124
  bschat skill print
125
125
 
126
- Admin commands (BSCHAT_ADMIN=<nickname> or --admin <nickname>)
127
- bschat admin login --as <nickname> --key <bs_admin_...> [--url <api>]
128
- bschat admin signup --url <api> --key <signup-code> <account-name> <email>
129
- bschat admin project create|list|delete <name>
130
- bschat admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
131
- bschat admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
132
- bschat admin agent --account list|role|rotate-key|delete ...
133
- bschat admin agent list <project>
134
- bschat admin enroll create <project> [--name n | --prefix p] [--role r] [--uses n] [--expires-hours h] prints the invite text
135
- bschat admin enroll create --account --name n --role r invite an account-wide agent
136
- bschat admin enroll list <project>
137
- bschat admin enroll revoke <project> <token-id>
138
- bschat admin agent role <project> <name> <role|none>
139
- bschat admin agent rotate-key <project> <name> [--machine m]
140
- bschat admin agent delete <project> <name>
141
- bschat admin role create <name> [--project p] [--description d] [--broadcast] [--create-channels] [--read-account-status] [--permissions '{json}'] [--cardinality one|many]
142
- bschat admin role edit <name> [--project p] [--projects a,b|*] [--post c1,c2] [--broadcast] [--create-channels] [--read-account-status] [--description d] [--cardinality one|many]
143
- bschat admin role list [--project p]
144
- bschat admin role delete <name> [--project p]
145
- bschat admin channel create|delete <project> <name>
146
- bschat admin keys
147
- bschat admin delete-account --confirm "delete everything"
126
+ `;
127
+ export const ADMIN_HELP = `bschat-admin: the operator's tools for BenignSwarm (benignswarm.org)
128
+
129
+ These act for the account's owner: projects, agents, invites, roles, the process, decisions
130
+ waiting on you. Agents in projects use bschat and never need this. An AI agent driving this
131
+ tool should run bschat-admin --agent first, then install the operator skill. Sign in once per machine with
132
+ bschat-admin login (approve it in your signed-in browser); the session lasts 30 days, like the console's.
133
+
134
+ bschat-admin login [--as <nickname>] [--url <api>]
135
+ prints a link and a code and opens it: approve it in a browser already signed in to BenignSwarm
136
+ bschat-admin login --email <you@example.com> no signed-in browser at hand: approve by an emailed link instead
137
+ bschat-admin login --as <nickname> --key <bs_admin_...> for scripts and CI only (an admin key in a secret store)
138
+ bschat-admin logout [--as <nickname>] end the terminal session and forget it here
139
+ bschat-admin --agent for an AI agent driving this tool: what it is and how to load the operator skill
140
+ bschat-admin skill install [--dir <path>] | skill print the operator skill (default ~/.claude/skills/benignswarm-operator)
141
+ bschat-admin signup --url <api> --key <signup-code> <account-name> <email>
142
+ bschat-admin project create|list|delete <name>
143
+ bschat-admin agent create <project> <name> --vendor <v> [--role r] [--machine m]
144
+ bschat-admin agent --account create <name> --vendor <v> --role <r> account-wide agent (role's --projects decides access)
145
+ bschat-admin agent --account list|role|rotate-key|delete ...
146
+ bschat-admin agent list <project>
147
+ bschat-admin enroll create <project> [--name n | --prefix p] [--role r] [--uses n] [--expires-hours h] prints the invite text
148
+ bschat-admin enroll create --account --name n --role r invite an account-wide agent
149
+ bschat-admin enroll list <project>
150
+ bschat-admin enroll revoke <project> <token-id>
151
+ bschat-admin agent role <project> <name> <role|none>
152
+ bschat-admin agent rotate-key <project> <name> [--machine m]
153
+ bschat-admin agent delete <project> <name>
154
+ bschat-admin role create <name> [--project p] [--description d] [--broadcast] [--create-channels] [--read-account-status] [--permissions '{json}'] [--cardinality one|many]
155
+ bschat-admin role edit <name> [--project p] [--projects a,b|*] [--post c1,c2] [--broadcast] [--create-channels] [--read-account-status] [--description d] [--cardinality one|many]
156
+ bschat-admin role list [--project p]
157
+ bschat-admin role delete <name> [--project p]
158
+ bschat-admin channel create|delete <project> <name>
159
+ bschat-admin keys [create | revoke <id>] list admin and agent keys; create shows a new admin key once
160
+ bschat-admin process show|export <project> [--out f] the process as agents are told it, or as an editable file
161
+ bschat-admin process set <project> --file process.json publish definition, vocabulary and agreements in one version
162
+ bschat-admin process tag add|edit|remove <project> <tag> [--meaning ..] [--require-evidence yes|no] [--require-rebased yes|no] [--expert-role r|none]
163
+ bschat-admin process timing <project> [--sla m] [--takeover m] [--max-open n] [--max-in-progress n] [--require-scope yes|no] [--require-evidence yes|no] [--default-approver r|none]
164
+ bschat-admin process merge <project> [--target b] [--merged-by owner|approver|integrator] [--integrator-role r] [--require-rebased|--require-merge-commit|--require-pushed yes|no]
165
+ bschat-admin process assigners <project> role1,role2 | agreements <project> --file agreements.md
166
+ bschat-admin process steward <project> on|off [--quiet m] [--summary m]
167
+ bschat-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
168
+ bschat-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
169
+ bschat-admin answer <key> "decision" answer one; the asker is @mentioned
170
+ bschat-admin notifier [--agent name|none] [--email yes|no] [--repeat m] how you are reached away from the console, and the last report
171
+ bschat-admin account [--summary-minutes m] plan, usage and the account summary period
172
+ bschat-admin worktree forget <project> <id> delete a stale worktree record (never the directory)
173
+ bschat-admin delete-account --confirm "delete everything"
148
174
  `;
package/dist/index.js CHANGED
@@ -1,6 +1,5 @@
1
1
  #!/usr/bin/env node
2
2
  import { bool, parse } from "./args.js";
3
- import { admin } from "./commands/admin.js";
4
3
  import * as a from "./commands/agent.js";
5
4
  import { evidence } from "./commands/evidence.js";
6
5
  import { join, setup } from "./commands/join.js";
@@ -59,7 +58,9 @@ const COMMANDS = {
59
58
  follow: a.followCmd,
60
59
  unfollow: a.followCmd,
61
60
  following: a.followCmd,
62
- admin,
61
+ admin: async () => {
62
+ throw new CliError("moved", "operator commands are in bschat-admin, which ships with this package", "Run: bschat-admin --help (agents never need it)");
63
+ },
63
64
  };
64
65
  async function main(argv) {
65
66
  const p = parse(argv);
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.23";
1
+ export const CLI_VERSION = "0.12.25";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.23",
3
+ "version": "0.12.25",
4
4
  "description": "bschat: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -16,7 +16,8 @@
16
16
  ],
17
17
  "type": "module",
18
18
  "bin": {
19
- "bschat": "dist/index.js"
19
+ "bschat": "dist/index.js",
20
+ "bschat-admin": "dist/admin-index.js"
20
21
  },
21
22
  "files": [
22
23
  "dist"