pub struct PolicyContext<'a> {
pub turn_index: usize,
pub accumulated_usage: &'a Usage,
pub accumulated_cost: &'a Cost,
pub message_count: usize,
pub overflow_signal: bool,
pub new_messages: &'a [AgentMessage],
pub state: &'a SessionState,
}Expand description
Shared read-only context available to every policy evaluation.
Fields§
§turn_index: usizeZero-based index of the current/completed turn.
accumulated_usage: &'a UsageAccumulated token usage across all turns.
accumulated_cost: &'a CostAccumulated cost across all turns.
message_count: usizeNumber of messages in context.
overflow_signal: boolWhether context overflow was signaled.
new_messages: &'a [AgentMessage]Messages added since the last policy evaluation for this slot.
PreTurn: user/pending messages appended since the previous turn.PostTurn/PostLoop: empty — current-turn data is inTurnPolicyContext.
Policies should only scan this slice, never the full session history, to avoid redundant work on messages that have already been evaluated.
state: &'a SessionStateRead-only access to the session state.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for PolicyContext<'a>
impl<'a> !RefUnwindSafe for PolicyContext<'a>
impl<'a> Send for PolicyContext<'a>
impl<'a> Sync for PolicyContext<'a>
impl<'a> Unpin for PolicyContext<'a>
impl<'a> UnsafeUnpin for PolicyContext<'a>
impl<'a> !UnwindSafe for PolicyContext<'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