"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteScrollToolDefinition = exports.executeScrollClientResponseSchema = exports.executeScrollServerResultSchema = exports.executeScrollArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("./agentToolNames.js");
exports.executeScrollArgumentsSchema = zod_1.z.object({
    description: zod_1.z
        .string()
        .max(100)
        .optional()
        .describe('A brief description of what this step does (max 100 characters)'),
    reasoning: zod_1.z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
    direction: zod_1.z.string().meta({
        description: '"up" or "down" to scroll in the desired direction',
    }),
    sectionDescription: zod_1.z.string().optional().meta({
        description: 'If provided, scrolls the specific section with this description instead of the page. This is useful for cases where pages have sections that are independently scrollable such as a modal or side menu. It is generally better to be more specific than less on what to scroll.',
    }),
    scrollFactor: zod_1.z.number().optional().meta({
        description: 'Controls how much of the viewport height to scroll per action (0.0 to 1.0). Default is 0.75. Use the default at first, but consider using a smaller value (e.g., 0.25-0.5) for finer scrolling if you need more precise positioning, or a larger value (e.g., 0.9-1.0) if you need to scroll through more content quickly after a previous scroll was insufficient.',
    }),
});
exports.executeScrollServerResultSchema = zod_1.z.object({
    direction: zod_1.z.string(),
    scrollFactor: zod_1.z.number(),
    sectionDescription: zod_1.z.string().optional(),
    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_scroll tool.
 * The client should include the new screenshot after the scroll action
 * to show newly visible content.
 */
exports.executeScrollClientResponseSchema = 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 scrolling',
    }),
    current_url: zod_1.z.string().optional().meta({
        description: 'The current URL (may change if scrolling triggers lazy loading or hash changes)',
    }),
});
exports.ExecuteScrollToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteScroll,
    description: 'Scrolls the application in the desired direction. The client response will include a new screenshot showing the newly visible content. ' +
        'Scrolling is not saved as a test step; replay auto-scrolls to elements on find. ' +
        'If a visual assertion depends on scroll position, record an execute_javascript scroll (e.g. window.scrollTo) before it.',
    argumentsSchema: exports.executeScrollArgumentsSchema,
    serverPrepareResultSchema: exports.executeScrollServerResultSchema,
    responseSchema: exports.executeScrollClientResponseSchema,
});
//# sourceMappingURL=ExecuteScrollDefinition.js.map