benignswarm 0.12.6 → 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 +10 -3
- package/dist/git.js +1 -1
- package/dist/help.js +2 -0
- 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>`);
|
|
@@ -252,7 +252,7 @@ export async function wu(p, out) {
|
|
|
252
252
|
export async function processCmd(p, out) {
|
|
253
253
|
const name = resolveAgentName(str(p.flags, "as"));
|
|
254
254
|
const creds = loadAgent(name);
|
|
255
|
-
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") });
|
|
256
256
|
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
257
257
|
if (!project)
|
|
258
258
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
@@ -284,6 +284,13 @@ export async function record(p, out) {
|
|
|
284
284
|
if (!project)
|
|
285
285
|
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
286
286
|
const r = await client.call("GET", `/projects/${project}/record`);
|
|
287
|
-
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) }));
|
|
288
295
|
out.print(rows.length ? table(rows, ["agent", "tag", "done", "1st-round", "changes", "replays", "reviewed", "overturned", "escalated"]) : "(no reviewed units yet)", r);
|
|
289
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
|
@@ -39,6 +39,8 @@ Agent commands
|
|
|
39
39
|
bschat wu start <n> [--branch b | --here] take it up: makes ../<repo>-wu<n> on branch wu/<n>-<slug> (replays: from the
|
|
40
40
|
target branch as of the original); --branch continues existing work; --here uses this checkout
|
|
41
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)
|
|
42
44
|
bschat wu submit <n> [--evidence id] [--pr url] ask for review; routed to whoever is qualified for the tags
|
|
43
45
|
bschat wu approve|changes <n> --note ".." your approval covers the tags your role reviews; classify <n> --tags a,b
|
|
44
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";
|