pub struct PluginSpec {Show 18 fields
pub tool_providers: Vec<Arc<dyn ToolProvider>>,
pub host_events: Vec<HostEvent>,
pub prompt_contributors: Vec<Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>>,
pub tool_surface_contributors: Vec<Arc<dyn Fn(ToolSurfaceContext) -> Result<ToolSurfaceContribution, 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 history_rewriters: Vec<(i32, Arc<dyn HistoryRewriter>)>,
}Fields§
§tool_providers: Vec<Arc<dyn ToolProvider>>§host_events: Vec<HostEvent>§prompt_contributors: Vec<Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>>§tool_surface_contributors: Vec<Arc<dyn Fn(ToolSurfaceContext) -> Result<ToolSurfaceContribution, 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>)>§history_rewriters: Vec<(i32, Arc<dyn HistoryRewriter>)>Implementations§
Source§impl PluginSpec
impl PluginSpec
pub fn new() -> PluginSpec
pub fn with_tool_provider(self, provider: Arc<dyn ToolProvider>) -> PluginSpec
pub fn with_host_event(self, event: HostEvent) -> PluginSpec
pub fn with_prompt_contributor( self, contributor: Arc<dyn Fn(PromptHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PromptContribution>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_tool_surface_contributor( self, contributor: Arc<dyn Fn(ToolSurfaceContext) -> Result<ToolSurfaceContribution, PluginError> + Send + Sync>, ) -> PluginSpec
pub fn with_tool_discovery_contributor( self, contributor: Arc<dyn Fn(ToolDiscoveryContext) -> Result<ToolDiscoveryContribution, PluginError> + Send + Sync>, ) -> PluginSpec
pub fn with_before_turn( self, hook: Arc<dyn Fn(TurnHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
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
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
pub fn with_after_turn( self, hook: Arc<dyn Fn(TurnResultHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_checkpoint( self, hook: Arc<dyn Fn(CheckpointHookContext) -> Pin<Box<dyn Future<Output = Result<Vec<PluginDirective>, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_assistant_stream( self, hook: Arc<dyn Fn(AssistantStreamHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantStreamTransform, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_assistant_response( self, hook: Arc<dyn Fn(AssistantResponseHookContext) -> Pin<Box<dyn Future<Output = Result<AssistantResponseTransform, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_tool_result_projector( self, projector: Arc<dyn Fn(ToolResultProjectionContext) -> Pin<Box<dyn Future<Output = Result<ModelToolReturn, PluginError>> + Send>> + Send + Sync>, ) -> PluginSpec
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
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
pub fn with_plugin_action( self, def: PluginActionDef, handler: Arc<dyn Fn(PluginActionContext, Value) -> Pin<Box<dyn Future<Output = ToolResult> + Send>> + Send + Sync>, ) -> PluginSpec
pub fn with_plugin_action_typed<Op, F, Fut>(self, handler: F) -> PluginSpecwhere
Op: PluginAction,
F: Fn(PluginActionContext, <Op as PluginAction>::Args) -> Fut + Send + Sync + 'static,
Fut: Future<Output = Result<<Op as PluginAction>::Output, PluginActionFailure>> + Send + 'static,
pub fn with_plugin_action_sync<Op, F>(self, handler: F) -> PluginSpecwhere
Op: PluginAction,
F: Fn(PluginActionContext, <Op as PluginAction>::Args) -> Result<<Op as PluginAction>::Output, PluginActionFailure> + Send + Sync + 'static,
pub fn with_turn_context_transform( self, priority: i32, transform: Arc<dyn TurnContextTransform>, ) -> PluginSpec
pub fn with_history_rewriter( self, priority: i32, rewriter: Arc<dyn HistoryRewriter>, ) -> PluginSpec
Trait Implementations§
Source§impl Clone for PluginSpec
impl Clone for PluginSpec
Source§fn clone(&self) -> PluginSpec
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)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for PluginSpec
impl Default for PluginSpec
Source§fn default() -> PluginSpec
fn default() -> PluginSpec
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for PluginSpec
impl !UnwindSafe for PluginSpec
impl Freeze for PluginSpec
impl Send for PluginSpec
impl Sync for PluginSpec
impl Unpin for PluginSpec
impl UnsafeUnpin for PluginSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more