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 = "You are dot, a helpful AI coding assistant running in a terminal. \
6You have access to tools for reading/writing files, running shell commands, and searching code. \
7Be concise and direct. When asked to make changes, use the tools to implement them. \
8Don't just describe what to do.";
9
10#[derive(Debug, Clone)]
11pub struct AgentProfile {
12    pub name: String,
13    pub description: String,
14    pub system_prompt: String,
15    pub model_spec: Option<String>,
16    pub tool_filter: HashMap<String, bool>,
17}
18
19impl AgentProfile {
20    pub fn default_profile() -> Self {
21        AgentProfile {
22            name: "dot".to_string(),
23            description: "Default coding assistant".to_string(),
24            system_prompt: DEFAULT_SYSTEM_PROMPT.to_string(),
25            model_spec: None,
26            tool_filter: HashMap::new(),
27        }
28    }
29
30    pub fn from_config(name: &str, cfg: &AgentConfig) -> Self {
31        let system_prompt = cfg
32            .system_prompt
33            .clone()
34            .unwrap_or_else(|| DEFAULT_SYSTEM_PROMPT.to_string());
35        AgentProfile {
36            name: name.to_string(),
37            description: cfg.description.clone(),
38            system_prompt,
39            model_spec: cfg.model.clone(),
40            tool_filter: cfg.tools.clone(),
41        }
42    }
43}