"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteValidateTestToolDefinition = exports.executeValidateTestResponseSchema = exports.executeValidateTestArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
exports.executeValidateTestArgumentsSchema = zod_1.z.object({
    url: zod_1.z.string().optional().meta({
        description: 'Override starting URL for the validation run. Defaults to the application URL configured for this test.',
    }),
    stop_on_first_failure: zod_1.z.boolean().optional().meta({
        description: 'If true, stop replay at the first failing step instead of running all steps. Defaults to false.',
    }),
});
/**
 * Result for a single step during the validation replay.
 */
var stepValidationResultSchema = zod_1.z.object({
    stepIndex: zod_1.z.number().meta({ description: 'Zero-based index of the step' }),
    stepDescription: zod_1.z.string().meta({ description: 'Human-readable step description' }),
    status: zod_1.z.enum(['pass', 'fail', 'skipped']),
    errorMessage: zod_1.z.string().optional().meta({ description: 'Error message if the step failed' }),
    expected: zod_1.z.string().optional().meta({ description: 'Expected value for assertion failures' }),
    actual: zod_1.z.string().optional().meta({ description: 'Actual value found for assertion failures' }),
    durationMs: zod_1.z.number().optional().meta({ description: 'Step execution time in milliseconds' }),
});
/**
 * Response schema for execute_validate_test tool.
 * Returns per-step pass/fail results from replaying the generated test
 * in a fresh browser.
 */
exports.executeValidateTestResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean().meta({
        description: 'Whether all steps passed during the validation run',
    }),
    stepResults: zod_1.z.array(stepValidationResultSchema).meta({
        description: 'Per-step validation results',
    }),
    totalDurationMs: zod_1.z.number().meta({
        description: 'Total time for the validation run in milliseconds',
    }),
    error: zod_1.z.string().optional().meta({
        description: 'Error message if validation could not be performed',
    }),
});
exports.ExecuteValidateTestToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: 'execute_validate_test',
    description: 'Validates the generated test by closing the current browser, launching a completely fresh browser (no cookies, localStorage, or cached state), and replaying all generated steps from start to finish. Use this after completing test authoring to verify the test handles dynamic data correctly and works end-to-end in a clean environment. The fresh browser becomes the new authoring browser, so you can continue editing if any steps fail. Returns per-step pass/fail results with error details for failed assertions.',
    argumentsSchema: exports.executeValidateTestArgumentsSchema,
    responseSchema: exports.executeValidateTestResponseSchema,
});
//# sourceMappingURL=ExecuteValidateTestDefinition.js.map