mirror of
https://github.com/claude-code-best/claude-code.git
synced 2026-06-18 06:15:51 +00:00
* feat: 第一版大重构 * fix: 修复类型问题 * chore: 更新版本到 1.3.2 * Add brave as alternative WebSearchTool * fix: 修正顺序 * fix: 修复对穷鬼模式的 auto dream 和 session memory 越过 * feat: 穷鬼模式去除 session-summary * feat: 创建 builtin-tools 包,搬运所有工具实现 将 src/tools/ 下的全部 60 个工具目录迁移至 packages/builtin-tools/src/tools/, 内部导入路径已更新为 src/ alias 模式。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: 更新 src/ 中所有工具引用至 builtin-tools 包,删除 src/tools/ - src/tools.ts 及 178 个 src/ 文件的 import 路径从 ./tools/ 改为 builtin-tools/tools/ - 删除 src/tools/ 整个目录(已迁移至 packages/builtin-tools/) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: 添加 builtin-tools 路径别名至 tsconfig,更新 bun.lock - tsconfig.json 新增 builtin-tools/* 和 builtin-tools 路径映射 - 新增 packages/builtin-tools/src 至 include Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * refactor: 为 builtin-tools、mcp-client、agent-tools 添加 @claude-code-best 作用域前缀 所有包名及 import 路径统一添加 @claude-code-best/ 前缀: - builtin-tools → @claude-code-best/builtin-tools - mcp-client → @claude-code-best/mcp-client - agent-tools → @claude-code-best/agent-tools Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix: 修复 node 环境没有 bun 的问题 --------- Co-authored-by: Eric-Guo <eric.guocz@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
111 lines
5.3 KiB
TypeScript
111 lines
5.3 KiB
TypeScript
// biome-ignore-all assist/source/organizeImports: ANT-ONLY import markers must not be reordered
|
|
import { feature } from 'bun:bundle'
|
|
import { TASK_OUTPUT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskOutputTool/constants.js'
|
|
import { EXIT_PLAN_MODE_V2_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/ExitPlanModeTool/constants.js'
|
|
import { ENTER_PLAN_MODE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/EnterPlanModeTool/constants.js'
|
|
import { AGENT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/AgentTool/constants.js'
|
|
import { ASK_USER_QUESTION_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/AskUserQuestionTool/prompt.js'
|
|
import { TASK_STOP_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskStopTool/prompt.js'
|
|
import { FILE_READ_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileReadTool/prompt.js'
|
|
import { WEB_SEARCH_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/WebSearchTool/prompt.js'
|
|
import { TODO_WRITE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TodoWriteTool/constants.js'
|
|
import { GREP_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/GrepTool/prompt.js'
|
|
import { WEB_FETCH_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/WebFetchTool/prompt.js'
|
|
import { GLOB_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/GlobTool/prompt.js'
|
|
import { SHELL_TOOL_NAMES } from '../utils/shell/shellToolUtils.js'
|
|
import { FILE_EDIT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileEditTool/constants.js'
|
|
import { FILE_WRITE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/FileWriteTool/prompt.js'
|
|
import { NOTEBOOK_EDIT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/NotebookEditTool/constants.js'
|
|
import { SKILL_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SkillTool/constants.js'
|
|
import { SEND_MESSAGE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SendMessageTool/constants.js'
|
|
import { TASK_CREATE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskCreateTool/constants.js'
|
|
import { TASK_GET_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskGetTool/constants.js'
|
|
import { TASK_LIST_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskListTool/constants.js'
|
|
import { TASK_UPDATE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/TaskUpdateTool/constants.js'
|
|
import { TOOL_SEARCH_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/ToolSearchTool/prompt.js'
|
|
import { SYNTHETIC_OUTPUT_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/SyntheticOutputTool/SyntheticOutputTool.js'
|
|
import { ENTER_WORKTREE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/EnterWorktreeTool/constants.js'
|
|
import { EXIT_WORKTREE_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/ExitWorktreeTool/constants.js'
|
|
import { WORKFLOW_TOOL_NAME } from '@claude-code-best/builtin-tools/tools/WorkflowTool/constants.js'
|
|
import {
|
|
CRON_CREATE_TOOL_NAME,
|
|
CRON_DELETE_TOOL_NAME,
|
|
CRON_LIST_TOOL_NAME,
|
|
} from '@claude-code-best/builtin-tools/tools/ScheduleCronTool/prompt.js'
|
|
|
|
export const ALL_AGENT_DISALLOWED_TOOLS = new Set([
|
|
TASK_OUTPUT_TOOL_NAME,
|
|
EXIT_PLAN_MODE_V2_TOOL_NAME,
|
|
ENTER_PLAN_MODE_TOOL_NAME,
|
|
// Allow Agent tool for agents when user is ant (enables nested agents)
|
|
...(process.env.USER_TYPE === 'ant' ? [] : [AGENT_TOOL_NAME]),
|
|
ASK_USER_QUESTION_TOOL_NAME,
|
|
TASK_STOP_TOOL_NAME,
|
|
// Prevent recursive workflow execution inside subagents.
|
|
...(feature('WORKFLOW_SCRIPTS') ? [WORKFLOW_TOOL_NAME] : []),
|
|
])
|
|
|
|
export const CUSTOM_AGENT_DISALLOWED_TOOLS = new Set([
|
|
...ALL_AGENT_DISALLOWED_TOOLS,
|
|
])
|
|
|
|
/*
|
|
* Async Agent Tool Availability Status (Source of Truth)
|
|
*/
|
|
export const ASYNC_AGENT_ALLOWED_TOOLS = new Set([
|
|
FILE_READ_TOOL_NAME,
|
|
WEB_SEARCH_TOOL_NAME,
|
|
TODO_WRITE_TOOL_NAME,
|
|
GREP_TOOL_NAME,
|
|
WEB_FETCH_TOOL_NAME,
|
|
GLOB_TOOL_NAME,
|
|
...SHELL_TOOL_NAMES,
|
|
FILE_EDIT_TOOL_NAME,
|
|
FILE_WRITE_TOOL_NAME,
|
|
NOTEBOOK_EDIT_TOOL_NAME,
|
|
SKILL_TOOL_NAME,
|
|
SYNTHETIC_OUTPUT_TOOL_NAME,
|
|
TOOL_SEARCH_TOOL_NAME,
|
|
ENTER_WORKTREE_TOOL_NAME,
|
|
EXIT_WORKTREE_TOOL_NAME,
|
|
])
|
|
/**
|
|
* Tools allowed only for in-process teammates (not general async agents).
|
|
* These are injected by inProcessRunner.ts and allowed through filterToolsForAgent
|
|
* via isInProcessTeammate() check.
|
|
*/
|
|
export const IN_PROCESS_TEAMMATE_ALLOWED_TOOLS = new Set([
|
|
TASK_CREATE_TOOL_NAME,
|
|
TASK_GET_TOOL_NAME,
|
|
TASK_LIST_TOOL_NAME,
|
|
TASK_UPDATE_TOOL_NAME,
|
|
SEND_MESSAGE_TOOL_NAME,
|
|
// Teammate-created crons are tagged with the creating agentId and routed to
|
|
// that teammate's pendingUserMessages queue (see useScheduledTasks.ts).
|
|
CRON_CREATE_TOOL_NAME, CRON_DELETE_TOOL_NAME, CRON_LIST_TOOL_NAME,
|
|
])
|
|
|
|
/*
|
|
* BLOCKED FOR ASYNC AGENTS:
|
|
* - AgentTool: Blocked to prevent recursion
|
|
* - TaskOutputTool: Blocked to prevent recursion
|
|
* - ExitPlanModeTool: Plan mode is a main thread abstraction.
|
|
* - TaskStopTool: Requires access to main thread task state.
|
|
* - TungstenTool: Uses singleton virtual terminal abstraction that conflicts between agents.
|
|
*
|
|
* ENABLE LATER (NEED WORK):
|
|
* - MCPTool: TBD
|
|
* - ListMcpResourcesTool: TBD
|
|
* - ReadMcpResourceTool: TBD
|
|
*/
|
|
|
|
/**
|
|
* Tools allowed in coordinator mode - only output and agent management tools for the coordinator
|
|
*/
|
|
export const COORDINATOR_MODE_ALLOWED_TOOLS = new Set([
|
|
AGENT_TOOL_NAME,
|
|
TASK_STOP_TOOL_NAME,
|
|
SEND_MESSAGE_TOOL_NAME,
|
|
SYNTHETIC_OUTPUT_TOOL_NAME,
|
|
])
|