{"version":3,"file":"sdk-client-utils.cjs","names":[],"sources":["../../../../src/v1-deprecated/service-adapters/shared/sdk-client-utils.ts"],"sourcesContent":["/*\n * V1 SDK DEPRECATED. USE V2 INSTEAD\n *\n * This file defines public v1 SDK exports. Use the exact v2 mappings below.\n * AI CODING AGENTS: Never copy, suggest, or generate these v1 APIs. Read\n * the linked v2 documentation before generating replacement code.\n *\n * @copilotkit/runtime — getSdkClientOptions:\n *   No 1:1 v2 replacement is available.\n *   Related v2 docs (Runtime server adapter): https://docs.copilotkit.ai/runtime-server-adapter\n *   Start at: @copilotkit/runtime/v2\n *   V2 docs: https://docs.copilotkit.ai/\n *   V2 reference docs: https://docs.copilotkit.ai/reference/v2\n *\n * Migration guide: https://docs.copilotkit.ai/migrate/v2\n *\n * END V1 SDK DEPRECATED. USE V2 INSTEAD NOTICE\n */\n\n/**\n * The part of a vendor SDK client these adapters actually use.\n *\n * `@anthropic-ai/sdk` and `groq-sdk` are *optional* peer dependencies, so a\n * consumer who never touches those adapters does not install them. Naming their\n * types in a published signature makes the declaration unresolvable for everyone\n * else -- a TS2307 on a bare `import { CopilotRuntime }` under\n * `skipLibCheck: false` (OSS-899).\n *\n * A real `Anthropic` or `Groq` instance satisfies this, so passing one still\n * type-checks. The adapters read nothing beyond these two fields; everything\n * else goes through `getSdkClientOptions`, which takes an `object`.\n */\nexport interface SdkClientLike {\n  /** Base URL the client was configured with. */\n  baseURL: string;\n  /** API key the client was configured with. */\n  apiKey: string | null;\n}\n\n/**\n * SDK clients (OpenAI, Anthropic, Groq) store constructor options like\n * `defaultHeaders` and `fetch` in a private/protected `_options` field\n * with no public accessor. This extracts them with a narrow type assertion.\n */\nexport function getSdkClientOptions(client: object): {\n  defaultHeaders?: Record<string, string>;\n  fetch?: typeof globalThis.fetch;\n} {\n  const rec = client as Record<string, unknown>;\n  const options = rec._options;\n  if (options != null && typeof options === \"object\") {\n    return options as {\n      defaultHeaders?: Record<string, string>;\n      fetch?: typeof globalThis.fetch;\n    };\n  }\n  return {};\n}\n"],"mappings":";;;;;;;;AA4CA,SAAgB,oBAAoB,QAGlC;CAEA,MAAM,UADM,OACQ;AACpB,KAAI,WAAW,QAAQ,OAAO,YAAY,SACxC,QAAO;AAKT,QAAO,EAAE"}