pub struct WorkingSet { /* private fields */ }Expand description
Manages the set of files currently in the agent’s context
Implementations§
Source§impl WorkingSet
impl WorkingSet
Sourcepub fn with_config(config: WorkingSetConfig) -> Self
pub fn with_config(config: WorkingSetConfig) -> Self
Create a new working set with the given configuration.
Sourcepub fn current_turn(&self) -> u32
pub fn current_turn(&self) -> u32
Returns the current turn number.
Sourcepub fn add(&mut self, path: PathBuf, tokens: usize) -> Option<String>
pub fn add(&mut self, path: PathBuf, tokens: usize) -> Option<String>
Add a file to the working set, evicting LRU entries if needed.
Sourcepub fn add_labeled(
&mut self,
path: PathBuf,
tokens: usize,
label: &str,
) -> Option<String>
pub fn add_labeled( &mut self, path: PathBuf, tokens: usize, label: &str, ) -> Option<String>
Add a file with a label, evicting LRU entries if needed.
Sourcepub fn add_pinned(&mut self, path: PathBuf, tokens: usize, label: Option<&str>)
pub fn add_pinned(&mut self, path: PathBuf, tokens: usize, label: Option<&str>)
Add a pinned file that is immune to eviction.
Sourcepub fn clear(&mut self, keep_pinned: bool)
pub fn clear(&mut self, keep_pinned: bool)
Clear the working set, optionally keeping pinned entries.
Sourcepub fn entries(&self) -> impl Iterator<Item = &WorkingSetEntry>
pub fn entries(&self) -> impl Iterator<Item = &WorkingSetEntry>
Iterate over all entries in the working set.
Sourcepub fn get(&self, path: &Path) -> Option<&WorkingSetEntry>
pub fn get(&self, path: &Path) -> Option<&WorkingSetEntry>
Get an entry by path.
Sourcepub fn total_tokens(&self) -> usize
pub fn total_tokens(&self) -> usize
Returns the total estimated token count across all entries.
Sourcepub fn last_eviction(&self) -> Option<&str>
pub fn last_eviction(&self) -> Option<&str>
Returns the last eviction message, if any.
Sourcepub fn file_paths(&self) -> Vec<&PathBuf>
pub fn file_paths(&self) -> Vec<&PathBuf>
Returns all file paths in the working set.
Trait Implementations§
Source§impl Clone for WorkingSet
impl Clone for WorkingSet
Source§fn clone(&self) -> WorkingSet
fn clone(&self) -> WorkingSet
Returns a duplicate of the value. Read more
1.0.0 · 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 WorkingSet
impl Debug for WorkingSet
Source§impl Default for WorkingSet
impl Default for WorkingSet
Source§fn default() -> WorkingSet
fn default() -> WorkingSet
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for WorkingSet
impl RefUnwindSafe for WorkingSet
impl Send for WorkingSet
impl Sync for WorkingSet
impl Unpin for WorkingSet
impl UnsafeUnpin for WorkingSet
impl UnwindSafe for WorkingSet
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