pub struct ToolResultStore { /* private fields */ }Expand description
Content-addressed disk cache for tool result outputs.
Stores full tool outputs on disk so that conversation messages can hold
lightweight ToolResultRef instead of multi-KB strings.
Implementations§
Source§impl ToolResultStore
impl ToolResultStore
pub fn new(cache_dir: PathBuf) -> Self
Sourcepub fn default_dir() -> PathBuf
pub fn default_dir() -> PathBuf
Default cache directory: $ATOMCODE_HOME/tool_cache/
Sourcepub fn store(&self, result: &ToolResult) -> ToolResultRef
pub fn store(&self, result: &ToolResult) -> ToolResultRef
Store a tool result on disk and return a lightweight reference.
Sourcepub fn load(&self, ref_: &ToolResultRef) -> Option<String>
pub fn load(&self, ref_: &ToolResultRef) -> Option<String>
Load the full output from disk. Returns None if the cache entry is missing.
Sourcepub fn inflate(&self, ref_: &ToolResultRef) -> ToolResult
pub fn inflate(&self, ref_: &ToolResultRef) -> ToolResult
Reconstruct a full ToolResult from a ref by loading from disk.
Falls back to the summary if the cache entry is gone.
Auto Trait Implementations§
impl Freeze for ToolResultStore
impl RefUnwindSafe for ToolResultStore
impl Send for ToolResultStore
impl Sync for ToolResultStore
impl Unpin for ToolResultStore
impl UnsafeUnpin for ToolResultStore
impl UnwindSafe for ToolResultStore
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
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 more