/** * agents/turn-budget.ts * * Resolving the per-agent turn ceiling as a real, configurable feature rather * than a hardcoded constant, and naming the budget-exhaustion outcome so wire * consumers can read it instead of regex-matching a prose string. * * Resolution order (mirrors the orchestration spawn-policy cap machinery so the * two never fight): a per-spawn override wins over the config default, but the * policy cap always wins over the override, a caller cannot lift the ceiling * past agents.maxTurnsCap. The resolved budget carries WHICH input applied so * the failure outcome can report it (default / spawn-override / policy-bound). */ /** The machine-readable outcome kind for a run that spent its whole turn budget. */ export declare const TURN_BUDGET_EXHAUSTED: "max_turns"; export type TurnBudgetExhausted = typeof TURN_BUDGET_EXHAUSTED; /** Which input determined the applied turn budget. */ export type TurnBudgetSource = 'default' | 'spawn-override' | 'policy-bound'; export interface ResolvedTurnBudget { /** The turn ceiling that actually applies to the run. */ readonly limit: number; /** Which input set it, for the honest turn-budget-exhausted outcome. */ readonly source: TurnBudgetSource; } export interface ResolveTurnBudgetInput { /** The configured default (agents.maxTurns). */ readonly configDefault: number; /** A per-spawn override, if the spawn requested one. */ readonly spawnOverride?: number | undefined; /** The hard cap a spawn override cannot exceed (agents.maxTurnsCap). */ readonly policyCap: number; } /** * Resolve the applied turn budget and its provenance. A spawn override above the * policy cap is clamped to the cap and reported as `policy-bound`; a valid * override at or below the cap is `spawn-override`; no override is `default`. */ export declare function resolveTurnBudget(input: ResolveTurnBudgetInput): ResolvedTurnBudget; /** The human-readable turn-limit error string, unchanged prose, so nothing that reads it breaks. */ export declare function formatTurnLimitError(limit: number): string; /** Recognize a turn-budget-exhausted failure from its prose message (compat with the classifier). */ export declare function isTurnBudgetExhaustedMessage(message: string): boolean; //# sourceMappingURL=turn-budget.d.ts.map