pub struct Notifier { /* private fields */ }Expand description
Per-turn completion notifier.
Holds a shared reqwest::Client and the resolved config. Construct once at
agent startup via Notifier::new and call Notifier::fire after each turn.
All I/O is spawned onto the Tokio runtime via tokio::spawn; fire returns
immediately without blocking the agent loop.
Cloning is cheap — reqwest::Client is an Arc-backed handle.
Implementations§
Source§impl Notifier
impl Notifier
Sourcepub fn new(cfg: NotificationsConfig) -> Self
pub fn new(cfg: NotificationsConfig) -> Self
Create a notifier from a NotificationsConfig.
Constructs a shared HTTP client with a 5-second connect timeout. The client is reused across all webhook calls for the agent session.
If webhook_url is set but fails URL validation (unparseable or non-HTTP(S)
scheme), it is cleared to None and a warning is logged. This prevents SSRF
via malformed URLs (e.g. file://, ftp://).
Sourcepub fn should_fire(&self, summary: &TurnSummary) -> bool
pub fn should_fire(&self, summary: &TurnSummary) -> bool
Evaluate all gate conditions and return true when the notification should fire.
Gates applied in order (all must pass):
enabledistruesummary.llm_requests > 0(zero-LLM turns are never notified)- If
only_on_error: turn must have errored - For successful turns:
duration_ms >= min_turn_duration_ms(error turns bypass the duration gate)
Sourcepub fn fire(&self, summary: &TurnSummary)
pub fn fire(&self, summary: &TurnSummary)
Fire all enabled notification channels for this turn summary.
Returns immediately — all I/O is spawned as a background task. Failures
are logged at warn level and never propagated. The spawned task has an
internal 5-second per-channel timeout.
Sourcepub async fn fire_test(&self) -> Result<(), NotifyTestError>
pub async fn fire_test(&self) -> Result<(), NotifyTestError>
Fire a test notification with a fixed message.
Used by the zeph notify test CLI subcommand. Returns an error if all
channels are disabled or if every channel failed.
§Errors
NotifyTestError::AllDisabled— no channel is enabledNotifyTestError::MacOsFailed— macOS notification failed (macOS only)NotifyTestError::WebhookFailed— webhook POST failed
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Notifier
impl !RefUnwindSafe for Notifier
impl Send for Notifier
impl Sync for Notifier
impl Unpin for Notifier
impl UnsafeUnpin for Notifier
impl !UnwindSafe for Notifier
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request