//! `hive-bash-daemon` binary — long-running per-agent bash task runner. //! Spawns `sh -c` subprocesses, monitors completion, writes task state //! files, and surfaces task state to the agent as todos on the harness's //! in-agent socket. Serves its MCP tools (`run`/`status`/`kill`) directly //! over streamable-http on `--http ` — no stdio bridge, no separate //! bin claude has to respawn every turn. use anyhow::Result; use clap::Parser; #[derive(Parser)] #[command(name = "hive-bash-daemon", about = "bash-task runner + MCP daemon")] struct Cli { /// Serve the MCP tools over streamable-http on this address (e.g. /// `127.0.0.1:8791`). Bind loopback only. #[arg(long)] http: std::net::SocketAddr, } #[tokio::main] async fn main() -> Result<()> { tracing_subscriber::fmt() .with_env_filter( tracing_subscriber::EnvFilter::try_from_env("RUST_LOG") .unwrap_or_else(|_| tracing_subscriber::EnvFilter::new("info")), ) .init(); let cli = Cli::parse(); let todo_socket = hive_bash_mcp::paths::agent_socket(); tracing::info!( http = %cli.http, todo = %todo_socket.display(), "hive-bash-daemon starting" ); // Start the background runner loop — scans for pending tasks and // spawns them, pushing todos to the harness on task transitions. hive_bash_mcp::runner::spawn_loop(todo_socket); // Serve the MCP tools over streamable-http forever. hive_bash_mcp::mcp::serve_http(cli.http).await }