/** * Conservative, streaming token estimator used to drive the live UI counter. * * Typical LLM tokenizers produce ~1 token per 4 characters of English text. We * deliberately use `chars / 5` so the estimate stays below the true count — * the real `tokenUsage` (which includes input and cache tokens we never see on * the wire) always exceeds this running estimate, letting the UI smoothly * count up to the final value without ever reversing. * * `onProgress` is throttled to only fire when the estimate has grown by at * least `MIN_DELTA` tokens, which avoids flooding `onJobUpdate` on very busy * streams. */ export interface TokenEstimator { /** Append assistant text. Triggers `onProgress` when the estimate grows enough. */ addText(text: string): void; /** Current conservative token estimate. */ current(): number; } export declare function createTokenEstimator(onProgress?: (estimatedTokens: number) => void): TokenEstimator; //# sourceMappingURL=token-estimator.d.ts.map