export type WebSocketStatus = "connecting" | "connected" | "disconnected"; export interface InsightWebSocketOptions { /** Called when a message is received from the server */ onMessage?: (data: unknown) => void; /** Called when the connection status changes */ onStatusChange?: (status: WebSocketStatus) => void; /** Called when an error occurs */ onError?: (event: Event) => void; /** Enable automatic reconnection (default: true) */ reconnect?: boolean; /** Maximum number of reconnect attempts (default: 5) */ maxReconnectAttempts?: number; } /** * WebSocket client for communicating with the Monolith insightSocket endpoint. * * Usage: * ```ts * const ws = new InsightWebSocket("my-insight-id", { * onMessage: (data) => console.log("Received:", data), * onStatusChange: (status) => console.log("Status:", status), * }); * ws.connect(); * ws.send("GetSystemConfig();"); * ws.close(); * ``` */ export declare class InsightWebSocket { private ws; private insightId; private options; private reconnectAttempts; private reconnectTimer; private closed; constructor(insightId: string, options?: InsightWebSocketOptions); /** Build the WebSocket URL from the current page location and Env.MODULE */ private buildUrl; /** Open the WebSocket connection */ connect(): void; private open; private scheduleReconnect; /** Send a pixel expression over the WebSocket */ send(pixel: string): void; /** * Start a streamer on the backend for the given type. * New data will arrive as messages via onMessage. * * @param type - registered streamer type (e.g. "claude_code") * @param params - additional params passed to the streamer factory */ watch(type: string, params?: Record): void; /** Stop a streamer by type and params (must match what was passed to watch). */ unwatch(type: string, params?: Record): void; /** Send a raw JSON message over the WebSocket */ sendRaw(data: Record): void; /** Close the WebSocket connection */ close(): void; /** Whether the socket is currently open */ get isConnected(): boolean; }