Skip to main content

ModeSessionPlugin

Trait ModeSessionPlugin 

Source
pub trait ModeSessionPlugin: Send + Sync {
    // Provided methods
    fn initialize_session<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: ModeSessionContext<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn restore_session<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: ModeSessionContext<'life1>,
        _state: &'life2 PersistedSessionState,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn append_session_nodes<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: ModeSessionContext<'life1>,
        _nodes: &'life2 [SessionAppendNode],
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn apply_session_extension<'life0, 'async_trait>(
        &'life0 self,
        _extension: ModeSessionExtensionHandle,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn validate_turn_extension<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _extension: &'life1 ModeTurnExtensionHandle,
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn execute_code<'life0, 'async_trait>(
        &'life0 self,
        _ctx: ModeExecutionContext,
        _request: ExecRequest,
    ) -> Pin<Box<dyn Future<Output = Result<ExecResponse, SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn execution_state_dirty(&self) -> bool { ... }
    fn snapshot_execution_state<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: ModeSessionContext<'life1>,
    ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn restore_execution_state<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        _ctx: ModeSessionContext<'life1>,
        _data: &'life2 [u8],
    ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn configure_runtime_from_request(
        &self,
        _ctx: ModeRuntimeContext<'_>,
        _request: &SessionCreateRequest,
    ) { ... }
    fn before_llm_call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _ctx: ModeBeforeLlmCallContext,
        _request: &'life1 LlmRequest,
    ) -> Pin<Box<dyn Future<Output = Result<Option<ModeLlmCallAction>, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Session-scoped plugin that initializes, restores, and extends mode state across a session’s lifecycle. External mode crates implement this via context wrappers (ModeSessionContext, ModeRuntimeContext) so they don’t need direct access to Session/LashRuntime internals — the context narrows what a plugin can poke at to the capabilities any execution mode reasonably needs.

Provided Methods§

Source

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

Source

fn restore_session<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: ModeSessionContext<'life1>, _state: &'life2 PersistedSessionState, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn append_session_nodes<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: ModeSessionContext<'life1>, _nodes: &'life2 [SessionAppendNode], ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn apply_session_extension<'life0, 'async_trait>( &'life0 self, _extension: ModeSessionExtensionHandle, ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn execute_code<'life0, 'async_trait>( &'life0 self, _ctx: ModeExecutionContext, _request: ExecRequest, ) -> Pin<Box<dyn Future<Output = Result<ExecResponse, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn execution_state_dirty(&self) -> bool

Source

fn snapshot_execution_state<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: ModeSessionContext<'life1>, ) -> Pin<Box<dyn Future<Output = Result<Option<Vec<u8>>, SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn restore_execution_state<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, _ctx: ModeSessionContext<'life1>, _data: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<(), SessionError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source

fn configure_runtime_from_request( &self, _ctx: ModeRuntimeContext<'_>, _request: &SessionCreateRequest, )

Source

fn before_llm_call<'life0, 'life1, 'async_trait>( &'life0 self, _ctx: ModeBeforeLlmCallContext, _request: &'life1 LlmRequest, ) -> Pin<Box<dyn Future<Output = Result<Option<ModeLlmCallAction>, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Implementors§