pub struct ManagedSession {
pub session: Session,
pub command_tx: Sender<AppCommand>,
pub event_rx: Option<Receiver<AppEvent>>,
pub subscriber_count: usize,
pub last_activity: DateTime<Utc>,
pub app_task_handle: JoinHandle<()>,
pub event_task_handle: JoinHandle<()>,
}Expand description
A managed session contains both the session state and the App instance
Fields§
§session: SessionThe session data
command_tx: Sender<AppCommand>Command sender for the App
event_rx: Option<Receiver<AppEvent>>Event receiver from the App (for external consumers like TUI)
subscriber_count: usizeEvent subscriber count
last_activity: DateTime<Utc>Last activity timestamp for cleanup
app_task_handle: JoinHandle<()>Handle to the app actor loop task
event_task_handle: JoinHandle<()>Handle to the event translation task
Implementations§
Source§impl ManagedSession
impl ManagedSession
Sourcepub async fn new(
session: Session,
app_config: AppConfig,
store: Arc<dyn SessionStore>,
default_model: ModelId,
conversation: Option<Conversation>,
) -> Result<Self>
pub async fn new( session: Session, app_config: AppConfig, store: Arc<dyn SessionStore>, default_model: ModelId, conversation: Option<Conversation>, ) -> Result<Self>
Create a new managed session
Sourcepub fn take_event_rx(&mut self) -> Option<Receiver<AppEvent>>
pub fn take_event_rx(&mut self) -> Option<Receiver<AppEvent>>
Take the event receiver (can only be called once)
Sourcepub fn is_inactive(&self, max_idle_time: Duration) -> bool
pub fn is_inactive(&self, max_idle_time: Duration) -> bool
Check if session is inactive (no subscribers and old)
Auto Trait Implementations§
impl Freeze for ManagedSession
impl RefUnwindSafe for ManagedSession
impl Send for ManagedSession
impl Sync for ManagedSession
impl Unpin for ManagedSession
impl UnwindSafe for ManagedSession
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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>
Wrap the input message
T in a tonic::Request