A thin EDN-over-HTTP client for the vaelii daemon (vaelii.impl.serve). Runs no
engine: it POSTs {:op :args} and reads the result back, over JDK java.net.http
(no dependency — JDK 21 ships it).
Every call threads an explicit connection handle as its first argument —
(query conn '(dog ?x) 'Ctx) — the network mirror of vaelii.core's explicit-kb
API. A conn from client holds a reusable HttpClient; no socket opens until a
call. A daemon reply of {:ok false} becomes an ex-info carrying the daemon's
:error and :type, so a remote naming/disjointness refusal surfaces like a local
one.
The bearer token rides on the request the daemon requires it on: the conn
carries it (VAELII_API_TOKEN unless :token says otherwise) and every call sets one
more header on the builder it was already using. No dependency, no client state, and
the conn is still a map you can read.
A thin EDN-over-HTTP client for the vaelii daemon (`vaelii.impl.serve`). Runs no
engine: it POSTs `{:op :args}` and reads the result back, over JDK `java.net.http`
(no dependency — JDK 21 ships it).
Every call threads an **explicit connection handle** as its first argument —
`(query conn '(dog ?x) 'Ctx)` — the network mirror of `vaelii.core`'s explicit-`kb`
API. A `conn` from `client` holds a reusable `HttpClient`; no socket opens until a
call. A daemon reply of `{:ok false}` becomes an `ex-info` carrying the daemon's
`:error` and `:type`, so a remote naming/disjointness refusal surfaces like a local
one.
**The bearer token rides on the request the daemon requires it on**: the `conn`
carries it (`VAELII_API_TOKEN` unless `:token` says otherwise) and every call sets one
more header on the builder it was already using. No dependency, no client state, and
the `conn` is still a map you can read.(assert! conn sentence context)(assert! conn sentence context opts)Assert sentence in context (optional opts) — returns the handle(s).
Assert `sentence` in `context` (optional `opts`) — returns the handle(s).
(assert-rule! conn antecedents consequent context)(assert-rule! conn antecedents consequent context opts)(blocked-justifications conn)The ids of the justifications the daemon's network holds blocked by their rule's exception. The whole set in one call, because the caller asking is rendering a proof tree and a blocked justification is the one thing belief alone does not report.
The ids of the justifications the daemon's network holds blocked by their rule's exception. The whole set in one call, because the caller asking is rendering a proof tree and a blocked justification is the one thing belief alone does not report.
(call conn op args)(call conn op args {:keys [timeout-ms]})POST {:op op :args args} and return the :result, or throw ex-info on an
{:ok false} reply. The low-level entry the convenience fns wrap; use it for an op
with no wrapper yet.
opts is {:timeout-ms n} for this call alone, which only the long :poll needs —
everything else answers inside the conn's own timeout.
POST `{:op op :args args}` and return the `:result`, or throw `ex-info` on an
`{:ok false}` reply. The low-level entry the convenience fns wrap; use it for an op
with no wrapper yet.
`opts` is `{:timeout-ms n}` for this call alone, which only the long `:poll` needs —
everything else answers inside the `conn`'s own timeout.(client host port)(client host port {:keys [timeout-ms] :or {timeout-ms 30000} :as opts})A connection handle to a daemon at host:port (opts: :timeout-ms, default
30000). Holds a reusable HttpClient; no network happens until a call.
:token is the bearer token every call presents. Omitted, it is VAELII_API_TOKEN
(guard/api-token) — the same variable the daemon reads, so a client and a daemon in
one environment agree without either being configured; an explicit nil sends no
Authorization header, which is what an open daemon wants and what a test of the
refusal needs.
A connection handle to a daemon at `host`:`port` (opts: `:timeout-ms`, default 30000). Holds a reusable `HttpClient`; no network happens until a call. `:token` is the bearer token every call presents. Omitted, it is `VAELII_API_TOKEN` (`guard/api-token`) — the same variable the daemon reads, so a client and a daemon in one environment agree without either being configured; an explicit nil sends no `Authorization` header, which is what an open daemon wants and what a test of the refusal needs.
(health conn)The daemon's liveness reply, {:ok true} — a GET, so it needs no op, and the one
route a daemon answers without the token (serve/open-routes). The header is sent
when the conn holds one all the same: a probe that authenticates where it can is no
worse off, and this way one code path builds every request.
The daemon's liveness reply, `{:ok true}` — a GET, so it needs no op, and the one
route a daemon answers without the token (`serve/open-routes`). The header is sent
when the `conn` holds one all the same: a probe that authenticates where it can is no
worse off, and this way one code path builds every request.(poll conn token cursor)(poll conn token cursor opts)Read a subscription forward from cursor — {:events [...] :cursor n :lagged k}.
opts is {:wait-ms n}, the long poll: the daemon holds the request open that long
waiting for the first event. The read timeout is extended to cover it, which is the
whole of what a long poll costs this client — no second protocol, no held socket of
its own, and nothing about the reply changes.
:lagged is on every reply and is the one field a caller must read: non-zero, the
ring dropped that many events before this poll reached them.
Read a subscription forward from `cursor` — `{:events [...] :cursor n :lagged k}`.
`opts` is `{:wait-ms n}`, the long poll: the daemon holds the request open that long
waiting for the first event. The read timeout is extended to cover it, which is the
whole of what a long poll costs this client — no second protocol, no held socket of
its own, and nothing about the reply changes.
**`:lagged` is on every reply and is the one field a caller must read**: non-zero, the
ring dropped that many events before this poll reached them.(sentexes-matching conn sentence)(sentexes-matching conn sentence context)(unwatch conn token)Drop subscription token; true if there was one. Idempotent.
Drop subscription `token`; true if there was one. Idempotent.
(watch conn)(watch conn goal context)Open a change-feed subscription — {:token t :cursor 0 :max-events n}. With no
goal it is every belief change; with one it is the standing query core/watch takes,
refused identically (:not-watchable) when the goal is not answerable from a moved
region.
Open a change-feed subscription — `{:token t :cursor 0 :max-events n}`. With no
goal it is every belief change; with one it is the standing query `core/watch` takes,
refused identically (`:not-watchable`) when the goal is not answerable from a moved
region.(watchers conn)What the daemon is holding open — one entry per subscription, with its goal, how many
events it has been :delivered, and how many are still :pending on its ring.
Neither is the reader's position, which lives on the client and is a thing the daemon
has no way to know.
What the daemon is holding open — one entry per subscription, with its goal, how many events it has been `:delivered`, and how many are still `:pending` on its ring. Neither is the *reader's* position, which lives on the client and is a thing the daemon has no way to know.
(why conn handle)(why conn handle opts)The proof tree behind handle. opts is core/why's — {:max-depth n} — and it is
the arity a truncated tree is re-asked with: the bound clips a branch to
{:truncated? true}, and without a way to raise it a remote reader can see that a proof
was clipped and never see the rest of it.
The proof tree behind `handle`. `opts` is `core/why`'s — `{:max-depth n}` — and it is
the arity a truncated tree is re-asked with: the bound clips a branch to
`{:truncated? true}`, and without a way to raise it a remote reader can see that a proof
was clipped and never see the rest of it.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 |