Refactor subagent and workflow domain models; migrate access tiers and events to domain module
- Moved `AccessTier` and `SubagentEvent` enums to `zesdex_domain::subagent`. - Consolidated workflow-related types into `zesdex_domain::workflow`. - Updated references across the codebase to use the new domain models. - Refactored tool execution logic to utilize a new `ToolExecutor` trait. - Enhanced `AgentTurnService` to handle tool calls and events more effectively. - Adjusted API handlers and state management to align with new domain structure.
This commit is contained in:
@@ -200,7 +200,8 @@ impl Tool for ParallelDelegate {
|
||||
|
||||
// Consolidate results
|
||||
if synthesize && results.len() > 1 {
|
||||
let consolidated = consolidate_results(&results, &base_url, &api_key, &model)?;
|
||||
let rt = tokio::runtime::Runtime::new()?;
|
||||
let consolidated = rt.block_on(consolidate_results(&results, &base_url, &api_key, &model))?;
|
||||
Ok(format!(
|
||||
"## Parallel Delegation Complete\n\n**Task:** {task}\n**Parallel agents:** {}\n\n{}",
|
||||
results.len(),
|
||||
@@ -249,8 +250,9 @@ async fn auto_split_task(
|
||||
let user_msg =
|
||||
zesdex_domain::core::ChatMessage::user(format!("Task: {task}\n\nSplit into {max_parallel} parallel directives:"));
|
||||
|
||||
use zesdex_application::ports::ProviderService;
|
||||
match client
|
||||
.chat_with_tools_non_streaming(&[sys_msg, user_msg], None, Some(2048), Some(0.4), None)
|
||||
.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.4)).await
|
||||
{
|
||||
Ok((response, _)) => {
|
||||
let text = response.content.unwrap_or_default();
|
||||
@@ -339,7 +341,7 @@ fn fallback_split(task: &str, max_parallel: usize) -> Vec<(String, AccessTier)>
|
||||
}
|
||||
|
||||
/// Use LLM to consolidate multiple agent results into a single response.
|
||||
fn consolidate_results(
|
||||
async fn consolidate_results(
|
||||
results: &[(usize, String, String)],
|
||||
base_url: &str,
|
||||
api_key: &str,
|
||||
@@ -367,7 +369,8 @@ fn consolidate_results(
|
||||
"Consolidate the following parallel agent outputs:\n\n{summary}"
|
||||
));
|
||||
|
||||
match client.chat_with_tools_non_streaming(&[sys_msg, user_msg], None, Some(2048), Some(0.3), None) {
|
||||
use zesdex_application::ports::ProviderService;
|
||||
match client.chat(&[sys_msg, user_msg], None, Some(2048), Some(0.3)).await {
|
||||
Ok((response, _)) => Ok(response.content.unwrap_or_else(|| summary.clone())),
|
||||
Err(e) => {
|
||||
warn!(error = %e, "consolidation LLM call failed, using raw concatenation");
|
||||
|
||||
Reference in New Issue
Block a user