mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-17 22:05:50 +00:00
feat: 将 Agents/Teams 工具纳入 Tool Search 按需发现
将 TeamCreate、TeamDelete、SendMessage 从 CORE_TOOLS 移除, 使其成为 deferred 工具,通过 ToolSearch 按需发现以减少 context token。 swarm 模式下 SendMessage 保持 always loaded,TeamCreate/TeamDelete 在 swarm 未启用时调用返回启用提示。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -52,8 +52,8 @@ function makeTool(overrides: Partial<MockTool> = {}): MockTool {
|
||||
|
||||
describe('CORE_TOOLS', () => {
|
||||
test('contains expected number of tools', () => {
|
||||
// 7 SHELL_TOOL_NAMES + 22 independent tool names
|
||||
expect(CORE_TOOLS.size).toBeGreaterThanOrEqual(29)
|
||||
// 7 SHELL_TOOL_NAMES + 19 independent tool names
|
||||
expect(CORE_TOOLS.size).toBeGreaterThanOrEqual(26)
|
||||
})
|
||||
|
||||
test('contains key core tool names', () => {
|
||||
@@ -72,8 +72,6 @@ describe('CORE_TOOLS', () => {
|
||||
'Sleep',
|
||||
'LSP',
|
||||
'Skill',
|
||||
'TeamCreate',
|
||||
'TeamDelete',
|
||||
'TaskCreate',
|
||||
'TaskGet',
|
||||
'TaskUpdate',
|
||||
@@ -124,6 +122,15 @@ describe('isDeferredTool', () => {
|
||||
expect(isDeferredTool(tool as never)).toBe(true)
|
||||
})
|
||||
|
||||
test('returns true for agent/team tools (TeamCreate, TeamDelete, SendMessage)', () => {
|
||||
for (const name of ['TeamCreate', 'TeamDelete', 'SendMessage']) {
|
||||
const tool = makeTool({ name })
|
||||
expect(isDeferredTool(tool as never), `${name} should be deferred`).toBe(
|
||||
true,
|
||||
)
|
||||
}
|
||||
})
|
||||
|
||||
test('returns true for MCP tools', () => {
|
||||
const tool = makeTool({ name: 'mcp__server__action', isMcp: true })
|
||||
expect(isDeferredTool(tool as never)).toBe(true)
|
||||
|
||||
@@ -135,10 +135,6 @@ export const CORE_TOOLS = new Set([
|
||||
// Agent & interaction
|
||||
AGENT_TOOL_NAME, // 'Agent'
|
||||
ASK_USER_QUESTION_TOOL_NAME, // 'AskUserQuestion'
|
||||
SEND_MESSAGE_TOOL_NAME, // 'SendMessage'
|
||||
// Team (swarm)
|
||||
TEAM_CREATE_TOOL_NAME, // 'TeamCreate'
|
||||
TEAM_DELETE_TOOL_NAME, // 'TeamDelete'
|
||||
// Task management
|
||||
TASK_OUTPUT_TOOL_NAME, // 'TaskOutput'
|
||||
TASK_STOP_TOOL_NAME, // 'TaskStop'
|
||||
|
||||
@@ -247,9 +247,8 @@ export function getAllBaseTools(): Tools {
|
||||
...(isWorktreeModeEnabled() ? [EnterWorktreeTool, ExitWorktreeTool] : []),
|
||||
getSendMessageTool(),
|
||||
...(ListPeersTool ? [ListPeersTool] : []),
|
||||
...(isAgentSwarmsEnabled()
|
||||
? [getTeamCreateTool(), getTeamDeleteTool()]
|
||||
: []),
|
||||
getTeamCreateTool(),
|
||||
getTeamDeleteTool(),
|
||||
...(VerifyPlanExecutionTool ? [VerifyPlanExecutionTool] : []),
|
||||
...(process.env.USER_TYPE === 'ant' && REPLTool ? [REPLTool] : []),
|
||||
...(WorkflowTool ? [WorkflowTool] : []),
|
||||
|
||||
Reference in New Issue
Block a user