use std::any::Any;
use async_trait::async_trait;
use downcast_rs::{Downcast, impl_downcast};
use fkl_mir::{ContextMap, CustomEnv};
pub struct Argument {
pub name: String,
pub value: String,
}
#[async_trait]
pub trait CustomRunner: Downcast + Any + Send + Sync {
fn name(&self) -> &str {
std::any::type_name::<Self>()
}
async fn execute(&self, context: &ContextMap, env: &CustomEnv);
async fn send_command(&self, _command: &str, _args: &[Argument]) -> Option<String> {
None
}
fn list_commands(&self) -> Vec<String> {
Vec::new()
}
}
impl_downcast!(CustomRunner);
pub type CreateRunner = unsafe fn() -> *mut dyn CustomRunner;