import { buildReplayProviderTurnBudget } from "./provider-replay-budget.js";
export function buildReplayTerminalRepairState(input) {
    const { payload, runtime, turn } = input;
    const replayRouteConfig = runtime.hydrateProviderRequestReplayConfig(payload);
    const replayContextAvailableTools = runtime.hydrateProviderReplayContextAvailableTools(payload);
    const replayProfileName = payload.replayContext?.profileName;
    const replayProfile = replayProfileName ? runtime.requireProfile(replayProfileName) : undefined;
    return {
        payload,
        replayContextAvailableTools,
        replayProfile,
        replayProfileName,
        replayProviderTurnBudget: buildReplayProviderTurnBudget({
            defaultMaxProviderTurns: runtime.defaultMaxProviderTurns,
            enabled: payload.replayContext?.providerTurnBudgeted ?? false,
            maxProviderTurnsForProfile: (profile) => runtime.maxProviderTurnsForProfile(profile),
            profile: replayProfile,
            providerTurnCount: payload.replayContext?.providerTurnCount,
        }),
        replayRouteConfig,
        runtime,
        turn,
    };
}
//# sourceMappingURL=provider-replay-terminal-repair-state.js.map