/** * CostHeatmap — Per-agent cost & performance overlay for the topology graph. * * Tracks token spend (with configurable USD-per-token rates), latency * percentiles, throughput, and error rates per agent so the dashboard can * render a cost/performance heatmap on top of the topology view. * * @module CostHeatmap */ /** Per-model cost rates (USD per 1K tokens) */ export interface CostRate { inputPer1k: number; outputPer1k: number; } /** Recorded data point for one agent execution */ export interface ExecutionSample { timestamp: number; durationMs: number; inputTokens: number; outputTokens: number; success: boolean; } /** Heatmap cell for a single agent */ export interface HeatmapCell { agentId: string; /** Total estimated cost in USD */ costUsd: number; /** Total tokens consumed (input + output) */ totalTokens: number; /** Number of executions */ executions: number; /** Error count */ errors: number; /** Error rate (0-1) */ errorRate: number; /** Average latency in ms */ avgLatencyMs: number; /** p50 latency ms */ p50LatencyMs: number; /** p95 latency ms */ p95LatencyMs: number; /** p99 latency ms */ p99LatencyMs: number; /** Throughput: executions per minute (over the window) */ throughputPerMin: number; /** Normalized heat value 0-1 (higher = more expensive/slow) */ heat: number; } /** Full heatmap snapshot */ export interface HeatmapSnapshot { timestamp: string; cells: HeatmapCell[]; totalCostUsd: number; totalTokens: number; hottestAgent: string | null; } /** * Tracks per-agent cost and performance for heatmap rendering. * * @example * ```ts * const heatmap = new CostHeatmap(); * heatmap.setCostRate('gpt-4', { inputPer1k: 0.03, outputPer1k: 0.06 }); * heatmap.record('agent-1', { durationMs: 200, inputTokens: 500, outputTokens: 100, success: true }); * const snap = heatmap.getSnapshot(); * ``` */ export declare class CostHeatmap { private samples; private costRates; private agentModels; private defaultRate; private maxSamplesPerAgent; private windowMs; constructor(options?: { /** Max samples to keep per agent. Default 1000 */ maxSamplesPerAgent?: number; /** Time window for throughput calculation (ms). Default 60_000 (1 min) */ windowMs?: number; /** Default cost rate if no model-specific rate set */ defaultRate?: CostRate; }); /** Set the cost rate for a model */ setCostRate(model: string, rate: CostRate): void; /** Associate an agent with a model (for cost lookups) */ setAgentModel(agentId: string, model: string): void; /** Record an execution sample for an agent */ record(agentId: string, sample: Omit & { timestamp?: number; }): void; /** Get the heatmap cell for a single agent */ getCell(agentId: string): HeatmapCell | null; /** Get the full heatmap snapshot */ getSnapshot(): HeatmapSnapshot; /** List all tracked agent IDs */ listAgents(): string[]; /** Clear all data */ clear(): void; /** Clear data for a specific agent */ clearAgent(agentId: string): void; private computeCell; private percentile; } //# sourceMappingURL=cost-heatmap.d.ts.map