use std::sync::Arc;
use serde_json::Value;
use tokio_util::sync::CancellationToken;
use crate::interface::tool::Tool;
use crate::interface::tool_middleware::ToolOutcome;
use crate::permission::PermissionRule;
#[async_trait::async_trait]
pub trait HostToolRunner: Send + Sync {
async fn run(
&self,
tool: Arc<dyn Tool>,
input: Value,
limits: HostCallLimits,
cancel: CancellationToken,
) -> HostCallOutcome;
fn tool(&self, name: &str) -> Option<Arc<dyn Tool>>;
}
#[derive(Debug, Clone, Default, PartialEq)]
pub struct HostCallLimits {
pub rules: Vec<PermissionRule>,
pub cut_network: bool,
}
#[derive(Debug, Clone, PartialEq)]
pub struct HostCallOutcome {
pub outcome: ToolOutcome,
pub by_middleware: bool,
pub stopped: bool,
}