/**
 * Auto-correct drift policy runtime (AUTO.4).
 *
 * Authoritative source: `docs/tasks/automation.md` AUTO.4.
 *
 * Lifecycle of an `auto_correct` verdict:
 *   1. Drift dispatcher emits `RuntimeAction{kind:'auto_correct', correctiveSkill, verdict}`.
 *   2. Caller invokes `runAutoCorrect()` with pack + evaluator + capability gate
 *      + a re-eval thunk for the offending rule.
 *   3. Capability gate fires FIRST (`subagent_call` for `correctiveSkill`).
 *      Gate denied → no invocation; fall-through descriptor returned.
 *   4. Corrective skill's process runs via the evaluator. Process error or
 *      drift verdict from the corrective skill itself → fall-through.
 *   5. Re-eval original rule. Drift persists → fall-through. Pass → emit a
 *      "corrected" pass verdict for the audit trail.
 *
 * LOOP CAP — 1 ATTEMPT MAX (locked).
 *   If the corrective skill (or the re-eval) ITSELF produces drift, we do
 *   NOT recurse — we return a fall-through descriptor so the caller routes
 *   to `notify_pause` / `escalate`. The cap is structural: no `attemptCount`
 *   parameter is accepted; there is no second attempt path to count to.
 *
 * NO SILENT FAIL-OPEN (C10):
 *   Every failure mode returns `corrected: false` with a structured
 *   `fallthrough` descriptor carrying a human-readable reason. The caller
 *   MUST route this to `notify_pause`. Function never silently swallows.
 *
 * Engine-vocabulary: pack / skill / verdict / capability only.
 */
import type { FunctionRegistry, EvalCtx } from '../functions/registry.js';
import type { CapabilityGate } from './capability_gate.js';
import type { MessageVerdict as Verdict, Pack, RuleResult } from './types.js';
/**
 * `corrected: true` ⇒ caller treats the original verdict as resolved.
 * `correctionVerdict` carries a synthetic pass verdict for audit logs.
 *
 * `corrected: false` ⇒ caller MUST route to `notify_pause` (or `escalate`)
 * using `fallthrough.reason`. Loop cap forbids a second auto-correct.
 */
export interface AutoCorrectResult {
    corrected: boolean;
    correctionVerdict: Verdict | null;
    fallthrough?: {
        reason: string;
        kind: 'capability_denied' | 'corrective_skill_missing' | 'corrective_skill_drift' | 'corrective_skill_error' | 'reeval_persistent_drift' | 'reeval_error';
    };
}
export interface AutoCorrectDeps {
    pack: Pack;
    correctiveSkill: string;
    verdict: Verdict;
    evalCtx: EvalCtx;
    registry: FunctionRegistry;
    capabilityGate: CapabilityGate;
    /**
     * Re-evaluate the rule that originally produced `verdict`. Caller owns
     * the thunk — the rule reference lives in the dispatcher layer, not here.
     */
    reevaluateOriginalRule: () => Promise<RuleResult>;
}
/**
 * Single linear pipeline (no recursion, no retry). Audit reads as: 1
 * capability check → 1 skill invocation → 1 re-eval → done. Every
 * fall-through path returns immediately.
 */
export declare function runAutoCorrect(deps: AutoCorrectDeps): Promise<AutoCorrectResult>;
//# sourceMappingURL=auto_correct.d.ts.map