neurastream 0.2.54 → 0.2.55

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.54",
3
+ "version": "0.2.55",
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",
@@ -26,7 +26,7 @@ import { configFile, loadConfig, reloadingConfig, type Config } from "../../core
26
26
  import { checkWrite, deferSteer, type WriteCheckConfig } from "../../core/write-check.ts";
27
27
  import { nowSec, strftime } from "../../core/clock.ts";
28
28
  import { runDetectors, runDetectorsGated, type DetectorInput } from "../../core/incident-detectors.ts";
29
- import { checkInject, checkPlanEdit, checkStop, checkTool, findingsValue, MAIN_PLAN_FILE, newProgressEntries, planReadNote, recordMainResult, resetMainCalls, revertMainEdit, rekeySpawnFile, reviewSpawnEnd } from "../../core/guards.ts";
29
+ import { checkInject, checkPlanEdit, checkStop, checkTool, findingsValue, MAIN_PLAN_FILE, newProgressEntries, planReadNote, recordMainResult, resetMainCalls, revertMainEdit, rekeySpawnFile, reviewSpawnEnd, STOP_PLAN_OFFER_REFUSAL } from "../../core/guards.ts";
30
30
  import { rateLimitWait } from "../../core/rate-limit.ts";
31
31
  import { notifyProviders, postReply } from "../../core/notify.ts";
32
32
  import { loadKnownSecrets, redactSecrets, redactSummary } from "../../core/secret-redact.ts";
@@ -1320,6 +1320,12 @@ export function createOmpAdapter(pi: ExtensionHost, initial: Config, freshConfig
1320
1320
  }
1321
1321
  // A real hand-back: the turn ended without a rate limit — the episode is over.
1322
1322
  disarmRateEpisode();
1323
+ // A deferred hand-back fires no session_stop: reset the per-turn cap here (I-20261030-24)
1324
+ // and steer a promise like checkStop refuses it (I-20261030-32).
1325
+ resetMainCalls();
1326
+ if (new RegExp(cfg.guards.plan_offer, "i").test(reply.text)) {
1327
+ pi.sendUserMessage(STOP_PLAN_OFFER_REFUSAL);
1328
+ }
1323
1329
  notifyHandback(reply, "agent_end hand-back");
1324
1330
  });
1325
1331
  // Turn end: page answers that arrived during the turn go out (P3b), then open plans that now
@@ -1354,8 +1360,8 @@ export function createOmpAdapter(pi: ExtensionHost, initial: Config, freshConfig
1354
1360
  });
1355
1361
 
1356
1362
  // Terminal hand-back (plan 20261028_1545 P2): a willContinue agent_end keeps the turn going
1357
- // (blocked stop, todo/plan-mode continuation, deferred hand-back), so only its absence ends
1358
- // the turn — the per-turn call budget resets for the next one.
1363
+ // (blocked stop, todo/plan-mode continuation, deferred hand-back); only its absence ends the
1364
+ // turn — the budget resets here and on the deferred hand-back above (I-20261030-24).
1359
1365
  pi.on("agent_end", (e, ctx) => {
1360
1366
  if (!isMain(ctx)) return;
1361
1367
  if (asRecord(e).willContinue === true) return;
@@ -1826,6 +1826,8 @@ export function liveSubagents(ledgerOut: string): string[] {
1826
1826
  .map(l => l.split(/\s+/)[0] ?? "");
1827
1827
  }
1828
1828
 
1829
+ export const STOP_PLAN_OFFER_REFUSAL = "main-guard: don't promise it — do it now, or write the plan and index it";
1830
+
1829
1831
  /**
1830
1832
  * stop: Main may not stop while an open plan is not parked "WAITING on owner" (or the queue has a
1831
1833
  * problem) and no subagent is alive to wake it; an open incident (no plan, no dismissal) blocks
@@ -1838,8 +1840,8 @@ export function checkStop(e: StopEvent, cfg: Config): Decision {
1838
1840
  // 20261028_0900 P2: a reply that offers to plan instead of planning is refused for the offer
1839
1841
  // itself; the two-empty-stops valves below never release this block.
1840
1842
  if (e.reply && new RegExp(cfg.guards.plan_offer, "i").test(e.reply)) {
1841
- log(cfg.paths.guard_log, "BLOCK stop: reply offers to plan instead of planning it");
1842
- return { allow: false, reason: "main-guard: don't offer it — write the plan and index it", state };
1843
+ log(cfg.paths.guard_log, "BLOCK stop: reply offers or promises instead of doing it");
1844
+ return { allow: false, reason: STOP_PLAN_OFFER_REFUSAL, state };
1843
1845
  }
1844
1846
  let open: string[];
1845
1847
  try {
@@ -125,7 +125,7 @@ guards:
125
125
  chat_unlock: false # the owner's whole chat message "unlock"/"unlock N"/"lock" moves the guard unlock file
126
126
  plan_read_max_hours: 24
127
127
  idle_stops: 3
128
- plan_offer: 'want me to (write|make) a plan|should i plan|shall i plan|if you want, i(''ll)? plan|plan it or' # a Main stop reply matching this (case-insensitive) is refused: don't offer it — write the plan and index it
128
+ plan_offer: 'want me to (write|make) a plan|should i plan|shall i plan|if you want, i(''ll)? plan|plan it or|\bi will\b|\bi(''|’)ll\b' # refused: don't promise or offer it — do it now, or write the plan and index it
129
129
  rate_limit:
130
130
  patterns: ["429", "rate_limit", "rate limit", "overloaded", "529"] # error-text substrings (case-insensitive) that mark a provider rate limit
131
131
  default_wait_s: 300 # wait when the error text names no retry-after