Liking cljdoc? Tell your friends :D

hive-compose.api

The control API's request/response layer (card hc-14). Pure apart from the dispatch fn it is handed: (method, path, body) -> {:status :headers :body}.

POST /v1/{command} with a JSON object body = the compose MCP tool's params minus command, run through the SAME dispatch the tool runs (hive-compose.addon/dispatch). The answer is the hive-cabi/v1 envelope, {ok:true,value} | {ok:false,error,..rest of the Result error map}, with the error category QUALIFIED ("compose/held-by-another-section"); the MCP tool text keeps today's bare name. GET /v1/health and GET /v1/openapi.yaml (the spec in resources/hive_compose/openapi.yaml) are the two reads.

HTTP status per category (status-by-category), 200 for ok. The body is always the envelope, so a client may ignore the code, as hive_call does.

The control API's request/response layer (card hc-14). Pure apart from the
dispatch fn it is handed: (method, path, body) -> {:status :headers :body}.

POST /v1/{command} with a JSON object body = the `compose` MCP tool's params
minus `command`, run through the SAME dispatch the tool runs
(`hive-compose.addon/dispatch`). The answer is the hive-cabi/v1 envelope,
{ok:true,value} | {ok:false,error,..rest of the Result error map}, with the
error category QUALIFIED ("compose/held-by-another-section"); the MCP tool
text keeps today's bare name. GET /v1/health and GET /v1/openapi.yaml (the
spec in resources/hive_compose/openapi.yaml) are the two reads.

HTTP status per category (`status-by-category`), 200 for ok. The body is
always the envelope, so a client may ignore the code, as hive_call does.
raw docstring

browser-guardclj

(browser-guard method hs)

nil when request headers hs (lower-cased names) may reach the API, else the refusal. Loopback binding does not stop a web page: it can POST a text/plain body without a preflight, and DNS rebinding lets it read the answer. So the Host must be a loopback name, an Origin, when sent, must be one too, and a POST must be application/json (which forces a CORS preflight this server never grants).

nil when request headers `hs` (lower-cased names) may reach the API, else
the refusal. Loopback binding does not stop a web page: it can POST a
`text/plain` body without a preflight, and DNS rebinding lets it read the
answer. So the Host must be a loopback name, an Origin, when sent, must be
one too, and a POST must be `application/json` (which forces a CORS
preflight this server never grants).
sourceraw docstring

callclj

(call {:keys [dispatch] :as deps} command params)

Result of command with params through dispatch ((command params) -> Result, the MCP tool's contract), after known-op, so a planned or unknown op does not depend on the addon's lifecycle. A throw is answered, never propagated.

Result of `command` with `params` through `dispatch` ((command params) ->
Result, the MCP tool's contract), after `known-op`, so a planned or unknown
op does not depend on the addon's lifecycle. A throw is answered, never
propagated.
sourceraw docstring

category-strclj

(category-str k)

A category keyword as the API writes it: ns/name, or name when bare.

A category keyword as the API writes it: ns/name, or name when bare.
sourceraw docstring

check-paramsclj

(check-params declared params)
(check-params declared known params)

Result<params>: params when every key is one command reads (known, addon/command-params) and every one the tool declares (declared, the tool's inputSchema properties, string names to {:type ..}) has that JSON type, else an invalid-param naming the first that is not. An unknown key is refused rather than dropped: a typo (runn for run) on stack-down would otherwise take down every run of the stack. A nil known (no table) checks types only.

Result<params>: `params` when every key is one `command` reads (`known`,
addon/command-params) and every one the tool declares (`declared`, the
tool's inputSchema properties, string names to {:type ..}) has that JSON
type, else an invalid-param naming the first that is not. An unknown key
is refused rather than dropped: a typo (runn for run) on stack-down would
otherwise take down every run of the stack. A nil `known` (no table)
checks types only.
sourceraw docstring

configclj

(config cfg)

The API config of addon config cfg: defaults under :compose/api.

The API config of addon config `cfg`: `defaults` under `:compose/api`.
sourceraw docstring

defaultsclj

:compose/api config, off by default. :port 0 binds an ephemeral port (status answers the bound one); :host must be a loopback address.

`:compose/api` config, off by default. :port 0 binds an ephemeral port
(`status` answers the bound one); :host must be a loopback address.
sourceraw docstring

encodeclj

(encode x)

JSON text of x, slashes unescaped (compose/x, not compose/x).

JSON text of `x`, slashes unescaped (compose/x, not compose\/x).
sourceraw docstring

envelopeclj

(envelope res)

The hive-cabi/v1 envelope of Result res.

The hive-cabi/v1 envelope of Result `res`.
sourceraw docstring

http-statusclj

(http-status res)

200 for an ok Result, else the status of its category (500 when unmapped).

200 for an ok Result, else the status of its category (500 when unmapped).
sourceraw docstring

known-opclj

(known-op {:keys [commands]} command)

Result<command>: command when commands (deps) holds it, else not-implemented for a planned op and unknown-command for anything else. Checked before the body, so /v1/bogus is 404 whatever it is sent.

Result<command>: `command` when `commands` (deps) holds it, else
not-implemented for a planned op and unknown-command for anything else.
Checked before the body, so /v1/bogus is 404 whatever it is sent.
sourceraw docstring

parse-paramsclj

(parse-params body)

Result<params>: the request body as the tool's params (string keys; a command key is dropped, the path names the command). A blank body is {}. Anything but a JSON object is an invalid-param.

Result<params>: the request body as the tool's params (string keys; a
`command` key is dropped, the path names the command). A blank body is {}.
Anything but a JSON object is an invalid-param.
sourceraw docstring

plannedclj

Path segment -> hive_call op of the paths the spec marks x-status planned (plan 20261122140443-09c5c225). Answered 501 until they are implemented.

Path segment -> hive_call op of the paths the spec marks x-status planned
(plan 20261122140443-09c5c225). Answered 501 until they are implemented.
sourceraw docstring

qualify-errorsclj

(qualify-errors x)

x with every keyword under an :error key, at any depth, written as its qualified string, so the wire keeps the category's namespace. Every other key and value is left to the encoder (namespaced keys stay bare, as on the MCP wire).

`x` with every keyword under an :error key, at any depth, written as its
qualified string, so the wire keeps the category's namespace. Every other
key and value is left to the encoder (namespaced keys stay bare, as on the
MCP wire).
sourceraw docstring

respondclj

(respond res)
(respond res headers)

{:status :headers :body} answering Result res.

{:status :headers :body} answering Result `res`.
sourceraw docstring

routeclj

(route deps req)

{:status :headers :body} for one request {:method :path :headers :body} (:headers lower-cased names; :body the request text, nil when it was too large). deps: :dispatch and :commands (see call), :declared (the tool's inputSchema properties) and :params (addon/command-params; absent: no unknown-param check), see check-params, :health (0-arity, the addon health map) and :spec (0-arity, the spec text). Never throws: a throw is answered as the envelope of compose/internal.

{:status :headers :body} for one request {:method :path :headers :body}
(:headers lower-cased names; :body the request text, nil when it was too
large). `deps`: :dispatch and :commands (see `call`), :declared (the tool's
inputSchema properties) and :params (addon/command-params; absent: no
unknown-param check), see `check-params`, :health (0-arity, the addon
health map) and :spec (0-arity, the spec text). Never throws: a throw is
answered as the envelope of compose/internal.
sourceraw docstring

source-categoriesclj

(source-categories root)

Sorted set of every category (ns/name strings) the .clj files under root can answer, by category-forms. Build and test time only: the spec's ErrorCategory enum (doc/api/gen) and the drift tests over status-by-category are this one scan, so they cannot disagree.

Sorted set of every category (ns/name strings) the .clj files under `root`
can answer, by `category-forms`. Build and test time only: the spec's
ErrorCategory enum (doc/api/gen) and the drift tests over
`status-by-category` are this one scan, so they cannot disagree.
sourceraw docstring

spec-textclj

(spec-text)

The OpenAPI document served at GET /v1/openapi.yaml, nil when missing.

The OpenAPI document served at GET /v1/openapi.yaml, nil when missing.
sourceraw docstring

status-by-categoryclj

HTTP status of a Result error category. Every category the source answers with an r/err literal is mapped, which api-test checks against src/; any other answers 500. 400 the request or the stack it names is invalid, 404 a named thing is not there, 409 it conflicts with what runs, 502 a backend (docker, toxiproxy, the trace store) failed, 503 the addon or a backend is not ready or not configured, 500 a fault of the addon itself.

HTTP status of a Result error category. Every category the source answers
with an r/err literal is mapped, which api-test checks against src/; any
other answers 500. 400 the request or the stack it names is invalid, 404 a
named thing is not there, 409 it conflicts with what runs, 502 a backend
(docker, toxiproxy, the trace store) failed, 503 the addon or a backend is
not ready or not configured, 500 a fault of the addon itself.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close