/** * SMRT Form context for field registration and coordination */ import type { ControlConstraints, ControlInteractionRegistry, ControlKind, ControlOption, ControlRuntimeState, ControlSensitivity } from '@happyvertical/smrt-ui/forms'; /** * Field definition for form registration */ /** All supported form field types */ export type FormFieldType = 'text' | 'email' | 'datetime' | 'number' | 'address' | 'checkbox' | 'daterange' | 'measurement' | 'money' | 'phone' | 'select' | 'textarea'; export interface FieldDefinition { /** Field name (used as key for LLM extraction) */ name: string; /** Field type */ type: FormFieldType; /** Human-readable label */ label?: string; /** Description to help LLM understand field purpose */ description?: string; /** Set the field value */ setValue: (value: unknown) => void; /** Get current field value */ getValue: () => unknown; /** Optional richer interaction metadata and capabilities. */ controlId?: string; interactionKind?: ControlKind; sensitivity?: ControlSensitivity; readable?: boolean; writable?: boolean; constraints?: ControlConstraints; /** Optional WebMCP schema override for structured field values. */ webMcpSchema?: Record; options?: ControlOption[]; unit?: string; clear?: () => void; focus?: () => void; reveal?: () => void; highlight?: (durationMs?: number) => void; validate?: () => boolean; getState?: () => ControlRuntimeState; } /** * SMRT Form context interface */ export interface SMRTFormContext { /** Current mode */ readonly mode: 'smrt' | 'default'; /** Register a field with the form */ registerField: (field: FieldDefinition) => void; /** Unregister a field */ unregisterField: (name: string) => void; /** Get all registered fields schema (for LLM prompt) */ getFieldSchema: () => FieldDefinition[]; /** Whether form-level listening is active */ readonly isFormListening: boolean; /** Whether currently extracting from speech */ readonly isExtracting: boolean; /** Toggle form-level listening on/off */ toggleListening: () => void; /** Shared transport-neutral registry used by voice/chat/tutorial adapters. */ readonly interactionRegistry: ControlInteractionRegistry; readonly formId: string; } /** * Context key for SMRT form */ export declare const SMRT_FORM_KEY: unique symbol; /** * Set form context (used by SMRTForm) */ export declare function setFormContext(ctx: SMRTFormContext): void; /** * Get form context * @throws If called outside of SMRTForm */ export declare function getFormContext(): SMRTFormContext; /** * Try to get form context (returns null if not available) */ export declare function tryGetFormContext(): SMRTFormContext | null; //# sourceMappingURL=form-context.d.ts.map