/** * EffortPolicy — governed control over the model `effort` lever. * * On frontier models, `effort` (low → max) is the primary dial on per-token * spend: it affects text, tool calls, and thinking. `EffortPolicy` turns that * dial into a policy object — a global ceiling, optional per-agent ceilings, and * an optional justification requirement for the most expensive tiers — so an * orchestrator can cap sub-agents at `low` and require a reason to spend `max`. * * It satisfies the `EffortSink` contract consumed by * {@link ../lib/model-gateway!GovernedModelGateway}, which calls * {@link EffortPolicy.resolve} to clamp each request's effort. * * @module EffortPolicy * @version 1.0.0 * @license MIT */ import type { EffortLevel } from './model-gateway'; /** Construction options for {@link EffortPolicy}. */ export interface EffortPolicyOptions { /** Maximum effort any request may use (default: `'max'`). */ ceiling?: EffortLevel; /** Effort applied when a request omits one (default: `'high'`). */ default?: EffortLevel; /** Per-agent ceilings that override the global ceiling for specific agents. */ perAgent?: Record; /** Effort at or above this tier requires a non-empty justification. */ requireJustificationAtOrAbove?: EffortLevel; } /** Outcome of {@link EffortPolicy.gate}. */ export interface EffortDecision { /** The granted effort level after applying ceilings and justification rules. */ granted: EffortLevel; /** Whether the granted level is below what was requested. */ downgraded: boolean; /** Why the request was downgraded, if it was. */ reason?: 'agent_ceiling' | 'global_ceiling' | 'justification_required'; } /** * Governs the `effort` lever. * * @example * ```typescript * const policy = new EffortPolicy({ * ceiling: 'high', * perAgent: { 'subagent-*': 'low' }, * requireJustificationAtOrAbove: 'xhigh', * }); * * policy.resolve('max', { agentId: 'analyst' }); // → 'high' (global ceiling) * policy.gate('xhigh', { agentId: 'analyst' }).reason; // → 'justification_required' * ``` */ export declare class EffortPolicy { private readonly ceiling; private readonly defaultLevel; private readonly perAgent; private readonly justificationThreshold; constructor(options?: EffortPolicyOptions); /** * Clamp a requested effort to what policy permits. Satisfies `EffortSink`. * * Applies the per-agent (or global) ceiling. Justification rules are not * applied here — use {@link gate} when you have a justification to evaluate. * * @param requested The requested level (falls back to the policy default). * @param ctx `agentId` selects a per-agent ceiling. * @returns The granted effort level. */ resolve(requested: EffortLevel | undefined, ctx?: { agentId?: string; }): EffortLevel; /** * Resolve effort and report whether (and why) it was downgraded — including * the justification requirement for high tiers. * * @param requested The requested level (falls back to the policy default). * @param ctx `agentId` selects a per-agent ceiling; `justification` * unlocks tiers at or above the configured threshold. */ gate(requested: EffortLevel | undefined, ctx?: { agentId?: string; justification?: string; }): EffortDecision; /** The effort ceiling that applies to `agentId` (per-agent, else global). */ private ceilingFor; } //# sourceMappingURL=effort-policy.d.ts.map