diff --git a/hive-c0re/src/audit_log.rs b/hive-c0re/src/audit_log.rs index 9ec08284..4a64efa7 100644 --- a/hive-c0re/src/audit_log.rs +++ b/hive-c0re/src/audit_log.rs @@ -15,7 +15,7 @@ //! //! Same process-singleton handle pattern as `build_logs`: installed once //! at `Coordinator::open`, fetched via [`global`] so the recording sites -//! (e.g. `agent_server::handle_restart_infra`) don't have to thread an +//! (e.g. `socket_server::handle_restart_infra`) don't have to thread an //! `Arc` through every call path. Recording is best-effort: a //! sqlite blip must never fail the underlying privileged action. diff --git a/hive-c0re/src/container_view.rs b/hive-c0re/src/container_view.rs index 70109357..c0719ca7 100644 --- a/hive-c0re/src/container_view.rs +++ b/hive-c0re/src/container_view.rs @@ -137,7 +137,7 @@ fn auth_failed_sentinel(name: &str) -> bool { /// Read the agent's free-text status and the Unix timestamp when it was last set /// (derived from the file's mtime). Returns `(None, None)` when the file is absent -/// or empty. `pub` so `agent_server` and `manager_server` can populate `AgentMeta`. +/// or empty. `pub` so `socket_server` and `manager_server` can populate `AgentMeta`. /// /// NB: callers building `AgentMeta` for a *stopped* container should /// clear the result — the on-disk status is a stale snapshot from diff --git a/hive-c0re/src/coordinator.rs b/hive-c0re/src/coordinator.rs index 73de3a5a..039a126d 100644 --- a/hive-c0re/src/coordinator.rs +++ b/hive-c0re/src/coordinator.rs @@ -10,12 +10,12 @@ use std::sync::{Arc, Mutex}; use anyhow::{Context, Result}; use tokio::sync::{broadcast, watch}; -use crate::agent_server::{self, AgentSocket}; use crate::approvals::Approvals; use crate::broker::Broker; use crate::container_view::{self, ContainerView}; use crate::dashboard_events::DashboardEvent; use crate::operator_questions::OperatorQuestions; +use crate::socket_server::{self, AgentSocket}; /// Capacity of the dashboard event channel. Slow browser subscribers /// (idle tab, throttled connection) drop frames past this — that's @@ -126,7 +126,7 @@ pub struct Coordinator { /// `recent_crash_counts`, which prunes entries older than its window. recent_crashes: Mutex>>, /// Agents with a graceful stop in progress. Set by the `GracefulStop` - /// orchestration; read by `agent_server::handle_recv`, which returns + /// orchestration; read by `socket_server::handle_recv`, which returns /// `Response::GracefulStop` (instead of polling the broker) while an /// agent is in this set — the inbound fence. Cleared when the agent /// reports `GracefulStopComplete` or the container is stopped. @@ -429,7 +429,7 @@ impl Coordinator { crate::build_logs::install(build_logs.clone()); // Audit log shares the same db dir; install its process-wide // handle so privileged-action recording sites (e.g. - // `agent_server::handle_restart_infra`) write without threading an + // `socket_server::handle_restart_infra`) write without threading an // `Arc` through the agent-request surface. let audit_log = Arc::new(crate::audit_log::AuditLog::open(build_logs_dir).context("open audit_log")?); @@ -1068,7 +1068,7 @@ impl Coordinator { // Hand the full Coordinator to the per-agent socket — it // needs broker + operator_questions to handle the agent-side // `ask` / `answer` tools, not just the broker. - let socket = agent_server::start(name, &socket_path, self.clone())?; + let socket = socket_server::start(name, &socket_path, self.clone())?; self.agents.lock().unwrap().insert(name.to_owned(), socket); Ok(agent_dir) } @@ -1136,7 +1136,7 @@ impl Coordinator { } /// Mark `name` as having a graceful stop in progress. While set, - /// `agent_server::handle_recv` returns `Response::GracefulStop` for + /// `socket_server::handle_recv` returns `Response::GracefulStop` for /// this agent instead of polling the broker (the inbound fence). pub fn mark_graceful_stop(&self, name: &str) { self.graceful_stop_pending diff --git a/hive-c0re/src/lib.rs b/hive-c0re/src/lib.rs index 531d50f5..2fe98c75 100644 --- a/hive-c0re/src/lib.rs +++ b/hive-c0re/src/lib.rs @@ -13,7 +13,6 @@ //! surface beyond "this is where the modules live". pub mod actions; -pub mod agent_server; pub mod agent_sockets; pub mod approvals; pub mod audit_log; @@ -52,5 +51,6 @@ pub mod reminder_scheduler; pub mod scheduled_prompts; pub mod scheduled_prompts_worker; pub mod server; +pub mod socket_server; pub mod tool_groups; pub mod topology; diff --git a/hive-c0re/src/limits.rs b/hive-c0re/src/limits.rs index da61ac7a..b890f203 100644 --- a/hive-c0re/src/limits.rs +++ b/hive-c0re/src/limits.rs @@ -6,7 +6,7 @@ //! to a state file and the path sent as the body. //! //! Reminders get a separate auto-file escape hatch (see -//! `agent_server::handle_remind`) so callers don't have to think +//! `socket_server::handle_remind`) so callers don't have to think //! about it — oversized reminder bodies get persisted to disk //! transparently and the inbox sees a pointer. diff --git a/hive-c0re/src/manager_server.rs b/hive-c0re/src/manager_server.rs index 489ebce3..fed755ef 100644 --- a/hive-c0re/src/manager_server.rs +++ b/hive-c0re/src/manager_server.rs @@ -25,7 +25,7 @@ pub fn start(coord: Arc) -> Result<()> { let listener = UnixListener::bind(&socket) .with_context(|| format!("bind manager socket {}", socket.display()))?; // 0666 so the in-container root user (non-root) can connect; - // the bind source dir is manager-only on host. See agent_server.rs. + // the bind source dir is manager-only on host. See socket_server.rs. std::fs::set_permissions(&socket, std::fs::Permissions::from_mode(0o666)) .with_context(|| format!("chmod manager socket {}", socket.display()))?; tracing::info!(socket = %socket.display(), "manager socket listening"); @@ -81,7 +81,7 @@ async fn dispatch(req: &ManagerRequest, coord: &Arc) -> ManagerResp // grant manager-level authority from the socket, not from matching the // `MANAGER_AGENT` name. `MANAGER_AGENT` is still passed as the actor // name for attribution/routing (notifications, ownership), not authz. - if let Some(resp) = crate::agent_server::dispatch_shared(req, MANAGER_AGENT, true, coord).await + if let Some(resp) = crate::socket_server::dispatch_shared(req, MANAGER_AGENT, true, coord).await { return resp; } diff --git a/hive-c0re/src/reminder_scheduler.rs b/hive-c0re/src/reminder_scheduler.rs index a78abbb5..6c69fe7e 100644 --- a/hive-c0re/src/reminder_scheduler.rs +++ b/hive-c0re/src/reminder_scheduler.rs @@ -130,7 +130,7 @@ fn inline_fallback(req_path: &str, reason: &str, message: &str) -> String { /// Persist `message` to `host_path` with the symlink-escape defenses /// described in the module docs. Returns `Ok(())` on success, or a /// human-readable reason string on any failure (caller logs + -/// inline-falls-back). `pub` because `agent_server::handle_remind` +/// inline-falls-back). `pub` because `socket_server::handle_remind` /// reuses it for the at-remind-time auto-file path. pub fn write_payload(agent: &str, host_path: &Path, message: &str) -> Result<(), String> { let Some(parent) = host_path.parent() else { @@ -186,7 +186,7 @@ pub fn container_state_prefix(agent: &str) -> String { /// validating that it lives under the agent's own state subtree, has /// a non-empty relative tail, and doesn't try to traverse out via /// `..`. Returns the host `PathBuf` on success, or a human-readable -/// reason string on rejection. `pub` so `agent_server::handle_remind` +/// reason string on rejection. `pub` so `socket_server::handle_remind` /// can reuse it for the at-remind-time auto-file path. pub fn resolve_host_path(agent: &str, req_path: &str) -> Result { let prefix = container_state_prefix(agent); diff --git a/hive-c0re/src/agent_server.rs b/hive-c0re/src/socket_server.rs similarity index 99% rename from hive-c0re/src/agent_server.rs rename to hive-c0re/src/socket_server.rs index 6d02af4a..6ab72491 100644 --- a/hive-c0re/src/agent_server.rs +++ b/hive-c0re/src/socket_server.rs @@ -119,7 +119,7 @@ pub(crate) fn recv_timeout(wait_seconds: Option) -> std::time::Duration { /// semantics (e.g. `GetLooseEnds` / `CountPendingReminders` / `ReminderRollup` /// where the manager can target other agents) or for manager-only variants. /// -/// Both `agent_server::dispatch` and `manager_server::dispatch` call this +/// Both `socket_server::dispatch` and `manager_server::dispatch` call this /// first; each then handles its own remaining arms. pub(crate) async fn dispatch_shared( req: &hive_sh4re::Request,