import { ApiCaller } from '../api/api-caller'; import { ActionCallDto, MessageDto } from '../types/dtos'; import { WidgetMessageOptions, WidgetMessageReplyTo, WidgetMessageU, WidgetSystemMessageU } from '../types/messages'; import { WidgetConfig } from '../types/widget-config'; import { MessageCtx } from './message.ctx'; import { SessionCtx } from './session.ctx'; export declare class ActiveSessionPollingCtx { private api; private config; private sessionCtx; private messageCtx; private sessionPollingIntervalSeconds; private poller; private fetchSessionAndFullHistoryAbortController; private reconcileAbortController; private subscriptions; /** Session the in-flight post-stream reconcile belongs to, if any. */ private reconcilingSessionId; /** Ids the latest polls returned; only these can be removed by a later poll. */ private seenHistoryIds; /** Ids a poll removed. A response issued before the delete may still carry one; it must not come back. */ private removedHistoryIds; /** * Rows added by a response that could not remove, keyed to the highest seq * issued when it landed. A removing response with a seq at or below that * overlapped it and may have been read before the row was written, so it * must not remove the row. */ private protectedUntilSeq; /** Session a poll response has landed for since the conversation started. */ private landedPollSessionId; /** Polls overlap (the poller does not await them), so responses are ordered by issue. */ private pollSeq; private lastAppliedSeq; /** * Highest seq issued when the last response was applied. A request issued * while that response was in flight has no known snapshot order against it * (the server may have read it first), so it may add rows but never remove. */ private removableAfterSeq; constructor({ api, config, sessionCtx, messageCtx, sessionPollingIntervalSeconds, }: { api: ApiCaller; config: WidgetConfig; sessionCtx: SessionCtx; messageCtx: MessageCtx; sessionPollingIntervalSeconds: number; }); private registerPolling; dispose: () => void; /** * Ingest the canonical rows the backend persisted for a just-settled * streamed turn. Owns a REAL abort controller — cancelled on the session * boundary (see `registerPolling`), which is the whole point: the signal * this passes must be one somebody can actually fire. */ reconcileAfterStream: (sessionId: string) => Promise; fetchSessionAndHistory: ({ sessionId, abortSignal, }: { sessionId: string; abortSignal: AbortSignal; }) => Promise; /** A pick recorded elsewhere (another tab) lands on the message this tab already shows. */ private reconcileOptionPicks; mapHistoryToMessage: (history: MessageDto) => WidgetMessageU | null; /** * The quoted message carried by a reply — a teammate answering a specific * message, or the AI following up on one after asking the team. Spread into * the message so an absent quote adds no key at all. */ constructReplyTo: (history: MessageDto) => { replyTo?: WidgetMessageReplyTo; }; /** A message's tappable options, spread so a row without them adds no key. */ constructMessageOptions: (history: MessageDto) => { messageOptions?: WidgetMessageOptions; }; constructSystemMessage: (history: MessageDto) => WidgetSystemMessageU | null; extractActionResult: (action: ActionCallDto) => any; } //# sourceMappingURL=active-session-polling.ctx.d.ts.map