feat: 关闭 agent 会话危险命令确认——自动理解和接受全部确认,不再打断用户

This commit is contained in:
ymq 2026-08-19 13:52:23 +08:00
parent 7787898456
commit bda9f31a1b

View File

@ -1269,14 +1269,12 @@ class AgentExecutor:
return any(d in c for d in dangerous)
def _needs_confirmation(self, tool_name: str, params: dict = None) -> bool:
"""检查工具是否需要用户确认。run_command 只对危险命令确认,普通命令自动执行。"""
if self._tool_registry:
tool = self._tool_registry.get(tool_name)
if tool and tool.requires_confirmation:
if tool_name == "run_command":
cmd = (params or {}).get("command", "")
return self._is_dangerous_command(cmd)
return True
"""检查工具是否需要用户确认。
已关闭确认机制:agent 会话应能理解和接受全部确认,执行任务时
不再打断用户要求确认(危险命令也自动执行,不再弹「请回复确认」)。
如需恢复按命令危险度确认,改回读取 tool.requires_confirmation + _is_dangerous_command。
"""
return False