pub struct ToolState(/* private fields */);Expand description
Thread-safe tool state handle.
Implementations§
Source§impl ToolState
impl ToolState
pub fn new(session_id: SessionId) -> Self
pub fn from_session(session: Session) -> Self
pub fn session_id(&self) -> SessionId
pub async fn session(&self) -> Session
pub async fn update_session(&self, session: Session)
pub async fn enter_plan_mode(&self, name: Option<String>) -> Plan
pub async fn current_plan(&self) -> Option<Plan>
pub async fn update_plan_content(&self, content: String)
pub async fn exit_plan_mode(&self) -> Option<Plan>
pub async fn cancel_plan(&self) -> Option<Plan>
pub async fn is_in_plan_mode(&self) -> bool
pub async fn set_todos(&self, todos: Vec<TodoItem>)
pub async fn todos(&self) -> Vec<TodoItem>
pub async fn todos_in_progress_count(&self) -> usize
pub async fn record_tool_execution(&self, exec: ToolExecution)
pub async fn with_tool_executions<F, R>(&self, f: F) -> R
pub async fn tool_executions_for_plan( &self, plan_id: Uuid, ) -> Vec<ToolExecution>
pub async fn execution_log_len(&self) -> usize
pub async fn clear_execution_log(&self)
pub async fn record_compact(&self, record: CompactRecord)
pub async fn with_compact_history<F, R>(&self, f: F) -> Rwhere
F: FnOnce(&[CompactRecord]) -> R,
pub async fn session_snapshot(&self) -> (SessionId, usize, Option<Plan>)
pub async fn execution_state(&self) -> (SessionId, bool, usize)
pub async fn record_execution_with_todos( &self, exec: ToolExecution, todos: Option<Vec<TodoItem>>, )
pub async fn enqueue( &self, content: impl Into<String>, ) -> Result<Uuid, QueueError>
pub async fn dequeue_or_merge(&self) -> Option<MergedInput>
pub async fn pending_count(&self) -> usize
pub async fn cancel_pending(&self, id: Uuid) -> bool
pub async fn cancel_all_pending(&self) -> usize
pub fn is_executing(&self) -> bool
pub async fn acquire_execution(&self) -> ExecutionGuard<'_>
pub fn try_acquire_execution(&self) -> Option<ExecutionGuard<'_>>
pub async fn with_session<F, R>(&self, f: F) -> R
pub async fn with_session_mut<F, R>(&self, f: F) -> R
pub async fn compact( &self, client: &Client, keep_messages: usize, ) -> Result<CompactResult>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ToolState
impl !RefUnwindSafe for ToolState
impl Send for ToolState
impl Sync for ToolState
impl Unpin for ToolState
impl !UnwindSafe for ToolState
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,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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 moreCreates a shared type from an unshared type.