pub trait DomainAdapter: Send + Sync {
// Required methods
fn domain_name(&self) -> &str;
fn constraint_channels(&self) -> Vec<Box<dyn ConstraintChannel>>;
fn map_action_to_state(
&self,
action: &dyn ProposedAction,
) -> KernelResult<Vec<f64>>;
fn detect_regime_change(&self, current: &[f64], proposed: &[f64]) -> bool;
fn format_domain_payload(
&self,
margins: &BTreeMap<String, f64>,
) -> Option<Value>;
// Provided method
fn current_state(&self) -> KernelResult<Vec<f64>> { ... }
}Expand description
Adapter that connects domain-specific knowledge to the safety kernel.
A domain adapter translates domain concepts (e.g., financial positions, robotic actuator states, LLM tool calls) into the kernel’s state-vector representation and provides domain-specific constraint channels.
Required Methods§
Sourcefn domain_name(&self) -> &str
fn domain_name(&self) -> &str
Name of the domain (e.g., “finance”, “agentic”, “robotics”).
Sourcefn constraint_channels(&self) -> Vec<Box<dyn ConstraintChannel>>
fn constraint_channels(&self) -> Vec<Box<dyn ConstraintChannel>>
Provide the constraint channels for this domain.
Sourcefn map_action_to_state(
&self,
action: &dyn ProposedAction,
) -> KernelResult<Vec<f64>>
fn map_action_to_state( &self, action: &dyn ProposedAction, ) -> KernelResult<Vec<f64>>
Map a proposed action’s state deltas into a state vector.
Sourcefn detect_regime_change(&self, current: &[f64], proposed: &[f64]) -> bool
fn detect_regime_change(&self, current: &[f64], proposed: &[f64]) -> bool
Detect whether the proposed state change represents a regime change.
Provided Methods§
Sourcefn current_state(&self) -> KernelResult<Vec<f64>>
fn current_state(&self) -> KernelResult<Vec<f64>>
Return the current (pre-action) state vector.
Used by the certifier to provide accurate current state for regime
change detection. Default returns Err, which causes the certifier to
fall back to a zero vector of the correct length (safe fallback —
regime detection that depends on the delta will see a larger-than-real shift).