/**
 * Compliance drift alerting (Tier 3 of the agentic eval framework).
 *
 * When any (model × harness) cell exceeds the configured threshold for a
 * sustained window with at least N turns, this module emits a
 * `product_feedback` entity with `kind: "compliance_drift"` so the alarm
 * surfaces alongside other product-level signals in the existing
 * agent-feedback pipeline.
 *
 * Configuration (env):
 *   - `NEOTOMA_COMPLIANCE_BACKFILL_ALERT_THRESHOLD` (default `0.30`)
 *   - `NEOTOMA_COMPLIANCE_BACKFILL_ALERT_WINDOW`    (default `24h`)
 *   - `NEOTOMA_COMPLIANCE_BACKFILL_ALERT_MIN_TURNS` (default `100`)
 *
 * The check is intentionally idempotent: each (model × harness × window
 * end) tuple keys an idempotency value, so re-running this module under
 * cron will not flood the feedback queue with duplicates. The deterministic
 * key also lets operators see drift recurrences as additional observations
 * rather than separate entities.
 *
 * Triggering happens lazily — callers (cron, CLI, tests) call
 * `runComplianceAlertCheck()`; nothing runs automatically inside the
 * server hot path.
 */
export interface AlertingStore {
    storeStructured(input: {
        entities: Array<Record<string, unknown>>;
        idempotency_key: string;
    }): Promise<{
        structured?: {
            entities?: Array<{
                entity_id?: string;
                action?: string;
            }>;
        };
        [key: string]: unknown;
    }>;
}
export interface AlertingOptions {
    user_id: string;
    /**
     * Optional override for the env-driven threshold. Floor of 0, ceiling of 1.
     */
    threshold?: number;
    /** Window applied to the scorecard read (defaults to env, then 24h). */
    window?: string;
    /** Minimum turns per cell before the cell is alert-eligible. */
    min_turns?: number;
    /** Inject a store wrapper for tests. Defaults to the operations module. */
    store?: AlertingStore;
    /**
     * Override "now" for deterministic tests. Affects both the window
     * boundary and the idempotency key.
     */
    now?: Date;
    /**
     * If true, do not call store_structured; return the alert payloads that
     * would have been emitted. Useful for dry-runs and unit tests.
     */
    dry_run?: boolean;
}
export interface AlertPayload {
    entity_type: "product_feedback";
    kind: "compliance_drift";
    title: string;
    body: string;
    metadata: {
        model: string;
        harness: string;
        rate: number;
        threshold: number;
        min_turns: number;
        window: string;
        cell_total_turns: number;
        cell_backfilled_turns: number;
        top_missed_steps: ReadonlyArray<{
            step: string;
            count: number;
        }>;
    };
    /**
     * Stable observation identity so multiple alarms over the same cell
     * accrete onto the same entity rather than spawning duplicates.
     */
    identity: {
        model: string;
        harness: string;
    };
    /** Tag so triage tooling can filter on it. */
    source: "compliance-scorecard";
}
export interface AlertResult {
    threshold: number;
    window: string;
    min_turns: number;
    evaluated_cells: number;
    emitted: AlertPayload[];
    errors: string[];
    dry_run: boolean;
}
/**
 * Compute alerts for the current window without emitting anything. Used
 * by the CLI dry-run and by tests.
 */
export declare function evaluateAlerts(options: {
    user_id: string;
    threshold?: number;
    window?: string;
    min_turns?: number;
    now?: Date;
}): {
    threshold: number;
    window: string;
    min_turns: number;
    alerts: AlertPayload[];
};
/**
 * Run an alert check end-to-end: read the scorecard, evaluate cells
 * against the threshold, and write `product_feedback` entities for every
 * cell that breached.
 */
export declare function runComplianceAlertCheck(options: AlertingOptions): Promise<AlertResult>;
//# sourceMappingURL=alerting.d.ts.map