pub struct GovernanceRequest {
pub agent_id: String,
pub action: String,
pub effect: EffectVector,
pub context: HashMap<String, String>,
pub node_id: Option<String>,
}Expand description
Governance evaluation request.
Fields§
§agent_id: StringAgent identifier making the request.
action: StringAction being requested.
effect: EffectVectorComputed effect vector for the action.
context: HashMap<String, String>Additional context for the evaluator.
node_id: Option<String>Node ID of the requesting node (for distributed governance in K6).
Implementations§
Source§impl GovernanceRequest
impl GovernanceRequest
Sourcepub fn new(agent_id: impl Into<String>, action: impl Into<String>) -> Self
pub fn new(agent_id: impl Into<String>, action: impl Into<String>) -> Self
Create a new governance request.
Sourcepub fn with_node_id(self, node_id: impl Into<String>) -> Self
pub fn with_node_id(self, node_id: impl Into<String>) -> Self
Set the node ID for distributed governance evaluation.
Sourcepub fn with_effect(self, effect: EffectVector) -> Self
pub fn with_effect(self, effect: EffectVector) -> Self
Set the effect vector.
Sourcepub fn with_tool_context(
self,
tool_name: impl Into<String>,
gate_action: impl Into<String>,
effect: EffectVector,
pid: u64,
) -> Self
pub fn with_tool_context( self, tool_name: impl Into<String>, gate_action: impl Into<String>, effect: EffectVector, pid: u64, ) -> Self
Enrich the request with tool execution context (k3:D2).
Sets the context map with tool-specific fields so governance
rules can distinguish between different tool invocations even
when the action string is the generic "tool.exec".
§Fields set
tool— tool name (e.g."fs.read_file")gate_action— the per-tool gate action from the catalogpid— stringified PID of the requesting agent
The effect field is set from the tool’s declared effect vector,
enabling threshold-based governance that varies per tool.
Trait Implementations§
Source§impl Clone for GovernanceRequest
impl Clone for GovernanceRequest
Source§fn clone(&self) -> GovernanceRequest
fn clone(&self) -> GovernanceRequest
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for GovernanceRequest
impl Debug for GovernanceRequest
Source§impl<'de> Deserialize<'de> for GovernanceRequest
impl<'de> Deserialize<'de> for GovernanceRequest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for GovernanceRequest
impl RefUnwindSafe for GovernanceRequest
impl Send for GovernanceRequest
impl Sync for GovernanceRequest
impl Unpin for GovernanceRequest
impl UnsafeUnpin for GovernanceRequest
impl UnwindSafe for GovernanceRequest
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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