import { type SessionState } from '../../../core/session-model/session-state.js'; import type { BrokerToClient, ClientRole } from '../../../core/runtime/broker-protocol.js'; /** The repaints a state delta can trigger. Each is a lazy closure so the * collaborators that answer them may be built after this owner. */ export interface StateSyncEffects { /** Feed engine state to the input controller — steer-vs-prompt routing reads * `isStreaming`, so it must stay current. */ setEngineState: (engine: NonNullable) => void; /** The task name lives in the editor's top border; the border color tracks * the agent's thinking level. Both follow live state. */ setEditorTitle: (name: string | undefined) => void; paintEditorFrame: () => void; renderExtensionWidgets: () => void; renderQueued: () => void; renderFooter: () => void; setTerminalTitle: (title: string) => void; /** Panel liveness rides the relayed event stream (agent_start/agent_end/ * queue_update/session_info_changed all move engine state) plus the viewer's * low-rate poll for changes that emit no event (child status flips). */ refreshChrome: () => void; } export interface SessionStateSync { /** The live folded state. Read it; never hold it across an await. */ state: () => SessionState; /** Fold one broker frame through the shared reducer and repaint the slices * that actually changed. */ fold: (frame: BrokerToClient) => void; /** The ONE place this viewer writes session state without a broker frame: an * idle-released broker has settled its turn and will relay no final event, * so the viewer must clear the live-only spinner itself. Everything else * must go through `fold`. */ patchLocal: (patch: Partial>) => void; /** The combined model + thinking-level label a model/thinking change * announces (e.g. "sonnet medium", "fable x high"). Reads live state, so * callers fold first, then notice. `off` collapses to the bare model name. */ modelThinkingLabel: () => string | undefined; } export declare function createSessionStateSync(role: ClientRole, clientId: string, fx: StateSyncEffects): SessionStateSync;