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
+23
View File
@@ -189,6 +189,19 @@ export interface DocInfo {
// ── 桌面 Bridge 类型 ──
export interface WorkspaceFileEntry {
name: string;
type: 'file' | 'directory';
size: number | null;
modified: string;
}
export interface WorkspaceDirResult {
success: boolean;
entries?: WorkspaceFileEntry[];
error?: string;
}
export interface MetonaDesktopAPI {
isDesktop: boolean;
info: () => Promise<AppInfo>;
@@ -216,6 +229,16 @@ export interface MetonaDesktopAPI {
onTrayAction: (callback: (action: string) => void) => void;
onAppQuit: (callback: () => void) => void;
removeAllListeners: (channel: string) => void;
workspace: {
getDir: () => Promise<{ dir: string; defaultDir: string }>;
setDir: (dir: string) => Promise<{ success: boolean; dir?: string; error?: string }>;
listDir: (dirPath?: string) => Promise<WorkspaceDirResult>;
readFile: (filePath: string) => Promise<{ success: boolean; content?: string; path?: string; error?: string; truncated?: boolean; lines?: number }>;
exec: (params: { id: string; command: string; cwd?: string }) => void;
kill: (id: string) => void;
onOutput: (callback: (data: { id: string; type: 'stdout' | 'stderr'; data: string }) => void) => void;
onExit: (callback: (data: { id: string; code: number | null }) => void) => void;
};
}
export interface AppInfo {