DecidrHolon Design Kit

Technologies and APIs

Console endpoints

HTTP and event-stream routes served by the reference holon console, plus specified task-runner endpoints.

HTTP
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/json

Overview

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

MethodPathPurposeAuth in public modeResponse
GET/robots.txtDisallow indexing by crawlersNone200 text/plain
GET/?k=<key>Exchange access key for session cookieKey query parameter303 redirect to / or 404
GET/api/stateSnapshot of profile, rules, metrics, runs, and priceshk session cookie200 application/json
POST/api/sayRun the message flow for one visitor turnCookie + same-origin JSON200 JSON or SSE stream
POST/api/profile-checksRun the organisation battery on evidenceCookie + same-origin JSON200 JSON or SSE stream
POST/api/explorePropose attributes for a new entity typeAlways 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 //) return 400 Bad request. Reference: server.mjs
  • Same-origin JSON guard: in public mode, every POST /api/* request must include an Origin header matching the request Host (or HOLON_PUBLIC_ORIGIN) and Content-Type: application/json; otherwise the server returns 403 { "ok": false, "error": "forbidden" }. Reference: server.mjs Reference: public.mjs
  • Admission before body read: admitAndRun enforces 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 at 300, evicting the oldest idle session or returning 503 if all are busy. Reference: server.mjs Reference: public.mjs
  • Body size and deadline: readJson caps request bodies at 4,096 bytes (413), enforces a 5,000 ms read deadline (408), and rejects invalid JSON (400). Reference: server.mjs Reference: public.mjs
  • Client abort: if the caller closes the connection mid-stream, an AbortController cancels 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 typePayload fieldsEmitted when
run.startrun (id, kind, title, at, steps, status, quote)A flow run begins
run.quoterunId, quote, reasonScreened visitor quote is revealed or withheld
run.steprunId, step (name, status, task_type, variant, price_cents, raw_cost_micro, plus step details)A step starts, completes, stops, or fails
reply.deltarunId, textEach reply chunk streams (in default reviewed mode, only after checks pass)
reply.donerunId, textFinal approved reply settles
run.donerunId, run (status, ms, cost_micro_usd, price_cents)Run finishes or aborts
metricsmetrics (tasks, checks, withPerson, spendMicro, billedCents)Session totals update
resultMirrors 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

HTTP
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

HTTP
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 result frame): { "ok": true, "reply": "...", "runId": "<id>" }. If the holon is paused, returns 200 { "ok": true, "reply": "The holon is resting for today. Please come back tomorrow.", "paused": true } without running the flow. Missing text returns 200 { "ok": false, "error": "text is required" }; empty text after cleaning returns 200 { "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 over 4,096 bytes), 429 (limited: "one_at_a_time", "address_concurrent", or "messages"), 503 (limited: "concurrent" or "sessions"). Public rate limits: 20 messages per 10 minutes per session, 40 per 10 minutes per address, and 500 per 24 hours across the console. Reference: server.mjs Reference: public.mjs

POST /api/profile-checks

HTTP
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>" } (or ok: false if the decisions service fails). When paused, returns 200 { "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: 1 run per 10 minutes per session and 12 runs per 24 hours overall. Reference: server.mjs Reference: public.mjs

POST /api/explore

HTTP
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=on locally, and always off in public mode. When in public mode or paused, returns 409 { "ok": false, "off": true }. When HOLON_AGENTS is not enabled locally, returns 200 { "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>

HTTP
GET /?k=<access-key> HTTP/1.1

Public 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

HTTP
GET /robots.txt HTTP/1.1

Accessible 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 over POST, specified only): runs one Delivery task-type step (intake code-only Read scrubbing PII and Australian TFNs -> consider via a Delivery request battery and optional reviewed reasoning -> select). Autonomous AI Specialist tasks (such as Classify email into a Request) validate against the controlled choice list and record one immutable cell; AI Specialist, person confirms tasks (such as Resolve client) and Person tasks (such as Approve invoice) stop deterministically at hold_for_review and hand off to a person. Wireframe review C3 Wireframe review C5
  • POST /api/task-confirm (JSON or SSE over POST, specified only): accepts a person's Confirm, Change, or Not applicable decision alongside a mandatory non-empty reasoning string for reasoned tasks, validates controlled-choice membership, records an immutable selected or approved event, and updates the session feed card and counters. Wireframe review C3 Ruling 27

See also