/** * VasperaMemory Token Metrics * Accurate token counting using tiktoken for measuring context savings */ /** * Count tokens in a string using tiktoken */ export declare function countTokens(text: string): number; /** * Count tokens in an object (JSON serialized) */ export declare function countObjectTokens(obj: unknown): number; /** * Token savings calculation result */ export interface TokenSavings { /** Estimated tokens if user manually provided full context */ naiveEstimate: number; /** Actual tokens in the compressed context we provide */ actualInjected: number; /** Tokens saved (naive - actual) */ tokensSaved: number; /** Percentage reduction */ percentReduction: number; /** Breakdown by category */ breakdown: { decisions: { naive: number; actual: number; }; memories: { naive: number; actual: number; }; errorFixes: { naive: number; actual: number; }; fileContext: { naive: number; actual: number; }; }; } /** * Context data for calculating savings */ export interface ContextData { allDecisions?: Array<{ title: string; content: string; reasoning?: string; }>; allMemories?: Array<{ content: string; reasoning?: string; }>; allErrorFixes?: Array<{ errorMessage: string; rootCause: string; fixDescription: string; preventionRule?: string; }>; fullFileContents?: string[]; injectedDecisions?: Array<{ title: string; content: string; }>; injectedMemories?: Array<{ content: string; }>; injectedErrorFixes?: Array<{ errorMessage: string; fixDescription: string; }>; injectedFileContext?: string; } /** * Calculate token savings from VasperaMemory context compression */ export declare function calculateTokenSavings(data: ContextData): TokenSavings; /** * Estimate naive context size for a typical session * Used when we don't have full data but want to show approximate savings */ export declare function estimateNaiveContextSize(params: { decisionCount: number; memoryCount: number; errorFixCount: number; openFileCount: number; }): number; /** * Format token count for display */ export declare function formatTokenCount(tokens: number): string; /** * Format savings for display */ export declare function formatTokenSavings(savings: TokenSavings): string; /** * Cleanup encoder when done (for long-running processes) */ export declare function cleanupEncoder(): void; //# sourceMappingURL=token-metrics.d.ts.map