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 the random installation ID attached to telemetry events.
65 TelemetryInstallationId,
66 /// Persists the active terminal color theme.
67 Theme,
68}
69
70impl SettingName {
71 /// Returns the persisted key string for one setting.
72 pub fn as_str(self) -> &'static str {
73 match self {
74 Self::ActiveProjectId => "ActiveProjectId",
75 Self::ActiveTab => "ActiveTab",
76 Self::AutoAddressReviewComments => "AutoAddressReviewComments",
77 Self::DefaultFastAgent => "DefaultFastAgent",
78 Self::DefaultFastModel => "DefaultFastModel",
79 Self::DefaultHarnessModel => "DefaultHarnessModel",
80 Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
81 Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
82 Self::DefaultReviewAgent => "DefaultReviewAgent",
83 Self::DefaultReviewModel => "DefaultReviewModel",
84 Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
85 Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
86 Self::DefaultResponseStyle => "DefaultResponseStyle",
87 Self::DefaultSmartAgent => "DefaultSmartAgent",
88 Self::DefaultSmartModel => "DefaultSmartModel",
89 Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
90 Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
91 Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
92 Self::LaunchConfiguration => "LaunchConfiguration",
93 Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
94 Self::MaxConcurrentSubagents => "MaxConcurrentSubagents",
95 Self::PlatformSignIn => "PlatformSignIn",
96 Self::ProjectCatalogVisible => "ProjectCatalogVisible",
97 Self::ProjectDiscoveryPromptSeen => "ProjectDiscoveryPromptSeen",
98 Self::RemoteInstanceKey => "RemoteInstanceKey",
99 Self::TelemetryInstallationId => "TelemetryInstallationId",
100 Self::Theme => "Theme",
101 }
102 }
103}
104
105impl fmt::Display for SettingName {
106 fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
107 formatter.write_str(self.as_str())
108 }
109}
110
111#[cfg(test)]
112#[path = "setting_test.rs"]
113mod tests;