import "./agent-scope-DTd9OXHs.js";
import { c as resolveDefaultAgentId, n as listAgentIds } from "./agent-scope-config-By9b6pJY.js";
import { in as errorShape, rn as ErrorCodes } from "./schema-DS_xImy7.js";
import "./src-B6kXsJ7D.js";
//#region src/gateway/server-methods/agent-id-shared.ts
function resolveAgentIdOrRespondError(params) {
	const knownAgents = listAgentIds(params.cfg);
	const requestedAgentId = params.normalize(params.rawAgentId) ?? "";
	const agentId = requestedAgentId || resolveDefaultAgentId(params.cfg);
	if (requestedAgentId && !knownAgents.includes(agentId)) {
		params.respond(false, void 0, errorShape(ErrorCodes.INVALID_REQUEST, `unknown agent id "${requestedAgentId}"`));
		return null;
	}
	return {
		cfg: params.cfg,
		agentId
	};
}
//#endregion
export { resolveAgentIdOrRespondError as t };
