import { r as resolveAgentModelFallbackValues } from "./model-input-B7OGjVYg.js";
import { d as resolveAgentModelFallbacksOverride } from "./agent-scope-uF6sww3K.js";
import { r as resolveAgentConfig } from "./agent-scope-config-BGhyaQxC.js";
import { a as createModelVisibilityPolicyWithFallbacks } from "./model-selection-shared-CHgH9Zpi.js";
//#region src/agents/model-visibility-policy.ts
/**
* Builds model visibility policies with configured fallbacks included.
*/
const RUNTIME_MODEL_VISIBILITY_NORMALIZATION = {
	allowManifestNormalization: true,
	allowPluginNormalization: true
};
function resolveAllowedFallbacks(params) {
	if (params.agentId) {
		const override = resolveAgentModelFallbacksOverride(params.cfg, params.agentId);
		if (override !== void 0) return override;
	}
	return resolveAgentModelFallbackValues(params.cfg.agents?.defaults?.model);
}
function createModelVisibilityPolicy(params) {
	return createModelVisibilityPolicyWithFallbacks({
		cfg: params.cfg,
		catalog: params.catalog,
		defaultProvider: params.defaultProvider,
		defaultModel: params.defaultModel,
		fallbackModels: resolveAllowedFallbacks({
			cfg: params.cfg,
			agentId: params.agentId
		}),
		additionalConfiguredModelRefs: params.agentId ? Object.keys(resolveAgentConfig(params.cfg, params.agentId)?.models ?? {}) : [],
		allowManifestNormalization: params.allowManifestNormalization ?? false,
		allowPluginNormalization: params.allowPluginNormalization ?? false,
		manifestPlugins: params.manifestPlugins
	});
}
//#endregion
export { createModelVisibilityPolicy as n, RUNTIME_MODEL_VISIBILITY_NORMALIZATION as t };
