Wire encoding for the HTTP gateway.
One dumb, deterministic boundary: engine EDN -> JSON. Keyword/symbol
keys become snake_case strings (namespace dropped), keyword values
become their name, non-JSON leaves fall back to str. The walker
makes ZERO semantic decisions - no flattening, no rendering. Canonical
IR vectors pass through structurally ([:ir {...} ...] ->
["ir", {...}, ...]), which is exactly the ALWAYS-IR contract:
the client walks IR; the gateway never renders.
Wire encoding for the HTTP gateway.
One dumb, deterministic boundary: engine EDN -> JSON. Keyword/symbol
keys become snake_case strings (namespace dropped), keyword values
become their name, non-JSON leaves fall back to `str`. The walker
makes ZERO semantic decisions - no flattening, no rendering. Canonical
IR vectors pass through structurally (`[:ir {...} ...]` ->
`["ir", {...}, ...]`), which is exactly the ALWAYS-IR contract:
the client walks IR; the gateway never renders.(->wire x)Recursively convert an engine value into JSON-encodable data.
Recursively convert an engine value into JSON-encodable data.
(bounded-pr x limit)Bounded pr-str for tool results / errors riding events. Protects the
event log and SSE frames from multi-megabyte values.
Bounded `pr-str` for tool results / errors riding events. Protects the event log and SSE frames from multi-megabyte values.
(bounded-str s limit)Bounded plain-string clamp for an ALREADY-rendered value (e.g. the
model-facing render-form-value string) — same megabyte protection as
bounded-pr but WITHOUT re-pr-str'ing, so the string rides the wire
verbatim instead of quoted/escaped.
Bounded plain-string clamp for an ALREADY-rendered value (e.g. the model-facing `render-form-value` string) — same megabyte protection as `bounded-pr` but WITHOUT re-`pr-str`'ing, so the string rides the wire verbatim instead of quoted/escaped.
(json-str x)Encode any engine value as a JSON string via ->wire.
Encode any engine value as a JSON string via [[->wire]].
(json-str-pretty x)Pretty-printed (2-space indent) JSON via ->wire — for
HUMAN-facing surfaces (the web ctx rail's trailer view), never the
wire itself.
Pretty-printed (2-space indent) JSON via [[->wire]] — for HUMAN-facing surfaces (the web ctx rail's trailer view), never the wire itself.
(parse-json s)Parse a JSON request body into keyword-keyed Clojure data. Returns nil on blank or malformed input (callers map that to 400).
Parse a JSON request body into keyword-keyed Clojure data. Returns nil on blank or malformed input (callers map that to 400).
(sse-frame {:keys [seq type] :as event})Render one event map as an SSE frame. The event's :seq doubles as
the SSE id: so Last-Event-ID reconnects resume losslessly.
Render one event map as an SSE frame. The event's `:seq` doubles as the SSE `id:` so `Last-Event-ID` reconnects resume losslessly.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |