"use strict";
// src/cli/install/ProvidersCatalog.ts
// Hermes-parity provider catalog — ~30 providers organized in 5 tiers.
//
// Each row carries:
//  - id (machine-readable, matches ProviderId in types.ts)
//  - label (display name)
//  - description (1-liner shown in the multiselect)
//  - envVar (which .env var holds the credential, when api-key strategy)
//  - oauthCli (which CLI binary handles `<cli> login`, when oauth strategy)
//  - tier (organizational grouping for the multiselect header)
//  - tags (filter chips: 'cloud' | 'local' | 'router' | 'oauth' | 'oss')
//
// To add a new provider: append the row here, add the ProviderId to types.ts,
// and (if it collects API keys) wire the env var in InstallModules.API_KEY_ENV_MAP.
Object.defineProperty(exports, "__esModule", { value: true });
exports.TIER_LABELS = exports.PROVIDERS_CATALOG = void 0;
exports.getProvider = getProvider;
exports.providersByTier = providersByTier;
exports.oauthProviders = oauthProviders;
exports.PROVIDERS_CATALOG = Object.freeze([
    // ── Tier 1: first-class, ship-it-now providers ────────────────────────
    {
        id: 'openai-api',
        label: 'OpenAI API',
        description: 'GPT-5.5, GPT-5.4-mini, embeddings (api.openai.com)',
        envVar: 'OPENAI_API_KEY',
        oauthCli: '',
        tier: 'tier-1',
        tags: ['cloud'],
        blurb: 'Direct API — fastest setup, paid per-token',
    },
    {
        id: 'anthropic',
        label: 'Anthropic',
        description: 'Claude Opus 4.7, Sonnet 4.6, Haiku 4.5 (api.anthropic.com)',
        envVar: 'ANTHROPIC_API_KEY',
        oauthCli: '',
        tier: 'tier-1',
        tags: ['cloud'],
        blurb: 'Direct API — Claude family. OAuth NOT supported (use API key only)',
    },
    {
        id: 'gemini-api',
        label: 'Google Gemini API',
        description: 'Gemini 3.1 Pro/Flash (generativelanguage.googleapis.com)',
        envVar: 'GEMINI_API_KEY',
        oauthCli: '',
        tier: 'tier-1',
        tags: ['cloud'],
        blurb: 'Direct API — generous free tier, multimodal',
    },
    {
        id: 'openrouter',
        label: 'OpenRouter',
        description: 'Unified gateway to 200+ models (openrouter.ai)',
        envVar: 'OPENROUTER_API_KEY',
        oauthCli: '',
        tier: 'tier-1',
        tags: ['cloud', 'router'],
        blurb: 'Single key, every model — pay-as-you-go aggregation',
    },
    {
        id: 'ollama',
        label: 'Ollama (local)',
        description: 'Run llama, qwen, mistral, etc. locally (localhost:11434)',
        envVar: '',
        oauthCli: '',
        tier: 'tier-1',
        tags: ['local', 'oss'],
        blurb: 'Local inference — no API key needed, GPU/CPU on your machine',
    },
    // ── Tier 2: CLI-based and popular alternatives ────────────────────────
    {
        id: 'openai-cli',
        label: 'OpenAI Codex (OAuth)',
        description: 'OAuth login via @openai/codex CLI — uses Plus/Pro subscription',
        envVar: '',
        oauthCli: 'codex',
        tier: 'tier-2',
        tags: ['cloud', 'oauth'],
        blurb: 'Browser OAuth — reuses your ChatGPT Plus/Pro session, no API costs',
    },
    {
        id: 'gemini-cli',
        label: 'Google Gemini CLI (OAuth)',
        description: 'OAuth login via gemini-cli — uses Google account quota',
        envVar: '',
        oauthCli: 'gemini',
        tier: 'tier-2',
        tags: ['cloud', 'oauth'],
        blurb: 'Browser OAuth — uses your Google account, generous free tier',
    },
    {
        id: 'xai',
        label: 'xAI Grok',
        description: 'Grok 4, Grok-vision (api.x.ai) — API key OR device-auth OAuth',
        envVar: 'XAI_API_KEY',
        oauthCli: 'grok',
        tier: 'tier-2',
        tags: ['cloud', 'oauth'],
        blurb: 'Direct API or browser OAuth — Grok models, X integration',
    },
    {
        id: 'deepseek',
        label: 'DeepSeek',
        description: 'DeepSeek-V3, DeepSeek-Coder (api.deepseek.com)',
        envVar: 'DEEPSEEK_API_KEY',
        oauthCli: '',
        tier: 'tier-2',
        tags: ['cloud'],
        blurb: 'Strong coder models, competitive pricing',
    },
    {
        id: 'groq',
        label: 'Groq',
        description: 'Ultra-fast inference on LPUs (api.groq.com)',
        envVar: 'GROQ_API_KEY',
        oauthCli: '',
        tier: 'tier-2',
        tags: ['cloud'],
        blurb: 'Lowest-latency inference, llama/mixtral on LPU hardware',
    },
    {
        id: 'together',
        label: 'Together AI',
        description: 'Open-source models at scale (api.together.xyz)',
        envVar: 'TOGETHER_API_KEY',
        oauthCli: '',
        tier: 'tier-2',
        tags: ['cloud', 'oss'],
        blurb: 'Hosted OSS models — llama, mixtral, deepseek, qwen, etc.',
    },
    {
        id: 'mistral',
        label: 'Mistral AI',
        description: 'Mistral Large, Codestral (api.mistral.ai)',
        envVar: 'MISTRAL_API_KEY',
        oauthCli: '',
        tier: 'tier-2',
        tags: ['cloud'],
        blurb: 'European AI lab — strong general + coder models',
    },
    // ── Tier 3: enterprise / specialty / regional ─────────────────────────
    {
        id: 'bedrock',
        label: 'AWS Bedrock',
        description: 'Claude, Llama, Titan via AWS (bedrock.amazonaws.com)',
        envVar: 'AWS_ACCESS_KEY_ID',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud', 'enterprise'],
        blurb: 'Enterprise — AWS billing, VPC integration, multi-model',
    },
    {
        id: 'qwen',
        label: 'Alibaba Qwen',
        description: 'Qwen2.5, Qwen-VL (dashscope.aliyuncs.com)',
        envVar: 'DASHSCOPE_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud'],
        blurb: 'Alibaba models — strong multilingual + Chinese performance',
    },
    {
        id: 'kimi',
        label: 'Moonshot Kimi',
        description: 'Kimi-k2, long-context (api.moonshot.cn)',
        envVar: 'MOONSHOT_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud'],
        blurb: 'Moonshot — 2M context window, Chinese-strong',
    },
    {
        id: 'minimax',
        label: 'MiniMax',
        description: 'abab6.5 (api.minimax.chat)',
        envVar: 'MINIMAX_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud'],
        blurb: 'MiniMax — multimodal, agent-friendly',
    },
    {
        id: 'glm',
        label: 'Zhipu GLM',
        description: 'GLM-4, ChatGLM (open.bigmodel.cn)',
        envVar: 'ZHIPU_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud'],
        blurb: 'Zhipu AI — GLM family, multilingual',
    },
    {
        id: 'huggingface',
        label: 'Hugging Face',
        description: 'Inference API + Endpoints (api-inference.huggingface.co)',
        envVar: 'HF_TOKEN',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud', 'oss'],
        blurb: 'Any HF model via serverless inference or dedicated endpoints',
    },
    {
        id: 'nvidia-nim',
        label: 'NVIDIA NIM',
        description: 'NVIDIA-hosted optimized inference (integrate.api.nvidia.com)',
        envVar: 'NVIDIA_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud', 'enterprise'],
        blurb: 'NVIDIA Inference Microservices — optimized for NVIDIA stack',
    },
    {
        id: 'perplexity',
        label: 'Perplexity',
        description: 'Sonar models w/ real-time web search (api.perplexity.ai)',
        envVar: 'PERPLEXITY_API_KEY',
        oauthCli: '',
        tier: 'tier-3',
        tags: ['cloud'],
        blurb: 'Web-grounded models — search-augmented responses',
    },
    // ── Tier 4: local / self-hosted / DIY ─────────────────────────────────
    {
        id: 'vllm',
        label: 'vLLM (self-hosted)',
        description: 'OpenAI-compatible server, self-hosted (vllm.ai)',
        envVar: 'VLLM_BASE_URL',
        oauthCli: '',
        tier: 'tier-4',
        tags: ['local', 'oss'],
        blurb: 'High-throughput inference server — bring your own GPUs',
    },
    {
        id: 'sglang',
        label: 'SGLang (self-hosted)',
        description: 'Fast structured-generation server (sgl-project.github.io)',
        envVar: 'SGLANG_BASE_URL',
        oauthCli: '',
        tier: 'tier-4',
        tags: ['local', 'oss'],
        blurb: 'Structured output + RadixAttention — self-hosted',
    },
    {
        id: 'llamacpp',
        label: 'llama.cpp server',
        description: 'GGUF inference w/ OpenAI-compat endpoint (github.com/ggml-org/llama.cpp)',
        envVar: 'LLAMACPP_BASE_URL',
        oauthCli: '',
        tier: 'tier-4',
        tags: ['local', 'oss'],
        blurb: 'CPU/GPU GGUF inference — tiny footprint',
    },
    {
        id: 'lmstudio',
        label: 'LM Studio',
        description: 'Desktop local-LLM app w/ OpenAI server (lmstudio.ai)',
        envVar: 'LMSTUDIO_BASE_URL',
        oauthCli: '',
        tier: 'tier-4',
        tags: ['local'],
        blurb: 'Desktop app — easiest local LLM setup',
    },
    // ── Tier 5: routers / gateways / custom ───────────────────────────────
    {
        id: 'litellm',
        label: 'LiteLLM Proxy',
        description: 'Unified proxy for 100+ providers (litellm.ai)',
        envVar: 'LITELLM_BASE_URL',
        oauthCli: '',
        tier: 'tier-5',
        tags: ['router', 'oss'],
        blurb: 'Self-hosted proxy — one endpoint, every provider',
    },
    {
        id: 'clawrouter',
        label: 'ClawRouter',
        description: 'OpenAI-compatible router (clawrouter.ai)',
        envVar: 'CLAWROUTER_API_KEY',
        oauthCli: '',
        tier: 'tier-5',
        tags: ['cloud', 'router'],
        blurb: 'Cloud router — multi-provider failover',
    },
    {
        id: 'custom-openai',
        label: 'Custom OpenAI-compatible',
        description: 'Any provider exposing the /v1/chat/completions API',
        envVar: 'CUSTOM_OPENAI_BASE_URL',
        oauthCli: '',
        tier: 'tier-5',
        tags: ['custom'],
        blurb: 'Bring your own endpoint — any OpenAI-API-compatible server',
    },
]);
exports.TIER_LABELS = Object.freeze({
    'tier-1': '⭐ Tier 1 — First-class (start here)',
    'tier-2': '🔥 Tier 2 — Popular alternatives',
    'tier-3': '🏢 Tier 3 — Enterprise & regional',
    'tier-4': '💻 Tier 4 — Local & self-hosted',
    'tier-5': '🔀 Tier 5 — Routers & custom',
});
/** Lookup by id — throws on unknown id (catches catalog desync at runtime). */
function getProvider(id) {
    const found = exports.PROVIDERS_CATALOG.find(p => p.id === id);
    if (!found) {
        throw new Error(`PROVIDER_NOT_IN_CATALOG: ${id} — add a row to ProvidersCatalog.ts`);
    }
    return found;
}
/** All providers belonging to a tier — used to render the multiselect. */
function providersByTier(tier) {
    return exports.PROVIDERS_CATALOG.filter(p => p.tier === tier);
}
/** OAuth-capable providers — used in the agent profile auth-strategy phase. */
function oauthProviders() {
    return exports.PROVIDERS_CATALOG.filter(p => !!p.oauthCli);
}
