refactor: 清理未使用代码并添加未来功能标记
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
Some checks failed
CI / Rust Check (push) Has been cancelled
CI / Lint & TypeCheck (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Build Frontend (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
CI / E2E Tests (push) Has been cancelled
style: 统一代码格式和注释风格 docs: 更新多个功能文档的完整度和状态 feat(runtime): 添加路径验证工具支持 fix(pipeline): 改进条件判断和变量解析逻辑 test(types): 为ID类型添加全面测试用例 chore: 更新依赖项和Cargo.lock文件 perf(mcp): 优化MCP协议传输和错误处理
This commit is contained in:
@@ -9,7 +9,7 @@ use super::ActionError;
|
||||
pub async fn execute_hand(
|
||||
hand_id: &str,
|
||||
action: &str,
|
||||
params: HashMap<String, Value>,
|
||||
_params: HashMap<String, Value>,
|
||||
) -> Result<Value, ActionError> {
|
||||
// This will be implemented by injecting the hand registry
|
||||
// For now, return an error indicating it needs configuration
|
||||
|
||||
@@ -8,7 +8,7 @@ use super::ActionError;
|
||||
/// Execute a skill by ID
|
||||
pub async fn execute_skill(
|
||||
skill_id: &str,
|
||||
input: HashMap<String, Value>,
|
||||
_input: HashMap<String, Value>,
|
||||
) -> Result<Value, ActionError> {
|
||||
// This will be implemented by injecting the skill registry
|
||||
// For now, return an error indicating it needs configuration
|
||||
|
||||
@@ -341,6 +341,15 @@ impl PipelineExecutor {
|
||||
return Ok(b);
|
||||
}
|
||||
|
||||
// Handle string "true" / "false" as boolean values
|
||||
if let Value::String(s) = &resolved {
|
||||
match s.as_str() {
|
||||
"true" => return Ok(true),
|
||||
"false" => return Ok(false),
|
||||
_ => {}
|
||||
}
|
||||
}
|
||||
|
||||
// Check for comparison operators
|
||||
let condition = condition.trim();
|
||||
|
||||
@@ -350,7 +359,16 @@ impl PipelineExecutor {
|
||||
let right = condition[eq_pos + 2..].trim();
|
||||
|
||||
let left_val = context.resolve(left)?;
|
||||
let right_val = context.resolve(right)?;
|
||||
// Handle quoted string literals for right side
|
||||
let right_val = if right.starts_with('\'') && right.ends_with('\'') {
|
||||
// Remove quotes and return as string value
|
||||
Value::String(right[1..right.len()-1].to_string())
|
||||
} else if right.starts_with('"') && right.ends_with('"') {
|
||||
// Remove double quotes and return as string value
|
||||
Value::String(right[1..right.len()-1].to_string())
|
||||
} else {
|
||||
context.resolve(right)?
|
||||
};
|
||||
|
||||
return Ok(left_val == right_val);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
//! - Custom variables
|
||||
|
||||
use std::collections::HashMap;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
use regex::Regex;
|
||||
|
||||
@@ -156,7 +155,26 @@ impl ExecutionContext {
|
||||
|
||||
match first {
|
||||
"inputs" => self.resolve_from_map(&self.inputs, rest, path),
|
||||
"steps" => self.resolve_from_map(&self.steps_output, rest, path),
|
||||
"steps" => {
|
||||
// Handle "output" as a special key for step outputs
|
||||
// steps.step_id.output.field -> steps_output["step_id"].field
|
||||
// steps.step_id.field -> steps_output["step_id"].field (also supported)
|
||||
if rest.len() >= 2 && rest[1] == "output" {
|
||||
// Skip "output" in the path: [step_id, "output", ...rest] -> [step_id, ...rest]
|
||||
let step_id = rest[0];
|
||||
let actual_rest = &rest[2..];
|
||||
let step_value = self.steps_output.get(step_id)
|
||||
.ok_or_else(|| StateError::VariableNotFound(step_id.to_string()))?;
|
||||
|
||||
if actual_rest.is_empty() {
|
||||
Ok(step_value.clone())
|
||||
} else {
|
||||
self.resolve_from_value(step_value, actual_rest, path)
|
||||
}
|
||||
} else {
|
||||
self.resolve_from_map(&self.steps_output, rest, path)
|
||||
}
|
||||
}
|
||||
"vars" | "var" => self.resolve_from_map(&self.variables, rest, path),
|
||||
"item" => {
|
||||
if let Some(ctx) = &self.loop_context {
|
||||
|
||||
@@ -8,6 +8,7 @@ pub const API_VERSION: &str = "zclaw/v1";
|
||||
|
||||
/// A complete pipeline definition
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct Pipeline {
|
||||
/// API version (must be "zclaw/v1")
|
||||
pub api_version: String,
|
||||
@@ -24,6 +25,7 @@ pub struct Pipeline {
|
||||
|
||||
/// Pipeline metadata
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineMetadata {
|
||||
/// Unique identifier (e.g., "classroom-generator")
|
||||
pub name: String,
|
||||
@@ -63,6 +65,7 @@ fn default_version() -> String {
|
||||
|
||||
/// Pipeline specification
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineSpec {
|
||||
/// Input parameters definition
|
||||
#[serde(default)]
|
||||
@@ -94,6 +97,7 @@ fn default_max_workers() -> usize {
|
||||
|
||||
/// Input parameter definition
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineInput {
|
||||
/// Parameter name
|
||||
pub name: String,
|
||||
@@ -142,6 +146,7 @@ pub enum InputType {
|
||||
|
||||
/// Validation rules for input
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct ValidationRules {
|
||||
/// Minimum length (for strings)
|
||||
#[serde(default)]
|
||||
@@ -166,6 +171,7 @@ pub struct ValidationRules {
|
||||
|
||||
/// A single step in the pipeline
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineStep {
|
||||
/// Unique step identifier
|
||||
pub id: String,
|
||||
@@ -368,6 +374,7 @@ pub struct ConditionBranch {
|
||||
|
||||
/// Retry configuration
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct RetryConfig {
|
||||
/// Maximum retry attempts
|
||||
#[serde(default = "default_max_retries")]
|
||||
@@ -424,6 +431,7 @@ impl std::fmt::Display for RunStatus {
|
||||
|
||||
/// Pipeline run information
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineRun {
|
||||
/// Unique run ID
|
||||
pub id: String,
|
||||
@@ -458,6 +466,7 @@ pub struct PipelineRun {
|
||||
|
||||
/// Progress information for a running pipeline
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct PipelineProgress {
|
||||
/// Run ID
|
||||
pub run_id: String,
|
||||
|
||||
Reference in New Issue
Block a user