import { type ModelUsageTotals } from '@moxxy/sdk'; /** * Cross-session token usage, persisted at ~/.moxxy/usage.json. A forward-going * aggregate keyed by `"/"`: each session folds its own * `provider_response` usage and merges the delta in on shutdown (see * `@moxxy/plugin-usage-stats`). Purely additive counters — no derived/cost * fields — so a session's contribution is added once and the file stays a sum. * * Like preferences, this is best-effort: a missing or malformed file reads as * empty, and a write failure never blocks shutdown. */ export interface StoredModelUsage extends ModelUsageTotals { /** ISO timestamp of the first session that recorded usage for this model. */ readonly firstSeen: string; /** ISO timestamp of the most recent session that recorded usage. */ readonly lastSeen: string; } export interface UsageStatsFile { readonly version: 1; /** ISO timestamp of the last merge/clear. */ readonly updatedAt: string; /** Per-`provider/model` lifetime totals. */ readonly models: Record; } export declare function usageStatsPath(): string; /** * Read the usage aggregate. Returns an empty file when missing or unparseable — * usage stats are an optional, non-load-blocking layer. */ export declare function loadUsageStats(filePath?: string): Promise; /** * Merge a session's per-model delta into the persisted aggregate and write it * back. Reads the current file, adds each delta field-wise, refreshes * first/lastSeen, and writes atomically. Returns the updated file. * * Best-effort: a write failure logs to stderr but does not throw — losing one * session's stats must never block shutdown. */ export declare function mergeUsageStats(delta: Record, filePath?: string): Promise; /** * Reset the aggregate to empty (the user-facing `/usage clear`). Runs inside the * same `mergeMutex` as `mergeUsageStats` so a clear can't interleave with an * in-flight merge's read-modify-write — otherwise the merge could write its * stale-plus-delta snapshot back after the clear lands and resurrect the cleared * aggregate (or the clear could clobber a concurrent merge). */ export declare function clearUsageStats(filePath?: string): Promise; //# sourceMappingURL=usage-stats.d.ts.map