/**
 * OwlCoda Native Token/Usage Tracker
 *
 * Tracks token usage across conversation turns.
 * Uses the heuristic estimator (chars/4) since local models
 * may not report usage in the Anthropic format.
 */
export interface TokenUsage {
    inputTokens: number;
    outputTokens: number;
    requestCount?: number;
}
export interface UsageSnapshot {
    /** Cumulative input tokens across all turns */
    totalInputTokens: number;
    /** Cumulative output tokens across all turns */
    totalOutputTokens: number;
    /** Number of API calls made */
    requestCount: number;
    /** Total tokens (input + output) */
    totalTokens: number;
    /** Estimated cost in USD (fictional — local models are free) */
    estimatedCostUsd: number;
    /** Time of first request */
    startedAt: number | null;
    /** Elapsed time in ms since first request */
    elapsedMs: number;
}
export interface ConversationTokenBreakdown {
    systemTokens: number;
    userTextTokens: number;
    assistantTextTokens: number;
    toolUseTokens: number;
    toolResultTokens: number;
    turnTokens: number;
    totalTokens: number;
}
export interface ContextBudgetSnapshot {
    contextWindow: number;
    usedTokens: number;
    remainingTokens: number;
    usageRatio: number;
    thresholdRatio: number;
    thresholdTokens: number;
    overThreshold: boolean;
    outputMaxTokens?: number;
    breakdown: ConversationTokenBreakdown;
}
export interface FormatBudgetOptions {
    outputMaxTokens?: number;
    breakdown?: ConversationTokenBreakdown;
    thresholdRatio?: number;
    includeBreakdown?: boolean;
    includeDisplayNote?: boolean;
}
/** Heuristic token estimation: ~4 characters per token. */
export declare function estimateTokens(text: string): number;
type ConversationForUsage = {
    system: string;
    turns: Array<{
        role?: string;
        content: unknown[];
    }>;
};
/** Estimate tokens for a conversation's full context with category totals. */
export declare function estimateConversationTokenBreakdown(conversation: ConversationForUsage): ConversationTokenBreakdown;
/** Estimate tokens for a conversation's full context. */
export declare function estimateConversationTokens(conversation: ConversationForUsage): {
    systemTokens: number;
    turnTokens: number;
    totalTokens: number;
};
export declare function buildContextBudgetSnapshot(conversation: ConversationForUsage, contextWindow: number, options?: {
    outputMaxTokens?: number;
    thresholdRatio?: number;
}): ContextBudgetSnapshot;
/** Format context budget display. */
export declare function formatBudget(usedTokens: number, contextWindow: number, options?: FormatBudgetOptions): string;
/**
 * Usage tracker accumulates token counts across conversation turns.
 */
export declare class UsageTracker {
    private inputTokens;
    private outputTokens;
    private requestCount;
    private startedAt;
    /** Record usage from one API response. */
    recordUsage(usage: TokenUsage): void;
    /** Record usage by estimating from text content. */
    recordEstimated(inputText: string, outputText: string): void;
    /** Get current usage snapshot. */
    getSnapshot(): UsageSnapshot;
    /** Reset all counters. */
    reset(): void;
    /** Format usage for display. */
    formatUsage(): string;
}
export {};
