/** * Centralized statistics management service for POLARIS framework * Eliminates duplicate statistics code and provides consistent metrics across components */ import { EvaluationResult } from "../types/evaluation"; /** * Base statistics interface */ export interface BaseStatistics { startTime: number; lastUpdated: number; totalOperations: number; totalTime: number; averageTime: number; errorCount: number; successRate: number; } /** * Agent-specific statistics */ export interface AgentStatistics extends BaseStatistics { agentId: string; totalEvaluations: number; averageEvaluationTime: number; averageConfidence: number; selectionCount: number; performanceScore: number; totalThinkingTime: number; lastEvaluationTime?: number; evaluationHistory: PerformanceDataPoint[]; confidenceHistory: PerformanceDataPoint[]; } /** * Search statistics */ export interface SearchStatistics extends BaseStatistics { nodesExplored: number; totalSimulations: number; searchTime: number; averageDepth: number; maxDepth: number; agentUsage: Map; sentinelInterventions: number; nodesPerSecond: number; phaseTimings: PhaseTimings; } /** * Performance data point for tracking trends */ export interface PerformanceDataPoint { timestamp: number; value: number; metadata?: Record; } /** * Phase timing breakdown */ export interface PhaseTimings { selection: number; expansion: number; simulation: number; backpropagation: number; sentinelAnalysis: number; } /** * Statistics configuration */ export interface StatisticsConfig { enableHistory: boolean; maxHistorySize: number; updateInterval: number; enablePerformanceTracking: boolean; } /** * Centralized statistics manager */ export declare class StatisticsManager { private agentStats; private searchStats; private globalStats; private config; private logger; constructor(config?: Partial); /** * Initialize agent statistics */ initializeAgentStats(agentId: string): AgentStatistics; /** * Update agent statistics with evaluation result */ updateAgentStats(agentId: string, evaluation: EvaluationResult): void; /** * Record agent error */ recordAgentError(agentId: string, _error: Error): void; /** * Initialize search statistics */ initializeSearchStats(searchId: string): SearchStatistics; /** * Update search statistics */ updateSearchStats(searchId: string, updates: Partial): void; /** * Get agent statistics */ getAgentStats(agentId: string): AgentStatistics | undefined; /** * Get all agent statistics */ getAllAgentStats(): Map; /** * Get search statistics */ getSearchStats(searchId: string): SearchStatistics | undefined; /** * Get global statistics */ getGlobalStats(): GlobalStatistics; /** * Reset statistics for an agent */ resetAgentStats(agentId: string): void; /** * Reset all statistics */ resetAllStats(): void; /** * Get statistics summary */ getSummary(): StatisticsSummary; /** * Export statistics to JSON */ exportStats(): string; private calculatePerformanceScore; private calculateConsistencyScore; private addToHistory; private initializeGlobalStats; private updateGlobalStats; private estimateMemoryUsage; } /** * Global statistics interface */ export interface GlobalStatistics { startTime: number; totalAgents: number; totalSearches: number; totalEvaluations: number; totalErrors: number; uptime: number; memoryUsage: number; averagePerformance: number; } /** * Statistics summary interface */ export interface StatisticsSummary { agentCount: number; searchCount: number; totalEvaluations: number; averageConfidence: number; topPerformers: Array<{ agentId: string; score: number; }>; globalStats: GlobalStatistics; uptime: number; } /** * Global statistics manager instance */ export declare const statisticsManager: StatisticsManager; /** * Statistics decorator for automatic stats tracking */ export declare function withStatistics(_target: any, _propertyName: string, descriptor: PropertyDescriptor): PropertyDescriptor; //# sourceMappingURL=statistics.d.ts.map