import { PageInfo } from './utils/page-info-utils'; import { StepOperation } from './types'; import { LLMProvider } from './llm-provider'; export interface LLMScenarioBreakdownResponse { steps: string[]; } export interface LLMPlaywrightCommandResponse { command: string; reasoning?: string; } export interface LLMTestNameResponse { testName: string; } export interface RepairSuggestionResponse { shouldContinue: boolean; reason: string; action: { operation: StepOperation; stepIndex?: number; newStep?: { description: string; code: string; }; insertAfterIndex?: number; }; } export interface RepairConfidenceResponse { confidence: number; advice: string; } export interface GoalCompletionResponse { isComplete: boolean; reason: string; nextSubGoal?: string; } export interface VisionDiagnosticResponse { visualAnalysis: string; rootCause: string; specificInstructions: string; recommendedApproach: string; elementsFound: string[]; elementsNotFound: string[]; } export interface ScenarioStep { stepNumber: number; description: string; playwrightCommand?: string; success?: boolean; error?: string; retryCount?: number; attempts?: Array<{ attemptNumber: number; command?: string; success: boolean; error?: string; timestamp: number; }>; } export declare class LLMFacade { llmProvider: LLMProvider; private logger?; private tokenUsageCallback?; constructor(llmProvider: LLMProvider); /** * Set token usage callback for tracking */ setTokenUsageCallback(callback: (inputTokens: number, outputTokens: number, includesImage: boolean) => void): void; /** * Set a logger callback for capturing execution logs */ setLogger(logger: (message: string, level?: 'log' | 'error' | 'warn') => void): void; /** * Log a message using the configured logger */ private log; private callLLM; /** * Generate a test name from scenario description */ generateTestName(scenario: string, model?: string): Promise; /** * Generate hashtags for semantic grouping */ generateHashtags(scenario: string, model?: string): Promise; /** * Check if a goal has been completed based on actions taken and current page state */ checkGoalCompletion(goalDescription: string, completedActions: string[], pageInfo: any, model?: string): Promise; /** * Check goal completion with visual verification (uses vision model) */ checkGoalCompletionWithVision(goalDescription: string, completedActions: string[], pageInfo: any, imageDataUrl: string, model?: string): Promise; /** * Get diagnostic analysis from screenshot (supervisor role) */ getVisionDiagnostics(stepDescription: string, pageInfo: any, previousSteps: any[], lastError: string | undefined, imageDataUrl: string, model?: string): Promise; /** * Generate command based on supervisor's instructions */ generateCommandFromSupervisorInstructions(stepDescription: string, supervisorDiagnostics: VisionDiagnosticResponse, pageInfo: any, model?: string): Promise; /** * Generate Playwright command with vision (uses vision model) */ generatePlaywrightCommandWithVision(stepDescription: string, pageInfo: any, previousSteps: any[], lastError: string | undefined, imageDataUrl: string, // Full data URL: data:image/png;base64,... model?: string): Promise; /** * Break down scenario into steps */ breakdownScenario(scenario: string, model?: string): Promise; /** * Generate Playwright command for a step */ generatePlaywrightCommand(stepDescription: string, pageInfo: PageInfo, previousSteps: ScenarioStep[], lastError?: string, currentStep?: ScenarioStep, model?: string): Promise; /** * Parse script into steps for AI repair */ parseScriptIntoSteps(script: string, model?: string): Promise>; /** * Get repair suggestion for a failing step */ getRepairSuggestion(stepDescription: string, stepCode: string, errorMessage: string, pageInfo: PageInfo, failureHistory: string, recentRepairs: string, model?: string): Promise; /** * Assess repair confidence and generate advice */ assessRepairConfidence(originalScript: string, updatedScript: string, model?: string): Promise; /** * Generate final script with repair advice */ generateFinalScript(originalScript: string, updatedScript: string, newRepairAdvice: string, model?: string): Promise; /** * Build attempt history for current step */ private buildAttemptHistory; /** * Build error context for LLM analysis */ private buildErrorContext; /** * Cleanup generated script - remove redundancies and make minor adjustments */ cleanupScript(script: string, model?: string): Promise<{ script: string; changes: string[]; skipped?: string; }>; } //# sourceMappingURL=llm-facade.d.ts.map