import CDP from "chrome-remote-interface"; export type FailureType = "DEAD_SELECTOR" | "ACTION_FAILED"; export interface SelectorFingerprint { tag?: string; classes?: string[]; role?: string; relativeTo?: string; structuralIdiom?: string; } export interface MemoryEntry { intent: string; selector: string; urlPath?: string; fingerprint?: SelectorFingerprint; successCount: number; failureCount: number; consecutiveFailures: number; lastSuccessVisit: number; state: "active" | "drift_detected" | "deprecated"; } export interface NegativeMemoryEntry { selector: string; urlPath?: string; failureType: FailureType; expiredAtVisit: number; } export interface DomainProfile { domainFamily?: string; strategies: string[]; memories: MemoryEntry[]; failedSelectors: NegativeMemoryEntry[]; shadowDom: boolean; framework?: string; updatedAt: string; visitCount: number; } export declare function clearMemoryCache(): void; export declare function getDomainFilePath(hostname: string): string; export declare function loadDomainProfile(hostname: string): Promise; export declare function saveDomainProfile(hostname: string, updates: Partial): Promise; /** * Increment the visit counter for a domain. Call this exactly once per page navigation, * NOT on every logMemorySuccess/Failure call. */ export declare function bumpVisitCount(hostname: string): Promise; export declare function logMemorySuccess(hostname: string, intent: string, selector: string, fingerprint?: SelectorFingerprint, urlPath?: string): Promise; export declare function logMemoryFailure(hostname: string, intent: string, selector: string, failureType: FailureType, urlPath?: string): Promise; export interface MemoryHit { selector: string; fingerprint?: SelectorFingerprint; score: number; } /** * Evaluates memory entries and returns the highest confidence memory hit. */ export declare function getBestSelectorForIntent(hostname: string, intent: string, urlPath?: string): Promise; /** * Detect the frontend framework used by the current page. */ export declare function detectFramework(session: CDP.Client): Promise; /** * Check if the page uses Shadow DOM. */ export declare function detectShadowDom(session: CDP.Client): Promise; /** * Format a domain profile as a system hint string. */ export declare function formatDomainHint(hostname: string, profile: DomainProfile): string | undefined;