Expand description
The event/hook boundary conversions (plugin-host.md §5 events, PH7.8a).
Mirrors lattice_runtime::EventBus + the lattice_protocol::Event enum —
the observation-only hook surface a plugin subscribes to. Two directions:
-
Eventcrosses host→guest (delivered to the gueston-eventexport). It is fully owned (no borrows), so it round-trips both ways compiler-exhaustively — the honest “every variant covered” guarantee: a newEventarm cannot land without a mapping here (theeffectmirror precedent). Paths cross asstring; a non-UTF-8 path is a typed boundary error, never a lossyto_string_lossy(path_to_wit). -
EventFiltercrosses guest→host (a plugin’ssubscribe(filter)atactivate). It is a ONE-WAY projection (project_event_filter): the nativeEventFiltercannot round-trip — itsGlobSetdoesn’t reverse to patterns and itspredicateis an arbitrary Rust closure. The declarative subset (kinds/path-globs/major-modes) crosses; a plugin that needs custom logic filters inside its ownon-eventhandler (the grammar typed-error-defer precedent). This is the reverse of the grammarproject_*fns (there native→WIT; here WIT→native).
Functions§
- project_
event_ filter - Project a guest-supplied
WitEventFilterinto the nativeEventFilter(guest→host, one-way). The declarative fields cross; the nativepredicateis alwaysNone(a Rust closure can’t cross — the guest filters in itson-eventhandler instead).kinds = nonestays the wildcard;path-globscompile via the samecompile_glob_setthe native subscribers use, so a plugin filter matches identically to a native one.