feat: 统一安全层 - AI 风险识别 + 三模式切换
安全检查流程: - 工具调用前统一经过 safety.check() 拦截 - 普通模式: AI 独立分析指令风险(不带历史对话) - 识别出风险后展示: 指令/风险等级/影响,请求 y/n 确认 - 安全操作快速预检放行(读取类/查询类直接跳过) 三种模式 (/safe 切换): - 普通模式 (默认): AI 识别风险,有风险才确认 - 人工确认模式: 所有指令都需确认 - 无限制模式: 直接执行,不检查 特殊指令始终需确认: - cmd_executor: rm/chmod/chown - file_manager: delete - git_tools: checkout -b
This commit is contained in:
1 parent
3c8ca42bfa
commit
5147662b88
4 files changed
+328
No files matched your search
@@ -72,6 +72,10 @@ class BaseAICLI:
|
||||
if self.current_engine:
|
||||
self.current_engine.cli = self # 设置引用以便访问插件
|
||||
|
||||
# 初始化安全层
|
||||
from .safety import get_safety
|
||||
get_safety().set_cli(self)
|
||||
|
||||
# 创建聊天记录目录
|
||||
self.chat_history_dir = os.path.join(project_dir, "chat_history")
|
||||
if not os.path.exists(self.chat_history_dir):
|
||||
|
||||
Reference in new issue
Block a user