feat(kernel): add multi-skill orchestration bridge + true parallel execution
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
- Kernel orchestration bridge: execute_orchestration, auto_compose_skills, validate_orchestration methods on Kernel struct - True parallel execution: replace sequential for-loop with tokio::JoinSet for concurrent node execution within parallel groups - Tauri commands: orchestration_execute (auto-compose or pre-defined graph), orchestration_validate (dry-run validation) - Full type conversions: OrchestrationRequest/Response with camelCase serde Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,7 @@ mod skills;
|
||||
mod hands;
|
||||
mod triggers;
|
||||
mod approvals;
|
||||
mod orchestration;
|
||||
#[cfg(feature = "multi-agent")]
|
||||
mod a2a;
|
||||
|
||||
|
||||
71
crates/zclaw-kernel/src/kernel/orchestration.rs
Normal file
71
crates/zclaw-kernel/src/kernel/orchestration.rs
Normal file
@@ -0,0 +1,71 @@
|
||||
//! Kernel-level orchestration methods
|
||||
//!
|
||||
//! Bridges the zclaw-skills orchestration engine to the Kernel,
|
||||
//! providing high-level orchestration execution via Tauri commands.
|
||||
|
||||
use std::collections::HashMap;
|
||||
use serde_json::Value;
|
||||
use zclaw_types::Result;
|
||||
|
||||
use super::Kernel;
|
||||
use zclaw_skills::orchestration::{OrchestrationPlanner, SkillGraphExecutor};
|
||||
|
||||
impl Kernel {
|
||||
/// Execute a skill orchestration graph with the given inputs.
|
||||
///
|
||||
/// This creates a `DefaultExecutor` backed by the kernel's `SkillRegistry`,
|
||||
/// builds an execution plan, and runs the graph with true parallel execution
|
||||
/// within each parallel group.
|
||||
pub async fn execute_orchestration(
|
||||
&self,
|
||||
graph: &zclaw_skills::orchestration::SkillGraph,
|
||||
inputs: HashMap<String, Value>,
|
||||
context: &zclaw_skills::SkillContext,
|
||||
) -> Result<zclaw_skills::orchestration::OrchestrationResult> {
|
||||
let executor = zclaw_skills::orchestration::DefaultExecutor::new(
|
||||
self.skills.clone(),
|
||||
);
|
||||
|
||||
executor.execute(graph, inputs, context).await
|
||||
}
|
||||
|
||||
/// Execute an orchestration with progress tracking.
|
||||
///
|
||||
/// The `progress_fn` callback is invoked at each stage of execution,
|
||||
/// allowing the frontend to display real-time progress.
|
||||
pub async fn execute_orchestration_with_progress<F>(
|
||||
&self,
|
||||
graph: &zclaw_skills::orchestration::SkillGraph,
|
||||
inputs: HashMap<String, Value>,
|
||||
context: &zclaw_skills::SkillContext,
|
||||
progress_fn: F,
|
||||
) -> Result<zclaw_skills::orchestration::OrchestrationResult>
|
||||
where
|
||||
F: Fn(zclaw_skills::orchestration::OrchestrationProgress) + Send + Sync,
|
||||
{
|
||||
let executor = zclaw_skills::orchestration::DefaultExecutor::new(
|
||||
self.skills.clone(),
|
||||
);
|
||||
|
||||
executor.execute_with_progress(graph, inputs, context, progress_fn).await
|
||||
}
|
||||
|
||||
/// Auto-compose a skill graph from a list of skill IDs.
|
||||
///
|
||||
/// Analyzes input/output schemas to infer data flow edges between skills.
|
||||
pub async fn auto_compose_skills(
|
||||
&self,
|
||||
skill_ids: &[zclaw_types::SkillId],
|
||||
) -> Result<zclaw_skills::orchestration::SkillGraph> {
|
||||
let planner = zclaw_skills::orchestration::DefaultPlanner::new();
|
||||
planner.auto_compose(skill_ids, &self.skills).await
|
||||
}
|
||||
|
||||
/// Validate a skill graph without executing it.
|
||||
pub async fn validate_orchestration(
|
||||
&self,
|
||||
graph: &zclaw_skills::orchestration::SkillGraph,
|
||||
) -> Vec<zclaw_skills::orchestration::ValidationError> {
|
||||
zclaw_skills::orchestration::validate_graph(graph, &self.skills).await
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user