import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from '../shared/agentToolNames.js';
import { flowOptionSchema, snippetOptionSchema } from '../testPlanning/schemas.js';
export const getTestContextParamsSchema = z.object({
    include_plan: z.boolean().optional().meta({
        description: 'Whether to include the full test plan with all tasks and their details (implementation notes, validation criteria, suggested flows, suggested snippets). Default: true. Always include this on first call to read the plan built with the user during planning.',
    }),
    include_variables: z.boolean().optional().meta({
        description: 'Whether to include the available variables and their values. Default: true',
    }),
    include_test_steps: z.boolean().optional().meta({
        description: 'Whether to include the current test steps with cursor position. Default: true',
    }),
});
const taskDetailSchema = z.object({
    task: z.string().meta({
        description: 'The description of the task',
    }),
    implementation_notes: z.string().optional().meta({
        description: 'Implementation notes for how to accomplish the task',
    }),
    suggested_validation: z.string().optional().meta({
        description: 'What to verify when the task is complete',
    }),
    suggested_flow_options: z.array(flowOptionSchema).optional().meta({
        description: 'Recommended reusable flow options for this task, with IDs and reasoning',
    }),
    suggested_snippet_options: z.array(snippetOptionSchema).optional().meta({
        description: 'Recommended reusable code snippet options for this task, with IDs and reasoning',
    }),
});
export const getTestContextResponseSchema = z.object({
    current_task_index: z.number().meta({
        description: 'The 0-based index of the current task',
    }),
    current_task: taskDetailSchema.optional().meta({
        description: 'Details about the current task being worked on',
    }),
    total_tasks: z.number().meta({
        description: 'Total number of tasks in the test plan',
    }),
    plan: z.string().optional().meta({
        description: 'The full test plan as a JSON string. Contains all tasks and their details. Only present when include_plan is true (default).',
    }),
    formatted_steps: z.string().optional().meta({
        description: 'Formatted test steps with 1-based dot-notation indices, task group boundaries, and cursor position marker. Use these indices with execute_move_cursor and execute_play_steps. Only present when include_test_steps is true.',
    }),
    variables: z.record(z.string(), z.string()).optional().meta({
        description: 'Available variables and their current values (if include_variables is true)',
    }),
});
export const GetTestContextToolDefinition = defineTool({
    name: AgentToolNames.GetTestContext,
    description: `Retrieves the current test context including task information, variables, and test steps.

Use this tool when you need to:
- Read the full test plan with all tasks, suggested flows, snippets, and implementation notes — do this FIRST at the start of test creation
- Review the available variables and their values
- See the current test steps and cursor position (formatted_steps shows dot-notation indices)
- Get details about the current task's implementation notes or validation criteria

**Before getting started:** If you don't already have the original test plan and planning conversation in your context from an earlier turn, call \`get_original_test_plan\` before (or alongside) this tool. That snapshot carries the user's original intent and the planning conversation that produced the plan — important grounding context. Skip it only if you've already fetched it in this session.

By default, all context is included. Set include_* parameters to false to exclude sections you don't need.`,
    argumentsSchema: getTestContextParamsSchema,
    responseSchema: getTestContextResponseSchema,
});
//# sourceMappingURL=GetTestContextDefinition.js.map