feat(tui): implement status bar with connection and turn state indicators feat(tui): create workflow panel for agent status and progress visualization feat(web): introduce web frontend interface with static file serving feat(ws): add WebSocket interface for real-time communication and session management
43 lines
1.3 KiB
Rust
43 lines
1.3 KiB
Rust
//! Hive-mind convergence documentation — writes deterministic audit trail.
|
|
|
|
use std::path::{Path, PathBuf};
|
|
|
|
use anyhow::Result;
|
|
use tracing::info;
|
|
|
|
use crate::workflow::hive_mind::types::NodeOutput;
|
|
|
|
/// Write a deterministic audit trail for a hive-mind convergence.
|
|
///
|
|
/// Flow: create docs/runs/ dir → build markdown content → write file.
|
|
/// This is deterministic (not an LLM step) and never skippable.
|
|
pub fn write_hive_mind_convergence(
|
|
run_dir: &Path,
|
|
nodes: &[NodeOutput],
|
|
consensus: &str,
|
|
) -> Result<PathBuf> {
|
|
let docs_dir = run_dir.join("docs/runs");
|
|
std::fs::create_dir_all(&docs_dir)?;
|
|
|
|
let timestamp = chrono::Utc::now().format("%Y%m%d_%H%M%S");
|
|
let filename = format!("{timestamp}-hive-mind-convergence.md");
|
|
let filepath = docs_dir.join(&filename);
|
|
|
|
let mut content = String::new();
|
|
content.push_str(&format!("# Hive Mind Convergence — {timestamp}\n\n"));
|
|
|
|
content.push_str("## Node Outputs\n\n");
|
|
for node in nodes {
|
|
content.push_str(&format!("### {} — {}\n\n", node.id, node.directive));
|
|
content.push_str(&format!("{}\n\n", node.output));
|
|
}
|
|
|
|
content.push_str("## Consensus\n\n");
|
|
content.push_str(consensus);
|
|
content.push('\n');
|
|
|
|
std::fs::write(&filepath, content)?;
|
|
info!("Hive mind convergence written to {:?}", filepath);
|
|
Ok(filepath)
|
|
}
|