import { CortiClient as BaseCortiClient } from "../Client.mjs"; import type * as environments from "../environments.mjs"; import { CustomAgentic } from "./agentic/CustomAgentic.mjs"; import { CustomAgents } from "./agents/CustomAgents.mjs"; import { CortiAuth } from "./auth/CortiAuth.mjs"; import { CustomStream } from "./stream/CustomStream.mjs"; import { CustomTranscribe } from "./transcribe/CustomTranscribe.mjs"; import { type Environment } from "./utils/environment.mjs"; type OptionsBase = Omit & { withCredentials?: boolean; /** * Additional call-site metadata merged into the X-Corti-Analytics payload. * `sdk_version` and `sdk_type` are reserved and always set by the SDK. */ analytics?: Record; /** * When true, encodes the client's auth headers as WebSocket subprotocol pairs instead of * HTTP headers on every WebSocket connection. Useful when connecting through a gateway * that strips HTTP headers but passes WS protocols through. */ encodeHeadersAsWsProtocols?: boolean; }; export declare namespace CortiClient { type Auth = CortiAuth.AuthServer | CortiAuth.AuthTokenDerivable; type Options = (OptionsBase & { auth: CortiAuth.AuthServer; tenantName: string; environment: Environment; }) | (OptionsBase & { auth: CortiAuth.AuthTokenDerivable; tenantName?: string; environment?: Environment; }) | (OptionsBase & { baseUrl: string; auth?: Auth; tenantName?: string; environment?: Environment; }) | (OptionsBase & { environment: environments.CortiEnvironmentUrls; auth?: Auth; tenantName?: string; }); interface RequestOptions extends BaseCortiClient.RequestOptions { } } export declare class CortiClient extends BaseCortiClient { protected _auth: CortiAuth | undefined; protected _stream: CustomStream | undefined; protected _transcribe: CustomTranscribe | undefined; protected _agents: CustomAgents | undefined; protected _agentic: CustomAgentic | undefined; private readonly _encodeHeadersAsWsProtocols; private readonly _analytics; constructor(options: CortiClient.Options); get auth(): CortiAuth; get stream(): CustomStream; get transcribe(): CustomTranscribe; /** @deprecated Migrate to the Agentic API v2. See https://docs.corti.ai/agentic/guides/migrate-v1-to-v2 */ get agents(): CustomAgents; get agentic(): CustomAgentic; /** * Returns the full set of URLs the client is configured to use. * * If a custom `baseUrl` was provided it overrides the `base` field; all * other URLs are derived from the configured environment. * * @example * ```typescript * const client = new CortiClient({ environment: "eu", ... }); * const urls = await client.getEnvironmentUrls(); * // { base: "https://api.eu.corti.app/v2", wss: "wss://...", login: "https://...", agents: "https://..." } * ``` */ getEnvironmentUrls: () => Promise; /** * Retrieves authentication headers for API requests. * * This method returns a Headers object containing the Authorization header with a valid * bearer token and the Tenant-Name header. The token is automatically refreshed if needed. * * @returns A Promise that resolves to a Headers object with Authorization and Tenant-Name headers * * @example * ```typescript * const client = new CortiClient({ ... }); * const headers = await client.getAuthHeaders(); * console.log(headers.get("Authorization")); // "Bearer ..." * console.log(headers.get("Tenant-Name")); // "your-tenant" * ``` */ getAuthHeaders: () => Promise; /** * Retrieves all configured client headers, including authentication, tenant, * custom headers, analytics, and SDK metadata. Tokens are refreshed if needed * and header suppliers are resolved on each call. * * Endpoint-specific headers such as Accept and Content-Type are not included. * * @example * ```typescript * const headers = await client.getHeaders(); * ``` */ getHeaders: () => Promise; } export {};