benignswarm 0.12.31 → 0.12.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/args.js CHANGED
@@ -1,7 +1,7 @@
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", "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", "churn", "unmet", "require-cited-changes", "checks-every"];
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", "defer", "hold", "clear", "met", "shared", "archive"];
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", "churn", "unmet", "require-cited-changes", "checks-every", "propose"];
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", "defer", "hold", "clear", "met", "shared", "archive", "approve"];
5
5
  export function parse(argv) {
6
6
  const options = {};
7
7
  for (const f of STRING_FLAGS)
@@ -2,7 +2,7 @@ import { mkdirSync, readFileSync, writeFileSync } from "node:fs";
2
2
  import { homedir } from "node:os";
3
3
  import { join } from "node:path";
4
4
  import { DEFAULT_URL, listSaved } from "../config.js";
5
- import { str } from "../args.js";
5
+ import { bool, str } from "../args.js";
6
6
  import { Client } from "../client.js";
7
7
  import { loadAdmin, resolveAdminName } from "../config.js";
8
8
  import { CliError } from "../errors.js";
@@ -241,19 +241,22 @@ export async function needsAdmin(p, out) {
241
241
  const r = await adminClient(p).call("GET", "/account/needs");
242
242
  if (!r.needs.length)
243
243
  return out.print("Nothing is waiting on you.", r);
244
- 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);
244
+ 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.proposal ? `\n Proposed: ${n.proposal.replace(/\n/g, "\n ")}` : ""}\n key: ${n.key}`).join("\n\n") + `\n\nAnswer with: bschat-admin answer <key> "decision", or bschat-admin answer <key> --approve [--note ".."] to accept a proposal`, r);
245
245
  }
246
246
  export async function answerAdmin(rest, p, out) {
247
247
  const [key, ...words] = rest;
248
248
  const answer = (words.join(" ") || str(p.flags, "note") || "").trim();
249
- if (!key || !answer)
250
- throw new CliError("usage", 'admin answer <key from admin needs> "decision"');
249
+ const approve = bool(p.flags, "approve");
250
+ if (!key || (!answer && !approve))
251
+ throw new CliError("usage", 'admin answer <key from admin needs> "decision" | --approve [--note ".."]');
251
252
  const c = adminClient(p);
252
253
  const n = (await c.call("GET", "/account/needs")).needs.find((x) => x.key === key);
253
254
  if (!n)
254
255
  throw new CliError("not_found", `nothing waiting with key ${key}; list them with: bschat-admin needs`);
256
+ if (approve && n.kind !== "ask")
257
+ throw new CliError("usage", "--approve accepts an ask's proposal; answer this one in words");
255
258
  if (n.kind === "ask")
256
- return out.print("Answered; the asker was told.", await c.call("POST", `/projects/${n.project}/asks/${n.ask_id}/answer`, { answer }));
259
+ return out.print(approve ? "Approved the proposal; the asker was told." : "Answered; the asker was told.", await c.call("POST", `/projects/${n.project}/asks/${n.ask_id}/answer`, approve ? { approve: true, answer } : { answer }));
257
260
  if (n.kind === "unit_question")
258
261
  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 }));
259
262
  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");
@@ -580,7 +580,7 @@ export async function lock(p, out) {
580
580
  ? `You hold ${lockName}${r.lock.machine ? ` on ${r.lock.machine}` : " (shared)"}${unit ? ` for WU #${unit}` : ""}. Release it when done: bschat unlock ${lockName}`
581
581
  : `${lockName} is held by ${r.lock.holder_name}${r.lock.unit ? ` (WU #${r.lock.unit})` : ""}; you are ${r.position === 1 ? "next" : `#${r.position} in line`}. You will be @mentioned when it is yours; do not poll. Leave the queue: bschat unlock ${lockName}`, r);
582
582
  }
583
- /** bschat ask-operator "question" [--blocks "what waits"]: a decision only the operator can make, on the record and reported to them. */
583
+ /** bschat ask-operator "question" [--blocks "what waits"] [--propose "recommended answer"]: a decision only the operator can make, on the record and reported to them. */
584
584
  export async function askOperator(p, out) {
585
585
  const name = resolveAgentName(str(p.flags, "as"));
586
586
  const creds = loadAgent(name);
@@ -590,7 +590,8 @@ export async function askOperator(p, out) {
590
590
  throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
591
591
  const text = (p.positionals.slice(1).join(" ") || str(p.flags, "question") || "").trim();
592
592
  if (!text)
593
- throw new CliError("usage", 'ask-operator "the decision only the operator can make" [--blocks "what waits on it"]');
594
- const r = await client.call("POST", `/projects/${project}/ask-operator`, { text, blocks: str(p.flags, "blocks") ?? "" });
595
- out.print(`Asked the operator; it is on their console banner and reported to them. You will be @mentioned with the decision. Carry on with what does not depend on it.`, r);
593
+ throw new CliError("usage", 'ask-operator "the decision only the operator can make" [--blocks "what waits on it"] [--propose "your recommended answer, approvable as written"]');
594
+ const proposal = str(p.flags, "propose") ?? "";
595
+ const r = await client.call("POST", `/projects/${project}/ask-operator`, { text, blocks: str(p.flags, "blocks") ?? "", proposal });
596
+ out.print(`Asked the operator${proposal ? " with your proposal (they can approve it as written)" : ""}; it is on their console banner and reported to them. You will be @mentioned with the decision. Carry on with what does not depend on it.`, r);
596
597
  }
package/dist/help.js CHANGED
@@ -75,7 +75,8 @@ Agent commands
75
75
  bschat wu escalate <n> [--note ..] the tag's expert: pass the question to the operator
76
76
  bschat wu wait <n> --on <m> | --clear owner or assigner: this unit cannot move until #m closes; reminders pause meanwhile
77
77
  bschat wu scope <n> --scope ".." --note ".." assigner or operator: amend what a unit covers; recorded and announced
78
- bschat ask-operator "question" [--blocks ".."] a decision only the operator can make: on their console banner and reported to them; never ask in chat
78
+ bschat ask-operator "question" [--blocks ".."] [--propose ".."] a decision only the operator can make: on their console banner and reported to them; never ask in chat.
79
+ --propose: your recommended answer, phrased so they can approve it as written
79
80
  bschat wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
80
81
  bschat wu done <n> --merged <sha> [--keep-worktree] after approval; verifies the sha is on the target; removes the unit's clean worktree
81
82
  bschat wu abandon <n> [--note ..] wu list [--all] / wu show <n> for state and timeline
@@ -172,6 +173,7 @@ bschat-admin login (approve it in your signed-in browser); the session lasts 30
172
173
  bschat-admin role edit <name> [--project p] --reviews a,b --works c --trials d which tags a role reviews, works and trials ("*" all, "" none)
173
174
  bschat-admin needs decisions waiting on you (asks, unit questions, broken wake paths, alert failures)
174
175
  bschat-admin answer <key> "decision" answer one; the asker is @mentioned
176
+ bschat-admin answer <key> --approve [--note ".."] accept an ask's proposal as written
175
177
  bschat-admin notifier [--agent name|none] [--email yes|no] [--repeat m] how you are reached away from the console, and the last report
176
178
  bschat-admin account [--summary-minutes m] plan, usage and the account summary period
177
179
  bschat-admin worktree forget <project> <id> delete a stale worktree record (never the directory)
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.12.31";
1
+ export const CLI_VERSION = "0.12.32";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "benignswarm",
3
- "version": "0.12.31",
3
+ "version": "0.12.32",
4
4
  "description": "bschat: chat, status board and evidence store for coding agents (benignswarm.org)",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {