ShellTool 真实动作生命周期

Bash 是最强也最危险的工具,需要沙箱、超时、输出截断和退出码语义共同约束。

flowchart TD
  A[BashTool.call] --> B[validateInput]
  B --> C[权限与安全检查]
  C --> D{是否进入 sandbox}
  D -->|是| E[沙箱 shell]
  D -->|否| F[普通 shell]
  E --> G[runShellCommand]
  F --> G
  G --> H[stdout / stderr / exitCode]
  H --> I[mapToolResultToToolResultBlockParam]
Phase 6 阅读路线图
Sandbox限制真实命令影响范围
timeout避免命令永久阻塞
exitCode并非所有非零退出都是失败

Phase 6: ShellTool 与真实动作