import { appendRuntimeObservation } from "./runtime-observation.js";
export async function runReplayGenerateRepair(input) {
    const repairMessages = appendRuntimeObservation(input.baseMessages, input.repairObservation);
    const correctionTrace = input.runtime.buildCorrectionTrace({
        code: input.repairCode,
        messages: input.baseMessages,
        operation: input.correctionOperation,
        systemPrompt: input.traceSystemPrompt ?? input.systemPrompt,
    });
    const response = await input.runtime.provider.generate(input.turn.threadId, input.turn.id, {
        ...input.request,
        messages: repairMessages,
        systemPrompt: input.systemPrompt,
    }, "repair", {
        ...input.providerContext,
        correctionTrace,
    });
    return input.runtime.finalizeGeneratedResponse({
        availableTools: input.availableTools,
        messages: repairMessages,
        objective: input.objective,
        text: response.text,
    });
}
//# sourceMappingURL=provider-replay-generate-repair-runner.js.map