import type { ApiUsageSnapshot, ContextSource } from '../types/core.js';
export interface ContextUsageResult {
    percent: number;
    source: ContextSource;
}
/**
 * Decide the context-usage percentage and its provenance.
 *
 * The provider-reported total is the ground truth for everything it covers
 * (system prompt + tool definitions + history up to the snapshot). Rather than
 * discarding it the moment a new message arrives, we *anchor* on it and add a
 * client-side estimate of only the messages appended since (`estimatedTailTokens`,
 * which the caller also folds the in-flight streaming count into). That keeps the
 * accurate base for the bulk of the context and estimates only the small, fresh
 * tail — so the figure tracks the API closely turn to turn instead of swinging
 * between a 100%-API and a 100%-estimate number.
 *
 * Fallbacks:
 * - No usable snapshot, or one captured against a *longer* conversation than we
 *   currently have (e.g. just after a clear) → the full client-side estimate.
 * - A snapshot whose `atMessageCount` matches the conversation needs no tail.
 *
 * The tail only flips the source to `api+estimate` (and thus shows the `~`
 * marker) when it actually moves the rounded percentage; a just-typed short
 * message that rounds away stays labelled `api`.
 */
export declare function resolveContextUsage(params: {
    estimatedTotalTokens: number;
    estimatedTailTokens: number;
    apiSnapshot: ApiUsageSnapshot | null;
    currentMessageCount: number;
    contextLimit: number;
}): ContextUsageResult;
//# sourceMappingURL=context-source.d.ts.map