Skip to main content

ag_session/
setting.rs

1//! Domain model for persisted application setting keys.
2
3use std::fmt;
4
5/// Stable keys used in the `setting` and `project_setting` tables.
6#[derive(Clone, Copy, Debug, Eq, PartialEq)]
7pub enum SettingName {
8    /// Persists the active project selection.
9    ActiveProjectId,
10    /// Persists the active list tab selection.
11    ActiveTab,
12    /// Persists the provider that owns the fast-model default.
13    DefaultFastAgent,
14    /// Persists the project or global fast-model selection.
15    DefaultFastModel,
16    /// Persists the reasoning level paired with the fast-model default.
17    DefaultFastReasoningLevel,
18    /// Persists the response speed paired with the fast-model default.
19    DefaultFastSpeedMode,
20    /// Persists the provider that owns the review-model default.
21    DefaultReviewAgent,
22    /// Persists the project or global review-model selection.
23    DefaultReviewModel,
24    /// Persists the reasoning level paired with the review-model default.
25    DefaultReviewReasoningLevel,
26    /// Persists the response speed paired with the review-model default.
27    DefaultReviewSpeedMode,
28    /// Persists the default response style for newly created sessions.
29    DefaultResponseStyle,
30    /// Persists the provider that owns the smart-model default.
31    DefaultSmartAgent,
32    /// Persists the project or global smart-model selection.
33    DefaultSmartModel,
34    /// Persists the reasoning level paired with the smart-model default.
35    DefaultSmartReasoningLevel,
36    /// Persists the response speed paired with the smart-model default.
37    DefaultSmartSpeedMode,
38    /// Persists whether generated session commits append the Agentty coauthor
39    /// trailer.
40    IncludeCoauthoredByAgentty,
41    /// Persists the configured launch-configuration override.
42    LaunchConfiguration,
43    /// Persists whether the last used model should become the default.
44    LastUsedModelAsDefault,
45    /// Distinguishes registered projects from non-repository launch contexts.
46    ProjectCatalogVisible,
47    /// Records dismissal of the one-time project discovery suggestion.
48    ProjectDiscoveryPromptSeen,
49    /// Persists the random installation ID attached to telemetry events.
50    TelemetryInstallationId,
51    /// Persists the active terminal color theme.
52    Theme,
53}
54
55impl SettingName {
56    /// Returns the persisted key string for one setting.
57    pub fn as_str(self) -> &'static str {
58        match self {
59            Self::ActiveProjectId => "ActiveProjectId",
60            Self::ActiveTab => "ActiveTab",
61            Self::DefaultFastAgent => "DefaultFastAgent",
62            Self::DefaultFastModel => "DefaultFastModel",
63            Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
64            Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
65            Self::DefaultReviewAgent => "DefaultReviewAgent",
66            Self::DefaultReviewModel => "DefaultReviewModel",
67            Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
68            Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
69            Self::DefaultResponseStyle => "DefaultResponseStyle",
70            Self::DefaultSmartAgent => "DefaultSmartAgent",
71            Self::DefaultSmartModel => "DefaultSmartModel",
72            Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
73            Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
74            Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
75            Self::LaunchConfiguration => "LaunchConfiguration",
76            Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
77            Self::ProjectCatalogVisible => "ProjectCatalogVisible",
78            Self::ProjectDiscoveryPromptSeen => "ProjectDiscoveryPromptSeen",
79            Self::TelemetryInstallationId => "TelemetryInstallationId",
80            Self::Theme => "Theme",
81        }
82    }
83}
84
85impl fmt::Display for SettingName {
86    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
87        formatter.write_str(self.as_str())
88    }
89}
90
91#[cfg(test)]
92#[path = "setting_test.rs"]
93mod tests;