Skip to main content

SessionBackend

Trait SessionBackend 

Source
pub trait SessionBackend: Send + Sync {
    // Required methods
    fn create_session<'life0, 'async_trait>(
        &'life0 self,
        request: CreateSessionRequest,
    ) -> Pin<Box<dyn Future<Output = Result<SessionId, SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Session>, SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn send_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
        message: String,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn submit_coordinator_message<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
        request: CoordinatorMessageRequest,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn answer_questions<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
        request: AnswerQuestionsRequest,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn cancel_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn merge_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_review_request<'life0, 'life1, 'async_trait>(
        &'life0 self,
        session_id: &'life1 SessionId,
    ) -> Pin<Box<dyn Future<Output = Result<ReviewRequest, SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}
Expand description

Host implementation boundary for session persistence and workflows.

The trait is object-safe so agent loops and future orchestrators can hold a programmatic session capability without depending on a concrete frontend.

Required Methods§

Source

fn create_session<'life0, 'async_trait>( &'life0 self, request: CreateSessionRequest, ) -> Pin<Box<dyn Future<Output = Result<SessionId, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Creates one session and returns its stable identifier.

Source

fn get_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, ) -> Pin<Box<dyn Future<Output = Result<Option<Session>, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Loads one complete session aggregate, including settings and messages.

Source

fn send_message<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, message: String, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Sends one text message, starting, resuming, or queueing as appropriate.

Source

fn submit_coordinator_message<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, request: CoordinatorMessageRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Submits a coordinator-owned turn without entering the lossy live-chat queue used while an ordinary user turn is active.

Source

fn answer_questions<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, request: AnswerQuestionsRequest, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Answers the complete current clarification-question set.

Source

fn cancel_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Cancels one session through the host lifecycle workflow.

Source

fn merge_session<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Requests merge processing for one review-ready session.

Source

fn create_review_request<'life0, 'life1, 'async_trait>( &'life0 self, session_id: &'life1 SessionId, ) -> Pin<Box<dyn Future<Output = Result<ReviewRequest, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Queues publication of one session branch and creates or refreshes its review request.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§