Skip to main content

Plugin

Trait Plugin 

Source
pub trait Plugin:
    Send
    + Sync
    + 'static {
    // Required method
    fn descriptor(&self) -> PluginDescriptor;

    // Provided methods
    fn bind_runtime_context(
        &self,
        _store: &StateStore,
        _owner_inbox: Option<&InboxSender>,
    ) { ... }
    fn register(
        &self,
        _registrar: &mut PluginRegistrar,
    ) -> Result<(), StateError> { ... }
    fn config_schemas(&self) -> Vec<ConfigSchema> { ... }
    fn on_activate(
        &self,
        _agent_spec: &AgentSpec,
        _patch: &mut MutationBatch,
    ) -> Result<(), StateError> { ... }
    fn on_deactivate(
        &self,
        _patch: &mut MutationBatch,
    ) -> Result<(), StateError> { ... }
}

Required Methods§

Provided Methods§

Source

fn bind_runtime_context( &self, _store: &StateStore, _owner_inbox: Option<&InboxSender>, )

Bind per-run runtime context to the plugin instance.

This is invoked at run startup and on agent handoff so plugins that keep runtime-owned handles can bind to the current run’s store or inbox.

Source

fn register(&self, _registrar: &mut PluginRegistrar) -> Result<(), StateError>

Declare capabilities: state keys, hooks, action handlers, effect handlers, permission checkers. Called once per resolve to build the ExecutionEnv.

Source

fn config_schemas(&self) -> Vec<ConfigSchema>

Declare config section schemas for eager validation during resolve.

Override this to declare which AgentSpec.sections keys this plugin owns and how to validate them. The resolve pipeline calls this to catch malformed config before hooks run.

Source

fn on_activate( &self, _agent_spec: &AgentSpec, _patch: &mut MutationBatch, ) -> Result<(), StateError>

Agent activated: read spec config, write initial state. Called when this plugin becomes active for a specific agent.

Source

fn on_deactivate(&self, _patch: &mut MutationBatch) -> Result<(), StateError>

Agent deactivated: clean up agent-scoped state. Called when switching away from an agent that uses this plugin.

Implementors§