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 whether completed turns automatically address focused-review
13    /// suggestions for a project.
14    AutoAddressReviewComments,
15    /// Persists the provider that owns the fast-model default.
16    DefaultFastAgent,
17    /// Persists the project or global fast-model selection.
18    DefaultFastModel,
19    /// Persists the harness model last chosen through `/model`, which new
20    /// Harness sessions start on.
21    DefaultHarnessModel,
22    /// Persists the reasoning level paired with the fast-model default.
23    DefaultFastReasoningLevel,
24    /// Persists the response speed paired with the fast-model default.
25    DefaultFastSpeedMode,
26    /// Persists the provider that owns the review-model default.
27    DefaultReviewAgent,
28    /// Persists the project or global review-model selection.
29    DefaultReviewModel,
30    /// Persists the reasoning level paired with the review-model default.
31    DefaultReviewReasoningLevel,
32    /// Persists the response speed paired with the review-model default.
33    DefaultReviewSpeedMode,
34    /// Persists the default response style for newly created sessions.
35    DefaultResponseStyle,
36    /// Persists the provider that owns the smart-model default.
37    DefaultSmartAgent,
38    /// Persists the project or global smart-model selection.
39    DefaultSmartModel,
40    /// Persists the reasoning level paired with the smart-model default.
41    DefaultSmartReasoningLevel,
42    /// Persists the response speed paired with the smart-model default.
43    DefaultSmartSpeedMode,
44    /// Persists whether generated session commits append the Agentty coauthor
45    /// trailer.
46    IncludeCoauthoredByAgentty,
47    /// Persists the configured launch-configuration override.
48    LaunchConfiguration,
49    /// Persists whether the last used model should become the default.
50    LastUsedModelAsDefault,
51    /// Persists the global cap on concurrent provider-native subagents that
52    /// each harness turn may run.
53    MaxConcurrentSubagents,
54    /// Persists the Agentty Platform sign-in: the access token together with
55    /// the platform that issued it. Empty while signed out.
56    PlatformSignIn,
57    /// Distinguishes registered projects from non-repository launch contexts.
58    ProjectCatalogVisible,
59    /// Records dismissal of the one-time project discovery suggestion.
60    ProjectDiscoveryPromptSeen,
61    /// Persists the long-term key that identifies this installation to remote
62    /// devices paired through a relay. Replacing it unpairs those devices.
63    RemoteInstanceKey,
64    /// Persists whether a project's sandboxed harness sessions use the
65    /// host's own dependency caches instead of per-session copies.
66    ShareHostCaches,
67    /// Persists the random installation ID attached to telemetry events.
68    TelemetryInstallationId,
69    /// Persists the active terminal color theme.
70    Theme,
71}
72
73impl SettingName {
74    /// Returns the persisted key string for one setting.
75    pub fn as_str(self) -> &'static str {
76        match self {
77            Self::ActiveProjectId => "ActiveProjectId",
78            Self::ActiveTab => "ActiveTab",
79            Self::AutoAddressReviewComments => "AutoAddressReviewComments",
80            Self::DefaultFastAgent => "DefaultFastAgent",
81            Self::DefaultFastModel => "DefaultFastModel",
82            Self::DefaultHarnessModel => "DefaultHarnessModel",
83            Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
84            Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
85            Self::DefaultReviewAgent => "DefaultReviewAgent",
86            Self::DefaultReviewModel => "DefaultReviewModel",
87            Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
88            Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
89            Self::DefaultResponseStyle => "DefaultResponseStyle",
90            Self::DefaultSmartAgent => "DefaultSmartAgent",
91            Self::DefaultSmartModel => "DefaultSmartModel",
92            Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
93            Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
94            Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
95            Self::LaunchConfiguration => "LaunchConfiguration",
96            Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
97            Self::MaxConcurrentSubagents => "MaxConcurrentSubagents",
98            Self::PlatformSignIn => "PlatformSignIn",
99            Self::ProjectCatalogVisible => "ProjectCatalogVisible",
100            Self::ProjectDiscoveryPromptSeen => "ProjectDiscoveryPromptSeen",
101            Self::RemoteInstanceKey => "RemoteInstanceKey",
102            Self::ShareHostCaches => "ShareHostCaches",
103            Self::TelemetryInstallationId => "TelemetryInstallationId",
104            Self::Theme => "Theme",
105        }
106    }
107}
108
109impl fmt::Display for SettingName {
110    fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
111        formatter.write_str(self.as_str())
112    }
113}
114
115#[cfg(test)]
116#[path = "setting_test.rs"]
117mod tests;