import type { LocalInvocationRequest } from './request-normalizer.js';
import type { LocalResponse } from './entrypoint.js';
import type { FailureClassification } from '../runtime/failure/types.js';
import type { DebuggerResult } from '../product/specialists/debugger/types.js';
import type { WorkflowRunEvidence } from '../shared/models/workflow-evidence.js';
import type { WorkforcePersonaRepairAttempt } from '../product/generation/workforce-persona-repairer.js';
import { type CodeDriftRepairOptions, type CodeDriftRepairResult } from './code-drift-repairer.js';
export interface AutoFixAttemptSummary {
    attempt: number;
    status: 'ok' | 'blocker' | 'error';
    blocker_code?: string;
    run_id?: string;
    tracking_run_id?: string;
    failed_step?: string;
    applied_fix?: Record<string, unknown>;
    fix_error?: string;
    warning?: string;
}
export interface WorkflowRepairInput {
    request: LocalInvocationRequest;
    response: LocalResponse;
    evidence: WorkflowRunEvidence;
    classification: FailureClassification;
    debuggerResult: DebuggerResult;
    artifactPath: string;
    artifactContent: string;
    cwd: string;
    failedStep?: string;
    runId?: string;
    previousAttempts?: WorkforcePersonaRepairAttempt[];
    attempt: number;
    maxAttempts: number;
    onProgress?: (message: string) => void;
}
export interface WorkflowRepairResult {
    applied: boolean;
    content?: string;
    artifactPath?: string;
    mode?: string;
    summary: string;
    warnings?: string[];
    runId?: string | null;
}
export interface RunWithAutoFixOptions {
    maxAttempts: number;
    runSingleAttempt: (request: LocalInvocationRequest) => Promise<LocalResponse>;
    classifyFailure?: (evidence: WorkflowRunEvidence) => FailureClassification;
    debugWorkflowRun?: (input: {
        evidence: WorkflowRunEvidence;
        classification: FailureClassification;
    }) => DebuggerResult;
    workflowRepairer?: (input: WorkflowRepairInput) => Promise<WorkflowRepairResult>;
    /**
     * Optional repairer for "code drift" failures — when the workflow has
     * generated structured drift reports under `.workflow-artifacts/**\/*-drift.json`
     * indicating that target source code does not match an external reference.
     * If unset, defaults to `repairCodeFromDriftArtifacts`. Dispatched before
     * the workflow repairer when discoverable drift reports are present.
     */
    codeDriftRepairer?: (options: CodeDriftRepairOptions) => Promise<CodeDriftRepairResult>;
    artifactWriter?: (artifactPath: string, content: string, cwd: string) => Promise<void>;
    repairRunner?: (command: string, cwd: string) => Promise<{
        exitCode: number;
    }>;
    sleep?: (ms: number) => Promise<void>;
    onProgress?: (message: string) => void;
}
export declare function resolveSafeResumeAnchor(failedStep: string | undefined, workflowContent: string | undefined): string | undefined;
export declare function runWithAutoFix(request: LocalInvocationRequest, options: RunWithAutoFixOptions): Promise<LocalResponse>;
export declare function repairWorkflowDeterministically(input: Pick<WorkflowRepairInput, 'artifactPath' | 'artifactContent' | 'evidence'> & Partial<Pick<WorkflowRepairInput, 'response'>>, personaError?: unknown): WorkflowRepairResult | null;
