From b087761d6524d414946c88d77ad52faccdd186df Mon Sep 17 00:00:00 2001 From: thzxx Date: Wed, 8 Apr 2026 13:32:03 +0800 Subject: [PATCH] =?UTF-8?q?docs:=20=E6=9B=B4=E6=96=B0=20DEVELOPMENT.md=205?= =?UTF-8?q?.3=20=E5=B7=A5=E4=BD=9C=E7=A9=BA=E9=97=B4=E4=B8=8E=20AI=20?= =?UTF-8?q?=E9=9B=86=E6=88=90=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/DEVELOPMENT.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/docs/DEVELOPMENT.md b/docs/DEVELOPMENT.md index f080903..2f1ce1b 100644 --- a/docs/DEVELOPMENT.md +++ b/docs/DEVELOPMENT.md @@ -170,11 +170,13 @@ import { ### 5.3 工作空间与 AI 集成 -- AI 通过 `run_command` 工具调用工作空间进程管理 -- 执行路径:`tool-registry.ts` → `bridge.workspace.execTool()` → IPC → `workspace.ts execWorkspaceCommand()` -- 无超时限制,进程自然结束后返回完整输出 -- 输出上限:5MB(超出标记 `truncated=true`) -- 用户可随时通过设置禁用 `run_command` +- AI 通过 `run_command` 工具执行命令,命令在工作空间终端实时显示 +- 执行路径:`tool-registry.ts` → `bridge.workspace.execTool()` → IPC `tool:execute` → `handleRunCommand()` → `spawn` 子进程 +- 主进程 `handleRunCommand` 执行命令,stdout/stderr 通过 `cmd:output` 实时推送到渲染进程终端面板 +- 进程结束后通过 `cmd:done` 通知渲染进程,结果回传 AI +- 用户可通过工作空间面板停止按钮终止命令(`cmd:kill`) +- 命令执行前经过 `checkCommandAllowed()` 安全检查 +- 用户确认后才执行(Agent Loop 的 `needsConfirmation` 机制) ---