/**
 * code-drift-repairer.ts
 *
 * Auto-fix path for "drift report" workflow failures — i.e. when a workflow
 * has *successfully* generated structured findings showing that target code
 * doesn't match an external reference (provider docs, schema, etc.) but the
 * workflow's final gate exits non-zero because drift exists.
 *
 * Distinct from workforce-persona-repairer:
 *   - workforce-persona-repairer: fixes the *workflow artifact itself*
 *     (treating the failure as a generation bug)
 *   - code-drift-repairer (this file): fixes the *target code* the workflow
 *     was inspecting (treating the failure as expected output that requires
 *     a follow-up code change before retry)
 *
 * Drift report schema (any file under .workflow-artifacts/**\/*-drift.json):
 *   {
 *     verdict: 'PASS' | 'DRIFT',
 *     findings: Array<{ severity: 'blocker'|'major'|'minor', axis: string, description: string }>,
 *     expected?: Record<string, unknown>,
 *     actual?: Record<string, unknown>,
 *     sources?: Record<string, string>,
 *     ...
 *   }
 *
 * Detection (in resolveCodeDriftTarget): convention-based + schema-validated
 * + freshness-checked. See auto-fix-loop.ts → resolveCodeDriftTarget.
 */
import { type WorkforcePersonaResolver, type WorkforcePersonaSendOptions } from '../product/generation/workforce-persona-writer.js';
export interface DriftFinding {
    severity: 'blocker' | 'major' | 'minor';
    axis: string;
    description: string;
}
export interface DriftReport {
    /** Path to the .json file on disk (absolute or cwd-relative). */
    filePath: string;
    /** Slug or identifier carried by the report (`r.slug` if present, else basename). */
    slug?: string;
    verdict: 'PASS' | 'DRIFT';
    findings: DriftFinding[];
    expected?: Record<string, unknown>;
    actual?: Record<string, unknown>;
    sources?: Record<string, string>;
    /**
     * Per-report opt-out for auto-fix. Auto-fix is ON by default — when a
     * workflow emits a drift report with `"autofix": false`, ricky records
     * the drift but does NOT dispatch a code-fix agent. Useful for
     * monitoring/audit workflows that want findings surfaced for human
     * triage rather than automated source edits.
     */
    autofix: boolean;
    /** Full parsed JSON for the agent prompt. */
    raw: Record<string, unknown>;
}
export interface CodeDriftTarget {
    /** Working directory the workflow ran in. */
    cwd: string;
    /** Reports with verdict === 'DRIFT' that contain at least one blocker or major finding. */
    reports: DriftReport[];
}
export interface CodeDriftRepairOptions {
    target: CodeDriftTarget;
    attempt: number;
    maxAttempts: number;
    failedStep?: string;
    previousRunId?: string;
    timeoutSeconds?: number;
    installSkills?: boolean;
    installRoot?: string;
    tier?: string;
    env?: NodeJS.ProcessEnv;
    signal?: AbortSignal;
    onProgress?: WorkforcePersonaSendOptions['onProgress'];
    personaIntentCandidates?: readonly string[];
    resolver?: WorkforcePersonaResolver;
}
export interface CodeDriftRepairResult {
    applied: boolean;
    summary: string;
    /** The persona/agent run id, when the underlying harness exposes one. */
    runId?: string | null;
    /** Slugs whose findings were addressed; informational. */
    fixedSlugs?: string[];
    warnings?: string[];
}
export declare function repairCodeFromDriftArtifacts(options: CodeDriftRepairOptions): Promise<CodeDriftRepairResult>;
/**
 * Recursively scans `<cwd>/.workflow-artifacts/**` for `*-drift.json` files
 * created at or after `runStartTimeMs`, parses each, and returns the subset
 * that:
 *   1. Conform to the drift-report schema
 *   2. Have verdict === 'DRIFT'
 *   3. Contain at least one blocker- or major-severity finding
 *
 * Returns null if no actionable reports are found, signalling that the
 * caller should fall back to the regular workflow-repair path.
 */
export declare function discoverDriftReports(cwd: string, runStartTimeMs: number): Promise<DriftReport[] | null>;
