>_ bmux
docsgithub

Plugin SDK

bmux_plugin

Native-first plugin SDK for bmux.

Goals

  • Keep the default plugin authoring path simple
  • Support deep native integrations without exposing unstable internals directly
  • Separate bmux plugin API and native ABI versioning from the bmux product version
  • Make it possible to move more built-in functionality onto plugin-style contracts over time

What This Crate Provides Today

  • Plugin manifest parsing
  • Stable plugin declaration types
  • Host scope and plugin feature declaration types
  • Host service traits for plugin-facing integrations
  • Plugin registry and host compatibility validation
  • Native plugin entrypoint metadata constants

Current Scope

This crate now supports native plugin discovery, validation, loading, lifecycle hooks, command execution, and event delivery. Host services are still intentionally narrow and deeper runtime hooks are still being built out.

Manifest Example

id = "git.status" name = "Git Status" version = "0.1.0" runtime = "native" entry = "libgit_status.dylib" required_host_scopes = ["bmux.commands", "bmux.events.subscribe"] provided_features = ["git.status"] [plugin_api] minimum = "1.0" [native_abi] minimum = "1.0"
The manifest entry should point at the installed plugin bundle artifact, typically a library placed next to the manifest, rather than a hardcoded Cargo target/ path.

Rust Example (Builder-First)

use bmux_plugin::{ CommandExecutionKind, HostScope, NativeCommandContext, NativeDescriptor, PluginCommand, RustPlugin, }; #[derive(Default)] struct HelloPlugin; impl RustPlugin for HelloPlugin { fn descriptor(&self) -> NativeDescriptor { NativeDescriptor::builder("hello.example", "Hello Example") .plugin_version("0.1.0") .description("Small example plugin") .require_capability("bmux.commands") .unwrap() .provide_feature("hello.example") .unwrap() .command( PluginCommand::new("hello", "Print a greeting") .execution(CommandExecutionKind::ProviderExec), ) .build() .unwrap() } fn run_command(&mut self, context: NativeCommandContext) -> i32 { match context.command.as_str() { "hello" => { println!("hello from bmux"); 0 } _ => 64, } } } bmux_plugin::export_plugin!(HelloPlugin);

Design Notes

  • Prefer plugin-facing DTOs, handles, and service traits over direct access to server internals
  • Treat hot-path runtime hooks as explicit high-risk host scopes
  • Keep ordinary plugins compatible across bmux releases by stabilizing bmux_plugin first
  • Leave room for future non-Rust runtimes by defining manifests, host scopes, and plugin features as host concepts
  • Keep plugin domain ownership, capability policy, and migration intent in code and tests rather than external markdown planning docs