ironflow_engine/lib.rs
1//! # ironflow-engine
2//!
3//! Workflow orchestration engine for **ironflow**.
4//!
5//! Workflows are defined as Rust-native handlers implementing
6//! [`WorkflowHandler`](handler::WorkflowHandler). Handlers receive a
7//! [`WorkflowContext`](context::WorkflowContext) and can chain step outputs,
8//! use native `if`/`else`/`match` for conditional branching, and execute
9//! steps in parallel.
10//!
11//! Handlers can be executed inline or enqueued for a background worker.
12//!
13//! ## Custom operations
14//!
15//! Implement [`Operation`](operation::Operation) to define custom step types
16//! (e.g. GitLab, Gmail, Slack) that integrate into the workflow lifecycle.
17//! Call [`WorkflowContext::operation()`](context::WorkflowContext::operation)
18//! inside a handler to execute them with full step tracking.
19//!
20//! # Example
21//!
22//! ```no_run
23//! use ironflow_engine::prelude::*;
24//! use std::future::Future;
25//! use std::pin::Pin;
26//!
27//! struct DeployWorkflow;
28//!
29//! impl WorkflowHandler for DeployWorkflow {
30//! fn name(&self) -> &str { "deploy" }
31//! fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
32//! Box::pin(async move {
33//! let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
34//! ctx.agent("review", AgentStepConfig::new(
35//! &format!("Review: {}", build.output["stdout"])
36//! )).await?;
37//! Ok(())
38//! })
39//! }
40//! }
41//! ```
42
43pub mod artifact;
44pub mod budget;
45pub mod config;
46pub mod context;
47pub mod engine;
48pub mod error;
49pub mod executor;
50pub mod fsm;
51pub mod guard;
52pub mod handler;
53pub mod log_sender;
54pub mod notify;
55pub mod operation;
56pub mod retry_policy;
57pub mod run_creator;
58pub mod schedule;
59
60/// Convenience re-exports.
61pub mod prelude {
62 pub use crate::artifact::{ArtifactSink, ArtifactUpload, DirectArtifactSink};
63 pub use crate::budget::BudgetConfig;
64 pub use crate::config::{AgentStepConfig, ApprovalConfig, HttpConfig, ShellConfig, StepConfig};
65 pub use crate::context::WorkflowContext;
66 pub use crate::engine::{Engine, EnqueueOptions, WorkflowResult};
67 pub use crate::error::EngineError;
68 pub use crate::executor::StepResult;
69 pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
70 pub use crate::guard::{WorkflowGuardConfig, WorkflowGuardState, WorkflowRejection};
71 pub use crate::handler::{HandlerFuture, WorkflowHandler};
72 pub use crate::notify::{
73 Event, EventPublisher, EventSubscriber, WebhookSubscriber, WorkflowEvent, WorkflowEventBus,
74 };
75 pub use crate::operation::Operation;
76 pub use crate::run_creator::{CreateRunOpts, RunCreator};
77 pub use crate::schedule::CronSchedule;
78}