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:
- host/application side:
crate::plugin::PluginManager - wire-format / protocol side:
crate::core::plugin - in-process built-ins that should behave like plugins without subprocesses:
crate::native::NativeCommandRegistry
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:
crate::plugin::PluginManageris the host-side facade for discovery, browse surfaces, provider selection, and dispatch- catalog and doctor payloads such as
crate::plugin::CommandCatalogEntry,crate::plugin::PluginSummary, andcrate::plugin::DoctorReportstay plain semantic data - dispatch customization flows through
crate::plugin::PluginDispatchContextand dispatch failures are surfaced ascrate::plugin::PluginDispatchError - discovery provenance is described by
crate::plugin::PluginSource
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.