refactor(hive-c0re): group src-root files into submodules

stores/ (sqlite-backed host stores + db helper), stats/, agent_config/,
workers/ — pure git-mv moves; crate-root re-exports keep every
crate::<module> path compiling. flake_check stays at root (synchronous
approval-flow validation, not a background worker)
This commit is contained in:
müde 2026-07-06 22:38:47 +02:00
commit 0e4b5a1120
29 changed files with 68 additions and 24 deletions

View file

@ -413,7 +413,7 @@ tool group can therefore edit, commit, and submit changes for any of
its direct children directly inside its container at `/agents/<child>/config/`.
Agents holding the `can_manage_top_level_agents` topology role
(defined as `ROLE_CAN_MANAGE_TOP_LEVEL_AGENTS` in `hive-c0re/src/topology.rs`)
(defined as `ROLE_CAN_MANAGE_TOP_LEVEL_AGENTS` in `hive-c0re/src/agent_config/topology.rs`)
get additional host-side bind mounts via `set_nspawn_flags`:
- `/var/lib/hyperhive/agents/``/agents/` (RW) — all top-level

View file

@ -109,7 +109,7 @@ Notable collapses:
### Desired-state (spec vs status)
Per-agent power *intent*`wanted: Up | Offline` — is durable as the
`agent_power` table in the coordinator DB (`hive-c0re/src/power.rs`).
`agent_power` table in the coordinator DB (`hive-c0re/src/stores/power.rs`).
`container_view` remains the observed *status*; `Reconcile` nodes converge the
two. Setting `wanted` is never a queued node: the submit layer
(`job_queue/submit.rs`) writes the row synchronously, then submits the DAG

View file

@ -47,7 +47,7 @@ header/targets split, and the per-agent power-intent registry:
- `agent_power` — one tiny row per agent: `agent PK / wanted (up |
offline) / updated_at` — the durable power *intent* behind the job
queue's desired-state reconciliation
(`docs/coordinator.md::Job queue`; owner: `hive-c0re/src/power.rs`).
(`docs/coordinator.md::Job queue`; owner: `hive-c0re/src/stores/power.rs`).
Written synchronously by every operator/agent power action
(dashboard start/stop, `hivectl stop`, the MCP kill/start tools,
spawn approval); read by `Reconcile` nodes and the boot reconcile.

View file

@ -0,0 +1,10 @@
//! Per-agent configuration registries: tool groups, capabilities,
//! topology (all JSON files under `/var/lib/hyperhive/meta/`) and the
//! shared wire-protocol size limits. Each submodule is re-exported at
//! the crate root, so `crate::topology::…` etc. keep working
//! unchanged.
pub mod capabilities;
pub mod limits;
pub mod tool_groups;
pub mod topology;

View file

@ -11,45 +11,45 @@
//! 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_sockets;
pub mod approvals;
pub mod audit_log;
pub mod auto_update;
pub mod broker;
pub mod build_logs;
pub mod capabilities;
pub mod agent_config;
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 db;
pub mod flake_check;
pub mod forge;
pub mod gateway_nginx;
pub mod hive_stats;
pub mod host_stats;
pub mod job_queue;
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 power;
pub mod priv_client;
pub mod questions;
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;
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, reminder_scheduler,
scheduled_prompts_worker,
};

View file

@ -0,0 +1,8 @@
//! Metrics aggregation for the dashboard: hive-wide turn-stats
//! rollups, host-system probes / server warnings, and live
//! per-container cgroup load. Each submodule is re-exported at the
//! crate root, so `crate::hive_stats::…` etc. keep working unchanged.
pub mod container_stats;
pub mod hive_stats;
pub mod host_stats;

View file

@ -0,0 +1,14 @@
//! Sqlite-backed host-side stores (broker, approval / question /
//! schedule queues, build logs, audit trail, power intent) plus the
//! shared connection open/migration helper (`db`). Each submodule is
//! re-exported at the crate root, so `crate::broker::…` etc. keep
//! working unchanged.
pub mod approvals;
pub mod audit_log;
pub mod broker;
pub mod build_logs;
pub mod db;
pub mod operator_questions;
pub mod power;
pub mod scheduled_prompts;

View file

@ -0,0 +1,12 @@
//! Background tasks and periodic sweeps: crash/login watcher, the
//! reminder and scheduled-prompt delivery loops, boot-time auto-update
//! reconcile, the agent-sockets.json writer loop, and knowledge-repo
//! sync. Each submodule is re-exported at the crate root, so
//! `crate::crash_watch::…` etc. keep working unchanged.
pub mod agent_sockets;
pub mod auto_update;
pub mod crash_watch;
pub mod knowledge;
pub mod reminder_scheduler;
pub mod scheduled_prompts_worker;