vtcode_core/core/agent/
steering.rs1use serde::{Deserialize, Serialize};
2use std::fmt;
3use uuid::Uuid;
4
5pub const MAX_QUEUED_FOLLOW_UP_INTENTS: usize = 64;
10pub const MAX_OVERFLOW_FOLLOW_UP_INTENTS: usize = 64;
14pub const MAX_APPLIED_FOLLOW_UP_INTENT_IDS: usize = 64;
16
17#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
19#[serde(rename_all = "snake_case")]
20pub enum FollowUpProvenance {
21 #[default]
23 UserInput,
24 Synthetic,
26}
27
28#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
31pub struct QueuedFollowUpIntent {
32 id: String,
33 text: String,
34 #[serde(default)]
36 provenance: FollowUpProvenance,
37}
38
39impl QueuedFollowUpIntent {
40 #[must_use]
42 pub fn new(text: String) -> Self {
43 Self::new_with_provenance(text, FollowUpProvenance::UserInput)
44 }
45
46 #[must_use]
48 pub fn new_with_provenance(text: String, provenance: FollowUpProvenance) -> Self {
49 Self { id: Uuid::new_v4().to_string(), text, provenance }
50 }
51
52 pub fn from_parts(id: impl Into<String>, text: impl Into<String>) -> Self {
54 Self::from_parts_with_provenance(id, text, FollowUpProvenance::UserInput)
55 }
56
57 pub fn from_parts_with_provenance(
59 id: impl Into<String>,
60 text: impl Into<String>,
61 provenance: FollowUpProvenance,
62 ) -> Self {
63 Self { id: id.into(), text: text.into(), provenance }
64 }
65
66 #[must_use]
67 pub fn id(&self) -> &str {
68 &self.id
69 }
70
71 #[must_use]
72 pub fn text(&self) -> &str {
73 &self.text
74 }
75
76 #[must_use]
77 pub const fn provenance(&self) -> FollowUpProvenance {
78 self.provenance
79 }
80
81 #[must_use]
83 pub fn into_parts(self) -> (String, String) {
84 (self.id, self.text)
85 }
86
87 #[must_use]
89 pub fn into_parts_with_provenance(self) -> (String, String, FollowUpProvenance) {
90 (self.id, self.text, self.provenance)
91 }
92}
93
94#[derive(Debug, Clone, PartialEq, Eq)]
96pub struct FollowUpQueueFull {
97 pub capacity: usize,
98}
99
100impl fmt::Display for FollowUpQueueFull {
101 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
102 write!(f, "follow-up intent queue is full (capacity {})", self.capacity)
103 }
104}
105
106impl std::error::Error for FollowUpQueueFull {}
107
108#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
110pub enum SteeringMessage {
111 SteerStop,
113 Pause,
115 Resume,
117 FollowUpInput(String),
121}