agent_profile.rs

 1use std::sync::Arc;
 2
 3use gpui::SharedString;
 4use indexmap::IndexMap;
 5use schemars::JsonSchema;
 6use serde::{Deserialize, Serialize};
 7
 8#[derive(Debug, PartialEq, Eq, Hash, Clone, Serialize, Deserialize, JsonSchema)]
 9pub struct AgentProfileId(pub Arc<str>);
10
11impl AgentProfileId {
12    pub fn as_str(&self) -> &str {
13        &self.0
14    }
15}
16
17impl std::fmt::Display for AgentProfileId {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        write!(f, "{}", self.0)
20    }
21}
22
23impl Default for AgentProfileId {
24    fn default() -> Self {
25        Self("write".into())
26    }
27}
28
29/// A profile for the Zed Agent that controls its behavior.
30#[derive(Debug, Clone)]
31pub struct AgentProfile {
32    /// The name of the profile.
33    pub name: SharedString,
34    pub tools: IndexMap<Arc<str>, bool>,
35    pub enable_all_context_servers: bool,
36    pub context_servers: IndexMap<Arc<str>, ContextServerPreset>,
37}
38
39#[derive(Debug, Clone, Default)]
40pub struct ContextServerPreset {
41    pub tools: IndexMap<Arc<str>, bool>,
42}