Skip to main content

scv_core/
approval.rs

1//! The [`ApprovalGate`] that decides whether a tool call may run.
2
3use std::path::PathBuf;
4
5use async_trait::async_trait;
6use tokio_util::sync::CancellationToken;
7
8use crate::{AgentError, ToolRisk};
9
10#[derive(Debug, Clone)]
11pub struct ApprovalRequest {
12    pub call_id: String,
13    pub name: String,
14    pub risk: ToolRisk,
15    pub cwd: PathBuf,
16    pub summary: String,
17}
18
19#[async_trait]
20pub trait ApprovalGate: Send + Sync {
21    async fn approve(
22        &self,
23        request: ApprovalRequest,
24        cancellation: CancellationToken,
25    ) -> Result<bool, AgentError>;
26}