import type { Signal } from '../core/signal'; import type { ManagedSocket } from '../ws/ws'; export interface RtcConfig { backend: string; iceServers?: RTCIceServer[]; signalling?: string; chat?: string; messages?: string; files?: string; } /** Fetch the self-describing realtime config (ICE servers + resolved paths). */ export declare function rtcConfig(url?: string): Promise; export type CallStatus = 'idle' | 'connecting' | 'connected' | 'closed'; export interface RemotePeer { id: string; stream: MediaStream | null; } export interface CallOptions { /** Pre-fetched config (skips the fetch); else configUrl is used. */ config?: RtcConfig; /** Where to fetch the config from (default "/api/rtc/config"). */ configUrl?: string; /** Explicit signalling WS base (overrides config); "{room}" is appended. */ signallingUrl?: string; /** ICE servers override (else from config). */ iceServers?: RTCIceServer[]; /** Local media constraints, or a ready MediaStream, or false for recv-only. */ media?: MediaStreamConstraints | MediaStream | false; } export interface CallSession { readonly status: Signal; readonly localStream: Signal; readonly peers: Signal; readonly screenSharing: Signal; readonly error: Signal; /** This peer's id in the room. */ readonly id: string; shareScreen(): Promise; stopScreen(): Promise; toggleAudio(on?: boolean): boolean; toggleVideo(on?: boolean): boolean; leave(): void; } declare function startCall(room: string, options?: CallOptions): Promise; export interface ChatMessage { id?: number; channel_id?: number; user_id?: string; body?: string; thread_id?: number | null; created_at?: string; } export interface ChatOptions { /** JWT for the secured chat WebSocket + history/upload calls. */ token?: string; /** Explicit chat WS base ("{channel}" appended); else derived from location. */ url?: string; /** HTTP base for history (default same origin). */ apiBase?: string; /** Path template for history (default "/api/channels/{id}/messages"). */ messagesPath?: string; /** ms a typing indicator lingers before auto-clearing (default 3000). */ typingTimeout?: number; } export interface ChatSession { readonly status: ManagedSocket['status']; readonly connected: ManagedSocket['connected']; readonly messages: Signal; readonly presence: Signal; readonly typing: Signal; send(body: string, threadId?: number): void; sendTyping(): void; markRead(): void; history(before?: number, limit?: number): Promise; close(): void; } declare function startChat(channel: string | number, options?: ChatOptions): ChatSession; export interface UploadResult { id: number; key: string; filename: string; mime: string; size: number; url: string; } export interface FileOptions { token?: string; apiBase?: string; filesPath?: string; } declare function uploadFile(channel: string | number, file: File | Blob, options?: FileOptions): Promise; /** * Fetch a permissioned download as an object URL. A secured GET route can't be * hit by a bare (no auth header), so fetch with the token and wrap the * blob. For an S3 backend the upload result's `url` is already a presigned URL * usable directly; this is the local-storage path. */ declare function fetchBlobUrl(keyOrUrl: string, options?: FileOptions): Promise; export declare const rtc: { config: typeof rtcConfig; call: typeof startCall; chat: typeof startChat; upload: typeof uploadFile; fetchBlob: typeof fetchBlobUrl; }; export {}; //# sourceMappingURL=rtc.d.ts.map