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/api/cloud/instances/[id]/route.ts
1import { db } from "@/lib/db";2import { auditT, instanceOf, notFound, tenant } from "@/lib/tenant";3import { TRANSITIONS } from "@/lib/cloud";4// Lifecycle transitions only; terminating never deletes data and never touches billing (there is none).5export async function PATCH(req: Request, { params }: { params: Promise<{ id: string }> }) {6 const g = await tenant("admin", { write: true }); if (g.res) return g.res; const ctx = g.ctx; const { id } = await params;7 const inst = await instanceOf(ctx, id); if (!inst) return notFound(); const b = await req.json().catch(() => ({})); const to = String(b.status ?? "");8 if (!(TRANSITIONS[inst.status] ?? []).includes(to as any)) return Response.json({ error: `cannot move an instance from ${inst.status} to ${to}` }, { status: 409 });9 if (to === "active" && inst.target === "managed" && !(await db().prepare("SELECT 1 FROM managed_inventory WHERE assigned_instance_id=?").get(id))) return Response.json({ error: "a managed instance needs an assigned server first (request provisioning)" }, { status: 409 });10 await db().prepare("UPDATE instances SET status=? WHERE id=? AND org_id=?").run(to, id, ctx.orgId); await auditT(ctx, "instance.lifecycle", id, { from: inst.status, to }); return Response.json({ ok: true });11}12
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.