pub enum BudgetStatus {
Ok,
Warning {
spent: f64,
max: f64,
},
Exceeded {
spent: f64,
max: f64,
},
}Expand description
Outcome of classifying cumulative spend against a budget cap.
This is the single source of truth for the harness budget decision. Both the
vtcode-core runner (crate::core::agent::runner) and the binary crate’s
turn loop classify spend through BudgetStatus::classify rather than
re-deriving the > max / >= threshold * max comparisons inline.
Variants§
Ok
Under the warning threshold.
Warning
At or above the warning ratio but still within the cap.
Exceeded
Over the cap — the run should stop or escalate.
Implementations§
Source§impl BudgetStatus
impl BudgetStatus
Sourcepub fn classify(
spent_usd: f64,
max_usd: Option<f64>,
warning_threshold: f64,
) -> Self
pub fn classify( spent_usd: f64, max_usd: Option<f64>, warning_threshold: f64, ) -> Self
Classify spent_usd against an optional max_usd cap and a
warning_threshold fraction (0.0..=1.0).
max_usd == None→ alwaysBudgetStatus::Ok(unlimited).spent_usd > max→BudgetStatus::Exceeded(strict, matching the harness “stop after reaching the budget limit” semantics).spent_usd >= warning_threshold * max→BudgetStatus::Warning.- otherwise →
BudgetStatus::Ok.
Sourcepub fn is_exceeded(&self) -> bool
pub fn is_exceeded(&self) -> bool
Whether the cap has been exceeded (the run should stop/escalate).
Trait Implementations§
Source§impl Clone for BudgetStatus
impl Clone for BudgetStatus
impl Copy for BudgetStatus
Source§impl Debug for BudgetStatus
impl Debug for BudgetStatus
Source§impl PartialEq for BudgetStatus
impl PartialEq for BudgetStatus
impl StructuralPartialEq for BudgetStatus
Auto Trait Implementations§
impl Forget for BudgetStatus
impl Freeze for BudgetStatus
impl Move for BudgetStatus
impl RefUnwindSafe for BudgetStatus
impl Send for BudgetStatus
impl Sync for BudgetStatus
impl Unpin for BudgetStatus
impl UnsafeUnpin for BudgetStatus
impl UnwindSafe for BudgetStatus
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
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>
Convert
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>
Convert
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)
Convert
&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)
Convert
&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
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PtyHandle for Twhere
T: Send,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ResetDiscriminant<T> for Twhere
T: Copy,
impl<T> ResetDiscriminant<T> for Twhere
T: Copy,
Source§fn discriminant(&self) -> T
fn discriminant(&self) -> T
Value based on which equality for the reset will be determined.