## 主要变更 ### 1. 新增 delete_file 工具(26 → 27 个) - 支持:删除文件/空目录(默认)/递归删除非空目录(recursive: true) - 5 层安全防护: * isPathWithinWorkspace — 路径遍历防护 * isProtectedWorkspaceFile — MEMORY.md 拦截 * 工作空间根目录保护 — 禁止删除 workspace 本身 * 递归删除需显式开启 — 默认仅删空目录 * riskLevel: HIGH + requiresPermission — 破坏性操作必须确认 - 友好错误处理:ENOTEMPTY 时提示设置 recursive: true ### 2. 文件工具全面优化(6 个工具) - 抽取共享代码到 file-guard.ts: * safeResolvePath — 合并路径遍历 + MEMORY.md 校验 * matchGlob — 简易通配符匹配 * extractErrorMessage — 统一错误提取 * MAX_FILE_SIZE_BYTES (10MB) / FILE_TOOL_TIMEOUT_MS (15s) / MAX_LINE_LENGTH (10000) - read_file:stat 预检 + 超长行截断 + 二进制检测 + 大小上限 - write_file:原子写入(临时文件+rename)+ 内容大小上限 + append 返回 new_file_size - list_directory:1000 结果上限 + modified time + include_hidden 参数 + 提前终止优化 - search_files:regex lastIndex 修复 + context_lines + include_hidden + 大文件跳过 - file_editor:dry_run 预览模式 + 文件大小上限 ### 3. 审计修复(1 FAIL + 3 WARN) - FAIL: isBinaryFile 用 bytesRead 限制循环,修复 < 8KB 文本误判为二进制 - WARN-1: file-editor dry_run preview 分模式计算,修复 insert 范围过大 - WARN-2: write_file 允许空字符串创建空文件 - WARN-3: list_directory listDir 提前终止,避免大目录全量遍历
82 lines
2.5 KiB
JSON
82 lines
2.5 KiB
JSON
{
|
|
"name": "metona-ai-desktop",
|
|
"version": "0.3.3",
|
|
"description": "MetonaAI Desktop — 生产级通用 AI Agent 智能体桌面应用",
|
|
"main": "dist-electron/main/main.js",
|
|
"author": "Metona Team",
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"scripts": {
|
|
"dev": "electron-vite dev",
|
|
"build": "npm run prebuild && electron-vite build && electron-builder",
|
|
"prebuild": "npm dedupe && rimraf release",
|
|
"build:renderer": "electron-vite build --rendererOnly",
|
|
"build:electron": "tsc -p tsconfig.node.json",
|
|
"preview": "vite preview",
|
|
"lint": "eslint . --ext .ts,.tsx",
|
|
"lint:fix": "eslint . --ext .ts,.tsx --fix",
|
|
"format": "prettier --write \"src/**/*.{ts,tsx,css}\" \"electron/**/*.ts\"",
|
|
"typecheck": "tsc --noEmit",
|
|
"typecheck:node": "tsc -p tsconfig.node.json --noEmit",
|
|
"test": "vitest run",
|
|
"test:watch": "vitest",
|
|
"test:e2e": "playwright test"
|
|
},
|
|
"dependencies": {
|
|
"@emotion/react": "^11.14.0",
|
|
"@emotion/styled": "^11.14.1",
|
|
"@modelcontextprotocol/sdk": "^1.12.1",
|
|
"@mui/icons-material": "^9.1.1",
|
|
"@mui/material": "^9.1.2",
|
|
"@types/shell-quote": "^1.7.5",
|
|
"better-sqlite3": "^11.9.1",
|
|
"date-fns": "^4.1.0",
|
|
"electron-log": "^5.3.3",
|
|
"electron-store": "^10.0.1",
|
|
"fuse.js": "^7.1.0",
|
|
"lru-cache": "^11.1.0",
|
|
"metona-toast": "^2.0.0",
|
|
"nanoid": "^5.1.5",
|
|
"react": "^19.1.0",
|
|
"react-dom": "^19.1.0",
|
|
"react-markdown": "^10.1.0",
|
|
"rehype-highlight": "^7.0.2",
|
|
"rehype-raw": "^7.0.0",
|
|
"remark-gfm": "^4.0.1",
|
|
"shell-quote": "^1.10.0",
|
|
"sql.js": "^1.12.0",
|
|
"zod": "^3.25.67",
|
|
"zustand": "^5.0.5"
|
|
},
|
|
"devDependencies": {
|
|
"@electron-toolkit/preload": "^3.0.1",
|
|
"@electron-toolkit/utils": "^4.0.0",
|
|
"@playwright/test": "^1.52.0",
|
|
"@tailwindcss/typography": "^0.5.16",
|
|
"@tailwindcss/vite": "^4.1.7",
|
|
"@types/better-sqlite3": "^7.6.13",
|
|
"@types/node": "^22.15.29",
|
|
"@types/react": "^19.1.6",
|
|
"@types/react-dom": "^19.1.6",
|
|
"@vitejs/plugin-react": "^4.5.2",
|
|
"autoprefixer": "^10.4.21",
|
|
"electron": "^35.5.1",
|
|
"electron-builder": "^26.0.12",
|
|
"electron-vite": "^3.1.0",
|
|
"eslint": "^9.28.0",
|
|
"lucide-react": "^0.511.0",
|
|
"postcss": "^8.5.4",
|
|
"prettier": "^3.5.3",
|
|
"tailwindcss": "^4.1.7",
|
|
"typescript": "^5.8.3",
|
|
"vite": "^6.3.5",
|
|
"vitest": "^3.2.1"
|
|
},
|
|
"allowScripts": {
|
|
"electron@35.7.5": true,
|
|
"better-sqlite3@11.10.0": true,
|
|
"esbuild@0.25.12": true,
|
|
"electron-winstaller@5.4.0": true
|
|
}
|
|
}
|