/**
 * economy/outcome-tracker — Per-cycle cost accounting, in-memory store.
 *
 * Closes the "agent_run.cost_usd always zero" gap (Sprint 0 v1).
 *
 * Design principles:
 *   • No DB dependency — substrate is product-agnostic.
 *   • Host wires DB persistence via OutcomeHook.
 *   • Cost computed from TierPolicy pricing; unknown models default to 0.
 */
import type { TierPolicy } from "./tier-policy.js";
export interface OutcomeHook {
    /**
     * Called by OutcomeTracker when flush() is invoked for a run.
     * Consumer is responsible for DB persistence or downstream dispatch.
     */
    onCycleEnd(runId: string, cost: CycleCost): Promise<void>;
}
export interface CycleCost {
    runId: string;
    inputTokens: number;
    outputTokens: number;
    /** Computed from TierPolicy pricing. 0 when model pricing is unknown. */
    costUsd: number;
    /** Label of the ModelTier used (e.g. "free", "cheap", "mid", "premium"). */
    modelTier: string;
    durationMs: number;
    /** Sprint C: skill that ran (if known). */
    skillId?: string;
    /** Sprint C: consumer-supplied outcome delta (business value). */
    outcomeValue?: number;
    /** Sprint D: task category for economy router lookups (e.g. "simple"|"standard"|"complex"|"reasoning"). */
    category?: string;
}
/**
 * OutcomeTracker records token usage per cycle and computes cost_usd
 * from the injected TierPolicy.
 *
 * Usage:
 *   const tracker = new OutcomeTracker(policy, hook);
 *   const cost = tracker.record(runId, "litellm/default-fast", 1200, 300, 1800);
 *   await tracker.flush(runId);
 */
export declare class OutcomeTracker {
    private readonly _policy;
    private readonly _hook;
    /** In-memory store: runId → list of CycleCost records. */
    private readonly _store;
    constructor(policy: TierPolicy, hook?: OutcomeHook);
    /**
     * Record tokens used by one cycle.
     *
     * @param runId        - Unique run identifier.
     * @param model        - "provider/model" string, e.g. "litellm/default-fast" or "groq/llama-3.3-70b-versatile".
     * @param inputTokens  - Number of input tokens consumed.
     * @param outputTokens - Number of output tokens produced.
     * @param durationMs   - Wall-clock duration of the cycle.
     * @param opts         - Optional: skillId for Sprint C skill attribution.
     */
    record(runId: string, model: string, inputTokens: number, outputTokens: number, durationMs: number, opts?: {
        skillId?: string;
        outcomeValue?: number;
        category?: string;
    }): CycleCost;
    /**
     * Flush all recorded cycles for a runId to the consumer hook.
     * Noop if no hook is configured or no records exist for the runId.
     */
    flush(runId: string): Promise<void>;
    /**
     * Get all recorded costs, optionally filtered to a trailing time window.
     *
     * @param windowMs - If provided, only return records within the last windowMs milliseconds.
     *                   The tracker uses the current time as the reference point and
     *                   estimates record time by insertion order (no timestamp stored per record).
     *                   For window filtering, use totalCostInWindow() which is time-aware.
     */
    getCosts(windowMs?: number): CycleCost[];
    /**
     * Running total cost (USD) across all recorded cycles within the time window.
     * Default window: last 1 hour (3_600_000 ms).
     *
     * Uses an internal timestamped wrapper to implement accurate windowing.
     */
    totalCostInWindow(windowMs?: number): number;
    /** Timestamped record store for window queries. */
    private readonly _timestamped;
    private _push;
}
//# sourceMappingURL=outcome-tracker.d.ts.map