feat(#2659): serve hive-bash-mcp over persistent streamable-http, drop stdio bridge

This commit is contained in:
damocles 2026-07-23 17:34:02 +02:00 committed by mara
commit c4fcf7fbf1
26 changed files with 376 additions and 574 deletions

View file

@ -1,10 +1,21 @@
//! `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. Listens on a unix socket for tool-call requests from
//! the `hive-bash-mcp` stdio bridge.
//! in-agent socket. Serves its MCP tools (`run`/`status`/`kill`) directly
//! over streamable-http on `--http <addr>` — 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<()> {
@ -15,11 +26,11 @@ async fn main() -> Result<()> {
)
.init();
let socket_path = hive_bash_mcp::paths::daemon_socket();
let cli = Cli::parse();
let todo_socket = hive_bash_mcp::paths::agent_socket();
tracing::info!(
socket = %socket_path.display(),
http = %cli.http,
todo = %todo_socket.display(),
"hive-bash-daemon starting"
);
@ -28,6 +39,6 @@ async fn main() -> Result<()> {
// spawns them, pushing todos to the harness on task transitions.
hive_bash_mcp::runner::spawn_loop(todo_socket);
// Serve the unix socket forever.
hive_bash_mcp::socket::serve(&socket_path).await
// Serve the MCP tools over streamable-http forever.
hive_bash_mcp::mcp::serve_http(cli.http).await
}