1. Discover what components exist
Callregistry.manifest() to get a JSON string describing every registered component and its full prop schema. Pass this to your agent as system context before generating any UI code.
2. Mount a component
mountComponent returns a numeric instance ID you can use to unmount later.
3. Handle errors
Solar throws aContractError when props don’t match the schema. It’s JSON-serializable — catch it and feed it back to the agent as correction context.
e.toJSON() returns:
4. Full agent loop
A minimal generate-mount-correct loop:5. Unmount when done
What agents should know
registry.manifest()is the source of truth. Never assume prop names or types — always read the manifest first.ContractErrorhas afixfield. It tells the agent exactly what to change — use it verbatim in retry prompts.- Components must be registered before mounting. If
registry.get(name)returnsundefined, the component either doesn’t exist or wasn’t registered. - Event handlers (
type: "function") cannot be serialized to JSON. The agent should generate handler function bodies as code strings and have the runtimeevalor import them — or use a fixed set of named handlers exposed by the host app.