eve
Version:
Filesystem-first framework for durable backend AI agents that run anywhere.
2 lines • 1.48 kB
JavaScript
import{z}from"#compiled/zod/index.js";import{defineTool}from"#tools/definition.js";import{toolLabel}from"#tools/tool-label.js";import{executeWriteFileOnSandbox}from"#execution/sandbox/write-file.js";const WRITE_FILE_INPUT_SCHEMA=z.strictObject({content:z.string().describe(`Complete replacement file contents.`),filePath:z.string().describe(`The absolute path to the file to write. A leading $HOME is supported.`)}),WRITE_FILE_OUTPUT_SCHEMA=z.strictObject({existed:z.boolean(),path:z.string()}),writeFile=defineTool({label:{start:e=>toolLabel(`Write`,e.filePath)},description:[`Writes a file to the local filesystem.`,``,`Usage:`,`- This tool will overwrite the existing file if there is one at the provided path.`,`- If this is an existing file, you MUST use the read_file tool first to read the file's contents. This tool will fail if you did not read the file first.`,`- ALWAYS prefer editing existing files in the codebase. NEVER write new files unless explicitly required.`,`- NEVER proactively create documentation files (*.md) or README files. Only create documentation files if explicitly requested by the User.`,`- Only use emojis if the user explicitly requests it. Avoid writing emojis to files unless asked.`].join(`
`),async execute(e,t){return await executeWriteFileOnSandbox(await t.getSandbox(),e)},inputSchema:WRITE_FILE_INPUT_SCHEMA,outputSchema:WRITE_FILE_OUTPUT_SCHEMA});export{WRITE_FILE_INPUT_SCHEMA,WRITE_FILE_OUTPUT_SCHEMA,writeFile as default,writeFile};