feat: 升级至 v0.3.13 — 任务管理系统重构(删除 todo_write + IPC 越权防护 + UI 自动刷新)

This commit is contained in:
2026-07-21 17:01:15 +08:00
parent 058ee2de36
commit f640c9b48a
13 changed files with 114 additions and 280 deletions
+9 -5
View File
@@ -14,7 +14,7 @@
* @see docs/MetonaAI-Desktop UI UX 设计集成方案.html — 窗口管理
*/
import { app, shell, Menu } from 'electron';
import { app, shell, Menu, BrowserWindow } from 'electron';
import { join } from 'path';
import { existsSync, readFileSync, writeFileSync } from 'fs';
import { electronApp, optimizer } from '@electron-toolkit/utils';
@@ -55,7 +55,6 @@ import {
GitStatusTool, GitDiffTool, GitLogTool, GitCommitTool,
LintCodeTool, RunTestsTool, ProjectInfoTool,
HttpRequestTool,
TodoWriteTool,
ThinkTool,
ViewImageTool,
// v0.3.2 新增工具(1 个)
@@ -232,7 +231,13 @@ async function initialize(): Promise<void> {
toolRegistry.registerBuiltin(runCommandTool);
// v0.2.0: 任务管理工具
toolRegistry.registerBuiltin(new TaskManagerTool(() => db));
// P2v0.3.13: 注入 onTaskChanged 回调,工具写入后广播 IPC 事件给所有窗口
toolRegistry.registerBuiltin(new TaskManagerTool(() => db, (sessionId) => {
// 广播任务变更事件给所有窗口(UI 订阅后自动刷新)
for (const win of BrowserWindow.getAllWindows()) {
win.webContents.send('task:changed', sessionId);
}
}));
// 注册 Web Browser 统一浏览器工具
toolRegistry.registerBuiltin(new WebBrowserTool());
@@ -248,9 +253,8 @@ async function initialize(): Promise<void> {
toolRegistry.registerBuiltin(new RunTestsTool());
toolRegistry.registerBuiltin(new ProjectInfoTool());
// v0.3.1: 独立工具(4 个)
// v0.3.1: 独立工具(3v0.3.13 删除 todo_write 后
toolRegistry.registerBuiltin(new HttpRequestTool());
toolRegistry.registerBuiltin(new TodoWriteTool());
toolRegistry.registerBuiltin(new ThinkTool());
toolRegistry.registerBuiltin(new ViewImageTool());