vtcode_config/root/
notifications.rs1use serde::{Deserialize, Serialize};
6
7use super::env_bool_var;
8use super::modes::{NotificationBackend, NotificationDeliveryMode};
9
10#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
12#[derive(Debug, Clone, Deserialize, Serialize)]
13pub struct UiNotificationsConfig {
14 #[serde(default = "default_notifications_enabled")]
16 pub enabled: bool,
17
18 #[serde(default)]
20 pub delivery_mode: NotificationDeliveryMode,
21
22 #[serde(default)]
24 pub backend: NotificationBackend,
25
26 #[serde(default = "default_notifications_suppress_when_focused")]
28 pub suppress_when_focused: bool,
29
30 #[serde(default)]
33 pub command_failure: Option<bool>,
34
35 #[serde(default = "default_notifications_tool_failure")]
37 pub tool_failure: bool,
38
39 #[serde(default = "default_notifications_error")]
41 pub error: bool,
42
43 #[serde(default = "default_notifications_completion")]
46 pub completion: bool,
47
48 #[serde(default)]
51 pub completion_success: Option<bool>,
52
53 #[serde(default)]
56 pub completion_failure: Option<bool>,
57
58 #[serde(default = "default_notifications_hitl")]
60 pub hitl: bool,
61
62 #[serde(default)]
65 pub policy_approval: Option<bool>,
66
67 #[serde(default)]
70 pub request: Option<bool>,
71
72 #[serde(default = "default_notifications_tool_success")]
74 pub tool_success: bool,
75
76 #[serde(default = "default_notifications_repeat_window_seconds")]
78 pub repeat_window_seconds: u64,
79
80 #[serde(default = "default_notifications_max_identical_in_window")]
82 pub max_identical_in_window: u32,
83}
84
85impl Default for UiNotificationsConfig {
86 fn default() -> Self {
87 Self {
88 enabled: default_notifications_enabled(),
89 delivery_mode: NotificationDeliveryMode::default(),
90 backend: NotificationBackend::default(),
91 suppress_when_focused: default_notifications_suppress_when_focused(),
92 command_failure: Some(default_notifications_command_failure()),
93 tool_failure: default_notifications_tool_failure(),
94 error: default_notifications_error(),
95 completion: default_notifications_completion(),
96 completion_success: Some(default_notifications_completion_success()),
97 completion_failure: Some(default_notifications_completion_failure()),
98 hitl: default_notifications_hitl(),
99 policy_approval: Some(default_notifications_policy_approval()),
100 request: Some(default_notifications_request()),
101 tool_success: default_notifications_tool_success(),
102 repeat_window_seconds: default_notifications_repeat_window_seconds(),
103 max_identical_in_window: default_notifications_max_identical_in_window(),
104 }
105 }
106}
107
108fn default_notifications_enabled() -> bool {
109 true
110}
111
112fn default_notifications_suppress_when_focused() -> bool {
113 true
114}
115
116fn default_notifications_command_failure() -> bool {
117 false
118}
119
120fn default_notifications_tool_failure() -> bool {
121 false
122}
123
124fn default_notifications_error() -> bool {
125 true
126}
127
128fn default_notifications_completion() -> bool {
129 true
130}
131
132fn default_notifications_completion_success() -> bool {
133 false
134}
135
136fn default_notifications_completion_failure() -> bool {
137 true
138}
139
140fn default_notifications_hitl() -> bool {
141 true
142}
143
144fn default_notifications_policy_approval() -> bool {
145 true
146}
147
148fn default_notifications_request() -> bool {
149 false
150}
151
152fn default_notifications_tool_success() -> bool {
153 false
154}
155
156fn default_notifications_repeat_window_seconds() -> u64 {
157 30
158}
159
160fn default_notifications_max_identical_in_window() -> u32 {
161 1
162}