/**
 * Shared Run Statistics Calculation
 *
 * This module provides shared logic for calculating benchmark run statistics.
 * Both UI and CLI use these functions to ensure consistent pass/fail counting.
 *
 * The canonical approach is:
 * 1. Get report IDs from run.results[testCaseId].reportId
 * 2. Fetch each report by ID
 * 3. Count passFailStatus from the fetched reports
 *
 * For performance optimization, stats are denormalized onto BenchmarkRun.stats
 * and updated incrementally as test cases complete.
 */
import type { BenchmarkRun, EvaluationReport, RunStats as RunStatsType } from '../types/index.js';
/**
 * Statistics for a benchmark run
 */
export interface RunStats {
    /** Number of test cases that passed (passFailStatus === 'passed') */
    passed: number;
    /** Number of test cases that failed (passFailStatus === 'failed' or execution failed) */
    failed: number;
    /** Number of test cases still pending (running, or report not yet available) */
    pending: number;
    /**
     * Number of test cases where the *evaluator* could not produce a verdict
     * (judge validation error, trace timeout, etc.). Excluded from passed and
     * failed counts so a misconfigured evaluator doesn't poison aggregate
     * pass rates. Issue #242.
     */
    errored: number;
    /** Total number of test cases in the run */
    total: number;
    /**
     * Pass rate as a percentage (0-100). Computed over `total - errored`
     * (the *evaluable* set), not over `total`, so a non-retryable judge
     * failure can't masquerade as the agent scoring 0%.
     */
    passRate: number;
}
/**
 * Calculate statistics for a benchmark run.
 *
 * This function uses the same logic as the UI to count pass/fail status:
 * - Iterates over run.results to get reportIds
 * - Looks up each report in the provided reports map
 * - Counts passFailStatus from completed reports
 *
 * @param run - The benchmark run to calculate stats for
 * @param reports - Map of reportId -> EvaluationReport (pre-fetched)
 * @returns Calculated statistics including passed, failed, pending, total, and passRate
 */
export declare function calculateRunStats(run: BenchmarkRun, reports: Record<string, EvaluationReport | null>): RunStats;
/**
 * Extract all report IDs from a run's results that need to be fetched.
 *
 * @param run - The benchmark run to extract report IDs from
 * @returns Array of unique report IDs
 */
export declare function getReportIdsFromRun(run: BenchmarkRun): string[];
/**
 * Compute stats from a benchmark run and its reports.
 * This is the server-side version that returns the denormalized stats object.
 *
 * @param run - The benchmark run to compute stats for
 * @param reports - Array of reports for this run
 * @returns Denormalized stats object (passed, failed, pending, total)
 */
export declare function computeRunStatsFromReports(run: BenchmarkRun, reports: EvaluationReport[]): RunStatsType;
//# sourceMappingURL=runStats.d.ts.map