import type { ViewCore, ChromeState } from '../core/view/contract.js'; /** Host-level pre-dispatch hook: observes every dispatched intent + its payload * against a snapshot of state, before the view's own handler runs. The shell * taps the small documented shell-intent vocabulary (`activate`, `open`) and * lets everything else pass through untouched. */ export type IntentTap = (name: string, payload: unknown, state: unknown) => void; export interface ViewStoreOptions { /** Frozen options map handed to core.init (e.g. forwarded --target). */ options?: Record; /** Bridge endpoint for the HTTP transport; defaults to /__crtr/source. */ endpoint?: string; /** The host TAP (ยง5). Omit โ‡’ standalone, byte-identical to no shell. */ onIntent?: IntentTap; } export interface ViewStore { /** Snapshot of the current view state (read after a subscribe fires). */ getState(): unknown; /** Snapshot of the current chrome record. */ getChrome(): ChromeState; /** Dispatch a named intent โ€” runs the TAP, then the core handler. */ dispatch(intent: string, payload?: unknown): Promise; /** Force an immediate, busy-guarded refresh (auto-poll cb + the SSE seam). */ refresh(): void; /** External-store subscribe (for useSyncExternalStore). */ subscribe(listener: () => void): () => void; /** Monotonic version the external store snapshots on. */ getVersion(): number; /** Run the first refresh + start the refreshMs auto-poll. Idempotent. */ start(): void; /** Stop the auto-poll. Idempotent. */ stop(): void; /** The host TAP โ€” mutable so the React layer keeps it fresh per render * WITHOUT restarting the store. */ onIntent?: IntentTap; } /** Build the running store for one view (its core + the HTTP transport). The * React layer (useViewCore) owns lifecycle (start on mount, stop on unmount) * and re-renders off subscribe/getVersion; this factory is React-free. */ export declare function createViewStore(core: ViewCore, opts?: ViewStoreOptions): ViewStore;