Skip to content

Open source Grok Bot alternative, Bring your own agent and subscription: message Claude Code, Codex, Gemini CLI, Cursor, Copilot and 40+ AI agents as bots on your own computer, from iPhone, Mac, Windows, Linux or terminal. Agent-agnostic and free. Also a Muse and Dots alternative. Built in Rust.

feat(host): codync-host mcp network for agents that aren't Codync bots

leepokaid2b87f19139a
diff --git a/host/src/api/bots.rs b/host/src/api/bots.rs
index 0e69e84a..279e98e3 100644
--- a/host/src/api/bots.rs
+++ b/host/src/api/bots.rs
@@ -55,6 +55,11 @@ pub(super) async fn call(hub: &Arc<Hub>, caller: &Caller, method: &str, b: Value
crate::chat::outbox::call(hub, bot, name, &b["arguments"]).await?
}
}
+ // An agent on this computer that isn't a bot (`codync-host mcp network`).
+ "agentCall" => {
+ crate::chat::team::assistant::local_call(hub, str_arg(&b, "botId")?, str_arg(&b, "name")?, &b["arguments"])
+ .await?
+ }
"teamCall" => {
crate::chat::team::call_async(hub, str_arg(&b, "botId")?, str_arg(&b, "name")?, &b["arguments"]).await?
}
diff --git a/host/src/api/devices.rs b/host/src/api/devices.rs
index ef8af81c..491c6208 100644
--- a/host/src/api/devices.rs
+++ b/host/src/api/devices.rs
@@ -46,6 +46,7 @@ const LOCAL_ONLY: &[&str] = &[
"computerTools",
"chatCall",
"teamCall",
+ "agentCall",
"manageCall",
"memoryCall",
"routineCall",
diff --git a/host/src/chat/team/assistant.rs b/host/src/chat/team/assistant.rs
index 78e98983..26ed1b7c 100644
--- a/host/src/chat/team/assistant.rs
+++ b/host/src/chat/team/assistant.rs
@@ -4,6 +4,9 @@
//! user has turned cloud assistants on here, and only for this computer's own account. It
//! messages this computer's bots the way a bot does. Nothing can wake it, so the replies wait here
//! until it reads them (in memory: a restart forgets them).
+//!
+//! Agents on this computer that aren't Codync bots (a Claude Code or Codex session) get the same
+//! three tools from `codync-host mcp network` (`agentCall`, loopback only), each under its own name.
use super::{
Back, Exchange, MessageLifetime, RequestStatus, STOPPED, check_message, directory, message_args, remote,
@@ -59,7 +62,7 @@ pub fn set_enabled(hub: &Hub, on: bool) -> Result<CloudStatus> {
pub async fn answer(hub: &Arc<Hub>, call: &Value) -> Value {
let id = &call["id"];
let tool = call["tool"].as_str().unwrap_or_default();
- match run(hub, call["user"].as_str().unwrap_or_default(), tool, &call["args"]).await {
+ match cloud_call(hub, call["user"].as_str().unwrap_or_default(), tool, &call["args"]).await {
Ok(result) => json!({"t": "assistant.result", "id": id, "ok": true, "result": result}),
Err(e) => {
tracing::info!(tool, error = format!("{e:#}"), "refused a cloud assistant call");
@@ -68,7 +71,7 @@ pub async fn answer(hub: &Arc<Hub>, call: &Value) -> Value {
}
}
-async fn run(hub: &Arc<Hub>, user: &str, tool: &str, args: &Value) -> Result<Value> {
+async fn cloud_call(hub: &Arc<Hub>, user: &str, tool: &str, args: &Value) -> Result<Value> {
if !enabled(&hub.store) {
bail!(OFF);
}
@@ -76,37 +79,93 @@ async fn run(hub: &Arc<Hub>, user: &str, tool: &str, args: &Value) -> Result<Val
if user.is_empty() || hub.cloud.status().owner.map(|o| o.user_id).as_deref() != Some(user) {
bail!("This computer isn't in your Codync account.");
}
+ run(hub, &Asker::cloud(), tool, args).await
+}
+
+/// `agentCall`: an agent on this computer that isn't a Codync bot, through `codync-host mcp
+/// network`. It's on the computer, like the user, so neither the cloud switch nor the per-bot
+/// cloud scope applies. Loopback only.
+pub async fn local_call(hub: &Arc<Hub>, name: &str, tool: &str, args: &Value) -> Result<Value> {
+ run(hub, &Asker::local(name)?, tool, args).await
+}
+
+/// Who asks through these tools. Neither kind can be woken, so its replies wait here.
+struct Asker {
+ /// Its id in a bot's chat (`sourceBotId`), and whose replies `read_replies` shows.
+ id: String,
+ /// How a bot's chat shows it.
+ name: String,
+ /// Who it is, in the bot's prompt.
+ who: String,
+ /// What it signs letters to the user's other computers with.
+ handle: String,
+ cloud: bool,
+}
+
+impl Asker {
+ fn cloud() -> Self {
+ Self {
+ id: ID.into(),
+ name: NAME.into(),
+ who: "The user's cloud assistant (ChatGPT, Claude or another assistant they connected to Codync)".into(),
+ handle: HANDLE.into(),
+ cloud: true,
+ }
+ }
+
+ /// `name` is how the agent introduced itself (`--name`).
+ fn local(name: &str) -> Result<Self> {
+ let name = name.trim();
+ if name.is_empty() || name.len() > 40 {
+ bail!("an agent's name is 1–40 characters");
+ }
+ let handle = crate::network::handle(name);
+ Ok(Self {
+ id: format!("agent:{handle}"),
+ name: format!("{name} (this computer)"),
+ who: format!("{name}, an agent on this computer that isn't a Codync bot,"),
+ handle: format!("agent-{handle}"),
+ cloud: false,
+ })
+ }
+}
+
+async fn run(hub: &Arc<Hub>, asker: &Asker, tool: &str, args: &Value) -> Result<Value> {
match tool {
// Also the bots on the user's other computers in this one's network (what they offer).
"list_bots" => {
- directory::list(hub, ID, args, &hub.network.directory().await, |bot| bot.reachable_by_assistants)
+ let keep: fn(&crate::store::BotConfig) -> bool =
+ if asker.cloud { |bot| bot.reachable_by_assistants } else { |_| true };
+ directory::list(hub, &asker.id, args, &hub.network.directory().await, keep)
}
- "message_bot" => message(hub, args),
- "read_replies" => Ok(hub.assistant.read(args["requestId"].as_str())),
+ "message_bot" => message(hub, asker, args),
+ "read_replies" => Ok(hub.assistant.read(&asker.id, args["requestId"].as_str())),
_ => bail!("unknown tool: {tool}"),
}
}
-fn message(hub: &Arc<Hub>, args: &Value) -> Result<Value> {
+fn message(hub: &Arc<Hub>, asker: &Asker, args: &Value) -> Result<Value> {
let (to, message) = message_args(args)?;
check_message(message)?;
- if hub.assistant.running() >= MAX_RUNNING {
+ if hub.assistant.running(&asker.id) >= MAX_RUNNING {
bail!("{MAX_RUNNING} requests are still running: read_replies first, then try again");
}
let to = match hub.network.recipient(to)? {
Recipient::Here(bot) => bot,
- Recipient::There(address) => return message_elsewhere(hub, &address, message),
+ Recipient::There(address) => return message_elsewhere(hub, asker, &address, message),
};
let target = visible_bot(hub, &to)?;
- if !target.reachable_by_assistants {
+ if asker.cloud && !target.reachable_by_assistants {
bail!("{} isn't open to cloud assistants: Reachable by cloud assistants is off in its settings", target.name);
}
let request = uuid::Uuid::new_v4().to_string();
let back = Back::Assistant { request: request.clone() };
let mut lifetime = MessageLifetime::new(hub, &request, message, back, &target.name);
- let exchange = Exchange { request: &request, source: ID, target: &target.id, text: message, peer_name: Some(NAME) };
- lifetime.entries.push(exchange.notice(hub, &target.id, &format!("Message from {NAME}: {message}"), true)?);
+ let (source, name) = (asker.id.as_str(), asker.name.as_str());
+ let exchange = Exchange { request: &request, source, target: &target.id, text: message, peer_name: Some(name) };
+ lifetime.entries.push(exchange.notice(hub, &target.id, &format!("Message from {name}: {message}"), true)?);
hub.assistant.add(Reply {
+ asker: asker.id.clone(),
request: request.clone(),
bot: target.name.clone(),
quote: lifetime.quote.clone(),
@@ -114,8 +173,7 @@ fn message(hub: &Arc<Hub>, args: &Value) -> Result<Value> {
text: None,
at: now_ms(),
});
- let who = "The user's cloud assistant (ChatGPT, Claude or another assistant they connected to Codync)";
- lifetime.deliver(&target.id, 1, request_prompt(who, "the assistant", message))?;
+ lifetime.deliver(&target.id, 1, request_prompt(&asker.who, name, message))?;
Ok(json!({
"requestId": request, "botId": target.id, "name": target.name, "status": RequestStatus::Queued,
"note": "Queued. Bots can take minutes: get the reply later with read_replies.",
@@ -124,9 +182,10 @@ fn message(hub: &Arc<Hub>, args: &Value) -> Result<Value> {
/// A bot on another of the user's computers (`reviewer@laptop`): a letter from this computer,
/// whose answer comes back here. That computer's own rules decide whether it takes it.
-fn message_elsewhere(hub: &Arc<Hub>, to: &codync_network::Address, message: &str) -> Result<Value> {
- let (request, peer) = remote::ask_for_assistant(hub, to, message)?;
+fn message_elsewhere(hub: &Arc<Hub>, asker: &Asker, to: &codync_network::Address, message: &str) -> Result<Value> {
+ let (request, peer) = remote::ask_for_assistant(hub, &asker.handle, to, message)?;
hub.assistant.add(Reply {
+ asker: asker.id.clone(),
request: request.clone(),
bot: peer.clone(),
quote: crate::agent::acp::truncate(message, super::REQUEST_QUOTE_BYTES),
@@ -140,11 +199,52 @@ fn message_elsewhere(hub: &Arc<Hub>, to: &codync_network::Address, message: &str
}))
}
+/// The tools an agent on this computer gets from `codync-host mcp network`: the cloud
+/// assistant's, which the Worker describes for hosted assistants (`cloud/src/routes/assistant.ts`).
+pub fn tools() -> Value {
+ json!([
+ {
+ "name": "list_bots",
+ "description": "List the user's Codync bots you can message, with their IDs, specialties and status: this computer's first, then those on the user's other computers (IDs like reviewer@laptop). Narrow it with query; it returns at most limit at a time, with next for the rest.",
+ "inputSchema": {"type": "object", "properties": {
+ "query": {"type": "string", "description": "Words that must all appear in the bot's name or description."},
+ "limit": {"type": "integer", "minimum": 1, "maximum": 50, "description": "At most this many (default 20)."},
+ "cursor": {"type": "string", "description": "next from the previous call, for the rest."},
+ }},
+ "annotations": {"readOnlyHint": true},
+ },
+ {
+ "name": "message_bot",
+ "description": "Send a self-contained request to one of the user's Codync bots. It runs in that bot's own chat, with the bot's tools, folder and permissions, and this returns as soon as it is queued. Get the reply later with read_replies.",
+ "inputSchema": {"type": "object", "properties": {
+ "botId": {"type": "string", "description": "The bot's id from list_bots."},
+ "message": {"type": "string", "description": "The task, relevant context, file paths and the expected result."},
+ }, "required": ["botId", "message"]},
+ "annotations": {"readOnlyHint": false, "idempotentHint": false},
+ },
+ {
+ "name": "read_replies",
+ "description": "Your recent message_bot requests, newest first, with each bot's reply once it's done. status is queued, sent (the bot is working), completed, failed or cancelled.",
+ "inputSchema": {"type": "object", "properties": {
+ "requestId": {"type": "string", "description": "One request's id from message_bot."},
+ }},
+ "annotations": {"readOnlyHint": true},
+ },
+ ])
+}
+
+pub const INSTRUCTIONS: &str = "Codync connects you to the user's Codync bots, on this computer and the user's \
+other computers. Use list_bots to find one, message_bot to give it a self-contained task, and read_replies to collect \
+its answer. Bots work in their own folders with their own tools and can take minutes: after messaging one, go on with \
+your work and check read_replies later instead of waiting in a loop.";
+
/// The cloud assistant's requests and their replies, oldest first.
#[derive(Default)]
pub struct Replies(Mutex<Vec<Reply>>);
struct Reply {
+ /// Whose request (`Asker::id`).
+ asker: String,
request: String,
bot: String,
quote: String,
@@ -178,8 +278,8 @@ impl Replies {
}
}
- fn running(&self) -> usize {
- self.0.locked().iter().filter(|r| r.running()).count()
+ fn running(&self, asker: &str) -> usize {
+ self.0.locked().iter().filter(|r| r.asker == asker && r.running()).count()
}
fn set(&self, request: &str, status: RequestStatus, text: Option<String>) {
@@ -204,17 +304,18 @@ impl Replies {
self.set(request, RequestStatus::Cancelled, Some(STOPPED.to_owned()));
}
- /// One request, or the newest ones (running and finished).
- fn read(&self, request: Option<&str>) -> Value {
+ /// One of `asker`'s requests, or its newest ones (running and finished).
+ fn read(&self, asker: &str, request: Option<&str>) -> Value {
let all = self.0.locked();
+ let mine = || all.iter().filter(|r| r.asker == asker);
let shown: Vec<Value> = match request {
- Some(id) => all.iter().filter(|r| r.request == id).map(Reply::json).collect(),
- None => all.iter().rev().take(SHOW).map(Reply::json).collect(),
+ Some(id) => mine().filter(|r| r.request == id).map(Reply::json).collect(),
+ None => mine().rev().take(SHOW).map(Reply::json).collect(),
};
if request.is_some() && shown.is_empty() {
return json!({"replies": [], "note": "No such request here: this computer forgets them when Codync restarts."});
}
- json!({"replies": shown, "running": all.iter().filter(|r| r.running()).count()})
+ json!({"replies": shown, "running": mine().filter(|r| r.running()).count()})
}
}
diff --git a/host/src/chat/team/assistant/tests.rs b/host/src/chat/team/assistant/tests.rs
index 8436ebcb..e11d3dd5 100644
--- a/host/src/chat/team/assistant/tests.rs
+++ b/host/src/chat/team/assistant/tests.rs
@@ -26,7 +26,7 @@ async fn the_cloud_assistant_needs_the_switch_and_the_account_and_reads_replies_
assert_eq!((&listed["id"], &listed["result"]["bots"][0]["id"]), (&json!("c1"), &json!("b")));
let sent = call(hub, "user_1", "message_bot", &json!({"botId": "b", "message": "review this"})).await;
let request = sent["result"]["requestId"].as_str().unwrap().to_owned();
- let read = || hub.assistant.read(Some(&request))["replies"][0].clone();
+ let read = || hub.assistant.read(ID, Some(&request))["replies"][0].clone();
f.until(|| read()["status"] == "completed").await;
assert_eq!((&read()["bot"], &read()["reply"]), (&json!("b"), &json!("reply: review this")));
// The bot's chat shows who asked.
@@ -50,7 +50,7 @@ async fn read_replies_tells_a_failed_request_from_a_stopped_one() {
let sent = call(hub, "user_1", "message_bot", &json!({"botId": "b", "message": message})).await;
sent["result"]["requestId"].as_str().unwrap().to_owned()
};
- let read = |request: &str| hub.assistant.read(Some(request))["replies"][0].clone();
+ let read = |request: &str| hub.assistant.read(ID, Some(request))["replies"][0].clone();
let failed = ask("FAIL agent error").await;
f.until(|| read(&failed)["status"] == "failed").await;
@@ -107,6 +107,7 @@ async fn an_answer_from_another_computer_waits_in_the_replies() {
let f = Fixture::new();
let hub = &f.hub;
let added = |request: &str| Reply {
+ asker: ID.into(),
request: request.into(),
bot: "Coder on laptop".into(),
quote: "status?".into(),
@@ -132,9 +133,31 @@ async fn an_answer_from_another_computer_waits_in_the_replies() {
};
tx.send(answer("l1", "all green", "completed")).await.unwrap();
tx.send(answer("l2", "Couldn't finish: tests fail", "failed")).await.unwrap();
- let read = |request: &str| hub.assistant.read(Some(request))["replies"][0].clone();
+ let read = |request: &str| hub.assistant.read(ID, Some(request))["replies"][0].clone();
f.until(|| read("l2")["status"] == "failed").await;
assert_eq!((&read("l1")["status"], &read("l1")["reply"]), (&json!("completed"), &json!("all green")));
assert_eq!(read("l2")["detail"], "Couldn't finish: tests fail");
f.shutdown().await;
}
+
+#[tokio::test]
+async fn an_agent_on_this_computer_asks_without_the_cloud_and_reads_only_its_own_replies() {
+ let f = Fixture::new();
+ let hub = &f.hub;
+ // No cloud switch or account: it's on the computer, and the cloud scope doesn't apply to it.
+ hub.update_bot(&json!({"id": "b", "reachableByAssistants": false})).unwrap();
+ let listed = local_call(hub, "Claude Code", "list_bots", &json!({})).await.unwrap();
+ assert!(listed["bots"].as_array().unwrap().iter().any(|b| b["id"] == "b"), "{listed}");
+ let sent =
+ local_call(hub, "Claude Code", "message_bot", &json!({"botId": "b", "message": "review this"})).await.unwrap();
+ let request = sent["requestId"].as_str().unwrap().to_owned();
+ let read = |name: &str| hub.assistant.read(&Asker::local(name).unwrap().id, Some(&request))["replies"][0].clone();
+ f.until(|| read("Claude Code")["status"] == "completed").await;
+ assert_eq!(read("Claude Code")["reply"], "reply: review this");
+ assert!(read("Codex").is_null(), "another agent doesn't see it");
+ let history = hub.store.history("b", i64::MAX, 50).unwrap();
+ let notice = history.into_iter().find(|e| e.data["delegationId"] == *request).unwrap();
+ assert_eq!(notice.data["botMessage"]["peerName"], "Claude Code (this computer)");
+ assert!(local_call(hub, " ", "list_bots", &json!({})).await.is_err(), "it needs a name");
+ f.shutdown().await;
+}
diff --git a/host/src/chat/team/remote.rs b/host/src/chat/team/remote.rs
index fb168307..de92fa55 100644
--- a/host/src/chat/team/remote.rs
+++ b/host/src/chat/team/remote.rs
@@ -152,9 +152,10 @@ async fn send(hub: &Arc<Hub>, node: &Node, source: &BotConfig, letter: Letter) -
/// The user's cloud assistant asks a bot on another computer. Returns the request's id (the
/// letter's) at once: the letter goes in the background, and its outcome waits in the
/// assistant's replies.
-pub(super) fn ask_for_assistant(hub: &Arc<Hub>, to: &Address, message: &str) -> Result<(String, String)> {
+pub(super) fn ask_for_assistant(hub: &Arc<Hub>, from: &str, to: &Address, message: &str) -> Result<(String, String)> {
let node = hub.network.node().ok_or_else(|| anyhow!("this computer isn't in a network"))?;
- let letter = Letter::new(super::assistant::HANDLE, to.clone(), message);
+ hub.network.send_as(from)?;
+ let letter = Letter::new(from, to.clone(), message);
let (id, peer) = (letter.id.clone(), peer_name(hub, to));
awaits_for_assistant(hub, &id, &peer, message);
let (hub, request) = (hub.clone(), id.clone());
diff --git a/host/src/main.rs b/host/src/main.rs
index 2123aa2a..6511433b 100644
--- a/host/src/main.rs
+++ b/host/src/main.rs
@@ -260,6 +260,16 @@ enum McpServer {
#[arg(long, default_value_t = service::DEFAULT_PORT)]
port: u16,
},
+ /// For a Claude Code, Codex or other agent session on this computer that isn't a Codync bot:
+ /// list the user's bots (here and on their other computers), message one, read its reply.
+ /// Add it to the agent, for example `claude mcp add codync -- codync-host mcp network --name "Claude Code"`.
+ Network {
+ /// How the bots' chats show this agent.
+ #[arg(long, default_value = "Agent")]
+ name: String,
+ #[arg(long, default_value_t = service::DEFAULT_PORT)]
+ port: u16,
+ },
/// Tools of the apps connected through Composio.
Composio {
#[arg(long)]
@@ -468,6 +478,7 @@ async fn main() -> Result<()> {
Sub::Mcp { server: McpServer::Manage { bot, port } } => mcp::serve(bot, port, mcp::Server::Manage).await,
Sub::Mcp { server: McpServer::Memory { bot, port } } => mcp::serve(bot, port, mcp::Server::Memory).await,
Sub::Mcp { server: McpServer::Composio { bot, port } } => mcp::serve(bot, port, mcp::Server::Composio).await,
+ Sub::Mcp { server: McpServer::Network { name, port } } => mcp::serve(name, port, mcp::Server::Network).await,
Sub::Mcp { server: McpServer::Local { connector, port } } => mcp::serve_local(connector, port).await,
Sub::Mcp { server: McpServer::Remote { connector, port } } => mcp::serve_remote(connector, port).await,
Sub::Tui { url, token, port } => {
diff --git a/host/src/mcp.rs b/host/src/mcp.rs
index 1c74562c..4d1eebb3 100644
--- a/host/src/mcp.rs
+++ b/host/src/mcp.rs
@@ -35,6 +35,8 @@ pub enum Server {
Manage,
Memory,
Composio,
+ /// For agents on this computer that aren't Codync bots; `bot` is the agent's name.
+ Network,
}
const INSTRUCTIONS: &str = "Operate this computer's apps like a person would, in the background where you can: \
@@ -85,6 +87,9 @@ pub async fn serve(bot: String, port: u16, server: Server) -> Result<()> {
Server::Composio => {
("codync-composio", crate::market::composio::INSTRUCTIONS, crate::market::composio::tools())
}
+ Server::Network => {
+ ("codync-network", crate::chat::team::assistant::INSTRUCTIONS, crate::chat::team::assistant::tools())
+ }
};
// Requests still running, by id: a cancelled one stops, and its host call with it (a team change's card expires).
let mut running = std::collections::HashMap::<String, tokio::task::AbortHandle>::new();
@@ -161,6 +166,8 @@ async fn call(port: u16, token: &str, bot: &str, params: &Value, server: Server)
Server::Manage => ("manageCall", crate::chat::manage::APPROVAL_TIMEOUT + Duration::from_secs(30)),
Server::Memory => ("memoryCall", Duration::from_mins(2)),
Server::Composio => ("composioCall", Duration::from_mins(2)),
+ // The first listing may wait for the other computers.
+ Server::Network => ("agentCall", Duration::from_secs(30)),
};
let res = crate::http()
.post(format!("http://127.0.0.1:{port}/api/{method}"))
@@ -182,6 +189,7 @@ async fn call(port: u16, token: &str, bot: &str, params: &Value, server: Server)
| Server::Manage
| Server::Memory
| Server::Routines
+ | Server::Network
| Server::Connectors => {
json!({"content": [{"type": "text", "text": v.to_string()}]})
}
diff --git a/host/src/network/mod.rs b/host/src/network/mod.rs
index bb931054..8900a344 100644
--- a/host/src/network/mod.rs
+++ b/host/src/network/mod.rs
@@ -41,6 +41,9 @@ pub struct Network {
node: OnceLock<Arc<Node>>,
asked: Mutex<Option<Instant>>,
handles: Mutex<handles::Handles>,
+ /// Names this computer sends letters as without offering them (`Node::set_senders`): the cloud
+ /// assistant, and agents that aren't bots (`codync-host mcp network`).
+ senders: Mutex<std::collections::BTreeSet<String>>,
}
/// Who a `message_bot` request is for.
@@ -112,6 +115,20 @@ impl Network {
}
}
+ /// Lets this computer send letters as `name` without offering it, unless a bot goes by it.
+ pub fn send_as(&self, name: &str) -> Result<()> {
+ if let Some(bot) = self.bot_for(name) {
+ bail!("a bot here ({bot}) already goes by {name} on the network: give the agent another name");
+ }
+ let mut senders = self.senders.locked();
+ if senders.insert(name.to_owned())
+ && let Some(node) = self.node()
+ {
+ node.set_senders(senders.iter().cloned());
+ }
+ Ok(())
+ }
+
/// This computer's bot behind an address name, if any.
pub fn bot_for(&self, handle: &str) -> Option<String> {
self.handles.locked().bot(handle)
@@ -138,7 +155,6 @@ async fn boot(hub: &Arc<Hub>) -> Result<Arc<Node>> {
if let Err(error) = node.set_rules(rules) {
tracing::warn!(error = format!("{error:#}"), "couldn't apply the network's rules; none apply");
}
- node.set_senders([crate::chat::team::assistant::HANDLE.to_owned()]);
let node = Arc::new(node);
hub.network.node.set(node.clone()).map_err(|_| anyhow!("the network is already starting; try again"))?;
tokio::spawn(watch(hub.clone(), node.changes()));