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 /// Distinguishes registered projects from non-repository launch contexts.
55 ProjectCatalogVisible,
56 /// Records dismissal of the one-time project discovery suggestion.
57 ProjectDiscoveryPromptSeen,
58 /// Persists the long-term key that identifies this installation to remote
59 /// devices paired through a relay. Replacing it unpairs those devices.
60 RemoteInstanceKey,
61 /// Persists the random installation ID attached to telemetry events.
62 TelemetryInstallationId,
63 /// Persists the active terminal color theme.
64 Theme,
65}
66
67impl SettingName {
68 /// Returns the persisted key string for one setting.
69 pub fn as_str(self) -> &'static str {
70 match self {
71 Self::ActiveProjectId => "ActiveProjectId",
72 Self::ActiveTab => "ActiveTab",
73 Self::AutoAddressReviewComments => "AutoAddressReviewComments",
74 Self::DefaultFastAgent => "DefaultFastAgent",
75 Self::DefaultFastModel => "DefaultFastModel",
76 Self::DefaultHarnessModel => "DefaultHarnessModel",
77 Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
78 Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
79 Self::DefaultReviewAgent => "DefaultReviewAgent",
80 Self::DefaultReviewModel => "DefaultReviewModel",
81 Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
82 Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
83 Self::DefaultResponseStyle => "DefaultResponseStyle",
84 Self::DefaultSmartAgent => "DefaultSmartAgent",
85 Self::DefaultSmartModel => "DefaultSmartModel",
86 Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
87 Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
88 Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
89 Self::LaunchConfiguration => "LaunchConfiguration",
90 Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
91 Self::MaxConcurrentSubagents => "MaxConcurrentSubagents",
92 Self::ProjectCatalogVisible => "ProjectCatalogVisible",
93 Self::ProjectDiscoveryPromptSeen => "ProjectDiscoveryPromptSeen",
94 Self::RemoteInstanceKey => "RemoteInstanceKey",
95 Self::TelemetryInstallationId => "TelemetryInstallationId",
96 Self::Theme => "Theme",
97 }
98 }
99}
100
101impl fmt::Display for SettingName {
102 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
103 formatter.write_str(self.as_str())
104 }
105}
106
107#[cfg(test)]
108#[path = "setting_test.rs"]
109mod tests;