import { type SetStateAction } from "react"; /** * Persist model-visible state for the current mounted view. * * Every component in one view runtime reads and updates the same state object. * ChatGPT restores the object from `window.openai.widgetState.modelContent`. * Other MCP Apps hosts keep it for the iframe lifetime and receive it through * `ui/update-model-context`. * * The state must be a JSON-serializable object and cannot contain the reserved * `_uiContext` key used by {@link ModelContext}. * * @param defaultState - Initial object, or a lazy initializer evaluated once * for this hook instance. Restored ChatGPT state takes precedence. * @returns A readonly `[state, setState]` tuple with `useState` ergonomics. * * @example * ```tsx * const [state, setState] = useViewState({ count: 0 }); * setState((previous) => ({ ...previous, count: previous.count + 1 })); * ``` */ export declare function useViewState>(defaultState: T | (() => T)): readonly [T, (state: SetStateAction) => void];