Fix 2 - 类型安全: - (window as any).metonaDesktop → window.metonaDesktop - any[] → Record<string, unknown>[] - 回调 :any → ChatSession | null - 78 处 → 38 处(减少 51%) Fix 3 - 架构拆分: - tool-handlers.ts (1308行) → 4 个模块: - tool-handlers-shared.ts: 共享工具函数 - tool-handlers-fs.ts: 15 个文件系统操作 - tool-handlers-system.ts: 6 个系统网络操作 - tool-handlers-git.ts: 1 个 Git 操作 Fix 4 - 记忆数据治理: - 90 天未使用自动降低 importance - 清理评分新增 agePenalty - 向量错误日志增强(记忆ID、内容摘要、模型、栈) - 去重增强(前缀匹配)
40 lines
892 B
TypeScript
40 lines
892 B
TypeScript
/**
|
|
* Tool Handlers - 主进程工具执行器入口
|
|
* 按类别拆分:文件系统 / 系统网络 / Git
|
|
* 所有导出保持不变,ipc.ts 无需修改
|
|
*/
|
|
|
|
export { sendLog, resolvePath, type ToolResult } from './tool-handlers-shared.js';
|
|
|
|
// 文件系统操作(15 个)
|
|
export {
|
|
handleReadFile,
|
|
handleWriteFile,
|
|
handleListDir,
|
|
handleSearchFiles,
|
|
handleCreateDir,
|
|
handleDeleteFile,
|
|
handleMoveFile,
|
|
handleCopyFile,
|
|
handleAppendFile,
|
|
handleEditFile,
|
|
handleGetFileInfo,
|
|
handleTree,
|
|
handleDiffFiles,
|
|
handleReplaceInFiles,
|
|
handleReadMultipleFiles,
|
|
} from './tool-handlers-fs.js';
|
|
|
|
// 系统与网络操作(6 个)
|
|
export {
|
|
handleRunCommand,
|
|
killToolProcess,
|
|
handleWebFetch,
|
|
handleWebSearch,
|
|
handleDownloadFile,
|
|
handleCompress,
|
|
} from './tool-handlers-system.js';
|
|
|
|
// Git 操作(1 个)
|
|
export { handleGit } from './tool-handlers-git.js';
|