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 from_config(name: &str, cfg: &AgentConfig) -> Self {
28        let system_prompt = cfg
29            .system_prompt
30            .clone()
31            .unwrap_or_else(|| DEFAULT_SYSTEM_PROMPT.to_string());
32        AgentProfile {
33            name: name.to_string(),
34            description: cfg.description.clone(),
35            system_prompt,
36            model_spec: cfg.model.clone(),
37            tool_filter: cfg.tools.clone(),
38        }
39    }
40}