import { z } from 'zod';
import { defineTool, } from '../toolDefinition.js';
import { AgentToolNames } from './agentToolNames.js';
const writeFileArgumentsSchema = z.object({
    filename: z.string().meta({ description: 'The name of the file' }),
    mode: z.enum(['overwrite', 'append', 'patch']).meta({
        description: 'overwrite: replace entire file (or create new). append: add content to end of file. patch: replace characters between start and end indices.',
    }),
    content: z.string().meta({
        description: 'The content to write. For overwrite: the full new content. For append: text to add at the end. For patch: replacement text for the [start, end) range.',
    }),
    start: z.number().optional().meta({
        description: 'Start character index (0-indexed, inclusive). Required for patch mode.',
    }),
    end: z.number().optional().meta({
        description: 'End character index (0-indexed, exclusive). Required for patch mode.',
    }),
});
const writeFileResponseSchema = z.object({
    filename: z.string(),
    size_chars: z.number(),
    diff: z.string(),
});
export const WriteFileToolDefinition = defineTool({
    name: AgentToolNames.WriteFile,
    description: 'Write to a file. Supports three modes: overwrite (create or replace entire file), append (add to end), and patch (replace a character range). Returns a diff showing what changed.',
    argumentsSchema: writeFileArgumentsSchema,
    responseSchema: writeFileResponseSchema,
});
//# sourceMappingURL=WriteFileDefinition.js.map