Skip to main content

entelix_graph/
lib.rs

1//! # entelix-graph
2//!
3//! Control-flow contract for entelix (invariant 8). Houses
4//! [`StateGraph<S>`] with typed state, the [`Reducer<T>`] trait,
5//! conditional / fan-out edges, subgraphs, the [`Checkpointer`]
6//! trait plus [`InMemoryCheckpointer`], and the [`Command<S>`]
7//! HITL resume API. `recursion_limit` (F6 mitigation) is enforced
8//! here. The HITL pause primitive
9//! ([`entelix_core::interrupt`] / [`entelix_core::interrupt_with`])
10//! lives in `entelix-core` so tools, nodes, and middleware layers
11//! all raise the same `Error::Interrupted` shape.
12//!
13//! Surface: [`StateGraph<S>`] builder with static and conditional
14//! edges + [`CompiledGraph<S>`] executor with `recursion_limit`
15//! enforcement and the [`END`] sentinel target. [`Checkpointer`] +
16//! [`InMemoryCheckpointer`] for write-after-each-node persistence;
17//! [`CompiledGraph::resume`] / [`CompiledGraph::resume_with`] crash
18//! recovery. [`Command<S>`] for typed resume payloads.
19
20#![cfg_attr(docsrs, feature(doc_cfg))]
21#![doc(html_root_url = "https://docs.rs/entelix-graph/0.5.3")]
22#![deny(missing_docs)]
23// Doc prose for Reducer/Dispatch references LangGraph by name and
24// uses long opening paragraphs that explain the parity intent;
25// pedantic doc-style lints fire on both. We accept the trade-off.
26#![allow(clippy::doc_markdown, clippy::too_long_first_doc_paragraph)]
27
28mod checkpoint;
29mod command;
30mod compiled;
31mod contributing_node;
32mod dispatch;
33mod finalizing_stream;
34mod in_memory_checkpointer;
35mod merge_node;
36mod reducer;
37mod state_graph;
38
39pub use checkpoint::{Checkpoint, CheckpointId, Checkpointer};
40pub use command::Command;
41pub use compiled::{
42    CompiledGraph, ConditionalEdge, EdgeSelector, SendEdge, SendMerger, SendSelector,
43};
44pub use contributing_node::ContributingNodeAdapter;
45pub use dispatch::{Dispatch, scatter};
46pub use finalizing_stream::FinalizingStream;
47pub use in_memory_checkpointer::InMemoryCheckpointer;
48pub use merge_node::MergeNodeAdapter;
49pub use reducer::{Annotated, Append, Max, MergeMap, Reducer, Replace, StateMerge};
50pub use state_graph::{CheckpointGranularity, DEFAULT_RECURSION_LIMIT, END, StateGraph};
51
52// Companion `#[derive(StateMerge)]` proc-macro. Lives in the macro
53// namespace, so the same-name re-export coexists with the trait
54// above (serde's `Serialize` / `Deserialize` follow the same shape).
55pub use entelix_graph_derive::StateMerge;