//#region src/domains/run/utils/model-resolver.ts
async function resolveModelConfig(executionContext, subAgent) {
	const { agentId, project } = executionContext;
	if (subAgent.models?.base?.model) return {
		base: subAgent.models.base,
		structuredOutput: subAgent.models.structuredOutput || subAgent.models.base,
		summarizer: subAgent.models.summarizer || subAgent.models.base
	};
	const agent = project.agents[agentId];
	if (agent?.models?.base?.model) return {
		base: agent.models.base,
		structuredOutput: subAgent.models?.structuredOutput || agent.models.structuredOutput || agent.models.base,
		summarizer: subAgent.models?.summarizer || agent.models.summarizer || agent.models.base
	};
	if (project?.models?.base?.model) return {
		base: project.models.base,
		structuredOutput: subAgent.models?.structuredOutput || project.models.structuredOutput || project.models.base,
		summarizer: subAgent.models?.summarizer || project.models.summarizer || project.models.base
	};
	throw new Error("Base model configuration is required. Please configure models at the project level.");
}

//#endregion
export { resolveModelConfig };