fix: AI Tool Calling run_command 输出同步到工作空间终端面板

- handleRunCommand 改用 execWorkspaceCommand 替代 Node exec()
- 执行完成后通过 workspace:toolOutput IPC 事件推送命令和输出
- 渲染进程监听 onToolOutput,在活跃终端显示 AI 命令及结果
- 清理 tool-handlers.ts 中不再需要的 child_process 导入
This commit is contained in:
thzxx
2026-04-08 12:47:28 +08:00
parent 5800aaedd2
commit d5f4112d97
4 changed files with 69 additions and 25 deletions
+2
View File
@@ -241,6 +241,8 @@ export interface MetonaDesktopAPI {
onExit: (callback: (data: { id: string; code: number | null }) => void) => void;
/** 无超时工具命令执行,用于 AI Tool Calling 集成 */
execTool: (command: string, cwd?: string) => Promise<{ success: boolean; stdout: string; stderr: string; exitCode: number | null; duration: number; userTerminated: boolean; truncated: boolean }>;
/** AI Tool Calling 命令输出 → 同步到工作空间终端 */
onToolOutput: (callback: (data: { command: string; stdout: string; stderr: string; exitCode: number | null }) => void) => void;
};
}