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
//! Communicator middleware — transparent wrappers that enhance any
//! [`ElicitCommunicator`] with context accumulation, observability, etc.
//!
//! # Overview
//!
//! The middleware in this module follow a common pattern: wrap an inner
//! [`ElicitCommunicator`], forward all calls unchanged (or with minimal
//! enrichment), and provide side-effects like logging, state injection, or
//! channel notifications.
//!
//! All middleware implement [`ElicitCommunicator`] themselves, so they compose
//! naturally:
//!
//! ```rust,ignore
//! use elicitation::middleware::{ContextualCommunicator, ObservableCommunicator, knowledge_cache};
//! use elicitation::ElicitClient;
//! use tokio::sync::watch;
//!
//! let knowledge = knowledge_cache();
//! let (prompt_tx, _prompt_rx) = watch::channel(None);
//!
//! let comm = ObservableCommunicator::new(
//! ContextualCommunicator::new(
//! ElicitClient::new(config),
//! knowledge
//! ),
//! prompt_tx
//! );
//! ```
//!
//! # Available middleware
//!
//! - [`ContextualCommunicator`] — prepends accumulated knowledge to every prompt
//! (solves stateless elicitation protocol for stateful experiences)
//! - [`ObservableCommunicator`] — publishes exchanges to watch/mpsc channels
//! (enables chat UIs, debug logging, replay systems)
//!
//! [`ElicitCommunicator`]: crate::ElicitCommunicator
pub use ;
pub use ;