diff --git a/hive-c0re/src/agent_server.rs b/hive-c0re/src/agent_server.rs index 564b150..3e6d574 100644 --- a/hive-c0re/src/agent_server.rs +++ b/hive-c0re/src/agent_server.rs @@ -188,5 +188,20 @@ async fn dispatch(req: &AgentRequest, agent: &str, coord: &Arc) -> }, } } + AgentRequest::Wake { from, body } => { + // Deliver a message to this agent from a co-process (e.g. a + // Matrix daemon). Identical to `Send { to: agent }` but the + // recipient is always the owning agent — no routing needed. + match broker.send(&Message { + from: from.clone(), + to: agent.to_owned(), + body: body.clone(), + }) { + Ok(()) => AgentResponse::Ok, + Err(e) => AgentResponse::Err { + message: format!("{e:#}"), + }, + } + } } } diff --git a/hive-sh4re/src/lib.rs b/hive-sh4re/src/lib.rs index 2035fe4..f0b330b 100644 --- a/hive-sh4re/src/lib.rs +++ b/hive-sh4re/src/lib.rs @@ -218,6 +218,13 @@ pub enum AgentRequest { #[serde(default)] ttl_seconds: Option, }, + /// Deliver a message TO this agent from a co-process (e.g. a Matrix + /// daemon running in the same container). `from` identifies the sender + /// (e.g. `"matrix"`); `body` is a short summary. Unlike `Send`, the + /// recipient is always the agent that owns this socket — no `to` field. + /// Wakes whatever `Recv` the harness is parked on, triggering the next + /// claude turn. + Wake { from: String, body: String }, } /// Responses on a per-agent socket.