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/qa/ai-adapters.mjs

1// Verifies the Anthropic/OpenAI adapters against LOCAL protocol stubs (SSE format, usage accounting, 429 retry-after, auth failure).
2// This proves our parsing/handling, NOT that real providers accept our calls — that needs real API keys.
3import http from "node:http";
4import { ADAPTERS, ProviderError } from "../scripts/ai-adapters.mjs";
5const results = []; const rec = (n, ok, d = "") => { results.push({ n, ok }); console.log(`${ok ? "PASS" : "FAIL"} ${n}${d ? " — " + d : ""}`); };
6const seen = {};
7const srv = http.createServer((req, res) => {
8 let body = ""; req.on("data", c => body += c); req.on("end", () => {
9 seen[req.url] = { headers: req.headers, body: JSON.parse(body || "{}") };
10 if (req.headers["x-api-key"] === "bad" || req.headers.authorization === "Bearer bad") { res.writeHead(401).end('{"error":"nope"}'); return; }
11 if (req.headers["x-api-key"] === "limited" || req.headers.authorization === "Bearer limited") { res.writeHead(429, { "retry-after": "7" }).end("slow down"); return; }
12 res.writeHead(200, { "content-type": "text/event-stream" });
13 const ev = (t, o) => res.write(`event: ${t}\ndata: ${JSON.stringify(o)}\n\n`);
14 if (req.url === "/v1/messages") { ev("message_start", { type: "message_start", message: { usage: { input_tokens: 11 } } }); for (const w of ["Hel", "lo ", "wor", "ld"]) ev("content_block_delta", { type: "content_block_delta", delta: { type: "text_delta", text: w } }); ev("message_delta", { type: "message_delta", usage: { output_tokens: 4 } }); ev("message_stop", { type: "message_stop" }); res.end(); }
15 else { const d = o => res.write(`data: ${JSON.stringify(o)}\n\n`); for (const w of ["Hel", "lo ", "wor", "ld"]) d({ choices: [{ delta: { content: w } }] }); d({ choices: [], usage: { prompt_tokens: 9, completion_tokens: 4 } }); res.write("data: [DONE]\n\n"); res.end(); }
16 });
17}).listen(0, "127.0.0.1");
18await new Promise(r => srv.once("listening", r)); const baseUrl = `http://127.0.0.1:${srv.address().port}`;
19const run = async (prov, key) => { let text = "", usage = null; for await (const e of ADAPTERS[prov]({ key, model: "m", messages: [{ role: "user", content: "hi" }], baseUrl })) { if (e.text) text += e.text; if (e.usage) usage = e.usage; } return { text, usage }; };
20for (const [prov, path, hdr] of [["anthropic", "/v1/messages", "x-api-key"], ["openai", "/v1/chat/completions", "authorization"]]) {
21 const r = await run(prov, "good"); rec(`${prov}: streamed text reassembled`, r.text === "Hello world", r.text);
22 rec(`${prov}: usage parsed`, prov === "anthropic" ? r.usage?.in === 11 && r.usage?.out === 4 : r.usage?.in === 9 && r.usage?.out === 4);
23 rec(`${prov}: key sent only in the auth header, stream requested`, (seen[path].headers[hdr] ?? "").includes("good") && seen[path].body.stream === true && !JSON.stringify(seen[path].body).includes("good"));
24 try { await run(prov, "limited"); rec(`${prov}: 429 raises`, false); } catch (e) { rec(`${prov}: 429 is retryable and honours retry-after (7000ms)`, e instanceof ProviderError && e.retryable && e.retryAfterMs === 7000); }
25 try { await run(prov, "bad"); rec(`${prov}: 401 raises`, false); } catch (e) { rec(`${prov}: 401 is NOT retryable`, e instanceof ProviderError && e.retryable === false && e.status === 401); }
26}
27srv.close(); const f = results.filter(r => !r.ok).length; console.log(`${results.length - f}/${results.length} adapter checks passed`); process.exit(f ? 1 : 0);
28

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 fb22adb on master.

Approval requests

None pending.