kurihada
|
2c8a95daeb
|
refactor(core): 实现类型安全的工具定义系统
- 新增 defineTool 函数,使用 Zod schema 定义参数并自动推断 TypeScript 类型
- 重构文件系统工具 (read_file, write_file, edit_file, glob, grep, multi_edit) 使用 Zod 类型推断
- 重构 shell 工具 (bash, kill_shell) 使用新的类型安全系统
- 重构 task 工具 (task, task_output) 使用 Zod 验证
- 兼容 Zod v4 API (处理 _zod.def vs _def, error.issues vs error.errors)
- 导出参数类型供外部使用 (ReadFileParams, BashParams 等)
- 统一参数命名: path -> file_path
- 修复相关测试以适配新的参数结构和输出格式
- 移除不存在工具的测试文件
|
2025-12-18 15:46:11 +08:00 |
|
kurihada
|
31e246f629
|
refactor(core): 移除 get_file_info 和 list_directory 工具
这些工具功能可通过 bash 命令 (ls, stat, file) 实现,不再需要单独的工具。
删除的文件:
- src/tools/filesystem/get_file_info.ts
- src/tools/filesystem/list_directory.ts
- src/tools/descriptions/filesystem/get_file_info.txt
- src/tools/descriptions/filesystem/list_directory.txt
- tests/unit/tools/filesystem/get_file_info.test.ts
- tests/unit/tools/filesystem/list_directory.test.ts
更新的文件:
- src/tools/index.ts: 移除导入和注册
- src/tools/filesystem/index.ts: 移除导出
- src/tools/load_description.ts: 移除映射
- src/agent/presets/*.ts: 移除 tools.enabled 引用
- tests/unit/tools/load_description.test.ts: 移除测试数据
|
2025-12-17 12:07:38 +08:00 |
|