| soterion |
|
|---|
π Soterion: π documentation | owner: HADES | status: active | reviewed: 2026-05-21
Blueprint crate for Annunimas service registry functionality
This crate provides the foundational contract definitions, governance interfaces, and registry blueprint for the Annunimas service registry system. It is intentionally designed as a blueprint rather than a production-ready implementation.
annunimas-service-registry is the ARDA catalog layer: it gives agentic services
a shared vocabulary for what exists, which governance posture applies, and which
dependencies must be satisfied before a runtime promotes work. In the broader
ARDA operating system, it anchors service discovery to inspect-act-verify
receipts instead of informal process notes.
cargo test
cargo doc --no-depsUse this crate as a contract-first starting point. Production registries should wrap the blueprint with persistence, authorization, health probes, and deployment specific transport adapters rather than changing the core contract shape in place.
flowchart TB
Operator[Human Operator] --> HUD[ARDA HUD]
HUD --> Registry[Service Registry Blueprint]
AgentLoop[Agent Loop Contract] --> Registry
Registry --> Contracts[Service Contracts]
Registry --> Governance[Governance Validator]
Registry --> Status[Service Lifecycle State]
SignalGrid[Signal Grid] --> Registry
ToolGate[Tool Gate] --> Governance
Governance --> Receipts[Audit and Compliance Receipts]
Service Registry is ARDA's discovery and lifecycle catalog. It gives Agent Loop, Tool Gate, Signal Grid, Council, and HUD surfaces a shared contract for which services exist, what governance policy applies, and which lifecycle state should be exposed to operators.
Blueprint-stage Rust crate. The current surface is suitable for local contract tests, documentation, and extension planning; production deployments should add persistence, authorization, health probes, and transport adapters outside the core blueprint.
The annunimas-service-registry crate defines:
- Service Contracts - Core data structures for service registration and discovery
- Governance Interfaces - Validation traits for governance compliance
- Registry Blueprint - In-memory registry structure and APIs
- Service Status Tracking - Service lifecycle and health state management
This blueprint serves as the design specification for production service registry implementations in the Annunimas ecosystem.
annunimas-service-registry/
βββ src/
β βββ lib.rs # Crate root and module declarations
β βββ contract.rs # Service contract definitions
β βββ registry.rs # Registry implementation blueprint
β βββ service.rs # Service status and lifecycle
βββ tests/
βββ contract_smoke.rs # Integration test suite
pub struct ServiceContract {
pub name: String,
pub version: String,
pub governance_policy: GovernancePolicy,
pub dependencies: Vec<String>,
pub metadata: HashMap<String, String>,
}Fields:
name: Unique service identifierversion: Semantic version stringgovernance_policy: Governance rules for this servicedependencies: List of required servicesmetadata: Additional service attributes
pub enum GovernancePolicy {
/// Service must pass all governance checks
Strict,
/// Service can operate with warnings
Advisory,
/// No governance restrictions
None,
}The GovernanceValidator trait defines the interface for contract validation:
pub trait GovernanceValidator {
/// Validate a service contract against governance policies
fn validate(&self, contract: &ServiceContract) -> Result<(), GovernanceError>;
/// Check if service is compliant with current governance rules
fn is_compliant(&self, contract: &ServiceContract) -> bool;
}pub struct Registry {
services: HashMap<String, ServiceContract>,
governance_validator: Box<dyn GovernanceValidator>,
}Methods:
register(contract: ServiceContract)- Add a service to the registryderegister(name: &str)- Remove a service from the registryget(name: &str) -> Option<&ServiceContract>- Retrieve a service contractlist() -> Vec<&ServiceContract>- List all registered servicesvalidate_all() -> Vec<ValidationResult>- Validate all services
impl Registry {
/// Create a new registry with default governance validator
pub fn new() -> Self;
/// Register a service contract
pub fn register(&mut self, contract: ServiceContract) -> Result<(), RegistryError>;
/// Check if a service exists
pub fn contains(&self, name: &str) -> bool;
/// Get service count
pub fn len(&self) -> usize;
/// Check if registry is empty
pub fn is_empty(&self) -> bool;
}#[derive(Debug, Clone, PartialEq, Eq)]
pub enum ServiceState {
/// Service is initializing
Initializing,
/// Service is healthy and operational
Healthy,
/// Service is degraded but functional
Degraded,
/// Service is unhealthy and should be restarted
Unhealthy,
/// Service is undergoing maintenance
Maintenance,
/// Service has been decommissioned
Decommissioned,
}pub struct ServiceStatus {
pub contract: ServiceContract,
pub state: ServiceState,
pub last_heartbeat: DateTime<Utc>,
pub uptime_seconds: u64,
pub error_count: u32,
}Methods:
update_state(new_state: ServiceState)- Update service staterecord_heartbeat()- Update last heartbeat timestampincrement_error_count()- Track failuresreset()- Reset service state
This crate provides the foundation. To create a production service registry:
cargo new annunimas-service-registry-impl --lib
cd annunimas-service-registry-impl[dependencies]
annunimas-service-registry = { path = "../annunimas-service-registry" }
tokio = { version = "1.0", features = ["full"] }
serde = { version = "1.0", features = ["derive"] }
thiserror = "1.0"
tracing = "0.1"use annunimas_service_registry::{GovernanceValidator, ServiceContract, GovernanceError};
pub struct ProductionGovernanceValidator;
impl GovernanceValidator for ProductionGovernanceValidator {
fn validate(&self, contract: &ServiceContract) -> Result<(), GovernanceError> {
// Add your governance rules here
if contract.name.is_empty() {
return Err(GovernanceError::InvalidName);
}
if contract.version.is_empty() {
return Err(GovernanceError::InvalidVersion);
}
Ok(())
}
fn is_compliant(&self, contract: &ServiceContract) -> bool {
self.validate(contract).is_ok()
}
}use annunimas_service_registry::{Registry, ServiceContract};
use std::sync::Arc;
#[tokio::main]
async fn main() {
// Create governance validator
let validator = Arc::new(ProductionGovernanceValidator);
// Create registry
let mut registry = Registry::new();
registry.set_governance_validator(validator);
// Register services
let service = ServiceContract {
name: "example-service".to_string(),
version: "1.0.0".to_string(),
governance_policy: annunimas_service_registry::GovernancePolicy::Strict,
dependencies: vec!["database".to_string(), "cache".to_string()],
metadata: HashMap::new(),
};
registry.register(service).expect("Failed to register service");
println!("Registry initialized with {} services", registry.len());
}| Policy | Description | Validation Level |
|---|---|---|
Strict |
All governance checks must pass | High |
Advisory |
Warnings allowed, but critical issues fail | Medium |
None |
No governance restrictions | Low |
To add custom governance rules:
impl GovernanceValidator for YourValidator {
fn validate(&self, contract: &ServiceContract) -> Result<(), GovernanceError> {
// Add custom validation logic
// Example: Check for required metadata
if !contract.metadata.contains_key("team") {
return Err(GovernanceError::MissingMetadata("team".to_string()));
}
// Example: Check for minimum version
if !is_version_compatible(&contract.version, "1.0.0") {
return Err(GovernanceError::VersionMismatch);
}
Ok(())
}
}The crate includes 3 integration tests in tests/contract_smoke.rs:
- Contract Validation - Tests service contract creation and validation
- Governance Compliance - Tests governance policy enforcement
- Registry Operations - Tests basic registry functionality
# Run all tests
cargo test -p annunimas-service-registry
# Run tests with output
cargo test -p annunimas-service-registry -- --nocapture
# Run specific test
cargo test -p annunimas-service-registry governance_validationrunning 3 tests
test contract_creation ... ok
test governance_validation ... ok
test registry_operations ... ok
test result: ok. 3 passed; 0 failed; 0 ignored
//! # annunimas-service-registry
//!
//! Blueprint crate for Annunimas service registry functionality.
//!
//! This crate provides foundational contract definitions, governance interfaces,
//! and registry blueprint for the Annunimas service registry system.
//!
//! # Purpose
//!
//! This is a **blueprint crate**, not a production implementation. It defines:
//! - Service contract interfaces
//! - Governance validation traits
//! - Registry structure blueprints
//! - Service lifecycle management
//!
//! # Usage
//!
//! This crate is meant to be extended. See the module documentation for:
//! - [`contract`] - Service contract definitions
//! - [`registry`] - Registry blueprint implementation
//! - [`service`] - Service status and lifecycle
//!
//! To create a production registry, extend this blueprint in your own crate.
pub mod contract;
pub mod registry;
pub mod service;None currently required. The blueprint is designed to be flexible and configurable through the ServiceContract metadata field.
None currently defined. All functionality is available by default.
| Operation | Complexity | Notes |
|---|---|---|
| Register service | O(1) avg | HashMap insertion |
| Deregister service | O(1) avg | HashMap removal |
| Get service | O(1) avg | HashMap lookup |
| Validate all | O(n) | Linear scan |
| List services | O(n) | Linear iteration |
Memory Usage: ~200 bytes per registered service
Current State: Blueprint (annunimas-service-registry)
β
ββ If you need a simple in-memory registry:
β ββ Use as-is (zero changes required)
β
ββ If you need persistence:
β ββ Create annunimas-service-registry-persistent crate
β ββ Add serde support and file/database backend
β
ββ If you need distributed registry:
β ββ Create annunimas-service-registry-distributed crate
β ββ Add network layer and consensus protocol
β
ββ If you need production governance:
ββ Create annunimas-service-registry-impl crate
ββ Implement GovernanceValidator trait with real rules
| Term | Definition |
|---|---|
| Service Contract | Formal definition of a service's identity, version, dependencies, and governance requirements |
| Governance Policy | Rules that determine service compliance and operational restrictions |
| Governance Validator | Component that enforces governance policies on service contracts |
| Registry | Central store of service contracts and their current status |
| Service State | Current operational status of a service (healthy, degraded, etc.) |
| Blueprint | Design specification that is not yet production-ready |
pub enum GovernanceError {
InvalidName,
InvalidVersion,
MissingMetadata(String),
VersionMismatch,
PolicyViolation(String),
}
pub enum RegistryError {
ServiceAlreadyExists,
ServiceNotFound,
ValidationFailed(GovernanceError),
StorageError(String),
}impl From<GovernanceError> for RegistryError {
fn from(err: GovernanceError) -> Self {
RegistryError::ValidationFailed(err)
}
}annunimas-governance- Governance policy definitions and enforcementannunimas-core- Core Annunimas system definitionsannunimas-systemd- Typedsystemctl --userclient (supervision policy lives inannunimas-prometheus)
- Initial blueprint release
- Service contract definitions
- Governance interface
- In-memory registry blueprint
- 3 integration tests
- When converting to implementation:
- Add persistence layer
- Add network layer
- Add async operations
- Add monitoring hooks
This is a blueprint crate. Contributions should focus on:
- Improving the blueprint - Better documentation, clearer interfaces
- Adding examples - Usage patterns and extension guides
- Identifying gaps - Missing governance rules or contract fields
Not for: Production implementations (create separate crate for that)
For issues and questions:
- Check the Annunimas documentation
- Review the Governance Policy Guide
- Open an issue in the Annunimas repository
This crate is licensed under the MIT License.
Copyright (c) 2026 Your Organization
Permission is hereby granted... (standard MIT license text)
Last Updated: 2026-04-29
Blueprint Status: Active (not yet production-ready)
Next Review: When governance requirements change or production implementation begins