Public declaration syntax from forge-rs/crates/forge-collab/src/session.rs Original source SHA-256: f65e767a07d3a1a4a3e28c21daefefbdc4ca89b162c4419627de1cf550a13253 Function bodies and constant values are omitted. This is not the complete implementation. Source line 85 #[async_trait::async_trait] pub trait SessionContract: Send + Sync { /// Called when the agent joins a collaboration session. /// /// # Arguments /// /// * `session` - The session being joined. /// * `role` - The role assigned to this agent in the session. /// /// # Errors /// /// Returns [`CollabError`] if the agent cannot join the session. // ANVIL Spec section 11.2 -- Session Lifecycle: on_session_join async fn on_session_join( &self, session: &CollaborationSession, role: CollaborationRole, ) -> Result<(), CollabError>; /// Called when the session transitions between states. /// /// # Arguments /// /// * `session_id` - The ID of the session. /// * `from` - The previous state. /// * `to` - The new state. /// /// # Errors /// /// Returns [`CollabError`] if the agent cannot handle the transition. // ANVIL Spec section 11.2 -- Session Lifecycle: on_session_transition async fn on_session_transition( &self, session_id: &str, from: SessionState, to: SessionState, ) -> Result<(), CollabError>; /// Called when the agent leaves a collaboration session. /// /// # Arguments /// /// * `session_id` - The ID of the session being left. /// * `reason` - A human-readable reason for leaving. /// /// # Errors /// /// Returns [`CollabError`] if cleanup fails. // ANVIL Spec section 11.2 -- Session Lifecycle: on_session_leave async fn on_session_leave(&self, session_id: &str, reason: &str) -> Result<(), CollabError>; } Source line 179 #[derive(Debug, Clone)] pub struct SessionManager { } Source line 206 pub fn new() -> Self; Source line 228 pub fn state(&self) -> SessionState; Source line 272 pub fn transition(&mut self, target: SessionState) -> Result; Source line 322 pub fn can_transition_to(&self, target: SessionState) -> bool; Source line 344 pub fn valid_transitions(&self) -> Vec; Source line 370 pub fn history(&self) -> &[SessionTransition];