How it works
The agent-driven loop looks like this at runtime:- The user describes a change. “Add a delete button to each row.” The request is a natural-language delta, not a full rebuild.
- The agent reads
registry.manifest(). Before generating code, the agent pulls the full component catalog — every component name, prop type, required flag, and enum. It targets this exact contract instead of inferring conventions from style guides. - The agent generates or modifies the affected component. Because the manifest gives the agent a precise schema, it makes a surgical change — updating one component, not rewriting the whole tree.
- The new component is mounted with
mountComponent(), replacing the old one. Unmount the previous instance by its id, then mount the new component in the same container. The rest of the UI is untouched.
Mounting and unmounting
mountComponent() returns a numeric instance id. Store that id so you can unmount the component later. unmountComponent() cleans up event listeners, runs effect teardown callbacks, and removes the component’s DOM node.
Every container can hold one mounted component at a time. Unmount the current instance before mounting a replacement in the same container.
Why runtime-based matters
Solar has no compile step between generation and execution. The agent generates a component string, you evaluate it or load it as a dynamic module, and the browser runs it immediately. There is no bundler waiting in the loop, no cold-start delay, no hot-reload round trip. This matters for agent-driven UIs because the feedback cycle is everything. The faster the user sees the result of their request, the tighter the interaction loop becomes — and the more useful the agent feels.The self-correction loop
When the agent makes a prop mistake, Solar throws aContractError with a machine-readable toJSON() payload. Feed that payload back to the agent as the next prompt and it can correct the mistake and regenerate — without any human intervention.
ContractError payload includes component, prop, expected, received, and a fix string — everything the agent needs to understand what went wrong and produce a corrected component on the next attempt.
Vibe-coded apps
Solar works well for apps built entirely through prompting — Cursor, Claude, or similar tools writing the full codebase. The usual failure mode in vibe-coded apps is “worked in isolation, broke in context”: the model generates a component that looks correct on its own but clashes with conventions in the rest of the codebase. Solar reduces this failure mode because all component conventions are explicit and machine-readable, not inferred from style guides or example files. The rules are:- One component per file
- File name matches component name
- Default export is always a
defineComponentcall - Props are always typed and validated
defineComponent calls all the way down. There is nothing to infer and nothing to guess.
Because Solar is runtime-based with no build step, the generation-to-render loop is much tighter than with compiler-based frameworks. Compiler-based frameworks require a full rebuild before the browser can run new code. With Solar, the agent generates a component and the browser executes it in the same tick — which makes real-time agent-driven UI modification practical rather than theoretical.