use crate::types::agent_state::AgentState;
use crate::types::message::MessageRole;
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum InjectionPoint {
SystemPrompt,
BeforeNextLlmCall,
RecencyZone,
AppendToToolResult {
tool_name: String,
},
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum HintPriority {
Low,
Normal,
Critical,
}
#[derive(Debug, Clone)]
pub struct HintMessage {
pub role: MessageRole,
pub content: String,
pub priority: HintPriority,
}
pub trait Hint: Send + Sync + 'static {
fn name(&self) -> &'static str;
fn should_trigger(&self, state: &AgentState) -> bool;
fn generate(&self, state: &AgentState) -> HintMessage;
fn injection_point(&self) -> InjectionPoint;
}
pub struct NoopHint;
impl Hint for NoopHint {
fn name(&self) -> &'static str {
"noop"
}
fn should_trigger(&self, _state: &AgentState) -> bool {
false
}
fn generate(&self, _state: &AgentState) -> HintMessage {
HintMessage {
role: MessageRole::System,
content: String::new(),
priority: HintPriority::Low,
}
}
fn injection_point(&self) -> InjectionPoint {
InjectionPoint::BeforeNextLlmCall
}
}
#[cfg(test)]
mod tests {
use super::*;
use crate::types::agent_state::AgentState;
use crate::types::model_info::ModelTier;
#[test]
fn test_noop_hint_never_triggers() {
let hint = NoopHint;
let state = AgentState::new(ModelTier::Small, 4096);
assert!(
!hint.should_trigger(&state),
"NoopHint should never trigger"
);
}
#[test]
fn test_noop_hint_generates_empty_message() {
let hint = NoopHint;
let state = AgentState::new(ModelTier::Small, 4096);
let msg = hint.generate(&state);
assert!(msg.content.is_empty());
assert_eq!(msg.priority, HintPriority::Low);
}
#[test]
fn test_noop_hint_injection_point() {
let hint = NoopHint;
assert_eq!(hint.injection_point(), InjectionPoint::BeforeNextLlmCall);
}
#[test]
fn test_noop_hint_name() {
let hint = NoopHint;
assert_eq!(hint.name(), "noop");
}
}