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§
fn descriptor(&self) -> PluginDescriptor
Provided Methods§
Sourcefn bind_runtime_context(
&self,
_store: &StateStore,
_owner_inbox: Option<&InboxSender>,
)
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.
Sourcefn register(&self, _registrar: &mut PluginRegistrar) -> Result<(), StateError>
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.
Sourcefn config_schemas(&self) -> Vec<ConfigSchema>
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.
Sourcefn on_activate(
&self,
_agent_spec: &AgentSpec,
_patch: &mut MutationBatch,
) -> Result<(), StateError>
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.
Sourcefn on_deactivate(&self, _patch: &mut MutationBatch) -> Result<(), StateError>
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.