algocline_core/observer.rs
1use crate::{ExecutionSpec, LlmQuery, QueryId};
2
3/// Observer for execution state transitions.
4///
5/// Hooks cross-cutting concerns (stats, logging) without
6/// polluting the Execution core.
7pub trait ExecutionObserver: Send + Sync {
8 fn on_started(&self, _spec: &ExecutionSpec) {}
9 /// LLM request issued (transition to Paused).
10 fn on_paused(&self, _queries: &[LlmQuery]) {}
11 /// Partial response arrived (not yet complete).
12 fn on_partial_feed(&self, _query_id: &QueryId, _remaining: usize) {}
13 /// All responses arrived, Lua resuming (transition to Running).
14 fn on_resumed(&self) {}
15 fn on_completed(&self, _result: &serde_json::Value) {}
16 fn on_failed(&self, _error: &str) {}
17 /// Host-initiated cancellation.
18 fn on_cancelled(&self) {}
19}