Skip to main content

Module plugin

Module plugin 

Source
Expand description

External plugin discovery, protocol, and dispatch support. The plugin module exists so external commands can participate in osp without becoming a separate execution model everywhere else in the app.

This module owns the boundary between the core app and external command providers. Discovery and catalog building happen before dispatch so the rest of the app can reason about plugins as ordinary command metadata.

Broad-strokes flow:

plugin executable
     │ emits `describe` JSON
     ▼
[ core::plugin ]  wire DTOs + validation
     ▼
[ plugin ]        discovery, catalog building, provider selection
     ▼
[ app ]           command dispatch and rendering
     │
     └── later invokes plugin command -> `ResponseV1`

Start here based on which side of the boundary you own:

Minimal host-side browse path:

use osp_cli::plugin::PluginManager;

let manager = PluginManager::new(Vec::new()).with_path_discovery(false);
let plugins = manager.list_plugins();
let catalog = manager.command_catalog();
let doctor = manager.doctor();

assert!(plugins.is_empty());
assert!(catalog.is_empty());
assert!(doctor.conflicts.is_empty());

Choose crate::plugin::PluginManager when you are building the host and want discovery, catalog, and provider-selection behavior. Choose crate::core::plugin when you are implementing the plugin executable or need the stable wire DTOs directly.

Contract:

  • plugin discovery and dispatch rules live here
  • the rest of the app should consume plugin metadata/results, not spawn plugin processes ad hoc

Public API shape:

Re-exports§

pub use manager::CommandCatalogEntry;
pub use manager::CommandConflict;
pub use manager::DEFAULT_PLUGIN_PROCESS_TIMEOUT_MS;
pub use manager::DiscoveredPlugin;
pub use manager::DoctorReport;
pub use manager::PluginDispatchContext;
pub use manager::PluginDispatchError;
pub use manager::PluginManager;
pub use manager::PluginSource;
pub use manager::PluginSummary;
pub use manager::RawPluginOutput;

Modules§

manager
Public plugin facade and shared plugin data types.