/** * Token cap gate — the process-wide hook the delivery and wake paths ask * "may this agent start a new turn?". Kept apart from the service so the * hot paths (agent registration, the orc queue processor, the owner-message * watchdog) import a tiny module with no dependencies of its own. * * specs/2026-10-02-spend-cap.md * * @module services/spend/spend-cap.gate */ /** Why an agent may not start a new turn today. */ export interface SpendStop { session: string; /** `agent`: its own cap; `team`: its team's cap; `total`: the all-agents cap */ scope: 'agent' | 'team' | 'total'; /** The cap in force (tokens, boosts included) */ capTokens: number; /** Tokens used today against it */ usedTokens: number; /** For a team stop: the team */ teamId?: string; teamName?: string; } /** What the service exposes to the gate. */ export interface SpendCapGate { /** The stop in force for a session, or null when it may run */ stopOf(session: string): SpendStop | null; /** Owner-facing name of a session ("Orc", "Ella") */ displayNameOf?(session: string): string; } /** * Install (or clear) the gate. * * @param next - Gate, or null */ export declare function setSpendCapGate(next: SpendCapGate | null): void; /** * The stop in force for a session. Never throws: a broken gate lets the * agent run rather than silently dropping its work. * * @param session - Agent session * @returns Stop, or null */ export declare function spendCapStopOf(session: string): SpendStop | null; /** * Owner-facing name of a session. * * @param session - Agent session * @returns Name (the session name when unknown) */ export declare function spendCapNameOf(session: string): string; /** * The one-line reason, e.g. "Orc hit its daily token cap (5M tokens)". * * @param stop - The stop * @param name - Owner-facing name (default: looked up) * @returns Reason text */ export declare function spendCapReason(stop: SpendStop, name?: string): string; //# sourceMappingURL=spend-cap.gate.d.ts.map