/** * Token counting utility using tiktoken (cl100k_base encoding) * * Replaces the rough `Math.ceil(charCount / 4)` heuristic with actual * BPE tokenization for accurate context window management. */ import type { Message } from '../providers/types.js'; /** * Count tokens in a text string using tiktoken. * Falls back to chars/4 heuristic for very large or pathologically repetitive strings. */ export declare function countTokens(text: string): number; /** * Count tokens across an array of messages * * Extracts all text content from messages (text blocks, tool inputs/results, * thinking blocks) and counts tokens using tiktoken. */ export declare function countMessageTokens(messages: Message[]): number;