Generated code loop
- 1. PromptAsk an agent for an interface.
- 2. CodeModel emits JSX, CSS, chart code, and glue.
- 3. ShipBuild, deploy, reload, then hope it fits.
LensUI lets agents generate interfaces inside a mounted browser surface, then save the useful pieces as reusable components. Built-ins are just the starter grammar; your agent grows the UI vocabulary while the app is running.
voice prompt
-> builder model
-> compact lightcode
-> runtime.validate()
-> browser surface updatesCopy the generated instructions into your local agent, then watch it stream lightcode into the blank target below without a rebuild loop.
Most AI UI demos stop at code generation: the model writes React, a build runs, and the result ships later. LensUI is designed for living surfaces: agents render now, patch what is already on screen, save components that work, and reuse them by name later.
HTML and React make an agent describe implementation details. Lightcode lets it send compact UI intent to a live renderer that already knows how to lay out, patch, persist, and update the surface.
function MarketPulse({ data }) {
return (
<section className="stage rounded-xl border border-white/15 bg-black p-6 text-white">
<header className="mb-5">
<h1 className="text-4xl font-semibold tracking-tight">Market Pulse</h1>
<p className="text-sm uppercase text-white/55">Live source</p>
</header>
<div className="grid grid-cols-3 gap-3">
<Metric label="BTC" value={data.btc} detail="usd" />
<Metric label="ETH" value={data.eth} detail="usd" />
<LineChart data={data.trend} x="t" y="v" />
</div>
</section>
);
}<section class="stage">
<header>
<h1>Market Pulse</h1>
<p>Live source</p>
</header>
<div class="grid grid-cols-3 gap-3">
<article class="metric"><span>BTC</span><strong data-bind="markets.btc"></strong><em>usd</em></article>
<article class="metric"><span>ETH</span><strong data-bind="markets.eth"></strong><em>usd</em></article>
<canvas data-chart="line" data-source="markets.trend"></canvas>
</div>
</section>0DS|markets|https://api.coingecko.com/api/v3/simple/price?ids=bitcoin,ethereum&vs_currencies=usd|ttl=30|mode=poll
0F|st=mono
0V|Market Pulse|Live source
1G|auto|min=180|max=3
2M|BTC|$markets.bitcoin.usd|usd
2M|ETH|$markets.ethereum.usd|usd
1H|line|4,7,6,10,9,13,16|x=t|y=v54% saved vs React, 38% saved vs HTML.
Yes. That is a real concern. LensUI is intentionally powerful: raw HTML, CSS, and JavaScript components are enabled by default because the goal is maximum expressive range for agents. Treat those components like untrusted plugin code until your host decides otherwise.
The package includes the browser runtime, CLI bridge, MCP server pieces, and the reusable LensUI agent skill.
npm install @ardabot/lensui
npx lensui skill
npx lensui bridge --port 5743import { createPersistentStageRuntime } from "@ardabot/lensui/html";
const stage = createPersistentStageRuntime(document.querySelector("#lens-stage"));
stage.render(`0F|st=studio
0V|Market Pulse|Live source
1G|auto|min=180|max=3
2M|BTC|$markets.btc|usd
2H|line|$markets.trend|trend`);
stage.setSource("markets", nextSnapshot);