"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SaveTestInformationToolDefinition = exports.saveTestInformationArgumentsSchema = exports.saveTestInformationResponseSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
var schemas_js_1 = require("./schemas.js");
/**
 * Response schema for the save_test_information tool.
 * Returns the resolved test information with entity names for user display.
 */
exports.saveTestInformationResponseSchema = zod_1.z.object({
    message: zod_1.z.string().meta({
        description: 'A confirmation message describing the saved test information with resolved entity names',
    }),
    test_information: schemas_js_1.testInformationSchema,
    resolved_names: zod_1.z
        .object({
        application_name: zod_1.z.string().optional(),
        environment_name: zod_1.z.string().optional(),
        deployment_url: zod_1.z.string().optional(),
        credentials_name: zod_1.z.string().optional(),
        datatable_name: zod_1.z.string().optional(),
        scenario_name: zod_1.z.string().optional(),
        branch_name: zod_1.z.string().optional(),
        plan_name: zod_1.z.string().optional(),
        test_name: zod_1.z.string().optional(),
    })
        .meta({
        description: 'Human-readable names for the resolved entities (deployment, credentials, branch, plan, etc.)',
    }),
});
/**
 * Extended test information schema that includes viewport dimensions, datatable
 * selection, labels, device emulation, branch, and plan.
 *
 * These fields are optional — the agent only sets them when the user's request
 * implies them. The defaults documented below are applied downstream (the
 * desktop trainer / cloud runner) when the field is omitted.
 */
exports.saveTestInformationArgumentsSchema = schemas_js_1.testInformationSchema.extend({
    viewport_width: zod_1.z.number().optional().meta({
        description: 'Browser viewport width in pixels. Defaults to 1080 if not specified. Only set this if the user explicitly requests a specific viewport size.',
    }),
    viewport_height: zod_1.z.number().optional().meta({
        description: 'Browser viewport height in pixels. Defaults to 1440 if not specified. Only set this if the user explicitly requests a specific viewport size.',
    }),
    datatable_id: zod_1.z.string().optional().meta({
        description: 'The ID of the data table to use for the test. Pick this from the workspace context only when the test is data-driven (the user wants to run the same test against multiple inputs). If the user just wants a single test scenario, leave this blank.',
    }),
    scenario_id: zod_1.z.string().optional().meta({
        description: 'The ID of a specific scenario (row) within the chosen data table. Required when datatable_id is set — the test builder needs concrete variable values from a specific scenario to build with. Call get_data_table_details first to see available scenarios. Additional scenarios can be configured after generation.',
    }),
    labels: zod_1.z.array(zod_1.z.string()).optional().meta({
        description: 'Free-form labels to attach to the test (used for tagging / filtering, e.g. "smoke", "checkout"). Only include labels the user explicitly mentioned, or labels that strongly match the test purpose.',
    }),
});
exports.SaveTestInformationToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.SaveTestInformation,
    description: 'Lock in the test configuration: name, description, deployment (application + environment + URL), credentials, test case, ' +
        'data table, labels, viewport, device emulation, branch, and plan. This tool validates that all IDs are real and accessible, ' +
        'resolves deployment to its application/environment/URL, and persists the information for the user to review. Call this before ' +
        'presenting the test information to the user — it will fail with a clear error if any required field is missing or any ID is invalid.',
    argumentsSchema: exports.saveTestInformationArgumentsSchema,
    responseSchema: exports.saveTestInformationResponseSchema,
});
//# sourceMappingURL=SaveTestInfoDefinition.js.map