@llui/compiler-introspection
Opt-in compiler module that emits runtime-introspection metadata. Consumed by @llui/agent (for end-user agent surfaces) and @llui/mcp (for the dev MCP server).
When enabled, the compiler emits:
- Msg schemas — discriminated-union JSON Schema for every component's
Msg, used byllui_validate_messageandllui_get_message_schema. - Msg annotations —
@intent,@should,@emits, etc. surfaced as runtime metadata. - State schemas — JSON Schema for every component's
State. - Binding descriptors — per-binding kind/mask/path data used by
llui_get_bindings. - Schema hash — a stable content hash so consumers can detect schema changes across reloads.
Why it's separate
These payloads add bundle weight that production apps without agent/MCP integration don't need. Splitting them into an opt-in package keeps the @llui/compiler engine lean.
Constants
introspectionFactory
Builds the introspection module set for a single source file. Activation order matches the v2c/decomp-7 design:
bindingDescriptorsModule— preTransform fires first so the universal handler-tagger + scope-variant-registration runs before any visitor or emit phase sees the file.msgSchemaModule,stateSchemaModule,msgAnnotationsModule— producer modules populate the schema-hash inputs slot.schemaHashModule— emit reads the populated slot. Per-module activation gates mirror whattransformLluidid inline before decomp-26:
msgSchemaModulewhen at least one of Msg / Effect schemas extractedstateSchemaModulewhen State schema extractedmsgAnnotationsModulewhen annotation map non-null (includes empty)schemaHashModulealways (well-defined hash over null inputs)bindingDescriptorsModulealways when introspection is on The "always-on schemaHash" comes from spec §7.4: the hash ships in prod too, used by HMR re-send gating regardless of agent mode.
const introspectionFactory: IntrospectionFactory