export type UsageHarnessId = 'opencode' | 'claude' | 'codex' | 'gemini' | 'antigravity' | 'copilot' | 'cursor' | 'goose' | 'openhands' | 'aider' | 'cline' | 'openrouter'; export interface UsageSession { title: string; model: string; providerID: string; /** Which harness recorded this session. */ harness: string; cost: number; /** True when cost came from the price catalogue, not the harness itself. */ costEstimated: boolean; /** False when the model has no catalogue price — cost is 0, tokens are real. */ costKnown: boolean; tokensInput: number; tokensOutput: number; tokensReasoning: number; tokensCacheRead: number; tokensCacheWrite: number; timeCreated: number; timeUpdated: number; durationMin: number; attribution: 'user' | 'agent'; teamshare: boolean; } export interface UsageHarnessInfo { id: string; label: string; /** False when this machine has no local usage store for the harness. */ available: boolean; /** Why it is unavailable (only when available === false). */ reason?: string; /** 'recorded' = the harness stored the cost; 'estimated' = catalogue price. */ costSource: 'recorded' | 'estimated' | 'unavailable'; sessions: number; cost: number; tokens: { input: number; output: number; }; } export interface UsageReport { day: string; /** The harness this report covers ('all' when several were read). */ harness: string; dbPath: string; /** Local source path per harness that was read. */ sources: Record; provider: string; totalCost: number; sessionCount: number; userCost: number; agentCost: number; teamshareCost: number; /** Sessions with real tokens but no catalogue price. */ unpricedSessions: number; /** Present when a single requested harness has no local store. */ notice?: string; harnesses: UsageHarnessInfo[]; totalsByHarness: Record; tokens: { input: number; output: number; reasoning: number; cacheRead: number; cacheWrite: number; }; sessions: UsageSession[]; } export interface UsageOptions { day?: string; agent?: string; /** One harness id, or 'all' (default) for every supported harness. */ harness?: string; /** Legacy alias for harness (opencode/codex only). */ provider?: 'opencode' | 'codex'; /** Override for tests — defaults to the OS home directory. */ homeDir?: string; } interface HarnessDef { id: UsageHarnessId; label: string; /** True when a reader below can produce numbers for it. */ supported: boolean; costSource: 'recorded' | 'estimated' | 'unavailable'; unavailableReason?: string; } export declare const USAGE_HARNESSES: HarnessDef[]; export declare const SUPPORTED_USAGE_HARNESSES: UsageHarnessId[]; export declare function todayLocalDay(): string; export declare function dayBounds(day: string): { startMs: number; endMs: number; }; /** * Estimate a session/message cost from the catalogue. Returns cost 0 with * known=false when the model has no price — the caller still reports tokens. * `style` decides how cached input is charged: claude reports cache tokens * separately from input; codex `input_tokens` already include the cached * ones, so only the fresh remainder is charged at the input rate. */ export declare function estimateModelCost(modelId: string, tokens: { input: number; output: number; cacheRead: number; cacheWrite: number; }, style: 'claude' | 'codex', home?: string): { cost: number; known: boolean; }; export declare function readOpencodeSessions(day: string, agentFilter: string | null, home?: string): { sessions: UsageSession[]; source: string; }; export declare function readClaudeSessions(day: string, agentFilter: string | null, home?: string): { sessions: UsageSession[]; source: string; }; export declare function readCodexSessions(day: string, agentFilter: string | null, home?: string): { sessions: UsageSession[]; source: string; }; /** * Read one harness (or 'all' supported harnesses) for a local day. * Each harness is its own report slice: sessions carry `harness`, * `costEstimated` and `costKnown`, and the UI switches between them. * Throws when no local store exists for an explicitly requested harness. */ export declare function readUsageReport(opts?: UsageOptions): UsageReport; export {};