Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(show): standardize generated theme guidance (#1119)
Call White029b10492319
diff --git a/core/show_pages.py b/core/show_pages.pyindex 87bcf3736..42b7771c2 100644--- a/core/show_pages.py+++ b/core/show_pages.py@@ -1145,7 +1145,9 @@ def show_page_runtime_recovery_html(session_id: str) -> str:"Please repair this avibe Show Page. Open the Show Page workspace for session "f"{session_id}, read the local Show Page/runtime instructions, then replace src/App.tsx ""with a polished React page. Use the shadcn-style components from @/components/ui and "- "@avibe/show-ui. Do not edit index.html unless it is required. If the browser shows "+ "Tailwind CSS v4. Keep the existing CSS imports and customize standard shadcn variables "+ "such as --background, --foreground, --primary, --border, and --radius. Do not edit "+ "index.html unless it is required. If the browser shows ""Ready to visualize, check src/App.tsx, src/main.tsx, src/styles.css, and the Vite/browser ""console for compile or runtime errors. Make the page responsive and verify it renders.\n\n""Show Page history contract:\n"@@ -1433,21 +1435,17 @@ createRoot(document.getElementById("root")!).render(def _default_app_tsx() -> str:- # Default app shell for a fresh Show Page (agent-editable). It wraps the routed- # page in the theme provider and a simple centered container. This file, the- # pages under src/pages/, and src/router.tsx are a starting point — restyle,- # add pages, or replace them. The runtime-owned app shell (index.html +- # src/main.tsx) is never edited to add a page.- return """import { ThemeProvider } from "@avibe/show-ui/theme"-import { RouterView } from "./router"+ # Default app shell for a fresh Show Page (agent-editable). Standard shadcn+ # variables from styles.css are the theme authority, so no provider shadows+ # an agent's CSS overrides. This file, the pages under src/pages/, and+ # src/router.tsx are a starting point — restyle, add pages, or replace them.+ return """import { RouterView } from "./router"export default function App() {return (- <ThemeProvider preset="zinc">- <main className="mx-auto min-h-screen max-w-3xl px-4 py-8">- <RouterView />- </main>- </ThemeProvider>+ <main className="mx-auto min-h-screen max-w-3xl bg-background px-4 py-8 text-foreground">+ <RouterView />+ </main>)}"""@@ -1778,17 +1776,15 @@ def _default_styles_css() -> str:return """@import "tailwindcss";@import "@avibe/show-ui/theme.css";-:root {- color-scheme: light;-}-/** The default multi-page demo styles itself with Tailwind utility classes and the- * @avibe/show-ui shadcn components, so this entry only needs the two imports above+ * built-in shadcn components, so this entry only needs the two imports above* (keep them first) plus a small base. Add global CSS here as the app grows.*/body {margin: 0;+ background: var(--background);+ color: var(--foreground);font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;}"""diff --git a/core/system_prompt_injection.py b/core/system_prompt_injection.pyindex 836b2e063..d539eb8e5 100644--- a/core/system_prompt_injection.py+++ b/core/system_prompt_injection.py@@ -103,8 +103,8 @@ Guidance:- An older Show Page with no `src/router.tsx` is a single-page app that renders `src/App.tsx` directly. There, edit `src/App.tsx` (or adopt the router scaffold: add `src/router.tsx` + `src/pages/` and render it from `App.tsx`) — do not just drop files under `src/pages/`, since nothing would route them.- Treat `index.html` and `src/main.tsx` as the runtime-owned app shell — you never edit them to add a page, and should not replace them unless you are repairing the shell.- Hot reload is available while `/show/<session-id>/` is open. Users will see page changes live. Prefer component-level changes that preserve React state.-- Built-in UI imports include shadcn-style aliases such as `@/components/ui/button`, `@/components/ui/card`, `@/components/ui/badge`, `@/components/ui/dialog`, `@/components/ui/input`, `@/components/ui/progress`, plus `@avibe/show-ui/theme` for theme presets and CSS variables.-- Tailwind CSS v4 utility classes are built in and work in any `className`, including to restyle the built-in `@/components/ui/*` components (a utility overrides the component default). `src/styles.css` is the CSS entry and must keep `@import "tailwindcss";` and `@import "@avibe/show-ui/theme.css";` at the top; theme through the `@avibe/show-ui/theme` CSS variables.+- Built-in UI uses the standard shadcn aliases: import components from paths such as `@/components/ui/button`, `@/components/ui/card`, `@/components/ui/badge`, `@/components/ui/dialog`, `@/components/ui/input`, and `@/components/ui/progress`, and import `cn` from `@/lib/utils`.+- Tailwind CSS v4 utility classes are built in and work in any `className`, including to restyle the built-in `@/components/ui/*` components (a utility overrides the component default). `src/styles.css` is the CSS entry and must keep `@import "tailwindcss";` and `@import "@avibe/show-ui/theme.css";` at the top. Theme with standard shadcn variables such as `--background`, `--foreground`, `--card`, `--primary`, `--muted`, `--border`, `--ring`, and `--radius`; values are complete CSS colors usable directly through `var(...)`. Override the same variables under `.dark` or `[data-theme="dark"]` for dark mode. Do not use runtime-prefixed private variables.- Prefer the built-in UI primitives over hand-rolled controls. They include Show Page motion for changed text, numbers, badges, cards, and progress without extra animation calls.- Optional server handlers live under `api/` and run only when requested. Export functions named like HTTP methods, for example `export async function GET(request) { return Response.json({ ok: true }) }`.- Design for user understanding, not just for moving text onto a webpage. Choose the visual form that best helps the user inspect, compare, confirm, and continue the discussion.diff --git a/docs/plans/show-page-multipage-scaffold.md b/docs/plans/show-page-multipage-scaffold.mdindex 96a568ebc..11004a73c 100644--- a/docs/plans/show-page-multipage-scaffold.md+++ b/docs/plans/show-page-multipage-scaffold.md@@ -85,13 +85,14 @@ Runtime-owned shell (unchanged, skip-if-exists): `index.html`, `src/main.tsx`,Fresh-workspace multi-page demo (written only when `src/App.tsx` does not yet exist, soexisting single-page workspaces stay byte-identical):-- `src/App.tsx` — router host: `ThemeProvider` + `Layout` (nav) + `<RouterView/>`.+- `src/App.tsx` — router host using standard semantic theme utilities + `<RouterView/>`.- `src/router.tsx` — dependency-free hash-router engine + file-based discovery.- `src/pages/index.tsx` — Home (overview + how to add a page).- `src/pages/items/index.tsx` — a list page linking into the nested route.- `src/pages/items/[id].tsx` — nested dynamic route; deep-linkable/refreshable.- `src/styles.css` — minimal: keeps `@import "tailwindcss";` + `@import- "@avibe/show-ui/theme.css";`, plus a small base; demo styling uses Tailwind + show-ui.+ "@avibe/show-ui/theme.css";`, plus a small base; standard shadcn variables are+ the theme authority and the demo styling uses Tailwind + show-ui.## Compatibilitydiff --git a/docs/plans/show-service-runtime.md b/docs/plans/show-service-runtime.mdindex efd104558..966072877 100644--- a/docs/plans/show-service-runtime.md+++ b/docs/plans/show-service-runtime.md@@ -166,8 +166,12 @@ import { cn } from "@/lib/utils"Those paths resolve to `@avibe/show-ui/*` inside the shared dependency store.-Theme customization is token-based through `@avibe/show-ui/theme`, so agents-can use presets or override CSS variables without editing component source.+Theme customization uses the standard shadcn token contract (`--background`,+`--foreground`, `--card`, `--primary`, `--muted`, `--border`, `--ring`,+`--radius`, and peers). Complete CSS color values drive both semantic Tailwind+classes and native `var(...)` references. Dark mode overrides the same tokens+under `.dark` or `[data-theme="dark"]`; the optional provider is available at+the familiar `@/components/ui/theme` alias for runtime-computed subtree values.## Shared Dependenciesdiff --git a/tests/test_reply_enhancer_platform.py b/tests/test_reply_enhancer_platform.pyindex 21614d8e4..4e49d2318 100644--- a/tests/test_reply_enhancer_platform.py+++ b/tests/test_reply_enhancer_platform.py@@ -1298,6 +1298,11 @@ class ReplyEnhancerPlatformTests(unittest.IsolatedAsyncioTestCase):self.assertIn("Tailwind CSS v4 utility classes are built in", prompt)self.assertIn("restyle the built-in `@/components/ui/*` components", prompt)self.assertIn('must keep `@import "tailwindcss";` and `@import "@avibe/show-ui/theme.css";` at the top', prompt)+ self.assertIn("Theme with standard shadcn variables", prompt)+ self.assertIn("values are complete CSS colors usable directly through `var(...)`", prompt)+ self.assertIn('under `.dark` or `[data-theme="dark"]` for dark mode', prompt)+ self.assertIn("import `cn` from `@/lib/utils`", prompt)+ self.assertNotIn("theme through the `@avibe/show-ui/theme` CSS variables", prompt)self.assertNotIn("Ready to visualize", prompt)self.assertIn("@/components/ui/progress", prompt)self.assertNotIn("Excalidraw-style static SVG/PNG diagrams", prompt)diff --git a/tests/test_show_pages.py b/tests/test_show_pages.pyindex 855ea2d38..59855dfdf 100644--- a/tests/test_show_pages.py+++ b/tests/test_show_pages.py@@ -1659,6 +1659,9 @@ def test_fresh_workspace_scaffolds_placeholder_and_minimal_router(monkeypatch, t# App is a minimal shell that renders the router — no hardcoded nav/route table.app_tsx = (page_dir / "src" / "App.tsx").read_text(encoding="utf-8")assert "<RouterView" in app_tsx+ assert "bg-background" in app_tsx+ assert "text-foreground" in app_tsx+ assert "ThemeProvider" not in app_tsxassert "navItems" not in app_tsxassert "activeLocale" not in app_tsx@@ -1673,6 +1676,9 @@ def test_fresh_workspace_scaffolds_placeholder_and_minimal_router(monkeypatch, tstyles = (page_dir / "src" / "styles.css").read_text(encoding="utf-8")assert styles.splitlines()[0].strip() == '@import "tailwindcss";'assert '@import "@avibe/show-ui/theme.css";' in styles+ assert "background: var(--background)" in styles+ assert "color: var(--foreground)" in styles+ assert "--avs-" not in stylesdef test_existing_single_page_workspace_is_preserved(monkeypatch, tmp_path):diff --git a/tests/test_ui_show_pages.py b/tests/test_ui_show_pages.pyindex 01810de70..a89c5d9ef 100644--- a/tests/test_ui_show_pages.py+++ b/tests/test_ui_show_pages.py@@ -478,6 +478,9 @@ def test_show_page_history_route_uses_recovery_when_runtime_unavailable(monkeypaassert response.status_code == 200assert b"Loading Show Page" in response.contentassert b"Ready to visualize" in response.content+ assert b"standard shadcn variables" in response.content+ assert b"--background" in response.content+ assert b"components from @/components/ui and @avibe/show-ui" not in response.contentassert [call[1] for call in manager.calls] == ["/sessions/ses123/app/reports/daily"]@@ -980,6 +983,8 @@ def test_private_show_page_materializes_workspace_before_runtime_proxy(monkeypatstyles_css = (page_dir / "src" / "styles.css").read_text(encoding="utf-8")assert styles_css.startswith('@import "tailwindcss";'), styles_css[:60]assert '@import "@avibe/show-ui/theme.css";' in styles_css, styles_css[:90]+ assert "background: var(--background)" in styles_css+ assert "--avs-" not in styles_cssassert manager.calls[0][1] == "/sessions/ses123/app/"