import { type CacheSavings, type TokenSplit } from "./pricing.js"; /** * Org analytics, normalized from a saved Admin-API export. * * The exact wire shape of the Claude Code usage / skills endpoints is external * and versioned, so {@link parseOrgAnalytics} is a deliberately TOLERANT * anti-corruption layer: it accepts `{data:[…]}`, `{data:[{results:[…]}]}`, or a * bare array, and reads each metric from any of several known field-name variants. * Confirm against live `fetch-analytics.mjs --run` output; if a field is renamed * upstream, this file is the single place to adjust. */ export interface ModelTokens { model: string; tokens: TokenSplit; } export interface SkillStat { name: string; users: number; sessions: number; } export interface OrgAnalytics { window?: { startingAt?: string; endingAt?: string; }; tokens: TokenSplit; byModel: ModelTokens[]; estimatedCostUsd?: number; toolActions?: { accepted: number; rejected: number; }; skills: SkillStat[]; /** How many usage records were folded; 0 → "no usage data in the export". */ records: number; } export interface OrgDigestData extends OrgAnalytics { savings: CacheSavings; } /** * Normalize a saved Admin-API export (`{ usage_report, skills }`, or a bare * usage response) into {@link OrgAnalytics}. Pure: no fs, no network; tolerant * of missing fields so a partial export still yields a useful digest. */ export declare function parseOrgAnalytics(raw: unknown): OrgAnalytics; /** Parse a saved export and attach computed cache savings. */ export declare function aggregateOrg(raw: unknown): OrgDigestData;