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