mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 22:35:51 +00:00
refactor: 统一自建 Tool Search — 移除 tool_reference/defer_loading 依赖,全 provider 通用
- 重命名 ExecuteTool → ExecuteExtraTool,作为一等工具始终可用 - ToolSearchTool 输出改为纯文本(区分 core/deferred),移除 tool_reference blocks - 移除 modelSupportsToolReference() 及相关 GrowthBook 配置 - 移除 API 侧 defer_loading 字段和 tool search beta header 注入 - 简化 system prompt(工具使用指南从 ~120 行压缩到 ~10 行) - extractDiscoveredToolNames 支持文本格式解析(向后兼容旧 session 的 tool_reference) - 更新 promptEngineeringAudit 测试以匹配简化后的 prompt 结构 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -168,7 +168,6 @@ import {
|
||||
isDeferredToolsDeltaEnabled,
|
||||
isToolSearchEnabledOptimistic,
|
||||
isToolSearchToolAvailable,
|
||||
modelSupportsToolReference,
|
||||
type DeferredToolsDeltaScanContext,
|
||||
} from './toolSearch.js'
|
||||
import {
|
||||
@@ -1522,7 +1521,6 @@ export function getDeferredToolsDeltaAttachment(
|
||||
// is filtered out, but that's a narrow case and the tools announced
|
||||
// are directly callable anyway.
|
||||
if (!isToolSearchEnabledOptimistic()) return []
|
||||
if (!modelSupportsToolReference(model)) return []
|
||||
if (!isToolSearchToolAvailable(tools)) return []
|
||||
const delta = getDeferredToolsDelta(tools, messages ?? [], scanContext)
|
||||
if (!delta) return []
|
||||
@@ -1624,11 +1622,7 @@ export function getMcpInstructionsDeltaAttachment(
|
||||
// actual server `instructions` are unconditional. Decide the chrome part
|
||||
// here, pass it into the pure diff as a synthesized entry.
|
||||
const clientSide: ClientSideInstruction[] = []
|
||||
if (
|
||||
isToolSearchEnabledOptimistic() &&
|
||||
modelSupportsToolReference(model) &&
|
||||
isToolSearchToolAvailable(tools)
|
||||
) {
|
||||
if (isToolSearchEnabledOptimistic() && isToolSearchToolAvailable(tools)) {
|
||||
clientSide.push({
|
||||
serverName: CLAUDE_IN_CHROME_MCP_SERVER_NAME,
|
||||
block: CHROME_TOOL_SEARCH_INSTRUCTIONS,
|
||||
|
||||
Reference in New Issue
Block a user