feat: consolidate subagent execution for dynamic tasks (#3444)
Co-authored-by: Lifei Zhou <lifei@squareup.com>
This commit is contained in:
@@ -203,6 +203,7 @@ pub async fn build_session(session_config: SessionBuilderConfig) -> Session {
|
||||
|
||||
// Create the agent
|
||||
let agent: Agent = Agent::new();
|
||||
|
||||
if let Some(sub_recipes) = session_config.sub_recipes {
|
||||
agent.add_sub_recipes(sub_recipes).await;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,10 @@ mod prompt;
|
||||
mod task_execution_display;
|
||||
mod thinking;
|
||||
|
||||
use crate::session::task_execution_display::TASK_EXECUTION_NOTIFICATION_TYPE;
|
||||
use crate::session::task_execution_display::{
|
||||
format_task_execution_notification, TASK_EXECUTION_NOTIFICATION_TYPE,
|
||||
};
|
||||
use std::io::Write;
|
||||
|
||||
pub use self::export::message_to_markdown;
|
||||
pub use builder::{build_session, SessionBuilderConfig, SessionSettings};
|
||||
@@ -20,8 +23,6 @@ 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;
|
||||
@@ -1077,7 +1078,7 @@ impl Session {
|
||||
|
||||
// Handle subagent notifications - show immediately
|
||||
if let Some(_id) = subagent_id {
|
||||
// Show subagent notifications immediately (no buffering) with compact spacing
|
||||
// TODO: proper display for subagent notifications
|
||||
if interactive {
|
||||
let _ = progress_bars.hide();
|
||||
println!("{}", console::style(&formatted_message).green().dim());
|
||||
|
||||
@@ -463,8 +463,26 @@ fn print_params(value: &Value, depth: usize, debug: bool) {
|
||||
}
|
||||
}
|
||||
Value::String(s) => {
|
||||
if !debug && s.len() > get_tool_params_max_length() {
|
||||
println!("{}{}: {}", indent, style(key).dim(), style("...").dim());
|
||||
// Special handling for text_instruction to show more content
|
||||
let max_length = if key == "text_instruction" {
|
||||
200 // Allow longer display for text instructions
|
||||
} else {
|
||||
get_tool_params_max_length()
|
||||
};
|
||||
|
||||
if !debug && s.len() > max_length {
|
||||
// For text instructions, show a preview instead of just "..."
|
||||
if key == "text_instruction" {
|
||||
let preview = &s[..max_length.saturating_sub(3)];
|
||||
println!(
|
||||
"{}{}: {}",
|
||||
indent,
|
||||
style(key).dim(),
|
||||
style(format!("{}...", preview)).green()
|
||||
);
|
||||
} else {
|
||||
println!("{}{}: {}", indent, style(key).dim(), style("...").dim());
|
||||
}
|
||||
} else {
|
||||
println!("{}{}: {}", indent, style(key).dim(), style(s).green());
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use goose::agents::sub_recipe_execution_tool::lib::TaskStatus;
|
||||
use goose::agents::sub_recipe_execution_tool::notification_events::{
|
||||
use goose::agents::subagent_execution_tool::lib::TaskStatus;
|
||||
use goose::agents::subagent_execution_tool::notification_events::{
|
||||
TaskExecutionNotificationEvent, TaskInfo,
|
||||
};
|
||||
use serde_json::Value;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use super::*;
|
||||
use goose::agents::sub_recipe_execution_tool::notification_events::{
|
||||
use goose::agents::subagent_execution_tool::notification_events::{
|
||||
FailedTaskInfo, TaskCompletionStats, TaskExecutionStats,
|
||||
};
|
||||
use serde_json::json;
|
||||
|
||||
Reference in New Issue
Block a user