Expand description
The sync grammar trampoline + registry wiring (plugin-host.md §4.1, PH7.7c).
This is the production counterpart to the picker/completion actor adapters —
but synchronous, per the PH7.7 fork: a plugin motion/operator/text-object
must resolve inline on the dispatch thread to compose with its operator (async
would break operator∘motion atomicity + dot-repeat/macros). So there is no
actor task; the native spec’s apply closure calls the guest export directly
under a lock, bounded by a Reflex-class fuel/epoch budget
(PluginBudget::grammar).
Flow (PluginHost::instantiate_grammar_plugin):
- instantiate the
grammar-plugincomponent against the sync grammar linker (lib.rs: sync WASI + thegrammarregister import), - call the guest’s
register-grammarexport (sync) — the guest calls the importedregister-*host funcs, which record intoGrammarContributions, - drain the recorded contributions and build a native
*Specfor each, whoseapply/parse_argsis a trampoline closure over the sharedArc<Mutex<GrammarGuest>>+ the guest-chosen callback id, - return a
GrammarContributionSetthe caller registers into itsCommandRegistryviaregister_plugin_*(mode-ownership — the host builds specs, the caller owns the registry; ZEROEditor::methods).
Graceful degradation (§8): a guest err, a fuel/epoch trap (the Reflex
runaway guard), a boundary-conversion failure, or a poisoned lock all map to
CommandError::Plugin — the dispatcher commits no effect, the contribution
is a no-op, the reason is logged. Never a panic, never a keystroke hang.
Structs§
- Grammar
Contribution Set - The native grammar contributions a plugin declared, each with a trampoline
applyinto the guest, ready for the caller to register into itsCommandRegistry. The host builds the specs (owning the trampoline over the guest store) but never owns the registry —register_alltakes the caller’s&mut CommandRegistryand stamps every entrySourceLayer::Plugin(plugin_id)via theregister_plugin_*seam (mode-ownership; ZEROEditor::methods). - Plugin
Operator Chord - CM.2: a chord a plugin declared on its operator, as recorded at drain time.
- Wired
Operator Chord - CM.2: a chord request, paired with the
OperatorIdregistration produced.