Files
hack/tools/scripts/llm-key-hunter/results/_cache/content/bagidea_bagidea-office.json
T

1 line
111 KiB
JSON

{"repo": "bagidea/bagidea-office", "files": {"daemon/providers.js": {"8b2dce2e01add5147d7b3d6b1ce8144635a127bc": {"t": 1785746701.0293155, "n": 10114, "h": "bb52841e09d62e13", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n // Anthropic DOES list models — but not with a per-provider key like everyone\n // else: the office runs on the machine's own Claude auth. server.js\n // (fetchClaudeModels) pulls this URL with ANTHROPIC_API_KEY, or failing that\n // the Claude Code CLI's local subscription token. The list below is only the\n // offline fallback for when neither is available.\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n modelsUrl: \"https://api.anthropic.com/v1/models?limit=100\",\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-5\", \"claude-sonnet-5\", \"claude-fable-5\", \"claude-opus-4-8\",\n \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n // GLM-5.2's full 1M context is unlocked ONLY by the \"glm-5.2[1m]\" id — plain\n // \"glm-5.2\" serves ~200k. List the [1m] variant first so the picker favors it.\n models: [\"glm-5.2[1m]\", \"glm-5.2\", \"glm-4.6\", \"glm-4.5\"], // hint only — live list fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n // Best-effort live list from MiniMax's OpenAI-compatible endpoint; if it 404s\n // the fetch is caught and we fall back to the static hint (never blocks Connect).\n modelsUrl: \"https://api.minimax.io/v1/models\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "3822bcc193ee32c8c9b23237a1b993d68baee523": {"t": 1785766995.8985343, "n": 10114, "h": "bb52841e09d62e13", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n // Anthropic DOES list models — but not with a per-provider key like everyone\n // else: the office runs on the machine's own Claude auth. server.js\n // (fetchClaudeModels) pulls this URL with ANTHROPIC_API_KEY, or failing that\n // the Claude Code CLI's local subscription token. The list below is only the\n // offline fallback for when neither is available.\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n modelsUrl: \"https://api.anthropic.com/v1/models?limit=100\",\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-5\", \"claude-sonnet-5\", \"claude-fable-5\", \"claude-opus-4-8\",\n \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n // GLM-5.2's full 1M context is unlocked ONLY by the \"glm-5.2[1m]\" id — plain\n // \"glm-5.2\" serves ~200k. List the [1m] variant first so the picker favors it.\n models: [\"glm-5.2[1m]\", \"glm-5.2\", \"glm-4.6\", \"glm-4.5\"], // hint only — live list fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n // Best-effort live list from MiniMax's OpenAI-compatible endpoint; if it 404s\n // the fetch is caught and we fall back to the static hint (never blocks Connect).\n modelsUrl: \"https://api.minimax.io/v1/models\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "1ffb4a1ef841f64370148955650b516da5c64ff2": {"t": 1785767000.2561636, "n": 9818, "h": "841fcff79a4a1312", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n // The ONLY provider with no live /models fetch (subscription auth has no\n // listing endpoint) — keep this hint list current by hand on every release.\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-fable-5\", \"claude-opus-4-8\", \"claude-sonnet-5\", \"claude-haiku-4-5\",\n \"claude-sonnet-4-6\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n // GLM-5.2's full 1M context is unlocked ONLY by the \"glm-5.2[1m]\" id — plain\n // \"glm-5.2\" serves ~200k. List the [1m] variant first so the picker favors it.\n models: [\"glm-5.2[1m]\", \"glm-5.2\", \"glm-4.6\", \"glm-4.5\"], // hint only — live list fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n // Best-effort live list from MiniMax's OpenAI-compatible endpoint; if it 404s\n // the fetch is caught and we fall back to the static hint (never blocks Connect).\n modelsUrl: \"https://api.minimax.io/v1/models\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "db5ca9c8186f18f282bf86ba0617d5c3c6a05063": {"t": 1785767003.1956716, "n": 9609, "h": "63696350387bc6a6", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n // GLM-5.2's full 1M context is unlocked ONLY by the \"glm-5.2[1m]\" id — plain\n // \"glm-5.2\" serves ~200k. List the [1m] variant first so the picker favors it.\n models: [\"glm-5.2[1m]\", \"glm-5.2\", \"glm-4.6\", \"glm-4.5\"], // hint only — live list fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n // Best-effort live list from MiniMax's OpenAI-compatible endpoint; if it 404s\n // the fetch is caught and we fall back to the static hint (never blocks Connect).\n modelsUrl: \"https://api.minimax.io/v1/models\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "36bd7b9f23a6600e9adaaabe351821085c40c734": {"t": 1785767006.800315, "n": 9388, "h": "7fe1516837eb5f79", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n // GLM-5.2's full 1M context is unlocked ONLY by the \"glm-5.2[1m]\" id — plain\n // \"glm-5.2\" serves ~200k. List the [1m] variant first so the picker favors it.\n models: [\"glm-5.2[1m]\", \"glm-5.2\", \"glm-4.6\", \"glm-4.5\"], // hint only — live list fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "21d858bf55032dc3f21fcc89ff6856325391fa57": {"t": 1785767009.5676436, "n": 9218, "h": "d3e98d5138305e49", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n models: [\"glm-4.6\", \"glm-4.5\"], // hint only — live list is fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4.1\", \"gpt-4o\", \"gpt-4o-mini\"], // gpt-4.1 = 1M flagship, listed first\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-pro\", \"gemini-2.5-flash\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-4\", \"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "01ee05e404a29a4fb43de03f5dd152910b3392ab": {"t": 1785767013.3034875, "n": 9156, "h": "9d16fe519f2955bf", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n models: [\"glm-4.6\", \"glm-4.5\"], // hint only — live list is fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n kimicode: {\n // Kimi Code — the coding subscription (kimi.com/code). DISTINCT from Moonshot's\n // general API above: separate \"sk-kimi-…\" keys, its own Anthropic-compatible\n // endpoint, and a single model id. Confirmed live (200) against the global host;\n // mainland-China users can override baseUrl in Connect.\n label: \"Kimi Code · coding plan\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.kimi.com/coding\", // → /v1/messages (Anthropic-compatible)\n models: [\"kimi-for-coding\"], // the only model this plan serves\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4o\", \"gpt-4o-mini\"],\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-flash\", \"gemini-2.5-pro\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "3055fcaf76ac417dfa3e9fad6f58b41f317ed153": {"t": 1785767017.7733412, "n": 8578, "h": "ec288338bef54c0d", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n models: [\"glm-4.6\", \"glm-4.5\"], // hint only — live list is fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.6\", \"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"], // hint only — live list fetched on Connect\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4o\", \"gpt-4o-mini\"],\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-flash\", \"gemini-2.5-pro\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "41240e0b6149d01935fa95ea661a7f9e5ffdc5f1": {"t": 1785767021.3403065, "n": 8520, "h": "2d140112932bbe8a", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n models: [\"glm-4.6\", \"glm-4.5\"], // hint only — live list is fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"],\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4o\", \"gpt-4o-mini\"],\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-flash\", \"gemini-2.5-pro\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n groq: {\n label: \"Groq\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b-versatile\", \"llama-3.1-8b-instant\"],\n },\n cerebras: {\n label: \"Cerebras\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"llama-3.3-70b\", \"llama-3.1-8b\"],\n },\n xai: {\n label: \"xAI · Grok\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"grok-3\", \"grok-3-mini\"],\n },\n mistral: {\n label: \"Mistral\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"mistral-large-latest\", \"codestral-latest\"],\n },\n together: {\n label: \"Together AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta-llama/Llama-3.3-70B-Instruct-Turbo\"],\n },\n fireworks: {\n label: \"Fireworks AI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"accounts/fireworks/models/llama-v3p3-70b-instruct\"],\n },\n // Local OpenAI-compatible servers — no key needed (local: true). Default ports.\n ollama: {\n label: \"Ollama · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [\"llama3.1\", \"qwen2.5-coder\", \"deepseek-r1\"],\n },\n lmstudio: {\n label: \"LM Studio · local\", format: \"openai\", needsProxy: true, local: true, baseUrl: null,\n models: [],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey && !(spec && spec.local)) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "9b4210f6942fafda839faca7df26345d6258eee2": {"t": 1785767025.0065222, "n": 7227, "h": "852922114f99a663", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n modelsUrl: \"https://api.z.ai/api/paas/v4/models\", // OpenAI-compatible model list\n models: [\"glm-4.6\", \"glm-4.5\"], // hint only — live list is fetched on Connect\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n modelsUrl: \"https://api.deepseek.com/models\",\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n modelsUrl: \"https://dashscope-intl.aliyuncs.com/compatible-mode/v1/models\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n moonshot: {\n label: \"Kimi · Moonshot\", format: \"anthropic\", direct: true,\n // confirmed (Moonshot docs). International endpoint; mainland-China is\n // https://api.moonshot.cn/anthropic — set reg.providerConfig.moonshot.baseUrl.\n baseUrl: \"https://api.moonshot.ai/anthropic\",\n modelsUrl: \"https://api.moonshot.ai/v1/models\",\n models: [\"kimi-k2.5\", \"kimi-k2\", \"kimi-latest\"],\n },\n openai: {\n label: \"OpenAI\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-4o\", \"gpt-4o-mini\"],\n },\n gemini: {\n label: \"Gemini\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-2.5-flash\", \"gemini-2.5-pro\"],\n },\n openrouter: {\n label: \"OpenRouter\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"openai/gpt-4o\", \"anthropic/claude-sonnet-4-6\", \"deepseek/deepseek-chat\"],\n },\n nvidia: {\n label: \"NVIDIA build\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"meta/llama-3.3-70b-instruct\", \"deepseek-ai/deepseek-v3\"],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}, opts = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n const pc = pConf[provider] || {};\n // \"anthropic\" (claude talks straight to the endpoint) or \"openai\" (via the\n // built-in proxy). Built-ins read it from the catalog; CUSTOM providers store\n // their kind/baseUrl/token in providerConfig[id].\n const kind = spec ? spec.format : pc.kind;\n if (!kind) return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" };\n\n let baseUrl, token;\n if (kind === \"openai\") {\n // Needs translation. openai/gemini may use an explicit LiteLLM gateway; everyone\n // else (openrouter/nvidia/custom) uses the daemon's built-in proxy, which resolves\n // the real upstream + key from providerConfig (proxy.js → upstreamFor).\n const builtinPair = provider === \"openai\" || provider === \"gemini\";\n const lc = pConf.litellm;\n const liteUrl = builtinPair && ((lc && lc.baseUrl) || reg.litellmUrl);\n if (liteUrl) {\n baseUrl = liteUrl;\n token = (lc && lc.token) || pc.token || \"litellm\";\n } else if (opts.proxyBase) {\n const mainKey = provider === \"openai\" ? (reg.apiKeys || {}).OPENAI_API_KEY\n : provider === \"gemini\" ? (reg.apiKeys || {}).GEMINI_API_KEY : null;\n if (!pc.token && !mainKey) {\n return { ok: false, env: {}, modelArgs: [], reason: \"key-not-set\" };\n }\n baseUrl = `${opts.proxyBase}/proxy/${provider}`;\n token = \"office\"; // the proxy injects the real key; this value is ignored\n } else {\n return { ok: false, env: {}, modelArgs: [], reason: \"no-proxy-available\" };\n }\n } else {\n // anthropic-kind: direct.\n baseUrl = pc.baseUrl || (spec && spec.baseUrl);\n token = pc.token;\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n let m = pc.model || model;\n if (!m && kind === \"openai\") {\n m = provider === \"openai\" ? \"gpt-4o-mini\" : provider === \"gemini\" ? \"gemini-2.5-flash\" : \"\";\n }\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "574385199b1fa59f4af171622792ffc6ee93dea4": {"t": 1785767087.2657351, "n": 5362, "h": "fd4f705b45c73c53", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n models: [\"glm-4.6\", \"glm-4.5\"],\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n openai: {\n label: \"OpenAI · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-5.5\", \"gpt-5-mini\"],\n },\n gemini: {\n label: \"Gemini · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-3-pro\", \"gemini-3-flash\"],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n if (!spec) { return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" }; }\n\n const pc = pConf[provider] || {};\n let baseUrl, token;\n\n if (spec.needsProxy) {\n // OpenAI/Gemini ride a LiteLLM gateway. ONLY route when the user has actually\n // pointed us at a running gateway (reg.providerConfig.litellm.baseUrl or\n // reg.litellmUrl). Otherwise FAIL-OPEN to Claude — never aim `claude` at a\n // phantom localhost proxy, or the agent hangs silently with no response.\n const lc = pConf.litellm;\n const proxyUrl = (lc && lc.baseUrl) || reg.litellmUrl;\n if (!proxyUrl) {\n return { ok: false, env: {}, modelArgs: [], reason: \"litellm-not-configured\" };\n }\n baseUrl = proxyUrl;\n token = (lc && lc.token) || pc.token || \"litellm\"; // LiteLLM master key\n } else {\n baseUrl = pc.baseUrl || spec.baseUrl;\n token = pc.token;\n }\n\n // Not configured yet → fail-open to plain Claude.\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n const m = pc.model || model;\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "c4629089a8c235dbf9d2b57168aa6374dce40fa8": {"t": 1785767088.9202554, "n": 5004, "h": "fe41c6ff25853d9a", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n models: [\"glm-4.6\", \"glm-4.5\"],\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // confirmed (DeepSeek docs)\n models: [\"deepseek-v4-pro\", \"deepseek-v4-flash\"], // chat/reasoner deprecated 2026-07-24\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n // confirmed (Alibaba Model Studio docs). International endpoint; mainland-China\n // is https://dashscope.aliyuncs.com/apps/anthropic — set reg.providerConfig.qwen.baseUrl.\n baseUrl: \"https://dashscope-intl.aliyuncs.com/apps/anthropic\",\n models: [\"qwen3-coder-plus\", \"qwen3-coder-next\", \"qwen3-coder-flash\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n // confirmed (MiniMax docs). International endpoint; mainland-China is\n // https://api.minimaxi.com/anthropic (extra \"i\") — set reg.providerConfig.minimax.baseUrl.\n baseUrl: \"https://api.minimax.io/anthropic\",\n models: [\"MiniMax-M3\"],\n },\n openai: {\n label: \"OpenAI · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-5.5\", \"gpt-5-mini\"],\n },\n gemini: {\n label: \"Gemini · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-3-pro\", \"gemini-3-flash\"],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n if (!spec) { return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" }; }\n\n const pc = pConf[provider] || {};\n let baseUrl, token;\n\n if (spec.needsProxy) {\n // OpenAI/Gemini ride a local LiteLLM gateway (Anthropic-compatible front).\n const lc = pConf.litellm || {};\n baseUrl = lc.baseUrl || reg.litellmUrl || DEFAULT_LITELLM;\n token = lc.token || pc.token || \"litellm\"; // LiteLLM master key (any non-empty)\n } else {\n baseUrl = pc.baseUrl || spec.baseUrl;\n token = pc.token;\n }\n\n // Not configured yet → fail-open to plain Claude.\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n const m = pc.model || model;\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}, "37c7234fc90f2658e540795bd026b9dfed4b0427": {"t": 1785767090.8266912, "n": 4628, "h": "dff0f7608f2d1ac9", "c": "\"use strict\";\n// ---------------------------------------------------------------------------\n// Per-agent model/provider routing — the office's \"swappable brain\".\n//\n// The agent runtime is ALWAYS the Claude Code CLI (`claude -p`): it owns the\n// tools, the agentic loop, skills, sessions. Only the *model behind it* changes.\n// `claude` is just a client — point ANTHROPIC_BASE_URL at another endpoint and it\n// talks to that backend instead, authenticated with ANTHROPIC_AUTH_TOKEN. So\n// switching an agent to GLM/Qwen/DeepSeek/MiniMax is purely env + --model.\n//\n// • Anthropic-format providers (direct: true) → ANTHROPIC_BASE_URL straight at\n// their Anthropic-compatible endpoint. No proxy.\n// • OpenAI-format providers (needsProxy: true) → ANTHROPIC_BASE_URL at a local\n// LiteLLM gateway that translates Anthropic <-> OpenAI (wired in P3).\n//\n// FAIL-OPEN: an unconfigured, unknown, or \"claude\" provider returns empty\n// overrides, so the spawn is byte-identical to today's plain-Claude behavior.\n// (A *configured* provider with a bad token will fail that run — same as a bad\n// Claude key today; we do not silently re-route to Claude.)\n// ---------------------------------------------------------------------------\n\n// Catalog. `baseUrl` filled only where the endpoint is confirmed; the rest are\n// supplied via reg.providerConfig[id].baseUrl (verified per-provider in P2).\n// `models` is a hint list for the settings UI — any string is accepted.\nconst PROVIDERS = {\n claude: {\n label: \"Claude · Anthropic\", format: \"anthropic\", direct: true, baseUrl: null,\n models: [\"\", \"opus\", \"sonnet\", \"haiku\",\n \"claude-opus-4-8\", \"claude-sonnet-4-6\", \"claude-haiku-4-5\"],\n },\n glm: {\n label: \"GLM · Z.AI\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.z.ai/api/anthropic\", // confirmed (Z.AI docs)\n models: [\"glm-4.6\", \"glm-4.5\"],\n },\n deepseek: {\n label: \"DeepSeek\", format: \"anthropic\", direct: true,\n baseUrl: \"https://api.deepseek.com/anthropic\", // verify in P2\n models: [\"deepseek-chat\", \"deepseek-reasoner\"],\n },\n qwen: {\n label: \"Qwen · Alibaba\", format: \"anthropic\", direct: true,\n baseUrl: \"\", // set in P2 (providerConfig)\n models: [\"qwen3-coder-plus\", \"qwen3-coder\"],\n },\n minimax: {\n label: \"MiniMax\", format: \"anthropic\", direct: true,\n baseUrl: \"\", // set in P2 (providerConfig)\n models: [\"MiniMax-M2\"],\n },\n openai: {\n label: \"OpenAI · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gpt-5.5\", \"gpt-5-mini\"],\n },\n gemini: {\n label: \"Gemini · via LiteLLM\", format: \"openai\", needsProxy: true, baseUrl: null,\n models: [\"gemini-3-pro\", \"gemini-3-flash\"],\n },\n};\n\nconst DEFAULT_LITELLM = \"http://127.0.0.1:4000\";\n\n// resolve(provider, model, reg) -> { ok, env, modelArgs, reason }\n// env : object spread into the child's env (ANTHROPIC_BASE_URL/_AUTH_TOKEN)\n// modelArgs : [] or [\"--model\", \"<id>\"] pushed into the claude argv\n// reg.providerConfig = {\n// glm: { token, baseUrl?, model? },\n// deepseek: { token, baseUrl?, model? },\n// litellm: { baseUrl?, token? }, // for openai/gemini\n// ...\n// }\nfunction resolve(provider, model, reg = {}) {\n const out = { ok: true, env: {}, modelArgs: [], reason: \"claude-default\" };\n const pConf = (reg && reg.providerConfig) || {};\n\n // Default brain: plain Claude. Optional explicit model only.\n if (!provider || provider === \"claude\") {\n if (model) out.modelArgs = [\"--model\", String(model)];\n return out;\n }\n\n const spec = PROVIDERS[provider];\n if (!spec) { return { ok: false, env: {}, modelArgs: [], reason: \"unknown-provider\" }; }\n\n const pc = pConf[provider] || {};\n let baseUrl, token;\n\n if (spec.needsProxy) {\n // OpenAI/Gemini ride a local LiteLLM gateway (Anthropic-compatible front).\n const lc = pConf.litellm || {};\n baseUrl = lc.baseUrl || reg.litellmUrl || DEFAULT_LITELLM;\n token = lc.token || pc.token || \"litellm\"; // LiteLLM master key (any non-empty)\n } else {\n baseUrl = pc.baseUrl || spec.baseUrl;\n token = pc.token;\n }\n\n // Not configured yet → fail-open to plain Claude.\n if (!baseUrl || !token) {\n return { ok: false, env: {}, modelArgs: [], reason: \"not-configured\" };\n }\n\n out.env = { ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_AUTH_TOKEN: token };\n const m = pc.model || model;\n if (m) out.modelArgs = [\"--model\", String(m)];\n out.reason = provider;\n return out;\n}\n\nmodule.exports = { PROVIDERS, DEFAULT_LITELLM, resolve };\n"}}}}