benignswarm 0.12.5 → 0.12.7
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 +1 -1
- package/dist/client.js +2 -1
- package/dist/commands/agent.js +1 -1
- package/dist/commands/wu.js +29 -6
- package/dist/git.js +1 -1
- package/dist/help.js +6 -1
- package/dist/model.js +29 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
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"];
|
|
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"];
|
|
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"];
|
|
5
5
|
export function parse(argv) {
|
|
6
6
|
const options = {};
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { CliError } from "./errors.js";
|
|
2
2
|
import { collectAuto } from "./git.js";
|
|
3
|
+
import { resolveEffort } from "./model.js";
|
|
3
4
|
import { CLI_VERSION } from "./version.js";
|
|
4
5
|
import { noteServerVersions } from "./update.js";
|
|
5
6
|
export class Client {
|
|
@@ -19,7 +20,7 @@ export class Client {
|
|
|
19
20
|
* by the hook or the watcher, which say nothing about whether the agent is alive.
|
|
20
21
|
*/
|
|
21
22
|
static forAgent(c, model, opts = {}) {
|
|
22
|
-
return new Client(c.url, c.key, opts.presence === false ? null : { ...collectAuto({ model, machine: c.machine }) }, c.agent);
|
|
23
|
+
return new Client(c.url, c.key, opts.presence === false ? null : { ...collectAuto({ model, machine: c.machine, effort: resolveEffort(opts.effort, process.env, c.vendor) }) }, c.agent);
|
|
23
24
|
}
|
|
24
25
|
static forAdmin(c) {
|
|
25
26
|
return new Client(c.url, c.key, null);
|
package/dist/commands/agent.js
CHANGED
|
@@ -12,7 +12,7 @@ function agentClient(p) {
|
|
|
12
12
|
const name = resolveAgentName(str(p.flags, "as"));
|
|
13
13
|
const creds = loadAgent(name);
|
|
14
14
|
const model = resolveModel(str(p.flags, "model"), process.env, process.cwd(), name);
|
|
15
|
-
return { client: Client.forAgent(creds, model), creds };
|
|
15
|
+
return { client: Client.forAgent(creds, model, { effort: str(p.flags, "effort") }), creds };
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
18
|
* The project a command acts in. Project agents: their own. Account agents: --project or
|
package/dist/commands/wu.js
CHANGED
|
@@ -26,7 +26,7 @@ export async function wu(p, out) {
|
|
|
26
26
|
const sub = p.positionals[1];
|
|
27
27
|
const name = resolveAgentName(str(p.flags, "as"));
|
|
28
28
|
const creds = loadAgent(name);
|
|
29
|
-
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name));
|
|
29
|
+
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name), { effort: str(p.flags, "effort") });
|
|
30
30
|
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
31
31
|
if (!project)
|
|
32
32
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
@@ -45,7 +45,7 @@ export async function wu(p, out) {
|
|
|
45
45
|
const approvals = u.approvals.map((a) => a.name).join(", ");
|
|
46
46
|
return [
|
|
47
47
|
`WU #${u.number} [${u.status}] ${tags(u)} ${u.title}${flags ? ` (${flags})` : ""}`,
|
|
48
|
-
` owner ${u.owner_name}${reviewers ? ` · reviewers ${reviewers}` : ""}${approvals ? ` · approved by ${approvals}` : ""}${u.uncovered?.length ? ` · awaiting ${u.uncovered.map((t) => `#${t}`).join(" ")}` : ""}`,
|
|
48
|
+
` owner ${u.owner_name || "unassigned (queued)"}${reviewers ? ` · reviewers ${reviewers}` : ""}${approvals ? ` · approved by ${approvals}` : ""}${u.uncovered?.length ? ` · awaiting ${u.uncovered.map((t) => `#${t}`).join(" ")}` : ""}`,
|
|
49
49
|
` ${u.branch ? `${u.branch}${u.head ? ` @ ${u.head}` : ""}` : "no branch recorded"}${u.worktree ? ` in ${u.worktree.replace(/^\/(Users|home)\/[^/]+\//, "~/")}` : ""}${u.pr_url ? ` · ${u.pr_url}` : ""}${u.merged_sha ? ` · merged ${u.merged_sha}` : ""}${u.evidence.length ? ` · evidence ${u.evidence.map((e) => `evidence:${e}`).join(" ")}` : ""}`,
|
|
50
50
|
u.scope ? ` scope: ${u.scope}` : null,
|
|
51
51
|
].filter(Boolean).join("\n");
|
|
@@ -65,10 +65,26 @@ export async function wu(p, out) {
|
|
|
65
65
|
const title = p.positionals.slice(2).join(" ").trim();
|
|
66
66
|
const to = str(p.flags, "to");
|
|
67
67
|
if (!title || !to)
|
|
68
|
-
throw new CliError("usage", 'wu assign "<title>" --to <agent> --scope "<what it covers and does not>" [--tags a,b] [--evidence id] [--replay-of <n>]');
|
|
68
|
+
throw new CliError("usage", 'wu assign "<title>" --to <agent|auto|queue> --scope "<what it covers and does not>" [--tags a,b] [--evidence id] [--replay-of <n>]');
|
|
69
69
|
const replay = str(p.flags, "replay-of");
|
|
70
70
|
const r = await client.call("POST", `${base}/assign`, { to, title, scope: str(p.flags, "scope") ?? "", tags: list("tags"), evidence: list("evidence"), replay_of: replay ? Number(replay) : null, branch: str(p.flags, "branch") ?? null });
|
|
71
|
-
out.print(`${fmt(r.unit)}\
|
|
71
|
+
out.print(`${fmt(r.unit)}\n${r.unit.status === "queued" ? `Queued: nobody qualified is free; it goes to the first qualified worker with capacity (or bschat wu take ${r.unit.number} --to <agent>).` : `Assigned to ${r.unit.owner_name}; they start it with bschat wu start ${r.unit.number}.`}`, r);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
case "take": {
|
|
75
|
+
// Pull a queued unit: for yourself (qualified by works or trial), or for someone with --to (assigners).
|
|
76
|
+
const to = str(p.flags, "to") ?? null;
|
|
77
|
+
const r = await client.call("POST", `${base}/${num()}/take`, { to });
|
|
78
|
+
out.print(`${fmt(r.unit)}\n${to ? `Handed to ${r.unit.owner_name}.` : `Yours. Start it: bschat wu start ${r.unit.number}`}`, r);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
case "next": {
|
|
82
|
+
const r = await client.call("POST", `${base}/next`, {});
|
|
83
|
+
if (!r || !r.unit) {
|
|
84
|
+
out.print("(nothing queued that you qualify for)", { unit: null });
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
out.print(`${fmt(r.unit)}\nYours. Start it: bschat wu start ${r.unit.number}`, r);
|
|
72
88
|
return;
|
|
73
89
|
}
|
|
74
90
|
case "start": {
|
|
@@ -236,7 +252,7 @@ export async function wu(p, out) {
|
|
|
236
252
|
export async function processCmd(p, out) {
|
|
237
253
|
const name = resolveAgentName(str(p.flags, "as"));
|
|
238
254
|
const creds = loadAgent(name);
|
|
239
|
-
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name));
|
|
255
|
+
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name), { effort: str(p.flags, "effort") });
|
|
240
256
|
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
241
257
|
if (!project)
|
|
242
258
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
@@ -268,6 +284,13 @@ export async function record(p, out) {
|
|
|
268
284
|
if (!project)
|
|
269
285
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
270
286
|
const r = await client.call("GET", `/projects/${project}/record`);
|
|
271
|
-
const
|
|
287
|
+
const counters = (x) => ({ done: x.units, "1st-round": x.approved_first_round, changes: x.changes_requested, replays: x.replays, reviewed: x.reviewed, overturned: x.overturned, escalated: x.escalated });
|
|
288
|
+
if (str(p.flags, "by") === "model") {
|
|
289
|
+
// The same counters keyed by what produced the work: model and effort setting at the time of the start or the verdict.
|
|
290
|
+
const rows = (r.by_model ?? []).map((x) => ({ model: x.model, effort: x.effort, tag: `#${x.tag}`, ...counters(x), agents: x.agents.join(",") }));
|
|
291
|
+
out.print(rows.length ? table(rows, ["model", "effort", "tag", "done", "1st-round", "changes", "replays", "reviewed", "overturned", "escalated", "agents"]) : "(no reviewed units yet)", r);
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
const rows = r.record.map((x) => ({ agent: x.agent, tag: `#${x.tag}`, ...counters(x) }));
|
|
272
295
|
out.print(rows.length ? table(rows, ["agent", "tag", "done", "1st-round", "changes", "replays", "reviewed", "overturned", "escalated"]) : "(no reviewed units yet)", r);
|
|
273
296
|
}
|
package/dist/git.js
CHANGED
|
@@ -24,7 +24,7 @@ export function collectAuto(opts) {
|
|
|
24
24
|
dirty = status === null ? null : status.length > 0;
|
|
25
25
|
({ repo, base, merged, ahead } = mergeFacts(cwd, worktree));
|
|
26
26
|
}
|
|
27
|
-
return { model: opts.model && opts.model.length > 0 ? opts.model : "unknown", machine: opts.machine, cwd, worktree, branch, head, dirty, repo, base, merged, ahead };
|
|
27
|
+
return { model: opts.model && opts.model.length > 0 ? opts.model : "unknown", effort: opts.effort && opts.effort.length > 0 ? opts.effort : "unknown", machine: opts.machine, cwd, worktree, branch, head, dirty, repo, base, merged, ahead };
|
|
28
28
|
}
|
|
29
29
|
/** Where this worktree belongs and how it relates to the base branch. Local facts only; nothing is fetched. */
|
|
30
30
|
export function mergeFacts(cwd, worktree) {
|
package/dist/help.js
CHANGED
|
@@ -30,12 +30,17 @@ Agent commands
|
|
|
30
30
|
other channels appear as a one-line unread digest
|
|
31
31
|
bschat process the project's process: tag vocabulary, who reviews what, requirements, agreements
|
|
32
32
|
bschat wu open "<title>" --scope "..." [--tags a,b] [--evidence id] open a work unit; tags come from the vocabulary
|
|
33
|
-
bschat wu assign "<title>" --to <agent|auto> --scope ".." [--tags a,b] [--replay-of n] hand out a unit (assigner roles);
|
|
33
|
+
bschat wu assign "<title>" --to <agent|auto|queue> --scope ".." [--tags a,b] [--replay-of n] hand out a unit (assigner roles);
|
|
34
|
+
auto queues it when nobody qualified is free; queue waits deliberately
|
|
35
|
+
bschat wu take <n> [--to <agent>] pull a queued unit for yourself (qualified by works or trial), or hand it to someone
|
|
36
|
+
bschat wu next take the oldest queued unit you qualify for
|
|
34
37
|
--to auto picks the active worker qualified for the tags with the lightest load;
|
|
35
38
|
it exists on the board as assigned and the sweep chases it; wu decline <n> --note
|
|
36
39
|
bschat wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
|
|
37
40
|
target branch as of the original); --branch continues existing work; --here uses this checkout
|
|
38
41
|
bschat record per agent per tag: first-round approvals, changes, replays, reviews overturned
|
|
42
|
+
bschat record --by model the same, keyed by model and effort setting (stamped on start and on each verdict)
|
|
43
|
+
Global: --effort <high|medium|low|...> reasoning effort to report (else BSCHAT_EFFORT, CLAUDE_EFFORT, codex model_reasoning_effort)
|
|
39
44
|
bschat wu submit <n> [--evidence id] [--pr url] ask for review; routed to whoever is qualified for the tags
|
|
40
45
|
bschat wu approve|changes <n> --note ".." your approval covers the tags your role reviews; classify <n> --tags a,b
|
|
41
46
|
bschat wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
|
package/dist/model.js
CHANGED
|
@@ -75,6 +75,35 @@ export function modelFromHarnessConfig(vendor, cwd = process.cwd(), env = proces
|
|
|
75
75
|
}
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
|
+
/**
|
|
79
|
+
* Reasoning effort: --effort, BSCHAT_EFFORT, then what the harness itself exposes (Claude Code's
|
|
80
|
+
* CLAUDE_EFFORT, Codex's model_reasoning_effort in config.toml), else "unknown". Never a guess.
|
|
81
|
+
*/
|
|
82
|
+
export function resolveEffort(flag, env = process.env, vendor = null, cwd = process.cwd()) {
|
|
83
|
+
if (flag)
|
|
84
|
+
return flag;
|
|
85
|
+
if (env.BSCHAT_EFFORT)
|
|
86
|
+
return env.BSCHAT_EFFORT;
|
|
87
|
+
const v = detectVendor(env) ?? vendor;
|
|
88
|
+
try {
|
|
89
|
+
if (v === "claude-code" && env.CLAUDE_EFFORT)
|
|
90
|
+
return env.CLAUDE_EFFORT;
|
|
91
|
+
if (v === "codex") {
|
|
92
|
+
const home = env.HOME ?? homedir();
|
|
93
|
+
for (const p of [join(cwd, ".codex", "config.toml"), join(home, ".codex", "config.toml")]) {
|
|
94
|
+
if (!existsSync(p))
|
|
95
|
+
continue;
|
|
96
|
+
const m = /^\s*model_reasoning_effort\s*=\s*"([^"]+)"/m.exec(readFileSync(p, "utf8"));
|
|
97
|
+
if (m)
|
|
98
|
+
return m[1];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return "unknown";
|
|
104
|
+
}
|
|
105
|
+
return "unknown";
|
|
106
|
+
}
|
|
78
107
|
/**
|
|
79
108
|
* Resolution order: --model, BSCHAT_MODEL, the model the hook last observed for this identity
|
|
80
109
|
* (exact id from Claude Code's hook input or transcript), the harness config, the repo identity
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.12.
|
|
1
|
+
export const CLI_VERSION = "0.12.7";
|