import type { ProviderTurnTraceEntry, RequestBudgetSnapshot, SessionUsageOperation, Turn, TurnSettlementRecord } from "@best-agent/protocol";
import type { ConversationMessage, ProviderCacheControl, ProviderToolOption } from "../../provider/provider-core.js";
import type { PromptDeliverableFailure } from "../../prompt/runtime-prompts.js";
import type { ProviderCorrectionTrace } from "../checkpoint-codec.js";
import type { ProviderTurnInvokeContext } from "./provider-turn-budget.js";
export { repairDurableGenerateTerminalOutput } from "./provider-terminal-repair-runner.js";
export { repairDurableGenerateFinalAnswer } from "./provider-final-answer-repair-runner.js";
type ProviderTurnTraceValidation = NonNullable<ProviderTurnTraceEntry["validation"]>;
export type RepairGenerateTraceOutcome = {
    runtimeOutcome: "accepted" | "rejected" | "repaired";
    validation?: ProviderTurnTraceValidation;
};
export declare function getRepairGenerateTraceOutcomes(error: unknown): RepairGenerateTraceOutcome[] | undefined;
export type DurableResponseRepairRuntime = {
    assertValidTerminalAssistantText: (text: string) => string;
    buildCorrectionTrace: (input: {
        code: ProviderCorrectionTrace["code"];
        messages: ConversationMessage[];
        operation: SessionUsageOperation;
        systemPrompt?: string;
        tools?: ProviderToolOption[];
    }) => ProviderCorrectionTrace;
    buildProviderInvokeContext: (overrides?: Partial<ProviderTurnInvokeContext>) => ProviderTurnInvokeContext;
    buildTurnSettlementRecord: (input: {
        rejectedReason?: TurnSettlementRecord["rejectedReason"];
        terminalKind: TurnSettlementRecord["terminalKind"];
        unresolvedFailures?: PromptDeliverableFailure[];
    }) => Promise<TurnSettlementRecord>;
    provider: ProviderResponseRepairProvider;
    recordTurnSettlement: (settlement: TurnSettlementRecord) => Promise<void>;
};
type ProviderResponseRepairProvider = {
    generate: (threadId: Turn["threadId"], turnId: Turn["id"], request: {
        cacheControl?: ProviderCacheControl;
        messages: ConversationMessage[];
        systemPrompt?: string;
    }, operation: SessionUsageOperation, context: ProviderTurnInvokeContext) => Promise<{
        text: string;
    }>;
};
export declare function repairDurableGenerateResponse(input: {
    availableTools: ProviderToolOption[];
    cacheControl?: ProviderCacheControl;
    finalAnswerRepairAttempted: boolean;
    messages: ConversationMessage[];
    objective?: string;
    operation: SessionUsageOperation;
    repairAttempted: boolean;
    requestBudgetSnapshot?: RequestBudgetSnapshot;
    responseText: string;
    runtime: DurableResponseRepairRuntime;
    systemPrompt?: string;
    turn: Turn;
    validateFinalAnswer?: boolean;
}): Promise<{
    finalAnswerRepaired: boolean;
    repairGenerateOutcomes: RepairGenerateTraceOutcome[];
    responseText: string;
    terminalOutputRepaired: boolean;
}>;
//# sourceMappingURL=provider-durable-response-repair.d.ts.map