kunibert
All repositories: gitoria
3.2 KB
\* hl:http1 — module exports beside the class surface (NativeHttpServer,NativeWebSocketServer, Response, WsClient in their own files). *\\* Bind a plain HTTP/1.1 listener; answers the request event source. *\listen(Number port \\ the port to bind) {return __native("http1.listen", port)}\* The full-featured constructor: interface, TLS pair, worker count. *\create_server(Number port \\ the port to bindString host = '0.0.0.0' \\ the interfaceString cert = null \\ PEM certificate path — with key, serve httpsString key = null \\ PEM key pathNumber threads = 4 \\ I/O worker threadsNumber maxBody = 20971520 \\ largest request body read, bytes; over it: 413Boolean wsCheckOrigin = false \\ 403 a WebSocket upgrade with a foreign OriginString wsOrigins = "" \\ extra allowed origins, comma-separated) {return __native("http1.create_server", port, host, cert, key, threads, maxBody, wsCheckOrigin, wsOrigins)}\* A cookie-grade random token: n lowercase hex characters read from theKERNEL's CSPRNG, never a seeded PRNG — a session id is the only thingbetween a stranger and someone else's session (hl:math's random() is aclock-seeded xoshiro whose state a handful of outputs reveal). Lives herebecause the session cookie is an HTTP artifact. *\randomToken(Number n \\ how many hex characters) {return __native("http1.random_token", n)}\* SERVER-SENT EVENTS (ticket #144) — the push channel, imported by name like anyother export: import { sseStart, sseSend } from 'hl:http1'. A static or a methodcalls them; the browser build of a file that imports them binds each to a refusalthat throws only if the browser CALLS it (hl:http1 ships no browser half).let conn = sseStart(req.respond) \\ the GET is now a text/event-streamsseSend(conn, JSON.stringify(row)) \\ one `data:` frame to that clientA stream lives until its client goes: hl:http1 reaps a closed one at once (FIN) orat the next ":" heartbeat (every 5 s), and a push to it answers false. Plain HTTPonly — on hl:http1's own TLS, sseStart answers null (end TLS in a proxy). *\\* Turn this request into a Server-Sent Events stream: writes the 200text/event-stream head and keeps the socket open. Answers the CONNECTION ID theother sse calls address, or null when the request was already answered (or is TLS). *\sseStart(Hybrid respond \\ the request's respond handle: req.respond) {return respond.call("sse_start")}\* One frame to one stream: `data: <text>` and the blank line. A text withnewlines continues the frame (a line after the first is its own field, e.g.'id: 42'). Answers true when it was written, false when that stream is gone. *\sseSend(Number conn \\ the id sseStart answeredString text \\ the frame's data, usually JSON.stringify(...)) {return __native("http1.sse_send", conn, text) == 1}\* The same frame to every open stream; answers how many got it. *\sseBroadcast(String text \\ the frame's data) {return __native("http1.sse_broadcast", text)}\* Is the stream still open? Asks the registry, pushes nothing. *\sseAlive(Number conn \\ the id sseStart answered) {return __native("http1.sse_alive", conn) == 1}\* How many streams are open now. *\sseCount() {return __native("http1.sse_count")}
Branches
Latest commits
- 401df4e8Records: review user logged inmre
- 6ca681b3Records: login command, status cleanupmre
- 6b8d763cRecords: review user, device login startedKunibert
- 07025b99Open the job worktree read-only for the review user before each model runKunibert
- 2a44bd54Runner CLI: --review-user/--codex-bin/--work-dir work in every modeKunibert
- 2177f66fReview model runs as its own unix user (reviewUser, codexBin, workDir)Kunibert
- 35df8306Records: live service on byrodin, real proof part 1Kunibert
- 7480a98dkunibert.service: SIGTERM stop is a clean exitKunibert
- 3a8d93f9gitoria client: parse only JSON answers, accept a plain-text errorKunibert
- c9b48bfeVendor Hybriel plugins; deploy ships bin/ from zig-outKunibert
- a41ba15fKunibert: event intake, git cache, review runner, posting, linked tickets, deploy filesKunibert