/** * Research Suggestion Generator * * Generates structured suggestions for LLM-assisted problem solving * when the browser encounters issues it can't resolve automatically. * * This enables a feedback loop where: * 1. Browser encounters a problem (blocking, extraction failure, etc.) * 2. Returns research suggestion to LLM * 3. LLM researches solutions using the browser * 4. LLM retries with new parameters or approach * 5. Success is learned for future use * * Problem types handled: * - Bot detection/blocking * - Content extraction failures * - API discovery issues * - Authentication challenges * - Rate limiting * - Complex page structures * - JavaScript-heavy sites * - Pagination issues * - Selector failures * - Timeouts */ import type { BotDetectionType, ProblemType, ResearchSuggestion, ProblemResponse, RetryConfig } from '../types/index.js'; /** * Maximum research depth (LR-005). * Limits LLM research attempts to prevent infinite loops. * After this many research-assisted retries, the problem should be * reported as unresolvable via automated means. */ export declare const MAX_RESEARCH_DEPTH = 2; /** * Trusted sources for bypass research * These are curated to provide reliable, technical information */ export declare const TRUSTED_SOURCES: readonly ["github.com", "stackoverflow.com", "developer.mozilla.org", "web.dev", "playwright.dev", "puppeteer.github.io"]; /** * Generate a research suggestion for any problem type */ export declare function generateResearchSuggestion(problemType: ProblemType, domain: string, detectionType?: BotDetectionType): ResearchSuggestion; /** * Detect the type of bot protection from response content */ export declare function detectBotProtection(html: string, statusCode?: number, headers?: Record): BotDetectionType; /** * Classify a problem based on error characteristics */ export declare function classifyProblem(error?: Error | string, statusCode?: number, html?: string, attemptedStrategies?: string[]): ProblemType; /** * Create a full problem response with research suggestion * * @param url - The URL that had the problem * @param problemType - Category of problem encountered * @param options - Additional options including research depth tracking */ export declare function createProblemResponse(url: string, problemType: ProblemType, options?: { statusCode?: number; detectionType?: BotDetectionType; error?: Error | string; attemptedStrategies?: string[]; partialContent?: string; /** Current research depth (LR-005) - incremented from previous attempt */ researchDepth?: number; }): ProblemResponse; /** * Generate a human-readable reason for the problem */ export declare function generateProblemReason(problemType: ProblemType, detectionType?: BotDetectionType, error?: Error | string): string; /** * Check if a response indicates bot detection */ export declare function isBlockedByBotDetection(statusCode: number, html: string, headers?: Record): boolean; /** * Suggest a RetryConfig based on problem type and research findings */ export declare function suggestRetryConfig(problemType: ProblemType, detectionType?: BotDetectionType): Partial; //# sourceMappingURL=research-suggestion.d.ts.map