import type { FabricEvent } from './types.js'; /** * Lightweight WebSocket client for the Node server's `WS /sessions/:id/ws` * endpoint. Works in browsers and on Node 22+ (uses the global `WebSocket`). * Does NOT depend on the `ws` package — that's the server side's optional * peer dep. */ export interface WsClientOptions { /** WS URL — e.g. `ws://localhost:4317/sessions/abc/ws` or `wss://...` for production. */ url: string; /** Bearer token, sent as `?token=` query param (browsers can't set headers on WS). */ authToken?: string; /** Tenant id, sent as `?tenant=` query param. */ tenantId?: string; /** Number of past events to replay on connect. Default 20 (server-side). */ replay?: number; /** Called for every `event` message from the server. */ onEvent?: (event: FabricEvent) => void; /** Called once after the initial replay finishes. Live events follow. */ onReplayEnd?: () => void; /** Called on errors (transport or server-side). */ onError?: (error: Error) => void; /** Called when the socket closes (clean or otherwise). */ onClose?: () => void; /** Called for ack messages to client commands. */ onAck?: (ack: { for: string; ok: boolean; message?: string; }) => void; } export type WsClientCommand = { type: 'cancel'; taskId: string; reason?: string; } | { type: 'approve'; approvalId: string; decision: 'approved' | 'denied'; reason?: string; } | { type: 'ping'; ts?: number; }; export interface WsClientHandle { send(command: WsClientCommand): void; close(): void; } export declare function connectFabricWs(options: WsClientOptions): WsClientHandle; //# sourceMappingURL=ws-client.d.ts.map