pub struct ConfirmationManager { /* private fields */ }Expand description
Manages confirmation requests for a session
Implementations§
Source§impl ConfirmationManager
impl ConfirmationManager
Sourcepub fn new(policy: ConfirmationPolicy, event_tx: Sender<AgentEvent>) -> Self
pub fn new(policy: ConfirmationPolicy, event_tx: Sender<AgentEvent>) -> Self
Create a new confirmation manager
Sourcepub async fn policy(&self) -> ConfirmationPolicy
pub async fn policy(&self) -> ConfirmationPolicy
Get the current policy
Sourcepub async fn set_policy(&self, policy: ConfirmationPolicy)
pub async fn set_policy(&self, policy: ConfirmationPolicy)
Update the confirmation policy
Sourcepub async fn requires_confirmation(&self, tool_name: &str) -> bool
pub async fn requires_confirmation(&self, tool_name: &str) -> bool
Check if a tool requires confirmation
Sourcepub async fn request_confirmation(
&self,
tool_id: &str,
tool_name: &str,
args: &Value,
) -> Receiver<ConfirmationResponse>
pub async fn request_confirmation( &self, tool_id: &str, tool_name: &str, args: &Value, ) -> Receiver<ConfirmationResponse>
Request confirmation for a tool execution
Returns a receiver that will receive the confirmation response. Emits a ConfirmationRequired event.
Sourcepub async fn confirm(
&self,
tool_id: &str,
approved: bool,
reason: Option<String>,
) -> Result<bool, String>
pub async fn confirm( &self, tool_id: &str, approved: bool, reason: Option<String>, ) -> Result<bool, String>
Handle a confirmation response from the user
Returns Ok(true) if the confirmation was found and processed, Ok(false) if no pending confirmation was found.
Sourcepub async fn check_timeouts(&self) -> usize
pub async fn check_timeouts(&self) -> usize
Check for and handle timed out confirmations
Returns the number of confirmations that timed out.
Sourcepub async fn pending_count(&self) -> usize
pub async fn pending_count(&self) -> usize
Get the number of pending confirmations
Sourcepub async fn pending_confirmations(&self) -> Vec<(String, String, u64)>
pub async fn pending_confirmations(&self) -> Vec<(String, String, u64)>
Get pending confirmation details (for debugging/status)
Sourcepub async fn cancel_all(&self) -> usize
pub async fn cancel_all(&self) -> usize
Cancel all pending confirmations
Auto Trait Implementations§
impl !Freeze for ConfirmationManager
impl !RefUnwindSafe for ConfirmationManager
impl Send for ConfirmationManager
impl Sync for ConfirmationManager
impl Unpin for ConfirmationManager
impl UnsafeUnpin for ConfirmationManager
impl !UnwindSafe for ConfirmationManager
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