vtcode_config/core/
security.rs

1use serde::{Deserialize, Serialize};
2
3/// Security configuration
4#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
5#[derive(Debug, Clone, Deserialize, Serialize)]
6pub struct SecurityConfig {
7    /// Require human confirmation for critical actions
8    #[serde(default = "default_true")]
9    pub human_in_the_loop: bool,
10
11    /// Require a successful write tool before accepting claims like
12    /// "I've updated the file" as applied. When true, such claims are
13    /// treated as proposals unless a write tool executed successfully.
14    #[serde(default = "default_true")]
15    pub require_write_tool_for_claims: bool,
16
17    /// Automatically apply detected patch blocks in assistant replies
18    /// when no write tool was executed. Defaults to false for safety.
19    #[serde(default)]
20    pub auto_apply_detected_patches: bool,
21}
22
23impl Default for SecurityConfig {
24    fn default() -> Self {
25        Self {
26            human_in_the_loop: default_true(),
27            require_write_tool_for_claims: default_true(),
28            auto_apply_detected_patches: false,
29        }
30    }
31}
32
33fn default_true() -> bool {
34    true
35}