pub struct ContextBudgetSnapshot {
pub context_window: usize,
pub overhead_tokens: usize,
pub overhead_cap_tokens: usize,
pub working_context_pct: u8,
pub overhead_pct: u8,
pub within_budget: bool,
pub fired: bool,
pub rounds: usize,
}Expand description
One turn’s working-context budget measurement, handed to
ToolEventSink::context_budget.
Why: cadence::CadenceOutcome is the engine’s internal result type and
carries no notion of the model’s context window — but the Infinite Sessions
guarantee a consumer wants to render (“working context >= 60%”) is a RATIO
against that window. This bundles the outcome with the window and cap the
caller resolved, so the sink receives everything a budget indicator needs
and re-derives nothing.
What: overhead_tokens is the measured model-facing transcript size;
overhead_cap_tokens the hard cap; context_window the model’s real
window; working_context_pct/overhead_pct the two derived percentages
(summing to 100); within_budget, fired, and rounds mirror
CadenceOutcome.
Test: crate::task::sink::tests::forwards_context_budget.
Fields§
§context_window: usize§overhead_tokens: usize§overhead_cap_tokens: usize§working_context_pct: u8§overhead_pct: u8§within_budget: bool§fired: boolWhether the scheduled cadence compaction ran this turn — i.e. history was removed from the model-facing CONTEXT (never from the durable record).
rounds: usizeTrait Implementations§
Source§impl Clone for ContextBudgetSnapshot
impl Clone for ContextBudgetSnapshot
Source§fn clone(&self) -> ContextBudgetSnapshot
fn clone(&self) -> ContextBudgetSnapshot
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for ContextBudgetSnapshot
Source§impl Debug for ContextBudgetSnapshot
impl Debug for ContextBudgetSnapshot
impl Eq for ContextBudgetSnapshot
Source§impl PartialEq for ContextBudgetSnapshot
impl PartialEq for ContextBudgetSnapshot
impl StructuralPartialEq for ContextBudgetSnapshot
Auto Trait Implementations§
impl Freeze for ContextBudgetSnapshot
impl RefUnwindSafe for ContextBudgetSnapshot
impl Send for ContextBudgetSnapshot
impl Sync for ContextBudgetSnapshot
impl Unpin for ContextBudgetSnapshot
impl UnsafeUnpin for ContextBudgetSnapshot
impl UnwindSafe for ContextBudgetSnapshot
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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