/** * UI Bridge Server Handlers * * Factory function to create handler implementations for all UI Bridge endpoints. */ import type { UIBridgeServerHandlers } from './types'; import type { ControlSnapshot, DiscoveredElement } from '@qontinui/ui-bridge/control'; import type { RenderLogEntry } from '@qontinui/ui-bridge/render-log'; import type { ElementHistoryOptions, ElementLogEntry } from '@qontinui/ui-bridge/core'; /** * Registry interface - minimal contract for handler usage */ export interface RegistryLike { getAllElements(): DiscoveredElement[]; getElement(id: string): DiscoveredElement | undefined; getAllComponents(): unknown[]; getComponent(id: string): unknown | undefined; getComponentState?(id: string): { state: Record; computed: Record; timestamp: number; } | null; createSnapshot(): ControlSnapshot; getRenderLog?(): RenderLogEntry[]; clearRenderLog?(): void; captureSnapshot?(): unknown; findElements?(request?: unknown): unknown[]; getAllWorkflows?(): unknown[]; getWorkflow?(id: string): unknown; getActionHistory?(): unknown[]; getMetrics?(): unknown; highlightElement?(id: string): void; getElementTree?(): unknown; getElementHistory?(elementId: string, options?: ElementHistoryOptions): ElementLogEntry[]; } /** * Action executor interface - minimal contract for handler usage */ export interface ActionExecutorLike { executeAction(elementId: string, request: { action: string; params?: Record; waitOptions?: unknown; }): Promise; executeComponentAction(componentId: string, request: { action: string; params?: Record; }): Promise; /** Optional find method for filtered element discovery */ find?(request?: unknown): Promise; } /** * Configuration for creating handlers */ export interface CreateHandlersConfig { /** Optional render log path */ renderLogPath?: string; /** Verbose logging */ verbose?: boolean; } /** * Create server handlers for UI Bridge * * @param registry - The UI Bridge registry instance * @param actionExecutor - The action executor instance * @param config - Optional configuration * @returns Handler implementations for all endpoints * * @example * ```ts * import { createHandlers } from '@qontinui/ui-bridge-server'; * import { getGlobalRegistry, createActionExecutor } from '@qontinui/ui-bridge'; * * const registry = getGlobalRegistry(); * const executor = createActionExecutor(registry); * const handlers = createHandlers(registry, executor); * * // Use with Express * const router = createExpressRouter(handlers); * * // Use with standalone server * const server = new StandaloneServer(handlers); * ``` */ export declare function createHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike, config?: CreateHandlersConfig): UIBridgeServerHandlers; /** * Create partial handlers for AI-specific functionality only * * Use this when you want to add AI endpoints to an existing handler setup. */ export declare function createAIHandlers(registry: RegistryLike, actionExecutor: ActionExecutorLike): Pick; //# sourceMappingURL=handlers.d.ts.map