import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
export const getApplicationStateParamsSchema = z.object({
    include_url: z.boolean().optional().meta({
        description: 'Whether to include the current URL in the response. Default: true',
    }),
    include_scrollable_elements: z.boolean().optional().meta({
        description: 'Whether to include information about scrollable elements. Default: false',
    }),
    include_tabs: z.boolean().optional().meta({
        description: 'Whether to include the list of open browser tabs. Default: true',
    }),
    include_page_snapshot: 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
const scrollableElementSchema = z.any();
// Schema for tab info
const tabInfoSchema = z.object({
    tab_id: z.string().meta({
        description: 'The unique identifier for the tab (page identifier)',
    }),
    url: z.string().meta({
        description: 'The URL of the tab',
    }),
    title: z.string().optional().meta({
        description: 'The title of the tab (if available)',
    }),
});
export const getApplicationStateResponseSchema = z.object({
    current_url: z.string().optional().meta({
        description: 'The current URL of the page (if include_url is true)',
    }),
    scrollable_elements: z.array(scrollableElementSchema).optional().meta({
        description: 'List of scrollable elements on the page (if include_scrollable_elements is true)',
    }),
    message: z.string().optional().meta({
        description: 'A message indicating the screenshot is attached as an image',
    }),
    tabs: z.array(tabInfoSchema).optional().meta({
        description: 'List of open browser tabs with their details (if include_tabs is true)',
    }),
    tab_count: z.number().optional().meta({
        description: 'The total number of open tabs (if include_tabs is true)',
    }),
    page_snapshot: 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.',
    }),
});
export const GetApplicationStateToolDefinition = defineTool({
    name: AgentToolNames.GetApplicationState,
    description: `Retrieves the current application state including a screenshot and optional page information.

Use this tool when you need to:
- See the current state of the application without executing an action
- Verify the page state after a series of actions
- Check what elements are visible before deciding on the next action
- Get information about scrollable areas on the page
- Access the current URL
- See what browser tabs are currently open (use include_tabs: true)
- Retrieve the page snapshot of the current page

Note: 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: getApplicationStateParamsSchema,
    responseSchema: getApplicationStateResponseSchema,
});
//# sourceMappingURL=GetApplicationStateDefinition.js.map