//! Consensus synthesis — reconciles multiple node outputs into one assessment. use anyhow::Result; use tracing::info; use crate::tools::ToolCtx; use zesdex_domain::workflow::NodeOutput; /// Synthesize a consensus from all node outputs. /// /// Flow: combine node outputs → return consensus text. /// Uses simple concatenation-based synthesis (avoids LLM call dependency). pub async fn synthesize_consensus( nodes: &[NodeOutput], _tool_ctx: &ToolCtx, ) -> Result { info!("Synthesizing consensus from {} nodes", nodes.len()); let mut combined = String::new(); for node in nodes { combined.push_str(&format!( "\n## {} — {}\n\n{}\n", node.id, node.directive, node.output )); } Ok(format!( "# Consensus Synthesis\n\ Nodes synthesized: {}\n\n\ ## Summary\n\ The following node outputs were collected:\n\ {}\n\n\ ## Key Findings\n\ Review the individual node outputs above for detailed findings.", nodes.len(), combined )) }