Skip to main content

ainl_runtime/
hooks.rs

1//! Integration seam for hosts (e.g. OpenFang) — all methods default to no-ops.
2
3use uuid::Uuid;
4
5use crate::engine::{MemoryContext, TurnOutput};
6use ainl_graph_extractor::ExtractionReport;
7
8/// Hooks for observability and host wiring. Every method has a default empty body.
9pub trait TurnHooks: Send + Sync {
10    fn on_artifact_loaded(&self, _agent_id: &str, _node_count: usize) {}
11    fn on_persona_compiled(&self, _contribution: Option<&str>) {}
12    fn on_memory_context_ready(&self, _ctx: &MemoryContext) {}
13    fn on_episode_recorded(&self, _episode_id: Uuid) {}
14    fn on_patch_dispatched(&self, _label: &str, _fitness: f32) {}
15    fn on_extraction_complete(&self, _report: &ExtractionReport) {}
16    fn on_emit(&self, _target: &str, _payload: &serde_json::Value) {}
17    fn on_turn_complete(&self, _output: &TurnOutput) {}
18}
19
20/// Default hook implementation (no side effects).
21pub struct NoOpHooks;
22
23impl TurnHooks for NoOpHooks {}