/**
 * MCP Server mode handler — directory barrel.
 *
 * MCPServerModeHandler — compilation rules for `mcp-server` evaluation mode.
 *
 * This is the first non-literacy mode handler, proving the compiler
 * architecture works end-to-end. It translates MCP server task definitions
 * into Promptfoo configuration with:
 *
 * - An MCP provider that wraps the server under test
 * - Tool-call assertions compiled to Promptfoo `javascript` assertions
 * - Server lifecycle management via Promptfoo provider hooks
 * - Multi-turn conversation support via Promptfoo's `steps` syntax
 *
 * @see docs/archive/exec-plans/architecture-overhaul/phase-3-mcp-server-mode.md
 * @see packages/core/src/types/eval-mode-config.ts — MCPServerModeConfig
 * @see packages/core/src/types/generalized-task.ts — MCPServerTaskDefinition
 */
import { compileMCPTask } from "./compiler.js";
import { MCP_PROMPT_TEMPLATES } from "./prompts.js";
// ---------------------------------------------------------------------------
// ModeHandler adapter
// ---------------------------------------------------------------------------
/** ModeHandler-conformant export for the mcp-server evaluation mode. */
export const handler = {
    getPrompts() {
        return MCP_PROMPT_TEMPLATES;
    },
    compileTask(task, ctx) {
        if (!("mode" in task) || task.mode !== "mcp-server") {
            throw new Error(`MCP server handler received task with mode "${task.mode ?? "undefined"}" — expected "mcp-server"`);
        }
        const result = compileMCPTask(task, {
            graderProvider: ctx.graderProvider,
            models: ctx.models,
        });
        return {
            providers: result.providers,
            tests: result.tests,
            prompts: result.prompts,
            warnings: result.warnings,
        };
    },
};
// Assertions
export { buildMCPAssertions } from "./assertions.js";
// Compilation
export { compileMCPTask } from "./compiler.js";
// Validation
export { validateMCPTask } from "./validation.js";
// Prompts
export { MCP_PROMPT_TEMPLATES } from "./prompts.js";
// Provider config
export { DEFAULT_MAX_TOOL_ROUNDS, MCP_PROVIDER_PATH, } from "./provider-config.js";
