Expand description
The boundary adapter machinery (plugin-host.md §4).
Design fragment §4. Slice: PH7.3a (conventions + Args); the Effect
variant mirror is PH7.3b; the document resource handle + owned-snapshot
projection is PH7.3c.
Native host types (lattice_grammar::args::Args, Effect, the picker /
completion records) cannot cross a WASM boundary as-is — they carry
borrows, closures, Future/Stream carriers, or non-serde fields (§4.1–
§4.5). The generated WIT mirror (from wit/types.wit, emitted by
bindgen! at the crate root) is the owned, serializable shape the guest
sees. WitBoundary is the single adapter contract between the two: one
place that defines to_wit / from_wit and the Result<_, String> error
convention, so every type round-trips uniformly and a malformed payload is
rejected at the boundary rather than at apply-time.
The String error arm is deliberate: it is the WIT result<_, string>
convention (§4, “Result<_, string> error convention”), so a conversion that
cannot be represented yet (e.g. a nested CommandInvocation, §4.1) surfaces
as a typed error the host logs + skips, never a panic or a lossy encoding.
Traits§
- WitBoundary
- Converts a native host type to/from its generated WIT mirror.