rename HiveServer -> AgentServer per mara's feedback
This commit is contained in:
parent
c634dab2a6
commit
3c5abd3c85
1 changed files with 16 additions and 18 deletions
|
|
@ -8,13 +8,13 @@
|
|||
//! broker-routed protocol. Unaffected by this module.
|
||||
//! - **MCP stdio** owned by this module — what claude actually speaks.
|
||||
//!
|
||||
//! One `HiveServer { socket, flavor }` with two public type aliases:
|
||||
//! - `AgentServer` — sub-agent flavor; restricted send allow-list.
|
||||
//! - `ManagerServer` — manager flavor; manager-only tools unlocked.
|
||||
//! One `AgentServer { socket, flavor }` struct handles both flavors:
|
||||
//! - `Flavor::Agent` — restricted send allow-list, no manager-only tools.
|
||||
//! - `Flavor::Manager` — manager-only tools unlocked via `require_manager()`.
|
||||
//! `ManagerServer` is a backward-compat type alias for `AgentServer`.
|
||||
//!
|
||||
//! All tools live in one `#[tool_router] impl HiveServer`; manager-only
|
||||
//! tools guard via `require_manager()`. Both go through the same
|
||||
//! `run_tool_envelope` helper so logging + status line stay uniform.
|
||||
//! All tools live in one `#[tool_router] impl AgentServer`. Both flavors go
|
||||
//! through the same `run_tool_envelope` helper so logging stays uniform.
|
||||
|
||||
use std::future::Future;
|
||||
use std::path::PathBuf;
|
||||
|
|
@ -28,7 +28,7 @@ use rmcp::{
|
|||
use crate::client;
|
||||
|
||||
/// Wire-protocol-agnostic view of a hyperhive socket response. Both flavors
|
||||
/// of `HiveServer` convert into this so the tool formatters can be shared.
|
||||
/// of `AgentServer` convert into this so the tool formatters can be shared.
|
||||
#[derive(Debug)]
|
||||
pub enum SocketReply {
|
||||
Ok,
|
||||
|
|
@ -105,7 +105,7 @@ impl From<hive_sh4re::Response> for SocketReply {
|
|||
}
|
||||
|
||||
/// Write (or remove) the status file in the agent's own `state/` directory.
|
||||
/// Called by `HiveServer::set_status` for both agent and manager flavors
|
||||
/// Called by `AgentServer::set_status` for both agent and manager flavors
|
||||
/// before dispatching the wire `SetStatus` request (which only triggers a
|
||||
/// dashboard rescan on the host side — file I/O moved here because the
|
||||
/// harness runs as the agent user and has write access to `state/`, whereas
|
||||
|
|
@ -581,17 +581,15 @@ pub struct RemindArgs {
|
|||
/// Manager-only tools return a clear error when called from an agent context.
|
||||
/// In practice the `--allowedTools` gate prevents that — this is belt-and-suspenders.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct HiveServer {
|
||||
pub struct AgentServer {
|
||||
socket: PathBuf,
|
||||
flavor: Flavor,
|
||||
}
|
||||
|
||||
// Keep the old names as type aliases so any external code that references them
|
||||
// still compiles without changes.
|
||||
pub type AgentServer = HiveServer;
|
||||
pub type ManagerServer = HiveServer;
|
||||
/// Backward-compat alias — callers that reference `ManagerServer` by name still compile.
|
||||
pub type ManagerServer = AgentServer;
|
||||
|
||||
impl HiveServer {
|
||||
impl AgentServer {
|
||||
#[must_use]
|
||||
pub fn new(socket: PathBuf, flavor: Flavor) -> Self {
|
||||
Self { socket, flavor }
|
||||
|
|
@ -629,7 +627,7 @@ impl HiveServer {
|
|||
// Claude Code's permission gate refuses uninlisted MCP tools in
|
||||
// non-interactive `--print` mode with "permissions not granted yet".
|
||||
#[tool_router]
|
||||
impl HiveServer {
|
||||
impl AgentServer {
|
||||
#[tool(
|
||||
description = "Send a message to another hyperhive agent (or to the operator). \
|
||||
Use this to talk to peers or to surface output for the human at the dashboard."
|
||||
|
|
@ -1476,7 +1474,7 @@ impl HiveServer {
|
|||
name) or to the operator (recipient `operator`). Use `recv` to drain your inbox one \
|
||||
message at a time. Use `remind` to schedule a future wake-up message for yourself."
|
||||
)]
|
||||
impl ServerHandler for HiveServer {}
|
||||
impl ServerHandler for AgentServer {}
|
||||
|
||||
/// Run an MCP server over stdio for the given flavor. Returns when the client disconnects.
|
||||
///
|
||||
|
|
@ -1485,7 +1483,7 @@ impl ServerHandler for HiveServer {}
|
|||
/// Returns an error if the MCP server fails to initialize or the transport
|
||||
/// encounters a fatal error.
|
||||
pub async fn serve_stdio(socket: PathBuf, flavor: Flavor) -> Result<()> {
|
||||
let server = HiveServer::new(socket, flavor);
|
||||
let server = AgentServer::new(socket, flavor);
|
||||
let service = server.serve(stdio()).await?;
|
||||
service.waiting().await?;
|
||||
Ok(())
|
||||
|
|
@ -1498,7 +1496,7 @@ pub async fn serve_agent_stdio(socket: PathBuf) -> Result<()> {
|
|||
|
||||
/// Convenience wrapper: run the manager MCP server over stdio.
|
||||
pub async fn serve_manager_stdio(socket: PathBuf) -> Result<()> {
|
||||
let server = HiveServer::new(socket, Flavor::Manager);
|
||||
let server = AgentServer::new(socket, Flavor::Manager);
|
||||
let service = server.serve(stdio()).await?;
|
||||
service.waiting().await?;
|
||||
Ok(())
|
||||
|
|
|
|||
Loading…
Reference in a new issue