feat: 实现 Tool Search 基础设施层(CORE_TOOLS 白名单 + TF-IDF 索引 + ExecuteTool + 搜索增强)

- 新增 CORE_TOOLS 白名单常量(31 个核心工具),重构 isDeferredTool 为白名单制判定
- 新建 TF-IDF 工具索引模块(toolIndex.ts),复用 localSearch.ts 算法函数
- 新建 ExecuteTool 跨 API provider 统一工具执行入口
- 增强 ToolSearchTool:TF-IDF 搜索路径、discover: 模式、并行搜索合并、文本模式回退
- 新增 27 个单元测试,precheck 零错误通过(4108 tests pass)

Co-Authored-By: glm-5.1[1m] <zai-org@claude-code-best.win>
This commit is contained in:
claude-code-best
2026-05-08 22:29:15 +08:00
parent 02dd796706
commit 7be08f53bd
34 changed files with 4040 additions and 90 deletions

View File

@@ -85,6 +85,7 @@ export const DEFAULT_BUILD_FEATURES = [
// overflow risk, but Haiku-on-first-Chinese-query and disk-side
// observation accumulation remain operator-discretion concerns.
'EXPERIMENTAL_SKILL_SEARCH', // 技能搜索bounded caches 已修复 overflow内存问题已解决
'EXPERIMENTAL_TOOL_SEARCH', // 工具搜索预取管道TF-IDF 索引 + inter-turn 异步预取)
// 'SKILL_LEARNING',
// P3: poor mode
'POOR', // 穷鬼模式,跳过 extract_memories/prompt_suggestion 减少消耗

View File

@@ -18,7 +18,8 @@ const defines = {
...getMacroDefines(),
// React production mode — prevents 6,889+ _debugStack Error objects
// (12MB) from accumulating during long-running sessions.
'process.env.NODE_ENV': JSON.stringify('development'),
// dev 模式使用 development 模式
'process.env.NODE_ENV': JSON.stringify('production'),
}
const defineArgs = Object.entries(defines).flatMap(([k, v]) => [