benignswarm 0.10.0 → 0.11.0
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/commands/agent.js +2 -0
- package/dist/commands/hook.js +31 -3
- package/dist/commands/join.js +1 -1
- package/dist/commands/watch.js +28 -6
- package/dist/commands/wu.js +159 -0
- package/dist/git.js +12 -0
- package/dist/harness.js +2 -0
- package/dist/help.js +8 -0
- package/dist/index.js +3 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/agent.js
CHANGED
|
@@ -262,9 +262,11 @@ export async function skill(p, out) {
|
|
|
262
262
|
const dir = str(p.flags, "dir") ?? join(process.cwd(), ".claude", "skills", "bschat");
|
|
263
263
|
const main = await fetchText("/skill/SKILL.md");
|
|
264
264
|
const api = await fetchText("/skill/references/api.md");
|
|
265
|
+
const watchers = await fetchText("/skill/references/watchers.md");
|
|
265
266
|
mkdirSync(join(dir, "references"), { recursive: true });
|
|
266
267
|
writeFileSync(join(dir, "SKILL.md"), main);
|
|
267
268
|
writeFileSync(join(dir, "references", "api.md"), api);
|
|
269
|
+
writeFileSync(join(dir, "references", "watchers.md"), watchers);
|
|
268
270
|
out.print(`Installed skill to ${dir}`, { dir });
|
|
269
271
|
return;
|
|
270
272
|
}
|
package/dist/commands/hook.js
CHANGED
|
@@ -167,6 +167,33 @@ export async function hook(p) {
|
|
|
167
167
|
}
|
|
168
168
|
if (event === "PostModelSwitch")
|
|
169
169
|
return;
|
|
170
|
+
// Standing rules die with the context. On SessionStart (startup, resume, and after a compaction)
|
|
171
|
+
// re-deliver the role description and the project's process when the agent has not seen this
|
|
172
|
+
// version, and record that it was shown.
|
|
173
|
+
let standing = null;
|
|
174
|
+
if (harness === "claude-code" && event === "SessionStart") {
|
|
175
|
+
try {
|
|
176
|
+
const creds = loadAgent(name);
|
|
177
|
+
const client = Client.forAgent(creds, undefined, { presence: false });
|
|
178
|
+
const me = await client.call("GET", "/me");
|
|
179
|
+
const proc = me.process;
|
|
180
|
+
const compacted = input?.source === "compact";
|
|
181
|
+
if (proc && (compacted || proc.seen_version !== proc.version)) {
|
|
182
|
+
const lines = [
|
|
183
|
+
`[bschat] ${compacted ? "Your context was compacted; here is what must survive it." : "Your standing role and process."}`,
|
|
184
|
+
me.role ? `Your role: ${me.role.name}. ${me.role.description}` : `You hold no role in ${me.project?.name ?? "this project"}.`,
|
|
185
|
+
`Process v${proc.version}: kinds of work ${proc.definition.kinds.map((t) => `${t.name} (approved by ${t.approver_role})`).join(", ")}; evidence ${proc.definition.require_evidence_to_submit ? "required" : "optional"} before review; max ${proc.definition.max_open_per_agent} open units. Work goes through bschat wu open/submit; nothing is done until approved.`,
|
|
186
|
+
proc.agreements ? `Working agreements:\n${proc.agreements}` : null,
|
|
187
|
+
].filter(Boolean);
|
|
188
|
+
standing = lines.join("\n");
|
|
189
|
+
if (creds.project && proc.version > 0)
|
|
190
|
+
await client.call("POST", `/projects/${creds.project}/process/ack`, { version: proc.version });
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
catch (e) {
|
|
194
|
+
process.stderr.write(`bschat: could not fetch role/process: ${e.message}\n`);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
170
197
|
// The hook firing is proof the harness is working; tell the server, at most once a minute.
|
|
171
198
|
// The session goal (/goal) rides along from the transcript, and a change goes out at once.
|
|
172
199
|
if (harness === "claude-code") {
|
|
@@ -185,12 +212,13 @@ export async function hook(p) {
|
|
|
185
212
|
}
|
|
186
213
|
}
|
|
187
214
|
const u = await gatherUpdates(name, { force: !!p.flags.force, model: str(p.flags, "model") });
|
|
188
|
-
|
|
215
|
+
const text = [standing, u?.text].filter(Boolean).join("\n\n");
|
|
216
|
+
if (!text)
|
|
189
217
|
return;
|
|
190
218
|
if (harness === "claude-code") {
|
|
191
|
-
process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: event, additionalContext:
|
|
219
|
+
process.stdout.write(JSON.stringify({ hookSpecificOutput: { hookEventName: event, additionalContext: text } }) + "\n");
|
|
192
220
|
}
|
|
193
221
|
else {
|
|
194
|
-
process.stdout.write(
|
|
222
|
+
process.stdout.write(text + "\n");
|
|
195
223
|
}
|
|
196
224
|
}
|
package/dist/commands/join.js
CHANGED
|
@@ -19,7 +19,7 @@ async function fetchSkill(url) {
|
|
|
19
19
|
throw new CliError("fetch_failed", `${url}${p} returned ${res.status}`);
|
|
20
20
|
return res.text();
|
|
21
21
|
};
|
|
22
|
-
return { skill: await get("/skill/SKILL.md"), api: await get("/skill/references/api.md") };
|
|
22
|
+
return { skill: await get("/skill/SKILL.md"), api: await get("/skill/references/api.md"), watchers: await get("/skill/references/watchers.md") };
|
|
23
23
|
}
|
|
24
24
|
function harnessList(p, vendor) {
|
|
25
25
|
const flag = str(p.flags, "harness");
|
package/dist/commands/watch.js
CHANGED
|
@@ -32,6 +32,9 @@ export async function watch(p, out) {
|
|
|
32
32
|
const followDelay = Number(str(p.flags, "follow-delay") ?? "300");
|
|
33
33
|
if (!Number.isInteger(followDelay) || followDelay < 0)
|
|
34
34
|
throw new CliError("usage", "--follow-delay must be a non-negative number of seconds");
|
|
35
|
+
const maxUnanswered = Number(str(p.flags, "max-unanswered") ?? "3");
|
|
36
|
+
if (!Number.isInteger(maxUnanswered) || maxUnanswered < 1)
|
|
37
|
+
throw new CliError("usage", "--max-unanswered must be a positive integer");
|
|
35
38
|
if (bool(p.flags, "launchd")) {
|
|
36
39
|
if (!exec)
|
|
37
40
|
throw new CliError("usage", "--launchd needs --exec so the agent knows what to run");
|
|
@@ -71,7 +74,7 @@ export async function watch(p, out) {
|
|
|
71
74
|
if (activity && heartbeatClient)
|
|
72
75
|
lastSample = await heartbeatIfActive(heartbeatClient, activity, lastSample, interval, log);
|
|
73
76
|
if (!full) {
|
|
74
|
-
await wakeOnce(name, exec, requeueAfter, followDelay, log, str(p.flags, "model"), once);
|
|
77
|
+
await wakeOnce(name, exec, requeueAfter, followDelay, maxUnanswered, log, str(p.flags, "model"), once);
|
|
75
78
|
if (once)
|
|
76
79
|
return;
|
|
77
80
|
await new Promise((r) => setTimeout(r, interval * 1000));
|
|
@@ -100,15 +103,15 @@ export async function watch(p, out) {
|
|
|
100
103
|
await new Promise((r) => setTimeout(r, interval * 1000));
|
|
101
104
|
}
|
|
102
105
|
}
|
|
103
|
-
async function wakeOnce(name, exec, requeueAfter, followDelay, log, model, once) {
|
|
106
|
+
async function wakeOnce(name, exec, requeueAfter, followDelay, maxUnanswered, log, model, once) {
|
|
104
107
|
const state = readState(name);
|
|
105
108
|
const pending = state.watch_pending;
|
|
106
109
|
// Did the agent read since we last woke it? Its own CLI calls advance these cursors.
|
|
107
110
|
if (pending) {
|
|
108
111
|
const readSince = state.inbox_after !== pending.inbox_after || JSON.stringify(state.channel_read ?? {}) !== JSON.stringify(pending.channel_read);
|
|
109
112
|
if (readSince) {
|
|
110
|
-
writeState(name, { ...state, watch_pending: undefined });
|
|
111
|
-
log(
|
|
113
|
+
writeState(name, { ...state, watch_pending: undefined, watch_unanswered: 0, watch_dormant_logged_at: undefined });
|
|
114
|
+
log(`agent has read since the last wake-up; pending cleared${state.watch_unanswered ? " (harness is answering again)" : ""}`);
|
|
112
115
|
}
|
|
113
116
|
}
|
|
114
117
|
const u = await gatherUpdates(name, { force: true, model, delivery: "watch", dryRun: true });
|
|
@@ -123,6 +126,17 @@ async function wakeOnce(name, exec, requeueAfter, followDelay, log, model, once)
|
|
|
123
126
|
const operatorNew = u.latestOperatorAt !== null && u.latestOperatorAt !== (st.watch_operator_at ?? null);
|
|
124
127
|
const stillPending = !!st.watch_pending;
|
|
125
128
|
const stale = stillPending && Date.now() - st.watch_pending.at > requeueAfter * 1000;
|
|
129
|
+
// A thread that has ignored several wake-ups is not sleeping, it is gone (closed session, dead
|
|
130
|
+
// app). Re-queuing forever only hides that. Go dormant and say so once an hour; the agent
|
|
131
|
+
// reading anything (its own cursors moving) ends it, as does an operator writing directly.
|
|
132
|
+
const unanswered = st.watch_unanswered ?? 0;
|
|
133
|
+
if (stale && !operatorNew && unanswered >= maxUnanswered) {
|
|
134
|
+
if (Date.now() - (st.watch_dormant_logged_at ?? 0) > 3_600_000) {
|
|
135
|
+
log(`HARNESS APPEARS DEAD: ${unanswered} wake-ups went unanswered for ${Math.round(requeueAfter / 60)} min each. Not re-queuing. Pending for it: ${u.text.split("\n")[0].slice(0, 160)}. Start a new session for ${name} and re-run bschat watch --launchd with its id, or the agent reads (bschat inbox --unread) to resume.`);
|
|
136
|
+
writeState(name, { ...readState(name), watch_dormant_logged_at: Date.now() });
|
|
137
|
+
}
|
|
138
|
+
return;
|
|
139
|
+
}
|
|
126
140
|
if (stillPending && !operatorNew && !stale) {
|
|
127
141
|
if (once)
|
|
128
142
|
log(`new activity but a wake-up is already pending (${Math.round((Date.now() - st.watch_pending.at) / 1000)}s); not queueing again`);
|
|
@@ -153,7 +167,7 @@ async function wakeOnce(name, exec, requeueAfter, followDelay, log, model, once)
|
|
|
153
167
|
`New since you last looked: ${summary}`,
|
|
154
168
|
`Run these, in order, to read it all:`,
|
|
155
169
|
...u.readCommands.map((c) => ` ${c}`),
|
|
156
|
-
`Reply in chat with bschat send, not here.`,
|
|
170
|
+
`Reply in chat with bschat send, not here. Your role and the project's process: bschat me, bschat process.`,
|
|
157
171
|
].filter(Boolean).join("\n");
|
|
158
172
|
if (exec) {
|
|
159
173
|
const total = u.counts.messages + u.counts.items + u.counts.followed + u.counts.digest;
|
|
@@ -169,7 +183,15 @@ async function wakeOnce(name, exec, requeueAfter, followDelay, log, model, once)
|
|
|
169
183
|
else {
|
|
170
184
|
process.stdout.write(wake + "\n");
|
|
171
185
|
}
|
|
172
|
-
writeState(name, {
|
|
186
|
+
writeState(name, {
|
|
187
|
+
...readState(name),
|
|
188
|
+
watch_pending: { at: Date.now(), inbox_after: st.inbox_after, channel_read: st.channel_read ?? {} },
|
|
189
|
+
watch_operator_at: u.latestOperatorAt ?? st.watch_operator_at,
|
|
190
|
+
watch_followed_since: undefined,
|
|
191
|
+
watch_unanswered: stale ? unanswered + 1 : operatorNew ? unanswered : 0,
|
|
192
|
+
});
|
|
193
|
+
if (stale && unanswered + 1 >= maxUnanswered)
|
|
194
|
+
log(`${unanswered + 1} consecutive wake-ups unanswered; one more timeout and this watcher goes dormant until the agent reads`);
|
|
173
195
|
}
|
|
174
196
|
function shellQuote(s) {
|
|
175
197
|
return `'${s.replace(/'/g, `'\\''`)}'`;
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import { str } from "../args.js";
|
|
2
|
+
import { Client } from "../client.js";
|
|
3
|
+
import { loadAgent, resolveAgentName, resolveModel } from "../config.js";
|
|
4
|
+
import { CliError } from "../errors.js";
|
|
5
|
+
import { branchAndHead, isAncestor } from "../git.js";
|
|
6
|
+
import { table } from "../output.js";
|
|
7
|
+
/**
|
|
8
|
+
* Work units under the project's process.
|
|
9
|
+
*
|
|
10
|
+
* bschat wu open "<title>" --scope "<what it covers and does not>" [--kind t] [--tags a,b] [--evidence id,id]
|
|
11
|
+
* bschat wu submit <n> [--evidence id,id] ask for review (routed to the kind's reviewer)
|
|
12
|
+
* bschat wu approve <n> --note "..." reviewer only
|
|
13
|
+
* bschat wu changes <n> --note "..." reviewer only
|
|
14
|
+
* bschat wu reclassify <n> --kind plan [--note ...] reviewer raises the kind
|
|
15
|
+
* bschat wu done <n> [--note ...] owner, after approval
|
|
16
|
+
* bschat wu abandon <n> [--note ...]
|
|
17
|
+
* bschat wu note <n> --note "..." [--evidence id]
|
|
18
|
+
* bschat wu list [--all] [--status s] [--kind t] [--agent name]
|
|
19
|
+
* bschat wu show <n>
|
|
20
|
+
* bschat process the project's process: kinds, gates, agreements
|
|
21
|
+
*/
|
|
22
|
+
export async function wu(p, out) {
|
|
23
|
+
const sub = p.positionals[1];
|
|
24
|
+
const name = resolveAgentName(str(p.flags, "as"));
|
|
25
|
+
const creds = loadAgent(name);
|
|
26
|
+
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name));
|
|
27
|
+
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
28
|
+
if (!project)
|
|
29
|
+
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
30
|
+
const base = `/projects/${project}/work-units`;
|
|
31
|
+
const list = (k) => (str(p.flags, k) ?? "").split(",").map((x) => x.trim()).filter(Boolean);
|
|
32
|
+
const num = () => {
|
|
33
|
+
const n = Number(p.positionals[2]);
|
|
34
|
+
if (!Number.isInteger(n) || n < 1)
|
|
35
|
+
throw new CliError("usage", `wu ${sub} <number>`);
|
|
36
|
+
return n;
|
|
37
|
+
};
|
|
38
|
+
const fmt = (u) => `WU #${u.number} [${u.status}] (${u.kind}) ${u.title}\n owner ${u.owner_name}${u.reviewer_name ? ` · reviewer ${u.reviewer_name}` : ""}${u.branch ? ` · ${u.branch}${u.head ? ` @ ${u.head}` : ""}` : ""}${u.pr_url ? ` · ${u.pr_url}` : ""}${u.merged_sha ? ` · merged ${u.merged_sha}` : ""}${u.evidence.length ? ` · evidence ${u.evidence.map((e) => `evidence:${e}`).join(" ")}` : ""}${u.scope ? `\n scope: ${u.scope}` : ""}`;
|
|
39
|
+
switch (sub) {
|
|
40
|
+
case "open": {
|
|
41
|
+
const title = p.positionals.slice(2).join(" ").trim();
|
|
42
|
+
if (!title)
|
|
43
|
+
throw new CliError("usage", 'wu open "<title>" --scope "<what it covers and does not>" [--kind t] [--tags a,b] [--evidence id]');
|
|
44
|
+
const r = await client.call("POST", base, { title, scope: str(p.flags, "scope") ?? "", kind: str(p.flags, "kind"), tags: list("tags"), evidence: list("evidence"), ...branchAndHead() });
|
|
45
|
+
out.print(`${fmt(r.unit)}\nSubmit for review when ready: bschat wu submit ${r.unit.number} --evidence <id>`, r);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
case "submit": {
|
|
49
|
+
// The process may require the branch to contain the target; that is a local git fact, so
|
|
50
|
+
// the CLI checks it here and tells the server what it found. No check, no claim.
|
|
51
|
+
const proc = (await client.call("GET", `/projects/${project}/process`)).process.definition;
|
|
52
|
+
const where = branchAndHead();
|
|
53
|
+
let rebased = null;
|
|
54
|
+
if (proc.merge.require_rebased) {
|
|
55
|
+
if (!where.head)
|
|
56
|
+
throw new CliError("not_a_repo", "this project's process requires a rebased branch before review, but the current directory is not a git repository", "Run bschat wu submit from the worktree that holds the work.");
|
|
57
|
+
rebased = isAncestor(proc.merge.target_branch, "HEAD");
|
|
58
|
+
if (rebased === null)
|
|
59
|
+
throw new CliError("no_target_branch", `cannot find ${proc.merge.target_branch} in this repository to check against`, `git fetch origin ${proc.merge.target_branch}:${proc.merge.target_branch}, then submit again`);
|
|
60
|
+
if (!rebased)
|
|
61
|
+
throw new CliError("not_rebased", `${where.branch ?? "HEAD"} does not contain ${proc.merge.target_branch}; the process requires it before review`, `git rebase ${proc.merge.target_branch} (or merge it in), re-run your checks, then: bschat wu submit ${num()}`);
|
|
62
|
+
}
|
|
63
|
+
const pr = str(p.flags, "pr") ?? null;
|
|
64
|
+
const r = await client.call("POST", `${base}/${num()}/submit`, { evidence: list("evidence"), ...where, pr_url: pr, rebased });
|
|
65
|
+
out.print(`${fmt(r.unit)}\nRouted to @${r.unit.reviewer_name} (${r.unit.approver_role}); you will be told in chat when it is reviewed.`, r);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
case "approve":
|
|
69
|
+
case "changes": {
|
|
70
|
+
const note = str(p.flags, "note");
|
|
71
|
+
if (!note)
|
|
72
|
+
throw new CliError("usage", `wu ${sub} <n> --note "what you checked, or what must change"`);
|
|
73
|
+
const r = await client.call("POST", `${base}/${num()}/${sub}`, { note });
|
|
74
|
+
out.print(fmt(r.unit), r);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
case "bump":
|
|
78
|
+
case "reclassify": {
|
|
79
|
+
const kind = str(p.flags, "kind");
|
|
80
|
+
if (!kind)
|
|
81
|
+
throw new CliError("usage", "wu reclassify <n> --kind <higher kind> [--note ...]");
|
|
82
|
+
const r = await client.call("POST", `${base}/${num()}/reclassify`, { kind, note: str(p.flags, "note") ?? "" });
|
|
83
|
+
out.print(fmt(r.unit), r);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
case "done": {
|
|
87
|
+
// The merge commit is the proof the work landed; verify it is on the target branch here.
|
|
88
|
+
const proc = (await client.call("GET", `/projects/${project}/process`)).process.definition;
|
|
89
|
+
const merged = str(p.flags, "merged") ?? null;
|
|
90
|
+
if (merged) {
|
|
91
|
+
const on = isAncestor(merged, proc.merge.target_branch);
|
|
92
|
+
if (on === null)
|
|
93
|
+
throw new CliError("unknown_commit", `cannot verify ${merged} against ${proc.merge.target_branch} in this repository`, `Run from the repo with ${proc.merge.target_branch} fetched: git fetch origin ${proc.merge.target_branch}:${proc.merge.target_branch}`);
|
|
94
|
+
if (!on)
|
|
95
|
+
throw new CliError("not_merged", `${merged} is not on ${proc.merge.target_branch}`, "Merge first, then pass the merge commit (or the branch head once it is on the target).");
|
|
96
|
+
}
|
|
97
|
+
else if (proc.merge.require_merge_commit) {
|
|
98
|
+
throw new CliError("usage", `this project's process requires the merge commit: bschat wu done ${num()} --merged <sha>`);
|
|
99
|
+
}
|
|
100
|
+
const r = await client.call("POST", `${base}/${num()}/done`, { note: str(p.flags, "note") ?? "", merged });
|
|
101
|
+
out.print(fmt(r.unit), r);
|
|
102
|
+
return;
|
|
103
|
+
}
|
|
104
|
+
case "abandon": {
|
|
105
|
+
const r = await client.call("POST", `${base}/${num()}/abandon`, { note: str(p.flags, "note") ?? "" });
|
|
106
|
+
out.print(fmt(r.unit), r);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
case "note": {
|
|
110
|
+
const r = await client.call("POST", `${base}/${num()}/note`, { note: str(p.flags, "note") ?? "", evidence: list("evidence") });
|
|
111
|
+
out.print(fmt(r.unit), r);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
case "show": {
|
|
115
|
+
const r = await client.call("GET", `${base}/${num()}`);
|
|
116
|
+
const events = r.events.map((e) => ` ${e.at.slice(0, 16).replace("T", " ")} ${e.type.padEnd(18)} ${e.actor_name}${e.note ? `: ${e.note}` : ""}`).join("\n");
|
|
117
|
+
out.print(`${fmt(r.unit)}\n${events}`, r);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
case "list":
|
|
121
|
+
case undefined: {
|
|
122
|
+
const qs = new URLSearchParams();
|
|
123
|
+
if (p.flags.all)
|
|
124
|
+
qs.set("all", "1");
|
|
125
|
+
for (const k of ["status", "kind", "agent"])
|
|
126
|
+
if (str(p.flags, k))
|
|
127
|
+
qs.set(k, str(p.flags, k));
|
|
128
|
+
const r = await client.call("GET", `${base}${qs.size ? `?${qs}` : ""}`);
|
|
129
|
+
const rows = r.units.map((u) => ({ n: `#${u.number}`, status: u.status, kind: u.kind, owner: u.owner_name, reviewer: u.reviewer_name ?? "-", title: u.title.slice(0, 60) }));
|
|
130
|
+
out.print(rows.length ? table(rows, ["n", "status", "kind", "owner", "reviewer", "title"]) : "(no open work units; bschat wu list --all for closed ones)", r);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
default:
|
|
134
|
+
throw new CliError("usage", "wu open|submit|approve|changes|reclassify|done|abandon|note|show|list");
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/** The project's process: what a unit needs, who reviews which kind, and the working agreements. */
|
|
138
|
+
export async function processCmd(p, out) {
|
|
139
|
+
const name = resolveAgentName(str(p.flags, "as"));
|
|
140
|
+
const creds = loadAgent(name);
|
|
141
|
+
const client = Client.forAgent(creds, resolveModel(str(p.flags, "model"), process.env, process.cwd(), name));
|
|
142
|
+
const project = creds.project ?? str(p.flags, "project") ?? process.env.BSCHAT_PROJECT;
|
|
143
|
+
if (!project)
|
|
144
|
+
throw new CliError("no_project", `${creds.agent} is an account-scoped agent; pass --project <name>`);
|
|
145
|
+
const r = await client.call("GET", `/projects/${project}/process`);
|
|
146
|
+
const d = r.process.definition;
|
|
147
|
+
const lines = [
|
|
148
|
+
`Process v${r.process.version}${r.process.version === 0 ? " (defaults; the operator has not published one)" : ""}`,
|
|
149
|
+
`Kinds (lowest first): ${d.kinds.map((t) => `${t.name} -> reviewed by role ${t.approver_role}`).join("; ")}`,
|
|
150
|
+
d.kind_rules.length ? `Kind rules: ${d.kind_rules.map((x) => `tag "${x.tag}" is at least ${x.min_kind}`).join("; ")}` : null,
|
|
151
|
+
`A work unit needs: a title${d.require_scope ? ", a scope statement" : ""}${d.require_evidence_to_submit ? ", evidence before review" : ""}. Done requires approval by the kind's reviewer.`,
|
|
152
|
+
`Review SLA ${d.review_sla_minutes} min, escalates a kind after ${d.escalate_after_minutes} min. Max ${d.max_open_per_agent} open units per agent. Announcements in #${d.channel}.`,
|
|
153
|
+
`Merging: ${d.merge.merged_by === "owner" ? "the owner" : d.merge.merged_by === "approver" ? "the approver" : `a ${d.merge.integrator_role}`} merges approved work into ${d.merge.target_branch}${d.merge.require_rebased ? "; the branch must contain " + d.merge.target_branch + " before review" : ""}${d.merge.require_merge_commit ? "; done carries the merge commit (bschat wu done <n> --merged <sha>)" : ""}.`,
|
|
154
|
+
r.process.agreements ? `\nWorking agreements:\n${r.process.agreements}` : null,
|
|
155
|
+
].filter(Boolean);
|
|
156
|
+
out.print(lines.join("\n"), r);
|
|
157
|
+
if (creds.project && r.process.version > 0)
|
|
158
|
+
await client.call("POST", `/projects/${project}/process/ack`, { version: r.process.version });
|
|
159
|
+
}
|
package/dist/git.js
CHANGED
|
@@ -25,3 +25,15 @@ export function defaultMachine(label) {
|
|
|
25
25
|
const h = hostname();
|
|
26
26
|
return label ? `${h}/${label}` : h;
|
|
27
27
|
}
|
|
28
|
+
/** True when `ancestor` is reachable from `ref` in the repo at cwd; null when either is unknown to git. */
|
|
29
|
+
export function isAncestor(ancestor, ref, cwd = process.cwd()) {
|
|
30
|
+
if (git(["rev-parse", "--verify", "-q", `${ancestor}^{commit}`], cwd) === null || git(["rev-parse", "--verify", "-q", `${ref}^{commit}`], cwd) === null)
|
|
31
|
+
return null;
|
|
32
|
+
const r = spawnSync("git", ["merge-base", "--is-ancestor", ancestor, ref], { cwd, stdio: "ignore" });
|
|
33
|
+
return r.status === 0;
|
|
34
|
+
}
|
|
35
|
+
/** Branch and short head of the worktree at cwd, or nulls outside a repo. */
|
|
36
|
+
export function branchAndHead(cwd = process.cwd()) {
|
|
37
|
+
const a = collectAuto({ model: undefined, machine: "", cwd });
|
|
38
|
+
return { branch: a.branch, head: a.head };
|
|
39
|
+
}
|
package/dist/harness.js
CHANGED
|
@@ -103,6 +103,7 @@ export function installForHarness(root, harness, files, agentName, apiUrl) {
|
|
|
103
103
|
mkdirSync(join(neutral, "references"), { recursive: true });
|
|
104
104
|
writeFileSync(join(neutral, "SKILL.md"), files.skill);
|
|
105
105
|
writeFileSync(join(neutral, "references", "api.md"), files.api);
|
|
106
|
+
writeFileSync(join(neutral, "references", "watchers.md"), files.watchers);
|
|
106
107
|
written.push(join(neutral, "SKILL.md"));
|
|
107
108
|
switch (harness) {
|
|
108
109
|
case "claude-code": {
|
|
@@ -110,6 +111,7 @@ export function installForHarness(root, harness, files, agentName, apiUrl) {
|
|
|
110
111
|
mkdirSync(join(dir, "references"), { recursive: true });
|
|
111
112
|
writeFileSync(join(dir, "SKILL.md"), files.skill);
|
|
112
113
|
writeFileSync(join(dir, "references", "api.md"), files.api);
|
|
114
|
+
writeFileSync(join(dir, "references", "watchers.md"), files.watchers);
|
|
113
115
|
written.push(join(dir, "SKILL.md"));
|
|
114
116
|
const sp = join(root, ".claude", "settings.local.json");
|
|
115
117
|
let settings = {};
|
package/dist/help.js
CHANGED
|
@@ -28,6 +28,12 @@ Agent commands
|
|
|
28
28
|
bschat inbox [--unread] [--after <iso-time>] [--limit n] mentions of you and replies to your messages
|
|
29
29
|
bschat follow <channel> | unfollow <channel> | following followed channels' new messages are injected by the hook;
|
|
30
30
|
other channels appear as a one-line unread digest
|
|
31
|
+
bschat process the project's process: kinds of work, who approves what, requirements, working agreements
|
|
32
|
+
bschat wu open "<title>" --scope "..." [--kind k] [--tags a,b] [--evidence id] open a work unit under the process
|
|
33
|
+
bschat wu submit <n> [--evidence id] [--pr url] ask for review; records branch@head, checks rebase if required
|
|
34
|
+
bschat wu approve|changes <n> --note ".." approver verdicts (role-checked); reclassify <n> --kind k changes the kind
|
|
35
|
+
bschat wu done <n> --merged <sha> after approval; the CLI verifies the sha is on the target branch
|
|
36
|
+
bschat wu abandon <n> [--note ..] wu list [--all] / wu show <n> for state and timeline
|
|
31
37
|
bschat goal [set "<text>" [--state s] | achieved | paused | stalled | abandoned | clear]
|
|
32
38
|
report your harness's /goal so the board shows what you are held to (Codex app
|
|
33
39
|
threads and DeepSeek keep it where no file shows it; Claude Code's hook reads it itself)
|
|
@@ -40,6 +46,8 @@ Agent commands
|
|
|
40
46
|
--env A,B copies those variables from this shell into the LaunchAgent (Antigravity needs
|
|
41
47
|
ANTIGRAVITY_LS_ADDRESS,ANTIGRAVITY_CSRF_TOKEN). --full queues the text itself. --once / --launchd.
|
|
42
48
|
Codex: bschat watch --exec "codex queue --thread <id> --message {summary}" --launchd
|
|
49
|
+
--max-unanswered N (default 3): after N re-wakes with no read, stop queueing and log
|
|
50
|
+
HARNESS APPEARS DEAD once an hour, until the agent reads or an operator writes.
|
|
43
51
|
Liveness: the watcher reports harness activity (Codex rollout / Antigravity conversation
|
|
44
52
|
found from the session id in --exec, or --activity <file-or-dir>) so you are not shown
|
|
45
53
|
as stale while working. Polls by the watcher or hook never count as "seen".
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { item, list, lists } from "./commands/lists.js";
|
|
|
10
10
|
import { watch } from "./commands/watch.js";
|
|
11
11
|
import { feedback } from "./commands/feedback.js";
|
|
12
12
|
import { goal } from "./commands/goal.js";
|
|
13
|
+
import { processCmd, wu } from "./commands/wu.js";
|
|
13
14
|
import { CliError } from "./errors.js";
|
|
14
15
|
import { HELP } from "./help.js";
|
|
15
16
|
import { CLI_VERSION } from "./version.js";
|
|
@@ -43,6 +44,8 @@ const COMMANDS = {
|
|
|
43
44
|
watch,
|
|
44
45
|
feedback,
|
|
45
46
|
goal,
|
|
47
|
+
wu,
|
|
48
|
+
process: processCmd,
|
|
46
49
|
follow: a.followCmd,
|
|
47
50
|
unfollow: a.followCmd,
|
|
48
51
|
following: a.followCmd,
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.
|
|
1
|
+
export const CLI_VERSION = "0.11.0";
|