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
43/// Engine version, compiled from `Cargo.toml` at build time.
44pub const VERSION: &str = env!("CARGO_PKG_VERSION");
45
46pub mod artifact;
47pub mod budget;
48pub mod config;
49pub mod context;
50mod control_flow;
51pub mod engine;
52pub mod error;
53pub mod escalation;
54pub mod executor;
55pub mod fsm;
56pub mod guard;
57pub mod handler;
58pub mod log_sender;
59pub mod notify;
60pub mod operation;
61pub mod retry_policy;
62pub mod run_creator;
63pub mod schedule;
64
65/// Convenience re-exports.
66pub mod prelude {
67 pub use crate::artifact::{ArtifactSink, ArtifactUpload, DirectArtifactSink};
68 pub use crate::budget::BudgetConfig;
69 pub use crate::config::{
70 AgentStepConfig, ApprovalConfig, DelayConfig, EscalationPolicy, HttpConfig,
71 NotificationTarget, ShellConfig, StepConfig,
72 };
73 pub use crate::context::WorkflowContext;
74 pub use crate::engine::{Engine, EnqueueOptions, WorkflowResult};
75 pub use crate::error::EngineError;
76 pub use crate::executor::StepResult;
77 pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
78 pub use crate::guard::{WorkflowGuardConfig, WorkflowGuardState, WorkflowRejection};
79 pub use crate::handler::{HandlerFuture, WorkflowHandler};
80 pub use crate::notify::{
81 Event, EventPublisher, EventSubscriber, WebhookSubscriber, WorkflowEvent, WorkflowEventBus,
82 };
83 pub use crate::operation::{
84 NoopSecretResolver, Operation, OperationContext, SecretResolver, SecretValue,
85 TypedOperation,
86 };
87 pub use crate::run_creator::{CreateRunOpts, RunCreator};
88 pub use crate::schedule::CronSchedule;
89}