import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
import { TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS } from '../shared/constants.js';
import { customFindSchema } from '../shared/customFind.js';
export const executeReleaseArgumentsSchema = 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(),
    isHtml5: z
        .boolean()
        .optional()
        .describe('Whether the drop target uses the HTML5 Drag and Drop API. ' +
        'Must match the isHtml5 value used in the preceding execute_click_and_hold step.'),
    reasoning: z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
});
export const executeReleaseServerResultSchema = z.object({
    elementDescription: z.string(),
    isHtml5: z.boolean().optional(),
    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(),
});
export const executeReleaseClientResponseSchema = z.object({
    success: z.boolean(),
    message: z.string().optional(),
    new_screenshot: z.string().optional().meta({
        description: 'Base64-encoded PNG screenshot of the page after the release action',
    }),
    current_url: z.string().optional().meta({
        description: 'The current URL after the release action',
    }),
});
export const ExecuteReleaseToolDefinition = defineTool({
    name: AgentToolNames.ExecuteRelease,
    description: 'Releases the mouse on a drop target to complete a drag-and-drop operation. ' +
        'Must be preceded by execute_click_and_hold on the drag source. ' +
        'Use the same isHtml5 value as the corresponding execute_click_and_hold step.',
    argumentsSchema: executeReleaseArgumentsSchema,
    serverPrepareResultSchema: executeReleaseServerResultSchema,
    responseSchema: executeReleaseClientResponseSchema,
});
//# sourceMappingURL=ExecuteReleaseDefinition.js.map