import type { Api, Model } from "@earendil-works/pi-ai/compat";
declare module "@earendil-works/pi-ai/compat" {
    interface Model<TApi extends Api> {
        /** Selectable context-window sizes for this model. The scalar contextWindow remains the default/effective value. */
        contextWindowOptions?: readonly number[];
        /** Original/default scalar context window, preserved when contextWindow is overridden for a session. */
        defaultContextWindow?: number;
        /**
         * Hard prompt/input cap for providers (e.g. GitHub Copilot `max_prompt_tokens`) that enforce an
         * input budget below the displayed context window. When set and below `contextWindow`, it is the
         * effective input budget for compaction thresholds and overflow recovery; `contextWindow` remains
         * the displayed/branded window.
         */
        maxInputTokens?: number;
    }
}
export interface ContextWindowParseResult {
    value?: number;
    error?: string;
}
export interface ContextWindowSelection<TApi extends Api = Api> {
    model: Model<TApi>;
    contextWindow: number;
}
export interface ContextWindowSelectionError {
    error: string;
}
export interface ContextWindowSelectionOptions {
    /**
     * GitHub Copilot advertises some long-context tiers below their branded 1M size
     * (for example 936k or 922k input tokens). When enabled, a request above an
     * advertised long tier selects the largest supported Copilot window not
     * exceeding the request, but never silently falls back to the model's base
     * window.
     */
    allowCopilotLongContextFallback?: boolean;
}
export declare function validateContextWindowValue(value: number): string | undefined;
export declare function parseContextWindowValue(input: string): ContextWindowParseResult;
export declare function formatContextWindow(value: number): string;
export declare function normalizeContextWindowOptions(values: readonly number[] | undefined): number[];
export declare function getModelDefaultContextWindow(model: Model<Api>): number;
/**
 * Effective input-token budget for compaction/overflow decisions. Equals the displayed
 * `contextWindow` unless a smaller hard input cap (`maxInputTokens`, e.g. GitHub Copilot's
 * `max_prompt_tokens`) is advertised, in which case the lower of the two is used. This lets a model
 * display its full/branded window while compaction and overflow recovery respect the real,
 * server-enforced input limit.
 */
export declare function getEffectiveInputBudget(model: Model<Api>): number;
export declare function getSupportedContextWindows(model: Model<Api>): number[];
export declare function withContextWindowOptions<TApi extends Api>(model: Model<TApi>, contextWindowOptions: readonly number[]): Model<TApi>;
export declare function selectContextWindow<TApi extends Api>(model: Model<TApi>, contextWindow: number, options?: ContextWindowSelectionOptions): ContextWindowSelection<TApi> | ContextWindowSelectionError;
//# sourceMappingURL=context-window.d.ts.map