/**
 * Client-side, display-only feature → model resolution.
 *
 * Mirrors a simplified version of cms-core's `resolveFeatureModel` so the UI can
 * preview which model a feature will use as the admin edits — including before
 * Save. The server resolver remains the authority for the AI runtime; this only
 * drives labels and capability warnings.
 */
const CAPABILITY_LABELS = {
    text: 'text',
    vision: 'vision',
    imageGeneration: 'image generation',
    embeddings: 'embeddings',
    toolCalling: 'tool calling',
    structuredOutput: 'structured output',
    streaming: 'streaming',
    reasoning: 'reasoning',
    longContext: 'long context',
};
export function findModel(models, id) {
    if (!id)
        return undefined;
    return models.find((m) => m.id === id || m.providerModelId === id);
}
/** Required capabilities a model is missing. Unknown capability strings are ignored. */
export function missingCapabilities(model, required) {
    const wanted = required.filter((c) => c in CAPABILITY_LABELS);
    if (!model)
        return wanted;
    return wanted.filter((c) => !model.capabilities?.[c]);
}
export function capabilityLabel(key) {
    return CAPABILITY_LABELS[key] ?? key;
}
export function effectiveFeatureModel(override, defaultModelId, required, models) {
    const isOverride = Boolean(override);
    const modelId = override || defaultModelId;
    const model = findModel(models, modelId);
    return { modelId, model, isOverride, missingCapabilities: missingCapabilities(model, required) };
}
/** Whether a model satisfies every required capability and is selectable. */
export function isModelCompatible(model, required) {
    return model.status !== 'unavailable' && missingCapabilities(model, required).length === 0;
}
//# sourceMappingURL=featureModel.js.map