juncture_core/graph/mod.rs
1//! Graph building, compilation, and topology validation
2//!
3//! This module provides the core graph construction API for Juncture.
4//! It includes:
5//! - [`StateGraph`]: Builder for constructing executable graphs
6//! - [`CompiledGraph`]: Optimized, validated graph for execution
7//! - [`TopologyValidator`]: Ensures graph structure is valid
8//! - [`TopologyError`]: Validation failure details
9//!
10//! # Examples
11//!
12//! ```ignore
13//! use juncture_core::{StateGraph, State, Node, IntoNode};
14//!
15//! struct MyState;
16//! impl State for MyState { type Update = MyStateUpdate; }
17//! struct MyStateUpdate;
18//!
19//! // Build a simple graph
20//! let mut graph = StateGraph::<MyState>::new();
21//! graph.add_node_simple("process", |state: MyState| async move {
22//! Ok(MyStateUpdate)
23//! });
24//! graph.set_entry_point("process");
25//! graph.set_finish_point("process");
26//!
27//! // Compile and validate
28//! let compiled = graph.compile()?;
29//! # Ok::<(), juncture_core::graph::TopologyError>(())
30//! ```
31
32mod builder;
33mod compiled;
34#[cfg(all(feature = "chat", not(target_family = "wasm")))]
35mod remote;
36mod topology;
37
38pub use builder::{
39 CompileConfig, ErrorHandlerNode, NodeMetadata, RetryPolicy, RetryingNode, StateGraph,
40 TimeoutNode, execute_with_retry, execute_with_timeout,
41};
42pub use compiled::{
43 CompiledGraph, DrawableEdge, DrawableGraph, DrawableNode, GraphOutput, GraphOutputMetadata,
44 InterruptInfo, StateFilter, StateUpdate, StreamHandle, SubgraphInfo,
45};
46#[cfg(all(feature = "chat", not(target_family = "wasm")))]
47pub use remote::RemoteGraph;
48pub use topology::TopologyError;
49
50// Rust guideline compliant 2026-05-19