Files
zclaw_openfang/desktop/src-tauri/src/pipeline_commands/mod.rs
iven f79560a911 refactor(desktop): split kernel_commands/pipeline_commands into modules, add SaaS client libs and gateway modules
Split monolithic kernel_commands.rs (2185 lines) and pipeline_commands.rs (1391 lines)
into focused sub-modules under kernel_commands/ and pipeline_commands/ directories.
Add gateway module (commands, config, io, runtime), health_check, and 15 new
TypeScript client libraries for SaaS relay, auth, admin, telemetry, and kernel
sub-systems (a2a, agent, chat, hands, skills, triggers).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-31 11:12:47 +08:00

64 lines
2.2 KiB
Rust

//! Pipeline commands for Tauri
//!
//! Commands for discovering, running, and monitoring Pipelines.
pub mod adapters;
pub mod types;
pub mod discovery;
pub mod crud;
pub mod helpers;
pub mod intent_router;
pub mod presentation;
use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::sync::RwLock;
use zclaw_pipeline::{Pipeline, PipelineExecutor, ActionRegistry};
// Re-export key types from sub-modules for external consumers
#[allow(unused_imports)]
pub use adapters::{RuntimeLlmAdapter, PipelineSkillDriver, PipelineHandDriver};
#[allow(unused_imports)]
pub use types::{PipelineInfo, PipelineInputInfo, RunPipelineRequest, RunPipelineResponse, PipelineRunResponse};
#[allow(unused_imports)]
pub use crud::{CreatePipelineRequest, UpdatePipelineRequest, WorkflowStepInput};
#[allow(unused_imports)]
pub use intent_router::{RouteResultResponse, MissingParamInfo, PipelineCandidateInfo};
#[allow(unused_imports)]
pub use presentation::PipelineTemplateInfo;
/// Pipeline state wrapper for Tauri
pub struct PipelineState {
/// Pipeline executor
pub executor: Arc<PipelineExecutor>,
/// Discovered pipelines (id -> Pipeline)
pub pipelines: RwLock<HashMap<String, Pipeline>>,
/// Pipeline file paths (id -> path)
pub pipeline_paths: RwLock<HashMap<String, PathBuf>>,
}
impl PipelineState {
pub fn new(action_registry: Arc<ActionRegistry>) -> Self {
Self {
executor: Arc::new(PipelineExecutor::new(action_registry)),
pipelines: RwLock::new(HashMap::new()),
pipeline_paths: RwLock::new(HashMap::new()),
}
}
}
/// Create pipeline state with default action registry
pub fn create_pipeline_state() -> Arc<PipelineState> {
// Try to create an LLM driver from environment/config
let action_registry = if let Some(driver) = intent_router::create_llm_driver_from_config() {
tracing::debug!("[create_pipeline_state] LLM driver configured successfully");
Arc::new(ActionRegistry::new().with_llm_driver(driver))
} else {
tracing::debug!("[create_pipeline_state] No LLM driver configured - pipelines requiring LLM will fail");
Arc::new(ActionRegistry::new())
};
Arc::new(PipelineState::new(action_registry))
}