mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 14:25:51 +00:00
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:
@@ -3909,7 +3909,24 @@ Read the team config to discover your teammates' names. Check the task list peri
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- teammate_mailbox/team_context/skill_discovery/bagel_console handled above
|
||||
// tool_discovery handled here (not in the switch) so the 'tool_discovery'
|
||||
// string literal lives inside a feature()-guarded block.
|
||||
if (feature('EXPERIMENTAL_TOOL_SEARCH')) {
|
||||
if (attachment.type === 'tool_discovery') {
|
||||
if (attachment.tools.length === 0) return []
|
||||
const lines = attachment.tools.map(
|
||||
t => `- ${t.name}: ${t.description.slice(0, 100)}`,
|
||||
)
|
||||
return wrapMessagesInSystemReminder([
|
||||
createUserMessage({
|
||||
content: `The following tools were discovered as relevant to your task. Use ExecuteTool to invoke any of them by name:\n\n${lines.join('\n')}`,
|
||||
isMeta: true,
|
||||
}),
|
||||
])
|
||||
}
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- teammate_mailbox/team_context/skill_discovery/tool_discovery/bagel_console handled above
|
||||
switch (attachment.type) {
|
||||
case 'directory': {
|
||||
return wrapMessagesInSystemReminder([
|
||||
|
||||
Reference in New Issue
Block a user