fix: 修复 daemon 架构中 3 个 blocking 正确性 bug
1. call_capability 元工具不可用
- execute_tool() 中缺失 call_capability 处理分支
- 添加解包 {name, prompt} → 提取目标工具并派发的逻辑
2. tool_call_id 传空字符串
- Tool Consumer 中 tool_call_id 被 _ 忽略,ToolResult 传空串
- 改为使用 LLM 原始 tool_call_id 传递
3. 高风险工具审批无限循环
- Tool Consumer 无条件触发审批,approved_tool 从未被读取
- ToolCall 新增 approved 字段,已批准的工具跳过审批
- ToolExecutor 根据 approved_tool 设置标记
4. Session TTL 时间戳不更新(should-fix)
- ToolResult 回喂时更新 last_access,防止长对话被误清理
5. 其他清理
- load_memories 魔数字符串比较改为 starts_with
- _sock_path 添加文档说明保留用于兼容
- MessageKind::ToolCall 新增 approved: bool 字段
This commit is contained in:
@@ -60,6 +60,8 @@ pub enum MessageKind {
|
||||
tool_name: String,
|
||||
arguments: String,
|
||||
context_token: Option<String>,
|
||||
/// 该工具调用是否已被用户批准(跳过审批流程)
|
||||
approved: bool,
|
||||
},
|
||||
/// 工具执行结果 → 回喂 LLM Consumer
|
||||
ToolResult {
|
||||
@@ -157,6 +159,31 @@ impl PipelineMessage {
|
||||
tool_name: tool_name.into(),
|
||||
arguments: arguments.into(),
|
||||
context_token,
|
||||
approved: false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
/// 快速构造一条已批准的工具调用(跳过审批)
|
||||
pub fn approved_tool_call(
|
||||
channel: ChannelId,
|
||||
correlation_id: Uuid,
|
||||
session_id: Uuid,
|
||||
tool_call_id: impl Into<String>,
|
||||
tool_name: impl Into<String>,
|
||||
arguments: impl Into<String>,
|
||||
context_token: Option<String>,
|
||||
) -> Self {
|
||||
Self {
|
||||
channel,
|
||||
correlation_id,
|
||||
kind: MessageKind::ToolCall {
|
||||
session_id,
|
||||
tool_call_id: tool_call_id.into(),
|
||||
tool_name: tool_name.into(),
|
||||
arguments: arguments.into(),
|
||||
context_token,
|
||||
approved: true,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user