Skip to main content

PluginSpec

Struct PluginSpec 

Source
pub struct PluginSpec {
Show 18 fields pub tool_providers: Vec<Arc<dyn ToolProvider>>, pub triggers: Vec<TriggerEvent>, pub prompt_contributors: Vec<Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>>, pub tool_catalog_contributors: Vec<Arc<dyn Fn(ToolCatalogContext) -> Result<ToolCatalogContribution, PluginError> + Send + Sync>>, pub tool_discovery_contributors: Vec<Arc<dyn Fn(ToolDiscoveryContext) -> Result<ToolDiscoveryContribution, PluginError> + Send + Sync>>, pub before_turn_hooks: Vec<Arc<dyn Fn(TurnHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>, pub before_tool_call_hooks: Vec<Arc<dyn Fn(ToolCallHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>, pub after_tool_call_hooks: Vec<Arc<dyn Fn(ToolResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>, pub after_turn_hooks: Vec<Arc<dyn Fn(TurnResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>, pub checkpoint_hooks: Vec<Arc<dyn Fn(CheckpointHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>, pub assistant_stream_hooks: Vec<Arc<dyn Fn(AssistantStreamHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantStreamTransform, PluginError>> + Send>> + Send + Sync>>, pub assistant_response_hooks: Vec<Arc<dyn Fn(AssistantResponseHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantResponseTransform, PluginError>> + Send>> + Send + Sync>>, pub tool_result_projector: Option<Arc<dyn Fn(ToolResultProjectionContext) -> Pin<Box<dyn Future<Output = Result<ModelToolReturn, PluginError>> + Send>> + Send + Sync>>, pub runtime_event_hooks: Vec<Arc<dyn for<'run> Fn(PluginLifecycleEvent<'run>) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'run>> + Send + Sync>>, pub session_config_mutators: Vec<Arc<dyn Fn(SessionConfigChangedContext, SessionPolicy) -> Pin<Box<dyn Future<Output = Result<SessionPolicy, PluginError>> + Send>> + Send + Sync>>, pub plugin_actions: Vec<(PluginActionDef, Arc<dyn Fn(PluginActionContext, Value) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync>)>, pub turn_context_transforms: Vec<(i32, Arc<dyn TurnContextTransform>)>, pub context_compactors: Vec<(i32, Arc<dyn ContextCompactor>)>,
}

Fields§

§tool_providers: Vec<Arc<dyn ToolProvider>>§triggers: Vec<TriggerEvent>§prompt_contributors: Vec<Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>>§tool_catalog_contributors: Vec<Arc<dyn Fn(ToolCatalogContext) -> Result<ToolCatalogContribution, PluginError> + Send + Sync>>§tool_discovery_contributors: Vec<Arc<dyn Fn(ToolDiscoveryContext) -> Result<ToolDiscoveryContribution, PluginError> + Send + Sync>>§before_turn_hooks: Vec<Arc<dyn Fn(TurnHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>§before_tool_call_hooks: Vec<Arc<dyn Fn(ToolCallHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>§after_tool_call_hooks: Vec<Arc<dyn Fn(ToolResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>§after_turn_hooks: Vec<Arc<dyn Fn(TurnResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>§checkpoint_hooks: Vec<Arc<dyn Fn(CheckpointHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>>§assistant_stream_hooks: Vec<Arc<dyn Fn(AssistantStreamHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantStreamTransform, PluginError>> + Send>> + Send + Sync>>§assistant_response_hooks: Vec<Arc<dyn Fn(AssistantResponseHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantResponseTransform, PluginError>> + Send>> + Send + Sync>>§tool_result_projector: Option<Arc<dyn Fn(ToolResultProjectionContext) -> Pin<Box<dyn Future<Output = Result<ModelToolReturn, PluginError>> + Send>> + Send + Sync>>§runtime_event_hooks: Vec<Arc<dyn for<'run> Fn(PluginLifecycleEvent<'run>) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'run>> + Send + Sync>>§session_config_mutators: Vec<Arc<dyn Fn(SessionConfigChangedContext, SessionPolicy) -> Pin<Box<dyn Future<Output = Result<SessionPolicy, PluginError>> + Send>> + Send + Sync>>§plugin_actions: Vec<(PluginActionDef, Arc<dyn Fn(PluginActionContext, Value) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync>)>§turn_context_transforms: Vec<(i32, Arc<dyn TurnContextTransform>)>§context_compactors: Vec<(i32, Arc<dyn ContextCompactor>)>

Implementations§

Source§

impl PluginSpec

Source

pub fn new() -> PluginSpec

Source

pub fn with_tool_provider(self, provider: Arc<dyn ToolProvider>) -> PluginSpec

Source

pub fn with_trigger_event(self, event: TriggerEvent) -> PluginSpec

Source

pub fn with_prompt_contributor( self, contributor: Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_tool_catalog_contributor( self, contributor: Arc<dyn Fn(ToolCatalogContext) -> Result<ToolCatalogContribution, PluginError> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_tool_discovery_contributor( self, contributor: Arc<dyn Fn(ToolDiscoveryContext) -> Result<ToolDiscoveryContribution, PluginError> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_before_turn( self, hook: Arc<dyn Fn(TurnHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_before_tool_call( self, hook: Arc<dyn Fn(ToolCallHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_after_tool_call( self, hook: Arc<dyn Fn(ToolResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_after_turn( self, hook: Arc<dyn Fn(TurnResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_checkpoint( self, hook: Arc<dyn Fn(CheckpointHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_assistant_stream( self, hook: Arc<dyn Fn(AssistantStreamHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantStreamTransform, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_assistant_response( self, hook: Arc<dyn Fn(AssistantResponseHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantResponseTransform, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_tool_result_projector( self, projector: Arc<dyn Fn(ToolResultProjectionContext) -> Pin<Box<dyn Future<Output = Result<ModelToolReturn, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_runtime_event( self, hook: Arc<dyn for<'run> Fn(PluginLifecycleEvent<'run>) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'run>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_session_config_mutator( self, hook: Arc<dyn Fn(SessionConfigChangedContext, SessionPolicy) -> Pin<Box<dyn Future<Output = Result<SessionPolicy, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_plugin_action( self, def: PluginActionDef, handler: Arc<dyn Fn(PluginActionContext, Value) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync>, ) -> PluginSpec

Source

pub fn with_plugin_action_typed<Op, F, Fut>(self, handler: F) -> PluginSpec
where Op: PluginAction, F: Fn(PluginActionContext, <Op as PluginAction>::Args) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<<Op as PluginAction>::Output, PluginActionFailure>> + Send + 'static,

Source

pub fn with_plugin_action_sync<Op, F>(self, handler: F) -> PluginSpec

Source

pub fn with_turn_context_transform( self, priority: i32, transform: Arc<dyn TurnContextTransform>, ) -> PluginSpec

Source

pub fn with_context_compactor( self, priority: i32, compactor: Arc<dyn ContextCompactor>, ) -> PluginSpec

Trait Implementations§

Source§

impl Clone for PluginSpec

Source§

fn clone(&self) -> PluginSpec

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for PluginSpec

Source§

fn default() -> PluginSpec

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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