Plugins
Micro-Seg is extensible through task plugins: WebAssembly components that run sandboxed, out-of-process in a dedicated plugin host. A misbehaving plugin cannot crash the app or read anything the host doesn’t hand it.
Plugins come in two kinds:
- Annotation tasks power the Interactive and Auto annotation flows (typically AI models)
- Extension tasks provide exports, analysis, summaries and tables, run from the Plugin Manager
Installing a plugin
Section titled “Installing a plugin”Drop the plugin bundle into the user plugin directory:
- Windows:
%APPDATA%/MicroSeg/data/plugins - Linux:
~/.config/MicroSeg/data/plugins
A bundle is a directory tree of <plugin_id>/<version>/ containing
plugin.json (the manifest), plugin.wasm, and optional assets. When the
same plugin and version exists both built-in and user-installed, the
user-installed copy wins.
Managing plugins
Section titled “Managing plugins”The Plugin Manager shows each task’s required context, permissions, capabilities and resource profile, and lets you enable or disable plugins individually. Disabled plugins are never executed.
Which plugin handles Interactive and Auto annotation is bound per project
in <project_root>/.microseg/plugins.json, optionally pinned to a specific
version.
Built-in plugins
Section titled “Built-in plugins”Micro-Seg ships with:
microseg.example.hrnetocr— interactive AI segmentationmicroseg.example.hrnetocr_automatic— automatic multi-seed segmentationmicroseg.example.extensions— example extension tasks
Developing plugins
Section titled “Developing plugins”Plugins are written in Rust against the plugin-tasks-sdk crate and compiled
to a WASM component targeting the microseg:plugin/tasks@1.0.0 world.
A minimal plugin:
use plugin_tasks_sdk::prelude::*;
struct Plugin;
struct ExampleSession { seed_context: TaskSessionSeedContext,}
impl SessionPlugin for Plugin { type Session = ExampleSession;
fn open_session( task_id: String, seed_context: TaskSessionSeedContext, ) -> Result<Self::Session, TaskSessionError> { if task_id != "example.task" { return Err(error_invalid_request(format!( "unsupported task_id: {task_id}" ))); } Ok(ExampleSession { seed_context }) }}
impl TaskSession for ExampleSession { fn run(&mut self) -> Result<TaskSessionResult, TaskSessionError> { let image_id = self.seed_context.require_active_image_id()?; let labels = read_label_schema()?;
publish_progress(Some("Running example task"), Some(0.5))?;
Ok(TaskSessionResult { summary: Some(format!("image={image_id}, labels={}", labels.labels.len())), artifacts: Vec::new(), tables: Vec::new(), }) }}
export_task_plugin!(Plugin);Inside a session a plugin can query host state through typed require_ops
(existing instances, label schema, occupancy, rasterization), submit
incremental draft mutations with apply_ops, and publish progress, logs,
summaries, tables and artifacts. The host commits or discards the session
explicitly — only the committed batch is durable truth.
The full plugin contract, SDK and manifest templates are available on request — contact us.