Problem
IPC bus payloads are opaque JSON strings. The runtime has no schema metadata for topic payloads, so the LLM (A2UI bridge) cannot know what fields a topic carries or what they mean. New capsules are invisible to the UI.
Solution
Let capsule authors define WIT records for their IPC event types. At install time, wit-parser extracts field names, types, and /// doc comments into JSON Schema. The schema is baked into meta.json and fed to the SchemaCatalog at runtime.
Capsule author workflow
- Write
wit/events.wit with ///-documented records
- Declare
[[topic]] in Capsule.toml with wit_type = "record-name"
- Use the generated Rust struct in capsule code via
ipc::publish_json()
- Install → runtime populates schema catalog → LLM sees typed schema
Changes
wit-parser 0.227 workspace dependency
astrid-build::wit_schema module (WIT record → JSON Schema converter)
wit_type: Option<String> field on TopicDef
bake_topics() extended for WIT type resolution
SchemaCatalog::register_topics() accepts baked schemas
WasmEngine::load() reads meta.json and populates schema catalog
Problem
IPC bus payloads are opaque JSON strings. The runtime has no schema metadata for topic payloads, so the LLM (A2UI bridge) cannot know what fields a topic carries or what they mean. New capsules are invisible to the UI.
Solution
Let capsule authors define WIT records for their IPC event types. At install time,
wit-parserextracts field names, types, and///doc comments into JSON Schema. The schema is baked intometa.jsonand fed to theSchemaCatalogat runtime.Capsule author workflow
wit/events.witwith///-documented records[[topic]]inCapsule.tomlwithwit_type = "record-name"ipc::publish_json()Changes
wit-parser0.227 workspace dependencyastrid-build::wit_schemamodule (WIT record → JSON Schema converter)wit_type: Option<String>field onTopicDefbake_topics()extended for WIT type resolutionSchemaCatalog::register_topics()accepts baked schemasWasmEngine::load()reads meta.json and populates schema catalog