Files
time/quc/dev.mjs
T
teahubxyzandClaude Opus 5.5 84bf73bc83 quc v0 (4/4): tests, dev server, deploy, pipeline
15 tests (the run end to end against a fake GitHub tarball, safeword, the three phrases, veto revert, owner-only API, cross-site refusal, daily cap). dev.mjs takes POST bodies and a memory store. deploy.py creates the time-quc KV namespace and binds the Venice key as a Worker secret. quc.yml tests and deploys on main and skips the deploy until CLOUDFLARE_API_TOKEN is staged; ci.yml runs the quc tests on PRs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EVg99kQMY2Tumhobuyg7Fm
2026-10-22 18:15:15 +00:00

17 lines
972 B
JavaScript

// Run the Worker locally: `npm start` in quc/, then http://localhost:8787/
// Without VENICE_API_KEY in the environment the agent gives canned offline answers; with it, it uses the real models.
import { createServer } from "node:http";
import worker from "./src/worker.js";
import { memoryStore } from "./src/runs.js";
const env = { REV: "dev", KV: memoryStore(), VENICE_API_KEY: process.env.VENICE_API_KEY || "" };
createServer(async (q, s) => {
const chunks = [];
for await (const c of q) chunks.push(c);
const body = chunks.length && q.method !== "GET" && q.method !== "HEAD" ? Buffer.concat(chunks) : undefined;
const r = await worker.fetch(new Request(`http://${q.headers.host}${q.url}`, { method: q.method, headers: q.headers, body }), env);
s.writeHead(r.status, Object.fromEntries(r.headers));
s.end(Buffer.from(await r.arrayBuffer()));
}).listen(process.env.PORT || 8787, () => console.log(`quc on http://localhost:${process.env.PORT || 8787}/`));