Expand description
NexoPlugin trait + PluginInitContext + lifecycle errors. The
runtime contract every native Rust plugin implements.
A plugin ships as a Rust crate that:
- Includes a
nexo-plugin.tomlmanifest at its crate root (parsed bynexo-plugin-manifest). - Implements
NexoPluginin its public surface. - Exports an
Arc<dyn NexoPlugin>constructor (e.g.pub fn new() -> Arc<dyn NexoPlugin>).
[PluginRegistry] walks the workspace + user
plugin dirs at boot, parses manifests, instantiates plugin
handles, and calls init in deterministic order.
PluginInitContext gives plugins typed handles to every
daemon subsystem they may need: tool registry, advisor
registry (advisory_hook), hook registry, broker, LLM
registry, reload coordinator, sessions, long-term memory,
shutdown signal.
Provider-agnostic: the trait + context expose no LLM-provider
specifics. Plugins reach providers through
LlmRegistry::build which itself is provider-agnostic.
§Distinction from existing crate::agent::plugin::Plugin
Plugin (in crate::agent::plugin) is the Channel
plugin trait — runtime-side I/O for browser / WhatsApp /
Telegram / email channels. NexoPlugin is the boot-time
lifecycle trait — the plug-and-play registration contract.
Distinct concept, distinct file, distinct trait name.
A plugin’s resources clean up when its Arc<dyn NexoPlugin> is
dropped (via Rust Drop semantics) or via an explicit
shutdown() call. The activation surface is just the manifest +
the PluginInitContext.
Structs§
- Plugin
Init Context - Bundle of handles a plugin’s
initreceives. Lifetimes tied to the boot scope; plugins that need long-lived clones must clone theArc<...>fields explicitly.
Enums§
- Plugin
Configure Error - Errors a plugin’s
configurehook (Phase 93.2) can surface. - Plugin
Init Error - Errors a plugin’s
initcan return. Boundary type — every failure mode the registry needs to discriminate is its own variant; freeform errors land inOther. - Plugin
Shutdown Error
Constants§
- DEFAULT_
PLUGIN_ SHUTDOWN_ TIMEOUT - Default per-plugin shutdown budget. The registry shutdown
sequence wraps
plugin.shutdown()intokio::time::timeoutat this duration so a stuck plugin can’t hold the daemon at exit.
Traits§
- Nexo
Plugin - Lifecycle contract for native Rust plugins.