feat(mcp): enhance MCP server registration with error handling and improve transport process management
refactor: update various tools for better error handling and path resolution fix: improve markdown rendering and input display in TUI
This commit is contained in:
@@ -9,7 +9,9 @@ use crate::tools::{arg_str, Tool, ToolCtx};
|
||||
use crate::workflow::engine::execution::execute_workflow;
|
||||
use crate::workflow::hive_mind::cycle::execute_cycle;
|
||||
use crate::workflow::hive_mind::synthesis::synthesize_consensus;
|
||||
use crate::workflow::hive_mind::types::{CognitiveCycle, NodeOutput};
|
||||
use crate::workflow::hive_mind::types::{
|
||||
CognitiveCycle, NodeDirective, NodeOutput,
|
||||
};
|
||||
use crate::workflow::script::WorkflowScript;
|
||||
|
||||
/// Execute a multi-step workflow defined in YAML.
|
||||
@@ -102,10 +104,16 @@ impl Tool for NoteFinding {
|
||||
|
||||
fn run(&self, ctx: &ToolCtx, args: &Value) -> Result<String> {
|
||||
let finding = crate::tools::arg_str(args, "finding")?;
|
||||
let category = args
|
||||
.get("category")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("general");
|
||||
|
||||
let tagged = format!("[{category}] {finding}");
|
||||
|
||||
if let Some(ref findings) = ctx.workflow_findings {
|
||||
if let Ok(mut guard) = findings.lock() {
|
||||
guard.push(finding.clone());
|
||||
guard.push(tagged);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,13 +213,24 @@ impl Tool for HiveMind {
|
||||
let mut all_node_outputs = Vec::new();
|
||||
|
||||
for (cycle_idx, cycle_val) in cycles_val.iter().enumerate() {
|
||||
let directives: Vec<String> = cycle_val
|
||||
let directives: Vec<NodeDirective> = cycle_val
|
||||
.get("directives")
|
||||
.and_then(|v| v.as_array())
|
||||
.map(|arr| {
|
||||
arr.iter()
|
||||
.filter_map(|d| d.get("directive").and_then(|v| v.as_str()))
|
||||
.map(String::from)
|
||||
.filter_map(|d| {
|
||||
let directive = d
|
||||
.get("directive")
|
||||
.and_then(|v| v.as_str())?;
|
||||
let access = d
|
||||
.get("access")
|
||||
.and_then(|v| v.as_str())
|
||||
.unwrap_or("read");
|
||||
Some(NodeDirective {
|
||||
directive: directive.to_string(),
|
||||
access_tier: access.to_string(),
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
Reference in New Issue
Block a user