import { J as QIANFAN_DEFAULT_MODEL_ID, _ as upsertAuthProfile, w as resolveCoderClawAgentDir } from "./auth-profiles-Ci0m1nDj.js";

//#region src/commands/onboard-auth.models.ts
const MINIMAX_API_BASE_URL = "https://api.minimax.io/anthropic";
const MINIMAX_CN_API_BASE_URL = "https://api.minimaxi.com/anthropic";
const MINIMAX_HOSTED_MODEL_ID = "MiniMax-M2.1";
const MINIMAX_HOSTED_MODEL_REF = `minimax/${MINIMAX_HOSTED_MODEL_ID}`;
const DEFAULT_MINIMAX_CONTEXT_WINDOW = 2e5;
const DEFAULT_MINIMAX_MAX_TOKENS = 8192;
const MOONSHOT_BASE_URL = "https://api.moonshot.ai/v1";
const MOONSHOT_CN_BASE_URL = "https://api.moonshot.cn/v1";
const MOONSHOT_DEFAULT_MODEL_ID = "kimi-k2.5";
const MOONSHOT_DEFAULT_MODEL_REF = `moonshot/${MOONSHOT_DEFAULT_MODEL_ID}`;
const MOONSHOT_DEFAULT_CONTEXT_WINDOW = 256e3;
const MOONSHOT_DEFAULT_MAX_TOKENS = 8192;
const KIMI_CODING_MODEL_ID = "k2p5";
const KIMI_CODING_MODEL_REF = `kimi-coding/${KIMI_CODING_MODEL_ID}`;
const QIANFAN_DEFAULT_MODEL_REF = `qianfan/${QIANFAN_DEFAULT_MODEL_ID}`;
const ZAI_CODING_GLOBAL_BASE_URL = "https://api.z.ai/api/coding/paas/v4";
const ZAI_CODING_CN_BASE_URL = "https://open.bigmodel.cn/api/coding/paas/v4";
const ZAI_GLOBAL_BASE_URL = "https://api.z.ai/api/paas/v4";
const ZAI_CN_BASE_URL = "https://open.bigmodel.cn/api/paas/v4";
const ZAI_DEFAULT_MODEL_ID = "glm-5";
function resolveZaiBaseUrl(endpoint) {
	switch (endpoint) {
		case "coding-cn": return ZAI_CODING_CN_BASE_URL;
		case "global": return ZAI_GLOBAL_BASE_URL;
		case "cn": return ZAI_CN_BASE_URL;
		case "coding-global": return ZAI_CODING_GLOBAL_BASE_URL;
		default: return ZAI_GLOBAL_BASE_URL;
	}
}
const MINIMAX_API_COST = {
	input: 15,
	output: 60,
	cacheRead: 2,
	cacheWrite: 10
};
const MINIMAX_LM_STUDIO_COST = {
	input: 0,
	output: 0,
	cacheRead: 0,
	cacheWrite: 0
};
const MOONSHOT_DEFAULT_COST = {
	input: 0,
	output: 0,
	cacheRead: 0,
	cacheWrite: 0
};
const ZAI_DEFAULT_COST = {
	input: 0,
	output: 0,
	cacheRead: 0,
	cacheWrite: 0
};
const MINIMAX_MODEL_CATALOG = {
	"MiniMax-M2.1": {
		name: "MiniMax M2.1",
		reasoning: false
	},
	"MiniMax-M2.1-lightning": {
		name: "MiniMax M2.1 Lightning",
		reasoning: false
	},
	"MiniMax-M2.5": {
		name: "MiniMax M2.5",
		reasoning: true
	},
	"MiniMax-M2.5-Lightning": {
		name: "MiniMax M2.5 Lightning",
		reasoning: true
	}
};
const ZAI_MODEL_CATALOG = {
	"glm-5": {
		name: "GLM-5",
		reasoning: true
	},
	"glm-4.7": {
		name: "GLM-4.7",
		reasoning: true
	},
	"glm-4.7-flash": {
		name: "GLM-4.7 Flash",
		reasoning: true
	},
	"glm-4.7-flashx": {
		name: "GLM-4.7 FlashX",
		reasoning: true
	}
};
function buildMinimaxModelDefinition(params) {
	const catalog = MINIMAX_MODEL_CATALOG[params.id];
	return {
		id: params.id,
		name: params.name ?? catalog?.name ?? `MiniMax ${params.id}`,
		reasoning: params.reasoning ?? catalog?.reasoning ?? false,
		input: ["text"],
		cost: params.cost,
		contextWindow: params.contextWindow,
		maxTokens: params.maxTokens
	};
}
function buildMinimaxApiModelDefinition(modelId) {
	return buildMinimaxModelDefinition({
		id: modelId,
		cost: MINIMAX_API_COST,
		contextWindow: DEFAULT_MINIMAX_CONTEXT_WINDOW,
		maxTokens: DEFAULT_MINIMAX_MAX_TOKENS
	});
}
function buildMoonshotModelDefinition() {
	return {
		id: MOONSHOT_DEFAULT_MODEL_ID,
		name: "Kimi K2.5",
		reasoning: false,
		input: ["text"],
		cost: MOONSHOT_DEFAULT_COST,
		contextWindow: MOONSHOT_DEFAULT_CONTEXT_WINDOW,
		maxTokens: MOONSHOT_DEFAULT_MAX_TOKENS
	};
}
function buildZaiModelDefinition(params) {
	const catalog = ZAI_MODEL_CATALOG[params.id];
	return {
		id: params.id,
		name: params.name ?? catalog?.name ?? `GLM ${params.id}`,
		reasoning: params.reasoning ?? catalog?.reasoning ?? true,
		input: ["text"],
		cost: params.cost ?? ZAI_DEFAULT_COST,
		contextWindow: params.contextWindow ?? 204800,
		maxTokens: params.maxTokens ?? 131072
	};
}
const XAI_BASE_URL = "https://api.x.ai/v1";
const XAI_DEFAULT_MODEL_ID = "grok-4";
const XAI_DEFAULT_MODEL_REF = `xai/${XAI_DEFAULT_MODEL_ID}`;
const XAI_DEFAULT_CONTEXT_WINDOW = 131072;
const XAI_DEFAULT_MAX_TOKENS = 8192;
const XAI_DEFAULT_COST = {
	input: 0,
	output: 0,
	cacheRead: 0,
	cacheWrite: 0
};
function buildXaiModelDefinition() {
	return {
		id: XAI_DEFAULT_MODEL_ID,
		name: "Grok 4",
		reasoning: false,
		input: ["text"],
		cost: XAI_DEFAULT_COST,
		contextWindow: XAI_DEFAULT_CONTEXT_WINDOW,
		maxTokens: XAI_DEFAULT_MAX_TOKENS
	};
}

//#endregion
//#region src/commands/onboard-auth.credentials.ts
const resolveAuthAgentDir = (agentDir) => agentDir ?? resolveCoderClawAgentDir();
async function writeOAuthCredentials(provider, creds, agentDir) {
	upsertAuthProfile({
		profileId: `${provider}:${typeof creds.email === "string" && creds.email.trim() ? creds.email.trim() : "default"}`,
		credential: {
			type: "oauth",
			provider,
			...creds
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setAnthropicApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "anthropic:default",
		credential: {
			type: "api_key",
			provider: "anthropic",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setGeminiApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "google:default",
		credential: {
			type: "api_key",
			provider: "google",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setMinimaxApiKey(key, agentDir, profileId = "minimax:default") {
	upsertAuthProfile({
		profileId,
		credential: {
			type: "api_key",
			provider: profileId.split(":")[0] ?? "minimax",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setMoonshotApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "moonshot:default",
		credential: {
			type: "api_key",
			provider: "moonshot",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setKimiCodingApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "kimi-coding:default",
		credential: {
			type: "api_key",
			provider: "kimi-coding",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setSyntheticApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "synthetic:default",
		credential: {
			type: "api_key",
			provider: "synthetic",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setVeniceApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "venice:default",
		credential: {
			type: "api_key",
			provider: "venice",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
const ZAI_DEFAULT_MODEL_REF = "zai/glm-5";
const XIAOMI_DEFAULT_MODEL_REF = "xiaomi/mimo-v2-flash";
const OPENROUTER_DEFAULT_MODEL_REF = "openrouter/auto";
const HUGGINGFACE_DEFAULT_MODEL_REF = "huggingface/deepseek-ai/DeepSeek-R1";
const TOGETHER_DEFAULT_MODEL_REF = "together/moonshotai/Kimi-K2.5";
const LITELLM_DEFAULT_MODEL_REF = "litellm/claude-opus-4-6";
const VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF = "vercel-ai-gateway/anthropic/claude-opus-4.6";
async function setZaiApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "zai:default",
		credential: {
			type: "api_key",
			provider: "zai",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setXiaomiApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "xiaomi:default",
		credential: {
			type: "api_key",
			provider: "xiaomi",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setOpenrouterApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "openrouter:default",
		credential: {
			type: "api_key",
			provider: "openrouter",
			key: key === "undefined" ? "" : key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setCloudflareAiGatewayConfig(accountId, gatewayId, apiKey, agentDir) {
	const normalizedAccountId = accountId.trim();
	const normalizedGatewayId = gatewayId.trim();
	upsertAuthProfile({
		profileId: "cloudflare-ai-gateway:default",
		credential: {
			type: "api_key",
			provider: "cloudflare-ai-gateway",
			key: apiKey.trim(),
			metadata: {
				accountId: normalizedAccountId,
				gatewayId: normalizedGatewayId
			}
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setLitellmApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "litellm:default",
		credential: {
			type: "api_key",
			provider: "litellm",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setVercelAiGatewayApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "vercel-ai-gateway:default",
		credential: {
			type: "api_key",
			provider: "vercel-ai-gateway",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setOpencodeZenApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "opencode:default",
		credential: {
			type: "api_key",
			provider: "opencode",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setTogetherApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "together:default",
		credential: {
			type: "api_key",
			provider: "together",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
async function setHuggingfaceApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "huggingface:default",
		credential: {
			type: "api_key",
			provider: "huggingface",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
function setQianfanApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "qianfan:default",
		credential: {
			type: "api_key",
			provider: "qianfan",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}
function setXaiApiKey(key, agentDir) {
	upsertAuthProfile({
		profileId: "xai:default",
		credential: {
			type: "api_key",
			provider: "xai",
			key
		},
		agentDir: resolveAuthAgentDir(agentDir)
	});
}

//#endregion
export { MINIMAX_LM_STUDIO_COST as A, ZAI_CODING_CN_BASE_URL as B, setXaiApiKey as C, KIMI_CODING_MODEL_REF as D, writeOAuthCredentials as E, QIANFAN_DEFAULT_MODEL_REF as F, buildMinimaxModelDefinition as G, ZAI_DEFAULT_MODEL_ID as H, XAI_BASE_URL as I, buildZaiModelDefinition as J, buildMoonshotModelDefinition as K, XAI_DEFAULT_MODEL_ID as L, MOONSHOT_CN_BASE_URL as M, MOONSHOT_DEFAULT_MODEL_ID as N, MINIMAX_API_BASE_URL as O, MOONSHOT_DEFAULT_MODEL_REF as P, XAI_DEFAULT_MODEL_REF as R, setVercelAiGatewayApiKey as S, setZaiApiKey as T, ZAI_GLOBAL_BASE_URL as U, ZAI_CODING_GLOBAL_BASE_URL as V, buildMinimaxApiModelDefinition as W, resolveZaiBaseUrl as Y, setOpenrouterApiKey as _, VERCEL_AI_GATEWAY_DEFAULT_MODEL_REF as a, setTogetherApiKey as b, setAnthropicApiKey as c, setHuggingfaceApiKey as d, setKimiCodingApiKey as f, setOpencodeZenApiKey as g, setMoonshotApiKey as h, TOGETHER_DEFAULT_MODEL_REF as i, MOONSHOT_BASE_URL as j, MINIMAX_CN_API_BASE_URL as k, setCloudflareAiGatewayConfig as l, setMinimaxApiKey as m, LITELLM_DEFAULT_MODEL_REF as n, XIAOMI_DEFAULT_MODEL_REF as o, setLitellmApiKey as p, buildXaiModelDefinition as q, OPENROUTER_DEFAULT_MODEL_REF as r, ZAI_DEFAULT_MODEL_REF as s, HUGGINGFACE_DEFAULT_MODEL_REF as t, setGeminiApiKey as u, setQianfanApiKey as v, setXiaomiApiKey as w, setVeniceApiKey as x, setSyntheticApiKey as y, ZAI_CN_BASE_URL as z };