import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
export const requestFlowToolsParamsSchema = z.object({
    task_description: z.string().meta({
        description: 'Description of the current task to search for relevant flows',
    }),
    flow_type: 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: 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'),
});
const flowParameterSchema = z.object({
    name: z.string(),
    default_value: z.string().optional(),
});
const flowSummarySchema = z.object({
    flow_id: z.string().meta({
        description: 'The unique identifier for this flow, use this with execute_flow tool',
    }),
    name: z.string().meta({
        description: 'The name/description of the flow',
    }),
    description: z.string().optional().meta({
        description: 'Detailed description of what the flow does',
    }),
    parameters: z.array(flowParameterSchema).meta({
        description: 'Parameters required by this flow',
    }),
    usage_count: z.number().optional().meta({
        description: 'Number of tests using this flow',
    }),
    creation_url: z.string().optional().meta({
        description: 'The URL where the flow was created',
    }),
    preconditions: z.string().optional().meta({
        description: 'Preconditions required before executing this flow',
    }),
    summary: z.string().optional().meta({
        description: 'Summary of what the flow accomplishes',
    }),
    steps: z.string().optional().meta({
        description: 'Detailed step-by-step description of what the flow does',
    }),
    snippets: z.string().optional().meta({
        description: 'Information about JavaScript snippets referenced in this flow',
    }),
});
export const requestFlowToolsResponseSchema = z.object({
    flows_found: z.number().meta({
        description: 'Number of flows found',
    }),
    flows: z.array(flowSummarySchema).meta({
        description: 'List of flows that can be executed using the execute_flow tool',
    }),
});
export const RequestFlowToolsDefinition = defineTool({
    name: 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: requestFlowToolsParamsSchema,
    responseSchema: requestFlowToolsResponseSchema,
});
//# sourceMappingURL=RequestFlowsDefinition.js.map