Expand description
Nemo Plugin API - Shared interface for native plugins.
This crate defines the stable API boundary between the Nemo host and native plugins. Plugins link against this crate to register their capabilities.
§Writing a Plugin
A Nemo plugin is a dynamic library (cdylib) that exports two symbols:
nemo_plugin_manifest- returns aPluginManifestdescribing the pluginnemo_plugin_entry- called with aPluginRegistrarto register components, data sources, transforms, actions, and templates
Use the declare_plugin! macro to generate both exports.
§Minimal Example
use nemo_plugin_api::*;
use semver::Version;
fn init(registrar: &mut dyn PluginRegistrar) {
// Register a custom component
registrar.register_component(
"my_counter",
ComponentSchema::new("my_counter")
.with_description("A counter component")
.with_property("initial", PropertySchema::integer())
.require("initial"),
);
// Access host data
if let Some(value) = registrar.context().get_data("app.settings.theme") {
registrar.context().log(LogLevel::Info, &format!("Theme: {:?}", value));
}
}
declare_plugin!(
PluginManifest::new("my-plugin", "My Plugin", Version::new(0, 1, 0))
.with_description("Example Nemo plugin")
.with_capability(Capability::Component("my_counter".into())),
init
);§Registering a Data Source
fn init(registrar: &mut dyn PluginRegistrar) {
let mut schema = DataSourceSchema::new("my_feed");
schema.description = "Streams data from a custom feed".into();
schema.supports_streaming = true;
schema.properties.insert(
"url".into(),
PropertySchema::string().with_description("Feed URL"),
);
registrar.register_data_source("my_feed", schema);
}§Plugin Permissions
Plugins declare required permissions in their manifest via PluginPermissions.
The host checks these before granting access to network, filesystem, or
subprocess operations.
Macros§
- declare_
plugin - Macro to declare a plugin entry point.
Structs§
- Action
Schema - Schema for an action.
- Component
Schema - Schema for a component.
- Data
Source Schema - Schema for a data source.
- Plugin
Manifest - Plugin manifest describing capabilities.
- Plugin
Permissions - Permissions requested by a plugin.
- Property
Schema - Schema for a property.
- Transform
Schema - Schema for a transform.
Enums§
- Capability
- Plugin capability type.
- LogLevel
- Log level.
- Plugin
Error - Error from plugin operations.
- Plugin
Value - A configuration value (simplified for FFI safety).
- Property
Type - Property type.
Traits§
- Plugin
Context - Context providing API access to plugins at runtime.
- Plugin
Registrar - Trait for plugin registration.
Type Aliases§
- Plugin
Entry Fn - Plugin entry point function type.