import type { ChatStore } from './store.js'; import type { ConversationId } from './protocol/index.js'; import type { Renderer } from './renderer.js'; /** Resolve a single user-supplied relay URL into the concrete WebSocket URL and * HTTP(S) base the client needs. * * Accepts any scheme — `https://`, `http://`, `wss://`, or `ws://` — and any of * these shapes: bare origin (`https://api.example.com`), origin with `/ws` * (`wss://api.example.com/ws`), or a sub-path (`https://api.example.com/relay`). * * https://api.example.com → ws wss://api.example.com/ws · http https://api.example.com * wss://api.example.com/ws → ws wss://api.example.com/ws · http https://api.example.com * http://localhost:3000 → ws ws://localhost:3000/ws · http http://localhost:3000 * * `https`/`wss` map to a secure socket (`wss`); `http`/`ws` map to `ws`. A bare * host with no scheme is assumed secure. Pass `apiBaseOverride` only when the * REST API lives on a different origin than the socket. */ export declare function resolveRelayUrls(input: string, apiBaseOverride?: string): { wsUrl: string; httpBase: string; }; /** Derive the HTTP(S) base origin from a ws(s):// URL. * @deprecated prefer {@link resolveRelayUrls}; kept for back-compat. */ export declare function httpBaseFromWsUrl(wsUrl: string): string; /** Initial history restore on conversation open. * * Fetches the latest PAGE messages and sets up scroll-triggered loading for * older messages: a `scroll` listener on the container's own scrollTop (see * below), not an IntersectionObserver sentinel. No buttons — scrolling up * loads more automatically. * * Does NOT return a cleanup function — the scroll-listener teardown is * registered internally via `renderer.setScrollCleanup()` and runs whenever * the renderer tears down the conversation view. Callers just `void` this * call (see index.ts). */ export declare function restoreHistory(wsUrl: string, token: string, conversationId: ConversationId, store: ChatStore, renderer: Renderer, apiBase?: string): Promise;