pub struct SystemPromptReport {
pub token_estimate: u64,
pub over_budget: bool,
pub trimmed_sections: Vec<&'static str>,
pub layer_token_estimate: u64,
}Expand description
Result of measuring a composed system prompt against the configured token
budget (agent.max_system_prompt_tokens).
Fields§
§token_estimate: u64estimate_token_count of the final composed text (after trimming, if
trimming occurred).
over_budget: boolWhether token_estimate exceeds agent.max_system_prompt_tokens.
trimmed_sections: Vec<&'static str>Names of sections dropped to satisfy the budget, in drop order. Empty
unless agent.trim_system_prompt is enabled and trimming occurred.
layer_token_estimate: u64estimate_token_count of the user/workspace prompt-layer text spliced
into the prompt (see crate::prompts::resources::SystemPromptLayers::applied_text),
measured before trimming. Layers are never trimmed, so this figure stays
valid after trimming; the built-in share is token_estimate - layer_token_estimate
modulo estimator rounding. Zero when the prompt was assembled outside
the layer pipeline.
Implementations§
Source§impl SystemPromptReport
impl SystemPromptReport
Sourcepub fn measure(text: &str, max_tokens: u64) -> Self
pub fn measure(text: &str, max_tokens: u64) -> Self
Measure text against max_tokens with no trimming applied.
Useful when a system prompt was assembled or overridden outside the
normal section-based pipeline (e.g. downstream embedders calling
AgentRunner::set_system_prompt, or appendix text appended after
crate::prompts::system::compose_system_instruction_with_report already measured the
sectioned prompt).
Sourcepub fn over_budget_warning(&self, max_tokens: u64) -> Option<String>
pub fn over_budget_warning(&self, max_tokens: u64) -> Option<String>
One-line over-budget warning shared by the headless (task_setup.rs)
and interactive (header_context.rs) paths so both sessions surface
the same signal. Returns None when within budget; callers gate on
agent.system_prompt_budget_warning themselves.
Trait Implementations§
Source§impl Clone for SystemPromptReport
impl Clone for SystemPromptReport
Source§impl Debug for SystemPromptReport
impl Debug for SystemPromptReport
Source§impl Default for SystemPromptReport
impl Default for SystemPromptReport
Source§impl PartialEq for SystemPromptReport
impl PartialEq for SystemPromptReport
impl StructuralPartialEq for SystemPromptReport
Auto Trait Implementations§
impl Forget for SystemPromptReport
impl Freeze for SystemPromptReport
impl Move for SystemPromptReport
impl RefUnwindSafe for SystemPromptReport
impl Send for SystemPromptReport
impl Sync for SystemPromptReport
impl Unpin for SystemPromptReport
impl UnsafeUnpin for SystemPromptReport
impl UnwindSafe for SystemPromptReport
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
impl<T> CacheValue for T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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> 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