benignswarm 0.12.73 → 0.12.74
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 +2 -2
- package/dist/commands/machine-admin.js +42 -0
- package/dist/commands/machine.js +35 -2
- package/dist/commands/watch.js +9 -0
- package/dist/commands/wu.js +20 -3
- package/dist/help.js +4 -0
- package/dist/maintenance.js +23 -0
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/args.js
CHANGED
|
@@ -3,8 +3,8 @@ import { CliError } from "./errors.js";
|
|
|
3
3
|
// These options accept comma-separated collections, so repeating them should
|
|
4
4
|
// append another collection instead of discarding earlier values.
|
|
5
5
|
export const LIST_FLAGS = ["tags", "projects", "evidence", "statuses", "depends-on", "units", "waits-on", "needs", "exclude", "remove", "post", "harness", "variant"];
|
|
6
|
-
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", "unacked-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", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason"];
|
|
7
|
-
export const BOOL_FLAGS = ["latest", "no-restart", "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", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor"];
|
|
6
|
+
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", "unacked-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", "waits-on", "sandbox", "thread", "turn-timeout", "session", "plain", "if-yes", "if-no", "ssh", "variant", "count", "needs", "min-ram", "exclude", "carry", "from", "to-ssh", "wait", "writable", "for", "until", "reason", "at"];
|
|
7
|
+
export const BOOL_FLAGS = ["latest", "no-restart", "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", "turn", "service", "print-hooks", "create", "rotate", "codex-userns", "bwrap-userns", "print-apparmor", "cancel"];
|
|
8
8
|
export function parse(argv) {
|
|
9
9
|
const options = {};
|
|
10
10
|
for (const f of STRING_FLAGS)
|
|
@@ -134,6 +134,22 @@ export async function machineAdmin(action, rest, p, out) {
|
|
|
134
134
|
const rows = m.sessions.map((s) => ({ agent: s.agent, pool: s.pool ?? "-", desired: s.desired, state: s.reported?.state ?? "-", thread: s.thread ?? "-", sandbox: s.sandbox, model: s.model ?? "-", dir: s.dir || s.reported?.dir || "(auto)", error: s.reported?.error ?? s.reported?.detail ?? "", last_turn: (s.reported?.last_turn ?? "").replace(/^\S+ bschat watch\[[^\]]+\]: /, "") }));
|
|
135
135
|
return out.print([...head, rows.length ? table(rows, ["agent", "pool", "desired", "state", "thread", "sandbox", "model", "dir", "error", "last_turn"]) : " no sessions"].join("\n"), r);
|
|
136
136
|
}
|
|
137
|
+
if (action === "maintenance") {
|
|
138
|
+
// A window on the machine: no new turns from 15 min before, its agents away until it ends.
|
|
139
|
+
const name = rest[0];
|
|
140
|
+
const usage = "machine maintenance <name> --at <ISO time | HH:MM local> --for <minutes | 30m | 2h> | --cancel";
|
|
141
|
+
if (!name)
|
|
142
|
+
throw new CliError("usage", usage);
|
|
143
|
+
if (bool(p.flags, "cancel"))
|
|
144
|
+
return out.print(`${name}: maintenance cancelled; its agents are back and turns start again.`, await c.call("DELETE", `/machines/${name}/maintenance`));
|
|
145
|
+
const at = str(p.flags, "at");
|
|
146
|
+
const len = str(p.flags, "for");
|
|
147
|
+
if (!at || !len)
|
|
148
|
+
throw new CliError("usage", usage);
|
|
149
|
+
const r = await c.call("PUT", `/machines/${name}/maintenance`, { start: maintenanceStart(at).toISOString(), minutes: durationMinutes(len) });
|
|
150
|
+
const w = r.maintenance;
|
|
151
|
+
return out.print(`${name}: maintenance ${w.start.slice(0, 16).replace("T", " ")} to ${w.end.slice(11, 16)} UTC (${w.phase}). No new turns start there from 15 min before; its agents are away until it ends, which happens when the machine reports after booting or at the end time. Projects with agents there were told.`, r);
|
|
152
|
+
}
|
|
137
153
|
if (action === "writable") {
|
|
138
154
|
const name = rest[0];
|
|
139
155
|
if (!name || rest.length < 2)
|
|
@@ -431,3 +447,29 @@ export async function agentMove(rest, p, out) {
|
|
|
431
447
|
`Follow it: bschat-admin machine show ${to}`,
|
|
432
448
|
].filter(Boolean).join("\n"), r);
|
|
433
449
|
}
|
|
450
|
+
/** --at: an ISO timestamp, or HH:MM in this machine's local time (today, or tomorrow when past). */
|
|
451
|
+
export function maintenanceStart(at, nowMs = Date.now()) {
|
|
452
|
+
const hm = /^(\d{1,2}):(\d{2})$/.exec(at);
|
|
453
|
+
if (hm) {
|
|
454
|
+
const d = new Date(nowMs);
|
|
455
|
+
d.setHours(Number(hm[1]), Number(hm[2]), 0, 0);
|
|
456
|
+
if (d.getTime() < nowMs - 60_000)
|
|
457
|
+
d.setDate(d.getDate() + 1);
|
|
458
|
+
return d;
|
|
459
|
+
}
|
|
460
|
+
if (at === "now")
|
|
461
|
+
return new Date(nowMs);
|
|
462
|
+
const t = Date.parse(at);
|
|
463
|
+
if (Number.isNaN(t))
|
|
464
|
+
throw new CliError("usage", `--at ${at}: an ISO timestamp, HH:MM (local time) or now`);
|
|
465
|
+
return new Date(t);
|
|
466
|
+
}
|
|
467
|
+
/** --for: minutes as a number, or 30m / 2h / 1h30m. */
|
|
468
|
+
export function durationMinutes(v) {
|
|
469
|
+
if (/^\d+$/.test(v))
|
|
470
|
+
return Number(v);
|
|
471
|
+
const m = /^(?:(\d+)h)?(?:(\d+)m)?$/.exec(v);
|
|
472
|
+
if (!m || (!m[1] && !m[2]))
|
|
473
|
+
throw new CliError("usage", `--for ${v}: minutes, or a duration like 30m, 2h, 1h30m`);
|
|
474
|
+
return Number(m[1] ?? 0) * 60 + Number(m[2] ?? 0);
|
|
475
|
+
}
|
package/dist/commands/machine.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { closeSync, existsSync, mkdirSync, openSync, readFileSync, readSync, statSync, statfsSync, writeFileSync } from "node:fs";
|
|
3
|
-
import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, userInfo } from "node:os";
|
|
3
|
+
import { arch, cpus, freemem, homedir, hostname, loadavg, platform, totalmem, uptime, userInfo } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { str } from "../args.js";
|
|
6
6
|
import { Client } from "../client.js";
|
|
@@ -8,6 +8,7 @@ import { configRoot, loadAgent, saveAgent } from "../config.js";
|
|
|
8
8
|
import { CliError } from "../errors.js";
|
|
9
9
|
import { BWRAP_APPARMOR_PATH, bwrapAppArmorProfile, CODEX_APPARMOR_PATH, CODEX_MANAGED_DIR, CODEX_MANAGED_MARK, codexAppArmorProfile, codexManagedHooks } from "../harness.js";
|
|
10
10
|
import { applySparse } from "../git.js";
|
|
11
|
+
import { drainingUntil, writeMaintenance } from "../maintenance.js";
|
|
11
12
|
import { TURN_HARNESSES, claudeFacts, claudeSandbox, probeFor, sessionProcesses } from "../harnesses.js";
|
|
12
13
|
import { readState, writeState } from "../state.js";
|
|
13
14
|
import { installService, lingerEnabled, MACHINE_LABEL, removeService, requireInstall, restartWatcher, serviceActive, WATCH_LABEL_PREFIX, watcherServices } from "../install.js";
|
|
@@ -34,6 +35,20 @@ function writeMachineState(s) {
|
|
|
34
35
|
const START_REV = 3;
|
|
35
36
|
export const sessionFingerprint = (s, writable = []) => JSON.stringify([s.harness, s.dir, s.sandbox, s.model, s.effort, s.turn_timeout, ...(writable.length ? [writable] : []), ...(START_REV > 1 ? [`rev${START_REV}`] : [])]);
|
|
36
37
|
export const watchLabelOf = (ref) => `${WATCH_LABEL_PREFIX}${ref.replace("/", ".")}`;
|
|
38
|
+
/**
|
|
39
|
+
* During a maintenance drain or window, a session that would be started fresh (no known thread, so
|
|
40
|
+
* `bschat start` runs its first turn at once, past the watchers' check) waits; adopting a known
|
|
41
|
+
* thread starts no turn and proceeds. Returns the session's report while it waits, else null.
|
|
42
|
+
*/
|
|
43
|
+
export function deferredByMaintenance(s, thread, drain) {
|
|
44
|
+
if (!drain || thread)
|
|
45
|
+
return null;
|
|
46
|
+
return { id: s.id, state: "preparing", dir: s.dir, detail: `maintenance until ${drain.end.slice(11, 16)} UTC: its first turn starts after it` };
|
|
47
|
+
}
|
|
48
|
+
/** The daemon's confirmation that it holds new turns back, with the turns still running. */
|
|
49
|
+
export function maintenanceReport(drain, sessions) {
|
|
50
|
+
return drain ? { draining: true, until: drain.end, turns_running: sessions.filter((o) => o.turn?.running).length } : null;
|
|
51
|
+
}
|
|
37
52
|
/** The `bschat start` arguments that bring a session up (adopting its thread or session when known). */
|
|
38
53
|
export function startArgs(s, thread, writable = []) {
|
|
39
54
|
return [
|
|
@@ -52,6 +67,9 @@ export async function reconcile(m, log) {
|
|
|
52
67
|
const desired = me.sessions;
|
|
53
68
|
const workdir = me.machine?.workdir ?? null;
|
|
54
69
|
const writable = me.machine?.writable ?? [];
|
|
70
|
+
// The maintenance window, for the watchers: they start no new turns while it drains or runs.
|
|
71
|
+
const mw = me.machine?.maintenance;
|
|
72
|
+
writeMaintenance(mw ? { start: mw.start, end: mw.end } : null);
|
|
55
73
|
const state = readMachineState();
|
|
56
74
|
const bin = requireInstall().bin;
|
|
57
75
|
const out = [];
|
|
@@ -88,6 +106,15 @@ export async function reconcile(m, log) {
|
|
|
88
106
|
const thread = s.thread ?? local?.thread ?? null;
|
|
89
107
|
const threadChanged = !!local?.thread && !!s.thread && s.thread !== local.thread;
|
|
90
108
|
if (!svc() || !local || local.fingerprint !== fp || threadChanged) {
|
|
109
|
+
// A new session's start runs its first turn at once, past the watchers' check: during a
|
|
110
|
+
// maintenance window it waits. (Adopting a known thread starts no turn, so that proceeds.)
|
|
111
|
+
// The phase is read at the launch decision itself: credential checks and checkouts before
|
|
112
|
+
// it can take long enough to cross the drain point (sol-reviewer's boundary probe).
|
|
113
|
+
const held = deferredByMaintenance(s, thread, drainingUntil());
|
|
114
|
+
if (held) {
|
|
115
|
+
out.push(held);
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
91
118
|
const r = spawnSync(bin, startArgs(s, thread, writable), { cwd: s.dir, encoding: "utf8", timeout: 180_000 });
|
|
92
119
|
if (r.status !== 0)
|
|
93
120
|
throw new Error(`bschat start failed: ${errorText(r.stderr || r.stdout)}`);
|
|
@@ -139,7 +166,11 @@ export async function reconcile(m, log) {
|
|
|
139
166
|
}
|
|
140
167
|
writeMachineState(state);
|
|
141
168
|
const clones = refreshClones(workdir, [...new Set(desired.filter((s) => !s.dir && s.project && s.desired === "running").map((s) => s.project))], log);
|
|
142
|
-
const report = {
|
|
169
|
+
const report = {
|
|
170
|
+
...machineFacts(), workdir: workdir ?? join(homedir(), "bschat"), workdir_free_bytes: freeBytes(workdir ?? homedir()), clones,
|
|
171
|
+
// The daemon's own confirmation that it is holding turns back, and how many are still running.
|
|
172
|
+
maintenance: maintenanceReport(drainingUntil(), out),
|
|
173
|
+
};
|
|
143
174
|
await client.call("POST", "/machines/me/report", { report, sessions: out });
|
|
144
175
|
return { sessions: out, report };
|
|
145
176
|
}
|
|
@@ -427,6 +458,8 @@ export function machineFacts() {
|
|
|
427
458
|
return {
|
|
428
459
|
os: platform(), arch: arch(), hostname: hostname(), user: userInfo().username, cpus: cpus().length, mem_total_bytes: totalmem(),
|
|
429
460
|
load: loadavg().map((x) => Math.round(x * 100) / 100), mem_available_bytes: memAvailable(),
|
|
461
|
+
// When this machine last booted: the server ends a maintenance window once the machine is back.
|
|
462
|
+
booted_at: new Date(Math.floor((Date.now() - uptime() * 1000) / 60_000) * 60_000).toISOString(),
|
|
430
463
|
bschat: { version: CLI_VERSION, bin: requireInstall().bin },
|
|
431
464
|
codex: codex.status === 0 ? { version: codex.stdout.trim(), logged_in: login?.status === 0 && /logged in/i.test(`${login.stdout}${login.stderr}`), login: `${login?.stdout ?? ""}${login?.stderr ?? ""}`.trim().slice(0, 200), sandbox: codexSandbox() } : null,
|
|
432
465
|
"claude-code": claudeReport(),
|
package/dist/commands/watch.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { spawn, spawnSync } from "node:child_process";
|
|
2
2
|
import { bindSession, sessionOfExec, threadOfExec } from "../sessions.js";
|
|
3
3
|
import { startTurn, stopTurn } from "../turn.js";
|
|
4
|
+
import { drainingUntil } from "../maintenance.js";
|
|
4
5
|
import { probeFor, turnHarness } from "../harnesses.js";
|
|
5
6
|
import { applyAck } from "./wake.js";
|
|
6
7
|
import { lingerEnabled, loadSystemdUnit, reloadLaunchAgent, removeService, requireInstall, systemdUnit, systemdUserDir, WATCH_LABEL_PREFIX, watcherServices } from "../install.js";
|
|
@@ -470,6 +471,14 @@ async function turnStep(ctl, probe, timeoutMin, log, wake, name) {
|
|
|
470
471
|
log(`the turn started at ${ph.startedAt} has written nothing for ${Math.round(quietMs / 60_000)} min (over the ${timeoutMin}-min limit); treating it as dead`);
|
|
471
472
|
ctl.loggedRunning = ph.startedAt;
|
|
472
473
|
}
|
|
474
|
+
// A maintenance window on this machine: no new turn from 15 min before it until it ends.
|
|
475
|
+
const maint = drainingUntil();
|
|
476
|
+
if (maint) {
|
|
477
|
+
if (ctl.loggedRunning !== `maint:${maint.start}`)
|
|
478
|
+
log(`maintenance on this machine ${maint.start.slice(0, 16)} to ${maint.end.slice(11, 16)} UTC: starting no new turns until it ends`);
|
|
479
|
+
ctl.loggedRunning = `maint:${maint.start}`;
|
|
480
|
+
return;
|
|
481
|
+
}
|
|
473
482
|
const st = readState(name);
|
|
474
483
|
if (st.watch_pending) {
|
|
475
484
|
// Queued by a queue-mode watcher and never delivered, or failed: no turn is running, so the agent is not going to answer it.
|
package/dist/commands/wu.js
CHANGED
|
@@ -81,6 +81,7 @@ export async function wu(p, out) {
|
|
|
81
81
|
return [
|
|
82
82
|
`WU #${u.number} [${u.status}] ${tags(u)} ${u.title}${flags ? ` (${flags})` : ""}`,
|
|
83
83
|
` owner ${u.owner_name || "unassigned (queued)"}${reviewers ? ` · reviewers ${reviewers}` : ""}${approvals ? ` · approved by ${approvals}` : ""}${u.uncovered?.length ? ` · awaiting ${u.uncovered.map((t) => `#${t}`).join(" ")}` : ""}`,
|
|
84
|
+
u.operator_hold ? ` ON HOLD by ${u.operator_hold.by}: ${u.operator_hold.note} (no verdict and no merge until the owner resubmits or it is released)` : null,
|
|
84
85
|
u.question ? ` QUESTION for ${u.question.level === "expert" ? `a ${u.question.roles.join(" or ")}` : "the operator"} (asked by ${u.question.asked_by}${u.question.passed_by ? `, passed up by ${u.question.passed_by}` : ""}): ${u.question.text}` : null,
|
|
85
86
|
` ${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(" ")}` : ""}`,
|
|
86
87
|
u.scope ? ` scope: ${u.scope}` : null,
|
|
@@ -233,6 +234,20 @@ export async function wu(p, out) {
|
|
|
233
234
|
out.print(fmt(r.unit), r);
|
|
234
235
|
return;
|
|
235
236
|
}
|
|
237
|
+
case "hold": {
|
|
238
|
+
// Operator or assigner: no verdict and no merge until the owner resubmits or the hold is released.
|
|
239
|
+
const note = str(p.flags, "note");
|
|
240
|
+
if (!note)
|
|
241
|
+
throw new CliError("usage", 'wu hold <n> --note "what must happen before it moves on" (operator or assigner)');
|
|
242
|
+
const r = await client.call("POST", `${base}/${num()}/hold`, { note });
|
|
243
|
+
out.print(`${fmt(r.unit)}\nOn hold: verdicts and done are refused until ${r.unit.owner_name} resubmits or you run bschat wu release ${num()}.`, r);
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
case "release": {
|
|
247
|
+
const r = await client.call("POST", `${base}/${num()}/hold/release`, { note: str(p.flags, "note") ?? "" });
|
|
248
|
+
out.print(`${fmt(r.unit)}\nHold released.`, r);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
236
251
|
case "scope": {
|
|
237
252
|
const scope = str(p.flags, "scope");
|
|
238
253
|
const note = str(p.flags, "note");
|
|
@@ -681,9 +696,11 @@ export async function lock(p, out) {
|
|
|
681
696
|
const unit = str(p.flags, "unit");
|
|
682
697
|
// Scoped to this machine unless --shared: the resource is this box's CPU and disk.
|
|
683
698
|
const r = await client.call("POST", `/projects/${project}/locks/${lockName}/acquire`, { unit: unit ? Number(unit) : null, note: str(p.flags, "note") ?? "", shared: bool(p.flags, "shared") });
|
|
684
|
-
out.print(r.
|
|
685
|
-
?
|
|
686
|
-
:
|
|
699
|
+
out.print(r.maintenance
|
|
700
|
+
? `${lockName} is not handed out now: ${r.maintenance}. You are #${r.position} in line and will be @mentioned when it is yours after the window; do not poll. Leave the queue: bschat unlock ${lockName}`
|
|
701
|
+
: r.acquired
|
|
702
|
+
? `You hold ${lockName}${r.lock.machine ? ` on ${r.lock.machine}` : " (shared)"}${unit ? ` for WU #${unit}` : ""}. Release it when done: bschat unlock ${lockName}`
|
|
703
|
+
: `${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);
|
|
687
704
|
}
|
|
688
705
|
/**
|
|
689
706
|
* bschat ask-operator "what you need from them" --plain ".." --blocks ".." --if-yes ".." --if-no ".." [--propose ".."]:
|
package/dist/help.js
CHANGED
|
@@ -89,6 +89,8 @@ Agent commands
|
|
|
89
89
|
bschat wu explain <n> "..." the same for a unit's question waiting on the operator
|
|
90
90
|
--propose: your recommended answer, phrased so they can approve it as written
|
|
91
91
|
bschat wu tags <n> --add a --remove b retag (owner before review, a reviewer during it; may add a reviewer)
|
|
92
|
+
bschat wu hold <n> --note ".." operator or assigner: no verdict and no merge until the owner resubmits;
|
|
93
|
+
wu release <n> [--note ..] lifts it earlier
|
|
92
94
|
bschat wu evidence replace <n> <old> <new> [--note ".."] owner replaces attached evidence; old id is retained in the unit history
|
|
93
95
|
bschat wu done <n> --merged <sha> [--keep-worktree] after approval; verifies the sha is on the target; removes the unit's clean worktree
|
|
94
96
|
bschat wu abandon <n> [--note ..] wu list [--all] / wu show <n> for state and timeline
|
|
@@ -219,6 +221,8 @@ Machines (provisioned over your own ssh; a daemon on each runs the agent session
|
|
|
219
221
|
Codex-only AppArmor profile so sandboxed agents can run; --bwrap-userns: the same
|
|
220
222
|
for /usr/bin/bwrap (Claude Code's sandbox; broader: any local user may use it)
|
|
221
223
|
bschat-admin machine list | show <name> | remove <name>
|
|
224
|
+
bschat-admin machine maintenance <name> --at <ISO | HH:MM> --for <30m | 2h> | --cancel a window: no new turns from
|
|
225
|
+
15 min before, its agents away until the machine reports back after booting
|
|
222
226
|
bschat-admin machine session add <machine> <project>/<agent> --dir <checkout> --sandbox <read-only|workspace-write|danger-full-access>
|
|
223
227
|
[--create --role <role>] [--model m] [--effort e] [--thread <id>] [--turn-timeout min]
|
|
224
228
|
bschat-admin machine session stop|start|remove <machine> <project>/<agent>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { configRoot } from "./config.js";
|
|
4
|
+
export const DRAIN_MS = 15 * 60_000;
|
|
5
|
+
const file = () => join(configRoot(), "state", "maintenance.json");
|
|
6
|
+
export function writeMaintenance(w) {
|
|
7
|
+
if (!w) {
|
|
8
|
+
rmSync(file(), { force: true });
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
mkdirSync(dirname(file()), { recursive: true });
|
|
12
|
+
const tmp = `${file()}.${process.pid}.tmp`;
|
|
13
|
+
writeFileSync(tmp, JSON.stringify(w) + "\n");
|
|
14
|
+
renameSync(tmp, file());
|
|
15
|
+
}
|
|
16
|
+
/** The window holding turns back now, or null. */
|
|
17
|
+
export function drainingUntil(nowMs = Date.now(), text) {
|
|
18
|
+
const raw = text ?? (existsSync(file()) ? readFileSync(file(), "utf8") : null);
|
|
19
|
+
if (!raw)
|
|
20
|
+
return null;
|
|
21
|
+
const w = JSON.parse(raw);
|
|
22
|
+
return nowMs >= Date.parse(w.start) - DRAIN_MS && nowMs < Date.parse(w.end) ? w : null;
|
|
23
|
+
}
|
package/dist/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const CLI_VERSION = "0.12.
|
|
1
|
+
export const CLI_VERSION = "0.12.74";
|