Skip to content
  1. Home
  2. workspace
Checking…
Demo 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/api/integrations/[id]/route.ts

1import { db } from "@/lib/db";
2import { auditT, tenant } from "@/lib/tenant";
3import { INTEGRATIONS, saveCredential, verifyKey, revealKey, type ProviderId } from "@/lib/providers";
4const ok = (id: string) => INTEGRATIONS.some(i => i.id === id);
5// PUT: store (encrypted) + verify against the provider. POST: re-verify. DELETE: remove. Secrets are never returned.
6export async function PUT(req: Request, { params }: { params: Promise<{ id: string }> }) {
7 const g = await tenant("admin", { write: true }); if (g.res) return g.res; const ctx = g.ctx; const { id } = await params; if (!ok(id)) return Response.json({ error: "unknown provider" }, { status: 404 });
8 const b = await req.json().catch(() => ({})); const key = typeof b.key === "string" ? b.key.trim() : "";
9 if (key.length < 8 || key.length > 400 || /\s/.test(key)) return Response.json({ error: "invalid key format" }, { status: 400 });
10 const v = await saveCredential(ctx.orgId, id as ProviderId, key); await auditT(ctx, "credential.set", id, { status: v.status }); return Response.json({ ok: true, status: v.status, detail: v.detail });
11}
12export async function POST(_: Request, { params }: { params: Promise<{ id: string }> }) {
13 const g = await tenant("admin", { write: true }); if (g.res) return g.res; const ctx = g.ctx; const { id } = await params; if (!ok(id)) return Response.json({ error: "unknown provider" }, { status: 404 });
14 const k = await revealKey(ctx.orgId, id as ProviderId); if (!k) return Response.json({ error: "no credential stored" }, { status: 404 });
15 const v = await verifyKey(id as ProviderId, k);
16 await db().prepare("UPDATE credentials SET status=?, verified_at=? WHERE provider=? AND org_id=?").run(v.status, v.status === "verified" ? new Date().toISOString() : null, id, ctx.orgId);
17 await auditT(ctx, "credential.verify", id, { status: v.status }); return Response.json({ ok: true, ...v });
18}
19export async function DELETE(_: Request, { params }: { params: Promise<{ id: string }> }) {
20 const g = await tenant("admin", { write: true }); if (g.res) return g.res; const ctx = g.ctx; const { id } = await params; if (!ok(id)) return Response.json({ error: "unknown provider" }, { status: 404 });
21 await db().prepare("DELETE FROM credentials WHERE provider=? AND org_id=?").run(id, ctx.orgId); await auditT(ctx, "credential.delete", id); return Response.json({ ok: true });
22}
23

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 692573d on master.

Approval requests

None pending.