Console endpoints
HTTP and event-stream routes served by the reference holon console, plus specified task-runner endpoints.
GET /robots.txt
GET /?k=<key>
GET /api/state
POST /api/say Accept: text/event-stream | application/json
POST /api/profile-checks Accept: text/event-stream | application/json
POST /api/explore Accept: text/event-stream | application/jsonOverview
The reference console (server.mjs) serves static UI assets and a small HTTP API over loopback 127.0.0.1 (default port 4981). Reference: server.mjs In local mode, every browser shares one 'local' session. In public mode (HOLON_CONSOLE_PUBLIC=1), every route other than GET /robots.txt and GET /?k=<key> requires a valid signed hk session cookie; any unauthenticated request receives 404 Not found. Reference: server.mjs Reference: public.mjs
Live run updates and reply chunks stream over POST when the caller sends Accept: text/event-stream (q=0 declines streaming; media types are compared case-insensitively). Reference: server.mjs There is no GET event stream because some proxies hold a GET event stream until the response finishes, whereas a POST response passes through chunk by chunk. Reference: server.mjs House note: three-service holon Holon rules §4
| Method | Path | Purpose | Auth in public mode | Response |
|---|---|---|---|---|
GET | /robots.txt | Disallow indexing by crawlers | None | 200 text/plain |
GET | /?k=<key> | Exchange access key for session cookie | Key query parameter | 303 redirect to / or 404 |
GET | /api/state | Snapshot of profile, rules, metrics, runs, and prices | hk session cookie | 200 application/json |
POST | /api/say | Run the message flow for one visitor turn | Cookie + same-origin JSON | 200 JSON or SSE stream |
POST | /api/profile-checks | Run the organisation battery on evidence | Cookie + same-origin JSON | 200 JSON or SSE stream |
POST | /api/explore | Propose attributes for a new entity type | Always off (409) | 200 JSON or SSE stream (local) |
The console also serves static assets (/, /console.css, /console.js, /money.js, /decidr-mark.svg, /glyph-organisation.svg, and the bundled font files), gated behind the same hk cookie in public mode. Reference: server.mjs
Inputs
Every incoming request passes through shared transport checks in server.mjs:
- Target parsing: malformed request URLs (such as
//) return400 Bad request. Reference: server.mjs - Same-origin JSON guard: in public mode, every
POST /api/*request must include anOriginheader matching the requestHost(orHOLON_PUBLIC_ORIGIN) andContent-Type: application/json; otherwise the server returns403 { "ok": false, "error": "forbidden" }. Reference: server.mjs Reference: public.mjs - Admission before body read:
admitAndRunenforces concurrency caps before reading the request stream: one flow per session (429), two concurrent flows per hashed client address (429), and four concurrent flows across all sessions (503). Active sessions cap at300, evicting the oldest idle session or returning503if all are busy. Reference: server.mjs Reference: public.mjs - Body size and deadline:
readJsoncaps request bodies at4,096bytes (413), enforces a5,000 msread deadline (408), and rejects invalid JSON (400). Reference: server.mjs Reference: public.mjs - Client abort: if the caller closes the connection mid-stream, an
AbortControllercancels further model calls and frees the slot at once. Reference: server.mjs Reference: flow.mjs
Outputs
All responses carry SECURITY_HEADERS. Reference: server.mjs Reference: public.mjs Streamed POST responses set Content-Type: text/event-stream, Cache-Control: no-cache, no-store, no-transform, and X-Accel-Buffering: no, and open with a 2,048-space comment frame (: open ...) to flush intermediate buffers. Reference: server.mjs
Each SSE frame is a JSON object prefixed with data: and terminated by a blank line:
Event type | Payload fields | Emitted when |
|---|---|---|
run.start | run (id, kind, title, at, steps, status, quote) | A flow run begins |
run.quote | runId, quote, reason | Screened visitor quote is revealed or withheld |
run.step | runId, step (name, status, task_type, variant, price_cents, raw_cost_micro, plus step details) | A step starts, completes, stops, or fails |
reply.delta | runId, text | Each reply chunk streams (in default reviewed mode, only after checks pass) |
reply.done | runId, text | Final approved reply settles |
run.done | runId, run (status, ms, cost_micro_usd, price_cents) | Run finishes or aborts |
metrics | metrics (tasks, checks, withPerson, spendMicro, billedCents) | Session totals update |
result | Mirrors the JSON return payload (ok, reply, runId, etc.) | Final frame before the stream closes |
The console UI (console.js) consumes these frames live and calls GET /api/state afterwards to stay in sync after reloads or dropped streams. Reference: console.js Note that while the reference console exposes raw_cost_micro and cost_micro_usd for its local raw-cost toggle, public visitor deployments should keep internal cost telemetry on a loopback inspector port. Reference: console.js Holon rules §1.3 Wireframe review C1
Topics
GET /api/state
GET /api/state HTTP/1.1
Cookie: hk=<sid>.<exp>.<sig>Returns the session's current snapshot as JSON: profile, rules (id, label, task, atLeast, effect), metrics, runs (the 30 most recent runs), exploreOn, talkOn, taskTypes (public name and variant price map), public, and paused. Reference: server.mjs Reference: flow.mjs
Errors: 404 without a valid session cookie in public mode; 503 (limited: "sessions") if all 300 sessions are busy. Reference: server.mjs
POST /api/say
POST /api/say HTTP/1.1
Content-Type: application/json
Accept: text/event-stream
{"text":"What services do you offer?"}Runs the seven-step message flow (receive, screen, checks, rules, reply, review, stored). Reference: flow.mjs The server ignores any client-supplied threadId and binds every session to its own 'main' thread. Reference: server.mjs
- Success (JSON or final
resultframe):{ "ok": true, "reply": "...", "runId": "<id>" }. If the holon is paused, returns200 { "ok": true, "reply": "The holon is resting for today. Please come back tomorrow.", "paused": true }without running the flow. Missingtextreturns200 { "ok": false, "error": "text is required" }; empty text after cleaning returns200 { "ok": false, "error": "empty message" }. Reference: server.mjs Reference: flow.mjs Reference: guards.mjs - Errors and limits:
400(bad JSON),403(cross-origin or non-JSON in public mode),404(no session),408(body deadline),413(body over4,096bytes),429(limited:"one_at_a_time","address_concurrent", or"messages"),503(limited:"concurrent"or"sessions"). Public rate limits:20messages per10minutes per session,40per10minutes per address, and500per24hours across the console. Reference: server.mjs Reference: public.mjs
POST /api/profile-checks
POST /api/profile-checks HTTP/1.1
Content-Type: application/json
Accept: text/event-stream
{}Runs ORG_SEED against the holon's evidence file, emitting checks and stored steps. Reference: flow.mjs
- Success:
{ "ok": true, "runId": "<id>" }(orok: falseif the decisions service fails). When paused, returns200 { "ok": false, "paused": true }. Reference: server.mjs Reference: flow.mjs - Errors and limits:
400,403,404,408,413,429(limited:"profile","one_at_a_time", or"address_concurrent"),503. Public rate limits:1run per10minutes per session and12runs per24hours overall. Reference: server.mjs Reference: public.mjs
POST /api/explore
POST /api/explore HTTP/1.1
Content-Type: application/json
{"entityType":"wind turbine"}Asks the frontier exploration service to propose filterable attributes for a new entity type (trimmed to 80 characters) and records the output with review: "proposed" so a person can sign it off later. Reference: flow.mjs Reference: holon.mjs
- Availability: disabled unless
HOLON_AGENTS=onlocally, and always off in public mode. When in public mode or paused, returns409 { "ok": false, "off": true }. WhenHOLON_AGENTSis not enabled locally, returns200 { "ok": false, "off": true, "error": "Explore is off" }. Reference: server.mjs Reference: flow.mjs - Errors:
400,403,404,408,409,413,429,503. Reference: server.mjs
GET /?k=<key>
GET /?k=<access-key> HTTP/1.1Public mode entry point. Checks k in constant time against HOLON_CONSOLE_KEY_FILE. A valid key returns 303 with a relative Location: / header and a signed HttpOnly hk cookie. Reference: server.mjs Reference: public.mjs Holon rules §4 An invalid key increments the per-address counter and returns 404; 10 wrong keys within 10 minutes lock that address out of /?k= with 404 for the remainder of the window. Reference: server.mjs Reference: public.mjs
GET /robots.txt
GET /robots.txt HTTP/1.1Accessible without a session cookie even in public mode. Returns 200 text/plain; charset=utf-8 with a wildcard disallow policy (Disallow: /) so crawlers do not index shared consoles. Reference: server.mjs
Specified, not yet built
The Function holon specification defines two additional routes that are specified and not yet implemented in server.mjs: Wireframe review C3
POST /api/task-step(SSE overPOST, specified only): runs one Delivery task-type step (intakecode-onlyReadscrubbing PII and Australian TFNs ->considervia a Delivery request battery and optional reviewed reasoning ->select). Autonomous AI Specialist tasks (such asClassify email into a Request) validate against the controlled choice list and record one immutable cell;AI Specialist, person confirmstasks (such asResolve client) andPersontasks (such asApprove invoice) stop deterministically athold_for_reviewand hand off to a person. Wireframe review C3 Wireframe review C5POST /api/task-confirm(JSON or SSE overPOST, specified only): accepts a person'sConfirm,Change, orNot applicabledecision alongside a mandatory non-empty reasoning string for reasoned tasks, validates controlled-choice membership, records an immutableselectedorapprovedevent, and updates the session feed card and counters. Wireframe review C3 Ruling 27