AI Engineering Workspace
PartialChat, files, terminal and preview in one place. Chat sessions run on a durable Postgres-backed queue (chat only: no tools or shell). Live models need an API key; the terminal is unavailable.
Project files
read-only- ..
- baseline-v0.1.4-access-desktop.png
- baseline-v0.1.4-access-mobile.png
- baseline-v0.1.4-dashboard-desktop.png
- baseline-v0.1.4-dashboard-mobile.png
- baseline-v0.1.4-deployments-desktop.png
- baseline-v0.1.4-deployments-mobile.png
- baseline-v0.1.4-design-studio-desktop.png
- baseline-v0.1.4-design-studio-mobile.png
- baseline-v0.1.4-domains-desktop.png
- baseline-v0.1.4-domains-mobile.png
- baseline-v0.1.4-files-desktop.png
- baseline-v0.1.4-files-mobile.png
- baseline-v0.1.4-infrastructure-desktop.png
- baseline-v0.1.4-infrastructure-mobile.png
- baseline-v0.1.4-integrations-desktop.png
- baseline-v0.1.4-integrations-mobile.png
- baseline-v0.1.4-login-desktop.png
- baseline-v0.1.4-login-mobile.png
- baseline-v0.1.4-monitoring-desktop.png
- baseline-v0.1.4-monitoring-mobile.png
- baseline-v0.1.4-progress-desktop.png
- baseline-v0.1.4-progress-mobile.png
- baseline-v0.1.4-projects-desktop.png
- baseline-v0.1.4-projects-mobile.png
- baseline-v0.1.4-settings-desktop.png
- baseline-v0.1.4-settings-mobile.png
- baseline-v0.1.4-terminal-desktop.png
- baseline-v0.1.4-terminal-mobile.png
- baseline-v0.1.4-wizard-desktop.png
- baseline-v0.1.4-wizard-mobile.png
- baseline-v0.1.4-workspace-desktop.png
- baseline-v0.1.4-workspace-mobile.png
app/src/components/shell.tsx
1"use client";2import Link from "next/link";3import { usePathname, useRouter } from "next/navigation";4import { useEffect, useMemo, useRef, useState, type ReactNode } from "react";5import { LayoutDashboard, Sparkles, WandSparkles, FolderKanban, Palette as PaletteIcon, Files, SquareTerminal, Server, Rocket, Globe, Plug, ShieldCheck, Activity, Settings, Cpu, Cloud, Users, CreditCard, Database, HardDrive, Boxes, Crown, Network,6 Image as ImageIcon, Search, Bell, Sun, Moon, PanelLeftClose, PanelLeftOpen, Menu, X, ChevronsUpDown, Command, LogOut, LogIn, Gauge, Check } from "lucide-react";78const ICONS: Record<string, any> = { LayoutDashboard, Sparkles, WandSparkles, FolderKanban, Palette: PaletteIcon, Files, SquareTerminal, Server, Rocket, Globe, Plug, ShieldCheck, Activity, Settings, Cpu, Cloud, Users, CreditCard, Database, HardDrive, Boxes, Crown, Network, Image: ImageIcon };9type Nav = { id: string; title: string; href: string; icon: string };10type Notif = { ts: string; action: string; resource: string };11type CNav = { title: string; href: string; icon: string; tag?: string };12type P = { cnav: CNav[]; platform: boolean; orgs: { id: string; name: string; role: string }[]; orgId: string; orgName: string; role: string; name: string; tagline: string; nav: Nav[]; authed: boolean; secure: boolean; signInUrl: string; projects: { id: string; name: string }[]; notifs: Notif[]; children: ReactNode };1314const GROUPS: [string, string[]][] = [["Build", ["D01", "D02", "D15", "D03", "D04", "D05", "D06", "D07"]], ["Operate", ["D08", "D09", "D10", "D11"]], ["Govern", ["D12", "D13", "D14", "D17"]]];1516export function Shell({ cnav, platform, orgs, orgId, orgName, role, name, tagline, nav, authed, secure, signInUrl, projects, notifs, children }: P) {17 const path = usePathname(); const router = useRouter();18 const [collapsed, setCollapsed] = useState(false); const [drawer, setDrawer] = useState(false);19 const [dark, setDark] = useState(false); const [palette, setPalette] = useState(false);20 const [menu, setMenu] = useState<"" | "proj" | "env" | "notif" | "user" | "ai">("");21 const [project, setProject] = useState("All projects"); const [health, setHealth] = useState<"ok" | "bad" | "…">("…");2223 useEffect(() => { setDark(document.documentElement.classList.contains("dark")); try { setCollapsed(localStorage.getItem("zcs-collapsed") === "1"); } catch {} }, []);24 useEffect(() => { setDrawer(false); setMenu(""); }, [path]);25 useEffect(() => {26 const f = () => fetch("/api/health").then(r => r.ok ? setHealth("ok") : setHealth("bad")).catch(() => setHealth("bad"));27 f(); const t = setInterval(f, 15000); return () => clearInterval(t);28 }, []);29 useEffect(() => {30 const k = (e: KeyboardEvent) => { if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "k") { e.preventDefault(); setPalette(p => !p); } if (e.key === "Escape") { setPalette(false); setMenu(""); setDrawer(false); } };31 window.addEventListener("keydown", k); return () => window.removeEventListener("keydown", k);32 }, []);3334 const toggleTheme = () => { const d = !dark; setDark(d); document.documentElement.classList.toggle("dark", d); try { localStorage.setItem("zcs-theme", d ? "dark" : "light"); } catch {} };35 const toggleCollapse = () => { const c = !collapsed; setCollapsed(c); try { localStorage.setItem("zcs-collapsed", c ? "1" : "0"); } catch {} };36 const active = (h: string) => h === "/console" ? path === "/console" : path.startsWith(h);37 const crumbs = useMemo(() => { const segs = path.split("/").filter(Boolean); return [{ label: "Home", href: "/console" }, ...segs.map((s, i) => ({ label: decodeURIComponent(s), href: "/" + segs.slice(0, i + 1).join("/") }))]; }, [path]);3839 const NavList = ({ compact }: { compact: boolean }) => <nav aria-label="Primary" className="flex flex-col gap-4 px-2 pb-4">40 {cnav.length > 0 && <div><div className={compact ? "sr-only" : "px-2 pb-1 text-[11px] font-medium uppercase tracking-wider text-muted"}>Cloud console</div>41 <ul className="flex flex-col gap-0.5">{cnav.map(n => { const I = ICONS[n.icon] ?? Cloud; const a = active(n.href);42 return <li key={n.href}><Link href={n.href} title={compact ? n.title : undefined} aria-current={a ? "page" : undefined} className={`flex h-9 items-center gap-3 rounded-lg px-2.5 text-sm ${a ? "bg-accentsoft font-medium text-accent" : "text-muted hover:bg-surface2 hover:text-fg"} ${compact ? "justify-center" : ""}`}>43 <I size={17} aria-hidden /><span className={compact ? "sr-only" : "min-w-0 flex-1 truncate"}>{n.title}</span>{!compact && n.tag && <span className="rounded-full bg-[var(--neutral-bg)] px-1.5 text-[10px] text-muted">{n.tag}</span>}</Link></li>; })}</ul></div>}44 {(platform ? GROUPS : []).map(([g, ids]) => <div key={g}>45 {!compact && <div className="px-2 pb-1 text-[11px] font-medium uppercase tracking-wider text-muted">Platform · {g}</div>}46 <ul className="flex flex-col gap-0.5">{ids.map(id => { const n = nav.find(x => x.id === id)!; const I = ICONS[n.icon]; const a = active(n.href);47 return <li key={id}><Link href={n.href} title={compact ? n.title : undefined} aria-current={a ? "page" : undefined}48 className={`flex h-9 items-center gap-3 rounded-lg px-2.5 text-sm ${a ? "bg-accentsoft font-medium text-accent" : "text-muted hover:bg-surface2 hover:text-fg"} ${compact ? "justify-center" : ""}`}>49 <I size={17} aria-hidden /><span className={compact ? "sr-only" : ""}>{n.title}</span></Link></li>; })}</ul></div>)}50 </nav>;5152 const Brand = ({ compact }: { compact?: boolean }) => <Link href="/console" className="flex h-14 items-center gap-2.5 px-4" aria-label={`${name} home`}>53 {/* eslint-disable-next-line @next/next/no-img-element */}<img src="/brand/zloud-mark.svg" alt="" width={32} height={32} className="h-8 w-8 shrink-0" />54 {!compact && <span className="min-w-0 leading-tight"><span className="block truncate text-sm font-semibold">{name}</span><span className="block truncate text-[11px] text-muted">{tagline}</span></span>}</Link>;5556 const Pop = ({ id, children: c, w = "w-72" }: { id: typeof menu; children: ReactNode; w?: string }) => menu === id ? <div className={`absolute right-0 z-40 mt-2 ${w} max-w-[calc(100vw-2rem)] rounded-xl border border-line bg-surface p-1.5 shadow-xl`}>{c}</div> : null;57 const sd = { dot: health === "ok" ? "bg-[var(--ok)]" : health === "bad" ? "bg-[var(--err)]" : "bg-[var(--warn)]", txt: health === "ok" ? "All systems operational" : health === "bad" ? "Service check failed" : "Checking…" };5859 return <div className="min-h-dvh">60 <a href="#main" className="sr-only focus:not-sr-only focus:fixed focus:left-2 focus:top-2 focus:z-50 focus:rounded focus:bg-accent focus:px-3 focus:py-2 focus:text-accentfg">Skip to content</a>61 <aside className={`fixed inset-y-0 left-0 z-30 hidden flex-col border-r border-line bg-surface lg:flex ${collapsed ? "w-16" : "w-60"}`}>62 <Brand compact={collapsed} /><div className="flex-1 overflow-y-auto pt-2"><NavList compact={collapsed} /></div>63 <div className="border-t border-line p-2"><button className="btn btn-sm w-full justify-center" onClick={toggleCollapse} aria-label={collapsed ? "Expand navigation" : "Collapse navigation"}>64 {collapsed ? <PanelLeftOpen size={16} /> : <><PanelLeftClose size={16} />Collapse</>}</button></div></aside>6566 {drawer && <div className="fixed inset-0 z-40 lg:hidden"><div className="absolute inset-0 bg-black/50" onClick={() => setDrawer(false)} />67 <aside className="absolute inset-y-0 left-0 flex w-72 max-w-[85vw] flex-col bg-surface"><div className="flex items-center justify-between pr-2"><Brand />68 <button className="btn btn-sm" onClick={() => setDrawer(false)} aria-label="Close menu"><X size={16} /></button></div><div className="flex-1 overflow-y-auto"><NavList compact={false} /></div></aside></div>}6970 <div className={collapsed ? "lg:pl-16" : "lg:pl-60"}>71 <header className="sticky top-0 z-20 border-b border-line bg-[color-mix(in_srgb,var(--surface)_92%,transparent)] backdrop-blur">72 <div className="flex h-14 items-center gap-2 px-3 sm:px-5">73 <button className="btn btn-sm lg:hidden" onClick={() => setDrawer(true)} aria-label="Open menu"><Menu size={16} /></button>74 <div className="relative hidden sm:block"><button className="btn btn-sm" onClick={() => setMenu(menu === "proj" ? "" : "proj")} aria-haspopup="menu" aria-expanded={menu === "proj"}>75 <span className="max-w-32 truncate">{project}</span><ChevronsUpDown size={14} /></button>76 {menu === "proj" && <div className="absolute left-0 z-40 mt-2 w-64 rounded-xl border border-line bg-surface p-1.5 shadow-xl" role="menu">77 {["All projects", ...projects.map(p => p.name)].map(n => <button key={n} role="menuitem" className="flex w-full items-center justify-between rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface2" onClick={() => { setProject(n); setMenu(""); const p = projects.find(x => x.name === n); router.push(p ? `/projects/${p.id}` : "/projects"); }}>78 <span className="truncate">{n}</span>{n === project && <Check size={14} />}</button>)}79 {!projects.length && <div className="px-2.5 py-2 text-xs text-muted">{authed ? "No projects yet." : "Sign in to see your projects."}</div>}</div>}</div>80 <div className="relative hidden md:block"><button className="btn btn-sm" onClick={() => setMenu(menu === "env" ? "" : "env")} aria-haspopup="menu" aria-expanded={menu === "env"}>81 <span className="h-2 w-2 rounded-full bg-[var(--warn)]" aria-hidden /><span className="max-w-36 truncate" data-testid="org-name">{orgName || "Experimental"}</span><ChevronsUpDown size={14} /></button>82 {menu === "env" && <div className="absolute left-0 z-40 mt-2 w-64 rounded-xl border border-line bg-surface p-1.5 shadow-xl" role="menu">83 <div className="px-2.5 pb-1 pt-1 text-[11px] font-medium uppercase tracking-wider text-muted">Organization · role {role || "—"}</div>84 {orgs.map(o => <button key={o.id} role="menuitem" className="flex w-full items-center justify-between rounded-lg px-2.5 py-2 text-left text-sm hover:bg-surface2" onClick={async () => { await fetch("/api/cloud/org", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ orgId: o.id }) }); location.href = "/console"; }}><span className="truncate">{o.name}<span className="block text-xs text-muted">{o.role}</span></span>{o.id === orgId && <Check size={14} />}</button>)}85 {!orgs.length && <div className="px-2.5 py-2 text-sm text-muted">Sign in to switch organizations.</div>}</div>}</div>86 <button className="btn btn-sm ml-auto min-w-0 flex-1 justify-start text-muted sm:ml-2 sm:max-w-md" onClick={() => setPalette(true)} aria-label="Search and commands">87 <Search size={15} /><span className="truncate">Search or jump to…</span><kbd className="ml-auto hidden rounded border border-line px-1.5 text-[11px] sm:inline">Ctrl K</kbd></button>88 <div className="relative"><button className="btn btn-sm" onClick={() => setMenu(menu === "ai" ? "" : "ai")} aria-label="AI assistant" aria-expanded={menu === "ai"}><Sparkles size={15} /><span className="hidden lg:inline">Assistant</span></button>89 <Pop id="ai" w="w-80"><div className="p-3"><div className="font-medium">AI assistant</div><p className="mt-1 text-sm text-muted">Not connected. An Anthropic or OpenAI API key and the sandboxed agent runtime are required (see Integrations). Nothing here is simulated as live.</p>90 <Link href="/integrations" className="btn btn-sm mt-3">Open Integrations</Link></div></Pop></div>91 <div className="relative"><button className="btn btn-sm" onClick={() => setMenu(menu === "notif" ? "" : "notif")} aria-label={`Notifications (${notifs.length})`}><Bell size={15} />{notifs.length > 0 && <span className="text-xs tabular-nums">{notifs.length}</span>}</button>92 <Pop id="notif" w="w-80"><div className="px-2.5 py-2 text-xs font-medium text-muted">Recent system events</div>93 {notifs.length ? notifs.map((n, i) => <div key={i} className="rounded-lg px-2.5 py-2 text-sm hover:bg-surface2"><div className="truncate font-medium">{n.action}</div><div className="truncate text-xs text-muted">{n.resource} · {new Date(n.ts).toLocaleString()}</div></div>) : <div className="px-2.5 py-3 text-sm text-muted">No events yet.</div>}</Pop></div>94 <button className="btn btn-sm" onClick={toggleTheme} aria-label={dark ? "Switch to light theme" : "Switch to dark theme"}>{dark ? <Sun size={15} /> : <Moon size={15} />}</button>95 <div className="relative"><button className="grid h-8 w-8 place-items-center rounded-full bg-accentsoft text-xs font-semibold text-accent" onClick={() => setMenu(menu === "user" ? "" : "user")} aria-label="User menu">{authed ? "AD" : "DM"}</button>96 <Pop id="user" w="w-64"><div className="px-2.5 py-2"><div className="font-medium">{authed ? "Administrator" : "Demo visitor"}</div><div className="text-xs text-muted">{authed ? "Local token session (Zoo IAM pending)" : "Read-only demonstration view"}</div></div>97 {authed ? <button className="flex w-full items-center gap-2 rounded-lg px-2.5 py-2 text-sm hover:bg-surface2" onClick={async () => { await fetch("/api/auth/logout", { method: "POST" }); location.href = "/"; }}><LogOut size={15} />Sign out</button>98 : <a href={signInUrl} className="flex items-center gap-2 rounded-lg px-2.5 py-2 text-sm hover:bg-surface2"><LogIn size={15} />Sign in (HTTPS)</a>}</Pop></div>99 </div>100 <div className="flex h-9 items-center gap-3 overflow-x-auto border-t border-line px-3 text-xs text-muted sm:px-5">101 <ol className="flex items-center gap-1.5 whitespace-nowrap capitalize" aria-label="Breadcrumb">{crumbs.map((c, i) => <li key={c.href} className="flex items-center gap-1.5">{i > 0 && <span aria-hidden>/</span>}102 {i === crumbs.length - 1 ? <span className="text-fg" aria-current="page">{c.label}</span> : <Link href={c.href} className="hover:text-fg">{c.label}</Link>}</li>)}</ol>103 <span className="ml-auto flex items-center gap-1.5 whitespace-nowrap"><span className={`h-2 w-2 rounded-full ${sd.dot}`} aria-hidden /><span>{sd.txt}</span></span></div>104 </header>105106 {!authed && <div className="border-b border-line bg-[var(--warn-bg)] px-4 py-1.5 text-center text-xs text-[var(--warn)]">Demo view — sanitized data only. <a href={signInUrl} className="font-medium underline">Sign in over HTTPS</a> to create projects and manage the workspace.{!secure && " Plain HTTP is read-only by design."}</div>}107 <main id="main" className="mx-auto w-full max-w-[1400px] px-4 py-6 pb-24 sm:px-6 lg:pb-8">{children}</main>108 </div>109110 <nav aria-label="Mobile" className="fixed inset-x-0 bottom-0 z-20 grid grid-cols-5 border-t border-line bg-surface pb-[env(safe-area-inset-bottom)] lg:hidden">111 {[["D01", "Home"], ["D04", "Projects"], ["D02", "Workspace"], ["D09", "Deploy"]].map(([id, label]) => { const n = nav.find(x => x.id === id)!; const I = ICONS[n.icon];112 return <Link key={id} href={n.href} aria-current={active(n.href) ? "page" : undefined} className={`flex h-14 flex-col items-center justify-center gap-0.5 text-[11px] ${active(n.href) ? "text-accent" : "text-muted"}`}><I size={19} aria-hidden />{label}</Link>; })}113 <button className="flex h-14 flex-col items-center justify-center gap-0.5 text-[11px] text-muted" onClick={() => setDrawer(true)}><Menu size={19} aria-hidden />More</button></nav>114115 {palette && <Palette nav={nav} onClose={() => setPalette(false)} toggleTheme={toggleTheme} />}116 </div>;117}118119function Palette({ nav, onClose, toggleTheme }: { nav: Nav[]; onClose: () => void; toggleTheme: () => void }) {120 const [q, setQ] = useState(""); const [i, setI] = useState(0); const router = useRouter(); const ref = useRef<HTMLInputElement>(null);121 useEffect(() => ref.current?.focus(), []);122 const items = useMemo(() => [...nav.map(n => ({ label: `Go to ${n.title}`, run: () => router.push(n.href) })),123 { label: "New project", run: () => router.push("/projects/new") }, { label: "Open progress & evidence", run: () => router.push("/progress") },124 { label: "Toggle theme", run: toggleTheme }].filter(x => x.label.toLowerCase().includes(q.toLowerCase())), [q, nav, router, toggleTheme]);125 return <div className="fixed inset-0 z-50 flex items-start justify-center p-4 pt-[12vh]" role="dialog" aria-modal="true" aria-label="Command palette">126 <div className="absolute inset-0 bg-black/50" onClick={onClose} />127 <div className="relative w-full max-w-lg overflow-hidden rounded-xl border border-line bg-surface shadow-2xl">128 <div className="flex items-center gap-2 border-b border-line px-3"><Command size={16} className="text-muted" aria-hidden />129 <input ref={ref} className="h-12 flex-1 bg-transparent outline-none placeholder:text-muted" placeholder="Type a command or page name…" value={q} aria-label="Command search"130 onChange={e => { setQ(e.target.value); setI(0); }}131 onKeyDown={e => { if (e.key === "ArrowDown") { e.preventDefault(); setI(Math.min(i + 1, items.length - 1)); } if (e.key === "ArrowUp") { e.preventDefault(); setI(Math.max(i - 1, 0)); } if (e.key === "Enter" && items[i]) { items[i].run(); onClose(); } }} /></div>132 <ul className="max-h-80 overflow-y-auto p-1.5">{items.length ? items.map((it, k) => <li key={it.label}><button className={`w-full rounded-lg px-3 py-2 text-left text-sm ${k === i ? "bg-accentsoft text-accent" : "hover:bg-surface2"}`} onMouseEnter={() => setI(k)} onClick={() => { it.run(); onClose(); }}>{it.label}</button></li>)133 : <li className="px-3 py-6 text-center text-sm text-muted">No matches.</li>}</ul></div></div>;134}135
Conversation
PartialSign in to start AI sessions.
Task checklist
- Application shell deployed
- Persistent projects
- Agent runtime
- Sandboxed terminal
Execution activity
No agent sessions. Git HEAD fb22adb on master.
Approval requests
None pending.