import { DefaultChatTransport } from "ai";
const DEFAULT_ENDPOINT = "/api/ai_assistant/ai/chat";
function buildEndpointWithAgentQuery(endpoint, agentId) {
  if (!agentId) return endpoint;
  const separator = endpoint.includes("?") ? "&" : "?";
  return `${endpoint}${separator}agent=${encodeURIComponent(agentId)}`;
}
function createAiAgentTransport(input) {
  const endpoint = buildEndpointWithAgentQuery(
    input.endpoint && input.endpoint.length > 0 ? input.endpoint : DEFAULT_ENDPOINT,
    input.agentId
  );
  const extraBody = { ...input.body ?? {} };
  if (typeof input.debug === "boolean") {
    extraBody.debug = input.debug;
  }
  return new DefaultChatTransport({
    api: endpoint,
    body: extraBody
  });
}
export {
  createAiAgentTransport
};
//# sourceMappingURL=agent-transport.js.map
