1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//! # flow-runner
//!
//! A small decision engine. You write rules in a `.flow` file; the host passes
//! in data and gets back a decision. The engine never does I/O, never reads the
//! clock, and never performs actions: it decides, and the host acts.
//!
//! ```
//! use flow_runner::{Decision, Flow, Input, Limits, Value};
//!
//! let flow = Flow::compile(r#"
//! edition 2026
//! flow return-window
//! entry evaluate
//!
//! param windowDays = 30
//!
//! node evaluate =
//! let age = input.data.evaluatedAt - input.data.deliveredAt
//! when {
//! age > windowDays * 86400: { "eligible": false, "reason": "WindowExpired" }
//! else: { "eligible": true }
//! }
//! "#).unwrap();
//!
//! let data = Value::obj([
//! ("evaluatedAt", Value::Int(1_774_166_400)),
//! ("deliveredAt", Value::Int(1_772_870_400)),
//! ]);
//! let decision = flow.run(Input::start("evaluate", data), &Limits::default()).unwrap();
//! let Decision::Value { value, .. } = decision else { panic!() };
//! assert_eq!(value, Value::obj([("eligible", Value::Bool(true))]));
//! ```
//!
//! Expressions inside a flow are [temple-dsl](https://docs.rs/temple-dsl).
//!
//! # How the pieces fit
//!
//! - [`Flow::compile`] parses and checks the text and produces a [`Flow`].
//! Problems are [`Diagnostics`], each with a span into the source.
//! - [`Flow::run`] walks the flow for one [`Input`] and returns a
//! [`Decision`], with a [`Token`] to continue from later.
//! - [`Flow::to_bytes`] and [`Flow::from_bytes`] store a flow.
//! - [`Document`] edits a flow as text, for a visual builder.
//!
//! # Features
//!
//! - `json`: conversions to and from `serde_json`, and [`Graph::to_json`].
//! - `cli`: the `flow` command-line tool. Implies `json`.
pub use ;
pub use ;
pub use ;
pub use BLOB_VERSION;
pub use ;
pub use ;
pub use ;
pub use ;