hyperhive/hive-c0re/src/lib.rs
atlas 3d919b596f feat(#2290): split ensure_runtime — dirs to lifecycle, listeners to mcp_sockets supervisor
- lifecycle::ensure_agent_runtime_dir(name): pure filesystem op, no
  Coordinator dep. Creates /run/hyperhive/agents/<name> without touching
  the MCP listener map.

- workers/mcp_sockets::spawn_poll(coord): 10 s reconcile loop (same shape
  as agent_sockets::spawn_poll). Converges 'agent running => MCP listener
  bound'. First tick is immediate so hive-c0re restarts re-register all
  running agents without waiting a full interval. Fixes the dead-listener-
  after-daemon-restart gap.

- All ensure_runtime() call sites updated:
  - Prebuild/Swap/WriteDropin: Coordinator::agent_dir() (pure, no IO)
  - Reconcile-Start: ensure_agent_runtime_dir + agent_dir (dir may be
    missing after reboot; listener deferred to supervisor)
  - run_create / handle_spawn: ensure_agent_runtime_dir + register_agent
    (eager on first spawn so socket ready before harness first turn)
  - apply_commit / merge_config_pr: ensure_agent_runtime_dir + agent_dir
  - Manager (auto_update): ensure_agent_runtime_dir + agent_dir
    (manager has no MCP listener; socket_server::start_manager owns it)

- ensure_runtime() retained in Coordinator with updated doc pointing at
  the preferred split form. No callers remain outside tests.
2026-07-09 00:58:51 +02:00

55 lines
1.9 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".
//!
//! Cohesive clusters live in directory submodules (`stores`, `stats`,
//! `agent_config`, `workers`); each of their children is re-exported
//! at the crate root so pre-existing `crate::broker::…` /
//! `hive_c0re::broker::…` paths keep compiling unchanged.
pub mod actions;
pub mod agent_config;
pub mod client;
pub mod container_view;
pub mod coordinator;
pub mod dashboard;
pub mod dashboard_events;
pub mod flake_check;
pub mod forge;
pub mod gateway_nginx;
pub mod job_queue;
pub mod lifecycle;
pub mod loose_ends;
pub mod matrix;
pub mod meta;
pub mod migrate;
pub mod paths;
pub mod priv_client;
pub mod questions;
pub mod server;
pub mod socket_server;
pub mod stats;
pub mod stores;
pub mod workers;
// Root re-exports: keep every pre-grouping `crate::<module>` /
// `hive_c0re::<module>` path compiling without touching consumers.
pub use agent_config::{capabilities, limits, tool_groups, topology};
pub use stats::{container_stats, hive_stats, host_stats};
pub use stores::{
approvals, audit_log, broker, build_logs, db, operator_questions, power, scheduled_prompts,
};
pub use workers::{
agent_sockets, auto_update, crash_watch, knowledge, mcp_sockets, reminder_scheduler,
scheduled_prompts_worker,
};