Skip to main content

Module config_host

Module config_host 

Source
Expand description

The config guest→host option-declaration seam (PH7.10).

A config plugin implements the config-plugin world: it imports the config API (register-option / get-option) and exports register-options (the host calls it once to drive declaration). This module holds the bindgen! for that world plus the host-side registration logic — the type mapping from the WIT option-type to a native OptionType impl, factored here so it is unit-testable without a Store (the host_services precedent).

The canonical API is the WIT (config.wit) — any component-model language calls register-option directly. A plugin option lands in the SAME ConfigRegistry core options use, built as a concrete Option<bool|i64|String> via the public OptionType parse/format contract, so :set / :describe-option / gen:options completion / OptionChanged treat it uniformly with NO host kind-branch.

Registration flow (the register-events precedent): the host sets the ConfigRegistry handle on PluginState, calls the guest’s register-options export, and the guest calls the imported register-option — which registers directly into the handle (no drain step; options are declared synchronously, unlike event subscriptions which need bus wiring).

Enums§

PluginOptionKind
The native value type a plugin option maps to — the host-side mirror of the WIT option-type enum, kept as a plain enum (no bindgen type) so the registration logic is unit-testable without the generated bindings.

Functions§

register_plugin_option
The register-option host-service body (PH7.10). Builds a concrete Option<bool|i64|String> from the plugin’s declaration and registers it into the SAME ConfigRegistry core options use. Returns false (registering nothing) if default doesn’t parse for kind OR name collides with an existing option — a plugin must not silently shadow another option.
register_structured_option
TC.3 — register an option whose value has structure.