feat(engine): 实现 Agent 角色热切换与子代理调度
新增 SessionManager::switch_agent / dispatch / dispatch_all / dispatch_stream 四个核心方法,补齐多 Agent 基础系统原语。 交付物: - switch_agent 运行时替换 Arc<dyn Agent>,保留上下文并更新 SessionMeta - dispatch 单任务派发:create_child → inherit_memory → submit_turn - dispatch_all 并行派发:Semaphore 并发控制 + 部分成功语义 - dispatch_stream 流式派发:unbounded_channel + spawn task 消息重建 + finalize_turn - DispatchConfig / SubTaskResult / SubTaskStreamEvent 公开类型 - 4 个端到端示例(agent_switch_demo / sub_agent_dispatch_demo / bridge_keys_demo / dispatch_stream_demo) 辅助变更: - EngineError 新增 DispatchFailed 变体 - CostTracker 实现 From<Usage> 转换 - save_session_meta / load_session_meta 改 pub(crate) 供 switch.rs 使用 测试: +17 个内联测试(4 switch + 5 dispatch + 4 dispatch_all + 4 dispatch_stream),全量 391 passed / 0 failed, clippy 0 警告,doc 0 warning。
This commit is contained in:
+4
-1
@@ -13,8 +13,11 @@ pub mod checkpointer;
|
||||
pub mod error;
|
||||
pub mod session_manager;
|
||||
pub mod snapshot;
|
||||
pub mod sub_agent;
|
||||
pub mod switch;
|
||||
|
||||
pub use checkpointer::{Checkpointer, CkptMeta};
|
||||
pub use error::EngineError;
|
||||
pub use session_manager::{SessionManager, SessionManagerConfig};
|
||||
pub use snapshot::{SessionMemoryEntry, SessionSnapshot};
|
||||
pub use snapshot::{SessionMemoryEntry, SessionSnapshot};
|
||||
pub use sub_agent::{DispatchConfig, SubTaskResult, SubTaskStreamEvent};
|
||||
Reference in New Issue
Block a user