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/gates.ts
1// Customer activation gates. Pass/fail is computed from live checks and recorded test evidence, never from typed attestations.2// Controlled activation: even when every gate passes, customers are admitted only for ORGANIZATIONS the platform owner explicitly lists (no public registration).3import fs from "node:fs";4import path from "node:path";5import { db, getSetting, setSetting, asSystem } from "./db";6import { verifyAudit } from "./audit";7const EV = path.resolve(process.cwd(), "../design/verification");8const ev = (name: string) => { try { const j = JSON.parse(fs.readFileSync(path.join(EV, name + ".json"), "utf8")); const total = Number(j.total ?? (Number(j.passed) + Number(j.failed ?? 0))); const failed = j.failed !== undefined ? Number(j.failed) : total - Number(j.passed); const when = j.finished ?? j.at ?? ""; const age = Date.now() - Date.parse(when); return { ok: failed === 0 && Number(j.passed) > 0 && age < 30 * 86400_000, passed: Number(j.passed), failed, total, finished: when as string | null, scope: j.scope as string | undefined }; } catch { return { ok: false, passed: 0, failed: -1, total: 0, finished: null as string | null, scope: undefined }; } };9export const emergencyStopped = async () => (await getSetting("emergency_stop", "0")) === "1";10export async function activationOrgs(): Promise<string[]> { try { const a = JSON.parse(await getSetting("security.activation_orgs", "[]")); return Array.isArray(a) ? a.filter((x: unknown) => typeof x === "string") : []; } catch { return []; } }11export const setActivationOrgs = (ids: string[]) => setSetting("security.activation_orgs", JSON.stringify([...new Set(ids)]));12export type Gate = { id: string; title: string; pass: boolean; detail: string; evidence?: string };13export async function gateReport(): Promise<{ gates: Gate[]; allPass: boolean }> {14 const t = ev("trusted-https"), ti = ev("tenant-isolation"), rls = ev("rls"), ow = ev("owner-auth"), g = ev("gates"), df = ev("deploy-flow");15 const rlsLive = await asSystem(async () => Number((await db().prepare("SELECT COUNT(*) n FROM pg_class WHERE relname IN ('projects','node_jobs','app_deployments','app_releases','domains','nodes','instances') AND relrowsecurity").get() as any).n));16 const caps = await asSystem(async () => await db().prepare("SELECT COUNT(*) n FROM organizations WHERE ai_monthly_cap_usd<=0 OR max_apps<=0 OR max_deploys_per_day<=0").get() as any); const au = await verifyAudit();17 const gates: Gate[] = [18 { id: "trusted-https", title: "Trusted HTTPS", pass: t.ok, detail: t.ok ? `${t.passed} checks passed` : "no passing trusted-HTTPS evidence", evidence: "trusted-https.json" },19 { id: "rls", title: "PostgreSQL RLS", pass: rls.ok && rlsLive === 7, detail: `${rlsLive}/7 key tables enforce RLS; suite ${rls.passed}/${rls.total}`, evidence: "rls.json" },20 { id: "tenant-isolation", title: "Tenant and resource isolation", pass: ti.ok, detail: `${ti.passed} checks`, evidence: "tenant-isolation.json" },21 { id: "spending", title: "Tenant spending and quota limits", pass: g.ok && Number(caps.n) === 0, detail: Number(caps.n) === 0 ? "every organization has AI-spend, app and daily-deploy limits; enforcement tested" : `${caps.n} organizations without limits`, evidence: "gates.json" },22 { id: "job-isolation", title: "Job execution isolation (per-node, per-tenant, serialized)", pass: g.ok && df.ok, detail: "one active job per node; payloads bound to node+org; forged/foreign jobs refused", evidence: "gates.json" },23 { id: "emergency-stop", title: "Emergency stop enforced", pass: g.ok, detail: "engaged stop blocks deployments, domain changes and job delivery", evidence: "gates.json" },24 { id: "secrets", title: "Secure credential handling (encrypted at rest, scrubbed from jobs, redacted from logs/audit)", pass: g.ok, detail: "tested", evidence: "gates.json" },25 { id: "agent-auth", title: "Agent authorization", pass: ti.ok && df.ok && g.ok, detail: "tenant-bound enrollment, per-node credential, rotation, revocation", evidence: "deploy-flow.json" },26 { id: "auth-session", title: "Authentication and session security", pass: ow.ok, detail: `${ow.passed} checks`, evidence: "owner-auth.json" },27 { id: "audit", title: "Audit integrity (hash chain verified live)", pass: au.ok, detail: `${au.count} entries${au.ok ? "" : `, broken at ${au.brokenAt}`}` },28 ];29 return { gates, allPass: gates.every(x => x.pass) };30}31/** Is this organization admitted? dev-override admits all (test hook); otherwise trusted-TLS mode requires an explicit allowlist entry. */32export async function orgAdmitted(orgId: string): Promise<boolean> {33 if ((await getSetting("security.dev_customer_ops", "0")) === "1") return true;34 if ((await getSetting("security.trusted_tls", "0")) !== "1") return false;35 return (await activationOrgs()).includes(orgId);36}37export async function userAdmitted(userId: string): Promise<boolean> {38 const rows = await asSystem(() => db().prepare("SELECT org_id FROM memberships WHERE user_id=?").all(userId)) as { org_id: string }[];39 for (const r of rows) if (await orgAdmitted(r.org_id)) return true; return false;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.