vtcode_config/core/
automation.rs

1use crate::constants::{defaults, tools};
2use serde::{Deserialize, Serialize};
3use std::path::PathBuf;
4
5/// Automation-specific configuration toggles.
6#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
7#[derive(Debug, Clone, Deserialize, Serialize, Default)]
8pub struct AutomationConfig {
9    /// Full-auto execution safeguards.
10    #[serde(default)]
11    pub full_auto: FullAutoConfig,
12}
13
14/// Controls for running the agent without interactive approvals.
15#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
16#[derive(Debug, Clone, Deserialize, Serialize)]
17pub struct FullAutoConfig {
18    /// Enable the runtime flag once the workspace is configured for autonomous runs.
19    #[serde(default = "default_full_auto_enabled")]
20    pub enabled: bool,
21
22    /// Maximum number of autonomous agent turns before the exec runner pauses.
23    #[serde(default = "default_full_auto_max_turns")]
24    pub max_turns: usize,
25
26    /// Allow-list of tools that may execute automatically.
27    #[serde(default = "default_full_auto_allowed_tools")]
28    pub allowed_tools: Vec<String>,
29
30    /// Require presence of a profile/acknowledgement file before activation.
31    #[serde(default = "default_require_profile_ack")]
32    pub require_profile_ack: bool,
33
34    /// Optional path to a profile describing acceptable behaviors.
35    #[serde(default)]
36    pub profile_path: Option<PathBuf>,
37}
38
39impl Default for FullAutoConfig {
40    fn default() -> Self {
41        Self {
42            enabled: default_full_auto_enabled(),
43            max_turns: default_full_auto_max_turns(),
44            allowed_tools: default_full_auto_allowed_tools(),
45            require_profile_ack: default_require_profile_ack(),
46            profile_path: None,
47        }
48    }
49}
50
51fn default_full_auto_enabled() -> bool {
52    false
53}
54
55fn default_full_auto_allowed_tools() -> Vec<String> {
56    vec![
57        tools::READ_FILE.to_string(),
58        tools::LIST_FILES.to_string(),
59        tools::GREP_FILE.to_string(),
60    ]
61}
62
63fn default_require_profile_ack() -> bool {
64    true
65}
66
67fn default_full_auto_max_turns() -> usize {
68    defaults::DEFAULT_FULL_AUTO_MAX_TURNS
69}