""" ╔══════════════════════════════════════════════════════════╗ ║ OMNI-VIBE CORE — Specialized Swarm Architecture ║ ║ ║ ║ The Athanor: LiteRT engine, sub-second latency ║ ║ ║ ║ POSE ARCHITECT: full-stack schema + zero-config DB ║ ║ + Google OAuth out-of-the-box ║ ║ POSE PAINTER: Liquid Glass design system enforced ║ ║ across every generated app ║ ║ POSE AUDITOR: step-by-step reasoning, verify code ║ ║ before every hot-reload ║ ║ ║ ║ All Poses run locally — zero external API calls. ║ ║ Sub-second Reflect-Select loop with regex engine. ║ ╚══════════════════════════════════════════════════════════╝ """ import asyncio, json, os, re, time, uuid, textwrap, hashlib from pathlib import Path from typing import Dict, List, Optional, Tuple from dataclasses import dataclass, field # ═══════════════════════════════════════════════════════ # POSES — The Specialized Swarm # ═══════════════════════════════════════════════════════ @dataclass class AuditFinding: line: int severity: str # ERROR | WARN | INFO message: str fix: Optional[str] = None # ─── LIQUID GLASS DESIGN SYSTEM ──────────────────────── # Canonical CSS variables injected into every output LIQUID_GLASS_CSS = """ :root { --glass-bg: rgba(255,255,255,.03); --glass-border: rgba(255,255,255,.06); --glass-hover: rgba(255,255,255,.08); --purple: #8B5CF6; --cyan: #06B6D4; --green: #10B981; --gold: #F59E0B; --text: #e0e0ff; --text2: #9090b0; --text3: #606080; --bg1: #0a0a1a; --bg2: #1a0a2e; --radius: 20px; --radius-sm: 12px; --font: -apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif; --mono: 'SF Mono','Fira Code',monospace; } *,*::before,*::after{box-sizing:border-box;margin:0;padding:0} body{font-family:var(--font);background:linear-gradient(135deg,var(--bg1),var(--bg2),#0a1a2e);color:var(--text);min-height:100vh;-webkit-font-smoothing:antialiased} ::selection{background:rgba(139,92,246,.5);color:#fff} .glass{background:var(--glass-bg);backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px);border:1px solid var(--glass-border);border-radius:var(--radius)} .glass-hover:hover{background:var(--glass-hover);border-color:rgba(139,92,246,.2)} .btn{display:inline-flex;align-items:center;gap:.5rem;padding:.75rem 1.75rem;background:linear-gradient(135deg,var(--purple),var(--cyan));border:none;border-radius:var(--radius-sm);color:#fff;font-weight:600;cursor:pointer;transition:transform .15s,box-shadow .15s} .btn:hover{transform:translateY(-1px);box-shadow:0 4px 20px rgba(139,92,246,.4)} .btn-outline{background:var(--glass-bg);border:1px solid var(--glass-border);color:var(--text2)} .input-glass{width:100%;padding:.75rem 1rem;background:var(--glass-bg);border:1px solid var(--glass-border);border-radius:var(--radius-sm);color:var(--text);font-size:.95rem;outline:none;transition:border-color .15s,box-shadow .15s} .input-glass:focus{border-color:rgba(139,92,246,.4);box-shadow:0 0 20px rgba(139,92,246,.1)} .card{background:var(--glass-bg);backdrop-filter:blur(20px);border:1px solid var(--glass-border);border-radius:var(--radius);padding:1.5rem} .gradient-text{background:linear-gradient(135deg,var(--purple),var(--cyan),var(--green));-webkit-background-clip:text;-webkit-text-fill-color:transparent} """ LIQUID_GLASS_LOGO = """ """ # ─── ZERO-CONFIG DATABASE SCHEMA ─────────────────────── ZERO_DB_SCHEMA = """ -- Omni-Vibe Zero-Config Database -- Uses SQLite (built-in, zero setup) with WAL mode CREATE TABLE IF NOT EXISTS users ( id TEXT PRIMARY KEY, email TEXT UNIQUE NOT NULL, name TEXT, avatar_url TEXT, google_id TEXT UNIQUE, created_at TEXT DEFAULT (datetime('now')), updated_at TEXT DEFAULT (datetime('now')) ); CREATE TABLE IF NOT EXISTS sessions ( id TEXT PRIMARY KEY, user_id TEXT NOT NULL REFERENCES users(id), token TEXT UNIQUE NOT NULL, expires_at TEXT NOT NULL, created_at TEXT DEFAULT (datetime('now')) ); CREATE TABLE IF NOT EXISTS items ( id TEXT PRIMARY KEY, user_id TEXT NOT NULL REFERENCES users(id), title TEXT NOT NULL, content TEXT, status TEXT DEFAULT 'active', created_at TEXT DEFAULT (datetime('now')), updated_at TEXT DEFAULT (datetime('now')) ); CREATE INDEX IF NOT EXISTS idx_items_user ON items(user_id); CREATE INDEX IF NOT EXISTS idx_sessions_token ON sessions(token); """ # ─── GOOGLE OAUTH SERVER-SIDE ────────────────────────── GOOGLE_OAUTH_PY = """ import os, json, httpx from urllib.parse import urlencode GOOGLE_CLIENT_ID = os.environ.get("GOOGLE_CLIENT_ID", "") GOOGLE_CLIENT_SECRET = os.environ.get("GOOGLE_CLIENT_SECRET", "") GOOGLE_REDIRECT = os.environ.get("GOOGLE_REDIRECT_URI", "http://localhost:8080/auth/callback") def get_auth_url(state: str = "") -> str: params = { "client_id": GOOGLE_CLIENT_ID, "redirect_uri": GOOGLE_REDIRECT, "response_type": "code", "scope": "openid email profile", "state": state, } return f"https://accounts.google.com/o/oauth2/v2/auth?{urlencode(params)}" async def exchange_code(code: str) -> dict: async with httpx.AsyncClient() as c: resp = await c.post("https://oauth2.googleapis.com/token", data={ "code": code, "client_id": GOOGLE_CLIENT_ID, "client_secret": GOOGLE_CLIENT_SECRET, "redirect_uri": GOOGLE_REDIRECT, "grant_type": "authorization_code", }) tokens = resp.json() user = await c.get("https://www.googleapis.com/oauth2/v2/userinfo", headers={"Authorization": f"Bearer {tokens['access_token']}"}) return {**tokens, "user": user.json()} """ GOOGLE_OAUTH_JS = """ // Google OAuth client-side — Liquid Glass styled async function initGoogleAuth() { const btn = document.getElementById('google-auth-btn'); if (!btn) return; btn.addEventListener('click', () => { const state = crypto.randomUUID(); localStorage.setItem('oauth_state', state); window.location.href = `/auth/google?state=${state}`; }); // Check for callback const params = new URLSearchParams(window.location.search); if (params.get('code')) { const resp = await fetch('/auth/callback?' + params.toString()); const data = await resp.json(); if (data.user) { localStorage.setItem('user', JSON.stringify(data.user)); window.location.href = '/'; } } } document.addEventListener('DOMContentLoaded', initGoogleAuth); """ # ═══════════════════════════════════════════════════════ # POSE ARCHITECT — Full-Stack Schema Generator # ═══════════════════════════════════════════════════════ class PoseArchitect: """ Generates full-stack application architectures. Every output includes: zero-config SQLite DB + Google OAuth. """ STACKS = { "html": {"backend": None, "frontend": "Vanilla HTML/CSS/JS + Liquid Glass"}, "flask": {"backend": "Flask+SQLite","frontend": "Jinja2 + Liquid Glass"}, "fastapi": {"backend": "FastAPI+SQLite","frontend": "HTMX + Liquid Glass"}, "node": {"backend": "Express+better-sqlite3","frontend": "Vanilla + Liquid Glass"}, } def design(self, prompt: str) -> Dict: """Analyze prompt and design the full-stack schema.""" p = prompt.lower() # Detect stack stack = "html" if any(w in p for w in ["api","backend","server","flask","fastapi"]): stack = "fastapi" if "fastapi" in p else "flask" elif any(w in p for w in ["node","express","javascript backend"]): stack = "node" elif any(w in p for w in ["app","saas","platform","dashboard","database"]): stack = "fastapi" # Detect features features = [] if any(w in p for w in ["auth","login","signup","oauth","google"]): features.append("google-oauth") if any(w in p for w in ["database","db","storage","data","crud"]): features.append("zero-db") if any(w in p for w in ["dashboard","admin","panel"]): features.append("dashboard") if any(w in p for w in ["landing","page","homepage","marketing"]): features.append("landing-page") if any(w in p for w in ["dark","theme","purple","glass","gradient"]): features.append("liquid-glass-theme") schema = { "stack": self.STACKS[stack], "features": features, "has_db": "zero-db" in features, "has_auth": "google-oauth" in features, "has_dashboard": "dashboard" in features, "files_needed": self._compute_files(stack, features), "landing_title": self._extract_title(prompt), } return schema def _compute_files(self, stack: str, features: List[str]) -> List[str]: files = ["index.html"] if "google-oauth" in features: files.extend(["auth.py", "static/auth.js"]) if "zero-db" in features: files.append("database.py") if stack in ("flask", "fastapi"): files.extend(["app.py", "requirements.txt"]) if stack == "fastapi": files.append("Dockerfile") if "dashboard" in features: files.append("templates/dashboard.html") return files def _extract_title(self, prompt: str) -> str: """Extract a meaningful title from the prompt.""" for phrase in ["called ", "named ", "titled "]: if phrase in prompt.lower(): idx = prompt.lower().find(phrase) + len(phrase) end = min(prompt.find(" ", idx + 1) if " " in prompt[idx:] else len(prompt), idx + 30) name = prompt[idx:end].strip().rstrip(".,;!?") if name: return name for w in ["startup", "saas", "app", "platform", "labs", "studio"]: if w in prompt.lower(): return f"{w.title()} — Omni-Vibe" return "Omni-Vibe App" def generate_backend(self, schema: Dict) -> str: """Generate zero-config backend code.""" if not schema["has_db"] and not schema["has_auth"]: return "" code = [] if schema["stack"]["backend"] and "Flask" in schema["stack"]["backend"]: code.append("from flask import Flask, request, jsonify, redirect, session\n") code.append("import sqlite3, os, uuid, hashlib\n\n") code.append("app = Flask(__name__)\napp.secret_key = os.environ.get('SECRET_KEY', 'omni-vibe-dev')\n\n") code.append("# ─── Zero-Config Database ───\n") code.append("DB = os.environ.get('DATABASE_URL', 'app.db')\n\n") code.append("def get_db():\n conn = sqlite3.connect(DB)\n conn.row_factory = sqlite3.Row\n conn.execute('PRAGMA journal_mode=WAL')\n return conn\n\n") code.append("# ─── Init Schema ───\n") code.append("def init_db():\n with get_db() as db:\n") for line in ZERO_DB_SCHEMA.strip().split("\n"): if line.strip() and not line.startswith("--"): code.append(f" db.execute('''{line.strip()}''')\n") code.append(" print('✅ Omni-Vibe DB initialized')\n\ninit_db()\n\n") if schema["has_auth"]: code.append("# ─── Google OAuth ───\n") code.append(GOOGLE_OAUTH_PY.strip() + "\n\n") elif schema["stack"]["backend"] and "FastAPI" in schema["stack"]["backend"]: code.append("from fastapi import FastAPI, Request, HTTPException\n") code.append("from fastapi.responses import JSONResponse, RedirectResponse\n") code.append("import sqlite3, os, uuid\n\n") code.append("app = FastAPI(title='Omni-Vibe')\n\n") return "".join(code) # ═══════════════════════════════════════════════════════ # POSE PAINTER — Liquid Glass Design Enforcer # ═══════════════════════════════════════════════════════ class PosePainter: """ Enforces the Liquid Glass design system on every generated app. Injects canonical CSS, logo SVG, and ensures consistent theming. """ LG_COMPONENTS = { "navbar": """ """, "hero": """

{TITLE}

{SUBTITLE}

""", "features": """
{FEATURE_CARDS}
""", "feature_card": """
{ICON}

{TITLE}

{DESCRIPTION}

""", "footer": """ """, } def paint(self, code: str, schema: Dict) -> str: """Inject Liquid Glass design system into generated code.""" title = schema.get("landing_title", "Omni-Vibe App") # 1. Inject canonical CSS if not present if "liquid-glass" not in code.lower() and "--glass-bg" not in code: code = code.replace("", f"\n") # 2. Replace with actual SVG code = code.replace("", LIQUID_GLASS_LOGO) # 3. Inject navbar if missing if "", f"\n{navbar}") # 4. Ensure gradient-text class exists if "gradient-text" not in code and ".gradient-text" not in code: if "" in code: code = code.replace("", ".gradient-text{background:linear-gradient(135deg,var(--purple),var(--cyan),var(--green));-webkit-background-clip:text;-webkit-text-fill-color:transparent}\n") # 5. Inject Google OAuth JS if auth is needed if schema.get("has_auth") and "google-auth" not in code: code = code.replace("", f"\n") return code # ═══════════════════════════════════════════════════════ # POSE AUDITOR — Step-by-Step Code Verification # ═══════════════════════════════════════════════════════ class PoseAuditor: """ Step-by-step reasoning: verifies code correctness before hot-reload. Returns structured findings with severity and suggested fixes. """ VOID = {'br','hr','img','input','meta','link','area','base','col','embed','source','track','wbr'} SVG_VOID = VOID | {'lineargradient','defs','stop','animate','animatetransform','fegaussianblur','femerge','femergenode','ellipse','path','circle','rect','polygon','polyline','g','use','svg'} def audit(self, code: str, schema: Dict = None) -> List[AuditFinding]: """Full audit: HTML validity, JS correctness, accessibility, security, simplicity.""" findings = [] # STEP 1: HTML validity findings.extend(self._audit_html(code)) # STEP 2: JS correctness findings.extend(self._audit_js(code)) # STEP 3: Liquid Glass compliance if schema and schema.get("features"): findings.extend(self._audit_liquid_glass(code)) # STEP 4: STABLE VIBE — simplicity verification (Painter must strip SaaS) findings.extend(self._audit_simplicity(code, schema)) # STEP 5: Security & best practices findings.extend(self._audit_security(code, schema)) return findings def _audit_html(self, code: str) -> List[AuditFinding]: findings = [] stack = [] for m in re.finditer(r'<(?P/)?(?P\w+)(?:\s[^>]*?)?(?P/)?>', code, re.IGNORECASE): t = m.group('tag').lower() if t in self.SVG_VOID: continue if m.group('self'): continue if m.group('closing'): if stack and stack[-1] == t: stack.pop() else: findings.append(AuditFinding( line=code[:m.start()].count('\n')+1, severity="ERROR", message=f"Unmatched closing tag ", fix=f"Remove or match with opening <{t}>")) else: stack.append(t) for t in stack: findings.append(AuditFinding( line=1, severity="ERROR", message=f"Unclosed tag <{t}>", fix=f"Add before parent closes")) # Check DOCTYPE if ' List[AuditFinding]: findings = [] scripts = re.findall(r']*>(.*?)', code, re.DOTALL | re.IGNORECASE) for i, script in enumerate(scripts): lines = script.split('\n') for ln, line in enumerate(lines, 1): # Common typos typos = { "console.loge(": "console.log(", "docment.": "document.", "getElementbyId": "getElementById", "innerHtml": "innerHTML", "functon ": "function ", "retrun": "return", "alet(": "alert(", "consts ": "const ", } for typo, fix in typos.items(): if typo in line: findings.append(AuditFinding( line=ln, severity="ERROR", message=f"Typo: {typo.strip('(')} → {fix.strip('(')}", fix=f"Replace '{typo}' with '{fix}'")) return findings def _audit_liquid_glass(self, code: str) -> List[AuditFinding]: findings = [] if "--glass-bg" not in code and "var(--glass" not in code: findings.append(AuditFinding(line=1, severity="WARN", message="Liquid Glass CSS variables not detected", fix="Inject Liquid Glass design system CSS")) return findings def _audit_security(self, code: str, schema: Dict) -> List[AuditFinding]: findings = [] # Check for innerHTML usage (XSS risk) if re.search(r'\.innerHTML\s*=', code) and "sanitize" not in code.lower(): findings.append(AuditFinding(line=1, severity="WARN", message="innerHTML assignment detected without sanitization — XSS risk", fix="Use textContent or DOMPurify.sanitize()")) return findings def _audit_simplicity(self, code: str, schema: Dict) -> List[AuditFinding]: """ STABLE VIBE: Verify Painter produced a single, elegant Liquid Glass landing page — no SaaS complexity, no broken asset paths. """ findings = [] # 1. No dashboard/multi-page routing — must be single-page saas_routes = ['/dashboard', '/admin', '/settings', '/login', '/register', '/signup', '/api/', '/app/', '/profile', '/billing', '/tasks', '/items'] for route in saas_routes: if route in code and f'href="{route}"' in code: findings.append(AuditFinding(line=1, severity="ERROR", message=f"SaaS route detected: {route} — STABLE VIBE requires single landing page", fix=f"Remove navigation link to {route}")) # 2. No database initialization scripts in the HTML db_patterns = ['CREATE TABLE', 'INSERT INTO', 'sqlite3', 'better-sqlite3', 'mongoose', 'prisma', 'supabase', 'firebase', 'mongodb'] for pat in db_patterns: if pat.lower() in code.lower(): findings.append(AuditFinding(line=1, severity="ERROR", message=f"Database reference '{pat}' found in HTML — strip backend complexity", fix="Remove database initialization from frontend code")) # 3. No external asset paths — must use relative paths or inline everything external_assets = re.findall(r'(?:src|href)=["\'](https?://[^"\']+)["\']', code) # Allow: HF Spaces URLs, Google Fonts, Google OAuth endpoints allowed_prefixes = ('https://huggingface.co', 'https://accounts.google.com', 'https://oauth2.googleapis.com', 'https://fonts.googleapis.com', 'https://cdnjs.cloudflare.com', 'https://fonts.gstatic.com') for asset in external_assets: if not any(asset.startswith(p) for p in allowed_prefixes): findings.append(AuditFinding(line=1, severity="WARN", message=f"External asset: {asset[:80]} — prefer inline or relative paths", fix="Inline the resource or use a relative path")) # 4. Must have exactly one document (no iframes with separate apps) html_count = len(re.findall(r' 1: findings.append(AuditFinding(line=1, severity="ERROR", message=f"Multiple documents ({html_count}) — must be single page", fix="Merge into one HTML document")) # 5. Must have Liquid Glass CSS variables if "--glass-bg" not in code and "var(--glass" not in code: findings.append(AuditFinding(line=1, severity="ERROR", message="Liquid Glass CSS variables missing — Painter must enforce", fix="Inject the Liquid Glass design system CSS")) # 6. Must have wizard-hat SVG (brand identity) if 'wizard-hat' not in code.lower() and 'wizard_hat' not in code.lower(): findings.append(AuditFinding(line=1, severity="WARN", message="Wizard hat SVG missing — brand element required", fix="Add the wizard hat SVG logo")) return findings def heal_findings(self, code: str, findings: List[AuditFinding]) -> Tuple[str, int]: """Apply all ERROR-level fixes.""" fixed = code count = 0 for f in findings: if f.severity == "ERROR" and f.fix: # Apply typo fixes for typo, fix in [ ("console.loge(", "console.log("), ("docment.", "document."), ("getElementbyId", "getElementById"), ("innerHtml", "innerHTML"), ("functon ", "function "), ("retrun", "return"), ("alet(", "alert("), ]: if typo in fixed: fixed = fixed.replace(typo, fix) count += 1 return fixed, count # ═══════════════════════════════════════════════════════ # OMNI-VIBE ENGINE — Swarm Orchestrator # ═══════════════════════════════════════════════════════ class OmniVibeEngine: """The Athanor: all three Poses running as a synchronized swarm.""" def __init__(self): self.architect = PoseArchitect() self.painter = PosePainter() self.auditor = PoseAuditor() def pose(self, prompt: str) -> Dict: """All three Poses analyze the prompt in parallel.""" return { "architect": self.architect.design(prompt), "painter": {"design_system": "Liquid Glass", "components": sorted(self.painter.LG_COMPONENTS.keys())}, "auditor": {"strategy": "step-by-step reasoning", "checks": ["HTML validity", "JS correctness", "Liquid Glass compliance", "Simplicity (no SaaS)", "Security"]}, } def generate(self, prompt: str) -> Tuple[str, Dict]: """ Full Omni-Vibe generation: 1. Architect designs the full-stack schema 2. Painter enforces Liquid Glass design 3. Auditor verifies every line Returns (code, schema) """ schema = self.architect.design(prompt) # Determine what to generate if schema["features"] and any(f in schema["features"] for f in ["landing-page", "dashboard"]): code = self._generate_frontend(prompt, schema) elif schema["stack"]["backend"]: code = self.architect.generate_backend(schema) else: code = self._generate_frontend(prompt, schema) # Painter: enforce Liquid Glass code = self.painter.paint(code, schema) # Auditor: verify and fix findings = self.auditor.audit(code, schema) code, fixes = self.auditor.heal_findings(code, findings) return code, schema def _generate_frontend(self, prompt: str, schema: Dict) -> str: """Generate a Liquid Glass frontend.""" title = schema["landing_title"] has_auth = schema.get("has_auth", False) features_html = "" default_features = [ ("⚡", "purple", "Zero-Delay", "Real-time streaming with sub-second hot reload in sandboxed iframe."), ("🔄", "cyan", "Reflect-Select", "Autonomous code healing — errors fixed before you see them."), ("🚀", "green", "Ghost Deploy", "One-click publish to HF Spaces with instant live URL."), ] for icon, color, ftitle, desc in default_features: features_html += self.painter.LG_COMPONENTS["feature_card"].format( ICON=icon, COLOR=color, TITLE=ftitle, DESCRIPTION=desc) hero_subtitle = "Built with Omni-Vibe Studio — specialized AI swarm with zero-config database, Google OAuth, and Liquid Glass design." auth_section = "" if has_auth: auth_section = """

Get Started

Sign in with Google — no password required.

""" return f""" {title}
{LIQUID_GLASS_LOGO}

{title}

{hero_subtitle}

{features_html}
{auth_section}

Built with Omni-Vibe Studio — Liquid Glass Design System

Zero-config · Google OAuth · SQLite · Ghost Deploy · Pinggy

{f'''''' if has_auth else ''} """ # ═══════════════════════════════════════════════════════ # REFLECT-SELECT — Sub-Second Loop # ═══════════════════════════════════════════════════════ class ReflectSelect: """Sub-second Reflect-Select using compiled regex patterns.""" VOID = PoseAuditor.SVG_VOID PATTERNS = [ (re.compile(r"console\.loge\("), "console.log("), (re.compile(r"docment\."), "document."), (re.compile(r"getElementbyId"), "getElementById"), (re.compile(r"innerHtml"), "innerHTML"), (re.compile(r"functon\s"), "function "), (re.compile(r"retrun"), "return"), ] def heal(self, code: str, errors: List[str] = None) -> Tuple[str, int, int]: errors_list = self._detect(code) if errors: errors_list.extend(errors) errors_list = list(set(errors_list)) found = len(errors_list) if not found: return code, 0, 0 fixed = 0 for i in range(15): if not errors_list: break code = self._apply_fixes(code, errors_list) fixed += 1 errors_list = self._detect(code) return code, found, fixed def _detect(self, code: str) -> List[str]: e = [] # HTML if "/)?(?P\w+)(?:\s[^>]*?)?(?P/)?>', code, re.IGNORECASE): t = m.group('tag').lower() if t in self.VOID: continue if m.group('self'): continue if m.group('closing'): if stack and stack[-1]==t: stack.pop() else: e.append(f"Unmatched ") else: stack.append(t) for t in stack: e.append(f"Unclosed <{t}>") # Python elif code.startswith("import") or "def " in code: try: compile(code,'','exec') except SyntaxError as se: e.append(f"Syntax: {se}") # Generic bracket check if code.count('(')!=code.count(')'): e.append("Parenthesis mismatch") if code.count('{')!=code.count('}'): e.append("Brace mismatch") return e def _apply_fixes(self, code: str, errors: List[str]) -> str: for pat, rep in self.PATTERNS: code = pat.sub(rep, code) # Close unclosed HTML tags for tag in re.findall(r'Unclosed <(\w+)>', '\n'.join(errors)): if tag.lower() not in self.VOID: close = code.lower().rfind('') or code.lower().rfind('') if close >= 0: code = code[:close] + f'\n' + code[close:] return code def validate(self, code: str) -> Dict: e = self._detect(code) return {"success": len(e)==0, "errors": e} # ═══════════════════════════════════════════════════════ # STATE # ═══════════════════════════════════════════════════════ @dataclass class State: engine: OmniVibeEngine = field(default_factory=OmniVibeEngine) reflect: ReflectSelect = field(default_factory=ReflectSelect) sessions: Dict = field(default_factory=dict) codes: Dict = field(default_factory=dict) sandbox: Dict = field(default_factory=dict) publish_ready: Dict = field(default_factory=dict) state = State() # ═══════════════════════════════════════════════════════ # COMPATIBILITY EXPORTS # ═══════════════════════════════════════════════════════ # Expose the old API for server.py compatibility class Orchestrator: """Backward-compatible wrapper around OmniVibeEngine.""" def pose(self, prompt: str) -> Dict: plan = state.engine.pose(prompt) return { "model": "omni-vibe-swarm", "domain": plan["architect"]["stack"]["backend"] and "fullstack" or "frontend", "plan": plan, } def generate(self, prompt: str): code, schema = state.engine.generate(prompt) # Yield chunks for SSE streaming chunk_size = max(1, len(code) // 20) for i in range(0, len(code), chunk_size): yield code[i:i+chunk_size] time.sleep(0.02) state.codes["_last_schema"] = schema def sandbox_validate(code: str) -> Dict: return state.reflect.validate(code) print("🧙‍♂️ Omni-Vibe Core — Swarm Synchronized") print(" Pose Architect: full-stack + zero-DB + Google OAuth") print(" Pose Painter: Liquid Glass design system") print(" Pose Auditor: step-by-step verification") print(" Athanor ready — Steady Gold")