/** * AI Feedback Service * * Secure feedback system that allows AI users to report issues with browsing * quality, accuracy, and performance. Features: * * Security: * - Rate limiting at session and tenant levels * - Anomaly detection for feedback poisoning prevention * - Max 5% confidence adjustment per feedback * - Require 3 consistent signals before applying adjustments * - HMAC-SHA256 webhook signature verification * - Full audit logging * * Real-Time Adjustments: * - Pattern confidence adjustments (capped) * - Tier routing hints * - Automatic revert if quality degrades * * Async Notifications: * - Security alerts (always notify) * - Critical severity feedback * - Repeated pattern failures * - Feature requests */ import type { LearningEngine } from './learning-engine.js'; import type { ProceduralMemory } from './procedural-memory.js'; import { type FeedbackRecord, type AnomalyFlag, type FeedbackAuditEntry, type FeedbackRateLimits, type FeedbackSubmitResult, type FeedbackStats, type FeedbackCategory, type FeedbackSentiment, type NotificationType } from '../types/feedback.js'; export interface FeedbackServiceConfig { rateLimits?: Partial; enableRealTimeAdjustments?: boolean; enableWebhooks?: boolean; maxAdjustmentPercent?: number; requiredConsistentSignals?: number; } export declare class FeedbackService { private feedbackRecords; private consistencyTrackers; private auditLog; private webhookConfigs; private pendingNotifications; private rateLimiter; private config; private learningEngine?; private proceduralMemory?; constructor(config?: FeedbackServiceConfig); /** * Set the learning engine for real-time adjustments */ setLearningEngine(engine: LearningEngine): void; /** * Set the procedural memory for skill feedback */ setProceduralMemory(memory: ProceduralMemory): void; /** * Submit feedback from an AI user */ submitFeedback(tenantId: string, sessionId: string, submission: unknown): Promise; /** * Detect anomalous feedback patterns */ private detectAnomalies; /** * Process real-time adjustments based on feedback * Returns the number of adjustments applied */ private processRealTimeAdjustments; /** * Apply a single adjustment (capped at max percent) */ private applyAdjustment; /** * Get or create a consistency tracker for a target */ private getOrCreateConsistencyTracker; /** * Revert adjustments made for a specific feedback */ revertAdjustments(tenantId: string, feedbackId: string): Promise; /** * Check if notification should be sent and queue it */ private checkAndSendNotifications; /** * Trigger a notification */ private triggerNotification; /** * Generate notification title */ private getNotificationTitle; /** * Generate notification summary */ private getNotificationSummary; /** * Send notification via webhook */ private sendNotification; /** * Sign a payload with HMAC-SHA256 */ private signPayload; /** * Configure webhook for a tenant * Note: In production, the secret should be encrypted at rest */ configureWebhook(tenantId: string, url: string, secret: string, enabledTypes: NotificationType[]): void; /** * Disable webhook for a tenant */ disableWebhook(tenantId: string): void; /** * Get feedback records for a tenant */ listFeedback(tenantId: string, options?: { limit?: number; offset?: number; category?: FeedbackCategory; sentiment?: FeedbackSentiment; status?: FeedbackRecord['status']; }): FeedbackRecord[]; /** * Get feedback statistics for a tenant */ getStats(tenantId: string, periodHours?: number): FeedbackStats; /** * Get anomaly flags for a tenant */ getAnomalies(tenantId: string, limit?: number): AnomalyFlag[]; /** * Store a feedback record */ private storeFeedback; /** * Record an audit entry */ private audit; /** * Get audit log entries */ getAuditLog(tenantId?: string, limit?: number): FeedbackAuditEntry[]; /** * Cleanup expired data */ cleanup(): void; } //# sourceMappingURL=feedback-service.d.ts.map