pub struct SessionStatusNotifier { /* private fields */ }Expand description
Fire-and-forget handle for pushing a client-visible status update outside of the normal prompt-drain path.
Most agent output reaches the client through LoopbackChannel and is only flushed to
the IDE as part of a session/prompt response (see helpers::loopback_event_to_updates
and drain_agent_events). Some failures are discovered before any prompt is ever sent —
e.g. session hydration in spawn_acp_agent (zeph binary crate) hitting
SessionError::AlreadyLocked — so a client that never prompts, or whose first prompt is
cancelled before the drain, would otherwise never learn persistence degraded (#5519).
SessionStatusNotifier reuses the same per-session notification channel that
ZephAcpAgentState::send_notification_nowait already drives for other proactive updates
(e.g. available_commands_update), so it delivers immediately via the session’s notify
drainer instead of waiting on the next prompt.
Implementations§
Source§impl SessionStatusNotifier
impl SessionStatusNotifier
Sourcepub fn new(notify_tx: NotifySender, session_id: SessionId) -> Self
pub fn new(notify_tx: NotifySender, session_id: SessionId) -> Self
Builds a notifier bound to a session’s notification channel.
notify_tx is normally a SessionEntry’s own notify sender (see build_acp_context),
so pushes from this notifier are drained by the same task that delivers this session’s
session/update notifications to the client. pub (not pub(crate)) so integration
tests outside this crate can bind a notifier to a plain mpsc::channel and assert on
the receiving end directly, without constructing a full AcpContext/ACP connection.
§Examples
use agent_client_protocol::schema::v1::SessionId;
use tokio::sync::mpsc;
use zeph_acp::SessionStatusNotifier;
let (tx, mut rx) = mpsc::channel(4);
let notifier = SessionStatusNotifier::new(tx, SessionId::new("session-1".to_owned()));
notifier.notify_status_nowait("degraded");
assert!(rx.try_recv().is_ok());Sourcepub fn notify_status_nowait(&self, text: impl Into<String>)
pub fn notify_status_nowait(&self, text: impl Into<String>)
Push a status message to the client immediately, without waiting for an ack.
Mirrors the AgentThoughtChunk shape loopback_event_to_updates already produces for
LoopbackEvent::Status, so proactive and prompt-drained status messages render
identically on the client. Errors (channel full or closed) are logged and swallowed —
same tolerance as ZephAcpAgentState::send_notification_nowait.
Trait Implementations§
Source§impl Clone for SessionStatusNotifier
impl Clone for SessionStatusNotifier
Source§fn clone(&self) -> SessionStatusNotifier
fn clone(&self) -> SessionStatusNotifier
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for SessionStatusNotifier
impl RefUnwindSafe for SessionStatusNotifier
impl Send for SessionStatusNotifier
impl Sync for SessionStatusNotifier
impl Unpin for SessionStatusNotifier
impl UnsafeUnpin for SessionStatusNotifier
impl UnwindSafe for SessionStatusNotifier
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> IntoMaybeUndefined<T> for T
impl<T> IntoMaybeUndefined<T> for T
Source§fn into_maybe_undefined(self) -> MaybeUndefined<T>
fn into_maybe_undefined(self) -> MaybeUndefined<T>
Source§impl<T> IntoOption<T> for T
impl<T> IntoOption<T> for T
Source§fn into_option(self) -> Option<T>
fn into_option(self) -> Option<T>
Source§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