/**
 * Judge service for evaluating AI-generated applications.
 *
 * Encapsulates the complete judge evaluation workflow including:
 * - LLM client access for executing evaluations
 * - Storage for persisting evaluation results
 * - MCP server lifecycle management
 * - Executor orchestration
 */
import type { JudgeEvaluation, EvaluationCriteria, JudgeConfig } from "./types.js";
import type { Logger } from "../../util/logger.js";
import type { LLMClient } from "../llm/client.js";
import type { LLMProvider } from "../llm/types.js";
import type { JudgeStorage, StoredEvaluation } from "./storage/index.js";
import type { PlaywrightMcpServerManager } from "../mcp/playwright-server.js";
import type { LLMProviderConfig } from "@superblocksteam/library-shared/types";
/**
 * Options for judge evaluation.
 */
export interface JudgeEvaluationOptions {
    /** Application URL to evaluate */
    appUrl: string;
    /** JWT token for AI Gateway authentication */
    jwt?: string;
    /** LLM configuration (provider, thinking opts, disabled tools) */
    llmConfig?: LLMProviderConfig;
    /** Optional websocket endpoint to reuse an existing Playwright browser */
    connectWsEndpoint?: string;
    /** Raw storage state data to seed Playwright context */
    storageStateData?: any;
    /** Session storage entries to seed for the app origin */
    sessionStorageData?: {
        origin: string;
        items: Array<{
            name: string;
            value: string;
        }>;
    };
    /** Additional origins storage to seed (e.g., auth domain local/session storage) */
    extraOrigins?: Array<{
        origin: string;
        localStorage: Array<{
            name: string;
            value: string;
        }>;
        sessionStorage?: Array<{
            name: string;
            value: string;
        }>;
    }>;
    /** Optional evaluation criteria (auto-generated if not provided) */
    criteria?: EvaluationCriteria;
    /** Optional judge configuration overrides */
    config?: Partial<JudgeConfig>;
    /** Complexity level for model selection */
    complexity?: "low" | "medium" | "high";
    /** Optional path to Playwright storage state for authentication */
    storageStatePath?: string;
    /** Whether the Playwright MCP browser should run headless */
    playwrightHeadless?: boolean;
    /** Browser engine to use for Playwright MCP */
    playwrightBrowser?: "chromium" | "firefox" | "webkit";
    /** External Playwright MCP server to reuse instead of starting a new one */
    playwrightServerUrl?: string;
}
/**
 * Result of a judge evaluation with metadata.
 */
export interface JudgeEvaluationResult extends JudgeEvaluation {
    /** Prompt ID that was evaluated */
    promptId: string;
    /** Application ID */
    appId: string;
}
/**
 * Judge service for orchestrating application evaluations.
 *
 * Provides a high-level API for running judge evaluations
 * and managing their lifecycle.
 */
export declare class JudgeService {
    private llmClient;
    private llmProvider;
    private storage;
    private mcpServerManager;
    private logger;
    constructor(config: {
        llmClient: LLMClient;
        llmProvider: LLMProvider;
        storage: JudgeStorage;
        mcpServerManager: PlaywrightMcpServerManager;
        logger: Logger;
    });
    /**
     * Evaluates an application against a prompt.
     *
     * This is the main entry point for judge evaluations. It:
     * 1. Ensures MCP server is running
     * 2. Generates or uses provided criteria
     * 3. Executes the evaluation via JudgeExecutor
     * 4. Stores the result
     * 5. Returns the evaluation
     *
     * @param promptId - Unique identifier for the prompt
     * @param prompt - The prompt text that was used to generate the app
     * @param appId - Application identifier
     * @param options - Evaluation options
     * @returns Complete evaluation result
     * @throws Error if evaluation fails
     */
    evaluateApplication(promptId: string, prompt: string, appId: string, options: JudgeEvaluationOptions): Promise<JudgeEvaluationResult>;
    /**
     * Retrieves stored evaluations.
     *
     * @param promptId - Optional prompt ID to filter by
     * @returns Array of stored evaluations
     */
    getEvaluations(promptId?: string): Promise<StoredEvaluation[]>;
    /**
     * Retrieves evaluations for a specific branch.
     *
     * @param branchName - Git branch name
     * @returns Array of stored evaluations for the branch
     */
    getEvaluationsByBranch(branchName: string): Promise<StoredEvaluation[]>;
    /**
     * Ensures the MCP server is running.
     *
     * Starts the server if not already running.
     *
     * @param storageStatePath - Optional path to Playwright storage state for authentication
     * @returns MCP server URL
     */
    private ensureMcpServer;
    /**
     * Gets the current git branch name.
     *
     * @returns Branch name or 'unknown' if git is not available
     */
    private getCurrentBranch;
    /**
     * Gets the current git commit SHA.
     *
     * @returns Commit SHA or 'unknown' if git is not available
     */
    private getCurrentCommitSha;
    /**
     * Cleans up resources used by the judge service.
     *
     * Stops the MCP server if running.
     */
    dispose(): Promise<void>;
}
//# sourceMappingURL=judge-service.d.ts.map