/**
 * Vision Testing Types
 *
 * Extends flow-testing types with vision-based capabilities.
 * Enables AI agents to understand UI through visual perception instead of brittle selectors.
 */
import { TestMission, TestStep, TestExecutionResult, ValidationRule, ValidationResult, BrowserConfig } from "./flow-testing";
/**
 * Vision Test Mission - Enhanced with visual expectations
 */
export interface VisionTestMission extends TestMission {
    visualExpectations?: VisualExpectation[];
    baselineScreenshots?: string[];
    recordDemo?: boolean;
    demoConfig?: DemoConfig;
}
/**
 * Visual Expectation - What the UI should look like
 */
export interface VisualExpectation {
    id: string;
    name: string;
    description: string;
    screenshot?: string;
    colorScheme?: {
        primary?: string;
        secondary?: string;
        background?: string;
        text?: string;
    };
    layoutType?: "grid" | "flex" | "fixed" | "responsive";
    threshold?: number;
}
/**
 * Vision Sub-Action - Individual action in a batch turn
 */
export interface VisionSubAction {
    action: "click" | "fill" | "wait";
    targetElement: {
        description: string;
        visualCoordinates?: {
            x: number;
            y: number;
        };
        domSelector?: string;
        confidence: number;
    };
    value?: string;
}
/**
 * Vision Action Decision - AI's decision on what to do next
 */
export interface VisionActionDecision {
    action: "click" | "fill" | "scroll" | "wait" | "navigate" | "upload" | "complete" | "multi_action";
    confidence: number;
    reasoning: string;
    visualContext: string;
    targetElement?: {
        description: string;
        visualCoordinates?: {
            x: number;
            y: number;
        };
        domSelector?: string;
        confidence: number;
    };
    value?: string;
    url?: string;
    subActions?: VisionSubAction[];
    intent: string;
    alignsWithPrimeObjective: boolean;
    gravityScore: number;
}
/**
 * Vision Test Step - Enhanced with visual data
 */
export interface VisionTestStep extends TestStep {
    visionDecision?: VisionActionDecision;
    visualAnalysis?: {
        componentsDetected: string[];
        interactiveElements: string[];
        textContent: string[];
        colorPalette: string[];
        layoutStructure: string;
    };
    screenshotAnalysis?: {
        path: string;
        analysisText: string;
        timestamp: string;
    };
}
/**
 * Vision Validation Rule - Visual checks
 * Note: Extends ValidationRule, type extended via string.
 */
export interface VisionValidationRule extends ValidationRule {
    type: "url-match" | "element-exists" | "text-contains" | "element-visible" | "form-submitted" | "data-updated" | "custom" | "visual-match" | "color-scheme-match" | "layout-match" | "text-readable" | "no-visual-regression";
    description: string;
    selector?: string;
    expectedValue?: string;
    customCheck?: string;
    baselineScreenshot?: string;
    threshold?: number;
}
/**
 * Visual Validation Result - Results of visual checks
 */
export interface VisualValidationResult extends ValidationResult {
    visualDiff?: {
        diffPercentage: number;
        diffScreenshot?: string;
        affectedAreas?: Array<{
            x: number;
            y: number;
            width: number;
            height: number;
            description: string;
        }>;
    };
    colorAnalysis?: {
        expectedColors: string[];
        actualColors: string[];
        matches: boolean;
    };
}
/**
 * Vision Test Execution Result - Enhanced with visual artifacts
 */
export interface VisionTestExecutionResult extends TestExecutionResult {
    steps: VisionTestStep[];
    validationResults: VisualValidationResult[];
    visualSummary?: {
        totalScreenshots: number;
        visualRegressionsDetected: number;
        colorSchemeMatches: boolean;
        layoutMatches: boolean;
    };
    demoArtifacts?: DemoArtifacts;
}
/**
 * Demo Configuration - How to record and generate demos
 */
export interface DemoConfig {
    outputFormats: Array<"video" | "screenshots" | "html-replay" | "markdown-script">;
    videoQuality?: "720p" | "1080p" | "4K";
    fps?: number;
    includeVoiceOver?: boolean;
    generateAudio?: boolean;
    ttsConfig?: TTSConfig;
    narrationStyle?: "technical" | "casual" | "marketing" | "educational";
}
/**
 * TTS Configuration - Text-to-speech settings
 */
export interface TTSConfig {
    provider: "google-cloud-tts" | "elevenlabs" | "local";
    voice?: string;
    language?: string;
    speed?: number;
    pitch?: number;
}
/**
 * Demo Artifacts - All generated demo files
 */
export interface DemoArtifacts {
    generatedAt: string;
    formats: {
        video?: {
            path: string;
            duration: number;
            size: number;
            resolution: string;
        };
        screenshots?: {
            paths: string[];
            count: number;
            format: "png" | "jpeg";
        };
        htmlReplay?: {
            path: string;
            interactive: boolean;
        };
        markdownScript?: {
            path: string;
            wordCount: number;
        };
    };
    voiceOver?: {
        script: VOScript;
        audio?: {
            path: string;
            duration: number;
            format: "mp3" | "wav";
        };
    };
}
/**
 * Voice-Over Script - Narration with timestamps
 */
export interface VOScript {
    title: string;
    totalDuration: number;
    segments: VOSegment[];
    fullScript: string;
}
/**
 * Voice-Over Segment - Individual narration segment
 */
export interface VOSegment {
    id: string;
    timestamp: number;
    duration: number;
    narration: string;
    action: string;
    screenshot?: string;
    metadata?: {
        step: number;
        uiState: string;
        textOnScreen: string[];
    };
}
/**
 * Visual Element - Element identified through vision
 */
export interface VisualElement {
    id: string;
    description: string;
    type: "button" | "link" | "input" | "form" | "card" | "navigation" | "text" | "image" | "unknown";
    visualCoordinates: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    domSelector?: string;
    confidence: number;
    interactable: boolean;
    textContent?: string;
}
/**
 * Vision Analysis Result - What the vision model sees
 */
export interface VisionAnalysisResult {
    screenshot: string;
    timestamp: string;
    elements: VisualElement[];
    interactiveElements: VisualElement[];
    uiState: {
        pageTitle?: string;
        url: string;
        loadingState: "loading" | "loaded" | "error";
        modalOpen: boolean;
        mainContent: string;
    };
    designSystem: {
        colors: string[];
        typography: string[];
        spacing: string;
    };
    layoutStructure: {
        type: "grid" | "flex" | "fixed" | "responsive";
        sections: string[];
    };
    aiInterpretation: string;
}
/**
 * Visual Diff Result - Comparison between two screenshots
 */
export interface VisualDiffResult {
    baseline: string;
    current: string;
    diff?: string;
    similarity: number;
    differencePercentage: number;
    changes: VisualChange[];
    passed: boolean;
    threshold: number;
}
/**
 * Visual Change - Specific visual difference detected
 */
export interface VisualChange {
    id: string;
    type: "color" | "layout" | "text" | "element-added" | "element-removed" | "position" | "size";
    severity: "minor" | "moderate" | "major";
    description: string;
    location: {
        x: number;
        y: number;
        width: number;
        height: number;
    };
    expected?: string;
    actual?: string;
}
/**
 * Vision Browser Config - Extended browser configuration
 */
export interface VisionBrowserConfig extends BrowserConfig {
    visionModel?: "gemini-2.0-flash" | "gemini-1.5-flash" | "gemini-1.5-pro" | "gpt-4-vision";
    screenshotQuality?: number;
    screenshotFormat?: "png" | "jpeg";
    analyzeEveryNthStep?: number;
    enableVisualValidation?: boolean;
    enableDemoRecording?: boolean;
}
/**
 * Living Brain Update - Message to write to context.json
 */
export interface LivingBrainUpdate {
    timestamp: string;
    agentName: string;
    updateType: "test-start" | "test-step" | "test-complete" | "validation" | "demo-generated" | "error";
    data: any;
    metadata?: {
        testId?: string;
        executionId?: string;
        stepId?: string;
    };
}
/**
 * Agent Communication Protocol - How agents talk via Living Brain
 */
export interface AgentMessage {
    id: string;
    from: string;
    to?: string;
    type: "request" | "response" | "notification" | "error";
    action: string;
    payload: any;
    timestamp: string;
    responseRequired: boolean;
}
/**
 * Vision Test Session - Active test session state
 */
export interface VisionTestSession {
    sessionId: string;
    missionId: string;
    status: "initializing" | "running" | "validating" | "recording" | "completed" | "failed";
    startedAt: string;
    currentStep: number;
    totalSteps: number;
    activeAgents: string[];
    livingBrainState: {
        lastUpdate: string;
        testProgress: number;
        currentUrl: string;
        lastScreenshot?: string;
        lastDecision?: VisionActionDecision;
    };
    artifacts: {
        screenshots: string[];
        videos: string[];
        reports: string[];
    };
}
/**
 * Visual Regression Test Suite - Collection of visual tests
 */
export interface VisualRegressionSuite {
    id: string;
    name: string;
    description: string;
    baselinePath: string;
    tests: VisionTestMission[];
    createdAt: string;
    updatedAt: string;
    config: {
        threshold: number;
        autoApprove?: boolean;
        notifyOn: Array<"failure" | "change" | "completion">;
    };
}
/**
 * Demo Generation Request - Request to generate a demo
 */
export interface DemoGenerationRequest {
    missionId: string;
    config: DemoConfig;
    startUrl: string;
    flow: string;
    metadata?: {
        title?: string;
        description?: string;
        tags?: string[];
    };
}
/**
 * Demo Generation Result - Result of demo generation
 */
export interface DemoGenerationResult {
    requestId: string;
    status: "success" | "failed" | "partial";
    artifacts: DemoArtifacts;
    duration: number;
    error?: string;
}
//# sourceMappingURL=vision-testing.d.ts.map