@join-pantheon/cli 0.34.3 → 0.35.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/admin-ui.js +2 -5
- package/dist/agent-outage.js +15 -1
- package/dist/agents.js +2 -2
- package/dist/board.js +55 -20
- package/dist/brief.js +5 -4
- package/dist/cli.js +168 -50
- package/dist/client.js +41 -4
- package/dist/decision-ui.js +5 -2
- package/dist/doctor.js +15 -5
- package/dist/home-guard.js +27 -0
- package/dist/home-safety.js +1 -0
- package/dist/install.js +35 -21
- package/dist/machine.js +2 -2
- package/dist/mcp-instructions.js +26 -7
- package/dist/mcp.js +33 -29
- package/dist/nonces.js +18 -0
- package/dist/notice.js +9 -10
- package/dist/outbound-guard.js +25 -0
- package/dist/plain.js +66 -0
- package/dist/quickstart.js +2 -2
- package/dist/refusal.js +5 -1
- package/dist/relay.js +6 -2
- package/dist/run-failure.js +13 -11
- package/dist/setup-guide.js +1 -0
- package/dist/signed-out.js +8 -5
- package/dist/tray.js +9 -6
- package/dist/update-check.js +2 -1
- package/dist/which.js +8 -1
- package/dist/worker-policy.js +64 -12
- package/dist/worker.js +115 -27
- package/dist/worklist.js +7 -1
- package/helper/macos/menubar.swift +68 -29
- package/helper/macos/prebuilt/manifest.json +3 -3
- package/helper/macos/prebuilt/pantheon-tray +0 -0
- package/package.json +1 -1
package/dist/run-failure.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
import { ownWords } from "./agent-outage.js";
|
|
1
2
|
import { execFileSync } from "node:child_process";
|
|
2
3
|
import { gitCallEnv, safeGitArgs } from "./git-safe.js";
|
|
3
4
|
import { checkRepoCommand } from "./agents.js";
|
|
4
5
|
import { bashRuleMatches, GIT_DENY_RULES } from "./claude-confine.js";
|
|
5
6
|
export const AUTH_RE = /not (?:logged|signed) in|not authenticated|no (?:github )?(?:authentication|credentials?|token) (?:found|available)|login required|please (?:log|sign) in|run .*login|invalid api key|unauthori[sz]ed|authentication (?:failed|required)|\b401\b|expired (?:token|session)/i;
|
|
7
|
+
const AGENT_LABEL = { "claude-code": "Claude Code", codex: "Codex", cursor: "Cursor", copilot: "GitHub Copilot", kiro: "Kiro" };
|
|
6
8
|
export const SIGN_IN_FIX = {
|
|
7
9
|
"claude-code": "run `claude`, then /login",
|
|
8
10
|
codex: "run `codex login`",
|
|
@@ -58,20 +60,20 @@ export function diagnoseRun(f, probe = gitProbe) {
|
|
|
58
60
|
const raise = f.timedOut.from === "flag"
|
|
59
61
|
? `this worker was started with --run-minutes ${m}; start it with a larger value (up to 180), or without the flag to use this machine's setting`
|
|
60
62
|
: f.timedOut.from === "persona"
|
|
61
|
-
? `
|
|
62
|
-
: `
|
|
63
|
+
? `raise or remove the max_run_minutes line in the persona that handled it (and, if this computer's limit is short too, pantheon policy set run-minutes ${Math.min(180, m * 2)})`
|
|
64
|
+
: `run pantheon policy set run-minutes ${Math.min(180, m * 2)} (up to 180; from the next run, no restart)`;
|
|
63
65
|
return {
|
|
64
66
|
cause: "timed_out",
|
|
65
|
-
says: `The run
|
|
66
|
-
fix: `
|
|
67
|
+
says: `The run hit this computer's ${m}-minute limit and was stopped before it finished.`,
|
|
68
|
+
fix: `To give it longer: ${raise}. What it did so far is kept (transcript: ${f.runLog}).`,
|
|
67
69
|
};
|
|
68
70
|
}
|
|
69
|
-
if (!f.exited &&
|
|
71
|
+
if (!f.exited && f.detail.split("\n").some((l) => ownWords(l, AUTH_RE))) {
|
|
70
72
|
const fix = SIGN_IN_FIX[f.agent ?? ""] ?? "sign in to the agent CLI on this machine";
|
|
71
73
|
return {
|
|
72
74
|
cause: "not_signed_in",
|
|
73
|
-
says:
|
|
74
|
-
fix: `Sign in once and the next run works: ${fix}
|
|
75
|
+
says: `${AGENT_LABEL[f.agent ?? ""] ?? "The agent"} is signed out on this computer, so the run couldn't start.`,
|
|
76
|
+
fix: `Sign in once and the next run works: ${fix}.`,
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
if (f.allowBash && (f.agent ?? "claude-code") === "claude-code" && (f.os ?? process.platform) === "linux" && SANDBOX_RE.test(f.detail)) {
|
|
@@ -118,8 +120,8 @@ export function diagnoseRun(f, probe = gitProbe) {
|
|
|
118
120
|
if (!f.allowBash) {
|
|
119
121
|
return {
|
|
120
122
|
cause: "no_commands",
|
|
121
|
-
says: "
|
|
122
|
-
fix: "
|
|
123
|
+
says: "The agent may only edit files on this computer, so it couldn't run tests, commit or push.",
|
|
124
|
+
fix: "To let it deliver work while you're away: pantheon setup --commands yes",
|
|
123
125
|
capability: "run_commands",
|
|
124
126
|
};
|
|
125
127
|
}
|
|
@@ -218,8 +220,8 @@ export function blockedCommands(text) {
|
|
|
218
220
|
}
|
|
219
221
|
const silent = (f) => ({
|
|
220
222
|
cause: "silent",
|
|
221
|
-
says: "The run finished
|
|
222
|
-
fix: `
|
|
223
|
+
says: "The run finished but didn't reply, so the request is still open.",
|
|
224
|
+
fix: `Answer it yourself from the board or menu bar. To see what the run did: ${f.runLog}.`,
|
|
223
225
|
dir: f.worktree,
|
|
224
226
|
lines: [`cat ${shq(f.runLog)}`],
|
|
225
227
|
});
|
package/dist/setup-guide.js
CHANGED
|
@@ -609,6 +609,7 @@ Do
|
|
|
609
609
|
- Take the one thing a teammate asked for, do only that, and deliver it on your own branch with a clear commit message.
|
|
610
610
|
- Answer questions about this repository from what is in the repository, not from memory.
|
|
611
611
|
- Check your work before you deliver: run what you can, read the diff, keep it small.
|
|
612
|
+
- Write every reply for a person: the answer first, plain words, a few sentences. A simple question gets a short answer.
|
|
612
613
|
|
|
613
614
|
Never
|
|
614
615
|
${never.map((n) => `- ${n}`).join("\n")}
|
package/dist/signed-out.js
CHANGED
|
@@ -4,6 +4,7 @@ import { join } from "node:path";
|
|
|
4
4
|
import { CONFIG_DIR } from "./config.js";
|
|
5
5
|
import { claudeTokenStamp } from "./agent-token.js";
|
|
6
6
|
import { trustWrite } from "./home-guard.js";
|
|
7
|
+
import { ownWords } from "./agent-outage.js";
|
|
7
8
|
export const SIGNED_OUT_RE = /please run \/login|login expired|not logged in\b|invalid api key|oauth token (?:has )?expired|oauth token refresh failed|failed to authenticate|api error: 401\b|oauth access token is invalid|run `?(?:codex|cursor-agent) login`?/i;
|
|
8
9
|
export const SIGNED_OUT_RETRY_MS = 3_600_000;
|
|
9
10
|
export const SIGNED_OUT_MAX_RETRY_MS = 8 * 3_600_000;
|
|
@@ -47,7 +48,7 @@ function write(home, m) {
|
|
|
47
48
|
export const retryAfter = (m) => Math.min(SIGNED_OUT_RETRY_MS * 2 ** Math.max(0, m.tries ?? 0), SIGNED_OUT_MAX_RETRY_MS);
|
|
48
49
|
export function markSignedOut(agent, output, o = {}) {
|
|
49
50
|
const tail = output.split("\n").map((l) => l.trim()).filter(Boolean).slice(-TAIL_LINES);
|
|
50
|
-
const line = tail.find((l) =>
|
|
51
|
+
const line = tail.find((l) => ownWords(l, SIGNED_OUT_RE));
|
|
51
52
|
if (!line)
|
|
52
53
|
return false;
|
|
53
54
|
const home = o.pantheonHome ?? CONFIG_DIR;
|
|
@@ -71,14 +72,16 @@ export function signedOutNow(agent, o = {}) {
|
|
|
71
72
|
if (!changed && !due)
|
|
72
73
|
return mark;
|
|
73
74
|
if (o.lift) {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
else
|
|
77
|
-
m[agent] = { ...mark, at: 0 };
|
|
75
|
+
const { tries: _t, ...rest } = mark;
|
|
76
|
+
m[agent] = changed ? { ...rest, at: 0 } : { ...mark, at: 0 };
|
|
78
77
|
write(home, m);
|
|
79
78
|
}
|
|
80
79
|
return null;
|
|
81
80
|
}
|
|
81
|
+
export function signedOutChecking(agent, o = {}) {
|
|
82
|
+
const mark = read(o.pantheonHome ?? CONFIG_DIR)[agent];
|
|
83
|
+
return mark && mark.at === 0 ? mark : null;
|
|
84
|
+
}
|
|
82
85
|
export function clearSignedOut(agent, o = {}) {
|
|
83
86
|
const home = o.pantheonHome ?? CONFIG_DIR;
|
|
84
87
|
const m = read(home);
|
package/dist/tray.js
CHANGED
|
@@ -50,12 +50,14 @@ export function writeTrayCommands(home = CONFIG_DIR) {
|
|
|
50
50
|
const dir = join(home, "bin");
|
|
51
51
|
mkdirSync(dir, { recursive: true });
|
|
52
52
|
const out = [];
|
|
53
|
+
const q = (s) => `'${s.replace(/'/g, `'\\''`)}'`;
|
|
54
|
+
const pb = q(bin);
|
|
53
55
|
for (const [name, cmd] of [
|
|
54
|
-
["pantheon-status.command", `${
|
|
55
|
-
["pantheon-doctor.command", `${
|
|
56
|
-
["pantheon-approvals.command", `${
|
|
57
|
-
["pantheon-explain.command", `${
|
|
58
|
-
["pantheon-details.command", `${
|
|
56
|
+
["pantheon-status.command", `${pb} status`],
|
|
57
|
+
["pantheon-doctor.command", `${pb} doctor`],
|
|
58
|
+
["pantheon-approvals.command", `${pb} approvals`],
|
|
59
|
+
["pantheon-explain.command", `${pb} explain --queued`],
|
|
60
|
+
["pantheon-details.command", `${pb} explain --queued`],
|
|
59
61
|
]) {
|
|
60
62
|
const file = join(dir, name);
|
|
61
63
|
const keep = name === "pantheon-explain.command" ? "" : `\necho\nread -s -k '?press any key to close '`;
|
|
@@ -67,8 +69,9 @@ export function writeTrayCommands(home = CONFIG_DIR) {
|
|
|
67
69
|
const WEEK_MS = 7 * 24 * 3600_000;
|
|
68
70
|
const RANK = (i) => (i.kind === "decision" || i.kind === "change" ? 0 : 1);
|
|
69
71
|
export const boardOrder = (a, b) => RANK(a) - RANK(b) || a.when - b.when;
|
|
72
|
+
export const AUTOPILOT_UNCLAIMED_MS = 24 * 3_600_000;
|
|
70
73
|
export function arrangeBoard(items, o) {
|
|
71
|
-
const fallback = o.autopilot && o.workerRunning ?
|
|
74
|
+
const fallback = o.autopilot && o.workerRunning ? AUTOPILOT_UNCLAIMED_MS : o.fallbackMs ?? LIMITS.workerFallbackMs;
|
|
72
75
|
const out = items.map((i) => ({ ...i }));
|
|
73
76
|
const spaceOf = (i) => i.space ?? "";
|
|
74
77
|
const asked = new Map();
|
package/dist/update-check.js
CHANGED
|
@@ -78,7 +78,8 @@ export function defaultDeps(home) {
|
|
|
78
78
|
isGit: () => existsSync(join(repoRoot(), ".git")),
|
|
79
79
|
fetchBehind: () => {
|
|
80
80
|
const root = repoRoot();
|
|
81
|
-
execFileSync("git", ["-C", root, "fetch", "--quiet"], { stdio: "ignore", timeout: 2500
|
|
81
|
+
execFileSync("git", ["-C", root, "fetch", "--quiet"], { stdio: "ignore", timeout: 2500,
|
|
82
|
+
env: { ...process.env, GIT_TERMINAL_PROMPT: "0", GCM_INTERACTIVE: "never" } });
|
|
82
83
|
const out = execFileSync("git", ["-C", root, "rev-list", "--count", "HEAD..@{u}"], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: 2500 }).trim();
|
|
83
84
|
return Number(out) || 0;
|
|
84
85
|
},
|
package/dist/which.js
CHANGED
|
@@ -58,6 +58,13 @@ export function which(name, os = platform(), env = process.env, opts = {}) {
|
|
|
58
58
|
}
|
|
59
59
|
return posixOnPath(name, env, usable);
|
|
60
60
|
}
|
|
61
|
+
export function loginShellEnv(env = process.env) {
|
|
62
|
+
const path = env.PATH;
|
|
63
|
+
if (!path)
|
|
64
|
+
return env;
|
|
65
|
+
const safe = path.split(":").filter((d) => !/[$`"\\\n\r]/.test(d)).join(":");
|
|
66
|
+
return safe === path ? env : { ...env, PATH: safe };
|
|
67
|
+
}
|
|
61
68
|
export const isWslWindowsShim = (p) => /^\/mnt\/[a-z]\//i.test(p) && !/\.exe$/i.test(p);
|
|
62
69
|
function onWsl(env) {
|
|
63
70
|
if (env.WSL_DISTRO_NAME || env.WSL_INTEROP)
|
|
@@ -111,7 +118,7 @@ export function parseLoginAnswer(out, mark) {
|
|
|
111
118
|
}
|
|
112
119
|
function runLoginShell(script, args, timeoutMs = 15_000) {
|
|
113
120
|
try {
|
|
114
|
-
return execFileSync("sh", ["-lc", script, "sh", ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: timeoutMs, killSignal: "SIGKILL" });
|
|
121
|
+
return execFileSync("sh", ["-lc", script, "sh", ...args], { encoding: "utf8", stdio: ["ignore", "pipe", "ignore"], timeout: timeoutMs, killSignal: "SIGKILL", env: loginShellEnv() });
|
|
115
122
|
}
|
|
116
123
|
catch (e) {
|
|
117
124
|
const out = e.stdout;
|
package/dist/worker-policy.js
CHANGED
|
@@ -77,13 +77,17 @@ export function describeRunMinutes(r, persona) {
|
|
|
77
77
|
: r.from === "flag" ? "this worker's --run-minutes" : `lowered by persona ${persona ?? ""}`.trim();
|
|
78
78
|
return `${r.minutes} minutes per run (${why})`;
|
|
79
79
|
}
|
|
80
|
+
export const finalKey = {
|
|
81
|
+
cap: (cap) => `cap:${cap}`,
|
|
82
|
+
wake: (team, member) => `wake:${wakeKey(team, member)}`,
|
|
83
|
+
};
|
|
80
84
|
export const WAKE_NO_MS = 30 * 24 * 60 * 60 * 1_000;
|
|
81
85
|
export const wakeKey = (team, member) => `${team}|${member}`;
|
|
82
86
|
export function mayAskWake(p, teams, member, now = Date.now()) {
|
|
83
87
|
const ts = teams.filter((t) => !!t);
|
|
84
88
|
if (isApprovedWaker(p, ts, member))
|
|
85
89
|
return false;
|
|
86
|
-
if (ts.some((t) =>
|
|
90
|
+
if (ts.some((t) => { const at = p.wakeNo?.[wakeKey(t, member)]; return at !== undefined && (p.finalNo?.includes(finalKey.wake(t, member)) || at > now - WAKE_NO_MS); }))
|
|
87
91
|
return false;
|
|
88
92
|
return !Object.values(p.wakeAsks ?? {}).some((a) => ts.includes(a.team) && a.member === member && now - a.at < ASK_EXPIRY_MS);
|
|
89
93
|
}
|
|
@@ -137,19 +141,29 @@ function readWakers(x) {
|
|
|
137
141
|
}
|
|
138
142
|
return out;
|
|
139
143
|
}
|
|
144
|
+
function notAfterNow(m) {
|
|
145
|
+
const now = Date.now();
|
|
146
|
+
return Object.fromEntries(Object.entries(m).map(([k, v]) => [k, typeof v === "number" && v > now ? now : v]));
|
|
147
|
+
}
|
|
140
148
|
export function loadPolicy(home) {
|
|
141
149
|
try {
|
|
142
150
|
const raw = parseJsonText(readFileSync(policyPath(home), "utf8"));
|
|
143
151
|
const obj = (v) => (isRecord(v) ? v : {});
|
|
144
152
|
const wakers = readWakers(raw.wakers);
|
|
145
153
|
return {
|
|
146
|
-
grants: obj(raw.grants), asks: obj(raw.asks), denied: obj(raw.denied), attempts: obj(raw.attempts),
|
|
154
|
+
grants: obj(raw.grants), asks: obj(raw.asks), denied: notAfterNow(obj(raw.denied)), attempts: obj(raw.attempts),
|
|
147
155
|
...(wakers ? { wakers } : {}),
|
|
148
156
|
...(isRecord(raw.wakersCarried) ? { wakersCarried: raw.wakersCarried } : {}),
|
|
149
157
|
...(isRecord(raw.wakersDeferred) ? { wakersDeferred: raw.wakersDeferred } : {}),
|
|
150
|
-
...(isRecord(raw.wakeAsks) ? { wakeAsks: Object.fromEntries(Object.entries(raw.wakeAsks)
|
|
158
|
+
...(isRecord(raw.wakeAsks) ? { wakeAsks: Object.fromEntries(Object.entries(raw.wakeAsks)
|
|
159
|
+
.filter(([, v]) => isRecord(v) && typeof v.team === "string" && typeof v.member === "string" && typeof v.at === "number")
|
|
160
|
+
.map(([k, v]) => {
|
|
161
|
+
const w = v;
|
|
162
|
+
const { refs, ...rest } = w;
|
|
163
|
+
return [k, Array.isArray(refs) ? { ...rest, refs: refs.filter((r) => typeof r === "string") } : rest];
|
|
164
|
+
})) } : {}),
|
|
151
165
|
...(isRecord(raw.wakeOnce) ? { wakeOnce: Object.fromEntries(Object.entries(raw.wakeOnce).filter(([, v]) => typeof v === "number" && v > 0 && v < 100)) } : {}),
|
|
152
|
-
...(isRecord(raw.wakeNo) ? { wakeNo: Object.fromEntries(Object.entries(raw.wakeNo).filter(([, v]) => typeof v === "number")) } : {}),
|
|
166
|
+
...(isRecord(raw.wakeNo) ? { wakeNo: notAfterNow(Object.fromEntries(Object.entries(raw.wakeNo).filter(([, v]) => typeof v === "number"))) } : {}),
|
|
153
167
|
...(isRecord(raw.wakeTeamFlag) ? { wakeTeamFlag: Object.fromEntries(Object.entries(raw.wakeTeamFlag).filter(([, v]) => typeof v === "number")) } : {}),
|
|
154
168
|
...(isRecord(raw.upgradeHeld) && typeof raw.upgradeHeld.version === "string" && typeof raw.upgradeHeld.node === "string"
|
|
155
169
|
? { upgradeHeld: { version: raw.upgradeHeld.version, node: raw.upgradeHeld.node, at: Number(raw.upgradeHeld.at) || 0, why: String(raw.upgradeHeld.why ?? "") } } : {}),
|
|
@@ -157,17 +171,28 @@ export function loadPolicy(home) {
|
|
|
157
171
|
...(typeof raw.idleSeconds === "number" && parseIdleSeconds(raw.idleSeconds) !== null ? { idleSeconds: raw.idleSeconds } : {}),
|
|
158
172
|
...(typeof raw.mode === "string" && parseMode(raw.mode) ? { mode: raw.mode } : {}),
|
|
159
173
|
...(typeof raw.modeToldAt === "number" ? { modeToldAt: raw.modeToldAt } : {}),
|
|
174
|
+
...(isRecord(raw.stuckReports) ? { stuckReports: Object.fromEntries(Object.entries(raw.stuckReports).filter(([, v]) => isRecord(v) && typeof v.ref === "string" && typeof v.team === "string" && typeof v.at === "number")) } : {}),
|
|
175
|
+
...(Array.isArray(raw.finalNo) ? { finalNo: raw.finalNo.filter((k) => typeof k === "string") } : {}),
|
|
160
176
|
};
|
|
161
177
|
}
|
|
162
178
|
catch {
|
|
163
179
|
return { grants: {}, asks: {}, denied: {}, attempts: {} };
|
|
164
180
|
}
|
|
165
181
|
}
|
|
182
|
+
export function clearWakeNo(p, teams, member) {
|
|
183
|
+
for (const t of teams) {
|
|
184
|
+
delete p.wakeNo?.[wakeKey(t, member)];
|
|
185
|
+
if (p.finalNo)
|
|
186
|
+
p.finalNo = p.finalNo.filter((k) => k !== finalKey.wake(t, member));
|
|
187
|
+
}
|
|
188
|
+
}
|
|
166
189
|
export function setWaker(p, team, member, approved) {
|
|
167
190
|
const w = (p.wakers ??= {});
|
|
168
191
|
const cur = new Set(w[team] ?? []);
|
|
169
|
-
if (approved)
|
|
192
|
+
if (approved) {
|
|
170
193
|
cur.add(member);
|
|
194
|
+
clearWakeNo(p, [team], member);
|
|
195
|
+
}
|
|
171
196
|
else
|
|
172
197
|
cur.delete(member);
|
|
173
198
|
if (cur.size)
|
|
@@ -219,7 +244,7 @@ export function relayKnowsAdmitters(members, me) {
|
|
|
219
244
|
const all = members.filter((m) => m.admitted);
|
|
220
245
|
return !all.some((m) => m.member !== me) || all.some((m) => m.admitted_by !== undefined);
|
|
221
246
|
}
|
|
222
|
-
export function setLocalWaker(teams, member, approved, home, env = process.env) {
|
|
247
|
+
export function setLocalWaker(teams, member, approved, home, env = process.env, opts = {}) {
|
|
223
248
|
if (inWokenRun(env))
|
|
224
249
|
return { ok: false, why: "a woken run cannot change who may wake this machine — a person has to run this here" };
|
|
225
250
|
const keys = [...new Set(teams.filter((t) => !!t))];
|
|
@@ -230,12 +255,26 @@ export function setLocalWaker(teams, member, approved, home, env = process.env)
|
|
|
230
255
|
if (approved) {
|
|
231
256
|
if (!was)
|
|
232
257
|
setWaker(p, keys[0], member, true);
|
|
258
|
+
clearWakeNo(p, keys, member);
|
|
233
259
|
}
|
|
234
|
-
else
|
|
260
|
+
else {
|
|
235
261
|
for (const k of keys)
|
|
236
262
|
setWaker(p, k, member, false);
|
|
237
|
-
|
|
263
|
+
if (opts.no) {
|
|
264
|
+
const now = Date.now();
|
|
265
|
+
for (const k of keys) {
|
|
266
|
+
(p.wakeNo ??= {})[wakeKey(k, member)] = now;
|
|
267
|
+
if (!p.finalNo?.includes(finalKey.wake(k, member)))
|
|
268
|
+
(p.finalNo ??= []).push(finalKey.wake(k, member));
|
|
269
|
+
}
|
|
270
|
+
savePolicy(p, home);
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
if (was === approved) {
|
|
274
|
+
if (approved)
|
|
275
|
+
savePolicy(p, home);
|
|
238
276
|
return { ok: true, changed: false };
|
|
277
|
+
}
|
|
239
278
|
savePolicy(p, home);
|
|
240
279
|
return { ok: true, changed: true };
|
|
241
280
|
}
|
|
@@ -286,6 +325,8 @@ export function grant(p, cap, mode, by) {
|
|
|
286
325
|
p.grants[cap] = { mode, by, at: Date.now() };
|
|
287
326
|
delete p.asks[cap];
|
|
288
327
|
delete p.denied[cap];
|
|
328
|
+
if (p.finalNo)
|
|
329
|
+
p.finalNo = p.finalNo.filter((k) => k !== finalKey.cap(cap));
|
|
289
330
|
}
|
|
290
331
|
export function revoke(p, cap) {
|
|
291
332
|
delete p.grants[cap];
|
|
@@ -302,7 +343,11 @@ export function mayAsk(p, cap, now = Date.now()) {
|
|
|
302
343
|
if (open && now - open.at < ASK_EXPIRY_MS)
|
|
303
344
|
return false;
|
|
304
345
|
const deniedAt = p.denied[cap];
|
|
305
|
-
|
|
346
|
+
if (deniedAt === undefined)
|
|
347
|
+
return true;
|
|
348
|
+
if (cap === "run_commands" && p.finalNo?.includes(finalKey.cap(cap)))
|
|
349
|
+
return false;
|
|
350
|
+
return now - deniedAt >= ASK_COOLDOWN_MS;
|
|
306
351
|
}
|
|
307
352
|
export function recordAsk(p, cap, escalateActId) {
|
|
308
353
|
p.asks[cap] = { act: escalateActId, at: Date.now() };
|
|
@@ -336,8 +381,11 @@ export function applyLocalAnswer(refActId, body, home, env = process.env) {
|
|
|
336
381
|
setWaker(p, wa.team, wa.member, true);
|
|
337
382
|
else if (verdict === "allow-once")
|
|
338
383
|
(p.wakeOnce ??= {})[k] = Math.min(99, (p.wakeOnce[k] ?? 0) + 1);
|
|
339
|
-
else
|
|
384
|
+
else {
|
|
340
385
|
(p.wakeNo ??= {})[k] = Date.now();
|
|
386
|
+
if (!p.finalNo?.includes(finalKey.wake(wa.team, wa.member)))
|
|
387
|
+
(p.finalNo ??= []).push(finalKey.wake(wa.team, wa.member));
|
|
388
|
+
}
|
|
341
389
|
if (verdict !== "deny" && wa.teamBlocked)
|
|
342
390
|
(p.wakeTeamFlag ??= {})[k] = Date.now();
|
|
343
391
|
delete p.wakeAsks[refActId];
|
|
@@ -351,6 +399,8 @@ export function applyLocalAnswer(refActId, body, home, env = process.env) {
|
|
|
351
399
|
const r = applyAnswer(p, refActId, body);
|
|
352
400
|
if (!r)
|
|
353
401
|
return null;
|
|
402
|
+
if (r.verdict === "deny" && r.cap === "run_commands" && !p.finalNo?.includes(finalKey.cap(r.cap)))
|
|
403
|
+
(p.finalNo ??= []).push(finalKey.cap(r.cap));
|
|
354
404
|
savePolicy(p, home);
|
|
355
405
|
return { applied: true, ...r };
|
|
356
406
|
}
|
|
@@ -361,11 +411,13 @@ export function describeLocalAnswer(g) {
|
|
|
361
411
|
const who = g.wake.member;
|
|
362
412
|
return g.verdict === "allow-always" ? `${who} may start work on this machine from now on — undo: pantheon wake deny ${who}`
|
|
363
413
|
: g.verdict === "allow-once" ? `${who} may start work on this machine this once — their request runs now`
|
|
364
|
-
: `${who} will not start work on this machine; their requests wait for you
|
|
414
|
+
: `${who} will not start work on this machine; their requests wait for you. You won't be asked again — to allow it later: pantheon wake allow ${who}`;
|
|
365
415
|
}
|
|
366
416
|
const name = CAPABILITY_ARGS[g.cap];
|
|
367
417
|
if (g.verdict === "deny")
|
|
368
|
-
return
|
|
418
|
+
return g.cap === "self_upgrade"
|
|
419
|
+
? `denied ${name} on this machine — the worker will not ask again for a day`
|
|
420
|
+
: `denied ${name} on this machine — the worker won't ask again. To allow it later: pantheon policy grant ${name}`;
|
|
369
421
|
return `granted ${name} on this machine${g.verdict === "allow-once" ? " for its next use" : ""} — revoke: pantheon policy revoke ${name}`;
|
|
370
422
|
}
|
|
371
423
|
export function applyAnswer(p, refActId, body) {
|
package/dist/worker.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { OWED_WORDS, plainRequest } from "./plain.js";
|
|
1
2
|
import { spawn as procSpawn } from "node:child_process";
|
|
2
3
|
import { execFileSync } from "node:child_process";
|
|
3
4
|
import { chmodSync, lstatSync, mkdirSync, writeFileSync, existsSync, readdirSync, readFileSync, readlinkSync, realpathSync, rmSync, statSync } from "node:fs";
|
|
@@ -778,6 +779,8 @@ export function deliveryStep(branch, canPush, ref) {
|
|
|
778
779
|
pantheon_send NOTE with${r || " a ref,"} saying what you changed and that it waits on branch ${branch} on this machine
|
|
779
780
|
for your human to review and push. If the request asked for code, that NOTE is your reply.`;
|
|
780
781
|
}
|
|
782
|
+
const SAFETY_CAUSES = new Set(["outside_links", "worktree_tampered"]);
|
|
783
|
+
export const MOOT_GRACE_MS = 2 * 60_000;
|
|
781
784
|
export function buildBrief(o, trigger, branch, persona, canPush = false) {
|
|
782
785
|
const placed = branch
|
|
783
786
|
? `in an isolated git worktree on branch ${branch}`
|
|
@@ -801,13 +804,16 @@ DO THIS
|
|
|
801
804
|
2. pantheon_status and, if there is a goal, pantheon_history to understand the context.
|
|
802
805
|
3. Do the work here. You may read and edit files in this worktree. Do NOT merge, ${branch && canPush ? `do NOT push any branch but ${branch}` : "do NOT push"},
|
|
803
806
|
do NOT touch any checkout other than this one.
|
|
804
|
-
4. Reply with pantheon_send — ANSWER an ASK, ACCEPT or OBJECT a PROPOSE, and so on.
|
|
807
|
+
4. Reply with pantheon_send — ANSWER an ASK, ACCEPT or OBJECT a PROPOSE, and so on. A person will
|
|
808
|
+
read it: the answer first, in plain words, a few sentences. A simple question gets a one- or
|
|
809
|
+
two-sentence answer — no plan, no options, no ids.
|
|
805
810
|
5. ${branch
|
|
806
811
|
? deliveryStep(branch, canPush, o.ref)
|
|
807
812
|
: `Do not promise code. There is no repo here, so nothing you write can be fetched by your
|
|
808
813
|
peer — say what you would do and leave the writing to your human.`}
|
|
809
814
|
6. If this genuinely needs your human — money, scope, anything irreversible, or one of their
|
|
810
|
-
stated red lines — pantheon_send ESCALATE and stop
|
|
815
|
+
stated red lines — pantheon_send ESCALATE and stop: the question in one sentence, why, the options,
|
|
816
|
+
your recommendation. Do not guess on their behalf.
|
|
811
817
|
|
|
812
818
|
There is no human in this session. Do not ask for approval; you will not get an answer.
|
|
813
819
|
Keep going until you have replied, then finish.`;
|
|
@@ -827,8 +833,8 @@ verify it against the goal's acceptance criteria, then pantheon_send ACCEPT (ref
|
|
|
827
833
|
holds or OBJECT with specifics if it does not. Never rubber-stamp: an unchecked ACCEPT is how
|
|
828
834
|
broken work lands.`
|
|
829
835
|
: `Your peer ANSWERED${inGoal("in")}. Use the answer: take the next concrete
|
|
830
|
-
step it unblocks. If
|
|
831
|
-
otherwise reply with the one act that moves the goal forward.`;
|
|
836
|
+
step it unblocks. If that finishes the goal, pantheon_send CLOSE with one line on what was settled;
|
|
837
|
+
otherwise reply with the one act that moves the goal forward, written for a person: point first, short.`;
|
|
832
838
|
return `A teammate's agent moved your work forward while your human is away, and the ball is now in
|
|
833
839
|
your court. You are running unattended ${placed}.
|
|
834
840
|
|
|
@@ -1612,7 +1618,7 @@ export class Worker {
|
|
|
1612
1618
|
if (t <= was + 120_000)
|
|
1613
1619
|
this.outageHeldUntil.delete(k);
|
|
1614
1620
|
}
|
|
1615
|
-
this.opts.log(` agent ${agentById(id)?.label ?? id}
|
|
1621
|
+
this.opts.log(` agent ${agentById(id)?.label ?? id} may be signed in again — trying it with the next request`);
|
|
1616
1622
|
this.readinessAt = 0;
|
|
1617
1623
|
}
|
|
1618
1624
|
}
|
|
@@ -2117,8 +2123,13 @@ export class Worker {
|
|
|
2117
2123
|
const what = clip((said.split("\n").find((l) => l.trim()) ?? said).replace(new RegExp(`^${member.replace(/[.*+?^${}()|[\]\\]/g, "\\$&")} asked:\\s*`, "i"), ""), 140);
|
|
2118
2124
|
if (!mayAskWake(pol, teams, member)) {
|
|
2119
2125
|
const open = Object.entries(pol.wakeAsks ?? {}).find(([, a]) => teams.includes(a.team) && a.member === member);
|
|
2120
|
-
if (open)
|
|
2126
|
+
if (open) {
|
|
2127
|
+
if (open[1].refs && !open[1].refs.includes(o.ref)) {
|
|
2128
|
+
open[1].refs.push(o.ref);
|
|
2129
|
+
savePolicy(pol, this.opts.home);
|
|
2130
|
+
}
|
|
2121
2131
|
this.alertWakeAsk(member, what, open[0]);
|
|
2132
|
+
}
|
|
2122
2133
|
return;
|
|
2123
2134
|
}
|
|
2124
2135
|
try {
|
|
@@ -2153,7 +2164,7 @@ export class Worker {
|
|
|
2153
2164
|
}
|
|
2154
2165
|
const me2 = client.members.find((m) => m.member === member);
|
|
2155
2166
|
const teamBlocked = me2?.admitted === true && !me2.revoked_by && me2.may_wake === false;
|
|
2156
|
-
(p.wakeAsks ??= {})[sent.id] = { team: this.cfg.spaceId ?? this.cfg.space, member, at: Date.now(), ...(teamBlocked ? { teamBlocked: true } : {}) };
|
|
2167
|
+
(p.wakeAsks ??= {})[sent.id] = { team: this.cfg.spaceId ?? this.cfg.space, member, at: Date.now(), refs: [o.ref], ...(teamBlocked ? { teamBlocked: true } : {}) };
|
|
2157
2168
|
askedHere.add(sent.id);
|
|
2158
2169
|
this.askedMembers.add(member);
|
|
2159
2170
|
savePolicy(p, this.opts.home);
|
|
@@ -2182,7 +2193,7 @@ export class Worker {
|
|
|
2182
2193
|
this.opts.notify(composeWakeAsk({ member, what, space: this.cfg.space, focus, mac: process.platform === "darwin" }));
|
|
2183
2194
|
}
|
|
2184
2195
|
catch { }
|
|
2185
|
-
this.opts.log(`* alerted you: ${member}
|
|
2196
|
+
this.opts.log(`* alerted you: ${member} wants your agent to work on this (once for this question)`);
|
|
2186
2197
|
}
|
|
2187
2198
|
async routeFor(client, o, trigger, wokeBy) {
|
|
2188
2199
|
const workspaces = this.workspaceList();
|
|
@@ -2508,6 +2519,7 @@ export class Worker {
|
|
|
2508
2519
|
await this.tellStops(client);
|
|
2509
2520
|
this.sayKeyChanges(client);
|
|
2510
2521
|
this.syncSignedOut();
|
|
2522
|
+
await this.settleMoot(client);
|
|
2511
2523
|
const aged = client
|
|
2512
2524
|
.myWork()
|
|
2513
2525
|
.filter((o) => o.kind !== "HUMAN" && o.kind !== "DELIVER" && !o.claimed_by)
|
|
@@ -4208,6 +4220,77 @@ export class Worker {
|
|
|
4208
4220
|
this.opts.log(`! could not tell the teammate that ${o.id} is waiting: ${e.message}`);
|
|
4209
4221
|
}
|
|
4210
4222
|
}
|
|
4223
|
+
mootSince = new Map();
|
|
4224
|
+
mootRetryAt = new Map();
|
|
4225
|
+
async settleMoot(client) {
|
|
4226
|
+
if (!client.connected)
|
|
4227
|
+
return;
|
|
4228
|
+
const policy = loadPolicy(this.opts.home);
|
|
4229
|
+
const teams = [this.cfg.spaceId, this.cfg.space].filter((t) => !!t);
|
|
4230
|
+
const reports = [
|
|
4231
|
+
...Object.entries(policy.stuckReports ?? {}).filter(([, r]) => teams.includes(r.team))
|
|
4232
|
+
.map(([act, r]) => [act, [r.ref], "stuck"]),
|
|
4233
|
+
...Object.entries(policy.wakeAsks ?? {}).filter(([, a]) => teams.includes(a.team) && a.refs?.length)
|
|
4234
|
+
.map(([act, a]) => [act, a.refs, "wake"]),
|
|
4235
|
+
];
|
|
4236
|
+
for (const k of [...this.mootSince.keys()])
|
|
4237
|
+
if (!reports.some(([a]) => a === k))
|
|
4238
|
+
this.mootSince.delete(k);
|
|
4239
|
+
if (!reports.length)
|
|
4240
|
+
return;
|
|
4241
|
+
const now = Date.now();
|
|
4242
|
+
const done = [];
|
|
4243
|
+
for (const [act, refs, kind] of reports) {
|
|
4244
|
+
const member = kind === "wake" ? policy.wakeAsks?.[act]?.member : undefined;
|
|
4245
|
+
const owed = client.obligations.some((o) => o.owner === this.cfg.member && o.kind !== "HUMAN" &&
|
|
4246
|
+
(refs.includes(o.ref) || (!!member && (client.seenAct(o.ref)?.from ?? /^([a-z0-9._-]+)\s/i.exec(o.body)?.[1]) === member)));
|
|
4247
|
+
if (owed) {
|
|
4248
|
+
this.mootSince.delete(act);
|
|
4249
|
+
continue;
|
|
4250
|
+
}
|
|
4251
|
+
const since = this.mootSince.get(act);
|
|
4252
|
+
if (since === undefined) {
|
|
4253
|
+
this.mootSince.set(act, now);
|
|
4254
|
+
continue;
|
|
4255
|
+
}
|
|
4256
|
+
if (now - since < (this.opts.mootGraceMs ?? MOOT_GRACE_MS))
|
|
4257
|
+
continue;
|
|
4258
|
+
if ((this.mootRetryAt.get(act) ?? 0) > now)
|
|
4259
|
+
continue;
|
|
4260
|
+
const open = client.obligations.some((o) => o.kind === "HUMAN" && o.ref === act);
|
|
4261
|
+
if (open) {
|
|
4262
|
+
try {
|
|
4263
|
+
await client.send({ act: "RETRACT", goal: null, ref: act, after_seq: Math.max(client.readSeq, client.seq),
|
|
4264
|
+
body: kind === "wake"
|
|
4265
|
+
? "No longer needed: the request this was about isn't waiting here any more (it was answered, withdrawn or closed). Nothing was changed on this computer — you'll be asked again if they need it."
|
|
4266
|
+
: "No longer needed: the request this was about isn't waiting here any more (it was answered, withdrawn or closed). Nothing was changed on this computer." });
|
|
4267
|
+
this.opts.log(`* withdrew ${act}: the request${refs.length > 1 ? "s" : ""} it was about (${refs.join(", ")}) ${refs.length > 1 ? "are" : "is"} finished`);
|
|
4268
|
+
}
|
|
4269
|
+
catch (e) {
|
|
4270
|
+
this.mootRetryAt.set(act, now + 5 * 60_000);
|
|
4271
|
+
this.opts.log(`! could not withdraw ${act}: ${e.message}`);
|
|
4272
|
+
continue;
|
|
4273
|
+
}
|
|
4274
|
+
}
|
|
4275
|
+
done.push([act, kind]);
|
|
4276
|
+
this.mootSince.delete(act);
|
|
4277
|
+
this.mootRetryAt.delete(act);
|
|
4278
|
+
}
|
|
4279
|
+
if (!done.length)
|
|
4280
|
+
return;
|
|
4281
|
+
const fresh = loadPolicy(this.opts.home);
|
|
4282
|
+
for (const [act, kind] of done) {
|
|
4283
|
+
if (kind === "wake")
|
|
4284
|
+
delete fresh.wakeAsks?.[act];
|
|
4285
|
+
else {
|
|
4286
|
+
delete fresh.stuckReports?.[act];
|
|
4287
|
+
for (const [cap, a] of Object.entries(fresh.asks))
|
|
4288
|
+
if (a?.act === act)
|
|
4289
|
+
delete fresh.asks[cap];
|
|
4290
|
+
}
|
|
4291
|
+
}
|
|
4292
|
+
savePolicy(fresh, this.opts.home);
|
|
4293
|
+
}
|
|
4211
4294
|
async reportStuck(client, o, d, attempts) {
|
|
4212
4295
|
const key = `stuck:${o.id}`;
|
|
4213
4296
|
const space = this.spaceKey();
|
|
@@ -4215,32 +4298,34 @@ export class Worker {
|
|
|
4215
4298
|
return;
|
|
4216
4299
|
const policy = loadPolicy(this.opts.home);
|
|
4217
4300
|
const asking = !!d.capability && mayAsk(policy, d.capability);
|
|
4218
|
-
const what = clip(o.body,
|
|
4301
|
+
const what = clip(plainRequest(o.body, this.cfg.member), 160);
|
|
4302
|
+
const owed = o.kind === "CONTINUE" ? "a follow-up" : OWED_WORDS[o.kind] ?? "a reply";
|
|
4219
4303
|
const lines = [
|
|
4220
|
-
attempts === 0 ? `
|
|
4221
|
-
:
|
|
4304
|
+
attempts === 0 ? `Couldn't start on ${owed} for a teammate — ${what}`
|
|
4305
|
+
: `Couldn't finish ${owed} for a teammate${attempts > 1 ? ` (${attempts} tries)` : ""} — ${what}`,
|
|
4222
4306
|
``,
|
|
4223
|
-
`
|
|
4224
|
-
`
|
|
4225
|
-
...(d.dir && d.lines?.length ? [``, `On this
|
|
4307
|
+
`Why: ${d.says}`,
|
|
4308
|
+
`What to do: ${asking ? "answer the question below." : d.fix}`,
|
|
4309
|
+
...(d.dir && d.lines?.length ? [``, `On this computer, in ${d.dir}:`, ...d.lines.map((l) => ` ${l}`)] : []),
|
|
4226
4310
|
``,
|
|
4227
|
-
`
|
|
4228
|
-
`It will not be retried unattended — a live session here, or you, has to move it.`,
|
|
4311
|
+
`The request is still open, and the teammate who asked hasn't been told. It won't be retried on its own.`,
|
|
4229
4312
|
];
|
|
4230
4313
|
if (asking) {
|
|
4231
|
-
lines.push(``, `
|
|
4314
|
+
lines.push(``, `Also: may ${this.cfg.member}'s agent run commands on this computer (tests, commit, push)? Answer "allow always", "allow once", or "deny" — in the menu bar, or with pantheon approvals.`, `Today it may only edit files, which is why it couldn't commit or push. Allowing it means: ${COMMAND_GRANT_SCOPE}`, `Answer on this computer: an answer from anywhere else settles this but grants nothing.`);
|
|
4232
4315
|
}
|
|
4233
4316
|
try {
|
|
4234
4317
|
const sent = await client.send({
|
|
4235
4318
|
act: "ESCALATE", goal: o.goal, ref: o.ref, after_seq: Math.max(client.readSeq, client.seq),
|
|
4236
|
-
summary: clip(this.ledgerPaths(
|
|
4319
|
+
summary: clip(this.ledgerPaths(`${this.cfg.member}'s agent is stuck: ${d.says}`), 190),
|
|
4237
4320
|
body: this.ledgerPaths(lines.join("\n")),
|
|
4238
4321
|
});
|
|
4239
4322
|
markContinued(space, key, this.opts.home);
|
|
4240
|
-
|
|
4241
|
-
|
|
4242
|
-
|
|
4243
|
-
|
|
4323
|
+
const fresh = loadPolicy(this.opts.home);
|
|
4324
|
+
if (asking && d.capability)
|
|
4325
|
+
recordAsk(fresh, d.capability, sent.id);
|
|
4326
|
+
if (o.kind !== "CONTINUE" && !SAFETY_CAUSES.has(d.cause))
|
|
4327
|
+
(fresh.stuckReports ??= {})[sent.id] = { ref: o.ref, team: this.cfg.spaceId ?? this.cfg.space, at: Date.now() };
|
|
4328
|
+
savePolicy(fresh, this.opts.home);
|
|
4244
4329
|
this.opts.log(`* escalated ${o.id}: ${d.cause}${asking ? ` (and asked for ${d.capability})` : ""}`);
|
|
4245
4330
|
}
|
|
4246
4331
|
catch (e) {
|
|
@@ -4391,7 +4476,7 @@ export class Worker {
|
|
|
4391
4476
|
const home = this.opts.home;
|
|
4392
4477
|
{
|
|
4393
4478
|
const policy = loadPolicy(home);
|
|
4394
|
-
|
|
4479
|
+
const denies = [];
|
|
4395
4480
|
for (const cap of Object.keys(policy.asks)) {
|
|
4396
4481
|
const open = policy.asks[cap];
|
|
4397
4482
|
if (!open || this.ledgerAllowSeen.has(open.act))
|
|
@@ -4402,9 +4487,8 @@ export class Worker {
|
|
|
4402
4487
|
continue;
|
|
4403
4488
|
const verdict = parseGrantAnswer(body);
|
|
4404
4489
|
if (verdict === "deny") {
|
|
4405
|
-
|
|
4490
|
+
denies.push([open.act, body]);
|
|
4406
4491
|
this.askAt.delete(open.act);
|
|
4407
|
-
changed = true;
|
|
4408
4492
|
this.opts.log(`* grant request answered on the ledger: ${cap} -> deny`);
|
|
4409
4493
|
}
|
|
4410
4494
|
else if (verdict) {
|
|
@@ -4413,8 +4497,12 @@ export class Worker {
|
|
|
4413
4497
|
`a grant takes effect only from this machine. To grant it: pantheon policy grant ${CAPABILITY_ARGS[cap]}`);
|
|
4414
4498
|
}
|
|
4415
4499
|
}
|
|
4416
|
-
if (
|
|
4417
|
-
|
|
4500
|
+
if (denies.length) {
|
|
4501
|
+
const fresh = loadPolicy(home);
|
|
4502
|
+
for (const [act, body] of denies)
|
|
4503
|
+
applyAnswer(fresh, act, body);
|
|
4504
|
+
savePolicy(fresh, home);
|
|
4505
|
+
}
|
|
4418
4506
|
}
|
|
4419
4507
|
if (fleetLock)
|
|
4420
4508
|
return;
|
package/dist/worklist.js
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
export function goalKindLabel(g) {
|
|
2
2
|
return g.kind === "worklist" ? " [worklist — one person's own list; nobody owes anything here, and it does not keep you in the loop]" : "";
|
|
3
3
|
}
|
|
4
|
+
export function questionTitle(text) {
|
|
5
|
+
const line = text.replace(/\s+/g, " ").trim();
|
|
6
|
+
const sentence = /^(.{12,}?[?.!])(\s|$)/.exec(line)?.[1] ?? line;
|
|
7
|
+
const t = sentence.length > 90 ? `${sentence.slice(0, 89).replace(/\s+\S*$/, "")}…` : sentence;
|
|
8
|
+
return t || "A question";
|
|
9
|
+
}
|
|
4
10
|
export function openedText(id, title, askedWorklist, seen, deadlineLine = "") {
|
|
5
11
|
const head = `goal ${id} opened: "${title}"${deadlineLine}`;
|
|
6
12
|
if (!askedWorklist)
|
|
7
|
-
return `${head}\n\nNext:
|
|
13
|
+
return `${head}\n\nNext: send what you need in it — an ASK, or the work itself. PROPOSE only when people must agree on an interface or on who does what.`;
|
|
8
14
|
if (seen?.kind !== "worklist") {
|
|
9
15
|
return `${head}\n\nOpened as an ORDINARY goal: this relay is older than the worklist feature and ignored the flag. ` +
|
|
10
16
|
`The six-acts-in-a-row guard still applies here, so file items in batches of six and expect PEER_TURN between them ` +
|