Skip to main content

urge_runtime/
lib.rs

1//! # urge-runtime
2//!
3//! The `std`-tier public API for URGE. This is the crate most applications
4//! will depend on directly. It assembles all lower crates into a coherent,
5//! easy-to-use governance interface.
6//!
7//! ## Quick start — healthcare
8//!
9//! ```rust,no_run
10//! use urge_runtime::healthcare::HealthcareGovernor;
11//!
12//! let mut gov = HealthcareGovernor::new();
13//!
14//! // Register HIPAA obligation: must obtain consent within 24 hours.
15//! gov.require_consent("P123", "nurse_007", 86_400_000_000_000); // 24h in ns
16//!
17//! // Tick time forward — check for violations.
18//! let now_ns: u64 = 1_000_000_000; // supply your own clock source
19//! let violations = gov.tick(now_ns);
20//! for v in &violations {
21//!     eprintln!("Violation: {:?}", v);
22//! }
23//!
24//! // Evaluate a governance expression before an action.
25//! // `evaluate` takes the expression plus a slice of context slots.
26//! let verdict = gov.evaluate("must audit_access", &[]);
27//! assert!(verdict.valid, "Access denied by governance layer");
28//! ```
29//!
30//! ## Quick start — embedded BIOS access control
31//!
32//! ```rust
33//! use urge_runtime::embedded::BiosGovernor;
34//!
35//! let gov = BiosGovernor::new();
36//! // All evaluation is no-alloc, stack-only.
37//! let permitted = gov.check_access("camera", "app.health", 45); // 45% battery
38//! ```
39
40#![cfg_attr(not(feature = "std"), no_std)]
41
42// `alloc` is UNCONDITIONAL here, not optional. audit.rs and healthcare.rs use String
43// and Vec with no feature gate, so a build without alloc never compiled -- gating this
44// line only made that failure look like a missing feature instead of a manifest error.
45extern crate alloc;
46
47pub mod audit;
48pub mod embedded;
49pub mod healthcare;
50
51// Re-export the full crate surface so users need only one dep.
52pub use urge_core::{AstNode, Expr, Literal, Paradigm, Verdict};
53pub use urge_meta::{GovernancePipeline, PipelineConfig};
54pub use urge_monitor::{GovernanceMonitor, Obligation, ObligationState, ObligationType};