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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
//! MidStream: Real-Time Large Language Model Streaming Platform
//!
//! This library provides functionality for real-time LLM response streaming,
//! inflight data analysis, and integration with external tools.
//!
//! # Example
//!
//! ```rust,no_run
//! use midstream::{Midstream, HyprSettings, HyprServiceImpl, StreamProcessor, LLMClient};
//! use bytes::Bytes;
//! use futures::stream::BoxStream;
//! use futures::stream::iter;
//! use std::time::Duration;
//!
//! // Example LLM client implementation
//! struct ExampleLLMClient;
//!
//! impl LLMClient for ExampleLLMClient {
//! fn stream(&self) -> BoxStream<'static, Bytes> {
//! Box::pin(iter(vec![
//! Bytes::from_static(b"Processing"),
//! Bytes::from_static(b"the"),
//! Bytes::from_static(b"stream"),
//! ]))
//! }
//! }
//!
//! #[tokio::main]
//! async fn main() -> Result<(), Box<dyn std::error::Error>> {
//! // Initialize settings
//! let settings = HyprSettings::new()?;
//!
//! // Create hyprstream service
//! let hypr_service = HyprServiceImpl::new(&settings).await?;
//!
//! // Create LLM client
//! let llm_client = ExampleLLMClient;
//!
//! // Initialize Midstream
//! let midstream = Midstream::new(
//! Box::new(llm_client),
//! Box::new(hypr_service),
//! );
//!
//! // Process stream
//! let messages = midstream.process_stream().await?;
//! println!("Processed messages: {:?}", messages);
//!
//! // Get metrics
//! let metrics = midstream.get_metrics().await;
//! println!("Collected metrics: {:?}", metrics);
//!
//! // Get average sentiment for last 5 minutes
//! let avg = midstream.get_average_sentiment(Duration::from_secs(300)).await?;
//! println!("Average sentiment: {}", avg);
//!
//! Ok(())
//! }
//! ```
// `lean_agentic` is the legacy in-tree subsystem that ADR-0005 retires.
// It currently fails to compile and duplicates functionality in the
// `midstreamer-*` workspace crates. Gated off-by-default until the
// dedup refactor lands; consumers wanting the old API still build with
// `--features lean-agentic` and accept the broken-build risk.
pub use HyprSettings;
pub use ;
pub use HyprServiceImpl;
// Lean Agentic Learning System exports — gated behind the same feature.
// Once ADR-0005's dedup ships, the canonical home for these types is
// the published `midstreamer-*` crates; this re-export block goes away.
pub use ;