import { ViewFingerprint } from '../utils/view-fingerprinting.js'; /** * Cached coordinate with confidence tracking * Following xcode-agent recommendation for confidence decay */ export interface CachedCoordinate { elementId: string; elementType: string; x: number; y: number; relativeX?: number; relativeY?: number; bounds?: { width: number; height: number; }; confidence: number; successCount: number; failureCount: number; createdAt: Date; lastUsed: Date; } /** * View coordinate mapping for a specific app screen */ export interface ViewCoordinateMapping { cacheKey: string; fingerprint: ViewFingerprint; bundleId: string; appVersion?: string; coordinates: Map; createdAt: Date; lastAccessed: Date; hitCount: number; } /** * Cache configuration following xcode-agent recommendations */ export interface ViewCacheConfig { enabled: boolean; maxAge: number; minConfidence: number; maxCachedViews: number; maxCoordinatesPerView: number; autoDisableThreshold: number; } /** * View Coordinate Cache * * Implements intelligent coordinate caching with: * - Element structure hash as primary key (per xcode-agent) * - Confidence tracking with auto-invalidation * - Auto-disable on low hit rate * - Conservative defaults for Phase 1 */ export declare class ViewCoordinateCache { private static instance; private cache; private config; private hitCount; private missCount; private totalQueries; private constructor(); static getInstance(): ViewCoordinateCache; setConfig(config: Partial): void; getConfig(): ViewCacheConfig; enable(): void; disable(): void; isEnabled(): boolean; /** * Get cached coordinate for an element on a specific view */ getCachedCoordinate(fingerprint: ViewFingerprint, bundleId: string, elementId: string, appVersion?: string): Promise; /** * Store successful tap coordinates in cache */ storeCoordinate(fingerprint: ViewFingerprint, bundleId: string, elementId: string, elementType: string, x: number, y: number, bounds?: { width: number; height: number; }, appVersion?: string): Promise; /** * Record successful tap using cached coordinate */ recordSuccess(fingerprint: ViewFingerprint, bundleId: string, elementId: string, appVersion?: string): Promise; /** * Invalidate coordinate on tap failure */ invalidateCoordinate(fingerprint: ViewFingerprint, bundleId: string, elementId: string, appVersion?: string): Promise; /** * Clear entire cache */ clear(): void; /** * Clear cache for specific bundle ID */ clearForBundle(bundleId: string): void; getStatistics(): { enabled: boolean; hitRate: number; missRate: number; totalQueries: number; hitCount: number; missCount: number; cachedViews: number; totalCoordinates: number; config: ViewCacheConfig; }; /** * Auto-disable cache if hit rate falls below threshold * Per xcode-agent recommendation */ private checkAutoDisable; /** * Evict least recently used view mapping (LRU eviction) */ private evictLRU; /** * Evict least recently used coordinate from a view mapping */ private evictLRUCoordinate; private persistState; private loadPersistedState; } export declare const viewCoordinateCache: ViewCoordinateCache; //# sourceMappingURL=view-coordinate-cache.d.ts.map