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 /// Persists the global cap on concurrent provider-native subagents that
49 /// each harness turn may run.
50 MaxConcurrentSubagents,
51 /// Distinguishes registered projects from non-repository launch contexts.
52 ProjectCatalogVisible,
53 /// Records dismissal of the one-time project discovery suggestion.
54 ProjectDiscoveryPromptSeen,
55 /// Persists the random installation ID attached to telemetry events.
56 TelemetryInstallationId,
57 /// Persists the active terminal color theme.
58 Theme,
59}
60
61impl SettingName {
62 /// Returns the persisted key string for one setting.
63 pub fn as_str(self) -> &'static str {
64 match self {
65 Self::ActiveProjectId => "ActiveProjectId",
66 Self::ActiveTab => "ActiveTab",
67 Self::DefaultFastAgent => "DefaultFastAgent",
68 Self::DefaultFastModel => "DefaultFastModel",
69 Self::DefaultHarnessModel => "DefaultHarnessModel",
70 Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
71 Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
72 Self::DefaultReviewAgent => "DefaultReviewAgent",
73 Self::DefaultReviewModel => "DefaultReviewModel",
74 Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
75 Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
76 Self::DefaultResponseStyle => "DefaultResponseStyle",
77 Self::DefaultSmartAgent => "DefaultSmartAgent",
78 Self::DefaultSmartModel => "DefaultSmartModel",
79 Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
80 Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
81 Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
82 Self::LaunchConfiguration => "LaunchConfiguration",
83 Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
84 Self::MaxConcurrentSubagents => "MaxConcurrentSubagents",
85 Self::ProjectCatalogVisible => "ProjectCatalogVisible",
86 Self::ProjectDiscoveryPromptSeen => "ProjectDiscoveryPromptSeen",
87 Self::TelemetryInstallationId => "TelemetryInstallationId",
88 Self::Theme => "Theme",
89 }
90 }
91}
92
93impl fmt::Display for SettingName {
94 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
95 formatter.write_str(self.as_str())
96 }
97}
98
99#[cfg(test)]
100#[path = "setting_test.rs"]
101mod tests;