mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
ensure developer extension is always loaded
This commit is contained in:
@@ -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())),
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user