import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from './agentToolNames.js';
import { TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS } from './constants.js';
import { customFindSchema } from './customFind.js';
export const executeClickArgumentsSchema = z.object({
    description: z.string().max(100).describe('A brief description of what this step does (max 100 characters)'),
    elementDescription: z.string().meta({
        description: TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS,
    }),
    customFind: customFindSchema.optional(),
    reasoning: z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
});
export const executeClickServerResultSchema = z.object({
    elementDescription: z.string(),
    elementBoundingBox: z
        .object({
        top: z.number(),
        left: z.number(),
        bottom: z.number(),
        right: z.number(),
    })
        .optional(),
    elementTargetPoint: z
        .object({
        x: z.number(),
        y: z.number(),
    })
        .optional(),
});
/**
 * Response schema for execute_click tool.
 * The client should include the new screenshot and current URL after the click action
 * to provide context for the next agent decision without requiring a separate user prompt.
 */
export const executeClickClientResponseSchema = z.object({
    success: z.boolean(),
    message: z.string().optional(),
    // Context fields - client should include these after executing the action
    new_screenshot: z.string().optional().meta({
        description: 'Base64-encoded PNG screenshot of the page after the click action',
    }),
    current_url: z.string().optional().meta({
        description: 'The current URL after the click action (in case of navigation)',
    }),
});
export const ExecuteClickToolDefinition = defineTool({
    name: AgentToolNames.ExecuteClick,
    description: 'Clicks on an element in the app identified by the provided description to uniquely identify it the screenshot.',
    argumentsSchema: executeClickArgumentsSchema,
    serverPrepareResultSchema: executeClickServerResultSchema,
    responseSchema: executeClickClientResponseSchema,
});
//# sourceMappingURL=ExecuteClickDefinition.js.map