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
//! AG-UI Client Consumer
//!
//! This crate provides client-side event consumption for AG-UI streams.
//! It enables Rust applications to connect to AG-UI agents and receive
//! real-time event streams via SSE or WebSocket.
//!
//! # Features
//!
//! - **SSE Client**: Connect to Server-Sent Events endpoints
//! - **WebSocket Client**: Connect to WebSocket endpoints
//! - **Event Stream**: Unified stream abstraction for both transports
//! - **State Reconstruction**: Apply state deltas to reconstruct agent state
//!
//! # Example
//!
//! ```rust,ignore
//! use ag_ui_client::{SseClient, EventStream};
//! use futures::StreamExt;
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Connect to SSE endpoint
//! let client = SseClient::connect("http://localhost:3000/events").await?;
//!
//! // Process events
//! let mut stream = client.into_stream();
//! while let Some(event) = stream.next().await {
//! match event {
//! Ok(event) => println!("Received: {:?}", event.event_type()),
//! Err(e) => eprintln!("Error: {}", e),
//! }
//! }
//!
//! Ok(())
//! }
//! ```
// Re-export key types
pub use ClientError;
pub use SseClient;
pub use StateReconstructor;
pub use WsClient;
/// Re-export core types for convenience
pub use ;