Expand description
The §4.1 trampoline + §4.3 result-carrier (plugin-host.md, PH7.3d).
§4.1 — closures cannot cross the boundary, so a contribution’s apply
becomes “the guest exports a function; the host stores (id → export) and
calls it by id, projecting the context in and mapping the returned WIT
effect back to native.” The production trampoline (the shim closure the
grammar/picker dispatcher calls) is world-specific and lands with the
grammar / picker-source worlds (PH7.4/7.7); this slice proves the
mechanism end-to-end against a minimal wasm32-wasip2 fixture guest — a real
guest↔host canonical-ABI call — retiring §14’s highest risk (the whole
effect mirror actually crosses).
§4.3 — a plugin’s Future/Stream result cannot cross either. The carrier
re-expresses it as “guest returns batches; host owns the loop / Future /
mpsc.” collect_batches is that host-owned loop: it pulls batches from a
(world-specific) guest export until one comes back empty. The guest never
names a tokio type.
Functions§
- collect_
batches - Drive a batch-returning guest export to exhaustion, aggregating every batch
into one owned
Vec(§4.3).nextwraps the guest’snext-batch-style call; an empty batch is the exhausted sentinel. The host owns this loop — the guest only ever returns data. Anextthat errors aborts the drive with that error (a trapped/fuel-exhausted batch call never yields a partial-but- silent result).