feat: 新增技能编排引擎和工作流构建器组件
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
refactor: 统一Hands系统常量到单个源文件 refactor: 更新Hands中文名称和描述 fix: 修复技能市场在连接状态变化时重新加载 fix: 修复身份变更提案的错误处理逻辑 docs: 更新多个功能文档的验证状态和实现位置 docs: 更新Hands系统文档 test: 添加测试文件验证工作区路径
This commit is contained in:
@@ -9,6 +9,7 @@ mod export;
|
||||
mod http;
|
||||
mod skill;
|
||||
mod hand;
|
||||
mod orchestration;
|
||||
|
||||
pub use llm::*;
|
||||
pub use parallel::*;
|
||||
@@ -17,6 +18,7 @@ pub use export::*;
|
||||
pub use http::*;
|
||||
pub use skill::*;
|
||||
pub use hand::*;
|
||||
pub use orchestration::*;
|
||||
|
||||
use std::collections::HashMap;
|
||||
use std::sync::Arc;
|
||||
@@ -57,6 +59,9 @@ pub enum ActionError {
|
||||
|
||||
#[error("Invalid input: {0}")]
|
||||
InvalidInput(String),
|
||||
|
||||
#[error("Orchestration error: {0}")]
|
||||
Orchestration(String),
|
||||
}
|
||||
|
||||
/// Action registry - holds references to all action executors
|
||||
@@ -70,6 +75,9 @@ pub struct ActionRegistry {
|
||||
/// Hand registry (injected from kernel)
|
||||
hand_registry: Option<Arc<dyn HandActionDriver>>,
|
||||
|
||||
/// Orchestration driver (injected from kernel)
|
||||
orchestration_driver: Option<Arc<dyn OrchestrationActionDriver>>,
|
||||
|
||||
/// Template directory
|
||||
template_dir: Option<std::path::PathBuf>,
|
||||
}
|
||||
@@ -81,6 +89,7 @@ impl ActionRegistry {
|
||||
llm_driver: None,
|
||||
skill_registry: None,
|
||||
hand_registry: None,
|
||||
orchestration_driver: None,
|
||||
template_dir: None,
|
||||
}
|
||||
}
|
||||
@@ -103,6 +112,12 @@ impl ActionRegistry {
|
||||
self
|
||||
}
|
||||
|
||||
/// Set orchestration driver
|
||||
pub fn with_orchestration_driver(mut self, driver: Arc<dyn OrchestrationActionDriver>) -> Self {
|
||||
self.orchestration_driver = Some(driver);
|
||||
self
|
||||
}
|
||||
|
||||
/// Set template directory
|
||||
pub fn with_template_dir(mut self, dir: std::path::PathBuf) -> Self {
|
||||
self.template_dir = Some(dir);
|
||||
@@ -166,6 +181,22 @@ impl ActionRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
/// Execute a skill orchestration
|
||||
pub async fn execute_orchestration(
|
||||
&self,
|
||||
graph_id: Option<&str>,
|
||||
graph: Option<&Value>,
|
||||
input: HashMap<String, Value>,
|
||||
) -> Result<Value, ActionError> {
|
||||
if let Some(driver) = &self.orchestration_driver {
|
||||
driver.execute(graph_id, graph, input)
|
||||
.await
|
||||
.map_err(ActionError::Orchestration)
|
||||
} else {
|
||||
Err(ActionError::Orchestration("Orchestration driver not configured".to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Render classroom
|
||||
pub async fn render_classroom(&self, data: &Value) -> Result<Value, ActionError> {
|
||||
// This will integrate with the classroom renderer
|
||||
@@ -377,3 +408,14 @@ pub trait HandActionDriver: Send + Sync {
|
||||
params: HashMap<String, Value>,
|
||||
) -> Result<Value, String>;
|
||||
}
|
||||
|
||||
/// Orchestration action driver trait
|
||||
#[async_trait]
|
||||
pub trait OrchestrationActionDriver: Send + Sync {
|
||||
async fn execute(
|
||||
&self,
|
||||
graph_id: Option<&str>,
|
||||
graph: Option<&Value>,
|
||||
input: HashMap<String, Value>,
|
||||
) -> Result<Value, String>;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user