Skip to content
  1. Home
  2. workspace
Checking…
Demo view — sanitized data only. Sign in over HTTPS to create projects and manage the workspace.

AI Engineering Workspace

Partial

Chat, 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

app/src/app/(app)/superadmin/page.tsx

1import Link from "next/link";
2import { Plus, FolderKanban, Rocket, ShieldCheck, Sparkles, Server, Coins } from "lucide-react";
3import { Notice, Badge, Card, Empty, LinkBtn, MaturityBadge, PageHeader, Stat, ago, fmtUptime } from "@/components/ui";
4import { LiveResources } from "@/components/live";
5import { snapshot } from "@/lib/metrics";
6import { db } from "@/lib/db";
7import { getCtx } from "@/lib/tenant";
8import { spend, limits } from "@/lib/ai";
9import { listAudit } from "@/lib/audit";
10import { getSetting } from "@/lib/db";
11
12export const dynamic = "force-dynamic";
13export default async function CommandCenter() {
14 const snap = snapshot(); const ctx = await getCtx(); if (ctx && !ctx.platformAdmin) return <Notice tone="warn" title="Platform administrators only">This page shows platform-wide infrastructure. Customer pages are under Cloud console.</Notice>; const authed = !!ctx; const d = db();
15 const count = async (sql: string) => ((await d.prepare(sql).get()) as { c: number }).c;
16 const projects = authed ? await count("SELECT COUNT(*) c FROM projects WHERE status!='archived'") : 0;
17 const deps = await d.prepare("SELECT * FROM deployments ORDER BY started_at DESC LIMIT 5").all() as any[];
18 const events = authed ? await listAudit("", 8) : [];
19 const stopped = await getSetting("emergency_stop") === "1";
20 const ai = await spend(), lim = await limits();
21 return <>
22 <PageHeader title="Command Center" desc="Operational overview of the experimental Zloud Studio environment." badge={<MaturityBadge state="partial" />}
23 actions={<LinkBtn href="/projects/new" primary><Plus size={16} />New project</LinkBtn>} />
24 {stopped && <div className="mb-4"><Badge tone="err" dot>Emergency stop engaged — autonomous execution halted</Badge></div>}
25 <div className="grid grid-cols-2 gap-3 lg:grid-cols-4">
26 <Stat label="Projects" value={authed ? projects : "—"} sub={authed ? "active + draft" : "sign in to view"} />
27 <Stat label="Connected servers" value="1" sub={`${snap.host.cpus} vCPU · up ${fmtUptime(snap.host.uptimeSec)}`} />
28 <Stat label="Active AI sessions" value="0" sub="agent runtime not connected" />
29 <Stat label="Pending approvals" value="0" sub="no autonomous runs yet" />
30 </div>
31 <div className="mt-4 grid gap-4 xl:grid-cols-3">
32 <Card title="Infrastructure · live" className="xl:col-span-2" action={<Link href="/infrastructure" className="text-xs text-accent hover:underline">Details</Link>}><LiveResources initial={snap} /></Card>
33 <Card title="AI usage & estimated cost" action={<MaturityBadge state={ai.calls ? "partial" : "awaiting"} />}>
34 <div className="flex items-center gap-3"><Coins className="text-muted" size={22} aria-hidden /><div><div className="text-2xl font-semibold tabular-nums">${ai.month_usd.toFixed(4)}</div><div className="text-xs text-muted">this month · {ai.calls} calls · {ai.tokens_in + ai.tokens_out} tokens · cap ${lim.monthly}</div></div></div>
35 <p className="mt-3 text-sm text-muted">Costs are estimates from a configurable price table; provider invoices are authoritative. Calls to the labelled mock provider cost $0. Caps are enforced before every call.</p></Card>
36 <Card title="Recent deployments" className="xl:col-span-2" pad={false} action={<Link href="/deployments" className="text-xs text-accent hover:underline">All</Link>}>
37 {deps.length ? <div className="scroll-x"><table className="tbl"><thead><tr><th>Version</th><th>Commit</th><th>Status</th><th>When</th></tr></thead><tbody>
38 {deps.map(x => <tr key={x.id}><td className="font-medium">{x.version}</td><td className="mono">{x.commit_sha?.slice(0, 7)}</td>
39 <td><Badge tone={x.status === "success" ? "ok" : "err"} dot>{x.status}</Badge></td><td className="text-muted">{ago(x.started_at)}</td></tr>)}</tbody></table></div>
40 : <Empty title="No deployments recorded" desc="Run scripts/deploy.sh to build, deploy and record a release." />}</Card>
41 <Card title="Recent activity" pad={false}>
42 {events.length ? <ul className="divide-y divide-line">{events.map(e => <li key={e.seq} className="px-4 py-2.5"><div className="truncate text-sm font-medium">{e.action}</div><div className="truncate text-xs text-muted">{e.resource || e.actor} · {ago(e.ts)}</div></li>)}</ul>
43 : <Empty title={authed ? "No activity yet" : "Sign in to view activity"} desc="Audit events appear here as actions occur." />}</Card>
44 </div>
45 <div className="mt-4 grid gap-3 sm:grid-cols-2 lg:grid-cols-4">
46 {[{ i: FolderKanban, t: "Create a project", d: "Guided wizard, saved as you go", h: "/projects/new" }, { i: Sparkles, t: "Open AI workspace", d: "Multi-panel engineering view", h: "/workspace" },
47 { i: Server, t: "Inspect infrastructure", d: "Live host metrics", h: "/infrastructure" }, { i: ShieldCheck, t: "Review access & audit", d: "Roles, estop, audit chain", h: "/access" }]
48 .map(q => <Link key={q.h} href={q.h} className="card flex items-start gap-3 p-4 hover:bg-surface2"><q.i size={18} className="mt-0.5 text-accent" aria-hidden /><div><div className="font-medium">{q.t}</div><div className="text-xs text-muted">{q.d}</div></div></Link>)}
49 </div>
50 <p className="mt-6 text-xs text-muted"><Rocket size={12} className="mr-1 inline" aria-hidden />Honesty note: metrics, projects, deployments and audit data are real. AI costs come from the usage ledger; live provider calls require API keys that have not been supplied.</p>
51 </>;
52}
53

Conversation

Partial
Sign in to start AI sessions.

Task checklist

  • Application shell deployed
  • Persistent projects
  • Agent runtime
  • Sandboxed terminal

Execution activity

No agent sessions. Git HEAD 692573d on master.

Approval requests

None pending.