neurastream 0.2.68 → 0.2.69

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurastream",
3
- "version": "0.2.68",
3
+ "version": "0.2.69",
4
4
  "description": "Guardrails for running many AI coding agents at once: plan queue, blockers, call budgets, provider caps, scoring, merge-verified close.",
5
5
  "keywords": [
6
6
  "ai-agents",
@@ -1302,9 +1302,15 @@ function subRules(e: ToolEvent, input: Record<string, unknown>, paths: string[],
1302
1302
  // (isOrchestrationPath + planAt both false), so the refusal fires here — never by accident of
1303
1303
  // indexing — and covers shell redirects through writeTargets too.
1304
1304
  const delegatedPlanner = currentPlanner(cfg) === "delegated" ? plannerSpawnPlan(e.agentId) : null;
1305
+ // I-20261102-27: the seam above also refused the REVIEW spawn, and a review spawn's only write
1306
+ // is its own PLAN REVIEW / CODE REVIEW line — so in delegated mode no plan could ever record a
1307
+ // PASS and no implementer could spawn. The named review spawn of a plan may still write that
1308
+ // plan; the REVIEW_LINE rule below then decides whether the line is its verdict.
1309
+ const delegatedReview = currentPlanner(cfg) === "delegated" ? (matchReviewSpawn(readReviewSpawns(), e.agentId ?? "")?.spawn.plan ?? null) : null;
1305
1310
  if (currentPlanner(cfg) === "delegated") {
1306
1311
  for (const p of writes) {
1307
1312
  if (!MAIN_PLAN_FILE.test(p) || p === delegatedPlanner) continue;
1313
+ if (delegatedReview && path.resolve(e.cwd, p) === path.resolve(delegatedReview)) continue;
1308
1314
  if (delegatedPlanner) return `planner is delegated — your Planner role names ${delegatedPlanner} only; ${p} is not yours to write.`;
1309
1315
  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.`;
1310
1316
  }
@@ -1971,8 +1977,11 @@ export function checkPlanEdit(e: PlanEditEvent, cfg: Config): PlanEditDecision {
1971
1977
  };
1972
1978
  }
1973
1979
  const name = e.agentId ?? "";
1980
+ // The header records the agent the owner picked, not the spawn instance: a `glm-3` spawn
1981
+ // satisfies `Planner: glm`, and the spawn form still works for plans written before this.
1982
+ const names = new Set([name, name.replace(/-\d+$/, "")]);
1974
1983
  const head = e.after.split(/^## /m)[0] ?? "";
1975
- if (!head.split("\n").some((l) => l.trim() === `Planner: ${name}`)) {
1984
+ if (!head.split("\n").some((l) => l.trim().startsWith("Planner: ") && names.has(l.trim().slice("Planner: ".length).trim()))) {
1976
1985
  log(cfg.paths.plan_guard_log, `RESTORE ${e.path} (no Planner header)`);
1977
1986
  return {
1978
1987
  allow: false,
@@ -2064,12 +2073,17 @@ function codeReviewProblem(file: string, after: string, ids: string[]): string |
2064
2073
  return null;
2065
2074
  }
2066
2075
 
2067
- /** The plan text a planner agent owns: everything outside "## Progress" and the Main-only lines (planner mode P2a, plan 20261102_1515). */
2068
- function plannerBody(text: string): string {
2069
- return q
2070
- .outsideProgress(text)
2071
- .split("\n")
2072
- .filter((l) => !MAIN_ONLY_LINE.test(l))
2076
+ /** The plan text a planner agent owns: everything outside "## Progress" and the Main-only lines (planner mode P2a, plan 20261102_1515) — minus the two zones Main may still correct (punch list, plan 20261102_2315): a "## Done check" section's body, and the backticked `verify:` span on a "## Phases" checkbox line. */
2077
+ export function plannerBody(text: string): string {
2078
+ const body = q.outsideProgress(text).split("\n");
2079
+ let section = "";
2080
+ return body
2081
+ .map((l) => {
2082
+ if (l.startsWith("## ")) section = l;
2083
+ if (/^## +Done check\b/i.test(section)) return "";
2084
+ if (/^## +Phases\b/i.test(section) && /^- \[[ x]\]/.test(l)) l = l.replace(/`verify:[^`]*`/g, "`verify:`");
2085
+ return MAIN_ONLY_LINE.test(l) ? "" : l;
2086
+ })
2073
2087
  .join("\n");
2074
2088
  }
2075
2089
 
@@ -10,6 +10,8 @@ You are Main, the orchestrator. Main plans, delegates, reviews and lands; implem
10
10
  - A hold is one line: `WAITING on owner: <what to do> — blocked: <what stays stuck until then> — why you: <why Main cannot do it>`. The phone page shows those three parts; a missing part is left out.
11
11
  - Entering a repo: read its AGENTS.md first.
12
12
  - Main writes every plan in `<repo>/docs/plans/`, shaped like `{{AGENT_DIR}}/queue/TEMPLATE.md`. Do the research yourself; never base a plan on another agent's findings. In `planner delegated` mode the planner agent writes the plan instead (`Planner: <agent>` header; the research and the `## Code read by Main` list are the planner's): Main routes the owner's asks to it, dispatches implementers, checks the outcomes (verify commands, CI, the reviewer's PASS) and lands, and Main does not read repo code to plan. The owner's whole message `planner main` returns this rule; `autonomy.planner` (default `main`) is the same switch in the config.
13
+ - Planner choice is Main's: a small mechanical plan (a tick, a done-check or verify fix, one doc line) goes to `glm`, or `haiku` when the fast planner is unavailable; anything else goes to `opus-planner` (always thinking medium). The plan's `Planner: <agent>` header is the record; no tier code.
14
+ - In delegated mode Main may correct only a plan's `## Done check` command and a phase line's `verify:` command; every other plan line belongs to the planner.
13
15
  - Phase 0 of every plan: blocker scripts that stop the implementer from going against the plan. They must exist before any spawn.
14
16
  - Every plan has `## Reuse`; no spawn without a current reviewer PASS (`templates/plan-review-brief.md`, recorded only from the reviewer's own Progress edit); a brief names every open MR of its plan with an `MR !N:` line.
15
17
  - Plan order: plan → page built from the architecture-drilldown template (`neurastream pages publish <page.html> --plan <plan.md>` refuses anything else) → owner approves (Approve on the page, or types `approve <YYYYMMDD_HHMM>`) → reviewer PASS → implementer. Once `approval.since` is set, a plan stamped at or after it gets no spawn without a page and an approval record for its current text; a body edit voids the approval, a Progress-only edit keeps it.