/**
 * Per-run and per-thread token-usage accumulator. The runtime feeds parent and
 * child agent loop events here; completed runs emit immutable run-stats entries
 * back to the host.
 */
import type { RunStatsEntry, RunStatsModelUsage, RunStatsSnapshot, RunStatsTokenUsageByModel } from '../contracts/run-stats.js';
import type { AgentLoopEvent } from '../core/core-types.js';
import type { SessionEntry } from '../core/session-schema.js';
export type { RunStatsEntry, RunStatsModelUsage, RunStatsSnapshot, RunStatsTokenUsageByModel };
/** Per-turn config stamped on the run-stats entry, captured at run-start post-swap. */
export interface RunStatsRunConfig {
    readonly modelName?: string;
    readonly effortLevel?: 'low' | 'medium' | 'high' | 'max';
    readonly speed?: 'fast' | 'standard';
}
export interface RunStatsAccumulator {
    handle(event: AgentLoopEvent): void;
    /** Subagent assistant `message_end` rolls usage into parent totals; other kinds no-op. */
    handleChildEvent(event: AgentLoopEvent): void;
    /** Active run id between `agent_start` and `agent_end`; undefined otherwise. */
    getActiveRunId(): string | undefined;
    /** Pre-mint runId before agent.prompt() to beat heartbeat-emit-before-agent_start race. */
    beginRun(): string;
    /** Refresh the active run's stamped config after late per-turn wiring settles. */
    refreshRunConfig(): void;
    /** Discard activeRun without emitting; for abort-before-agent_start. */
    abortRun(): void;
    /** Set before `agent.abort()`: the next `agent_end` drops the run without finalizing. */
    markCancelling(): void;
    /** Seed `threadTokenUsage` + `run_number` baseline from prior session entries (hydrate). */
    seedFromHistory(entries: readonly SessionEntry[]): void;
}
export interface CreateRunStatsAccumulatorOptions {
    readonly onRunComplete: (snapshot: RunStatsSnapshot) => void;
    /** Resolved once per run at start time (post-swap, post-override). */
    readonly resolveRunConfig?: () => RunStatsRunConfig;
    readonly mintRunId?: () => string;
    readonly mintMessageId?: () => string;
    readonly now?: () => number;
}
export declare function createRunStatsAccumulator(options: CreateRunStatsAccumulatorOptions): RunStatsAccumulator;
//# sourceMappingURL=run-stats.d.ts.map