/** * Context Budgeter - Token budget management * * Manages token allocation across context components. */ /** * Budget allocation */ export interface BudgetAllocation { id: string; name: string; allocated: number; used: number; priority: number; } /** * Budgeter configuration */ export interface ContextBudgeterConfig { /** Total token budget */ totalBudget: number; /** Reserved for response */ responseReserve?: number; /** Allocation strategy */ strategy?: 'proportional' | 'priority' | 'fixed'; /** Token estimation ratio */ tokenRatio?: number; } /** * ContextBudgeter - Manage token budgets */ export declare class ContextBudgeter { readonly id: string; private totalBudget; private responseReserve; private strategy; private tokenRatio; private allocations; constructor(config: ContextBudgeterConfig); /** * Get available budget */ getAvailable(): number; /** * Request allocation */ allocate(name: string, requested: number, priority?: number): BudgetAllocation | null; /** * Use tokens from allocation */ use(allocationId: string, tokens: number): boolean; /** * Release allocation */ release(allocationId: string): boolean; /** * Estimate tokens for text */ estimateTokens(text: string): number; /** * Check if text fits in allocation */ fits(allocationId: string, text: string): boolean; /** * Evict lower priority allocations */ private evictLowerPriority; /** * Get all allocations */ getAllocations(): BudgetAllocation[]; /** * Get stats */ getStats(): { totalBudget: number; responseReserve: number; allocated: number; used: number; available: number; allocationCount: number; }; /** * Clear all allocations */ clear(): void; } /** * Create context budgeter */ export declare function createContextBudgeter(config: ContextBudgeterConfig): ContextBudgeter; export default ContextBudgeter;