/** * Agent Benchmark Database — Store and compare benchmarks over time. * * Provides persistent storage for benchmark results with trend analysis, * run comparison, and dashboard reporting. */ export interface BenchmarkResult { /** Unique run ID (auto-generated if omitted) */ runId?: string; /** Test or suite name */ testName: string; /** Timestamp (ISO string, auto-set if omitted) */ timestamp?: string; /** Pass/fail */ passed: boolean; /** Duration in ms */ duration_ms: number; /** Token usage */ tokens?: { input?: number; output?: number; total?: number; }; /** Estimated cost in USD */ cost_usd?: number; /** Number of steps */ steps?: number; /** Tool calls made */ tools_called?: string[]; /** Model used */ model?: string; /** Arbitrary tags */ tags?: string[]; /** Custom metrics */ metrics?: Record; } export interface StoredBenchmark extends BenchmarkResult { runId: string; timestamp: string; } export interface TrendPoint { timestamp: string; runId: string; duration_ms: number; passed: boolean; tokens_total?: number; cost_usd?: number; } export interface TrendData { testName: string; points: TrendPoint[]; avg_duration_ms: number; min_duration_ms: number; max_duration_ms: number; pass_rate: number; total_runs: number; trend_direction: 'improving' | 'degrading' | 'stable'; } export interface ComparisonResult { run1: string; run2: string; tests: ComparisonEntry[]; summary: { improved: number; degraded: number; unchanged: number; new_tests: number; removed_tests: number; }; } export interface ComparisonEntry { testName: string; run1?: StoredBenchmark; run2?: StoredBenchmark; duration_change_ms?: number; duration_change_pct?: number; status_changed: boolean; verdict: 'improved' | 'degraded' | 'unchanged' | 'new' | 'removed'; } export interface DashboardData { total_runs: number; total_tests: number; overall_pass_rate: number; avg_duration_ms: number; top_slowest: Array<{ testName: string; avg_duration_ms: number; }>; top_flaky: Array<{ testName: string; pass_rate: number; runs: number; }>; recent_runs: Array<{ runId: string; timestamp: string; passed: number; failed: number; }>; cost_total_usd: number; } /** * Persistent benchmark database backed by a JSON file. */ export declare class BenchmarkDB { private dbPath; private data; constructor(dbPath?: string); private load; private save; /** Record a benchmark result. */ record(benchmark: BenchmarkResult): StoredBenchmark; /** Record multiple results at once. */ recordBatch(benchmarks: BenchmarkResult[]): StoredBenchmark[]; /** Get trend data for a specific test over the last N days. */ trend(testName: string, days?: number): TrendData; /** Compare two runs by runId. */ compare(run1: string, run2: string): ComparisonResult; /** Generate dashboard data. */ report(): DashboardData; /** Get all stored benchmarks. */ getAll(): StoredBenchmark[]; /** Get benchmarks for a specific run. */ getRun(runId: string): StoredBenchmark[]; /** List all unique run IDs. */ listRuns(): string[]; /** Clear all data. */ clear(): void; } /** Format a benchmark comparison for display. */ export declare function formatComparison(result: ComparisonResult): string; /** Format dashboard data for console display. */ export declare function formatDashboard(data: DashboardData): string; //# sourceMappingURL=benchmark-db.d.ts.map