/**
 * model-identity.ts - user-facing names for provider wire model IDs.
 *
 * Purpose: keep provider-specific wire IDs stable while showing SF agents the
 * actual model identity they should reason about.
 *
 * Consumer: bootstrap/system-context.ts and dashboard surfaces.
 */
/**
 * Return the human-readable model identity for a provider route.
 *
 * Purpose: let prompts and dashboards discuss model capability/version without
 * rewriting the provider's required wire ID.
 *
 * Consumer: formatModelIdentity() and SF prompt context injection.
 */
export function normalizedModelName(model) {
	const provider = model.provider?.toLowerCase();
	const id = model.id.toLowerCase();
	const mimoName = normalizedMiMoModelName(id);
	if (mimoName) return mimoName;
	if (
		(provider === "kimi-coding" && id === "kimi-for-coding") ||
		id === "kimi-k2.6" ||
		id === "kimi-k2.6:cloud" ||
		id === "kimi-k2.6-cloud" ||
		id === "moonshotai/kimi-k2.6"
	)
		return "Kimi K2.6";
	if (
		id === "kimi-k2.5" ||
		id === "kimi-k2.5:cloud" ||
		id === "moonshotai/kimi-k2.5"
	)
		return "Kimi K2.5";
	if (model.name?.trim()) return model.name.trim();
	return model.id;
}
function normalizedMiMoModelName(id) {
	const bareId = id.startsWith("xiaomi/") ? id.slice("xiaomi/".length) : id;
	switch (bareId) {
		case "mimo-v2.5-pro":
			return "MiMo V2.5 Pro";
		case "mimo-v2.5":
			return "MiMo V2.5";
		case "mimo-v2-pro":
			return "MiMo V2 Pro";
		case "mimo-v2-omni":
			return "MiMo V2 Omni";
		case "mimo-v2-flash":
			return "MiMo V2 Flash";
		default:
			return undefined;
	}
}
/**
 * Return a display label that preserves both model identity and wire route.
 *
 * Purpose: avoid ambiguity for provider aliases such as Kimi Code's
 * `kimi-for-coding`, which is the wire ID for Kimi K2.6.
 *
 * Consumer: SF system context and UI surfaces that need stable model labels.
 */
export function formatModelIdentity(model) {
	const route = model.provider ? `${model.provider}/${model.id}` : model.id;
	const name = normalizedModelName(model);
	return name === model.id ? route : `${name} (${route})`;
}
