pub struct PluginHost { /* private fields */ }Expand description
Window-scoped plugin host: discovery cache, running processes, restart
supervision, and the last SetWidget text per plugin.
Implementations§
Source§impl PluginHost
impl PluginHost
Sourcepub fn overlays(&self) -> &HashMap<String, PluginOverlay>
pub fn overlays(&self) -> &HashMap<String, PluginOverlay>
Live plugin overlays (plugin id → overlay), for the render layer.
Sourcepub fn focused_overlay(&self) -> Option<&str>
pub fn focused_overlay(&self) -> Option<&str>
The focused overlay’s plugin id, if any — the render layer’s click-to-focus target check and the key router’s focus check.
Sourcepub fn focus_overlay(&mut self, plugin_id: &str)
pub fn focus_overlay(&mut self, plugin_id: &str)
Focus one plugin’s overlay (the render layer’s click path). Only an overlay that is live AND interactive can take focus — everything else clears focus, so the call doubles as the unfocus path.
Sourcepub fn unfocus_overlay(&mut self)
pub fn unfocus_overlay(&mut self)
Drop overlay focus entirely (Escape path; also called when the focused overlay stops being focusable).
Sourcepub fn send_overlay_event(
&mut self,
plugin_id: &str,
widget_id: &str,
event: OverlayWidgetEvent,
) -> bool
pub fn send_overlay_event( &mut self, plugin_id: &str, widget_id: &str, event: OverlayWidgetEvent, ) -> bool
Deliver one semantic overlay-widget event to a plugin’s running overlay process (the renderer’s interaction sink). Returns false without warning when there is nothing to deliver to — the renderer only calls this for a focused overlay it just drew, so a miss means the process raced an exit, which the supervisor reports.
Sourcepub fn overlay_events_dispatched_count(&self) -> u64
pub fn overlay_events_dispatched_count(&self) -> u64
Successful overlay-event stdin writes this session — the
plugin_overlay_event ui-test operand’s source. Monotonic.
Source§impl PluginHost
impl PluginHost
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty host. Nothing runs until
refresh_discovery +
apply_enabled say otherwise.
Sourcepub fn refresh_discovery(&mut self, root: &Path) -> &[DiscoveredPlugin]
pub fn refresh_discovery(&mut self, root: &Path) -> &[DiscoveredPlugin]
Re-scan a plugins root, replacing the discovery cache. Running plugins are preserved — a re-scan never stops or spawns anything.
Sourcepub fn discovered(&self, id: &str) -> Option<&DiscoveredPlugin>
pub fn discovered(&self, id: &str) -> Option<&DiscoveredPlugin>
The discovery-cache entry for a plugin id, if the last scan found it.
Sourcepub fn discovered_count(&self) -> usize
pub fn discovered_count(&self) -> usize
Number of plugins the last discovery scan accepted.
Sourcepub fn apply_enabled(&mut self, enabled: &[EnabledPlugin])
pub fn apply_enabled(&mut self, enabled: &[EnabledPlugin])
Reconcile running plugins with the enabled set (diff → spawn/stop).
Land-disabled is structural: only ids present in enabled AND in the
discovery cache are spawned, so dropping a plugin directory into the
root does nothing until the Settings layer enables it. A multi-kind
manifest spawns every declared kind’s entry in this one pass, with
the same settings argv and one supervision slot per kind (design D5).
Sourcepub fn poll(&mut self)
pub fn poll(&mut self)
Advance supervision one frame: drain each running plugin process’s commands (every kind), observe exits, and drive each kind’s restart supervisor (manifest-declared mode, capped) — one frame advance covers the widget, action, and panel maps identically.
Commands are drained before exit handling so a plugin’s final output before a crash still lands.
Sourcepub fn widget_text(&self, plugin_id: &str) -> Option<&str>
pub fn widget_text(&self, plugin_id: &str) -> Option<&str>
Last SetWidget text recorded for a plugin, if any.
Sourcepub fn panel_content(&self, plugin_id: &str) -> Option<&(String, String)>
pub fn panel_content(&self, plugin_id: &str) -> Option<&(String, String)>
Last SetPanel (title, content) recorded for a panel plugin, if any.
Sourcepub fn subscription_forwarders(
&self,
) -> &HashMap<String, Arc<ScriptEventForwarder>>
pub fn subscription_forwarders( &self, ) -> &HashMap<String, Arc<ScriptEventForwarder>>
Live per-plugin event forwarders (plugin id → forwarder), for the
window layer’s observer registration and per-sweep drain — the pump
in StatusBarUI::pump_plugin_events.
Sourcepub fn deliver_events(&mut self, plugin_id: &str, events: &[ScriptEvent])
pub fn deliver_events(&mut self, plugin_id: &str, events: &[ScriptEvent])
Deliver drained events to one plugin’s running processes (every kind alike — the manifest’s subscriptions are plugin-level, so every running process of the plugin hears them).
A plugin with no running process this sweep silently drops the events: they are moments in time, not state, and its supervisor restarts it for the next ones. Write failures (a process exiting mid-delivery) warn once per episode.
Sourcepub fn sync_theme(&mut self, theme: &Theme)
pub fn sync_theme(&mut self, theme: &Theme)
Deliver the active theme to every running plugin subscribed to
THEME_CHANGED_KIND: the greet after each (re)spawn and every
change thereafter, deduped by theme name.
App-sourced — nothing here reads a terminal. The status bar calls this per frame with the config-resolved theme, which catches every theme-application site (system dark/light switch, settings apply, config reload) without editing any of them. A same-name sync delivers nothing unless the plugin was (re)spawned since (the greet-due flag), so a respawned process that has never seen a theme still gets one.
Sourcepub fn widget_texts(&self) -> &HashMap<String, String>
pub fn widget_texts(&self) -> &HashMap<String, String>
All recorded widget texts (plugin id → text), for the status bar.
Sourcepub fn panel_contents(&self) -> &HashMap<String, (String, String)>
pub fn panel_contents(&self) -> &HashMap<String, (String, String)>
All recorded panel contents (plugin id → (title, content)), for the settings plugins section.
Sourcepub fn actions_dispatched_count(&self) -> u64
pub fn actions_dispatched_count(&self) -> u64
Successful Self::invoke_action stdin writes this session.
Monotonic for the session and never reset — delivered-means-true
dispatch has no undo, so the count only grows.
Sourcepub fn running_plugin_ids(&self) -> Vec<String>
pub fn running_plugin_ids(&self) -> Vec<String>
Ids of plugins with any running or supervised process, of any kind. A multi-kind plugin appears once.
Sourcepub fn invoke_action(&mut self, plugin_id: &str, action_id: &str) -> bool
pub fn invoke_action(&mut self, plugin_id: &str, action_id: &str) -> bool
Invoke one of a plugin’s contributed palette actions: write a single
ScriptEvent line carrying ScriptEventData::PluginActionInvoked
to the plugin’s running action process.
Returns true only when the plugin is discovered, declares the
action-contributor kind, the action id is in its manifest, a process
is running, and the stdin write succeeded. Every miss returns false
behind WarnOnce gates (warned_not_discovered, and
warned_action_not_running for every post-discovery miss) — a stuck
keybinding can retry this at frame rate.
Sourcepub fn palette_actions(&self) -> Vec<PluginActionRow>
pub fn palette_actions(&self) -> Vec<PluginActionRow>
Palette rows for every action of every discovered, enabled, action-contributor plugin (design D2), in discovery order.
Sourcepub fn drain_ignored(&mut self) -> Vec<String>
pub fn drain_ignored(&mut self) -> Vec<String>
Take the lines accumulated from refused plugin commands (the read-errors-style surface for commands v1 ignores).
Sourcepub fn drain_crash_caps(&mut self) -> Vec<PluginCrashCap>
pub fn drain_crash_caps(&mut self) -> Vec<PluginCrashCap>
Drain supervisor give-up events (see PluginCrashCap). Called once
per frame by the window layer.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for PluginHost
impl !UnwindSafe for PluginHost
impl Freeze for PluginHost
impl Send for PluginHost
impl Sync for PluginHost
impl Unpin for PluginHost
impl UnsafeUnpin for PluginHost
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.