import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
const COOKIE_ATTRIBUTES = ['value', 'domain', 'path', 'expires', 'http_only', 'secure', 'name'];
const COOKIE_ASSERTION_TYPES = [
    'equals',
    'does_not_equal',
    'contains',
    'does_not_contain',
    'starts_with',
    'ends_with',
    'matches_regex',
];
export const executeAssertCookieArgumentsSchema = z.object({
    cookieName: z.string().min(1).meta({
        description: 'The name of the browser cookie to assert against (e.g. "session_id", "consent", "auth_token"). The cookie must already exist on the current page at the time of the assertion — this tool does not create cookies.',
    }),
    cookieAttribute: z.enum(COOKIE_ATTRIBUTES).meta({
        description: 'Which cookie attribute to assert on. "value" is the cookie content (most common — use this unless the user asked about another property). "domain" is the cookie\'s scope (e.g. ".example.com"). "path" is the URL path scope (e.g. "/"). "expires" is the expiry time. "http_only" and "secure" are "true"/"false" strings. "name" is rarely useful (it will always equal cookieName).',
    }),
    assertionType: z.enum(COOKIE_ASSERTION_TYPES).meta({
        description: 'The type of comparison to perform between the cookie attribute value and the expected value.',
    }),
    expectedValue: z.string().meta({
        description: 'The expected value to compare the cookie attribute against. Use {{@variableName}} syntax if the expected value is stored in a variable.',
    }),
});
export const executeAssertCookieResponseSchema = z.object({
    success: z.boolean(),
    message: z.string().optional(),
});
export const ExecuteAssertCookieToolDefinition = defineTool({
    name: AgentToolNames.ExecuteAssertCookie,
    description: 'Asserts on a browser cookie attribute using a comparison. Use this tool when you need to verify a cookie exists with a specific value, or to verify any other cookie property (domain, path, http_only, secure, etc.) — such as confirming an auth/session cookie was set after login, verifying a consent cookie captured a user choice, or checking a feature-flag cookie. This tool reads cookies directly from the browser — it does NOT look at the DOM or screenshot. Do NOT use execute_assert or execute_assert_element to verify cookies: they only inspect visible page content. Do NOT use this tool for non-cookie state (URL properties, variable values, visible text) — use execute_assert_url, execute_assert_variable, or execute_assert/execute_assert_element respectively. To verify a variable that was populated from a cookie in a prior step, use execute_assert_variable instead.',
    argumentsSchema: executeAssertCookieArgumentsSchema,
    responseSchema: executeAssertCookieResponseSchema,
});
//# sourceMappingURL=ExecuteAssertCookieDefinition.js.map