use async_trait::async_trait;
use serde_json::Value;
#[derive(Debug)]
pub enum HookOutcome {
Allow,
Blocked(String),
}
#[async_trait]
pub trait HookRunner: Send + Sync {
async fn pre_tool(&self, tool_name: &str, input: &Value) -> HookOutcome;
async fn post_tool(&self, tool_name: &str, result: &str, is_error: bool);
async fn on_stop(&self, final_text: &str);
}
#[derive(Debug)]
pub struct NoopHookRunner;
#[async_trait]
impl HookRunner for NoopHookRunner {
async fn pre_tool(&self, _tool_name: &str, _input: &Value) -> HookOutcome {
HookOutcome::Allow
}
async fn post_tool(&self, _tool_name: &str, _result: &str, _is_error: bool) {}
async fn on_stop(&self, _final_text: &str) {}
}