Agent controls the whole look: validated theme spec, presets, layout, copy, chat, scoped CSS, protected fee/banner #4
Loading…
x
Reference in New Issue
Block a user
No description provided.
Delete Branch "feat/agent-theming"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Feedback on the live demo: asked to change the background, the agent said it couldn't and showed the bike listing again. With this PR, the agent controls the whole look of the page.
What's in it
set_themeUI action, defined as a JSON theme spec of design tokens. It covers:resetcustomCssescape hatch:!important, custom properties, positioning, transforms andcontent, script, expression() and HTMLurl()to any host outside the allowlistbase < user < protected):localStorageand sent with each chat turn as compact context. The server never stores it. There's a Reset look button in the header, and "reset the look" works in chat.set_theme.free-models-per-day429, the whole chain is parked until the reset time from the header, instead of retrying every request.Tests on staging (:8795)
test_theme.py: 19/19 passed.llm_proxy_check.sh: 10/10 passed. This includes a mock model emitting a malicious set_theme, which gets cleaned, and the daily-quota path.theme_check.js, chat-driven, run against the built-in agent: 19/19 passed. It covers the nine requested commands, guardrail contrast under sunset, light+green and retro, a fresh session seeing the default look, and reset.e2e_http.py: 23/23 passed.browser_e2e.js: 11/11 passed.Still to do: the real model couldn't be exercised end to end. The free key hit OpenRouter's 50/day cap before this ran, and it resets at 00:00 UTC. The model path for
set_themeis covered by the mock-model test.