Expand description
The plugin-API catalog: the wit/ package parsed at build time into typed
data, and the reference, JSON and agent bundle rendered from it (PI.1).
The wit/ package at the workspace root IS the canonical plugin API
(plugin-host.md §5). This crate exposes a PluginApiCatalog derived from
that WIT at build time (build.rs → wit-parser → $OUT_DIR/catalog.rs),
so the catalog can never drift from the interface it documents. It answers
the “what CAN a plugin do” facet of the introspection layer (design §5.11);
:describe-plugin-api / :list-plugin-apis / :apropos (PI.2) render it,
and plugin authors export it (JSON/markdown).
This crate is deliberately wasmtime-free — its only build input is the
WIT text and its only runtime dep is std. lattice-host can therefore dep
it for the introspection ex-commands WITHOUT pulling the WASM runtime into
the host, keeping the no-per-frame-WASM invariant (plugin-host.md PH7.5).
Two things the catalog carries that the parser can’t infer:
- direction — world-derived (does a guest export the interface, i.e.
implement it, or import it, i.e. call into the host); a descriptive
hint, since
use-for-types also registers an import edge. - capability — a host-authored annotation the WIT can’t express (which
OS capability a seam requires); see
CAPABILITY_ANNOTATIONS. Every parsed interface MUST have an entry (enforced by a test), so a new WIT interface forces a deliberate capability decision before it ships.
Modules§
- examples
- AD.3: examples for the plugin-API reference, extracted from guests CI already builds.
- json
- AD.2: the catalog as JSON — the plugin API for a reader that wants structure rather than prose (an agent, a code generator, an editor integration).
- render
- PI.6 / AD.1: rendering the plugin-API catalog for humans.
Structs§
- ApiFunction
- One function within an interface.
- ApiInterface
- One WIT interface — a namespace of functions a plugin implements or calls.
- ApiMember
- A record field, variant case, enum case or flag.
- ApiParam
- One function parameter.
- ApiType
- One type an interface defines.
- ApiUse
- A type an interface imports from another with
use. - ApiWorld
- One WIT world — a bundle of imported/exported interfaces a component targets.
- Plugin
ApiCatalog - The whole plugin-API surface, derived from
wit/.
Enums§
- ApiFunction
Kind - Whether a function stands alone or belongs to a resource.
- ApiType
Kind - The shape of a type definition.
- Capability
- A host-authored capability annotation the WIT can’t itself carry.
- Direction
- World-derived direction of an interface relative to a guest plugin.
Constants§
- CAPABILITY_
ANNOTATIONS - The host-authored capability annotation, one row per WIT interface.
- PACKAGE
- The WIT package the catalog was derived from, e.g.
lattice:plugin-host@0.1.0— the name a guest’swit_bindgenworld path resolves under.
Functions§
- capability_
for - The capability annotation for an interface, or
Noneif unannotated (which the coverage test forbids for any parsed interface). - catalog
- The plugin-API catalog, derived from
wit/at build time and merged with the host-authored capability annotation. Computed once, then cached.