import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from './agentToolNames.js';
const sendAutoAnalysisResultArgumentsSchema = z.object({
    title: z.string().meta({
        description: 'Short title summarizing the analysis result (e.g., "Login test fails due to missing CSRF token" or "Checkout flow broken by API 500 error"). Keep under 100 characters.',
    }),
    summary: z.string().meta({
        description: `Structured markdown summary. Always include **### Root cause** and **### Next steps** (bullets under each) only. Do not add extra **###** subsections — put automatic-recovery step detail in the evidence file when **traSessionId** appears on steps.

**Root cause** — Expected vs actual, new vs recurring.

**Next steps** — Actionable recommendation (flaky vs broken vs app change vs escalate).

Keep root cause and next steps tight; put detail (including recovery steps) in the evidence file.`,
    }),
    failure_category: z.string().optional().meta({
        description: 'Suggested failure category ID. MUST be one of the IDs listed under "failure_category" in the system prompt for this workspace (mabl defaults + any workspace-custom reasons). When no listed category is a clear match, use "other" (the default catch-all) — do not invent new IDs.',
    }),
    evidence_filename: z.string().optional().meta({
        description: 'Filename of a saved evidence file to attach. The file should contain detailed visual and technical evidence supporting the analysis.',
    }),
});
const sendAutoAnalysisResultServerPrepareResultSchema = z.object({
    file_content: z.string().optional().meta({
        description: 'The content of the evidence file, if a filename was provided and validated.',
    }),
    validation_warnings: z.array(z.string()).optional().meta({
        description: 'Warnings about potential issues with the evidence file content, such as missing evidence URLs.',
    }),
});
const sendAutoAnalysisResultResponseSchema = z.object({
    status: z.string().meta({
        description: 'Confirmation that the analysis was received.',
    }),
});
export const SendAutoAnalysisResultToolDefinition = defineTool({
    name: AgentToolNames.SendAutoAnalysisResult,
    description: `Submit the final structured failure analysis. This tool MUST be called exactly once to complete the analysis.

Use this tool after you have investigated the failure and gathered evidence. Provide:
- A concise title summarizing the failure
- A structured summary with root cause and next steps
- An optional failure category if one clearly matches
- An optional evidence file with detailed visual and technical evidence

This tool ends the analysis session. Do not call any other tools after this.`,
    argumentsSchema: sendAutoAnalysisResultArgumentsSchema,
    serverPrepareResultSchema: sendAutoAnalysisResultServerPrepareResultSchema,
    responseSchema: sendAutoAnalysisResultResponseSchema,
});
//# sourceMappingURL=SendAutoAnalysisResultDefinition.js.map