/** * Transport auto-select. * * Tiny helper that probes which transport lanes the runtime AND the platform * BOTH support, and returns the best one for this client/host pair. * * Preference order (best -> fallback): * 1. webtransport - multi-stream, lower head-of-line blocking * 2. websocket - universal default * 3. sse - HTTP-only fallback for restrictive networks * * The function fetches `/api/info` once, intersects its * `transports` array with the runtime's capabilities, and returns the * highest-preference match. Caller then instantiates the corresponding * primitive (`WebTransportTransport` / WebSocket / `SseTransport`) and * uses it as their lane. * * @example * ```ts * import { selectTransport, WebTransportTransport, SseTransport } from '@droponair/sdk-js'; * const lane = await selectTransport({ httpUrl: 'https://sdk.droponair.com' }); * switch (lane) { * case 'webtransport': // construct WebTransportTransport break; * case 'sse': // construct SseTransport break; * default: // fall through to WebSocket * } * ``` */ export type TransportLane = 'webtransport' | 'websocket' | 'sse'; export interface SelectTransportOptions { /** Base URL of the platform's REST API (no trailing slash). */ httpUrl: string; /** * Override the default WT -> WS -> SSE preference order. Useful for tests * or when a specific lane is preferred (e.g. force `sse` first on a known * firewalled network). */ preference?: TransportLane[]; /** Custom fetch impl, useful for Node polyfills + test doubles. */ fetchFn?: typeof fetch; } /** * Returns the highest-preference transport lane available on BOTH the * runtime and the platform. Throws if no lane is supported (extremely * unusual; WebSocket is the universal floor). */ export declare function selectTransport(options: SelectTransportOptions): Promise;