| 1 | #![allow(dead_code)] |
| 2 | |
| 3 | pub mod activation; |
| 4 | pub mod agent_plugin; |
| 5 | pub mod builtin; |
| 6 | pub mod context; |
| 7 | pub mod discovery; |
| 8 | pub mod export; |
| 9 | pub mod install; |
| 10 | pub mod managed_policy; |
| 11 | pub mod manifest; |
| 12 | pub mod marketplace; |
| 13 | pub mod matcher; |
| 14 | pub mod mutation; |
| 15 | pub(crate) mod native_presets; |
| 16 | mod path_identity; |
| 17 | pub mod recommend; |
| 18 | pub mod registry; |
| 19 | pub mod runtime; |
| 20 | pub mod types; |
| 21 | |
| 22 | #[cfg(test)] |
| 23 | pub(crate) mod test_fixture; |
| 24 | #[cfg(test)] |
| 25 | mod tests; |
| 26 | |
| 27 | pub use context::{HostEnvironment, PluginDiscoveryContext}; |
| 28 | pub use discovery::PluginCatalogStamp; |
| 29 | pub(crate) use path_identity::metadata_is_link_or_reparse; |
| 30 | #[cfg(windows)] |
| 31 | pub(crate) use path_identity::windows_file_identity; |
| 32 | pub use registry::PluginRegistry; |
| 33 | |
| 34 | pub const PLUGIN_RELOAD_NUDGE: &str = "Plugins changed on disk. Run /plugin reload to apply."; |
| 35 | |
| 36 | /// Returns the reload nudge once per distinct on-disk catalog stamp. |
| 37 | #[must_use] |
| 38 | pub fn plugin_reload_nudge( |
| 39 | registry: &PluginRegistry, |
| 40 | last_nudged: &mut Option<PluginCatalogStamp>, |
| 41 | ) -> Option<&'static str> { |
| 42 | if !registry.on_disk_catalog_changed() { |
| 43 | return None; |
| 44 | } |
| 45 | let live = registry.live_catalog_stamp(); |
| 46 | if last_nudged.as_ref() == Some(&live) { |
| 47 | return None; |
| 48 | } |
| 49 | *last_nudged = Some(live); |
| 50 | Some(PLUGIN_RELOAD_NUDGE) |
| 51 | } |
| 52 |