Skip to main content

spacedb_console/
lib.rs

1#![forbid(unsafe_code)]
2//! # spacedb-console — the operator's read-model
3//!
4//! The substance of an operations console is not pixels — it is the logic that
5//! turns raw fleet / access / audit / settlement [`Observations`] into the four
6//! boards a SpaceDB business is run from:
7//!
8//! 1. **Fleet Health** ([`FleetHealth`]) — durability + availability: under-replicated,
9//!    at-risk and lost shards, quorum loss, lag; one Green/Amber/Red rollup.
10//! 2. **Access & Audit** ([`AccessOverview`]) — human vs AI-agent capabilities,
11//!    expirations, revocations, per-agent activity, denials.
12//! 3. **Economics** ([`Economics`]) — revenue, spend per customer, per-rail split,
13//!    agent budget burn-down, unsettled claims.
14//! 4. **Alerts** ([`Alert`]) — the page-me surface, severity-sorted.
15//!
16//! [`Dashboard::assemble`] computes all four from one snapshot; [`Dashboard::render_text`]
17//! prints them. A Dioxus/WASM shell binds the same fields to a UI:
18//!
19//! ```ignore
20//! // in the Dioxus shell (compiles to wasm32, not part of the tested core):
21//! let dash = Dashboard::assemble(&observations, &Config::at(now));
22//! rsx! {
23//!     HealthBadge { status: dash.health.status }
24//!     for alert in dash.alerts { AlertRow { alert } }
25//!     EconomicsPanel { economics: dash.economics }
26//! }
27//! ```
28//!
29//! Open-core (MIT). Fed by observation DTOs, so it stays decoupled and testable.
30
31mod intern;
32mod observe;
33pub use observe::{
34    AgentBudgetObs, AuditObs, CapabilityObs, HomeObs, LagObs, SettledObs, ShardObs, StrongObs,
35};
36
37mod fleet;
38pub use fleet::{assess_fleet, FleetHealth, HealthStatus};
39
40mod alerts;
41pub use alerts::{derive_alerts, Alert, AlertKind, AlertThresholds, Severity};
42
43mod economics;
44pub use economics::{rollup_economics, BudgetStatus, Economics, RailBreakdown};
45
46mod access;
47pub use access::{rollup_access, AccessOverview, AgentActivity};
48
49mod dashboard;
50pub use dashboard::{Config, Dashboard, Observations};
51
52// Re-export the shared economics vocabulary.
53pub use spacedb_meter::Resource;
54
55/// Compiles the README's examples as doctests, so the documented API can never
56/// drift from the real one. Not part of the public API, and not rendered into
57/// the crate docs — it exists only under `cargo test --doc`.
58#[cfg(doctest)]
59#[doc = include_str!("../README.md")]
60pub struct ReadmeDoctests;