/**
 * Raw per-session cost counters as stored on disk and accumulated in memory.
 * `cacheHitRate` is intentionally NOT persisted — it is a derived field
 * computed at read time from `cacheReadTokens` and `inputTokens`. See
 * docs/design (Cache-Hit Metric).
 */
export interface RawSessionCost {
    inputTokens: number;
    outputTokens: number;
    cacheReadTokens: number;
    cacheWriteTokens: number;
    totalCost: number;
}
/**
 * Public-facing session cost snapshot. Adds the derived `cacheHitRate`
 * to {@link RawSessionCost}. `cacheHitRate` is `null` when the denominator
 * (`cacheReadTokens + inputTokens`) is 0 — i.e. cold sessions, or providers
 * that do not report cache counters. UI renders `null` as `—`.
 */
export interface SessionCost extends RawSessionCost {
    cacheHitRate: number | null;
}
export interface UsageData {
    inputTokens?: number;
    outputTokens?: number;
    cacheReadTokens?: number;
    cacheWriteTokens?: number;
    cost?: number;
}
/**
 * Derive the cache-hit rate from a raw cost snapshot.
 *
 * Formula: `cacheReadTokens / (cacheReadTokens + inputTokens)`. `cacheWriteTokens`
 * is intentionally excluded — writes are charged at full price and are not hits.
 * Returns `null` when the denominator is 0 so cold sessions render as `—`
 * rather than `0%`.
 */
export declare function deriveCacheHitRate(cost: Pick<RawSessionCost, "inputTokens" | "cacheReadTokens">): number | null;
/** Decorate a raw cost with the derived `cacheHitRate` field. */
export declare function withDerivedFields(raw: RawSessionCost): SessionCost;
/**
 * Tracks cumulative per-session cost/usage data.
 * Persists to .bobbit/state/session-costs.json.
 * Same load-on-construct, write-on-mutate pattern as GoalStore/SessionStore.
 */
export declare class CostTracker {
    private costs;
    private readonly storeDir;
    private readonly storeFile;
    constructor(stateDir: string);
    private load;
    private save;
    /**
     * Add usage data to the cumulative totals for a session.
     * Handles partial usage objects — undefined fields are treated as 0.
     * Returns a snapshot with the derived `cacheHitRate` populated.
     */
    recordUsage(sessionId: string, usage: UsageData): SessionCost;
    getSessionCost(sessionId: string): SessionCost | undefined;
    /**
     * Aggregate cost across multiple sessions (caller provides session IDs).
     * Returns a combined SessionCost with the aggregate `cacheHitRate` derived
     * from the aggregate `cacheReadTokens` and `inputTokens`. Sessions without
     * cost data are skipped.
     */
    getGoalCost(_goalId: string, sessionIds: string[]): SessionCost;
    getAllCosts(): Map<string, SessionCost>;
    removeSession(sessionId: string): void;
}
//# sourceMappingURL=cost-tracker.d.ts.map