|  | 
| 1 | 1 | use crate::config_profile::ConfigProfile; | 
|  | 2 | +use crate::config_types::History; | 
|  | 3 | +use crate::config_types::McpServerConfig; | 
|  | 4 | +use crate::config_types::Tui; | 
|  | 5 | +use crate::config_types::UriBasedFileOpener; | 
| 2 | 6 | use crate::flags::OPENAI_DEFAULT_MODEL; | 
| 3 |  | -use crate::mcp_server_config::McpServerConfig; | 
| 4 | 7 | use crate::model_provider_info::ModelProviderInfo; | 
| 5 | 8 | use crate::model_provider_info::built_in_model_providers; | 
| 6 | 9 | use crate::protocol::AskForApproval; | 
| @@ -93,75 +96,6 @@ pub struct Config { | 
| 93 | 96 |     pub tui: Tui, | 
| 94 | 97 | } | 
| 95 | 98 | 
 | 
| 96 |  | -/// Settings that govern if and what will be written to `~/.codex/history.jsonl`. | 
| 97 |  | -#[derive(Deserialize, Debug, Clone, PartialEq, Default)] | 
| 98 |  | -pub struct History { | 
| 99 |  | -    /// If true, history entries will not be written to disk. | 
| 100 |  | -    pub persistence: HistoryPersistence, | 
| 101 |  | - | 
| 102 |  | -    /// If set, the maximum size of the history file in bytes. | 
| 103 |  | -    /// TODO(mbolin): Not currently honored. | 
| 104 |  | -    pub max_bytes: Option<usize>, | 
| 105 |  | -} | 
| 106 |  | - | 
| 107 |  | -#[derive(Deserialize, Debug, Copy, Clone, PartialEq, Default)] | 
| 108 |  | -#[serde(rename_all = "kebab-case")] | 
| 109 |  | -pub enum HistoryPersistence { | 
| 110 |  | -    /// Save all history entries to disk. | 
| 111 |  | -    #[default] | 
| 112 |  | -    SaveAll, | 
| 113 |  | -    /// Do not write history to disk. | 
| 114 |  | -    None, | 
| 115 |  | -} | 
| 116 |  | - | 
| 117 |  | -/// Collection of settings that are specific to the TUI. | 
| 118 |  | -#[derive(Deserialize, Debug, Clone, PartialEq, Default)] | 
| 119 |  | -pub struct Tui { | 
| 120 |  | -    /// By default, mouse capture is enabled in the TUI so that it is possible | 
| 121 |  | -    /// to scroll the conversation history with a mouse. This comes at the cost | 
| 122 |  | -    /// of not being able to use the mouse to select text in the TUI. | 
| 123 |  | -    /// (Most terminals support a modifier key to allow this. For example, | 
| 124 |  | -    /// text selection works in iTerm if you hold down the `Option` key while | 
| 125 |  | -    /// clicking and dragging.) | 
| 126 |  | -    /// | 
| 127 |  | -    /// Setting this option to `true` disables mouse capture, so scrolling with | 
| 128 |  | -    /// the mouse is not possible, though the keyboard shortcuts e.g. `b` and | 
| 129 |  | -    /// `space` still work. This allows the user to select text in the TUI | 
| 130 |  | -    /// using the mouse without needing to hold down a modifier key. | 
| 131 |  | -    pub disable_mouse_capture: bool, | 
| 132 |  | -} | 
| 133 |  | - | 
| 134 |  | -#[derive(Deserialize, Debug, Copy, Clone, PartialEq)] | 
| 135 |  | -pub enum UriBasedFileOpener { | 
| 136 |  | -    #[serde(rename = "vscode")] | 
| 137 |  | -    VsCode, | 
| 138 |  | - | 
| 139 |  | -    #[serde(rename = "vscode-insiders")] | 
| 140 |  | -    VsCodeInsiders, | 
| 141 |  | - | 
| 142 |  | -    #[serde(rename = "windsurf")] | 
| 143 |  | -    Windsurf, | 
| 144 |  | - | 
| 145 |  | -    #[serde(rename = "cursor")] | 
| 146 |  | -    Cursor, | 
| 147 |  | - | 
| 148 |  | -    /// Option to disable the URI-based file opener. | 
| 149 |  | -    #[serde(rename = "none")] | 
| 150 |  | -    None, | 
| 151 |  | -} | 
| 152 |  | - | 
| 153 |  | -impl UriBasedFileOpener { | 
| 154 |  | -    pub fn get_scheme(&self) -> Option<&str> { | 
| 155 |  | -        match self { | 
| 156 |  | -            UriBasedFileOpener::VsCode => Some("vscode"), | 
| 157 |  | -            UriBasedFileOpener::VsCodeInsiders => Some("vscode-insiders"), | 
| 158 |  | -            UriBasedFileOpener::Windsurf => Some("windsurf"), | 
| 159 |  | -            UriBasedFileOpener::Cursor => Some("cursor"), | 
| 160 |  | -            UriBasedFileOpener::None => None, | 
| 161 |  | -        } | 
| 162 |  | -    } | 
| 163 |  | -} | 
| 164 |  | - | 
| 165 | 99 | /// Base config deserialized from ~/.codex/config.toml. | 
| 166 | 100 | #[derive(Deserialize, Debug, Clone, Default)] | 
| 167 | 101 | pub struct ConfigToml { | 
| @@ -523,6 +457,8 @@ pub fn parse_sandbox_permission_with_base_path( | 
| 523 | 457 | #[cfg(test)] | 
| 524 | 458 | mod tests { | 
| 525 | 459 |     #![allow(clippy::expect_used, clippy::unwrap_used)] | 
|  | 460 | +    use crate::config_types::HistoryPersistence; | 
|  | 461 | + | 
| 526 | 462 |     use super::*; | 
| 527 | 463 |     use pretty_assertions::assert_eq; | 
| 528 | 464 |     use tempfile::TempDir; | 
|  | 
0 commit comments