pub struct WriteBudget { /* private fields */ }Expand description
Everything one agent needs to execute a tool call: the executors, its policy
layers, and its interaction backend. All fields are cheap Arcs so a clone is
moved into each exec_for closure. The stage-scoped fields
One run’s write ceilings and what it has spent of them (issue #252).
The count is what a tool call reported writing, which for a shell redirect is the target’s size measured after the call. That is an approximation in one direction worth naming: a command that overwrites the same file twice is counted twice, so a run that rewrites one file in a loop reaches its budget sooner than the disk does. Erring that way is the point - the alternative is tracking per-path deltas, which a command writing to a path Leviath cannot name defeats anyway.
Implementations§
Source§impl WriteBudget
impl WriteBudget
Sourcepub fn new(limits: WriteLimits) -> Self
pub fn new(limits: WriteLimits) -> Self
A budget over the real filesystem.
Sourcepub fn with_probe(
limits: WriteLimits,
available: fn(&Path) -> Option<u64>,
) -> Self
pub fn with_probe( limits: WriteLimits, available: fn(&Path) -> Option<u64>, ) -> Self
A budget whose free-space probe is supplied.
Sourcepub fn check(&self, workdir: &Path, bytes: u64) -> WriteVerdict
pub fn check(&self, workdir: &Path, bytes: u64) -> WriteVerdict
Whether a write of bytes into workdir may proceed.
Does not record anything: a refused write must not spend the budget it was refused by, or one oversized call would exhaust the run.
Auto Trait Implementations§
impl !Freeze for WriteBudget
impl RefUnwindSafe for WriteBudget
impl Send for WriteBudget
impl Sync for WriteBudget
impl Unpin for WriteBudget
impl UnsafeUnpin for WriteBudget
impl UnwindSafe for WriteBudget
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> ConditionalSend for Twhere
T: Send,
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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<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