import type { ChatError, ConnectionState } from '../types.js'; /** Options for {@link useConnectionState}'s `startNewSession`. */ export type StartNewSessionOptions = { /** * Also null `currentConversationId` before reconnecting (opt-in; default off). * Use on COO ENTER, where the forceNew abandons the current session and its * conversation pointer becomes a dangling reference the new session doesn't know. */ resetConversation?: boolean; }; export declare function useConnectionState(): { connectionState: ConnectionState; /** * Session-level recovery flag (#29). Independent of `connectionState`: * a connected WS can be mid-recovery (server replaying interrupted * conversation context). Combine with `connectionState` for UI: * - `connectionState !== 'connected'` → transport status * - `connectionState === 'connected' && isRecovering` → "Resuming session…" * - `connectionState === 'connected' && !isRecovering` → all good */ isRecovering: boolean; error: ChatError | null; reconnectAttempt: number; reconnect: () => void; /** * Force a brand-new gateway session (appends `new=1` → gateway createSession). * COO toggle ENTER/EXIT (#467/#1076): mode is baked at session creation, so * switching it needs a fresh session. Await it to know the reconnect kicked * off; the resulting `session_ready.mode` drives the shell via useSession(). * * Reconciles the abandoned session's transient streaming state up front (clears * `processingConversationIds` + resets the `isStreaming`/`isThinking` flags) — a * forceNew deliberately drops the current session, so any turn still streaming on * it can never emit `finish`, which would otherwise leave the composer stuck * (#619). * * `opts.resetConversation` (opt-in): also null `currentConversationId` before * reconnecting. The pointer survives a forceNew as a dangling reference to a * conversation the NEW session doesn't know (e.g. the onboarding conversation on * COO ENTER) — the first message would mis-route into it and the connected-edge * auto-restore would fire a spurious `restore_request` for it. Nulling lets the * shell lazily create a fresh conversation. Left OFF by default so EXIT (COO→chat) * keeps the user's place; the caller decides per direction (#619 follow-up). */ startNewSession: (opts?: StartNewSessionOptions) => Promise; }; //# sourceMappingURL=use-connection-state.d.ts.map