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 executeUploadFileArgumentsSchema = z.object({
    elementDescription: z.string().describe(TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS),
    file_name: z
        .string()
        .describe('The exact name of the file to upload, as it appears in the mabl workspace file uploads. The tool will fail if no upload with this exact name is found.'),
    customFind: customFindSchema.optional(),
});
export const executeUploadFileServerResultSchema = 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(),
    files: z.array(z.object({
        id: z.string().optional(),
        name: z.string().optional(),
        size: z.number().optional(),
        type: z.string().optional(),
        url: z.string().optional(),
    })),
});
export const executeUploadFileClientResponseSchema = 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 upload action',
    }),
    current_url: z.string().optional().meta({
        description: 'The current URL after the upload action',
    }),
});
export const ExecuteUploadFileToolDefinition = defineTool({
    name: AgentToolNames.ExecuteUploadFile,
    description: 'Uploads a file using a file input element on the page. The elementDescription identifies the file input element. The file_name must exactly match the name of a previously uploaded file in the mabl workspace. Records both the set_files step and the await_upload step.',
    argumentsSchema: executeUploadFileArgumentsSchema,
    serverPrepareResultSchema: executeUploadFileServerResultSchema,
    responseSchema: executeUploadFileClientResponseSchema,
});
//# sourceMappingURL=ExecuteUploadFileDefinition.js.map