
//#region src/model-utils.ts
const DATE_SUFFIX_RE = /[-](\d{8}(-v\d+([:.]\d+)*)?)$|[-]\d{4}-\d{2}-\d{2}$/;
function normalizeModelName(model, skipNormalization) {
	if (!model || skipNormalization) return model;
	return model.replace(DATE_SUFFIX_RE, "");
}
const NONREASONING_FAMILIES = [
	"gpt-4.1",
	"gpt-4o",
	"gpt-4-turbo",
	"gpt-4",
	"gpt-3.5",
	"claude-3-5-",
	"claude-3-haiku",
	"claude-3-opus",
	"claude-3-sonnet",
	"gemini-1.5-"
];
const REASONING_FAMILIES = [
	"o1",
	"o3",
	"o4",
	"gpt-5",
	"deepseek-r1",
	"deepseek-reasoner",
	"claude-3-7-sonnet",
	"claude-opus-4",
	"claude-sonnet-4",
	"claude-haiku-4",
	"gpt-oss",
	"gemini-2.5-pro",
	"gemini-2.5-flash",
	"gemini-2.0-flash-thinking",
	"qwq",
	"qwen3"
];
/**
* Strip a leading provider segment that Bedrock (and similar) prepend before
* the actual family token — e.g. `anthropic.`, `us.anthropic.`, `eu.`. Keeps
* everything from the recognised family token onward so prefix matching works.
*/
function stripProviderPrefix(id) {
	let rest = id;
	while (true) {
		const dot = rest.indexOf(".");
		if (dot === -1) break;
		const head = rest.slice(0, dot);
		if (head.length === 0 || head.includes("-")) break;
		rest = rest.slice(dot + 1);
	}
	return rest;
}
function parseEnvList(raw) {
	if (!raw) return [];
	return raw.split(",").map((s) => stripProviderPrefix(normalizeModelName(s.trim())?.toLowerCase() ?? "")).filter((s) => s.length > 0);
}
function matchesAny(id, families) {
	return families.some((fam) => id.startsWith(fam));
}
/**
* Returns whether the real provider for `model` would emit a reasoning/thinking
* channel. Absence of a model id, or an unrecognised id, defaults to `true`
* (assume capable) — see the policy note above.
*/
function isReasoningModel(model) {
	if (!model) return true;
	const id = stripProviderPrefix(normalizeModelName(model)?.toLowerCase() ?? "");
	if (matchesAny(id, parseEnvList(process.env.AIMOCK_NONREASONING_MODELS))) return false;
	if (matchesAny(id, parseEnvList(process.env.AIMOCK_REASONING_MODELS))) return true;
	if (matchesAny(id, NONREASONING_FAMILIES)) return false;
	if (matchesAny(id, REASONING_FAMILIES)) return true;
	return true;
}

//#endregion
exports.isReasoningModel = isReasoningModel;
exports.normalizeModelName = normalizeModelName;
//# sourceMappingURL=model-utils.cjs.map