import { a as normalizeOptionalAgentRuntimeId, t as AUTO_AGENT_RUNTIME_ID } from "./agent-runtime-id-iSZ_VYTS.js";
import { t as resolveModelRuntimePolicy } from "./model-runtime-policy-B_BE4lG0.js";
import { s as openAIProviderUsesCodexRuntimeByDefault } from "./openai-codex-routing-Bj_v8mRJ.js";
//#region src/agents/harness/policy.ts
function resolveAgentHarnessPolicy(params) {
	const configured = resolveModelRuntimePolicy({
		config: params.config,
		provider: params.provider,
		modelId: params.modelId,
		agentId: params.agentId,
		sessionKey: params.sessionKey
	});
	const configuredRuntime = normalizeOptionalAgentRuntimeId(configured.policy?.id);
	const runtimeSource = configured.source ?? "implicit";
	const runtime = configuredRuntime && configuredRuntime !== "default" ? configuredRuntime : AUTO_AGENT_RUNTIME_ID;
	if (openAIProviderUsesCodexRuntimeByDefault({
		provider: params.provider,
		config: params.config
	})) {
		if (runtime === "auto") return {
			runtime: "codex",
			runtimeSource
		};
		return {
			runtime,
			runtimeSource
		};
	}
	return {
		runtime,
		runtimeSource
	};
}
//#endregion
export { resolveAgentHarnessPolicy as t };
