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:
@@ -5,7 +5,7 @@ use std::path::{Path, PathBuf};
|
||||
use anyhow::Result;
|
||||
use tracing::{info, instrument};
|
||||
|
||||
use crate::workflow::hive_mind::types::NodeOutput;
|
||||
use zesdex_domain::workflow::NodeOutput;
|
||||
|
||||
/// Write a deterministic audit trail for a hive-mind convergence.
|
||||
///
|
||||
|
||||
@@ -6,7 +6,7 @@ use tracing::{info, instrument};
|
||||
use crate::llm::provider::LlmClient;
|
||||
use crate::tools::ToolCtx;
|
||||
use crate::workflow::engine::primitives::execute_primitive;
|
||||
use crate::workflow::script::WorkflowScript;
|
||||
use zesdex_domain::workflow::WorkflowScript;
|
||||
|
||||
/// Execute each phase of a workflow script sequentially.
|
||||
///
|
||||
|
||||
@@ -15,7 +15,7 @@ use crate::subagent::context::SubagentContext;
|
||||
use crate::subagent::division::AccessTier;
|
||||
use crate::subagent::engine::run_agent;
|
||||
use crate::tools::ToolCtx;
|
||||
use crate::workflow::hive_mind::types::{CognitiveCycle, NodeOutput};
|
||||
use zesdex_domain::workflow::{CognitiveCycle, NodeOutput};
|
||||
|
||||
/// Execute one cycle: run each node directive and collect outputs.
|
||||
///
|
||||
@@ -56,7 +56,7 @@ pub async fn execute_cycle(
|
||||
|
||||
let cycle_index = cycle.index;
|
||||
|
||||
use crate::workflow::hive_mind::types::NodeDirective;
|
||||
use zesdex_domain::workflow::NodeDirective;
|
||||
|
||||
// Run all directives in this cycle concurrently.
|
||||
let handles: Vec<_> = cycle
|
||||
|
||||
@@ -4,7 +4,7 @@ use anyhow::Result;
|
||||
use tracing::info;
|
||||
|
||||
use crate::tools::ToolCtx;
|
||||
use crate::workflow::hive_mind::types::NodeOutput;
|
||||
use zesdex_domain::workflow::NodeOutput;
|
||||
|
||||
/// Synthesize a consensus from all node outputs.
|
||||
///
|
||||
|
||||
@@ -1,31 +1,3 @@
|
||||
//! Hive-mind shared types — node directives, cycle plans, and node outputs.
|
||||
|
||||
/// A directive for a single processing node in the hive mind.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NodeDirective {
|
||||
pub directive: String,
|
||||
pub access_tier: String,
|
||||
}
|
||||
|
||||
/// A cognitive cycle plan — ordered list of cycles, each containing
|
||||
/// parallel node directives.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CognitiveCyclePlan {
|
||||
pub cycles: Vec<Vec<NodeDirective>>,
|
||||
}
|
||||
|
||||
/// A single cycle in a cognitive cycle plan — parallel node directives
|
||||
/// executed together.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CognitiveCycle {
|
||||
pub index: u32,
|
||||
pub directives: Vec<NodeDirective>,
|
||||
}
|
||||
|
||||
/// Output from a single hive-mind processing node after a cycle completes.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct NodeOutput {
|
||||
pub id: String,
|
||||
pub directive: String,
|
||||
pub output: String,
|
||||
}
|
||||
// Types have been moved to zesdex_domain::workflow
|
||||
|
||||
@@ -3,24 +3,11 @@
|
||||
use anyhow::Result;
|
||||
use tracing::{info, instrument};
|
||||
|
||||
/// A single phase in a parsed workflow script.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkflowPhase {
|
||||
pub name: String,
|
||||
pub directive: String,
|
||||
}
|
||||
use zesdex_domain::workflow::{WorkflowPhase, WorkflowScript};
|
||||
|
||||
/// A parsed workflow script with named phases.
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct WorkflowScript {
|
||||
pub name: String,
|
||||
pub phases: Vec<WorkflowPhase>,
|
||||
}
|
||||
|
||||
impl WorkflowScript {
|
||||
/// Parse a YAML string into a WorkflowScript.
|
||||
///
|
||||
/// Expected format:
|
||||
/// Parse a YAML string into a WorkflowScript.
|
||||
///
|
||||
/// Expected format:
|
||||
/// ```yaml
|
||||
/// name: my-workflow
|
||||
/// phases:
|
||||
@@ -30,7 +17,7 @@ impl WorkflowScript {
|
||||
/// directive: "Implement the changes..."
|
||||
/// ```
|
||||
#[instrument]
|
||||
pub fn parse(yaml: &str) -> Result<Self> {
|
||||
pub fn parse_workflow_script(yaml: &str) -> Result<WorkflowScript> {
|
||||
let parsed: serde_json::Value = serde_yaml_ng::from_str(yaml)
|
||||
.map_err(|e| anyhow::anyhow!("Failed to parse workflow YAML: {e}"))?;
|
||||
|
||||
@@ -62,5 +49,4 @@ impl WorkflowScript {
|
||||
|
||||
info!("Parsed workflow script: {name} ({} phases)", phases.len());
|
||||
Ok(WorkflowScript { name, phases })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user