pub struct AgentStateSnapshot {
pub todos: Vec<TodoItem>,
pub files: BTreeMap<String, String>,
pub scratchpad: BTreeMap<String, Value>,
pub pending_interrupts: Vec<AgentInterrupt>,
}
Expand description
Snapshot of agent state shared between runtime, planners, and tools.
Fields§
§todos: Vec<TodoItem>
§files: BTreeMap<String, String>
§scratchpad: BTreeMap<String, Value>
§pending_interrupts: Vec<AgentInterrupt>
Pending interrupts awaiting human response
Implementations§
Source§impl AgentStateSnapshot
impl AgentStateSnapshot
pub fn apply_command(&mut self, command: Command)
Source§impl AgentStateSnapshot
impl AgentStateSnapshot
Sourcepub fn add_interrupt(&mut self, interrupt: AgentInterrupt)
pub fn add_interrupt(&mut self, interrupt: AgentInterrupt)
Add an interrupt to the pending interrupts list.
Sourcepub fn clear_interrupts(&mut self)
pub fn clear_interrupts(&mut self)
Clear all pending interrupts.
Sourcepub fn has_pending_interrupts(&self) -> bool
pub fn has_pending_interrupts(&self) -> bool
Check if there are any pending interrupts.
Sourcepub fn merge(&mut self, other: AgentStateSnapshot)
pub fn merge(&mut self, other: AgentStateSnapshot)
Merge another state snapshot into this one using reducer logic.
Sourcepub fn reduce_files(
left: Option<BTreeMap<String, String>>,
right: Option<BTreeMap<String, String>>,
) -> Option<BTreeMap<String, String>>
pub fn reduce_files( left: Option<BTreeMap<String, String>>, right: Option<BTreeMap<String, String>>, ) -> Option<BTreeMap<String, String>>
File reducer function matching Python’s file_reducer behavior. Merges two optional file dictionaries, handling None values appropriately.
Sourcepub fn with_merged_files(
&self,
new_files: Option<BTreeMap<String, String>>,
) -> AgentStateSnapshot
pub fn with_merged_files( &self, new_files: Option<BTreeMap<String, String>>, ) -> AgentStateSnapshot
Create a new state with merged files, handling None values.
pub fn with_updated_todos(&self, new_todos: Vec<TodoItem>) -> AgentStateSnapshot
Trait Implementations§
Source§impl Clone for AgentStateSnapshot
impl Clone for AgentStateSnapshot
Source§fn clone(&self) -> AgentStateSnapshot
fn clone(&self) -> AgentStateSnapshot
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 AgentStateSnapshot
impl Debug for AgentStateSnapshot
Source§impl Default for AgentStateSnapshot
impl Default for AgentStateSnapshot
Source§fn default() -> AgentStateSnapshot
fn default() -> AgentStateSnapshot
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for AgentStateSnapshot
impl<'de> Deserialize<'de> for AgentStateSnapshot
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentStateSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<AgentStateSnapshot, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Serialize for AgentStateSnapshot
impl Serialize for AgentStateSnapshot
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations§
impl Freeze for AgentStateSnapshot
impl RefUnwindSafe for AgentStateSnapshot
impl Send for AgentStateSnapshot
impl Sync for AgentStateSnapshot
impl Unpin for AgentStateSnapshot
impl UnwindSafe for AgentStateSnapshot
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moreCreates a shared type from an unshared type.