pub struct GovernanceGate { /* private fields */ }Expand description
Gate backend wrapping the GovernanceEngine.
Bridges the 5D effect-algebra governance engine into the kernel’s
gate slot, mapping GovernanceDecision → GateDecision. Governance
events are logged to the exochain when a ChainManager is provided.
Implementations§
Source§impl GovernanceGate
impl GovernanceGate
Sourcepub fn new(risk_threshold: f64, human_approval: bool) -> Self
pub fn new(risk_threshold: f64, human_approval: bool) -> Self
Create a governance gate with the given risk threshold.
Sourcepub fn with_eval_rate_limit(self, config: RateLimitConfig) -> Self
pub fn with_eval_rate_limit(self, config: RateLimitConfig) -> Self
Configure per-principal governance-evaluation rate limiting (WEFT-148).
Sourcepub fn with_chain(self, cm: Arc<ChainManager>) -> Self
pub fn with_chain(self, cm: Arc<ChainManager>) -> Self
Attach a chain manager for audit logging.
Sourcepub fn exempt_action(self, action: impl Into<String>) -> Self
pub fn exempt_action(self, action: impl Into<String>) -> Self
Grant a per-action exemption from the blocking-deny path.
action must match the gate action string exactly (the chat path uses
format!("tool.{name}"), so e.g. "tool.agent_spawn"). An exempted
action that the engine would deny or escalate is permitted instead, but
the decision is still evaluated and witnessed as a governance.grant.
Every other action is unaffected; a gate that never calls this is
identical to before. Opt-in only — driven by the
[kernel.agent.subagents].governance_grant config flag.
Sourcepub fn add_rule(self, rule: GovernanceRule) -> Self
pub fn add_rule(self, rule: GovernanceRule) -> Self
Add a governance rule.
Sourcepub fn engine(&self) -> &GovernanceEngine
pub fn engine(&self) -> &GovernanceEngine
Access the inner governance engine.
Sourcepub fn verify_governance_genesis(&self) -> Option<u64>
pub fn verify_governance_genesis(&self) -> Option<u64>
Verify that the governance genesis event exists on the chain.
Returns the genesis sequence number if found, or None if no
chain is attached or no genesis event exists.
Trait Implementations§
Source§impl GateBackend for GovernanceGate
impl GateBackend for GovernanceGate
Source§fn governance_snapshot(&self) -> Option<GovernanceSnapshot>
fn governance_snapshot(&self) -> Option<GovernanceSnapshot>
None for gates with no
rule set.Source§fn check(&self, agent_id: &str, action: &str, context: &Value) -> GateDecision
fn check(&self, agent_id: &str, action: &str, context: &Value) -> GateDecision
Source§fn check_teardown(
&self,
agent_id: &str,
action: &str,
context: &Value,
) -> GateDecision
fn check_teardown( &self, agent_id: &str, action: &str, context: &Value, ) -> GateDecision
Self::check for a teardown (stop / unload / re-adoption of what
is already placed): a denial caused only by the node’s trust tier is
waived, every other denial (revocation, default deny, rule or
threshold) stands. Gates that cannot tell the difference return the
plain decision, so they never waive anything.Auto Trait Implementations§
impl !Freeze for GovernanceGate
impl RefUnwindSafe for GovernanceGate
impl Send for GovernanceGate
impl Sync for GovernanceGate
impl Unpin for GovernanceGate
impl UnsafeUnpin for GovernanceGate
impl UnwindSafe for GovernanceGate
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more