hyperhive/hive-c0re/src/lib.rs
atlas f5f06a5f14 refactor(#1865): consolidate agent + manager socket servers into one
The per-agent and manager sockets ran two parallel dispatchers with
duplicated lifecycle handlers (agent-side topology-gated, manager-side
ungated) plus a manager-only handler set. Collapse to one parameterized
server in socket_server.rs:

- one serve() + dispatch(req, agent, privileged, coord); start() binds
  the per-agent sockets (privileged=false), start_manager() binds the
  manager socket (privileged=true).
- each lifecycle/config handler (start/restart/kill/update/init_config/
  apply_commit) merges its dual: the topology guard (require_child /
  require_new_child) runs only on the !privileged path; init_config
  records the requester as parent only when !privileged. restart keeps
  the orthogonal, capability-gated + audited infra-container branch.
- the agent-state queries (loose-ends / reminder count + rollup) branch
  on privileged: privileged keeps any-target + the "*" hive-wide sweep
  (query_agent_state-gated), non-privileged keeps the topology/cap gate.
- the privileged-only verbs (schedules / meta-inputs / get_logs) plus
  the submit/schedule/watchdog helpers move into socket_server; they are
  reached via dispatch_privileged_only(), which rejects the whole group
  on a non-privileged socket.
- delete manager_server.rs; repoint refs; merge the test modules.

No behavior change: the topology guard still applies on every
non-privileged lifecycle call, the privileged socket still acts on any
agent, and privileged-only verbs are still rejected on agent sockets.
2026-06-22 13:58:52 +02:00

55 lines
1.5 KiB
Rust

//! `hive-c0re` library — module surface shared by the `hive-c0re`
//! daemon binary and the `hivectl` operator CLI.
//!
//! `hive-c0re` (daemon) keeps the systemd service shape it always had:
//! coordinator, broker, axum dashboard, admin/manager/agent unix
//! sockets, background sweepers. `hivectl` (sibling bin under
//! `src/bin/hivectl.rs`) reuses a thin subset (`forge`, `matrix`,
//! `lifecycle`) to expose host-side administration verbs — manually
//! provisioning forge / matrix users for an agent, etc.
//!
//! Every module is re-exported `pub` so anything in the crate is
//! addressable from either binary; the lib doesn't have a curated
//! surface beyond "this is where the modules live".
pub mod actions;
pub mod agent_sockets;
pub mod approvals;
pub mod audit_log;
pub mod auto_update;
pub mod bash_tasks_vacuum;
pub mod broker;
pub mod build_logs;
pub mod capabilities;
pub mod client;
pub mod container_stats;
pub mod container_view;
pub mod coordinator;
pub mod crash_watch;
pub mod dashboard;
pub mod dashboard_events;
pub mod events_vacuum;
pub mod flake_check;
pub mod forge;
pub mod gateway_nginx;
pub mod hive_stats;
pub mod host_stats;
pub mod knowledge;
pub mod lifecycle;
pub mod limits;
pub mod loose_ends;
pub mod matrix;
pub mod meta;
pub mod migrate;
pub mod operator_questions;
pub mod paths;
pub mod priv_client;
pub mod questions;
pub mod rebuild_queue;
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;