Skip to main content

codetether_agent/tui/app/state/
steering.rs

1//! Steering queue methods.
2//!
3//! Steering messages are queued guidance injected into the next LLM turn.
4
5impl super::AppState {
6    pub fn queue_steering(&mut self, value: impl Into<String>) {
7        let trimmed = value.into().trim().to_string();
8        if !trimmed.is_empty() {
9            self.queued_steering.push(trimmed);
10        }
11    }
12
13    pub fn clear_steering(&mut self) {
14        self.queued_steering.clear();
15    }
16
17    pub fn steering_count(&self) -> usize {
18        self.queued_steering.len()
19    }
20
21    pub fn steering_prompt_prefix(&self) -> Option<String> {
22        if self.queued_steering.is_empty() {
23            return None;
24        }
25        let items = self
26            .queued_steering
27            .iter()
28            .enumerate()
29            .map(|(idx, item)| format!("{}. {item}", idx + 1))
30            .collect::<Vec<_>>()
31            .join("\n");
32        Some(format!(
33            "[Queued steering for this turn]\nApply the following guidance while answering:\n{items}\n"
34        ))
35    }
36}