mirror of
https://github.com/aaif-goose/goose.git
synced 2026-07-03 14:10:03 +02:00
extension fix
This commit is contained in:
@@ -478,15 +478,17 @@ impl Agent {
|
||||
} else if tool_call.name == SUBAGENT_TOOL_NAME {
|
||||
let arguments = tool_call.arguments.clone().unwrap_or_default();
|
||||
|
||||
let loaded_extensions = self
|
||||
.extension_manager
|
||||
.list_extensions()
|
||||
.await
|
||||
.unwrap_or_default();
|
||||
// Get extensions from the agent's runtime state rather than global config
|
||||
// This ensures subagents inherit extensions that were dynamically enabled by the parent
|
||||
let extensions = self.get_extension_configs().await;
|
||||
|
||||
// Get just the extension names for the recipe builder (for name resolution)
|
||||
let loaded_extension_names: Vec<String> =
|
||||
extensions.iter().map(|ext| ext.key()).collect();
|
||||
|
||||
let recipe = match subagent_tools::task_params_to_inline_recipe(
|
||||
&Value::Object(arguments.clone()),
|
||||
&loaded_extensions,
|
||||
&loaded_extension_names,
|
||||
) {
|
||||
Ok(r) => r,
|
||||
Err(e) => {
|
||||
@@ -515,12 +517,8 @@ impl Agent {
|
||||
}
|
||||
};
|
||||
|
||||
let task_config = TaskConfig::new(
|
||||
provider,
|
||||
&session.id,
|
||||
&session.working_dir,
|
||||
self.get_extension_configs().await,
|
||||
);
|
||||
let task_config =
|
||||
TaskConfig::new(provider, &session.id, &session.working_dir, extensions);
|
||||
|
||||
let return_last_only = arguments
|
||||
.get("return_last_only")
|
||||
|
||||
@@ -127,7 +127,13 @@ fn get_agent_messages(
|
||||
.await
|
||||
.map_err(|e| anyhow!("Failed to set provider on sub agent: {}", e))?;
|
||||
|
||||
for extension in task_config.extensions {
|
||||
let extensions_to_use = if let Some(recipe_extensions) = recipe.extensions {
|
||||
recipe_extensions
|
||||
} else {
|
||||
task_config.extensions
|
||||
};
|
||||
|
||||
for extension in extensions_to_use {
|
||||
if let Err(e) = agent.add_extension(extension.clone()).await {
|
||||
debug!(
|
||||
"Failed to add extension '{}' to subagent: {}",
|
||||
|
||||
Reference in New Issue
Block a user