import { BestAgentError } from "@best-agent/foundation";
import type { AutoBudgetReasonCode, ProviderConfig, RequestBudgetSnapshot, SessionTokenUsage } from "@best-agent/protocol";
import { type ConversationMessage, type ProviderCacheControl, type ProviderToolOption, type ProviderUsageStats } from "../provider/model-provider.js";
import type { AgentLoopCompactionAdvisory } from "./agent-loop.js";
export type ProviderRequestBudgetInput = {
    cacheControl?: ProviderCacheControl;
    messages: ConversationMessage[];
    systemPrompt?: string;
    tools?: ProviderToolOption[];
};
export declare function normalizeTokenCount(value: unknown): number | undefined;
export declare function estimateProviderRequestInputTokens(input: ProviderRequestBudgetInput): number;
export declare function estimateConversationInputTokens(messages: ConversationMessage[], systemPrompt?: string): number;
export declare function providerRequestPromptSignature(input: ProviderRequestBudgetInput): string;
export declare function calculateConversationMemoryBudgetTokens(input: {
    estimatedConversationTokens: number;
    estimatedRequestTokens: number;
    inputBudgetTokens: number;
}): number;
export declare function createRequestBudgetSnapshot(providerConfig: ProviderConfig, estimatedInputTokens: number, input: {
    autoBudgetOutcome: RequestBudgetSnapshot["autoBudgetOutcome"];
    autoBudgetReasonCode?: AutoBudgetReasonCode;
}): RequestBudgetSnapshot;
export declare function createRequestBudgetExceededError(snapshot: RequestBudgetSnapshot): BestAgentError;
export declare function canRetryProviderContextOverflow(error: unknown, snapshot: RequestBudgetSnapshot): boolean;
export declare function getCompactionAdvisoryFromSnapshot(snapshot: RequestBudgetSnapshot | undefined, plannedCostEstimate?: number): AgentLoopCompactionAdvisory;
export declare function buildCompactionAdvisorySystemPrompt(snapshot: RequestBudgetSnapshot | undefined): string | undefined;
export declare function appendCompactionAdvisoryToProviderRequest<T extends ProviderRequestBudgetInput & {
    promptLayerOrder: string[];
}>(request: T, snapshot: RequestBudgetSnapshot): T;
export declare function createEmptyRuntimeSessionUsage(): SessionTokenUsage;
export declare function estimateProviderUsage(input: {
    messages: ConversationMessage[];
    responseText: string;
    systemPrompt?: string;
}): ProviderUsageStats;
export declare function estimateTextTokens(text?: string): number;
//# sourceMappingURL=provider-request-budget.d.ts.map