import { ExecutionContext } from './types.js'; /** * Component metadata for UI rendering */ export interface ComponentMetadata { /** Unique identifier for the component */ id: string; /** Human-readable name */ name: string; /** Description of what the component displays */ description?: string; /** HTML content or path to HTML file */ html: string; /** CSS content or path to CSS file */ css?: string; /** JavaScript content or path to JS file */ js?: string; /** Whether component can initiate tool calls */ canInvokeTools?: boolean; /** Content Security Policy domains */ csp?: { connectDomains?: string[]; resourceDomains?: string[]; frameDomains?: string[]; }; /** Custom subdomain for component rendering */ subdomain?: string; /** Whether to show border around component */ prefersBorder?: boolean; /** Provider-specific metadata */ providerMetadata?: Record; /** Internal metadata (not exposed to MCP) */ _meta?: Record; } /** * Component definition */ export interface ComponentDefinition extends ComponentMetadata { /** Data transformation function for structuredContent */ transformer?: (data: unknown, context: ExecutionContext) => unknown; /** Data transformation function for _meta (widget state) */ metaTransformer?: (data: unknown, context: ExecutionContext) => unknown; /** Component initialization logic */ onInit?: (context: ExecutionContext) => void | Promise; } /** * Component class for defining UI components */ export declare class Component { private definition; private compiled; private bundle; constructor(definition: ComponentDefinition); private validateDefinition; /** * Get component ID */ get id(): string; /** * Get component name */ get name(): string; /** * Get component description */ get description(): string | undefined; /** * Compile component bundle */ compile(): Promise; /** * Get compiled bundle as HTML document */ getBundle(): string; /** * Get component URI for resource registration */ getResourceUri(): string; /** * Check if component is in dev mode */ isDevMode(): boolean; /** * Get dev URL if in dev mode */ getDevUrl(): string | null; /** * Transform data for component */ transformData(data: unknown, context: ExecutionContext): Promise; /** * Get widget metadata (state) */ getWidgetMeta(data: unknown, context: ExecutionContext): Promise; /** * Get provider-specific metadata */ getProviderMetadata(provider: 'openai' | 'anthropic' | 'generic'): Record; /** * Get resource metadata for MCP */ getResourceMetadata(): Record; /** * Initialize component */ initialize(context: ExecutionContext): Promise; } /** * Helper function to create a component */ export declare function createComponent(definition: ComponentDefinition): Component; //# sourceMappingURL=component.d.ts.map