import type { AggregateUsage, ChatMessage } from '@genesislcap/foundation-ai';
/**
 * Zeroed {@link AggregateUsage}. A factory, not a shared const, because callers
 * accumulate into the returned object.
 *
 * @internal
 */
export declare function emptyUsage(): AggregateUsage;
/**
 * Total tokens processed — the four buckets added up. Safe to sum because the
 * buckets are disjoint (see {@link AggregateUsage}); the equivalent sum over
 * per-message fields would double-count the prompt.
 *
 * Bear in mind what this number is: because every turn resends the conversation,
 * a turn's prompt is counted again in the next turn's. It is billed throughput,
 * NOT the count of distinct tokens in the conversation, so it grows
 * super-linearly with turn count and is expected to dwarf the context size.
 *
 * @internal
 */
export declare function totalTokens(usage: AggregateUsage): number;
/**
 * `a + b`, per bucket, as a new object.
 *
 * Used to lay a row's banked (pre-transcript) spend over what the live transcript
 * proves. Pure rather than in-place because both operands are live state a caller
 * must not mutate.
 *
 * @internal
 */
export declare function addUsage(a: AggregateUsage, b: AggregateUsage): AggregateUsage;
/**
 * Sum cost and per-bucket token usage across a message list.
 *
 * One walk produces everything a usage display needs, replacing separate cost and
 * token passes over the same (potentially deep) transcript. Recurses into each
 * tool call's `subAgentTrace`, so LLM work a sub-agent did — possibly on another
 * provider at other rates — lands in the total; the driver embeds a whole
 * sub-agent conversation in the parent's tool result, so this is the only place
 * that spend is visible.
 *
 * Splitting the prompt into buckets is the point: `cost` already has the cache
 * discount applied, but a single token total cannot show that a session was cheap
 * because most of its prompt was a cache hit. The three input buckets are derived
 * from the per-message fields, where `inputTokens` is the whole prompt and the
 * cache fields break it down — so uncached input is the remainder, never an
 * addition.
 *
 * Also counts `compaction.rolledUpUsage`: compaction destroys the messages it
 * summarises, and without their banked usage every total re-derived from the
 * transcript would drop by whatever those turns had already spent.
 *
 * Returns a zeroed total when no message carries usage — providers that report
 * none (e.g. Chrome built-in) are skipped silently rather than guessed at.
 *
 * @internal
 */
export declare function sumUsage(messages: readonly ChatMessage[]): AggregateUsage;
//# sourceMappingURL=sum-usage.d.ts.map