import { normalizeProviderId } from "./model-selection.js";
//#region src/agent/transcript/provider-capabilities.ts
const DEFAULT_PROVIDER_CAPABILITIES = {
	anthropicToolSchemaMode: "native",
	anthropicToolChoiceMode: "native",
	providerFamily: "default",
	preserveAnthropicThinkingSignatures: true,
	openAiCompatTurnValidation: true,
	geminiThoughtSignatureSanitization: false,
	transcriptToolCallIdMode: "default",
	transcriptToolCallIdModelHints: [],
	geminiThoughtSignatureModelHints: [],
	dropThinkingBlockModelHints: []
};
const PROVIDER_CAPABILITIES = {
	anthropic: { providerFamily: "anthropic" },
	"amazon-bedrock": { providerFamily: "anthropic" },
	"kimi-coding": { preserveAnthropicThinkingSignatures: false },
	mistral: {
		transcriptToolCallIdMode: "strict9",
		transcriptToolCallIdModelHints: [
			"mistral",
			"mixtral",
			"codestral",
			"pixtral",
			"devstral",
			"ministral",
			"mistralai"
		]
	},
	openai: { providerFamily: "openai" },
	"openai-codex": { providerFamily: "openai" },
	openrouter: {
		openAiCompatTurnValidation: false,
		geminiThoughtSignatureSanitization: true,
		geminiThoughtSignatureModelHints: ["gemini"]
	},
	opencode: {
		openAiCompatTurnValidation: false,
		geminiThoughtSignatureSanitization: true,
		geminiThoughtSignatureModelHints: ["gemini"]
	},
	kilocode: {
		geminiThoughtSignatureSanitization: true,
		geminiThoughtSignatureModelHints: ["gemini"]
	},
	"github-copilot": { dropThinkingBlockModelHints: ["claude"] }
};
function resolveProviderCapabilities(provider) {
	const normalized = normalizeProviderId(provider ?? "");
	return {
		...DEFAULT_PROVIDER_CAPABILITIES,
		...PROVIDER_CAPABILITIES[normalized]
	};
}
function preservesAnthropicThinkingSignatures(provider) {
	return resolveProviderCapabilities(provider).preserveAnthropicThinkingSignatures;
}
function requiresOpenAiCompatibleAnthropicToolPayload(provider) {
	const capabilities = resolveProviderCapabilities(provider);
	return capabilities.anthropicToolSchemaMode !== "native" || capabilities.anthropicToolChoiceMode !== "native";
}
function usesOpenAiFunctionAnthropicToolSchema(provider) {
	return resolveProviderCapabilities(provider).anthropicToolSchemaMode === "openai-functions";
}
function usesOpenAiStringModeAnthropicToolChoice(provider) {
	return resolveProviderCapabilities(provider).anthropicToolChoiceMode === "openai-string-modes";
}
function supportsOpenAiCompatTurnValidation(provider) {
	return resolveProviderCapabilities(provider).openAiCompatTurnValidation;
}
function sanitizesGeminiThoughtSignatures(provider) {
	return resolveProviderCapabilities(provider).geminiThoughtSignatureSanitization;
}
function modelIncludesAnyHint(modelId, hints) {
	const normalized = (modelId ?? "").toLowerCase();
	return Boolean(normalized) && hints.some((hint) => normalized.includes(hint));
}
function isOpenAiProviderFamily(provider) {
	return resolveProviderCapabilities(provider).providerFamily === "openai";
}
function isAnthropicProviderFamily(provider) {
	return resolveProviderCapabilities(provider).providerFamily === "anthropic";
}
function shouldDropThinkingBlocksForModel(params) {
	return modelIncludesAnyHint(params.modelId, resolveProviderCapabilities(params.provider).dropThinkingBlockModelHints);
}
function shouldSanitizeGeminiThoughtSignaturesForModel(params) {
	const capabilities = resolveProviderCapabilities(params.provider);
	return capabilities.geminiThoughtSignatureSanitization && modelIncludesAnyHint(params.modelId, capabilities.geminiThoughtSignatureModelHints);
}
function resolveTranscriptToolCallIdMode(provider, modelId) {
	const capabilities = resolveProviderCapabilities(provider);
	const mode = capabilities.transcriptToolCallIdMode;
	if (mode === "strict9") return mode;
	if (modelIncludesAnyHint(modelId, capabilities.transcriptToolCallIdModelHints)) return "strict9";
}
//#endregion
export { isAnthropicProviderFamily, isOpenAiProviderFamily, preservesAnthropicThinkingSignatures, requiresOpenAiCompatibleAnthropicToolPayload, resolveProviderCapabilities, resolveTranscriptToolCallIdMode, sanitizesGeminiThoughtSignatures, shouldDropThinkingBlocksForModel, shouldSanitizeGeminiThoughtSignaturesForModel, supportsOpenAiCompatTurnValidation, usesOpenAiFunctionAnthropicToolSchema, usesOpenAiStringModeAnthropicToolChoice };

//# sourceMappingURL=provider-capabilities.js.map