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:
asepharyana
2026-07-21 06:42:53 +07:00
parent 552bc5bc63
commit 802346f909
31 changed files with 968 additions and 870 deletions
@@ -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