pub struct SessionManager { /* private fields */ }Expand description
Agent session manager.
Handles session lifecycle and communication channels.
Implementations§
Source§impl SessionManager
impl SessionManager
Sourcepub fn new(event_tx: Sender<AgentEvent>) -> Self
pub fn new(event_tx: Sender<AgentEvent>) -> Self
Create a new session manager with event sender.
Sourcepub fn with_channels(
event_tx: Sender<AgentEvent>,
ask_rx: Option<Receiver<String>>,
) -> Self
pub fn with_channels( event_tx: Sender<AgentEvent>, ask_rx: Option<Receiver<String>>, ) -> Self
Create a session manager with all channels.
Sourcepub fn with_pending_input(
event_tx: Sender<AgentEvent>,
pending_input_rx: Option<Receiver<String>>,
) -> Self
pub fn with_pending_input( event_tx: Sender<AgentEvent>, pending_input_rx: Option<Receiver<String>>, ) -> Self
Create a session manager with pending input channel.
Sourcepub fn with_all_channels(
event_tx: Sender<AgentEvent>,
ask_rx: Option<Receiver<String>>,
pending_input_rx: Option<Receiver<String>>,
) -> Self
pub fn with_all_channels( event_tx: Sender<AgentEvent>, ask_rx: Option<Receiver<String>>, pending_input_rx: Option<Receiver<String>>, ) -> Self
Create a session manager with all channels including pending input.
Sourcepub fn emit(&self, event: AgentEvent) -> Result<()>
pub fn emit(&self, event: AgentEvent) -> Result<()>
Emit an agent event.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if session is cancelled.
Sourcepub fn set_cancel_token(&mut self, token: CancellationToken)
pub fn set_cancel_token(&mut self, token: CancellationToken)
Set cancellation token.
Sourcepub fn cancel_token(&self) -> Option<&CancellationToken>
pub fn cancel_token(&self) -> Option<&CancellationToken>
Get cancellation token.
Sourcepub fn set_ask_channel(&mut self, rx: Receiver<String>)
pub fn set_ask_channel(&mut self, rx: Receiver<String>)
Set ask response channel.
Sourcepub fn has_ask_channel(&self) -> bool
pub fn has_ask_channel(&self) -> bool
Check if ask response channel is available (no mutable borrow needed).
Sourcepub fn set_pending_input_channel(&mut self, rx: Receiver<String>)
pub fn set_pending_input_channel(&mut self, rx: Receiver<String>)
Set pending input channel.
Sourcepub fn pending_input_rx(&mut self) -> Option<&mut Receiver<String>>
pub fn pending_input_rx(&mut self) -> Option<&mut Receiver<String>>
Get pending input channel.
Sourcepub fn drain_pending_inputs(&mut self) -> Vec<String>
pub fn drain_pending_inputs(&mut self) -> Vec<String>
Drain pending inputs from the channel.
Sourcepub fn event_sender(&self) -> Sender<AgentEvent>
pub fn event_sender(&self) -> Sender<AgentEvent>
Get event sender (for cloning).
Auto Trait Implementations§
impl Freeze for SessionManager
impl RefUnwindSafe for SessionManager
impl Send for SessionManager
impl Sync for SessionManager
impl Unpin for SessionManager
impl UnsafeUnpin for SessionManager
impl UnwindSafe for SessionManager
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