bamboo_notification/lib.rs
1//! Notification policy for the Bamboo agent framework.
2//!
3//! This crate owns the *decision* of whether a given [`AgentEvent`] should
4//! surface to the user as a notification. It is deliberately a self-contained
5//! infra crate with no I/O beyond reading/writing a small preferences file and
6//! no async runtime: it classifies events, gates them against user
7//! [`NotificationPreferences`], and coalesces duplicates within a short window.
8//!
9//! The pipeline is three layers:
10//!
11//! - [`preferences`] — the user's opt-in/opt-out flags, persisted as JSON.
12//! - [`policy`] — a pure [`classify`](policy::classify) function mapping an
13//! [`AgentEvent`] + preferences into an optional
14//! [`ClassifiedNotification`](policy::ClassifiedNotification).
15//! - [`service`] — a `Send + Sync` [`NotificationService`] that wraps policy
16//! with a dedup window, preference persistence, and per-session relay
17//! idempotency for the server to hang off an `Arc`.
18//!
19//! The server constructs the user-facing
20//! [`AgentEvent::Notification`](bamboo_agent_core::AgentEvent::Notification);
21//! the client merely delivers it after its own presence checks.
22//!
23//! [`AgentEvent`]: bamboo_agent_core::AgentEvent
24
25pub mod policy;
26pub mod preferences;
27pub mod service;
28
29pub use policy::{NotificationCategory, NotificationPriority};
30pub use preferences::NotificationPreferences;
31pub use service::NotificationService;