pub struct TurnObserver { /* private fields */ }Expand description
Captures observations during agent turns.
Implementations§
Source§impl TurnObserver
impl TurnObserver
Sourcepub fn find_marker(text: &str, markers: &[&str]) -> Option<usize>
pub fn find_marker(text: &str, markers: &[&str]) -> Option<usize>
Find the byte offset of the first matching marker phrase in text.
Searches case-insensitively. Returns Some(byte_offset) of the match
start, or None if no marker is found.
Sourcepub fn capture_window(
text: &str,
marker_pos: usize,
window_bytes: usize,
) -> String
pub fn capture_window( text: &str, marker_pos: usize, window_bytes: usize, ) -> String
Extract a context window centered on marker_pos.
Returns approximately window_bytes / 2 bytes before and after the
marker, with the marker phrase centered. Respects UTF-8 char boundaries.
Sourcepub fn truncate_context(context: String, max_bytes: usize) -> String
👎Deprecated since 0.2.0: Use find_marker + capture_window instead. This function keeps the head of the string, losing the actual signal.
pub fn truncate_context(context: String, max_bytes: usize) -> String
Use find_marker + capture_window instead. This function keeps the head of the string, losing the actual signal.
Truncate context to fit max_bytes, appending a marker if truncated.
Sourcepub fn start_turn(&mut self)
pub fn start_turn(&mut self)
Start a new turn.
Sourcepub fn record_correction(&mut self, context: String, intensity: f64)
pub fn record_correction(&mut self, context: String, intensity: f64)
Record a correction signal.
Sourcepub fn record_error(&mut self, context: String, intensity: f64)
pub fn record_error(&mut self, context: String, intensity: f64)
Record an error signal.
Sourcepub fn record_satisfaction(&mut self, context: String, intensity: f64)
pub fn record_satisfaction(&mut self, context: String, intensity: f64)
Record a satisfaction signal.
Sourcepub fn record_inefficiency(&mut self, context: String, intensity: f64)
pub fn record_inefficiency(&mut self, context: String, intensity: f64)
Record an inefficiency signal.
Sourcepub fn current_observations(&self) -> &[Observation]
pub fn current_observations(&self) -> &[Observation]
Get all observations for the current turn.
Sourcepub fn turn_number(&self) -> u32
pub fn turn_number(&self) -> u32
Get the current turn number.
Sourcepub fn session_id(&self) -> Option<&str>
pub fn session_id(&self) -> Option<&str>
Get the session ID.
Sourcepub fn drain_observations(&mut self) -> Vec<Observation>
pub fn drain_observations(&mut self) -> Vec<Observation>
Drain observations from the current turn.