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)/workspace/page.tsx

1import Link from "next/link";
2import { Send, Paperclip, Pause, Play, Square, Maximize2, FileCode2, Folder, CheckCircle2, Circle } from "lucide-react";
3import { Badge, Card, MaturityBadge, Notice, PageHeader } from "@/components/ui";
4import { list, read, gitInfo } from "@/lib/files";
5import { isSecure } from "@/lib/auth";
6import { getCtx } from "@/lib/tenant";
7import { credentialStatus, mockAllowed } from "@/lib/providers";
8import { opencodeInfo, loadEngineSettings } from "@/lib/engines";
9import { ProjectEditor } from "@/components/project-editor";
10import { db } from "@/lib/db";
11import { AiChat } from "@/components/ai-chat";
12export const dynamic = "force-dynamic";
13export const metadata = { title: "AI Workspace" };
14const VIEWS = ["Design", "Code", "Editor", "Terminal", "Preview", "Testing", "Deployment"] as const;
15
16export default async function Workspace({ searchParams }: { searchParams: Promise<{ view?: string; file?: string; dir?: string; full?: string }> }) {
17 const sp = await searchParams; const view = (VIEWS as readonly string[]).includes(sp.view ?? "") ? sp.view! : "Code";
18 const dir = sp.dir ?? "app/src"; const nodes = list(dir) ?? []; const file = sp.file ?? "app/src/lib/modules.ts"; const f = read(file); const git = gitInfo();
19 const q = (o: Record<string, string>) => "?" + new URLSearchParams({ view, dir, file, ...o }).toString();
20 const full = sp.full;
21 const ctx = await getCtx(); const authed = !!ctx, secure = await isSecure(); const cs = ctx ? Object.keys(await credentialStatus(ctx.orgId)).filter(k => k === "anthropic" || k === "openai") : [];
22 const oc = await opencodeInfo(), es = await loadEngineSettings();
23 const projList = ctx ? (await db().prepare("SELECT id,name,data FROM projects WHERE org_id=? ORDER BY created_at DESC").all(ctx.orgId)).map(p => { let e = ""; try { e = JSON.parse(String(p.data)).engine ?? ""; } catch {} return { id: String(p.id), name: String(p.name), engine: String(e) }; }) : [];
24 const Chat = <Card title="Conversation" pad={false} action={<MaturityBadge state={cs.length || es.consent ? "partial" : mockAllowed() ? "partial" : "awaiting"} />} className="flex flex-col"><AiChat configured={cs} mock={mockAllowed()} signedIn={authed} secure={secure} ocModels={authed && es.consent ? oc.freeModels : []} defaultEngine={es.default} projects={authed ? projList : []} /></Card>;
25 const Tree = <Card title="Project files" pad={false} action={<Badge tone="ok">read-only</Badge>}>
26 <ul className="max-h-80 overflow-auto p-1.5 text-sm">{dir !== "." && dir !== "" && <li><Link className="flex items-center gap-2 rounded px-2 py-1 text-muted hover:bg-surface2" href={q({ dir: dir.split("/").slice(0, -1).join("/") || "." })}>..</Link></li>}
27 {nodes.map(n => <li key={n.path}><Link href={n.dir ? q({ dir: n.path }) : q({ file: n.path })} className={`flex items-center gap-2 rounded px-2 py-1 hover:bg-surface2 ${n.path === file ? "bg-accentsoft text-accent" : ""}`}>
28 {n.dir ? <Folder size={14} aria-hidden /> : <FileCode2 size={14} aria-hidden />}<span className="truncate">{n.name}</span></Link></li>)}</ul></Card>;
29 const Editor = <Card title={<span className="mono">{file}</span>} pad={false} action={<Link className="btn btn-sm" href={q({ full: full === "editor" ? "" : "editor" })} aria-label="Toggle full screen"><Maximize2 size={13} /></Link>}>
30 {f ? <pre className={`mono overflow-auto p-3 leading-relaxed ${full === "editor" ? "max-h-[70vh]" : "max-h-80"}`}>{f.text.split("\n").map((l, i) => <div key={i} className="flex"><span className="w-9 shrink-0 select-none pr-3 text-right text-muted">{i + 1}</span><span className="whitespace-pre">{l}</span></div>)}</pre> : <div className="p-4 text-sm text-muted">File not viewable.</div>}</Card>;
31 return <>
32 <PageHeader title="AI Engineering Workspace" desc="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." badge={<MaturityBadge state="partial" />} />
33 <div role="tablist" aria-label="Workspace views" className="mb-4 flex gap-1 overflow-x-auto">{VIEWS.map(v => <Link key={v} role="tab" aria-selected={v === view} href={q({ view: v, full: "" })} className={`btn btn-sm ${v === view ? "btn-primary" : ""}`}>{v}</Link>)}</div>
34 {view === "Code" && (full === "editor" ? Editor : <div className="grid gap-4 xl:grid-cols-[18rem_1fr_24rem]">{Tree}{Editor}{Chat}</div>)}
35 {view === "Editor" && <div className="grid gap-4 xl:grid-cols-[1fr_24rem]"><Card title="Project editor" pad={false} action={<Badge tone="ok">per-project sandboxed files</Badge>}><ProjectEditor signedIn={authed} secure={secure} projects={ctx ? (await db().prepare("SELECT id,name FROM projects WHERE org_id=? ORDER BY created_at DESC").all(ctx.orgId)).map(p => ({ id: String(p.id), name: String(p.name) })) : []} /></Card>{Chat}</div>}
36 {view === "Design" && <div className="grid gap-4 lg:grid-cols-2"><Card title="Design context"><p className="text-sm text-muted">Tokens, screenshots and visual QA live in the Design Studio.</p><Link className="btn mt-3" href="/design">Open Design Studio</Link></Card>{Chat}</div>}
37 {view === "Terminal" && <Notice tone="err" title="Terminal unavailable">A secure, sandboxed terminal needs a rootless container runtime, which requires administrator access on this VPS. No shell is exposed. See Blockers.</Notice>}
38 {view === "Preview" && <Card title="Live application preview"><p className="text-sm text-muted">Preview of generated projects appears here once the agent builds an app inside a sandbox. This product's own deployed UI is the page you are viewing.</p></Card>}
39 {view === "Testing" && <Card title="Testing"><p className="text-sm text-muted">Latest browser QA results are published on the evidence page.</p><Link className="btn mt-3" href="/progress">Open evidence</Link></Card>}
40 {view === "Deployment" && <Card title="Deployment"><p className="text-sm text-muted">Release history and health evidence are in the Deployment Center.</p><Link className="btn mt-3" href="/deployments">Open Deployment Center</Link></Card>}
41 <div className="mt-4 grid gap-4 md:grid-cols-3">
42 <Card title="Task checklist"><ul className="space-y-1.5 text-sm">{[["Application shell deployed", true], ["Persistent projects", true], ["Agent runtime", false], ["Sandboxed terminal", false]].map(([t, d]) => <li key={String(t)} className="flex items-center gap-2">{d ? <CheckCircle2 size={15} className="text-[var(--ok)]" /> : <Circle size={15} className="text-muted" />}<span className={d ? "" : "text-muted"}>{t}</span></li>)}</ul></Card>
43 <Card title="Execution activity"><p className="text-sm text-muted">No agent sessions. Git HEAD <span className="mono">{git.head || "n/a"}</span> on <span className="mono">{git.branch || "n/a"}</span>.</p></Card>
44 <Card title="Approval requests"><p className="text-sm text-muted">None pending.</p></Card></div></>;
45}
46

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.