#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum NegativeSignal {
ToolError,
ToolTimeout,
RepeatedToolCall,
LowConfidence,
}
pub struct SignalVoter {
signals: Vec<NegativeSignal>,
threshold: usize,
}
impl SignalVoter {
pub fn new(threshold: usize) -> Self {
Self {
signals: Vec::new(),
threshold,
}
}
pub fn vote(&mut self, signal: NegativeSignal) -> bool {
self.signals.push(signal);
self.signals.len() >= self.threshold
}
pub fn signal_count(&self) -> usize {
self.signals.len()
}
pub fn reset(&mut self) {
self.signals.clear();
}
}
impl Default for SignalVoter {
fn default() -> Self {
Self::new(5)
}
}