feat: 添加工作空间面板 - 右侧终端/文件浏览器

- 新增主进程 workspace.ts:spawn 进程管理,流式输出,安全检查
- IPC 双向通信:workspace:exec(on/send 模式,无超时限制)
- preload 暴露 workspace API
- 渲染进程 workspace-panel.ts:多终端 Tab、ANSI 颜色渲染、文件浏览器
- 设置面板添加工作空间目录配置
- 启动时自动创建 workspace 目录
- 窗口关闭时自动清理所有子进程
- 帮助文档更新
This commit is contained in:
thzxx
2026-04-07 18:30:45 +08:00
parent 9485b4c09e
commit 0e1f216aa4
10 changed files with 1555 additions and 0 deletions
+4
View File
@@ -9,6 +9,7 @@ import { setupIPC } from './ipc.js';
import { createTray } from './tray.js';
import { createMenu } from './menu.js';
import { showNotification } from './utils.js';
import { ensureWorkspaceDir, killAllProcesses } from './workspace.js';
const APP_NAME = 'Metona Ollama';
const ICON_PATH = path.join(__dirname, '..', '..', 'assets', 'icons', 'llama.png');
@@ -143,6 +144,7 @@ if (!gotTheLock) {
}
app.whenReady().then(() => {
ensureWorkspaceDir();
setupIPC();
createMainWindow();
createTray();
@@ -165,6 +167,8 @@ app.on('window-all-closed', () => {
app.on('before-quit', () => {
isQuitting = true;
// 清理所有工作空间进程
killAllProcesses();
// 通知渲染进程释放显存
mainWindow?.webContents.send('app-quit');
});