neurastream 0.2.28 → 0.2.29

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
@@ -111,7 +111,7 @@ A plan parked for the owner has one line: `WAITING on owner: <what>`. That line
111
111
 
112
112
  ## Autonomy tiers
113
113
 
114
- One setting decides how much Main does without asking: `autonomy.tier` in the config (default `opinionated`), moved any time by the owner's whole chat message `tier strict|opinionated|full` (when `guards.chat_unlock` is on) or the tier buttons on the phone page — the setting lives in `<queue_state>/autonomy-tier`, a guard-protected path no agent can write. `strict` caps Main's project-file changes at `autonomy.strict_edit_limit` per `guards.main_window_min` minutes and refuses `git push` / `glab mr merge` / `gh pr merge` until the owner types `go` (one landing, valid `autonomy.go_minutes` minutes); `opinionated` keeps today's limits (`guards.main_edit_limit`); `full` drops the cap and lets Main skip an idle higher plan with `Priority skip: <plan> — Main: "<reason>"` (reason ≥ 4 words). No tier loosens the owner-only moves: guard-file edits without the unlock, starting the phone page, reading notify secrets, local `npm publish` and the tier setting itself.
114
+ One setting decides how much Main does without asking: `autonomy.tier` in the config (default `opinionated`), moved any time by the owner's whole chat message `tier strict|opinionated|full` (when `guards.chat_unlock` is on) or the tier buttons on the phone page — the setting lives in `<queue_state>/autonomy-tier`, a guard-protected path no agent can write. `strict` caps Main's project-file changes at `autonomy.strict_edit_limit` per `guards.main_window_min` minutes and refuses `git push` / `glab mr merge` / `gh pr merge` until the owner types the approve phrase from `autonomy.go_phrase` (default `go push`; a bare `go` is an ordinary message — one landing, valid `autonomy.go_minutes` minutes); `opinionated` keeps today's limits (`guards.main_edit_limit`); `full` drops the cap and lets Main skip an idle higher plan with `Priority skip: <plan> — Main: "<reason>"` (reason ≥ 4 words). No tier loosens the owner-only moves: guard-file edits without the unlock, starting the phone page, reading notify secrets, local `npm publish` and the tier setting itself.
115
115
 
116
116
  ## Owner page (`neurastream ui`)
117
117
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "neurastream",
3
- "version": "0.2.28",
3
+ "version": "0.2.29",
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",
@@ -1151,8 +1151,9 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
1151
1151
  };
1152
1152
 
1153
1153
  // Chat unlock + autonomy tiers (guards.chat_unlock): the owner's whole message "unlock"/
1154
- // "unlock N"/"lock" moves the guard unlock file, "tier <name>" sets the autonomy tier and
1155
- // "go" approves one strict landing (src/core/queue/lib.ts chatUnlock, src/core/autonomy.ts
1154
+ // "unlock N"/"lock" moves the guard unlock file, "tier <name>" sets the autonomy tier and the
1155
+ // approve phrase (autonomy.go_phrase, default "go push") approves one strict landing
1156
+ // (src/core/queue/lib.ts chatUnlock, src/core/autonomy.ts
1156
1157
  // chatTier/chatGo). Only prompts the owner really typed
1157
1158
  // count: the local terminal (input event, source "interactive") and collab guest prompts from
1158
1159
  // write peers. This handler is registered BEFORE the rollover input handler below, so the unlock
@@ -1176,7 +1177,7 @@ export function createOmpAdapter(pi: ExtensionHost, cfg: Config): void {
1176
1177
  const notifyGo = (ctx: unknown, r: { minutes?: number }): void => {
1177
1178
  const c = asRolloverCtx(ctx);
1178
1179
  if (!c || r.minutes === undefined) return;
1179
- c.notify(`go: one push/merge approved for ${r.minutes} min`);
1180
+ c.notify(`${cfg.autonomy.go_phrase}: one push/merge approved for ${r.minutes} min`);
1180
1181
  };
1181
1182
  pi.on("input", (event, ctx) => {
1182
1183
  if (!cfg.guards.chat_unlock || !isMain(ctx)) return undefined;
@@ -1,5 +1,6 @@
1
1
  // Autonomy tiers (I-20261025-177): one owner setting — strict / opinionated / full — that the
2
- // guards follow. The tier and a one-shot `go` are written only by the owner's own words (the same
2
+ // guards follow. The tier and the one-shot approve phrase (autonomy.go_phrase, default "go push")
3
+ // are written only by the owner's own words (the same
3
4
  // paths as chatUnlock: the terminal input event and collab write-peer messages) or the
4
5
  // authenticated phone page; never by a tool call (the state dir is protected) and never from
5
6
  // model text. Every tier keeps the owner-only moves owner-only; no tier loosens them.
@@ -59,20 +60,25 @@ export function chatTier(text: string, cfg: Config, source: string, word: "chat"
59
60
  }
60
61
 
61
62
  export interface ChatGoResult {
62
- /** True when the text was a whole-message `go` command that took effect. */
63
+ /** True when the text was a whole-message approve phrase that took effect. */
63
64
  applied: boolean;
64
65
  /** The minutes this `go` stays valid (autonomy.go_minutes), for the owner notice. */
65
66
  minutes?: number;
66
67
  }
67
68
 
69
+ /** The shape a phrase is matched in: trimmed, lowercased, inner whitespace collapsed. */
70
+ const goWords = (s: string): string => s.trim().toLowerCase().replace(/\s+/g, " ");
71
+
68
72
  /**
69
73
  * The strict tier's one-shot landing approval by chat (guards.chat_unlock): the whole trimmed
70
- * message "go" touches `<state dir>/autonomy-go`; the next strict push/merge consumes it
71
- * (takeGo). Same trust rules as chatTier.
74
+ * message matching `autonomy.go_phrase` (default "go push") — case-insensitive, inner spaces
75
+ * collapsed — touches `<state dir>/autonomy-go`; the next strict push/merge consumes it
76
+ * (takeGo). Same trust rules as chatTier. A bare "go" is an ordinary message (I-20261025-201):
77
+ * it approves nothing.
72
78
  */
73
79
  export function chatGo(text: string, cfg: Config, source: string, word: "chat" | "ui" = "chat"): ChatGoResult {
74
80
  if (!cfg.guards.chat_unlock) return { applied: false };
75
- if (text.trim().toLowerCase() !== "go") return { applied: false };
81
+ if (goWords(text) !== goWords(cfg.autonomy.go_phrase)) return { applied: false };
76
82
  mkdirSync(stateDirPath(), { recursive: true });
77
83
  writeFileSync(goFile(), "");
78
84
  try {
@@ -140,8 +140,10 @@ export interface Config {
140
140
  tier: "strict" | "opinionated" | "full";
141
141
  /** Main's project-file changes per guards.main_window_min window in tier strict. */
142
142
  strict_edit_limit: number;
143
- /** Minutes one owner `go` approves exactly one push/merge in tier strict. */
143
+ /** Minutes the approve phrase approves exactly one push/merge in tier strict. */
144
144
  go_minutes: number;
145
+ /** The whole chat message that approves one push/merge in tier strict (default "go push"; matched case-insensitively with inner spaces collapsed). */
146
+ go_phrase: string;
145
147
  };
146
148
  /** The owner's phone page (`neurastream ui`): binds the tailnet address only. */
147
149
  ui: { enabled: boolean; port: number; owner_login: string };
@@ -426,6 +428,8 @@ function check(cfg: Config): void {
426
428
  throw new ConfigError("autonomy.strict_edit_limit must be an integer >= 1");
427
429
  if (!Number.isInteger(cfg.autonomy.go_minutes) || cfg.autonomy.go_minutes < 1)
428
430
  throw new ConfigError("autonomy.go_minutes must be an integer >= 1");
431
+ if (typeof cfg.autonomy.go_phrase !== "string" || cfg.autonomy.go_phrase.trim() === "")
432
+ throw new ConfigError("autonomy.go_phrase must be a non-empty string");
429
433
  if (!Array.isArray(cfg.guards.rate_limit.patterns) || cfg.guards.rate_limit.patterns.some(p => typeof p !== "string" || p === "")) {
430
434
  throw new ConfigError("guards.rate_limit.patterns must be a list of non-empty strings");
431
435
  }
@@ -700,12 +700,13 @@ function mainTool(e: ToolEvent, input: Record<string, unknown>, cfg: Config): De
700
700
  return ALLOW;
701
701
  }
702
702
  if (cfg.guards.shell_tools.includes(e.tool)) {
703
- // Strict landing gate (20261025_1940 P2): in tier strict every push/merge waits for the
704
- // owner's one-shot `go` (autonomy.go_minutes); the landing that consumes it goes through.
705
- // Opinionated and full keep today's allowance. Owner-only rules above are untouched.
703
+ // Strict landing gate (20261025_1940 P2, P5): in tier strict every push/merge waits for the
704
+ // owner's approve phrase (autonomy.go_phrase, default "go push"); the landing that consumes
705
+ // it goes through. Opinionated and full keep today's allowance. Owner-only rules above are
706
+ // untouched.
706
707
  if (landingCommand(input) && currentTier(cfg) === "strict" && !takeGo(cfg)) {
707
- log(cfg.paths.guard_log, "BLOCK landing: tier strict, no go");
708
- return deny('main-guard: tier strict — type "go" to approve one push/merge');
708
+ log(cfg.paths.guard_log, "BLOCK landing: tier strict, no approve phrase");
709
+ return deny(`main-guard: tier strict — type "${cfg.autonomy.go_phrase}" to approve one push/merge`);
709
710
  }
710
711
  const command = String(input?.command ?? input?.code ?? "");
711
712
  for (const entry of cfg.guards.bypass_spawn) {
@@ -937,7 +938,7 @@ export function checkInject(e: InjectEvent, cfg: Config): Decision {
937
938
  const tier = currentTier(cfg);
938
939
  const tierNote =
939
940
  tier === "strict"
940
- ? `Main changes at most ${cfg.autonomy.strict_edit_limit} project files per ${cfg.guards.main_window_min} min, and every git push / glab mr merge / gh pr merge waits for your "go" (one landing, valid ${cfg.autonomy.go_minutes} min).`
941
+ ? `Main changes at most ${cfg.autonomy.strict_edit_limit} project files per ${cfg.guards.main_window_min} min, and every git push / glab mr merge / gh pr merge waits for your "${cfg.autonomy.go_phrase}" (one landing, valid ${cfg.autonomy.go_minutes} min).`
941
942
  : tier === "full"
942
943
  ? `Main works unattended: no edit cap, its own "Priority skip: <plan> — Main: \\"<reason>\\"" skips pass, pushes and merges go through. Owner-only moves (guard files, the phone page, notify secrets, the unlock) stay locked.`
943
944
  : `Main changes at most ${cfg.guards.main_edit_limit} project files per ${cfg.guards.main_window_min} min; pushes and merges go through.`;
@@ -28,4 +28,4 @@ You are Main, the orchestrator. Main plans, delegates, reviews and lands; implem
28
28
 
29
29
  Guard files are locked for every agent; the owner unlocks with `touch {{AGENT_DIR}}/.guard-unlock` (30 min), or — when `guards.chat_unlock` is on in the config — by typing `unlock 30` in chat (`lock` closes it again).
30
30
 
31
- Autonomy tiers: the owner sets how much Main does unattended with one word — `tier strict` (edit cap `autonomy.strict_edit_limit`; every `git push`, `glab mr merge` or `gh pr merge` also waits until the owner types `go`, which approves exactly one landing for `autonomy.go_minutes` minutes), `tier opinionated` (the limits above), or `tier full` (no edit cap, and a `Priority skip: <plan> — Main: "<reason>"` line with a reason of at least four words may skip an idle higher plan). Pushes stay owner-ruled in strict and opinionated as above; whatever the tier, guard files, the phone page, notify secrets and the unlock stay owner-only.
31
+ Autonomy tiers: the owner sets how much Main does unattended with one word — `tier strict` (edit cap `autonomy.strict_edit_limit`; every `git push`, `glab mr merge` or `gh pr merge` also waits until the owner types the approve phrase from `autonomy.go_phrase` (default `go push`; a bare `go` is an ordinary message), which approves exactly one landing for `autonomy.go_minutes` minutes), `tier opinionated` (the limits above), or `tier full` (no edit cap, and a `Priority skip: <plan> — Main: "<reason>"` line with a reason of at least four words may skip an idle higher plan). Pushes stay owner-ruled in strict and opinionated as above; whatever the tier, guard files, the phone page, notify secrets and the unlock stay owner-only.
@@ -128,7 +128,8 @@ guards:
128
128
  autonomy:
129
129
  tier: opinionated # strict | opinionated | full: how much Main does without asking; the owner moves it with `tier <name>` in chat or a button on the phone page
130
130
  strict_edit_limit: 2 # Main's project-file changes per main_window_min in tier strict
131
- go_minutes: 10 # minutes one owner `go` approves exactly one push/merge in tier strict
131
+ go_minutes: 10 # minutes the approve phrase approves exactly one push/merge in tier strict
132
+ go_phrase: "go push" # the whole chat message that approves one push/merge in tier strict (I-20261025-201); a bare `go` is an ordinary message
132
133
 
133
134
  ui:
134
135
  enabled: false # the owner's phone page (neurastream ui); binds the tailnet address only