neurastream 0.3.18 → 0.3.21
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/README.md +88 -490
- package/package.json +1 -1
- package/src/adapters/index.ts +3 -2
- package/src/adapters/omp/adapter.ts +2 -1
- package/src/adapters/omp/auto-close.ts +64 -0
- package/src/adapters/omp/chat-commands.ts +161 -0
- package/src/adapters/omp/inbox.ts +221 -0
- package/src/adapters/omp/index.ts +138 -1050
- package/src/adapters/omp/launch.ts +35 -9
- package/src/adapters/omp/rate-limit-controller.ts +196 -0
- package/src/adapters/omp/rollover-controller.ts +334 -0
- package/src/adapters/omp/types.ts +143 -0
- package/src/cli/claim.ts +1 -3
- package/src/cli/commands.ts +33 -2
- package/src/cli/dispatch.ts +55 -30
- package/src/cli/guard.ts +0 -3
- package/src/cli/incident.ts +2 -2
- package/src/cli/metrics.ts +1 -1
- package/src/cli/recall.ts +6 -8
- package/src/cli/results-build.ts +2 -4
- package/src/cli/workspace.ts +13 -5
- package/src/core/adapter.ts +16 -0
- package/src/core/autonomy.ts +24 -21
- package/src/core/blockers.ts +326 -30
- package/src/core/file-lock.ts +71 -12
- package/src/core/guards/plan-edit.ts +338 -0
- package/src/core/guards/planner.ts +70 -0
- package/src/core/guards/review.ts +391 -0
- package/src/core/guards/spawn.ts +699 -0
- package/src/core/guards/state.ts +581 -0
- package/src/core/guards/stop.ts +235 -0
- package/src/core/guards/tool.ts +541 -0
- package/src/core/guards.ts +12 -2661
- package/src/core/incidents.ts +134 -99
- package/src/core/machine-guard.ts +23 -5
- package/src/core/main-start.ts +11 -9
- package/src/core/mr-sweep.ts +4 -2
- package/src/core/notify.ts +15 -15
- package/src/core/owner-log.ts +19 -17
- package/src/core/owner-topics.ts +38 -48
- package/src/core/owner-ui/auth.ts +164 -0
- package/src/core/owner-ui/data.ts +437 -0
- package/src/core/owner-ui/handlers.ts +250 -0
- package/src/core/owner-ui/messages.ts +209 -0
- package/src/core/owner-ui/render.ts +714 -0
- package/src/core/owner-ui/results.ts +266 -0
- package/src/core/owner-ui/server.ts +142 -0
- package/src/core/owner-ui.ts +11 -2118
- package/src/core/page-notes.ts +25 -0
- package/src/core/pages.ts +452 -78
- package/src/core/plan-approval.ts +24 -26
- package/src/core/queue/lib.ts +170 -137
- package/src/core/queue-cancel.ts +29 -15
- package/src/core/queue-check.ts +5 -7
- package/src/core/queue-close.ts +54 -29
- package/src/core/queue-finished.ts +9 -10
- package/src/core/queue-migrate.ts +1 -3
- package/src/core/queue-trim.ts +2 -4
- package/src/core/results.ts +0 -2
- package/src/core/rollover.ts +2 -3
- package/src/core/secret-redact.ts +65 -14
- package/src/core/tailscale.ts +79 -3
- package/src/core/team-client.ts +18 -6
- package/src/core/uninstall.ts +2 -0
- package/src/core/watch.ts +3 -2
- package/src/core/queue/env.ts +0 -14
|
@@ -0,0 +1,541 @@
|
|
|
1
|
+
// Pre-tool guard checks: protected files, subagent rules/blockers/budgets, Main edit window, and Main call budget.
|
|
2
|
+
|
|
3
|
+
import { execFileSync } from "node:child_process";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import type { Decision, RunSource, ToolEvent } from "../adapter.ts";
|
|
6
|
+
import { currentPlanner, currentTier, takeGo } from "../autonomy.ts";
|
|
7
|
+
import { nowSec } from "../clock.ts";
|
|
8
|
+
import type { Config } from "../config.ts";
|
|
9
|
+
import { removalFlags, stagedDiff, type RemovalFlag } from "../diff-check.ts";
|
|
10
|
+
import { notifyProtectedPaths, notifySecretReadHit } from "../notify.ts";
|
|
11
|
+
import * as q from "../queue/lib.ts";
|
|
12
|
+
import type { Plan } from "../queue/lib.ts";
|
|
13
|
+
import { plannerSpawnPlan } from "./planner.ts";
|
|
14
|
+
import { matchReviewSpawn, readReviewSpawns, reviewLockProblem } from "./review.ts";
|
|
15
|
+
import { bypassLaunch, taskLaunch } from "./spawn.ts";
|
|
16
|
+
import {
|
|
17
|
+
ALLOW,
|
|
18
|
+
bypassRegExp,
|
|
19
|
+
changedProjectFiles,
|
|
20
|
+
deny,
|
|
21
|
+
log,
|
|
22
|
+
MAIN_CALLS_RESET_SEC,
|
|
23
|
+
MAIN_PLAN_FILE,
|
|
24
|
+
mainCallsExpired,
|
|
25
|
+
mainStateDir,
|
|
26
|
+
readStaffing,
|
|
27
|
+
readWindow,
|
|
28
|
+
recordMainReads,
|
|
29
|
+
subCallCap,
|
|
30
|
+
tuned,
|
|
31
|
+
unlockUntilMs,
|
|
32
|
+
updateWindow,
|
|
33
|
+
} from "./state.ts";
|
|
34
|
+
|
|
35
|
+
/** A raw target that names a plan: under a docs/plans/ directory, or a plan file name (YYYYMMDD_HHMM_*.md). */
|
|
36
|
+
function isPlanName(raw: string): boolean {
|
|
37
|
+
return /(^|\/)docs\/plans\//.test(raw) || /^\d{8}_\d{4}_[^/]*\.md$/.test(raw.split("/").pop() ?? "");
|
|
38
|
+
}
|
|
39
|
+
const PLAN_WRITE_TOOLS: Record<string, true> = { edit: true, write: true, ast_edit: true };
|
|
40
|
+
|
|
41
|
+
function protectedHit(paths: string[], cfg: Config): string | null {
|
|
42
|
+
const hit = q.protectedHit(paths, cfg.paths);
|
|
43
|
+
if (hit) return hit;
|
|
44
|
+
for (const p of paths) {
|
|
45
|
+
for (const raw of cfg.guards.protected) {
|
|
46
|
+
const g = q.expandHome(raw);
|
|
47
|
+
if (g.endsWith("/") ? p.startsWith(g) || `${p}/` === g : p === g) return p;
|
|
48
|
+
}
|
|
49
|
+
// The user's config file and the configured notify secret files are guard surface too:
|
|
50
|
+
// an agent that could rewrite them could point notify at its own webhook.
|
|
51
|
+
if (notifyProtectedPaths(cfg).includes(p)) return p;
|
|
52
|
+
}
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function runBlockers(plan: Plan, hit: string[], e: ToolEvent, cfg: Config): string | null {
|
|
57
|
+
// A caller staffed on a different plan (staffing.json holds the task names, keyed by agentId)
|
|
58
|
+
// only grazes this plan (I-20261028-111): its path blockers must judge the covered paths,
|
|
59
|
+
// not every path the command names.
|
|
60
|
+
const staffing = readStaffing(cfg.paths);
|
|
61
|
+
const foreign = !(staffing[plan.file] ?? []).includes(e.agentId) && Object.entries(staffing).some(([f, names]) => f !== plan.file && names.includes(e.agentId));
|
|
62
|
+
for (const b of plan.blockers) {
|
|
63
|
+
try {
|
|
64
|
+
execFileSync(b.script, b.args, {
|
|
65
|
+
input: JSON.stringify({ tool: e.tool, input: e.input, cwd: e.cwd, agent: e.agent, repo: plan.repo, plan: plan.file, paths: hit, ...(foreign ? { foreign: true } : {}) }),
|
|
66
|
+
encoding: "utf8",
|
|
67
|
+
timeout: cfg.guards.blocker_timeout_ms,
|
|
68
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
69
|
+
});
|
|
70
|
+
} catch (err) {
|
|
71
|
+
// P5c (plan 20261031_1207): the deny names the hit paths and the script's own output
|
|
72
|
+
// (stdout+stderr, first 300 chars) so the worker can fix the named file instead of
|
|
73
|
+
// retrying blind; the Error message is the last resort for a script with no output.
|
|
74
|
+
const stdout = typeof err === "object" && err !== null && "stdout" in err && typeof err.stdout === "string" ? err.stdout.trim() : "";
|
|
75
|
+
const stderr = typeof err === "object" && err !== null && "stderr" in err && typeof err.stderr === "string" ? err.stderr.trim() : "";
|
|
76
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
77
|
+
const detail = `${stdout}\n${stderr}`.trim().slice(0, 300);
|
|
78
|
+
const why = detail || `${path.basename(b.script)} failed (${message})`;
|
|
79
|
+
return `blocked by plan ${path.basename(plan.file)} (${hit.join(", ")}): ${why}`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// Words a shell line may put before the tool: launchers, shells with -c, VAR=value, and a script path ending in main.ts.
|
|
86
|
+
const LAUNCHERS: Record<string, true> = { bun: true, run: true, neurastream: true, node: true, npx: true, bunx: true, env: true, sudo: true, nohup: true, exec: true, bash: true, sh: true, zsh: true, "-c": true };
|
|
87
|
+
|
|
88
|
+
// True when a command segment runs queue-close or queue-cancel: the tool is the segment's first word after launchers.
|
|
89
|
+
// Segments also split at $( and backticks, so substitutions and `sh -c "..."` bodies are checked too.
|
|
90
|
+
function runsCloser(input: Record<string, unknown>): boolean {
|
|
91
|
+
const text = Object.values(input).filter((v): v is string => typeof v === "string").join("\n");
|
|
92
|
+
return text.split(/&&|\|\||;|\||\n|\$\(|`/).some(seg => {
|
|
93
|
+
const words = seg.trim().split(/\s+/).filter(Boolean).map(w => w.replace(/^["'(]+|["')]+$/g, ""));
|
|
94
|
+
let i = 0;
|
|
95
|
+
while (i < words.length && (LAUNCHERS[words[i] ?? ""] === true || /^\w+=/.test(words[i] ?? "") || /(^|\/)main\.ts$/.test(words[i] ?? ""))) i++;
|
|
96
|
+
const cmd = (words[i] ?? "").split("/").pop() ?? "";
|
|
97
|
+
return /^queue-(close|cancel)$/.test(cmd);
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const bin = (w: string | undefined) => (w ?? "").replace(/^["']+|["']+$/g, "").split("/").pop() ?? "";
|
|
102
|
+
|
|
103
|
+
// P5g (plan 20261027_0915): the shell text a call would really run — bash's command line, eval's
|
|
104
|
+
// !cmd shell-escape lines and the Bun.$/spawn arguments inside its code. Everything else in an
|
|
105
|
+
// input is prose or string data (a task brief, plan text, an eval cell that only names the page's
|
|
106
|
+
// words), and prose runs nothing.
|
|
107
|
+
function shellText(input: Record<string, unknown>): string {
|
|
108
|
+
if (typeof input.command === "string") return input.command;
|
|
109
|
+
const code = input.code;
|
|
110
|
+
if (typeof code !== "string") return "";
|
|
111
|
+
const out: string[] = [];
|
|
112
|
+
for (const m of code.matchAll(/^[ \t]*!(.+)$/gm)) out.push(m[1] ?? "");
|
|
113
|
+
for (const m of code.matchAll(/(?<!\w)(?:Bun\.)?\$[ \t]*`((?:[^`\\]|\\.)*)`/g)) out.push(m[1] ?? "");
|
|
114
|
+
for (const m of code.matchAll(/\b(?:Bun\.)?spawn(?:Sync)?[ \t]*\(([^)]*)/g))
|
|
115
|
+
out.push(
|
|
116
|
+
[...(m[1] ?? "").matchAll(/[`"']([^`"']*)[`"']/g)]
|
|
117
|
+
.map(s => s[1] ?? "")
|
|
118
|
+
.join(" "),
|
|
119
|
+
);
|
|
120
|
+
return out.join("\n");
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// True when a command segment starts the owner page (plan 20261024_2230 P3c): `neurastream
|
|
124
|
+
// workspace` serves it and `systemctl --user start/restart/enable` of neurastream-workspace
|
|
125
|
+
// relaunches it — the owner's systemd moves, never an agent's, unlocked or not. P5g: the text is
|
|
126
|
+
// shellText's — only real shell commands, never prose. Segment splitting and launcher skipping
|
|
127
|
+
// match runsCloser, so `sh -c "neurastream workspace"` and `sudo systemctl --user ...` are seen.
|
|
128
|
+
// (The command and unit were `ui` before the workspace rename; that name is gone, no alias.)
|
|
129
|
+
function startsOwnerUi(input: Record<string, unknown>): boolean {
|
|
130
|
+
const text = shellText(input);
|
|
131
|
+
return text.split(/&&|\|\||;|\||\n|\$\(|`/).some(seg => {
|
|
132
|
+
const words = seg.trim().split(/\s+/).filter(Boolean).map(w => w.replace(/^["'(]+|["')]+$/g, ""));
|
|
133
|
+
let i = 0;
|
|
134
|
+
while (i < words.length && (LAUNCHERS[words[i] ?? ""] === true || /^\w+=/.test(words[i] ?? "") || /(^|\/)main\.ts$/.test(words[i] ?? ""))) i++;
|
|
135
|
+
const cmd = bin(words[i]);
|
|
136
|
+
if ((cmd === "workspace" && bin(words[i - 1]) === "neurastream") || (cmd === "neurastream" && bin(words[i + 1]) === "workspace")) return true;
|
|
137
|
+
return (
|
|
138
|
+
cmd === "systemctl" &&
|
|
139
|
+
words.some(w => w === "--user") &&
|
|
140
|
+
words.some(w => w === "start" || w === "restart" || w === "enable") &&
|
|
141
|
+
words.some(w => bin(w) === "neurastream-workspace" || w.startsWith("neurastream-workspace."))
|
|
142
|
+
);
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// True when a command segment runs `claim release <plan> --force` (plan 20261027_1300 P4): it
|
|
147
|
+
// frees another Main's claim, the owner's terminal move, refused for every agent. Segment
|
|
148
|
+
// splitting and launcher skipping match startsOwnerUi, so `sh -c "neurastream claim release x
|
|
149
|
+
// --force"` and `sudo neurastream claim release x --force` are seen too.
|
|
150
|
+
function forceClaimRelease(input: Record<string, unknown>): boolean {
|
|
151
|
+
const text = Object.values(input).filter((v): v is string => typeof v === "string").join("\n");
|
|
152
|
+
return text.split(/&&|\|\||;|\||\n|\$\(|`/).some(seg => {
|
|
153
|
+
const words = seg.trim().split(/\s+/).filter(Boolean).map(w => w.replace(/^["'(]+|["')]+$/g, ""));
|
|
154
|
+
let i = 0;
|
|
155
|
+
while (i < words.length && (LAUNCHERS[words[i] ?? ""] === true || /^\w+=/.test(words[i] ?? "") || /(^|\/)main\.ts$/.test(words[i] ?? ""))) i++;
|
|
156
|
+
const seq = words.slice(i).map(bin);
|
|
157
|
+
if (seq[0] === "neurastream") seq.shift();
|
|
158
|
+
return seq[0] === "claim" && seq.includes("release") && seq.includes("--force");
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// True when a command segment lands work on a remote (plan 20261025_1940 P2): `git push`,
|
|
163
|
+
// `glab mr merge`, `gh pr merge`. Segment splitting and launcher skipping match startsOwnerUi,
|
|
164
|
+
// so `sh -c "git push"`, `sudo git push` and chained pushes are seen too.
|
|
165
|
+
function landingCommand(input: Record<string, unknown>): boolean {
|
|
166
|
+
const text = Object.values(input).filter((v): v is string => typeof v === "string").join("\n");
|
|
167
|
+
return text.split(/&&|\|\||;|\||\n|\$\(|`/).some(seg => {
|
|
168
|
+
const words = seg.trim().split(/\s+/).filter(Boolean).map(w => w.replace(/^["'(]+|["')]+$/g, ""));
|
|
169
|
+
let i = 0;
|
|
170
|
+
while (i < words.length && (LAUNCHERS[words[i] ?? ""] === true || /^\w+=/.test(words[i] ?? "") || /(^|\/)main\.ts$/.test(words[i] ?? ""))) i++;
|
|
171
|
+
const cmd = (words[i] ?? "").split("/").pop() ?? "";
|
|
172
|
+
if (cmd === "git" && words[i + 1] === "push") return true;
|
|
173
|
+
if (cmd === "glab" && words[i + 1] === "mr" && words[i + 2] === "merge") return true;
|
|
174
|
+
if (cmd === "gh" && words[i + 1] === "pr" && words[i + 2] === "merge") return true;
|
|
175
|
+
return false;
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
// P5/P5c (plan 20261031_1207): the shell text a read-only fast path may never carry — a landing
|
|
180
|
+
// command (push / MR merge), git add or commit, npm publish, a bypass_spawn launch, or a MUTATING
|
|
181
|
+
// write. Landing and commit commands produce no write targets, so this text filter — not
|
|
182
|
+
// writeTargets — is what keeps them out of the review lock's shell allow and the blocker skip.
|
|
183
|
+
// One predicate for both callers; reviewLockProblem denies it, subRules keeps the blockers on it.
|
|
184
|
+
// The removal check uses the commit alternative only: `git add` stages; the check judges at commit.
|
|
185
|
+
const GIT_ADD_OR_COMMIT = /\bgit\s+(add|commit)\b/;
|
|
186
|
+
function writesShellText(input: Record<string, unknown>, cfg: Config): boolean {
|
|
187
|
+
if (landingCommand(input)) return true;
|
|
188
|
+
const text = q.withoutQuotedRedirects(Object.values(input).filter((v): v is string => typeof v === "string").join("\n"));
|
|
189
|
+
if (GIT_ADD_OR_COMMIT.test(text) || /\bnpm\s+publish\b/.test(text)) return true;
|
|
190
|
+
if (cfg.guards.bypass_spawn.some(entry => bypassRegExp(entry).test(text))) return true;
|
|
191
|
+
return q.MUTATING.test(text);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// The read tool's stand-in for a value it hid. A file may hold one only where it is produced
|
|
195
|
+
// (secret-redact.ts) or exercised (its tests).
|
|
196
|
+
const PLACEHOLDER = "[REDACTED:";
|
|
197
|
+
const PLACEHOLDER_FILES = [/\/src\/core\/secret-redact\.ts$/, /\/tests\/secret-redact[^/]*\.test\.ts$/];
|
|
198
|
+
/** What a write/edit/ast_edit call would add: every text argument but the targets and the replaced text. */
|
|
199
|
+
function addedText(input: Record<string, unknown>): string {
|
|
200
|
+
const skip = new Set(["path", "file", "cwd", "old_string", "old", "oldText", "i"]);
|
|
201
|
+
return Object.entries(input)
|
|
202
|
+
.filter(([key, value]) => typeof value === "string" && !skip.has(key))
|
|
203
|
+
.map(([, value]) => value as string)
|
|
204
|
+
.join("\n");
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
// P5g: tools whose string fields are content — a task brief, the text a write or edit adds — are
|
|
208
|
+
// prose, never reads; the notify-secret check scans only their path argument.
|
|
209
|
+
const PROSE_TOOLS: Record<string, true> = { task: true, write: true, edit: true, ast_edit: true };
|
|
210
|
+
|
|
211
|
+
// Only a tool call's path arguments — the paths it names as targets, not its prose fields.
|
|
212
|
+
function pathArgs(input: Record<string, unknown>): Record<string, unknown> {
|
|
213
|
+
const out: Record<string, unknown> = {};
|
|
214
|
+
for (const key of ["path", "file"]) if (typeof input[key] === "string") out[key] = input[key];
|
|
215
|
+
return out;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
// Subagent half of a tool call (the original plan-guard checkCall without the main return).
|
|
219
|
+
// `cap` is the sub's hard call cap: its recorded per-spawn budget, else the global sub_max_calls.
|
|
220
|
+
function subRules(e: ToolEvent, input: Record<string, unknown>, paths: string[], writes: string[], cfg: Config, cap: number): string | null {
|
|
221
|
+
// P6 (plan 20261024_1915): a sub's `git commit` is scanned first — its staged diff must not add
|
|
222
|
+
// the removal comments diff-check flags. Detected through GIT_ADD_OR_COMMIT (the predicate
|
|
223
|
+
// writesShellText carries); the refusal goes back through checkTool's deny(). Git that cannot
|
|
224
|
+
// be read fails open (write-check.ts: a broken scan never blocks). Main is not gated: only
|
|
225
|
+
// subRules sees this. A staged diff has no subject yet, so the subject rule is the CLI's <rev>.
|
|
226
|
+
if (cfg.guards.shell_tools.includes(e.tool)) {
|
|
227
|
+
const git = GIT_ADD_OR_COMMIT.exec(q.withoutQuotedRedirects(Object.values(input).filter((v): v is string => typeof v === "string").join("\n")));
|
|
228
|
+
if (git?.[1] === "commit") {
|
|
229
|
+
let flags: RemovalFlag[] = [];
|
|
230
|
+
try {
|
|
231
|
+
flags = removalFlags(stagedDiff(e.cwd), "", cfg);
|
|
232
|
+
} catch { /* no readable repo in this cwd: nothing to flag */ }
|
|
233
|
+
if (flags.length)
|
|
234
|
+
return (
|
|
235
|
+
"git commit refused: the staged diff adds removal comments (reword or drop them, then re-stage):\n" +
|
|
236
|
+
flags.map(f => `${f.file}:${f.line}: ${f.text}`).join("\n")
|
|
237
|
+
);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Closing and cancelling are Main's decisions: a shell that runs the tool is refused; one that only names its path is not.
|
|
241
|
+
if (cfg.guards.shell_tools.includes(e.tool) && runsCloser(input))
|
|
242
|
+
return 'queue-close and queue-cancel are Main\'s; report in your plan\'s "## Progress" instead.';
|
|
243
|
+
// The read tool prints a placeholder for a value it hid, never the value (I-20261027-158,
|
|
244
|
+
// I-20261027-160: one copy silently broke the shipped config template). Writing that text back
|
|
245
|
+
// is refused; the file that produces one and the tests that exercise it are the exceptions.
|
|
246
|
+
if ((e.tool === "write" || e.tool === "edit" || e.tool === "ast_edit") && addedText(input).includes(PLACEHOLDER)) {
|
|
247
|
+
const keeper = writes.length > 0 && writes.every(p => PLACEHOLDER_FILES.some(rx => rx.test(p)));
|
|
248
|
+
if (!keeper)
|
|
249
|
+
return "this is the read tool's redaction placeholder, not the real value; re-read the file raw or keep the original line";
|
|
250
|
+
}
|
|
251
|
+
// planner mode P2 (b): while delegated, every sub write to a plan path is refused except the
|
|
252
|
+
// plan its brief named in the approved spawn's `Planner role for <plan path>` line (the
|
|
253
|
+
// planner-spawns binding). A NEW plan file is invisible to the indexed-plan gate below
|
|
254
|
+
// (isOrchestrationPath + planAt both false), so the refusal fires here — never by accident of
|
|
255
|
+
// indexing — and covers shell redirects through writeTargets too.
|
|
256
|
+
const delegatedPlanner = currentPlanner(cfg) === "delegated" ? plannerSpawnPlan(e.agentId, cfg.paths) : null;
|
|
257
|
+
// I-20261102-27: the seam above also refused the REVIEW spawn, and a review spawn's only write
|
|
258
|
+
// is its own PLAN REVIEW / CODE REVIEW line — so in delegated mode no plan could ever record a
|
|
259
|
+
// PASS and no implementer could spawn. The named review spawn of a plan may still write that
|
|
260
|
+
// plan; the REVIEW_LINE rule below then decides whether the line is its verdict.
|
|
261
|
+
const delegatedReview = currentPlanner(cfg) === "delegated" ? (matchReviewSpawn(readReviewSpawns(cfg.paths), e.agentId ?? "")?.spawn.plan ?? null) : null;
|
|
262
|
+
if (currentPlanner(cfg) === "delegated") {
|
|
263
|
+
for (const p of writes) {
|
|
264
|
+
if (!MAIN_PLAN_FILE.test(p) || p === delegatedPlanner) continue;
|
|
265
|
+
if (delegatedReview && path.resolve(e.cwd, p) === path.resolve(delegatedReview)) continue;
|
|
266
|
+
if (delegatedPlanner) return `planner is delegated — your Planner role names ${delegatedPlanner} only; ${p} is not yours to write.`;
|
|
267
|
+
return `planner is delegated — plan files are the planner agent's; your brief carries no "Planner role for <plan path>" line, so ${p} is refused.`;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
const plans = q.activePlans(cfg.paths);
|
|
271
|
+
if (e.calls >= cap) {
|
|
272
|
+
// Plan edit targets come from writeTargets (write and structured/hashline edit)
|
|
273
|
+
// with touchedPaths as fallback; plan reads match any read tool.
|
|
274
|
+
const planEdit =
|
|
275
|
+
(e.tool === "write" || e.tool === "edit") &&
|
|
276
|
+
(writes.length > 0 ? writes.every(p => q.planAt(p, plans)) : paths.length > 0 && paths.every(p => q.planAt(p, plans)));
|
|
277
|
+
const planRead = cfg.guards.read_tools.includes(e.tool) && paths.length > 0 && paths.every(p => q.planAt(p, plans));
|
|
278
|
+
if (!planEdit && !planRead)
|
|
279
|
+
return `call budget spent (${e.calls}/${cap}). Only reading and editing your plan's "## Progress" is allowed now: write what you did, what is verified, what is next, then end your run.`;
|
|
280
|
+
}
|
|
281
|
+
if (!plans.length || !paths.length) return null;
|
|
282
|
+
for (const p of writes) {
|
|
283
|
+
if (!q.isOrchestrationPath(p, plans, cfg.paths.queue_index)) continue;
|
|
284
|
+
if (!q.planAt(p, plans)) {
|
|
285
|
+
// planner mode P2 (b): the bound planner plan routes into checkPlanEdit (Planner header,
|
|
286
|
+
// Main-only lines), it is not Main's — but only that path, and only while delegated.
|
|
287
|
+
if (currentPlanner(cfg) === "delegated" && p === delegatedPlanner) continue;
|
|
288
|
+
return `${p} belongs to Main (main index / blocker script); read it, never change it. Report instead.`;
|
|
289
|
+
}
|
|
290
|
+
if (e.tool !== "write" && e.tool !== "edit")
|
|
291
|
+
return `${p} is a plan file: change its "## Progress" section only with the edit or write tool.`;
|
|
292
|
+
}
|
|
293
|
+
for (const plan of plans) {
|
|
294
|
+
const hit = paths.filter(p => !q.isOrchestrationPath(p, plans, cfg.paths.queue_index) && q.planCovers(plan, p, plans));
|
|
295
|
+
if (!hit.length) continue;
|
|
296
|
+
// An invalid plan stops code writes, not reads and not the repair of plan files: refusing those
|
|
297
|
+
// too left a planner unable to fix the very errors the guard named (writes are checked before
|
|
298
|
+
// the file is valid, so no valid text could ever land).
|
|
299
|
+
const readOnly = cfg.guards.read_tools.includes(e.tool) || (cfg.guards.shell_tools.includes(e.tool) && !writes.length && !writesShellText(input, cfg));
|
|
300
|
+
const planRepair = writes.length > 0 && writes.every(w => q.planAt(w, plans));
|
|
301
|
+
if (plan.errors.length && !readOnly && !planRepair) return `plan ${plan.file} is invalid (${plan.errors.join("; ")}). Stop and report to Main.`;
|
|
302
|
+
// P5c (plan 20261031_1207): reads and read-only shell calls skip the phase-0 blockers — a
|
|
303
|
+
// failing blocker used to deny every read of a covered path and send the worker back blind.
|
|
304
|
+
// The shell filter is the review lock's (writesShellText), so landing text keeps its blocker.
|
|
305
|
+
if (!readOnly && !planRepair) {
|
|
306
|
+
const why = runBlockers(plan, hit, e, cfg);
|
|
307
|
+
if (why) return why;
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return null;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
// Main's edit limit (20261025_1940 P2): the cap follows the autonomy tier — autonomy.strict_edit_limit
|
|
314
|
+
// in strict, guards.main_edit_limit in opinionated, none in full. Window starts at the first counted
|
|
315
|
+
// change, resets after main_window_min minutes and at every owner message. State lives in the queue
|
|
316
|
+
// state dir so one-shot CLI processes share the window (the original kept it in extension memory for
|
|
317
|
+
// one session).
|
|
318
|
+
function editWindow(e: ToolEvent, input: Record<string, unknown>, cfg: Config): Decision {
|
|
319
|
+
const files = changedProjectFiles(e.tool, input, e.cwd, cfg);
|
|
320
|
+
if (!files.length) return ALLOW;
|
|
321
|
+
const tier = currentTier(cfg);
|
|
322
|
+
if (tier === "full") return ALLOW; // no cap: Main works unattended
|
|
323
|
+
const limit = tier === "strict" ? cfg.autonomy.strict_edit_limit : cfg.guards.main_edit_limit;
|
|
324
|
+
const limitName = tier === "strict" ? "autonomy.strict_edit_limit" : "owner limit";
|
|
325
|
+
const now = Date.now();
|
|
326
|
+
return updateWindow(cfg.paths, (w) => {
|
|
327
|
+
if (w.used.length && now - w.windowStart >= cfg.guards.main_window_min * 60_000) w.used = [];
|
|
328
|
+
if (w.used.length >= limit) {
|
|
329
|
+
const mins = Math.ceil((w.windowStart + cfg.guards.main_window_min * 60_000 - now) / 60_000);
|
|
330
|
+
log(cfg.paths.guard_log, `BLOCK tool=${e.tool} after ${w.used.length} edits (tier ${tier}): ${files.join(",")} rule=main.edit-window`);
|
|
331
|
+
return {
|
|
332
|
+
write: false,
|
|
333
|
+
result: deny(
|
|
334
|
+
`main-guard: tier ${tier} — Main already changed project files ${w.used.length} times in this ${cfg.guards.main_window_min}-minute window ` +
|
|
335
|
+
`(${limitName} ${limit}; resets in ${mins} min). Main writes plans, not code: put the work in a plan ` +
|
|
336
|
+
`(listed in ${cfg.paths.queue_index}, phase-0 blockers first) and spawn an implementer. Changes so far: ${w.used.join(", ")}`,
|
|
337
|
+
"main.edit-window",
|
|
338
|
+
),
|
|
339
|
+
};
|
|
340
|
+
}
|
|
341
|
+
if (!w.used.length) w.windowStart = now;
|
|
342
|
+
w.used.push(`${e.tool}:${files[0]!}`);
|
|
343
|
+
const left = limit - w.used.length;
|
|
344
|
+
if (left <= 2) {
|
|
345
|
+
return {
|
|
346
|
+
write: true,
|
|
347
|
+
result: {
|
|
348
|
+
allow: true,
|
|
349
|
+
reason: "",
|
|
350
|
+
inject: `main-guard: tier ${tier} — ${left} project-file change(s) left in this ${cfg.guards.main_window_min}-minute window; then delegate.`,
|
|
351
|
+
},
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
return { write: true, result: ALLOW };
|
|
355
|
+
});
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
function mainTool(e: ToolEvent, input: Record<string, unknown>, cfg: Config, runs?: RunSource): Decision {
|
|
359
|
+
if (e.tool === "task") {
|
|
360
|
+
const why = taskLaunch(input, cfg, e.runningJobs, "main", runs);
|
|
361
|
+
return why ? deny(`main-guard: ${why}`, "main.task-launch") : ALLOW;
|
|
362
|
+
}
|
|
363
|
+
if (cfg.guards.shell_tools.includes(e.tool)) {
|
|
364
|
+
// Strict landing gate (20261025_1940 P2, P5): in tier strict every push/merge waits for the
|
|
365
|
+
// owner's approve phrase (autonomy.go_phrase, default "go push"); the landing that consumes
|
|
366
|
+
// it goes through. Opinionated and full keep today's allowance. Owner-only rules above are
|
|
367
|
+
// untouched.
|
|
368
|
+
if (landingCommand(input) && currentTier(cfg) === "strict" && !takeGo(cfg)) {
|
|
369
|
+
log(cfg.paths.guard_log, "BLOCK landing: tier strict, no approve phrase rule=main.push-merge");
|
|
370
|
+
return deny(`main-guard: tier strict — type "${cfg.autonomy.go_phrase}" to approve one push/merge`, "main.push-merge");
|
|
371
|
+
}
|
|
372
|
+
const command = String(input?.command ?? input?.code ?? "");
|
|
373
|
+
const why = bypassLaunch(command, cfg, "main", runs);
|
|
374
|
+
if (why) return deny(`main-guard: ${why}`, "main.bypass-launch");
|
|
375
|
+
}
|
|
376
|
+
return editWindow(e, input, cfg);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// Main's per-turn call cap (plan 20261028_1545 P2): the sub call-cap shape — warn at
|
|
380
|
+
// main_warn_calls, hard stop at main_max_calls — over calls counted in the window state file
|
|
381
|
+
// since the last real owner prompt or Main's terminal hand-back. The file, not the adapter's
|
|
382
|
+
// session memory, is the counter: one-shot CLI calls and a reloaded plugin must see the same
|
|
383
|
+
// count, and the reset points (checkInject here, the adapter's terminal agent_end) already write
|
|
384
|
+
// this file. Off in tier full (same gate as editWindow) and at main_max_calls 0.
|
|
385
|
+
|
|
386
|
+
/** The per-turn call cap applies to this call: on, not tier full, and the tool is not exempt. */
|
|
387
|
+
function mainCallApplies(e: ToolEvent, cfg: Config): boolean {
|
|
388
|
+
return cfg.guards.main_max_calls > 0 && currentTier(cfg) !== "full" && !cfg.guards.main_call_exempt_tools.includes(e.tool);
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
/** Refusal once this turn has spent main_max_calls, or null. */
|
|
392
|
+
function mainCallStop(e: ToolEvent, cfg: Config): string | null {
|
|
393
|
+
if (!mainCallApplies(e, cfg)) return null;
|
|
394
|
+
const w = readWindow(cfg.paths);
|
|
395
|
+
if (w.mainCalls >= cfg.guards.main_max_calls && !mainCallsExpired(w))
|
|
396
|
+
return `main-guard: call ${w.mainCalls}/${cfg.guards.main_max_calls} since the owner's last message or your last hand-back (guards.main_max_calls); the count starts over ${Math.ceil((MAIN_CALLS_RESET_SEC - (nowSec() - (w.mainCallsStart ?? 0))) / 60)} min from now. End your turn with the answer, or spawn an implementer.`;
|
|
397
|
+
return null;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Count one allowed, non-exempt call; returns the warn-band inject at main_warn_calls, "" below it. */
|
|
401
|
+
function mainCallWarn(e: ToolEvent, cfg: Config): string {
|
|
402
|
+
if (!mainCallApplies(e, cfg)) return "";
|
|
403
|
+
return updateWindow(cfg.paths, (w) => {
|
|
404
|
+
if (w.mainCalls === 0 || mainCallsExpired(w)) {
|
|
405
|
+
w.mainCalls = 0;
|
|
406
|
+
w.mainCallsStart = nowSec();
|
|
407
|
+
}
|
|
408
|
+
w.mainCalls += 1;
|
|
409
|
+
const warn =
|
|
410
|
+
w.mainCalls >= cfg.guards.main_warn_calls
|
|
411
|
+
? `main-guard: call ${w.mainCalls}/${cfg.guards.main_max_calls} this turn (guards.main_warn_calls). End your turn with the answer, or spawn an implementer.`
|
|
412
|
+
: "";
|
|
413
|
+
return { write: true, result: warn };
|
|
414
|
+
});
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* pre-tool: plan-guard checkCall for subs (protected files, budget, plan-edit rules, blockers)
|
|
419
|
+
* plus, for Main, the spawn gates and the project-file edit window.
|
|
420
|
+
*/
|
|
421
|
+
export function checkTool(e: ToolEvent, cfg: Config, runs?: RunSource): Decision {
|
|
422
|
+
return tuned(checkToolRules(e, cfg, runs), cfg);
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
function checkToolRules(e: ToolEvent, cfg: Config, runs?: RunSource): Decision {
|
|
426
|
+
const lock = e.agent === "sub" ? reviewLockProblem(e, cfg) : null;
|
|
427
|
+
if (lock) {
|
|
428
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} review lock: ${lock} rule=tool.review-lock`);
|
|
429
|
+
return deny(`plan-guard: ${lock}`, "tool.review-lock");
|
|
430
|
+
}
|
|
431
|
+
if (cfg.guards.skip_tools.includes(e.tool)) return ALLOW;
|
|
432
|
+
const input = e.input ?? {};
|
|
433
|
+
// Starting the owner page (plan 20261024_2230 P3c) is the owner's systemd move, never an
|
|
434
|
+
// agent's, unlocked or not: refused plan-guard style like a protected-file write.
|
|
435
|
+
if (cfg.guards.shell_tools.includes(e.tool) && startsOwnerUi(input)) {
|
|
436
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} ui-start: ${String(input.command ?? "")} rule=tool.ui-start`);
|
|
437
|
+
return deny(
|
|
438
|
+
"plan-guard: starting the owner page (neurastream workspace, or systemctl --user start/restart/enable of neurastream-workspace) is the owner's move, not an agent's.",
|
|
439
|
+
"tool.ui-start",
|
|
440
|
+
);
|
|
441
|
+
}
|
|
442
|
+
// claim release --force frees another Main's claim (plan 20261027_1300 P4): the owner's
|
|
443
|
+
// terminal move, refused for every agent like the ui-start, plan-guard style.
|
|
444
|
+
if (cfg.guards.shell_tools.includes(e.tool) && forceClaimRelease(input)) {
|
|
445
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} claim-force: ${String(input.command ?? "")} rule=tool.claim-force`);
|
|
446
|
+
return deny("plan-guard: claim release --force frees another Main's claim; that is the owner's move, in a terminal.", "tool.claim-force");
|
|
447
|
+
}
|
|
448
|
+
// The caller may know paths the text search cannot see (structured edits); union, never shrink.
|
|
449
|
+
const paths: string[] = [];
|
|
450
|
+
for (const p of [...(e.paths ?? []), ...q.touchedPaths(e.tool, input, e.cwd)]) if (!paths.includes(p)) paths.push(p);
|
|
451
|
+
const writes: string[] = [];
|
|
452
|
+
const relative: string[] = [];
|
|
453
|
+
for (const p of [...(e.writes ?? []), ...q.writeTargets(e.tool, input, e.cwd, cfg.paths, relative)]) if (!writes.includes(p)) writes.push(p);
|
|
454
|
+
// A relative plan path resolves against cwd to a file that does not exist, so the plan gate never
|
|
455
|
+
// sees the edit (plan 20261028_1600 P4j). A plan is named by its absolute path, for every agent.
|
|
456
|
+
const relPlan = PLAN_WRITE_TOOLS[e.tool] ? relative.find(isPlanName) : undefined;
|
|
457
|
+
if (relPlan) {
|
|
458
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} relative plan path: ${relPlan} rule=tool.relative-plan`);
|
|
459
|
+
return deny(`plan-guard: use the absolute plan path, not ${relPlan}. The plan gate cannot see a relative one.`, "tool.relative-plan");
|
|
460
|
+
}
|
|
461
|
+
// Notify secrets: no agent, main or sub, reads a webhook URL — with or without the unlock.
|
|
462
|
+
// A call that changes a secret is not a read: its target goes through the protected-write
|
|
463
|
+
// rule above, so the owner's unlock covers it like any guard file. P5g: the scan reads real
|
|
464
|
+
// read targets only — naming a secret-shaped glob in a task brief or in plan text is prose,
|
|
465
|
+
// not a read — so prose tools (task, write/edit) scan just their path argument, while every
|
|
466
|
+
// other tool keeps the whole-input scan (glob/grep patterns arrive through it).
|
|
467
|
+
const secretPaths: string[] = [];
|
|
468
|
+
for (const p of [...(e.paths ?? []), ...q.touchedPaths(e.tool, PROSE_TOOLS[e.tool] === true ? pathArgs(input) : input, e.cwd)])
|
|
469
|
+
if (!secretPaths.includes(p)) secretPaths.push(p);
|
|
470
|
+
const secretHit = notifySecretReadHit(secretPaths.filter(p => !writes.includes(p)), cfg);
|
|
471
|
+
if (secretHit) {
|
|
472
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} notify secret: ${secretHit} rule=tool.notify-secret`);
|
|
473
|
+
return deny(`plan-guard: ${secretHit} is a notify secret path. Only the owner touches the webhook files, in a terminal.`, "tool.notify-secret");
|
|
474
|
+
}
|
|
475
|
+
// Main writes its own rollover note unattended (the note turn has nobody to ask). Only a Write
|
|
476
|
+
// of a .md directly in <state>/rollover/ is exempt; shell writes, subagents and relaunch.json stay refused.
|
|
477
|
+
const rolloverDir = path.join(mainStateDir(cfg), "rollover");
|
|
478
|
+
const openWrites =
|
|
479
|
+
e.agent === "main" && e.tool === "write"
|
|
480
|
+
? writes.filter(p => !(path.extname(p) === ".md" && path.dirname(path.resolve(p)) === rolloverDir))
|
|
481
|
+
: writes;
|
|
482
|
+
const hit = protectedHit(openWrites, cfg);
|
|
483
|
+
if (hit && unlockUntilMs(cfg) === null) {
|
|
484
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} protected: ${hit} rule=tool.protected`);
|
|
485
|
+
// The plan index (plan 20261031_0911 P2) is guard surface like the rest, but unlike the
|
|
486
|
+
// others an agent has a sanctioned way to change it: the queue add/move CLI through
|
|
487
|
+
// writeIndex. Name it, so the refusal says what to do instead of naming the unlock.
|
|
488
|
+
const viaQueue = hit === cfg.paths.queue_index ? ` Plans enter the index or move within it through \`neurastream queue add\` / \`neurastream queue move\`.` : "";
|
|
489
|
+
return deny(
|
|
490
|
+
`plan-guard: ${hit} is a protected guard file. Only the owner changes it (unlock: \`touch ${cfg.paths.unlock}\` in a terminal${
|
|
491
|
+
cfg.guards.chat_unlock ? `, or type \`unlock ${cfg.guards.unlock_minutes}\` in chat` : ""
|
|
492
|
+
}, valid ${cfg.guards.unlock_minutes} min).${viaQueue}`,
|
|
493
|
+
"tool.protected",
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
if (e.agent === "main") {
|
|
497
|
+
// The plan-text checks (checkPlanEdit) see only edit/write results; a shell redirect,
|
|
498
|
+
// sed -i or heredoc into a plan would skip them, so plans change through edit/write only.
|
|
499
|
+
const shellPlan = e.tool !== "write" && e.tool !== "edit" ? writes.find(p => MAIN_PLAN_FILE.test(p)) : undefined;
|
|
500
|
+
if (shellPlan) {
|
|
501
|
+
log(cfg.paths.plan_guard_log, `BLOCK main tool=${e.tool} shell write to plan ${shellPlan} rule=tool.shell-plan`);
|
|
502
|
+
return deny(`plan-guard: ${shellPlan} is a plan file: change it with the edit or write tool (close or cancel it with queue-close / queue-cancel).`, "tool.shell-plan");
|
|
503
|
+
}
|
|
504
|
+
const stop = mainCallStop(e, cfg);
|
|
505
|
+
if (stop) {
|
|
506
|
+
log(cfg.paths.guard_log, `BLOCK tool=${e.tool} after ${readWindow(cfg.paths).mainCalls} calls this turn rule=main.call-budget`);
|
|
507
|
+
return deny(stop, "main.call-budget");
|
|
508
|
+
}
|
|
509
|
+
const d = mainTool(e, input, cfg, runs);
|
|
510
|
+
if (!d.allow) return d;
|
|
511
|
+
const warn = mainCallWarn(e, cfg);
|
|
512
|
+
// A task brief names paths it does not read; only the other tools' paths count as reads.
|
|
513
|
+
if (e.tool !== "task") recordMainReads(paths.filter(p => !writes.includes(p)), cfg.paths);
|
|
514
|
+
return warn ? { ...d, inject: d.inject ? `${d.inject}\n${warn}` : warn } : d;
|
|
515
|
+
}
|
|
516
|
+
const cap = subCallCap(e.agentId, cfg);
|
|
517
|
+
const why = subRules(e, input, paths, writes, cfg, cap);
|
|
518
|
+
if (why) {
|
|
519
|
+
log(cfg.paths.plan_guard_log, `BLOCK sub:${e.agentId} tool=${e.tool} ${why} rule=sub.rule`);
|
|
520
|
+
return deny(`plan-guard: ${why}`, "sub.rule");
|
|
521
|
+
}
|
|
522
|
+
// A sub's own launch passes the same spawn gates as Main's (plan 20261028_1600 P4i).
|
|
523
|
+
let launch: string | null = null;
|
|
524
|
+
if (e.tool === "task") launch = taskLaunch(input, cfg, e.runningJobs, "sub", runs);
|
|
525
|
+
else if (cfg.guards.shell_tools.includes(e.tool)) launch = bypassLaunch(String(input?.command ?? input?.code ?? ""), cfg, "sub", runs);
|
|
526
|
+
if (launch) {
|
|
527
|
+
log(cfg.paths.plan_guard_log, `BLOCK ${e.agent}:${e.agentId} tool=${e.tool} ${launch} rule=sub.launch`);
|
|
528
|
+
return deny(`plan-guard: ${launch}`, "sub.launch");
|
|
529
|
+
}
|
|
530
|
+
const n = e.calls + 1;
|
|
531
|
+
// The warn band has the global width (sub_max_calls - sub_warn_calls) ending at the cap;
|
|
532
|
+
// unbudgeted subs keep sub_warn_calls exactly.
|
|
533
|
+
const warn = cap === cfg.guards.sub_max_calls ? cfg.guards.sub_warn_calls : Math.max(1, cap - (cfg.guards.sub_max_calls - cfg.guards.sub_warn_calls));
|
|
534
|
+
if (n >= warn && n < cap)
|
|
535
|
+
return {
|
|
536
|
+
allow: true,
|
|
537
|
+
reason: "",
|
|
538
|
+
inject: `plan-guard: call ${n}/${cap}. Update your plan's "## Progress" now (done, verified, next); at ${cap} only that edit is allowed.`,
|
|
539
|
+
};
|
|
540
|
+
return ALLOW;
|
|
541
|
+
}
|