Skip to main content

agent_context/context/events/
subscribe.rs

1//! 压缩订阅管理请求消息。
2//!
3//! 每条消息的 `impl Message<…> for `[`AgentContext`](super::super::actor::AgentContext) 块定义在
4//! [`context::actor`](super::super::actor) 模块中。
5
6use kameo::actor::ReplyRecipient;
7
8use super::outbound::NotifyCompressedForReply;
9
10/// 设置压缩结果订阅者。Reply = `()`。
11///
12/// 在 [`RequestCompress`](super::inbound::RequestCompress) 生成摘要后、写入 compressed 区之前,
13/// 将 [`NotifyCompressedForReply`] 发送给订阅者,订阅者返回修改后的 `(摘要, 保留)` 对。
14/// 后设覆盖前设(单例语义)。
15pub struct RequestSubscribeCompressed<M: Send + 'static> {
16    /// 压缩结果订阅者引用
17    pub recipient: ReplyRecipient<NotifyCompressedForReply<M>, (Vec<M>, Vec<M>)>,
18}
19
20/// 清除压缩结果订阅者。Reply = `()`。
21///
22/// 清除后 [`RequestCompress`](super::inbound::RequestCompress) 将跳过订阅者处理,直接使用原始摘要。
23pub struct RequestUnsubscribeCompressed;