Liking cljdoc? Tell your friends :D

vaelii.agents.mcp.overlay

An overlay knowledge loader: a directory's excepts.edn and *.clj files into the base KB at server start, each file into the context contexts.edn names for it. Kept out of vaelii.agents.mcp.server, which calls load-overlay! once, so the server file stays a near copy of the shape a non-overlay deployment would use.

An overlay knowledge loader: a directory's `excepts.edn` and `*.clj` files
into the base KB at server start, each file into the context `contexts.edn`
names for it. Kept out of `vaelii.agents.mcp.server`, which calls
`load-overlay!` once, so the server file stays a near copy of the shape a
non-overlay deployment would use.
raw docstring

default-contextclj

The context an overlay .clj file loads into when contexts.edn names none for it: the overlay's own context by default. A file this map does not name loads here unless contexts.edn says otherwise.

The context an overlay .clj file loads into when contexts.edn names none for
it: the overlay's own context by default. A file this map does not name
loads here unless contexts.edn says otherwise.
sourceraw docstring

except-contextclj

The context excepts.edn's entries are excepted from: CxWell, which every promotable overlay file loads into (directly or by contexts.edn's naming it) and which default-context sees, so an except made here binds CxWell and everything that sees it, default-context included. Independent of default-context: a deployment can route its own files anywhere and still except from CxWell.

The context excepts.edn's entries are excepted from: CxWell, which every
promotable overlay file loads into (directly or by contexts.edn's naming it)
and which default-context sees, so an except made here binds CxWell and
everything that sees it, default-context included. Independent of
default-context: a deployment can route its own files anywhere and still
except from CxWell.
sourceraw docstring

load-overlay!clj

(load-overlay! kb overlay-dir)

Load the overlay knowledge in overlay-dir into kb the way the engine loads a text KB, each .clj file into its own context.

  1. First, if the dir holds excepts.edn — a vector of [sentence context] pairs — each sentence is excepted from except-context (CxWell) by content (utils/except-sentex!), so the except binds CxWell and every context that sees it. Each result is logged — a failure as overlay: WARN except ... not applied — then a count summary; an absent excepts.edn logs overlay: no excepts.edn.
  2. contexts.edn, when present, maps a .clj file's name to the context its forms load into: CxWell for knowledge the deployment intends to promote into a shared, engine-standard context (or an existing middle context CxWell sees, where the vocabulary obviously belongs), default-context for knowledge this overlay keeps to itself. A file it does not name loads into default-context. Each routed file is logged as overlay: <file> -> <context>. A contexts.edn that is not one map of file name to context name is reported as an unreadable file and routes nothing, so every file falls back to default-context.
  3. Then every form of every *.clj file (sorted by filename; the .edn extension keeps excepts.edn and contexts.edn out) goes into its file's context in ONE pass through the engine's loader, eh/load-entries! — what vaelii.core/load-text! and a starter's own files use: order-insensitive, a form refused because what it rests on is further down (or in a later file) is retried while rounds make progress, genlCx edges go first. Every form, comments, rules, genlCx and excepts included. The retry sees only what throws: a form that lands differently for coming early — a reifiable function's term asserted before the function is declared reifiable, stored unminted — is not retried, so for it the file order still matters.

Why a wrapper at all, and only this much:

  • excepts.edn names starter sentexes by content, which no text-KB form can (an (except H) is a handle), so it is applied by except-sentex! ahead of the pass;
  • an overlay file's name is not its context, as an engine KB file's is, so contexts.edn says where each file goes;
  • the pass's assert! records each form's refusal, and the files are read one by one, so the log and the return value name EVERY form and file that did not load, where load-entries! throws for the first;
  • it never throws: what loaded stays loaded, each refusal and unreadable file is logged as overlay: ERROR ..., and server start goes on.

Returns {:excepts [except-sentex! results] :forms n :contexts {file context} :refused [{:form :context :type :message}] :unreadable [{:file :line :message}]}. An excepts entry that is not a two-element [sentence context] vector, or that throws, answers {:status :error :entry entry :message m}.

Load the overlay knowledge in `overlay-dir` into `kb` the way the engine loads a
text KB, each .clj file into its own context.

1. First, if the dir holds excepts.edn — a vector of [sentence context]
   pairs — each sentence is excepted from except-context (CxWell) by
   content (utils/except-sentex!), so the except binds CxWell and every
   context that sees it. Each result is logged — a failure as
   `overlay: WARN except ... not applied` — then a count summary; an absent
   excepts.edn logs `overlay: no excepts.edn`.
2. contexts.edn, when present, maps a .clj file's name to the context its
   forms load into: CxWell for knowledge the deployment intends to promote
   into a shared, engine-standard context (or an existing middle context
   CxWell sees, where the vocabulary obviously belongs), default-context
   for knowledge this overlay keeps to itself. A file it does not name
   loads into default-context. Each routed file is logged as
   `overlay: <file> -> <context>`. A contexts.edn that is not one map of
   file name to context name is reported as an unreadable file and routes
   nothing, so every file falls back to default-context.
3. Then every form of every *.clj file (sorted by filename; the .edn
   extension keeps excepts.edn and contexts.edn out) goes into its file's
   context in ONE pass through the engine's loader, eh/load-entries! —
   what vaelii.core/load-text! and a starter's own files use:
   order-insensitive, a form refused because what it rests on is further
   down (or in a later file) is retried while rounds make progress, genlCx
   edges go first. Every form, comments, rules, genlCx and excepts
   included. The retry sees only what throws: a form that lands
   differently for coming early — a reifiable function's term asserted
   before the function is declared reifiable, stored unminted — is not
   retried, so for it the file order still matters.

Why a wrapper at all, and only this much:
- excepts.edn names starter sentexes by content, which no text-KB form can
  (an `(except H)` is a handle), so it is applied by except-sentex! ahead
  of the pass;
- an overlay file's name is not its context, as an engine KB file's is, so
  contexts.edn says where each file goes;
- the pass's assert! records each form's refusal, and the files are read
  one by one, so the log and the return value name EVERY form and file
  that did not load, where load-entries! throws for the first;
- it never throws: what loaded stays loaded, each refusal and unreadable
  file is logged as `overlay: ERROR ...`, and server start goes on.

Returns {:excepts [except-sentex! results] :forms n :contexts {file context}
:refused [{:form :context :type :message}] :unreadable [{:file :line
:message}]}. An excepts entry that is not a two-element [sentence context]
vector, or that throws, answers {:status :error :entry entry :message m}.
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