import { BrainInsight, HallucinationFlag, EnsembleVote, AdversarialLog, ThreatVector } from '../types.js'; /** * Adversarial Defense — the immune system of the brain. * * Hallucination Detection: * Cross-reference LLM claims against actual file content. * "function X exists in file Y" → verify with file reads. * Contradiction detection: compare against stored knowledge. * * Ensemble Verification: * Critical insights → send to 2+ models → majority vote. * Split verdict → flag for human review. * * Injection Detection: * Scan for prompt injection patterns in agent inputs. * Block and log ThreatVector when detected. * Rate limit: max 3 injections per session before alert. */ export declare class AdversarialDefense { private log; private injectionCount; private readonly MAX_INJECTIONS_PER_SESSION; private static readonly INJECTION_PATTERNS; constructor(); /** * Verify an insight against actual project state. * Cross-references claims with file content. */ verifyInsight(insight: BrainInsight, projectDir: string): Promise; /** * Send a question to multiple models and collect votes. * Majority consensus required for acceptance. */ ensembleVerify(question: string, modelAnswers: Array<{ model: string; answer: string; confidence: number; }>): EnsembleVote; /** * Scan input for prompt injection patterns. * Returns ThreatVector if detected, null otherwise. */ scanForInjection(input: string): ThreatVector | null; /** Block and log a detected threat */ blockAndLog(threat: ThreatVector): void; /** Get defense statistics */ getDefenseStats(): AdversarialLog; /** Get injection count for current session */ getSessionInjectionCount(): number; /** Simple text similarity based on shared words */ private textSimilarity; /** Attempt to decode common encoding schemes */ private decodeCommonEncodings; private saveToDisk; private loadFromDisk; } //# sourceMappingURL=adversarial-defense.d.ts.map