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
//! The summarisation hook: collapse a long thread into one summary entry.
use ;
use crate::;
/// The boxed future a [`Summarizer`] returns.
///
/// An explicit boxed form rather than native `async fn` in the trait: the
/// summarizer is injected as `Arc<dyn Summarizer>` (an embedder may back it
/// with an LLM call), and native async-fn-in-trait is not dyn-compatible.
pub type SummarizeFuture<'a> = ;
/// Collapses a thread's entries into a single summary value.
///
/// Invoked by [`SessionState::set`](super::SessionState::set) when a thread
/// exceeds the configured threshold — the returned value replaces every
/// ordinary entry under the reserved [`SUMMARY_KEY`](super::SUMMARY_KEY)
/// atomically. A summarizer is an *injection point* (typically the consuming
/// agent or an embedder-provided LLM call); when none is installed, threads
/// simply grow and expire by TTL.
///
/// # Errors
///
/// An implementation returning `Err` aborts the collapse — the just-written
/// entry survives and the thread stays intact (state loss is worse than an
/// oversized thread), and the error is propagated to the `set` caller.
/// A [`Summarizer`] that records nothing but the entry count.
///
/// Useful in tests and as a documentation stub — installing it *does* collapse
/// threads at the threshold (into `{"entry_count": N}`); to keep threads
/// uncollapsed, install no summarizer at all.
;