Skip to content
  1. Home
  2. workspace
Checking…
Public 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)/projects/[id]/controls.tsx

1"use client";
2import { useRouter } from "next/navigation";
3import { useState } from "react";
4import { Archive, Plus } from "lucide-react";
5
6async function call(url: string, body: unknown, method = "POST") { const r = await fetch(url, { method, headers: { "content-type": "application/json" }, body: JSON.stringify(body) }); return r; }
7
8type TaskRow = { id: string; title: string; done: boolean; depends_on: string[]; milestone_id: string | null; blocked_reason: string | null };
9type Ms = { id: string; title: string; due: string | null; status: string };
10export function TaskList({ projectId, tasks, milestones }: { projectId: string; tasks: TaskRow[]; milestones: Ms[] }) {
11 const router = useRouter(); const [t, setT] = useState(""); const [err, setErr] = useState(""); const [open, setOpen] = useState("");
12 const byId = new Map(tasks.map(x => [x.id, x])); const upd = async (id: string, body: object) => { setErr(""); const r = await call(`/api/projects/${projectId}/tasks`, { update: id, ...body }); if (!r.ok) setErr((await r.json()).error); router.refresh(); };
13 const waiting = (x: TaskRow) => x.depends_on.map(d => byId.get(d)).filter(d => d && !d.done);
14 return <div className="space-y-3">
15 {tasks.length === 0 && <p className="text-sm text-muted">No tasks yet.</p>}
16 <ul className="space-y-1">{tasks.map(x => { const w = waiting(x); return <li key={x.id}><div className="flex items-center gap-2 rounded-lg px-1 py-1 text-sm hover:bg-surface2"><input type="checkbox" aria-label={`Complete ${x.title}`} className="h-4 w-4 accent-[var(--accent)]" checked={x.done}
17 onChange={async () => { setErr(""); const r = await call(`/api/projects/${projectId}/tasks`, { toggle: x.id }); if (!r.ok) setErr((await r.json()).error); router.refresh(); }} /><span className={`min-w-0 flex-1 truncate ${x.done ? "text-muted line-through" : ""}`}>{x.title}</span>
18 {w.length > 0 && !x.done && <span className="whitespace-nowrap rounded-full bg-[var(--warn-bg)] px-2 text-xs text-[var(--warn)]">blocked ×{w.length}</span>}
19 {x.blocked_reason && <span className="whitespace-nowrap rounded-full bg-[var(--err-bg)] px-2 text-xs text-[var(--err)]" title={x.blocked_reason}>blocker</span>}
20 <button className="btn btn-sm" aria-expanded={open === x.id} onClick={() => setOpen(open === x.id ? "" : x.id)}>Plan</button></div>
21 {open === x.id && <div className="ml-6 space-y-2 rounded-lg border border-line p-2 text-xs">
22 <label className="block">Milestone<select className="input mt-1" value={x.milestone_id ?? ""} onChange={e => upd(x.id, { milestone_id: e.target.value || null })}><option value="">None</option>{milestones.map(m => <option key={m.id} value={m.id}>{m.title}</option>)}</select></label>
23 <fieldset><legend>Depends on</legend>{tasks.filter(o => o.id !== x.id).map(o => <label key={o.id} className="mr-3 inline-flex items-center gap-1"><input type="checkbox" checked={x.depends_on.includes(o.id)} onChange={e => upd(x.id, { depends_on: e.target.checked ? [...x.depends_on, o.id] : x.depends_on.filter(d => d !== o.id) })} />{o.title}</label>)}{tasks.length < 2 && <span className="text-muted">Add another task first.</span>}</fieldset>
24 <label className="block">Blocker note<input className="input mt-1" defaultValue={x.blocked_reason ?? ""} maxLength={200} placeholder="e.g. waiting for API key" onBlur={e => { if (e.target.value !== (x.blocked_reason ?? "")) void upd(x.id, { blocked_reason: e.target.value || null }); }} /></label></div>}</li>; })}</ul>
25 <form className="flex gap-2" onSubmit={async e => { e.preventDefault(); setErr(""); const r = await call(`/api/projects/${projectId}/tasks`, { title: t }); if (r.ok) { setT(""); router.refresh(); } else setErr((await r.json()).error); }}>
26 <input className="input" aria-label="New task" value={t} onChange={e => setT(e.target.value)} placeholder="Add a task" maxLength={200} /><button className="btn btn-primary" aria-label="Add task"><Plus size={16} /></button></form>
27 {err && <div role="alert" className="text-xs text-[var(--err)]">{err}</div>}</div>;
28}
29export function Milestones({ projectId, milestones, tasks }: { projectId: string; milestones: Ms[]; tasks: TaskRow[] }) {
30 const router = useRouter(); const [t, setT] = useState(""), [due, setDue] = useState(""), [err, setErr] = useState("");
31 return <div className="space-y-3">{milestones.length === 0 && <p className="text-sm text-muted">No milestones yet.</p>}
32 <ul className="space-y-2">{milestones.map(m => { const ts = tasks.filter(x => x.milestone_id === m.id); const d = ts.filter(x => x.done).length; return <li key={m.id} className="text-sm"><div className="flex items-center gap-2"><input type="checkbox" aria-label={`Milestone ${m.title} done`} checked={m.status === "done"} className="h-4 w-4 accent-[var(--accent)]" onChange={async () => { await call(`/api/projects/${projectId}/milestones`, { toggle: m.id }); router.refresh(); }} />
33 <span className={`flex-1 ${m.status === "done" ? "text-muted line-through" : "font-medium"}`}>{m.title}</span><span className="text-xs text-muted">{m.due ?? "no date"}</span></div>
34 <div className="ml-6 text-xs text-muted">{ts.length ? `${d}/${ts.length} tasks done` : "no tasks assigned"}</div></li>; })}</ul>
35 <form className="grid gap-2 sm:grid-cols-[1fr_9rem_auto]" onSubmit={async e => { e.preventDefault(); setErr(""); const r = await call(`/api/projects/${projectId}/milestones`, { title: t, due: due || undefined }); if (r.ok) { setT(""); setDue(""); router.refresh(); } else setErr((await r.json()).error); }}>
36 <input className="input" aria-label="New milestone" value={t} onChange={e => setT(e.target.value)} placeholder="Add a milestone" maxLength={120} /><input className="input" type="date" aria-label="Milestone due date" value={due} onChange={e => setDue(e.target.value)} /><button className="btn btn-primary" aria-label="Add milestone"><Plus size={16} /></button></form>
37 {err && <div role="alert" className="text-xs text-[var(--err)]">{err}</div>}</div>;
38}
39export function ProjectControls({ id, name, status }: { id: string; name: string; status: string }) {
40 const router = useRouter(); const [n, setN] = useState(name); const [msg, setMsg] = useState("");
41 return <div className="space-y-3"><label className="text-sm font-medium" htmlFor="pname">Name</label>
42 <div className="flex gap-2"><input id="pname" className="input" value={n} onChange={e => setN(e.target.value)} maxLength={80} /><button className="btn" onClick={async () => { const r = await call(`/api/projects/${id}`, { name: n }, "PATCH"); setMsg(r.ok ? "Saved" : "Failed"); router.refresh(); }}>Save</button></div>
43 <button className="btn w-full justify-center" onClick={async () => { await call(`/api/projects/${id}`, { status: status === "archived" ? "active" : "archived" }, "PATCH"); router.refresh(); }}><Archive size={15} />{status === "archived" ? "Restore project" : "Archive project"}</button>
44 <div aria-live="polite" className="text-xs text-muted">{msg}</div></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 0eebc42 on master.

Approval requests

None pending.