use serde_json::Value;
use std::sync::Arc;
#[async_trait::async_trait]
pub trait CustomToolExecutor: Send + Sync + std::fmt::Debug {
async fn execute(&self, tool_id: &str, input: Value) -> anyhow::Result<String>;
fn clone_box(&self) -> Arc<dyn CustomToolExecutor>;
}
#[derive(Clone)]
pub struct CustomExecutorHandle {
pub inner: Arc<dyn CustomToolExecutor>,
}
impl std::fmt::Debug for CustomExecutorHandle {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("CustomExecutorHandle").finish()
}
}
impl CustomExecutorHandle {
pub fn new(exec: Arc<dyn CustomToolExecutor>) -> Self {
Self { inner: exec }
}
}