/** A single spend observation. Append-only; never mutated in place. */
export interface SpendEntry {
    /** Run identifier — groups multiple usage observations from one dispatch. */
    runId: string;
    /** Agent id (claude, codex, ...). The cross-vendor attribution key. */
    agent: string;
    /** Project key (absolute path or repo slug). Empty string when unknown. */
    project: string;
    /** Local calendar day, YYYY-MM-DD. */
    day: string;
    /** Model id as reported by the stream (may carry vendor prefix / date suffix). */
    model: string;
    inputTok: number;
    outputTok: number;
    /** Combined cache read + creation tokens (kept as one field for the ledger). */
    cacheTok: number;
    /** USD cost of THIS observation, via actualCost() at write time. */
    costUsd: number;
    /** Where the spend came from: local run, teams teammate, or cloud dispatch. */
    source: 'run' | 'teams' | 'cloud';
    /** ISO timestamp of the observation. */
    ts: string;
}
/** Token bundle for a single observation (matches session/parse usage fields). */
export interface UsageObservation {
    model?: string;
    inputTokens?: number;
    outputTokens?: number;
    cacheReadTokens?: number;
    cacheCreationTokens?: number;
}
/** Default ledger path: <history>/spend/ledger.jsonl. */
export declare function defaultLedgerPath(): string;
/** Local YYYY-MM-DD for a Date (defaults to now). Local, not UTC — caps are a human-day notion. */
export declare function localDay(d?: Date): string;
/**
 * Append one spend observation. Computes `costUsd` from the usage via the
 * canonical pricing module (unpriced models contribute $0). Returns the written
 * entry. Creates the spend dir on first write.
 */
export declare function recordSpend(input: {
    runId: string;
    agent: string;
    project?: string;
    model: string;
    usage: UsageObservation;
    source: SpendEntry['source'];
    ts?: Date;
}, ledgerPath?: string): SpendEntry;
/** Load every entry. Skips malformed lines (a half-written final line never breaks a rollup). */
export declare function loadLedger(ledgerPath?: string): SpendEntry[];
/** Total USD spend on a given local day across ALL agents (cross-vendor). */
export declare function spendForDay(day: string, ledger?: SpendEntry[]): number;
/** Total USD spend on a given day for ONE agent (per-agent cap accounting). */
export declare function spendForAgentDay(agent: string, day: string, ledger?: SpendEntry[]): number;
/** Total USD spend attributed to an agent across all time. */
export declare function spendForAgent(agent: string, ledger?: SpendEntry[]): number;
/** Total USD spend attributed to a project across all time (cross-vendor). */
export declare function spendForProject(project: string, ledger?: SpendEntry[]): number;
/** Total USD spend for a single run id (all of its usage observations). */
export declare function spendForRun(runId: string, ledger?: SpendEntry[]): number;
