1pub mod agents_ipc;
8pub mod apply_patch;
9pub mod autonomy;
10pub mod browser;
11pub mod browser_open;
12pub mod cli_discovery;
13pub mod composio;
14pub mod content_search;
15pub mod cron_store;
16pub mod cron_tools;
17pub mod delegate;
18pub mod delegate_coordination_status;
19pub mod docx_read;
20pub mod file_edit;
21pub mod git_operations;
22pub mod glob_search;
23pub mod hardware;
24pub mod hardware_tools;
25pub mod http_request;
26pub mod image_info;
27pub mod memory_tools;
28pub mod model_routing_config;
29pub mod pdf_read;
30pub mod process_tool;
31pub mod proxy_config;
32pub mod pushover;
33pub mod read_file;
34pub mod schedule;
35pub mod screenshot;
36pub mod shell;
37pub mod shell_parse;
38pub mod skills;
39pub mod sop_tools;
40pub mod subagent_tools;
41pub mod task_plan;
42pub mod url_validation;
43pub mod wasm_tools;
44pub mod web_fetch;
45pub mod web_search;
46pub mod write_file;
47
48use std::path::PathBuf;
49
50pub use agents_ipc::AgentsIpcTool;
51pub use agentzero_core::common::url_policy::UrlAccessPolicy;
52pub use apply_patch::ApplyPatchTool;
53pub use browser::BrowserTool;
54pub use browser_open::BrowserOpenTool;
55pub use cli_discovery::CliDiscoveryTool;
56pub use composio::ComposioTool;
57pub use content_search::ContentSearchTool;
58pub use cron_tools::{
59 CronAddTool, CronListTool, CronPauseTool, CronRemoveTool, CronResumeTool, CronUpdateTool,
60};
61pub use delegate::{DelegateTool, ToolBuilder};
62pub use delegate_coordination_status::DelegateCoordinationStatusTool;
63pub use docx_read::DocxReadTool;
64pub use file_edit::FileEditTool;
65pub use git_operations::GitOperationsTool;
66pub use glob_search::GlobSearchTool;
67pub use hardware_tools::{HardwareBoardInfoTool, HardwareMemoryMapTool, HardwareMemoryReadTool};
68pub use http_request::HttpRequestTool;
69pub use image_info::ImageInfoTool;
70pub use memory_tools::{MemoryForgetTool, MemoryRecallTool, MemoryStoreTool};
71pub use model_routing_config::ModelRoutingConfigTool;
72pub use pdf_read::PdfReadTool;
73pub use process_tool::ProcessTool;
74pub use proxy_config::ProxyConfigTool;
75pub use pushover::PushoverTool;
76pub use read_file::{ReadFilePolicy, ReadFileTool};
77pub use schedule::ScheduleTool;
78pub use screenshot::ScreenshotTool;
79pub use shell::{ShellPolicy, ShellTool};
80pub use sop_tools::{SopAdvanceTool, SopApproveTool, SopExecuteTool, SopListTool, SopStatusTool};
81pub use subagent_tools::{SubAgentListTool, SubAgentManageTool, SubAgentSpawnTool};
82pub use task_plan::TaskPlanTool;
83pub use url_validation::UrlValidationTool;
84pub use wasm_tools::{WasmModuleTool, WasmToolExecTool};
85pub use web_fetch::WebFetchTool;
86pub use web_search::WebSearchTool;
87pub use write_file::{WriteFilePolicy, WriteFileTool};
88
89#[derive(Debug, Clone)]
90pub struct ToolSecurityPolicy {
91 pub read_file: ReadFilePolicy,
92 pub write_file: WriteFilePolicy,
93 pub shell: ShellPolicy,
94 pub url_access: UrlAccessPolicy,
95 pub enable_write_file: bool,
96 pub enable_mcp: bool,
97 pub allowed_mcp_servers: Vec<String>,
98 pub enable_process_plugin: bool,
99 pub enable_git: bool,
100 pub enable_cron: bool,
101 pub enable_web_search: bool,
102 pub enable_browser: bool,
103 pub enable_browser_open: bool,
104 pub enable_http_request: bool,
105 pub enable_web_fetch: bool,
106 pub enable_url_validation: bool,
107 pub enable_agents_ipc: bool,
108 pub enable_composio: bool,
109 pub enable_pushover: bool,
110 pub enable_wasm_plugins: bool,
111 pub wasm_global_plugin_dir: Option<PathBuf>,
112 pub wasm_project_plugin_dir: Option<PathBuf>,
113 pub wasm_dev_plugin_dir: Option<PathBuf>,
114}
115
116impl ToolSecurityPolicy {
117 pub fn default_for_workspace(workspace_root: PathBuf) -> Self {
118 Self {
119 read_file: ReadFilePolicy::default_for_root(workspace_root.clone()),
120 write_file: WriteFilePolicy::default_for_root(workspace_root),
121 shell: ShellPolicy::default_with_commands(vec![
122 "ls".to_string(),
123 "pwd".to_string(),
124 "cat".to_string(),
125 "echo".to_string(),
126 "grep".to_string(),
127 "find".to_string(),
128 "head".to_string(),
129 "tail".to_string(),
130 "wc".to_string(),
131 "sort".to_string(),
132 "uniq".to_string(),
133 "diff".to_string(),
134 "file".to_string(),
135 "which".to_string(),
136 "basename".to_string(),
137 "dirname".to_string(),
138 "mkdir".to_string(),
139 "cp".to_string(),
140 "mv".to_string(),
141 "rm".to_string(),
142 "touch".to_string(),
143 "date".to_string(),
144 "env".to_string(),
145 "test".to_string(),
146 "tr".to_string(),
147 "cut".to_string(),
148 "xargs".to_string(),
149 "sed".to_string(),
150 "awk".to_string(),
151 "git".to_string(),
152 "cargo".to_string(),
153 "rustc".to_string(),
154 "npm".to_string(),
155 "node".to_string(),
156 "python3".to_string(),
157 ]),
158 url_access: UrlAccessPolicy::default(),
159 enable_write_file: false,
160 enable_mcp: false,
161 allowed_mcp_servers: vec![],
162 enable_process_plugin: false,
163 enable_git: false,
164 enable_cron: false,
165 enable_web_search: false,
166 enable_browser: false,
167 enable_browser_open: false,
168 enable_http_request: false,
169 enable_web_fetch: false,
170 enable_url_validation: false,
171 enable_agents_ipc: true,
172 enable_composio: false,
173 enable_pushover: false,
174 enable_wasm_plugins: false,
175 wasm_global_plugin_dir: None,
176 wasm_project_plugin_dir: None,
177 wasm_dev_plugin_dir: None,
178 }
179 }
180}