mirror of
https://github.com/aljazceru/goose.git
synced 2025-12-18 14:44:21 +01:00
feat: non-editable bundled extensions (#2114)
This commit is contained in:
@@ -70,6 +70,7 @@ pub async fn handle_configure() -> Result<(), Box<dyn Error>> {
|
||||
name: "developer".to_string(),
|
||||
display_name: Some(goose::config::DEFAULT_DISPLAY_NAME.to_string()),
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: Some(true),
|
||||
},
|
||||
})?;
|
||||
}
|
||||
@@ -509,6 +510,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
name: extension.clone(),
|
||||
display_name: Some(display_name),
|
||||
timeout: Some(timeout),
|
||||
bundled: Some(true),
|
||||
},
|
||||
})?;
|
||||
|
||||
@@ -600,6 +602,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
envs: Envs::new(envs),
|
||||
description,
|
||||
timeout: Some(timeout),
|
||||
bundled: None,
|
||||
},
|
||||
})?;
|
||||
|
||||
@@ -686,6 +689,7 @@ pub fn configure_extensions_dialog() -> Result<(), Box<dyn Error>> {
|
||||
envs: Envs::new(envs),
|
||||
description,
|
||||
timeout: Some(timeout),
|
||||
bundled: None,
|
||||
},
|
||||
})?;
|
||||
|
||||
|
||||
@@ -159,6 +159,7 @@ impl Session {
|
||||
description: Some(goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string()),
|
||||
// TODO: should set timeout
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: None,
|
||||
};
|
||||
|
||||
self.agent
|
||||
@@ -190,6 +191,7 @@ impl Session {
|
||||
description: Some(goose::config::DEFAULT_EXTENSION_DESCRIPTION.to_string()),
|
||||
// TODO: should set timeout
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: None,
|
||||
};
|
||||
|
||||
self.agent
|
||||
@@ -214,6 +216,7 @@ impl Session {
|
||||
display_name: None,
|
||||
// TODO: should set a timeout
|
||||
timeout: Some(goose::config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: None,
|
||||
};
|
||||
self.agent
|
||||
.add_extension(config)
|
||||
|
||||
@@ -204,6 +204,7 @@ async fn add_extension(
|
||||
envs: Envs::new(env_map),
|
||||
description: None,
|
||||
timeout,
|
||||
bundled: None,
|
||||
}
|
||||
}
|
||||
ExtensionConfigRequest::Stdio {
|
||||
@@ -254,6 +255,7 @@ async fn add_extension(
|
||||
description: None,
|
||||
envs: Envs::new(env_map),
|
||||
timeout,
|
||||
bundled: None,
|
||||
}
|
||||
}
|
||||
ExtensionConfigRequest::Builtin {
|
||||
@@ -264,6 +266,7 @@ async fn add_extension(
|
||||
name,
|
||||
display_name,
|
||||
timeout,
|
||||
bundled: None,
|
||||
},
|
||||
ExtensionConfigRequest::Frontend {
|
||||
name,
|
||||
@@ -273,6 +276,7 @@ async fn add_extension(
|
||||
name,
|
||||
tools,
|
||||
instructions,
|
||||
bundled: None,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@@ -243,6 +243,7 @@ impl Agent {
|
||||
name: _,
|
||||
tools,
|
||||
instructions,
|
||||
bundled: _,
|
||||
} => {
|
||||
// For frontend tools, just store them in the frontend_tools map
|
||||
for tool in tools {
|
||||
|
||||
@@ -130,6 +130,9 @@ pub enum ExtensionConfig {
|
||||
// NOTE: set timeout to be optional for compatibility.
|
||||
// However, new configurations should include this field.
|
||||
timeout: Option<u64>,
|
||||
/// Whether this extension is bundled with Goose
|
||||
#[serde(default)]
|
||||
bundled: Option<bool>,
|
||||
},
|
||||
/// Standard I/O client with command and arguments
|
||||
#[serde(rename = "stdio")]
|
||||
@@ -142,6 +145,9 @@ pub enum ExtensionConfig {
|
||||
envs: Envs,
|
||||
timeout: Option<u64>,
|
||||
description: Option<String>,
|
||||
/// Whether this extension is bundled with Goose
|
||||
#[serde(default)]
|
||||
bundled: Option<bool>,
|
||||
},
|
||||
/// Built-in extension that is part of the goose binary
|
||||
#[serde(rename = "builtin")]
|
||||
@@ -150,6 +156,9 @@ pub enum ExtensionConfig {
|
||||
name: String,
|
||||
display_name: Option<String>, // needed for the UI
|
||||
timeout: Option<u64>,
|
||||
/// Whether this extension is bundled with Goose
|
||||
#[serde(default)]
|
||||
bundled: Option<bool>,
|
||||
},
|
||||
/// Frontend-provided tools that will be called through the frontend
|
||||
#[serde(rename = "frontend")]
|
||||
@@ -160,6 +169,9 @@ pub enum ExtensionConfig {
|
||||
tools: Vec<Tool>,
|
||||
/// Instructions for how to use these tools
|
||||
instructions: Option<String>,
|
||||
/// Whether this extension is bundled with Goose
|
||||
#[serde(default)]
|
||||
bundled: Option<bool>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -169,6 +181,7 @@ impl Default for ExtensionConfig {
|
||||
name: config::DEFAULT_EXTENSION.to_string(),
|
||||
display_name: Some(config::DEFAULT_DISPLAY_NAME.to_string()),
|
||||
timeout: Some(config::DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: Some(true),
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,6 +194,7 @@ impl ExtensionConfig {
|
||||
envs: Envs::default(),
|
||||
description: Some(description.into()),
|
||||
timeout: Some(timeout.into()),
|
||||
bundled: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -197,6 +211,7 @@ impl ExtensionConfig {
|
||||
envs: Envs::default(),
|
||||
description: Some(description.into()),
|
||||
timeout: Some(timeout.into()),
|
||||
bundled: None,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,6 +227,7 @@ impl ExtensionConfig {
|
||||
envs,
|
||||
timeout,
|
||||
description,
|
||||
bundled,
|
||||
..
|
||||
} => Self::Stdio {
|
||||
name,
|
||||
@@ -220,6 +236,7 @@ impl ExtensionConfig {
|
||||
args: args.into_iter().map(Into::into).collect(),
|
||||
description,
|
||||
timeout,
|
||||
bundled,
|
||||
},
|
||||
other => other,
|
||||
}
|
||||
|
||||
@@ -146,6 +146,7 @@ impl ExtensionManager {
|
||||
name,
|
||||
display_name: _,
|
||||
timeout,
|
||||
bundled: _,
|
||||
} => {
|
||||
// For builtin extensions, we run the current executable with mcp and extension name
|
||||
let cmd = std::env::current_exe()
|
||||
|
||||
@@ -45,6 +45,7 @@ impl ExtensionConfigManager {
|
||||
name: DEFAULT_EXTENSION.to_string(),
|
||||
display_name: Some(DEFAULT_DISPLAY_NAME.to_string()),
|
||||
timeout: Some(DEFAULT_EXTENSION_TIMEOUT),
|
||||
bundled: Some(true),
|
||||
},
|
||||
},
|
||||
)]);
|
||||
|
||||
Reference in New Issue
Block a user