"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MODELS = void 0;
exports.findModelById = findModelById;
exports.versionsForAlias = versionsForAlias;
exports.defaultForAlias = defaultForAlias;
exports.resolveModel = resolveModel;
exports.allowedEffortLevels = allowedEffortLevels;
exports.recommendedEffort = recommendedEffort;
exports.coerceEffort = coerceEffort;
exports.MODELS = [
    {
        alias: "haiku",
        version: "4.5",
        modelId: "claude-haiku-4-5-20251001",
        displayName: "Haiku 4.5",
        description: "Fastest",
        supportsExtendedContext: false,
        contextWindow: 200_000,
        isDefault: true,
    },
    {
        alias: "sonnet",
        version: "4.6",
        modelId: "claude-sonnet-4-6",
        displayName: "Sonnet 4.6",
        description: "Balanced",
        supportsExtendedContext: true,
        contextWindow: 200_000,
        isDefault: true,
    },
    {
        alias: "opus",
        version: "4.6",
        modelId: "claude-opus-4-6",
        displayName: "Opus 4.6",
        description: "Previous generation",
        supportsExtendedContext: true,
        contextWindow: 200_000,
    },
    {
        alias: "opus",
        version: "4.7",
        modelId: "claude-opus-4-7",
        displayName: "Opus 4.7",
        description: "Most capable",
        supportsExtendedContext: true,
        contextWindow: 200_000,
        isDefault: true,
    },
];
function findModelById(modelId) {
    if (!modelId)
        return undefined;
    return exports.MODELS.find((m) => m.modelId === modelId);
}
function versionsForAlias(alias) {
    return exports.MODELS.filter((m) => m.alias === alias);
}
function defaultForAlias(alias) {
    return exports.MODELS.find((m) => m.alias === alias && m.isDefault) ?? versionsForAlias(alias)[0];
}
function resolveModel(model) {
    if (!model)
        return null;
    const base = model.replace(/\[.*\]$/, "");
    if (base === "opus" || base === "sonnet" || base === "haiku") {
        return defaultForAlias(base) ?? null;
    }
    return findModelById(base) ?? null;
}
function allowedEffortLevels(entry) {
    if (!entry || entry.alias === "haiku")
        return [];
    const levels = ["low", "medium", "high"];
    if (entry.alias === "opus" && entry.version === "4.7")
        levels.push("xhigh");
    levels.push("max");
    return levels;
}
function recommendedEffort(entry) {
    if (!entry || entry.alias === "haiku")
        return null;
    if (entry.alias === "opus" && entry.version === "4.7")
        return "xhigh";
    if (entry.alias === "sonnet")
        return "medium";
    return "high";
}
function coerceEffort(level, entry) {
    const allowed = allowedEffortLevels(entry);
    if (allowed.length === 0)
        return null;
    if (allowed.includes(level))
        return level;
    return recommendedEffort(entry) ?? allowed[allowed.length - 1] ?? null;
}
