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- ..
- apple-touch-icon.png
- brand-guidelines-v2.md
- brand-manifest-v2.json
- favicon-16.png
- favicon-32.png
- favicon-48.png
- favicon.ico
- icon-192.png
- icon-512.png
- maskable-192.png
- maskable-512.png
- source-brand-board.png
- source-crop-icon-fullcolor.png
- source-crop-lockup-dark.png
- source-crop-wordmark-light.png
- zloud-app-icon-1024.png
- zloud-app-icon.svg
- zloud-favicon.svg
- zloud-mark-1024.png
- zloud-mark-512.png
- zloud-mark-mono-512.png
- zloud-mark-mono.svg
- zloud-mark-reversed.svg
- zloud-mark-white-512.png
- zloud-mark-white.svg
- zloud-mark.svg
- zloud-maskable.svg
- zloud-wordmark-dark.svg
- zloud-wordmark-light.svg
- zloud-wordmark-mono.svg
app/src/components/apps-client.tsx
1"use client";2import { useCallback, useEffect, useState } from "react";3type P = { key: string; label: string; type: string; default?: string; required?: boolean };4type T = { id: string; name: string; version: string; deployable: boolean; summary: string; requires: string[]; resources: Record<string, any>; ports: string[]; health: string; rollback: string; params: P[]; verified: { at: string; evidence: string; scope: string } | null };5type Nd = { id: string; label: string; state: string; caps: any; exec: boolean };6type D = { id: string; name: string; template: string; node_id: string; port: number; status: string; current_release: number; url: string | null; health: string | null };7const tone = (s: string) => s === "running" ? "text-emerald-600" : ["failed", "down"].includes(s) ? "text-red-600" : "text-muted";8export function AppsPanel({ canDeploy, canAdmin }: { canDeploy: boolean; canAdmin: boolean }) {9 const [data, setData] = useState<{ templates: T[]; deployments: D[]; nodes: Nd[] } | null>(null); const [msg, setMsg] = useState(""); const [sel, setSel] = useState<string>(""); const [open, setOpen] = useState<string>("");10 const [form, setForm] = useState<Record<string, string>>({}); const [node, setNode] = useState(""); const [name, setName] = useState(""); const [detail, setDetail] = useState<any>(null); const [busy, setBusy] = useState(false);11 const load = useCallback(async () => { const r = await fetch("/api/cloud/apps"); if (r.ok) setData(await r.json()); }, []);12 useEffect(() => { load(); const t = setInterval(load, 4000); return () => clearInterval(t); }, [load]);13 useEffect(() => { if (!open) { setDetail(null); return; } const f = async () => { const r = await fetch(`/api/cloud/apps?id=${open}`); if (r.ok) setDetail(await r.json()); }; f(); const t = setInterval(f, 2000); return () => clearInterval(t); }, [open]);14 const post = async (b: any) => { setBusy(true); setMsg(""); const r = await fetch("/api/cloud/apps", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify(b) }); const j = await r.json().catch(() => ({})); setBusy(false); if (!r.ok) setMsg(j.error ?? `error ${r.status}`); else { load(); return j; } };15 const tpl = data?.templates.find(t => t.id === sel);16 if (!data) return <p className="text-sm text-muted">Loading…</p>;17 const online = data.nodes.filter(n => n.state === "online" && n.exec);18 return <div className="space-y-6">19 <section aria-label="Servers" className="rounded-xl border border-line p-3 text-sm"><h2 className="mb-2 font-medium">Servers</h2>{data.nodes.length === 0 ? <p className="text-muted">No enrolled servers.</p> : <ul className="space-y-1">{data.nodes.map(n => <li key={n.id} className="flex flex-wrap items-center justify-between gap-2"><span>{n.label} <span className="text-xs text-muted">{n.state}{n.caps?.node ? ` · node ${n.caps.node}` : ""}</span></span><span className="text-xs">{n.exec ? <span className="text-emerald-600">remote execution authorized</span> : <span className="text-amber-600">remote execution NOT authorized</span>}{canAdmin && <button disabled={busy} className="ml-2 rounded border border-line px-2 py-1" onClick={async () => { await fetch("/api/cloud/servers", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ action: "authorize", nodeId: n.id, on: !n.exec }) }); load(); }}>{n.exec ? "revoke" : "authorize"}</button>}</span></li>)}</ul>}<p className="mt-2 text-[11px] text-muted">Authorizing lets the Zloud control plane run application deployments and proxy updates on that server through the agent. Only an admin can do this.</p></section>20 <section aria-label="Application catalog"><h2 className="mb-2 font-medium">Catalog</h2>21 <div className="grid gap-3 sm:grid-cols-2 lg:grid-cols-3">{data.templates.map(t => <button key={t.id} onClick={() => { setSel(t.id); setForm(Object.fromEntries(t.params.map(p => [p.key, p.default ?? ""]))); }} className={`rounded-xl border p-3 text-left text-sm ${sel === t.id ? "border-accent" : "border-line"} ${t.deployable ? "" : "opacity-60"}`}>22 <div className="flex items-center justify-between gap-2"><span className="font-medium">{t.name}</span><span className="text-[11px] text-muted">{t.version}</span></div>23 <p className="mt-1 text-xs text-muted">{t.summary}</p>24 <p className="mt-2 text-[11px]">{!t.deployable ? <span className="text-muted">Not deployable yet — needs {t.requires.join("; ")}</span> : t.verified ? <span className="text-emerald-600">Verified by deployment ({t.verified.scope})</span> : <span className="text-amber-600">Implemented, not yet verified</span>}</p></button>)}</div></section>25 {tpl?.deployable && <section className="rounded-xl border border-line p-4 text-sm" aria-label="Configure and deploy"><h2 className="font-medium">Deploy {tpl.name}</h2>26 <dl className="mt-2 grid gap-x-4 gap-y-1 text-xs text-muted sm:grid-cols-2"><div>Requires: {tpl.requires.join(", ") || "nothing"}</div><div>Resources: {tpl.resources.memMb} MB RAM, {tpl.resources.diskMb} MB disk</div><div>Ports: {tpl.ports.join("; ")}</div><div>Health: {tpl.health}</div><div className="sm:col-span-2">Rollback: {tpl.rollback}</div></dl>27 {!canDeploy ? <p className="mt-3 text-muted">Developer role required.</p> : online.length === 0 ? <p className="mt-3 text-amber-600">No connected server. Add and enroll an External VPS first.</p> : <div className="mt-3 grid gap-2">28 <label className="grid gap-1">Server<select className="rounded border border-line bg-surface p-2" value={node} onChange={e => setNode(e.target.value)}><option value="">Select a connected server…</option>{online.map(n => <option key={n.id} value={n.id}>{n.label}</option>)}</select></label>29 <label className="grid gap-1">Application name<input className="rounded border border-line bg-surface p-2" value={name} onChange={e => setName(e.target.value.toLowerCase())} placeholder="my-site" /></label>30 {tpl.params.map(p => <label key={p.key} className="grid gap-1">{p.label}{p.type === "text" || p.type === "env" ? <textarea className="mono min-h-24 rounded border border-line bg-surface p-2" value={form[p.key] ?? ""} onChange={e => setForm({ ...form, [p.key]: e.target.value })} /> : <input className="rounded border border-line bg-surface p-2" value={form[p.key] ?? ""} onChange={e => setForm({ ...form, [p.key]: e.target.value })} />}</label>)}31 <button disabled={busy || !node || !name} onClick={async () => { const j = await post({ action: "deploy", nodeId: node, template: tpl.id, name, params: form }); if (j?.id) { setOpen(j.id); setName(""); } }} className="w-fit rounded-lg bg-accent px-4 py-2 text-accentfg disabled:opacity-50">Deploy</button></div>}</section>}32 {msg && <p role="alert" className="rounded border border-red-300 bg-red-50 p-2 text-sm text-red-700 dark:bg-red-950 dark:text-red-200">{msg}</p>}33 <section aria-label="Deployments"><h2 className="mb-2 font-medium">Deployments</h2>{data.deployments.length === 0 ? <p className="text-sm text-muted">Nothing deployed yet.</p> : <ul className="space-y-2">{data.deployments.map(d => <li key={d.id} className="rounded-xl border border-line p-3 text-sm">34 <div className="flex flex-wrap items-center justify-between gap-2"><div className="min-w-0"><span className="font-medium">{d.name}</span> <span className="text-xs text-muted">{d.template} · release {d.current_release || "—"} · port {d.port}</span></div><span className={`text-xs font-medium ${tone(d.status)}`}>{d.status}{d.health === "ok" ? " · healthy" : ""}</span></div>35 {d.url && d.status === "running" && <p className="mt-1 break-all text-xs"><a className="underline" href={d.url} target="_blank" rel="noreferrer noopener">{d.url}</a></p>}36 <div className="mt-2 flex flex-wrap gap-2 text-xs">{canDeploy && <>{["stop", "start", "restart", "retry", "cancel"].map(a => <button key={a} disabled={busy} onClick={() => post({ action: a, deploymentId: d.id })} className="rounded border border-line px-2 py-1">{a}</button>)}</>}{canAdmin && <button disabled={busy} onClick={() => post({ action: "remove", deploymentId: d.id })} className="rounded border border-red-300 px-2 py-1 text-red-700">remove</button>}<button onClick={() => setOpen(open === d.id ? "" : d.id)} className="rounded border border-line px-2 py-1">{open === d.id ? "hide logs" : "logs & releases"}</button></div>37 {open === d.id && detail?.deployment?.id === d.id && <div className="mt-2 space-y-2"><div className="flex flex-wrap gap-2 text-xs">{detail.releases.map((r: any) => <span key={r.seq} className="rounded bg-surface2 px-2 py-1">v{r.seq} {r.status}{canDeploy && r.status === "superseded" && <button className="ml-2 underline" onClick={() => post({ action: "rollback", deploymentId: d.id, release: r.seq })}>roll back</button>}</span>)}</div>38 <pre className="mono max-h-64 overflow-auto whitespace-pre-wrap rounded bg-surface2 p-2 text-[11px]">{detail.jobs.map((j: any) => `# ${j.kind} · ${j.status}\n${j.log}${j.result ? "result: " + JSON.stringify(j.result) + "\n" : ""}`).join("\n") || "no log yet"}</pre></div>}</li>)}</ul>}</section></div>;39}40
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 692573d on master.
Approval requests
None pending.