Expand description
Task 23 — per-turn budgets (spec §8.1).
Every stream session runs under one TurnBudget: provider rounds,
tool calls, elapsed wall-clock, accumulated tool-result bytes, and the
optional context-token / USD-cost dimensions. Budgets differ by role
(foreground, autonomous/watcher, worker) but share ONE enforcement
mechanism — the TurnBudgetMeter consulted by the stream loop.
Composition note: the chat frontend’s reactor auto-turn cap
(engine::reactor::AUTO_TURN_CAP) limits consecutive auto-triggered
turns ACROSS turns; this budget bounds work WITHIN one turn. They
compose — neither replaces nor duplicates the other.
Structs§
- Turn
Budget - Per-turn limits (spec §8.1).
- Turn
Budget Meter - One turn’s running budget meter. NOT thread-shared: owned by the
stream loop; the only cross-task input is the
UsageCounterscell. - Usage
Counters - Shared provider-usage counters, updated at the single authoritative Usage emission sites in the transport and read by the stream loop for the optional token/cost dimensions. Metadata only.
Enums§
- Turn
Role - Execution role a turn runs under.