neurastream 0.2.25 → 0.2.26

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 CHANGED
@@ -26,12 +26,12 @@ flowchart LR
26
26
  | Queue (`queue-check`, `queue-close`, `queue-cancel`) | Every open plan is a file in a main checkout, listed in the one main index (`paths.queue_index`, one absolute path per line — never repo directories) and follows a template; one plan = one worktree. A plan leaves the queue only when its branch is merged into remote main and its done check passes; a failing check reopens it. Closing removes the plan's worktree when it is clean and its branch landed — a plain `git worktree remove`; a dirty, unmerged or unremovable worktree and the repo's main checkout are kept with the reason. Branches leave only via `git branch -d`, so a branch whose merge git cannot see stays. |
27
27
  | Blockers | Each plan's phase 0 lists what helpers may not do: push, touch a path, run a command, or write a text. The guard judges the command that runs and the files it changes, not words inside commit messages, quoted text or heredoc bodies: `git commit -m "... push ..."` is allowed, `git push` is refused. |
28
28
  | Guards | Helpers may only edit their plan's `## Progress`; every new entry ends with a `Findings:` line (`Findings: none`, or one item per finding with `file:line` evidence) or the edit is refused and the file restored, and each item becomes an incident. Helpers get a warning at call 90 and are stopped at call 100; Main can set a different stop for one run with a `Call budget: <N>` line in the task brief (see "Main reads the code for its plans" below). Protected files need an owner unlock (a file the owner touches, valid 30 minutes). With `guards.chat_unlock` on (default off), the owner's whole chat message `unlock` / `unlock N` / `lock` — typed in the terminal or through a collab guest prompt from a write peer — moves that file instead; nothing a model, a subagent or a tool produces can. |
29
- | Ledger (`agent-ledger`) | Tokens, cost, state and exit reason per agent; `--cap` refuses a spawn when a provider already runs 2. |
29
+ | Ledger (`agent-ledger`) | Tokens, cost, state and exit reason per agent; `--cap` refuses a spawn when a provider already runs `ledger.max_running_per_provider` (default 2), when a run is `OVER-BUDGET` (unless `--incident <id>`), or when a priority plan has no running agent (unless `--priority`). |
30
30
  | Scoring (`agent-score`) | Points only for work Main accepted by commit, times the phase difficulty. Ranked per dollar and per hour. |
31
31
  | Brief lint (`brief-lint`) | Refuses a helper brief that misses a required rule (acceptance, stop condition, no push, call budget). |
32
32
  | Machine health (`machine-guard`, `main-start`, `heavy-run`) | Load, free memory, disk and `/tmp` limits; one heavy test run at a time. |
33
33
  | Unlanded work (`wip-check`, `wip-snapshot`, `wip-backup`) | Lists branches on no remote and dirty worktrees; snapshots them as hidden commits; can push them to a backup repo. |
34
- | Session rollover | When the main session file passes 5 MB, the next owner message starts a fresh session from a handoff note. |
34
+ | Session rollover | When the main session file passes 5 MB, or the installed neurastream version differs from the running plugin, Main writes a handoff note; under `neurastream main` a fresh session starts on its own, under plain omp the next owner message starts it. |
35
35
  | Owner page (`neurastream ui`) | One phone-sized page over Tailscale (`ui.*` config): the plans waiting on the owner with answer buttons, the guard unlock, running agents, the queue, recent merges/CI, open incidents, agent scores, machine health. Serves only a tailnet peer whose `tailscale whois` login equals `ui.owner_login`, only with a Host header naming the tailnet address or the MagicDNS name — DNS rebinding and every other visitor get a 403. Answers land in the owner inbox and reach Main once each; agents cannot start the page or write the inbox. |
36
36
 
37
37
  ## Requirements
@@ -205,7 +205,7 @@ notify: posted (rate-limit)
205
205
  RATE-LIMIT resume: new turn sent (waited until 08:12)
206
206
  ```
207
207
 
208
- The wait is the `retry-after-ms=<ms>` or `retry-after: <seconds>` the error text names (omp appends the provider's header to the error message), else `default_wait_s` (300). A turn the resume started that ends on a limit again is the same episode at attempt 2: the wait doubles, no second post. Any turn that ends without a limit ends the episode and disarms the timer. Every wait is clamped to `max_wait_s` (3600) before `slack_s` (15) is added on top. Your own message takes over and cancels the resume (`RATE-LIMIT resume cancelled: owner message`) when it starts a turn; a slash command or a handled input such as a chat unlock leaves the resume armed. A rate-limited deferred hand-back (an `agent_end` while an async job is pending) arms the same timer instead of logging "no reply text". The words and the waits live in `config.yml` (`guards.rate_limit`, `docs/config.md`); turns that did not end on a rate limit are unaffected.
208
+ The wait is the `retry-after-ms=<ms>` or `retry-after: <seconds>` the error text names (omp appends the provider's header to the error message), else `default_wait_s` (300). A turn the resume started that ends on a limit again is the same episode at attempt 2: named retry-after values remain unchanged; only the default wait doubles, no second post. Any turn that ends without a limit ends the episode and disarms the timer. Every wait is clamped to `max_wait_s` (3600) before `slack_s` (15) is added on top. Your own message takes over and cancels the resume (`RATE-LIMIT resume cancelled: owner message`) when it starts a turn; a slash command or a handled input such as a chat unlock leaves the resume armed. A rate-limited deferred hand-back (an `agent_end` while an async job is pending) arms the same timer instead of logging "no reply text". The words and the waits live in `config.yml` (`guards.rate_limit`, `docs/config.md`); turns that did not end on a rate limit are unaffected.
209
209
 
210
210
  omp retries a 429 itself while the provider's wait fits its `retry.maxDelayMs` (300000 ms by default); only a longer wait ends the turn (`Retry failed after 1 attempts: Provider requested 731000ms wait, exceeds retry.maxDelayMs`), and that turn end is what neurastream waits out.
211
211
 
@@ -213,6 +213,10 @@ omp retries a 429 itself while the provider's wait fits its `retry.maxDelayMs` (
213
213
 
214
214
  Before Main reads a message, reset timestamps matching `quota.reset_pattern` are annotated with their local time, for example `reset at 2026-10-25 18:56:22 (= 2026-10-25 11:56:22 CET local)`. Set `quota.reset_tz` to the provider's time zone; an explicit zone or UTC offset in the message takes precedence.
215
215
 
216
+ ## Suspicious actions (`neurastream traces actions`)
217
+
218
+ `neurastream traces actions <runId|--since 24h> [--json]` lists the suspicious tool actions a run's trace shows: reads of secret paths (`traces.actions.secret_globs`), network commands (`net_tools`) to unknown hosts, pipes into a shell (`shell_patterns`), and writes outside `write_roots` (empty = `paths.work_roots`; both empty = off) or on `deny_globs`. The high ones also open realtime suspicious-action incidents.
219
+
216
220
  ## Trace claims (`neurastream traces claims`)
217
221
 
218
222
  Agents' final reports assert results — "530 passed", "exit 0", commit SHAs, heavy-run labels, changed files. This command reads a run's trace (its session file, read-only) and checks each claim in the run's last assistant message against what the run's own tool activity shows: a count or exit code must appear in some tool output, a commit SHA must be printed by the output of a git command the run itself ran, a heavy-run label must appear in a quoted heavy-run call, and a changed path must be carried by an edit/write call or a shell write in the path's own command segment. A claim nothing shows becomes a `claim-unbacked` finding.
@@ -323,7 +327,7 @@ Live copies are never hand-edited. `neurastream doctor` names each hand-edited i
323
327
  - Managed: the text between the markers. Install replaces it. A second install changes nothing.
324
328
  - Yours: every line outside the markers. Install keeps it byte for byte. A file with no markers gets the block appended.
325
329
  - Drift: `neurastream doctor` reports `stale:` when the text between the markers differs from the package's block, and `missing:` when the markers are absent. Edits outside the markers are never reported.
326
- - Edit limit: the project-file changes Main gets per window come from `guards.main_edit_limit` and `guards.main_window_min`, not from the block text.
330
+ - Edit limit: the project-file changes Main gets per window come from the config, not from the block text: `guards.main_edit_limit` per `guards.main_window_min` in tier `opinionated`, `autonomy.strict_edit_limit` in tier `strict`, no cap in tier `full`.
327
331
 
328
332
  ## License
329
333
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurastream",
3
- "version": "0.2.25",
3
+ "version": "0.2.26",
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",
@@ -463,10 +463,11 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
463
463
  // mid-work report, never a hand-back.
464
464
  let stopBlocked = false;
465
465
  // Rate-limit wait-it-out (plan 20261025_0640): consecutive turn ends on a provider rate limit
466
- // form one episode. The attempt doubles the wait, the owner chat is told once per episode, and
467
- // ONE timer gives Main a new turn when the wait is over; a new Main turn before expiry takes
468
- // over and cancels it. Inputs that do not start a turn leave it armed. Any turn that ends
469
- // without a limit resets the episode and disarms it.
466
+ // form one episode. Named provider retry-after values remain authoritative; otherwise the
467
+ // attempt doubles the default wait. The owner chat is told once per episode, and ONE timer
468
+ // gives Main a new turn when the wait is over; a new Main turn before expiry takes over and
469
+ // cancels it. Inputs that do not start a turn leave it armed. Any turn that ends without a
470
+ // limit resets the episode and disarms it.
470
471
  let rateAttempt = 0;
471
472
  let rateTimer: NodeJS.Timeout | null = null;
472
473
  const rateClock = (ms: number): string => strftime(ms / 1000, "%H:%M");
@@ -24,20 +24,19 @@ export interface RateLimitWait {
24
24
  const RETRY_AFTER_MS = /retry-after-ms[=:]\s*(\d+)/i;
25
25
  const RETRY_AFTER_S = /retry-after[=:]\s*(\d+)/i;
26
26
 
27
- function retryAfterMs(errorText: string, cfg: RateLimitConfig): number {
27
+ function retryAfterMs(errorText: string, cfg: RateLimitConfig): { ms: number; named: boolean } {
28
28
  const ms = RETRY_AFTER_MS.exec(errorText);
29
- if (ms) return Number(ms[1]);
29
+ if (ms) return { ms: Number(ms[1]), named: true };
30
30
  const s = RETRY_AFTER_S.exec(errorText);
31
- if (s) return Number(s[1]) * 1000;
32
- return cfg.default_wait_s * 1000;
31
+ if (s) return { ms: Number(s[1]) * 1000, named: true };
32
+ return { ms: cfg.default_wait_s * 1000, named: false };
33
33
  }
34
34
 
35
35
  /**
36
36
  * The wait for a turn that ended on a provider rate limit, or null when it did not: the stop
37
37
  * reason must be "error" and the error text must contain one of the configured patterns
38
- * (case-insensitive). The wait is the retry-after the text names (`retry-after-ms=<ms>` or
39
- * `retry-after: <seconds>`, else default_wait_s); attempt >= 2 doubles the previous wait of the
40
- * episode; every wait is clamped to max_wait_s, then slack_s is added.
38
+ * (case-insensitive). A named retry-after is used as-is; otherwise default_wait_s is doubled
39
+ * for each later attempt. The resulting wait is clamped to max_wait_s, then slack_s is added.
41
40
  */
42
41
  export function rateLimitWait(
43
42
  stopReason: string | null,
@@ -50,12 +49,15 @@ export function rateLimitWait(
50
49
  const text = errorText.toLowerCase();
51
50
  if (!cfg.patterns.some(p => text.includes(p.toLowerCase()))) return null;
52
51
  const capMs = cfg.max_wait_s * 1000;
53
- let baseMs = retryAfterMs(errorText, cfg);
54
- for (let i = 1; i < Math.max(1, attempt); i++) {
55
- baseMs *= 2;
56
- if (baseMs >= capMs) {
57
- baseMs = capMs;
58
- break;
52
+ const retryAfter = retryAfterMs(errorText, cfg);
53
+ let baseMs = retryAfter.ms;
54
+ if (!retryAfter.named) {
55
+ for (let i = 1; i < Math.max(1, attempt); i++) {
56
+ baseMs *= 2;
57
+ if (baseMs >= capMs) {
58
+ baseMs = capMs;
59
+ break;
60
+ }
59
61
  }
60
62
  }
61
63
  const waitMs = Math.min(baseMs, capMs) + cfg.slack_s * 1000;