feat: run sub recipe multiple times in parallel (Experimental feature) (#3274)

Co-authored-by: Wendy Tang <wendytang@squareup.com>
This commit is contained in:
Lifei Zhou
2025-07-17 08:39:35 +10:00
committed by GitHub
parent 3b90282b49
commit e5a55dbddc
30 changed files with 2757 additions and 674 deletions
+21 -2
View File
@@ -4,8 +4,11 @@ mod export;
mod input;
mod output;
mod prompt;
mod task_execution_display;
mod thinking;
use crate::session::task_execution_display::TASK_EXECUTION_NOTIFICATION_TYPE;
pub use self::export::message_to_markdown;
pub use builder::{build_session, SessionBuilderConfig, SessionSettings};
use console::Color;
@@ -17,6 +20,8 @@ use goose::permission::PermissionConfirmation;
use goose::providers::base::Provider;
pub use goose::session::Identifier;
use goose::utils::safe_truncate;
use std::io::Write;
use task_execution_display::format_task_execution_notification;
use anyhow::{Context, Result};
use completion::GooseCompleter;
@@ -1008,7 +1013,7 @@ impl Session {
match method.as_str() {
"notifications/message" => {
let data = o.get("data").unwrap_or(&Value::Null);
let (formatted_message, subagent_id, _notification_type) = match data {
let (formatted_message, subagent_id, message_notification_type) = match data {
Value::String(s) => (s.clone(), None, None),
Value::Object(o) => {
// Check for subagent notification structure first
@@ -1059,6 +1064,8 @@ impl Session {
} else if let Some(Value::String(output)) = o.get("output") {
// Fallback for other MCP notification types
(output.to_owned(), None, None)
} else if let Some(result) = format_task_execution_notification(data) {
result
} else {
(data.to_string(), None, None)
}
@@ -1077,7 +1084,19 @@ impl Session {
} else {
progress_bars.log(&formatted_message);
}
} else {
} else if let Some(ref notification_type) = message_notification_type {
if notification_type == TASK_EXECUTION_NOTIFICATION_TYPE {
if interactive {
let _ = progress_bars.hide();
print!("{}", formatted_message);
std::io::stdout().flush().unwrap();
} else {
print!("{}", formatted_message);
std::io::stdout().flush().unwrap();
}
}
}
else {
// Non-subagent notification, display immediately with compact spacing
if interactive {
let _ = progress_bars.hide();