Adds a durable, operator-visible audit trail of privileged operations hive-c0re performs on behalf of an agent — the ones that cross the agent/operator trust boundary. First entry: infra-container restarts via the infra_admin-gated `restart` tool, which until now were recorded only as a hive-priv journal trace. Backend: - new `audit_log` module: sqlite-backed store (audit_log.sqlite, same dir as build_logs) with schema (ts/agent/action/target/outcome/detail), best-effort `record`, `list_recent` (clamped 500), 90-day `vacuum`, and a process-singleton handle mirroring build_logs. - Coordinator opens + installs the handle; main spawns the hourly vacuum. - agent_server::handle_restart_infra records every attempt (ok, error, and capability-denied) via the global handle — best-effort, never fails the underlying action. - dashboard: `GET /api/audit-log` returns recent entries as JSON. Scope is deliberately agent-initiated privileged actions only (not every PrivRequest — token writes + nspawn edits are constant lifecycle noise). Extensible: future agent-initiated priv ops record via the same handle. Unit tests cover record/list ordering, the 500 clamp, and retention vacuum. The dashboard *surface* (an AUDIT view consuming /api/audit-log) is a frontend follow-up coordinated with iris.
57 lines
1.6 KiB
Rust
57 lines
1.6 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_ports;
|
|
pub mod agent_server;
|
|
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 manager_server;
|
|
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 tool_groups;
|
|
pub mod topology;
|