pub struct ContextSnapshot {
pub system_tokens: usize,
pub sent_tokens: usize,
pub tool_defs_tokens: usize,
pub cold_zone_tokens: usize,
pub total_messages: usize,
pub ctx_window: usize,
pub ctx_name: String,
pub system_prompt: String,
}Expand description
Snapshot of the agent’s context budget, cached from AgentEvent::ContextStats
and surfaced by the /context command.
Merged across two emission paths: the narrow TurnEvent-forwarded one
(system/sent/total_messages) and the rich one from handle_send_message
(tool_defs / cold_zone / ctx_window / ctx_name). Each path leaves the
fields it doesn’t know at 0 / empty, so we merge by keeping non-zero
updates. See UiState::on_context_stats.
Fields§
§system_tokens: usize§sent_tokens: usize§tool_defs_tokens: usize§cold_zone_tokens: usize§total_messages: usize§ctx_window: usize§ctx_name: String§system_prompt: StringFull assembled system prompt from the most recent turn.
Surfaced by /context prompt. Empty until the first rich
emission lands.
Trait Implementations§
Source§impl Clone for ContextSnapshot
impl Clone for ContextSnapshot
Source§fn clone(&self) -> ContextSnapshot
fn clone(&self) -> ContextSnapshot
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 ContextSnapshot
impl Debug for ContextSnapshot
Source§impl Default for ContextSnapshot
impl Default for ContextSnapshot
Source§fn default() -> ContextSnapshot
fn default() -> ContextSnapshot
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for ContextSnapshot
impl RefUnwindSafe for ContextSnapshot
impl Send for ContextSnapshot
impl Sync for ContextSnapshot
impl Unpin for ContextSnapshot
impl UnsafeUnpin for ContextSnapshot
impl UnwindSafe for ContextSnapshot
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