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 CircuitBreakerConfig, CircuitBreakerState, CircuitState, CompileConfig, ErrorHandlerNode,
40 NodeMetadata, RetryPolicy, RetryingNode, StateGraph, TimeoutNode, execute_with_retry,
41 execute_with_timeout,
42};
43pub use compiled::{
44 CompiledGraph, DrawableEdge, DrawableGraph, DrawableNode, GraphOutput, GraphOutputMetadata,
45 InterruptInfo, StateFilter, StateUpdate, StreamHandle, SubgraphInfo,
46};
47#[cfg(all(feature = "chat", not(target_family = "wasm")))]
48pub use remote::RemoteGraph;
49pub use topology::TopologyError;
50
51// Rust guideline compliant 2026-05-19