drop debug-only cli subcommands from hive-ag3nt + hive-m1nd
drop the one-shot send/recv/kill/start/restart/request-spawn/request- apply-commit subcommands from both in-container binaries. they were debug-only — the host admin socket (`hive-c0re ...`) exposes the same verbs and the manager mcp surface covers the rest from inside claude. now each binary's --help shows just `serve` and `mcp`, which are the only commands either is meant to be started with. removes the `one_shot` helper and the `render` / `check` glue.
This commit is contained in:
parent
08f2ec5232
commit
0cc25d33d8
3 changed files with 6 additions and 77 deletions
|
|
@ -2,7 +2,7 @@ use std::path::{Path, PathBuf};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use hive_ag3nt::events::{Bus, LiveEvent};
|
||||
use hive_ag3nt::login::{self, LoginState};
|
||||
|
|
@ -29,10 +29,6 @@ enum Cmd {
|
|||
#[arg(long, default_value_t = 1000)]
|
||||
poll_ms: u64,
|
||||
},
|
||||
/// Send a message to another agent.
|
||||
Send { to: String, body: String },
|
||||
/// Pop one message from the inbox.
|
||||
Recv,
|
||||
/// Run the agent's MCP server on stdio. Spawned by `claude` via
|
||||
/// `--mcp-config`; tools dispatch through `/run/hive/mcp.sock` back into
|
||||
/// the hyperhive broker.
|
||||
|
|
@ -103,17 +99,6 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
Cmd::Send { to, body } => {
|
||||
let resp: AgentResponse =
|
||||
client::request(&cli.socket, &AgentRequest::Send { to, body }).await?;
|
||||
render(&resp)?;
|
||||
check(&resp)
|
||||
}
|
||||
Cmd::Recv => {
|
||||
let resp: AgentResponse = client::request(&cli.socket, &AgentRequest::Recv).await?;
|
||||
render(&resp)?;
|
||||
check(&resp)
|
||||
}
|
||||
Cmd::Mcp => mcp::serve_agent_stdio(cli.socket).await,
|
||||
}
|
||||
}
|
||||
|
|
@ -192,14 +177,3 @@ async fn inbox_unread(socket: &Path) -> u64 {
|
|||
}
|
||||
}
|
||||
|
||||
fn render(resp: &AgentResponse) -> Result<()> {
|
||||
println!("{}", serde_json::to_string_pretty(resp)?);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check(resp: &AgentResponse) -> Result<()> {
|
||||
if let AgentResponse::Err { message } = resp {
|
||||
bail!("{message}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,13 +1,12 @@
|
|||
//! Manager harness. Talks to the manager socket (bind-mounted from the host
|
||||
//! at `/run/hive/mcp.sock` inside the `hm1nd` container) using the privileged
|
||||
//! tool surface. Phase 4 minimum: a CLI to exercise the verbs from a shell,
|
||||
//! plus a `serve` loop that logs the manager's inbox.
|
||||
//! at `/run/hive/mcp.sock` inside the `hm1nd` container). Two surfaces:
|
||||
//! `serve` (long-lived turn loop) and `mcp` (stdio MCP server claude spawns).
|
||||
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
|
||||
use anyhow::{Result, bail};
|
||||
use anyhow::Result;
|
||||
use clap::{Parser, Subcommand};
|
||||
use hive_ag3nt::events::{Bus, LiveEvent};
|
||||
use hive_ag3nt::login::{self, LoginState};
|
||||
|
|
@ -32,25 +31,10 @@ enum Cmd {
|
|||
#[arg(long, default_value_t = 1000)]
|
||||
poll_ms: u64,
|
||||
},
|
||||
/// Send a message to a sub-agent (or anywhere — the broker doesn't validate).
|
||||
Send { to: String, body: String },
|
||||
/// Pop one message from the manager's inbox.
|
||||
Recv,
|
||||
/// Submit a spawn request for the user to approve (creates a pending
|
||||
/// approval; on approval the host creates + starts the container).
|
||||
RequestSpawn { name: String },
|
||||
/// Kill a sub-agent.
|
||||
Kill { name: String },
|
||||
/// Start a stopped sub-agent.
|
||||
Start { name: String },
|
||||
/// Restart a sub-agent (stop + start).
|
||||
Restart { name: String },
|
||||
/// Submit a config commit on the agent's config repo for user approval.
|
||||
RequestApplyCommit { agent: String, commit_ref: String },
|
||||
/// Run the manager MCP server on stdio. Spawned by claude via
|
||||
/// `--mcp-config`; same shape as `hive-ag3nt mcp` but with the
|
||||
/// manager tool surface (`request_spawn`, `kill`,
|
||||
/// `request_apply_commit`).
|
||||
/// manager tool surface (`request_spawn`, `kill`, `start`, `restart`,
|
||||
/// `request_apply_commit`, `ask_operator`).
|
||||
Mcp,
|
||||
}
|
||||
|
||||
|
|
@ -101,34 +85,10 @@ async fn main() -> Result<()> {
|
|||
}
|
||||
}
|
||||
}
|
||||
Cmd::Send { to, body } => one_shot(&cli.socket, ManagerRequest::Send { to, body }).await,
|
||||
Cmd::Recv => one_shot(&cli.socket, ManagerRequest::Recv).await,
|
||||
Cmd::RequestSpawn { name } => {
|
||||
one_shot(&cli.socket, ManagerRequest::RequestSpawn { name }).await
|
||||
}
|
||||
Cmd::Kill { name } => one_shot(&cli.socket, ManagerRequest::Kill { name }).await,
|
||||
Cmd::Start { name } => one_shot(&cli.socket, ManagerRequest::Start { name }).await,
|
||||
Cmd::Restart { name } => one_shot(&cli.socket, ManagerRequest::Restart { name }).await,
|
||||
Cmd::RequestApplyCommit { agent, commit_ref } => {
|
||||
one_shot(
|
||||
&cli.socket,
|
||||
ManagerRequest::RequestApplyCommit { agent, commit_ref },
|
||||
)
|
||||
.await
|
||||
}
|
||||
Cmd::Mcp => mcp::serve_manager_stdio(cli.socket).await,
|
||||
}
|
||||
}
|
||||
|
||||
async fn one_shot(socket: &Path, req: ManagerRequest) -> Result<()> {
|
||||
let resp: ManagerResponse = client::request(socket, &req).await?;
|
||||
println!("{}", serde_json::to_string_pretty(&resp)?);
|
||||
if let ManagerResponse::Err { message } = resp {
|
||||
bail!("{message}");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
async fn serve(socket: &Path, interval: Duration, bus: Bus) -> Result<()> {
|
||||
tracing::info!(socket = %socket.display(), "hive-m1nd serve");
|
||||
let mcp_config = turn::write_mcp_config(socket).await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue