From 7eaeaad2a19c312dd55128d625359b6faf8302bb Mon Sep 17 00:00:00 2001 From: "LAPTOP-TOBATCU4\\mefly" Date: Thu, 23 Apr 2026 17:43:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=20setting=20=E4=B8=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E4=BA=86=E5=B7=A5=E5=85=B7=E5=88=97=E8=A1=A8=EF=BC=8C?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E5=87=BA=E6=89=80=E6=9C=89=E5=8F=AF=E7=94=A8?= =?UTF-8?q?=E7=9A=84=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/src/i18n/locales/en.ts | 5 ++ desktop/src/i18n/locales/zh.ts | 5 ++ desktop/src/pages/Settings.tsx | 154 +++++++++++++++++++++++++++++++++ desktop/src/stores/uiStore.ts | 2 +- 4 files changed, 165 insertions(+), 1 deletion(-) diff --git a/desktop/src/i18n/locales/en.ts b/desktop/src/i18n/locales/en.ts index 78751bd5..1f5d911e 100644 --- a/desktop/src/i18n/locales/en.ts +++ b/desktop/src/i18n/locales/en.ts @@ -248,6 +248,11 @@ export const en = { 'settings.about.updates': 'App Updates', 'settings.about.updatesDesc': 'Check GitHub Releases, download the installer, and relaunch after install.', + // Settings > Tools + 'settings.tab.tools': 'Tools', + 'settings.tools.title': 'Available Tools', + 'settings.tools.description': 'All tools available to Claude. Feature-gated tools are only active when the corresponding environment variable or feature flag is enabled.', + // Settings > Computer Use 'settings.tab.computerUse': 'Computer Use', 'settings.computerUse.title': 'Computer Use', diff --git a/desktop/src/i18n/locales/zh.ts b/desktop/src/i18n/locales/zh.ts index ce10bff0..0669323f 100644 --- a/desktop/src/i18n/locales/zh.ts +++ b/desktop/src/i18n/locales/zh.ts @@ -250,6 +250,11 @@ export const zh: Record = { 'settings.about.updates': '应用更新', 'settings.about.updatesDesc': '检查 GitHub Releases,下载安装包,并在安装后自动重启。', + // Settings > Tools + 'settings.tab.tools': '工具', + 'settings.tools.title': '可用工具', + 'settings.tools.description': '当前环境中 Claude 可以使用的所有工具。带有条件标签的工具仅在对应的环境变量或功能开关启用时才会生效。', + // Settings > Computer Use 'settings.tab.computerUse': 'Computer Use', 'settings.computerUse.title': 'Computer Use', diff --git a/desktop/src/pages/Settings.tsx b/desktop/src/pages/Settings.tsx index 972459c2..5e7618cf 100644 --- a/desktop/src/pages/Settings.tsx +++ b/desktop/src/pages/Settings.tsx @@ -46,6 +46,7 @@ export function Settings() { setActiveTab('adapters')} /> setActiveTab('agents')} /> setActiveTab('skills')} /> + setActiveTab('tools')} /> setActiveTab('computerUse')} />
@@ -61,6 +62,7 @@ export function Settings() { {activeTab === 'adapters' && } {activeTab === 'agents' && } {activeTab === 'skills' && } + {activeTab === 'tools' && } {activeTab === 'computerUse' && } {activeTab === 'about' && }
@@ -1235,6 +1237,158 @@ function DetailStat({ ) } +// ─── Tools Settings ────────────────────────────────────── + +type ToolEntry = { + name: string + icon: string + description: string + gated?: string +} + +type ToolCategory = { + id: string + icon: string + label: string + tools: ToolEntry[] +} + +const TOOL_CATEGORIES: ToolCategory[] = [ + { + id: 'file', + icon: 'folder_open', + label: '文件操作', + tools: [ + { name: 'Read', icon: 'description', description: '读取文件系统中的文件内容' }, + { name: 'Write', icon: 'edit_document', description: '创建或覆写文件' }, + { name: 'Edit', icon: 'edit', description: '对已有文件进行精准字符串替换式编辑' }, + { name: 'Glob', icon: 'filter_list', description: '通过 glob 模式匹配查找文件' }, + { name: 'Grep', icon: 'search', description: '在文件内容中用正则表达式搜索' }, + { name: 'NotebookEdit', icon: 'book', description: '编辑 Jupyter Notebook 单元格' }, + ], + }, + { + id: 'execution', + icon: 'terminal', + label: '执行', + tools: [ + { name: 'Bash', icon: 'terminal', description: '在 Shell 中执行命令' }, + { name: 'PowerShell', icon: 'terminal', description: '在 PowerShell 中执行命令', gated: 'Windows' }, + { name: 'REPL', icon: 'code', description: '启动交互式 REPL 会话(Node / Python / Ruby 等)', gated: 'ant' }, + ], + }, + { + id: 'web', + icon: 'public', + label: '网络', + tools: [ + { name: 'WebFetch', icon: 'language', description: '获取网页或 URL 的内容' }, + { name: 'WebSearch', icon: 'travel_explore', description: '通过 Anthropic web_search_20250305 API 搜索互联网' }, + ], + }, + { + id: 'agent', + icon: 'smart_toy', + label: 'Agent & 规划', + tools: [ + { name: 'Agent', icon: 'smart_toy', description: '派遣子 Agent 处理复杂子任务' }, + { name: 'Skill', icon: 'auto_awesome', description: '调用已安装的技能文档作为上下文提示' }, + { name: 'ToolSearch', icon: 'manage_search', description: '在延迟加载工具中搜索可用工具', gated: 'feature' }, + { name: 'EnterPlanMode', icon: 'architecture', description: '进入只规划不执行的规划模式' }, + { name: 'ExitPlanMode', icon: 'done_all', description: '退出规划模式并执行计划' }, + { name: 'EnterWorktree', icon: 'account_tree', description: '进入 Git Worktree 隔离环境', gated: 'feature' }, + { name: 'ExitWorktree', icon: 'logout', description: '退出 Git Worktree 环境', gated: 'feature' }, + ], + }, + { + id: 'task', + icon: 'task', + label: '任务管理', + tools: [ + { name: 'TodoWrite', icon: 'checklist', description: '管理当前会话的 Todo 列表' }, + { name: 'TaskOutput', icon: 'output', description: '获取异步任务的输出内容' }, + { name: 'TaskStop', icon: 'stop_circle', description: '停止正在运行的任务' }, + { name: 'TaskCreate', icon: 'add_task', description: '创建新的异步后台任务', gated: 'feature' }, + { name: 'TaskGet', icon: 'task_alt', description: '获取任务状态与详情', gated: 'feature' }, + { name: 'TaskUpdate', icon: 'edit_note', description: '更新任务的状态或内容', gated: 'feature' }, + { name: 'TaskList', icon: 'format_list_bulleted', description: '列出所有任务', gated: 'feature' }, + ], + }, + { + id: 'team', + icon: 'group', + label: '团队 & 调度', + tools: [ + { name: 'SendMessage', icon: 'send', description: '向其他 Agent 或频道发送消息' }, + { name: 'TeamCreate', icon: 'group_add', description: '创建并行 Agent 团队', gated: 'feature' }, + { name: 'TeamDelete', icon: 'group_remove', description: '解散 Agent 团队', gated: 'feature' }, + { name: 'CronCreate', icon: 'schedule', description: '创建定时触发器', gated: 'feature' }, + { name: 'CronUpdate', icon: 'schedule', description: '更新定时触发器', gated: 'feature' }, + { name: 'CronDelete', icon: 'schedule', description: '删除定时触发器', gated: 'feature' }, + { name: 'CronList', icon: 'schedule', description: '列出所有定时触发器', gated: 'feature' }, + { name: 'RemoteTrigger', icon: 'webhook', description: '通过远程 Webhook 触发 Agent', gated: 'feature' }, + ], + }, + { + id: 'system', + icon: 'settings', + label: '系统', + tools: [ + { name: 'AskUserQuestion', icon: 'help', description: '向用户提问以获取信息或确认' }, + { name: 'SendUserMessage', icon: 'chat_bubble', description: '向用户发送简短进度消息(Brief)' }, + { name: 'StructuredOutput', icon: 'data_object', description: '产出结构化 JSON 格式的响应' }, + { name: 'ListMcpResourcesTool', icon: 'storage', description: '列出 MCP 服务器的可用资源' }, + { name: 'ReadMcpResourceTool', icon: 'open_in_browser', description: '读取 MCP 服务器资源的内容' }, + { name: 'Sleep', icon: 'bedtime', description: '暂停执行若干毫秒', gated: 'feature' }, + { name: 'LSP', icon: 'code_blocks', description: '通过 Language Server Protocol 分析代码', gated: 'env' }, + { name: 'Config', icon: 'tune', description: '读写 Claude 配置文件', gated: 'ant' }, + ], + }, +] + +function ToolsSettings() { + const t = useTranslation() + + return ( +
+

{t('settings.tools.title')}

+

{t('settings.tools.description')}

+ +
+ {TOOL_CATEGORIES.map((category) => ( +
+
+ {category.icon} +

{category.label}

+
+
+ {category.tools.map((tool) => ( +
+ {tool.icon} +
+
+ {tool.name} + {tool.gated && ( + + {tool.gated === 'feature' ? '功能开关' : tool.gated === 'ant' ? '内部' : tool.gated === 'env' ? '环境变量' : tool.gated} + + )} +
+
{tool.description}
+
+
+ ))} +
+
+ ))} +
+
+ ) +} + // ─── Skill Settings ────────────────────────────────────── function SkillSettings() { diff --git a/desktop/src/stores/uiStore.ts b/desktop/src/stores/uiStore.ts index 27903371..402821ce 100644 --- a/desktop/src/stores/uiStore.ts +++ b/desktop/src/stores/uiStore.ts @@ -28,7 +28,7 @@ export type Toast = { duration?: number } -export type SettingsTab = 'providers' | 'permissions' | 'general' | 'adapters' | 'agents' | 'skills' | 'computerUse' | 'about' +export type SettingsTab = 'providers' | 'permissions' | 'general' | 'adapters' | 'agents' | 'skills' | 'tools' | 'computerUse' | 'about' type ActiveView = 'code' | 'scheduled' | 'terminal' | 'history' | 'settings'