The artifact layer. Holds live session state, records canonical facts/payloads through session-db, and keeps an in-memory folded view for the active process.
The artifact layer. Holds live session state, records canonical facts/payloads through session-db, and keeps an in-memory folded view for the active process.
(add-event! state event)Emit an annotation/lifecycle event (no row change of its own). Returns the event id for boundary call sites.
Emit an annotation/lifecycle event (no row change of its own). Returns the event id for boundary call sites.
(add-message! state role content)(add-message! state role content turn-id)(add-message! state role content turn-id extra)(checkpoint! state)Boundary hook retained inside the runtime. Canonical persistence already
happened event-by-event in emit!, so there is no automatic filesystem output.
Boundary hook retained inside the runtime. Canonical persistence already happened event-by-event in `emit!`, so there is no automatic filesystem output.
(create-head! state head)Append one immutable completed-state boundary for the session. The current ref advances in Datahike only after the immutable head fact has been written.
Append one immutable completed-state boundary for the session. The current ref advances in Datahike only after the immutable head fact has been written.
(derive-usage-report locator calls)(derive-usage-report locator calls {:keys [turn-id]})Usage at two scopes from the same canonical call facts:
:usage/turn is the completed turn only, including any child sessions that
were invoked by calls in that turn.:usage/cumulative is the whole current session tree up to the selected
head.This is intentionally a read-side projection. It does not change accounting
or create a second cost model; it only slices the existing call rows by
:call/turn-id before applying derive-usage.
Usage at two scopes from the same canonical call facts: - `:usage/turn` is the completed turn only, including any child sessions that were invoked by calls in that turn. - `:usage/cumulative` is the whole current session tree up to the selected head. This is intentionally a read-side projection. It does not change accounting or create a second cost model; it only slices the existing call rows by `:call/turn-id` before applying `derive-usage`.
(emit! state event)Record one event: assign its id and timestamp, write canonical SQLite facts
plus BlobStore payload refs, then fold it into the in-memory view.
Serialized per session so DB event order and the live view stay consistent
under the parallel fanout of map-lm/map-rlm. The reentrant monitor lets
update-turn!/update-call! read-then-emit atomically.
Record one event: assign its id and timestamp, write canonical SQLite facts plus BlobStore payload refs, then fold it into the in-memory view. Serialized per session so DB event order and the live view stay consistent under the parallel fanout of map-lm/map-rlm. The reentrant monitor lets `update-turn!`/`update-call!` read-then-emit atomically.
(new-state! {:keys [id logical-id kind provider parent resumed-from forked-from
cache-id initial-head? alias title origin]
store-root-dir :store-root})Filesystem path helper for artifact-adjacent readers.
Storage authority lives in session-db/store namespaces; this remains a small file helper for read-side compatibility such as eval result readers.
Filesystem path helper for artifact-adjacent readers. Storage authority lives in session-db/store namespaces; this remains a small file helper for read-side compatibility such as eval result readers.
Read an EDN file, returning default when absent.
This delegates to store.io and does not participate in session storage.
Read an EDN file, returning default when absent. This delegates to store.io and does not participate in session storage.
(set-current-head! state head-id)Move the session's current ref to an existing head without creating a new head. Used by same-session restore when a continuation starts from an existing same-session head.
Move the session's current ref to an existing head without creating a new head. Used by same-session restore when a continuation starts from an existing same-session head.
(start-invocation! state invocation)Append the start fact for one RLM session invocation. Leaves never use this; leaf work remains represented only as call rows.
Append the start fact for one RLM session invocation. Leaves never use this; leaf work remains represented only as call rows.
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 |