(&self, tool_name: &str)
| 140 | } |
| 141 | |
| 142 | async fn confirmation_decision(&self, tool_name: &str) -> ToolGateDecision { |
| 143 | let Some(cm) = &self.config.confirmation_manager else { |
| 144 | let msg = format!( |
| 145 | "Tool '{}' requires confirmation but no HITL confirmation manager is configured. \ |
| 146 | Configure a confirmation policy to enable tool execution.", |
| 147 | tool_name |
| 148 | ); |
| 149 | return ToolGateDecision::Deny { |
| 150 | output: msg.clone(), |
| 151 | event_reason: msg, |
| 152 | reason: ToolGateDenial::MissingConfirmationManager, |
| 153 | }; |
| 154 | }; |
| 155 | |
| 156 | if !cm.requires_confirmation(tool_name).await { |
| 157 | return ToolGateDecision::Execute { |
| 158 | reason: ToolGateApproval::ConfirmationNotRequired, |
| 159 | }; |
| 160 | } |
| 161 | |
| 162 | let policy = cm.policy().await; |
| 163 | ToolGateDecision::Confirm { |
| 164 | timeout_ms: policy.default_timeout_ms, |
| 165 | timeout_action: policy.timeout_action, |
| 166 | } |
| 167 | } |
| 168 | } |
| 169 | |
| 170 | #[cfg(test)] |
no test coverage detected