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:
+5
-1
@@ -60,6 +60,10 @@ contextBridge.exposeInMainWorld('metonaDesktop', {
|
||||
ipcRenderer.on('workspace:exit', (_: unknown, data: { id: string; code: number | null }) => callback(data));
|
||||
},
|
||||
/** 无超时命令执行,用于 AI Tool Calling */
|
||||
execTool: (command: string, cwd?: string) => ipcRenderer.invoke('workspace:execTool', command, cwd)
|
||||
execTool: (command: string, cwd?: string) => ipcRenderer.invoke('workspace:execTool', command, cwd),
|
||||
/** AI Tool Calling 命令输出 → 同步到工作空间终端 */
|
||||
onToolOutput: (callback: (data: { command: string; stdout: string; stderr: string; exitCode: number | null }) => void) => {
|
||||
ipcRenderer.on('workspace:toolOutput', (_: unknown, data: { command: string; stdout: string; stderr: string; exitCode: number | null }) => callback(data));
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user