export type FeedbackKind = 'accepted' | 'rejected' | 'modified' | 'ignored'; export interface Feedback { queryText: string; resultId: string; kind: FeedbackKind; userAction?: string; project: string; ts?: number; } export interface ActiveLearnerStats { totalFeedback: number; acceptRate: number; topAccepted: Array<{ id: string; count: number; }>; topRejected: Array<{ id: string; count: number; }>; lastUpdated: number; } export interface BiasExport { feedback: Feedback[]; biases: Record; } export declare class BrainActiveLearner { private state; private embedderPromise; /** Record a single feedback event. Returns once persisted. */ recordFeedback(feedback: Feedback): Promise; /** * Re-rank candidates using accumulated feedback for this project. * Returns a new array; does not mutate input. When there is no feedback * the candidates pass through unchanged with biasApplied=0. */ bias(query: string, candidates: Array<{ id: string; score: number; }>, project: string): Promise>; /** Return a summary for the given project. Empty stats when no feedback. */ stats(project: string): ActiveLearnerStats; /** Export feedback + derived biases for backup / inspection. */ export(project: string): Promise; /** Import feedback. Appends to existing file. Returns count imported. */ import(data: { feedback?: Feedback[]; }, project: string): Promise<{ imported: number; }>; /** Wipe all feedback + bias cache for a project. */ reset(project: string): Promise; private feedbackFile; private biasFile; private loadProject; private append; private writeBiasCache; private ensureBiases; private computeBiases; private assignCluster; /** * Dynamic import of embeddings module. If the import fails (e.g. test * environment without the module compiled), we fall back to a local word * bag — clustering still works, just with coarser query buckets. */ private getEmbedder; } export declare function getBrainActiveLearner(): BrainActiveLearner; export declare function resetBrainActiveLearnerForTests(): void; //# sourceMappingURL=brain-active-learner.d.ts.map