pub struct ConversationStore { /* private fields */ }Expand description
Shared, mutable conversation state plus a bus publisher. The supervisor holds
one clone and calls ConversationStore::apply; the ai-conversation mode
reads ConversationStore::snapshot on each ConversationUpdated.
Implementations§
Source§impl ConversationStore
impl ConversationStore
Sourcepub fn new(publish: Arc<dyn Fn(ConversationUpdated) + Send + Sync>) -> Self
pub fn new(publish: Arc<dyn Fn(ConversationUpdated) + Send + Sync>) -> Self
Build a store whose mutations publish ConversationUpdated via publish.
Sourcepub fn apply(&self, session: &SessionKey, update: &SessionUpdate)
pub fn apply(&self, session: &SessionKey, update: &SessionUpdate)
Fold update into the conversation for session, then publish.
Sourcepub fn push_user_text(&self, session: &SessionKey, text: &str)
pub fn push_user_text(&self, session: &SessionKey, text: &str)
AU‑3: fold a locally-composed user prompt into the conversation as a
User turn, then publish. ACP agents don’t echo the user’s prompt back,
so the supervisor calls this when it sends a prompt to make the user’s
turn appear in the transcript immediately.
Sourcepub fn push_permission_request(
&self,
session: &SessionKey,
id: String,
title: String,
description: Option<String>,
options: Vec<PermissionOption>,
responder: Sender<PermissionOptionId>,
)
pub fn push_permission_request( &self, session: &SessionKey, id: String, title: String, description: Option<String>, options: Vec<PermissionOption>, responder: Sender<PermissionOptionId>, )
AUX‑1: push a permission block and register its oneshot responder. The
supervisor calls this when classify_permission returns AskUser; the
receiver is awaited in handle_permission.
Sourcepub fn resolve_permission(&self, id: &str, option_id: PermissionOptionId)
pub fn resolve_permission(&self, id: &str, option_id: PermissionOptionId)
PU-B.2: resolve a pending permission request by the agent’s chosen
option_id. Derives the inline block status from that option’s kind,
updates the block, and sends the option_id through the oneshot the
supervisor is parked on (which answers ACP with Selected(option_id)),
then publishes. No-op when id is unknown (already resolved, deferred
and re-resolved, or never registered).
Sourcepub fn oldest_pending_permission(&self) -> Option<PendingPermissionView>
pub fn oldest_pending_permission(&self) -> Option<PendingPermissionView>
PU-B.2b: the oldest still-Pending permission request, projected for
the popup menu (ai-permission-mode reads it in on_activate). Turns
and blocks are in wire order, so the first Pending block is the oldest.
Sourcepub fn oldest_pending_permission_where(
&self,
keep: impl Fn(&str) -> bool,
) -> Option<PendingPermissionView>
pub fn oldest_pending_permission_where( &self, keep: impl Fn(&str) -> bool, ) -> Option<PendingPermissionView>
PU-B.3: the oldest Pending request whose id satisfies keep. The
auto-open tick callback passes |id| !deferred(id) so an Esc-deferred
request is skipped (the queue advances past it) without re-opening it.
Sourcepub fn set_status(&self, session: &SessionKey, status: SessionStatus)
pub fn set_status(&self, session: &SessionKey, status: SessionStatus)
AUX‑3: set the global processing status and publish a
ConversationUpdated so the headerline re-renders.
Sourcepub fn snapshot(&self) -> Conversation
pub fn snapshot(&self) -> Conversation
Cheap-ish clone of the current conversation for projection.
Trait Implementations§
Source§impl Clone for ConversationStore
impl Clone for ConversationStore
Source§fn clone(&self) -> ConversationStore
fn clone(&self) -> ConversationStore
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 !RefUnwindSafe for ConversationStore
impl !UnwindSafe for ConversationStore
impl Freeze for ConversationStore
impl Send for ConversationStore
impl Sync for ConversationStore
impl Unpin for ConversationStore
impl UnsafeUnpin for ConversationStore
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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 more