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- ..
- assets
- basic-languages
- editor
- language
- nls
- abap-D-t0cyap.js
- apex-CcIm7xu6.js
- azcli-BA0tQDCg.js
- bat-C397hTD6.js
- bicep-DF5aW17k.js
- cameligo-plsz8qhj.js
- clojure-Y2auQMzK.js
- coffee-Bu45yuWE.js
- cpp-CkKPQIni.js
- csharp-CX28MZyh.js
- csp-D8uWnyxW.js
- css-CaeNmE3S.js
- css.worker-C7XcYe5x.js
- cssMode-DpEkhVlW.js
- cypher-DVThT8BS.js
- dart-CmGfCvrO.js
- dockerfile-CZqqYdch.js
- ecl-30fUercY.js
- editor-CG9c2pE-.js
- editor.js
- elixir-O3PRlgxO.js
- flow9-DqtmStfK.js
- freemarker2-DTUDMAl2.js
- fsharp-BOMdg4U1.js
- go-D_hbi-Jt.js
- graphql-CKUU4kLG.js
- handlebars-qLqoXa-4.js
- hcl-DTaboeZW.js
- html-DTxBj26n.js
- html.worker-VIR_LTyv.js
- htmlMode-DFBg6CMj.js
- index-BVflv2uG.js
- index.js
- ini--YXggpAu.js
- java-CI4ZMsH9.js
- javascript-BiL3JN6i.js
- json.worker-DzWXGkG8.js
- jsonMode-Dz4r0pwo.js
- julia-BwzEvaQw.js
- kotlin-IUYPiTV8.js
- less-C0eDYdqa.js
- lexon-iON-Kj97.js
- liquid-lXEUQRVn.js
- loader.js
- lspLanguageFeatures-IeRAvoKK.js
- lua-DtygF91M.js
- m3-CsR4AuFi.js
- markdown-C_rD0bIw.js
- mdx-Dtr248s4.js
- mips-CiYP61RB.js
- monaco.contribution-BRs4bdz5.js
- monaco.contribution-ChoOM5Gg.js
- monaco.contribution-DbKqsbmO.js
- monaco.contribution-DKFaWvum.js
- msdax-C38-sJlp.js
- mysql-CdtbpvbG.js
- nls.messages-loader.js
- objective-c-CntZFaHX.js
- pascal-r6kuqfl_.js
- pascaligo-BiXoTmXh.js
- perl-DABw_TcH.js
- pgsql-me_jFXeX.js
- php-D_kh-9LK.js
- pla-VfZjczW0.js
- postiats-BBSzz8Pk.js
- powerquery-Dt-g_2cc.js
- powershell-B-7ap1zc.js
- protobuf-BmtuEB1A.js
- pug-BRpRNeEb.js
- python-Cma5OvNe.js
- qsharp-BzsFaUU9.js
- r-f8dDdrp4.js
- razor-C8pOqqry.js
- redis-fvZQY4PI.js
- redshift-45Et0LQi.js
- restructuredtext-C7UUFKFD.js
- ruby-CZO8zYTz.js
- rust-Bfetafyc.js
- sb-3GYllVck.js
- scala-foMgrKo1.js
- scheme-CHdMtr7p.js
- scss-C1cmLt9V.js
- shell-ClXCKCEW.js
- solidity-MZ6ExpPy.js
- sophia-DWkuSsPQ.js
- sparql-AUGFYSyk.js
- sql-32GpJSV2.js
- st-CuDFIVZ_.js
- swift-t-PfMj7W.js
- systemverilog-Ch4vA8Yt.js
- tcl-D74tq1nH.js
- toggleHighContrast-CmI6H2gJ.js
- ts.worker-Dp2_QI6H.js
- tsMode-DgC3tGu_.js
- twig-C6taOxMV.js
- typescript-PjDChiYw.js
- typespec-D-PIh9Xw.js
- vb-Dyb2648j.js
- wgsl-BhLXMOR0.js
- workers-B_Zs9c54.js
- xml-BgCkTIhY.js
- yaml-D0tu26m-.js
app/src/app/api/projects/route.ts
1import { db, now, uid } from "@/lib/db";2import { auditT, getCtx, tenant } from "@/lib/tenant";3import { draftRequirements, type WizardData } from "@/lib/requirements";4export const dynamic = "force-dynamic";56export async function GET() {7 const ctx = await getCtx(); if (!ctx) return Response.json({ projects: [], demo: true });8 return Response.json({ projects: await db().prepare("SELECT id,slug,name,status,created_at,updated_at FROM projects WHERE org_id=? ORDER BY updated_at DESC").all(ctx.orgId) });9}10const slugify = (s: string) => s.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 40) || "project";1112export async function POST(req: Request) {13 const g = await tenant("developer", { write: true }); if (g.res) return g.res; const ctx = g.ctx;14 const b = await req.json().catch(() => null) as { id?: string; name?: string; status?: string; wizard?: WizardData } | null;15 if (!b) return Response.json({ error: "invalid JSON" }, { status: 400 });16 const name = String(b.name ?? "").trim();17 if (name.length < 2 || name.length > 80) return Response.json({ error: "name must be 2–80 characters" }, { status: 422 });18 const status = b.status === "active" ? "active" : "draft";19 const w = b.wizard; if (w && (typeof w.description !== "string" || w.description.length > 5000)) return Response.json({ error: "invalid wizard data" }, { status: 422 });20 const engine = w?.engine && ["opencode", "anthropic", "openai"].includes(w.engine) ? w.engine : "";21 const data = JSON.stringify({ engine, wizard: w ?? null, requirements: w ? draftRequirements(w) : "" });22 const d = db(); const t = now();23 if (b.id) {24 const r = await d.prepare("UPDATE projects SET name=?,status=?,data=?,updated_at=? WHERE id=? AND org_id=?").run(name, status, data, t, b.id, ctx.orgId);25 if (!r.changes) return Response.json({ error: "not found" }, { status: 404 });26 await auditT(ctx, "project.update", b.id, { status }); return Response.json({ id: b.id });27 }28 const cnt = await d.prepare("SELECT COUNT(*) n FROM projects WHERE org_id=?").get(ctx.orgId) as any; const lim = await d.prepare("SELECT max_projects FROM organizations WHERE id=?").get(ctx.orgId) as any;29 if (cnt.n >= lim.max_projects) return Response.json({ error: `project quota reached (${lim.max_projects})` }, { status: 409 });30 const id = uid("p_"); let slug = slugify(name);31 if (await d.prepare("SELECT 1 FROM projects WHERE slug=?").get(slug)) slug += "-" + id.slice(-4);32 await d.prepare("INSERT INTO projects(id,slug,name,status,data,created_at,updated_at,org_id) VALUES(?,?,?,?,?,?,?,?)").run(id, slug, name, status, data, t, t, ctx.orgId);33 await auditT(ctx, "project.create", id, { name, status });34 return Response.json({ id }, { status: 201 });35}36
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.