benignswarm 0.12.152 → 0.12.154
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/commands/codex-start.js +72 -9
- package/dist/commands/machine.js +15 -2
- package/dist/commands/routing-admin.js +36 -0
- package/dist/commands/ux.js +60 -5
- package/dist/commands/watch.js +75 -26
- package/dist/commands/wu.js +97 -10
- package/dist/help.js +8 -4
- package/dist/ux-jobs.js +533 -127
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/commands/wu.js
CHANGED
|
@@ -70,6 +70,52 @@ function jsonFlag(p, key, expected) {
|
|
|
70
70
|
throw new CliError("usage", `--${key} must be JSON ${expected}`);
|
|
71
71
|
}
|
|
72
72
|
}
|
|
73
|
+
/** Read the send-back review body's structured points before contacting the API. */
|
|
74
|
+
export function sendbackRuleFromFile(file) {
|
|
75
|
+
if (!file?.trim())
|
|
76
|
+
throw new CliError("usage", "wu sendback-rule <n> --file ruling.json");
|
|
77
|
+
let parsed;
|
|
78
|
+
try {
|
|
79
|
+
parsed = JSON.parse(readFileSync(resolve(file), "utf8"));
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
throw new CliError("sendback_rule_file", `cannot read valid JSON from ${file}: ${error.message}`);
|
|
83
|
+
}
|
|
84
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
85
|
+
throw new CliError("usage", "send-back ruling JSON must be an object with a points array");
|
|
86
|
+
const points = parsed.points;
|
|
87
|
+
if (!Array.isArray(points) || !points.length)
|
|
88
|
+
throw new CliError("usage", "send-back ruling JSON must include a non-empty points array");
|
|
89
|
+
const dispositions = new Set(["in_scope_unmet", "out_of_scope", "already_met", "repeated"]);
|
|
90
|
+
const causes = new Set(["scope_gap", "missing_context", "worker_error", "reviewer_scope_growth", "environment", "stale_base"]);
|
|
91
|
+
if (points.some((point) => {
|
|
92
|
+
if (!point || typeof point !== "object" || Array.isArray(point))
|
|
93
|
+
return true;
|
|
94
|
+
const value = point;
|
|
95
|
+
if (typeof value.finding_event_id !== "string" || !value.finding_event_id.trim()
|
|
96
|
+
|| typeof value.finding !== "string" || !value.finding.trim()
|
|
97
|
+
|| typeof value.disposition !== "string" || !dispositions.has(value.disposition)
|
|
98
|
+
|| typeof value.rationale !== "string" || !value.rationale.trim()
|
|
99
|
+
|| typeof value.cause !== "string" || !causes.has(value.cause)
|
|
100
|
+
|| typeof value.cause_evidence !== "string" || !value.cause_evidence.trim()
|
|
101
|
+
|| (value.quote !== undefined && (typeof value.quote !== "string" || !value.quote.trim()))
|
|
102
|
+
|| (value.commit !== undefined && (typeof value.commit !== "string" || !value.commit.trim())))
|
|
103
|
+
return true;
|
|
104
|
+
return (value.disposition === "out_of_scope" && (typeof value.quote !== "string" || !value.quote.trim()))
|
|
105
|
+
|| (value.disposition === "already_met" && (typeof value.commit !== "string" || !value.commit.trim()));
|
|
106
|
+
})) {
|
|
107
|
+
throw new CliError("usage", "each send-back ruling point needs finding_event_id, finding, a permitted disposition, rationale, cause and cause_evidence; out_of_scope needs quote and already_met needs commit");
|
|
108
|
+
}
|
|
109
|
+
const value = parsed;
|
|
110
|
+
const needsDraft = value.points.some((point) => point.cause === "scope_gap" || point.cause === "missing_context");
|
|
111
|
+
if (value.scope_draft !== undefined && (typeof value.scope_draft !== "string" || !value.scope_draft.trim() || value.scope_draft.length > 2000)) {
|
|
112
|
+
throw new CliError("usage", "scope_draft must be a non-empty scope amendment up to 2000 characters");
|
|
113
|
+
}
|
|
114
|
+
if (needsDraft && typeof value.scope_draft !== "string") {
|
|
115
|
+
throw new CliError("usage", "scope_draft is required when a cause is scope_gap or missing_context; the assigner must confirm it with wu scope <n> --append");
|
|
116
|
+
}
|
|
117
|
+
return parsed;
|
|
118
|
+
}
|
|
73
119
|
export function needsRetrospectiveInput(status, events = []) {
|
|
74
120
|
if (status === "changes_requested")
|
|
75
121
|
return true;
|
|
@@ -1037,10 +1083,24 @@ export async function wu(p, out) {
|
|
|
1037
1083
|
out.print(withRuleText(fmt(r.unit), r, "submit"), r);
|
|
1038
1084
|
return;
|
|
1039
1085
|
}
|
|
1086
|
+
case "sendback-rule": {
|
|
1087
|
+
const body = sendbackRuleFromFile(str(p.flags, "file"));
|
|
1088
|
+
const r = await client.call("POST", `${base}/${num()}/sendback-rule`, body);
|
|
1089
|
+
const next = r.successor
|
|
1090
|
+
? `\nBinding checklist assigned to stronger worker in successor WU #${r.successor.number}.`
|
|
1091
|
+
: r.reliability_unit
|
|
1092
|
+
? `\nNo-blame reliability work queued as WU #${r.reliability_unit.number}.`
|
|
1093
|
+
: body.scope_draft
|
|
1094
|
+
? `\nAssigner confirmation required: b9s wu scope ${num()} --append <exact scope_draft> --note "confirm send-back scope draft".`
|
|
1095
|
+
: "\nOriginal reviewer resumes the unit.";
|
|
1096
|
+
out.print(`${fmt(r.unit)}\nSend-back ruling recorded.${next}`, r);
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1040
1099
|
case "approve":
|
|
1041
1100
|
case "proceed":
|
|
1042
1101
|
case "changes": {
|
|
1043
1102
|
const note = str(p.flags, "note");
|
|
1103
|
+
const reviewedHead = str(p.flags, "head");
|
|
1044
1104
|
const unmet = str(p.flags, "unmet");
|
|
1045
1105
|
const plainSummary = str(p.flags, "plain-summary") ?? str(p.flags, "summary");
|
|
1046
1106
|
if (!note)
|
|
@@ -1050,7 +1110,27 @@ export async function wu(p, out) {
|
|
|
1050
1110
|
throw new CliError("usage", 'wu changes <n> --cause <scope_gap|missing_context|worker_error|reviewer_scope_growth|environment|stale_base> --unmet "<cited clause>" --note "what must change"');
|
|
1051
1111
|
if (sub === "changes" && !plainSummary?.trim())
|
|
1052
1112
|
throw new CliError("usage", 'wu changes <n> --summary "plain explanation of the revision" --cause <cause> --unmet "<cited clause>" --note "what must change"');
|
|
1053
|
-
|
|
1113
|
+
let reviewedHeadProof = {};
|
|
1114
|
+
if (sub === "approve" && reviewedHead === undefined) {
|
|
1115
|
+
const detail = await client.call("GET", `${base}/${num()}`);
|
|
1116
|
+
if (detail.unit?.head)
|
|
1117
|
+
throw new CliError("usage", 'wu approve <n> --head <exact-reviewed-full-sha> --note "what you checked" (code-backed work requires the SHA you reviewed; source-free work may omit --head)');
|
|
1118
|
+
}
|
|
1119
|
+
if (reviewedHead !== undefined) {
|
|
1120
|
+
if (sub !== "approve" || !/^[0-9a-f]{40}$/.test(reviewedHead))
|
|
1121
|
+
throw new CliError("usage", 'wu approve <n> --head <full-40-character-lowercase-sha> --note "what you checked"');
|
|
1122
|
+
const detail = await client.call("GET", `${base}/${num()}`);
|
|
1123
|
+
if (!detail.unit.branch)
|
|
1124
|
+
throw new CliError("no_branch", `WU #${num()} has no recorded branch to verify the reviewed head`);
|
|
1125
|
+
const repository = await client.call("GET", `${base}/${num()}/head-verification`);
|
|
1126
|
+
if (repository.branch !== detail.unit.branch || typeof repository.repository_identity !== "string" || typeof repository.repository_url !== "string")
|
|
1127
|
+
throw new CliError("origin_verification_failed", `WU #${num()} did not provide its recorded branch and project repository identity`);
|
|
1128
|
+
const proof = verifyUnitHeadOnOrigin(detail.unit.branch, reviewedHead, repository.repository_identity, repository.repository_url);
|
|
1129
|
+
if (detail.unit.head && isAncestor(detail.unit.head, reviewedHead) !== true)
|
|
1130
|
+
throw new CliError("stale_review_head", `reviewed head ${reviewedHead} does not contain the currently recorded head ${detail.unit.head}`);
|
|
1131
|
+
reviewedHeadProof = { head: reviewedHead, expected_head: detail.unit.head, remote_tip: proof.remote_tip, repository_identity: proof.repository_identity };
|
|
1132
|
+
}
|
|
1133
|
+
const r = await client.call("POST", `${base}/${num()}/${sub}`, { note, usage: await reviewUsage(client, project, name), ...(unmet ? { unmet } : {}), ...(cause ? { cause } : {}), ...(sub === "changes" ? { plain_summary: plainSummary } : {}), ...(sub === "approve" && p.flags["confirm-causes"] !== undefined ? { confirmed_causes: list("confirm-causes") } : {}), ...reviewedHeadProof });
|
|
1054
1134
|
out.print(withRuleText(fmt(r.unit), r, sub === "approve" ? "merge" : "verdict"), r);
|
|
1055
1135
|
return;
|
|
1056
1136
|
}
|
|
@@ -1137,6 +1217,13 @@ export async function wu(p, out) {
|
|
|
1137
1217
|
if (!checked.on)
|
|
1138
1218
|
throw new CliError("not_merged", `${merged} is not on ${checked.ref}`, "Merge first, then pass the merge commit (or the branch head once it is on the target).");
|
|
1139
1219
|
}
|
|
1220
|
+
if (unit.approved_head) {
|
|
1221
|
+
const containsApprovedHead = isAncestor(unit.approved_head, merged);
|
|
1222
|
+
if (containsApprovedHead === null)
|
|
1223
|
+
throw new CliError("unknown_commit", `cannot verify that merge commit ${merged} contains approved head ${unit.approved_head}`, "Fetch the approved head and merge commit, then retry.");
|
|
1224
|
+
if (!containsApprovedHead)
|
|
1225
|
+
throw new CliError("not_approved_head", `merge commit ${merged} does not contain approved head ${unit.approved_head}`, "Merge the approved head into the target branch before closing the unit.");
|
|
1226
|
+
}
|
|
1140
1227
|
}
|
|
1141
1228
|
else if (def.merge.require_merge_commit) {
|
|
1142
1229
|
throw new CliError("usage", `this project's process requires the merge commit: b9s wu done ${num()} --merged <sha>`);
|
|
@@ -1414,7 +1501,7 @@ export async function wu(p, out) {
|
|
|
1414
1501
|
return;
|
|
1415
1502
|
}
|
|
1416
1503
|
default:
|
|
1417
|
-
throw new CliError("usage", "wu open|assign|lands-with|branch|start [--branch b|--here]|decline|submit|approve|changes|classify|tags|merge <n>|merge status <n>|done [--keep-worktree]|abandon|note|ask|rule|propose|show|list|stalled");
|
|
1504
|
+
throw new CliError("usage", "wu open|assign|lands-with|branch|start [--branch b|--here]|decline|submit|approve|changes|classify|tags|merge <n>|merge status <n>|done [--keep-worktree]|abandon|note|ask|rule|sendback-rule|propose|show|list|stalled");
|
|
1418
1505
|
}
|
|
1419
1506
|
}
|
|
1420
1507
|
/** Queued units have no owner; ask the API to reject before any local worktree is made. */
|
|
@@ -1576,7 +1663,7 @@ function resolveRecordedBaseRef(recordedBase, target, n, branch) {
|
|
|
1576
1663
|
}
|
|
1577
1664
|
return fetched.ref;
|
|
1578
1665
|
}
|
|
1579
|
-
export function prepareWorktreeForWatcher(n, unit, def, exclude = []) {
|
|
1666
|
+
export function prepareWorktreeForWatcher(n, unit, def, exclude = [], inheritUrlRewrites = shouldInheritSandboxUrlRewrites()) {
|
|
1580
1667
|
if (unit.branch && isShaBranchName(unit.branch))
|
|
1581
1668
|
throw new CliError("no_branch", `recorded branch ${unit.branch} is a commit identifier, not a branch`, "Record and push the unit branch before retrying.");
|
|
1582
1669
|
const target = unit.target ?? def.merge.target_branch;
|
|
@@ -1653,10 +1740,10 @@ export function prepareWorktreeForWatcher(n, unit, def, exclude = []) {
|
|
|
1653
1740
|
// A branch checked out in the home checkout cannot also be attached to a linked worktree.
|
|
1654
1741
|
if (!recoveryBase)
|
|
1655
1742
|
throw new CliError("unit_worktree_prepare_failed", `cannot identify the committed work on WU #${n}'s home checkout; refusing to fork from the integration target`);
|
|
1656
|
-
prepared = prepareWorktree(n, { ...unit, branch: null, worktree: null }, def, { positionals: [], flags: { branch: watcherBranch } }, exclude, recoveryBase);
|
|
1743
|
+
prepared = prepareWorktree(n, { ...unit, branch: null, worktree: null }, def, { positionals: [], flags: { branch: watcherBranch } }, exclude, recoveryBase, inheritUrlRewrites);
|
|
1657
1744
|
}
|
|
1658
1745
|
else {
|
|
1659
|
-
prepared = prepareWorktree(n, unit, def, { positionals: [], flags: {} }, exclude);
|
|
1746
|
+
prepared = prepareWorktree(n, unit, def, { positionals: [], flags: {} }, exclude, undefined, inheritUrlRewrites);
|
|
1660
1747
|
}
|
|
1661
1748
|
if (prepared.mode === "here")
|
|
1662
1749
|
throw new CliError("unit_worktree_prepare_failed", "watchers must prepare a linked unit worktree; --here is not available in watcher preparation");
|
|
@@ -1692,7 +1779,7 @@ export function prepareWorktreeForWatcher(n, unit, def, exclude = []) {
|
|
|
1692
1779
|
needsRecord: !recorded || !existsSync(recorded) || !samePath(recorded, prepared.path) || unit.branch !== prepared.branch || (preparedHead !== null && unit.head !== preparedHead),
|
|
1693
1780
|
recoveryRequired };
|
|
1694
1781
|
}
|
|
1695
|
-
function prepareWorktree(n, unit, def, p, exclude = [], baseRefOverride) {
|
|
1782
|
+
function prepareWorktree(n, unit, def, p, exclude = [], baseRefOverride, inheritUrlRewrites = shouldInheritSandboxUrlRewrites()) {
|
|
1696
1783
|
// The unit's own target when it has one: a lane or release branch the work lands in.
|
|
1697
1784
|
const target = unit.target ?? def.merge.target_branch;
|
|
1698
1785
|
const log = (line) => process.stderr.write(`b9s: ${line}\n`);
|
|
@@ -1771,7 +1858,7 @@ function prepareWorktree(n, unit, def, p, exclude = [], baseRefOverride) {
|
|
|
1771
1858
|
throw new UnitWorktreePrepareFailed(missingBranchFaultMessage(n, pinned, recordedBase, inspected.reason), { branch: pinned, recordedBase });
|
|
1772
1859
|
}
|
|
1773
1860
|
}
|
|
1774
|
-
const result = !existing ? ensureUnitWorktree(path, pinned, baseRef, log, exclude) : { created: false, repaired: false };
|
|
1861
|
+
const result = !existing ? ensureUnitWorktree(path, pinned, baseRef, log, exclude, inheritUrlRewrites) : { created: false, repaired: false };
|
|
1775
1862
|
if (shouldPushCreatedBranch) {
|
|
1776
1863
|
const pushed = pushBranchToOrigin(pinned, path, "origin");
|
|
1777
1864
|
if (!pushed.ok) {
|
|
@@ -1797,12 +1884,12 @@ function prepareWorktree(n, unit, def, p, exclude = [], baseRefOverride) {
|
|
|
1797
1884
|
baseRef = at;
|
|
1798
1885
|
}
|
|
1799
1886
|
const branchCreated = fullSha(`refs/heads/${branch}`) === null;
|
|
1800
|
-
const result = ensureUnitWorktree(path, branch, baseRef, log, exclude);
|
|
1887
|
+
const result = ensureUnitWorktree(path, branch, baseRef, log, exclude, inheritUrlRewrites);
|
|
1801
1888
|
return { mode: "fresh", path, branch, created: result.created, branchCreated };
|
|
1802
1889
|
}
|
|
1803
|
-
function ensureUnitWorktree(path, branch, baseRef, log, exclude) {
|
|
1890
|
+
function ensureUnitWorktree(path, branch, baseRef, log, exclude, inheritUrlRewrites = shouldInheritSandboxUrlRewrites()) {
|
|
1804
1891
|
try {
|
|
1805
|
-
return ensureWorktree(path, branch, baseRef, process.cwd(), log, exclude,
|
|
1892
|
+
return ensureWorktree(path, branch, baseRef, process.cwd(), log, exclude, inheritUrlRewrites);
|
|
1806
1893
|
}
|
|
1807
1894
|
catch (error) {
|
|
1808
1895
|
const cause = error.message;
|
package/dist/help.js
CHANGED
|
@@ -159,8 +159,9 @@ Machine placement enforces configured session slots and reports machine pressure
|
|
|
159
159
|
b9s wu review <n> reviewer's checkout: fetch the submitted branch from origin and open
|
|
160
160
|
../<repo>-review-wu<n> detached at the submitted head (refused if origin differs)
|
|
161
161
|
b9s wu reviewer <n> --replace <agent> [--with <agent>] --note "why" assigner or operator: replace an owing reviewer with an available qualified reviewer; audited and announced (console control WU #733)
|
|
162
|
-
b9s wu approve <n> --note ".." [--confirm-causes cause,cause]
|
|
163
|
-
|
|
162
|
+
b9s wu approve <n> --head <exact-reviewed-full-sha> --note ".." [--confirm-causes cause,cause]
|
|
163
|
+
code-backed approval records the reviewed head; source-free work may omit --head; escalated or away-takeover reviewers cover only their handed-over tags
|
|
164
|
+
complete approval confirms send-back causes in timeline order; a planned reviewer may approve after coverage; status stays approved until merge
|
|
164
165
|
b9s wu changes <n> --unmet ".." --cause <cause> --note ".." [--summary "..." | --plain-summary "..."] send back with a cited clause, cause and stored explanation (scope_gap, missing_context, worker_error, reviewer_scope_growth, environment, stale_base)
|
|
165
166
|
concerns outside those are notes (wu note) or questions (wu ask)
|
|
166
167
|
b9s wu classify <n> --tags a,b classifier: confirm or change a new unit's tags before it routes for review
|
|
@@ -169,6 +170,7 @@ Machine placement enforces configured session slots and reports machine pressure
|
|
|
169
170
|
b9s wu supersede <n> --by <m> owner or assigner: this unit continues as #m; anyone blocked on #n now waits on #m
|
|
170
171
|
b9s wu ask <n> "question" [--question <text>] owner, reviewer or assigner: a decision this unit cannot move without, including queued units (tag expert first, then the operator)
|
|
171
172
|
b9s wu rule <n> "decision" [--ruling <text>|--note <text>] [--send-back-event <id> --cause <cause>] | --approve the tag's expert: answer an open question, or approve its proposal as written (operator questions are answered in the console); the event and cause record an explicit retrospective ruling
|
|
173
|
+
b9s wu sendback-rule <n> --file ruling.json send-back reviewer: record the binding point-by-point ruling; scope_gap/missing_context also need scope_draft, confirmed by the assigner with wu scope --append; environment/stale_base opens no-blame reliability work; out_of_scope needs quote and already_met needs commit
|
|
172
174
|
b9s wu note <n> --note ".." [--annotation '<JSON object>'] add a note; assigner annotation links a cited scope finding to a cause and one-line reason
|
|
173
175
|
b9s wu propose <n> "answer" owner, reviewer, assigner or expert: recommend an answer to the unit's open question, approvable as written
|
|
174
176
|
b9s wu escalate <n> [--note ..] the tag's expert: pass the question to the operator
|
|
@@ -315,11 +317,11 @@ Machine placement enforces configured session slots and reports machine pressure
|
|
|
315
317
|
b9s test-results show <run-id> show the stored run, outcome counts, and original report evidence
|
|
316
318
|
b9s ux run [<task>] [--compare <screen>] --unit <n> [--on <machine>] [--head <sha>]
|
|
317
319
|
queue a remote seeded browser task or ux:compare on an account machine labeled ux-host or browser
|
|
318
|
-
b9s ux job <id>
|
|
320
|
+
b9s ux job <id> [--log] inspect remote browser job diagnostics; --log prints its full log
|
|
319
321
|
b9s ux jobs [--unit <n>] [--limit n] list remote browser jobs in this project
|
|
320
322
|
b9s gate run <n> [--merge-candidate <sha>] --on <machine>
|
|
321
323
|
queue a complete-suite gate run on a machine; records the receipt and posts the log as evidence
|
|
322
|
-
b9s gate job <id>
|
|
324
|
+
b9s gate job <id> [--log] inspect remote gate diagnostics; --log prints its full log
|
|
323
325
|
b9s gate jobs [--unit <n>] [--limit n] list remote gate jobs in this project
|
|
324
326
|
b9s retire --title t (--body b | --body-file f) [--handoff-to @x|@role:y] [--evidence id,id] --yes
|
|
325
327
|
save a RESUME or HANDOFF note, revoke keys and remove machine sessions; revival does not restore sessions
|
|
@@ -428,6 +430,8 @@ Use --admin <nickname> to select one of this machine's saved operator identities
|
|
|
428
430
|
b9s-admin routing required-class <project> <n> (--class <p/h/m/e> | --clear) --reason "why"
|
|
429
431
|
b9s-admin routing tag-required-class <project> <tag> (--class <p/h/m/e> | --clear) --reason "why"
|
|
430
432
|
b9s-admin routing tier-migration <project> inspect cleared legacy min_tier units requiring operator required_class review
|
|
433
|
+
b9s-admin routing adjustments <project> inspect cause-backed per-tag model recommendations and assigner prompts
|
|
434
|
+
b9s-admin routing override <project> --tag <tag> --model <canonical-model> --reason "why" audit a project-local worker/reviewer model preference
|
|
431
435
|
b9s-admin routing pool-suggestions <project> [--status pending|accepted|rejected|superseded|all]
|
|
432
436
|
b9s-admin role delete <name> [--project p]
|
|
433
437
|
b9s-admin channel create|delete <project> <name>
|