/** * ============================================================ * src/tools/shared/schemas.ts —— 工具 Zod 输入 schema 公共片段 * ------------------------------------------------------------ * 抽出 Read / Write / Edit / MultiEdit 共享的 file_path 字段, * 统一 min length 校验与 describe 文案。 * 动作动词通过参数注入(读取 / 写入 / 编辑)。 * ============================================================ */ import { z } from 'zod'; export type FilePathAction = '读取' | '写入' | '编辑'; export function filePathField(action: FilePathAction) { return z .string() .min(1, '必须提供 file_path') .describe(`要${action}的文件路径(绝对路径优先,相对路径基于 working dir 解析)`); }