新增: u-claw 集成
This commit is contained in:
@@ -300,6 +300,11 @@ pub(crate) async fn execute_with_heartbeat(
|
||||
// 外层必须晚于子循环自身三重熔断(轮次/token/挂钟)触发,让超预算的子代理
|
||||
// 以截断报告优雅收尾,而非被外层硬腰斩成裸超时错误(报告蒸发)。
|
||||
crate::commands::ai::agentic::sub_agent::SUB_AGENT_WALL_TIMEOUT_SECS + 60
|
||||
} else if name == "ask_uclaw" {
|
||||
// u-claw 委托:外层取工具内 REQUEST_TIMEOUT(16min,u-claw 15min 硬上限之上)
|
||||
// 加缓冲(含重试序列 3×16min 理论上限,但实际互斥锁内串行,单次 16min+60s 已够
|
||||
// ——重试在 handler 内部串行,外层只需覆盖单次 run_once 最长路径)。见 tools/uclaw.rs。
|
||||
16 * 60 + 60
|
||||
} else if name == "run_command" {
|
||||
args.get("timeout_secs")
|
||||
.and_then(|v| v.as_u64())
|
||||
@@ -321,6 +326,23 @@ pub(crate) async fn execute_with_heartbeat(
|
||||
None
|
||||
};
|
||||
let exec_fut = crate::commands::ai::command_stream::scope(sink, tools.execute(name, args));
|
||||
// ask_uclaw 进度流式:u-claw agent_progress 块级(2s 节流)经独立 task-local sink 注入,
|
||||
// handler 内 emit_progress_line 每块 emit AiCommandOutput(前端工具卡实时展示)。
|
||||
// 非 ask_uclaw 不注入(handler 内 emit_progress_line 静默 noop),零行为变更。
|
||||
// 与上方 command_stream 的 SINK / spawn_agent 的 CALLER_CONV 三 task-local 嵌套互不干扰。
|
||||
// 两分支都走 scope(else 包 None):if/else 类型一致(future 输出 R 相同,scope 包装后
|
||||
// 具体类型不同会 E0308,统一 None/Some 走同一泛型路径)。
|
||||
let uclaw_sink = if name == "ask_uclaw" {
|
||||
Some(crate::commands::ai::tools::uclaw::UclawProgressSink::new(
|
||||
app.clone(),
|
||||
tool_call_id.to_string(),
|
||||
Some(conv_id.to_string()),
|
||||
))
|
||||
} else {
|
||||
None
|
||||
};
|
||||
let exec_fut =
|
||||
crate::commands::ai::tools::uclaw::scope_progress_sink(uclaw_sink, exec_fut);
|
||||
// 父会话 task-local 注入:spawn_agent handler 经 caller_conv() 定位发起调用的父会话
|
||||
// (直调防御兜底用)。与上方 command_stream 的 SINK scope 嵌套,两个 task-local 互不干扰。
|
||||
let exec_fut = crate::commands::ai::tools::spawn_agent::scope_caller_conv(
|
||||
|
||||
Reference in New Issue
Block a user