(&self, name: String, args: serde_json::Value)
| 3651 | /// Execute a tool by name, bypassing the LLM. |
| 3652 | #[napi] |
| 3653 | pub async fn tool(&self, name: String, args: serde_json::Value) -> napi::Result<ToolResult> { |
| 3654 | let session = self.inner.clone(); |
| 3655 | let result = get_runtime() |
| 3656 | .spawn(async move { session.tool(&name, args).await }) |
| 3657 | .await |
| 3658 | .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))? |
| 3659 | .map_err(|e| napi::Error::from_reason(format!("Tool execution failed: {e}")))?; |
| 3660 | Ok(tool_result_from_core(result)) |
| 3661 | } |
| 3662 | |
| 3663 | /// Delegate a bounded task to a child agent through the built-in `task` tool. |
| 3664 | #[napi(ts_args_type = "options: DelegateTaskOptions")] |
no test coverage detected