/** * Telemetry and Decision Logging for Drift Detection * * Records comparison decisions for post-hoc analysis and algorithm improvement. * Decisions are logged locally and can be exported for feedback or A/B testing. */ import type { ConfidenceFactor } from './types.js'; import type { SecurityCategory, LimitationCategory } from './semantic.js'; /** * Category match extracted from text during comparison. */ export interface CategoryMatch { category: SecurityCategory | LimitationCategory | string; confidence: number; matchedKeywords: string[]; } /** * A recorded comparison decision. */ export interface ComparisonDecision { /** Unique ID for this decision */ id: string; /** When the decision was made */ timestamp: Date; /** Type of comparison */ type: 'security' | 'limitation' | 'assertion'; /** First text being compared */ text1: string; /** Second text being compared */ text2: string; /** Categories extracted from text1 */ categories1: CategoryMatch[]; /** Categories extracted from text2 */ categories2: CategoryMatch[]; /** Keyword overlap score (0-100) */ keywordOverlap: number; /** The match decision made */ matchDecision: boolean; /** Raw confidence score before calibration */ rawConfidence: number; /** Calibrated confidence score */ calibratedConfidence: number; /** Individual confidence factors */ factors: ConfidenceFactor[]; /** Tool name context */ toolName: string; /** Server command being interviewed */ serverCommand?: string; /** Bellwether version */ bellwetherVersion: string; } /** * User feedback on a comparison decision. */ export interface FeedbackReport { /** ID of the decision being reported */ decisionId: string; /** Type of feedback */ feedbackType: 'false_positive' | 'false_negative' | 'confidence_wrong'; /** Optional user comment explaining the issue */ userComment?: string; /** What the correct answer should have been */ correctAnswer?: boolean; /** When feedback was submitted */ timestamp: Date; } /** * Analysis of aggregated feedback. */ export interface FeedbackAnalysis { totalReports: number; falsePositiveRate: number; falseNegativeRate: number; confidenceIssueRate: number; commonPatterns: Array<{ pattern: string; count: number; feedbackType: string; }>; } /** * Decision logger for recording and analyzing comparison decisions. */ export declare class DecisionLogger { private decisions; private logPath; private enabled; constructor(options?: { enabled?: boolean; logPath?: string; }); /** * Log a comparison decision. */ log(decision: Omit): string; /** * Get all logged decisions from this session. */ getSessionDecisions(): ComparisonDecision[]; /** * Load all decisions from the log file. */ loadAllDecisions(): ComparisonDecision[]; /** * Get a specific decision by ID. */ getDecision(id: string): ComparisonDecision | undefined; /** * Export decisions to a JSON file. */ exportToFile(filePath: string): void; /** * Get statistics about logged decisions. */ getStatistics(): { totalDecisions: number; byType: Record; averageConfidence: number; matchRate: number; }; /** * Clear all logged decisions. */ clear(): void; } /** * Feedback manager for recording and analyzing user feedback. */ export declare class FeedbackManager { private feedbackPath; constructor(options?: { feedbackPath?: string; }); /** * Submit feedback on a comparison decision. */ submit(feedback: Omit): void; /** * Load all feedback reports. */ loadAll(): FeedbackReport[]; /** * Analyze all feedback to identify patterns. */ analyze(): FeedbackAnalysis; /** * Clear all feedback. */ clear(): void; } /** * Get the global decision logger instance. */ export declare function getDecisionLogger(options?: { enabled?: boolean; }): DecisionLogger; /** * Get the global feedback manager instance. */ export declare function getFeedbackManager(): FeedbackManager; /** * Reset global instances (for testing). */ export declare function resetTelemetry(): void; //# sourceMappingURL=telemetry.d.ts.map