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-onlyapp/src/app/auth/login/route.ts
1import { cookies } from "next/headers";2import { asSystem, db, now } from "@/lib/db";3import { isSecure, httpsBase } from "@/lib/auth";4import { authorizationUrl, newPkce, rand } from "@/lib/oidc-core.mjs";5import { discovery, oidcConfig } from "@/lib/oidc";6export const dynamic = "force-dynamic";7// Starts Authorization Code + PKCE. Sensitive: HTTPS only. Nothing is contacted until a client secret has been provisioned.8export async function GET() {9 if (!(await isSecure())) return Response.json({ error: "sign-in requires HTTPS" }, { status: 403 });10 const cfg = await oidcConfig();11 if (!cfg.configured) return Response.json({ error: "Zoo IAM sign-in is not configured on this deployment (client credentials not provisioned)." }, { status: 503 });12 try {13 const disc = await discovery(cfg.issuer); const state = rand(24), nonce = rand(24), pk = newPkce();14 await asSystem(async () => { await db().prepare("DELETE FROM oidc_requests WHERE created_at < ?").run(Date.now() - 600_000); await db().prepare("INSERT INTO oidc_requests(state,nonce,verifier,created_at) VALUES(?,?,?,?)").run(state, nonce, pk.verifier, Date.now()); });15 (await cookies()).set("zcs_oidc", state, { httpOnly: true, secure: true, sameSite: "lax", path: "/auth", maxAge: 600 }); // binds the flow to THIS browser (login-CSRF defence)16 return Response.redirect(authorizationUrl(disc, { redirectUri: cfg.redirectUri || `${await httpsBase()}/auth/callback`, state, nonce, challenge: pk.challenge, acr: cfg.requireAcr }), 302);17 } catch { return Response.json({ error: "Zoo IAM is unreachable or misconfigured" }, { status: 502 }); }18}19
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 548ed73 on master.
Approval requests
None pending.