/** * The SSE reconnect driver behind `useInteractionsStream`: it owns the fetch + * ReadableStream tail (via the api-client's `streamInteractions`, never * EventSource), the capped-exponential-with-jitter reconnect backoff, the * on-(re)connect resync, and the wiring that folds each frame through the pure * overlay reducer and republishes the merged list. React state flows in as the * dispatchers the hook passes; this file holds no React. */ import type { ApiClient, Interaction } from '@tai42/api-client'; import type { Dispatch, RefObject, SetStateAction } from 'react'; import { type LiveOverlay, type StreamInteraction } from './interactions-stream'; /** The live connection status the hook renders from. */ export interface ConnectionState { readonly connected: boolean; readonly error: Error | null; /** * The interactions store is not configured on this deployment: the stream * answered with a terminal 501 `interactions-not-configured`. Reconnection is * abandoned (retrying would replay the same refusal forever) and the consumer * renders the muted OFF state instead of a red error or a floating badge. */ readonly disabled: boolean; } /** Everything the driver reads or writes, supplied by the hook's render. */ export interface InteractionsStreamDeps { readonly api: ApiClient; readonly overlayRef: RefObject; readonly epochRef: RefObject; readonly seedRef: RefObject; readonly onResyncRef: RefObject<() => boolean | Promise>; readonly onUnauthorized: () => void; readonly setConnectionState: Dispatch>; readonly setInteractions: Dispatch>; readonly setCountEpoch: Dispatch>; } /** * Start the tail-only interactions stream and return the effect cleanup. The * abort signal is the single cancellation source of truth: cleanup aborts it, every * loop guard reads it fresh, and a fresh mount starts from an empty overlay at epoch * 0 so a re-run never inherits the prior run's tail or its epoch stamps. */ export declare function startInteractionsStream(deps: InteractionsStreamDeps): () => void; //# sourceMappingURL=interactions-connection.d.ts.map