pub struct ToolConfirmationManager { /* private fields */ }Expand description
A registry for in-flight tool confirmations.
This is intentionally small and simple: it supports approve/deny once. (Session/always remember decisions can be layered on later.)
Implementations§
Source§impl ToolConfirmationManager
impl ToolConfirmationManager
Sourcepub fn register(
&self,
confirmation_id: String,
session_id: Option<String>,
tool_name: String,
tool_args: String,
) -> Receiver<ToolConfirmationDecision>
pub fn register( &self, confirmation_id: String, session_id: Option<String>, tool_name: String, tool_args: String, ) -> Receiver<ToolConfirmationDecision>
Register a new confirmation request and return a receiver for the decision.
If a confirmation with the same id already exists, it is replaced.
Sourcepub fn resolve(
&self,
confirmation_id: &str,
session_id: Option<&str>,
approved: bool,
) -> Result<(), String>
pub fn resolve( &self, confirmation_id: &str, session_id: Option<&str>, approved: bool, ) -> Result<(), String>
Resolve a pending confirmation.
Returns an error if the confirmation id is unknown, or if a session id is required and does not match.
Sourcepub fn resolve_decision(
&self,
confirmation_id: &str,
session_id: Option<&str>,
decision: ToolConfirmationDecision,
) -> Result<(), String>
pub fn resolve_decision( &self, confirmation_id: &str, session_id: Option<&str>, decision: ToolConfirmationDecision, ) -> Result<(), String>
Resolve a pending confirmation with a scoped decision.
Returns an error if the confirmation id is unknown, or if a session id is required and does not match.
Sourcepub fn apply_session_policy_decision(
&self,
session_id: &str,
tool_name: &str,
decision: ToolConfirmationDecision,
)
pub fn apply_session_policy_decision( &self, session_id: &str, tool_name: &str, decision: ToolConfirmationDecision, )
Apply a scoped decision to session-level tool policy caches.
This enables “Allow for session” and “Deny for session” semantics to be respected by the pipeline when processing later tool calls.
Sourcepub fn is_tool_allowed_for_session(
&self,
session_id: &str,
tool_name: &str,
) -> bool
pub fn is_tool_allowed_for_session( &self, session_id: &str, tool_name: &str, ) -> bool
Return true if the tool has been allowed for this session.
Sourcepub fn is_tool_blocked_for_session(
&self,
session_id: &str,
tool_name: &str,
) -> bool
pub fn is_tool_blocked_for_session( &self, session_id: &str, tool_name: &str, ) -> bool
Return true if the tool has been blocked for this session.
Sourcepub fn abandon(&self, confirmation_id: &str)
pub fn abandon(&self, confirmation_id: &str)
Remove a pending confirmation without resolving it.
This is useful on timeout/cancel to avoid leaking entries.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Return the number of currently pending confirmations.
Trait Implementations§
Source§impl Debug for ToolConfirmationManager
impl Debug for ToolConfirmationManager
Source§impl Default for ToolConfirmationManager
impl Default for ToolConfirmationManager
Source§fn default() -> ToolConfirmationManager
fn default() -> ToolConfirmationManager
Auto Trait Implementations§
impl !Freeze for ToolConfirmationManager
impl RefUnwindSafe for ToolConfirmationManager
impl Send for ToolConfirmationManager
impl Sync for ToolConfirmationManager
impl Unpin for ToolConfirmationManager
impl UnwindSafe for ToolConfirmationManager
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<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§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>
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§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().