feat: AI 命令执行实时流式推送到工作空间终端
- execWorkspaceCommand 新增 onOutput 回调,stdout/stderr 实时推送 - ipc.ts workspace:execTool 实时转发输出 + 发送 toolDone 完成通知 - 渲染进程 appendToolStreamOutput 流式显示,handleToolDone 显示退出状态 - 去掉 tool-handlers.ts 中的一次性完整输出推送 - 完整流程:用户确认 → 实时输出 → 完成通知 → AI 回复结果
This commit is contained in:
+10
-2
@@ -173,9 +173,17 @@ export function setupIPC(): void {
|
||||
});
|
||||
|
||||
// 无超时工具命令执行(AI Tool Calling 集成)
|
||||
ipcMain.handle('workspace:execTool', async (_, command: string, cwd?: string) => {
|
||||
ipcMain.handle('workspace:execTool', async (event, command: string, cwd?: string) => {
|
||||
sendLog('info', `🔧 workspace:execTool`, `${command.slice(0, 200)} | cwd: ${cwd || '默认'}`);
|
||||
return execWorkspaceCommand(command, cwd);
|
||||
|
||||
const result = await execWorkspaceCommand(command, cwd, (type, data) => {
|
||||
// 实时推送到工作空间终端
|
||||
event.sender.send('workspace:toolOutput', { command, type, data });
|
||||
});
|
||||
|
||||
// 通知命令执行完毕
|
||||
event.sender.send('workspace:toolDone', { command, exitCode: result.exitCode });
|
||||
return result;
|
||||
});
|
||||
|
||||
// 终止当前 AI 工具命令
|
||||
|
||||
Reference in New Issue
Block a user