agent_profile.rs

 1use std::sync::Arc;
 2
 3use collections::HashMap;
 4use gpui::SharedString;
 5
 6/// A profile for the Zed Agent that controls its behavior.
 7#[derive(Debug, Clone)]
 8pub struct AgentProfile {
 9    /// The name of the profile.
10    pub name: SharedString,
11    pub tools: HashMap<Arc<str>, bool>,
12    #[allow(dead_code)]
13    pub context_servers: HashMap<Arc<str>, ContextServerPreset>,
14}
15
16#[derive(Debug, Clone)]
17pub struct ContextServerPreset {
18    #[allow(dead_code)]
19    pub tools: HashMap<Arc<str>, bool>,
20}
21
22impl AgentProfile {
23    pub fn read_only() -> Self {
24        Self {
25            name: "Read-only".into(),
26            tools: HashMap::from_iter([
27                ("diagnostics".into(), true),
28                ("fetch".into(), true),
29                ("list-directory".into(), true),
30                ("now".into(), true),
31                ("path-search".into(), true),
32                ("read-file".into(), true),
33                ("regex-search".into(), true),
34                ("thinking".into(), true),
35            ]),
36            context_servers: HashMap::default(),
37        }
38    }
39
40    pub fn code_writer() -> Self {
41        Self {
42            name: "Code Writer".into(),
43            tools: HashMap::from_iter([
44                ("bash".into(), true),
45                ("delete-path".into(), true),
46                ("diagnostics".into(), true),
47                ("edit-files".into(), true),
48                ("fetch".into(), true),
49                ("list-directory".into(), true),
50                ("now".into(), true),
51                ("path-search".into(), true),
52                ("read-file".into(), true),
53                ("regex-search".into(), true),
54                ("thinking".into(), true),
55            ]),
56            context_servers: HashMap::default(),
57        }
58    }
59}