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/pwauth-core.mjs
1// Local password authentication primitives (pure). scrypt hashes only; plaintext is never stored. Interim until Zoo IAM is live.2import crypto from "node:crypto";3const N = 16384, R = 8, P = 1, KEYLEN = 64;4export const POLICY = { min: 12, max: 128 };5export function hashPassword(pw) { const salt = crypto.randomBytes(16); const h = crypto.scryptSync(pw, salt, KEYLEN, { N, r: R, p: P }); return `scrypt$${N}$${R}$${P}$${salt.toString("base64url")}$${h.toString("base64url")}`; }6export function verifyPassword(pw, stored) {7 const [alg, n, r, p, salt, hash] = String(stored ?? "").split("$"); if (alg !== "scrypt" || !hash) return false;8 try { const want = Buffer.from(hash, "base64url"); const got = crypto.scryptSync(pw, Buffer.from(salt, "base64url"), want.length, { N: +n, r: +r, p: +p }); return got.length === want.length && crypto.timingSafeEqual(got, want); } catch { return false; }9}10// Equal work for unknown accounts so response timing does not reveal whether an e-mail exists.11const DUMMY = hashPassword("zloud-dummy-password-for-timing");12export const burn = pw => { verifyPassword(pw, DUMMY); };13export function policyError(pw, { email, old } = {}) {14 if (typeof pw !== "string" || pw.length < POLICY.min) return `password must be at least ${POLICY.min} characters`;15 if (pw.length > POLICY.max) return `password must be at most ${POLICY.max} characters`;16 const local = String(email ?? "").split("@")[0].toLowerCase();17 if (local.length >= 4 && pw.toLowerCase().includes(local)) return "password must not contain your e-mail name";18 if ([/[a-z]/, /[A-Z]/, /\d/, /[^A-Za-z0-9]/].filter(r => r.test(pw)).length < 3) return "use at least three of: lowercase, uppercase, digits, symbols";19 if (old && pw === old) return "new password must differ from the temporary one";20 return null;21}22// 32 characters from a 66-symbol alphabet (about 190 bits) with guaranteed class coverage.23export function generatePassword(len = 32) {24 const sets = ["abcdefghijkmnopqrstuvwxyz", "ABCDEFGHJKLMNPQRSTUVWXYZ", "23456789", "-_.!@#"]; const all = sets.join("");25 const pick = s => s[crypto.randomInt(s.length)]; const out = sets.map(pick); while (out.length < len) out.push(pick(all));26 for (let i = out.length - 1; i > 0; i--) { const j = crypto.randomInt(i + 1); [out[i], out[j]] = [out[j], out[i]]; } return out.join("");27}28export const LOCK = { maxFailures: 5, lockMs: 15 * 60 * 1000 };29// Next lockout state after a failed attempt.30export const afterFailure = (failed, now = Date.now()) => { const f = (failed ?? 0) + 1; return f >= LOCK.maxFailures ? { failed: 0, lockedUntil: now + LOCK.lockMs } : { failed: f, lockedUntil: 0 }; };31// ---- TOTP (RFC 6238, SHA-1, 6 digits, 30 s, +-1 step). Enrolment UI is not built yet; verification is enforced for any account with mfa_enabled=1.32const B32 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";33export const b32decode = s => { let bits = 0, v = 0; const out = []; for (const ch of s.replace(/=+$/, "").toUpperCase()) { const i = B32.indexOf(ch); if (i < 0) throw new Error("bad base32"); v = (v << 5) | i; bits += 5; if (bits >= 8) { out.push((v >>> (bits - 8)) & 255); bits -= 8; } } return Buffer.from(out); };34export function totp(secretB32, t = Date.now()) {35 const c = Buffer.alloc(8); c.writeBigUInt64BE(BigInt(Math.floor(t / 30000))); const h = crypto.createHmac("sha1", b32decode(secretB32)).update(c).digest(); const o = h[19] & 15;36 return String((((h[o] & 127) << 24) | (h[o + 1] << 16) | (h[o + 2] << 8) | h[o + 3]) % 1e6).padStart(6, "0");37}38export const verifyTotp = (secretB32, code, t = Date.now()) => /^\d{6}$/.test(String(code)) && [-1, 0, 1].some(d => { const a = Buffer.from(totp(secretB32, t + d * 30000)), b = Buffer.from(String(code)); return a.length === b.length && crypto.timingSafeEqual(a, b); });39
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.