/**
 * SelfViolationDetector — turns a self-violation into a LEARNING SIGNAL.
 *
 * The motivating problem (Correction & Preference Learning Sentinel, Self-Violation
 * Signal extension): a stored preference (e.g. "don't defer work to a fresh
 * session", "never ask the user to edit files") is recalled every session yet
 * still gets VIOLATED — and the violation just evaporates with no structural
 * consequence. This detector OBSERVES the agent's own finalized outbound message
 * and reports which stored preferences it contradicts, so the wiring seam can
 * record the violation in the CorrectionLedger and reinforce the matched
 * preference's recurrence/salience for the next session.
 *
 * ABSOLUTE CONSTRAINTS (spec §3.9 + the user's explicit hard rule):
 *   1. SIGNAL-ONLY — this module OBSERVES and RETURNS a list. It never blocks,
 *      delays, rewrites, or alters an outbound message. It holds no authority.
 *   2. PRECISION OVER RECALL — a lone weak/ambiguous match must NOT fire. A false
 *      self-violation that nags is the bad direction, so the match contract is
 *      deliberately conservative (explicit per-preference pattern, never a fuzzy
 *      heuristic the LLM or the loop can widen).
 *   3. NEVER THROWS — a malformed pattern, bad input, or any internal error is
 *      guarded internally and yields an empty result. A detector error must
 *      never propagate to the message-delivery seam (fail-open is enforced both
 *      here and at the caller).
 *
 * Back-compatibility: a preference WITHOUT a `violationPattern` is simply never
 * self-violation-checked. Shipped `.instar/preferences.json` files (which have no
 * such field) are fully compatible — they produce zero detections.
 */
import type { PreferenceEntry } from '../core/PreferencesManager.js';
/** A preference that the outbound message was found to contradict. */
export interface SelfViolation {
    /** The preference that was violated. */
    preference: PreferenceEntry;
    /** The literal substring of the outbound message that triggered the match. */
    matchedText: string;
    /**
     * How the match was made — 'regex' (the pattern was a valid RegExp source) or
     * 'keywords' (the pattern was a keyword set; ALL keywords had to be present).
     */
    matchKind: 'regex' | 'keywords';
}
/**
 * Detect which of the supplied active preferences the outbound message violates.
 *
 * Pure, deterministic, precision-biased, and guaranteed never to throw. Returns
 * the list of violated preferences (empty when none, or on any error, or when no
 * preference carries a `violationPattern`).
 *
 * Pattern grammar for `preference.violationPattern`:
 *   - `regex:<source>`  → compiled as a case-insensitive RegExp; a match fires.
 *   - `keywords:a,b,c`  → fires only when ALL of the comma-separated keywords
 *                          appear (case-insensitively) in the message AND there
 *                          are at least MIN_KEYWORDS_TO_FIRE of them (a lone
 *                          keyword never fires).
 *   - bare `<source>`   → treated as a regex source (back-compat / convenience).
 *
 * An empty/whitespace pattern, an unparseable regex, or a single-keyword set is
 * treated as "no check" for that preference (skipped, never an error).
 */
export declare function detectSelfViolation(outboundText: string, activePreferences: PreferenceEntry[] | null | undefined): SelfViolation[];
//# sourceMappingURL=SelfViolationDetector.d.ts.map