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/ai/sessions/[id]/messages/route.ts
1import { auditT, sessionOf, tenant, notFound } from "@/lib/tenant";2import { db, now, uid } from "@/lib/db";3import { ACTIVE } from "@/lib/ai";4import { credentialStatus } from "@/lib/providers";5import { opencodeInfo, loadEngineSettings } from "@/lib/engines";6export async function POST(req: Request, { params }: { params: Promise<{ id: string }> }) {7 const g = await tenant("developer", { write: true }); if (g.res) return g.res; const ctx = g.ctx; const { id } = await params;8 const b = await req.json().catch(() => ({})); const content = typeof b.content === "string" ? b.content.trim() : "";9 if (!content || content.length > 20_000) return Response.json({ error: "content must be 1-20000 chars" }, { status: 400 });10 const s = await sessionOf(ctx, id); if (!s) return notFound();11 if (s.provider === "opencode") {12 const info = await opencodeInfo(); if (!info.installed) return Response.json({ error: "OpenCode is not installed on this host." }, { status: 409 });13 if (!(await loadEngineSettings()).consent) return Response.json({ error: "OpenCode sends prompts and files to an external model service. Record owner consent on the AI Engines page first." }, { status: 409 });14 } else if (s.provider !== "mock") { const c = (await credentialStatus(ctx.orgId))[s.provider]; if (!c) return Response.json({ error: `Awaiting credentials: no ${s.provider} API key is configured (Integrations).` }, { status: 409 }); }15 const active = await db().prepare(`SELECT id FROM ai_runs WHERE session_id=? AND status IN (${ACTIVE.map(() => "?").join(",")})`).get(id, ...ACTIVE);16 if (active) return Response.json({ error: "a run is already active for this session" }, { status: 409 });17 const runId = uid("run_");18 await db().tx(async c => {19 const m = await c.query("INSERT INTO ai_messages(session_id,role,content,created_at) VALUES($1,'user',$2,$3) RETURNING id", [id, content, now()]);20 await c.query("INSERT INTO ai_runs(id,session_id,created_at,updated_at) VALUES($1,$2,$3,$3)", [runId, id, now()]);21 await c.query("INSERT INTO ai_checkpoints(run_id,seq,kind,detail,created_at) VALUES($1,1,'queued',$2,$3)", [runId, `user message ${m.rows[0].id}`, now()]);22 await c.query("UPDATE ai_sessions SET status='queued', updated_at=$2 WHERE id=$1", [id, now()]);23 });24 await auditT(ctx, "ai.run.enqueue", runId, { session: id }); return Response.json({ runId });25}26
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.