diff --git a/README.md b/README.md index fe87caa..7cb4e85 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ | | 功能 | 说明 | |:---:|:---|:---| | 🤖 | **ReAct Agent Loop** | 始终开启的唯一对话模式。Thought → Action → Observation → Reflection 完整循环,最大 85 轮(可配置),自动重试 2 次,工具去重,并行/链式执行 | -| 🔧 | **39 个内置工具** | 文件系统 · 命令执行 · 联网搜索 · 浏览器控制 · Git · 记忆 · 技能 · 会话 · 子代理 | +| 🔧 | **38 个内置工具** | 文件系统(16个) · 命令执行 · 联网搜索 · 浏览器控制(9个) · Git · 记忆 · 会话 · 子代理 | | 🧠 | **智能记忆系统** | 三类记忆(fact / preference / rule),FTS5 全文搜索 + 向量语义搜索,写入前安全扫描,容量 500 条,90 天衰减 | | 📋 | **自定义文件** | SOUL.md(人格,不可压缩)+ AGENT.md(行为准则)+ USER.md(用户画像),工作空间优先,内置默认 fallback | | 🎯 | **技能自动生成 v1.1** | 工具调用链自动提取 → 语义匹配 → 参数自优化 → 未使用衰减 → 技能链合并,越用越精准 | diff --git a/src/main/ipc.ts b/src/main/ipc.ts index 324342c..fd466cf 100644 --- a/src/main/ipc.ts +++ b/src/main/ipc.ts @@ -37,7 +37,6 @@ import { handleCopyFile, handleWebFetch, handleWebSearch, - handleAppendFile, handleEditFile, handleGetFileInfo, handleTree, @@ -67,7 +66,6 @@ function summarizeResult(toolName: string, result: Record): str case 'copy_file': return `${result.source} → ${result.destination}`; case 'web_fetch': return `${result.status} | ${result.length} chars`; case 'web_search': return `"${result.query}" → ${result.total} 条结果`; - case 'append_file': return `${result.path} (${result.newSize}B)`; case 'edit_file': return `${result.path} (${result.replaceCount} 处替换)`; case 'get_file_info': return `${result.name} (${result.type}, ${result.size}B)`; case 'tree': return `${result.path} (${result.fileCount} 文件 / ${result.dirCount} 目录)`; @@ -180,8 +178,7 @@ export async function setupIPC(): Promise { case 'copy_file': result = await handleCopyFile(args as { source: string; destination: string; recursive?: boolean }); break; case 'web_fetch': result = await handleWebFetch(args as { url: string; max_chars?: number; extract_mode?: string }); break; case 'web_search': result = await handleWebSearch(args as { query: string; max_results?: number }); break; - case 'append_file': result = await handleAppendFile(args as { path: string; content: string; newline?: boolean }); break; - case 'edit_file': result = await handleEditFile(args as { path: string; old_text: string; new_text: string; all?: boolean }); break; + case 'edit_file': result = await handleEditFile(args as { path: string; old_text: string; new_text: string; all?: boolean; use_regex?: boolean }); break; case 'get_file_info': result = await handleGetFileInfo(args as { path: string }); break; case 'tree': result = await handleTree(args as { path: string; max_depth?: number; include_hidden?: boolean }); break; case 'download_file': result = await handleDownloadFile(args as { url: string; destination: string }); break; diff --git a/src/main/tool-handlers-fs.ts b/src/main/tool-handlers-fs.ts index e1206dd..09c3a53 100644 --- a/src/main/tool-handlers-fs.ts +++ b/src/main/tool-handlers-fs.ts @@ -450,27 +450,6 @@ export async function handleDeleteFile(params: { path: string; recursive?: boole } } -/** 当前工具命令进程(用于用户手动终止) */ - -export async function handleAppendFile(params: { path: string; content: string; newline?: boolean }): Promise { - try { - const filePath = resolvePath(params.path); - const allowed = checkPathAllowed(filePath, 'write'); - if (!allowed.ok) return { success: false, error: allowed.reason }; - - const prefix = params.newline !== false ? '\n' : ''; - sendLog('info', `➕ append_file`, `${filePath} (${params.content.length} chars)`); - await fs.appendFile(filePath, prefix + params.content, 'utf-8'); - - const stat = await fs.stat(filePath); - sendLog('success', `➕ append_file 完成`, `${stat.size}B`); - return { success: true, path: filePath, newSize: stat.size }; - } catch (err) { - sendLog('error', `➕ append_file 失败`, (err as Error).message); - return { success: false, error: (err as Error).message }; - } -} - export async function handleEditFile(params: { path: string; old_text: string; new_text: string; all?: boolean; use_regex?: boolean }): Promise { try { const filePath = resolvePath(params.path); diff --git a/src/renderer/components/chat-area.ts b/src/renderer/components/chat-area.ts index 44f8685..516380e 100644 --- a/src/renderer/components/chat-area.ts +++ b/src/renderer/components/chat-area.ts @@ -235,7 +235,7 @@ function renderToolCallCard(tc: ToolCallRecord): string { const icons: Record = { read_file: '📄', write_file: '✏️', list_directory: '📁', search_files: '🔍', create_directory: '📂', delete_file: '🗑️', run_command: '💻', - move_file: '📦', copy_file: '📋', web_fetch: '🌐', append_file: '➕', + move_file: '📦', copy_file: '📋', web_fetch: '🌐', edit_file: '✂️', get_file_info: 'ℹ️', tree: '🌳', download_file: '⬇️', diff_files: '🔀', replace_in_files: '🔄', read_multiple_files: '📚', git: '🔖', compress: '🗜️', web_search: '🔍', @@ -246,7 +246,7 @@ function renderToolCallCard(tc: ToolCallRecord): string { const names: Record = { read_file: '读取文件', write_file: '写入文件', list_directory: '列出目录', search_files: '搜索文件', create_directory: '创建目录', delete_file: '删除文件', run_command: '执行命令', - move_file: '移动文件', copy_file: '复制文件', web_fetch: '网页抓取', append_file: '追加文件', + move_file: '移动文件', copy_file: '复制文件', web_fetch: '网页抓取', edit_file: '编辑文件', get_file_info: '文件信息', tree: '目录树', download_file: '下载文件', diff_files: '文件对比', replace_in_files: '批量替换', read_multiple_files: '批量读取', git: 'Git 操作', compress: '压缩/解压', web_search: '联网搜索', diff --git a/src/renderer/components/workspace-panel.ts b/src/renderer/components/workspace-panel.ts index aac6bf7..dc0b014 100644 --- a/src/renderer/components/workspace-panel.ts +++ b/src/renderer/components/workspace-panel.ts @@ -834,7 +834,7 @@ function renderToolCalls(): void {
AI 对话中自动调用工具,结果在此展示
-
共 39 个内置工具 · MCP 动态扩展
+
共 38 个内置工具 · MCP 动态扩展
`; return; @@ -859,7 +859,7 @@ function getToolDisplayName(name: string): string { const names: Record = { read_file: '读取文件', write_file: '写入文件', list_directory: '列出目录', search_files: '搜索文件', create_directory: '创建目录', delete_file: '删除文件', run_command: '执行命令', - move_file: '移动文件', copy_file: '复制文件', web_fetch: '网页抓取', append_file: '追加文件', + move_file: '移动文件', copy_file: '复制文件', web_fetch: '网页抓取', edit_file: '编辑文件', get_file_info: '文件信息', tree: '目录树', download_file: '下载文件', diff_files: '文件对比', replace_in_files: '批量替换', read_multiple_files: '批量读取', git: 'Git 操作', compress: '压缩/解压', web_search: '联网搜索', @@ -876,7 +876,7 @@ function getToolIcon(name: string): string { const icons: Record = { read_file: '📄', write_file: '✏️', list_directory: '📁', search_files: '🔍', create_directory: '📂', delete_file: '🗑️', run_command: '💻', - move_file: '📦', copy_file: '📋', web_fetch: '🌐', append_file: '➕', + move_file: '📦', copy_file: '📋', web_fetch: '🌐', edit_file: '✂️', get_file_info: 'ℹ️', tree: '🌳', download_file: '⬇️', diff_files: '🔀', replace_in_files: '🔄', read_multiple_files: '📚', git: '🔖', compress: '🗜️', web_search: '🔍', diff --git a/src/renderer/index.html b/src/renderer/index.html index 6f4347f..7c902c3 100644 --- a/src/renderer/index.html +++ b/src/renderer/index.html @@ -415,7 +415,7 @@