Skip to main content

ag_session/
setting.rs

1//! Domain model for persisted application setting keys.
2
3use std::fmt;
4
5/// Whether temporary read-only research waves start without plan approval.
6pub const DEFAULT_AUTO_APPROVE_ORCHESTRATION_RESEARCH: bool = true;
7/// Default number of orchestration children allowed to run concurrently.
8pub const DEFAULT_ORCHESTRATION_PARALLELISM: u8 = 3;
9/// Maximum orchestration concurrency exposed by the settings selector.
10pub const MAX_ORCHESTRATION_PARALLELISM: u8 = 8;
11
12/// Stable keys used in the `setting` and `project_setting` tables.
13#[derive(Clone, Copy, Debug, Eq, PartialEq)]
14pub enum SettingName {
15    /// Persists the active project selection.
16    ActiveProjectId,
17    /// Persists the active list tab selection.
18    ActiveTab,
19    /// Persists whether research-only orchestration waves start immediately.
20    AutoApproveOrchestrationResearch,
21    /// Persists the provider that owns the fast-model default.
22    DefaultFastAgent,
23    /// Persists the project or global fast-model selection.
24    DefaultFastModel,
25    /// Persists the reasoning level paired with the fast-model default.
26    DefaultFastReasoningLevel,
27    /// Persists the response speed paired with the fast-model default.
28    DefaultFastSpeedMode,
29    /// Persists the provider that owns the review-model default.
30    DefaultReviewAgent,
31    /// Persists the project or global review-model selection.
32    DefaultReviewModel,
33    /// Persists the reasoning level paired with the review-model default.
34    DefaultReviewReasoningLevel,
35    /// Persists the response speed paired with the review-model default.
36    DefaultReviewSpeedMode,
37    /// Persists the default response style for newly created sessions.
38    DefaultResponseStyle,
39    /// Persists the provider that owns the smart-model default.
40    DefaultSmartAgent,
41    /// Persists the project or global smart-model selection.
42    DefaultSmartModel,
43    /// Persists the reasoning level paired with the smart-model default.
44    DefaultSmartReasoningLevel,
45    /// Persists the response speed paired with the smart-model default.
46    DefaultSmartSpeedMode,
47    /// Persists whether generated session commits append the Agentty coauthor
48    /// trailer.
49    IncludeCoauthoredByAgentty,
50    /// Persists the configured launch-configuration override.
51    LaunchConfiguration,
52    /// Persists whether the last used model should become the default.
53    LastUsedModelAsDefault,
54    /// Persists how many orchestration children may run at once.
55    OrchestrationParallelism,
56    /// Persists the active terminal color theme.
57    Theme,
58}
59
60impl SettingName {
61    /// Returns the persisted key string for one setting.
62    pub fn as_str(self) -> &'static str {
63        match self {
64            Self::ActiveProjectId => "ActiveProjectId",
65            Self::ActiveTab => "ActiveTab",
66            Self::AutoApproveOrchestrationResearch => "AutoApproveOrchestrationResearch",
67            Self::DefaultFastAgent => "DefaultFastAgent",
68            Self::DefaultFastModel => "DefaultFastModel",
69            Self::DefaultFastReasoningLevel => "DefaultFastReasoningLevel",
70            Self::DefaultFastSpeedMode => "DefaultFastSpeedMode",
71            Self::DefaultReviewAgent => "DefaultReviewAgent",
72            Self::DefaultReviewModel => "DefaultReviewModel",
73            Self::DefaultReviewReasoningLevel => "DefaultReviewReasoningLevel",
74            Self::DefaultReviewSpeedMode => "DefaultReviewSpeedMode",
75            Self::DefaultResponseStyle => "DefaultResponseStyle",
76            Self::DefaultSmartAgent => "DefaultSmartAgent",
77            Self::DefaultSmartModel => "DefaultSmartModel",
78            Self::DefaultSmartReasoningLevel => "DefaultSmartReasoningLevel",
79            Self::DefaultSmartSpeedMode => "DefaultSmartSpeedMode",
80            Self::IncludeCoauthoredByAgentty => "IncludeCoauthoredByAgentty",
81            Self::LaunchConfiguration => "LaunchConfiguration",
82            Self::LastUsedModelAsDefault => "LastUsedModelAsDefault",
83            Self::OrchestrationParallelism => "OrchestrationParallelism",
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;