Skip to main content

talos_core/
approval.rs

1//! Approval types for permission-gated tool execution.
2
3use tokio::sync::oneshot;
4
5/// User's choice when presented with an approval prompt.
6#[derive(Debug, Clone, PartialEq)]
7pub enum ApprovalChoice {
8    /// Approve this tool call once.
9    ApproveOnce,
10    /// Always approve this tool (add a rule).
11    AlwaysApprove,
12    /// Deny the tool call.
13    Deny,
14}
15
16/// Approval request sent from a TUI tool to the TUI event loop.
17///
18/// The tool sends this via an unbounded channel and awaits the response
19/// on `response`. The TUI receives the request, shows the approval overlay,
20/// and sends back the user's choice via the oneshot channel.
21pub struct TuiApprovalRequest {
22    /// Name of the tool requiring approval.
23    pub tool_name: String,
24    /// Formatted arguments for display.
25    pub arguments: String,
26    /// Channel to send the approval response back to the waiting tool.
27    pub response: oneshot::Sender<ApprovalChoice>,
28}