Skip to main content

syncable_ag_ui_client/
lib.rs

1//! AG-UI Client Consumer
2//!
3//! This crate provides client-side event consumption for AG-UI streams.
4//! It enables Rust applications to connect to AG-UI agents and receive
5//! real-time event streams via SSE or WebSocket.
6//!
7//! # Features
8//!
9//! - **SSE Client**: Connect to Server-Sent Events endpoints
10//! - **WebSocket Client**: Connect to WebSocket endpoints
11//! - **Event Stream**: Unified stream abstraction for both transports
12//! - **State Reconstruction**: Apply state deltas to reconstruct agent state
13//!
14//! # Example
15//!
16//! ```rust,ignore
17//! use ag_ui_client::{SseClient, EventStream};
18//! use futures::StreamExt;
19//!
20//! #[tokio::main]
21//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
22//!     // Connect to SSE endpoint
23//!     let client = SseClient::connect("http://localhost:3000/events").await?;
24//!
25//!     // Process events
26//!     let mut stream = client.into_stream();
27//!     while let Some(event) = stream.next().await {
28//!         match event {
29//!             Ok(event) => println!("Received: {:?}", event.event_type()),
30//!             Err(e) => eprintln!("Error: {}", e),
31//!         }
32//!     }
33//!
34//!     Ok(())
35//! }
36//! ```
37
38pub mod error;
39pub mod sse;
40pub mod state;
41pub mod ws;
42
43// Re-export key types
44pub use error::ClientError;
45pub use sse::SseClient;
46pub use state::StateReconstructor;
47pub use ws::WsClient;
48
49/// Re-export core types for convenience
50pub use syncable_ag_ui_core::{Event, EventType, JsonValue};