import { buildLengthPartsForFinishLine } from "../../finish-line.js";
export { buildModelMetaFromAttempt } from "../../../engine/model-meta.js";
export function buildFinishExtras({ extracted, metricsDetailed, transcriptionCostLabel, }) {
    const parts = [
        ...(buildLengthPartsForFinishLine(extracted, metricsDetailed) ?? []),
        ...(transcriptionCostLabel ? [transcriptionCostLabel] : []),
    ];
    return parts.length > 0 ? parts : null;
}
export function pickModelForFinishLine(llmCalls, fallback) {
    const findLastModel = (purpose) => {
        for (let i = llmCalls.length - 1; i >= 0; i -= 1) {
            const call = llmCalls[i];
            if (call && call.purpose === purpose)
                return call.model;
        }
        return null;
    };
    const summaryModel = findLastModel("summary");
    if (summaryModel)
        return summaryModel;
    const markdownModel = findLastModel("markdown");
    if (markdownModel)
        return markdownModel;
    const lastCall = llmCalls.at(-1);
    if (lastCall?.model)
        return lastCall.model;
    return fallback;
}
//# sourceMappingURL=summary-finish.js.map