1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
//! Advanced SubAgent control plane.
//!
//! This module is an advanced control-plane API for explicit SubAgent lifecycle
//! management. Routine multi-agent composition should use the `task` /
//! `parallel_task` delegation tools.
//!
//! Broadcast-backed lifecycle APIs support:
//! - monitoring SubAgent behavior, planning, and execution
//! - dynamically controlling SubAgents: pause, resume, cancel, and inspect
//!
//! ## 架构
//!
//! ```text
//! AgentOrchestrator
//! +-- spawn_subagent(SubAgentConfig)
//! +-- AgentSession stream
//! +-- broadcast OrchestratorEvent
//! +-- pause/resume/cancel control signals
//! ```
//!
//! ## 使用示例
//!
//! ```rust,ignore
//! use a3s_code_core::orchestrator::{AgentOrchestrator, SubAgentConfig};
//!
//! # async fn example() -> anyhow::Result<()> {
//! // Create a control plane backed by a real Agent.
//! let agent = std::sync::Arc::new(a3s_code_core::Agent::from_config(config).await?);
//! let orchestrator = AgentOrchestrator::from_agent(agent);
//!
//! // Subscribe to all events.
//! let mut events = orchestrator.subscribe_all();
//!
//! // Spawn a SubAgent.
//! let handle = orchestrator
//! .spawn_subagent(
//! SubAgentConfig::new("general", "Use glob to find Python files")
//! .with_description("Analyze code")
//! .with_max_steps(10),
//! )
//! .await?;
//!
//! // Monitor events.
//! tokio::spawn(async move {
//! while let Ok(event) = events.recv().await {
//! println!("Event: {:?}", event);
//! }
//! });
//!
//! // Control the SubAgent lifecycle.
//! orchestrator.pause_subagent(&handle.id).await?;
//! orchestrator.resume_subagent(&handle.id).await?;
//!
//! # Ok(())
//! # }
//! ```
pub use ;
pub use ;
pub use ControlSignal;
pub use OrchestratorEvent;
pub use SubAgentHandle;
pub use SubAgentState;