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- ..
- ai.ts
- apps.ts
- audit.ts
- auth.ts
- central-core.d.mts
- central-core.mjs
- central.ts
- cloud.ts
- config.ts
- crypto.ts
- db.ts
- design.ts
- engines.ts
- files.ts
- gates.ts
- gateway.ts
- marketplace-core.d.mts
- marketplace-core.mjs
- metrics.ts
- modules.ts
- motion.ts
- nexus-core.d.mts
- nexus-core.mjs
- oidc-core.d.mts
- oidc-core.mjs
- oidc.ts
- providers.ts
- proxy-core.d.mts
- proxy-core.mjs
- pwauth-core.d.mts
- pwauth-core.mjs
- requirements.ts
- rls.sql.d.mts
- rls.sql.mjs
- services-content.ts
- ssrf.ts
- status.ts
- tenant.ts
- tlsgate.ts
- workspace.ts
app/src/app/(app)/engines/page.tsx
1import { Badge, Card, MaturityBadge, Notice, PageHeader } from "@/components/ui";2import { isSecure } from "@/lib/auth";3import { getCtx } from "@/lib/tenant";4import { db, getSetting } from "@/lib/db";5import { activeSessions, engineStatus, loadEngineSettings } from "@/lib/engines";6import { limits, spend } from "@/lib/ai";7import { EngineControls } from "./controls";8export const dynamic = "force-dynamic";9export const metadata = { title: "AI Engines" };10const tone = (s: string) => s.startsWith("ready") ? "ok" : s === "blocked" || s === "not installed" ? "err" : s === "planned" ? "neutral" : "warn";11export default async function Engines() {12 const ctx = await getCtx(); const authed = !!ctx, secure = await isSecure(); const engines = await engineStatus(ctx?.orgId ?? "org_owner"); const st = await loadEngineSettings(); const sp = await spend(), lim = await limits();13 const sessions = ctx ? await activeSessions(ctx.orgId) : [];14 const projects = ctx?.platformAdmin ? await Promise.all((await db().prepare("SELECT id,name FROM projects ORDER BY created_at DESC").all()).map(async p => ({ id: String(p.id), name: String(p.name), authorized: (await getSetting(`exec.authorized.${p.id}`, "0")) === "1" }))) : [];15 const usable = [...engines.filter(e => e.ready).map(e => e.id), ...(process.env.ZCS_ALLOW_MOCK === "1" ? ["mock"] : [])];16 return <>17 <PageHeader title="AI Engine Management" desc="Engines execute AI runs. Each is shown with its real install and credential status; nothing is marked ready unless it can run." badge={<MaturityBadge state="partial" />} />18 <div className="mb-4"><Notice tone="warn" title="Engines are not sandboxes">No isolation runtime exists on this host (AppArmor blocks user namespaces; no sudo). Agent file editing is therefore off unless a project is explicitly authorized, and every agent policy denies shell and network tools.</Notice></div>19 <div className="grid gap-4 md:grid-cols-2 xl:grid-cols-3" data-testid="engine-cards">{engines.map(e => <Card key={e.id}>20 <div className="flex items-start justify-between gap-2"><div><div className="font-medium">{e.name}</div><div className="text-xs text-muted">{e.kind}{"version" in e && e.version ? ` · v${e.version}` : ""}</div></div><Badge tone={tone(e.state)} dot>{e.state}</Badge></div>21 <p className="mt-3 text-sm text-muted">{e.note}</p>22 {e.models.length > 0 && <details className="mt-3 text-xs"><summary className="cursor-pointer text-muted">{e.models.length} models</summary><ul className="mono mt-1 max-h-32 overflow-auto">{e.models.map(m => <li key={m}>{m}</li>)}</ul></details>}23 {st.default === e.id && <div className="mt-3"><Badge tone="info">default engine</Badge></div>}</Card>)}</div>24 <div className="mt-4 grid gap-4 lg:grid-cols-3">25 <Card title="Configuration" className="lg:col-span-2">{ctx?.platformAdmin && secure ? <EngineControls def={st.default} consent={st.consent} fallback={st.fallbackEnabled} order={st.fallbackOrder} usable={usable} projects={projects} /> : <p className="text-sm text-muted">{secure ? "Sign in to change engine settings." : "Engine configuration requires an HTTPS sign-in; it is disabled over plain HTTP."} Provider API keys are managed under Integrations.</p>}</Card>26 <div className="space-y-4"><Card title="Usage & limits"><div className="text-2xl font-semibold tabular-nums">${sp.month_usd.toFixed(4)}</div><div className="text-xs text-muted">this month · {sp.calls} calls · cap ${lim.monthly} · per-project ${lim.project}</div><p className="mt-2 text-xs text-muted">OpenCode free-model runs report cost $0; direct providers use estimated prices. Limits are enforced before each call.</p></Card>27 <Card title="Active sessions" pad={false}>{sessions.length === 0 ? <p className="p-4 text-sm text-muted">No active sessions.</p> : <ul className="divide-y divide-line text-sm">{sessions.map((s: any) => <li key={s.id} className="flex items-center justify-between gap-2 px-4 py-2"><span className="min-w-0 truncate">{s.title}<span className="block text-xs text-muted">{s.provider} · {s.model}</span></span><Badge tone="info">{s.run_status ?? s.status}</Badge></li>)}</ul>}</Card></div></div></>;28}29
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 0eebc42 on master.
Approval requests
None pending.