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//! ## Testing handlers
21//!
22//! [`TestEngine`](testing::TestEngine) runs a handler against an in-memory
23//! store with mocked shell, HTTP, agent and approval steps, so a handler's
24//! logic can be asserted without a server, a worker or a real process.
25//!
26//! # Example
27//!
28//! ```no_run
29//! use ironflow_engine::prelude::*;
30//! use std::future::Future;
31//! use std::pin::Pin;
32//!
33//! struct DeployWorkflow;
34//!
35//! impl WorkflowHandler for DeployWorkflow {
36//! fn name(&self) -> &str { "deploy" }
37//! fn execute<'a>(&'a self, ctx: &'a mut WorkflowContext) -> HandlerFuture<'a> {
38//! Box::pin(async move {
39//! let build = ctx.shell("build", ShellConfig::new("cargo build")).await?;
40//! ctx.agent("review", AgentStepConfig::new(
41//! &format!("Review: {}", build.stdout())
42//! )).await?;
43//! Ok(())
44//! })
45//! }
46//! }
47//! ```
48
49// The derives of `ironflow-engine-macros` expand to `::ironflow_engine::...`; this
50// lets the crate's own tests and doc examples use them too.
51extern crate self as ironflow_engine;
52
53/// Engine version, compiled from `Cargo.toml` at build time.
54pub const VERSION: &str = env!("CARGO_PKG_VERSION");
55
56pub mod accounts;
57pub mod artifact;
58pub mod budget;
59pub mod cancel;
60mod chain;
61pub mod config;
62pub mod context;
63pub mod decision;
64pub mod engine;
65pub mod error;
66pub mod escalation;
67pub mod executor;
68pub mod fsm;
69pub mod guard;
70pub mod handler;
71pub mod log_sender;
72pub mod notify;
73pub mod operation;
74pub mod pause;
75pub mod plan;
76pub mod replay_policy;
77pub mod retry_policy;
78pub mod role_cost;
79pub mod run_creator;
80pub mod schedule;
81pub mod signal;
82pub mod testing;
83pub mod wake;
84
85/// Convenience re-exports.
86pub mod prelude {
87 pub use crate::artifact::{ArtifactSink, ArtifactUpload, DirectArtifactSink};
88 pub use crate::budget::BudgetConfig;
89 pub use crate::config::{
90 AgentRole, AgentStepConfig, AgentTask, ApprovalConfig, Approvers, CostPeriod, DelayConfig,
91 EscalationPolicy, HttpConfig, HumanInputConfig, MAX_ROLE_NAME_LEN, NotificationTarget,
92 Prompt, RoleCostCap, ShellConfig, StepConfig,
93 };
94 pub use crate::context::WorkflowContext;
95 pub use crate::engine::{Engine, EnqueueOptions, ExecutionMode, WorkflowResult};
96 pub use crate::error::EngineError;
97 pub use crate::executor::StepResult;
98 pub use crate::fsm::{RunEvent, RunFsm, StepEvent, StepFsm};
99 pub use crate::guard::{WorkflowGuardConfig, WorkflowGuardState, WorkflowRejection};
100 pub use crate::handler::{HandlerFuture, WorkflowHandler};
101 pub use crate::notify::{
102 Event, EventPublisher, EventSubscriber, WebhookSubscriber, WorkflowEvent, WorkflowEventBus,
103 };
104 pub use crate::operation::{
105 NoopSecretResolver, Operation, OperationContext, SecretResolver, SecretValue,
106 TypedOperation,
107 };
108 pub use crate::plan::{ConditionResult, ExecutionPlan, PlanOptions, PlannedStep};
109 pub use crate::run_creator::{CreateRunOpts, RunCreator};
110 pub use crate::schedule::{CatchupPolicy, CronSchedule, OverlapPolicy, SchedulePolicy};
111 pub use crate::signal::{Signal, SignalDelivery};
112 pub use crate::wake::RunWaker;
113}