/** * usage.ts — Token usage: shapes, accumulator operators, session-stats readers. */ /** * Lifetime usage components, accumulated via `message_end` events. Survives * compaction. cacheRead is excluded because each turn's cacheRead is * the cumulative cached prefix re-read on that one call. */ export interface LifetimeUsage { input: number; output: number; cacheWrite: number; } /** Sum of lifetime usage components, or 0 if undefined. */ export declare function getLifetimeTotal(u?: LifetimeUsage): number; /** Add a usage delta into a target accumulator (mutates target). */ export declare function addUsage(into: LifetimeUsage, delta: LifetimeUsage): void; /** Minimal shape we read from upstream `getSessionStats()`. */ export interface SessionStatsLike { tokens: { input: number; output: number; cacheWrite: number; }; contextUsage?: { percent: number | null; }; } export interface SessionLike { getSessionStats(): SessionStatsLike; } /** * Session-scoped token count: input + output + cacheWrite as reported by * upstream `getSessionStats().tokens` for the *current* session window. * * RESETS at compaction. For a lifetime total, use `getLifetimeTotal`. */ export declare function getSessionTokens(session?: SessionLike): number; /** * Context-window utilization (0–100), or null when unavailable. */ export declare function getSessionContextPercent(session?: SessionLike): number | null;