/** * Agent Selection Analytics Service * * Tracks and analyses dynamic agent selection metrics for rollout monitoring */ import type { AgentSelection, TaskContext } from '../types/agent.types.js'; import type { AgentRole } from '../types/command.types.js'; export interface AgentSelectionEvent { commandName: string; confidence: number; fallbackUsed: boolean; featureFlags: { agent_selection_analytics: boolean; dynamic_agent_selection: boolean; dynamic_agent_selection_implement_only: boolean; }; manualOverride: boolean; metadata: Record; previousAgent?: AgentRole; reasons: string[]; selectedAgent: AgentRole; sessionId: string; taskDescription: string; timestamp: number; } export interface AgentSelectionMetrics { agentDistribution: Record; averageConfidence: number; commandDistribution: Record; fallbackRate: number; manualOverrideRate: number; reasonDistribution: Record; timeRange: { end: number; start: number; }; totalSelections: number; } export declare class AgentSelectionAnalyticsService { private events; private logger; /** * Record an agent selection event */ recordAgentSelection(sessionId: string, commandName: string, taskContext: TaskContext, agentSelection: AgentSelection, featureFlags: unknown, manualOverride?: boolean, previousAgent?: AgentRole): void; /** * Create agent selection event */ private createSelectionEvent; /** * Parse feature flags from unknown type */ private parseFeatureFlags; /** * Create event metadata from task context */ private createEventMetadata; /** * Log selection event */ private logSelectionEvent; /** * Get metrics for a time range */ getMetrics(hoursBack?: number): AgentSelectionMetrics; /** * Get success metrics for rollout evaluation */ getSuccessMetrics(hoursBack?: number): { accuracy: number; completionRate: number; insights: string[]; performance: number; userSatisfaction: number; }; /** * Export events for analysis */ exportEvents(hoursBack?: number): AgentSelectionEvent[]; /** * Clear old events (for memory management) */ clearOldEvents(hoursBack?: number): number; /** * Get current event count */ getEventCount(): number; } /** * Get the global AgentSelectionAnalytics service instance */ export declare function getAgentSelectionAnalytics(): AgentSelectionAnalyticsService; /** * Set a custom global instance (for testing or DI) */ export declare function setAgentSelectionAnalytics(service: AgentSelectionAnalyticsService): void; //# sourceMappingURL=agent-selection-analytics.service.d.ts.map