Skip to main content

dot/agent/
profile.rs

1use std::collections::HashMap;
2
3use crate::config::AgentConfig;
4
5pub(super) const DEFAULT_SYSTEM_PROMPT: &str = include_str!("prompt.txt");
6
7#[derive(Debug, Clone)]
8pub struct AgentProfile {
9    pub name: String,
10    pub description: String,
11    pub system_prompt: String,
12    pub model_spec: Option<String>,
13    pub tool_filter: HashMap<String, bool>,
14}
15
16impl AgentProfile {
17    pub fn default_profile() -> Self {
18        AgentProfile {
19            name: "dot".to_string(),
20            description: "Default coding assistant".to_string(),
21            system_prompt: DEFAULT_SYSTEM_PROMPT.to_string(),
22            model_spec: None,
23            tool_filter: HashMap::new(),
24        }
25    }
26
27    pub fn plan_profile() -> Self {
28        let mut filter = HashMap::new();
29        filter.insert("write_file".to_string(), false);
30        filter.insert("run_command".to_string(), false);
31        filter.insert("apply_patch".to_string(), false);
32        filter.insert("web_fetch".to_string(), false);
33        filter.insert("multiedit".to_string(), false);
34        filter.insert("batch".to_string(), false);
35        AgentProfile {
36            name: "plan".to_string(),
37            description: "Read-only planning assistant".to_string(),
38            system_prompt: "You are a planning assistant. You can read and analyze code but cannot make changes. Help the user understand codebases, plan approaches, and think through problems. You have access to file reading, search, and grep tools only.".to_string(),
39            model_spec: None,
40            tool_filter: filter,
41        }
42    }
43
44    pub fn from_config(name: &str, cfg: &AgentConfig) -> Self {
45        let system_prompt = cfg
46            .system_prompt
47            .clone()
48            .unwrap_or_else(|| DEFAULT_SYSTEM_PROMPT.to_string());
49        AgentProfile {
50            name: name.to_string(),
51            description: cfg.description.clone(),
52            system_prompt,
53            model_spec: cfg.model.clone(),
54            tool_filter: cfg.tools.clone(),
55        }
56    }
57}