bmux_plugin 0.0.1-alpha.1

Plugin system for bmux terminal multiplexer
#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
#![allow(clippy::multiple_crate_versions)]
#![allow(clippy::result_large_err)]

//! Host-side plugin infrastructure for bmux.
//!
//! This crate provides the registry, loader, discovery, and validation
//! machinery that the bmux runtime uses to manage plugins.
//!
//! **Plugin authors** should depend on [`bmux_plugin_sdk`] instead — it
//! provides the [`RustPlugin`](bmux_plugin_sdk::RustPlugin) trait, context
//! types, macros, and everything needed to write a plugin without pulling
//! in the host-side dependencies.

pub mod action_dispatch;
mod declaration;
mod discovery;
mod event_bus;
mod host_runtime;
mod loader;
mod manifest;
mod plugin_state;
pub mod prompt;
mod registry;
pub mod render;
mod service_location;
mod startup_gate;
mod static_vtable_registry;
pub mod test_support;
mod typed_dispatch_bridge;
mod typed_service_caller;

pub use bmux_plugin_sdk::PluginEventKind;
pub use declaration::{
    NativePlugin, PluginDeclaration, PluginDependency, PluginEntrypoint, PluginExecutionClass,
    PluginId, PluginLifecycle, PluginOwnedPath,
};
pub use discovery::{
    DEFAULT_PLUGIN_MANIFEST_FILE, PluginDiscoveryReport, discover_plugin_manifests,
    discover_plugin_manifests_in_roots, discover_registered_plugins,
    discover_registered_plugins_in_roots,
};
pub use event_bus::{
    DEFAULT_EVENT_BUS_CAPACITY, DeliveryMode, EventBus, EventBusBytesError, EventBusChannelOptions,
    EventBusError, EventBusResult, JsonPluginEvent, JsonProjectionPolicy, global_event_bus,
};
pub use host_runtime::{HostRuntimeApi, ServiceCaller};
pub use loader::{
    LoadedPlugin, NativePluginLoader, NativeServiceBufferConfig, load_registered_plugin,
    load_registered_plugin_with_native_service_buffer_config, load_static_plugin,
    load_static_plugin_with_native_service_buffer_config, load_trusted_static_plugin,
    load_trusted_static_plugin_with_native_service_buffer_config,
};
pub use manifest::{
    PluginManifest, PluginManifestCompatibility, PluginManifestKeybindings, PluginRuntime,
};
pub use plugin_state::PluginStateRegistry;
pub use plugin_state::global_registry as global_plugin_state_registry;
pub use registry::{
    CapabilityProvider, PluginCompatibilityReport, PluginRegistry, RegisteredPlugin,
    ServiceProvider,
};
pub use render::{
    AttachInputEndpoint, AttachInputEvent, AttachInputHook, AttachInputHookFilter,
    AttachInputModifiers, AttachInputPaneContext, AttachInputResult, AttachRenderExtension,
    AttachVisualAdapter, AttachVisualAdapterOutput, AttachVisualAdapterRequest,
    AttachVisualCellRef, AttachVisualFrameView, AttachVisualProjectionResult,
    AttachVisualProjectionUpdate, AttachVisualSurfaceView, BorderGlyphs, ExtensionRect, RenderCell,
    RenderColor, RenderDamage, RenderExtensionContext, RenderExtensionLayer,
    RenderExtensionRegistry, RenderLayerItem, RenderNamedColor, RenderOp, RenderStyle,
    RenderTextSpan, RenderUnderCell, TerminalGraphicFill, TerminalGraphicOverlay,
    TerminalRenderCapabilities, TerminalRgba, VisualAdapterRegistry, clip_render_text_run_to_rect,
    global_render_extension_registry, global_visual_adapter_registry, register_render_extension,
    register_visual_adapter, registered_render_extensions, registered_visual_adapter,
    render_char_display_width_u16, render_single_display_cell_char, render_text_width_u16,
};
pub use service_location::{ServiceLocation, ServiceLocationMap, global_service_locations};
pub use startup_gate::{
    StartupReadyGate, StartupReadyGateRegistry, global_startup_ready_gate_registry,
    register_startup_ready_gate, registered_startup_ready_gates,
};
pub use static_vtable_registry::{register_static_vtable, static_vtable};
pub use typed_dispatch_bridge::{ServiceCallerDispatchClient, block_on_typed_dispatch};
pub use typed_service_caller::TypedServiceCaller;

/// Default exported symbol used to invoke a plugin command.
pub const DEFAULT_NATIVE_COMMAND_SYMBOL: &str = "bmux_plugin_run_command_v1";

/// Default exported symbol used to invoke a plugin command with host context.
pub const DEFAULT_NATIVE_COMMAND_WITH_CONTEXT_SYMBOL: &str =
    "bmux_plugin_run_command_with_context_v1";

/// Default exported symbol used to activate a plugin lifecycle hook.
pub const DEFAULT_NATIVE_ACTIVATE_SYMBOL: &str = "bmux_plugin_activate_v1";

/// Default exported symbol used to deactivate a plugin lifecycle hook.
pub const DEFAULT_NATIVE_DEACTIVATE_SYMBOL: &str = "bmux_plugin_deactivate_v1";

/// Default exported symbol used to deliver plugin events.
pub const DEFAULT_NATIVE_EVENT_SYMBOL: &str = "bmux_plugin_handle_event_v1";

/// Default exported symbol used to invoke a plugin-provided service.
pub const DEFAULT_NATIVE_SERVICE_SYMBOL: &str = "bmux_plugin_invoke_service_v1";