antcolony
All repositories: gitoria
1.0 KB
// AgentServer.hl — the scheduler's door for its agents (mission 035, antcolony#14): a tiny HTTP server (hl:http1) that// hands every request to `handler(method, path, body, authorization)` and answers { status, body } as JSON. As a class// file, so the daemon can give it a closure over its own state: `new AgentServer(port = …, host = …, handler = fn)`.// Hybriel has no WebSocket CLIENT (hybriel#109), so agents connect OUT with plain HTTPS requests (agent.hl): the agent// asks, the scheduler answers — no connection is held open, a dropped one breaks nothing.import { NativeHttpServer, Response } from 'hl:http1'Number port = 0String host = '127.0.0.1'Function handler = nullhttp = new NativeHttpServer(port = port, host = host)on http.request(req) {let auth = req.headers['authorization']if (auth == null) { auth = req.headers['Authorization'] }let out = handler(req.method, req.path, req.body, auth)return new Response(JSON.stringify(out.body), { status = out.status headers = { 'Content-Type' = 'application/json' } })}
Branches
- mainmain branch
Latest commits
- 3a4d0324antcolony#37: a too-long report gets up to 3 fix tries, finished work is never thrown away for lengthmre
- a6af7883tracker: worker box sees calendar.worldapi.org (login to copy)mre
- c613d26btemplates: bridges to external components (login.js for ident's selector) are allowed (creator 2026-09-27)mre
- 9062978ctracker: worker box sees /media/STORAGE/projects/old-tracker read-only (tracker#2 source data)mre
- 7f9660eeState of 2026-09-27, before the move to gitoriamre