/** * Pure metric folding for dsh-eval: one pass over a session trace produces * the automatic metric set, and pricing converts provider token buckets into * USD. The fold mirrors session-stats wall-time semantics and adds the * eval-owned failure and retry counters. * * @module dsh-eval/metrics */ import type { SessionEvent } from '@deepseek-ai/dsh-session'; import type { BenchmarkPricing, EvalCaseMetrics, EvalTokenUsage } from './types.ts'; /** * Fold a session trace into automatic metrics without pricing. * @param events - the trace's durable events in log order. * @returns the folded metrics with `costUsd: null`. */ export declare function foldMetrics(events: readonly SessionEvent[]): EvalCaseMetrics; /** * Convert token buckets into USD using per-million-token prices. * @param tokens - summed token buckets. * @param pricing - per-million-token USD prices. * @returns the estimated cost in USD. */ export declare function computeCost(tokens: EvalTokenUsage, pricing: BenchmarkPricing): number; /** * Fold metrics and attach cost when a pricing table entry exists. * @param events - the trace's durable events in log order. * @param pricing - the benchmark model's pricing, or undefined for no cost. * @returns the folded metrics. */ export declare function computeMetrics(events: readonly SessionEvent[], pricing: BenchmarkPricing | undefined): EvalCaseMetrics; /** * Aggregate per-trial metrics: arithmetic means for counts and wall times, * pooled success rate, and the mean cost when every trial priced it. * @param items - completed trials' metrics. * @returns the aggregate, or null when no trial is included. */ export declare function aggregateMetrics(items: readonly EvalCaseMetrics[]): EvalCaseMetrics | null;