bmux_plugin 0.0.1-alpha.3

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 attach_companion;
mod attach_presentation_input;
pub mod component_input;
pub mod component_render;
pub mod component_viewport;
mod declaration;
mod discovery;
mod event_bus;
mod host_runtime;
pub mod layout;
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 surface;
pub mod test_support;
mod typed_dispatch_bridge;
mod typed_service_caller;

pub use attach_companion::{
    AttachCompanion, AttachCompanionCallback, AttachCompanionFactory, AttachCompanionRegistry,
    AttachPresentationResources, global_attach_companion_registry, register_attach_companion,
    registered_attach_companions,
};
pub use attach_presentation_input::{
    AttachPresentationCommittedHandler, AttachPresentationFocusLostHandler,
    AttachPresentationInputHandler, AttachPresentationInputRegistry,
    AttachPresentationPasteHandler, global_attach_presentation_input_registry,
    global_attach_presentation_input_registry_handle, invoke_attach_presentation_input_handler,
    register_attach_presentation_input_handler, remove_attach_presentation_input_handler,
};
pub use bmux_plugin_runtime::{
    ConcurrencyGate, EffectiveConcurrencyPolicy, PluginConcurrencyConfig,
};
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, PluginManifestExtension,
    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, AttachInputServiceInvocation,
    AttachRenderExtension, AttachVisualAdapter, AttachVisualAdapterOutput,
    AttachVisualAdapterRequest, AttachVisualCellRef, AttachVisualFrameView,
    AttachVisualProjectionResult, AttachVisualProjectionUpdate, AttachVisualSurfaceView,
    BorderGlyphs, ExtensionRect, RenderCell, RenderColor, RenderDamage, RenderExtensionContext,
    RenderExtensionLayer, RenderExtensionRegistry, RenderLayerItem, RenderLayerScene,
    RenderLayerSceneBuilder, RenderNamedColor, RenderOp, RenderSceneItem, RenderSceneItemKey,
    RenderSceneItemKind, RenderStyle, RenderSurfaceChrome, RenderSurfaceRole, 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::{
    ServiceEndpoint, ServiceEndpointError, 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::{
    ASYNC_SERVICE_ROUTE_V1, AsyncCommandRouteGuard, AsyncServiceClient, AsyncServiceRequest,
    ServiceCallerDispatchClient, block_on_typed_dispatch, capture_async_command_route,
    enter_async_command_route,
};
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 register activation-time plugin contributions.
pub const DEFAULT_NATIVE_REGISTER_CONTRIBUTIONS_SYMBOL: &str =
    "bmux_plugin_register_contributions_v1";

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

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