import z from 'zod';
const parameters = z.object({
    path: z.string().describe('The path to the file to write.'),
    content: z.string().describe('The content to write to the file.'),
});
export const writeFileTool = {
    name: 'sys:write_file',
    description: 'Write content to a file at the specified path',
    parameters,
    needsApproval: true,
    async execute(rawArgs) {
        if (!window.filesystem?.writeFile) {
            throw new Error('filesystem bridge is not available');
        }
        const args = parameters.parse(rawArgs);
        await window.filesystem.writeFile(args.path, args.content);
        return `File written successfully to ${args.path}`;
    },
};
