From d7e0d7ac5556c907f95b604eeb6f7a8883b224d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BB=9D=E5=B0=98?= <237809796@qq.com> Date: Thu, 25 Jun 2026 01:21:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20AI=20=E5=B7=A5=E5=85=B7?= =?UTF-8?q?=E5=9F=BA=E7=BA=BF=E8=A1=A5=20read=5Fsymbol(31=E2=86=9232)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit baseline_tool_count 断言 file 层 12→13(7c2e3b2 read_symbol 符号解析注册未更新基线测试)。cargo test --lib 308 全绿。 --- src-tauri/src/commands/ai/tool_registry.rs | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src-tauri/src/commands/ai/tool_registry.rs b/src-tauri/src/commands/ai/tool_registry.rs index 6ba22e7..cba334a 100644 --- a/src-tauri/src/commands/ai/tool_registry.rs +++ b/src-tauri/src/commands/ai/tool_registry.rs @@ -2492,7 +2492,7 @@ mod tests { // 任一层漏移 register 调用,此测试立即红。工具名集合也断言,防 rename 致 LLM tool 突变。 // ============================================================ - /// build_ai_tool_registry 应注册恰好 31 个工具(18 data + 12 file + 1 http),且工具名集合稳定。 + /// build_ai_tool_registry 应注册恰好 32 个工具(18 data + 13 file + 1 http),且工具名集合稳定。 /// /// 用 in-memory SQLite(Database::open_in_memory 自跑迁移),构造零外部依赖的 db, // 不实际执行任何 handler——仅断言注册阶段的定义完整性,故无需真实数据。 @@ -2505,18 +2505,19 @@ mod tests { let allowed_dirs = Arc::new(RwLock::new(AllowedDirs::default_with_root())); let registry = build_ai_tool_registry(&db, &allowed_dirs); - // 总量基线:31(18 data + 12 file + 1 http)。拆分前后必须一致。 + // 总量基线:32(18 data + 13 file + 1 http)。拆分前后必须一致。 // F-260621: file 层 10→11(新增 grep 跨文件内容搜索工具)。 // L1 环境感知(设计 §2.1): file 层 11→12(新增 detect_environment 环境探测工具)。 + // AST 代码智能(7c2e3b2): file 层 12→13(新增 read_symbol 符号解析,治 read_file 全文回灌 prompt 爆)。 assert_eq!( registry.len(), - 31, - "工具总数应为 31(18 data + 12 file + 1 http),实际 {}", registry.len() + 32, + "工具总数应为 32(18 data + 13 file + 1 http),实际 {}", registry.len() ); // 工具名集合基线:防 rename / 漏注册 / 误删除。 // data 层 18 个(持 db):CRUD/状态机/工作流 - // file 层 12 个(不持 db):命令/读/列/写/改/元/追加/删/移/搜/grep/环境探测 + // file 层 13 个(不持 db):命令/读/列/写/改/元/追加/删/移/搜/grep/环境探测/符号解析 // http 层 1 个(不持 db):http_request let mut expected: Vec<&str> = vec![ // ── data 层 (18) ── @@ -2526,10 +2527,10 @@ mod tests { "run_workflow", "delete_task", "create_idea", "delete_project", "restore_project", "purge_project", "list_trash", "get_project_count", "get_task_count", - // ── file 层 (12) ──(run_command 注册顺序已移至末位降低 LLM 偏好, + // ── file 层 (13) ──(run_command 注册顺序已移至末位降低 LLM 偏好, // 集合断言经 sort 后与顺序无关,仅守护工具名不漂移。grep 新增 F-260621; - // detect_environment 新增 L1 环境感知 设计 §2.1) - "read_file", "list_directory", "write_file", + // detect_environment 新增 L1 环境感知 设计 §2.1;read_symbol 新增 AST 代码智能) + "read_file", "read_symbol", "list_directory", "write_file", "patch_file", "file_info", "append_file", "delete_file", "rename_file", "search_files", "run_command", "grep", "detect_environment",