pub struct ToolApprovals { /* private fields */ }Expand description
The session’s approval gate as seen by one running tool call. A tool that drives a nested agent (such as another SCV) asks it on the nested agent’s behalf, so the session’s policy and its user decide every nested side effect too. Without a gate, every request is denied.
Implementations§
Source§impl ToolApprovals
impl ToolApprovals
Sourcepub fn new(gate: Arc<dyn ApprovalGate>, call_id: impl Into<String>) -> Self
pub fn new(gate: Arc<dyn ApprovalGate>, call_id: impl Into<String>) -> Self
Requests for the tool call call_id, decided by gate.
Sourcepub async fn request(
&self,
name: impl Into<String>,
risk: ToolRisk,
cwd: PathBuf,
summary: impl Into<String>,
cancellation: CancellationToken,
) -> Result<bool, AgentError>
pub async fn request( &self, name: impl Into<String>, risk: ToolRisk, cwd: PathBuf, summary: impl Into<String>, cancellation: CancellationToken, ) -> Result<bool, AgentError>
Ask the session’s gate to approve a nested agent’s tool call. The
request carries this tool call’s ID; name, risk, and summary
describe the nested call.
Sourcepub async fn request_until(
&self,
name: impl Into<String>,
risk: ToolRisk,
cwd: PathBuf,
summary: impl Into<String>,
cancellation: CancellationToken,
deadline: Option<Instant>,
) -> Result<bool, AgentError>
pub async fn request_until( &self, name: impl Into<String>, risk: ToolRisk, cwd: PathBuf, summary: impl Into<String>, cancellation: CancellationToken, deadline: Option<Instant>, ) -> Result<bool, AgentError>
request, giving up at deadline when there is
one. Then cancellation is cancelled, the gate gets up to a second
to withdraw the request it is showing, and the result is
AgentError::ToolLimit. Cancellation itself is the gate’s to
observe, so it always cleans up after itself.
Trait Implementations§
Source§impl Clone for ToolApprovals
impl Clone for ToolApprovals
Source§impl Debug for ToolApprovals
impl Debug for ToolApprovals
Auto Trait Implementations§
impl !RefUnwindSafe for ToolApprovals
impl !UnwindSafe for ToolApprovals
impl Freeze for ToolApprovals
impl Send for ToolApprovals
impl Sync for ToolApprovals
impl Unpin for ToolApprovals
impl UnsafeUnpin for ToolApprovals
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