"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RequestSnippetToolsDefinition = exports.requestSnippetToolsResponseSchema = exports.requestSnippetToolsParamsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("../shared/agentToolNames.js");
var ExecutePreexistingSnippetDefinition_js_1 = require("./ExecutePreexistingSnippetDefinition.js");
exports.requestSnippetToolsParamsSchema = zod_1.z.object({
    task_description: zod_1.z.string().meta({
        description: 'Description of the current task to search for relevant snippets',
    }),
    snippet_types: zod_1.z
        .array(zod_1.z.enum(['javascript', 'postman', 'sql']))
        .meta({
        description: 'Types of snippets to search for. Choose based on the context:\n' +
            '- "javascript": For browser and mobile interactions (applicable to both web and mobile app testing)\n' +
            '- "postman": For API testing (REST API testing)\n' +
            '- "sql": For database operations\n' +
            'Select types that match the context. For browser or mobile interactions, include "javascript" and optionally "sql". For API testing, include "postman" and optionally "sql".',
    })
        .describe('Array of snippet types to search for: "javascript" for browser/mobile, "postman" for API, "sql" for database operations'),
    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 snippets specific to the relevant application.',
    })
        .describe('Optional application ID to limit snippet search to a specific application'),
});
var snippetParameterSchema = zod_1.z.object({
    name: zod_1.z.string(),
    default_value: zod_1.z.string().optional(),
});
var snippetSummarySchema = zod_1.z.object({
    snippet_id: zod_1.z.string().meta({
        description: "The unique identifier for this snippet, use this with ".concat(ExecutePreexistingSnippetDefinition_js_1.ExecutePreexistingSnippetToolDefinition.name, " tool"),
    }),
    name: zod_1.z.string().meta({
        description: 'The name of the snippet',
    }),
    description: zod_1.z.string().optional().meta({
        description: 'Description of what the snippet does',
    }),
    snippet_type: zod_1.z.string().optional().meta({
        description: 'Type of the snippet (e.g., javascript)',
    }),
    body: zod_1.z.string().optional().meta({
        description: 'The decoded body/code of the snippet',
    }),
    parameters: zod_1.z.array(snippetParameterSchema).meta({
        description: 'Parameters required by this snippet',
    }),
});
exports.requestSnippetToolsResponseSchema = zod_1.z.object({
    snippets_found: zod_1.z.number().meta({
        description: 'Number of snippets found',
    }),
    snippets: zod_1.z.array(snippetSummarySchema).meta({
        description: "List of snippets that can be executed using the ".concat(ExecutePreexistingSnippetDefinition_js_1.ExecutePreexistingSnippetToolDefinition.name, " tool"),
    }),
});
exports.RequestSnippetToolsDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.RequestSnippetTools,
    description: "Search for code snippets relevant to the current task. Returns a list of snippets with their details. Use this to find reusable code snippets that are related to your task. Specify snippet types (javascript for browser/mobile, postman for API, sql for database) and optionally limit to a specific application for better results.\n\nKeep in mind that when you are looking at the snippet details, snippets sometimes have input parameters. These parameters are important for when you use the ".concat(ExecutePreexistingSnippetDefinition_js_1.ExecutePreexistingSnippetToolDefinition.name, " tool, but they cannot be used as variables in other steps."),
    argumentsSchema: exports.requestSnippetToolsParamsSchema,
    responseSchema: exports.requestSnippetToolsResponseSchema,
});
//# sourceMappingURL=RequestSnippetsDefinition.js.map