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/lib/config.ts
1// Central, domain-portable endpoint configuration. Nothing in the app, database or agent protocol embeds a hostname.2// Resolution order per key: environment variable > settings row `config.<KEY>` (editable by the admin over HTTPS) > derived from the incoming request.3import { headers } from "next/headers";4import { getSetting } from "./db";56export const CONFIG_KEYS = ["PUBLIC_BASE_URL", "CONSOLE_BASE_URL", "API_BASE_URL", "GATEWAY_BASE_URL", "PACKAGE_BASE_URL", "ASSET_BASE_URL", "OIDC_ISSUER", "OIDC_REDIRECT_URI", "ALLOWED_ORIGINS", "COOKIE_DOMAIN", "COOKIE_SAMESITE"] as const;7export type ConfigKey = (typeof CONFIG_KEYS)[number];8export type Resolved = { value: string; source: "env" | "settings" | "derived" | "unset" };910const URL_KEYS = new Set<ConfigKey>(["PUBLIC_BASE_URL", "CONSOLE_BASE_URL", "API_BASE_URL", "GATEWAY_BASE_URL", "PACKAGE_BASE_URL", "ASSET_BASE_URL", "OIDC_ISSUER", "OIDC_REDIRECT_URI"]);11/** Validate a candidate value. URLs must be https (http allowed only for loopback); origins list is comma-separated origins. */12export function validate(key: ConfigKey, v: string): string | null {13 if (v === "") return null;14 if (key === "COOKIE_SAMESITE") return ["lax", "strict"].includes(v) ? null : "must be lax or strict (none is not allowed)";15 if (key === "COOKIE_DOMAIN") return /^\.?[a-z0-9]([a-z0-9.-]{0,251}[a-z0-9])?$/i.test(v) && v.includes(".") ? null : "must be a registrable domain such as example.com";16 const urls = key === "ALLOWED_ORIGINS" ? v.split(",").map(s => s.trim()).filter(Boolean) : [v];17 for (const u of urls) { try { const x = new URL(u); const loop = ["localhost", "127.0.0.1"].includes(x.hostname); if (x.protocol !== "https:" && !(loop && x.protocol === "http:")) return `${u}: https required`; if (key === "ALLOWED_ORIGINS" && x.origin !== u.replace(/\/$/, "")) return `${u}: must be a bare origin`; } catch { return `${u}: not a valid URL`; } }18 return null;19}2021async function derivedBase(): Promise<string> {22 const h = await headers(); const host = (h.get("host") || "localhost").replace(/:\d+$/, ""); const https = h.get("x-zcs-proto") === "https";23 return https ? `https://${h.get("host") || host}` : `https://${host}:${process.env.STUDIO_HTTPS_PORT || 8443}`;24}25export async function resolveConfig(): Promise<Record<ConfigKey, Resolved>> {26 const base = await derivedBase(); const out = {} as Record<ConfigKey, Resolved>;27 for (const k of CONFIG_KEYS) {28 const env = process.env[k]; if (env) { out[k] = { value: env, source: "env" }; continue; }29 const st = await getSetting(`config.${k}`, ""); if (st) { out[k] = { value: st, source: "settings" }; continue; }30 const pub = out.PUBLIC_BASE_URL?.value ?? base;31 const d: Partial<Record<ConfigKey, string>> = { PUBLIC_BASE_URL: base, CONSOLE_BASE_URL: `${pub}/console`, API_BASE_URL: `${pub}/api`, GATEWAY_BASE_URL: `${pub}/gateway`, PACKAGE_BASE_URL: `${pub}/packages`, ASSET_BASE_URL: `${pub}/design-assets`, OIDC_REDIRECT_URI: `${pub}/api/auth/oidc/callback`, ALLOWED_ORIGINS: "", COOKIE_SAMESITE: "lax" };32 out[k] = d[k] !== undefined && d[k] !== "" ? { value: d[k]!, source: "derived" } : { value: "", source: "unset" };33 }34 return out;35}36export async function allowedOrigins(): Promise<string[]> { return (await getSetting("config.ALLOWED_ORIGINS", process.env.ALLOWED_ORIGINS ?? "")).split(",").map(s => s.trim().replace(/\/$/, "")).filter(Boolean); }37export async function cookieConfig() {38 const domain = process.env.COOKIE_DOMAIN || (await getSetting("config.COOKIE_DOMAIN", "")) || undefined; const s = process.env.COOKIE_SAMESITE || (await getSetting("config.COOKIE_SAMESITE", "lax"));39 return { domain, sameSite: (s === "strict" ? "strict" : "lax") as "lax" | "strict", secure: true as const, httpOnly: true as const, path: "/" };40}41
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.