/**
 * TokenBudgetTracker - In-memory per-session token budget tracker
 * Singleton per project (same pattern as MemoryManager)
 * Provides predictive overflow prevention with threshold-based warnings
 */
export type TokenSource = 'session_rag' | 'memory' | 'agent' | 'compression' | 'tool_call' | 'user_prompt' | 'system';
export type ThresholdLevel = 'none' | 'soft' | 'medium' | 'hard' | 'critical';
export interface BudgetSnapshot {
    totalBudget: number;
    consumed: number;
    remaining: number;
    usagePercent: number;
    level: ThresholdLevel;
    bySource: Record<TokenSource, number>;
    crossings: ThresholdCrossing[];
}
export interface ActionEstimate {
    action: string;
    estimatedTokens: number;
    wouldCrossThreshold: boolean;
    resultingLevel: ThresholdLevel;
    resultingPercent: number;
}
interface ThresholdCrossing {
    level: ThresholdLevel;
    crossedAt: number;
    timestamp: string;
}
export type ThresholdCallback = (level: ThresholdLevel, snapshot: BudgetSnapshot) => void | Promise<void>;
export declare class TokenBudgetTracker {
    private static instances;
    private static defaultInstance;
    private totalBudget;
    private consumed;
    private bySource;
    private crossings;
    private lastLevel;
    private thresholdCallbacks;
    private circuitBreakerFailures;
    private static readonly MAX_CIRCUIT_FAILURES;
    private constructor();
    static getInstance(projectPath?: string, totalBudget?: number): TokenBudgetTracker;
    trackConsumption(source: TokenSource, tokens: number): ThresholdLevel;
    /**
     * 특정 threshold 도달 시 자동 실행할 콜백 등록.
     * 예: medium(75%) → 자동 압축, hard(85%) → 경고, critical(95%) → 중단
     */
    onThreshold(level: ThresholdLevel, callback: ThresholdCallback): void;
    /** 회로 차단기: 연속 실패 시 콜백 실행 중단 */
    isCircuitOpen(): boolean;
    resetCircuitBreaker(): void;
    private fireCallbacks;
    syncToPercent(percent: number): void;
    getRemainingBudget(): number;
    getUsagePercent(): number;
    estimateAfterAction(action: string, estimatedTokens: number): ActionEstimate;
    shouldThrottle(): boolean;
    getCurrentLevel(): ThresholdLevel;
    getSnapshot(): BudgetSnapshot;
    static estimateTokens(text: string): number;
    reset(): void;
    static resetInstance(): void;
    private createEmptySourceMap;
    private levelForPercent;
    private levelIndex;
}
export {};
//# sourceMappingURL=TokenBudgetTracker.d.ts.map