Expand description
PH7.8c — the per-plugin event-delivery actor + bus wiring.
Design fragment: docs/dev/architecture/plugin-host.md §5 events + §3
(Store-per-plugin, task-per-Store). Slice plan: PH7.8c.
§The shape
Event delivery is host→guest, fire-and-forget — the opposite direction of
the picker/completion bridges (which are host-calls-guest-for-a-reply). The
host owns an mpsc; the native EventBus pushes each matched [Event] into
it via a SubscriptionTarget::Plugin sink (with the bus lock dropped, so a
slow handler never stalls the publisher or another subscriber, audit M1); the
EventActor drains that channel on the plugin’s own task and drives the
guest on-event export. There is no reply — a hook observes, it does not
return a value (the bus is observation-only in v1, §5.10).
So this actor is simpler than picker_task: no
oneshot, no Client with call methods. Its input channel IS the sink the
bus pushes into; the loop projects each event to WIT and calls on-event.
Async delivery keeps plugin event work off the keystroke path entirely
(paramount #4), bounded per-delivery by PluginBudget::event.
§Runtime ownership + lifecycle
The lib owns no runtime: PluginHost::spawn_event_plugin returns the
(Vec<SubscriptionId>, EventActor) pair; the caller drives
EventActor::run on its multi-thread runtime and holds the subscription ids
to EventBus::unsubscribe on teardown. When every subscription is removed
(teardown / lazy prune of a closed sink), the sink Arcs drop, the channel
closes, and the actor loop ends — dropping the Store (the teardown seam;
full crash-quarantine is PH7.12).
Structs§
- Event
Actor - The per-plugin actor: owns the
Store+ events bindings for the plugin’s life and driveson-eventfor each delivery the bus pushes onto its channel. Construct viaPluginHost::spawn_event_plugin; drive by spawningrunon a multi-thread runtime.