1use crate::AgentServerCommand;
2use anyhow::Result;
3use gpui::App;
4use schemars::JsonSchema;
5use serde::{Deserialize, Serialize};
6use settings::{Settings, SettingsSources};
7
8pub fn init(cx: &mut App) {
9 AllAgentServersSettings::register(cx);
10}
11
12#[derive(Default, Deserialize, Serialize, Clone, JsonSchema, Debug)]
13pub struct AllAgentServersSettings {
14 pub gemini: Option<AgentServerSettings>,
15}
16
17#[derive(Deserialize, Serialize, Clone, JsonSchema, Debug)]
18pub struct AgentServerSettings {
19 #[serde(flatten)]
20 pub command: AgentServerCommand,
21}
22
23impl settings::Settings for AllAgentServersSettings {
24 const KEY: Option<&'static str> = Some("agent_servers");
25
26 type FileContent = Self;
27
28 fn load(sources: SettingsSources<Self::FileContent>, _: &mut App) -> Result<Self> {
29 let mut settings = AllAgentServersSettings::default();
30
31 for value in sources.defaults_and_customizations() {
32 if value.gemini.is_some() {
33 settings.gemini = value.gemini.clone();
34 }
35 }
36
37 Ok(settings)
38 }
39
40 fn import_from_vscode(_vscode: &settings::VsCodeSettings, _current: &mut Self::FileContent) {}
41}