"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.GetApplicationStateToolDefinition = exports.getApplicationStateResponseSchema = exports.getApplicationStateParamsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
exports.getApplicationStateParamsSchema = zod_1.z.object({
    include_url: zod_1.z.boolean().optional().meta({
        description: 'Whether to include the current URL in the response. Default: true',
    }),
    include_scrollable_elements: zod_1.z.boolean().optional().meta({
        description: 'Whether to include information about scrollable elements. Default: false',
    }),
    include_tabs: zod_1.z.boolean().optional().meta({
        description: 'Whether to include the list of open browser tabs. Default: true',
    }),
    include_page_snapshot: zod_1.z.boolean().optional().meta({
        description: 'Whether to include the page snapshot in the response. Default: false',
    }),
});
// Schema for scrollable elements - mirrors the ScrollableElementsInner type structure
var scrollableElementSchema = zod_1.z.any();
// Schema for tab info
var tabInfoSchema = zod_1.z.object({
    tab_id: zod_1.z.string().meta({
        description: 'The unique identifier for the tab (page identifier)',
    }),
    url: zod_1.z.string().meta({
        description: 'The URL of the tab',
    }),
    title: zod_1.z.string().optional().meta({
        description: 'The title of the tab (if available)',
    }),
});
exports.getApplicationStateResponseSchema = zod_1.z.object({
    current_url: zod_1.z.string().optional().meta({
        description: 'The current URL of the page (if include_url is true)',
    }),
    scrollable_elements: zod_1.z.array(scrollableElementSchema).optional().meta({
        description: 'List of scrollable elements on the page (if include_scrollable_elements is true)',
    }),
    message: zod_1.z.string().optional().meta({
        description: 'A message indicating the screenshot is attached as an image',
    }),
    tabs: zod_1.z.array(tabInfoSchema).optional().meta({
        description: 'List of open browser tabs with their details (if include_tabs is true)',
    }),
    tab_count: zod_1.z.number().optional().meta({
        description: 'The total number of open tabs (if include_tabs is true)',
    }),
    page_snapshot: zod_1.z
        .string()
        .optional()
        .meta({
        description: 'The page snapshot of the current page (if include_page_snapshot is true). ' +
            'Node labels in the snapshot (e.g. "button", "link") are ARIA roles from the accessibility tree; ' +
            'select elements by role and accessible name (textContent, aria-label, or input value) rather than by tag name.',
    }),
});
exports.GetApplicationStateToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.GetApplicationState,
    description: "Retrieves the current application state including a screenshot and optional page information.\n\nUse this tool when you need to:\n- See the current state of the application without executing an action\n- Verify the page state after a series of actions\n- Check what elements are visible before deciding on the next action\n- Get information about scrollable areas on the page\n- Access the current URL\n- See what browser tabs are currently open (use include_tabs: true)\n- Retrieve the page snapshot of the current page\n\nNote: Most page-mutating tools (click, enter_text, hover, scroll, etc.) include the new screenshot in their response. Use this tool only when you need the application state without performing an action.",
    argumentsSchema: exports.getApplicationStateParamsSchema,
    responseSchema: exports.getApplicationStateResponseSchema,
});
//# sourceMappingURL=GetApplicationStateDefinition.js.map