export function buildProviderToolLoopContext(context, input) {
    return {
        ...context,
        downgradeEligible: context.downgradeEligible ?? isProviderToolLoopRoutingDowngradeEligible(context.phaseName),
        escalationLevel: input.escalationLevel,
        correctionTrace: input.correctionTrace ?? context.correctionTrace,
        requiredToolConstraint: input.requiredToolConstraint,
        routeConfigOverride: input.routeConfigOverride,
        toolStepCount: input.toolStepCount,
    };
}
export function isProviderToolLoopRoutingDowngradeEligible(phaseName) {
    return (phaseName === undefined ||
        phaseName === "inspect" ||
        phaseName === "summarize" ||
        phaseName === "wait");
}
//# sourceMappingURL=provider-tool-loop-context.js.map