import type { DisplayMode } from "../types/host-types.js"; /** * Immutable pre-render runtime configuration for a view module. * * Export as a named `viewConfig` alongside the default component. Values are * normalized and validated by `bootstrapView` before the guest `App` is * constructed. React presentation settings do not belong here — compose * {@link ThemeProvider} / {@link ViewControls} in the component tree instead. * * @example * ```tsx * import type { ViewConfig } from "mcp-use/react"; * * export const viewConfig = { * autoResize: false, * displayModes: ["inline", "fullscreen"], * preferredDisplayMode: "fullscreen", * } satisfies ViewConfig; * * export default function CanvasView() { * return ; * } * ``` */ export interface ViewConfig { /** * Let ext-apps observe the document and report size changes. * * @defaultValue true */ autoResize?: boolean; /** * Display modes this view can render correctly. * * Must contain "inline". * * @defaultValue ["inline", "fullscreen", "pip"] */ displayModes?: readonly DisplayMode[]; /** * Hint to ChatGPT for the initial display mode, emitted on the UI resource. * Must belong to `displayModes`. ChatGPT may ignore this preference and * currently supports only "inline" and "fullscreen". */ preferredDisplayMode?: "inline" | "fullscreen"; } /** * {@link ViewConfig} with runtime defaults applied. The initial display * preference stays absent unless explicitly configured. * * @internal */ export interface NormalizedViewConfig { /** Whether the guest `App` auto-measures and reports size changes. */ autoResize: boolean; /** Display modes advertised to the host via App capabilities. */ displayModes: readonly DisplayMode[]; /** Optional initial display preference emitted on the UI resource. */ preferredDisplayMode?: "inline" | "fullscreen"; } /** * Normalize and validate an optional {@link ViewConfig}. * * @param config - Optional named export from a view module. * @returns A fully-resolved config with defaults applied. * @throws When `displayModes` is empty, contains duplicates, omits `"inline"`, * or includes a value that is not a known {@link DisplayMode}, or when * `preferredDisplayMode` is invalid or not among the supported modes. * * @internal */ export declare function normalizeViewConfig(config?: ViewConfig): NormalizedViewConfig;