Skip to main content

aether_core/events/
sub_agent_progress.rs

1use super::AgentMessage;
2use serde::{Deserialize, Serialize};
3
4pub use acp_utils::notifications::SUB_AGENT_PROGRESS_METHOD;
5
6/// Payload for sub-agent progress updates emitted by MCP tools.
7///
8/// This is the internal payload embedded in MCP progress messages between
9/// `mcp-subagents` and the ACP relay (in `aether-cli`). It uses `AgentMessage`
10/// for the event (the full fat type). The relay converts this to
11/// `SubAgentProgressParams` (which uses the lightweight `SubAgentEvent`)
12/// before sending to clients.
13#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
14pub struct SubAgentProgressPayload {
15    pub task_id: String,
16    pub agent_name: String,
17    pub event: AgentMessage,
18}
19
20#[cfg(test)]
21mod tests {
22    use super::SubAgentProgressPayload;
23    use crate::events::AgentMessage;
24
25    #[test]
26    fn test_sub_agent_progress_payload_roundtrip() {
27        let payload = SubAgentProgressPayload {
28            task_id: "task_123".to_string(),
29            agent_name: "explorer".to_string(),
30            event: AgentMessage::Done,
31        };
32
33        let json = serde_json::to_string(&payload).expect("serializable");
34        let parsed: SubAgentProgressPayload = serde_json::from_str(&json).expect("deserializable");
35
36        assert_eq!(payload, parsed);
37    }
38}