L2 · the SCI eval kernel (03). The model's Clojure runs here — in an SCI ctx (one per session), NOT JVM eval. Vars def'd in one eval persist across steps and turns. The loop owns turn/step/message/observation appends; the kernel owns the per-block :eval/added append (the deliberate kernel→store edge).
⚠ SCI 0.8.43 fact (verified): ns resets to user after every separate
eval-string* call, so a standalone (in-ns …) does NOT persist. We instead
bind sci/ns to the session-ns object around EVERY eval — which upholds every
invariant the spec names (vars persist, session isolation, a model (in-ns …)
never strands later evals — the binding re-establishes the session ns each
call) and is pinned by the §7 regression test.
⚠ SCI wraps an exception thrown inside eval in a {:type :sci/error} ExceptionInfo whose CAUSE is the original — so FINAL detection + err->map walk the cause chain.
L2 · the SCI eval kernel (03). The model's Clojure runs here — in an SCI ctx
(one per session), NOT JVM eval. Vars def'd in one eval persist across steps
and turns. The loop owns turn/step/message/observation appends; the kernel
owns the per-block :eval/added append (the deliberate kernel→store edge).
⚠ SCI 0.8.43 fact (verified): *ns* resets to `user` after every separate
`eval-string*` call, so a standalone `(in-ns …)` does NOT persist. We instead
bind `sci/ns` to the session-ns object around EVERY eval — which upholds every
invariant the spec names (vars persist, session isolation, a model `(in-ns …)`
never strands later evals — the binding re-establishes the session ns each
call) and is pinned by the §7 regression test.
⚠ SCI wraps an exception thrown inside eval in a {:type :sci/error} ExceptionInfo
whose CAUSE is the original — so FINAL detection + err->map walk the cause chain.(count-forms ctx code)Count top-level forms with SCI's OWN parser — exactly what eval reads.
Count top-level forms with SCI's OWN parser — exactly what eval reads.
(engine-fn-impls)The host-fn impl map handed to capability/sci-opts (assembled here, threaded by session/start-session!; Phase 3 adds :lm/:rlm/…).
The host-fn impl map handed to capability/sci-opts (assembled here, threaded by session/start-session!; Phase 3 adds :lm/:rlm/…).
(err->map e)The uniform namespaced error map (02 'The error map'). Preserves an explicit :error/type set anywhere in the cause chain (deadline/provider/capability), else :fractal/eval-error; message from the (already-informative) wrapper.
The uniform namespaced error map (02 'The error map'). Preserves an explicit :error/type set anywhere in the cause chain (deadline/provider/capability), else :fractal/eval-error; message from the (already-informative) wrapper.
(eval-batch handle turn-id blocks)Evaluate a step's blocks as a batch. A block that errors STOPS the batch; a block that calls FINAL ends the turn. The kernel appends each :eval/added. Returns RAW recs (raw values intact for render-observation + commit-turn!).
Evaluate a step's blocks as a batch. A block that errors STOPS the batch; a block that calls FINAL ends the turn. The kernel appends each :eval/added. Returns RAW recs (raw values intact for render-observation + commit-turn!).
(eval-block handle code block-index)Evaluate one fenced block in the session's SCI ctx → a RAW eval record. sci/eval-string* REPL-interleaves the block's forms and returns the LAST form's value (verified). sci/out/err capture model IO; sci/ns pins the session ns.
Evaluate one fenced block in the session's SCI ctx → a RAW eval record. sci/eval-string* REPL-interleaves the block's forms and returns the LAST form's value (verified). sci/out/err capture model IO; sci/ns pins the session ns.
(extract-blocks assistant-text)Ordered vector of code strings from fenced clojure blocks. No fence → [].
Ordered vector of code strings from fenced clojure blocks. No fence → [].
(make-FINAL)FINAL — the exception-based turn-return signal (03 §3).
FINAL — the exception-based turn-return signal (03 §3).
(make-inspect)inspect — bounded value viewer. Prints to the SCI out (so §4 capture sees it), returns nil. Bridges by rebinding the host out to @sci/out around println.
inspect — bounded value viewer. Prints to the SCI out (so §4 capture sees it), returns nil. Bridges by rebinding the host *out* to @sci/out around println.
(new-ctx session-id capability-profile engine-fns)(new-ctx session-id capability-profile engine-fns surface-namespaces)Build the session's SCI ctx from its capability profile + the host-fn impls. Creates & registers the session ns (so find-ns resolves it later); every eval then binds sci/ns to it.
Build the session's SCI ctx from its capability profile + the host-fn impls. Creates & registers the session ns (so find-ns resolves it later); every eval then binds sci/ns to it.
(restore-vars! ctx session-id snapshot)Phase 2/4 ONLY (resume/fork). Clear the session ns, then sci/intern each
:ok var DIRECTLY (⛔ never via a (def …) eval — a list/symbol value would be
re-evaluated and corrupt; intern binds the value as data, 03 §6).
Phase 2/4 ONLY (resume/fork). Clear the session ns, then sci/intern each :ok var DIRECTLY (⛔ never via a `(def …)` eval — a list/symbol value would be re-evaluated and corrupt; intern binds the value as data, 03 §6).
(snapshot-vars ctx session-id)A canonical, content-addressable snapshot of the session ns's vars (03 §6). Unrestorable vars are recorded INSIDE the snapshot so it is a faithful, hashable record and equal REPL states dedup.
A canonical, content-addressable snapshot of the session ns's vars (03 §6). Unrestorable vars are recorded INSIDE the snapshot so it is a faithful, hashable record and equal REPL states dedup.
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 |