Skip to main content

Module boundary_picker

Module boundary_picker 

Source
Expand description

The picker-source boundary mirrors (plugin-host.md §4.2 / §5 picker-source).

Slice PH7.4a. The picker-source WIT interface is the plugin-facing API a WASM picker source authors against (the user’s “expose the api, not sources”: native sources stay native Rust; a plugin implements a source against these types and registers through the same PickerRegistry::register_generator seam a native source uses). This module round-trips that API’s data types:

  • Annotation (+ KeyChord) — marginalia. The whole closed enum crosses (PH7.4a decision) so a plugin candidate can define + populate themed columns. slot/category are theme element KEYS resolved at paint, never baked colors, so :colorscheme recolors plugin marginalia live. The host lays out AnnotationColumns from the visible set (a render-consumed projection), so only the per-candidate annotations cross, never the column layout.
  • ArgSpec / PickerSourceSpec — the source’s declared metadata.
  • RoutingPayload / OpenTarget — the per-candidate token a source emits and consumes in accept.
  • the owned PickerContext projection (§4.2) the host hands init — host→guest only, so it mirrors one-way (a project_* fn, the project_buffer_snapshot precedent), no from_wit.

The &'static str seam. PickerSourceSpec/ArgSpec use &'static str for ids/docs/prompts — native sources supply compile-time literals. A WASM plugin supplies owned runtime strings, so from_wit interns them ([intern], Box::leak). This is bounded by the loaded-source count (each source’s spec is leaked once at registration); unbounded re-registration (hot reload) is a PH7.12 concern — see the slice plan.

The active buffer’s bulk rope text + syntax-highlight overlay do NOT ride the context projection; they cross via the buffer document resource handle, wired with the init(ctx) guest export at PH7.4c. A fuzzy-finder needs neither.

Functions§

project_picker_context
Project a live PickerContext into its owned WIT mirror (§4.2). Host→guest only: the host builds this at init time; the guest never sends a context back. A non-UTF-8 path anywhere in the context is a typed error (§4.4), never a lossy encoding.