"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecuteEnterAuthCodeToolDefinition = exports.executeEnterAuthCodeClientResponseSchema = exports.executeEnterAuthCodeServerResultSchema = exports.executeEnterAuthCodeArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
var constants_js_1 = require("../shared/constants.js");
exports.executeEnterAuthCodeArgumentsSchema = zod_1.z.object({
    description: zod_1.z.string().max(100).describe('A brief description of what this step does (max 100 characters)'),
    elementDescription: zod_1.z.string().meta({
        description: constants_js_1.TOOL_ELEMENT_DESCRIPTION_INSTRUCTIONS,
    }),
    reasoning: zod_1.z
        .string()
        .optional()
        .describe('Brief explanation of why this action is being taken and what it aims to achieve'),
});
exports.executeEnterAuthCodeServerResultSchema = zod_1.z.object({
    elementDescription: zod_1.z.string(),
    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(),
    }),
    elementTargetPoint: zod_1.z.object({
        x: zod_1.z.number(),
        y: zod_1.z.number(),
    }),
});
/**
 * Response schema for execute_enter_auth_code tool.
 * The auth code value is fetched at run time from the test's configured credential — the agent
 * never sees or supplies the code. The client should include the new screenshot and current URL
 * after typing because the auth-code submission frequently navigates.
 */
exports.executeEnterAuthCodeClientResponseSchema = zod_1.z.object({
    success: zod_1.z.boolean(),
    message: zod_1.z.string().optional(),
    new_screenshot: zod_1.z.string().optional().meta({
        description: 'Base64-encoded PNG screenshot of the page after entering the authentication code',
    }),
    current_url: zod_1.z.string().optional().meta({
        description: 'The current URL after the action (auth-code entry frequently submits the form)',
    }),
});
exports.ExecuteEnterAuthCodeToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.ExecuteEnterAuthCode,
    description: 'Records an "enter authentication code" step that types a TOTP (time-based one-time password) into the specified input at run time. ' +
        "The code is fetched from the test's configured credential during execution — the agent does NOT supply or see the code. " +
        'Use ONLY when the application is showing an MFA / authenticator-app prompt (e.g., "Enter the 6-digit code from your authenticator app"). ' +
        'Precondition: the test must have a credential of type basic_with_totp configured for run-time success. ' +
        'If the auth code is split across multiple inputs (common 6-digit pattern), call this tool once per input, left to right. ' +
        "For ordinary password fields, use ".concat(agentToolNames_js_1.AgentToolNames.ExecuteEnterText, " \u2014 not this tool."),
    argumentsSchema: exports.executeEnterAuthCodeArgumentsSchema,
    serverPrepareResultSchema: exports.executeEnterAuthCodeServerResultSchema,
    responseSchema: exports.executeEnterAuthCodeClientResponseSchema,
});
//# sourceMappingURL=ExecuteEnterAuthCodeDefinition.js.map