Skip to main content

PluginSession

Struct PluginSession 

Source
pub struct PluginSession { /* private fields */ }

Implementations§

Source§

impl PluginSession

Source

pub fn session_id(&self) -> &str

Source

pub fn execution_mode(&self) -> ExecutionMode

Source

pub fn tool_access(&self) -> &SessionToolAccess

Source

pub fn subagent_authority(&self) -> Option<&SubagentSessionAuthority>

Source

pub fn host(&self) -> &PluginHost

Source

pub fn tools(&self) -> Arc<dyn ToolProvider>

Source

pub fn tool_registry(&self) -> Arc<ToolRegistry>

Source

pub fn mode_protocol_driver(&self) -> Option<Arc<dyn ModeProtocolDriverPlugin>>

Plugin-registered protocol driver for this session, if any plugin claimed the singleton slot. When None, callers fall back to lash_sansio::build_mode_preamble (hardcoded Standard/RLM).

Source

pub fn tool_surface( &self, session_id: &str, mode: ExecutionMode, ) -> Arc<ToolSurface>

Source

pub fn tool_catalog(&self, session_id: &str, mode: ExecutionMode) -> Vec<Value>

Source

pub fn resolve_tool_surface( &self, ctx: ToolSurfaceContext, ) -> Result<ToolSurface, PluginError>

Source

pub fn plugin_actions(&self) -> Vec<PluginActionDef>

Source

pub fn monitor_specs(&self) -> &[PluginOwned<MonitorSpec>]

Source

pub fn has_assistant_stream_hooks(&self) -> bool

Source

pub async fn prepare_turn_context( &self, ctx: &TurnTransformContext, input: PreparedContext, ) -> Result<PreparedContext, HistoryError>

Chain registered turn-context transforms, piping each one’s output into the next in priority order.

Source

pub async fn rewrite_history( &self, ctx: &RewriteContext, input: HistoryState, ) -> Result<HistoryState, HistoryError>

Chain registered history rewriters, skipping any that opt out of the current trigger via accepts().

Source

pub async fn collect_prompt_contributions( &self, ctx: PromptHookContext, ) -> Result<Vec<PromptContribution>, PluginError>

Source

pub async fn prepare_turn( &self, request: PrepareTurnRequest, ) -> Result<TurnPreparation, PluginError>

Source

pub async fn apply_checkpoint( &self, ctx: CheckpointHookContext, ) -> Result<CheckpointApplication, PluginError>

Source

pub async fn before_turn( &self, ctx: TurnHookContext, ) -> Result<Vec<PluginOwned<PluginDirective>>, PluginError>

Source

pub async fn before_tool_call( &self, ctx: ToolCallHookContext, ) -> Result<Vec<PluginOwned<PluginDirective>>, PluginError>

Source

pub async fn after_tool_call( &self, ctx: ToolResultHookContext, ) -> Result<Vec<PluginOwned<PluginDirective>>, PluginError>

Source

pub async fn after_turn( &self, ctx: TurnResultHookContext, ) -> Result<Vec<PluginOwned<PluginDirective>>, PluginError>

Source

pub async fn at_checkpoint( &self, ctx: CheckpointHookContext, ) -> Result<Vec<PluginOwned<PluginDirective>>, PluginError>

Source

pub async fn transform_assistant_stream( &self, session_id: &str, chunk: String, ) -> Result<Vec<PluginOwned<AssistantStreamTransform>>, PluginError>

Source

pub async fn transform_assistant_response( &self, session_id: &str, response: LlmResponse, ) -> Result<Vec<PluginOwned<AssistantResponseTransform>>, PluginError>

Source

pub async fn project_tool_result( &self, ctx: ToolResultProjectionContext, ) -> Result<ModelToolReturn, PluginError>

Source

pub async fn emit_runtime_event(&self, event: PluginRuntimeEvent)

Source

pub fn has_runtime_event_hooks(&self) -> bool

Source

pub async fn mutate_session_config( &self, ctx: SessionConfigChangedContext, policy: SessionPolicy, ) -> SessionPolicy

Source

pub async fn finalize_turn( &self, turn: AssembledTurn, host: Arc<dyn ToolHookHost>, ) -> Result<TurnFinalization, PluginError>

Source

pub fn snapshot(&self) -> Result<PluginSessionSnapshot, PluginError>

Source

pub fn snapshot_is_current( &self, previous: Option<&PluginSessionSnapshot>, ) -> bool

Source

pub fn snapshot_revision_fingerprint(&self) -> u64

Source

pub fn restore( &self, snapshot: &PluginSessionSnapshot, ) -> Result<(), PluginError>

Source

pub fn fork_for_session( &self, session_id: impl Into<String>, execution_mode: ExecutionMode, standard_context_approach: Option<StandardContextApproach>, ) -> Result<Arc<PluginSession>, PluginError>

Source

pub fn fork_for_child_session( &self, session_id: impl Into<String>, parent_session_id: Option<String>, execution_mode: ExecutionMode, standard_context_approach: Option<StandardContextApproach>, authority: SessionAuthorityContext, ) -> Result<Arc<PluginSession>, PluginError>

Source

pub fn fork_for_session_with_tool_surface( &self, session_id: impl Into<String>, execution_mode: ExecutionMode, standard_context_approach: Option<StandardContextApproach>, tool_surface_overlay: ToolSurfaceContribution, ) -> Result<Arc<PluginSession>, PluginError>

Source

pub async fn invoke_plugin_action( &self, name: &str, args: Value, session_id: Option<String>, default_to_current_session: bool, host: Arc<dyn PluginActionHost>, ) -> Result<ToolResult, PluginActionInvokeError>

Source

pub async fn call_plugin_action<Op: PluginAction>( &self, args: Op::Args, session_id: Option<String>, default_to_current_session: bool, host: Arc<dyn PluginActionHost>, ) -> Result<Op::Output, PluginError>

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more