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>,
command: Option<String>,
cancellation: CancellationToken,
) -> Result<bool, AgentError>
pub async fn request( &self, name: impl Into<String>, risk: ToolRisk, cwd: PathBuf, summary: impl Into<String>, command: Option<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, summary, and
the exact command, when the nested call runs one, describe it.
Sourcepub async fn request_until(
&self,
name: impl Into<String>,
risk: ToolRisk,
cwd: PathBuf,
summary: impl Into<String>,
command: Option<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>, command: Option<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.