mirror of
https://github.com/block/goose.git
synced 2026-07-17 12:56:20 +02:00
need to enable the subagent tool whenever subrecipes are specified
This commit is contained in:
@@ -497,6 +497,8 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> CliSession {
|
||||
}
|
||||
}
|
||||
|
||||
agent_ptr.ensure_subagent_for_recipes().await;
|
||||
|
||||
// Determine editor mode
|
||||
let edit_mode = config
|
||||
.get_param::<String>("EDIT_MODE")
|
||||
|
||||
@@ -170,6 +170,8 @@ pub async fn apply_recipe_to_agent(
|
||||
)
|
||||
.await;
|
||||
|
||||
agent.ensure_subagent_for_recipes().await;
|
||||
|
||||
recipe.instructions.as_ref().map(|instructions| {
|
||||
let mut context: HashMap<&str, Value> = HashMap::new();
|
||||
context.insert("recipe_instructions", Value::String(instructions.clone()));
|
||||
|
||||
@@ -407,8 +407,8 @@ impl Agent {
|
||||
response: Option<Response>,
|
||||
include_final_output: bool,
|
||||
) {
|
||||
if let Some(sub_recipes) = sub_recipes {
|
||||
self.add_sub_recipes(sub_recipes).await;
|
||||
if let Some(ref sub_recipes) = sub_recipes {
|
||||
self.add_sub_recipes(sub_recipes.clone()).await;
|
||||
}
|
||||
|
||||
if include_final_output {
|
||||
@@ -418,6 +418,15 @@ impl Agent {
|
||||
}
|
||||
}
|
||||
|
||||
pub async fn ensure_subagent_for_recipes(&self) {
|
||||
let has_sub_recipes = !self.sub_recipes.read().await.is_empty();
|
||||
if has_sub_recipes {
|
||||
if let Err(e) = self.enable_subagent_extension().await {
|
||||
warn!("Failed to enable subagent extension for recipe: {}", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Dispatch a single tool call to the appropriate client
|
||||
#[instrument(skip(self, tool_call, request_id), fields(input, output))]
|
||||
pub async fn dispatch_tool_call(
|
||||
|
||||
Reference in New Issue
Block a user