pub struct NotificationPreferences {
pub enabled: bool,
pub on_clarification: bool,
pub on_tool_approval: bool,
pub on_context_pressure: bool,
pub on_subagent_complete: bool,
pub on_background_task_complete: bool,
pub on_run_complete: bool,
pub on_run_failed: bool,
}Expand description
Per-user notification opt-in flags.
enabled is the master switch; when false, no notifications are produced
regardless of the per-category flags. Each per-category flag gates a single
notification category.
Every field defaults to true (via serde(default = ...)), so missing keys
in a partial JSON document are treated as opted-in.
§Whole-struct-PUT caveat
The server’s PUT /api/v1/notifications/preferences endpoint deserializes
this struct directly and replaces the persisted value wholesale — it is
not a per-field patch. This has always meant that a client holding a
stale in-memory copy (fetched before some field existed, or simply never
refreshed) will silently reset any field it doesn’t know about back to its
serde(default) on its next save, clobbering whatever the user
previously chose for it. This applies equally to every field below,
including the two most recently added (on_run_complete,
on_run_failed); frontends must always PUT back a full, freshly-fetched
copy rather than a hand-built partial one.
Fields§
§enabled: boolMaster switch. When false, nothing is ever notified.
on_clarification: boolNotify when the agent needs free-form clarification from the user.
on_tool_approval: boolNotify when a tool requires explicit user approval.
on_context_pressure: boolNotify when context usage reaches a critical level.
on_subagent_complete: boolNotify when a background sub-agent task completes.
on_background_task_complete: boolNotify when a background shell/command (Bash run_in_background) finishes.
on_run_complete: boolNotify when a run finishes successfully (AgentEvent::Complete).
on_run_failed: boolNotify when a run fails (AgentEvent::Error).
Implementations§
Source§impl NotificationPreferences
impl NotificationPreferences
Sourcepub fn load(path: &Path) -> Self
pub fn load(path: &Path) -> Self
Loads preferences from path.
Returns Default when the file is missing (a fresh install) so the
caller never has to special-case first run. A file that exists but fails
to parse is logged via tracing::warn and also falls back to
Default, so a corrupt file never disables notifications silently.
Trait Implementations§
Source§impl Clone for NotificationPreferences
impl Clone for NotificationPreferences
Source§fn clone(&self) -> NotificationPreferences
fn clone(&self) -> NotificationPreferences
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more