pub trait StateStore:
Send
+ Sync
+ Clone {
type Error: Error + Send + Sync + 'static;
// Required methods
fn get_processed_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<HashSet<String>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add_processed_message_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
message_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn set_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_active_subscriptions<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCallId>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn add_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn remove_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn add_pending_user_choice<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice: UserChoice,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ChoiceId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_pending_user_choices<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserChoice>, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn is_thread_stopped<'life0, 'life1, 'async_trait>(
&'life0 self,
_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
Key-value state store for processed message IDs, metadata, toolset caches (DynamoDB in Lambda, in-memory HashMap for CLI).
Required Associated Types§
Required Methods§
Sourcefn get_processed_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<HashSet<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_processed_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<HashSet<String>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Durably deduplicated message IDs for this thread. Only inputs that are not naturally idempotent are tracked (user text and subscription events); tool results are deduplicated against history itself.
fn add_processed_message_ids<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
message_ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Option<Value>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn set_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
root_thread_id: &'life1 ThreadId<str>,
metadata: Value,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Sourcefn get_active_subscriptions<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCallId>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_active_subscriptions<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ToolCallId>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Return the list of active subscription tool_call_ids for a specific thread.
Sourcefn add_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn add_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Record a new active subscription (tool_call_id) for a specific thread.
Sourcefn remove_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_active_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
tool_call_id: &'life2 ToolCallId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove an active subscription (tool_call_id) from a specific thread.
Sourcefn add_pending_user_choice<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice: UserChoice,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn add_pending_user_choice<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice: UserChoice,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Add or replace a pending user choice for one thread.
Sourcefn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ChoiceId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_pending_user_choice<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
choice_id: &'life2 ChoiceId<str>,
) -> Pin<Box<dyn Future<Output = Result<(), Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove a pending user choice after it is answered or interrupted.
Sourcefn get_pending_user_choices<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserChoice>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_pending_user_choices<'life0, 'life1, 'async_trait>(
&'life0 self,
thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<UserChoice>, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
List choices awaiting a response for one thread.
Provided Methods§
Sourcefn is_thread_stopped<'life0, 'life1, 'async_trait>(
&'life0 self,
_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn is_thread_stopped<'life0, 'life1, 'async_trait>(
&'life0 self,
_thread_id: &'life1 ThreadId<str>,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Whether an existing thread has been explicitly stopped.
The local router consults this before spawning a driver for input that
cannot legitimately resume a stopped thread: synthetic subscription
events and thread reports, tool results, OAuth completions, and user
choices. Returning true drops such input before a driver is spawned.
Plain user text is never gated by this method because sending new text
is how a user resumes a stopped thread.
thread_id is the target thread itself, not necessarily its root.
Implementations that track stopped state per conversation may resolve
the root themselves. Stores without stopped-thread policy inherit the
default false response.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".