import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
import { TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS } from '../shared/constants.js';
export const executeWaitUntilArgumentsSchema = z.object({
    description: z
        .string()
        .max(100)
        .optional()
        .describe('A brief description of what this step does (max 100 characters)'),
    reasoning: z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
    elementDescription: z.string().meta({ description: TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS }),
    timeoutSeconds: z.number().meta({
        description: 'Maximum number of seconds to wait for the element to appear. Use a value appropriate for the expected load time (e.g. 10–30 seconds).',
    }),
});
export const executeWaitUntilServerResultSchema = z.object({
    elementDescription: z.string(),
    timeoutSeconds: z.number(),
    elementBoundingBox: z.object({
        top: z.number(),
        left: z.number(),
        bottom: z.number(),
        right: z.number(),
    }),
    elementTargetPoint: z.object({
        x: z.number(),
        y: z.number(),
    }),
});
export const executeWaitUntilResponseSchema = z.object({
    success: z.boolean(),
    message: z.string().optional(),
});
export const ExecuteWaitUntilToolDefinition = defineTool({
    name: AgentToolNames.ExecuteWaitUntil,
    description: 'Records a wait-until step that pauses test execution until the specified element is present on the page. Use this when the test will need to wait for a specific element to become visible or other visual change to the page. The step will be saved as part of the test.',
    argumentsSchema: executeWaitUntilArgumentsSchema,
    serverPrepareResultSchema: executeWaitUntilServerResultSchema,
    responseSchema: executeWaitUntilResponseSchema,
});
//# sourceMappingURL=ExecuteWaitUntilDefinition.js.map