import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
export const executeValidateTestArgumentsSchema = z.object({
    url: 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: 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.
 */
const stepValidationResultSchema = z.object({
    stepIndex: z.number().meta({ description: 'Zero-based index of the step' }),
    stepDescription: z.string().meta({ description: 'Human-readable step description' }),
    status: z.enum(['pass', 'fail', 'skipped']),
    errorMessage: z.string().optional().meta({ description: 'Error message if the step failed' }),
    expected: z.string().optional().meta({ description: 'Expected value for assertion failures' }),
    actual: z.string().optional().meta({ description: 'Actual value found for assertion failures' }),
    durationMs: 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.
 */
export const executeValidateTestResponseSchema = z.object({
    success: z.boolean().meta({
        description: 'Whether all steps passed during the validation run',
    }),
    stepResults: z.array(stepValidationResultSchema).meta({
        description: 'Per-step validation results',
    }),
    totalDurationMs: z.number().meta({
        description: 'Total time for the validation run in milliseconds',
    }),
    error: z.string().optional().meta({
        description: 'Error message if validation could not be performed',
    }),
});
export const ExecuteValidateTestToolDefinition = 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: executeValidateTestArgumentsSchema,
    responseSchema: executeValidateTestResponseSchema,
});
//# sourceMappingURL=ExecuteValidateTestDefinition.js.map