//! `hive-forge-notify` binary — long-running per-agent Forgejo //! notification poller. Polls the agent's unread notification list, //! formats each thread into a short summary, and pushes it as a todo //! (loose-ends v2) on the harness's in-agent socket so claude drives a //! turn to handle it. //! //! Takes no arguments: everything comes from the environment the //! per-agent systemd unit provides — `HIVE_FORGE_URL` (forwarded into //! every container by the meta flake), `HYPERHIVE_STATE_DIR` (where the //! agent's `forge-token` lives) and `HIVE_AGENT_SOCKET` (the harness's //! todo socket). When the forge is not configured for this agent the //! poller logs why and exits 0 — the unit is `Restart=on-failure`, so a //! forge-less agent settles instead of restart-looping. mod notify; mod todo_client; #[tokio::main] async fn main() { tracing_subscriber::fmt() .with_env_filter( tracing_subscriber::EnvFilter::try_from_env("RUST_LOG") .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")), ) .init(); let socket = std::env::var_os("HIVE_AGENT_SOCKET").map_or_else( || std::path::PathBuf::from(hive_agent_sock::DEFAULT_AGENT_SOCKET), std::path::PathBuf::from, ); tracing::info!(socket = %socket.display(), "hive-forge-notify starting"); // Returns only when the forge is not configured (or the token never // arrives); otherwise loops forever. Either way there is nothing left // for this process to do, so fall off the end and exit 0. notify::run(socket).await; }