pub struct SessionValues { /* private fields */ }Expand description
Per-run store of full tool results, addressed by short handles.
Deliberately not thread-shared: the loop is sequential and one store per run is the whole lifetime story. A shared store would raise a question this design does not want to answer — whether one run can read another’s values.
Implementations§
Source§impl SessionValues
impl SessionValues
pub fn new() -> Self
pub fn get(&self, handle: &str) -> Option<&Value>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn resolve_refs(&self, params: &mut Value) -> Vec<String>
pub fn resolve_refs(&self, params: &mut Value) -> Vec<String>
Substitute $rN references in tool arguments with the values they name.
Runs BEFORE parameter validation, which is not an implementation detail:
car-validator checks parameters against the tool’s JSON Schema, and
"$r3" is a string where the schema may demand an array. Resolving
first means the validator sees the real value and its guarantees are
unweakened — the alternative, teaching every schema to also admit a
reference form, would punch a hole in all of them.
Only whole string values are treated as references. A string that
merely contains $r3 is left alone: tool arguments legitimately carry
shell snippets and regexes, and interpolating into the middle of one
would corrupt commands that have nothing to do with this feature.
An unknown handle is left untouched rather than erased or errored. The model gets the literal string back and the tool’s own validation reports it, which is a better failure than silently substituting null. Returns the handles that were resolved, for logging.
Trait Implementations§
Source§impl Debug for SessionValues
impl Debug for SessionValues
Auto Trait Implementations§
impl Freeze for SessionValues
impl RefUnwindSafe for SessionValues
impl Send for SessionValues
impl Sync for SessionValues
impl Unpin for SessionValues
impl UnsafeUnpin for SessionValues
impl UnwindSafe for SessionValues
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<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
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