Skip to main content

Module boundary_event

Module boundary_event 

Source
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:

  • Event crosses host→guest (delivered to the guest on-event export). It is fully owned (no borrows), so it round-trips both ways compiler-exhaustively — the honest “every variant covered” guarantee: a new Event arm cannot land without a mapping here (the effect mirror precedent). Paths cross as string; a non-UTF-8 path is a typed boundary error, never a lossy to_string_lossy (path_to_wit).

  • EventFilter crosses guest→host (a plugin’s subscribe(filter) at activate). It is a ONE-WAY projection (project_event_filter): the native EventFilter cannot round-trip — its GlobSet doesn’t reverse to patterns and its predicate is an arbitrary Rust closure. The declarative subset (kinds / path-globs / major-modes) crosses; a plugin that needs custom logic filters inside its own on-event handler (the grammar typed-error-defer precedent). This is the reverse of the grammar project_* fns (there native→WIT; here WIT→native).

Functions§

project_event_filter
Project a guest-supplied WitEventFilter into the native EventFilter (guest→host, one-way). The declarative fields cross; the native predicate is always None (a Rust closure can’t cross — the guest filters in its on-event handler instead). kinds = none stays the wildcard; path-globs compile via the same compile_glob_set the native subscribers use, so a plugin filter matches identically to a native one.