"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteClickToolDefinition = exports.executeClickClientResponseSchema = exports.executeClickServerResultSchema = exports.executeClickArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("./agentToolNames.js");
var constants_js_1 = require("./constants.js");
var customFind_js_1 = require("./customFind.js");
exports.executeClickArgumentsSchema = zod_1.z.object({
    description: zod_1.z.string().max(100).describe('A brief description of what this step does (max 100 characters)'),
    elementDescription: zod_1.z.string().meta({
        description: constants_js_1.TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS,
    }),
    customFind: customFind_js_1.customFindSchema.optional(),
    reasoning: zod_1.z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
});
exports.executeClickServerResultSchema = zod_1.z.object({
    elementDescription: zod_1.z.string(),
    elementBoundingBox: zod_1.z
        .object({
        top: zod_1.z.number(),
        left: zod_1.z.number(),
        bottom: zod_1.z.number(),
        right: zod_1.z.number(),
    })
        .optional(),
    elementTargetPoint: zod_1.z
        .object({
        x: zod_1.z.number(),
        y: zod_1.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.
 */
exports.executeClickClientResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
    // Context fields - client should include these after executing the action
    new_screenshot: zod_1.z.string().optional().meta({
        description: 'Base64-encoded PNG screenshot of the page after the click action',
    }),
    current_url: zod_1.z.string().optional().meta({
        description: 'The current URL after the click action (in case of navigation)',
    }),
});
exports.ExecuteClickToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteClick,
    description: 'Clicks on an element in the app identified by the provided description to uniquely identify it the screenshot.',
    argumentsSchema: exports.executeClickArgumentsSchema,
    serverPrepareResultSchema: exports.executeClickServerResultSchema,
    responseSchema: exports.executeClickClientResponseSchema,
});
//# sourceMappingURL=ExecuteClickDefinition.js.map