/** * 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; cacheRead?: number; total?: number; }; contextUsage?: { percent: number | null; }; } export interface SessionLike { getSessionStats(): SessionStatsLike; } /** * Session-scoped token count: input + output + cacheWrite as reported by * upstream `getSessionStats().tokens`. * * On Pi 0.81+, these totals aggregate assistant, toolResult, compaction, and * branch-summary usage across the session (they do not reset at compaction). * For the orchestrator's own accumulator, 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;