pub struct StatefulContext<'a> { /* private fields */ }Expand description
Adapter that implements RequestContext for SessionState.
This is the stateful-mode implementation: all context is read from the
in-memory session store. Wrapping SessionState in this adapter allows
security-critical code to accept &dyn RequestContext and work identically
in both stateful and (future) stateless modes.
§Usage
ⓘ
let ctx = StatefulContext::new(&session);
let eval = ctx.to_evaluation_context();
engine.evaluate(&action, &eval)?;Implementations§
Source§impl<'a> StatefulContext<'a>
impl<'a> StatefulContext<'a>
Sourcepub fn new(session: &'a SessionState) -> Self
pub fn new(session: &'a SessionState) -> Self
Create a new stateful context wrapping a session reference.
Trait Implementations§
Source§impl RequestContext for StatefulContext<'_>
impl RequestContext for StatefulContext<'_>
Source§fn call_counts(&self) -> &HashMap<String, u64>
fn call_counts(&self) -> &HashMap<String, u64>
Per-tool call counts for the current session/request chain.
Source§fn previous_actions(&self) -> &[String]
fn previous_actions(&self) -> &[String]
History of tool names called in this session/request chain.
Source§fn call_chain(&self) -> &[CallChainEntry]
fn call_chain(&self) -> &[CallChainEntry]
Multi-agent call chain entries.
Source§fn agent_identity(&self) -> Option<&AgentIdentity>
fn agent_identity(&self) -> Option<&AgentIdentity>
Cryptographically attested agent identity (if available).
Source§fn session_guard_state(&self) -> Option<&str>
fn session_guard_state(&self) -> Option<&str>
Session guard state machine state (if tracked).
Source§fn risk_score(&self) -> Option<&RiskScore>
fn risk_score(&self) -> Option<&RiskScore>
Current risk score from continuous authorization (if available).
Source§fn to_evaluation_context(&self) -> EvaluationContext
fn to_evaluation_context(&self) -> EvaluationContext
Build an
EvaluationContext from this request context. Read moreAuto Trait Implementations§
impl<'a> !Freeze for StatefulContext<'a>
impl<'a> RefUnwindSafe for StatefulContext<'a>
impl<'a> Send for StatefulContext<'a>
impl<'a> Sync for StatefulContext<'a>
impl<'a> Unpin for StatefulContext<'a>
impl<'a> UnsafeUnpin for StatefulContext<'a>
impl<'a> UnwindSafe for StatefulContext<'a>
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