@aragon-agent/cli 0.6.66 → 0.6.68

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.
Files changed (36) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/README.md +25 -3
  3. package/dist/agent/controller.d.ts +22 -0
  4. package/dist/agent/controller.js +34 -0
  5. package/dist/agent/governance-wiring.js +2 -0
  6. package/dist/app/App.js +31 -2
  7. package/dist/app/use-governance-rounds.d.ts +44 -0
  8. package/dist/app/use-governance-rounds.js +71 -0
  9. package/dist/commands/governance-command.js +45 -3
  10. package/dist/config/cli-commands.d.ts +1 -1
  11. package/dist/config/cli-commands.js +26 -0
  12. package/dist/gene/hub.d.ts +10 -1
  13. package/dist/gene/hub.js +25 -7
  14. package/dist/governance/copy.d.ts +8 -0
  15. package/dist/governance/copy.js +16 -1
  16. package/dist/governance/engine/cards.js +9 -1
  17. package/dist/governance/engine/digest.js +6 -2
  18. package/dist/governance/engine/engine-core.d.ts +12 -0
  19. package/dist/governance/engine/engine-core.js +29 -0
  20. package/dist/governance/engine/engine.d.ts +1 -0
  21. package/dist/governance/engine/engine.js +4 -1
  22. package/dist/governance/engine/lifecycle.d.ts +36 -1
  23. package/dist/governance/engine/lifecycle.js +185 -2
  24. package/dist/governance/engine/report.d.ts +8 -0
  25. package/dist/governance/engine/report.js +17 -0
  26. package/dist/governance/engine/stage-runner.js +48 -3
  27. package/dist/governance/engine/state-machine.d.ts +27 -2
  28. package/dist/governance/engine/state-machine.js +146 -20
  29. package/dist/governance/prompts/orchestrator-block.d.ts +2 -0
  30. package/dist/governance/prompts/orchestrator-block.js +25 -0
  31. package/dist/governance/store/events-log.d.ts +4 -2
  32. package/dist/governance/store/events-log.js +4 -2
  33. package/dist/governance/tools/inspector-tools.js +4 -0
  34. package/dist/governance/tools/lead-tools.d.ts +1 -1
  35. package/dist/governance/tools/lead-tools.js +14 -2
  36. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -124,6 +124,24 @@ were written.
124
124
 
125
125
  ### Added
126
126
 
127
+ - **A governed run now has a ROUND BUDGET, and it can be auto.** A round is one failure-driven
128
+ repeat dispatch - a `fix` stage, or a `dev` stage that reworks a work package - so a clean pass
129
+ through dev / review / test / settle / integrate costs nothing. `governance.rounds` is either a
130
+ number (0-24, yours alone to raise) or `auto`, where the engine derives it from the plan (one
131
+ round per phase plus one per two work packages, floored at 2, capped at 24) and the orchestrator
132
+ may ask for one more with a written reason, twice per run (`gov_run {"action":"rounds",
133
+ "reason":"..."}`). When the budget is spent the engine stops retrying and escalates with a card
134
+ that offers `retry` (grant one more round - this works on a fixed budget too, because the number
135
+ is the user's), `accept_as_is` / `accept_failing`, or `drop`. New entry points: `/gov rounds
136
+ [<n>|auto]`, `Ctrl+Up / Ctrl+Down` in a governance posture with no run in flight
137
+ (`governance.arrowRounds`, on by default - everywhere else the keys still set the team size), a
138
+ `RND` status chip, a `Rounds` chip in the desktop composer, a `Round budget` row in Settings >
139
+ Governance, `aragon config set governance.rounds auto|6`, and the GOV chip's widest rung now
140
+ reads `GOV p2/3 REVIEW R3/5`. Two costs are deliberate and documented: **a pause spends a round**
141
+ (an `Esc` then `/gov resume` re-dispatches the interrupted rework, which is a dispatch like any
142
+ other), and the default (auto) budget is TIGHTER than the old "retry until `maxRework` runs out"
143
+ behaviour - raise it with `/gov rounds`, or rule `retry` on the card.
144
+
127
145
  - **Tiered reconnect: a dropped connection now has three gears instead of one.** Ten fast
128
146
  retries and then a dead run was the old behaviour, and it is the wrong shape for the outages
129
147
  people actually have. The ladder is now fast, then steady, then a hold: **tier 1** is the fast
package/README.md CHANGED
@@ -957,7 +957,7 @@ ignores them rather than rejecting the library):
957
957
  | `/resume [file]` | Load a saved session. This session moves to a NEW id, and the spend counter restarts |
958
958
  | `/session [copy\|pin]` | Report this session's id, file and branch parent; `copy` puts `aragon --resume <id>` on the clipboard; `pin` makes `sessions prune` skip the file forever |
959
959
  | `/plan [on\|off\|status]` | Toggle plan mode (and leave governance) - the keyboard-free equivalent of `Shift+Tab` |
960
- | `/gov [status\|on\|plan\|off\|board\|runs\|report [id]\|resume [id]\|pause [cancel]\|abort\|budget <n\|off>\|help]` | **Governance mode**: a governed engineering team (dev / review / test / inspector) with a GT scoring economy. `on` = GOVERN, `plan` = PLAN+GOVERN (interview first), `board` opens the full-screen overview, `runs` lists past runs with phase / health / tokens / cost, `report` re-reads a run's report, `pause` stops at the end of the running stage (nothing is killed), `abort` stops the running stage at once (the run is resumable). See [Governance mode](#governance-mode) |
960
+ | `/gov [status\|on\|plan\|off\|board\|runs\|report [id]\|resume [id]\|pause [cancel]\|abort\|budget <n\|off>\|rounds <n\|auto>\|help]` | **Governance mode**: a governed engineering team (dev / review / test / inspector) with a GT scoring economy. `on` = GOVERN, `plan` = PLAN+GOVERN (interview first), `board` opens the full-screen overview, `runs` lists past runs with phase / health / tokens / cost, `report` re-reads a run's report, `pause` stops at the end of the running stage (nothing is killed), `abort` stops the running stage at once (the run is resumable). See [Governance mode](#governance-mode) |
961
961
  | `/redteam [status\|on\|off\|scope <one line>\|prompt [...]]` | **Red team / security mode.** `/redteam status` prints five lines (effective state, scope, what the confirmation gate is doing, what this mode does NOT lift, and which prompt profile is supplying the wording) in any session, including `--no-redteam`. `on` needs the liability waiver accepted first (`Ctrl+R` opens it); a turn in flight defers the arming to its end, while `off` takes effect immediately and is never refused. `scope` declares the engagement boundary in one line (refused above 200 characters or across lines); no argument clears it. `prompt` manages the editable prompt profile: `status`, `builtin`, `<slug>`, `<path>`, `reload`, `validate [<path>]`, `init [<slug>]`. See [Red team and security mode](#red-team-and-security-mode) and [Prompt profiles](#prompt-profiles) |
962
962
  | `/team [on [n]\|off\|status]` / `/team [-n <n>] [--parts a,b,c] [--read-only] <brief>` | **Force team mode and start now.** `/team <brief>` arms forced team mode and submits that work as a normal turn: the lead analyses and plans it, then calls `task` — the directive, the `<forced_team_mode>` prompt block and a mechanical end-of-turn gate all say so. `/team on [n]` arms (optionally with a count) without submitting, `/team off` leaves - both take effect when the turn ends if one is running - and `/team` reports. The configuration it used to carry (team switch, width, concurrency, supervisor, subagent model) lives in `Settings > Team` |
963
963
  | `/todo [on\|off\|panel on\|off\|follow <mode>\|acceptance on\|off\|reset\|clear\|continue]` | Todo planning: status, the on/off switch, the rail, follow-through, acceptance criteria, and picking an unfinished plan back up |
@@ -1009,7 +1009,7 @@ completes, `Up` / `Down` moves the selection, `Esc` closes it.
1009
1009
  | `Ctrl+R` | **Red team / security mode on / off.** Arms only after the liability waiver is accepted (first press opens it); while armed the status bar shows `RT armed`, the composer border is drawn in the red team colour and the system prompt carries a `<redteam_mode>` block. Session state, never saved; the scope is never saved either. `Ctrl+R` no longer repaints - see the row below, and [Red team and security mode](#red-team-and-security-mode) |
1010
1010
  | `Alt+R` | Redraw the frame. This was `Ctrl+R` until red team mode took that key; the recovery key keeps working in every configuration, including `--no-redteam` |
1011
1011
  | `Ctrl+T` | **Team mode on / off.** While on, every message fans out to subagents (the forced mode `/team` arms); the status bar shows the switch. Session state, never saved. See [The team mode switch](#the-team-mode-switch) |
1012
- | `Ctrl+Up` / `Ctrl+Down` | **Team size**: one more / one fewer subagent per message, between 1 and `team.maxSubagents` (no wrap). Only while team mode is on. Inside the prompt library overlay these keys reorder prompts instead |
1012
+ | `Ctrl+Up` / `Ctrl+Down` | **Team size**: one more / one fewer subagent per message, between 1 and `team.maxSubagents` (no wrap). Only while team mode is on. In a governance posture with **no run in flight** the same keys step the **round budget** instead (`governance.arrowRounds`). Inside the prompt library overlay these keys reorder prompts instead |
1013
1013
  | `Alt+T` | Show / hide thinking (**off by default**) for the entire session. This was `Ctrl+T`. On macOS Terminal.app turn on *Use Option as Meta key* or `Option+T` types `†` |
1014
1014
  | `Ctrl+O` | Expand / collapse the most recent tool, team, compaction or **service** card — including a diff or a service's log tail. In native scroll mode printed rows cannot change, so it **prints an expanded copy** below instead. When no card is asking for the key it re-prints the **last finished answer** in full — the same escape hatch for a reply taller than the region |
1015
1015
  | Terminal scrolling (native mode, the default) | The wheel, the scrollbar, `Shift+PgUp` / `Shift+PgDn`, text selection and in-terminal search are all your terminal's own — see [Scrolling](#scrolling) |
@@ -1768,6 +1768,27 @@ pauses at once. `/gov pause cancel` withdraws a request that has not fired, and
1768
1768
  continues a paused run. Unlike `Esc`, it never throws away work in progress. A run that is waiting
1769
1769
  on your ruling is left as it is.
1770
1770
 
1771
+ **How many rounds may a run take?** A *round* is one **failure-driven repeat dispatch**: a `fix`
1772
+ stage, or a `dev` stage that includes a work package in `rework` (or blocked at dev). A clean pass
1773
+ through dev -> review -> test -> settle -> integrate costs none, so a normal six-phase run does not
1774
+ eat the budget it is given. The budget has two forms: a **number** you set (`/gov rounds 6`), which
1775
+ only you may raise mid-run, and **auto**, where the engine derives it from the plan (one round per
1776
+ phase plus one per two work packages, floored at 2 and capped at 24) and the orchestrator may ask for
1777
+ one more round with a written reason, twice per run. When it is spent the engine stops retrying and
1778
+ escalates: the card offers `retry` (grant one more round - this works on a fixed budget too, because
1779
+ the number is yours), `accept_as_is` / `accept_failing`, or `drop`. Two consequences worth knowing:
1780
+ every round grant is written to `events.jsonl` with its reason, and **a pause costs a round** - an
1781
+ `Esc` followed by `/gov resume` re-dispatches the interrupted rework, which is a dispatch like any
1782
+ other (D-11). Raise or lower the budget with `/gov rounds <n|auto>`, **Settings > Governance > Round
1783
+ budget**, or `aragon config set governance.rounds auto|6` (`config get` prints `auto` for the `null`
1784
+ the file stores: two presentations of one value).
1785
+
1786
+ **The arrow keys.** In a governance posture, with **no run in flight**, `Ctrl+Up / Ctrl+Down` steps
1787
+ the round budget (`governance.arrowRounds`, on by default); everywhere else - BUILD, PLAN, and any
1788
+ live run - the same keys still set the team size, because a budget you cannot use yet is not worth
1789
+ the key while agents need sizing. `/gov rounds` reads it, `/keys rounds` finds both meanings, and
1790
+ `governance.arrowRounds: false` hands the keys back to team size permanently.
1791
+
1771
1792
  **Cost before you start.** The charter, `/gov status` and the `gov_run start` result carry a
1772
1793
  dispatch plan: how many `gov_dispatch` calls a clean run needs (stages wider than
1773
1794
  `team.maxSubagents` are split, which adds calls), how many one more rework round or fix cycle adds,
@@ -1782,7 +1803,8 @@ transcript, up to 120 lines and the path of the full file. Nothing is regenerate
1782
1803
  Limits and switches (`aragon config set governance.<key> <value>`, or **Settings > Governance**): `enabled`, `shiftTab`,
1783
1804
  `panel`, `profile` (`general` / `ml` / `product` / `api-security`), `maxWorkPackages` (<= 8),
1784
1805
  `maxPhases` (<= 6), `maxRework` (<= 5), `maxFixCycles` (<= 5), `minAskRounds` (0-5),
1785
- `budgetTokens` (team tokens only; 0 = unlimited), `confirmCharter`. `ARAGON_GOVERNANCE=0` and
1806
+ `rounds` (0-24, `auto` = the engine decides), `arrowRounds`, `budgetTokens` (team tokens only;
1807
+ 0 = unlimited), `confirmCharter`. `ARAGON_GOVERNANCE=0` and
1786
1808
  `--no-governance` disable it; `--govern` / `--plan-govern` start in a governed posture. It is not
1787
1809
  available in `aragon exec` / `-p`. Governed agents are team agents: each one spends tokens, so a
1788
1810
  run costs several times a single-agent turn - watch the status-bar chip and set `budgetTokens`.
@@ -56,6 +56,7 @@ import type { CompactionEventListener, CompactionSnapshot, ContextUsageSnapshot
56
56
  import type { AcceptanceItem, TodoEventListener, TodoSnapshot } from '@aragon-agent/tui/model/todo/types';
57
57
  import { GovernanceWiring } from './governance-wiring.js';
58
58
  import { type GovernanceConfig } from '@aragon-agent/tui/model/config/governance-config';
59
+ import type { RoundBudget, RunStatus } from '@aragon-agent/tui/model/governance/types';
59
60
  import { type Posture } from '@aragon-agent/tui/model/governance/posture';
60
61
  import type { GovernanceAvailability } from '../governance/copy.js';
61
62
  import type { PauseOutcome } from '../governance/engine/pause.js';
@@ -898,6 +899,27 @@ export declare class AgentController {
898
899
  /** `/gov resume`: the run id to hand to the orchestrator, or null when none exists. */
899
900
  findResumableGovernanceRun(runId?: string): Promise<string | null>;
900
901
  getGovernanceConfig(): GovernanceConfig;
902
+ /** The live round budget (`null` = auto): the ONE policy source the arbiter and UI read. */
903
+ getGovernanceRounds(): RoundBudget;
904
+ /**
905
+ * The live run's status, or null. Read from the same snapshot the panel uses, so this can
906
+ * never become a second view of "is a run in flight" (governance-round-budget 4.5b).
907
+ */
908
+ getGovernanceRunStatus(): RunStatus | null;
909
+ /** The run's effective round limit; the structural maximum when nothing runs. */
910
+ roundsLimit(): number;
911
+ /**
912
+ * One ladder step of the round budget (governance-round-budget 4.5a).
913
+ *
914
+ * THE CONTROLLER DOES NOT WRITE TO DISK. `setGovernanceConfig` clamps, updates memory and
915
+ * re-renders the system prompt - exactly like `/gov budget` - and persisting is the
916
+ * CALLER's second call (`persistConfig`). A controller that persisted here would be a
917
+ * second write path around the App's `updatePersistedConfig`.
918
+ */
919
+ stepGovernanceRounds(delta: 1 | -1): {
920
+ value: RoundBudget;
921
+ toast: string;
922
+ };
901
923
  /** Adopt a governance config patch for this session and re-render (the block quotes limits). */
902
924
  setGovernanceConfig(patch: Partial<GovernanceConfig>): GovernanceConfig;
903
925
  /** `submit_plan` approval: PLAN+GOVERN hands over to the team, plain PLAN goes to BUILD. */
@@ -82,6 +82,8 @@ import { buildTodoBlock } from '../todo/prompt.js';
82
82
  import { createPlanTools } from '../tools/plan-tools.js';
83
83
  import { GovernanceWiring } from './governance-wiring.js';
84
84
  import { clampGovernanceConfig } from '@aragon-agent/tui/model/config/governance-config';
85
+ import { GOV_LIMITS } from '@aragon-agent/tui/model/governance/limits';
86
+ import { roundsStepToast, stepRoundBudget } from '@aragon-agent/tui/model/governance/rounds';
85
87
  import { decidePostureTransition } from '../governance/posture-transition.js';
86
88
  import { composePosture, splitPosture } from '@aragon-agent/tui/model/governance/posture';
87
89
  import { APPROVED_GOVERN_RESULT } from '../governance/prompts/refusals.js';
@@ -2526,6 +2528,38 @@ export class AgentController {
2526
2528
  getGovernanceConfig() {
2527
2529
  return clampGovernanceConfig(this.config.governance);
2528
2530
  }
2531
+ /** The live round budget (`null` = auto): the ONE policy source the arbiter and UI read. */
2532
+ getGovernanceRounds() {
2533
+ return this.getGovernanceConfig().rounds;
2534
+ }
2535
+ /**
2536
+ * The live run's status, or null. Read from the same snapshot the panel uses, so this can
2537
+ * never become a second view of "is a run in flight" (governance-round-budget 4.5b).
2538
+ */
2539
+ getGovernanceRunStatus() {
2540
+ return this.getGovernanceSnapshot()?.status ?? null;
2541
+ }
2542
+ /** The run's effective round limit; the structural maximum when nothing runs. */
2543
+ roundsLimit() {
2544
+ return this.getGovernanceSnapshot()?.rounds.limit ?? GOV_LIMITS.hardMaxRounds;
2545
+ }
2546
+ /**
2547
+ * One ladder step of the round budget (governance-round-budget 4.5a).
2548
+ *
2549
+ * THE CONTROLLER DOES NOT WRITE TO DISK. `setGovernanceConfig` clamps, updates memory and
2550
+ * re-renders the system prompt - exactly like `/gov budget` - and persisting is the
2551
+ * CALLER's second call (`persistConfig`). A controller that persisted here would be a
2552
+ * second write path around the App's `updatePersistedConfig`.
2553
+ */
2554
+ stepGovernanceRounds(delta) {
2555
+ const step = stepRoundBudget(this.getGovernanceRounds(), delta);
2556
+ const adopted = this.setGovernanceConfig({ rounds: step.value });
2557
+ const live = this.getGovernanceSnapshot()?.rounds ?? null;
2558
+ return {
2559
+ value: adopted.rounds,
2560
+ toast: roundsStepToast(adopted.rounds, live ?? undefined, live === null ? undefined : live.limit, step.at),
2561
+ };
2562
+ }
2529
2563
  /** Adopt a governance config patch for this session and re-render (the block quotes limits). */
2530
2564
  setGovernanceConfig(patch) {
2531
2565
  const governance = clampGovernanceConfig({ ...this.getGovernanceConfig(), ...patch });
@@ -195,6 +195,7 @@ export class GovernanceWiring {
195
195
  maxRework: gov.maxRework,
196
196
  maxFixCycles: gov.maxFixCycles,
197
197
  budgetTokens: gov.budgetTokens,
198
+ rounds: gov.rounds,
198
199
  },
199
200
  });
200
201
  }
@@ -456,6 +457,7 @@ export class GovernanceWiring {
456
457
  close: (summary) => e().close(summary),
457
458
  abandon: (reason) => e().abandon(reason),
458
459
  resolve: (input) => e().resolve(input),
460
+ rounds: (input) => e().rounds(input),
459
461
  snapshot: () => this.snapshot(),
460
462
  isStageRunning: () => this.isStageRunning(),
461
463
  abortStage: () => this.abortStage(),
package/dist/app/App.js CHANGED
@@ -64,6 +64,7 @@ import { advanceBudget, chargeResume, decideFollowThrough, emptyBudget, emptyRes
64
64
  // no policy. Imported beside the todo decision it shares one timer with.
65
65
  import { buildDispatchNudge, decideForcedDispatch, FORCED_NUDGE_NOTICE } from '../team/dispatch-gate.js';
66
66
  import { teamToastTtlMs, useTeamMode } from './use-team-mode.js';
67
+ import { useGovernanceRounds } from './use-governance-rounds.js';
67
68
  // THE RED TEAM SWITCH (red-team-security-mode 4.3 / 4.8): Ctrl+R, the waiver flow, the
68
69
  // deferred arming and the banner. Same adapter shape as `use-team-mode` above.
69
70
  import { redTeamToastTtlMs, useRedTeamMode, } from './use-redteam-mode.js';
@@ -702,6 +703,15 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
702
703
  });
703
704
  const teamKeysRef = useRef(teamKeys);
704
705
  teamKeysRef.current = teamKeys;
706
+ // THE ROUND BUDGET'S KEYS (governance-round-budget D-9): `Ctrl+Up / Ctrl+Down` in a
707
+ // governance posture with NO live run, otherwise team size. `planRoundKeyTarget` decides,
708
+ // and `handleKey` returns false for 'team', so the branch below runs unchanged.
709
+ const governanceRoundsKeys = useGovernanceRounds({
710
+ controller,
711
+ canAct: () => !stateRef.current.overlay,
712
+ persistConfig: (patch) => persistConfig(patch),
713
+ pushToast: (level, text) => dispatch({ type: 'pushToast', level, text, ttlMs: teamToastTtlMs(level) }),
714
+ });
705
715
  // THE RED TEAM SWITCH (red-team-security-mode): Ctrl+R, the waiver flow and the deferred
706
716
  // arming at `agent_end`. Same shape as `teamKeys` above, same reason: the controller owns the
707
717
  // state, this hook is the adapter, and `App` only routes keys and props.
@@ -3188,6 +3198,11 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
3188
3198
  // which had no overlay guard; and the help/plan/queue overlays consume Ctrl+Up/Down in
3189
3199
  // their own paging block earlier, which is the intended precedence. `PromptInput` ignores
3190
3200
  // both keys so a draft's history and a popup's highlight never also move (I-6).
3201
+ // Governance rounds outrank team size ONLY in a governance posture with no live run
3202
+ // (round-budget D-9); every other state answers 'team' and falls through to the line
3203
+ // below, so the team keys behave exactly as they always did.
3204
+ if (governanceRoundsKeys.handleKey(input, key))
3205
+ return;
3191
3206
  if (teamKeys.handleKey(input, key))
3192
3207
  return;
3193
3208
  // Ctrl+R IS THE RED TEAM SWITCH (red-team-security-mode D-1), and the repaint moved to
@@ -3727,7 +3742,14 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
3727
3742
  // second scroll authority and no geometry change in `ScrollViewport`.
3728
3743
  overlay === 'shortcuts' ? (_jsx(ShortcutPanel, { isActive: !tooSmall, cols: viewCols, maxRows: overlayMaxRows, theme: theme, caps: caps, native: native, running: running,
3729
3744
  // Only the team-size row reads it: dim until team mode is on (team-mode-toggle-keys D-13).
3730
- team: { available: teamKeys.view.available, on: teamKeys.view.on }, query: shortcutQuery, task: taskSectionFrom({
3745
+ team: { available: teamKeys.view.available, on: teamKeys.view.on }, ...(typeof controller.isGovernanceAvailable === 'function'
3746
+ ? {
3747
+ governance: {
3748
+ available: controller.isGovernanceAvailable().ok,
3749
+ on: isGovernancePosture(controller.getPosture()),
3750
+ },
3751
+ }
3752
+ : {}), query: shortcutQuery, task: taskSectionFrom({
3731
3753
  view: state.taskSummary,
3732
3754
  pending: state.taskSummaryPending,
3733
3755
  enabled: cfg.taskSummary?.enabled !== false,
@@ -4000,7 +4022,14 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
4000
4022
  // partially stale. The window and its `known` flag now travel INSIDE
4001
4023
  // it, resolved by the meter - which is what makes the user's
4002
4024
  // `contextWindow` override reach the bar.
4003
- context: state.context, status: state.status, elapsedMs: elapsedMs, thinkingLevel: cfg.thinkingLevel, tokPerSec: tokPerSec, theme: theme, caps: caps, scrolledLines: scrolledLines, redrawNonce: redrawNonce, agentMode: state.posture, pendingAgentMode: state.pendingPosture, governance: state.governance, ...(teamKeys.view.available ? { team: teamStatusFromView(teamKeys.view) } : {}), ecoRung: governor.rung, ...(state.team
4025
+ context: state.context, status: state.status, elapsedMs: elapsedMs, thinkingLevel: cfg.thinkingLevel, tokPerSec: tokPerSec, theme: theme, caps: caps, scrolledLines: scrolledLines, redrawNonce: redrawNonce, agentMode: state.posture, pendingAgentMode: state.pendingPosture, governance: state.governance, ...(typeof controller.getGovernanceConfig === 'function'
4026
+ ? {
4027
+ governanceRounds: {
4028
+ budget: controller.getGovernanceConfig().rounds,
4029
+ run: state.governance ? state.governance.rounds : null,
4030
+ },
4031
+ }
4032
+ : {}), ...(teamKeys.view.available ? { team: teamStatusFromView(teamKeys.view) } : {}), ecoRung: governor.rung, ...(state.team
4004
4033
  ? {
4005
4034
  // `rosterCounts`, NOT a fourth inline phase filter (A-1): the chip and
4006
4035
  // the roster header above it must never disagree.
@@ -0,0 +1,44 @@
1
+ /**
2
+ * `useGovernanceRounds`: the terminal's half of `Ctrl+Up / Ctrl+Down` for the round budget
3
+ * (governance-round-budget 4.5b).
4
+ *
5
+ * ASCII ONLY (`app/` is inside the glyph scanner's scope).
6
+ *
7
+ * A THIN ADAPTER, EXACTLY LIKE `use-team-mode`. Every decision lives elsewhere: the pure
8
+ * `planRoundKeyTarget` says whose key this is, and `controller.stepGovernanceRounds` steps
9
+ * the ladder and clamps. This hook only recognises the two byte forms of the key, asks, and
10
+ * reports what the controller adopted - plus the one thing the controller must NOT do,
11
+ * writing the value to `config.json`.
12
+ *
13
+ * EVERY CONTROLLER MEMBER IS OPTIONAL, for the reason `use-team-mode` records: several App
14
+ * tests hand `App` a hand-written controller stub, and an unconditional call would throw
15
+ * `is not a function` at render. A controller without them reads as "no round budget here":
16
+ * the key is not consumed and `Ctrl+Up/Down` keeps meaning team size.
17
+ */
18
+ import { type RoundKeyTarget } from '@aragon-agent/tui/model/governance/rounds-keys';
19
+ import type { RoundBudget } from '@aragon-agent/tui/model/governance/types';
20
+ import type { GovernanceConfig } from '@aragon-agent/tui/model/config/governance-config';
21
+ import type { AgentController } from '../agent/controller.js';
22
+ import type { TeamKeyLike, TeamToastLevel } from './use-team-mode.js';
23
+ /** The slice of the controller this hook reads. Structural, so a stub may implement none. */
24
+ export type GovernanceRoundsControllerPort = Partial<Pick<AgentController, 'stepGovernanceRounds' | 'getGovernanceConfig' | 'getGovernanceRounds' | 'getGovernanceRunStatus' | 'getPostureState' | 'isGovernanceAvailable'>>;
25
+ /** What the persisted patch needs; `App` supplies `updatePersistedConfig`. */
26
+ export type PersistGovernanceConfig = (patch: {
27
+ governance: GovernanceConfig;
28
+ }) => void;
29
+ export interface UseGovernanceRoundsArgs {
30
+ controller: GovernanceRoundsControllerPort;
31
+ /** False while an overlay owns the keyboard, exactly like the team keys (I-7). */
32
+ canAct(): boolean;
33
+ persistConfig: PersistGovernanceConfig;
34
+ pushToast(level: TeamToastLevel, text: string): void;
35
+ }
36
+ export interface UseGovernanceRounds {
37
+ /** True when the key was the round budget's and has been consumed. */
38
+ handleKey(input: string, key: TeamKeyLike): boolean;
39
+ /** The arbitration for the CURRENT state, exposed for tests and for `/keys`. */
40
+ target(): RoundKeyTarget;
41
+ }
42
+ export declare function useGovernanceRounds(args: UseGovernanceRoundsArgs): UseGovernanceRounds;
43
+ /** The value a `/gov rounds` read prints when nothing runs: the live config, formatted. */
44
+ export type GovernanceRoundsValue = RoundBudget;
@@ -0,0 +1,71 @@
1
+ /**
2
+ * `useGovernanceRounds`: the terminal's half of `Ctrl+Up / Ctrl+Down` for the round budget
3
+ * (governance-round-budget 4.5b).
4
+ *
5
+ * ASCII ONLY (`app/` is inside the glyph scanner's scope).
6
+ *
7
+ * A THIN ADAPTER, EXACTLY LIKE `use-team-mode`. Every decision lives elsewhere: the pure
8
+ * `planRoundKeyTarget` says whose key this is, and `controller.stepGovernanceRounds` steps
9
+ * the ladder and clamps. This hook only recognises the two byte forms of the key, asks, and
10
+ * reports what the controller adopted - plus the one thing the controller must NOT do,
11
+ * writing the value to `config.json`.
12
+ *
13
+ * EVERY CONTROLLER MEMBER IS OPTIONAL, for the reason `use-team-mode` records: several App
14
+ * tests hand `App` a hand-written controller stub, and an unconditional call would throw
15
+ * `is not a function` at render. A controller without them reads as "no round budget here":
16
+ * the key is not consumed and `Ctrl+Up/Down` keeps meaning team size.
17
+ */
18
+ import { useCallback, useRef } from 'react';
19
+ import { planRoundKeyTarget, } from '@aragon-agent/tui/model/governance/rounds-keys';
20
+ /** The two legacy byte forms some terminals deliver for Ctrl+Up / Ctrl+Down. */
21
+ const RAW_UP = '\x1b[1;5A';
22
+ const RAW_DOWN = '\x1b[1;5B';
23
+ function isStepKey(input, key) {
24
+ if (!key.ctrl || key.meta || key.shift)
25
+ return null;
26
+ if (key.upArrow || input === RAW_UP)
27
+ return 1;
28
+ if (key.downArrow || input === RAW_DOWN)
29
+ return -1;
30
+ return null;
31
+ }
32
+ /** The live arbitration inputs, read fresh on every press (never mirrored into state). */
33
+ function currentTarget(controller) {
34
+ return planRoundKeyTarget({
35
+ posture: (controller.getPostureState?.().effective ?? 'build'),
36
+ governanceAvailable: controller.isGovernanceAvailable?.().ok === true,
37
+ runStatus: (controller.getGovernanceRunStatus?.() ?? null),
38
+ // `arrowRounds` is the user's opt-out; a controller without a governance config
39
+ // answers `undefined` here, which reads as "off" - the key stays the team's.
40
+ preferRounds: controller.getGovernanceConfig?.().arrowRounds === true,
41
+ });
42
+ }
43
+ export function useGovernanceRounds(args) {
44
+ const argsRef = useRef(args);
45
+ argsRef.current = args;
46
+ const target = useCallback(() => currentTarget(argsRef.current.controller), []);
47
+ const handleKey = useCallback((input, key) => {
48
+ const live = argsRef.current;
49
+ if (!live.canAct())
50
+ return false;
51
+ const delta = isStepKey(input, key);
52
+ if (delta === null)
53
+ return false;
54
+ if (!live.controller.stepGovernanceRounds)
55
+ return false;
56
+ // `'team'` means "not mine": return false WITHOUT consuming, so App's team branch runs
57
+ // exactly as it did before this feature existed.
58
+ if (currentTarget(live.controller) !== 'rounds')
59
+ return false;
60
+ const stepped = live.controller.stepGovernanceRounds(delta);
61
+ // BOTH CALLS, AND NEITHER MAY BE DROPPED (the `/fast` rule): the setter makes this
62
+ // session honour the value, the persist survives a restart.
63
+ const config = live.controller.getGovernanceConfig?.();
64
+ if (config !== undefined)
65
+ live.persistConfig({ governance: config });
66
+ if (stepped.toast !== '')
67
+ live.pushToast('info', stepped.toast);
68
+ return true;
69
+ }, []);
70
+ return { handleKey, target };
71
+ }
@@ -24,12 +24,13 @@
24
24
  * posture change produces no `AgentEvent`, so without one the badge would wait for an
25
25
  * unrelated state change to repaint (the lesson of team-command-forced-dispatch P1-6).
26
26
  */
27
- import { GOV_ABORTED_NOTICE, GOV_BUDGET_OFF_NOTICE, GOV_BUDGET_USAGE, GOV_COMMAND_SUMMARY, GOV_NO_RUN_NOTICE, GOV_NO_RUNS_NOTICE, GOV_NO_STAGE_NOTICE, GOV_OFF_NOTICE, GOV_OFF_WITH_RUN_NOTICE, GOV_PAUSE_ALREADY_NOTICE, GOV_PAUSE_CANCELLED_TOAST, GOV_PAUSE_ESCALATED_NOTICE, GOV_PAUSE_NONE_PENDING_NOTICE, GOV_PAUSE_NO_RUN_NOTICE, GOV_REPORT_NO_RUN_NOTICE, GOV_STAGE_BUSY_NOTICE, buildGovHelpText, formatGovStatus, govBudgetSetNotice, govPausePendingToast, govPausedNowToast, govReportBadIdNotice, govReportMissingNotice, govUnavailableNotice, posturePendingToast, postureAppliedToast, stageRunningToast, RESTART_REQUIRED_TEXT, } from '../governance/copy.js';
28
- import { RUN_ID_PATTERN } from '@aragon-agent/tui/model/governance/limits';
27
+ import { GOV_ABORTED_NOTICE, GOV_BUDGET_OFF_NOTICE, GOV_BUDGET_USAGE, GOV_COMMAND_SUMMARY, GOV_NO_RUN_NOTICE, GOV_NO_RUNS_NOTICE, GOV_NO_STAGE_NOTICE, GOV_OFF_NOTICE, GOV_OFF_WITH_RUN_NOTICE, GOV_PAUSE_ALREADY_NOTICE, GOV_PAUSE_CANCELLED_TOAST, GOV_PAUSE_ESCALATED_NOTICE, GOV_PAUSE_NONE_PENDING_NOTICE, GOV_PAUSE_NO_RUN_NOTICE, GOV_REPORT_NO_RUN_NOTICE, GOV_ROUNDS_USAGE, GOV_STAGE_BUSY_NOTICE, buildGovHelpText, formatGovStatus, govBudgetSetNotice, govRoundsSetNotice, govPausePendingToast, govPausedNowToast, govReportBadIdNotice, govReportMissingNotice, govUnavailableNotice, posturePendingToast, postureAppliedToast, stageRunningToast, RESTART_REQUIRED_TEXT, } from '../governance/copy.js';
28
+ import { GOV_LIMITS, RUN_ID_PATTERN } from '@aragon-agent/tui/model/governance/limits';
29
+ import { formatRoundBudget, parseRoundBudget } from '@aragon-agent/tui/model/governance/rounds';
29
30
  import { isGovernancePosture } from '@aragon-agent/tui/model/governance/posture';
30
31
  import { formatReportNotice, formatRunsTable } from './governance-runs-table.js';
31
32
  const USAGE = 'Usage: /gov [status|on|plan|off|board|runs|report [runId]|resume [runId]|pause [cancel]' +
32
- '|abort|budget <n|off>|help]';
33
+ '|abort|budget <n|off>|rounds <n|auto>|help]';
33
34
  /** The fixed English turn that makes the orchestrator call `gov_run resume` (11.3). */
34
35
  export function resumeTurnText(runId) {
35
36
  return `Resume governance run ${runId}.`;
@@ -251,6 +252,44 @@ function setBudget(ctx) {
251
252
  ctx.persistConfig({ governance: adopted });
252
253
  ctx.notify('info', adopted.budgetTokens === 0 ? GOV_BUDGET_OFF_NOTICE : govBudgetSetNotice(adopted.budgetTokens));
253
254
  }
255
+ /**
256
+ * `/gov rounds` - read without an argument, write with one.
257
+ *
258
+ * The read branch is answerable in ANY session (it is a question, like `status`), and it
259
+ * names what a LIVE run can still do: the user's own `retry` ruling can grant a round even
260
+ * on a fixed budget, which is the fact a user is most likely to be missing (R-11).
261
+ */
262
+ function roundsCommand(ctx) {
263
+ const raw = ctx.args.trim().split(/\s+/)[1];
264
+ if (raw === undefined) {
265
+ ctx.notify('info', describeRounds(ctx));
266
+ return;
267
+ }
268
+ const parsed = parseRoundBudget(raw);
269
+ if (!parsed.ok && parsed.reason !== 'out_of_range') {
270
+ ctx.notify('warn', GOV_ROUNDS_USAGE);
271
+ return;
272
+ }
273
+ // An out-of-range NUMBER is clamped by `clampGovernanceConfig` rather than rejected, which
274
+ // is the same rule every other numeric setting follows; a word that is not a number is not
275
+ // an answer at all. The notice echoes what was WRITTEN.
276
+ const requested = parsed.ok ? parsed.value : Number(raw);
277
+ const adopted = ctx.controller.setGovernanceConfig({ rounds: requested });
278
+ ctx.persistConfig({ governance: adopted });
279
+ ctx.notify('info', govRoundsSetNotice(adopted.rounds));
280
+ }
281
+ /** The read-only answer: the setting in force plus this run's used/limit when there is one. */
282
+ function describeRounds(ctx) {
283
+ const budget = ctx.controller.getGovernanceConfig().rounds;
284
+ const snapshot = ctx.controller.getGovernanceSnapshot();
285
+ const head = `Round budget: ${formatRoundBudget(budget)}`;
286
+ if (snapshot === null)
287
+ return head;
288
+ const { used, limit, grants, rework, fix } = snapshot.rounds;
289
+ const left = Math.max(0, GOV_LIMITS.maxRoundGrantsPerRun - grants);
290
+ return (`${head}; this run has used ${used}/${limit} (${rework} rework, ${fix} fix). ` +
291
+ `${left} grant(s) left - a "retry" ruling on an escalation card spends one.`);
292
+ }
254
293
  /** The command body; `registerGovernanceCommand` is the only registration site. */
255
294
  export async function runGovernanceCommand(ctx) {
256
295
  const verb = (ctx.args.trim().split(/\s+/)[0] ?? '').toLowerCase();
@@ -292,6 +331,9 @@ export async function runGovernanceCommand(ctx) {
292
331
  case 'budget':
293
332
  setBudget(ctx);
294
333
  return;
334
+ case 'rounds':
335
+ roundsCommand(ctx);
336
+ return;
295
337
  default:
296
338
  ctx.notify('warn', `Unknown argument "${verb}". ${USAGE}`);
297
339
  }
@@ -100,7 +100,7 @@ export declare const COMPACTION_CONFIG_SET_KEYS: readonly ["compaction.enabled",
100
100
  * Config keys under `governance.` that `aragon config set` accepts (governance-mode 11.1).
101
101
  * Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
102
102
  */
103
- export declare const GOVERNANCE_CONFIG_SET_KEYS: readonly ["governance.enabled", "governance.shiftTab", "governance.panel", "governance.profile", "governance.maxWorkPackages", "governance.maxPhases", "governance.maxRework", "governance.maxFixCycles", "governance.minAskRounds", "governance.budgetTokens", "governance.confirmCharter"];
103
+ export declare const GOVERNANCE_CONFIG_SET_KEYS: readonly ["governance.enabled", "governance.shiftTab", "governance.panel", "governance.profile", "governance.maxWorkPackages", "governance.maxPhases", "governance.maxRework", "governance.maxFixCycles", "governance.minAskRounds", "governance.budgetTokens", "governance.confirmCharter", "governance.rounds", "governance.arrowRounds"];
104
104
  /**
105
105
  * Config keys under `memory.` that `aragon config set` accepts (agent-memory spec 5.6).
106
106
  * Every key is writable and ONE level deep, so `runConfigGet`'s single-dot split resolves it.
@@ -16,6 +16,7 @@ import { loadPersistedConfig, updatePersistedConfig } from './store.js';
16
16
  import { normalizeModelProfiles, validateModelProfiles } from '@aragon-agent/tui/model/config/model-profiles';
17
17
  import { clampFastConfig, clampRetryConfig, clampCompactionConfig, clampTeamConfig, parseThresholdInput, clampUpdateConfig, coercePositiveInt, maskSecret, DEFAULT_FAST_CONFIG, DEFAULT_RETRY_CONFIG, DEFAULT_TEAM_CONFIG, DEFAULT_COMPACTION_CONFIG, DEFAULT_UPDATE_CONFIG, DEFAULT_JOBS_CONFIG, clampJobsConfig, clampGovernanceConfig, clampMemoryConfig, clampGeneConfig, DEFAULT_GOVERNANCE_CONFIG, DEFAULT_MEMORY_CONFIG, DEFAULT_GENE_CONFIG, } from '@aragon-agent/tui/model/config/schema';
18
18
  import { clampLogLevel } from '@aragon-agent/tui/model/logging/levels';
19
+ import { parseRoundBudget } from '@aragon-agent/tui/model/governance/rounds';
19
20
  /** Config keys under `log.` that `aragon config set` accepts. */
20
21
  export const LOG_CONFIG_SET_KEYS = [
21
22
  'log.level',
@@ -204,6 +205,8 @@ export const GOVERNANCE_CONFIG_SET_KEYS = [
204
205
  'governance.minAskRounds',
205
206
  'governance.budgetTokens',
206
207
  'governance.confirmCharter',
208
+ 'governance.rounds',
209
+ 'governance.arrowRounds',
207
210
  ];
208
211
  /**
209
212
  * Config keys under `memory.` that `aragon config set` accepts (agent-memory spec 5.6).
@@ -419,7 +422,25 @@ export function applyGeneConfigSet(key, value) {
419
422
  });
420
423
  return { gene: { [field]: clamped[field] } };
421
424
  }
425
+ /**
426
+ * `rounds` is the one TRI-STATE key in this section, so the default's runtime type (`object`
427
+ * for `null`) cannot decide how to parse it: a typed `auto` would become the string
428
+ * `"auto"`, which `clampGovernanceConfig` repairs to `null` only by luck, and `banana`
429
+ * would look like a deliberate value. `parseRoundBudget` says what happened instead.
430
+ */
431
+ function parseRoundArgument(value) {
432
+ const parsed = parseRoundBudget(value);
433
+ if (parsed.ok)
434
+ return parsed.value;
435
+ // `99` is a NUMBER, just too large: the clamp caps it at `hardMaxRounds`, exactly like
436
+ // `maxRework 99` becomes 5. Only text that is not a number at all becomes NaN, which the
437
+ // clamp repairs to AUTO - the "typo changes nothing" rule every other key here follows.
438
+ const text = value.trim();
439
+ return /^\d+$/.test(text) ? Number(text) : Number.NaN;
440
+ }
422
441
  function parseGovernanceArgument(field, value) {
442
+ if (field === 'rounds')
443
+ return parseRoundArgument(value);
423
444
  const kind = typeof DEFAULT_GOVERNANCE_CONFIG[field];
424
445
  const trimmed = value.trim();
425
446
  if (kind === 'boolean')
@@ -737,6 +758,11 @@ function displayOverride(key, value) {
737
758
  // bare `null` sends the user looking for a bug that is not there.
738
759
  if (key === 'contextWindow' && value === null)
739
760
  return 'auto';
761
+ // `governance.rounds: null` is AUTO too. `config view` keeps printing the raw `null` (it
762
+ // mirrors the file); `get` and `list` are the human forms, and two presentations of one
763
+ // value are still one value (governance-round-budget 6.1).
764
+ if (key === 'governance.rounds' && value === null)
765
+ return 'auto';
740
766
  return undefined;
741
767
  }
742
768
  /** Resolve a flat or one-level-dotted key against the persisted config. */
@@ -124,8 +124,17 @@ export declare class GeneActivityHub {
124
124
  isPolling(): boolean;
125
125
  /** A local synchronous event happened (search started, learner state changed). */
126
126
  notify(): void;
127
- /** Re-read the file facts now and emit if anything changed. Never rejects. */
127
+ /**
128
+ * Re-read the file facts now and emit if anything changed. Never rejects.
129
+ *
130
+ * A caller that arrives while a read is already running does not settle for that read: it asks
131
+ * for one more pass and shares the promise of the WHOLE chain, so `await refresh()` always means
132
+ * "a read that started after my call has finished". Resolving with the earlier read instead would
133
+ * hand back facts read before the caller's own append landed, and the caller cannot tell.
134
+ */
128
135
  refresh(): Promise<void>;
136
+ /** Read until no caller asked for one more pass while a pass was running. */
137
+ private refreshUntilQuiet;
129
138
  dispose(): void;
130
139
  private startPolling;
131
140
  private stopAll;
package/dist/gene/hub.js CHANGED
@@ -211,7 +211,14 @@ export class GeneActivityHub {
211
211
  notify() {
212
212
  this.requestEmit();
213
213
  }
214
- /** Re-read the file facts now and emit if anything changed. Never rejects. */
214
+ /**
215
+ * Re-read the file facts now and emit if anything changed. Never rejects.
216
+ *
217
+ * A caller that arrives while a read is already running does not settle for that read: it asks
218
+ * for one more pass and shares the promise of the WHOLE chain, so `await refresh()` always means
219
+ * "a read that started after my call has finished". Resolving with the earlier read instead would
220
+ * hand back facts read before the caller's own append landed, and the caller cannot tell.
221
+ */
215
222
  refresh() {
216
223
  if (this.disposed)
217
224
  return Promise.resolve();
@@ -219,14 +226,25 @@ export class GeneActivityHub {
219
226
  this.refreshAgain = true;
220
227
  return this.refreshing;
221
228
  }
222
- this.refreshing = this.refreshOnce().finally(() => {
223
- this.refreshing = null;
224
- if (this.refreshAgain && !this.disposed) {
229
+ const run = this.refreshUntilQuiet();
230
+ this.refreshing = run;
231
+ return run;
232
+ }
233
+ /** Read until no caller asked for one more pass while a pass was running. */
234
+ async refreshUntilQuiet() {
235
+ try {
236
+ for (;;) {
225
237
  this.refreshAgain = false;
226
- void this.refresh();
238
+ await this.refreshOnce();
239
+ // The flag is read and the state cleared with no await in between (the finally
240
+ // runs synchronously with this return), so a later caller starts a pass of its own.
241
+ if (!this.refreshAgain || this.disposed)
242
+ return;
227
243
  }
228
- });
229
- return this.refreshing;
244
+ }
245
+ finally {
246
+ this.refreshing = null;
247
+ }
230
248
  }
231
249
  dispose() {
232
250
  this.disposed = true;
@@ -75,6 +75,14 @@ export declare function govUnavailableNotice(reason: GovernanceUnavailableReason
75
75
  export declare function govBudgetSetNotice(tokens: number): string;
76
76
  export declare const GOV_BUDGET_OFF_NOTICE = "Team token budget removed (unlimited).";
77
77
  export declare const GOV_BUDGET_USAGE = "Usage: /gov budget <tokens>|off";
78
+ /**
79
+ * The upper bound is INTERPOLATED from `GOV_LIMITS.hardMaxRounds`, never written as a literal:
80
+ * the config layer keeps that discipline (it never repeats a `hardMax*`), and a sentence has
81
+ * no reason to be the one place that goes stale when the constant moves.
82
+ */
83
+ export declare const GOV_ROUNDS_USAGE: string;
84
+ /** `/gov rounds <n>`: what was WRITTEN (the clamp runs before this sentence is built). */
85
+ export declare function govRoundsSetNotice(rounds: number | null): string;
78
86
  export interface GovStatusRun {
79
87
  runId: string;
80
88
  /** 1-based. */
@@ -122,6 +122,21 @@ export function govBudgetSetNotice(tokens) {
122
122
  }
123
123
  export const GOV_BUDGET_OFF_NOTICE = 'Team token budget removed (unlimited).';
124
124
  export const GOV_BUDGET_USAGE = 'Usage: /gov budget <tokens>|off';
125
+ // --- round budget (governance-round-budget 4.6 / 6.2) ------------------------------------
126
+ /**
127
+ * The upper bound is INTERPOLATED from `GOV_LIMITS.hardMaxRounds`, never written as a literal:
128
+ * the config layer keeps that discipline (it never repeats a `hardMax*`), and a sentence has
129
+ * no reason to be the one place that goes stale when the constant moves.
130
+ */
131
+ export const GOV_ROUNDS_USAGE = `Usage: /gov rounds <n|auto> (0-${GOV_LIMITS.hardMaxRounds}, auto = the engine decides)`;
132
+ /** `/gov rounds <n>`: what was WRITTEN (the clamp runs before this sentence is built). */
133
+ export function govRoundsSetNotice(rounds) {
134
+ if (rounds === null)
135
+ return 'Round budget set to auto: the engine decides per plan.';
136
+ if (rounds === 0)
137
+ return 'Round budget set to 0: the first rejection comes straight to you.';
138
+ return `Round budget set to ${rounds} round${rounds === 1 ? '' : 's'} per run.`;
139
+ }
125
140
  /** The `/gov` and `/gov status` notice. */
126
141
  export function formatGovStatus(input) {
127
142
  const lines = [`Posture: ${POSTURE_LABEL[input.posture]}`];
@@ -184,7 +199,7 @@ export function buildGovHelpText(minAskRounds = 2) {
184
199
  '',
185
200
  'Commands',
186
201
  ' /gov status | on | plan | off | board | runs | resume [id] | abort | budget <n|off> | help',
187
- ' /gov pause [cancel] | report [id]',
202
+ ' /gov rounds <n|auto> | pause [cancel] | report [id]',
188
203
  '',
189
204
  'Team fan-out versus governance',
190
205
  ' /team and the task tool fan out independent subtasks in parallel and the lead',