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_PENDING_FOLLOW_UP_INTENTS: usize = MAX_QUEUED_FOLLOW_UP_INTENTS + MAX_OVERFLOW_FOLLOW_UP_INTENTS + 1;
18pub const MAX_APPLIED_FOLLOW_UP_INTENT_IDS: usize = 64;
20
21#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize)]
23#[serde(rename_all = "snake_case")]
24pub enum FollowUpProvenance {
25 #[default]
27 UserInput,
28 Synthetic,
30}
31
32#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
35pub struct QueuedFollowUpIntent {
36 id: String,
37 text: String,
38 #[serde(default)]
40 provenance: FollowUpProvenance,
41}
42
43impl QueuedFollowUpIntent {
44 #[must_use]
46 pub fn new(text: String) -> Self {
47 Self::new_with_provenance(text, FollowUpProvenance::UserInput)
48 }
49
50 #[must_use]
52 pub fn new_with_provenance(text: String, provenance: FollowUpProvenance) -> Self {
53 Self { id: Uuid::new_v4().to_string(), text, provenance }
54 }
55
56 pub fn from_parts(id: impl Into<String>, text: impl Into<String>) -> Self {
58 Self::from_parts_with_provenance(id, text, FollowUpProvenance::UserInput)
59 }
60
61 pub fn from_parts_with_provenance(
63 id: impl Into<String>,
64 text: impl Into<String>,
65 provenance: FollowUpProvenance,
66 ) -> Self {
67 Self { id: id.into(), text: text.into(), provenance }
68 }
69
70 #[must_use]
71 pub fn id(&self) -> &str {
72 &self.id
73 }
74
75 #[must_use]
76 pub fn text(&self) -> &str {
77 &self.text
78 }
79
80 #[must_use]
81 pub const fn provenance(&self) -> FollowUpProvenance {
82 self.provenance
83 }
84
85 #[must_use]
87 pub fn into_parts(self) -> (String, String) {
88 (self.id, self.text)
89 }
90
91 #[must_use]
93 pub fn into_parts_with_provenance(self) -> (String, String, FollowUpProvenance) {
94 (self.id, self.text, self.provenance)
95 }
96}
97
98#[derive(Debug, Clone, PartialEq, Eq)]
100pub struct FollowUpQueueFull {
101 pub capacity: usize,
102}
103
104impl fmt::Display for FollowUpQueueFull {
105 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
106 write!(f, "follow-up intent queue is full (capacity {})", self.capacity)
107 }
108}
109
110impl std::error::Error for FollowUpQueueFull {}
111
112#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
114pub enum SteeringMessage {
115 SteerStop,
117 Pause,
119 Resume,
121 FollowUpInput(String),
125}