Skip to main content

vtcode_ui/tui/config/
types.rs

1//! Re-exports of shared configuration types from their canonical definitions,
2//! plus locally-defined types that need to satisfy Rust's orphan rule for
3//! trait implementations.
4
5use serde::{Deserialize, Serialize};
6use std::fmt;
7
8// Re-export from canonical sources.
9pub use vtcode_commons::reasoning::ReasoningEffortLevel;
10pub use vtcode_config::types::{SystemPromptMode, ToolDocumentationMode, VerbosityLevel};
11
12/// UI surface preference for rendering.
13///
14/// Kept as a local definition (rather than re-exported from vtcode-config)
15/// because `vtcode-ui` implements `From<SessionSurface>` and
16/// `From<UiSurfacePreference> for SessionSurface`, which require a local type.
17#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
18#[serde(rename_all = "lowercase")]
19pub enum UiSurfacePreference {
20    Auto,
21    Alternate,
22    #[default]
23    Inline,
24}
25
26impl UiSurfacePreference {
27    const fn as_str(self) -> &'static str {
28        match self {
29            Self::Auto => "auto",
30            Self::Alternate => "alternate",
31            Self::Inline => "inline",
32        }
33    }
34}
35
36impl fmt::Display for UiSurfacePreference {
37    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
38        f.write_str(self.as_str())
39    }
40}