/**
 * Validate a persisted (or requested) override before applying it. A stale
 * entry — model gone from the registry, or its provider no longer connected —
 * silently resolves to null so Ken falls back to following GG Coder instead
 * of erroring on every turn.
 */
export function validateKenModelPref(pref, opts) {
    if (!pref || !pref.model || !pref.provider)
        return null;
    if (!opts.modelExists(pref.model))
        return null;
    if (!opts.providerConnected(pref.provider))
        return null;
    return pref;
}
/**
 * Resolve the model Ken uses right now: the override when set, otherwise the
 * build session's current model.
 */
export function effectiveKenModel(override, build) {
    if (override) {
        return { kenProvider: override.provider, kenModel: override.model, kenModelOverride: true };
    }
    return { kenProvider: build.provider, kenModel: build.model, kenModelOverride: false };
}
//# sourceMappingURL=ken-model.js.map