"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SubmitRelevantTestsToolDefinition = exports.submitRelevantTestsResponseSchema = exports.submitRelevantTestsArgumentsSchema = void 0;
var zod_1 = require("zod");
var toolDefinition_js_1 = require("../toolDefinition.js");
var agentToolNames_js_1 = require("./agentToolNames.js");
/**
 * Terminal tool for the test-search agent. The agent calls this exactly once, after its single
 * search round, to return its final ranked selection. It is a pure client tool (see
 * SubmitRelevantTestsTool): calling it produces no tool output, so the function-calling loop
 * returns immediately and the service reads the submitted arguments off the tool_call part. The
 * agent has no source of test ids other than the search-tool outputs, so the service additionally
 * drops any submitted id those tools did not surface (the allowlist trust boundary).
 */
exports.submitRelevantTestsArgumentsSchema = zod_1.z.object({
    tests: zod_1.z
        .array(zod_1.z.object({
        test_invariant_id: zod_1.z.string().meta({
            description: 'The test_invariant_id of a relevant test, copied EXACTLY from a search result. ' +
                'Only ids your searches actually returned are accepted; fabricated ids are dropped.',
        }),
        test_name: zod_1.z.string().optional().meta({
            description: 'The test name from the search result, for readability. Optional.',
        }),
        relevance_reason: zod_1.z.string().meta({
            description: 'One sentence (max ~300 chars) explaining why this test answers the query, anchored in ' +
                'something concrete from the search results (a matched token, a step, a label). Do not invent details.',
        }),
        matched_via: zod_1.z.enum(['text', 'semantic', 'both']).meta({
            description: 'Which tool surfaced this test: "text" = only search_tests_by_text, ' +
                '"semantic" = only search_tests_by_semantic, "both" = returned by both.',
        }),
    }))
        .meta({
        description: 'Your final ranked, de-duplicated selection, ordered most-relevant first. Include EVERY test ' +
            'that genuinely answers the query — missing a relevant test is worse than including a borderline one. ' +
            'Submit an EMPTY array ONLY when no candidate is relevant (a valid, expected outcome); do NOT submit ' +
            'empty when any test is plausibly relevant.',
    }),
});
exports.submitRelevantTestsResponseSchema = zod_1.z.object({
    accepted: zod_1.z.boolean(),
});
exports.SubmitRelevantTestsToolDefinition = (0, toolDefinition_js_1.defineTool)({
    name: agentToolNames_js_1.AgentToolNames.SubmitRelevantTests,
    description: 'Return your final answer: the ranked list of tests relevant to the query. Call this EXACTLY ONCE, ' +
        'after your searches, with the tests you selected (or an empty list if none are relevant). ' +
        'This ENDS the search — do not call any search tool once you decide to submit.',
    argumentsSchema: exports.submitRelevantTestsArgumentsSchema,
    responseSchema: exports.submitRelevantTestsResponseSchema,
});
//# sourceMappingURL=SubmitRelevantTestsDefinition.js.map