From 89f18c27effe2df3faaf479bd2858f5848374d12 Mon Sep 17 00:00:00 2001 From: leora Date: Thu, 8 Oct 2026 19:49:25 +0800 Subject: [PATCH] README: React frontend structure, build/deploy, adding a component; theme_check fail-closed customCss check --- README.md | 77 ++++++++++++++++++++++++++++++++++++++++---- tests/theme_check.js | 2 +- 2 files changed, 72 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index f386a0a..270a3b3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ sell products or services. ## How it works ``` -browser (static HTML/JS) ──/api/chat──▶ tiny server ──▶ hosted LLM (OpenAI-compatible) +browser (React SPA) ─────/api/chat──▶ tiny server ──▶ hosted LLM (OpenAI-compatible) ▲ renders UI actions │ or the rule-based fallback agent │ ├── /api/payments/* ── mock test-mode provider ── signed webhook └── card form posts straight ────────┘ @@ -38,7 +38,7 @@ The server stays small on purpose. It does three things: ### Look and layout (agent-controlled, per visitor) The agent can restyle the whole page from chat with one action, `set_theme`. Its payload is a JSON theme spec: design tokens applied as CSS variables. The model never sends raw HTML or JS. The server checks every value -(`market/theme.py`), and the browser applies the result (`static/theme.js`). +(`market/theme.py`), and the browser applies the result (`web/src/theme/engine.ts`). | Area | Spec keys | |---|---| @@ -115,12 +115,76 @@ The landing view doesn't call the model either. Set `AGENT_MARKET_LLM_EVENTS=1` With no LLM configured, the demo runs the **rule-based fallback agent**. The page labels this. +## Frontend (React + Vite + TypeScript) + +The page is a React single-page app in `web/`. The Python server and API are unchanged, except that `/` now serves +the built `static/dist/index.html` and `/static/dist/assets/*` serves the hashed JS/CSS bundles. + +``` +web/ + index.html # declares `@layer base, user, protected;` first, then