(
&self,
tool_name: &str,
args: &Value,
session_id: Option<&str>,
event_tx: &Option<mpsc::Sender<AgentEvent>>,
)
| 34 | } |
| 35 | |
| 36 | pub(super) async fn execute_delegated_plan_tool( |
| 37 | &self, |
| 38 | tool_name: &str, |
| 39 | args: &Value, |
| 40 | session_id: Option<&str>, |
| 41 | event_tx: &Option<mpsc::Sender<AgentEvent>>, |
| 42 | ) -> (String, i32, bool, Option<Value>) { |
| 43 | let call_id = format!("plan-{}-{}", tool_name, uuid::Uuid::new_v4()); |
| 44 | if let Some(tx) = event_tx { |
| 45 | tx.send(AgentEvent::ToolStart { |
| 46 | id: call_id.clone(), |
| 47 | name: tool_name.to_string(), |
| 48 | }) |
| 49 | .await |
| 50 | .ok(); |
| 51 | } |
| 52 | |
| 53 | let ctx = self.tool_context_for_plan(session_id); |
| 54 | let normalized = NormalizedToolResult::from_execution( |
| 55 | self.execute_tool_timed(tool_name, args, &ctx).await, |
| 56 | ); |
| 57 | |
| 58 | if let Some(tx) = event_tx { |
| 59 | tx.send(AgentEvent::ToolEnd { |
| 60 | id: call_id, |
| 61 | name: tool_name.to_string(), |
| 62 | output: normalized.output.clone(), |
| 63 | exit_code: normalized.exit_code, |
| 64 | metadata: normalized.metadata.clone(), |
| 65 | error_kind: normalized.error_kind.clone(), |
| 66 | }) |
| 67 | .await |
| 68 | .ok(); |
| 69 | } |
| 70 | |
| 71 | ( |
| 72 | normalized.output, |
| 73 | normalized.exit_code, |
| 74 | normalized.is_error, |
| 75 | normalized.metadata, |
| 76 | ) |
| 77 | } |
| 78 | |
| 79 | /// Execute a tool, applying the configured timeout if set. |
| 80 | /// |
no test coverage detected