ensure developer extension is always loaded

This commit is contained in:
Ebony Louis
2025-11-18 12:05:04 -05:00
parent 9f316166e2
commit 9fe756e06c
2 changed files with 38 additions and 16 deletions
+24 -1
View File
@@ -165,12 +165,35 @@ pub async fn handle_web(
// Load and enable extensions from config
let enabled_configs = goose::config::get_enabled_extensions();
for config in enabled_configs {
// Check if developer extension is already loaded
let has_developer = enabled_configs.iter().any(|c| c.name() == "developer");
for config in &enabled_configs {
if let Err(e) = agent.add_extension(config.clone()).await {
eprintln!("Warning: Failed to load extension {}: {}", config.name(), e);
}
}
// Ensure the developer extension is always available in web mode
if !has_developer {
// Create a default developer extension config
let developer_config = goose::agents::ExtensionConfig::Builtin {
name: "developer".to_string(),
description: "The developer extension gives you the capabilities to edit code files and run shell commands".to_string(),
display_name: Some("Developer".to_string()),
timeout: Some(300),
bundled: Some(true),
available_tools: Vec::new(),
};
if let Err(e) = agent.add_extension(developer_config).await {
eprintln!("Warning: Failed to load default developer extension: {}", e);
} else {
println!(" Loaded default developer extension");
}
}
let state = AppState {
agent: Arc::new(agent),
cancellations: Arc::new(RwLock::new(std::collections::HashMap::new())),
+14 -15
View File
@@ -54,22 +54,21 @@ fn get_extensions_map() -> IndexMap<String, ExtensionEntry> {
}
}
if !extensions_map.is_empty() {
for (name, def) in PLATFORM_EXTENSIONS.iter() {
if !extensions_map.contains_key(*name) {
extensions_map.insert(
name.to_string(),
ExtensionEntry {
config: ExtensionConfig::Platform {
name: def.name.to_string(),
description: def.description.to_string(),
bundled: Some(true),
available_tools: Vec::new(),
},
enabled: true,
// Always add platform extensions if they're not already present
for (name, def) in PLATFORM_EXTENSIONS.iter() {
if !extensions_map.contains_key(*name) {
extensions_map.insert(
name.to_string(),
ExtensionEntry {
config: ExtensionConfig::Platform {
name: def.name.to_string(),
description: def.description.to_string(),
bundled: Some(true),
available_tools: Vec::new(),
},
);
}
enabled: true,
},
);
}
}
extensions_map