use crabllm_core::Tool;
use wcore::{AgentConfig, AgentEvent, ToolDispatch, ToolFuture, model::HistoryEntry};
pub trait Hook: Send + Sync {
fn schema(&self) -> Vec<Tool> {
vec![]
}
fn system_prompt(&self) -> Option<String> {
None
}
fn on_build_agent(&self, config: AgentConfig) -> AgentConfig {
config
}
fn on_before_run(
&self,
_agent: &str,
_conversation_id: u64,
_history: &[HistoryEntry],
) -> Vec<HistoryEntry> {
Vec::new()
}
fn on_event(&self, _agent: &str, _conversation_id: u64, _event: &AgentEvent) {}
fn preprocess(&self, _agent: &str, _content: &str) -> Option<String> {
None
}
fn scoped_tools(&self, _config: &AgentConfig) -> (Vec<String>, Option<String>) {
let tools = self
.schema()
.iter()
.map(|t| t.function.name.clone())
.collect();
(tools, None)
}
fn dispatch<'a>(&'a self, _name: &'a str, _call: ToolDispatch) -> Option<ToolFuture<'a>> {
None
}
}
impl Hook for () {}