Overview
A browser workspace where someone describes an app, an agent edits the project files, and the result can be previewed and exported: with accounts, invites, credits, and payments around it.
The hard part
Streaming an agent that edits files without letting it mutate a project before a human approves a plan, metering token and cost spend into integer credits, and keeping one codebase correct over both PostgreSQL and SQLite.
The approach
Each chat turn rebuilds the agent from a Drizzle transcript and streams events over SSE; file writes buffer during the run, stay blocked until the plan is approved, and flush as one history entry; a pluggable meter settles credits from an additive usage ledger, and the preview runs in WebContainer behind the required COOP/COEP headers.



