"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestFlowToolsDefinition = exports.requestFlowToolsResponseSchema = exports.requestFlowToolsParamsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
exports.requestFlowToolsParamsSchema = zod_1.z.object({
    task_description: zod_1.z.string().meta({
        description: 'Description of the current task to search for relevant flows',
    }),
    flow_type: zod_1.z
        .enum(['browser', 'api', 'mobile'])
        .meta({
        description: 'The type of flow to search for. Choose based on the context:\n' +
            '- "browser": For browser-based web flows (browser app login, general browser interactions)\n' +
            '- "api": For API testing flows (REST API calls, API validation)\n' +
            '- "mobile": For mobile application flows (mobile app interactions)\n' +
            'Select the type that matches the context.',
    })
        .describe('Type of flow to search for based on test context: "browser" for web/browser flows, "api" for API flows, "mobile" for mobile app flows'),
    application_id: zod_1.z
        .string()
        .optional()
        .meta({
        description: '**Best practice**: Limit search to a specific application when the application ID is known from context (e.g., from test information or workspace context). This improves search relevance by finding flows specific to the relevant application.',
    })
        .describe('Optional application ID to limit flow search to a specific application'),
});
var flowParameterSchema = zod_1.z.object({
    name: zod_1.z.string(),
    default_value: zod_1.z.string().optional(),
});
var flowSummarySchema = zod_1.z.object({
    flow_id: zod_1.z.string().meta({
        description: 'The unique identifier for this flow, use this with execute_flow tool',
    }),
    name: zod_1.z.string().meta({
        description: 'The name/description of the flow',
    }),
    description: zod_1.z.string().optional().meta({
        description: 'Detailed description of what the flow does',
    }),
    parameters: zod_1.z.array(flowParameterSchema).meta({
        description: 'Parameters required by this flow',
    }),
    usage_count: zod_1.z.number().optional().meta({
        description: 'Number of tests using this flow',
    }),
    creation_url: zod_1.z.string().optional().meta({
        description: 'The URL where the flow was created',
    }),
    preconditions: zod_1.z.string().optional().meta({
        description: 'Preconditions required before executing this flow',
    }),
    summary: zod_1.z.string().optional().meta({
        description: 'Summary of what the flow accomplishes',
    }),
    steps: zod_1.z.string().optional().meta({
        description: 'Detailed step-by-step description of what the flow does',
    }),
    snippets: zod_1.z.string().optional().meta({
        description: 'Information about JavaScript snippets referenced in this flow',
    }),
});
exports.requestFlowToolsResponseSchema = zod_1.z.object({
    flows_found: zod_1.z.number().meta({
        description: 'Number of flows found',
    }),
    flows: zod_1.z.array(flowSummarySchema).meta({
        description: 'List of flows that can be executed using the execute_flow tool',
    }),
});
exports.RequestFlowToolsDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.RequestFlowTools,
    description: 'Search for flows relevant to the current task. Returns a list of flows with their details. Use this to find reusable flows that are related to your task. Specify the flow type (browser/api/mobile) and optionally limit to a specific application for better results. If you are interacting with an application, flows are reusable steps that can be used to accomplish your task, and are generally preferred over individual mabl steps. Flows are also great context for understanding an application and how it works.\n\nKeep in mind that when you are looking at the flow details, flows sometimes have input parameters. These parameters are important for when you use the execute_flow tool, but they cannot be used as variables in other steps.',
    argumentsSchema: exports.requestFlowToolsParamsSchema,
    responseSchema: exports.requestFlowToolsResponseSchema,
});
//# sourceMappingURL=RequestFlowsDefinition.js.map