import type { ActionPlan, EvaluationContext, Library, OpenUIError, Store } from '@openuidev/lang-core'; import type { ReactNode } from '@lynx-js/react'; /** * Runtime context shared by OpenUI renderers, hooks, actions, and form fields. */ export interface OpenUIContextValue { /** The active component library (schema + renderers). */ library: Library; /** * Render any value (element, array, primitive) into React nodes. */ renderNode: (value: unknown) => ReactNode; /** * Trigger an action. Accepts either: * - ActionPlan (v0.5): runs steps sequentially (Run, Set, ToAssistant, OpenUrl) * - Legacy action config (v0.1): object with optional type and params. * - Nothing: fires ContinueConversation with the label */ triggerAction: (userMessage: string, formName?: string, action?: ActionPlan | { type?: string; params?: Record; url?: string; context?: string; }) => void | Promise; /** Whether the LLM is currently streaming content. */ isStreaming: boolean; /** Whether any Query is currently fetching data. */ isQueryLoading: boolean; /** Get a field value. Top-level for $bindings, nested under formName for form fields. */ getFieldValue: (formName: string | undefined, name: string) => any; /** * Set a form field value. * * @param formName - The form's name prop. * @param componentType - The component type (e.g. "Input", "Select"). * @param name - The field's name prop. * @param value - The new value. * @param shouldTriggerSaveCallback - When true, persists state via onStateUpdate. * Text inputs should pass `false` on change and `true` on blur. * Discrete inputs (Select, RadioGroup, etc.) should always pass `true`. */ setFieldValue: (formName: string | undefined, componentType: string | undefined, name: string, value: unknown, shouldTriggerSaveCallback?: boolean) => void; /** Reactive binding store for $variables and form data. */ store: Store; /** AST evaluation context used by runtime expression evaluation. */ evaluationContext: EvaluationContext; /** Report a structured error (used internally by error boundary). */ reportError?: (error: OpenUIError) => void; } export declare const OpenUIContext: import("react").Context; /** * Access the full OpenUI context. Throws if used outside an * `OpenUiRenderer` tree. */ export declare function useOpenUI(): OpenUIContextValue; /** * Get the renderNode function for rendering nested component values. */ export declare function useRenderNode(): (value: unknown) => ReactNode; /** * Get the triggerAction function for firing structured action events. * * @example * ```tsx * const triggerAction = useTriggerAction(); *