/** * Vision Matcher * * Vision-based element finding using screenshot analysis with vision models. * Serves as a fallback when CSS and semantic selectors fail. * * Tiered element finding: * 1. CSS Selector (fastest, most reliable when available) * 2. Semantic/ARIA Selector (resilient to DOM changes) * 3. Vision Matcher (handles dynamic/complex UIs) * * Features: * - Uses GPT-4V or Claude Vision to analyze screenshots * - Returns bounding boxes and click coordinates * - Learns successful positions for future requests * - Caches results per domain to reduce API calls */ import type { VisionMatcherConfig, VisionFindRequest, VisionFindResult, VisionProvider, LearnedPosition, VisionMatcherEvent, VisionMatcherEventType, VisionMatcherStats, VisionMatcherExport } from '../types/vision-matcher.js'; /** * Vision Matcher for finding elements using screenshot analysis */ export declare class VisionMatcher { private config; private learnedPositions; private eventListeners; private stats; constructor(config?: VisionMatcherConfig); /** * Check if a vision provider is available */ static isAvailable(provider?: VisionProvider): boolean; /** * Get the first available provider */ private getAvailableProvider; /** * Find an element using vision analysis */ findElement(request: VisionFindRequest): Promise; /** * Call the vision API to find an element */ private callVisionAPI; /** * Call OpenAI Vision API */ private callOpenAIVision; /** * Call Anthropic Vision API */ private callAnthropicVision; /** * Parse the vision API response */ private parseVisionResponse; /** * Calculate center point of a bounding box */ private calculateCenter; /** * Check cache for a learned position */ private checkCache; /** * Normalize element description for comparison */ private normalizeDescription; /** * Learn a successful position */ private learnPosition; /** * Record that a learned position was used */ recordPositionUsed(domain: string, elementDescription: string, success: boolean): void; /** * Create an error result */ private createErrorResult; /** * Create empty stats object */ private createEmptyStats; /** * Update average stats after a request */ private updateAverageStats; /** * Get current statistics */ getStats(): VisionMatcherStats; /** * List learned positions for a domain */ getLearnedPositions(domain?: string): LearnedPosition[]; /** * Clear learned positions */ clearLearnedPositions(domain?: string): void; /** * Export learned positions */ export(): VisionMatcherExport; /** * Import learned positions */ import(data: VisionMatcherExport): void; /** * Add event listener */ addEventListener(type: VisionMatcherEventType, listener: (event: VisionMatcherEvent) => void): void; /** * Remove event listener */ removeEventListener(type: VisionMatcherEventType, listener: (event: VisionMatcherEvent) => void): void; /** * Emit an event */ private emitEvent; } //# sourceMappingURL=vision-matcher.d.ts.map